@hashicorp/design-system-components 4.14.0 → 4.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declarations/components/hds/accordion/item/index.d.ts +3 -3
- package/declarations/components/hds/accordion/item/index.d.ts.map +1 -1
- package/declarations/components/hds/alert/description.d.ts +0 -1
- package/declarations/components/hds/alert/description.d.ts.map +1 -1
- package/declarations/components/hds/alert/index.d.ts +2 -2
- package/declarations/components/hds/alert/index.d.ts.map +1 -1
- package/declarations/components/hds/app-footer/item.d.ts +0 -1
- package/declarations/components/hds/app-footer/item.d.ts.map +1 -1
- package/declarations/components/hds/app-footer/link.d.ts +0 -1
- package/declarations/components/hds/app-footer/link.d.ts.map +1 -1
- package/declarations/components/hds/app-footer/status-link.d.ts +1 -1
- package/declarations/components/hds/app-footer/status-link.d.ts.map +1 -1
- package/declarations/components/hds/app-frame/parts/footer.d.ts +0 -1
- package/declarations/components/hds/app-frame/parts/footer.d.ts.map +1 -1
- package/declarations/components/hds/app-frame/parts/header.d.ts +0 -1
- package/declarations/components/hds/app-frame/parts/header.d.ts.map +1 -1
- package/declarations/components/hds/app-frame/parts/main.d.ts +0 -1
- package/declarations/components/hds/app-frame/parts/main.d.ts.map +1 -1
- package/declarations/components/hds/app-frame/parts/modals.d.ts +0 -1
- package/declarations/components/hds/app-frame/parts/modals.d.ts.map +1 -1
- package/declarations/components/hds/app-frame/parts/sidebar.d.ts +0 -1
- package/declarations/components/hds/app-frame/parts/sidebar.d.ts.map +1 -1
- package/declarations/components/hds/app-header/index.d.ts +7 -7
- package/declarations/components/hds/app-header/index.d.ts.map +1 -1
- package/declarations/components/hds/app-side-nav/index.d.ts +8 -8
- package/declarations/components/hds/app-side-nav/index.d.ts.map +1 -1
- package/declarations/components/hds/app-side-nav/list/back-link.d.ts +0 -1
- package/declarations/components/hds/app-side-nav/list/back-link.d.ts.map +1 -1
- package/declarations/components/hds/app-side-nav/list/index.d.ts +1 -1
- package/declarations/components/hds/app-side-nav/list/index.d.ts.map +1 -1
- package/declarations/components/hds/app-side-nav/list/item.d.ts +0 -1
- package/declarations/components/hds/app-side-nav/list/item.d.ts.map +1 -1
- package/declarations/components/hds/app-side-nav/list/link.d.ts +0 -1
- package/declarations/components/hds/app-side-nav/list/link.d.ts.map +1 -1
- package/declarations/components/hds/app-side-nav/list/title.d.ts +1 -1
- package/declarations/components/hds/app-side-nav/list/title.d.ts.map +1 -1
- package/declarations/components/hds/app-side-nav/portal/index.d.ts +0 -1
- package/declarations/components/hds/app-side-nav/portal/index.d.ts.map +1 -1
- package/declarations/components/hds/app-side-nav/portal/target.d.ts +3 -3
- package/declarations/components/hds/app-side-nav/portal/target.d.ts.map +1 -1
- package/declarations/components/hds/app-side-nav/toggle-button.d.ts +0 -1
- package/declarations/components/hds/app-side-nav/toggle-button.d.ts.map +1 -1
- package/declarations/components/hds/application-state/body.d.ts +0 -1
- package/declarations/components/hds/application-state/body.d.ts.map +1 -1
- package/declarations/components/hds/application-state/footer.d.ts +0 -1
- package/declarations/components/hds/application-state/footer.d.ts.map +1 -1
- package/declarations/components/hds/application-state/media.d.ts +0 -1
- package/declarations/components/hds/application-state/media.d.ts.map +1 -1
- package/declarations/components/hds/button-set/index.d.ts +0 -1
- package/declarations/components/hds/button-set/index.d.ts.map +1 -1
- package/declarations/components/hds/code-block/copy-button.d.ts +0 -1
- package/declarations/components/hds/code-block/copy-button.d.ts.map +1 -1
- package/declarations/components/hds/code-block/description.d.ts +0 -1
- package/declarations/components/hds/code-block/description.d.ts.map +1 -1
- package/declarations/components/hds/code-block/index.d.ts +3 -4
- package/declarations/components/hds/code-block/index.d.ts.map +1 -1
- package/declarations/components/hds/copy/button/index.d.ts +2 -2
- package/declarations/components/hds/copy/button/index.d.ts.map +1 -1
- package/declarations/components/hds/copy/snippet/index.d.ts +2 -2
- package/declarations/components/hds/copy/snippet/index.d.ts.map +1 -1
- package/declarations/components/hds/dialog-primitive/body.d.ts +0 -1
- package/declarations/components/hds/dialog-primitive/body.d.ts.map +1 -1
- package/declarations/components/hds/dialog-primitive/description.d.ts +0 -1
- package/declarations/components/hds/dialog-primitive/description.d.ts.map +1 -1
- package/declarations/components/hds/dialog-primitive/overlay.d.ts +0 -1
- package/declarations/components/hds/dialog-primitive/overlay.d.ts.map +1 -1
- package/declarations/components/hds/dialog-primitive/wrapper.d.ts +0 -1
- package/declarations/components/hds/dialog-primitive/wrapper.d.ts.map +1 -1
- package/declarations/components/hds/disclosure-primitive/index.d.ts +2 -2
- package/declarations/components/hds/disclosure-primitive/index.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/footer.d.ts +0 -1
- package/declarations/components/hds/dropdown/footer.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/header.d.ts +0 -1
- package/declarations/components/hds/dropdown/header.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/list-item/generic.d.ts +0 -1
- package/declarations/components/hds/dropdown/list-item/generic.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/list-item/separator.d.ts +0 -1
- package/declarations/components/hds/dropdown/list-item/separator.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/toggle/button.d.ts +2 -2
- package/declarations/components/hds/dropdown/toggle/button.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/toggle/chevron.d.ts +0 -1
- package/declarations/components/hds/dropdown/toggle/chevron.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/toggle/icon.d.ts +1 -1
- package/declarations/components/hds/dropdown/toggle/icon.d.ts.map +1 -1
- package/declarations/components/hds/flyout/index.d.ts +3 -3
- package/declarations/components/hds/flyout/index.d.ts.map +1 -1
- package/declarations/components/hds/form/checkbox/base.d.ts +0 -1
- package/declarations/components/hds/form/checkbox/base.d.ts.map +1 -1
- package/declarations/components/hds/form/checkbox/field.d.ts +0 -1
- package/declarations/components/hds/form/checkbox/field.d.ts.map +1 -1
- package/declarations/components/hds/form/checkbox/group.d.ts +0 -1
- package/declarations/components/hds/form/checkbox/group.d.ts.map +1 -1
- package/declarations/components/hds/form/error/message.d.ts +0 -1
- package/declarations/components/hds/form/error/message.d.ts.map +1 -1
- package/declarations/components/hds/form/file-input/base.d.ts +0 -1
- package/declarations/components/hds/form/file-input/base.d.ts.map +1 -1
- package/declarations/components/hds/form/file-input/field.d.ts +0 -1
- package/declarations/components/hds/form/file-input/field.d.ts.map +1 -1
- package/declarations/components/hds/form/masked-input/field.d.ts +0 -1
- package/declarations/components/hds/form/masked-input/field.d.ts.map +1 -1
- package/declarations/components/hds/form/radio/base.d.ts +0 -1
- package/declarations/components/hds/form/radio/base.d.ts.map +1 -1
- package/declarations/components/hds/form/radio/field.d.ts +0 -1
- package/declarations/components/hds/form/radio/field.d.ts.map +1 -1
- package/declarations/components/hds/form/radio/group.d.ts +0 -1
- package/declarations/components/hds/form/radio/group.d.ts.map +1 -1
- package/declarations/components/hds/form/radio-card/description.d.ts +0 -1
- package/declarations/components/hds/form/radio-card/description.d.ts.map +1 -1
- package/declarations/components/hds/form/radio-card/group.d.ts +0 -1
- package/declarations/components/hds/form/radio-card/group.d.ts.map +1 -1
- package/declarations/components/hds/form/radio-card/label.d.ts +0 -1
- package/declarations/components/hds/form/radio-card/label.d.ts.map +1 -1
- package/declarations/components/hds/form/select/field.d.ts +0 -1
- package/declarations/components/hds/form/select/field.d.ts.map +1 -1
- package/declarations/components/hds/form/super-select/after-options.d.ts +0 -1
- package/declarations/components/hds/form/super-select/after-options.d.ts.map +1 -1
- package/declarations/components/hds/form/super-select/multiple/base.d.ts +3 -3
- package/declarations/components/hds/form/super-select/multiple/base.d.ts.map +1 -1
- package/declarations/components/hds/form/super-select/option-group.d.ts +2 -1
- package/declarations/components/hds/form/super-select/option-group.d.ts.map +1 -1
- package/declarations/components/hds/form/super-select/placeholder.d.ts +0 -1
- package/declarations/components/hds/form/super-select/placeholder.d.ts.map +1 -1
- package/declarations/components/hds/form/text-input/field.d.ts +1 -1
- package/declarations/components/hds/form/text-input/field.d.ts.map +1 -1
- package/declarations/components/hds/form/textarea/field.d.ts +0 -1
- package/declarations/components/hds/form/textarea/field.d.ts.map +1 -1
- package/declarations/components/hds/form/toggle/base.d.ts +0 -1
- package/declarations/components/hds/form/toggle/base.d.ts.map +1 -1
- package/declarations/components/hds/form/toggle/field.d.ts +0 -1
- package/declarations/components/hds/form/toggle/field.d.ts.map +1 -1
- package/declarations/components/hds/form/toggle/group.d.ts +0 -1
- package/declarations/components/hds/form/toggle/group.d.ts.map +1 -1
- package/declarations/components/hds/form/visibility-toggle/index.d.ts +0 -1
- package/declarations/components/hds/form/visibility-toggle/index.d.ts.map +1 -1
- package/declarations/components/hds/icon/index.d.ts +2 -2
- package/declarations/components/hds/icon/index.d.ts.map +1 -1
- package/declarations/components/hds/modal/index.d.ts +4 -4
- package/declarations/components/hds/modal/index.d.ts.map +1 -1
- package/declarations/components/hds/page-header/actions.d.ts +0 -1
- package/declarations/components/hds/page-header/actions.d.ts.map +1 -1
- package/declarations/components/hds/page-header/badges.d.ts +0 -1
- package/declarations/components/hds/page-header/badges.d.ts.map +1 -1
- package/declarations/components/hds/page-header/description.d.ts +0 -1
- package/declarations/components/hds/page-header/description.d.ts.map +1 -1
- package/declarations/components/hds/page-header/index.d.ts +0 -1
- package/declarations/components/hds/page-header/index.d.ts.map +1 -1
- package/declarations/components/hds/page-header/subtitle.d.ts +0 -1
- package/declarations/components/hds/page-header/subtitle.d.ts.map +1 -1
- package/declarations/components/hds/page-header/title.d.ts +0 -1
- package/declarations/components/hds/page-header/title.d.ts.map +1 -1
- package/declarations/components/hds/pagination/compact/index.d.ts +2 -2
- package/declarations/components/hds/pagination/compact/index.d.ts.map +1 -1
- package/declarations/components/hds/pagination/nav/ellipsis.d.ts +0 -1
- package/declarations/components/hds/pagination/nav/ellipsis.d.ts.map +1 -1
- package/declarations/components/hds/pagination/numbered/index.d.ts +3 -3
- package/declarations/components/hds/pagination/numbered/index.d.ts.map +1 -1
- package/declarations/components/hds/pagination/size-selector/index.d.ts +1 -1
- package/declarations/components/hds/pagination/size-selector/index.d.ts.map +1 -1
- package/declarations/components/hds/popover-primitive/index.d.ts +8 -8
- package/declarations/components/hds/popover-primitive/index.d.ts.map +1 -1
- package/declarations/components/hds/reveal/index.d.ts +2 -2
- package/declarations/components/hds/reveal/index.d.ts.map +1 -1
- package/declarations/components/hds/rich-tooltip/index.d.ts +3 -3
- package/declarations/components/hds/rich-tooltip/index.d.ts.map +1 -1
- package/declarations/components/hds/segmented-group/index.d.ts +0 -1
- package/declarations/components/hds/segmented-group/index.d.ts.map +1 -1
- package/declarations/components/hds/side-nav/base.d.ts +0 -1
- package/declarations/components/hds/side-nav/base.d.ts.map +1 -1
- package/declarations/components/hds/side-nav/header/index.d.ts +0 -1
- package/declarations/components/hds/side-nav/header/index.d.ts.map +1 -1
- package/declarations/components/hds/side-nav/list/back-link.d.ts +0 -1
- package/declarations/components/hds/side-nav/list/back-link.d.ts.map +1 -1
- package/declarations/components/hds/side-nav/list/item.d.ts +0 -1
- package/declarations/components/hds/side-nav/list/item.d.ts.map +1 -1
- package/declarations/components/hds/side-nav/list/link.d.ts +0 -1
- package/declarations/components/hds/side-nav/list/link.d.ts.map +1 -1
- package/declarations/components/hds/side-nav/portal/index.d.ts +0 -1
- package/declarations/components/hds/side-nav/portal/index.d.ts.map +1 -1
- package/declarations/components/hds/side-nav/toggle-button.d.ts +0 -1
- package/declarations/components/hds/side-nav/toggle-button.d.ts.map +1 -1
- package/declarations/components/hds/stepper/task/indicator.d.ts +1 -1
- package/declarations/components/hds/stepper/task/indicator.d.ts.map +1 -1
- package/declarations/components/hds/table/index.d.ts +5 -4
- package/declarations/components/hds/table/index.d.ts.map +1 -1
- package/declarations/components/hds/table/th-button-sort.d.ts +2 -2
- package/declarations/components/hds/table/th-button-sort.d.ts.map +1 -1
- package/declarations/components/hds/table/th-button-tooltip.d.ts +1 -1
- package/declarations/components/hds/table/th-button-tooltip.d.ts.map +1 -1
- package/declarations/components/hds/table/th-selectable.d.ts +3 -3
- package/declarations/components/hds/table/th-selectable.d.ts.map +1 -1
- package/declarations/components/hds/table/th-sort.d.ts +2 -2
- package/declarations/components/hds/table/th-sort.d.ts.map +1 -1
- package/declarations/components/hds/table/th.d.ts +2 -2
- package/declarations/components/hds/table/th.d.ts.map +1 -1
- package/declarations/components/hds/tabs/index.d.ts +8 -8
- package/declarations/components/hds/tabs/index.d.ts.map +1 -1
- package/declarations/components/hds/tabs/panel.d.ts +3 -2
- package/declarations/components/hds/tabs/panel.d.ts.map +1 -1
- package/declarations/components/hds/tabs/tab.d.ts +2 -1
- package/declarations/components/hds/tabs/tab.d.ts.map +1 -1
- package/declarations/components/hds/time/index.d.ts +35 -0
- package/declarations/components/hds/time/index.d.ts.map +1 -0
- package/declarations/components/hds/time/range.d.ts +35 -0
- package/declarations/components/hds/time/range.d.ts.map +1 -0
- package/declarations/components/hds/time/single.d.ts +18 -0
- package/declarations/components/hds/time/single.d.ts.map +1 -0
- package/declarations/components/hds/toast/index.d.ts +0 -1
- package/declarations/components/hds/toast/index.d.ts.map +1 -1
- package/declarations/components/hds/yield/index.d.ts +0 -1
- package/declarations/components/hds/yield/index.d.ts.map +1 -1
- package/declarations/components.d.ts +4 -0
- package/declarations/components.d.ts.map +1 -1
- package/declarations/helpers/hds-format-date.d.ts +18 -0
- package/declarations/helpers/hds-format-date.d.ts.map +1 -0
- package/declarations/helpers/hds-format-relative.d.ts +11 -0
- package/declarations/helpers/hds-format-relative.d.ts.map +1 -0
- package/declarations/modifiers/hds-anchored-position.d.ts +1 -1
- package/declarations/modifiers/hds-anchored-position.d.ts.map +1 -1
- package/declarations/modifiers/hds-clipboard.d.ts +4 -4
- package/declarations/modifiers/hds-clipboard.d.ts.map +1 -1
- package/declarations/modifiers/hds-register-event.d.ts +1 -1
- package/declarations/modifiers/hds-register-event.d.ts.map +1 -1
- package/declarations/modifiers/hds-tooltip.d.ts +4 -4
- package/declarations/modifiers/hds-tooltip.d.ts.map +1 -1
- package/declarations/services/hds-time-types.d.ts +31 -0
- package/declarations/services/hds-time-types.d.ts.map +1 -0
- package/declarations/services/hds-time.d.ts +76 -0
- package/declarations/services/hds-time.d.ts.map +1 -0
- package/declarations/services.d.ts +5 -0
- package/declarations/services.d.ts.map +1 -0
- package/declarations/template-registry.d.ts +13 -0
- package/declarations/template-registry.d.ts.map +1 -1
- package/dist/_app_/components/hds/time/index.js +1 -0
- package/dist/_app_/components/hds/time/range.js +1 -0
- package/dist/_app_/components/hds/time/single.js +1 -0
- package/dist/_app_/helpers/hds-format-date.js +1 -0
- package/dist/_app_/helpers/hds-format-relative.js +1 -0
- package/dist/_app_/services/hds-time.js +1 -0
- package/dist/{_rollupPluginBabelHelpers-KIi_qCIU.js → _rollupPluginBabelHelpers-81503waH.js} +9 -3
- package/dist/_rollupPluginBabelHelpers-81503waH.js.map +1 -0
- package/dist/components/hds/accordion/index.js.map +1 -1
- package/dist/components/hds/accordion/item/button.js +2 -2
- package/dist/components/hds/accordion/item/button.js.map +1 -1
- package/dist/components/hds/accordion/item/index.js +6 -6
- package/dist/components/hds/accordion/item/index.js.map +1 -1
- package/dist/components/hds/accordion/types.js.map +1 -1
- package/dist/components/hds/alert/description.js.map +1 -1
- package/dist/components/hds/alert/index.js +10 -10
- package/dist/components/hds/alert/index.js.map +1 -1
- package/dist/components/hds/alert/title.js.map +1 -1
- package/dist/components/hds/alert/types.js.map +1 -1
- package/dist/components/hds/app-footer/copyright.js.map +1 -1
- package/dist/components/hds/app-footer/index.js.map +1 -1
- package/dist/components/hds/app-footer/item.js.map +1 -1
- package/dist/components/hds/app-footer/legal-links.js.map +1 -1
- package/dist/components/hds/app-footer/link.js.map +1 -1
- package/dist/components/hds/app-footer/status-link.js.map +1 -1
- package/dist/components/hds/app-footer/types.js.map +1 -1
- package/dist/components/hds/app-frame/index.js.map +1 -1
- package/dist/components/hds/app-frame/parts/footer.js.map +1 -1
- package/dist/components/hds/app-frame/parts/header.js.map +1 -1
- package/dist/components/hds/app-frame/parts/main.js.map +1 -1
- package/dist/components/hds/app-frame/parts/modals.js.map +1 -1
- package/dist/components/hds/app-frame/parts/sidebar.js.map +1 -1
- package/dist/components/hds/app-header/home-link.js.map +1 -1
- package/dist/components/hds/app-header/index.js +27 -27
- package/dist/components/hds/app-header/index.js.map +1 -1
- package/dist/components/hds/app-header/menu-button.js +2 -2
- package/dist/components/hds/app-header/menu-button.js.map +1 -1
- package/dist/components/hds/app-side-nav/index.js +48 -48
- package/dist/components/hds/app-side-nav/index.js.map +1 -1
- package/dist/components/hds/app-side-nav/list/back-link.js.map +1 -1
- package/dist/components/hds/app-side-nav/list/index.js +3 -3
- package/dist/components/hds/app-side-nav/list/index.js.map +1 -1
- package/dist/components/hds/app-side-nav/list/item.js.map +1 -1
- package/dist/components/hds/app-side-nav/list/link.js.map +1 -1
- package/dist/components/hds/app-side-nav/list/title.js +4 -4
- package/dist/components/hds/app-side-nav/list/title.js.map +1 -1
- package/dist/components/hds/app-side-nav/portal/index.js.map +1 -1
- package/dist/components/hds/app-side-nav/portal/target.js +14 -14
- package/dist/components/hds/app-side-nav/portal/target.js.map +1 -1
- package/dist/components/hds/app-side-nav/toggle-button.js.map +1 -1
- package/dist/components/hds/application-state/body.js.map +1 -1
- package/dist/components/hds/application-state/footer.js.map +1 -1
- package/dist/components/hds/application-state/header.js.map +1 -1
- package/dist/components/hds/application-state/index.js.map +1 -1
- package/dist/components/hds/application-state/media.js.map +1 -1
- package/dist/components/hds/application-state/types.js.map +1 -1
- package/dist/components/hds/badge/index.js.map +1 -1
- package/dist/components/hds/badge/types.js.map +1 -1
- package/dist/components/hds/badge-count/index.js.map +1 -1
- package/dist/components/hds/badge-count/types.js.map +1 -1
- package/dist/components/hds/breadcrumb/index.js.map +1 -1
- package/dist/components/hds/breadcrumb/item.js.map +1 -1
- package/dist/components/hds/breadcrumb/truncation.js.map +1 -1
- package/dist/components/hds/button/index.js.map +1 -1
- package/dist/components/hds/button/types.js.map +1 -1
- package/dist/components/hds/button-set/index.js.map +1 -1
- package/dist/components/hds/card/container.js.map +1 -1
- package/dist/components/hds/card/types.js.map +1 -1
- package/dist/components/hds/code-block/copy-button.js.map +1 -1
- package/dist/components/hds/code-block/description.js.map +1 -1
- package/dist/components/hds/code-block/index.js +9 -9
- package/dist/components/hds/code-block/index.js.map +1 -1
- package/dist/components/hds/code-block/title.js.map +1 -1
- package/dist/components/hds/code-block/types.js.map +1 -1
- package/dist/components/hds/copy/button/index.js +14 -14
- package/dist/components/hds/copy/button/index.js.map +1 -1
- package/dist/components/hds/copy/button/types.js.map +1 -1
- package/dist/components/hds/copy/snippet/index.js +14 -14
- package/dist/components/hds/copy/snippet/index.js.map +1 -1
- package/dist/components/hds/copy/snippet/types.js.map +1 -1
- package/dist/components/hds/dialog-primitive/body.js.map +1 -1
- package/dist/components/hds/dialog-primitive/description.js.map +1 -1
- package/dist/components/hds/dialog-primitive/footer.js.map +1 -1
- package/dist/components/hds/dialog-primitive/header.js.map +1 -1
- package/dist/components/hds/dialog-primitive/overlay.js.map +1 -1
- package/dist/components/hds/dialog-primitive/types.js.map +1 -1
- package/dist/components/hds/dialog-primitive/wrapper.js.map +1 -1
- package/dist/components/hds/disclosure-primitive/index.js +3 -3
- package/dist/components/hds/disclosure-primitive/index.js.map +1 -1
- package/dist/components/hds/dismiss-button/index.js.map +1 -1
- package/dist/components/hds/dropdown/footer.js.map +1 -1
- package/dist/components/hds/dropdown/header.js.map +1 -1
- package/dist/components/hds/dropdown/index.js +2 -2
- package/dist/components/hds/dropdown/index.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/checkbox.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/checkmark.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/copy-item.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/description.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/generic.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/interactive.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/radio.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/separator.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/title.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/types.js.map +1 -1
- package/dist/components/hds/dropdown/toggle/button.js +4 -4
- package/dist/components/hds/dropdown/toggle/button.js.map +1 -1
- package/dist/components/hds/dropdown/toggle/chevron.js.map +1 -1
- package/dist/components/hds/dropdown/toggle/icon.js +7 -7
- package/dist/components/hds/dropdown/toggle/icon.js.map +1 -1
- package/dist/components/hds/dropdown/toggle/types.js.map +1 -1
- package/dist/components/hds/dropdown/types.js.map +1 -1
- package/dist/components/hds/flyout/body.js.map +1 -1
- package/dist/components/hds/flyout/description.js.map +1 -1
- package/dist/components/hds/flyout/footer.js.map +1 -1
- package/dist/components/hds/flyout/header.js.map +1 -1
- package/dist/components/hds/flyout/index.js +21 -19
- package/dist/components/hds/flyout/index.js.map +1 -1
- package/dist/components/hds/flyout/types.js.map +1 -1
- package/dist/components/hds/form/character-count/index.js.map +1 -1
- package/dist/components/hds/form/checkbox/base.js.map +1 -1
- package/dist/components/hds/form/checkbox/field.js.map +1 -1
- package/dist/components/hds/form/checkbox/group.js.map +1 -1
- package/dist/components/hds/form/error/index.js.map +1 -1
- package/dist/components/hds/form/error/message.js.map +1 -1
- package/dist/components/hds/form/field/index.js +2 -2
- package/dist/components/hds/form/field/index.js.map +1 -1
- package/dist/components/hds/form/field/types.js.map +1 -1
- package/dist/components/hds/form/fieldset/index.js +2 -2
- package/dist/components/hds/form/fieldset/index.js.map +1 -1
- package/dist/components/hds/form/fieldset/types.js.map +1 -1
- package/dist/components/hds/form/file-input/base.js.map +1 -1
- package/dist/components/hds/form/file-input/field.js.map +1 -1
- package/dist/components/hds/form/helper-text/index.js.map +1 -1
- package/dist/components/hds/form/indicator/index.js.map +1 -1
- package/dist/components/hds/form/label/index.js.map +1 -1
- package/dist/components/hds/form/legend/index.js.map +1 -1
- package/dist/components/hds/form/masked-input/base.js +3 -3
- package/dist/components/hds/form/masked-input/base.js.map +1 -1
- package/dist/components/hds/form/masked-input/field.js.map +1 -1
- package/dist/components/hds/form/radio/base.js.map +1 -1
- package/dist/components/hds/form/radio/field.js.map +1 -1
- package/dist/components/hds/form/radio/group.js.map +1 -1
- package/dist/components/hds/form/radio-card/description.js.map +1 -1
- package/dist/components/hds/form/radio-card/group.js.map +1 -1
- package/dist/components/hds/form/radio-card/index.js.map +1 -1
- package/dist/components/hds/form/radio-card/label.js.map +1 -1
- package/dist/components/hds/form/radio-card/types.js.map +1 -1
- package/dist/components/hds/form/select/base.js.map +1 -1
- package/dist/components/hds/form/select/field.js.map +1 -1
- package/dist/components/hds/form/super-select/after-options.js.map +1 -1
- package/dist/components/hds/form/super-select/multiple/base.js +20 -20
- package/dist/components/hds/form/super-select/multiple/base.js.map +1 -1
- package/dist/components/hds/form/super-select/multiple/field.js.map +1 -1
- package/dist/components/hds/form/super-select/option-group.js +4 -3
- package/dist/components/hds/form/super-select/option-group.js.map +1 -1
- package/dist/components/hds/form/super-select/placeholder.js.map +1 -1
- package/dist/components/hds/form/super-select/single/base.js +3 -3
- package/dist/components/hds/form/super-select/single/base.js.map +1 -1
- package/dist/components/hds/form/super-select/single/field.js.map +1 -1
- package/dist/components/hds/form/super-select/types.js.map +1 -1
- package/dist/components/hds/form/text-input/base.js.map +1 -1
- package/dist/components/hds/form/text-input/field.js +9 -9
- package/dist/components/hds/form/text-input/field.js.map +1 -1
- package/dist/components/hds/form/text-input/types.js.map +1 -1
- package/dist/components/hds/form/textarea/base.js.map +1 -1
- package/dist/components/hds/form/textarea/field.js.map +1 -1
- package/dist/components/hds/form/toggle/base.js.map +1 -1
- package/dist/components/hds/form/toggle/field.js.map +1 -1
- package/dist/components/hds/form/toggle/group.js.map +1 -1
- package/dist/components/hds/form/visibility-toggle/index.js.map +1 -1
- package/dist/components/hds/icon/index.js +5 -5
- package/dist/components/hds/icon/index.js.map +1 -1
- package/dist/components/hds/icon/types.js.map +1 -1
- package/dist/components/hds/icon-tile/index.js.map +1 -1
- package/dist/components/hds/icon-tile/types.js.map +1 -1
- package/dist/components/hds/interactive/index.js +2 -2
- package/dist/components/hds/interactive/index.js.map +1 -1
- package/dist/components/hds/link/inline.js.map +1 -1
- package/dist/components/hds/link/standalone.js.map +1 -1
- package/dist/components/hds/link/types.js.map +1 -1
- package/dist/components/hds/menu-primitive/index.js +3 -3
- package/dist/components/hds/menu-primitive/index.js.map +1 -1
- package/dist/components/hds/modal/body.js.map +1 -1
- package/dist/components/hds/modal/footer.js.map +1 -1
- package/dist/components/hds/modal/header.js.map +1 -1
- package/dist/components/hds/modal/index.js +32 -32
- package/dist/components/hds/modal/index.js.map +1 -1
- package/dist/components/hds/modal/types.js.map +1 -1
- package/dist/components/hds/page-header/actions.js.map +1 -1
- package/dist/components/hds/page-header/badges.js.map +1 -1
- package/dist/components/hds/page-header/description.js.map +1 -1
- package/dist/components/hds/page-header/index.js.map +1 -1
- package/dist/components/hds/page-header/subtitle.js.map +1 -1
- package/dist/components/hds/page-header/title.js.map +1 -1
- package/dist/components/hds/pagination/compact/index.js +11 -11
- package/dist/components/hds/pagination/compact/index.js.map +1 -1
- package/dist/components/hds/pagination/info/index.js.map +1 -1
- package/dist/components/hds/pagination/nav/arrow.js +2 -2
- package/dist/components/hds/pagination/nav/arrow.js.map +1 -1
- package/dist/components/hds/pagination/nav/ellipsis.js.map +1 -1
- package/dist/components/hds/pagination/nav/number.js +2 -2
- package/dist/components/hds/pagination/nav/number.js.map +1 -1
- package/dist/components/hds/pagination/numbered/index.js +15 -15
- package/dist/components/hds/pagination/numbered/index.js.map +1 -1
- package/dist/components/hds/pagination/size-selector/index.js +4 -4
- package/dist/components/hds/pagination/size-selector/index.js.map +1 -1
- package/dist/components/hds/pagination/types.js.map +1 -1
- package/dist/components/hds/popover-primitive/index.js +52 -52
- package/dist/components/hds/popover-primitive/index.js.map +1 -1
- package/dist/components/hds/reveal/index.js +4 -4
- package/dist/components/hds/reveal/index.js.map +1 -1
- package/dist/components/hds/reveal/toggle/button.js.map +1 -1
- package/dist/components/hds/rich-tooltip/bubble.js.map +1 -1
- package/dist/components/hds/rich-tooltip/index.js +5 -5
- package/dist/components/hds/rich-tooltip/index.js.map +1 -1
- package/dist/components/hds/rich-tooltip/toggle.js.map +1 -1
- package/dist/components/hds/rich-tooltip/types.js.map +1 -1
- package/dist/components/hds/segmented-group/index.js.map +1 -1
- package/dist/components/hds/separator/index.js.map +1 -1
- package/dist/components/hds/separator/types.js.map +1 -1
- package/dist/components/hds/side-nav/base.js.map +1 -1
- package/dist/components/hds/side-nav/header/home-link.js.map +1 -1
- package/dist/components/hds/side-nav/header/icon-button.js.map +1 -1
- package/dist/components/hds/side-nav/header/index.js.map +1 -1
- package/dist/components/hds/side-nav/index.js +3 -3
- package/dist/components/hds/side-nav/index.js.map +1 -1
- package/dist/components/hds/side-nav/list/back-link.js.map +1 -1
- package/dist/components/hds/side-nav/list/index.js +3 -3
- package/dist/components/hds/side-nav/list/index.js.map +1 -1
- package/dist/components/hds/side-nav/list/item.js.map +1 -1
- package/dist/components/hds/side-nav/list/link.js.map +1 -1
- package/dist/components/hds/side-nav/list/title.js +2 -2
- package/dist/components/hds/side-nav/list/title.js.map +1 -1
- package/dist/components/hds/side-nav/portal/index.js.map +1 -1
- package/dist/components/hds/side-nav/portal/target.js +3 -3
- package/dist/components/hds/side-nav/portal/target.js.map +1 -1
- package/dist/components/hds/side-nav/toggle-button.js.map +1 -1
- package/dist/components/hds/stepper/step/indicator.js.map +1 -1
- package/dist/components/hds/stepper/task/indicator.js.map +1 -1
- package/dist/components/hds/stepper/types.js.map +1 -1
- package/dist/components/hds/table/index.js +26 -26
- package/dist/components/hds/table/index.js.map +1 -1
- package/dist/components/hds/table/td.js.map +1 -1
- package/dist/components/hds/table/th-button-sort.js +4 -4
- package/dist/components/hds/table/th-button-sort.js.map +1 -1
- package/dist/components/hds/table/th-button-tooltip.js +3 -3
- package/dist/components/hds/table/th-button-tooltip.js.map +1 -1
- package/dist/components/hds/table/th-selectable.js +7 -7
- package/dist/components/hds/table/th-selectable.js.map +1 -1
- package/dist/components/hds/table/th-sort.js +4 -4
- package/dist/components/hds/table/th-sort.js.map +1 -1
- package/dist/components/hds/table/th.js +4 -4
- package/dist/components/hds/table/th.js.map +1 -1
- package/dist/components/hds/table/tr.js.map +1 -1
- package/dist/components/hds/table/types.js.map +1 -1
- package/dist/components/hds/tabs/index.js +40 -40
- package/dist/components/hds/tabs/index.js.map +1 -1
- package/dist/components/hds/tabs/panel.js +9 -8
- package/dist/components/hds/tabs/panel.js.map +1 -1
- package/dist/components/hds/tabs/tab.js +6 -5
- package/dist/components/hds/tabs/tab.js.map +1 -1
- package/dist/components/hds/tabs/types.js.map +1 -1
- package/dist/components/hds/tag/index.js.map +1 -1
- package/dist/components/hds/tag/types.js.map +1 -1
- package/dist/components/hds/text/body.js.map +1 -1
- package/dist/components/hds/text/code.js.map +1 -1
- package/dist/components/hds/text/display.js.map +1 -1
- package/dist/components/hds/text/index.js.map +1 -1
- package/dist/components/hds/text/types.js.map +1 -1
- package/dist/components/hds/time/index.js +128 -0
- package/dist/components/hds/time/index.js.map +1 -0
- package/dist/components/hds/time/range.js +66 -0
- package/dist/components/hds/time/range.js.map +1 -0
- package/dist/components/hds/time/single.js +16 -0
- package/dist/components/hds/time/single.js.map +1 -0
- package/dist/components/hds/toast/index.js.map +1 -1
- package/dist/components/hds/tooltip-button/index.js.map +1 -1
- package/dist/components/hds/tooltip-button/types.js.map +1 -1
- package/dist/components/hds/yield/index.js.map +1 -1
- package/dist/components.js +3 -0
- package/dist/components.js.map +1 -1
- package/dist/helpers/hds-format-date.js +29 -0
- package/dist/helpers/hds-format-date.js.map +1 -0
- package/dist/helpers/hds-format-relative.js +29 -0
- package/dist/helpers/hds-format-relative.js.map +1 -0
- package/dist/helpers/hds-link-to-models.js.map +1 -1
- package/dist/helpers/hds-link-to-query.js.map +1 -1
- package/dist/instance-initializers/load-sprite.js.map +1 -1
- package/dist/modifiers/hds-anchored-position.js +12 -8
- package/dist/modifiers/hds-anchored-position.js.map +1 -1
- package/dist/modifiers/hds-clipboard.js.map +1 -1
- package/dist/modifiers/hds-register-event.js +4 -4
- package/dist/modifiers/hds-register-event.js.map +1 -1
- package/dist/modifiers/hds-tooltip.js +19 -19
- package/dist/modifiers/hds-tooltip.js.map +1 -1
- package/dist/services/hds-time-types.js +2 -0
- package/dist/services/hds-time-types.js.map +1 -0
- package/dist/services/hds-time.js +215 -0
- package/dist/services/hds-time.js.map +1 -0
- package/dist/services.js +2 -0
- package/dist/services.js.map +1 -0
- package/dist/styles/@hashicorp/design-system-components.css +101 -114
- package/dist/styles/@hashicorp/design-system-components.scss +1 -0
- package/dist/styles/components/alert.scss +0 -1
- package/dist/styles/components/app-side-nav/index.scss +4 -4
- package/dist/styles/components/badge-count.scss +6 -5
- package/dist/styles/components/badge.scss +11 -9
- package/dist/styles/components/code-block/index.scss +1 -1
- package/dist/styles/components/copy/index.scss +2 -2
- package/dist/styles/components/dropdown.scss +14 -7
- package/dist/styles/components/icon-tile.scss +19 -23
- package/dist/styles/components/link/index.scss +2 -2
- package/dist/styles/components/link/standalone.scss +5 -4
- package/dist/styles/components/page-header.scss +4 -1
- package/dist/styles/components/side-nav/index.scss +6 -6
- package/dist/styles/components/stepper/index.scss +2 -2
- package/dist/styles/components/stepper/step-indicator.scss +14 -12
- package/dist/styles/components/stepper/task-indicator.scss +5 -3
- package/dist/styles/components/tabs.scss +4 -3
- package/dist/styles/components/time.scss +13 -0
- package/dist/styles/mixins/_button.scss +11 -9
- package/dist/utils/hds-aria-described-by.js +3 -3
- package/dist/utils/hds-aria-described-by.js.map +1 -1
- package/dist/utils/hds-get-element-id.js.map +1 -1
- package/package.json +14 -6
- package/dist/_rollupPluginBabelHelpers-KIi_qCIU.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty, a as _defineProperty } from '../../../../_rollupPluginBabelHelpers-
|
|
1
|
+
import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty, a as _defineProperty } from '../../../../_rollupPluginBabelHelpers-81503waH.js';
|
|
2
2
|
import Component from '@glimmer/component';
|
|
3
3
|
import { tracked } from '@glimmer/tracking';
|
|
4
4
|
import { action } from '@ember/object';
|
|
@@ -27,7 +27,7 @@ let HdsPaginationCompact = (_class = class HdsPaginationCompact extends Componen
|
|
|
27
27
|
// at rendering time, but from that moment on it's not updated anymore, no matter what interaction the user
|
|
28
28
|
// has with the component (the state is controlled externally, eg. via query parameters)
|
|
29
29
|
_initializerDefineProperty(this, "_currentPageSize", _descriptor, this);
|
|
30
|
-
_initializerDefineProperty(this, "
|
|
30
|
+
_initializerDefineProperty(this, "_isControlled", _descriptor2, this);
|
|
31
31
|
_defineProperty(this, "showLabels", this.args.showLabels ?? true);
|
|
32
32
|
// if the labels for the "prev/next" controls are visible
|
|
33
33
|
_defineProperty(this, "showSizeSelector", this.args.showSizeSelector ?? false);
|
|
@@ -44,11 +44,11 @@ let HdsPaginationCompact = (_class = class HdsPaginationCompact extends Componen
|
|
|
44
44
|
// initialized and updated using the arguments passed to it.
|
|
45
45
|
|
|
46
46
|
if (queryFunction === undefined) {
|
|
47
|
-
this.
|
|
47
|
+
this._isControlled = false;
|
|
48
48
|
} else {
|
|
49
49
|
assert('@model, @models, or @route for "Hds::Pagination::Compact" must be provided when using the `@queryFunction` argument', this.args.model !== undefined || this.args.models !== undefined || this.args.route !== undefined);
|
|
50
50
|
assert('@queryFunction for "Hds::Pagination::Compact" must be a function', typeof queryFunction === 'function');
|
|
51
|
-
this.
|
|
51
|
+
this._isControlled = true;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
// we assert that `this.pageSizes` will always be an array with at least one item
|
|
@@ -72,14 +72,14 @@ let HdsPaginationCompact = (_class = class HdsPaginationCompact extends Componen
|
|
|
72
72
|
// For this reason the "get" and "set" methods always read from or write to the private internal state (_variable).
|
|
73
73
|
|
|
74
74
|
get currentPageSize() {
|
|
75
|
-
if (this.
|
|
75
|
+
if (this._isControlled) {
|
|
76
76
|
return this.args.currentPageSize;
|
|
77
77
|
} else {
|
|
78
78
|
return this._currentPageSize;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
set currentPageSize(value) {
|
|
82
|
-
if (this.
|
|
82
|
+
if (this._isControlled) ; else {
|
|
83
83
|
this._currentPageSize = value;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -91,7 +91,7 @@ let HdsPaginationCompact = (_class = class HdsPaginationCompact extends Componen
|
|
|
91
91
|
return pageSizes;
|
|
92
92
|
}
|
|
93
93
|
buildQueryParamsObject(page, pageSize) {
|
|
94
|
-
if (this.
|
|
94
|
+
if (this._isControlled) {
|
|
95
95
|
// if the component is controlled, we can assert that the queryFunction is defined
|
|
96
96
|
return this.args.queryFunction(page, pageSize);
|
|
97
97
|
} else {
|
|
@@ -107,7 +107,7 @@ let HdsPaginationCompact = (_class = class HdsPaginationCompact extends Componen
|
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
// the "query" is dynamic and needs to be calculated
|
|
110
|
-
if (this.
|
|
110
|
+
if (this._isControlled) {
|
|
111
111
|
routing.queryPrev = this.buildQueryParamsObject(HdsPaginationDirectionValues.Prev, this.currentPageSize);
|
|
112
112
|
routing.queryNext = this.buildQueryParamsObject(HdsPaginationDirectionValues.Next, this.currentPageSize);
|
|
113
113
|
} else {
|
|
@@ -134,17 +134,17 @@ let HdsPaginationCompact = (_class = class HdsPaginationCompact extends Componen
|
|
|
134
134
|
onPageSizeChange(newPageSize);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
},
|
|
137
|
+
}, _descriptor = _applyDecoratedDescriptor(_class.prototype, "_currentPageSize", [tracked], {
|
|
138
138
|
configurable: true,
|
|
139
139
|
enumerable: true,
|
|
140
140
|
writable: true,
|
|
141
141
|
initializer: null
|
|
142
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "
|
|
142
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "_isControlled", [tracked], {
|
|
143
143
|
configurable: true,
|
|
144
144
|
enumerable: true,
|
|
145
145
|
writable: true,
|
|
146
146
|
initializer: null
|
|
147
|
-
}), _applyDecoratedDescriptor(_class.prototype, "onPageChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onPageChange"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "onPageSizeChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onPageSizeChange"), _class.prototype)
|
|
147
|
+
}), _applyDecoratedDescriptor(_class.prototype, "onPageChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onPageChange"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "onPageSizeChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onPageSizeChange"), _class.prototype), _class);
|
|
148
148
|
setComponentTemplate(TEMPLATE, HdsPaginationCompact);
|
|
149
149
|
|
|
150
150
|
export { DEFAULT_PAGE_SIZES, HdsPaginationCompact as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/pagination/compact/index.hbs","../../../../../src/components/hds/pagination/compact/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class=\\\"hds-pagination\\\" ...attributes>\\n <nav class=\\\"hds-pagination-nav\\\" aria-label={{this.ariaLabel}}>\\n <Hds::Pagination::Nav::Arrow\\n @direction=\\\"prev\\\"\\n @showLabel={{this.showLabels}}\\n @route={{this.routing.route}}\\n @query={{this.routing.queryPrev}}\\n @model={{this.routing.model}}\\n @models={{this.routing.models}}\\n @replace={{this.routing.replace}}\\n @onClick={{this.onPageChange}}\\n @disabled={{@isDisabledPrev}}\\n />\\n <Hds::Pagination::Nav::Arrow\\n @direction=\\\"next\\\"\\n @showLabel={{this.showLabels}}\\n @route={{this.routing.route}}\\n @query={{this.routing.queryNext}}\\n @model={{this.routing.model}}\\n @models={{this.routing.models}}\\n @replace={{this.routing.replace}}\\n @onClick={{this.onPageChange}}\\n @disabled={{@isDisabledNext}}\\n />\\n </nav>\\n\\n {{#if this.showSizeSelector}}\\n <Hds::Pagination::SizeSelector\\n @pageSizes={{this.pageSizes}}\\n @label={{@sizeSelectorLabel}}\\n @selectedSize={{this.currentPageSize}}\\n @onChange={{this.onPageSizeChange}}\\n />\\n {{/if}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport { HdsPaginationDirectionValues } from '../types.ts';\n\nimport type {\n HdsPaginationRoutingProps,\n HdsPaginationDirections,\n} from '../types';\nimport type { HdsInteractiveSignature } from '../../interactive';\n\ntype HdsInteractiveQuery = HdsInteractiveSignature['Args']['query'];\n\ntype HdsPaginationCompactRoutingQueryProps = HdsPaginationRoutingProps & {\n queryNext?: HdsInteractiveQuery;\n queryPrev?: HdsInteractiveQuery;\n};\n\ntype HdsPaginationQueryFunction = (\n page: HdsPaginationDirections,\n pageSize?: number\n) => HdsInteractiveQuery;\n\ninterface HdsPaginationCompactArgs extends HdsPaginationRoutingProps {\n ariaLabel?: string;\n showLabels?: boolean;\n isDisabledPrev?: boolean;\n isDisabledNext?: boolean;\n showSizeSelector?: boolean;\n sizeSelectorLabel?: string;\n pageSizes?: number[];\n currentPageSize?: number;\n queryFunction?: HdsPaginationQueryFunction;\n onPageChange?: (page: HdsPaginationDirections) => void;\n onPageSizeChange?: (pageSize: number) => void;\n}\n\ninterface HdsPaginationCompactArgsControlledBase\n extends HdsPaginationCompactArgs {\n queryFunction: HdsPaginationQueryFunction;\n}\n\ninterface HdsPaginationCompactArgsControlledWithModel\n extends HdsPaginationCompactArgsControlledBase {\n model: string | number;\n}\n\ninterface HdsPaginationCompactArgsControlledWithModels\n extends HdsPaginationCompactArgsControlledBase {\n models: Array<string | number>;\n}\ninterface HdsPaginationCompactArgsControlledWithRoute\n extends HdsPaginationCompactArgsControlledBase {\n route: string;\n}\n\ntype HdsPaginationCompactArgsControlled =\n | HdsPaginationCompactArgsControlledWithModel\n | HdsPaginationCompactArgsControlledWithModels\n | HdsPaginationCompactArgsControlledWithRoute;\n\ninterface HdsPaginationCompactArgsUncontrolled\n extends HdsPaginationCompactArgs {\n queryFunction?: undefined;\n}\n\nexport interface HdsPaginationCompactSignature {\n Args:\n | HdsPaginationCompactArgsControlled\n | HdsPaginationCompactArgsUncontrolled;\n Element: HTMLDivElement;\n}\n\n// for context about the decision to use these values, see:\n// https://hashicorp.slack.com/archives/C03A0N1QK8S/p1673546329082759\nexport const DEFAULT_PAGE_SIZES = [10, 30, 50];\nexport default class HdsPaginationCompact extends Component<HdsPaginationCompactSignature> {\n // This private variable is used to differentiate between\n // \"uncontrolled\" component (where the state is handled internally) and\n // \"controlled\" component (where the state is handled externally, by the consumer's code).\n // In the first case, the variable stores the internal state of the component at any moment,\n // and its value is updated internally according to the user's interaction with the component.\n // In the second case, the variable stores *only* the initial state of the component (coming from the arguments)\n // at rendering time, but from that moment on it's not updated anymore, no matter what interaction the user\n // has with the component (the state is controlled externally, eg. via query parameters)\n @tracked _currentPageSize;\n @tracked isControlled;\n\n showLabels = this.args.showLabels ?? true; // if the labels for the \"prev/next\" controls are visible\n showSizeSelector = this.args.showSizeSelector ?? false; // if the \"size selector\" block is visible\n\n constructor(owner: unknown, args: HdsPaginationCompactSignature['Args']) {\n super(owner, args);\n\n const { queryFunction } = this.args;\n\n // This component works in two different ways, depending if we need to support\n // routing through links (`LinkTo`) for the \"navigation controls\", or not.\n // If there's no routing then the component behaves as \"uncontrolled\"\n // (the state updates are handled by its internal logic).\n // If instead the component needs to update the routing (and we infer this via the \"query\" arguments)\n // then the component behaves as \"controlled\", where the state is\n // initialized and updated using the arguments passed to it.\n\n if (queryFunction === undefined) {\n this.isControlled = false;\n } else {\n assert(\n '@model, @models, or @route for \"Hds::Pagination::Compact\" must be provided when using the `@queryFunction` argument',\n this.args.model !== undefined ||\n this.args.models !== undefined ||\n this.args.route !== undefined\n );\n assert(\n '@queryFunction for \"Hds::Pagination::Compact\" must be a function',\n typeof queryFunction === 'function'\n );\n this.isControlled = true;\n }\n\n // we assert that `this.pageSizes` will always be an array with at least one item\n this._currentPageSize = this.args.currentPageSize ?? this.pageSizes[0];\n }\n\n get ariaLabel(): string {\n return this.args.ariaLabel ?? 'Pagination';\n }\n\n // This very specific `get/set` pattern is used to handle the two different use cases of the component\n // being \"controlled\" (when it has routing, meaning it needs to support pagination controls as links/`LinkTo`)\n // vs being \"uncontrolled\" (see comments above for details).\n //\n // If it has routing (and so it's \"controlled\"), than the value (\"state\") of the `currentPageSize` variable\n // is *always* determined by the controller via arguments (most of the times, connected to query parameters in the URL).\n // For this reason the \"get\" method always returns the value from the `args`,\n // while the \"set\" method never updates the private internal state (_variable).\n //\n // If instead it doesn't have routing (and so it's \"uncontrolled\") than the value (\"state\") of the `currentPageSize` variables\n // is *always* determined by the component's internal logic (and updated according to the user interaction with it).\n // For this reason the \"get\" and \"set\" methods always read from or write to the private internal state (_variable).\n\n get currentPageSize(): number | undefined {\n if (this.isControlled) {\n return this.args.currentPageSize;\n } else {\n return this._currentPageSize;\n }\n }\n set currentPageSize(value) {\n if (this.isControlled) {\n // noop\n } else {\n this._currentPageSize = value;\n }\n }\n\n get pageSizes(): number[] {\n const { pageSizes = DEFAULT_PAGE_SIZES } = this.args;\n\n assert(\n `pageSizes argument must be an array. Received: ${pageSizes}`,\n Array.isArray(pageSizes) === true && pageSizes.length > 0\n );\n\n return pageSizes;\n }\n\n buildQueryParamsObject(\n page: HdsPaginationDirections,\n pageSize?: number\n ): HdsInteractiveQuery {\n if (this.isControlled) {\n // if the component is controlled, we can assert that the queryFunction is defined\n return this.args.queryFunction!(page, pageSize);\n } else {\n return {};\n }\n }\n\n get routing(): HdsPaginationCompactRoutingQueryProps {\n const routing: HdsPaginationCompactRoutingQueryProps = {\n route: this.args.route ?? undefined,\n model: this.args.model ?? undefined,\n models: this.args.models ?? undefined,\n replace: this.args.replace ?? undefined,\n };\n\n // the \"query\" is dynamic and needs to be calculated\n if (this.isControlled) {\n routing.queryPrev = this.buildQueryParamsObject(\n HdsPaginationDirectionValues.Prev,\n this.currentPageSize\n );\n routing.queryNext = this.buildQueryParamsObject(\n HdsPaginationDirectionValues.Next,\n this.currentPageSize\n );\n } else {\n routing.queryPrev = undefined;\n routing.queryNext = undefined;\n }\n\n return routing;\n }\n\n @action\n onPageChange(newPage: HdsPaginationDirections): void {\n const { onPageChange } = this.args;\n\n if (typeof onPageChange === 'function') {\n onPageChange(newPage);\n }\n }\n\n @action\n onPageSizeChange(newPageSize: number): void {\n const { onPageSizeChange } = this.args;\n\n // invoke the callback function\n if (typeof onPageSizeChange === 'function') {\n onPageSizeChange(newPageSize);\n }\n }\n}\n"],"names":["DEFAULT_PAGE_SIZES","HdsPaginationCompact","_class","Component","constructor","owner","args","_initializerDefineProperty","_descriptor","_descriptor2","_defineProperty","showLabels","showSizeSelector","queryFunction","undefined","isControlled","assert","model","models","route","_currentPageSize","currentPageSize","pageSizes","ariaLabel","value","Array","isArray","length","buildQueryParamsObject","page","pageSize","routing","replace","queryPrev","HdsPaginationDirectionValues","Prev","queryNext","Next","onPageChange","newPage","onPageSizeChange","newPageSize","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,isCAAisC;;;AC8EnuC;AACA;AACO,MAAMA,kBAAkB,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAC;AACzBC,IAAAA,oBAAoB,IAAAC,MAAA,GAA1B,MAAMD,oBAAoB,SAASE,SAAS,CAAgC;AAajC;;AAExDC,EAAAA,WAAWA,CAACC,KAAc,EAAEC,IAA2C,EAAE;AACvE,IAAA,KAA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AAyC,SAAA,mBACPC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;EAAAC,WAAA,EAAA,IAAA;AAAA,CAAA,CAAA,EAAAN,yBAAA,CAAAxC,MAAA,CAAAyC,SAAA,EAAA,cAAA,EAAA,CAuHPM,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAjD,MAAA,CAAAyC,SAAA,EAAAzC,cAAAA,CAAAA,EAAAA,MAAA,CAAAyC,SAAA,CAAA,EAAAD,yBAAA,CAAAxC,MAAA,CAAAyC,SAAA,uBASNM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAjD,MAAA,CAAAyC,SAAA,EAAA,kBAAA,CAAA,EAAAzC,MAAA,CAAAyC,SAAA,IAAAzC,MAAA,EAAA;AA1IgCkD,oBAAA,CAAAC,QAAA,EAApBpD,oBAAoB,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/pagination/compact/index.hbs","../../../../../src/components/hds/pagination/compact/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class=\\\"hds-pagination\\\" ...attributes>\\n <nav class=\\\"hds-pagination-nav\\\" aria-label={{this.ariaLabel}}>\\n <Hds::Pagination::Nav::Arrow\\n @direction=\\\"prev\\\"\\n @showLabel={{this.showLabels}}\\n @route={{this.routing.route}}\\n @query={{this.routing.queryPrev}}\\n @model={{this.routing.model}}\\n @models={{this.routing.models}}\\n @replace={{this.routing.replace}}\\n @onClick={{this.onPageChange}}\\n @disabled={{@isDisabledPrev}}\\n />\\n <Hds::Pagination::Nav::Arrow\\n @direction=\\\"next\\\"\\n @showLabel={{this.showLabels}}\\n @route={{this.routing.route}}\\n @query={{this.routing.queryNext}}\\n @model={{this.routing.model}}\\n @models={{this.routing.models}}\\n @replace={{this.routing.replace}}\\n @onClick={{this.onPageChange}}\\n @disabled={{@isDisabledNext}}\\n />\\n </nav>\\n\\n {{#if this.showSizeSelector}}\\n <Hds::Pagination::SizeSelector\\n @pageSizes={{this.pageSizes}}\\n @label={{@sizeSelectorLabel}}\\n @selectedSize={{this.currentPageSize}}\\n @onChange={{this.onPageSizeChange}}\\n />\\n {{/if}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport { HdsPaginationDirectionValues } from '../types.ts';\n\nimport type {\n HdsPaginationRoutingProps,\n HdsPaginationDirections,\n} from '../types';\nimport type { HdsInteractiveSignature } from '../../interactive';\n\ntype HdsInteractiveQuery = HdsInteractiveSignature['Args']['query'];\n\ntype HdsPaginationCompactRoutingQueryProps = HdsPaginationRoutingProps & {\n queryNext?: HdsInteractiveQuery;\n queryPrev?: HdsInteractiveQuery;\n};\n\ntype HdsPaginationQueryFunction = (\n page: HdsPaginationDirections,\n pageSize?: number\n) => HdsInteractiveQuery;\n\ninterface HdsPaginationCompactArgs extends HdsPaginationRoutingProps {\n ariaLabel?: string;\n showLabels?: boolean;\n isDisabledPrev?: boolean;\n isDisabledNext?: boolean;\n showSizeSelector?: boolean;\n sizeSelectorLabel?: string;\n pageSizes?: number[];\n currentPageSize?: number;\n queryFunction?: HdsPaginationQueryFunction;\n onPageChange?: (page: HdsPaginationDirections) => void;\n onPageSizeChange?: (pageSize: number) => void;\n}\n\ninterface HdsPaginationCompactArgsControlledBase\n extends HdsPaginationCompactArgs {\n queryFunction: HdsPaginationQueryFunction;\n}\n\ninterface HdsPaginationCompactArgsControlledWithModel\n extends HdsPaginationCompactArgsControlledBase {\n model: string | number;\n}\n\ninterface HdsPaginationCompactArgsControlledWithModels\n extends HdsPaginationCompactArgsControlledBase {\n models: Array<string | number>;\n}\ninterface HdsPaginationCompactArgsControlledWithRoute\n extends HdsPaginationCompactArgsControlledBase {\n route: string;\n}\n\ntype HdsPaginationCompactArgsControlled =\n | HdsPaginationCompactArgsControlledWithModel\n | HdsPaginationCompactArgsControlledWithModels\n | HdsPaginationCompactArgsControlledWithRoute;\n\ninterface HdsPaginationCompactArgsUncontrolled\n extends HdsPaginationCompactArgs {\n queryFunction?: undefined;\n}\n\nexport interface HdsPaginationCompactSignature {\n Args:\n | HdsPaginationCompactArgsControlled\n | HdsPaginationCompactArgsUncontrolled;\n Element: HTMLDivElement;\n}\n\n// for context about the decision to use these values, see:\n// https://hashicorp.slack.com/archives/C03A0N1QK8S/p1673546329082759\nexport const DEFAULT_PAGE_SIZES = [10, 30, 50];\nexport default class HdsPaginationCompact extends Component<HdsPaginationCompactSignature> {\n // This private variable is used to differentiate between\n // \"uncontrolled\" component (where the state is handled internally) and\n // \"controlled\" component (where the state is handled externally, by the consumer's code).\n // In the first case, the variable stores the internal state of the component at any moment,\n // and its value is updated internally according to the user's interaction with the component.\n // In the second case, the variable stores *only* the initial state of the component (coming from the arguments)\n // at rendering time, but from that moment on it's not updated anymore, no matter what interaction the user\n // has with the component (the state is controlled externally, eg. via query parameters)\n @tracked private _currentPageSize;\n @tracked private _isControlled;\n\n showLabels = this.args.showLabels ?? true; // if the labels for the \"prev/next\" controls are visible\n showSizeSelector = this.args.showSizeSelector ?? false; // if the \"size selector\" block is visible\n\n constructor(owner: unknown, args: HdsPaginationCompactSignature['Args']) {\n super(owner, args);\n\n const { queryFunction } = this.args;\n\n // This component works in two different ways, depending if we need to support\n // routing through links (`LinkTo`) for the \"navigation controls\", or not.\n // If there's no routing then the component behaves as \"uncontrolled\"\n // (the state updates are handled by its internal logic).\n // If instead the component needs to update the routing (and we infer this via the \"query\" arguments)\n // then the component behaves as \"controlled\", where the state is\n // initialized and updated using the arguments passed to it.\n\n if (queryFunction === undefined) {\n this._isControlled = false;\n } else {\n assert(\n '@model, @models, or @route for \"Hds::Pagination::Compact\" must be provided when using the `@queryFunction` argument',\n this.args.model !== undefined ||\n this.args.models !== undefined ||\n this.args.route !== undefined\n );\n assert(\n '@queryFunction for \"Hds::Pagination::Compact\" must be a function',\n typeof queryFunction === 'function'\n );\n this._isControlled = true;\n }\n\n // we assert that `this.pageSizes` will always be an array with at least one item\n this._currentPageSize = this.args.currentPageSize ?? this.pageSizes[0];\n }\n\n get ariaLabel(): string {\n return this.args.ariaLabel ?? 'Pagination';\n }\n\n // This very specific `get/set` pattern is used to handle the two different use cases of the component\n // being \"controlled\" (when it has routing, meaning it needs to support pagination controls as links/`LinkTo`)\n // vs being \"uncontrolled\" (see comments above for details).\n //\n // If it has routing (and so it's \"controlled\"), than the value (\"state\") of the `currentPageSize` variable\n // is *always* determined by the controller via arguments (most of the times, connected to query parameters in the URL).\n // For this reason the \"get\" method always returns the value from the `args`,\n // while the \"set\" method never updates the private internal state (_variable).\n //\n // If instead it doesn't have routing (and so it's \"uncontrolled\") than the value (\"state\") of the `currentPageSize` variables\n // is *always* determined by the component's internal logic (and updated according to the user interaction with it).\n // For this reason the \"get\" and \"set\" methods always read from or write to the private internal state (_variable).\n\n get currentPageSize(): number | undefined {\n if (this._isControlled) {\n return this.args.currentPageSize;\n } else {\n return this._currentPageSize;\n }\n }\n set currentPageSize(value) {\n if (this._isControlled) {\n // noop\n } else {\n this._currentPageSize = value;\n }\n }\n\n get pageSizes(): number[] {\n const { pageSizes = DEFAULT_PAGE_SIZES } = this.args;\n\n assert(\n `pageSizes argument must be an array. Received: ${pageSizes}`,\n Array.isArray(pageSizes) === true && pageSizes.length > 0\n );\n\n return pageSizes;\n }\n\n buildQueryParamsObject(\n page: HdsPaginationDirections,\n pageSize?: number\n ): HdsInteractiveQuery {\n if (this._isControlled) {\n // if the component is controlled, we can assert that the queryFunction is defined\n return this.args.queryFunction!(page, pageSize);\n } else {\n return {};\n }\n }\n\n get routing(): HdsPaginationCompactRoutingQueryProps {\n const routing: HdsPaginationCompactRoutingQueryProps = {\n route: this.args.route ?? undefined,\n model: this.args.model ?? undefined,\n models: this.args.models ?? undefined,\n replace: this.args.replace ?? undefined,\n };\n\n // the \"query\" is dynamic and needs to be calculated\n if (this._isControlled) {\n routing.queryPrev = this.buildQueryParamsObject(\n HdsPaginationDirectionValues.Prev,\n this.currentPageSize\n );\n routing.queryNext = this.buildQueryParamsObject(\n HdsPaginationDirectionValues.Next,\n this.currentPageSize\n );\n } else {\n routing.queryPrev = undefined;\n routing.queryNext = undefined;\n }\n\n return routing;\n }\n\n @action\n onPageChange(newPage: HdsPaginationDirections): void {\n const { onPageChange } = this.args;\n\n if (typeof onPageChange === 'function') {\n onPageChange(newPage);\n }\n }\n\n @action\n onPageSizeChange(newPageSize: number): void {\n const { onPageSizeChange } = this.args;\n\n // invoke the callback function\n if (typeof onPageSizeChange === 'function') {\n onPageSizeChange(newPageSize);\n }\n }\n}\n"],"names":["DEFAULT_PAGE_SIZES","HdsPaginationCompact","_class","Component","constructor","owner","args","_initializerDefineProperty","_descriptor","_descriptor2","_defineProperty","showLabels","showSizeSelector","queryFunction","undefined","_isControlled","assert","model","models","route","_currentPageSize","currentPageSize","pageSizes","ariaLabel","value","Array","isArray","length","buildQueryParamsObject","page","pageSize","routing","replace","queryPrev","HdsPaginationDirectionValues","Prev","queryNext","Next","onPageChange","newPage","onPageSizeChange","newPageSize","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,isCAAisC;;;AC8EnuC;AACA;AACO,MAAMA,kBAAkB,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;AACxBC,IAAAA,oBAAoB,IAAAC,MAAA,GAA1B,MAAMD,oBAAoB,SAASE,SAAS,CAAgC;AAajC;;AAExDC,EAAAA,WAAWA,CAACC,KAAc,EAAEC,IAA2C,EAAE;AACvE,IAAA,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A,MAAA,CAAAyC,SAAA,CAAA,EAAAD,yBAAA,CAAAxC,MAAA,CAAAyC,SAAA,uBASNM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAjD,MAAA,CAAAyC,SAAA,EAAA,kBAAA,CAAA,EAAAzC,MAAA,CAAAyC,SAAA,GAAAzC,MAAA;AA1IgCkD,oBAAA,CAAAC,QAAA,EAApBpD,oBAAoB,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/pagination/info/index.hbs","../../../../../src/components/hds/pagination/info/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Text::Body class=\\\"hds-pagination-info\\\" @tag=\\\"div\\\" @size=\\\"100\\\" @weight=\\\"medium\\\" ...attributes>\\n {{@itemsRangeStart}}–{{@itemsRangeEnd}}\\n {{#if this.showTotalItems}}\\n of\\n {{@totalItems}}\\n {{/if}}\\n</Hds::Text::Body>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport type { HdsPaginationNumberedSignature } from '../numbered/index';\nimport type { HdsTextBodySignature } from '../../text/body';\nexport interface HdsPaginationInfoSignature {\n Args: {\n itemsRangeStart: number;\n itemsRangeEnd: number;\n showTotalItems?: HdsPaginationNumberedSignature['Args']['showTotalItems'];\n totalItems: HdsPaginationNumberedSignature['Args']['totalItems'];\n };\n Element: HdsTextBodySignature['Element'];\n}\n\nexport default class HdsPaginationInfo extends Component<HdsPaginationInfoSignature> {\n get showTotalItems(): boolean {\n return this.args.showTotalItems ?? true;\n }\n}\n"],"names":["HdsPaginationInfo","Component","showTotalItems","args","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,iUAAiU;;ACDnW;AACA;AACA;AACA;;AAee,MAAMA,iBAAiB,SAASC,SAAS,CAA6B;EACnF,IAAIC,cAAcA,GAAY;AAC5B,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,cAAc,IAAI,IAAI
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/pagination/info/index.hbs","../../../../../src/components/hds/pagination/info/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Text::Body class=\\\"hds-pagination-info\\\" @tag=\\\"div\\\" @size=\\\"100\\\" @weight=\\\"medium\\\" ...attributes>\\n {{@itemsRangeStart}}–{{@itemsRangeEnd}}\\n {{#if this.showTotalItems}}\\n of\\n {{@totalItems}}\\n {{/if}}\\n</Hds::Text::Body>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport type { HdsPaginationNumberedSignature } from '../numbered/index';\nimport type { HdsTextBodySignature } from '../../text/body';\nexport interface HdsPaginationInfoSignature {\n Args: {\n itemsRangeStart: number;\n itemsRangeEnd: number;\n showTotalItems?: HdsPaginationNumberedSignature['Args']['showTotalItems'];\n totalItems: HdsPaginationNumberedSignature['Args']['totalItems'];\n };\n Element: HdsTextBodySignature['Element'];\n}\n\nexport default class HdsPaginationInfo extends Component<HdsPaginationInfoSignature> {\n get showTotalItems(): boolean {\n return this.args.showTotalItems ?? true;\n }\n}\n"],"names":["HdsPaginationInfo","Component","showTotalItems","args","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,iUAAiU;;ACDnW;AACA;AACA;AACA;;AAee,MAAMA,iBAAiB,SAASC,SAAS,CAA6B;EACnF,IAAIC,cAAcA,GAAY;AAC5B,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,cAAc,IAAI,IAAI;AACzC;AACF;AAACE,oBAAA,CAAAC,QAAA,EAJoBL,iBAAiB,CAAA;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as _applyDecoratedDescriptor } from '../../../../_rollupPluginBabelHelpers-
|
|
1
|
+
import { _ as _applyDecoratedDescriptor } from '../../../../_rollupPluginBabelHelpers-81503waH.js';
|
|
2
2
|
import Component from '@glimmer/component';
|
|
3
3
|
import { action } from '@ember/object';
|
|
4
4
|
import { assert } from '@ember/debug';
|
|
@@ -48,7 +48,7 @@ let HdsPaginationControlArrow = (_class = class HdsPaginationControlArrow extend
|
|
|
48
48
|
onClick(this.args.direction);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
},
|
|
51
|
+
}, _applyDecoratedDescriptor(_class.prototype, "onClick", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onClick"), _class.prototype), _class);
|
|
52
52
|
setComponentTemplate(TEMPLATE, HdsPaginationControlArrow);
|
|
53
53
|
|
|
54
54
|
export { DIRECTIONS, HdsPaginationControlArrow as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow.js","sources":["../../../../../src/components/hds/pagination/nav/arrow.hbs","../../../../../src/components/hds/pagination/nav/arrow.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n{{#if @disabled}}\\n <Hds::Interactive class={{this.classNames}} aria-label={{this.content.ariaLabel}} disabled={{true}} ...attributes>\\n <Hds::Icon @name={{this.content.icon}} />\\n {{#if this.showLabel}}\\n <Hds::Text::Body\\n class=\\\"hds-pagination-nav__arrow-label\\\"\\n @tag=\\\"span\\\"\\n @size=\\\"100\\\"\\n @weight=\\\"medium\\\"\\n aria-hidden=\\\"true\\\"\\n >\\n {{this.content.label}}\\n </Hds::Text::Body>\\n {{/if}}\\n </Hds::Interactive>\\n{{else}}\\n <Hds::Interactive\\n class={{this.classNames}}\\n @route={{@route}}\\n @query={{hds-link-to-query @query}}\\n @models={{hds-link-to-models @model @models}}\\n @replace={{@replace}}\\n {{on \\\"click\\\" this.onClick}}\\n aria-label={{this.content.ariaLabel}}\\n ...attributes\\n >\\n <Hds::Icon @name={{this.content.icon}} />\\n {{#if this.showLabel}}\\n <Hds::Text::Body\\n class=\\\"hds-pagination-nav__arrow-label\\\"\\n @tag=\\\"span\\\"\\n @size=\\\"100\\\"\\n @weight=\\\"medium\\\"\\n aria-hidden=\\\"true\\\"\\n >\\n {{this.content.label}}\\n </Hds::Text::Body>\\n {{/if}}\\n </Hds::Interactive>\\n{{/if}}\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport {\n HdsPaginationDirectionValues,\n HdsPaginationDirectionAriaLabelValues,\n HdsPaginationDirectionLabelValues,\n} from '../types.ts';\n\nimport type { HdsIconSignature } from '../../icon/index.ts';\nimport type { HdsInteractiveSignature } from '../../interactive';\nimport type {\n HdsPaginationDirections,\n HdsPaginationDirectionAriaLabels,\n HdsPaginationDirectionLabels,\n} from '../types';\n\ninterface HdsPaginationControlArrowContent {\n label: HdsPaginationDirectionLabels;\n icon: HdsIconSignature['Args']['name'];\n ariaLabel: HdsPaginationDirectionAriaLabels;\n}\n\ninterface HdsPaginationControlArrowArgs {\n direction: HdsPaginationDirections;\n disabled?: boolean;\n showLabel?: boolean;\n onClick?: (direction: HdsPaginationDirections) => void;\n}\n\nexport interface HdsPaginationControlArrowSignature {\n Args: HdsPaginationControlArrowArgs & HdsInteractiveSignature['Args'];\n Element: HdsInteractiveSignature['Element'];\n}\n\nexport const DIRECTIONS: HdsPaginationDirections[] = [\n HdsPaginationDirectionValues.Prev,\n HdsPaginationDirectionValues.Next,\n];\n\nexport default class HdsPaginationControlArrow extends Component<HdsPaginationControlArrowSignature> {\n get content(): HdsPaginationControlArrowContent {\n const { direction } = this.args;\n\n assert(\n `@direction for \"Pagination::Nav::Arrow\" must be one of the following: ${DIRECTIONS.join(\n ', '\n )}; received: ${direction}`,\n DIRECTIONS.includes(direction)\n );\n\n const hdsPaginationNavArrowContentDirectionMap: Record<\n HdsPaginationDirections,\n HdsPaginationControlArrowContent\n > = {\n [HdsPaginationDirectionValues.Prev]: {\n label: HdsPaginationDirectionLabelValues.Prev,\n icon: 'chevron-left',\n ariaLabel: HdsPaginationDirectionAriaLabelValues.Prev,\n },\n [HdsPaginationDirectionValues.Next]: {\n label: HdsPaginationDirectionLabelValues.Next,\n icon: 'chevron-right',\n ariaLabel: HdsPaginationDirectionAriaLabelValues.Next,\n },\n };\n\n return hdsPaginationNavArrowContentDirectionMap[direction];\n }\n\n get showLabel(): boolean {\n const { showLabel = true } = this.args;\n\n return showLabel;\n }\n\n get classNames(): string {\n const classes = [\n 'hds-pagination-nav__control',\n 'hds-pagination-nav__arrow',\n `hds-pagination-nav__arrow--direction-${this.args.direction}`,\n ];\n\n return classes.join(' ');\n }\n\n @action\n onClick(): void {\n const { onClick } = this.args;\n\n if (typeof onClick === 'function') {\n onClick(this.args.direction);\n }\n }\n}\n"],"names":["DIRECTIONS","HdsPaginationDirectionValues","Prev","Next","HdsPaginationControlArrow","_class","Component","content","direction","args","assert","join","includes","hdsPaginationNavArrowContentDirectionMap","label","HdsPaginationDirectionLabelValues","icon","ariaLabel","HdsPaginationDirectionAriaLabelValues","showLabel","classNames","classes","onClick","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;AACA,eAAe,kBAAkB,CAAC,4tCAA4tC;;;ACsCvvC,MAAMA,UAAqC,GAAG,CACnDC,4BAA4B,CAACC,IAAI,EACjCD,4BAA4B,CAACE,IAAI
|
|
1
|
+
{"version":3,"file":"arrow.js","sources":["../../../../../src/components/hds/pagination/nav/arrow.hbs","../../../../../src/components/hds/pagination/nav/arrow.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n{{#if @disabled}}\\n <Hds::Interactive class={{this.classNames}} aria-label={{this.content.ariaLabel}} disabled={{true}} ...attributes>\\n <Hds::Icon @name={{this.content.icon}} />\\n {{#if this.showLabel}}\\n <Hds::Text::Body\\n class=\\\"hds-pagination-nav__arrow-label\\\"\\n @tag=\\\"span\\\"\\n @size=\\\"100\\\"\\n @weight=\\\"medium\\\"\\n aria-hidden=\\\"true\\\"\\n >\\n {{this.content.label}}\\n </Hds::Text::Body>\\n {{/if}}\\n </Hds::Interactive>\\n{{else}}\\n <Hds::Interactive\\n class={{this.classNames}}\\n @route={{@route}}\\n @query={{hds-link-to-query @query}}\\n @models={{hds-link-to-models @model @models}}\\n @replace={{@replace}}\\n {{on \\\"click\\\" this.onClick}}\\n aria-label={{this.content.ariaLabel}}\\n ...attributes\\n >\\n <Hds::Icon @name={{this.content.icon}} />\\n {{#if this.showLabel}}\\n <Hds::Text::Body\\n class=\\\"hds-pagination-nav__arrow-label\\\"\\n @tag=\\\"span\\\"\\n @size=\\\"100\\\"\\n @weight=\\\"medium\\\"\\n aria-hidden=\\\"true\\\"\\n >\\n {{this.content.label}}\\n </Hds::Text::Body>\\n {{/if}}\\n </Hds::Interactive>\\n{{/if}}\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport {\n HdsPaginationDirectionValues,\n HdsPaginationDirectionAriaLabelValues,\n HdsPaginationDirectionLabelValues,\n} from '../types.ts';\n\nimport type { HdsIconSignature } from '../../icon/index.ts';\nimport type { HdsInteractiveSignature } from '../../interactive';\nimport type {\n HdsPaginationDirections,\n HdsPaginationDirectionAriaLabels,\n HdsPaginationDirectionLabels,\n} from '../types';\n\ninterface HdsPaginationControlArrowContent {\n label: HdsPaginationDirectionLabels;\n icon: HdsIconSignature['Args']['name'];\n ariaLabel: HdsPaginationDirectionAriaLabels;\n}\n\ninterface HdsPaginationControlArrowArgs {\n direction: HdsPaginationDirections;\n disabled?: boolean;\n showLabel?: boolean;\n onClick?: (direction: HdsPaginationDirections) => void;\n}\n\nexport interface HdsPaginationControlArrowSignature {\n Args: HdsPaginationControlArrowArgs & HdsInteractiveSignature['Args'];\n Element: HdsInteractiveSignature['Element'];\n}\n\nexport const DIRECTIONS: HdsPaginationDirections[] = [\n HdsPaginationDirectionValues.Prev,\n HdsPaginationDirectionValues.Next,\n];\n\nexport default class HdsPaginationControlArrow extends Component<HdsPaginationControlArrowSignature> {\n get content(): HdsPaginationControlArrowContent {\n const { direction } = this.args;\n\n assert(\n `@direction for \"Pagination::Nav::Arrow\" must be one of the following: ${DIRECTIONS.join(\n ', '\n )}; received: ${direction}`,\n DIRECTIONS.includes(direction)\n );\n\n const hdsPaginationNavArrowContentDirectionMap: Record<\n HdsPaginationDirections,\n HdsPaginationControlArrowContent\n > = {\n [HdsPaginationDirectionValues.Prev]: {\n label: HdsPaginationDirectionLabelValues.Prev,\n icon: 'chevron-left',\n ariaLabel: HdsPaginationDirectionAriaLabelValues.Prev,\n },\n [HdsPaginationDirectionValues.Next]: {\n label: HdsPaginationDirectionLabelValues.Next,\n icon: 'chevron-right',\n ariaLabel: HdsPaginationDirectionAriaLabelValues.Next,\n },\n };\n\n return hdsPaginationNavArrowContentDirectionMap[direction];\n }\n\n get showLabel(): boolean {\n const { showLabel = true } = this.args;\n\n return showLabel;\n }\n\n get classNames(): string {\n const classes = [\n 'hds-pagination-nav__control',\n 'hds-pagination-nav__arrow',\n `hds-pagination-nav__arrow--direction-${this.args.direction}`,\n ];\n\n return classes.join(' ');\n }\n\n @action\n onClick(): void {\n const { onClick } = this.args;\n\n if (typeof onClick === 'function') {\n onClick(this.args.direction);\n }\n }\n}\n"],"names":["DIRECTIONS","HdsPaginationDirectionValues","Prev","Next","HdsPaginationControlArrow","_class","Component","content","direction","args","assert","join","includes","hdsPaginationNavArrowContentDirectionMap","label","HdsPaginationDirectionLabelValues","icon","ariaLabel","HdsPaginationDirectionAriaLabelValues","showLabel","classNames","classes","onClick","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;AACA,eAAe,kBAAkB,CAAC,4tCAA4tC;;;ACsCvvC,MAAMA,UAAqC,GAAG,CACnDC,4BAA4B,CAACC,IAAI,EACjCD,4BAA4B,CAACE,IAAI;AAGdC,IAAAA,yBAAyB,IAAAC,MAAA,GAA/B,MAAMD,yBAAyB,SAASE,SAAS,CAAqC;EACnG,IAAIC,OAAOA,GAAqC;IAC9C,MAAM;AAAEC,MAAAA;KAAW,GAAG,IAAI,CAACC,IAAI;AAE/BC,IAAAA,MAAM,CACJ,CAAyEV,sEAAAA,EAAAA,UAAU,CAACW,IAAI,CACtF,IACF,CAAC,CAAA,YAAA,EAAeH,SAAS,CAAA,CAAE,EAC3BR,UAAU,CAACY,QAAQ,CAACJ,SAAS,CAC/B,CAAC;AAED,IAAA,MAAMK,wCAGL,GAAG;MACF,CAACZ,4BAA4B,CAACC,IAAI,GAAG;QACnCY,KAAK,EAAEC,iCAAiC,CAACb,IAAI;AAC7Cc,QAAAA,IAAI,EAAE,cAAc;QACpBC,SAAS,EAAEC,qCAAqC,CAAChB;OAClD;MACD,CAACD,4BAA4B,CAACE,IAAI,GAAG;QACnCW,KAAK,EAAEC,iCAAiC,CAACZ,IAAI;AAC7Ca,QAAAA,IAAI,EAAE,eAAe;QACrBC,SAAS,EAAEC,qCAAqC,CAACf;AACnD;KACD;IAED,OAAOU,wCAAwC,CAACL,SAAS,CAAC;AAC5D;EAEA,IAAIW,SAASA,GAAY;IACvB,MAAM;AAAEA,MAAAA,SAAS,GAAG;KAAM,GAAG,IAAI,CAACV,IAAI;AAEtC,IAAA,OAAOU,SAAS;AAClB;EAEA,IAAIC,UAAUA,GAAW;AACvB,IAAA,MAAMC,OAAO,GAAG,CACd,6BAA6B,EAC7B,2BAA2B,EAC3B,CAAwC,qCAAA,EAAA,IAAI,CAACZ,IAAI,CAACD,SAAS,EAAE,CAC9D;AAED,IAAA,OAAOa,OAAO,CAACV,IAAI,CAAC,GAAG,CAAC;AAC1B;AAGAW,EAAAA,OAAOA,GAAS;IACd,MAAM;AAAEA,MAAAA;KAAS,GAAG,IAAI,CAACb,IAAI;AAE7B,IAAA,IAAI,OAAOa,OAAO,KAAK,UAAU,EAAE;AACjCA,MAAAA,OAAO,CAAC,IAAI,CAACb,IAAI,CAACD,SAAS,CAAC;AAC9B;AACF;AACF,CAAC,EAAAe,yBAAA,CAAAlB,MAAA,CAAAmB,SAAA,EAAA,SAAA,EAAA,CAREC,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAtB,MAAA,CAAAmB,SAAA,cAAAnB,MAAA,CAAAmB,SAAA,CAAA,EAAAnB,MAAA;AA9CqCuB,oBAAA,CAAAC,QAAA,EAAzBzB,yBAAyB,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ellipsis.js","sources":["../../../../../src/components/hds/pagination/nav/ellipsis.hbs","../../../../../src/components/hds/pagination/nav/ellipsis.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class=\\\"hds-pagination-nav__ellipsis\\\" ...attributes>...</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\nimport TemplateOnlyComponent from '@ember/component/template-only';\n\nexport interface HdsApplicationPaginationNavEllipsisSignature {\n Element: HTMLDivElement;\n}\n\nconst HdsApplicationPaginationNavEllipsis =\n TemplateOnlyComponent<HdsApplicationPaginationNavEllipsisSignature>();\n\nexport default HdsApplicationPaginationNavEllipsis;\n"],"names":["HdsApplicationPaginationNavEllipsis","TemplateOnlyComponent","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,mJAAmJ;;ACDrL;AACA;AACA;AACA;AAOA,MAAMA,mCAAmC,GACvCC,qBAAqB,EAAgD
|
|
1
|
+
{"version":3,"file":"ellipsis.js","sources":["../../../../../src/components/hds/pagination/nav/ellipsis.hbs","../../../../../src/components/hds/pagination/nav/ellipsis.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class=\\\"hds-pagination-nav__ellipsis\\\" ...attributes>...</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\nimport TemplateOnlyComponent from '@ember/component/template-only';\n\nexport interface HdsApplicationPaginationNavEllipsisSignature {\n Element: HTMLDivElement;\n}\n\nconst HdsApplicationPaginationNavEllipsis =\n TemplateOnlyComponent<HdsApplicationPaginationNavEllipsisSignature>();\n\nexport default HdsApplicationPaginationNavEllipsis;\n"],"names":["HdsApplicationPaginationNavEllipsis","TemplateOnlyComponent","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,mJAAmJ;;ACDrL;AACA;AACA;AACA;AAOA,MAAMA,mCAAmC,GACvCC,qBAAqB,EAAgD;AAEvE,eAAAC,oBAAA,CAAAC,QAAA,EAAeH,mCAAmC,CAAA;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as _applyDecoratedDescriptor } from '../../../../_rollupPluginBabelHelpers-
|
|
1
|
+
import { _ as _applyDecoratedDescriptor } from '../../../../_rollupPluginBabelHelpers-81503waH.js';
|
|
2
2
|
import Component from '@glimmer/component';
|
|
3
3
|
import { action } from '@ember/object';
|
|
4
4
|
import { assert } from '@ember/debug';
|
|
@@ -31,7 +31,7 @@ let HdsPaginationControlNumber = (_class = class HdsPaginationControlNumber exte
|
|
|
31
31
|
onClick(this.args.page);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, _applyDecoratedDescriptor(_class.prototype, "onClick", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onClick"), _class.prototype), _class);
|
|
35
35
|
setComponentTemplate(TEMPLATE, HdsPaginationControlNumber);
|
|
36
36
|
|
|
37
37
|
export { HdsPaginationControlNumber as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.js","sources":["../../../../../src/components/hds/pagination/nav/number.hbs","../../../../../src/components/hds/pagination/nav/number.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Interactive\\n class={{this.classNames}}\\n @route={{@route}}\\n @query={{hds-link-to-query @query}}\\n @models={{hds-link-to-models @model @models}}\\n @replace={{@replace}}\\n {{on \\\"click\\\" this.onClick}}\\n ...attributes\\n aria-current={{if @isSelected \\\"page\\\" null}}\\n>\\n <Hds::Text::Body @tag=\\\"span\\\" @size=\\\"100\\\" @weight=\\\"medium\\\"><span class=\\\"sr-only\\\">page\\n </span>{{this.page}}</Hds::Text::Body>\\n</Hds::Interactive>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\n\nimport type { HdsInteractiveSignature } from '../../interactive';\n\ninterface HdsPaginationNavNumberArgs {\n page: number;\n onClick: (page: number) => void;\n isSelected: boolean;\n}\n\nexport interface HdsPaginationNavNumberSignature {\n Args: HdsPaginationNavNumberArgs & HdsInteractiveSignature['Args'];\n Element: HdsInteractiveSignature['Element'];\n}\n\nexport default class HdsPaginationControlNumber extends Component<HdsPaginationNavNumberSignature> {\n get page(): number {\n const { page } = this.args;\n\n assert(\n '@page for \"Pagination::Nav::Number\" must have a valid value',\n page !== undefined\n );\n\n return page;\n }\n\n get classNames(): string {\n const classes = [\n 'hds-pagination-nav__control',\n 'hds-pagination-nav__number',\n ];\n\n if (this.args.isSelected) {\n classes.push(`hds-pagination-nav__number--is-selected`);\n }\n\n return classes.join(' ');\n }\n\n @action\n onClick(): void {\n const { onClick } = this.args;\n\n if (typeof onClick === 'function') {\n onClick(this.args.page);\n }\n }\n}\n"],"names":["HdsPaginationControlNumber","_class","Component","page","args","assert","undefined","classNames","classes","isSelected","push","join","onClick","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;AACA,eAAe,kBAAkB,CAAC,2gBAA2gB;;;ACoBxhBA,IAAAA,0BAA0B,IAAAC,MAAA,GAAhC,MAAMD,0BAA0B,SAASE,SAAS,CAAkC;EACjG,IAAIC,IAAIA,GAAW;IACjB,MAAM;AAAEA,MAAAA
|
|
1
|
+
{"version":3,"file":"number.js","sources":["../../../../../src/components/hds/pagination/nav/number.hbs","../../../../../src/components/hds/pagination/nav/number.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Interactive\\n class={{this.classNames}}\\n @route={{@route}}\\n @query={{hds-link-to-query @query}}\\n @models={{hds-link-to-models @model @models}}\\n @replace={{@replace}}\\n {{on \\\"click\\\" this.onClick}}\\n ...attributes\\n aria-current={{if @isSelected \\\"page\\\" null}}\\n>\\n <Hds::Text::Body @tag=\\\"span\\\" @size=\\\"100\\\" @weight=\\\"medium\\\"><span class=\\\"sr-only\\\">page\\n </span>{{this.page}}</Hds::Text::Body>\\n</Hds::Interactive>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\n\nimport type { HdsInteractiveSignature } from '../../interactive';\n\ninterface HdsPaginationNavNumberArgs {\n page: number;\n onClick: (page: number) => void;\n isSelected: boolean;\n}\n\nexport interface HdsPaginationNavNumberSignature {\n Args: HdsPaginationNavNumberArgs & HdsInteractiveSignature['Args'];\n Element: HdsInteractiveSignature['Element'];\n}\n\nexport default class HdsPaginationControlNumber extends Component<HdsPaginationNavNumberSignature> {\n get page(): number {\n const { page } = this.args;\n\n assert(\n '@page for \"Pagination::Nav::Number\" must have a valid value',\n page !== undefined\n );\n\n return page;\n }\n\n get classNames(): string {\n const classes = [\n 'hds-pagination-nav__control',\n 'hds-pagination-nav__number',\n ];\n\n if (this.args.isSelected) {\n classes.push(`hds-pagination-nav__number--is-selected`);\n }\n\n return classes.join(' ');\n }\n\n @action\n onClick(): void {\n const { onClick } = this.args;\n\n if (typeof onClick === 'function') {\n onClick(this.args.page);\n }\n }\n}\n"],"names":["HdsPaginationControlNumber","_class","Component","page","args","assert","undefined","classNames","classes","isSelected","push","join","onClick","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;AACA,eAAe,kBAAkB,CAAC,2gBAA2gB;;;ACoBxhBA,IAAAA,0BAA0B,IAAAC,MAAA,GAAhC,MAAMD,0BAA0B,SAASE,SAAS,CAAkC;EACjG,IAAIC,IAAIA,GAAW;IACjB,MAAM;AAAEA,MAAAA;KAAM,GAAG,IAAI,CAACC,IAAI;AAE1BC,IAAAA,MAAM,CACJ,6DAA6D,EAC7DF,IAAI,KAAKG,SACX,CAAC;AAED,IAAA,OAAOH,IAAI;AACb;EAEA,IAAII,UAAUA,GAAW;AACvB,IAAA,MAAMC,OAAO,GAAG,CACd,6BAA6B,EAC7B,4BAA4B,CAC7B;AAED,IAAA,IAAI,IAAI,CAACJ,IAAI,CAACK,UAAU,EAAE;AACxBD,MAAAA,OAAO,CAACE,IAAI,CAAC,CAAA,uCAAA,CAAyC,CAAC;AACzD;AAEA,IAAA,OAAOF,OAAO,CAACG,IAAI,CAAC,GAAG,CAAC;AAC1B;AAGAC,EAAAA,OAAOA,GAAS;IACd,MAAM;AAAEA,MAAAA;KAAS,GAAG,IAAI,CAACR,IAAI;AAE7B,IAAA,IAAI,OAAOQ,OAAO,KAAK,UAAU,EAAE;AACjCA,MAAAA,OAAO,CAAC,IAAI,CAACR,IAAI,CAACD,IAAI,CAAC;AACzB;AACF;AACF,CAAC,EAAAU,yBAAA,CAAAZ,MAAA,CAAAa,SAAA,EAAA,SAAA,EAAA,CAREC,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAhB,MAAA,CAAAa,SAAA,cAAAb,MAAA,CAAAa,SAAA,CAAA,EAAAb,MAAA;AAzBsCiB,oBAAA,CAAAC,QAAA,EAA1BnB,0BAA0B,CAAA;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty, a as _defineProperty } from '../../../../_rollupPluginBabelHelpers-
|
|
1
|
+
import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty, a as _defineProperty } from '../../../../_rollupPluginBabelHelpers-81503waH.js';
|
|
2
2
|
import Component from '@glimmer/component';
|
|
3
3
|
import { tracked } from '@glimmer/tracking';
|
|
4
4
|
import { action } from '@ember/object';
|
|
@@ -71,7 +71,7 @@ let HdsPaginationNumbered = (_class = class HdsPaginationNumbered extends Compon
|
|
|
71
71
|
// has with the component (the state is controlled externally, eg. via query parameters)
|
|
72
72
|
_initializerDefineProperty(this, "_currentPage", _descriptor, this);
|
|
73
73
|
_initializerDefineProperty(this, "_currentPageSize", _descriptor2, this);
|
|
74
|
-
_initializerDefineProperty(this, "
|
|
74
|
+
_initializerDefineProperty(this, "_isControlled", _descriptor3, this);
|
|
75
75
|
_defineProperty(this, "showInfo", this.args.showInfo ?? true);
|
|
76
76
|
// if the "info" block is visible
|
|
77
77
|
_defineProperty(this, "showLabels", this.args.showLabels ?? false);
|
|
@@ -102,12 +102,12 @@ let HdsPaginationNumbered = (_class = class HdsPaginationNumbered extends Compon
|
|
|
102
102
|
// initialized and updated using the arguments passed to it.
|
|
103
103
|
|
|
104
104
|
if (queryFunction === undefined) {
|
|
105
|
-
this.
|
|
105
|
+
this._isControlled = false;
|
|
106
106
|
} else {
|
|
107
107
|
assert('@model, @models, or @route for "Hds::Pagination::Numbered" must be provided when using the @queryFunction argument', this.args.model !== undefined || this.args.models !== undefined || this.args.route !== undefined);
|
|
108
108
|
assert('@queryFunction for "Hds::Pagination::Numbered" must be a function', typeof queryFunction === 'function');
|
|
109
109
|
assert('@currentPage and @currentPageSize for "Hds::Pagination::Numbered" must be provided as numeric arguments when the pagination controls the routing', typeof this.args.currentPageSize === 'number' && typeof this.args.currentPage === 'number');
|
|
110
|
-
this.
|
|
110
|
+
this._isControlled = true;
|
|
111
111
|
}
|
|
112
112
|
assert('@totalItems for "Hds::Pagination::Numbered" must be defined as an integer number', typeof this.args.totalItems === 'number');
|
|
113
113
|
this._currentPage = this.args.currentPage ?? 1;
|
|
@@ -132,7 +132,7 @@ let HdsPaginationNumbered = (_class = class HdsPaginationNumbered extends Compon
|
|
|
132
132
|
// For this reason the "get" and "set" methods always read from or write to the private internal state (_variable).
|
|
133
133
|
|
|
134
134
|
get currentPage() {
|
|
135
|
-
if (this.
|
|
135
|
+
if (this._isControlled) {
|
|
136
136
|
// if the component is controlled, `@currentPage` is asserted to be a number
|
|
137
137
|
return this.args.currentPage;
|
|
138
138
|
} else {
|
|
@@ -140,13 +140,13 @@ let HdsPaginationNumbered = (_class = class HdsPaginationNumbered extends Compon
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
set currentPage(value) {
|
|
143
|
-
if (this.
|
|
144
|
-
// if `this.
|
|
143
|
+
if (this._isControlled) ; else {
|
|
144
|
+
// if `this._isControlled` is `false`
|
|
145
145
|
this._currentPage = value;
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
get currentPageSize() {
|
|
149
|
-
if (this.
|
|
149
|
+
if (this._isControlled) {
|
|
150
150
|
// if the component is controlled, `@currentPageSize` is asserted to be a number
|
|
151
151
|
return this.args.currentPageSize;
|
|
152
152
|
} else {
|
|
@@ -154,7 +154,7 @@ let HdsPaginationNumbered = (_class = class HdsPaginationNumbered extends Compon
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
set currentPageSize(value) {
|
|
157
|
-
if (this.
|
|
157
|
+
if (this._isControlled) ; else {
|
|
158
158
|
this._currentPageSize = value;
|
|
159
159
|
}
|
|
160
160
|
}
|
|
@@ -205,7 +205,7 @@ let HdsPaginationNumbered = (_class = class HdsPaginationNumbered extends Compon
|
|
|
205
205
|
}
|
|
206
206
|
buildQueryParamsObject(page, pageSize) {
|
|
207
207
|
// `page` may also be ellipsis
|
|
208
|
-
if (this.
|
|
208
|
+
if (this._isControlled && typeof page === 'number') {
|
|
209
209
|
// if the component is controlled, `@queryFunction` is asserted to be a function
|
|
210
210
|
return this.args.queryFunction(page, pageSize);
|
|
211
211
|
} else {
|
|
@@ -221,7 +221,7 @@ let HdsPaginationNumbered = (_class = class HdsPaginationNumbered extends Compon
|
|
|
221
221
|
};
|
|
222
222
|
|
|
223
223
|
// the "query" is dynamic and needs to be calculated
|
|
224
|
-
if (this.
|
|
224
|
+
if (this._isControlled) {
|
|
225
225
|
routing.queryPrev = this.buildQueryParamsObject(this.currentPage - 1, this.currentPageSize);
|
|
226
226
|
routing.queryNext = this.buildQueryParamsObject(this.currentPage + 1, this.currentPageSize);
|
|
227
227
|
// IMPORTANT: here we need to use an object and not an array
|
|
@@ -267,7 +267,7 @@ let HdsPaginationNumbered = (_class = class HdsPaginationNumbered extends Compon
|
|
|
267
267
|
const {
|
|
268
268
|
onPageSizeChange
|
|
269
269
|
} = this.args;
|
|
270
|
-
if (!this.
|
|
270
|
+
if (!this._isControlled) {
|
|
271
271
|
// notice: we agreed to reset the pagination to the first element (any alternative would result in an unpredictable UX)
|
|
272
272
|
this.currentPage = 1;
|
|
273
273
|
this.currentPageSize = newPageSize;
|
|
@@ -281,7 +281,7 @@ let HdsPaginationNumbered = (_class = class HdsPaginationNumbered extends Compon
|
|
|
281
281
|
getPageNumberQuery(page) {
|
|
282
282
|
return this.routing.queryPages[this.elliptizedPageArrayItemAsNumber(page)];
|
|
283
283
|
}
|
|
284
|
-
},
|
|
284
|
+
}, _descriptor = _applyDecoratedDescriptor(_class.prototype, "_currentPage", [tracked], {
|
|
285
285
|
configurable: true,
|
|
286
286
|
enumerable: true,
|
|
287
287
|
writable: true,
|
|
@@ -291,12 +291,12 @@ let HdsPaginationNumbered = (_class = class HdsPaginationNumbered extends Compon
|
|
|
291
291
|
enumerable: true,
|
|
292
292
|
writable: true,
|
|
293
293
|
initializer: null
|
|
294
|
-
}), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "
|
|
294
|
+
}), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "_isControlled", [tracked], {
|
|
295
295
|
configurable: true,
|
|
296
296
|
enumerable: true,
|
|
297
297
|
writable: true,
|
|
298
298
|
initializer: null
|
|
299
|
-
}), _applyDecoratedDescriptor(_class.prototype, "onPageChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onPageChange"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "onPageSizeChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onPageSizeChange"), _class.prototype)
|
|
299
|
+
}), _applyDecoratedDescriptor(_class.prototype, "onPageChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onPageChange"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "onPageSizeChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onPageSizeChange"), _class.prototype), _class);
|
|
300
300
|
setComponentTemplate(TEMPLATE, HdsPaginationNumbered);
|
|
301
301
|
|
|
302
302
|
export { DEFAULT_PAGE_SIZES, HdsPaginationNumbered as default, elliptize };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/pagination/numbered/index.hbs","../../../../../src/components/hds/pagination/numbered/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class=\\\"hds-pagination\\\" ...attributes>\\n {{#if this.showInfo}}\\n <Hds::Pagination::Info\\n @itemsRangeStart={{this.itemsRangeStart}}\\n @itemsRangeEnd={{this.itemsRangeEnd}}\\n @totalItems={{@totalItems}}\\n @showTotalItems={{@showTotalItems}}\\n />\\n {{/if}}\\n\\n <nav class=\\\"hds-pagination-nav\\\" aria-label={{this.ariaLabel}}>\\n <Hds::Pagination::Nav::Arrow\\n @direction=\\\"prev\\\"\\n @showLabel={{this.showLabels}}\\n @route={{this.routing.route}}\\n @query={{this.routing.queryPrev}}\\n @model={{this.routing.model}}\\n @models={{this.routing.models}}\\n @replace={{this.routing.replace}}\\n @onClick={{this.onPageChange}}\\n @disabled={{this.isDisabledPrev}}\\n />\\n {{#if this.showPageNumbers}}\\n <ul class=\\\"hds-pagination-nav__page-list\\\">\\n {{#each this.pages as |page|}}\\n <li class=\\\"hds-pagination-nav__page-item\\\">\\n {{#if (eq page \\\"…\\\")}}\\n <Hds::Pagination::Nav::Ellipsis />\\n {{else}}\\n <Hds::Pagination::Nav::Number\\n @page={{this.elliptizedPageArrayItemAsNumber page}}\\n @route={{this.routing.route}}\\n @query={{get this.routing.queryPages page}}\\n @model={{this.routing.model}}\\n @models={{this.routing.models}}\\n @replace={{this.routing.replace}}\\n @onClick={{this.onPageChange}}\\n @isSelected={{if (eq page this.currentPage) true false}}\\n />\\n {{/if}}\\n </li>\\n {{/each}}\\n </ul>\\n {{/if}}\\n <Hds::Pagination::Nav::Arrow\\n @direction=\\\"next\\\"\\n @showLabel={{this.showLabels}}\\n @route={{this.routing.route}}\\n @query={{this.routing.queryNext}}\\n @model={{this.routing.model}}\\n @models={{this.routing.models}}\\n @replace={{this.routing.replace}}\\n @onClick={{this.onPageChange}}\\n @disabled={{this.isDisabledNext}}\\n />\\n </nav>\\n\\n {{#if this.showSizeSelector}}\\n <Hds::Pagination::SizeSelector\\n @pageSizes={{this.pageSizes}}\\n @label={{@sizeSelectorLabel}}\\n @selectedSize={{this.currentPageSize}}\\n @onChange={{this.onPageSizeChange}}\\n />\\n {{/if}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport { HdsPaginationDirectionValues } from '../types.ts';\n\nimport type {\n HdsPaginationPage,\n HdsPaginationRoutingProps,\n HdsPaginationElliptizedPageArray,\n HdsPaginationElliptizedPageArrayItem,\n} from '../types';\nimport type { HdsInteractiveSignature } from '../../interactive/index.ts';\ninterface ElliptizeProps {\n pages: number[];\n current: number;\n limit?: number;\n}\n\ntype HdsInteractiveQuery = HdsInteractiveSignature['Args']['query'];\n\ntype HdsPaginationNumberedRoutingQueryProps = HdsPaginationRoutingProps & {\n queryNext?: HdsInteractiveQuery;\n queryPrev?: HdsInteractiveQuery;\n queryPages?: Record<\n HdsPaginationElliptizedPageArrayItem,\n HdsInteractiveQuery\n >;\n};\n\ntype HdsPaginationQueryFunction = (\n page: number,\n pageSize: number\n) => HdsInteractiveQuery;\n\ninterface HdsPaginationNumberedArgs extends HdsPaginationRoutingProps {\n ariaLabel?: string;\n totalItems: number;\n showLabels?: boolean;\n isTruncated?: boolean;\n currentPage?: number;\n showInfo?: boolean;\n showPageNumbers?: boolean;\n showTotalItems?: boolean;\n showSizeSelector?: boolean;\n sizeSelectorLabel?: string;\n pageSizes?: number[];\n currentPageSize?: number;\n queryFunction?: HdsPaginationQueryFunction;\n onPageChange?: (page: number, pageSize: number) => unknown;\n onPageSizeChange?: (pageSize: number) => unknown;\n}\n\ninterface HdsPaginationNumberedArgsControlledBase\n extends HdsPaginationNumberedArgs {\n currentPage: number;\n currentPageSize: number;\n queryFunction: HdsPaginationQueryFunction;\n}\n\ninterface HdsPaginationNumberedArgsControlledWithModel\n extends HdsPaginationNumberedArgsControlledBase {\n model: string | number;\n}\n\ninterface HdsPaginationNumberedArgsControlledWithModels\n extends HdsPaginationNumberedArgsControlledBase {\n models: Array<string | number>;\n}\ninterface HdsPaginationNumberedArgsControlledWithRoute\n extends HdsPaginationNumberedArgsControlledBase {\n route: string;\n}\n\ntype HdsPaginationNumberedArgsControlled =\n | HdsPaginationNumberedArgsControlledWithModel\n | HdsPaginationNumberedArgsControlledWithModels\n | HdsPaginationNumberedArgsControlledWithRoute;\n\ninterface HdsPaginationNumberedArgsUncontrolled\n extends HdsPaginationNumberedArgs {\n queryFunction?: undefined;\n}\n\nexport interface HdsPaginationNumberedSignature {\n Args:\n | HdsPaginationNumberedArgsControlled\n | HdsPaginationNumberedArgsUncontrolled;\n Element: HTMLDivElement;\n}\n\nconst ELLIPSIS = '…';\n\n// for context about the decision to use these values, see:\n// https://hashicorp.slack.com/archives/C03A0N1QK8S/p1673546329082759\nexport const DEFAULT_PAGE_SIZES = [10, 30, 50];\n\nexport const elliptize = ({\n pages,\n current,\n limit = 7,\n}: ElliptizeProps): HdsPaginationElliptizedPageArray => {\n const length = pages.length;\n\n let result = [];\n let start;\n let end;\n\n if (length <= limit) {\n return pages;\n }\n\n if (current <= length / 2) {\n start = Math.ceil(limit / 2);\n end = limit - start;\n } else {\n end = Math.ceil(limit / 2);\n start = limit - end;\n }\n\n const sliceStart: HdsPaginationElliptizedPageArray = pages.slice(0, start);\n const sliceEnd: HdsPaginationElliptizedPageArray = pages.slice(-end);\n\n if (sliceStart.includes(current) && sliceStart.includes(current + 1)) {\n // \"current\" (and its next sibling) is contained within the \"sliceStart\" block\n sliceEnd.splice(0, 1, ELLIPSIS);\n result = ([] as HdsPaginationElliptizedPageArray).concat(\n sliceStart,\n sliceEnd\n );\n } else if (sliceEnd.includes(current - 1) && sliceEnd.includes(current)) {\n // \"current\" (and its prev sibling) is contained within the \"sliceEnd\" block\n sliceStart.splice(-1, 1, ELLIPSIS);\n result = ([] as HdsPaginationElliptizedPageArray).concat(\n sliceStart,\n sliceEnd\n );\n } else {\n // this is a bit more tricky :)\n // we need to calculate how many items there are before/after the current item\n // since both the initial and ending blocks are always 2 items long (number + ellipsis)\n // and there is always the \"current\" item, we can just subtract 5 from the limit\n const delta = (limit - 5) / 2; // this is why the limit needs to be an odd number\n // we slice the array starting at the \"current\" index, minus the delta, minus one because it's an array (zero-based)\n const sliceCurr = pages.slice(current - delta - 1, current + delta);\n result = ([] as HdsPaginationElliptizedPageArray).concat(\n sliceStart.shift() as number,\n ELLIPSIS,\n sliceCurr,\n ELLIPSIS,\n sliceEnd.pop() as number\n );\n }\n\n return result;\n};\nexport default class HdsPaginationNumbered extends Component<HdsPaginationNumberedSignature> {\n // These two private variables are used to differentiate between\n // \"uncontrolled\" component (where the state is handled internally) and\n // \"controlled\" component (where the state is handled externally, by the consumer's code).\n // In the first case, these variables store the internal state of the component at any moment,\n // and their value is updated internally according to the user's interaction with the component.\n // In the second case, these variables store *only* the initial state of the component (coming from the arguments)\n // at rendering time, but from that moment on they're not updated anymore, no matter what interaction the user\n // has with the component (the state is controlled externally, eg. via query parameters)\n @tracked _currentPage;\n @tracked _currentPageSize;\n @tracked isControlled;\n\n showInfo = this.args.showInfo ?? true; // if the \"info\" block is visible\n showLabels = this.args.showLabels ?? false; // if the labels for the \"prev/next\" controls are visible\n showSizeSelector = this.args.showSizeSelector ?? true; // if the \"size selector\" block is visible\n showPageNumbers = this.args.showPageNumbers ?? true; // if the \"page numbers\" block is visible\n isTruncated = this.args.isTruncated ?? true; // if the list of \"page numbers\" is truncated\n\n constructor(owner: unknown, args: HdsPaginationNumberedSignature['Args']) {\n super(owner, args);\n\n const { queryFunction } = this.args;\n\n // This component works in two different ways, depending if we need to support\n // routing through links (`LinkTo`) for the \"navigation controls\", or not.\n // If there's no routing then the component behaves as \"uncontrolled\"\n // (the state updates - eg to the \"currentPage\" and \"currentPageSize\"\n // are handled by its internal logic).\n // If instead the component needs to update the routing (and we infer this via the \"query\" arguments)\n // then the component behaves as \"controlled\", where the state is\n // initialized and updated using the arguments passed to it.\n\n if (queryFunction === undefined) {\n this.isControlled = false;\n } else {\n assert(\n '@model, @models, or @route for \"Hds::Pagination::Numbered\" must be provided when using the @queryFunction argument',\n this.args.model !== undefined ||\n this.args.models !== undefined ||\n this.args.route !== undefined\n );\n assert(\n '@queryFunction for \"Hds::Pagination::Numbered\" must be a function',\n typeof queryFunction === 'function'\n );\n assert(\n '@currentPage and @currentPageSize for \"Hds::Pagination::Numbered\" must be provided as numeric arguments when the pagination controls the routing',\n typeof this.args.currentPageSize === 'number' &&\n typeof this.args.currentPage === 'number'\n );\n this.isControlled = true;\n }\n\n assert(\n '@totalItems for \"Hds::Pagination::Numbered\" must be defined as an integer number',\n typeof this.args.totalItems === 'number'\n );\n\n this._currentPage = this.args.currentPage ?? 1;\n // we assert that `this.pageSizes` will always be an array with at least one item\n this._currentPageSize = this.args.currentPageSize ?? this.pageSizes[0];\n }\n\n get ariaLabel(): string {\n return this.args.ariaLabel ?? 'Pagination';\n }\n\n // This very specific `get/set` pattern is used to handle the two different use cases of the component\n // being \"controlled\" (when it has routing, meaning it needs to support pagination controls as links/`LinkTo`)\n // vs being \"uncontrolled\" (see comments above for details).\n //\n // If it has routing (and so it's \"controlled\"), than the value (\"state\") of the `currentPage/currentPageSize` variables\n // is *always* determined by the controller via arguments (most of the times, connected to query parameters in the URL).\n // For this reason the \"get\" method always returns the value from the `args`,\n // while the \"set\" method never updates the private internal state (_variable).\n //\n // If instead it doesn't have routing (and so it's \"uncontrolled\") than the value (\"state\") of the `currentPage/currentPageSize` variables\n // is *always* determined by the component's internal logic (and updated according to the user interaction with it).\n // For this reason the \"get\" and \"set\" methods always read from or write to the private internal state (_variable).\n\n get currentPage(): number {\n if (this.isControlled) {\n // if the component is controlled, `@currentPage` is asserted to be a number\n return this.args.currentPage as number;\n } else {\n return this._currentPage;\n }\n }\n set currentPage(value) {\n if (this.isControlled) {\n // noop\n } else {\n // if `this.isControlled` is `false`\n this._currentPage = value as number;\n }\n }\n\n get currentPageSize(): number {\n if (this.isControlled) {\n // if the component is controlled, `@currentPageSize` is asserted to be a number\n return this.args.currentPageSize as number;\n } else {\n return this._currentPageSize as number;\n }\n }\n set currentPageSize(value) {\n if (this.isControlled) {\n // noop\n } else {\n this._currentPageSize = value;\n }\n }\n\n get pageSizes(): number[] {\n const { pageSizes = DEFAULT_PAGE_SIZES } = this.args;\n\n assert(\n // TODO: Add test for this\n `pageSizes argument must be an array with at least one item. Received: ${pageSizes}`,\n Array.isArray(pageSizes) === true && pageSizes.length > 0\n );\n\n return pageSizes;\n }\n\n get itemsRangeStart(): number {\n // Calculate the starting range of items displayed on current page\n // if currentPage = 1st page and # of items per page is 10:\n // ( (1 - 1 = 0) * 10 = 0 ) + 1 = 1\n // if current page = 2nd page:\n // ( (2 - 1 = 1) * 10 = 10 ) + 1 = 11\n return (this.currentPage - 1) * this.currentPageSize + 1;\n }\n\n get itemsRangeEnd(): number {\n // Calculate ending range of items displayed on current page\n // 2 cases: 1) full page of items or 2) last page of items\n if (this.currentPage * this.currentPageSize < this.args.totalItems) {\n // 1) full page of items (pages 1 to page before last):\n return this.itemsRangeStart + this.currentPageSize - 1;\n } else {\n // 2) last page of items:\n return this.args.totalItems;\n }\n }\n\n get pages(): HdsPaginationElliptizedPageArray {\n const pages = [];\n\n for (let i = 1; i <= this.totalPages; i++) {\n pages.push(i);\n }\n\n if (this.isTruncated) {\n return elliptize({ pages, current: this.currentPage });\n } else {\n return pages;\n }\n }\n\n get totalPages() {\n return Math.max(Math.ceil(this.args.totalItems / this.currentPageSize), 1);\n }\n\n buildQueryParamsObject(\n page: HdsPaginationElliptizedPageArrayItem,\n pageSize: number\n ): HdsInteractiveQuery {\n // `page` may also be ellipsis\n if (this.isControlled && typeof page === 'number') {\n // if the component is controlled, `@queryFunction` is asserted to be a function\n return this.args.queryFunction!(page, pageSize);\n } else {\n return {};\n }\n }\n\n get routing(): HdsPaginationNumberedRoutingQueryProps {\n const routing: HdsPaginationNumberedRoutingQueryProps = {\n route: this.args.route ?? undefined,\n model: this.args.model ?? undefined,\n models: this.args.models ?? undefined,\n replace: this.args.replace ?? undefined,\n };\n\n // the \"query\" is dynamic and needs to be calculated\n if (this.isControlled) {\n routing.queryPrev = this.buildQueryParamsObject(\n this.currentPage - 1,\n this.currentPageSize\n );\n routing.queryNext = this.buildQueryParamsObject(\n this.currentPage + 1,\n this.currentPageSize\n );\n // IMPORTANT: here we need to use an object and not an array\n // otherwise the {{get object page}} will be shifted by one\n // (the pages are 1-based while the array would be zero-based)\n routing.queryPages = {};\n this.pages.forEach(\n (page) =>\n (routing.queryPages![page] = this.buildQueryParamsObject(\n page,\n this.currentPageSize\n ))\n );\n } else {\n routing.queryPrev = undefined;\n routing.queryNext = undefined;\n }\n\n return routing;\n }\n\n get isDisabledPrev() {\n return this.currentPage === 1;\n }\n\n get isDisabledNext() {\n return this.currentPage === this.totalPages;\n }\n\n @action\n onPageChange(page: HdsPaginationPage) {\n let gotoPageNumber;\n if (page === HdsPaginationDirectionValues.Prev && this.currentPage > 1) {\n gotoPageNumber = this.currentPage - 1;\n } else if (\n page === HdsPaginationDirectionValues.Next &&\n this.currentPage < this.totalPages\n ) {\n gotoPageNumber = this.currentPage + 1;\n } else {\n gotoPageNumber = page;\n }\n\n // we want to invoke the `onPageChange` callback only on actual page change\n if (gotoPageNumber !== this.currentPage) {\n // we have already determined that `gotoPageNumber` is not `prev` or `next`\n this.currentPage = gotoPageNumber as number;\n\n const { onPageChange } = this.args;\n\n if (typeof onPageChange === 'function') {\n onPageChange(this.currentPage, this.currentPageSize);\n }\n }\n }\n\n @action\n onPageSizeChange(newPageSize: number) {\n const { onPageSizeChange } = this.args;\n\n if (!this.isControlled) {\n // notice: we agreed to reset the pagination to the first element (any alternative would result in an unpredictable UX)\n this.currentPage = 1;\n this.currentPageSize = newPageSize;\n }\n\n // invoke the callback function\n if (typeof onPageSizeChange === 'function') {\n onPageSizeChange(newPageSize);\n }\n }\n\n elliptizedPageArrayItemAsNumber = (\n item: HdsPaginationElliptizedPageArrayItem\n ): number => {\n if (typeof item === 'number') {\n return item;\n } else {\n throw new Error('Expected a number, but got an ellipsis');\n }\n };\n\n getPageNumberQuery(page: HdsPaginationElliptizedPageArrayItem) {\n return this.routing.queryPages![this.elliptizedPageArrayItemAsNumber(page)];\n }\n}\n"],"names":["ELLIPSIS","DEFAULT_PAGE_SIZES","elliptize","pages","current","limit","length","result","start","end","Math","ceil","sliceStart","slice","sliceEnd","includes","splice","concat","delta","sliceCurr","shift","pop","HdsPaginationNumbered","_class","Component","constructor","owner","args","_initializerDefineProperty","_descriptor","_descriptor2","_descriptor3","_defineProperty","showInfo","showLabels","showSizeSelector","showPageNumbers","isTruncated","item","Error","queryFunction","undefined","isControlled","assert","model","models","route","currentPageSize","currentPage","totalItems","_currentPage","_currentPageSize","pageSizes","ariaLabel","value","Array","isArray","itemsRangeStart","itemsRangeEnd","i","totalPages","push","max","buildQueryParamsObject","page","pageSize","routing","replace","queryPrev","queryNext","queryPages","forEach","isDisabledPrev","isDisabledNext","onPageChange","gotoPageNumber","HdsPaginationDirectionValues","Prev","Next","onPageSizeChange","newPageSize","getPageNumberQuery","elliptizedPageArrayItemAsNumber","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,kzEAAkzE;;;AC8Fp1E,MAAMA,QAAQ,GAAG,GAAG,CAAA;;AAEpB;AACA;AACO,MAAMC,kBAAkB,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAC;AAEvC,MAAMC,SAAS,GAAGA,CAAC;EACxBC,K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IAAA;AAAA,CAAA,CAAA,EAAAN,yBAAA,CAAA5D,MAAA,CAAA6D,SAAA,EAAA,cAAA,EAAA,CAoNPM,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAArE,MAAA,CAAA6D,SAAA,EAAA7D,cAAAA,CAAAA,EAAAA,MAAA,CAAA6D,SAAA,CAAA,EAAAD,yBAAA,CAAA5D,MAAA,CAAA6D,SAAA,uBA2BNM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAArE,MAAA,CAAA6D,SAAA,EAAA,kBAAA,CAAA,EAAA7D,MAAA,CAAA6D,SAAA,IAAA7D,MAAA,EAAA;AA1PiCsE,oBAAA,CAAAC,QAAA,EAArBxE,qBAAqB,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/pagination/numbered/index.hbs","../../../../../src/components/hds/pagination/numbered/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class=\\\"hds-pagination\\\" ...attributes>\\n {{#if this.showInfo}}\\n <Hds::Pagination::Info\\n @itemsRangeStart={{this.itemsRangeStart}}\\n @itemsRangeEnd={{this.itemsRangeEnd}}\\n @totalItems={{@totalItems}}\\n @showTotalItems={{@showTotalItems}}\\n />\\n {{/if}}\\n\\n <nav class=\\\"hds-pagination-nav\\\" aria-label={{this.ariaLabel}}>\\n <Hds::Pagination::Nav::Arrow\\n @direction=\\\"prev\\\"\\n @showLabel={{this.showLabels}}\\n @route={{this.routing.route}}\\n @query={{this.routing.queryPrev}}\\n @model={{this.routing.model}}\\n @models={{this.routing.models}}\\n @replace={{this.routing.replace}}\\n @onClick={{this.onPageChange}}\\n @disabled={{this.isDisabledPrev}}\\n />\\n {{#if this.showPageNumbers}}\\n <ul class=\\\"hds-pagination-nav__page-list\\\">\\n {{#each this.pages as |page|}}\\n <li class=\\\"hds-pagination-nav__page-item\\\">\\n {{#if (eq page \\\"…\\\")}}\\n <Hds::Pagination::Nav::Ellipsis />\\n {{else}}\\n <Hds::Pagination::Nav::Number\\n @page={{this.elliptizedPageArrayItemAsNumber page}}\\n @route={{this.routing.route}}\\n @query={{get this.routing.queryPages page}}\\n @model={{this.routing.model}}\\n @models={{this.routing.models}}\\n @replace={{this.routing.replace}}\\n @onClick={{this.onPageChange}}\\n @isSelected={{if (eq page this.currentPage) true false}}\\n />\\n {{/if}}\\n </li>\\n {{/each}}\\n </ul>\\n {{/if}}\\n <Hds::Pagination::Nav::Arrow\\n @direction=\\\"next\\\"\\n @showLabel={{this.showLabels}}\\n @route={{this.routing.route}}\\n @query={{this.routing.queryNext}}\\n @model={{this.routing.model}}\\n @models={{this.routing.models}}\\n @replace={{this.routing.replace}}\\n @onClick={{this.onPageChange}}\\n @disabled={{this.isDisabledNext}}\\n />\\n </nav>\\n\\n {{#if this.showSizeSelector}}\\n <Hds::Pagination::SizeSelector\\n @pageSizes={{this.pageSizes}}\\n @label={{@sizeSelectorLabel}}\\n @selectedSize={{this.currentPageSize}}\\n @onChange={{this.onPageSizeChange}}\\n />\\n {{/if}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport { HdsPaginationDirectionValues } from '../types.ts';\n\nimport type {\n HdsPaginationPage,\n HdsPaginationRoutingProps,\n HdsPaginationElliptizedPageArray,\n HdsPaginationElliptizedPageArrayItem,\n} from '../types';\nimport type { HdsInteractiveSignature } from '../../interactive/index.ts';\ninterface ElliptizeProps {\n pages: number[];\n current: number;\n limit?: number;\n}\n\ntype HdsInteractiveQuery = HdsInteractiveSignature['Args']['query'];\n\ntype HdsPaginationNumberedRoutingQueryProps = HdsPaginationRoutingProps & {\n queryNext?: HdsInteractiveQuery;\n queryPrev?: HdsInteractiveQuery;\n queryPages?: Record<\n HdsPaginationElliptizedPageArrayItem,\n HdsInteractiveQuery\n >;\n};\n\ntype HdsPaginationQueryFunction = (\n page: number,\n pageSize: number\n) => HdsInteractiveQuery;\n\ninterface HdsPaginationNumberedArgs extends HdsPaginationRoutingProps {\n ariaLabel?: string;\n totalItems: number;\n showLabels?: boolean;\n isTruncated?: boolean;\n currentPage?: number;\n showInfo?: boolean;\n showPageNumbers?: boolean;\n showTotalItems?: boolean;\n showSizeSelector?: boolean;\n sizeSelectorLabel?: string;\n pageSizes?: number[];\n currentPageSize?: number;\n queryFunction?: HdsPaginationQueryFunction;\n onPageChange?: (page: number, pageSize: number) => unknown;\n onPageSizeChange?: (pageSize: number) => unknown;\n}\n\ninterface HdsPaginationNumberedArgsControlledBase\n extends HdsPaginationNumberedArgs {\n currentPage: number;\n currentPageSize: number;\n queryFunction: HdsPaginationQueryFunction;\n}\n\ninterface HdsPaginationNumberedArgsControlledWithModel\n extends HdsPaginationNumberedArgsControlledBase {\n model: string | number;\n}\n\ninterface HdsPaginationNumberedArgsControlledWithModels\n extends HdsPaginationNumberedArgsControlledBase {\n models: Array<string | number>;\n}\ninterface HdsPaginationNumberedArgsControlledWithRoute\n extends HdsPaginationNumberedArgsControlledBase {\n route: string;\n}\n\ntype HdsPaginationNumberedArgsControlled =\n | HdsPaginationNumberedArgsControlledWithModel\n | HdsPaginationNumberedArgsControlledWithModels\n | HdsPaginationNumberedArgsControlledWithRoute;\n\ninterface HdsPaginationNumberedArgsUncontrolled\n extends HdsPaginationNumberedArgs {\n queryFunction?: undefined;\n}\n\nexport interface HdsPaginationNumberedSignature {\n Args:\n | HdsPaginationNumberedArgsControlled\n | HdsPaginationNumberedArgsUncontrolled;\n Element: HTMLDivElement;\n}\n\nconst ELLIPSIS = '…';\n\n// for context about the decision to use these values, see:\n// https://hashicorp.slack.com/archives/C03A0N1QK8S/p1673546329082759\nexport const DEFAULT_PAGE_SIZES = [10, 30, 50];\n\nexport const elliptize = ({\n pages,\n current,\n limit = 7,\n}: ElliptizeProps): HdsPaginationElliptizedPageArray => {\n const length = pages.length;\n\n let result = [];\n let start;\n let end;\n\n if (length <= limit) {\n return pages;\n }\n\n if (current <= length / 2) {\n start = Math.ceil(limit / 2);\n end = limit - start;\n } else {\n end = Math.ceil(limit / 2);\n start = limit - end;\n }\n\n const sliceStart: HdsPaginationElliptizedPageArray = pages.slice(0, start);\n const sliceEnd: HdsPaginationElliptizedPageArray = pages.slice(-end);\n\n if (sliceStart.includes(current) && sliceStart.includes(current + 1)) {\n // \"current\" (and its next sibling) is contained within the \"sliceStart\" block\n sliceEnd.splice(0, 1, ELLIPSIS);\n result = ([] as HdsPaginationElliptizedPageArray).concat(\n sliceStart,\n sliceEnd\n );\n } else if (sliceEnd.includes(current - 1) && sliceEnd.includes(current)) {\n // \"current\" (and its prev sibling) is contained within the \"sliceEnd\" block\n sliceStart.splice(-1, 1, ELLIPSIS);\n result = ([] as HdsPaginationElliptizedPageArray).concat(\n sliceStart,\n sliceEnd\n );\n } else {\n // this is a bit more tricky :)\n // we need to calculate how many items there are before/after the current item\n // since both the initial and ending blocks are always 2 items long (number + ellipsis)\n // and there is always the \"current\" item, we can just subtract 5 from the limit\n const delta = (limit - 5) / 2; // this is why the limit needs to be an odd number\n // we slice the array starting at the \"current\" index, minus the delta, minus one because it's an array (zero-based)\n const sliceCurr = pages.slice(current - delta - 1, current + delta);\n result = ([] as HdsPaginationElliptizedPageArray).concat(\n sliceStart.shift() as number,\n ELLIPSIS,\n sliceCurr,\n ELLIPSIS,\n sliceEnd.pop() as number\n );\n }\n\n return result;\n};\nexport default class HdsPaginationNumbered extends Component<HdsPaginationNumberedSignature> {\n // These two private variables are used to differentiate between\n // \"uncontrolled\" component (where the state is handled internally) and\n // \"controlled\" component (where the state is handled externally, by the consumer's code).\n // In the first case, these variables store the internal state of the component at any moment,\n // and their value is updated internally according to the user's interaction with the component.\n // In the second case, these variables store *only* the initial state of the component (coming from the arguments)\n // at rendering time, but from that moment on they're not updated anymore, no matter what interaction the user\n // has with the component (the state is controlled externally, eg. via query parameters)\n @tracked private _currentPage;\n @tracked private _currentPageSize;\n @tracked private _isControlled;\n\n showInfo = this.args.showInfo ?? true; // if the \"info\" block is visible\n showLabels = this.args.showLabels ?? false; // if the labels for the \"prev/next\" controls are visible\n showSizeSelector = this.args.showSizeSelector ?? true; // if the \"size selector\" block is visible\n showPageNumbers = this.args.showPageNumbers ?? true; // if the \"page numbers\" block is visible\n isTruncated = this.args.isTruncated ?? true; // if the list of \"page numbers\" is truncated\n\n constructor(owner: unknown, args: HdsPaginationNumberedSignature['Args']) {\n super(owner, args);\n\n const { queryFunction } = this.args;\n\n // This component works in two different ways, depending if we need to support\n // routing through links (`LinkTo`) for the \"navigation controls\", or not.\n // If there's no routing then the component behaves as \"uncontrolled\"\n // (the state updates - eg to the \"currentPage\" and \"currentPageSize\"\n // are handled by its internal logic).\n // If instead the component needs to update the routing (and we infer this via the \"query\" arguments)\n // then the component behaves as \"controlled\", where the state is\n // initialized and updated using the arguments passed to it.\n\n if (queryFunction === undefined) {\n this._isControlled = false;\n } else {\n assert(\n '@model, @models, or @route for \"Hds::Pagination::Numbered\" must be provided when using the @queryFunction argument',\n this.args.model !== undefined ||\n this.args.models !== undefined ||\n this.args.route !== undefined\n );\n assert(\n '@queryFunction for \"Hds::Pagination::Numbered\" must be a function',\n typeof queryFunction === 'function'\n );\n assert(\n '@currentPage and @currentPageSize for \"Hds::Pagination::Numbered\" must be provided as numeric arguments when the pagination controls the routing',\n typeof this.args.currentPageSize === 'number' &&\n typeof this.args.currentPage === 'number'\n );\n this._isControlled = true;\n }\n\n assert(\n '@totalItems for \"Hds::Pagination::Numbered\" must be defined as an integer number',\n typeof this.args.totalItems === 'number'\n );\n\n this._currentPage = this.args.currentPage ?? 1;\n // we assert that `this.pageSizes` will always be an array with at least one item\n this._currentPageSize = this.args.currentPageSize ?? this.pageSizes[0];\n }\n\n get ariaLabel(): string {\n return this.args.ariaLabel ?? 'Pagination';\n }\n\n // This very specific `get/set` pattern is used to handle the two different use cases of the component\n // being \"controlled\" (when it has routing, meaning it needs to support pagination controls as links/`LinkTo`)\n // vs being \"uncontrolled\" (see comments above for details).\n //\n // If it has routing (and so it's \"controlled\"), than the value (\"state\") of the `currentPage/currentPageSize` variables\n // is *always* determined by the controller via arguments (most of the times, connected to query parameters in the URL).\n // For this reason the \"get\" method always returns the value from the `args`,\n // while the \"set\" method never updates the private internal state (_variable).\n //\n // If instead it doesn't have routing (and so it's \"uncontrolled\") than the value (\"state\") of the `currentPage/currentPageSize` variables\n // is *always* determined by the component's internal logic (and updated according to the user interaction with it).\n // For this reason the \"get\" and \"set\" methods always read from or write to the private internal state (_variable).\n\n get currentPage(): number {\n if (this._isControlled) {\n // if the component is controlled, `@currentPage` is asserted to be a number\n return this.args.currentPage as number;\n } else {\n return this._currentPage;\n }\n }\n set currentPage(value) {\n if (this._isControlled) {\n // noop\n } else {\n // if `this._isControlled` is `false`\n this._currentPage = value as number;\n }\n }\n\n get currentPageSize(): number {\n if (this._isControlled) {\n // if the component is controlled, `@currentPageSize` is asserted to be a number\n return this.args.currentPageSize as number;\n } else {\n return this._currentPageSize as number;\n }\n }\n set currentPageSize(value) {\n if (this._isControlled) {\n // noop\n } else {\n this._currentPageSize = value;\n }\n }\n\n get pageSizes(): number[] {\n const { pageSizes = DEFAULT_PAGE_SIZES } = this.args;\n\n assert(\n // TODO: Add test for this\n `pageSizes argument must be an array with at least one item. Received: ${pageSizes}`,\n Array.isArray(pageSizes) === true && pageSizes.length > 0\n );\n\n return pageSizes;\n }\n\n get itemsRangeStart(): number {\n // Calculate the starting range of items displayed on current page\n // if currentPage = 1st page and # of items per page is 10:\n // ( (1 - 1 = 0) * 10 = 0 ) + 1 = 1\n // if current page = 2nd page:\n // ( (2 - 1 = 1) * 10 = 10 ) + 1 = 11\n return (this.currentPage - 1) * this.currentPageSize + 1;\n }\n\n get itemsRangeEnd(): number {\n // Calculate ending range of items displayed on current page\n // 2 cases: 1) full page of items or 2) last page of items\n if (this.currentPage * this.currentPageSize < this.args.totalItems) {\n // 1) full page of items (pages 1 to page before last):\n return this.itemsRangeStart + this.currentPageSize - 1;\n } else {\n // 2) last page of items:\n return this.args.totalItems;\n }\n }\n\n get pages(): HdsPaginationElliptizedPageArray {\n const pages = [];\n\n for (let i = 1; i <= this.totalPages; i++) {\n pages.push(i);\n }\n\n if (this.isTruncated) {\n return elliptize({ pages, current: this.currentPage });\n } else {\n return pages;\n }\n }\n\n get totalPages() {\n return Math.max(Math.ceil(this.args.totalItems / this.currentPageSize), 1);\n }\n\n buildQueryParamsObject(\n page: HdsPaginationElliptizedPageArrayItem,\n pageSize: number\n ): HdsInteractiveQuery {\n // `page` may also be ellipsis\n if (this._isControlled && typeof page === 'number') {\n // if the component is controlled, `@queryFunction` is asserted to be a function\n return this.args.queryFunction!(page, pageSize);\n } else {\n return {};\n }\n }\n\n get routing(): HdsPaginationNumberedRoutingQueryProps {\n const routing: HdsPaginationNumberedRoutingQueryProps = {\n route: this.args.route ?? undefined,\n model: this.args.model ?? undefined,\n models: this.args.models ?? undefined,\n replace: this.args.replace ?? undefined,\n };\n\n // the \"query\" is dynamic and needs to be calculated\n if (this._isControlled) {\n routing.queryPrev = this.buildQueryParamsObject(\n this.currentPage - 1,\n this.currentPageSize\n );\n routing.queryNext = this.buildQueryParamsObject(\n this.currentPage + 1,\n this.currentPageSize\n );\n // IMPORTANT: here we need to use an object and not an array\n // otherwise the {{get object page}} will be shifted by one\n // (the pages are 1-based while the array would be zero-based)\n routing.queryPages = {};\n this.pages.forEach(\n (page) =>\n (routing.queryPages![page] = this.buildQueryParamsObject(\n page,\n this.currentPageSize\n ))\n );\n } else {\n routing.queryPrev = undefined;\n routing.queryNext = undefined;\n }\n\n return routing;\n }\n\n get isDisabledPrev() {\n return this.currentPage === 1;\n }\n\n get isDisabledNext() {\n return this.currentPage === this.totalPages;\n }\n\n @action\n onPageChange(page: HdsPaginationPage) {\n let gotoPageNumber;\n if (page === HdsPaginationDirectionValues.Prev && this.currentPage > 1) {\n gotoPageNumber = this.currentPage - 1;\n } else if (\n page === HdsPaginationDirectionValues.Next &&\n this.currentPage < this.totalPages\n ) {\n gotoPageNumber = this.currentPage + 1;\n } else {\n gotoPageNumber = page;\n }\n\n // we want to invoke the `onPageChange` callback only on actual page change\n if (gotoPageNumber !== this.currentPage) {\n // we have already determined that `gotoPageNumber` is not `prev` or `next`\n this.currentPage = gotoPageNumber as number;\n\n const { onPageChange } = this.args;\n\n if (typeof onPageChange === 'function') {\n onPageChange(this.currentPage, this.currentPageSize);\n }\n }\n }\n\n @action\n onPageSizeChange(newPageSize: number) {\n const { onPageSizeChange } = this.args;\n\n if (!this._isControlled) {\n // notice: we agreed to reset the pagination to the first element (any alternative would result in an unpredictable UX)\n this.currentPage = 1;\n this.currentPageSize = newPageSize;\n }\n\n // invoke the callback function\n if (typeof onPageSizeChange === 'function') {\n onPageSizeChange(newPageSize);\n }\n }\n\n elliptizedPageArrayItemAsNumber = (\n item: HdsPaginationElliptizedPageArrayItem\n ): number => {\n if (typeof item === 'number') {\n return item;\n } else {\n throw new Error('Expected a number, but got an ellipsis');\n }\n };\n\n getPageNumberQuery(page: HdsPaginationElliptizedPageArrayItem) {\n return this.routing.queryPages![this.elliptizedPageArrayItemAsNumber(page)];\n }\n}\n"],"names":["ELLIPSIS","DEFAULT_PAGE_SIZES","elliptize","pages","current","limit","length","result","start","end","Math","ceil","sliceStart","slice","sliceEnd","includes","splice","concat","delta","sliceCurr","shift","pop","HdsPaginationNumbered","_class","Component","constructor","owner","args","_initializerDefineProperty","_descriptor","_descriptor2","_descriptor3","_defineProperty","showInfo","showLabels","showSizeSelector","showPageNumbers","isTruncated","item","Error","queryFunction","undefined","_isControlled","assert","model","models","route","currentPageSize","currentPage","totalItems","_currentPage","_currentPageSize","pageSizes","ariaLabel","value","Array","isArray","itemsRangeStart","itemsRangeEnd","i","totalPages","push","max","buildQueryParamsObject","page","pageSize","routing","replace","queryPrev","queryNext","queryPages","forEach","isDisabledPrev","isDisabledNext","onPageChange","gotoPageNumber","HdsPaginationDirectionValues","Prev","Next","onPageSizeChange","newPageSize","getPageNumberQuery","elliptizedPageArrayItemAsNumber","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,kzEAAkzE;;;AC8Fp1E,MAAMA,QAAQ,GAAG,GAAG;;AAEpB;AACA;AACO,MAAMC,kBAAkB,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;AAEtC,MAAMC,SAAS,GAAGA,CAAC;EACxBC,KAAK;EACLC,OAAO;AACPC,EAAAA,KAAK,GAAG;AACM,CAAC,KAAuC;AACtD,EAAA,MAAMC,MAAM,GAAGH,KAAK,CAACG,MAAM;EAE3B,IAAIC,MAAM,GAAG,EAAE;AACf,EAAA,IAAIC,KAAK;AACT,EAAA,IAAIC,GAAG;EAEP,IAAIH,MAAM,IAAID,KAAK,EAAE;AACnB,IAAA,OAAOF,KAAK;AACd;AAEA,EAAA,IAAIC,OAAO,IAAIE,MAAM,GAAG,CAAC,EAAE;IACzBE,KAAK,GAAGE,IAAI,CAACC,IAAI,CAACN,KAAK,GAAG,CAAC,CAAC;IAC5BI,GAAG,GAAGJ,KAAK,GAAGG,KAAK;AACrB,GAAC,MAAM;IACLC,GAAG,GAAGC,IAAI,CAACC,IAAI,CAACN,KAAK,GAAG,CAAC,CAAC;IAC1BG,KAAK,GAAGH,KAAK,GAAGI,GAAG;AACrB;EAEA,MAAMG,UAA4C,GAAGT,KAAK,CAACU,KAAK,CAAC,CAAC,EAAEL,KAAK,CAAC;EAC1E,MAAMM,QAA0C,GAAGX,KAAK,CAACU,KAAK,CAAC,CAACJ,GAAG,CAAC;AAEpE,EAAA,IAAIG,UAAU,CAACG,QAAQ,CAACX,OAAO,CAAC,IAAIQ,UAAU,C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AAA,EAAA,kBAAA,CAAA,EAAA7D,MAAA,CAAA6D,SAAA,GAAA7D,MAAA;AA1PiCsE,oBAAA,CAAAC,QAAA,EAArBxE,qBAAqB,CAAA;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as _applyDecoratedDescriptor, a as _defineProperty } from '../../../../_rollupPluginBabelHelpers-
|
|
1
|
+
import { _ as _applyDecoratedDescriptor, a as _defineProperty } from '../../../../_rollupPluginBabelHelpers-81503waH.js';
|
|
2
2
|
import Component from '@glimmer/component';
|
|
3
3
|
import { assert } from '@ember/debug';
|
|
4
4
|
import { guidFor } from '@ember/object/internals';
|
|
@@ -6,13 +6,13 @@ import { action } from '@ember/object';
|
|
|
6
6
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
7
7
|
import { setComponentTemplate } from '@ember/component';
|
|
8
8
|
|
|
9
|
-
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<div class=\"hds-pagination-size-selector\" ...attributes>\n <label class=\"hds-typography-body-100 hds-font-weight-medium\" for={{this.
|
|
9
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<div class=\"hds-pagination-size-selector\" ...attributes>\n <label class=\"hds-typography-body-100 hds-font-weight-medium\" for={{this._sizeSelectorId}}>\n {{this.label}}\n </label>\n <Hds::Form::Select::Base id={{this._sizeSelectorId}} {{on \"change\" this.onChange}} as |S|>\n <S.Options>\n {{#each this.pageSizes as |size|}}\n <option value={{size}} selected={{if (eq size this.selectedSize) true null}}>{{size}}</option>\n {{/each}}\n </S.Options>\n </Hds::Form::Select::Base>\n</div>");
|
|
10
10
|
|
|
11
11
|
var _class;
|
|
12
12
|
let HdsPaginationSizeSelector = (_class = class HdsPaginationSizeSelector extends Component {
|
|
13
13
|
constructor(...args) {
|
|
14
14
|
super(...args);
|
|
15
|
-
_defineProperty(this, "
|
|
15
|
+
_defineProperty(this, "_sizeSelectorId", 'pagination-size-selector-' + guidFor(this));
|
|
16
16
|
}
|
|
17
17
|
get pageSizes() {
|
|
18
18
|
const {
|
|
@@ -43,7 +43,7 @@ let HdsPaginationSizeSelector = (_class = class HdsPaginationSizeSelector extend
|
|
|
43
43
|
onChange(parseInt(target.value));
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
},
|
|
46
|
+
}, _applyDecoratedDescriptor(_class.prototype, "onChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onChange"), _class.prototype), _class);
|
|
47
47
|
setComponentTemplate(TEMPLATE, HdsPaginationSizeSelector);
|
|
48
48
|
|
|
49
49
|
export { HdsPaginationSizeSelector as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/pagination/size-selector/index.hbs","../../../../../src/components/hds/pagination/size-selector/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class=\\\"hds-pagination-size-selector\\\" ...attributes>\\n <label class=\\\"hds-typography-body-100 hds-font-weight-medium\\\" for={{this.
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/pagination/size-selector/index.hbs","../../../../../src/components/hds/pagination/size-selector/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class=\\\"hds-pagination-size-selector\\\" ...attributes>\\n <label class=\\\"hds-typography-body-100 hds-font-weight-medium\\\" for={{this._sizeSelectorId}}>\\n {{this.label}}\\n </label>\\n <Hds::Form::Select::Base id={{this._sizeSelectorId}} {{on \\\"change\\\" this.onChange}} as |S|>\\n <S.Options>\\n {{#each this.pageSizes as |size|}}\\n <option value={{size}} selected={{if (eq size this.selectedSize) true null}}>{{size}}</option>\\n {{/each}}\\n </S.Options>\\n </Hds::Form::Select::Base>\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\nimport { guidFor } from '@ember/object/internals';\nimport { action } from '@ember/object';\n\nimport type { HdsFormSelectBaseSignature } from '../../form/select/base';\n\nexport interface HdsPaginationSizeSelectorSignature {\n Args: {\n pageSizes: number[];\n label?: string;\n selectedSize?: number;\n onChange?: (size: number) => void;\n };\n Element: HTMLDivElement;\n}\n\nexport default class HdsPaginationSizeSelector extends Component<HdsPaginationSizeSelectorSignature> {\n private _sizeSelectorId = 'pagination-size-selector-' + guidFor(this);\n\n get pageSizes(): number[] {\n const { pageSizes } = this.args;\n\n assert(\n '@pageSizes for \"Pagination::SizeSelector\" must be defined',\n pageSizes !== undefined\n );\n\n return pageSizes;\n }\n\n get selectedSize(): number | undefined {\n const { selectedSize } = this.args;\n\n assert(\n `@selectedSize for \"Pagination::SizeSelector\" must one of the @pageSizes provided (${this.pageSizes.join(\n ','\n )}), received ${selectedSize}`,\n selectedSize === undefined || this.pageSizes.includes(selectedSize)\n );\n\n return selectedSize;\n }\n\n get label(): string {\n const { label = 'Items per page' } = this.args;\n\n return label;\n }\n\n @action\n onChange(e: Event): void {\n const { onChange } = this.args;\n\n const target = e.target as HdsFormSelectBaseSignature['Element'];\n\n if (typeof onChange === 'function') {\n onChange(parseInt(target.value));\n }\n }\n}\n"],"names":["HdsPaginationSizeSelector","_class","Component","constructor","args","_defineProperty","guidFor","pageSizes","assert","undefined","selectedSize","join","includes","label","onChange","e","target","parseInt","value","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;AACA,eAAe,kBAAkB,CAAC,ulBAAulB;;;ACqBpmBA,IAAAA,yBAAyB,IAAAC,MAAA,GAA/B,M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