@lifesg/react-design-system 4.0.0-alpha.5 → 4.0.0-alpha.6
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/types.d.ts +1 -1
- package/breadcrumb/breadcrumb.d.ts +7 -0
- package/breadcrumb/breadcrumb.js.map +1 -1
- package/breadcrumb/types.d.ts +31 -0
- package/button/button.d.ts +1 -0
- package/button/button.js.map +1 -1
- package/button/types.d.ts +42 -9
- package/calendar/calendar.d.ts +3 -0
- package/calendar/calendar.js.map +1 -1
- package/calendar/types.d.ts +43 -7
- 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 +19 -3
- 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/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/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/form/form-label-addon.js +1 -1
- package/cjs/form/form-label-addon.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/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/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.map +1 -1
- package/cjs/otp-verification/otp-verification.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.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/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/{table/table.styles_1af5ipv.css → cjs/table/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/{time-range-picker/common.styles_1qwp4xa.css → cjs/time-range-picker/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/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/types.d.ts +3 -3
- 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-range-input/types.d.ts +1 -1
- package/drawer/types.d.ts +1 -1
- package/e-signature/types.d.ts +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/file-upload/types.d.ts +0 -1
- package/filter/types.d.ts +6 -10
- package/form/form-label-addon.js +1 -1
- package/form/form-label-addon.js.map +1 -1
- package/form/index.d.ts +65 -8
- package/form/index.js +1 -1
- package/form/index.js.map +1 -1
- package/form/types.d.ts +155 -6
- 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/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/internal-types.d.ts +57 -3
- package/link-list/link-list.d.ts +6 -0
- package/link-list/link-list.js.map +1 -1
- package/link-list/types.d.ts +3 -0
- 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 +32 -0
- 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 +54 -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 +75 -8
- package/navbar/navbar.d.ts +7 -0
- package/navbar/navbar.js.map +1 -1
- package/navbar/types.d.ts +200 -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.map +1 -1
- package/otp-input/types.d.ts +54 -11
- 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/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/popover-inline.d.ts +5 -0
- package/popover/popover-inline/popover-inline.js.map +1 -1
- 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 +150 -3
- package/predictive-text-input/predictive-text-input.d.ts +6 -0
- 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 +11 -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/types.d.ts +52 -19
- 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 +70 -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 +54 -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 +21 -0
- package/table/table.js.map +1 -1
- package/table/table.styles.js +1 -1
- package/table/table.styles.js.map +1 -1
- package/{cjs/table/table.styles_1af5ipv.css → table/table.styles_1vjx31g.css} +1 -1
- 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 +3 -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 +3 -0
- package/theme/tokens/colour.js.map +1 -1
- package/theme/tokens/component.d.ts +1 -0
- package/theme/tokens/component.js.map +1 -1
- package/theme/tokens/font.d.ts +2 -0
- package/theme/tokens/font.js.map +1 -1
- package/theme/tokens/media-query.d.ts +1 -0
- package/theme/tokens/media-query.js.map +1 -1
- package/theme/tokens/motion.d.ts +1 -0
- package/theme/tokens/motion.js.map +1 -1
- package/theme/tokens/radius.d.ts +1 -0
- package/theme/tokens/radius.js.map +1 -1
- package/theme/tokens/shadow.d.ts +1 -0
- package/theme/tokens/shadow.js.map +1 -1
- package/theme/tokens/spacing.d.ts +1 -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/{cjs/time-range-picker/common.styles_1qwp4xa.css → time-range-picker/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 +112 -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 +74 -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 +53 -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 +42 -8
- package/toggle/toggle.d.ts +6 -0
- package/toggle/toggle.js.map +1 -1
- package/toggle/types.d.ts +95 -17
- 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/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/timepicker/timepicker.styles_1jm33yw.css +0 -1
- package/data-table/data-table.styles_1iqq1g7.css +0 -26
- package/timepicker/timepicker.styles_1jm33yw.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-indicator.js","sources":["../../src/progress-indicator/progress-indicator.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport kebabCase from \"lodash/kebabCase\";\n\nimport { VisuallyHidden } from \"../shared/accessibility\";\nimport { useMaxWidthMediaQuery } from \"../theme\";\nimport { Typography } from \"../typography\";\nimport * as styles from \"./progress-indicator.styles\";\nimport type { ProgressIndicatorProps } from \"./types\";\n\nexport const ProgressIndicator = <T,>({\n steps,\n currentIndex,\n displayExtractor,\n className,\n ...otherProps\n}: ProgressIndicatorProps<T>) => {\n // =============================================================================\n // CONST, STATE, REFS\n // =============================================================================\n const isTablet = useMaxWidthMediaQuery(\"lg\");\n\n // =============================================================================\n // EFFECTS\n // =============================================================================\n\n // =============================================================================\n // EVENT HANDLERS\n // =============================================================================\n\n // =============================================================================\n // HELPER FUNCTIONS\n // =============================================================================\n const getDisplayValue = (item: T): string => {\n if (displayExtractor) {\n return displayExtractor(item);\n }\n return item?.toString() ?? \"\";\n };\n\n const getStepAriaLabel = (stepIndex: number, currentIndex: number) => {\n if (stepIndex < currentIndex) {\n return \"Completed step\";\n } else if (stepIndex === currentIndex) {\n return \"Current step\";\n } else {\n return \"Upcoming step\";\n }\n };\n\n const getId = (stepIndex: number, currentIndex: number) => {\n return kebabCase(\n `${getStepAriaLabel(stepIndex, currentIndex)} ${stepIndex}`\n );\n };\n\n // =============================================================================\n // RENDER\n // =============================================================================\n if (!steps.length) return null;\n\n const renderBars = () => {\n return steps.map((step: T, stepIndex: number) => {\n // previous and current index elements are highlighted\n const highlighted = stepIndex <= currentIndex;\n\n return (\n <div\n key={stepIndex}\n id={getId(stepIndex, currentIndex)}\n className={styles.indicator}\n >\n <div\n className={clsx(\n styles.indicatorBar,\n highlighted && styles.indicatorBarHighlighted\n )}\n />\n </div>\n );\n });\n };\n\n const renderStepTitleDesktop = () => {\n return steps.map((step: T, stepIndex: number) => {\n const highlighted = stepIndex <= currentIndex;\n const current = stepIndex === currentIndex;\n const fontWeight = current ? \"bold\" : \"regular\";\n\n return (\n <div\n key={stepIndex}\n id={`${getId(stepIndex, currentIndex)}-title`}\n className={styles.indicator}\n >\n <Typography.BodyMD\n className={clsx(\n styles.indicatorTitleDesktop,\n highlighted &&\n styles.indicatorTitleDesktopHighlighted\n )}\n weight={fontWeight}\n aria-current={current}\n >\n {getDisplayValue(step)}\n <VisuallyHidden>\n {getStepAriaLabel(stepIndex, currentIndex)}\n </VisuallyHidden>\n </Typography.BodyMD>\n </div>\n );\n });\n };\n\n const renderStepTitleTablet = () => {\n return (\n <div\n key={currentIndex}\n id={getId(currentIndex, currentIndex)}\n className={styles.indicator}\n >\n <Typography.BodyMD\n className={styles.indicatorTitleTablet}\n weight={\"semibold\"}\n id={`${getId(currentIndex, currentIndex)}-counter`}\n >\n Step {currentIndex + 1} of {steps.length}\n </Typography.BodyMD>\n <Typography.BodyMD\n className={styles.indicatorTitleTablet}\n weight={\"regular\"}\n id={`${getId(currentIndex, currentIndex)}-title`}\n >\n {getDisplayValue(steps[currentIndex])}\n </Typography.BodyMD>\n </div>\n );\n };\n\n return (\n <div className={clsx(styles.wrapper, className)} {...otherProps}>\n <div className={styles.content}>{renderBars()}</div>\n <div className={styles.content}>\n {isTablet ? renderStepTitleTablet() : renderStepTitleDesktop()}\n </div>\n </div>\n );\n};\n"],"names":["ProgressIndicator","_a","steps","currentIndex","displayExtractor","className","otherProps","__rest","isTablet","useMaxWidthMediaQuery","getDisplayValue","item","toString","getStepAriaLabel","stepIndex","getId","kebabCase","length","_jsxs","clsx","styles.wrapper","children","_jsx","styles.content","map","step","highlighted","id","styles.indicator","styles.indicatorBar","styles.indicatorBarHighlighted","Typography","BodyMD","styles.indicatorTitleTablet","weight","current","fontWeight","styles.indicatorTitleDesktop","styles.indicatorTitleDesktopHighlighted","VisuallyHidden"],"mappings":"q+
|
|
1
|
+
{"version":3,"file":"progress-indicator.js","sources":["../../src/progress-indicator/progress-indicator.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport kebabCase from \"lodash/kebabCase\";\n\nimport { VisuallyHidden } from \"../shared/accessibility\";\nimport { useMaxWidthMediaQuery } from \"../theme\";\nimport { Typography } from \"../typography\";\nimport * as styles from \"./progress-indicator.styles\";\nimport type { ProgressIndicatorProps } from \"./types\";\n\n/**\n * A horizontal step-progress bar that tracks a user's position through a\n * multi-step flow.\n *\n * Use `ProgressIndicator` when you need to communicate progress through an\n * ordered sequence of steps.\n */\nexport const ProgressIndicator = <T,>({\n steps,\n currentIndex,\n displayExtractor,\n className,\n ...otherProps\n}: ProgressIndicatorProps<T>) => {\n // =============================================================================\n // CONST, STATE, REFS\n // =============================================================================\n const isTablet = useMaxWidthMediaQuery(\"lg\");\n\n // =============================================================================\n // EFFECTS\n // =============================================================================\n\n // =============================================================================\n // EVENT HANDLERS\n // =============================================================================\n\n // =============================================================================\n // HELPER FUNCTIONS\n // =============================================================================\n const getDisplayValue = (item: T): string => {\n if (displayExtractor) {\n return displayExtractor(item);\n }\n return item?.toString() ?? \"\";\n };\n\n const getStepAriaLabel = (stepIndex: number, currentIndex: number) => {\n if (stepIndex < currentIndex) {\n return \"Completed step\";\n } else if (stepIndex === currentIndex) {\n return \"Current step\";\n } else {\n return \"Upcoming step\";\n }\n };\n\n const getId = (stepIndex: number, currentIndex: number) => {\n return kebabCase(\n `${getStepAriaLabel(stepIndex, currentIndex)} ${stepIndex}`\n );\n };\n\n // =============================================================================\n // RENDER\n // =============================================================================\n if (!steps.length) return null;\n\n const renderBars = () => {\n return steps.map((step: T, stepIndex: number) => {\n // previous and current index elements are highlighted\n const highlighted = stepIndex <= currentIndex;\n\n return (\n <div\n key={stepIndex}\n id={getId(stepIndex, currentIndex)}\n className={styles.indicator}\n >\n <div\n className={clsx(\n styles.indicatorBar,\n highlighted && styles.indicatorBarHighlighted\n )}\n />\n </div>\n );\n });\n };\n\n const renderStepTitleDesktop = () => {\n return steps.map((step: T, stepIndex: number) => {\n const highlighted = stepIndex <= currentIndex;\n const current = stepIndex === currentIndex;\n const fontWeight = current ? \"bold\" : \"regular\";\n\n return (\n <div\n key={stepIndex}\n id={`${getId(stepIndex, currentIndex)}-title`}\n className={styles.indicator}\n >\n <Typography.BodyMD\n className={clsx(\n styles.indicatorTitleDesktop,\n highlighted &&\n styles.indicatorTitleDesktopHighlighted\n )}\n weight={fontWeight}\n aria-current={current}\n >\n {getDisplayValue(step)}\n <VisuallyHidden>\n {getStepAriaLabel(stepIndex, currentIndex)}\n </VisuallyHidden>\n </Typography.BodyMD>\n </div>\n );\n });\n };\n\n const renderStepTitleTablet = () => {\n return (\n <div\n key={currentIndex}\n id={getId(currentIndex, currentIndex)}\n className={styles.indicator}\n >\n <Typography.BodyMD\n className={styles.indicatorTitleTablet}\n weight={\"semibold\"}\n id={`${getId(currentIndex, currentIndex)}-counter`}\n >\n Step {currentIndex + 1} of {steps.length}\n </Typography.BodyMD>\n <Typography.BodyMD\n className={styles.indicatorTitleTablet}\n weight={\"regular\"}\n id={`${getId(currentIndex, currentIndex)}-title`}\n >\n {getDisplayValue(steps[currentIndex])}\n </Typography.BodyMD>\n </div>\n );\n };\n\n return (\n <div className={clsx(styles.wrapper, className)} {...otherProps}>\n <div className={styles.content}>{renderBars()}</div>\n <div className={styles.content}>\n {isTablet ? renderStepTitleTablet() : renderStepTitleDesktop()}\n </div>\n </div>\n );\n};\n"],"names":["ProgressIndicator","_a","steps","currentIndex","displayExtractor","className","otherProps","__rest","isTablet","useMaxWidthMediaQuery","getDisplayValue","item","toString","getStepAriaLabel","stepIndex","getId","kebabCase","length","_jsxs","clsx","styles.wrapper","children","_jsx","styles.content","map","step","highlighted","id","styles.indicator","styles.indicatorBar","styles.indicatorBarHighlighted","Typography","BodyMD","styles.indicatorTitleTablet","weight","current","fontWeight","styles.indicatorTitleDesktop","styles.indicatorTitleDesktopHighlighted","VisuallyHidden"],"mappings":"q+BAgBO,MAAMA,EAAyBC,IAAA,IAAAC,MAClCA,EAAKC,aACLA,EAAYC,iBACZA,EAAgBC,UAChBA,GAASJ,EACNK,EAAUC,EAAAN,EALqB,CAAA,QAAA,eAAA,mBAAA,cAUlC,MAAMO,EAAWC,EAAsB,MAajCC,EAAmBC,UACrB,OAAIP,EACOA,EAAiBO,GAEL,QAAhBV,EAAAU,aAAI,EAAJA,EAAMC,kBAAU,IAAAX,EAAAA,EAAI,EAAE,EAG3BY,EAAmB,CAACC,EAAmBX,IACrCW,EAAYX,EACL,iBACAW,IAAcX,EACd,eAEA,gBAITY,EAAQ,CAACD,EAAmBX,IACvBa,EACH,GAAGH,EAAiBC,EAAWX,MAAiBW,KAOxD,IAAKZ,EAAMe,OAAQ,OAAO,KAgF1B,OACIC,uBAAKb,UAAWc,EAAKC,EAAgBf,IAAgBC,EAAU,CAAAe,SAAA,CAC3DC,EAAA,MAAA,CAAKjB,UAAWkB,EAAcF,SA/E3BnB,EAAMsB,KAAI,CAACC,EAASX,KAEvB,MAAMY,EAAcZ,GAAaX,EAEjC,OACImB,EAAA,MAAA,CAEIK,GAAIZ,EAAMD,EAAWX,GACrBE,UAAWuB,EAAgBP,SAE3BC,EAAA,MAAA,CACIjB,UAAWc,EACPU,EACAH,GAAeI,MAPlBhB,EAUH,MAgEVQ,SAAKjB,UAAWkB,EAAcF,SACzBb,EA3BLU,EAAA,MAAA,CAEIS,GAAIZ,EAAMZ,EAAcA,GACxBE,UAAWuB,EAAgBP,SAAA,CAE3BH,EAACa,EAAWC,QACR3B,UAAW4B,EACXC,OAAQ,WACRP,GAAI,GAAGZ,EAAMZ,EAAcA,+BAErBA,EAAe,EAAC,OAAMD,EAAMe,UAEtCK,EAACS,EAAWC,QACR3B,UAAW4B,EACXC,OAAQ,UACRP,GAAI,GAAGZ,EAAMZ,EAAcA,oBAE1BO,EAAgBR,EAAMC,QAhBtBA,GAjCND,EAAMsB,KAAI,CAACC,EAASX,KACvB,MAAMY,EAAcZ,GAAaX,EAC3BgC,EAAUrB,IAAcX,EACxBiC,EAAaD,EAAU,OAAS,UAEtC,OACIb,EAAA,MAAA,CAEIK,GAAI,GAAGZ,EAAMD,EAAWX,WACxBE,UAAWuB,EAAgBP,SAE3BH,EAACa,EAAWC,OAAM,CACd3B,UAAWc,EACPkB,EACAX,GACIY,GAERJ,OAAQE,EAAU,eACJD,EAAOd,SAAA,CAEpBX,EAAgBe,GACjBH,EAACiB,EAAc,CAAAlB,SACVR,EAAiBC,EAAWX,SAfhCW,EAkBH,SAoCR"}
|
|
@@ -1,6 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props for the `ProgressIndicator` component.
|
|
3
|
+
*
|
|
4
|
+
* The type parameter `T` represents the shape of each step item in the
|
|
5
|
+
* `steps` array.
|
|
6
|
+
*/
|
|
1
7
|
export interface ProgressIndicatorProps<T> {
|
|
8
|
+
/**
|
|
9
|
+
* Ordered list of step items to render as progress bars and labels.
|
|
10
|
+
*/
|
|
2
11
|
steps: T[];
|
|
12
|
+
/**
|
|
13
|
+
* Zero-based index of the current active step.
|
|
14
|
+
* All steps at or before this index are visually highlighted.
|
|
15
|
+
*/
|
|
3
16
|
currentIndex: number;
|
|
17
|
+
/**
|
|
18
|
+
* Derives the display label for a step item.
|
|
19
|
+
*
|
|
20
|
+
* @remarks Falls back to `item.toString()` when omitted.
|
|
21
|
+
*/
|
|
4
22
|
displayExtractor?: ((item: T) => string) | undefined;
|
|
5
23
|
className?: string | undefined;
|
|
6
24
|
id?: string | undefined;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { RadioButtonProps } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A single radio button input.
|
|
4
|
+
*
|
|
5
|
+
* Use `RadioButton` as an input within a radio group.
|
|
6
|
+
*/
|
|
2
7
|
export declare const RadioButton: ({ className, checked, disabled, displaySize, focusableWhenDisabled, onChange, tabIndex, ...otherProps }: RadioButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-button.js","sources":["../../src/radio-button/radio-button.tsx"],"sourcesContent":["import { CircleDotIcon, CircleIcon } from \"@lifesg/react-icons\";\nimport clsx from \"clsx\";\nimport type { ChangeEvent } from \"react\";\n\nimport * as styles from \"./radio-button.styles\";\nimport type { RadioButtonProps } from \"./types\";\n\nexport const RadioButton = ({\n className,\n checked,\n disabled,\n displaySize = \"default\",\n focusableWhenDisabled,\n onChange,\n tabIndex,\n ...otherProps\n}: RadioButtonProps) => {\n // =============================================================================\n // CONST\n // =============================================================================\n const isFocusableWhenDisabled = !!disabled && !!focusableWhenDisabled;\n const isNativeDisabled = !!disabled && !focusableWhenDisabled;\n\n // =============================================================================\n // EVENT HANDLERS\n // =============================================================================\n const handleOnChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n\n onChange?.(event);\n };\n\n // =============================================================================\n // RENDER FUNCTION\n // =============================================================================\n const renderIcon = () => {\n return checked ? (\n <CircleDotIcon\n data-testid=\"radio-checked\"\n className={clsx(\n styles.icon,\n disabled ? styles.checkedIconDisabled : styles.checkedIcon\n )}\n aria-hidden\n />\n ) : (\n <CircleIcon\n data-testid=\"radio-unchecked\"\n className={clsx(\n styles.icon,\n disabled\n ? styles.uncheckedIconDisabled\n : styles.uncheckedIcon\n )}\n aria-hidden\n />\n );\n };\n\n return (\n <div\n className={clsx(styles.container, className)}\n data-display-size={displaySize}\n data-testid=\"radio-button\"\n >\n <input\n type=\"radio\"\n data-testid=\"radio-input\"\n onChange={handleOnChange}\n checked={checked}\n disabled={isNativeDisabled}\n aria-disabled={isFocusableWhenDisabled}\n tabIndex={isFocusableWhenDisabled ? 0 : tabIndex}\n className={clsx(styles.input, !disabled && styles.inputActive)}\n {...otherProps}\n />\n {renderIcon()}\n </div>\n );\n};\n"],"names":["RadioButton","_a","className","checked","disabled","displaySize","focusableWhenDisabled","onChange","tabIndex","otherProps","__rest","isFocusableWhenDisabled","isNativeDisabled","_jsxs","clsx","styles.container","children","_jsx","Object","assign","type","event","preventDefault","styles.input","styles.inputActive","CircleDotIcon","styles.icon","styles.checkedIconDisabled","styles.checkedIcon","CircleIcon","styles.uncheckedIconDisabled","styles.uncheckedIcon"],"mappings":"
|
|
1
|
+
{"version":3,"file":"radio-button.js","sources":["../../src/radio-button/radio-button.tsx"],"sourcesContent":["import { CircleDotIcon, CircleIcon } from \"@lifesg/react-icons\";\nimport clsx from \"clsx\";\nimport type { ChangeEvent } from \"react\";\n\nimport * as styles from \"./radio-button.styles\";\nimport type { RadioButtonProps } from \"./types\";\n\n/**\n * A single radio button input.\n *\n * Use `RadioButton` as an input within a radio group.\n */\nexport const RadioButton = ({\n className,\n checked,\n disabled,\n displaySize = \"default\",\n focusableWhenDisabled,\n onChange,\n tabIndex,\n ...otherProps\n}: RadioButtonProps) => {\n // =============================================================================\n // CONST\n // =============================================================================\n const isFocusableWhenDisabled = !!disabled && !!focusableWhenDisabled;\n const isNativeDisabled = !!disabled && !focusableWhenDisabled;\n\n // =============================================================================\n // EVENT HANDLERS\n // =============================================================================\n const handleOnChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n\n onChange?.(event);\n };\n\n // =============================================================================\n // RENDER FUNCTION\n // =============================================================================\n const renderIcon = () => {\n return checked ? (\n <CircleDotIcon\n data-testid=\"radio-checked\"\n className={clsx(\n styles.icon,\n disabled ? styles.checkedIconDisabled : styles.checkedIcon\n )}\n aria-hidden\n />\n ) : (\n <CircleIcon\n data-testid=\"radio-unchecked\"\n className={clsx(\n styles.icon,\n disabled\n ? styles.uncheckedIconDisabled\n : styles.uncheckedIcon\n )}\n aria-hidden\n />\n );\n };\n\n return (\n <div\n className={clsx(styles.container, className)}\n data-display-size={displaySize}\n data-testid=\"radio-button\"\n >\n <input\n type=\"radio\"\n data-testid=\"radio-input\"\n onChange={handleOnChange}\n checked={checked}\n disabled={isNativeDisabled}\n aria-disabled={isFocusableWhenDisabled}\n tabIndex={isFocusableWhenDisabled ? 0 : tabIndex}\n className={clsx(styles.input, !disabled && styles.inputActive)}\n {...otherProps}\n />\n {renderIcon()}\n </div>\n );\n};\n"],"names":["RadioButton","_a","className","checked","disabled","displaySize","focusableWhenDisabled","onChange","tabIndex","otherProps","__rest","isFocusableWhenDisabled","isNativeDisabled","_jsxs","clsx","styles.container","children","_jsx","Object","assign","type","event","preventDefault","styles.input","styles.inputActive","CircleDotIcon","styles.icon","styles.checkedIconDisabled","styles.checkedIcon","CircleIcon","styles.uncheckedIconDisabled","styles.uncheckedIcon"],"mappings":"4WAYO,MAAMA,EAAeC,QAAAC,UACxBA,EAASC,QACTA,EAAOC,SACPA,EAAQC,YACRA,EAAc,UAASC,sBACvBA,EAAqBC,SACrBA,EAAQC,SACRA,GAAQP,EACLQ,EAAUC,EAAAT,EARW,gGAaxB,MAAMU,IAA4BP,KAAcE,EAC1CM,IAAqBR,IAAaE,EAyCxC,OACIO,EAAA,MAAA,CACIX,UAAWY,EAAKC,EAAkBb,GAAU,oBACzBG,gBACP,eAAcW,SAAA,CAE1BC,EAAA,QAAAC,OAAAC,OAAA,CACIC,KAAK,QAAO,cACA,cACZb,SA7CYc,IAChBjB,EACAiB,EAAMC,iBAIVf,SAAAA,EAAWc,EAAM,EAwCTlB,QAASA,EACTC,SAAUQ,EAAgB,gBACXD,EACfH,SAAUG,EAA0B,EAAIH,EACxCN,UAAWY,EAAKS,GAAenB,GAAYoB,IACvCf,IAtCLN,EACHc,EAACQ,EAAa,CAAA,cACE,gBACZvB,UAAWY,EACPY,EACAtB,EAAWuB,EAA6BC,sBAKhDX,EAACY,EAAU,CAAA,cACK,kBACZ3B,UAAWY,EACPY,EACAtB,EACM0B,EACAC,GACT,eAAA,MAwBH"}
|
package/radio-button/types.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
/** Visual size variant for the radio button. */
|
|
1
2
|
export type RadioButtonSize = "small" | "default";
|
|
3
|
+
/** Props for the `RadioButton` component. */
|
|
2
4
|
export interface RadioButtonProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
5
|
+
/**
|
|
6
|
+
* Visual size of the radio button icon.
|
|
7
|
+
*
|
|
8
|
+
* @default "default"
|
|
9
|
+
*/
|
|
3
10
|
displaySize?: RadioButtonSize | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* When `true` and `disabled` is also `true`, the radio button remains
|
|
13
|
+
* keyboard-focusable. `onChange` is still suppressed.
|
|
14
|
+
*/
|
|
4
15
|
focusableWhenDisabled?: boolean | undefined;
|
|
5
16
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RefObject } from "react";
|
|
2
|
+
/** Shared props passed to the day-view and week-view sub-components. */
|
|
3
|
+
export interface CommonScheduleViewProps {
|
|
4
|
+
/** The currently displayed date in `YYYY-MM-DD` format. */
|
|
5
|
+
date: string;
|
|
6
|
+
/** Whether the schedule is in a loading state. */
|
|
7
|
+
loading: boolean;
|
|
8
|
+
/** Earliest visible time in `HH:mm` format. */
|
|
9
|
+
minTime: string;
|
|
10
|
+
/** Latest visible time in `HH:mm` format. */
|
|
11
|
+
maxTime: string;
|
|
12
|
+
/** Time in `HH:mm` format to scroll into view on mount. */
|
|
13
|
+
initialScrollTime?: string | undefined;
|
|
14
|
+
/** Ref to the scrollable container element. */
|
|
15
|
+
containerRef: RefObject<HTMLDivElement>;
|
|
16
|
+
/** Message displayed inside blocked time slots. */
|
|
17
|
+
blockedMessage?: string | undefined;
|
|
18
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { CommonScheduleViewProps
|
|
1
|
+
import type { CommonScheduleViewProps } from "../internal-types";
|
|
2
|
+
import type { ScheduleEmptySlotProps, ScheduleEntityProps, SchedulePopoverProps } from "../types";
|
|
2
3
|
export interface ScheduleDayViewProps extends CommonScheduleViewProps {
|
|
3
4
|
serviceData: ScheduleEntityProps[];
|
|
4
5
|
isMobile: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { CommonScheduleViewProps
|
|
1
|
+
import type { CommonScheduleViewProps } from "../internal-types";
|
|
2
|
+
import type { ScheduleEntityProps, ScheduleSlotProps } from "../types";
|
|
2
3
|
export interface ScheduleWeekViewProps extends CommonScheduleViewProps {
|
|
3
4
|
serviceData: ScheduleEntityProps[];
|
|
4
5
|
onSlotClick?: (data: ScheduleSlotProps, e: React.MouseEvent) => void | undefined;
|
package/schedule/schedule.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import type { ScheduleProps } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A grid visualisation of slot-based time availability for services across day and week views.
|
|
4
|
+
*/
|
|
2
5
|
export declare const Schedule: ({ id, className, view, date, serviceData, loading, minTime, maxTime, initialScrollTime, minDate, maxDate, emptyContentMessage, emptySlotPopover, onPreviousDayClick, onNextDayClick, onCalendarDateSelect, onTodayClick, onEmptySlotClick, blockedMessage, onClickHiddenSlots, "data-testid": testId, ...otherProps }: ScheduleProps) => import("react/jsx-runtime").JSX.Element;
|
package/schedule/schedule.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.js","sources":["../../src/schedule/schedule.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { isEmpty } from \"lodash\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport { ErrorDisplay } from \"../error-display\";\nimport { useMaxWidthMediaQuery } from \"../theme\";\nimport * as styles from \"./schedule.styles\";\nimport { ScheduleDayView } from \"./schedule-day-view/schedule-day-view\";\nimport { ScheduleHeader } from \"./schedule-header/schedule-header\";\nimport { ScheduleWeekView } from \"./schedule-week-view/schedule-week-view\";\nimport type {
|
|
1
|
+
{"version":3,"file":"schedule.js","sources":["../../src/schedule/schedule.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { isEmpty } from \"lodash\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport { ErrorDisplay } from \"../error-display\";\nimport { useMaxWidthMediaQuery } from \"../theme\";\nimport type { CommonScheduleViewProps } from \"./internal-types\";\nimport * as styles from \"./schedule.styles\";\nimport { ScheduleDayView } from \"./schedule-day-view/schedule-day-view\";\nimport { ScheduleHeader } from \"./schedule-header/schedule-header\";\nimport { ScheduleWeekView } from \"./schedule-week-view/schedule-week-view\";\nimport type { ScheduleProps } from \"./types\";\n\n/**\n * A grid visualisation of slot-based time availability for services across day and week views.\n */\nexport const Schedule = ({\n id,\n className,\n view = \"day\",\n date,\n serviceData,\n loading = false,\n minTime = \"00:00\",\n maxTime = \"23:59\",\n initialScrollTime = minTime,\n minDate,\n maxDate,\n emptyContentMessage,\n emptySlotPopover,\n onPreviousDayClick,\n onNextDayClick,\n onCalendarDateSelect,\n onTodayClick,\n onEmptySlotClick,\n blockedMessage,\n onClickHiddenSlots,\n \"data-testid\": testId = \"schedule\",\n ...otherProps\n}: ScheduleProps) => {\n // =============================================================================\n // CONST, STATE, REF\n // =============================================================================\n const [currentView, setCurrentView] = useState<\"day\" | \"week\">(view);\n const isSmallScreen = useMaxWidthMediaQuery(\"lg\");\n const effectiveView = isSmallScreen ? \"day\" : currentView;\n const contentContainerRef = useRef<HTMLDivElement>(null);\n const [visibleServiceIdx, setVisibleServiceIdx] = useState(0);\n const isEmptyContent = serviceData.length === 0 || isEmpty(serviceData);\n const filteredServiceData = useMemo(\n () =>\n serviceData.map((service) => ({\n ...service,\n slots: service.slots.filter((slot) => slot.date === date),\n })),\n [serviceData, date]\n );\n let visibleServiceData = filteredServiceData;\n if (isSmallScreen) {\n visibleServiceData =\n filteredServiceData.length > 0\n ? [filteredServiceData[visibleServiceIdx]]\n : [];\n }\n const showPrevArrow = isSmallScreen && visibleServiceIdx > 0;\n const showNextArrow =\n isSmallScreen && visibleServiceIdx < filteredServiceData.length - 1;\n\n useEffect(() => {\n setVisibleServiceIdx(0);\n }, [filteredServiceData]);\n\n // =============================================================================\n // EVENT HANDLERS\n // =============================================================================\n const handleViewChange = (newView: \"day\" | \"week\") => {\n setCurrentView(newView);\n };\n\n const handleTodayClick = useCallback(() => {\n onTodayClick?.();\n }, [onTodayClick]);\n\n const handleNextService = useCallback(() => {\n if (!filteredServiceData) return;\n setVisibleServiceIdx((idx) =>\n idx < filteredServiceData.length - 1 ? idx + 1 : idx\n );\n }, [filteredServiceData]);\n\n const handlePrevService = useCallback(() => {\n setVisibleServiceIdx((idx) => (idx > 0 ? idx - 1 : idx));\n }, []);\n\n // =============================================================================\n // RENDER FUNCTION\n // =============================================================================\n\n const renderEmptyContent = () => (\n <div className={clsx(styles.emptyTableContainer, \"empty-container\")}>\n <ErrorDisplay\n className={styles.noResultsFound}\n type=\"no-item-found\"\n description={emptyContentMessage}\n />\n </div>\n );\n\n const commonScheduleViewProps: CommonScheduleViewProps = {\n date,\n loading,\n minTime,\n maxTime,\n initialScrollTime,\n containerRef: contentContainerRef,\n blockedMessage,\n };\n\n const renderScheduleView = () => (\n <div\n className={styles.scheduleBodyContainer}\n ref={contentContainerRef}\n data-id=\"schedule-container\"\n >\n {effectiveView === \"day\" ? (\n <ScheduleDayView\n {...commonScheduleViewProps}\n serviceData={visibleServiceData}\n emptySlotPopover={emptySlotPopover}\n isMobile={isSmallScreen}\n onNextService={handleNextService}\n onPrevService={handlePrevService}\n showPrevArrow={showPrevArrow}\n showNextArrow={showNextArrow}\n onEmptySlotClick={onEmptySlotClick}\n />\n ) : (\n <ScheduleWeekView\n {...commonScheduleViewProps}\n serviceData={serviceData}\n onClickHiddenSlots={onClickHiddenSlots}\n />\n )}\n </div>\n );\n\n return (\n <div\n id={id}\n className={clsx(\n styles.container,\n loading && styles.containerLoading,\n className\n )}\n data-testid={testId}\n {...otherProps}\n >\n <ScheduleHeader\n data-id=\"schedule-header\"\n date={date}\n view={effectiveView}\n minDate={minDate}\n maxDate={maxDate}\n onPreviousDayClick={onPreviousDayClick}\n onNextDayClick={onNextDayClick}\n onCalendarDateSelect={onCalendarDateSelect}\n onViewChange={handleViewChange}\n onTodayClick={handleTodayClick}\n />\n\n {isEmptyContent ? renderEmptyContent() : renderScheduleView()}\n </div>\n );\n};\n"],"names":["Schedule","_a","id","className","view","date","serviceData","loading","minTime","maxTime","initialScrollTime","minDate","maxDate","emptyContentMessage","emptySlotPopover","onPreviousDayClick","onNextDayClick","onCalendarDateSelect","onTodayClick","onEmptySlotClick","blockedMessage","onClickHiddenSlots","testId","otherProps","__rest","currentView","setCurrentView","useState","isSmallScreen","useMaxWidthMediaQuery","effectiveView","contentContainerRef","useRef","visibleServiceIdx","setVisibleServiceIdx","isEmptyContent","length","isEmpty","filteredServiceData","useMemo","map","service","slots","filter","slot","visibleServiceData","showPrevArrow","showNextArrow","useEffect","handleTodayClick","useCallback","handleNextService","idx","handlePrevService","commonScheduleViewProps","containerRef","_jsxs","Object","assign","clsx","styles.container","styles.containerLoading","children","_jsx","ScheduleHeader","onViewChange","newView","styles.emptyTableContainer","ErrorDisplay","styles.noResultsFound","type","description","styles.scheduleBodyContainer","ref","ScheduleDayView","isMobile","onNextService","onPrevService","ScheduleWeekView"],"mappings":"6oCAgBO,MAAMA,EAAYC,IAAA,IAAAC,GACrBA,EAAEC,UACFA,EAASC,KACTA,EAAO,MAAKC,KACZA,EAAIC,YACJA,EAAWC,QACXA,GAAU,EAAKC,QACfA,EAAU,QAAOC,QACjBA,EAAU,QAAOC,kBACjBA,EAAoBF,EAAOG,QAC3BA,EAAOC,QACPA,EAAOC,oBACPA,EAAmBC,iBACnBA,EAAgBC,mBAChBA,EAAkBC,eAClBA,EAAcC,qBACdA,EAAoBC,aACpBA,EAAYC,iBACZA,EAAgBC,eAChBA,EAAcC,mBACdA,EACA,cAAeC,EAAS,YAAUrB,EAC/BsB,EAAUC,EAAAvB,EAtBQ,CAAA,KAAA,YAAA,OAAA,OAAA,cAAA,UAAA,UAAA,UAAA,oBAAA,UAAA,UAAA,sBAAA,mBAAA,qBAAA,iBAAA,uBAAA,eAAA,mBAAA,iBAAA,qBAAA,gBA2BrB,MAAOwB,EAAaC,GAAkBC,EAAyBvB,GACzDwB,EAAgBC,EAAsB,MACtCC,EAAgBF,EAAgB,MAAQH,EACxCM,EAAsBC,EAAuB,OAC5CC,EAAmBC,GAAwBP,EAAS,GACrDQ,EAAwC,IAAvB7B,EAAY8B,QAAgBC,EAAAA,QAAQ/B,GACrDgC,EAAsBC,GACxB,IACIjC,EAAYkC,KAAKC,kCACVA,GAAO,CACVC,MAAOD,EAAQC,MAAMC,QAAQC,GAASA,EAAKvC,OAASA,SAE5D,CAACC,EAAaD,IAElB,IAAIwC,EAAqBP,EACrBV,IACAiB,EACIP,EAAoBF,OAAS,EACvB,CAACE,EAAoBL,IACrB,IAEd,MAAMa,EAAgBlB,GAAiBK,EAAoB,EACrDc,GACFnB,GAAiBK,EAAoBK,EAAoBF,OAAS,EAEtEY,GAAU,KACNd,EAAqB,EAAE,GACxB,CAACI,IAKJ,MAIMW,GAAmBC,GAAY,KACjChC,SAAAA,GAAgB,GACjB,CAACA,IAEEiC,GAAoBD,GAAY,KAC7BZ,GACLJ,GAAsBkB,GAClBA,EAAMd,EAAoBF,OAAS,EAAIgB,EAAM,EAAIA,GACpD,GACF,CAACd,IAEEe,GAAoBH,GAAY,KAClChB,GAAsBkB,GAASA,EAAM,EAAIA,EAAM,EAAIA,GAAK,GACzD,IAgBGE,GAAmD,CACrDjD,OACAE,UACAC,UACAC,UACAC,oBACA6C,aAAcxB,EACdX,kBA+BJ,OACIoC,EAAA,MAAAC,OAAAC,OAAA,CACIxD,GAAIA,EACJC,UAAWwD,EACPC,EACArD,GAAWsD,EACX1D,GACH,cACYmB,GACTC,EAAU,CAAAuC,SAAA,CAEdC,EAACC,EAAc,CAAA,UACH,kBACR3D,KAAMA,EACND,KAAM0B,EACNnB,QAASA,EACTC,QAASA,EACTG,mBAAoBA,EACpBC,eAAgBA,EAChBC,qBAAsBA,EACtBgD,aA3FcC,IACtBxC,EAAewC,EAAQ,EA2FfhD,aAAc+B,KApEtBc,EAAA,MAuEK5B,EAvEL,CAAKhC,UAAWwD,EAAKQ,EAA4B,mBAAkBL,SAC/DC,EAACK,GACGjE,UAAWkE,EACXC,KAAK,gBACLC,YAAa1D,MAiBjBV,UAAWqE,EACXC,IAAK1C,EAAmB,UAChB,qBAAoB+B,SAET,QAAlBhC,EACGiC,EAACW,mBACOpB,GAAuB,CAC3BhD,YAAauC,EACb/B,iBAAkBA,EAClB6D,SAAU/C,EACVgD,cAAezB,GACf0B,cAAexB,GACfP,cAAeA,EACfC,cAAeA,GACf5B,iBAAkBA,KAGtB4C,EAACe,EAAgBrB,OAAAC,OAAA,CAAA,EACTJ,IACJhD,YAAaA,EACbe,mBAAoBA,UA+B1B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import"../../_virtual/_tslib.js";import"clsx";import"react";import"../../theme/theme-provider/context.js";import"../../typography/typography.js";import"../../card/card.styles_1gh9gs3.css";import"../../markup/markup.js";import"../../modal-v2/
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import"../../_virtual/_tslib.js";import"clsx";import"react";import"../../theme/theme-provider/context.js";import"../../typography/typography.js";import"../../card/card.styles_1gh9gs3.css";import"../../markup/markup.js";import"../../modal-v2/modal-v2.js";import"../../theme/theme-provider/index.js";import"../../theme/tokens/border.js";import"../../theme/tokens/colour.js";import"../../theme/tokens/font.js";import"../../theme/tokens/media-query.js";import"../../util/calendar-helper.js";import"../../external/dayjs/dayjs.min.js";import"../../util/simple-id-generator.js";import"../../util/string-helper.js";import"@react-aria/live-announcer";import"../../theme/utils/use-media-query.js";import"../../popover/popover.styles_ujnf0h.css";import{PopoverTrigger as e}from"../../popover/popover-trigger.js";import"../../popover/popover-inline/popover-inline.styles_bkopnt.css";import{popoverTrigger as o}from"./with-optional-popover.styles.js";const r=({containerRef:r,children:i,customPopover:p})=>{if(!p)return i;const s={position:"bottom-start",rootNode:r,customOffset:p.offset,children:i,trigger:p.trigger,delay:p.delay,popoverContent:p.content};return t(e,Object.assign({className:o,zIndex:2},s))};export{r as WithOptionalPopover};
|
|
2
2
|
//# sourceMappingURL=with-optional-popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-optional-popover.js","sources":["../../../src/schedule/shared/with-optional-popover.tsx"],"sourcesContent":["import type { RefObject } from \"react\";\n\nimport type { PopoverTriggerProps } from \"../../popover\";\nimport { PopoverTrigger } from \"../../popover\";\nimport type { SchedulePopoverProps } from \"../types\";\nimport * as styles from \"./with-optional-popover.styles\";\n\ninterface ConditionalCellWrapperProps {\n containerRef: RefObject<HTMLDivElement>;\n children: JSX.Element;\n customPopover?: SchedulePopoverProps;\n}\n\nexport const WithOptionalPopover = ({\n containerRef,\n children,\n customPopover,\n}: ConditionalCellWrapperProps) => {\n if (!customPopover) {\n return children;\n }\n\n const popoverTriggerProps: PopoverTriggerProps = {\n position: \"bottom-start\",\n rootNode: containerRef,\n customOffset: customPopover.offset,\n children: children,\n trigger: customPopover.trigger,\n delay: customPopover.delay,\n popoverContent: customPopover.content,\n };\n\n return (\n <PopoverTrigger\n className={styles.popoverTrigger}\n zIndex={2}\n {...popoverTriggerProps}\n />\n );\n};\n"],"names":["WithOptionalPopover","containerRef","children","customPopover","popoverTriggerProps","position","rootNode","customOffset","offset","trigger","delay","popoverContent","content","_jsx","PopoverTrigger","Object","assign","className","styles.popoverTrigger","zIndex"],"mappings":"
|
|
1
|
+
{"version":3,"file":"with-optional-popover.js","sources":["../../../src/schedule/shared/with-optional-popover.tsx"],"sourcesContent":["import type { RefObject } from \"react\";\n\nimport type { PopoverTriggerProps } from \"../../popover\";\nimport { PopoverTrigger } from \"../../popover\";\nimport type { SchedulePopoverProps } from \"../types\";\nimport * as styles from \"./with-optional-popover.styles\";\n\ninterface ConditionalCellWrapperProps {\n containerRef: RefObject<HTMLDivElement>;\n children: JSX.Element;\n customPopover?: SchedulePopoverProps;\n}\n\nexport const WithOptionalPopover = ({\n containerRef,\n children,\n customPopover,\n}: ConditionalCellWrapperProps) => {\n if (!customPopover) {\n return children;\n }\n\n const popoverTriggerProps: PopoverTriggerProps = {\n position: \"bottom-start\",\n rootNode: containerRef,\n customOffset: customPopover.offset,\n children: children,\n trigger: customPopover.trigger,\n delay: customPopover.delay,\n popoverContent: customPopover.content,\n };\n\n return (\n <PopoverTrigger\n className={styles.popoverTrigger}\n zIndex={2}\n {...popoverTriggerProps}\n />\n );\n};\n"],"names":["WithOptionalPopover","containerRef","children","customPopover","popoverTriggerProps","position","rootNode","customOffset","offset","trigger","delay","popoverContent","content","_jsx","PopoverTrigger","Object","assign","className","styles.popoverTrigger","zIndex"],"mappings":"m/BAaO,MAAMA,EAAsB,EAC/BC,eACAC,WACAC,oBAEA,IAAKA,EACD,OAAOD,EAGX,MAAME,EAA2C,CAC7CC,SAAU,eACVC,SAAUL,EACVM,aAAcJ,EAAcK,OAC5BN,SAAUA,EACVO,QAASN,EAAcM,QACvBC,MAAOP,EAAcO,MACrBC,eAAgBR,EAAcS,SAGlC,OACIC,EAACC,EAAcC,OAAAC,OAAA,CACXC,UAAWC,EACXC,OAAQ,GACJf,GACN"}
|
package/schedule/types.d.ts
CHANGED
|
@@ -1,66 +1,185 @@
|
|
|
1
|
-
import type { RefObject } from "react";
|
|
2
1
|
import type { PopoverTriggerType } from "../popover";
|
|
2
|
+
/**
|
|
3
|
+
* Visual state of a schedule time slot.
|
|
4
|
+
*
|
|
5
|
+
* - `"booked"` — the slot has confirmed bookings.
|
|
6
|
+
* - `"available"` — the slot is open for booking.
|
|
7
|
+
* - `"blocked"` — the slot is unavailable.
|
|
8
|
+
* - `"pending"` — the slot is under review or awaiting confirmation.
|
|
9
|
+
*/
|
|
3
10
|
export type ScheduleCellType = "booked" | "available" | "blocked" | "pending";
|
|
11
|
+
/**
|
|
12
|
+
* The active layout for the schedule.
|
|
13
|
+
*/
|
|
4
14
|
export type ScheduleView = "day" | "week";
|
|
15
|
+
/**
|
|
16
|
+
* A single entity displayed as a column or carousel item.
|
|
17
|
+
*/
|
|
5
18
|
export interface ScheduleEntityProps {
|
|
19
|
+
/** Unique identifier. */
|
|
6
20
|
id: string;
|
|
21
|
+
/** Display name shown in the column header. */
|
|
7
22
|
name: string;
|
|
23
|
+
/** All time slots belonging to this service across all dates. */
|
|
8
24
|
slots: ScheduleSlotProps[];
|
|
9
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Configuration for a popover attached to a schedule slot.
|
|
28
|
+
*/
|
|
10
29
|
export interface SchedulePopoverProps {
|
|
30
|
+
/** Interaction type that opens the popover. */
|
|
11
31
|
trigger: PopoverTriggerType;
|
|
32
|
+
/** The popover body. */
|
|
12
33
|
content: string | JSX.Element | (() => React.ReactNode);
|
|
34
|
+
/**
|
|
35
|
+
* Open and close delay in milliseconds.
|
|
36
|
+
*/
|
|
13
37
|
delay?: {
|
|
14
38
|
open?: number;
|
|
15
39
|
close?: number;
|
|
16
40
|
} | undefined;
|
|
41
|
+
/** Distance in pixels between the slot element and the popover. */
|
|
17
42
|
offset?: number | undefined;
|
|
18
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Props for the `Schedule` component.
|
|
46
|
+
*/
|
|
19
47
|
export interface ScheduleProps {
|
|
20
48
|
id?: string | undefined;
|
|
21
49
|
className?: string | undefined;
|
|
22
50
|
"data-testid"?: string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* The layout view.
|
|
53
|
+
*
|
|
54
|
+
* @default "day"
|
|
55
|
+
*
|
|
56
|
+
* @remarks `"week"` is automatically overridden to `"day"`
|
|
57
|
+
* on small screens.
|
|
58
|
+
*/
|
|
23
59
|
view?: ScheduleView | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* The currently displayed date in `YYYY-MM-DD` format.
|
|
62
|
+
* Slots are filtered to match this date in the day view.
|
|
63
|
+
*/
|
|
24
64
|
date: string;
|
|
65
|
+
/**
|
|
66
|
+
* Message shown inside the empty-state illustration when `serviceData` is
|
|
67
|
+
* empty.
|
|
68
|
+
*/
|
|
25
69
|
emptyContentMessage?: string | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Array of service entities to render. Each entity maps to a column in the
|
|
72
|
+
* week view, or to a carousel item in the day view.
|
|
73
|
+
*/
|
|
26
74
|
serviceData: ScheduleEntityProps[];
|
|
75
|
+
/**
|
|
76
|
+
* When `true` the schedule renders a loading animation in place of slot
|
|
77
|
+
* content.
|
|
78
|
+
*
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
27
81
|
loading?: boolean | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Earliest time shown on the time axis, in `HH:mm` format.
|
|
84
|
+
*
|
|
85
|
+
* @default "00:00"
|
|
86
|
+
*/
|
|
28
87
|
minTime?: string | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Latest time shown on the time axis, in `HH:mm` format.
|
|
90
|
+
*
|
|
91
|
+
* @default "23:59"
|
|
92
|
+
*/
|
|
29
93
|
maxTime?: string | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Time the schedule scrolls to on first render, in `HH:mm` format.
|
|
96
|
+
*
|
|
97
|
+
* @remarks Falls back to `minTime` when not provided.
|
|
98
|
+
*/
|
|
30
99
|
initialScrollTime?: string | undefined;
|
|
100
|
+
/** Earliest selectable date in the calendar picker, in `YYYY-MM-DD` format. */
|
|
31
101
|
minDate?: string | undefined;
|
|
102
|
+
/** Latest selectable date in the calendar picker, in `YYYY-MM-DD` format. */
|
|
32
103
|
maxDate?: string | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Called when the user navigates to the previous day.
|
|
106
|
+
*
|
|
107
|
+
* @param currentDate The date that was active before the navigation, in `YYYY-MM-DD` format.
|
|
108
|
+
*/
|
|
33
109
|
onPreviousDayClick: (currentDate: string) => void;
|
|
110
|
+
/**
|
|
111
|
+
* Called when the user navigates to the next day.
|
|
112
|
+
*
|
|
113
|
+
* @param currentDate The date that was active before the navigation, in `YYYY-MM-DD` format.
|
|
114
|
+
*/
|
|
34
115
|
onNextDayClick: (currentDate: string) => void;
|
|
116
|
+
/**
|
|
117
|
+
* Called when the user picks a date from the calendar popover.
|
|
118
|
+
*
|
|
119
|
+
* @param currentDate The selected date in `YYYY-MM-DD` format.
|
|
120
|
+
*/
|
|
35
121
|
onCalendarDateSelect: (currentDate: string) => void;
|
|
122
|
+
/** Called when the user clicks the "Today" button in the header. */
|
|
36
123
|
onTodayClick: () => void;
|
|
124
|
+
/**
|
|
125
|
+
* Called when the user clicks a cell without any time slots in the day view.
|
|
126
|
+
*
|
|
127
|
+
* @param slot Details about the clicked empty slot.
|
|
128
|
+
*/
|
|
37
129
|
onEmptySlotClick?: ((slot: ScheduleEmptySlotProps) => void) | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* When provided, a popover is attached to each empty slot in the day view
|
|
132
|
+
* instead of calling `onEmptySlotClick` directly.
|
|
133
|
+
*/
|
|
38
134
|
emptySlotPopover?: ((slot: ScheduleEmptySlotProps) => SchedulePopoverProps) | undefined;
|
|
135
|
+
/** Message displayed inside blocked slots. */
|
|
39
136
|
blockedMessage?: string | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* Called in the week view when the user clicks a cell that contains hidden
|
|
139
|
+
* overflow slots.
|
|
140
|
+
*
|
|
141
|
+
* @param hiddenServices Names of the services whose slots are hidden in the
|
|
142
|
+
* clicked cell.
|
|
143
|
+
*/
|
|
40
144
|
onClickHiddenSlots?: ((hiddenServices: string[]) => void) | undefined;
|
|
41
145
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
minTime: string;
|
|
46
|
-
maxTime: string;
|
|
47
|
-
initialScrollTime?: string | undefined;
|
|
48
|
-
containerRef: RefObject<HTMLDivElement>;
|
|
49
|
-
blockedMessage?: string | undefined;
|
|
50
|
-
}
|
|
146
|
+
/**
|
|
147
|
+
* A single bookable time slot within a `ScheduleEntityProps`.
|
|
148
|
+
*/
|
|
51
149
|
export interface ScheduleSlotProps {
|
|
150
|
+
/** Unique identifier for the slot. */
|
|
52
151
|
id: string;
|
|
152
|
+
/** Slot start time in `HH:mm` format. */
|
|
53
153
|
startTime: string;
|
|
154
|
+
/** Slot end time in `HH:mm` format. */
|
|
54
155
|
endTime: string;
|
|
156
|
+
/** Visual state of the slot. */
|
|
55
157
|
status: ScheduleCellType;
|
|
158
|
+
/** Total number of bookable places in this slot. */
|
|
56
159
|
capacity?: number | undefined;
|
|
160
|
+
/** Date this slot belongs to in `YYYY-MM-DD` format. */
|
|
57
161
|
date: string | undefined;
|
|
162
|
+
/** Number of confirmed bookings already made for this slot. */
|
|
58
163
|
booked?: number | undefined;
|
|
164
|
+
/** Attaches a popover to this slot with custom configuration. */
|
|
59
165
|
customPopover?: SchedulePopoverProps | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* Called when the user clicks this slot.
|
|
168
|
+
*
|
|
169
|
+
* @param data The full slot data at the time of the click.
|
|
170
|
+
* @param e The originating mouse event.
|
|
171
|
+
*/
|
|
60
172
|
onClick?: ((data: ScheduleSlotProps, e: React.MouseEvent) => void) | undefined;
|
|
61
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Describes an empty time slot passed to `onEmptySlotClick` and the
|
|
176
|
+
* `emptySlotPopover`.
|
|
177
|
+
*/
|
|
62
178
|
export interface ScheduleEmptySlotProps {
|
|
179
|
+
/** Slot start time in `HH:mm` format. */
|
|
63
180
|
startTime: string;
|
|
181
|
+
/** Slot end time in `HH:mm` format. */
|
|
64
182
|
endTime: string;
|
|
183
|
+
/** Name of the service this empty slot belongs to. */
|
|
65
184
|
name: string;
|
|
66
185
|
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { SelectHistogramProps } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A form input that displays the selected range and reveals a histogram slider in a dropdown.
|
|
4
|
+
*
|
|
5
|
+
* Use `SelectHistogram` when users need to select a numeric range against a data distribution.
|
|
6
|
+
*/
|
|
2
7
|
export declare const SelectHistogram: ({ alignment, className, disabled, dropdownZIndex, error, histogramSlider, id, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, onBlur, onChange, onChangeEnd, optionTruncationType, placeholder, rangeLabelPrefix, rangeLabelSuffix, readOnly, renderRangeLabel, value, dropdownRootNode, ...otherProps }: SelectHistogramProps) => JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-histogram.js","sources":["../../src/select-histogram/select-histogram.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport { HistogramSlider } from \"../histogram-slider\";\nimport { DropdownListState, ExpandableElement } from \"../shared/dropdown-list\";\nimport type { DropdownRenderProps } from \"../shared/dropdown-wrapper\";\nimport { ElementWithDropdown } from \"../shared/dropdown-wrapper\";\nimport * as dropdownWrapperStyles from \"../shared/dropdown-wrapper/dropdown-wrapper.styles\";\nimport { InputBox } from \"../shared/input-wrapper\";\nimport { Typography } from \"../typography\";\nimport { useId } from \"../util\";\nimport * as styles from \"./select-histogram.styles\";\nimport type { SelectHistogramProps } from \"./types\";\n\nexport const SelectHistogram = ({\n alignment = \"left\",\n className,\n disabled,\n dropdownZIndex,\n error,\n histogramSlider,\n id,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n onBlur,\n onChange,\n onChangeEnd,\n optionTruncationType = \"end\",\n placeholder = \"Select\",\n rangeLabelPrefix,\n rangeLabelSuffix,\n readOnly,\n renderRangeLabel,\n value,\n dropdownRootNode,\n ...otherProps\n}: SelectHistogramProps): JSX.Element => {\n const {\n interval,\n bins = [],\n renderEmptyView,\n ariaLabels,\n } = histogramSlider;\n // =============================================================================\n // CONST, STATE\n // =============================================================================\n const values = bins.map((item) => item.minValue);\n const minValue = Math.min(...values);\n const [selection, setSelection] = useState<[number, number]>(\n initSelection()\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 const testId = otherProps[\"data-testid\"] || \"select-histogram\";\n // =========================================================================\n // EFFECTS\n // =========================================================================\n useEffect(() => {\n if (value !== selection) {\n setSelection(initSelection());\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value]);\n\n // =============================================================================\n // EVENT HANDLERS\n // =============================================================================\n const handleOpen = () => {\n setShowOptions(true);\n };\n\n const handleClose = () => {\n setShowOptions(false);\n };\n\n const handleDismiss = () => {\n selectorRef.current?.focus();\n setShowOptions(false);\n };\n\n const onSliderChange = (values: [number, number]) => {\n setSelection(values);\n onChange?.(values);\n };\n\n const onSliderChangeEnd = (values: [number, number]) => {\n setSelection(values);\n onChangeEnd?.(values);\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 // HELPER FUNCTIONS\n // =============================================================================\n function initSelection(): [number, number] {\n return value ?? [minValue, minValue + interval];\n }\n\n // =============================================================================\n // RENDER FUNCTIONS\n // =============================================================================\n const renderSelector = (value: number) => {\n if (renderRangeLabel) {\n return renderRangeLabel(value);\n }\n\n return (\n <Typography.BodyBL>\n {rangeLabelPrefix}\n {value}\n {rangeLabelSuffix}\n </Typography.BodyBL>\n );\n };\n\n const getDisplayValue = () => {\n return !values || values.length === 0 ? (\n <div\n className={clsx(\n styles.placeholderLabel,\n optionTruncationType !== \"middle\" &&\n styles.placeholderLabelTruncateEnd\n )}\n >\n {placeholder}\n </div>\n ) : (\n <div className={styles.label}>\n {renderSelector(selection[0])}\n <div className={styles.separator}>-</div>\n {renderSelector(selection[1])}\n </div>\n );\n };\n\n const renderSelectorContent = () => (\n <div\n className={dropdownWrapperStyles.labelContainer}\n ref={labelContainerRef}\n data-disabled={disabled || undefined}\n >\n {getDisplayValue()}\n </div>\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=\"dialog\"\n readOnly={readOnly}\n variant=\"default\"\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 elementWidth,\n styles: floatingStyles,\n setFloatingRef,\n getFloatingProps,\n }: DropdownRenderProps) => (\n <div\n className={styles.histogramSliderDropdownContainer}\n style={{ ...floatingStyles, width: elementWidth }}\n ref={setFloatingRef}\n data-testid={`${testId}-dropdown`}\n {...getFloatingProps()}\n >\n <HistogramSlider\n interval={interval}\n value={selection}\n bins={bins}\n onChange={onSliderChange}\n onChangeEnd={onSliderChangeEnd}\n showRangeLabels={false}\n renderEmptyView={renderEmptyView}\n ariaLabels={ariaLabels}\n />\n </div>\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":["SelectHistogram","_a","alignment","className","disabled","dropdownZIndex","error","histogramSlider","id","ariaLabelledBy","ariaDescribedBy","ariaInvalid","onBlur","onChange","onChangeEnd","optionTruncationType","placeholder","rangeLabelPrefix","rangeLabelSuffix","readOnly","renderRangeLabel","value","dropdownRootNode","otherProps","__rest","interval","bins","renderEmptyView","ariaLabels","values","map","item","minValue","Math","min","selection","setSelection","useState","initSelection","showOptions","setShowOptions","focused","setFocused","internalId","useId","nodeRef","useRef","selectorRef","labelContainerRef","testId","useEffect","onSliderChange","onSliderChangeEnd","handleNodeFocus","handleNodeBlur","e","current","contains","relatedTarget","renderSelector","_jsxs","Typography","BodyBL","children","_jsx","DropdownListState","ElementWithDropdown","enabled","isOpen","renderElement","InputBox","ref","tabIndex","onFocus","ExpandableElement","expanded","listboxId","popupRole","variant","dropdownWrapperStyles.labelContainer","undefined","length","styles.label","styles.separator","clsx","styles.placeholderLabel","styles.placeholderLabelTruncateEnd","renderDropdown","elementWidth","styles","floatingStyles","setFloatingRef","getFloatingProps","Object","assign","styles.histogramSliderDropdownContainer","style","width","HistogramSlider","showRangeLabels","onOpen","onClose","onDismiss","focus","clickToToggle","offset","fitAvailableHeight","customZIndex","rootNode"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"select-histogram.js","sources":["../../src/select-histogram/select-histogram.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport { HistogramSlider } from \"../histogram-slider\";\nimport { DropdownListState, ExpandableElement } from \"../shared/dropdown-list\";\nimport type { DropdownRenderProps } from \"../shared/dropdown-wrapper\";\nimport { ElementWithDropdown } from \"../shared/dropdown-wrapper\";\nimport * as dropdownWrapperStyles from \"../shared/dropdown-wrapper/dropdown-wrapper.styles\";\nimport { InputBox } from \"../shared/input-wrapper\";\nimport { Typography } from \"../typography\";\nimport { useId } from \"../util\";\nimport * as styles from \"./select-histogram.styles\";\nimport type { SelectHistogramProps } from \"./types\";\n\n/**\n * A form input that displays the selected range and reveals a histogram slider in a dropdown.\n *\n * Use `SelectHistogram` when users need to select a numeric range against a data distribution.\n */\nexport const SelectHistogram = ({\n alignment = \"left\",\n className,\n disabled,\n dropdownZIndex,\n error,\n histogramSlider,\n id,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n onBlur,\n onChange,\n onChangeEnd,\n optionTruncationType = \"end\",\n placeholder = \"Select\",\n rangeLabelPrefix,\n rangeLabelSuffix,\n readOnly,\n renderRangeLabel,\n value,\n dropdownRootNode,\n ...otherProps\n}: SelectHistogramProps): JSX.Element => {\n const {\n interval,\n bins = [],\n renderEmptyView,\n ariaLabels,\n } = histogramSlider;\n // =============================================================================\n // CONST, STATE\n // =============================================================================\n const values = bins.map((item) => item.minValue);\n const minValue = Math.min(...values);\n const [selection, setSelection] = useState<[number, number]>(\n initSelection()\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 const testId = otherProps[\"data-testid\"] || \"select-histogram\";\n // =========================================================================\n // EFFECTS\n // =========================================================================\n useEffect(() => {\n if (value !== selection) {\n setSelection(initSelection());\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value]);\n\n // =============================================================================\n // EVENT HANDLERS\n // =============================================================================\n const handleOpen = () => {\n setShowOptions(true);\n };\n\n const handleClose = () => {\n setShowOptions(false);\n };\n\n const handleDismiss = () => {\n selectorRef.current?.focus();\n setShowOptions(false);\n };\n\n const onSliderChange = (values: [number, number]) => {\n setSelection(values);\n onChange?.(values);\n };\n\n const onSliderChangeEnd = (values: [number, number]) => {\n setSelection(values);\n onChangeEnd?.(values);\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 // HELPER FUNCTIONS\n // =============================================================================\n function initSelection(): [number, number] {\n return value ?? [minValue, minValue + interval];\n }\n\n // =============================================================================\n // RENDER FUNCTIONS\n // =============================================================================\n const renderSelector = (value: number) => {\n if (renderRangeLabel) {\n return renderRangeLabel(value);\n }\n\n return (\n <Typography.BodyBL>\n {rangeLabelPrefix}\n {value}\n {rangeLabelSuffix}\n </Typography.BodyBL>\n );\n };\n\n const getDisplayValue = () => {\n return !values || values.length === 0 ? (\n <div\n className={clsx(\n styles.placeholderLabel,\n optionTruncationType !== \"middle\" &&\n styles.placeholderLabelTruncateEnd\n )}\n >\n {placeholder}\n </div>\n ) : (\n <div className={styles.label}>\n {renderSelector(selection[0])}\n <div className={styles.separator}>-</div>\n {renderSelector(selection[1])}\n </div>\n );\n };\n\n const renderSelectorContent = () => (\n <div\n className={dropdownWrapperStyles.labelContainer}\n ref={labelContainerRef}\n data-disabled={disabled || undefined}\n >\n {getDisplayValue()}\n </div>\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=\"dialog\"\n readOnly={readOnly}\n variant=\"default\"\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 elementWidth,\n styles: floatingStyles,\n setFloatingRef,\n getFloatingProps,\n }: DropdownRenderProps) => (\n <div\n className={styles.histogramSliderDropdownContainer}\n style={{ ...floatingStyles, width: elementWidth }}\n ref={setFloatingRef}\n data-testid={`${testId}-dropdown`}\n {...getFloatingProps()}\n >\n <HistogramSlider\n interval={interval}\n value={selection}\n bins={bins}\n onChange={onSliderChange}\n onChangeEnd={onSliderChangeEnd}\n showRangeLabels={false}\n renderEmptyView={renderEmptyView}\n ariaLabels={ariaLabels}\n />\n </div>\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":["SelectHistogram","_a","alignment","className","disabled","dropdownZIndex","error","histogramSlider","id","ariaLabelledBy","ariaDescribedBy","ariaInvalid","onBlur","onChange","onChangeEnd","optionTruncationType","placeholder","rangeLabelPrefix","rangeLabelSuffix","readOnly","renderRangeLabel","value","dropdownRootNode","otherProps","__rest","interval","bins","renderEmptyView","ariaLabels","values","map","item","minValue","Math","min","selection","setSelection","useState","initSelection","showOptions","setShowOptions","focused","setFocused","internalId","useId","nodeRef","useRef","selectorRef","labelContainerRef","testId","useEffect","onSliderChange","onSliderChangeEnd","handleNodeFocus","handleNodeBlur","e","current","contains","relatedTarget","renderSelector","_jsxs","Typography","BodyBL","children","_jsx","DropdownListState","ElementWithDropdown","enabled","isOpen","renderElement","InputBox","ref","tabIndex","onFocus","ExpandableElement","expanded","listboxId","popupRole","variant","dropdownWrapperStyles.labelContainer","undefined","length","styles.label","styles.separator","clsx","styles.placeholderLabel","styles.placeholderLabelTruncateEnd","renderDropdown","elementWidth","styles","floatingStyles","setFloatingRef","getFloatingProps","Object","assign","styles.histogramSliderDropdownContainer","style","width","HistogramSlider","showRangeLabels","onOpen","onClose","onDismiss","focus","clickToToggle","offset","fitAvailableHeight","customZIndex","rootNode"],"mappings":"06EAmBO,MAAMA,EAAmBC,QAAAC,UAC5BA,EAAY,OAAMC,UAClBA,EAASC,SACTA,EAAQC,eACRA,EAAcC,MACdA,EAAKC,gBACLA,EAAeC,GACfA,EACA,kBAAmBC,EACnB,mBAAoBC,EACpB,eAAgBC,EAAWC,OAC3BA,EAAMC,SACNA,EAAQC,YACRA,EAAWC,qBACXA,EAAuB,MAAKC,YAC5BA,EAAc,SAAQC,iBACtBA,EAAgBC,iBAChBA,EAAgBC,SAChBA,EAAQC,iBACRA,EAAgBC,MAChBA,EAAKC,iBACLA,GAAgBrB,EACbsB,EAAUC,EAAAvB,EAtBe,CAAA,YAAA,YAAA,WAAA,iBAAA,QAAA,kBAAA,KAAA,kBAAA,mBAAA,eAAA,SAAA,WAAA,cAAA,uBAAA,cAAA,mBAAA,mBAAA,WAAA,mBAAA,QAAA,qBAwB5B,MAAMwB,SACFA,EAAQC,KACRA,EAAO,GAAEC,gBACTA,EAAeC,WACfA,GACArB,EAIEsB,EAASH,EAAKI,KAAKC,GAASA,EAAKC,WACjCA,EAAWC,KAAKC,OAAOL,IACtBM,EAAWC,GAAgBC,EAC9BC,OAEGC,EAAaC,GAAkBH,GAAkB,IACjDI,EAASC,IAAcL,GAAkB,GAC1CM,GAAaC,IAEbC,GAAUC,EAAuB,MACjCC,GAAcD,EAA0B,MACxCE,GAAoBF,EAAuB,MAE3CG,GAAS1B,EAAW,gBAAkB,mBAI5C2B,GAAU,KACF7B,IAAUc,GACVC,EAAaE,KACjB,GAED,CAACjB,IAKJ,MAaM8B,GAAkBtB,IACpBO,EAAaP,GACbhB,SAAAA,EAAWgB,EAAO,EAGhBuB,GAAqBvB,IACvBO,EAAaP,GACbf,SAAAA,EAAce,EAAO,EAGnBwB,GAAkB,KACfZ,GAAYF,GACbG,IAAW,EACf,EAGEY,GAAkBC,IAEhBd,IACCF,GACDM,GAAQW,UACPX,GAAQW,QAAQC,SAASF,EAAEG,iBAE5BhB,IAAW,GACX9B,SAAAA,IACJ,EAKJ,SAAS0B,KACL,OAAOjB,QAAAA,EAAS,CAACW,EAAUA,EAAWP,EAC1C,CAKA,MAAMkC,GAAkBtC,GAChBD,EACOA,EAAiBC,GAIxBuC,EAACC,EAAWC,OAAM,CAAAC,SAAA,CACb9C,EACAI,EACAH,KA8Fb,OACI8C,EAACC,EAAiB,CAAAF,SACdC,EAACE,EAAmB,CAChBC,SAAUhD,IAAaf,EACvBgE,OAAQ7B,EACR8B,cAhEU,IAEdL,EAACM,GACGnE,UAAWA,EAAS,cACP8C,GACbzC,GAAIA,EACJ+D,IAAK1B,GACL2B,UAAU,EACVC,QAASpB,GACTzC,OAAQ0C,GACRb,QAASA,EACTrC,SAAUA,EACVe,SAAUA,EACVb,MAAOA,WAEP0D,EAACU,GACGH,IAAKxB,GACL3C,SAAUA,EACVuE,SAAUpC,EACVqC,UAAWjC,GACXkC,UAAU,SACV1D,SAAUA,EACV2D,QAAQ,UAAS,kBACArE,qBACCC,EAAe,eACnBC,EAAWoD,SAlCrCC,EAAA,MAAA,CACI7D,UAAW4E,EACXR,IAAKvB,GAAiB,gBACP5C,QAAY4E,EAASjB,SAvBhClC,GAA4B,IAAlBA,EAAOoD,OAWrBrB,EAAA,MAAA,CAAKzD,UAAW+E,EAAYnB,SAAA,CACvBJ,GAAexB,EAAU,IAC1B6B,EAAA,MAAA,CAAK7D,UAAWgF,EAAgBpB,SAAA,MAC/BJ,GAAexB,EAAU,OAb9B6B,EAAA,MAAA,CACI7D,UAAWiF,EACPC,EACyB,WAAzBtE,GACIuE,YAGPtE,UAsFDuE,eAhCW,EACnBC,eACAC,OAAQC,EACRC,iBACAC,sBAEA5B,EAAA,MAAA6B,OAAAC,OAAA,CACI3F,UAAW4F,EACXC,qCAAYN,GAAc,CAAEO,MAAOT,IACnCjB,IAAKoB,EAAc,cACN,GAAG1C,eACZ2C,IAAkB,CAAA7B,SAEtBC,EAACkC,EAAe,CACZzE,SAAUA,EACVJ,MAAOc,EACPT,KAAMA,EACNb,SAAUsC,GACVrC,YAAasC,GACb+C,iBAAiB,EACjBxE,gBAAiBA,EACjBC,WAAYA,OAYZwE,OAhKO,KACf5D,GAAe,EAAK,EAgKZ6D,QA7JQ,KAChB7D,GAAe,EAAM,EA6Jb8D,UA1JU,WACC,QAAnBrG,EAAA8C,GAAYS,eAAO,IAAAvD,GAAAA,EAAEsG,QACrB/D,GAAe,EAAM,EAyJbgE,eAAa,EACbC,OAAQ,EACRvG,UAAWA,EACXwG,oBAAkB,EAClBC,aAActG,EACduG,SAAUtF,KAEE"}
|
|
@@ -2,32 +2,85 @@ import type { AriaAttributes, RefObject } from "react";
|
|
|
2
2
|
import type { HistogramSliderProps } from "../histogram-slider";
|
|
3
3
|
import type { TruncateType } from "../shared/dropdown-list/types";
|
|
4
4
|
import type { DropdownAlignmentType } from "../shared/dropdown-wrapper";
|
|
5
|
+
/**
|
|
6
|
+
* Subset of `HistogramSliderProps` passed to `SelectHistogram` to configure the
|
|
7
|
+
* embedded histogram slider rendered inside the dropdown.
|
|
8
|
+
*/
|
|
5
9
|
export type SelectHistogramSliderProps = Pick<HistogramSliderProps, "bins" | "interval" | "renderEmptyView" | "ariaLabels">;
|
|
10
|
+
/**
|
|
11
|
+
* Props for the `SelectHistogram` component.
|
|
12
|
+
*/
|
|
6
13
|
export interface SelectHistogramProps extends Pick<AriaAttributes, "aria-labelledby" | "aria-describedby" | "aria-invalid"> {
|
|
14
|
+
/**
|
|
15
|
+
* Horizontal alignment of the dropdown relative to the trigger element.
|
|
16
|
+
*
|
|
17
|
+
* @default "left"
|
|
18
|
+
*/
|
|
7
19
|
alignment?: DropdownAlignmentType | undefined;
|
|
8
20
|
className?: string | undefined;
|
|
9
21
|
"data-testid"?: string | undefined;
|
|
10
22
|
disabled?: boolean | undefined;
|
|
23
|
+
/** CSS `z-index` applied to the dropdown overlay. */
|
|
11
24
|
dropdownZIndex?: number | undefined;
|
|
25
|
+
/** Renders the trigger in an error state when `true`. */
|
|
12
26
|
error?: boolean | undefined;
|
|
13
27
|
id?: string | undefined;
|
|
28
|
+
/** Configuration for the histogram slider rendered inside the dropdown. */
|
|
14
29
|
histogramSlider: SelectHistogramSliderProps;
|
|
15
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Controls how long option labels are truncated when they overflow.
|
|
32
|
+
*
|
|
33
|
+
* @default "end"
|
|
34
|
+
*/
|
|
16
35
|
optionTruncationType?: TruncateType | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Text shown in the trigger when no range is selected or no bins are provided.
|
|
38
|
+
*
|
|
39
|
+
* @default "Select"
|
|
40
|
+
*/
|
|
17
41
|
placeholder?: string | undefined;
|
|
42
|
+
/** Text prepended to each range label value. */
|
|
18
43
|
rangeLabelPrefix?: string | undefined;
|
|
44
|
+
/** Text appended to each range label value. */
|
|
19
45
|
rangeLabelSuffix?: string | undefined;
|
|
20
46
|
readOnly?: boolean | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* The currently selected range as `[min, max]`. When omitted, the selection
|
|
49
|
+
* initialises to `[minValue, minValue + interval]` derived from the first bin.
|
|
50
|
+
*/
|
|
21
51
|
value?: [number, number] | undefined;
|
|
22
52
|
/**
|
|
23
|
-
* The root element that contains the dropdown element.
|
|
53
|
+
* The root element that contains the dropdown element.
|
|
24
54
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
55
|
+
* @remarks Specify this if you need to change the parent of the
|
|
56
|
+
* dropdown in the HTML DOM.
|
|
57
|
+
* Possible use case: sharing a stacking context.
|
|
58
|
+
*
|
|
59
|
+
* Note: if a parent of the trigger has a higher `z-index` than the dropdown,
|
|
60
|
+
* the dropdown may be obscured.
|
|
61
|
+
*
|
|
62
|
+
* @default `document.body`
|
|
27
63
|
*/
|
|
28
64
|
dropdownRootNode?: RefObject<HTMLElement> | undefined;
|
|
65
|
+
/** Called when focus leaves both the input and the dropdown. */
|
|
29
66
|
onBlur?: (() => void) | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Called on every selection change.
|
|
69
|
+
*
|
|
70
|
+
* @param value The current `[min, max]` selection.
|
|
71
|
+
*/
|
|
30
72
|
onChange?: ((value: [number, number]) => void) | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Called when a thumb is released after selection is complete.
|
|
75
|
+
*
|
|
76
|
+
* @param value The settled `[min, max]` selection.
|
|
77
|
+
*/
|
|
31
78
|
onChangeEnd?: ((value: [number, number]) => void) | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Custom renderer for each bound value displayed in the trigger label.
|
|
81
|
+
* Overrides `rangeLabelPrefix`, `rangeLabelSuffix`, and the default `Typography.BodyBL` wrapper.
|
|
82
|
+
*
|
|
83
|
+
* @param value The numeric bound to render.
|
|
84
|
+
*/
|
|
32
85
|
renderRangeLabel?: ((value: number) => React.ReactNode) | undefined;
|
|
33
86
|
}
|