From cecafcd6e305d1d52ebe79ccf5c3da796ed3faeb Mon Sep 17 00:00:00 2001 From: Simeon Simeonoff Date: Wed, 21 Jun 2023 10:39:15 +0300 Subject: [PATCH] refactor(select): deprecate `sameWidth` and `positionStrategy` (#791) * refactor(select): deprecate `sameWidth` and `positionStrategy` Change position strategy from `absolute` to `fixed`. Closes #789 --------- Co-authored-by: Stamen Stoychev Co-authored-by: Damyan Petev Co-authored-by: Radoslav Karaivanov --- CHANGELOG.md | 4 ++++ src/components/select/select.spec.ts | 2 +- src/components/select/select.ts | 7 +++++++ stories/select.stories.ts | 4 ++-- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ceb4a690..335f80de9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Deprecated + +- Select: Removed `sameWidth` and `positinStrategy`. They will be removed in the next major release. + ### Added - Combo: Added `matchDiacritics` to the filtering options property. Defaults to `false`. diff --git a/src/components/select/select.spec.ts b/src/components/select/select.spec.ts index d528a8650..55988f733 100644 --- a/src/components/select/select.spec.ts +++ b/src/components/select/select.spec.ts @@ -721,7 +721,7 @@ describe('Select component', () => { await elementUpdated(select); - expect(select.positionStrategy).to.eq('absolute'); + expect(select.positionStrategy).to.eq('fixed'); expect(select.placement).to.eq('bottom-start'); expect(select.open).to.be.true; diff --git a/src/components/select/select.ts b/src/components/select/select.ts index 00a859e63..d1b13ecdd 100644 --- a/src/components/select/select.ts +++ b/src/components/select/select.ts @@ -185,8 +185,15 @@ export default class IgcSelectComponent extends EventEmitterMixin< @property() public placeholder!: string; + /** + * @deprecated since version 5.0. It will be removed in the next major release. + * @hidden @internal + */ + public override positionStrategy: 'absolute' | 'fixed' = 'fixed'; + /** * Whether the dropdown's width should be the same as the target's one. + * @deprecated since version 5.0. It will be removed in the next major release. * @attr same-width */ @property({ type: Boolean, attribute: 'same-width' }) diff --git a/stories/select.stories.ts b/stories/select.stories.ts index 5512f6127..aad535bad 100644 --- a/stories/select.stories.ts +++ b/stories/select.stories.ts @@ -128,7 +128,7 @@ const metadata: Meta = { description: "Sets the component's positioning strategy.", options: ['absolute', 'fixed'], control: { type: 'inline-radio' }, - defaultValue: 'absolute', + defaultValue: 'fixed', }, flip: { type: 'boolean', @@ -169,7 +169,7 @@ const metadata: Meta = { keepOpenOnOutsideClick: false, open: false, placement: 'bottom-start', - positionStrategy: 'absolute', + positionStrategy: 'fixed', flip: false, distance: '0', sameWidth: true,