77 Commits

Author SHA1 Message Date
ba285306d6 fix(segment): set the view to the initial value without scrolling 2024-09-23 15:40:38 -04:00
44e8374791 fix(segment): only call updateSegmentView when gesture ends or button is clicked 2024-09-23 14:29:03 -04:00
00c378f0f5 refactor(segment): link the button and content with content-id and id 2024-09-18 15:32:48 -04:00
8af4d74846 style: lint 2024-09-17 14:17:45 -04:00
fa74077820 fix(segment): animate the highlight with value changes 2024-09-17 13:15:54 -04:00
ee833881da fix(angular): set active segment button when dynamically changing items (#29418)
Issue number: resolves #29414

---------

<!-- 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. -->

In Angular when the segment buttons are dynamically rendered, the
segment will not set the active visual state for the selected segment
after the re-render.

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

- In Angular the segment will set the active item visually when the
items are dynamically changed

Previously this PR:
https://github.com/ionic-team/ionic-framework/pull/28837 aimed to
resolve https://github.com/ionic-team/ionic-framework/issues/28816. I
have confirmed that the modified approach in the dev-build fixes #29414
and #28816 and the previous change is no longer needed.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->


## Other information

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

Dev-build: `8.0.2-dev.11714411675.10f48160`
2024-05-01 17:26:16 +00:00
ca01fe807f docs(core): ionChange will not emit from programmatically changing value (#29407)
Issue number: resolves
https://github.com/ionic-team/ionic-docs/issues/3588

---------

<!-- 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. -->

The documentation around `ionChange` not being emitted when
programmatically changing the property associated to the "value" is
either inconsistent or missing from certain components.

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

- Adds the documentation to the missing components.
- Makes the documentation consistent across components.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2024-04-26 20:16:16 +00:00
0847c2ac2c fix(segment): setting value via binding updates button state (#28837)
Issue number: resolves #28816

---------

<!-- 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. -->

The value is set on Segment asynchronously when binding it in Angular.
However, the timing works out such that the value changes after
`connectedCallback` is fired but before any Stencil Watchers are
configured. As a result, our `value` property watcher does not fire
which causes `ionSelect` to not be emitted. Segment Buttons rely on this
event to know when to update their state (if the value changes such that
a segment button is now selected). This results in a checked segment
button not appearing checked.

This is similar to other issues that have been fixed:

https://github.com/ionic-team/ionic-framework/pull/28510
https://github.com/ionic-team/ionic-framework/pull/28488
https://github.com/ionic-team/ionic-framework/pull/28526

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

- Segment now emits `ionSelect` on `componentDidLoad` so that any
descendant segment buttons can update correctly.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->


## Other information

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

Dev build: `7.6.5-dev.11705415448.16878103`

This is a timing issue with Stencil, so I am unable to write a reliable
automated test. Reviewers should test the dev build in the repro
provided in the linked issue.
2024-01-17 21:17:54 +00:00
8e2f818671 fix(segment): avoid scrolling webkit bug (#28376)
Issue number: resolves #28373

---------


🚨 Reviewers: Please test this on Chrome, Firefox, and Safari

<!-- 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. -->

The fix in
1167a9325f
uncovered a WebKit bug where scrolling an element using `scrollIntoView`
during an accelerated transition causes the segment to jump during the
transition. `scrollIntoView` can cause parent elements to also scroll,
and given that the entering view begins outside the viewport, it's
possible this triggered some sort of WebKit bug where it was trying to
scroll the element into view.

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

- Updated the internal implementation to use `scrollBy` instead of
`scrollIntoView`. `scrollBy` does not attempt to scroll parent elements
which avoids the WebKit issue.
- I also updated the initial scroll to be instant rather than smoothly
scroll. If a segment is added to the DOM, I'd expect it to be added with
the correct scroll position (after the first render that is), so
animating on load seemed like a strange behavior. User interaction will
continue to use smooth scrolling though.

## 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. -->


Dev build: `7.5.2-dev.11697638908.1f04980a`
2023-10-25 18:00:22 +00:00
1167a9325f fix(segment): scroll to active segment-button on first load (#28276)
Issue number: resolves #28096

---------

<!-- 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 a segment button is clicked, the segment will auto-scroll to
position the newly active button fully in view. However, this behavior
does not occur on first load. This means that when a segment is
initialized with a `value` corresponding to an off-screen button, the
button will remain off-screen.

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

The same auto-scroll behavior from button click now also occurs on
component load.

## 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-10-04 17:11:32 +00:00
49b91692fc chore(segment): remove unused import
pointerCoord usage was removed on main.
2023-06-01 12:16:24 -04:00
66d959f5bf Merge remote-tracking branch 'origin/main' into sp/sync-feature-7.1-with-main 2023-06-01 12:10:45 -04:00
01f99597f7 fix(segment): remove duplicate ripple effect on pointerup (#27448)
Issue number: resolves #27338

---------

## What is the current behavior?
Segment button on `md` mode shows two ripple effects: once on
pointerdown and again on pointerup

## What is the new behavior?
Segment button on `md` mode only shows a ripple effect on pointerdown

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

---------

Co-authored-by: Brandy Carney <brandy@ionic.io>
2023-05-24 14:44:37 +00:00
ec95ae5cd3 feat(segment, segment-button): update segment value property to accept numbers (#27222)
Issue number: resolves #27221

---------

## What is the current behavior?

The value property of the segment component in Ionic Framework currently
only accepts string values.

## What is the new behavior?

This pull request updates the "value" property of the segment component
to accept a union of string and number types. This allows for more
versatile data input in the segment component, particularly for users
who work with numerical data.

## Does this introduce a breaking change?

- [ ] Yes
- [X] No

## Other information

N/A
2023-05-24 09:07:57 -05:00
0a0345a84a refactor(many): use utils import (#27160) 2023-04-12 13:25:14 -07:00
3e0a905e81 fix(segment): change event fires when clicking (#27010)
resolves #27002
2023-03-23 16:18:43 -04:00
1a8bd6d8c6 chore(deps): update to stencil v3 (#26663) 2023-01-31 18:07:22 -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
e8fb9e7328 chore(): sync with main 2023-01-23 13:38:16 -05:00
c01600191e chore(): sync with main 2023-01-18 09:36:43 -05:00
77ce9e066e fix(segment): nested interactive is not rendered (#26575) 2023-01-09 13:08:01 -05:00
c2e1ad385d chore(many): replace any types and add tech debt tickets (#26293)
Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
2023-01-06 09:34:55 -06: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
a2d570b7ad fix(segment): scrolling button into view is more consistent (#26369)
resolves #26368
2022-11-30 10:15:48 -05:00
961e1bddd3 chore(): sync with main 2022-11-21 11:37:08 -05:00
73ea64c02f fix(segment): scrollable segments center button on click (#26285)
resolves #25367
2022-11-16 13:58:03 -05:00
70781e4c9f fix(segment): click event triggers ionChange (#26162) 2022-10-24 15:00:17 -04:00
f1cdf18316 chore(): sync with main: 2022-10-11 11:38:27 -04:00
a03c8afb3d feat(segment): ionChange will only emit from user committed changes (#25934) 2022-09-21 10:33:58 -04:00
ae6aa0cb8e chore(eslint): add strict-boolean-expressions rule (#25768) 2022-08-23 11:50:02 -05:00
5676bab316 lint(eslint): migrate to eslint and prettier (#25046) 2022-04-04 11:12:53 -04:00
2940e73a45 fix(segment): setting dir on ion-segment to enable rtl mode now supported (#24601)
Resolves #23978
2022-01-19 15:23:14 -05:00
b6c53e539b feat(segment): add keyboard navigation, add selectOnFocus property to control selection follow focus behavior (#23590)
resolves #23520
2021-07-20 16:45:17 -04:00
932d3ca62f feat(datetime): add calendar picker (#23416)
resolves #19423

BREAKING CHANGE: The `ion-datetime` component has been revamped to use a new calendar style. As a result, some APIs have been removed. See https://github.com/ionic-team/ionic-framework/blob/master/BREAKING.md for more details.
2021-06-16 15:54:15 -04:00
dc430af906 fix(all): reflect color property as an attribute for vue (#23345)
resolves #23323
2021-05-21 19:26:53 -04:00
91ac340ae7 fix(segment, segment-button): use correct tablist and tab roles for screen readers (#23145)
* fix(segment, segment-button): change aria attributes for segment and segment-button

* add axe test

* Add tests, screen reader doc

* add updated screen reader

* fix(segment-button): move aria tags to host

* verify nvda and talkback behavior

* fix(segment-button): remove outline on focus

* Update core/src/components/segment/test/basic/index.html

Co-authored-by: Liam DeBeasi <liamdebeasi@icloud.com>
2021-04-12 09:20:59 -04:00
65bc99577c feat(segment): add swipeGesture property to allow for disabling of the swipe gesture (#22087)
resolves #22048
2020-11-13 12:38:23 -05:00
dd307b60b6 chore(): revert old segment fix in favor of new one (#22434)
This reverts commit 68afc49e9ed27acffb0b765b7be6b03e8574850d.
2020-11-05 11:38:46 -05:00
04161c9512 fix(segment-button): color property is now reactive if previously undefined (#22405)
resolves #20831
2020-10-30 16:25:52 -04:00
68afc49e9e perf(segment): improve scrolling performance on ios when using segment (#22110)
resolves #22095
2020-09-21 15:39:09 -04:00
753fd2f910 chore(colorClass): update createColorClasses() for ts4 (#21896)
Change the createColorClasses() fn so the returned type and jsx class property work well with typescript 4
2020-08-10 09:18:41 -05:00
17308f247f fix(segment): ensure checked classes get set after not having a value (#21547) 2020-06-16 11:22:17 -04:00
314dbb1a4d fix(segment): allow routerLink to work on segment buttons (#20682)
fixes #20678
2020-03-05 12:38:51 -05:00
0224bed0c9 fix(segment): segment functions properly on android 5 (#20554)
fixes #20466
2020-02-24 13:41:49 -05:00
4d50064764 fix(segment): only emit ionChange when user releases pointer from screen (#20495)
fixes #20500
fixes #20257
2020-02-18 15:11:28 -05:00
7a461c59c5 fix(segment): do not show ripple effect if disabled via config (#20542)
fixes #20533
2020-02-18 14:02:34 -05:00
e8886e98f1 fix(segment): add activated class directly to segment button (#20400)
this gets around a bug with Safari where the ::slotted css selector was not working properly
2020-02-07 12:13:09 -05:00
94159291b2 feat(components): improve button states and add new css properties (#19440)
Before users had to know the exact opacity that the MD/iOS spec called for in order to change the hover or focused background color. This allows them to change the background without having to know the opacity. 

- changes apply to Action Sheet (Buttons), Back Button, Button, FAB Button, Item, Menu Button, Segment Button, Tab Button
- greatly reduces the requirement by users to set the background hover, focused states for dark modes and custom themes, also eliminates the need to know what the hover opacity is for each based on the spec
- updates the MD dark theme per their spec
- adds a component guide for internal use changing Ionic components

references #18279 fixes #20213 fixes #19965

BREAKING CHANGE:

*Activated Class*

The `activated` class that is automatically added to buttons on press has been renamed to `ion-activated`. This will be more consistent with our `ion-focused` class we add and also will reduce conflicts with user's CSS.

*CSS Variables*

The `--background-hover`, `--background-focused` and `--background-activated` CSS variables on components that render native buttons will now have an opacity automatically set. If you are setting any of these like the following:

```
--background-hover: rgba(44, 44, 44, 0.08);
```

You will likely not see a hover state anymore. It should be updated to only set the desired color:

```
--background-hover: rgba(44, 44, 44);
```

If the opacity desired is something other than what the spec asks for, use:

```
--background-hover: rgba(44, 44, 44);
--background-hover-opacity: 1;
```
2020-01-23 16:57:47 -05:00
f896821753 fix(segment): clicking disabled button no longer adds ripple to active button (#20254)
fixes #20253
2020-01-21 16:36:41 -05:00