diff --git a/.changeset/spotty-boxes-do.md b/.changeset/spotty-boxes-do.md new file mode 100644 index 0000000000..fe50aed9ef --- /dev/null +++ b/.changeset/spotty-boxes-do.md @@ -0,0 +1,5 @@ +--- +"@hashicorp/design-system-components": minor +--- + +`SuperSelect::Multiple` - Added `@resultCountMessage` argument to enable override diff --git a/packages/components/src/components/hds/form/super-select/multiple/base.ts b/packages/components/src/components/hds/form/super-select/multiple/base.ts index 7cf49b15d4..af14647535 100644 --- a/packages/components/src/components/hds/form/super-select/multiple/base.ts +++ b/packages/components/src/components/hds/form/super-select/multiple/base.ts @@ -55,7 +55,10 @@ export default class HdsFormSuperSelectMultipleBase extends Component + Custom result count message + + + + + {{option}} + + + + Form::SuperSelect::Multiple::Field diff --git a/showcase/tests/integration/components/hds/form/super-select/multiple/base-test.js b/showcase/tests/integration/components/hds/form/super-select/multiple/base-test.js index c7a35316b1..81f94458cc 100644 --- a/showcase/tests/integration/components/hds/form/super-select/multiple/base-test.js +++ b/showcase/tests/integration/components/hds/form/super-select/multiple/base-test.js @@ -163,6 +163,25 @@ module( assert.dom('.hds-form-super-select__after-options').doesNotExist(); }); + test('it should render the default after options block with custom result count message when `@resultCountMessage` exists', async function (assert) { + setOptionsData(this); + await render( + hbs`{{option}}` + ); + await click('.hds-form-super-select .ember-basic-dropdown-trigger'); + assert + .dom( + '.hds-form-super-select__after-options .hds-form-super-select__result-count' + ) + .hasText('custom result count message'); + assert + .dom('.hds-form-super-select__after-options .hds-button') + .hasText('Show selected'); + assert + .dom('.hds-form-super-select__after-options .hds-button') + .doesNotHaveTextContaining('Clear selected'); + }); + // MATCH TRIGGER WIDTH test('`@matchTriggerWidth` should be true by default', async function (assert) { diff --git a/website/docs/components/form/super-select/partials/code/component-api.md b/website/docs/components/form/super-select/partials/code/component-api.md index f7f716f8c2..c1a2d5743f 100644 --- a/website/docs/components/form/super-select/partials/code/component-api.md +++ b/website/docs/components/form/super-select/partials/code/component-api.md @@ -185,6 +185,9 @@ The default values of some [ember-power-select](https://ember-power-select.com/d Sets the content of the default `afterOptions` component overriding the default content. + + Overrides the default result count message. The default message follows this pattern: X selected of Y total. + Defaults to true instead for `SuperSelect::Single`.