53 Commits

Author SHA1 Message Date
a3b825475e feat(datetime): align active datetime font size with ios 17 (#28738)
Issue number: N/A

---------

## What is the current behavior?
The active day in a datetime uses the same font size as the other days.

## What is the new behavior?
Increase the font size of the active day to match the iOS 17 spec. 

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

## Other information

| iOS 17 | Ionic |
| ---| ---|
| ![native
ios](https://github.com/ionic-team/ionic-framework/assets/6577830/d26801cf-2771-4c37-b0f0-64b93017b171)
|
![ionic](https://github.com/ionic-team/ionic-framework/assets/6577830/c73deffe-e7bd-4cc3-a3b9-9ebac0a351c8)
|

> [!NOTE]
> In the above screenshot for Ionic I have added `background:
current-color(base);` to the active day. This code should be there for
"today" but it is not due to a bug
([FW-5808](https://ionic-cloud.atlassian.net/browse/FW-5808)).

---------

Co-authored-by: ionitron <hi@ionicframework.com>
2023-12-20 14:48:51 -05:00
f8067819ee feat(a11y): add dynamic font scaling (#28314)
Issue number: resolves #24638, resolves #18592

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

Developers have requested that Ionic Framework support the dynamic type
feature on iOS for accessibility purposes. Ionic applications do not
respond to font scaling on iOS which can create inaccessible
applications particularly for users with low vision. Ionic apps on
Android devices currently support the Android equivalent due to
functionality in the Chromium webview.

Developers have also requested a way of adjusting the fonts in their
Ionic UI components consistently.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Ionic components now use `rem` instead of `px` where appropriate. This
means devs can change the font size on `html` and the text in supported
Ionic components will scale up/down appropriately
- Add support for Dynamic Type on iOS (the iOS version of Dynamic Font
Scaling)

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

---------

Co-authored-by: Maria Hutt <thetaPC@users.noreply.github.com>
Co-authored-by: Brandy Carney <brandyscarney@users.noreply.github.com>
Co-authored-by: Shawn Taylor <shawn@ionic.io>
Co-authored-by: ionitron <hi@ionicframework.com>
Co-authored-by: Sean Perkins <sean@ionic.io>
Co-authored-by: Sean Perkins <13732623+sean-perkins@users.noreply.github.com>
Co-authored-by: Amanda Johnston <90629384+amandaejohnston@users.noreply.github.com>
2023-10-10 17:38:09 -04:00
8601977aa7 chore: update to latest ionicons (#28315) 2023-10-10 10:09:56 -04:00
597bc3f085 feat(datetime): add support for h11 and h24 hour formats (#28219)
Issue number: resolves #23750

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

Datetime does not support h11 and h24 hour formats

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Datetime supports h11 and h24 formats

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->


Implementation Notes:

1. I broke up the `is24Hour` function into two functions:
- The first function, `is24Hour`, accepts an hour cycle and returns true
if the hourCycle preference uses a 24 hour format
- The second function, getHourCycle, accepts a locale and an optional
hour cycle and returns the computed hour cycle. I found that the hour
cycle is not always set via `hourCycle` (such as when we are using the
system default if it's specified in the `locale` prop using locale
extension tags). This was coupled to is24Hour, but I needed this
functionality elsewhere to add support for this feature, so I decided to
break the functions up.
2. We were using the hour cycle types in several places, so I decided to
create a shared `DatetimeHourCycle` to avoid accidental typos.
2023-09-28 11:40:46 -04:00
79b005da70 feat(datetime): add parts for calendar day, active, and today (#27641)
Issue number: resolves #25340

---------

- Exposes the following parts for a calendar day: `calendar-day`,
`today`, and `active`
- Combines the `calendar-day-highlight` element with the `calendar-day`
element so developers don't have to know to style two different elements
& we don't have to expose them as separate parts
- Improves height parity of the calendar day across browsers
- Updates the `custom` e2e test to include an example of styling days
using the newly exposed CSS parts
- Adds tests for the focus states of the calendar day
2023-09-06 11:58:41 -04:00
32244fbdd1 fix(datetime): scroll to newly selected date when value changes (#27806)
Issue number: Resolves #26391

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

When updating the `value` programmatically on an `ion-datetime` after it
has already been created:
- With grid style: The selected date visually updates, but the calendar
does not scroll to the newly selected month.
- With wheel style: The selected date does not visually update, i.e. the
wheels do not move to show the newly selected date.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Grid style datetimes now scroll to the selected date using the same
animation as when clicking the next/prev month buttons.
- This animation mirrors the behavior in both MUI and native iOS. See
the [design
doc](https://github.com/ionic-team/ionic-framework-design-documents/blob/main/projects/ionic-framework/components/datetime/0003-datetime-async-value.md)
for more information and screen recordings.
- The animation will not occur if the month/year did not change, or when
the datetime is hidden.
- Wheel style datetimes now visually update to the selected date. No
animation occurs, also mirroring native.
- The `parseDate` util has also had its type signatures updated to
account for returning `undefined` when the date string is improperly
formatted. This was missed when the util was refactored to support
multiple date selection.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

- Docs PR: https://github.com/ionic-team/ionic-docs/pull/3053
- While this can technically be considered a bug fix, we are merging it
into a feature branch for safety; it's a fairly significant change to
how datetime behaves, and may interfere with custom logic when updating
a datetime's value async.
- Jumping to the newly selected value is handled by replacing everything
[here](https://github.com/ionic-team/ionic-framework/pull/27806/files#diff-4a407530c60e3cf72bcc11acdd21c4803a94bf47ea81b99e757db1c93d2735b8L364-L407)
with `processValue()`. This covers both wheel and grid datetimes.
- `activePartsClone` as a whole was also removed. It was added in
https://github.com/ionic-team/ionic-framework/pull/24244 to enable
changing `activeParts` without triggering a rerender (and thus jumping
to the new value) but since we now want to do that jump, the clone is no
longer needed.
- The animation code might be tricky to follow, so I recorded going
through it:
https://github.com/ionic-team/ionic-framework/assets/90629384/1afa5762-f493-441a-b662-f0429f2d86a7
2023-08-23 13:49:19 -05:00
bd1910ba69 fix(datetime-button): render correct text when passing partial date values (#27816)
Issue number: resolves #27797

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

Datetime Button passes a parsed value to one of the many text formatting
utilities we have, such as `getMonthAndYear`. However, developers can
pass partial date values such as `2022` or `2022-04` (April 2022).
According to
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format,
these are still valid date strings.

However, the `parseDate` utility does not add fallback values. So
passing `2022` will cause the `day` and `month` fields to be
`undefined`. This means that `getNormalizedDate` passes `'//2022'` to
the `Date` constructor.

Some browsers, such as Chrome, will automatically account for the stray
slashes and still return a valid date. Other browsers, such as Safari,
do not do this and will either return "Invalid Date" or throw an error.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Date normalizing utility now has fallback values so we always pass in
a valid date. In the example above, `getNormalizedDate` will now pass
`'1/1/2022'` instead of `'//2022'` to the `Date` constructor.
- Refactored other utils that use `new Date` to make use of
`getNormalizedDate` since they are also impacted.

Note: I added an E2E test instead of a spec test because I want to test
cross-browser behavior to ensure consistency.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2023-08-01 15:44:05 +00:00
19ec41c965 chore: sync with main 2023-05-16 10:26:41 -04:00
7b7e05aa69 fix(datetime-button): log error if non-datetime instance is passed (#27456)
Issue number: N/A

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

An issue was filed in
https://github.com/ionic-team/ionic-framework/issues/27452 where the
`presentation` property was not being respected. The problem ended up
being that the ID passed to `ion-datetime-button` was not associated
with an `ion-datetime` instance, so it did not pick up on the
`presentation` property. I think we can handle this better by logging an
error if the ID passed does not belong to an `ion-datetime`.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Log an error if the ID passed to `ion-datetime-button` exists but does
not belong to an `ion-datetime` instance.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2023-05-12 15:15:50 +00:00
10d2c75f8d Merge remote-tracking branch 'origin/main' into chore/sync-with-main-5-3 2023-05-03 13:38:03 -04:00
945624c0db test(datetime-button): migrate to generators (#27307)
Issue number: N/A

---------

<!-- Please refer to our contributing documentation for any questions on
submitting a pull request, or let us know here if you need any help:
https://ionicframework.com/docs/building/contributing -->

<!-- Some docs updates need to be made in the `ionic-docs` repo, in a
separate PR. See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation
for details. -->

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

Datetime button tests use the legacy syntax

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Datetime button tests use the generator syntax

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2023-04-27 20:54:53 +00:00
4826a3d9f5 test(config): introduce legacy and modern playwright projects (#27228)
Issue number: N/A

---------

<!-- Please refer to our contributing documentation for any questions on
submitting a pull request, or let us know here if you need any help:
https://ionicframework.com/docs/building/contributing -->

<!-- Some docs updates need to be made in the `ionic-docs` repo, in a
separate PR. See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation
for details. -->

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

This is the first PR to introduce the infrastructure required to add
test generators to the Ionic Framework project. This PR introduces the
file name changes necessary to support two playwright configs, so I
recommend reviewing the PR by commit:


1e5012cea1

- Created a `playwright.config-legacy.ts` file and updates
`package.json`.
- Running `npm run test.e2e` will run the generator tests, and running
`npm run test.e2e.legacy` will run the legacy tests.


4fe8de7df7

- Updates the GitHub Action scripts to run both the modern and legacy
E2E tests. I added command modifiers to avoid collisions with output
directories.


e8bcfaf926

- Updates `*.e2e.ts` files to have the legacy format name:
`*.e2e-legacy.ts`. This naming scheme is required for the two Playwright
configs to pull in the correct files. When migrating tests to
generators, team members will rename the file to remove the `-legacy`
part.


5bf196c36d
(warning: lots of files!)

- Updates the `*.e2e.ts-snapshots` directories to have the legacy format
name: `*.e2e-legacy.ts-snapshots`. The screenshot directory in
Playwright is generated based on the test file name which is why we are
updating the screenshot directory. When migrating tests to generators,
team members will rename the directory to remove the `-legacy` part.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2023-04-26 18:27:17 +00:00
0ac451998c test(many): do not await page.locator (#27267)
Issue number: N/A

---------

<!-- Please refer to our contributing documentation for any questions on
submitting a pull request, or let us know here if you need any help:
https://ionicframework.com/docs/building/contributing -->

<!-- Some docs updates need to be made in the `ionic-docs` repo, in a
separate PR. See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation
for details. -->

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

`page.locator` is synchronous, but we were `await`ing the calls:
https://playwright.dev/docs/api/class-page#page-locator

We were also doing `page.locator(...).click()` when we can just do
`page.click([selector])` directly,

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Removes `await` usage from `page.locator`
- Removes `page.locator().click()` usage in favor of `page.click()`

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2023-04-25 12:26:17 +00:00
0a0345a84a refactor(many): use utils import (#27160) 2023-04-12 13:25:14 -07:00
eb10a2e5f6 chore(): sync with main 2023-03-24 14:37:39 -04:00
53af005122 chore(deps-dev): bump @playwright/test from 1.31.2 to 1.32.0 in /core (#27003) 2023-03-23 12:44:59 -04:00
3f888c0928 chore(): sync with main 2023-03-03 12:00:21 -05:00
89a465c9ea chore(playwright): update to v1.31.1 (#26869) 2023-03-02 13:43:29 -05:00
799871e95d chore(): sync with main 2023-02-22 10:00:56 -05:00
804e54e5ca test(many): migrate to new toHaveScreenshot API (#26797) 2023-02-16 11:37:29 -05:00
e028d13a1b chore(many): import types from source path (#26718) 2023-02-02 11:40:51 -05:00
b78b454e08 revert(): revert base components feature (#26692)
The Ionic Framework team would like to re-evaluate our approach to improving customization options when building mobile applications. We are looking at other solutions that a) make customizing an app UI easier and b) are applicable to a broader set of developers.
2023-01-30 11:52:36 -05:00
18f109c7da feat(base-components): add ability to remove ios and md theme (#26669) 2023-01-24 16:18:35 -05:00
d54b9dfdc0 chore(): sync with main 2022-12-20 10:44:26 -05:00
bd05fccf58 test(config): update to playwright 1.29.0 (#26388) 2022-12-20 09:26:51 -05:00
88e7ee985d chore(): sync with main 2022-12-09 12:37:06 -05:00
3481c44b2f test(many): add await to async asserts (#26456) 2022-12-09 10:36:19 -05:00
b18a193684 chore(): sync with main 2022-12-08 12:39:38 -05:00
fcfbcdbc20 fix(datetime): md highlight does not clip at start or end of month (#26366)
Resolves #24891
2022-12-06 13:43:44 -05:00
acb12b36ee Merge remote-tracking branch 'origin/main' into chore/sync-7.0-with-main-12-05-22 2022-12-05 11:25:10 -05:00
1a5ee2f30f test(config): remove playwright diff threshold (#26405) 2022-12-05 11:08:59 -05:00
f06e438db3 test(config): reduce diff threshold to 0.0025 (#26387) 2022-12-01 10:26:14 -05:00
df6064e986 test(config): reduce playwright pixel threshold to 0.005 (#26375) 2022-11-30 12:25:49 -05:00
ce2e37b1a1 fix(angular): null values are not converted to falsy value (#26341)
BREAKING CHANGE:

Datetime:

Passing the empty string to the `value` property will now error as it is not a valid ISO-8601 value.

Angular:

`null` values on form components will no longer be converted to the empty string (`''`) or `false`. This impacts `ion-checkbox`, `ion-datetime`, `ion-input`, `ion-radio`, `ion-radio-group`, ion-range`, `ion-searchbar`, `ion-segment`, `ion-select`, `ion-textarea`, and `ion-toggle`.
2022-11-23 13:03:13 -05:00
c149b42d0b Merge remote-tracking branch 'origin/main' into sync-7-11-15-22 2022-11-15 15:40:21 -05:00
5a701b5b42 test(playwright): reduce diff threshold to 0.01 (#26279) 2022-11-14 15:14:09 -05:00
f13ddcaf47 fix(datetime): fonts now render consistently (#26281) 2022-11-14 12:55:14 -05:00
b470a307e3 chore(): sync with main 2022-11-08 13:13:46 -05:00
bb005956ea fix(overlays): presenting an overlay does not create nested elements (#26154)
Resolves #26117
2022-11-02 16:57:22 -04:00
3fb4caf21f fix(datetime): do not report timezone in ionChange (#26183)
resolves #25577

BREAKING CHANGE:

Datetime no longer incorrectly reports the time zone when `value` is updated. Datetime does not manage time zones, so any time zone information provided is ignored.
2022-10-31 15:03:14 -04:00
92d7bd5d7d Merge remote-tracking branch 'origin/main' into sync-feature-10-21 2022-10-21 14:36:30 -04:00
51ab5f67b5 fix(datetime): empty string is treated as no value (#26131)
resolves #26116
2022-10-17 15:01:27 -04:00
cc2af202a9 feat(datetime): ionChange will only emit from user committed changes (#26083)
resolves #20873 resolves #24452

BREAKING CHANGE

- `ionChange` is no longer emitted when the `value` property of `ion-datetime` is modified externally. `ionChange` is only emitted from user committed changes, such as clicking or tapping a date.

- Datetime no longer automatically adjusts the `value` property when passed an array and `multiple="false"`. Developers should update their apps to ensure they are using the API correctly.
2022-10-11 17:17:52 -04:00
5242dad473 chore(): add updated snapshots 2022-09-30 17:28:13 +00:00
25e6fe92b1 chore(): sync with main 2022-09-30 12:29:00 -04:00
fd658514b5 test(config): lower pixel diff threshold to 0.02 (#26010) 2022-09-26 12:33:27 -04:00
12b8a0cab8 test(config): lower pixel diff threshold to 0.03 (#26004) 2022-09-26 08:48:12 -04:00
21b1ca5041 test(config): lower pixel diff threshold to 0.04 (#26002) 2022-09-23 17:35:25 -04:00
a56a4a9c05 feat(datetime-button): support multiple date selection (#25971) 2022-09-21 11:29:56 -04:00
8a1b3c5f30 feat(datetime): add header text to multiple selection; improve header consistency between modes (#25817)
Co-authored-by: Sean Perkins <sean@ionic.io>
2022-08-29 11:18:45 -05:00