From f6860c4bb7f7bc86ed09e25815ebb1a0d6b85eec Mon Sep 17 00:00:00 2001 From: Robin Van Roy <46923671+thatdudemanguy@users.noreply.github.com> Date: Wed, 20 Aug 2025 08:59:56 +0200 Subject: [PATCH] amount-dropdown small fixes (#2561) * chore(amountDropdown): export types. * chore(amountDropdown): remove opinionated styling. * chore(amountDropdown): changeset. * chore(amountDropdown): props.styling optional * chore(amountDropdown): fix tests. --- .changeset/strange-islands-judge.md | 5 +++++ .../input-amount-dropdown/src/LionInputAmountDropdown.js | 5 +---- .../test-suites/LionInputAmountDropdown.suite.js | 1 - .../test/LionInputAmountDropdown.test.js | 7 ++++--- .../ui/components/input-amount-dropdown/types/index.ts | 2 +- packages/ui/exports/types/input-amount-dropdown.ts | 9 +++++++++ 6 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 .changeset/strange-islands-judge.md create mode 100644 packages/ui/exports/types/input-amount-dropdown.ts diff --git a/.changeset/strange-islands-judge.md b/.changeset/strange-islands-judge.md new file mode 100644 index 000000000..83b42ad2a --- /dev/null +++ b/.changeset/strange-islands-judge.md @@ -0,0 +1,5 @@ +--- +'@lion/ui': patch +--- + +exports amount-dropdown types diff --git a/packages/ui/components/input-amount-dropdown/src/LionInputAmountDropdown.js b/packages/ui/components/input-amount-dropdown/src/LionInputAmountDropdown.js index 481d0896d..e7dd30dbe 100644 --- a/packages/ui/components/input-amount-dropdown/src/LionInputAmountDropdown.js +++ b/packages/ui/components/input-amount-dropdown/src/LionInputAmountDropdown.js @@ -101,9 +101,6 @@ export class LionInputAmountDropdown extends LionInputAmount { const refs = { dropdown: { ref: this.refs.dropdown, - props: { - style: `height: 100%;`, - }, listeners: { change: this._onDropdownValueChange, 'model-value-changed': this._onDropdownValueChange, @@ -159,7 +156,7 @@ export class LionInputAmountDropdown extends LionInputAmount { ${ref(refs?.dropdown?.ref)} aria-label="${refs?.dropdown?.labels?.selectCurrency}" @change="${refs?.dropdown?.listeners?.change}" - style="${refs?.dropdown?.props?.style}" + style="${ifDefined(refs?.dropdown?.props?.style)}" > ${data?.regionMetaListPreferred?.length ? html` diff --git a/packages/ui/components/input-amount-dropdown/test-suites/LionInputAmountDropdown.suite.js b/packages/ui/components/input-amount-dropdown/test-suites/LionInputAmountDropdown.suite.js index e9eeb89f9..018c5e171 100644 --- a/packages/ui/components/input-amount-dropdown/test-suites/LionInputAmountDropdown.suite.js +++ b/packages/ui/components/input-amount-dropdown/test-suites/LionInputAmountDropdown.suite.js @@ -150,7 +150,6 @@ export function runInputAmountDropdownSuite({ klass } = { klass: LionInputAmount // @ts-expect-error [allow-protected] 'model-value-changed': el._onDropdownValueChange, }, - props: { style: 'height: 100%;' }, ref: { value: dropdownNode, }, diff --git a/packages/ui/components/input-amount-dropdown/test/LionInputAmountDropdown.test.js b/packages/ui/components/input-amount-dropdown/test/LionInputAmountDropdown.test.js index 44a7e91c1..3f31ce613 100644 --- a/packages/ui/components/input-amount-dropdown/test/LionInputAmountDropdown.test.js +++ b/packages/ui/components/input-amount-dropdown/test/LionInputAmountDropdown.test.js @@ -8,6 +8,7 @@ import { LionOption } from '@lion/ui/listbox.js'; import { ref } from 'lit/directives/ref.js'; import { html } from 'lit'; +import { ifDefined } from 'lit/directives/if-defined.js'; import { isActiveElement } from '../../core/test-helpers/isActiveElement.js'; import { ScopedElementsMixin } from '../../core/src/ScopedElementsMixin.js'; import '@lion/ui/define/lion-input-amount-dropdown.js'; @@ -43,7 +44,7 @@ class WithFormControlInputAmountDropdown extends ScopedElementsMixin(LionInputAm label="${refs?.dropdown?.labels?.country}" label-sr-only @model-value-changed="${refs?.dropdown?.listeners['model-value-changed']}" - style="${refs?.dropdown?.props?.style}" + style="${ifDefined(refs?.dropdown?.props?.style)}" > ${repeat( data.regionMetaList, @@ -81,7 +82,7 @@ describe('WithFormControlInputAmountDropdown', () => { label="${refs?.dropdown?.labels?.country}" label-sr-only @model-value-changed="${refs?.dropdown?.listeners['model-value-changed']}" - style="${refs?.dropdown?.props?.style}" + style="${ifDefined(refs?.dropdown?.props?.style)}" interaction-mode="mac" > ${repeat( @@ -134,7 +135,7 @@ describe('WithFormControlInputAmountDropdown', () => { label="${refs?.dropdown?.labels?.country}" label-sr-only @model-value-changed="${refs?.dropdown?.listeners['model-value-changed']}" - style="${refs?.dropdown?.props?.style}" + style="${ifDefined(refs?.dropdown?.props?.style)}" interaction-mode="windows/linux" > ${repeat( diff --git a/packages/ui/components/input-amount-dropdown/types/index.ts b/packages/ui/components/input-amount-dropdown/types/index.ts index 827d68d69..d607a2864 100644 --- a/packages/ui/components/input-amount-dropdown/types/index.ts +++ b/packages/ui/components/input-amount-dropdown/types/index.ts @@ -26,7 +26,7 @@ export type TemplateDataForDropdownInputAmount = { refs: { dropdown: RefTemplateData & { ref: DropdownRef; - props: { style: string }; + props?: { style?: string }; listeners: { change: (event: OnDropdownChangeEvent) => void; 'model-value-changed': (event: OnDropdownChangeEvent) => void; diff --git a/packages/ui/exports/types/input-amount-dropdown.ts b/packages/ui/exports/types/input-amount-dropdown.ts new file mode 100644 index 000000000..d2a9585e5 --- /dev/null +++ b/packages/ui/exports/types/input-amount-dropdown.ts @@ -0,0 +1,9 @@ +export { + RegionMeta, + TemplateDataForDropdownInputAmount, + AmountDropdownModelValue, + CurrencyCode, + countryToCurrencyList, + RegionToCurrencyMap, + AllCurrenciesSet +} from '../../components/input-amount-dropdown/types/index.js'; \ No newline at end of file