@lifesg/react-design-system 4.0.0-alpha.5 → 4.0.0-alpha.7
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/accordion/accordion.js.map +1 -1
- package/accordion/types.d.ts +1 -1
- package/alert/alert.js.map +1 -1
- package/alert/types.d.ts +2 -0
- package/animations/loading-dots/loading-dots.d.ts +5 -2
- package/animations/loading-dots/loading-dots.js.map +1 -1
- package/animations/loading-dots-spinner/loading-dots-spinner.d.ts +3 -0
- package/animations/loading-dots-spinner/loading-dots-spinner.js.map +1 -1
- package/animations/loading-dots-spinner/lottie-animation.d.ts +2 -2
- package/animations/loading-dots-spinner/lottie-animation.js.map +1 -1
- package/animations/loading-spinner/loading-spinner.d.ts +5 -2
- package/animations/loading-spinner/loading-spinner.js.map +1 -1
- package/animations/themed-loading-spinner/themed-loading-spinner.d.ts +5 -2
- package/animations/themed-loading-spinner/themed-loading-spinner.js.map +1 -1
- package/animations/types.d.ts +13 -6
- package/avatar/avatar.js.map +1 -1
- package/badge/badge.js.map +1 -1
- package/badge/types.d.ts +13 -2
- package/box-container/box-container.js.map +1 -1
- package/box-container/types.d.ts +2 -0
- package/breadcrumb/breadcrumb.d.ts +7 -0
- package/breadcrumb/breadcrumb.js.map +1 -1
- package/breadcrumb/types.d.ts +36 -0
- package/button/button.d.ts +1 -0
- package/button/button.js.map +1 -1
- package/button/types.d.ts +47 -9
- package/calendar/calendar.d.ts +3 -0
- package/calendar/calendar.js.map +1 -1
- package/calendar/types.d.ts +46 -10
- package/card/card.d.ts +1 -0
- package/card/card.js.map +1 -1
- package/card/types.d.ts +1 -0
- package/checkbox/checkbox.d.ts +3 -0
- package/checkbox/checkbox.js.map +1 -1
- package/checkbox/types.d.ts +23 -3
- package/cjs/accordion/accordion.js.map +1 -1
- package/cjs/alert/alert.js.map +1 -1
- package/cjs/animations/loading-dots/loading-dots.js.map +1 -1
- package/cjs/animations/loading-dots-spinner/loading-dots-spinner.js.map +1 -1
- package/cjs/animations/loading-dots-spinner/lottie-animation.js.map +1 -1
- package/cjs/animations/loading-spinner/loading-spinner.js.map +1 -1
- package/cjs/animations/themed-loading-spinner/themed-loading-spinner.js.map +1 -1
- package/cjs/avatar/avatar.js.map +1 -1
- package/cjs/badge/badge.js.map +1 -1
- package/cjs/box-container/box-container.js.map +1 -1
- package/cjs/breadcrumb/breadcrumb.js.map +1 -1
- package/cjs/button/button.js.map +1 -1
- package/cjs/calendar/calendar.js.map +1 -1
- package/cjs/card/card.js.map +1 -1
- package/cjs/checkbox/checkbox.js.map +1 -1
- package/cjs/countdown-timer/countdown-timer.js.map +1 -1
- package/cjs/dashed-border/dashed-border.js.map +1 -1
- package/cjs/data-table/data-table.js +1 -1
- package/cjs/data-table/data-table.js.map +1 -1
- package/cjs/data-table/data-table.styles.js +1 -1
- package/cjs/data-table/data-table.styles.js.map +1 -1
- package/cjs/data-table/data-table.styles_rxganh.css +27 -0
- package/cjs/date-input/date-input.js.map +1 -1
- package/cjs/date-navigator/date-navigator.js.map +1 -1
- package/cjs/date-range-input/date-range-input.js.map +1 -1
- package/cjs/divider/divider.js.map +1 -1
- package/cjs/drawer/drawer.js.map +1 -1
- package/cjs/e-signature/e-signature.js.map +1 -1
- package/cjs/error-display/error-display.js.map +1 -1
- package/cjs/external/dompurify/dist/purify.es.js +2 -2
- package/cjs/external/dompurify/dist/purify.es.js.map +1 -1
- package/cjs/external/lodash/_setCacheHas.js.map +1 -1
- package/cjs/external/lodash/lodash.js +1 -1
- package/cjs/external/lodash/lodash.js.map +1 -1
- package/cjs/feedback-rating/feedback-rating.js.map +1 -1
- package/cjs/file-download/file-download.js.map +1 -1
- package/cjs/file-upload/file-item-edit.js.map +1 -1
- package/cjs/file-upload/file-list/file-list.js.map +1 -1
- package/cjs/file-upload/file-list-item/file-list-item.js.map +1 -1
- package/cjs/file-upload/file-list-item/file-list-item.styles.js +1 -1
- package/cjs/file-upload/file-list-item/file-list-item.styles.js.map +1 -1
- package/cjs/file-upload/file-list-item/{file-list-item.styles_o8000f.css → file-list-item.styles_kgtfke.css} +1 -1
- package/cjs/file-upload/file-upload.js.map +1 -1
- package/cjs/filter/addons/filter-item-checkbox-helpers.js.map +1 -1
- package/cjs/filter/addons/filter-item-checkbox.js.map +1 -1
- package/cjs/filter/filter-item.js +1 -1
- package/cjs/filter/filter-item.js.map +1 -1
- package/cjs/filter/filter.js.map +1 -1
- package/cjs/footer/footer.js.map +1 -1
- package/cjs/form/form-custom-field/form-custom-field.js +2 -0
- package/cjs/form/form-custom-field/form-custom-field.js.map +1 -0
- package/cjs/form/form-date-input/form-date-input.js +2 -0
- package/cjs/form/form-date-input/form-date-input.js.map +1 -0
- package/cjs/form/form-date-range-input/form-date-range-input.js +2 -0
- package/cjs/form/form-date-range-input/form-date-range-input.js.map +1 -0
- package/cjs/form/form-e-signature/form-e-signature.js +2 -0
- package/cjs/form/form-e-signature/form-e-signature.js.map +1 -0
- package/cjs/form/form-histogram-slider/form-histogram-slider.js +2 -0
- package/cjs/form/form-histogram-slider/form-histogram-slider.js.map +1 -0
- package/cjs/form/form-input/form-input.js +2 -0
- package/cjs/form/form-input/form-input.js.map +1 -0
- package/cjs/form/form-input-group/form-input-group.js +2 -0
- package/cjs/form/form-input-group/form-input-group.js.map +1 -0
- package/cjs/form/form-label/form-label-addon.js +2 -0
- package/cjs/form/form-label/form-label-addon.js.map +1 -0
- package/cjs/form/form-label/form-label-addon.styles.js +2 -0
- package/cjs/form/form-label/form-label-addon.styles.js.map +1 -0
- package/cjs/form/form-label/form-label-addon.styles_aztasj.css +1 -0
- package/cjs/form/form-label/form-label.js +2 -0
- package/cjs/form/form-label/form-label.js.map +1 -0
- package/cjs/form/form-label/form-label.styles.js +2 -0
- package/cjs/form/form-label/form-label.styles.js.map +1 -0
- package/cjs/form/form-label/form-label.styles_180zf7j.css +6 -0
- package/cjs/form/form-masked-input/form-masked-input.js +2 -0
- package/cjs/form/form-masked-input/form-masked-input.js.map +1 -0
- package/cjs/form/form-multi-select/form-multi-select.js +2 -0
- package/cjs/form/form-multi-select/form-multi-select.js.map +1 -0
- package/cjs/form/form-nested-multi-select/form-nested-multi-select.js +2 -0
- package/cjs/form/form-nested-multi-select/form-nested-multi-select.js.map +1 -0
- package/cjs/form/form-nested-select/form-nested-select.js +2 -0
- package/cjs/form/form-nested-select/form-nested-select.js.map +1 -0
- package/cjs/form/form-otp-verification/form-otp-verification.js +2 -0
- package/cjs/form/form-otp-verification/form-otp-verification.js.map +1 -0
- package/cjs/form/form-phone-number-input/form-phone-number-input.js +2 -0
- package/cjs/form/form-phone-number-input/form-phone-number-input.js.map +1 -0
- package/cjs/form/form-predictive-text-input/form-predictive-text-input.js +2 -0
- package/cjs/form/form-predictive-text-input/form-predictive-text-input.js.map +1 -0
- package/cjs/form/form-range-select/form-range-select.js +2 -0
- package/cjs/form/form-range-select/form-range-select.js.map +1 -0
- package/cjs/form/form-range-slider/form-range-slider.js +2 -0
- package/cjs/form/form-range-slider/form-range-slider.js.map +1 -0
- package/cjs/form/form-select/form-select.js +2 -0
- package/cjs/form/form-select/form-select.js.map +1 -0
- package/cjs/form/form-select-histogram/form-select-histogram.js +2 -0
- package/cjs/form/form-select-histogram/form-select-histogram.js.map +1 -0
- package/cjs/form/form-slider/form-slider.js +2 -0
- package/cjs/form/form-slider/form-slider.js.map +1 -0
- package/cjs/form/form-textarea/form-textarea.js +2 -0
- package/cjs/form/form-textarea/form-textarea.js.map +1 -0
- package/cjs/form/form-textarea/form-textarea.styles.js +2 -0
- package/cjs/form/form-textarea/form-textarea.styles.js.map +1 -0
- package/cjs/form/form-textarea/form-textarea.styles_1kneyif.css +3 -0
- package/cjs/form/form-time-range-picker/form-time-range-picker.js +2 -0
- package/cjs/form/form-time-range-picker/form-time-range-picker.js.map +1 -0
- package/cjs/form/form-timepicker/form-timepicker.js +2 -0
- package/cjs/form/form-timepicker/form-timepicker.js.map +1 -0
- package/cjs/form/form-unit-number-input/form-unit-number-input.js +2 -0
- package/cjs/form/form-unit-number-input/form-unit-number-input.js.map +1 -0
- package/cjs/form/form-wrapper.js +1 -1
- package/cjs/form/form-wrapper.js.map +1 -1
- package/cjs/form/index.js +1 -1
- package/cjs/form/index.js.map +1 -1
- package/cjs/fullscreen-image-carousel/fullscreen-image-carousel.js +1 -1
- package/cjs/fullscreen-image-carousel/fullscreen-image-carousel.js.map +1 -1
- package/cjs/histogram-slider/histogram-slider.js.map +1 -1
- package/cjs/image-button/image-button.js.map +1 -1
- package/cjs/index.js +1 -1
- package/cjs/input/input.js.map +1 -1
- package/cjs/input-group/input-group.js.map +1 -1
- package/cjs/input-multi-select/input-multi-select.js.map +1 -1
- package/cjs/input-nested-multi-select/input-nested-multi-select.js.map +1 -1
- package/cjs/input-nested-select/input-nested-select.js.map +1 -1
- package/cjs/input-range-select/input-range-select.js.map +1 -1
- package/cjs/input-range-slider/input-range-slider.js.map +1 -1
- package/cjs/input-select/input-select.js.map +1 -1
- package/cjs/input-slider/input-slider.js.map +1 -1
- package/cjs/input-textarea/textarea.js.map +1 -1
- package/cjs/input-textarea/textarea.styles.js +1 -1
- package/cjs/input-textarea/textarea.styles.js.map +1 -1
- package/cjs/input-textarea/{textarea.styles_22z4n3.css → textarea.styles_q77m5x.css} +1 -1
- package/cjs/language-switcher/language-switcher.js.map +1 -1
- package/cjs/layout/index.js +1 -1
- package/cjs/layout/index.js.map +1 -1
- package/cjs/link-list/components/common.js.map +1 -1
- package/cjs/link-list/components/link-list-eager.js.map +1 -1
- package/cjs/link-list/components/link-list-lazy.js.map +1 -1
- package/cjs/link-list/link-list.js.map +1 -1
- package/cjs/local-nav/local-nav-dropdown/local-nav-dropdown.js.map +1 -1
- package/cjs/local-nav/local-nav-menu/local-nav-menu.js.map +1 -1
- package/cjs/markup/markup.js.map +1 -1
- package/cjs/masked-input/masked-input.js.map +1 -1
- package/cjs/masthead/masthead.js.map +1 -1
- package/cjs/menu/menu.js +1 -1
- package/cjs/menu/menu.js.map +1 -1
- package/cjs/modal/index.js.map +1 -1
- package/cjs/modal/modal-box.js +1 -1
- package/cjs/modal/modal-box.js.map +1 -1
- package/cjs/modal-v2/index.js +1 -1
- package/cjs/modal-v2/index.js.map +1 -1
- package/cjs/modal-v2/modal-v2.js +1 -1
- package/cjs/modal-v2/modal-v2.js.map +1 -1
- package/cjs/modal-v2/slots/card.js +1 -1
- package/cjs/modal-v2/slots/card.js.map +1 -1
- package/cjs/navbar/navbar.js.map +1 -1
- package/cjs/notification-banner/notification-banner-hoc.js.map +1 -1
- package/cjs/notification-banner/notification-banner.js.map +1 -1
- package/cjs/otp-input/otp-input.js +1 -1
- package/cjs/otp-input/otp-input.js.map +1 -1
- package/cjs/otp-verification/contact-input-section.js +1 -1
- package/cjs/otp-verification/contact-input-section.js.map +1 -1
- package/cjs/otp-verification/otp-verification.js.map +1 -1
- package/cjs/otp-verification/verification-section.js +1 -1
- package/cjs/otp-verification/verification-section.js.map +1 -1
- package/cjs/overlay/overlay.js.map +1 -1
- package/cjs/pagination/pagination.js.map +1 -1
- package/cjs/phone-number-input/phone-number-input.js.map +1 -1
- package/cjs/pill/pill.js.map +1 -1
- package/cjs/popover/popover-inline/popover-inline.js.map +1 -1
- package/cjs/popover/popover-trigger.js.map +1 -1
- package/cjs/popover/popover.js +1 -1
- package/cjs/popover/popover.js.map +1 -1
- package/cjs/predictive-text-input/predictive-text-input.js +1 -1
- package/cjs/predictive-text-input/predictive-text-input.js.map +1 -1
- package/cjs/progress-indicator/progress-indicator.js.map +1 -1
- package/cjs/radio-button/radio-button.js.map +1 -1
- package/cjs/schedule/schedule.js.map +1 -1
- package/cjs/schedule/shared/with-optional-popover.js +1 -1
- package/cjs/schedule/shared/with-optional-popover.js.map +1 -1
- package/cjs/select-histogram/select-histogram.js.map +1 -1
- package/cjs/shared/dropdown-list/dropdown-list.js +1 -1
- package/cjs/shared/dropdown-list/dropdown-list.js.map +1 -1
- package/cjs/shared/dropdown-wrapper/element-with-dropdown.js +1 -1
- package/cjs/shared/dropdown-wrapper/element-with-dropdown.js.map +1 -1
- package/cjs/sidenav/sidenav.js.map +1 -1
- package/cjs/singpass-button/singpass-button.js.map +1 -1
- package/cjs/smart-app-banner/smart-app-banner.js.map +1 -1
- package/cjs/tab/tab.js.map +1 -1
- package/cjs/table/table.js.map +1 -1
- package/cjs/table/table.styles.js +1 -1
- package/cjs/table/table.styles.js.map +1 -1
- package/cjs/table/{table.styles_1af5ipv.css → table.styles_1vjx31g.css} +1 -1
- package/cjs/tag/tag.js.map +1 -1
- package/cjs/text-list/index.js.map +1 -1
- package/cjs/theme/theme-provider/breakpoint.js +1 -1
- package/cjs/theme/theme-provider/breakpoint.js.map +1 -1
- package/cjs/theme/theme-provider/hooks.js.map +1 -1
- package/cjs/theme/theme-provider/index.js.map +1 -1
- package/cjs/theme/tokens/border.js.map +1 -1
- package/cjs/theme/tokens/breakpoint.js.map +1 -1
- package/cjs/theme/tokens/colour.js.map +1 -1
- package/cjs/theme/tokens/component.js.map +1 -1
- package/cjs/theme/tokens/font.js.map +1 -1
- package/cjs/theme/tokens/media-query.js.map +1 -1
- package/cjs/theme/tokens/motion.js.map +1 -1
- package/cjs/theme/tokens/radius.js.map +1 -1
- package/cjs/theme/tokens/shadow.js.map +1 -1
- package/cjs/theme/tokens/spacing.js.map +1 -1
- package/cjs/theme/types.js.map +1 -1
- package/cjs/theme/utils/css-variable.js.map +1 -1
- package/cjs/theme/utils/font.js.map +1 -1
- package/cjs/theme/utils/use-apply-styles.js +1 -1
- package/cjs/theme/utils/use-apply-styles.js.map +1 -1
- package/cjs/theme/utils/use-design-token-override.js.map +1 -1
- package/cjs/theme/utils/use-design-token.js.map +1 -1
- package/cjs/theme/utils/use-media-query.js.map +1 -1
- package/cjs/time-range-picker/combobox-picker/combobox-picker.js +1 -1
- package/cjs/time-range-picker/combobox-picker/combobox-picker.js.map +1 -1
- package/cjs/time-range-picker/common.styles.js +1 -1
- package/cjs/time-range-picker/common.styles.js.map +1 -1
- package/cjs/time-range-picker/{common.styles_1qwp4xa.css → common.styles_cnkkax.css} +2 -1
- package/cjs/time-range-picker/dial-picker/dial-picker.js +1 -1
- package/cjs/time-range-picker/dial-picker/dial-picker.js.map +1 -1
- package/cjs/time-range-picker/time-range-picker.js.map +1 -1
- package/cjs/time-slot-bar/time-slot-bar.js.map +1 -1
- package/cjs/time-slot-bar-week/time-slot-bar-week.js.map +1 -1
- package/cjs/time-slot-week-view/time-slot-week-view.js.map +1 -1
- package/cjs/timeline/timeline.js.map +1 -1
- package/cjs/timepicker/timepicker.js +1 -1
- package/cjs/timepicker/timepicker.js.map +1 -1
- package/cjs/timepicker/timepicker.styles.js +1 -1
- package/cjs/timepicker/timepicker.styles.js.map +1 -1
- package/cjs/timepicker/timepicker.styles_lyizvq.css +2 -0
- package/cjs/timetable/timetable-row/with-optional-popover.js +1 -1
- package/cjs/timetable/timetable-row/with-optional-popover.js.map +1 -1
- package/cjs/timetable/timetable.js +1 -1
- package/cjs/timetable/timetable.js.map +1 -1
- package/cjs/toast/toast.js.map +1 -1
- package/cjs/toggle/toggle.js.map +1 -1
- package/cjs/typography/index.js.map +1 -1
- package/cjs/uneditable-section/index.js.map +1 -1
- package/cjs/uneditable-section/section-item.js +1 -1
- package/cjs/uneditable-section/section-item.js.map +1 -1
- package/cjs/unit-number/unit-number-input.js.map +1 -1
- package/cjs/util/merge-refs.js.map +1 -1
- package/cjs/util/use-throttle.js +2 -0
- package/cjs/util/use-throttle.js.map +1 -0
- package/countdown-timer/countdown-timer.js.map +1 -1
- package/countdown-timer/types.d.ts +6 -6
- package/dashed-border/dashed-border.js.map +1 -1
- package/data-table/data-table.js +1 -1
- package/data-table/data-table.js.map +1 -1
- package/data-table/data-table.styles.d.ts +2 -1
- package/data-table/data-table.styles.js +1 -1
- package/data-table/data-table.styles.js.map +1 -1
- package/data-table/data-table.styles_rxganh.css +27 -0
- package/date-input/date-input.js.map +1 -1
- package/date-input/types.d.ts +1 -1
- package/date-navigator/date-navigator.js.map +1 -1
- package/date-navigator/types.d.ts +1 -1
- package/date-range-input/date-range-input.js.map +1 -1
- package/date-range-input/types.d.ts +2 -2
- package/divider/divider.js.map +1 -1
- package/divider/types.d.ts +1 -1
- package/docs/component-catalog.json +644 -0
- package/drawer/drawer.js.map +1 -1
- package/drawer/types.d.ts +1 -1
- package/e-signature/e-signature.js.map +1 -1
- package/e-signature/types.d.ts +1 -1
- package/error-display/error-display.js.map +1 -1
- package/external/dompurify/dist/purify.es.js +2 -2
- package/external/dompurify/dist/purify.es.js.map +1 -1
- package/external/lodash/_setCacheHas.js.map +1 -1
- package/external/lodash/lodash.js +1 -1
- package/external/lodash/lodash.js.map +1 -1
- package/feedback-rating/feedback-rating.js.map +1 -1
- package/file-download/file-download.js.map +1 -1
- package/file-download/types.d.ts +6 -1
- package/file-upload/file-item-edit.d.ts +1 -1
- package/file-upload/file-item-edit.js.map +1 -1
- package/file-upload/file-list/file-list.d.ts +1 -1
- package/file-upload/file-list/file-list.js.map +1 -1
- package/file-upload/file-list-item/file-list-item.d.ts +1 -1
- package/file-upload/file-list-item/file-list-item.js.map +1 -1
- package/file-upload/file-list-item/file-list-item.styles.js +1 -1
- package/file-upload/file-list-item/file-list-item.styles.js.map +1 -1
- package/file-upload/file-list-item/{file-list-item.styles_o8000f.css → file-list-item.styles_kgtfke.css} +1 -1
- package/file-upload/file-upload.js.map +1 -1
- package/file-upload/types.d.ts +6 -3
- package/filter/addons/filter-item-checkbox-helpers.d.ts +2 -2
- package/filter/addons/filter-item-checkbox-helpers.js.map +1 -1
- package/filter/addons/filter-item-checkbox.d.ts +1 -1
- package/filter/addons/filter-item-checkbox.js.map +1 -1
- package/filter/addons/internal-types.d.ts +12 -0
- package/filter/addons/types.d.ts +60 -9
- package/filter/filter-item.js +1 -1
- package/filter/filter-item.js.map +1 -1
- package/filter/filter.d.ts +1 -1
- package/filter/filter.js.map +1 -1
- package/filter/index.d.ts +1 -0
- package/filter/types.d.ts +36 -72
- package/footer/footer.js.map +1 -1
- package/form/form-custom-field/form-custom-field.js +2 -0
- package/form/form-custom-field/form-custom-field.js.map +1 -0
- package/form/form-custom-field/index.d.ts +2 -0
- package/form/form-custom-field/types.d.ts +7 -0
- package/form/form-date-input/form-date-input.js +2 -0
- package/form/form-date-input/form-date-input.js.map +1 -0
- package/form/form-date-input/index.d.ts +2 -0
- package/form/form-date-input/types.d.ts +8 -0
- package/form/form-date-range-input/form-date-range-input.js +2 -0
- package/form/form-date-range-input/form-date-range-input.js.map +1 -0
- package/form/form-date-range-input/index.d.ts +2 -0
- package/form/form-date-range-input/types.d.ts +8 -0
- package/form/form-e-signature/form-e-signature.js +2 -0
- package/form/form-e-signature/form-e-signature.js.map +1 -0
- package/form/form-e-signature/index.d.ts +2 -0
- package/form/form-e-signature/types.d.ts +8 -0
- package/form/form-histogram-slider/form-histogram-slider.js +2 -0
- package/form/form-histogram-slider/form-histogram-slider.js.map +1 -0
- package/form/form-histogram-slider/index.d.ts +2 -0
- package/form/form-histogram-slider/types.d.ts +8 -0
- package/form/form-input/form-input.js +2 -0
- package/form/form-input/form-input.js.map +1 -0
- package/form/form-input/index.d.ts +2 -0
- package/form/form-input/types.d.ts +8 -0
- package/form/form-input-group/form-input-group.js +2 -0
- package/form/form-input-group/form-input-group.js.map +1 -0
- package/form/form-input-group/index.d.ts +2 -0
- package/form/form-input-group/types.d.ts +10 -0
- package/form/form-label/form-label-addon.js +2 -0
- package/form/form-label/form-label-addon.js.map +1 -0
- package/form/form-label/form-label-addon.styles.js +2 -0
- package/form/form-label/form-label-addon.styles.js.map +1 -0
- package/form/form-label/form-label-addon.styles_aztasj.css +1 -0
- package/form/form-label/form-label.js +2 -0
- package/form/form-label/form-label.js.map +1 -0
- package/form/form-label/form-label.styles.js +2 -0
- package/form/form-label/form-label.styles.js.map +1 -0
- package/form/form-label/form-label.styles_180zf7j.css +6 -0
- package/form/form-label/index.d.ts +2 -0
- package/form/form-label/types.d.ts +39 -0
- package/form/form-masked-input/form-masked-input.js +2 -0
- package/form/form-masked-input/form-masked-input.js.map +1 -0
- package/form/form-masked-input/index.d.ts +2 -0
- package/form/form-masked-input/types.d.ts +8 -0
- package/form/form-multi-select/form-multi-select.js +2 -0
- package/form/form-multi-select/form-multi-select.js.map +1 -0
- package/form/form-multi-select/index.d.ts +2 -0
- package/form/form-multi-select/types.d.ts +10 -0
- package/form/form-nested-multi-select/form-nested-multi-select.js +2 -0
- package/form/form-nested-multi-select/form-nested-multi-select.js.map +1 -0
- package/form/form-nested-multi-select/index.d.ts +2 -0
- package/form/form-nested-multi-select/types.d.ts +11 -0
- package/form/form-nested-select/form-nested-select.js +2 -0
- package/form/form-nested-select/form-nested-select.js.map +1 -0
- package/form/form-nested-select/index.d.ts +2 -0
- package/form/form-nested-select/types.d.ts +11 -0
- package/form/{form-otp-verification.d.ts → form-otp-verification/form-otp-verification.d.ts} +1 -1
- package/form/form-otp-verification/form-otp-verification.js +2 -0
- package/form/form-otp-verification/form-otp-verification.js.map +1 -0
- package/form/form-otp-verification/index.d.ts +2 -0
- package/form/form-otp-verification/types.d.ts +1 -0
- package/form/form-phone-number-input/form-phone-number-input.js +2 -0
- package/form/form-phone-number-input/form-phone-number-input.js.map +1 -0
- package/form/form-phone-number-input/index.d.ts +2 -0
- package/form/form-phone-number-input/types.d.ts +8 -0
- package/form/form-predictive-text-input/form-predictive-text-input.js +2 -0
- package/form/form-predictive-text-input/form-predictive-text-input.js.map +1 -0
- package/form/form-predictive-text-input/index.d.ts +2 -0
- package/form/form-predictive-text-input/types.d.ts +10 -0
- package/form/form-range-select/form-range-select.js +2 -0
- package/form/form-range-select/form-range-select.js.map +1 -0
- package/form/form-range-select/index.d.ts +2 -0
- package/form/form-range-select/types.d.ts +10 -0
- package/form/form-range-slider/form-range-slider.js +2 -0
- package/form/form-range-slider/form-range-slider.js.map +1 -0
- package/form/form-range-slider/index.d.ts +2 -0
- package/form/form-range-slider/types.d.ts +8 -0
- package/form/form-select/form-select.js +2 -0
- package/form/form-select/form-select.js.map +1 -0
- package/form/form-select/index.d.ts +2 -0
- package/form/form-select/types.d.ts +10 -0
- package/form/form-select-histogram/form-select-histogram.js +2 -0
- package/form/form-select-histogram/form-select-histogram.js.map +1 -0
- package/form/form-select-histogram/index.d.ts +2 -0
- package/form/form-select-histogram/types.d.ts +8 -0
- package/form/form-slider/form-slider.js +2 -0
- package/form/form-slider/form-slider.js.map +1 -0
- package/form/form-slider/index.d.ts +2 -0
- package/form/form-slider/types.d.ts +8 -0
- package/form/form-textarea/form-textarea.js +2 -0
- package/form/form-textarea/form-textarea.js.map +1 -0
- package/form/form-textarea/form-textarea.styles.js +2 -0
- package/form/form-textarea/form-textarea.styles.js.map +1 -0
- package/form/form-textarea/form-textarea.styles_1kneyif.css +3 -0
- package/form/form-textarea/index.d.ts +2 -0
- package/form/form-textarea/types.d.ts +8 -0
- package/form/form-time-range-picker/form-time-range-picker.js +2 -0
- package/form/form-time-range-picker/form-time-range-picker.js.map +1 -0
- package/form/form-time-range-picker/index.d.ts +2 -0
- package/form/form-time-range-picker/types.d.ts +8 -0
- package/form/form-timepicker/form-timepicker.js +2 -0
- package/form/form-timepicker/form-timepicker.js.map +1 -0
- package/form/form-timepicker/index.d.ts +2 -0
- package/form/form-timepicker/types.d.ts +8 -0
- package/form/form-unit-number-input/form-unit-number-input.js +2 -0
- package/form/form-unit-number-input/form-unit-number-input.js.map +1 -0
- package/form/form-unit-number-input/index.d.ts +2 -0
- package/form/form-unit-number-input/types.d.ts +8 -0
- package/form/form-wrapper.js +1 -1
- package/form/form-wrapper.js.map +1 -1
- package/form/index.d.ts +104 -24
- package/form/index.js +1 -1
- package/form/index.js.map +1 -1
- package/form/types.d.ts +27 -85
- package/fullscreen-image-carousel/fullscreen-image-carousel.d.ts +7 -0
- package/fullscreen-image-carousel/fullscreen-image-carousel.js +1 -1
- package/fullscreen-image-carousel/fullscreen-image-carousel.js.map +1 -1
- package/fullscreen-image-carousel/types.d.ts +91 -3
- package/histogram-slider/histogram-slider.d.ts +6 -0
- package/histogram-slider/histogram-slider.js.map +1 -1
- package/histogram-slider/types.d.ts +63 -3
- package/image-button/image-button.d.ts +6 -0
- package/image-button/image-button.js.map +1 -1
- package/image-button/types.d.ts +11 -1
- package/index.js +1 -1
- package/input/input.d.ts +6 -0
- package/input/input.js.map +1 -1
- package/input/types.d.ts +38 -2
- package/input-group/input-group.d.ts +7 -0
- package/input-group/input-group.js.map +1 -1
- package/input-group/types.d.ts +84 -8
- package/input-multi-select/input-multi-select.d.ts +6 -0
- package/input-multi-select/input-multi-select.js.map +1 -1
- package/input-multi-select/types.d.ts +46 -5
- package/input-nested-multi-select/input-nested-multi-select.d.ts +8 -0
- package/input-nested-multi-select/input-nested-multi-select.js.map +1 -1
- package/input-nested-multi-select/types.d.ts +35 -5
- package/input-nested-select/input-nested-select.d.ts +9 -2
- package/input-nested-select/input-nested-select.js.map +1 -1
- package/input-nested-select/types.d.ts +77 -8
- package/input-range-select/input-range-select.d.ts +6 -0
- package/input-range-select/input-range-select.js.map +1 -1
- package/input-range-select/types.d.ts +68 -1
- package/input-range-slider/input-range-slider.d.ts +7 -0
- package/input-range-slider/input-range-slider.js.map +1 -1
- package/input-range-slider/types.d.ts +91 -6
- package/input-select/input-select.d.ts +5 -0
- package/input-select/input-select.js.map +1 -1
- package/input-select/types.d.ts +70 -14
- package/input-slider/input-slider.d.ts +6 -0
- package/input-slider/input-slider.js.map +1 -1
- package/input-slider/types.d.ts +21 -2
- package/input-textarea/textarea.d.ts +3 -0
- package/input-textarea/textarea.js.map +1 -1
- package/input-textarea/textarea.styles.js +1 -1
- package/input-textarea/textarea.styles.js.map +1 -1
- package/input-textarea/{textarea.styles_22z4n3.css → textarea.styles_q77m5x.css} +1 -1
- package/input-textarea/types.d.ts +24 -1
- package/language-switcher/language-switcher.d.ts +6 -0
- package/language-switcher/language-switcher.js.map +1 -1
- package/language-switcher/types.d.ts +23 -0
- package/layout/index.d.ts +16 -2
- package/layout/index.js +1 -1
- package/layout/index.js.map +1 -1
- package/layout/types.d.ts +61 -3
- package/link-list/components/common.d.ts +1 -1
- package/link-list/components/common.js.map +1 -1
- package/link-list/components/link-list-eager.d.ts +2 -2
- package/link-list/components/link-list-eager.js.map +1 -1
- package/link-list/components/link-list-lazy.d.ts +2 -2
- package/link-list/components/link-list-lazy.js.map +1 -1
- package/link-list/link-list.d.ts +6 -0
- package/link-list/link-list.js.map +1 -1
- package/link-list/types.d.ts +92 -3
- package/local-nav/local-nav-dropdown/local-nav-dropdown.d.ts +11 -0
- package/local-nav/local-nav-dropdown/local-nav-dropdown.js.map +1 -1
- package/local-nav/local-nav-menu/local-nav-menu.d.ts +6 -0
- package/local-nav/local-nav-menu/local-nav-menu.js.map +1 -1
- package/local-nav/types.d.ts +51 -0
- package/markup/markup.d.ts +6 -0
- package/markup/markup.js.map +1 -1
- package/markup/types.d.ts +6 -2
- package/masked-input/masked-input.d.ts +6 -0
- package/masked-input/masked-input.js.map +1 -1
- package/masked-input/types.d.ts +83 -8
- package/masthead/masthead.d.ts +6 -0
- package/masthead/masthead.js.map +1 -1
- package/masthead/types.d.ts +9 -0
- package/menu/menu.d.ts +27 -4
- package/menu/menu.js +1 -1
- package/menu/menu.js.map +1 -1
- package/menu/types.d.ts +49 -1
- package/modal/index.d.ts +13 -0
- package/modal/index.js.map +1 -1
- package/modal/modal-box.js +1 -1
- package/modal/modal-box.js.map +1 -1
- package/modal/types.d.ts +56 -7
- package/modal-v2/index.d.ts +1 -15
- package/modal-v2/index.js +1 -1
- package/modal-v2/index.js.map +1 -1
- package/modal-v2/modal-v2.d.ts +32 -1
- package/modal-v2/modal-v2.js +1 -1
- package/modal-v2/modal-v2.js.map +1 -1
- package/modal-v2/slots/card.js +1 -1
- package/modal-v2/slots/card.js.map +1 -1
- package/modal-v2/types.d.ts +92 -8
- package/navbar/navbar.d.ts +7 -0
- package/navbar/navbar.js.map +1 -1
- package/navbar/types.d.ts +201 -13
- package/notification-banner/notification-banner-hoc.d.ts +6 -0
- package/notification-banner/notification-banner-hoc.js.map +1 -1
- package/notification-banner/notification-banner.d.ts +7 -0
- package/notification-banner/notification-banner.js.map +1 -1
- package/notification-banner/types.d.ts +57 -2
- package/otp-input/otp-input.d.ts +7 -0
- package/otp-input/otp-input.js +1 -1
- package/otp-input/otp-input.js.map +1 -1
- package/otp-input/types.d.ts +63 -15
- package/otp-verification/contact-input-section.js +1 -1
- package/otp-verification/contact-input-section.js.map +1 -1
- package/otp-verification/internal-types.d.ts +22 -5
- package/otp-verification/otp-verification.d.ts +6 -0
- package/otp-verification/otp-verification.js.map +1 -1
- package/otp-verification/types.d.ts +125 -6
- package/otp-verification/verification-section.js +1 -1
- package/otp-verification/verification-section.js.map +1 -1
- package/overlay/overlay.d.ts +7 -0
- package/overlay/overlay.js.map +1 -1
- package/overlay/types.d.ts +57 -2
- package/package.json +1 -1
- package/pagination/pagination.d.ts +5 -0
- package/pagination/pagination.js.map +1 -1
- package/pagination/types.d.ts +48 -0
- package/phone-number-input/phone-number-input.d.ts +7 -0
- package/phone-number-input/phone-number-input.js.map +1 -1
- package/phone-number-input/types.d.ts +78 -13
- package/pill/pill.d.ts +6 -0
- package/pill/pill.js.map +1 -1
- package/pill/types.d.ts +19 -0
- package/popover/popover-inline/index.d.ts +1 -0
- package/popover/popover-inline/popover-inline.d.ts +6 -1
- package/popover/popover-inline/popover-inline.js.map +1 -1
- package/popover/popover-inline/types.d.ts +36 -0
- package/popover/popover-trigger.d.ts +6 -0
- package/popover/popover-trigger.js.map +1 -1
- package/popover/popover.d.ts +6 -0
- package/popover/popover.js +1 -1
- package/popover/popover.js.map +1 -1
- package/popover/types.d.ts +125 -11
- package/predictive-text-input/predictive-text-input.d.ts +6 -0
- package/predictive-text-input/predictive-text-input.js +1 -1
- package/predictive-text-input/predictive-text-input.js.map +1 -1
- package/predictive-text-input/types.d.ts +65 -11
- package/progress-indicator/progress-indicator.d.ts +7 -0
- package/progress-indicator/progress-indicator.js.map +1 -1
- package/progress-indicator/types.d.ts +18 -0
- package/radio-button/radio-button.d.ts +5 -0
- package/radio-button/radio-button.js.map +1 -1
- package/radio-button/types.d.ts +14 -0
- package/schedule/internal-types.d.ts +18 -0
- package/schedule/schedule-day-view/types.d.ts +2 -1
- package/schedule/schedule-week-view/types.d.ts +2 -1
- package/schedule/schedule.d.ts +3 -0
- package/schedule/schedule.js.map +1 -1
- package/schedule/shared/with-optional-popover.js +1 -1
- package/schedule/shared/with-optional-popover.js.map +1 -1
- package/schedule/types.d.ts +129 -10
- package/select-histogram/select-histogram.d.ts +5 -0
- package/select-histogram/select-histogram.js.map +1 -1
- package/select-histogram/types.d.ts +57 -4
- package/shared/dropdown-list/dropdown-list.js +1 -1
- package/shared/dropdown-list/dropdown-list.js.map +1 -1
- package/shared/dropdown-list/types.d.ts +52 -19
- package/shared/dropdown-wrapper/element-with-dropdown.d.ts +5 -4
- package/shared/dropdown-wrapper/element-with-dropdown.js +1 -1
- package/shared/dropdown-wrapper/element-with-dropdown.js.map +1 -1
- package/shared/dropdown-wrapper/types.d.ts +6 -0
- package/sidenav/sidenav.d.ts +10 -0
- package/sidenav/sidenav.js.map +1 -1
- package/sidenav/types.d.ts +71 -21
- package/singpass-button/singpass-button.d.ts +6 -0
- package/singpass-button/singpass-button.js.map +1 -1
- package/singpass-button/types.d.ts +29 -2
- package/smart-app-banner/smart-app-banner.d.ts +5 -0
- package/smart-app-banner/smart-app-banner.js.map +1 -1
- package/smart-app-banner/types.d.ts +56 -0
- package/tab/tab.d.ts +7 -0
- package/tab/tab.js.map +1 -1
- package/tab/types.d.ts +55 -6
- package/table/table.d.ts +30 -8
- package/table/table.js.map +1 -1
- package/table/table.styles.js +1 -1
- package/table/table.styles.js.map +1 -1
- package/table/{table.styles_1af5ipv.css → table.styles_1vjx31g.css} +1 -1
- package/table/types.d.ts +35 -0
- package/tag/tag.d.ts +5 -0
- package/tag/tag.js.map +1 -1
- package/tag/types.d.ts +24 -0
- package/text-list/index.d.ts +17 -0
- package/text-list/index.js.map +1 -1
- package/text-list/types.d.ts +33 -4
- package/theme/theme-provider/breakpoint.d.ts +0 -1
- package/theme/theme-provider/breakpoint.js +1 -1
- package/theme/theme-provider/breakpoint.js.map +1 -1
- package/theme/theme-provider/hooks.d.ts +16 -0
- package/theme/theme-provider/hooks.js.map +1 -1
- package/theme/theme-provider/index.d.ts +7 -0
- package/theme/theme-provider/index.js.map +1 -1
- package/theme/theme-provider/types.d.ts +14 -0
- package/theme/tokens/border.d.ts +9 -0
- package/theme/tokens/border.js.map +1 -1
- package/theme/tokens/breakpoint.d.ts +3 -0
- package/theme/tokens/breakpoint.js.map +1 -1
- package/theme/tokens/colour.d.ts +9 -0
- package/theme/tokens/colour.js.map +1 -1
- package/theme/tokens/component.d.ts +3 -0
- package/theme/tokens/component.js.map +1 -1
- package/theme/tokens/font.d.ts +6 -0
- package/theme/tokens/font.js.map +1 -1
- package/theme/tokens/media-query.d.ts +3 -0
- package/theme/tokens/media-query.js.map +1 -1
- package/theme/tokens/motion.d.ts +3 -0
- package/theme/tokens/motion.js.map +1 -1
- package/theme/tokens/radius.d.ts +3 -0
- package/theme/tokens/radius.js.map +1 -1
- package/theme/tokens/shadow.d.ts +3 -0
- package/theme/tokens/shadow.js.map +1 -1
- package/theme/tokens/spacing.d.ts +3 -0
- package/theme/tokens/spacing.js.map +1 -1
- package/theme/types.d.ts +23 -3
- package/theme/types.js.map +1 -1
- package/theme/utils/css-variable.d.ts +10 -2
- package/theme/utils/css-variable.js.map +1 -1
- package/theme/utils/font.d.ts +2 -1
- package/theme/utils/font.js.map +1 -1
- package/theme/utils/use-apply-styles.d.ts +8 -2
- package/theme/utils/use-apply-styles.js +1 -1
- package/theme/utils/use-apply-styles.js.map +1 -1
- package/theme/utils/use-design-token-override.d.ts +9 -1
- package/theme/utils/use-design-token-override.js.map +1 -1
- package/theme/utils/use-design-token.d.ts +9 -0
- package/theme/utils/use-design-token.js.map +1 -1
- package/theme/utils/use-media-query.d.ts +41 -3
- package/theme/utils/use-media-query.js.map +1 -1
- package/time-range-picker/combobox-picker/combobox-picker.js +1 -1
- package/time-range-picker/combobox-picker/combobox-picker.js.map +1 -1
- package/time-range-picker/common.styles.d.ts +1 -0
- package/time-range-picker/common.styles.js +1 -1
- package/time-range-picker/common.styles.js.map +1 -1
- package/time-range-picker/{common.styles_1qwp4xa.css → common.styles_cnkkax.css} +2 -1
- package/time-range-picker/dial-picker/dial-picker.js +1 -1
- package/time-range-picker/dial-picker/dial-picker.js.map +1 -1
- package/time-range-picker/time-range-picker.d.ts +5 -0
- package/time-range-picker/time-range-picker.js.map +1 -1
- package/time-range-picker/types.d.ts +85 -25
- package/time-slot-bar/internal-types.d.ts +1 -0
- package/time-slot-bar/time-slot-bar.d.ts +7 -0
- package/time-slot-bar/time-slot-bar.js.map +1 -1
- package/time-slot-bar/types.d.ts +116 -20
- package/time-slot-bar-week/time-slot-bar-week.d.ts +8 -0
- package/time-slot-bar-week/time-slot-bar-week.js.map +1 -1
- package/time-slot-bar-week/types.d.ts +80 -13
- package/time-slot-week-view/time-slot-week-view.d.ts +7 -0
- package/time-slot-week-view/time-slot-week-view.js.map +1 -1
- package/time-slot-week-view/types.d.ts +55 -10
- package/timeline/timeline.d.ts +6 -0
- package/timeline/timeline.js.map +1 -1
- package/timeline/types.d.ts +58 -4
- package/timepicker/timepicker.d.ts +5 -0
- package/timepicker/timepicker.js +1 -1
- package/timepicker/timepicker.js.map +1 -1
- package/timepicker/timepicker.styles.d.ts +1 -0
- package/timepicker/timepicker.styles.js +1 -1
- package/timepicker/timepicker.styles.js.map +1 -1
- package/timepicker/timepicker.styles_lyizvq.css +2 -0
- package/timepicker/types.d.ts +49 -14
- package/timetable/timetable-row/with-optional-popover.js +1 -1
- package/timetable/timetable-row/with-optional-popover.js.map +1 -1
- package/timetable/timetable.d.ts +6 -0
- package/timetable/timetable.js +1 -1
- package/timetable/timetable.js.map +1 -1
- package/timetable/types.d.ts +175 -50
- package/toast/toast.d.ts +6 -0
- package/toast/toast.js.map +1 -1
- package/toast/types.d.ts +44 -8
- package/toggle/toggle.d.ts +6 -0
- package/toggle/toggle.js.map +1 -1
- package/toggle/types.d.ts +95 -17
- package/tools/shared/generated-file-formatter.d.ts +6 -0
- package/tools/shared/jsdoc-parser.d.ts +36 -0
- package/tools/shared/ts-morph-project-factory.d.ts +9 -0
- package/tools/shared/typescript-source-provider.d.ts +9 -0
- package/tools/storybook-argtypes/adapters/file-system-adapter.d.ts +69 -0
- package/tools/storybook-argtypes/arg-types-generator.d.ts +85 -0
- package/tools/storybook-argtypes/config/arg-types-config.d.ts +31 -0
- package/tools/storybook-argtypes/index.d.ts +11 -0
- package/tools/storybook-argtypes/services/arg-types-row-builder.d.ts +43 -0
- package/tools/storybook-argtypes/services/file-path-resolver.d.ts +118 -0
- package/tools/storybook-argtypes/services/index.d.ts +6 -0
- package/tools/storybook-argtypes/services/jsdoc-metadata-extractor.d.ts +33 -0
- package/tools/storybook-argtypes/services/story-registry-generator.d.ts +27 -0
- package/tools/storybook-argtypes/services/type-dependency-resolver.d.ts +46 -0
- package/tools/storybook-argtypes/services/type-formatting-service.d.ts +27 -0
- package/tools/storybook-argtypes/types.d.ts +102 -0
- package/typography/index.d.ts +29 -0
- package/typography/index.js.map +1 -1
- package/typography/types.d.ts +51 -8
- package/uneditable-section/index.d.ts +15 -0
- package/uneditable-section/index.js.map +1 -1
- package/uneditable-section/section-item.js +1 -1
- package/uneditable-section/section-item.js.map +1 -1
- package/uneditable-section/types.d.ts +66 -23
- package/unit-number/types.d.ts +30 -4
- package/unit-number/unit-number-input.d.ts +6 -0
- package/unit-number/unit-number-input.js.map +1 -1
- package/util/index.d.ts +1 -0
- package/util/merge-refs.d.ts +1 -1
- package/util/merge-refs.js.map +1 -1
- package/util/use-throttle.d.ts +1 -0
- package/util/use-throttle.js +2 -0
- package/util/use-throttle.js.map +1 -0
- package/cjs/data-table/data-table.styles_1iqq1g7.css +0 -26
- package/cjs/form/form-custom-field.js +0 -2
- package/cjs/form/form-custom-field.js.map +0 -1
- package/cjs/form/form-date-input.js +0 -2
- package/cjs/form/form-date-input.js.map +0 -1
- package/cjs/form/form-date-range-input.js +0 -2
- package/cjs/form/form-date-range-input.js.map +0 -1
- package/cjs/form/form-e-signature.js +0 -2
- package/cjs/form/form-e-signature.js.map +0 -1
- package/cjs/form/form-histogram.js +0 -2
- package/cjs/form/form-histogram.js.map +0 -1
- package/cjs/form/form-input-group.js +0 -2
- package/cjs/form/form-input-group.js.map +0 -1
- package/cjs/form/form-input.js +0 -2
- package/cjs/form/form-input.js.map +0 -1
- package/cjs/form/form-label-addon.js +0 -2
- package/cjs/form/form-label-addon.js.map +0 -1
- package/cjs/form/form-label-addon.styles.js +0 -2
- package/cjs/form/form-label-addon.styles.js.map +0 -1
- package/cjs/form/form-label-addon.styles_b00z8p.css +0 -1
- package/cjs/form/form-label.js +0 -2
- package/cjs/form/form-label.js.map +0 -1
- package/cjs/form/form-label.styles.js +0 -2
- package/cjs/form/form-label.styles.js.map +0 -1
- package/cjs/form/form-label.styles_1nbe0bm.css +0 -6
- package/cjs/form/form-masked-input.js +0 -2
- package/cjs/form/form-masked-input.js.map +0 -1
- package/cjs/form/form-multi-select.js +0 -2
- package/cjs/form/form-multi-select.js.map +0 -1
- package/cjs/form/form-nested-multi-select.js +0 -2
- package/cjs/form/form-nested-multi-select.js.map +0 -1
- package/cjs/form/form-nested-select.js +0 -2
- package/cjs/form/form-nested-select.js.map +0 -1
- package/cjs/form/form-otp-verification.js +0 -2
- package/cjs/form/form-otp-verification.js.map +0 -1
- package/cjs/form/form-phone-number-input.js +0 -2
- package/cjs/form/form-phone-number-input.js.map +0 -1
- package/cjs/form/form-predictive-text-input.js +0 -2
- package/cjs/form/form-predictive-text-input.js.map +0 -1
- package/cjs/form/form-range-select.js +0 -2
- package/cjs/form/form-range-select.js.map +0 -1
- package/cjs/form/form-range-slider.js +0 -2
- package/cjs/form/form-range-slider.js.map +0 -1
- package/cjs/form/form-select-histogram.js +0 -2
- package/cjs/form/form-select-histogram.js.map +0 -1
- package/cjs/form/form-select.js +0 -2
- package/cjs/form/form-select.js.map +0 -1
- package/cjs/form/form-slider.js +0 -2
- package/cjs/form/form-slider.js.map +0 -1
- package/cjs/form/form-textarea.js +0 -2
- package/cjs/form/form-textarea.js.map +0 -1
- package/cjs/form/form-textarea.styles.js +0 -2
- package/cjs/form/form-textarea.styles.js.map +0 -1
- package/cjs/form/form-textarea.styles_3p9qoy.css +0 -3
- package/cjs/form/form-time-range-picker.js +0 -2
- package/cjs/form/form-time-range-picker.js.map +0 -1
- package/cjs/form/form-timepicker.js +0 -2
- package/cjs/form/form-timepicker.js.map +0 -1
- package/cjs/form/form-unit-number-input.js +0 -2
- package/cjs/form/form-unit-number-input.js.map +0 -1
- package/cjs/timepicker/timepicker.styles_1jm33yw.css +0 -1
- package/data-table/data-table.styles_1iqq1g7.css +0 -26
- package/form/form-custom-field.js +0 -2
- package/form/form-custom-field.js.map +0 -1
- package/form/form-date-input.js +0 -2
- package/form/form-date-input.js.map +0 -1
- package/form/form-date-range-input.js +0 -2
- package/form/form-date-range-input.js.map +0 -1
- package/form/form-e-signature.js +0 -2
- package/form/form-e-signature.js.map +0 -1
- package/form/form-histogram.js +0 -2
- package/form/form-histogram.js.map +0 -1
- package/form/form-input-group.js +0 -2
- package/form/form-input-group.js.map +0 -1
- package/form/form-input.js +0 -2
- package/form/form-input.js.map +0 -1
- package/form/form-label-addon.js +0 -2
- package/form/form-label-addon.js.map +0 -1
- package/form/form-label-addon.styles.js +0 -2
- package/form/form-label-addon.styles.js.map +0 -1
- package/form/form-label-addon.styles_b00z8p.css +0 -1
- package/form/form-label.js +0 -2
- package/form/form-label.js.map +0 -1
- package/form/form-label.styles.js +0 -2
- package/form/form-label.styles.js.map +0 -1
- package/form/form-label.styles_1nbe0bm.css +0 -6
- package/form/form-masked-input.js +0 -2
- package/form/form-masked-input.js.map +0 -1
- package/form/form-multi-select.js +0 -2
- package/form/form-multi-select.js.map +0 -1
- package/form/form-nested-multi-select.js +0 -2
- package/form/form-nested-multi-select.js.map +0 -1
- package/form/form-nested-select.js +0 -2
- package/form/form-nested-select.js.map +0 -1
- package/form/form-otp-verification.js +0 -2
- package/form/form-otp-verification.js.map +0 -1
- package/form/form-phone-number-input.js +0 -2
- package/form/form-phone-number-input.js.map +0 -1
- package/form/form-predictive-text-input.js +0 -2
- package/form/form-predictive-text-input.js.map +0 -1
- package/form/form-range-select.js +0 -2
- package/form/form-range-select.js.map +0 -1
- package/form/form-range-slider.js +0 -2
- package/form/form-range-slider.js.map +0 -1
- package/form/form-select-histogram.js +0 -2
- package/form/form-select-histogram.js.map +0 -1
- package/form/form-select.js +0 -2
- package/form/form-select.js.map +0 -1
- package/form/form-slider.js +0 -2
- package/form/form-slider.js.map +0 -1
- package/form/form-textarea.js +0 -2
- package/form/form-textarea.js.map +0 -1
- package/form/form-textarea.styles.js +0 -2
- package/form/form-textarea.styles.js.map +0 -1
- package/form/form-textarea.styles_3p9qoy.css +0 -3
- package/form/form-time-range-picker.js +0 -2
- package/form/form-time-range-picker.js.map +0 -1
- package/form/form-timepicker.js +0 -2
- package/form/form-timepicker.js.map +0 -1
- package/form/form-unit-number-input.js +0 -2
- package/form/form-unit-number-input.js.map +0 -1
- package/link-list/internal-types.d.ts +0 -31
- package/timepicker/timepicker.styles_1jm33yw.css +0 -1
- /package/{codemod-utils.d.ts → codemods/codemod-utils.d.ts} +0 -0
- /package/{migrate-popover → codemods/migrate-popover}/index.d.ts +0 -0
- /package/{run-codemod.d.ts → codemods/run-codemod.d.ts} +0 -0
- /package/form/{form-custom-field.d.ts → form-custom-field/form-custom-field.d.ts} +0 -0
- /package/form/{form-date-input.d.ts → form-date-input/form-date-input.d.ts} +0 -0
- /package/form/{form-date-range-input.d.ts → form-date-range-input/form-date-range-input.d.ts} +0 -0
- /package/form/{form-e-signature.d.ts → form-e-signature/form-e-signature.d.ts} +0 -0
- /package/form/{form-histogram.d.ts → form-histogram-slider/form-histogram-slider.d.ts} +0 -0
- /package/form/{form-input.d.ts → form-input/form-input.d.ts} +0 -0
- /package/form/{form-input-group.d.ts → form-input-group/form-input-group.d.ts} +0 -0
- /package/form/{form-label-addon.d.ts → form-label/form-label-addon.d.ts} +0 -0
- /package/form/{form-label-addon.styles.d.ts → form-label/form-label-addon.styles.d.ts} +0 -0
- /package/form/{form-label.d.ts → form-label/form-label.d.ts} +0 -0
- /package/form/{form-label.styles.d.ts → form-label/form-label.styles.d.ts} +0 -0
- /package/form/{form-masked-input.d.ts → form-masked-input/form-masked-input.d.ts} +0 -0
- /package/form/{form-multi-select.d.ts → form-multi-select/form-multi-select.d.ts} +0 -0
- /package/form/{form-nested-multi-select.d.ts → form-nested-multi-select/form-nested-multi-select.d.ts} +0 -0
- /package/form/{form-nested-select.d.ts → form-nested-select/form-nested-select.d.ts} +0 -0
- /package/form/{form-phone-number-input.d.ts → form-phone-number-input/form-phone-number-input.d.ts} +0 -0
- /package/form/{form-predictive-text-input.d.ts → form-predictive-text-input/form-predictive-text-input.d.ts} +0 -0
- /package/form/{form-range-select.d.ts → form-range-select/form-range-select.d.ts} +0 -0
- /package/form/{form-range-slider.d.ts → form-range-slider/form-range-slider.d.ts} +0 -0
- /package/form/{form-select.d.ts → form-select/form-select.d.ts} +0 -0
- /package/form/{form-select-histogram.d.ts → form-select-histogram/form-select-histogram.d.ts} +0 -0
- /package/form/{form-slider.d.ts → form-slider/form-slider.d.ts} +0 -0
- /package/form/{form-textarea.d.ts → form-textarea/form-textarea.d.ts} +0 -0
- /package/form/{form-textarea.styles.d.ts → form-textarea/form-textarea.styles.d.ts} +0 -0
- /package/form/{form-time-range-picker.d.ts → form-time-range-picker/form-time-range-picker.d.ts} +0 -0
- /package/form/{form-timepicker.d.ts → form-timepicker/form-timepicker.d.ts} +0 -0
- /package/form/{form-unit-number-input.d.ts → form-unit-number-input/form-unit-number-input.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-multi-select.js","sources":["../../src/input-multi-select/input-multi-select.tsx"],"sourcesContent":["import type { OpenChangeReason } from \"@floating-ui/react\";\nimport findIndex from \"lodash/findIndex\";\nimport type React from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport {\n DropdownList,\n DropdownListState,\n ExpandableElement,\n} from \"../shared/dropdown-list\";\nimport { ElementWithDropdown } from \"../shared/dropdown-wrapper\";\nimport {\n LabelContainer,\n PlaceholderLabel,\n ValueLabel,\n} from \"../shared/dropdown-wrapper/dropdown-wrapper\";\nimport { InputBox } from \"../shared/input-wrapper/input-wrapper\";\nimport { useId } from \"../util\";\nimport type { InputMultiSelectProps } from \"./types\";\n\nexport const InputMultiSelect = <T, V>({\n selectedOptions,\n placeholder = \"Select\",\n options,\n disabled,\n error,\n className,\n \"data-testid\": testId,\n id,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n enableSearch = false,\n searchFunction,\n searchPlaceholder,\n valueExtractor,\n listExtractor,\n onSelectOptions,\n onShowOptions,\n onHideOptions,\n onRetry,\n optionsLoadState = \"success\",\n optionTruncationType = \"end\",\n renderListItem,\n hideNoResultsDisplay,\n noResultsDescription,\n customLabels,\n renderCustomCallToAction,\n onBlur,\n variant = \"default\",\n readOnly,\n alignment,\n dropdownZIndex,\n maxSelectable,\n dropdownRootNode,\n dropdownWidth,\n}: InputMultiSelectProps<T, V>): JSX.Element => {\n // =============================================================================\n // CONST, STATE\n // =============================================================================\n const { allSelectedLabel, multiSelectedLabel } = customLabels || {};\n const [selected, setSelected] = useState<T[]>(selectedOptions || []);\n const [showOptions, setShowOptions] = useState<boolean>(false);\n const [focused, setFocused] = useState<boolean>(false);\n const internalId = useId();\n\n const nodeRef = useRef<HTMLDivElement>(null);\n const selectorRef = useRef<HTMLButtonElement>(null);\n\n // =============================================================================\n // EFFECTS\n // =============================================================================\n useEffect(() => {\n setSelected(selectedOptions || []);\n }, [selectedOptions]);\n\n // =============================================================================\n // EVENT HANDLERS\n // =============================================================================\n const handleSelectAllClick = () => {\n if ((selected && selected.length > 0) || maxSelectable) {\n setSelected([]);\n performOnSelectOptions([]);\n } else {\n setSelected(options);\n performOnSelectOptions(options);\n }\n };\n\n const handleListItemClick = (item: T, extractedValue: T | V) => {\n const selectedCopy = [...selected];\n\n // Check if it is a selection or deselection\n const itemIndex = findIndex(selected, (item) => {\n const valueToCompare = valueExtractor ? valueExtractor(item) : item;\n return valueToCompare === extractedValue;\n });\n\n if (itemIndex > -1) {\n // Item exists in selected. This indicates a deselection\n selectedCopy.splice(itemIndex, 1);\n } else {\n // Item does not exist in selected. This indicates a selection\n selectedCopy.push(item);\n }\n\n setSelected(selectedCopy);\n performOnSelectOptions(selectedCopy);\n };\n\n const handleListDismiss = () => {\n if (showOptions) {\n setShowOptions(false);\n triggerOptionDisplayCallback(false);\n }\n };\n\n const handleNodeFocus = () => {\n if (!focused && !showOptions) {\n setFocused(true);\n }\n };\n\n const handleNodeBlur = (e: React.FocusEvent) => {\n if (\n focused &&\n !showOptions &&\n nodeRef.current &&\n !nodeRef.current.contains(e.relatedTarget as Node)\n ) {\n setFocused(false);\n onBlur?.();\n }\n };\n\n const handleOpen = () => {\n setShowOptions(true);\n triggerOptionDisplayCallback(true);\n setFocused(true);\n };\n\n const handleClose = (reason: OpenChangeReason | undefined) => {\n setShowOptions(false);\n triggerOptionDisplayCallback(false);\n\n // click to toggle should not blur the input\n if (reason !== \"click\") {\n setFocused(false);\n onBlur?.();\n }\n };\n\n const handleDismiss = () => {\n selectorRef.current?.focus();\n setShowOptions(false);\n triggerOptionDisplayCallback(false);\n };\n\n // =============================================================================\n // HELPER FUNCTION\n // =============================================================================\n const getDisplayValue = () => {\n if (options && selected.length === options.length) {\n return allSelectedLabel || \"All selected\";\n }\n\n return multiSelectedLabel || `${selected.length} selected`;\n };\n\n const triggerOptionDisplayCallback = (show: boolean) => {\n if (!show && onHideOptions) {\n onHideOptions();\n }\n\n if (show && onShowOptions) {\n onShowOptions();\n }\n };\n\n const performOnSelectOptions = (options: T[]) => {\n if (onSelectOptions) {\n onSelectOptions(options);\n }\n };\n\n // =============================================================================\n // RENDER FUNCTIONS\n // =============================================================================\n const renderLabel = () => {\n if (!selected || selected.length === 0) {\n return (\n <PlaceholderLabel\n variant={variant}\n truncateType={optionTruncationType}\n >\n {placeholder}\n </PlaceholderLabel>\n );\n } else {\n return (\n <ValueLabel\n variant={variant}\n truncateType={optionTruncationType}\n >\n {getDisplayValue()}\n </ValueLabel>\n );\n }\n };\n\n const renderSelectorContent = () => (\n <LabelContainer disabled={disabled}>{renderLabel()}</LabelContainer>\n );\n\n const renderElement = () => {\n return (\n <InputBox\n className={className}\n data-testid={testId}\n id={id}\n ref={nodeRef}\n tabIndex={-1}\n onFocus={handleNodeFocus}\n onBlur={handleNodeBlur}\n focused={focused}\n disabled={disabled}\n readOnly={readOnly}\n error={error}\n >\n <ExpandableElement\n ref={selectorRef}\n disabled={disabled}\n expanded={showOptions}\n listboxId={internalId}\n popupRole=\"listbox\"\n readOnly={readOnly}\n variant={variant}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-invalid={ariaInvalid}\n >\n {renderSelectorContent()}\n </ExpandableElement>\n </InputBox>\n );\n };\n\n const renderDropdown = () => {\n return (\n <DropdownList\n listboxId={internalId}\n listItems={options}\n onSelectItem={handleListItemClick}\n onDismiss={handleListDismiss}\n valueExtractor={valueExtractor}\n listExtractor={listExtractor}\n enableSearch={enableSearch}\n searchFunction={searchFunction}\n searchPlaceholder={searchPlaceholder}\n multiSelect\n maxSelectable={maxSelectable}\n selectedItems={selected}\n onSelectAll={handleSelectAllClick}\n onRetry={onRetry}\n itemsLoadState={optionsLoadState}\n itemTruncationType={optionTruncationType}\n renderListItem={renderListItem}\n hideNoResultsDisplay={hideNoResultsDisplay}\n noResultsDescription={noResultsDescription}\n customLabels={customLabels}\n renderCustomCallToAction={renderCustomCallToAction}\n variant={variant}\n width={dropdownWidth}\n matchElementWidth\n />\n );\n };\n\n return (\n <DropdownListState>\n <ElementWithDropdown\n enabled={!readOnly && !disabled}\n isOpen={showOptions}\n renderElement={renderElement}\n renderDropdown={renderDropdown}\n onOpen={handleOpen}\n onClose={handleClose}\n onDismiss={handleDismiss}\n clickToToggle\n offset={8}\n alignment={alignment}\n fitAvailableHeight\n customZIndex={dropdownZIndex}\n rootNode={dropdownRootNode}\n />\n </DropdownListState>\n );\n};\n"],"names":["InputMultiSelect","selectedOptions","placeholder","options","disabled","error","className","testId","id","ariaLabelledBy","ariaDescribedBy","ariaInvalid","enableSearch","searchFunction","searchPlaceholder","valueExtractor","listExtractor","onSelectOptions","onShowOptions","onHideOptions","onRetry","optionsLoadState","optionTruncationType","renderListItem","hideNoResultsDisplay","noResultsDescription","customLabels","renderCustomCallToAction","onBlur","variant","readOnly","alignment","dropdownZIndex","maxSelectable","dropdownRootNode","dropdownWidth","allSelectedLabel","multiSelectedLabel","selected","setSelected","useState","showOptions","setShowOptions","focused","setFocused","internalId","useId","nodeRef","useRef","selectorRef","useEffect","handleSelectAllClick","length","performOnSelectOptions","handleListItemClick","item","extractedValue","selectedCopy","itemIndex","findIndex","splice","push","handleListDismiss","triggerOptionDisplayCallback","handleNodeFocus","handleNodeBlur","e","current","contains","relatedTarget","show","_jsx","DropdownListState","children","ElementWithDropdown","enabled","isOpen","renderElement","InputBox","ref","tabIndex","onFocus","ExpandableElement","expanded","listboxId","popupRole","LabelContainer","ValueLabel","truncateType","PlaceholderLabel","renderDropdown","DropdownList","listItems","onSelectItem","onDismiss","multiSelect","selectedItems","onSelectAll","itemsLoadState","itemTruncationType","width","matchElementWidth","onOpen","onClose","reason","_a","focus","clickToToggle","offset","fitAvailableHeight","customZIndex","rootNode"],"mappings":"otEAoBaA,EAAmB,EAC5BC,kBACAC,cAAc,SACdC,UACAC,WACAC,QACAC,YACA,cAAeC,EACfC,KACA,kBAAmBC,EACnB,mBAAoBC,EACpB,eAAgBC,EAChBC,gBAAe,EACfC,iBACAC,oBACAC,iBACAC,gBACAC,kBACAC,gBACAC,gBACAC,UACAC,mBAAmB,UAC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IAA6B,EAAM,EAqI3B4C,eAAa,EACbC,OAAQ,EACR7E,UAAWA,EACX8E,oBAAkB,EAClBC,aAAc9E,EACd+E,SAAU7E,KAEE"}
|
|
1
|
+
{"version":3,"file":"input-multi-select.js","sources":["../../src/input-multi-select/input-multi-select.tsx"],"sourcesContent":["import type { OpenChangeReason } from \"@floating-ui/react\";\nimport findIndex from \"lodash/findIndex\";\nimport type React from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport {\n DropdownList,\n DropdownListState,\n ExpandableElement,\n} from \"../shared/dropdown-list\";\nimport { ElementWithDropdown } from \"../shared/dropdown-wrapper\";\nimport {\n LabelContainer,\n PlaceholderLabel,\n ValueLabel,\n} from \"../shared/dropdown-wrapper/dropdown-wrapper\";\nimport { InputBox } from \"../shared/input-wrapper/input-wrapper\";\nimport { useId } from \"../util\";\nimport type { InputMultiSelectProps } from \"./types\";\n\n// @catalog\n/**\n * A dropdown field that lets users select multiple options from a list.\n *\n * Use `InputMultiSelect` when users need to pick one or more items from a\n * predefined list.\n */\nexport const InputMultiSelect = <T, V>({\n selectedOptions,\n placeholder = \"Select\",\n options,\n disabled,\n error,\n className,\n \"data-testid\": testId,\n id,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n enableSearch = false,\n searchFunction,\n searchPlaceholder,\n valueExtractor,\n listExtractor,\n onSelectOptions,\n onShowOptions,\n onHideOptions,\n onRetry,\n optionsLoadState = \"success\",\n optionTruncationType = \"end\",\n renderListItem,\n hideNoResultsDisplay,\n noResultsDescription,\n customLabels,\n renderCustomCallToAction,\n onBlur,\n variant = \"default\",\n readOnly,\n alignment,\n dropdownZIndex,\n maxSelectable,\n dropdownRootNode,\n dropdownWidth,\n}: InputMultiSelectProps<T, V>): JSX.Element => {\n // =============================================================================\n // CONST, STATE\n // =============================================================================\n const { allSelectedLabel, multiSelectedLabel } = customLabels || {};\n const [selected, setSelected] = useState<T[]>(selectedOptions || []);\n const [showOptions, setShowOptions] = useState<boolean>(false);\n const [focused, setFocused] = useState<boolean>(false);\n const internalId = useId();\n\n const nodeRef = useRef<HTMLDivElement>(null);\n const selectorRef = useRef<HTMLButtonElement>(null);\n\n // =============================================================================\n // EFFECTS\n // =============================================================================\n useEffect(() => {\n setSelected(selectedOptions || []);\n }, [selectedOptions]);\n\n // =============================================================================\n // EVENT HANDLERS\n // =============================================================================\n const handleSelectAllClick = () => {\n if ((selected && selected.length > 0) || maxSelectable) {\n setSelected([]);\n performOnSelectOptions([]);\n } else {\n setSelected(options);\n performOnSelectOptions(options);\n }\n };\n\n const handleListItemClick = (item: T, extractedValue: T | V) => {\n const selectedCopy = [...selected];\n\n // Check if it is a selection or deselection\n const itemIndex = findIndex(selected, (item) => {\n const valueToCompare = valueExtractor ? valueExtractor(item) : item;\n return valueToCompare === extractedValue;\n });\n\n if (itemIndex > -1) {\n // Item exists in selected. This indicates a deselection\n selectedCopy.splice(itemIndex, 1);\n } else {\n // Item does not exist in selected. This indicates a selection\n selectedCopy.push(item);\n }\n\n setSelected(selectedCopy);\n performOnSelectOptions(selectedCopy);\n };\n\n const handleListDismiss = () => {\n if (showOptions) {\n setShowOptions(false);\n triggerOptionDisplayCallback(false);\n }\n };\n\n const handleNodeFocus = () => {\n if (!focused && !showOptions) {\n setFocused(true);\n }\n };\n\n const handleNodeBlur = (e: React.FocusEvent) => {\n if (\n focused &&\n !showOptions &&\n nodeRef.current &&\n !nodeRef.current.contains(e.relatedTarget as Node)\n ) {\n setFocused(false);\n onBlur?.();\n }\n };\n\n const handleOpen = () => {\n setShowOptions(true);\n triggerOptionDisplayCallback(true);\n setFocused(true);\n };\n\n const handleClose = (reason: OpenChangeReason | undefined) => {\n setShowOptions(false);\n triggerOptionDisplayCallback(false);\n\n // click to toggle should not blur the input\n if (reason !== \"click\") {\n setFocused(false);\n onBlur?.();\n }\n };\n\n const handleDismiss = () => {\n selectorRef.current?.focus();\n setShowOptions(false);\n triggerOptionDisplayCallback(false);\n };\n\n // =============================================================================\n // HELPER FUNCTION\n // =============================================================================\n const getDisplayValue = () => {\n if (options && selected.length === options.length) {\n return allSelectedLabel || \"All selected\";\n }\n\n return multiSelectedLabel || `${selected.length} selected`;\n };\n\n const triggerOptionDisplayCallback = (show: boolean) => {\n if (!show && onHideOptions) {\n onHideOptions();\n }\n\n if (show && onShowOptions) {\n onShowOptions();\n }\n };\n\n const performOnSelectOptions = (options: T[]) => {\n if (onSelectOptions) {\n onSelectOptions(options);\n }\n };\n\n // =============================================================================\n // RENDER FUNCTIONS\n // =============================================================================\n const renderLabel = () => {\n if (!selected || selected.length === 0) {\n return (\n <PlaceholderLabel\n variant={variant}\n truncateType={optionTruncationType}\n >\n {placeholder}\n </PlaceholderLabel>\n );\n } else {\n return (\n <ValueLabel\n variant={variant}\n truncateType={optionTruncationType}\n >\n {getDisplayValue()}\n </ValueLabel>\n );\n }\n };\n\n const renderSelectorContent = () => (\n <LabelContainer disabled={disabled}>{renderLabel()}</LabelContainer>\n );\n\n const renderElement = () => {\n return (\n <InputBox\n className={className}\n data-testid={testId}\n id={id}\n ref={nodeRef}\n tabIndex={-1}\n onFocus={handleNodeFocus}\n onBlur={handleNodeBlur}\n focused={focused}\n disabled={disabled}\n readOnly={readOnly}\n error={error}\n >\n <ExpandableElement\n ref={selectorRef}\n disabled={disabled}\n expanded={showOptions}\n listboxId={internalId}\n popupRole=\"listbox\"\n readOnly={readOnly}\n variant={variant}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-invalid={ariaInvalid}\n >\n {renderSelectorContent()}\n </ExpandableElement>\n </InputBox>\n );\n };\n\n const renderDropdown = () => {\n return (\n <DropdownList\n listboxId={internalId}\n listItems={options}\n onSelectItem={handleListItemClick}\n onDismiss={handleListDismiss}\n valueExtractor={valueExtractor}\n listExtractor={listExtractor}\n enableSearch={enableSearch}\n searchFunction={searchFunction}\n searchPlaceholder={searchPlaceholder}\n multiSelect\n maxSelectable={maxSelectable}\n selectedItems={selected}\n onSelectAll={handleSelectAllClick}\n onRetry={onRetry}\n itemsLoadState={optionsLoadState}\n itemTruncationType={optionTruncationType}\n renderListItem={renderListItem}\n hideNoResultsDisplay={hideNoResultsDisplay}\n noResultsDescription={noResultsDescription}\n customLabels={customLabels}\n renderCustomCallToAction={renderCustomCallToAction}\n variant={variant}\n width={dropdownWidth}\n matchElementWidth\n />\n );\n };\n\n return (\n <DropdownListState>\n <ElementWithDropdown\n enabled={!readOnly && !disabled}\n isOpen={showOptions}\n renderElement={renderElement}\n renderDropdown={renderDropdown}\n onOpen={handleOpen}\n onClose={handleClose}\n onDismiss={handleDismiss}\n clickToToggle\n offset={8}\n alignment={alignment}\n fitAvailableHeight\n customZIndex={dropdownZIndex}\n rootNode={dropdownRootNode}\n />\n </DropdownListState>\n );\n};\n"],"names":["InputMultiSelect","selectedOptions","placeholder","options","disabled","error","className","testId","id","ariaLabelledBy","ariaDescribedBy","ariaInvalid","enableSearch","searchFunction","searchPlaceholder","valueExtractor","listExtractor","onSelectOptions","onShowOptions","onHideOptions","onRetry","optionsLoadState","optionTruncationType","renderListItem","hideNoResultsDisplay","noResultsDescription","customLabels","renderCustomCallToAction","onBlur","variant","readOnly","alignment","dropdownZIndex","maxSelectable","dropdownRootNode","dropdownWidth","allSelectedLabel","multiSelectedLabel","selected","setSelected","useState","showOptions","setShowOptions","focused","setFocused","internalId","useId","nodeRef","useRef","selectorRef","useEffect","handleSelectAllClick","length","performOnSelectOptions","handleListItemClick","item","extractedValue","selectedCopy","itemIndex","findIndex","splice","push","handleListDismiss","triggerOptionDisplayCallback","handleNodeFocus","handleNodeBlur","e","current","contains","relatedTarget","show","_jsx","DropdownListState","children","ElementWithDropdown","enabled","isOpen","renderElement","InputBox","ref","tabIndex","onFocus","ExpandableElement","expanded","listboxId","popupRole","LabelContainer","ValueLabel","truncateType","PlaceholderLabel","renderDropdown","DropdownList","listItems","onSelectItem","onDismiss","multiSelect","selectedItems","onSelectAll","itemsLoadState","itemTruncationType","width","matchElementWidth","onOpen","onClose","reason","_a","focus","clickToToggle","offset","fitAvailableHeight","customZIndex","rootNode"],"mappings":"otEA2BaA,EAAmB,EAC5BC,kBACAC,cAAc,SACdC,UACAC,WACAC,QACAC,YACA,cAAeC,EACfC,KACA,kBAAmBC,EACnB,mBAAoBC,EACpB,eAAgBC,EAChBC,gBAAe,EACfC,iBACAC,oBACAC,iBACAC,gBACAC,kBACAC,gBACAC,gBACAC,UACAC,mBAAmB,UACnBC,uBAAuB,MACvBC,iBACAC,uBACAC,uBACAC,eACAC,2BACAC,SACAC,UAAU,UACVC,WACAC,YACAC,iBACAC,gBACAC,mBACAC,oBAKA,MAAMC,iBAAEA,EAAgBC,mBAAEA,GAAuBX,GAAgB,CAAA,GAC1DY,EAAUC,GAAeC,EAAcvC,GAAmB,KAC1DwC,EAAaC,IAAkBF,GAAkB,IACjDG,GAASC,IAAcJ,GAAkB,GAC1CK,GAAaC,IAEbC,GAAUC,EAAuB,MACjCC,GAAcD,EAA0B,MAK9CE,GAAU,KACNX,EAAYtC,GAAmB,GAAG,GACnC,CAACA,IAKJ,MAAMkD,GAAuB,KACpBb,GAAYA,EAASc,OAAS,GAAMnB,GACrCM,EAAY,IACZc,GAAuB,MAEvBd,EAAYpC,GACZkD,GAAuBlD,GAC3B,EAGEmD,GAAsB,CAACC,EAASC,KAClC,MAAMC,EAAe,IAAInB,GAGnBoB,EAAYC,EAAUrB,GAAWiB,IACZxC,EAAiBA,EAAewC,GAAQA,KACrCC,IAG1BE,GAAY,EAEZD,EAAaG,OAAOF,EAAW,GAG/BD,EAAaI,KAAKN,GAGtBhB,EAAYkB,GACZJ,GAAuBI,EAAa,EAGlCK,GAAoB,KAClBrB,IACAC,IAAe,GACfqB,IAA6B,GACjC,EAGEC,GAAkB,KACfrB,IAAYF,GACbG,IAAW,EACf,EAGEqB,GAAkBC,IAEhBvB,KACCF,GACDM,GAAQoB,UACPpB,GAAQoB,QAAQC,SAASF,EAAEG,iBA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BA,EAC1BE,QAASA,EACTuE,MAAOjE,EACPkE,mBAAiB,IAYjBC,OAtJO,KACf5D,IAAe,GACfqB,IAA6B,GAC7BnB,IAAW,EAAK,EAoJR2D,QAjJSC,IACjB9D,IAAe,GACfqB,IAA6B,GAGd,UAAXyC,IACA5D,IAAW,GACXhB,SAAAA,IACJ,EA0IQkE,UAvIU,WACC,QAAnBW,EAAAxD,GAAYkB,eAAO,IAAAsC,GAAAA,EAAEC,QACrBhE,IAAe,GACfqB,IAA6B,EAAM,EAqI3B4C,eAAa,EACbC,OAAQ,EACR7E,UAAWA,EACX8E,oBAAkB,EAClBC,aAAc9E,EACd+E,SAAU7E,KAEE"}
|
|
@@ -2,25 +2,66 @@ import type { RefObject } from "react";
|
|
|
2
2
|
import type { InputSelectOptionsProps, InputSelectSharedProps } from "../input-select/types";
|
|
3
3
|
import type { DropdownCustomLabelProps, DropdownDisplayProps, DropdownSearchProps, DropdownVariantType } from "../shared/dropdown-list/types";
|
|
4
4
|
import type { DropdownAlignmentType } from "../shared/dropdown-wrapper";
|
|
5
|
+
/**
|
|
6
|
+
* Props for the `InputMultiSelect` component.
|
|
7
|
+
*
|
|
8
|
+
* `T` is the option item type. `V` is the extracted value type used for
|
|
9
|
+
* equality comparisons when a `valueExtractor` is provided.
|
|
10
|
+
*/
|
|
5
11
|
export interface InputMultiSelectProps<T, V> extends React.HTMLAttributes<HTMLElement>, InputSelectOptionsProps<T>, InputSelectSharedProps<T>, DropdownDisplayProps<T, V>, DropdownSearchProps<T> {
|
|
6
12
|
readOnly?: boolean | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The currently selected options.
|
|
15
|
+
*/
|
|
7
16
|
selectedOptions?: T[] | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Called when the selection changes. Receives the updated array of selected
|
|
19
|
+
* options after each user interaction.
|
|
20
|
+
*/
|
|
8
21
|
onSelectOptions?: ((options: T[]) => void) | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Called when focus leaves both the trigger and dropdown.
|
|
24
|
+
*/
|
|
9
25
|
onBlur?: (() => void) | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Controls the height of the trigger and dropdown items.
|
|
28
|
+
*
|
|
29
|
+
* @default "default"
|
|
30
|
+
*/
|
|
10
31
|
variant?: DropdownVariantType | undefined;
|
|
32
|
+
/** Aligns the dropdown relative to the trigger element. */
|
|
11
33
|
alignment?: DropdownAlignmentType | undefined;
|
|
34
|
+
/** CSS `z-index` applied to the dropdown overlay. */
|
|
12
35
|
dropdownZIndex?: number | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Caps the number of options that can be simultaneously selected.
|
|
38
|
+
*/
|
|
13
39
|
maxSelectable?: number | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Overrides the default labels shown inside the dropdown and on the trigger.
|
|
42
|
+
*/
|
|
14
43
|
customLabels?: DropdownCustomLabelProps | undefined;
|
|
15
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Custom width for the dropdown. When specified, the dropdown uses this
|
|
46
|
+
* width instead of matching the trigger element width.
|
|
47
|
+
*/
|
|
16
48
|
dropdownWidth?: string | undefined;
|
|
17
49
|
/**
|
|
18
|
-
* The root element that contains the dropdown element.
|
|
50
|
+
* The root element that contains the dropdown element.
|
|
51
|
+
*
|
|
52
|
+
* @remarks Specify this if you need to change the parent of the
|
|
53
|
+
* dropdown in the HTML DOM.
|
|
54
|
+
* Possible use case: sharing a stacking context.
|
|
55
|
+
*
|
|
56
|
+
* Note: if a parent of the trigger has a higher `z-index` than the dropdown,
|
|
57
|
+
* the dropdown may be obscured.
|
|
19
58
|
*
|
|
20
|
-
*
|
|
21
|
-
* the dropdown may not be visible. Specify the parent element here instead
|
|
59
|
+
* @default document.body
|
|
22
60
|
*/
|
|
23
61
|
dropdownRootNode?: RefObject<HTMLElement> | undefined;
|
|
24
62
|
}
|
|
25
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* A subset of `InputMultiSelectProps` used by form components that manage
|
|
65
|
+
* the `error` state themselves.
|
|
66
|
+
*/
|
|
26
67
|
export type InputMultiSelectPartialProps<T, V> = Omit<InputMultiSelectProps<T, V>, "error">;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import type { InputNestedMultiSelectProps } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A multi-select input that presents options in a nested hierarchy, up to three levels deep.
|
|
4
|
+
*
|
|
5
|
+
* Use `InputNestedMultiSelect` when users need to choose multiple values from a
|
|
6
|
+
* hierarchical option tree. Selecting a parent item automatically selects all its
|
|
7
|
+
* leaf descendants; deselecting a parent removes all its descendants from the
|
|
8
|
+
* selection.
|
|
9
|
+
*/
|
|
2
10
|
export declare const InputNestedMultiSelect: <V1, V2, V3>({ placeholder, options: _options, disabled, error, className, "data-testid": testId, id, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, selectedKeyPaths: _selectedKeyPaths, mode, valueToStringFunction, enableSearch, searchPlaceholder, hideNoResultsDisplay, noResultsDescription, customLabels, readOnly, onSearch, onSelectOptions, onShowOptions, onHideOptions, onRetry, onBlur, optionsLoadState, optionTruncationType, variant, alignment, dropdownZIndex, dropdownWidth, dropdownRootNode, }: InputNestedMultiSelectProps<V1, V2, V3>) => JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-nested-multi-select.js","sources":["../../src/input-nested-multi-select/input-nested-multi-select.tsx"],"sourcesContent":["import type { OpenChangeReason } from \"@floating-ui/react\";\nimport isEmpty from \"lodash/isEmpty\";\nimport isEqual from \"lodash/isEqual\";\nimport type React from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport type {\n NestedDropdownListItemProps,\n NestedDropdownListLocalItem,\n} from \"../shared/dropdown-list\";\nimport {\n buildKeyPathToSet,\n ExpandableElement,\n NestedDropdownList,\n} from \"../shared/dropdown-list\";\nimport { ElementWithDropdown } from \"../shared/dropdown-wrapper\";\nimport {\n LabelContainer,\n PlaceholderLabel,\n ValueLabel,\n} from \"../shared/dropdown-wrapper/dropdown-wrapper\";\nimport { InputBox } from \"../shared/input-wrapper/input-wrapper\";\nimport { StringHelper, useId } from \"../util\";\nimport type { SelectedItem } from \"./helpers\";\nimport { getSelectedItems, getSelectedSubItems } from \"./helpers\";\nimport type { InputNestedMultiSelectProps } from \"./types\";\n\nexport const InputNestedMultiSelect = <V1, V2, V3>({\n placeholder = \"Select\",\n options: _options,\n disabled,\n error,\n className,\n \"data-testid\": testId,\n id,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n selectedKeyPaths: _selectedKeyPaths,\n mode,\n valueToStringFunction,\n enableSearch,\n searchPlaceholder,\n hideNoResultsDisplay,\n noResultsDescription,\n customLabels,\n readOnly,\n onSearch,\n onSelectOptions,\n onShowOptions,\n onHideOptions,\n onRetry,\n onBlur,\n optionsLoadState = \"success\",\n optionTruncationType = \"end\",\n variant = \"default\",\n alignment,\n dropdownZIndex,\n dropdownWidth,\n dropdownRootNode,\n}: InputNestedMultiSelectProps<V1, V2, V3>): JSX.Element => {\n // =========================================================================\n // CONST, STATE\n // =========================================================================\n const { multiSelectedLabel } = customLabels || {};\n const options = _options as NestedDropdownListItemProps<V1 | V2 | V3>[];\n const [selectedKeyPaths, setSelectedKeyPaths] = useState<Set<string>>(\n _selectedKeyPaths\n ? buildKeyPathToSet(_selectedKeyPaths)\n : new Set<string>()\n );\n const [selectedItems, setSelectedItems] = useState<\n SelectedItem<V1 | V2 | V3>[]\n >([]);\n\n const [showOptions, setShowOptions] = useState<boolean>(false);\n const [focused, setFocused] = useState<boolean>(false);\n const internalId = useId();\n\n const nodeRef = useRef<HTMLDivElement>(null);\n const selectorRef = useRef<HTMLButtonElement>(null);\n const labelContainerRef = useRef<HTMLDivElement>(null);\n\n // =========================================================================\n // EFFECTS\n // =========================================================================\n useEffect(() => {\n const newKeyPath = _selectedKeyPaths || [];\n const selectedItems = getSelectedItems(options, newKeyPath);\n\n setSelectedKeyPaths(buildKeyPathToSet(newKeyPath));\n setSelectedItems(selectedItems);\n }, [_selectedKeyPaths, options]);\n\n // =========================================================================\n // EVENT HANDLERS\n // =========================================================================\n const handleSelectAll = (\n keyPaths: string[][],\n items: NestedDropdownListLocalItem<V1 | V2 | V3>[]\n ) => {\n const selectedItems = items.map((item) => ({\n keyPath: item.keyPath,\n label: item.item.label,\n value: item.item.value,\n }));\n setSelectedKeyPaths(buildKeyPathToSet(keyPaths));\n setSelectedItems(selectedItems);\n performOnSelectOptions(keyPaths, selectedItems);\n };\n\n const handleListItemClick = (\n listItem: NestedDropdownListLocalItem<V1 | V2 | V3>\n ) => {\n const newSelectedItems: SelectedItem<V1 | V2 | V3>[] =\n getNewSelection(listItem);\n const newKeyPaths = newSelectedItems.map((item) => item.keyPath);\n setSelectedItems(newSelectedItems);\n setSelectedKeyPaths(buildKeyPathToSet(newKeyPaths));\n performOnSelectOptions(newKeyPaths, newSelectedItems);\n };\n\n const handleNodeFocus = () => {\n if (!focused && !showOptions) {\n setFocused(true);\n }\n };\n\n const handleNodeBlur = (e: React.FocusEvent) => {\n if (\n focused &&\n !showOptions &&\n nodeRef.current &&\n !nodeRef.current.contains(e.relatedTarget as Node)\n ) {\n setFocused(false);\n onBlur?.();\n }\n };\n\n const handleOpen = () => {\n setShowOptions(true);\n triggerOptionDisplayCallback(true);\n setFocused(true);\n };\n\n const handleClose = (reason: OpenChangeReason | undefined) => {\n setShowOptions(false);\n triggerOptionDisplayCallback(false);\n\n // click to toggle should not blur the input\n if (reason !== \"click\") {\n setFocused(false);\n onBlur?.();\n }\n };\n\n const handleDismiss = () => {\n selectorRef.current?.focus();\n setShowOptions(false);\n triggerOptionDisplayCallback(false);\n };\n\n // =========================================================================\n // HELPER FUNCTION\n // =========================================================================\n const getDisplayValue = (): string => {\n if (selectedItems.length > 1) {\n return multiSelectedLabel || `${selectedItems.length} selected`;\n }\n\n const { label, value } = selectedItems[0];\n if (valueToStringFunction) {\n return valueToStringFunction(value);\n } else {\n return label;\n }\n };\n\n const truncateValue = (value: string) => {\n if (optionTruncationType === \"middle\") {\n let widthOfElement = 0;\n if (labelContainerRef && labelContainerRef.current) {\n widthOfElement =\n labelContainerRef.current.getBoundingClientRect().width;\n }\n return StringHelper.truncateOneLine(value, widthOfElement, 120, 6);\n }\n\n return value;\n };\n\n const triggerOptionDisplayCallback = (show: boolean) => {\n if (!show && onHideOptions) {\n onHideOptions();\n }\n\n if (show && onShowOptions) {\n onShowOptions();\n }\n };\n\n const performOnSelectOptions = (\n keyPaths: string[][],\n items: SelectedItem<V1 | V2 | V3>[]\n ) => {\n if (onSelectOptions) {\n const returnValue = items.map((item) => item.value);\n onSelectOptions(keyPaths, returnValue);\n }\n };\n\n const getNewSelection = (\n item: NestedDropdownListLocalItem<V1 | V2 | V3>\n ): SelectedItem<V1 | V2 | V3>[] => {\n if (item.checked === true) {\n // remove item or subitems\n return selectedItems.filter((selectedItem) => {\n const ancestorKeyPath = selectedItem.keyPath.slice(\n 0,\n item.keyPath.length\n );\n return !isEqual(item.keyPath, ancestorKeyPath);\n });\n } else {\n // select item or all subitems\n const nextSelection = [...selectedItems];\n const newItemsToAdd = item.hasSubItems\n ? getSelectedSubItems(options, item.keyPath)\n : [\n {\n value: item.item.value,\n label: item.item.label,\n keyPath: item.keyPath,\n },\n ];\n newItemsToAdd.forEach((addedItem) => {\n if (\n !selectedItems.find((selectedItem) =>\n isEqual(selectedItem.keyPath, addedItem.keyPath)\n )\n ) {\n nextSelection.push(addedItem);\n }\n });\n return nextSelection;\n }\n };\n\n // =========================================================================\n // RENDER FUNCTION\n // =========================================================================\n const renderLabel = () => {\n if (isEmpty(selectedItems)) {\n return (\n <PlaceholderLabel truncateType={optionTruncationType}>\n {placeholder}\n </PlaceholderLabel>\n );\n } else {\n return (\n <ValueLabel truncateType={optionTruncationType}>\n {truncateValue(getDisplayValue())}\n </ValueLabel>\n );\n }\n };\n\n const renderSelectorContent = () => (\n <LabelContainer ref={labelContainerRef} disabled={disabled}>\n {renderLabel()}\n </LabelContainer>\n );\n\n const renderElement = () => {\n return (\n <InputBox\n className={className}\n data-testid={testId}\n id={id}\n ref={nodeRef}\n tabIndex={-1}\n onFocus={handleNodeFocus}\n onBlur={handleNodeBlur}\n focused={focused}\n disabled={disabled}\n readOnly={readOnly}\n error={error}\n >\n <ExpandableElement\n ref={selectorRef}\n disabled={disabled}\n expanded={showOptions}\n listboxId={internalId}\n popupRole=\"tree\"\n readOnly={readOnly}\n variant={variant}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-invalid={ariaInvalid}\n >\n {renderSelectorContent()}\n </ExpandableElement>\n </InputBox>\n );\n };\n\n const renderDropdown = () => {\n return (\n <NestedDropdownList\n listboxId={internalId}\n listItems={options}\n multiSelect\n selectedKeyPaths={selectedKeyPaths}\n itemsLoadState={optionsLoadState}\n itemTruncationType={optionTruncationType}\n enableSearch={enableSearch}\n searchPlaceholder={searchPlaceholder}\n hideNoResultsDisplay={hideNoResultsDisplay}\n noResultsDescription={noResultsDescription}\n customLabels={customLabels}\n onSelectItem={handleListItemClick}\n onSelectAll={handleSelectAll}\n onRetry={onRetry}\n onSearch={onSearch}\n variant={variant}\n mode={mode}\n width={dropdownWidth}\n matchElementWidth\n />\n );\n };\n\n return (\n <ElementWithDropdown\n enabled={!readOnly && !disabled}\n isOpen={showOptions}\n renderElement={renderElement}\n renderDropdown={renderDropdown}\n onOpen={handleOpen}\n onClose={handleClose}\n onDismiss={handleDismiss}\n clickToToggle\n offset={8}\n alignment={alignment}\n fitAvailableHeight\n customZIndex={dropdownZIndex}\n rootNode={dropdownRootNode}\n />\n );\n};\n"],"names":["InputNestedMultiSelect","placeholder","options","_options","disabled","error","className","testId","id","ariaLabelledBy","ariaDescribedBy","ariaInvalid","selectedKeyPaths","_selectedKeyPaths","mode","valueToStringFunction","enableSearch","searchPlaceholder","hideNoResultsDisplay","noResultsDescription","customLabels","readOnly","onSearch","onSelectOptions","onShowOptions","onHideOptions","onRetry","onBlur","optionsLoadState","optionTruncationType","variant","alignment","dropdownZIndex","dropdownWidth","dropdownRootNode","multiSelectedLabel","setSelectedKeyPaths","useState","buildKeyPathToSet","Set","selectedItems","setSelectedItems","showOptions","setShowOptions","focused","setFocused","internalId","useId","nodeRef","useRef","selectorRef","labelContainerRef","useEffect","newKeyPath","getSelectedItems","handleSelectAll","keyPaths","items","map","item","keyPath","label","value","performOnSelectOptions","handleListItemClick","listItem","newSelectedItems","getNewSelection","newKeyPaths","handleNodeFocus","handleNodeBlur","e","current","contains","relatedTarget","getDisplayValue","length","truncateValue","widthOfElement","getBoundingClientRect","width","StringHelper","truncateOneLine","triggerOptionDisplayCallback","show","returnValue","checked","filter","selectedItem","ancestorKeyPath","slice","isEqual","nextSelection","hasSubItems","getSelectedSubItems","forEach","addedItem","find","push","_jsx","ElementWithDropdown","enabled","isOpen","renderElement","InputBox","ref","tabIndex","onFocus","ExpandableElement","expanded","listboxId","popupRole","children","LabelContainer","isEmpty","PlaceholderLabel","truncateType","ValueLabel","renderDropdown","NestedDropdownList","listItems","multiSelect","itemsLoadState","itemTruncationType","onSelectItem","onSelectAll","matchElementWidth","onOpen","onClose","reason","onDismiss","_a","focus","clickToToggle","offset","fitAvailableHeight","customZIndex","rootNode"],"mappings":"u8CA2BO,MAAMA,EAAyB,EAClCC,cAAc,SACdC,QAASC,EACTC,WACAC,QACAC,YACA,cAAeC,EACfC,KACA,kBAAmBC,EACnB,mBAAoBC,EACpB,eAAgBC,EAChBC,iBAAkBC,EAClBC,OACAC,wBACAC,eACAC,oBACAC,uBACAC,uBACAC,eACAC,WACAC,WACAC,kBACAC,gBACAC,gBACAC,UACAC,SACAC,mBAAmB,UACnBC,uBAAuB,MACvBC,UAAU,UACVC,YACAC,iBACAC,gBACAC,uBAKA,MAAMC,mBAAEA,GAAuBf,GAAgB,CAAA,EACzClB,EAAUC,GACTS,EAAkBwB,GAAuBC,EAC5CxB,EACMyB,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G,EAAQ1E,IAEJ2D,EAACgB,EAAgB,CAACC,aAAcvF,EAAoBmF,SAC/C/G,IAKLkG,EAACkB,EAAU,CAACD,aAAcvF,EAAoBmF,SACzCnC,GAAcF,cA4EvB2C,eA/Be,IAEfnB,EAACoB,EAAkB,CACfT,UAAWhE,GACX0E,UAAWtH,EACXuH,aAAW,EACX7G,iBAAkBA,EAClB8G,eAAgB9F,EAChB+F,mBAAoB9F,EACpBb,aAAcA,EACdC,kBAAmBA,EACnBC,qBAAsBA,EACtBC,qBAAsBA,EACtBC,aAAcA,EACdwG,aAAc5D,GACd6D,YAAatE,GACb7B,QAASA,EACTJ,SAAUA,EACVQ,QAASA,EACThB,KAAMA,EACNkE,MAAO/C,EACP6F,mBAAiB,IAWrBC,OAvMW,KACfpF,IAAe,GACfwC,IAA6B,GAC7BtC,IAAW,EAAK,EAqMZmF,QAlMaC,IACjBtF,IAAe,GACfwC,IAA6B,GAGd,UAAX8C,IACApF,IAAW,GACXlB,SAAAA,IACJ,EA2LIuG,UAxLc,WACC,QAAnBC,EAAAjF,GAAYsB,eAAO,IAAA2D,GAAAA,EAAEC,QACrBzF,IAAe,GACfwC,IAA6B,EAAM,EAsL/BkD,eAAa,EACbC,OAAQ,EACRvG,UAAWA,EACXwG,oBAAkB,EAClBC,aAAcxG,EACdyG,SAAUvG,GACZ"}
|
|
1
|
+
{"version":3,"file":"input-nested-multi-select.js","sources":["../../src/input-nested-multi-select/input-nested-multi-select.tsx"],"sourcesContent":["import type { OpenChangeReason } from \"@floating-ui/react\";\nimport isEmpty from \"lodash/isEmpty\";\nimport isEqual from \"lodash/isEqual\";\nimport type React from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport type {\n NestedDropdownListItemProps,\n NestedDropdownListLocalItem,\n} from \"../shared/dropdown-list\";\nimport {\n buildKeyPathToSet,\n ExpandableElement,\n NestedDropdownList,\n} from \"../shared/dropdown-list\";\nimport { ElementWithDropdown } from \"../shared/dropdown-wrapper\";\nimport {\n LabelContainer,\n PlaceholderLabel,\n ValueLabel,\n} from \"../shared/dropdown-wrapper/dropdown-wrapper\";\nimport { InputBox } from \"../shared/input-wrapper/input-wrapper\";\nimport { StringHelper, useId } from \"../util\";\nimport type { SelectedItem } from \"./helpers\";\nimport { getSelectedItems, getSelectedSubItems } from \"./helpers\";\nimport type {\n InputNestedMultiSelectProps,\n InputNestedMultiSelectValue,\n InputNestedMultiSelectValues,\n} from \"./types\";\n\n// @catalog\n/**\n * A multi-select input that presents options in a nested hierarchy, up to three levels deep.\n *\n * Use `InputNestedMultiSelect` when users need to choose multiple values from a\n * hierarchical option tree. Selecting a parent item automatically selects all its\n * leaf descendants; deselecting a parent removes all its descendants from the\n * selection.\n */\nexport const InputNestedMultiSelect = <V1, V2, V3>({\n placeholder = \"Select\",\n options: _options,\n disabled,\n error,\n className,\n \"data-testid\": testId,\n id,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n selectedKeyPaths: _selectedKeyPaths,\n mode,\n valueToStringFunction,\n enableSearch,\n searchPlaceholder,\n hideNoResultsDisplay,\n noResultsDescription,\n customLabels,\n readOnly,\n onSearch,\n onSelectOptions,\n onShowOptions,\n onHideOptions,\n onRetry,\n onBlur,\n optionsLoadState = \"success\",\n optionTruncationType = \"end\",\n variant = \"default\",\n alignment,\n dropdownZIndex,\n dropdownWidth,\n dropdownRootNode,\n}: InputNestedMultiSelectProps<V1, V2, V3>): JSX.Element => {\n // =========================================================================\n // CONST, STATE\n // =========================================================================\n type NestedValue = InputNestedMultiSelectValue<V1, V2, V3>;\n\n const { multiSelectedLabel } = customLabels || {};\n const options = _options as NestedDropdownListItemProps<NestedValue>[];\n const [selectedKeyPaths, setSelectedKeyPaths] = useState<Set<string>>(\n _selectedKeyPaths\n ? buildKeyPathToSet(_selectedKeyPaths)\n : new Set<string>()\n );\n const [selectedItems, setSelectedItems] = useState<\n SelectedItem<NestedValue>[]\n >([]);\n\n const [showOptions, setShowOptions] = useState<boolean>(false);\n const [focused, setFocused] = useState<boolean>(false);\n const internalId = useId();\n\n const nodeRef = useRef<HTMLDivElement>(null);\n const selectorRef = useRef<HTMLButtonElement>(null);\n const labelContainerRef = useRef<HTMLDivElement>(null);\n\n // =========================================================================\n // EFFECTS\n // =========================================================================\n useEffect(() => {\n const newKeyPath = _selectedKeyPaths || [];\n const selectedItems = getSelectedItems(options, newKeyPath);\n\n setSelectedKeyPaths(buildKeyPathToSet(newKeyPath));\n setSelectedItems(selectedItems);\n }, [_selectedKeyPaths, options]);\n\n // =========================================================================\n // EVENT HANDLERS\n // =========================================================================\n const handleSelectAll = (\n keyPaths: string[][],\n items: NestedDropdownListLocalItem<NestedValue>[]\n ) => {\n const selectedItems: SelectedItem<NestedValue>[] = items.map(\n (item) => ({\n keyPath: item.keyPath,\n label: item.item.label,\n value: item.item.value,\n })\n );\n setSelectedKeyPaths(buildKeyPathToSet(keyPaths));\n setSelectedItems(selectedItems);\n performOnSelectOptions(keyPaths, selectedItems);\n };\n\n const handleListItemClick = (\n listItem: NestedDropdownListLocalItem<NestedValue>\n ) => {\n const newSelectedItems: SelectedItem<NestedValue>[] =\n getNewSelection(listItem);\n const newKeyPaths = newSelectedItems.map((item) => item.keyPath);\n setSelectedItems(newSelectedItems);\n setSelectedKeyPaths(buildKeyPathToSet(newKeyPaths));\n performOnSelectOptions(newKeyPaths, newSelectedItems);\n };\n\n const handleNodeFocus = () => {\n if (!focused && !showOptions) {\n setFocused(true);\n }\n };\n\n const handleNodeBlur = (e: React.FocusEvent) => {\n if (\n focused &&\n !showOptions &&\n nodeRef.current &&\n !nodeRef.current.contains(e.relatedTarget as Node)\n ) {\n setFocused(false);\n onBlur?.();\n }\n };\n\n const handleOpen = () => {\n setShowOptions(true);\n triggerOptionDisplayCallback(true);\n setFocused(true);\n };\n\n const handleClose = (reason: OpenChangeReason | undefined) => {\n setShowOptions(false);\n triggerOptionDisplayCallback(false);\n\n // click to toggle should not blur the input\n if (reason !== \"click\") {\n setFocused(false);\n onBlur?.();\n }\n };\n\n const handleDismiss = () => {\n selectorRef.current?.focus();\n setShowOptions(false);\n triggerOptionDisplayCallback(false);\n };\n\n // =========================================================================\n // HELPER FUNCTION\n // =========================================================================\n const getDisplayValue = (): string => {\n if (selectedItems.length > 1) {\n return multiSelectedLabel || `${selectedItems.length} selected`;\n }\n\n const { label, value } = selectedItems[0];\n if (valueToStringFunction) {\n return valueToStringFunction(value);\n } else {\n return label;\n }\n };\n\n const truncateValue = (value: string) => {\n if (optionTruncationType === \"middle\") {\n let widthOfElement = 0;\n if (labelContainerRef && labelContainerRef.current) {\n widthOfElement =\n labelContainerRef.current.getBoundingClientRect().width;\n }\n return StringHelper.truncateOneLine(value, widthOfElement, 120, 6);\n }\n\n return value;\n };\n\n const triggerOptionDisplayCallback = (show: boolean) => {\n if (!show && onHideOptions) {\n onHideOptions();\n }\n\n if (show && onShowOptions) {\n onShowOptions();\n }\n };\n\n const performOnSelectOptions = (\n keyPaths: string[][],\n items: SelectedItem<NestedValue>[]\n ) => {\n if (onSelectOptions) {\n const returnValue: InputNestedMultiSelectValues<V1, V2, V3> =\n items.map((item) => item.value);\n onSelectOptions(keyPaths, returnValue);\n }\n };\n\n const getNewSelection = (\n item: NestedDropdownListLocalItem<NestedValue>\n ): SelectedItem<NestedValue>[] => {\n if (item.checked === true) {\n // remove item or subitems\n return selectedItems.filter((selectedItem) => {\n const ancestorKeyPath = selectedItem.keyPath.slice(\n 0,\n item.keyPath.length\n );\n return !isEqual(item.keyPath, ancestorKeyPath);\n });\n } else {\n // select item or all subitems\n const nextSelection = [...selectedItems];\n const newItemsToAdd = item.hasSubItems\n ? getSelectedSubItems(options, item.keyPath)\n : [\n {\n value: item.item.value,\n label: item.item.label,\n keyPath: item.keyPath,\n },\n ];\n newItemsToAdd.forEach((addedItem) => {\n if (\n !selectedItems.find((selectedItem) =>\n isEqual(selectedItem.keyPath, addedItem.keyPath)\n )\n ) {\n nextSelection.push(addedItem);\n }\n });\n return nextSelection;\n }\n };\n\n // =========================================================================\n // RENDER FUNCTION\n // =========================================================================\n const renderLabel = () => {\n if (isEmpty(selectedItems)) {\n return (\n <PlaceholderLabel truncateType={optionTruncationType}>\n {placeholder}\n </PlaceholderLabel>\n );\n } else {\n return (\n <ValueLabel truncateType={optionTruncationType}>\n {truncateValue(getDisplayValue())}\n </ValueLabel>\n );\n }\n };\n\n const renderSelectorContent = () => (\n <LabelContainer ref={labelContainerRef} disabled={disabled}>\n {renderLabel()}\n </LabelContainer>\n );\n\n const renderElement = () => {\n return (\n <InputBox\n className={className}\n data-testid={testId}\n id={id}\n ref={nodeRef}\n tabIndex={-1}\n onFocus={handleNodeFocus}\n onBlur={handleNodeBlur}\n focused={focused}\n disabled={disabled}\n readOnly={readOnly}\n error={error}\n >\n <ExpandableElement\n ref={selectorRef}\n disabled={disabled}\n expanded={showOptions}\n listboxId={internalId}\n popupRole=\"tree\"\n readOnly={readOnly}\n variant={variant}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-invalid={ariaInvalid}\n >\n {renderSelectorContent()}\n </ExpandableElement>\n </InputBox>\n );\n };\n\n const renderDropdown = () => {\n return (\n <NestedDropdownList\n listboxId={internalId}\n listItems={options}\n multiSelect\n selectedKeyPaths={selectedKeyPaths}\n itemsLoadState={optionsLoadState}\n itemTruncationType={optionTruncationType}\n enableSearch={enableSearch}\n searchPlaceholder={searchPlaceholder}\n hideNoResultsDisplay={hideNoResultsDisplay}\n noResultsDescription={noResultsDescription}\n customLabels={customLabels}\n onSelectItem={handleListItemClick}\n onSelectAll={handleSelectAll}\n onRetry={onRetry}\n onSearch={onSearch}\n variant={variant}\n mode={mode}\n width={dropdownWidth}\n matchElementWidth\n />\n );\n };\n\n return (\n <ElementWithDropdown\n enabled={!readOnly && !disabled}\n isOpen={showOptions}\n renderElement={renderElement}\n renderDropdown={renderDropdown}\n onOpen={handleOpen}\n onClose={handleClose}\n onDismiss={handleDismiss}\n clickToToggle\n offset={8}\n alignment={alignment}\n fitAvailableHeight\n customZIndex={dropdownZIndex}\n rootNode={dropdownRootNode}\n />\n );\n};\n"],"names":["InputNestedMultiSelect","placeholder","options","_options","disabled","error","className","testId","id","ariaLabelledBy","ariaDescribedBy","ariaInvalid","selectedKeyPaths","_selectedKeyPaths","mode","valueToStringFunction","enableSearch","searchPlaceholder","hideNoResultsDisplay","noResultsDescription","customLabels","readOnly","onSearch","onSelectOptions","onShowOptions","onHideOptions","onRetry","onBlur","optionsLoadState","optionTruncationType","variant","alignment","dropdownZIndex","dropdownWidth","dropdownRootNode","multiSelectedLabel","setSelectedKeyPaths","useState","buildKeyPathToSet","Set","selectedItems","setSelectedItems","showOptions","setShowOptions","focused","setFocused","internalId","useId","nodeRef","useRef","selectorRef","labelContainerRef","useEffect","newKeyPath","getSelectedItems","handleSelectAll","keyPaths","items","map","item","keyPath","label","value","performOnSelectOptions","handleListItemClick","listItem","newSelectedItems","getNewSelection","newKeyPaths","handleNodeFocus","handleNodeBlur","e","current","contains","relatedTarget","getDisplayValue","length","truncateValue","widthOfElement","getBoundingClientRect","width","StringHelper","truncateOneLine","triggerOptionDisplayCallback","show","returnValue","checked","filter","selectedItem","ancestorKeyPath","slice","isEqual","nextSelection","hasSubItems","getSelectedSubItems","forEach","addedItem","find","push","_jsx","ElementWithDropdown","enabled","isOpen","renderElement","InputBox","ref","tabIndex","onFocus","ExpandableElement","expanded","listboxId","popupRole","children","LabelContainer","isEmpty","PlaceholderLabel","truncateType","ValueLabel","renderDropdown","NestedDropdownList","listItems","multiSelect","itemsLoadState","itemTruncationType","onSelectItem","onSelectAll","matchElementWidth","onOpen","onClose","reason","onDismiss","_a","focus","clickToToggle","offset","fitAvailableHeight","customZIndex","rootNode"],"mappings":"u8CAwCO,MAAMA,EAAyB,EAClCC,cAAc,SACdC,QAASC,EACTC,WACAC,QACAC,YACA,cAAeC,EACfC,KACA,kBAAmBC,EACnB,mBAAoBC,EACpB,eAAgBC,EAChBC,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R1B,QAASA,GACTxC,SAAUA,EACViB,SAAUA,EACVhB,MAAOA,WAEP8F,EAACS,GACGH,IAAKvD,GACL9C,SAAUA,EACVyG,SAAUnE,GACVoE,UAAWhE,GACXiE,UAAU,OACV1F,SAAUA,EACVS,QAASA,EAAO,kBACCrB,qBACCC,EAAe,eACnBC,EAAWqG,SA9BrCb,EAACc,EAAc,CAACR,IAAKtD,GAAmB/C,SAAUA,WAhB9C8G,EAAQ1E,IAEJ2D,EAACgB,EAAgB,CAACC,aAAcvF,EAAoBmF,SAC/C/G,IAKLkG,EAACkB,EAAU,CAACD,aAAcvF,EAAoBmF,SACzCnC,GAAcF,cA4EvB2C,eA/Be,IAEfnB,EAACoB,EAAkB,CACfT,UAAWhE,GACX0E,UAAWtH,EACXuH,aAAW,EACX7G,iBAAkBA,EAClB8G,eAAgB9F,EAChB+F,mBAAoB9F,EACpBb,aAAcA,EACdC,kBAAmBA,EACnBC,qBAAsBA,EACtBC,qBAAsBA,EACtBC,aAAcA,EACdwG,aAAc5D,GACd6D,YAAatE,GACb7B,QAASA,EACTJ,SAAUA,EACVQ,QAASA,EACThB,KAAMA,EACNkE,MAAO/C,EACP6F,mBAAiB,IAWrBC,OAxMW,KACfpF,IAAe,GACfwC,IAA6B,GAC7BtC,IAAW,EAAK,EAsMZmF,QAnMaC,IACjBtF,IAAe,GACfwC,IAA6B,GAGd,UAAX8C,IACApF,IAAW,GACXlB,SAAAA,IACJ,EA4LIuG,UAzLc,WACC,QAAnBC,EAAAjF,GAAYsB,eAAO,IAAA2D,GAAAA,EAAEC,QACrBzF,IAAe,GACfwC,IAA6B,EAAM,EAuL/BkD,eAAa,EACbC,OAAQ,EACRvG,UAAWA,EACXwG,oBAAkB,EAClBC,aAAcxG,EACdyG,SAAUvG,GACZ"}
|
|
@@ -1,14 +1,44 @@
|
|
|
1
1
|
import type { InputNestedSelectOptionsProps, InputNestedSelectSharedProps, L1OptionProps } from "../input-nested-select";
|
|
2
2
|
import type { DropdownCustomLabelProps, DropdownSearchProps } from "../shared/dropdown-list/types";
|
|
3
|
+
/** Value type returned for a selected item at any nesting level. */
|
|
4
|
+
export type InputNestedMultiSelectValue<V1, V2, V3> = V1 | V2 | V3;
|
|
5
|
+
/** Ordered list of selected item values returned by `onSelectOptions`. */
|
|
6
|
+
export type InputNestedMultiSelectValues<V1, V2, V3> = Array<InputNestedMultiSelectValue<V1, V2, V3>>;
|
|
7
|
+
/**
|
|
8
|
+
* Props for the `InputNestedMultiSelect` component.
|
|
9
|
+
*
|
|
10
|
+
* The three type parameters describe the value types at each nesting level.
|
|
11
|
+
*/
|
|
3
12
|
export interface InputNestedMultiSelectProps<V1, V2, V3> extends React.HTMLAttributes<HTMLElement>, InputNestedSelectOptionsProps<V1, V2, V3>, InputNestedSelectSharedProps<V1, V2, V3>, DropdownSearchProps<L1OptionProps<V1, V2, V3>> {
|
|
4
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The currently selected options expressed as an array of key paths.
|
|
15
|
+
* Each key path is an ordered array of `key` strings from the root option
|
|
16
|
+
* down to the selected item.
|
|
17
|
+
*/
|
|
5
18
|
selectedKeyPaths?: string[][] | undefined;
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Called after the selection changes.
|
|
21
|
+
*
|
|
22
|
+
* @param keyPaths The key paths of all selected items in the new selection state.
|
|
23
|
+
* @param values The values of all selected items in the same order as `keyPaths`.
|
|
24
|
+
*/
|
|
25
|
+
onSelectOptions?: ((keyPaths: string[][], values: InputNestedMultiSelectValues<V1, V2, V3>) => void) | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Custom width for the dropdown. When specified, the dropdown uses this
|
|
28
|
+
* width instead of matching the trigger element width.
|
|
29
|
+
*/
|
|
9
30
|
dropdownWidth?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Called when focus leaves both the trigger and dropdown.
|
|
33
|
+
*/
|
|
10
34
|
onBlur?: (() => void) | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Overrides the default labels shown inside the dropdown and on the trigger.
|
|
37
|
+
*/
|
|
11
38
|
customLabels?: DropdownCustomLabelProps | undefined;
|
|
12
39
|
}
|
|
13
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* A subset of `InputNestedMultiSelectProps` used by form components that manage
|
|
42
|
+
* the `error` state themselves.
|
|
43
|
+
*/
|
|
14
44
|
export type InputNestedMultiSelectPartialProps<V1, V2, V3> = Omit<InputNestedMultiSelectProps<V1, V2, V3>, "error">;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
import type { InputNestedSelectProps
|
|
2
|
-
|
|
1
|
+
import type { InputNestedSelectProps } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A single-select input that presents options in a hierarchy, up to three levels deep.
|
|
4
|
+
*
|
|
5
|
+
* Use `InputNestedSelect` when users need to choose a value from a
|
|
6
|
+
* hierarchical option tree. The dropdown renders as an expandable tree.
|
|
7
|
+
* Parent nodes collapse or expand their children, and only one leaf or category
|
|
8
|
+
* value can be selected at a time.
|
|
9
|
+
*/
|
|
3
10
|
export declare const InputNestedSelect: <V1, V2, V3>({ placeholder, options: _options, disabled, error, className, "data-testid": testId, id, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, selectedKeyPath: _selectedKeyPath, mode, valueToStringFunction, enableSearch, searchPlaceholder, selectableCategory, hideNoResultsDisplay, noResultsDescription, customLabels, readOnly, onBlur, onSearch, onSelectOption, onShowOptions, onHideOptions, onRetry, optionsLoadState, optionTruncationType, variant, alignment, dropdownZIndex, dropdownWidth, dropdownRootNode, }: InputNestedSelectProps<V1, V2, V3>) => JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-nested-select.js","sources":["../../src/input-nested-select/input-nested-select.tsx"],"sourcesContent":["import type { OpenChangeReason } from \"@floating-ui/react\";\nimport isEmpty from \"lodash/isEmpty\";\nimport type React from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport type {\n NestedDropdownListItemProps,\n NestedDropdownListLocalItem,\n} from \"../shared/dropdown-list\";\nimport {\n buildKeyPathToSet,\n ExpandableElement,\n findItemByKeyPath,\n NestedDropdownList,\n} from \"../shared/dropdown-list\";\nimport { ElementWithDropdown } from \"../shared/dropdown-wrapper\";\nimport {\n LabelContainer,\n PlaceholderLabel,\n ValueLabel,\n} from \"../shared/dropdown-wrapper/dropdown-wrapper\";\nimport { InputBox } from \"../shared/input-wrapper/input-wrapper\";\nimport { StringHelper, useId } from \"../util\";\nimport type {\n InputNestedSelectProps,\n L1OptionProps,\n L2OptionProps,\n L3OptionProps,\n} from \"./types\";\n\nexport type CombinedOptionProps<V1, V2, V3> =\n | L1OptionProps<V1, V2, V3>\n | L2OptionProps<V2, V3>\n | L3OptionProps<V3>;\n\ninterface SelectedItemType<V1, V2, V3> {\n label: string;\n value: V1 | V2 | V3;\n}\n\nexport const InputNestedSelect = <V1, V2, V3>({\n placeholder = \"Select\",\n options: _options,\n disabled,\n error,\n className,\n \"data-testid\": testId,\n id,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n selectedKeyPath: _selectedKeyPath,\n mode,\n valueToStringFunction,\n enableSearch,\n searchPlaceholder,\n selectableCategory,\n hideNoResultsDisplay,\n noResultsDescription,\n customLabels,\n readOnly,\n onBlur,\n onSearch,\n onSelectOption,\n onShowOptions,\n onHideOptions,\n onRetry,\n optionsLoadState = \"success\",\n optionTruncationType = \"end\",\n variant = \"default\",\n alignment,\n dropdownZIndex,\n dropdownWidth,\n dropdownRootNode,\n}: InputNestedSelectProps<V1, V2, V3>): JSX.Element => {\n // =========================================================================\n // CONST, STATE\n // =========================================================================\n const options = _options as NestedDropdownListItemProps<V1 | V2 | V3>[];\n const [selectedKeyPaths, setSelectedKeyPaths] = useState<Set<string>>(\n _selectedKeyPath\n ? buildKeyPathToSet([_selectedKeyPath])\n : new Set<string>()\n );\n const [selectedItem, setSelectedItem] =\n useState<SelectedItemType<V1, V2, V3>>();\n\n const [showOptions, setShowOptions] = useState<boolean>(false);\n const [focused, setFocused] = useState<boolean>(false);\n const internalId = useId();\n\n const nodeRef = useRef<HTMLDivElement>(null);\n const selectorRef = useRef<HTMLButtonElement>(null);\n const labelContainerRef = useRef<HTMLDivElement>(null);\n\n // =========================================================================\n // EFFECTS\n // =========================================================================\n useEffect(() => {\n setSelectedKeyPaths(\n _selectedKeyPath\n ? buildKeyPathToSet([_selectedKeyPath])\n : new Set<string>()\n );\n const selectedItem = findItemByKeyPath(options, _selectedKeyPath || []);\n setSelectedItem(selectedItem ?? undefined);\n }, [_selectedKeyPath, options]);\n\n // =========================================================================\n // EVENT HANDLERS\n // =========================================================================\n const handleListItemClick = (\n listItem: NestedDropdownListLocalItem<V1 | V2 | V3>\n ) => {\n const {\n keyPath,\n item: { label, value },\n } = listItem;\n setSelectedKeyPaths(buildKeyPathToSet([keyPath]));\n setSelectedItem({ label, value });\n setShowOptions(false);\n triggerOptionDisplayCallback(false);\n\n selectorRef.current?.focus();\n onSelectOption?.(keyPath, value);\n };\n\n const handleNodeFocus = () => {\n if (!focused && !showOptions) {\n setFocused(true);\n }\n };\n\n const handleNodeBlur = (e: React.FocusEvent) => {\n if (\n focused &&\n !showOptions &&\n nodeRef.current &&\n !nodeRef.current.contains(e.relatedTarget as Node)\n ) {\n setFocused(false);\n onBlur?.();\n }\n };\n\n const handleOpen = () => {\n setShowOptions(true);\n triggerOptionDisplayCallback(true);\n setFocused(true);\n };\n\n const handleClose = (reason: OpenChangeReason | undefined) => {\n setShowOptions(false);\n triggerOptionDisplayCallback(false);\n\n // click to toggle should not blur the input\n if (reason !== \"click\") {\n setFocused(false);\n onBlur?.();\n }\n };\n\n const handleDismiss = () => {\n selectorRef.current?.focus();\n setShowOptions(false);\n triggerOptionDisplayCallback(false);\n };\n\n // =========================================================================\n // HELPER FUNCTION\n // =========================================================================\n const getDisplayValue = (): string => {\n if (!selectedItem) return \"\";\n const { label, value } = selectedItem;\n\n if (valueToStringFunction) {\n return valueToStringFunction(value);\n } else {\n return label;\n }\n };\n\n const truncateValue = (value: string) => {\n if (optionTruncationType === \"middle\") {\n let widthOfElement = 0;\n if (labelContainerRef && labelContainerRef.current) {\n widthOfElement =\n labelContainerRef.current.getBoundingClientRect().width;\n }\n return StringHelper.truncateOneLine(value, widthOfElement, 120, 6);\n }\n\n return value;\n };\n\n const triggerOptionDisplayCallback = (show: boolean) => {\n if (!show && onHideOptions) {\n onHideOptions();\n }\n\n if (show && onShowOptions) {\n onShowOptions();\n }\n };\n\n // =========================================================================\n // RENDER FUNCTION\n // =========================================================================\n const renderLabel = () => {\n if (isEmpty(selectedItem)) {\n return (\n <PlaceholderLabel truncateType={optionTruncationType}>\n {placeholder}\n </PlaceholderLabel>\n );\n } else {\n return (\n <ValueLabel truncateType={optionTruncationType}>\n {truncateValue(getDisplayValue())}\n </ValueLabel>\n );\n }\n };\n\n const renderSelectorContent = () => (\n <LabelContainer ref={labelContainerRef} disabled={disabled}>\n {renderLabel()}\n </LabelContainer>\n );\n\n const renderElement = () => {\n return (\n <InputBox\n className={className}\n data-testid={testId}\n id={id}\n ref={nodeRef}\n tabIndex={-1}\n onFocus={handleNodeFocus}\n onBlur={handleNodeBlur}\n focused={focused}\n disabled={disabled}\n readOnly={readOnly}\n error={error}\n >\n <ExpandableElement\n ref={selectorRef}\n disabled={disabled}\n expanded={showOptions}\n listboxId={internalId}\n popupRole=\"tree\"\n readOnly={readOnly}\n variant={variant}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-invalid={ariaInvalid}\n >\n {renderSelectorContent()}\n </ExpandableElement>\n </InputBox>\n );\n };\n\n const renderDropdown = () => {\n return (\n <NestedDropdownList\n listboxId={internalId}\n listItems={options}\n selectedKeyPaths={selectedKeyPaths}\n selectableCategory={selectableCategory}\n itemsLoadState={optionsLoadState}\n itemTruncationType={optionTruncationType}\n enableSearch={enableSearch}\n searchPlaceholder={searchPlaceholder}\n hideNoResultsDisplay={hideNoResultsDisplay}\n noResultsDescription={noResultsDescription}\n customLabels={customLabels}\n onSelectItem={handleListItemClick}\n onRetry={onRetry}\n onSearch={onSearch}\n variant={variant}\n mode={mode}\n width={dropdownWidth}\n matchElementWidth\n />\n );\n };\n\n return (\n <ElementWithDropdown\n enabled={!readOnly && !disabled}\n isOpen={showOptions}\n renderElement={renderElement}\n renderDropdown={renderDropdown}\n onOpen={handleOpen}\n onClose={handleClose}\n onDismiss={handleDismiss}\n clickToToggle\n offset={8}\n alignment={alignment}\n fitAvailableHeight\n customZIndex={dropdownZIndex}\n rootNode={dropdownRootNode}\n />\n );\n};\n"],"names":["InputNestedSelect","placeholder","options","_options","disabled","error","className","testId","id","ariaLabelledBy","ariaDescribedBy","ariaInvalid","selectedKeyPath","_selectedKeyPath","mode","valueToStringFunction","enableSearch","searchPlaceholder","selectableCategory","hideNoResultsDisplay","noResultsDescription","customLabels","readOnly","onBlur","onSearch","onSelectOption","onShowOptions","onHideOptions","onRetry","optionsLoadState","optionTruncationType","variant","alignment","dropdownZIndex","dropdownWidth","dropdownRootNode","selectedKeyPaths","setSelectedKeyPaths","useState","buildKeyPathToSet","Set","selectedItem","setSelectedItem","showOptions","setShowOptions","focused","setFocused","internalId","useId","nodeRef","useRef","selectorRef","labelContainerRef","useEffect","findItemByKeyPath","undefined","handleListItemClick","listItem","keyPath","item","label","value","triggerOptionDisplayCallback","_a","current","focus","handleNodeFocus","handleNodeBlur","e","contains","relatedTarget","getDisplayValue","truncateValue","widthOfElement","getBoundingClientRect","width","StringHelper","truncateOneLine","show","_jsx","ElementWithDropdown","enabled","isOpen","renderElement","InputBox","ref","tabIndex","onFocus","ExpandableElement","expanded","listboxId","popupRole","children","LabelContainer","isEmpty","PlaceholderLabel","truncateType","ValueLabel","renderDropdown","NestedDropdownList","listItems","itemsLoadState","itemTruncationType","onSelectItem","matchElementWidth","onOpen","onClose","reason","onDismiss","clickToToggle","offset","fitAvailableHeight","customZIndex","rootNode"],"mappings":"82CAwCaA,EAAoB,EAC7BC,cAAc,SACdC,QAASC,EACTC,WACAC,QACAC,YACA,cAAeC,EACfC,KACA,kBAAmBC,EACnB,mBAAoBC,EACpB,eAAgBC,EAChBC,gBAAiBC,EACjBC,OACAC,wBACAC,eACAC,oBACAC,qBACAC,uBACAC,uBACAC,eACAC,WACAC,SACAC,WACAC,iBACAC,gBACAC,gBACAC,UACAC,mBAAmB,UACnBC,uBAAuB,MACvBC,UAAU,UACVC,YACAC,iBACAC,gBACAC,uBAKA,MAAMjC,EAAUC,GACTiC,EAAkBC,GAAuBC,EAC5CzB,EACM0B,EAAkB,CAAC1B,IACnB,IAAI2B,MAEPC,EAAcC,GACjBJ,KAEGK,GAAaC,IAAkBN,GAAkB,IACjDO,GAASC,IAAcR,GAAkB,GAC1CS,GAAaC,IAEbC,GAAUC,EAAuB,MACjCC,GAAcD,EAA0B,MACxCE,GAAoBF,EAAuB,MAKjDG,GAAU,KACNhB,EACIxB,EACM0B,EAAkB,CAAC1B,IACnB,IAAI2B,KAEd,MAAMC,EAAea,EAAkBpD,EAASW,GAAoB,IACpE6B,EAAgBD,QAAAA,OAAgBc,EAAU,GAC3C,CAAC1C,EAAkBX,IAKtB,MAAMsD,GACFC,UAEA,MAAMC,QACFA,EACAC,MAAMC,MAAEA,EAAKC,MAAEA,IACfJ,EACJpB,EAAoBE,EAAkB,CAACmB,KACvChB,EAAgB,CAAEkB,QAAOC,UACzBjB,IAAe,GACfkB,IAA6B,GAEV,QAAnBC,EAAAZ,GAAYa,eAAO,IAAAD,GAAAA,EAAEE,QACrBxC,SAAAA,EAAiBiC,EAASG,EAAM,EAG9BK,GAAkB,KACfrB,IAAYF,IACbG,IAAW,EACf,EAGEqB,GAAkBC,IAEhBvB,KACCF,IACDM,GAAQe,UACPf,GAAQe,QAAQK,SAASD,EAAEE,iBAE5BxB,IAAW,GACXvB,SAAAA,IACJ,EA6BEgD,G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aAAc/C,GACd5B,QAASA,EACTJ,SAAUA,EACVO,QAASA,EACTjB,KAAMA,EACN6D,MAAOzC,EACPsE,mBAAiB,IAWrBC,OArJW,KACf7D,IAAe,GACfkB,IAA6B,GAC7BhB,IAAW,EAAK,EAmJZ4D,QAhJaC,IACjB/D,IAAe,GACfkB,IAA6B,GAGd,UAAX6C,IACA7D,IAAW,GACXvB,SAAAA,IACJ,EAyIIqF,UAtIc,WACC,QAAnB7C,EAAAZ,GAAYa,eAAO,IAAAD,GAAAA,EAAEE,QACrBrB,IAAe,GACfkB,IAA6B,EAAM,EAoI/B+C,eAAa,EACbC,OAAQ,EACR9E,UAAWA,EACX+E,oBAAkB,EAClBC,aAAc/E,EACdgF,SAAU9E,GACZ"}
|
|
1
|
+
{"version":3,"file":"input-nested-select.js","sources":["../../src/input-nested-select/input-nested-select.tsx"],"sourcesContent":["import type { OpenChangeReason } from \"@floating-ui/react\";\nimport isEmpty from \"lodash/isEmpty\";\nimport type React from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport type {\n NestedDropdownListItemProps,\n NestedDropdownListLocalItem,\n} from \"../shared/dropdown-list\";\nimport {\n buildKeyPathToSet,\n ExpandableElement,\n findItemByKeyPath,\n NestedDropdownList,\n} from \"../shared/dropdown-list\";\nimport { ElementWithDropdown } from \"../shared/dropdown-wrapper\";\nimport {\n LabelContainer,\n PlaceholderLabel,\n ValueLabel,\n} from \"../shared/dropdown-wrapper/dropdown-wrapper\";\nimport { InputBox } from \"../shared/input-wrapper/input-wrapper\";\nimport { StringHelper, useId } from \"../util\";\nimport type { InputNestedSelectProps } from \"./types\";\n\ninterface SelectedItemType<V1, V2, V3> {\n label: string;\n value: V1 | V2 | V3;\n}\n\n// @catalog\n/**\n * A single-select input that presents options in a hierarchy, up to three levels deep.\n *\n * Use `InputNestedSelect` when users need to choose a value from a\n * hierarchical option tree. The dropdown renders as an expandable tree.\n * Parent nodes collapse or expand their children, and only one leaf or category\n * value can be selected at a time.\n */\nexport const InputNestedSelect = <V1, V2, V3>({\n placeholder = \"Select\",\n options: _options,\n disabled,\n error,\n className,\n \"data-testid\": testId,\n id,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n selectedKeyPath: _selectedKeyPath,\n mode,\n valueToStringFunction,\n enableSearch,\n searchPlaceholder,\n selectableCategory,\n hideNoResultsDisplay,\n noResultsDescription,\n customLabels,\n readOnly,\n onBlur,\n onSearch,\n onSelectOption,\n onShowOptions,\n onHideOptions,\n onRetry,\n optionsLoadState = \"success\",\n optionTruncationType = \"end\",\n variant = \"default\",\n alignment,\n dropdownZIndex,\n dropdownWidth,\n dropdownRootNode,\n}: InputNestedSelectProps<V1, V2, V3>): JSX.Element => {\n // =========================================================================\n // CONST, STATE\n // =========================================================================\n const options = _options as NestedDropdownListItemProps<V1 | V2 | V3>[];\n const [selectedKeyPaths, setSelectedKeyPaths] = useState<Set<string>>(\n _selectedKeyPath\n ? buildKeyPathToSet([_selectedKeyPath])\n : new Set<string>()\n );\n const [selectedItem, setSelectedItem] =\n useState<SelectedItemType<V1, V2, V3>>();\n\n const [showOptions, setShowOptions] = useState<boolean>(false);\n const [focused, setFocused] = useState<boolean>(false);\n const internalId = useId();\n\n const nodeRef = useRef<HTMLDivElement>(null);\n const selectorRef = useRef<HTMLButtonElement>(null);\n const labelContainerRef = useRef<HTMLDivElement>(null);\n\n // =========================================================================\n // EFFECTS\n // =========================================================================\n useEffect(() => {\n setSelectedKeyPaths(\n _selectedKeyPath\n ? buildKeyPathToSet([_selectedKeyPath])\n : new Set<string>()\n );\n const selectedItem = findItemByKeyPath(options, _selectedKeyPath || []);\n setSelectedItem(selectedItem ?? undefined);\n }, [_selectedKeyPath, options]);\n\n // =========================================================================\n // EVENT HANDLERS\n // =========================================================================\n const handleListItemClick = (\n listItem: NestedDropdownListLocalItem<V1 | V2 | V3>\n ) => {\n const {\n keyPath,\n item: { label, value },\n } = listItem;\n setSelectedKeyPaths(buildKeyPathToSet([keyPath]));\n setSelectedItem({ label, value });\n setShowOptions(false);\n triggerOptionDisplayCallback(false);\n\n selectorRef.current?.focus();\n onSelectOption?.(keyPath, value);\n };\n\n const handleNodeFocus = () => {\n if (!focused && !showOptions) {\n setFocused(true);\n }\n };\n\n const handleNodeBlur = (e: React.FocusEvent) => {\n if (\n focused &&\n !showOptions &&\n nodeRef.current &&\n !nodeRef.current.contains(e.relatedTarget as Node)\n ) {\n setFocused(false);\n onBlur?.();\n }\n };\n\n const handleOpen = () => {\n setShowOptions(true);\n triggerOptionDisplayCallback(true);\n setFocused(true);\n };\n\n const handleClose = (reason: OpenChangeReason | undefined) => {\n setShowOptions(false);\n triggerOptionDisplayCallback(false);\n\n // click to toggle should not blur the input\n if (reason !== \"click\") {\n setFocused(false);\n onBlur?.();\n }\n };\n\n const handleDismiss = () => {\n selectorRef.current?.focus();\n setShowOptions(false);\n triggerOptionDisplayCallback(false);\n };\n\n // =========================================================================\n // HELPER FUNCTION\n // =========================================================================\n const getDisplayValue = (): string => {\n if (!selectedItem) return \"\";\n const { label, value } = selectedItem;\n\n if (valueToStringFunction) {\n return valueToStringFunction(value);\n } else {\n return label;\n }\n };\n\n const truncateValue = (value: string) => {\n if (optionTruncationType === \"middle\") {\n let widthOfElement = 0;\n if (labelContainerRef && labelContainerRef.current) {\n widthOfElement =\n labelContainerRef.current.getBoundingClientRect().width;\n }\n return StringHelper.truncateOneLine(value, widthOfElement, 120, 6);\n }\n\n return value;\n };\n\n const triggerOptionDisplayCallback = (show: boolean) => {\n if (!show && onHideOptions) {\n onHideOptions();\n }\n\n if (show && onShowOptions) {\n onShowOptions();\n }\n };\n\n // =========================================================================\n // RENDER FUNCTION\n // =========================================================================\n const renderLabel = () => {\n if (isEmpty(selectedItem)) {\n return (\n <PlaceholderLabel truncateType={optionTruncationType}>\n {placeholder}\n </PlaceholderLabel>\n );\n } else {\n return (\n <ValueLabel truncateType={optionTruncationType}>\n {truncateValue(getDisplayValue())}\n </ValueLabel>\n );\n }\n };\n\n const renderSelectorContent = () => (\n <LabelContainer ref={labelContainerRef} disabled={disabled}>\n {renderLabel()}\n </LabelContainer>\n );\n\n const renderElement = () => {\n return (\n <InputBox\n className={className}\n data-testid={testId}\n id={id}\n ref={nodeRef}\n tabIndex={-1}\n onFocus={handleNodeFocus}\n onBlur={handleNodeBlur}\n focused={focused}\n disabled={disabled}\n readOnly={readOnly}\n error={error}\n >\n <ExpandableElement\n ref={selectorRef}\n disabled={disabled}\n expanded={showOptions}\n listboxId={internalId}\n popupRole=\"tree\"\n readOnly={readOnly}\n variant={variant}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-invalid={ariaInvalid}\n >\n {renderSelectorContent()}\n </ExpandableElement>\n </InputBox>\n );\n };\n\n const renderDropdown = () => {\n return (\n <NestedDropdownList\n listboxId={internalId}\n listItems={options}\n selectedKeyPaths={selectedKeyPaths}\n selectableCategory={selectableCategory}\n itemsLoadState={optionsLoadState}\n itemTruncationType={optionTruncationType}\n enableSearch={enableSearch}\n searchPlaceholder={searchPlaceholder}\n hideNoResultsDisplay={hideNoResultsDisplay}\n noResultsDescription={noResultsDescription}\n customLabels={customLabels}\n onSelectItem={handleListItemClick}\n onRetry={onRetry}\n onSearch={onSearch}\n variant={variant}\n mode={mode}\n width={dropdownWidth}\n matchElementWidth\n />\n );\n };\n\n return (\n <ElementWithDropdown\n enabled={!readOnly && !disabled}\n isOpen={showOptions}\n renderElement={renderElement}\n renderDropdown={renderDropdown}\n onOpen={handleOpen}\n onClose={handleClose}\n onDismiss={handleDismiss}\n clickToToggle\n offset={8}\n alignment={alignment}\n fitAvailableHeight\n customZIndex={dropdownZIndex}\n rootNode={dropdownRootNode}\n />\n );\n};\n"],"names":["InputNestedSelect","placeholder","options","_options","disabled","error","className","testId","id","ariaLabelledBy","ariaDescribedBy","ariaInvalid","selectedKeyPath","_selectedKeyPath","mode","valueToStringFunction","enableSearch","searchPlaceholder","selectableCategory","hideNoResultsDisplay","noResultsDescription","customLabels","readOnly","onBlur","onSearch","onSelectOption","onShowOptions","onHideOptions","onRetry","optionsLoadState","optionTruncationType","variant","alignment","dropdownZIndex","dropdownWidth","dropdownRootNode","selectedKeyPaths","setSelectedKeyPaths","useState","buildKeyPathToSet","Set","selectedItem","setSelectedItem","showOptions","setShowOptions","focused","setFocused","internalId","useId","nodeRef","useRef","selectorRef","labelContainerRef","useEffect","findItemByKeyPath","undefined","handleListItemClick","listItem","keyPath","item","label","value","triggerOptionDisplayCallback","_a","current","focus","handleNodeFocus","handleNodeBlur","e","contains","relatedTarget","getDisplayValue","truncateValue","widthOfElement","getBoundingClientRect","width","StringHelper","truncateOneLine","show","_jsx","ElementWithDropdown","enabled","isOpen","renderElement","InputBox","ref","tabIndex","onFocus","ExpandableElement","expanded","listboxId","popupRole","children","LabelContainer","isEmpty","PlaceholderLabel","truncateType","ValueLabel","renderDropdown","NestedDropdownList","listItems","itemsLoadState","itemTruncationType","onSelectItem","matchElementWidth","onOpen","onClose","reason","onDismiss","clickToToggle","offset","fitAvailableHeight","customZIndex","rootNode"],"mappings":"82CAuCaA,EAAoB,EAC7BC,cAAc,SACdC,QAASC,EACTC,WACAC,QACAC,YACA,cAAeC,EACfC,KACA,kBAAmBC,EACnB,mBAAoBC,EACpB,eAAgBC,EAChBC,gBAAiBC,EACjBC,OACAC,wBACAC,eACAC,oBACAC,qBACAC,uBACAC,uBACAC,eACAC,WACAC,SACAC,WACAC,iBACAC,gBACAC,gBACAC,UACAC,mBAAmB,UACnBC,uBAAuB,MACvBC,UAAU,UACVC,YACAC,iBACAC,gBACAC,uBAKA,MAAMjC,EAAUC,GACTiC,EAAkBC,GAAuBC,EAC5CzB,EACM0B,EAAkB,CAAC1B,IACnB,IAAI2B,MAEPC,EAAcC,GACjBJ,KAEGK,GAAaC,IAAkBN,GAAkB,IACjDO,GAASC,IAAcR,GAAkB,GAC1CS,GAAaC,IAEbC,GAAUC,EAAuB,MACjCC,GAAcD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T3C,OAAQ4C,GACRtB,QAASA,GACTzC,SAAUA,EACVkB,SAAUA,EACVjB,MAAOA,WAEP0E,EAACS,GACGH,IAAKlC,GACL/C,SAAUA,EACVqF,SAAU9C,GACV+C,UAAW3C,GACX4C,UAAU,OACVrE,SAAUA,EACVS,QAASA,EAAO,kBACCtB,qBACCC,EAAe,eACnBC,EAAWiF,SA9BrCb,EAACc,EAAc,CAACR,IAAKjC,GAAmBhD,SAAUA,WAhB9C0F,EAAQrD,GAEJsC,EAACgB,EAAgB,CAACC,aAAclE,EAAoB8D,SAC/C3F,IAKL8E,EAACkB,EAAU,CAACD,aAAclE,EAAoB8D,SACzCpB,GAAcD,cA2EvB2B,eA9Be,IAEfnB,EAACoB,EAAkB,CACfT,UAAW3C,GACXqD,UAAWlG,EACXkC,iBAAkBA,EAClBlB,mBAAoBA,EACpBmF,eAAgBxE,EAChByE,mBAAoBxE,EACpBd,aAAcA,EACdC,kBAAmBA,EACnBE,qBAAsBA,EACtBC,qBAAsBA,EACtBC,aAAcA,EACdkF,aAAc/C,GACd5B,QAASA,EACTJ,SAAUA,EACVO,QAASA,EACTjB,KAAMA,EACN6D,MAAOzC,EACPsE,mBAAiB,IAWrBC,OArJW,KACf7D,IAAe,GACfkB,IAA6B,GAC7BhB,IAAW,EAAK,EAmJZ4D,QAhJaC,IACjB/D,IAAe,GACfkB,IAA6B,GAGd,UAAX6C,IACA7D,IAAW,GACXvB,SAAAA,IACJ,EAyIIqF,UAtIc,WACC,QAAnB7C,EAAAZ,GAAYa,eAAO,IAAAD,GAAAA,EAAEE,QACrBrB,IAAe,GACfkB,IAA6B,EAAM,EAoI/B+C,eAAa,EACbC,OAAQ,EACR9E,UAAWA,EACX+E,oBAAkB,EAClBC,aAAc/E,EACdgF,SAAU9E,GACZ"}
|
|
@@ -2,52 +2,121 @@ import type { RefObject } from "react";
|
|
|
2
2
|
import type { InputSelectOptionsProps, InputSelectSharedProps } from "../input-select";
|
|
3
3
|
import type { DropdownCustomLabelProps, DropdownSearchProps, DropdownVariantType, ExpandMode } from "../shared/dropdown-list/types";
|
|
4
4
|
import type { DropdownAlignmentType } from "../shared/dropdown-wrapper/types";
|
|
5
|
+
/**
|
|
6
|
+
* Options and load-state configuration used by `InputNestedSelect` & `InputNestedMultiSelect`.
|
|
7
|
+
*/
|
|
5
8
|
export interface InputNestedSelectOptionsProps<V1, V2, V3> extends Omit<InputSelectOptionsProps<V1>, "options"> {
|
|
6
9
|
options: L1OptionProps<V1, V2, V3>[];
|
|
7
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Shared behavioral and visual configuration for `InputNestedSelect` & `InputNestedMultiSelect`.
|
|
13
|
+
*
|
|
14
|
+
* The three type parameters describe the value types at each nesting level.
|
|
15
|
+
*/
|
|
8
16
|
export interface InputNestedSelectSharedProps<V1, V2, V3> extends Omit<InputSelectSharedProps<V1>, "options"> {
|
|
9
17
|
readOnly?: boolean | undefined;
|
|
10
18
|
/** Specifies if items are expanded or collapsed when the dropdown is opened */
|
|
11
19
|
mode?: ExpandMode | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Controls the height of the trigger and dropdown items.
|
|
22
|
+
*
|
|
23
|
+
* @default "default"
|
|
24
|
+
*/
|
|
12
25
|
variant?: DropdownVariantType | undefined;
|
|
26
|
+
/** Aligns the dropdown relative to the trigger element. */
|
|
13
27
|
alignment?: DropdownAlignmentType | undefined;
|
|
28
|
+
/** CSS `z-index` applied to the dropdown overlay. */
|
|
14
29
|
dropdownZIndex?: number | undefined;
|
|
15
30
|
/**
|
|
16
|
-
* The root element that contains the dropdown element.
|
|
31
|
+
* The root element that contains the dropdown element.
|
|
32
|
+
*
|
|
33
|
+
* @remarks Specify this if you need to change the parent of the
|
|
34
|
+
* dropdown in the HTML DOM.
|
|
35
|
+
* Possible use case: sharing a stacking context.
|
|
36
|
+
*
|
|
37
|
+
* Note: if a parent of the trigger has a higher `z-index` than the dropdown,
|
|
38
|
+
* the dropdown may be obscured.
|
|
17
39
|
*
|
|
18
|
-
*
|
|
19
|
-
* the dropdown may not be visible. Specify the parent element here instead
|
|
40
|
+
* @default document.body
|
|
20
41
|
*/
|
|
21
42
|
dropdownRootNode?: RefObject<HTMLElement> | undefined;
|
|
22
43
|
/** Function to convert selected value into a string */
|
|
23
44
|
valueToStringFunction?: ((value: V1 | V2 | V3) => string) | undefined;
|
|
24
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Props for `InputNestedSelect` component.
|
|
48
|
+
*
|
|
49
|
+
* The three type parameters describe the value types at each nesting level.
|
|
50
|
+
*/
|
|
25
51
|
export interface InputNestedSelectProps<V1, V2, V3> extends React.HTMLAttributes<HTMLElement>, InputNestedSelectOptionsProps<V1, V2, V3>, InputNestedSelectSharedProps<V1, V2, V3>, DropdownSearchProps<L1OptionProps<V1, V2, V3>> {
|
|
26
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Key path identifying the currently selected option. Each entry is the
|
|
54
|
+
* `key` of the option at that nesting level, ordered from level 1 to the
|
|
55
|
+
* selected level. Drives the controlled selection state.
|
|
56
|
+
*/
|
|
27
57
|
selectedKeyPath?: string[] | undefined;
|
|
28
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* When `true`, parent category labels are themselves selectable as options,
|
|
60
|
+
* not just expand/collapse toggles.
|
|
61
|
+
*/
|
|
29
62
|
selectableCategory?: boolean | undefined;
|
|
30
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* Called when the user selects an option.
|
|
65
|
+
*
|
|
66
|
+
* @param keyPath Key path from level 1 to the selected option.
|
|
67
|
+
* @param value Value of the selected option.
|
|
68
|
+
*/
|
|
31
69
|
onSelectOption?: ((keyPath: string[], value: V1 | V2 | V3) => void) | undefined;
|
|
32
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* Custom width for the dropdown. When specified, the dropdown uses this
|
|
72
|
+
* width instead of matching the trigger element width.
|
|
73
|
+
*/
|
|
33
74
|
dropdownWidth?: string | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Called when focus leaves both the trigger and the dropdown.
|
|
77
|
+
*/
|
|
34
78
|
onBlur?: (() => void) | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Overrides the default labels shown inside the dropdown and on the trigger.
|
|
81
|
+
*/
|
|
35
82
|
customLabels?: DropdownCustomLabelProps | undefined;
|
|
36
83
|
}
|
|
37
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* A subset of `InputNestedSelectProps` used by form components that manage
|
|
86
|
+
* the `error` state themselves.
|
|
87
|
+
*/
|
|
38
88
|
export type InputNestedSelectPartialProps<V1, V2, V3> = Omit<InputNestedSelectProps<V1, V2, V3>, "error">;
|
|
39
89
|
interface BaseOptionProps {
|
|
40
90
|
label: string;
|
|
41
91
|
key: string;
|
|
42
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* A top-level (level-1) option that may contain level-2 sub-options.
|
|
95
|
+
*
|
|
96
|
+
* `V1` is the value type for this level; `V2` and `V3` are the value types for
|
|
97
|
+
* nested levels 2 and 3 respectively.
|
|
98
|
+
*/
|
|
43
99
|
export interface L1OptionProps<V1, V2, V3> extends BaseOptionProps {
|
|
44
100
|
value: V1;
|
|
101
|
+
/** Nested level-2 options belonging to this category. */
|
|
45
102
|
subItems?: L2OptionProps<V2, V3>[] | undefined;
|
|
46
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* A level-2 option that may contain level-3 leaf options.
|
|
106
|
+
*
|
|
107
|
+
* `V2` is the value type for this level; `V3` is the value type for the nested
|
|
108
|
+
* level-3 options.
|
|
109
|
+
*/
|
|
47
110
|
export interface L2OptionProps<V2, V3> extends BaseOptionProps {
|
|
48
111
|
value: V2;
|
|
112
|
+
/** Nested level-3 leaf options belonging to this item. */
|
|
49
113
|
subItems?: L3OptionProps<V3>[] | undefined;
|
|
50
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* A level-3 leaf option with no further nesting.
|
|
117
|
+
*
|
|
118
|
+
* `V3` is the value type for this level.
|
|
119
|
+
*/
|
|
51
120
|
export interface L3OptionProps<V3> extends BaseOptionProps {
|
|
52
121
|
value: V3;
|
|
53
122
|
subItems?: undefined;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import type { InputRangeSelectProps } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A paired combobox input for selecting a start and end value from dropdown lists.
|
|
4
|
+
*
|
|
5
|
+
* Use `InputRangeSelect` when a consumer must choose a range by picking two
|
|
6
|
+
* values — one for "from" and one for "to" — each from their own option list.
|
|
7
|
+
*/
|
|
2
8
|
export declare const InputRangeSelect: <T, V>({ selectedOptions, placeholders, options, disabled, className, readOnly, error, "data-testid": testId, id, enableSearch, searchFunction, searchPlaceholder, valueExtractor, valueToStringFunction, listExtractor, displayValueExtractor, onSelectOption, onShowOptions, onHideOptions, onRetry, optionsLoadState, optionTruncationType, renderCustomSelectedOption, renderListItem, renderCustomCallToAction, alignment, dropdownZIndex, dropdownRootNode, dropdownWidth, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...otherProps }: InputRangeSelectProps<T, V>) => JSX.Element;
|