@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
package/toast/types.d.ts
CHANGED
|
@@ -1,25 +1,59 @@
|
|
|
1
1
|
import type { HTMLAttributes } from "react";
|
|
2
2
|
import type React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Visual variant of the `Toast`, controlling the icon and color treatment.
|
|
5
|
+
*/
|
|
3
6
|
export type ToastType = "success" | "warning" | "error" | "info";
|
|
7
|
+
/**
|
|
8
|
+
* Configuration for the optional action button rendered inside a `Toast`.
|
|
9
|
+
*/
|
|
4
10
|
export interface ToastActionButtonProps {
|
|
5
11
|
label: string;
|
|
6
12
|
onClick: () => void;
|
|
7
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Props for the `Toast` notification component.
|
|
16
|
+
*/
|
|
8
17
|
export interface ToastProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
9
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Visual variant controlling the icon and color treatment.
|
|
20
|
+
*
|
|
21
|
+
* @default "success"
|
|
22
|
+
*/
|
|
10
23
|
type: ToastType;
|
|
11
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Main text content of the toast. When `title` is also provided, rendered
|
|
26
|
+
* as a supporting description using a smaller typography style.
|
|
27
|
+
*/
|
|
12
28
|
label: string | React.ReactNode;
|
|
13
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Optional heading displayed above `label`.
|
|
31
|
+
*/
|
|
14
32
|
title?: string | React.ReactNode | undefined;
|
|
15
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* When `true`, the toast dismisses itself automatically after
|
|
35
|
+
* `autoDismissTime` milliseconds.
|
|
36
|
+
*/
|
|
16
37
|
autoDismiss?: boolean | undefined;
|
|
17
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Duration in milliseconds before the toast auto-dismisses.
|
|
40
|
+
* Only takes effect when `autoDismiss` is `true`.
|
|
41
|
+
*
|
|
42
|
+
* @default 4000
|
|
43
|
+
*/
|
|
18
44
|
autoDismissTime?: number | undefined;
|
|
19
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Called after the dismissal animation completes.
|
|
47
|
+
*/
|
|
20
48
|
onDismiss?: (() => void) | undefined;
|
|
21
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Pins the toast in a fixed position at the top of the viewport.
|
|
51
|
+
*
|
|
52
|
+
* @default true
|
|
53
|
+
*/
|
|
22
54
|
fixed?: boolean | undefined;
|
|
23
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Optional action button rendered alongside the toast content.
|
|
57
|
+
*/
|
|
24
58
|
actionButton?: ToastActionButtonProps | undefined;
|
|
25
59
|
}
|
package/toggle/toggle.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import type { ToggleProps } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A selectable control for checkbox and radio interaction patterns.
|
|
4
|
+
*
|
|
5
|
+
* Use `Toggle` to present a labeled option that the user can select or
|
|
6
|
+
* deselect.
|
|
7
|
+
*/
|
|
2
8
|
export declare const Toggle: ({ type, indicator, checked, styleType, children, childrenMaxLines, subLabel, disabled, error, name, id, className, compositeSection, removable, focusableWhenDisabled, useContentWidth, onRemove, onChange, "data-testid": testId, "aria-describedby": ariaDescribedBy, ...otherProps }: ToggleProps) => import("react/jsx-runtime").JSX.Element;
|
package/toggle/toggle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.js","sources":["../../src/toggle/toggle.tsx"],"sourcesContent":["import { ChevronDownIcon } from \"@lifesg/react-icons/chevron-down\";\nimport { ChevronUpIcon } from \"@lifesg/react-icons/chevron-up\";\nimport clsx from \"clsx\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\n\nimport { Alert } from \"../alert\";\nimport { Markup } from \"../markup\";\nimport { TextList } from \"../text-list\";\nimport { useApplyStyle } from \"../theme\";\nimport { Typography } from \"../typography\";\nimport { useId } from \"../util\";\nimport * as styles from \"./toggle.styles\";\nimport type { ToggleIconType } from \"./toggle-icon\";\nimport { ToggleIcon } from \"./toggle-icon\";\nimport type { ToggleProps } from \"./types\";\n\nexport const Toggle = ({\n type = \"checkbox\",\n indicator,\n checked,\n styleType = \"default\",\n children,\n childrenMaxLines,\n subLabel,\n disabled,\n error,\n name,\n id,\n className,\n compositeSection,\n removable,\n focusableWhenDisabled,\n useContentWidth,\n onRemove,\n onChange,\n \"data-testid\": testId,\n \"aria-describedby\": ariaDescribedBy,\n ...otherProps\n}: ToggleProps) => {\n // =============================================================================\n // CONST, STATE, REF\n // =============================================================================\n const {\n collapsible = true,\n errors,\n children: compositeSectionChildren,\n initialExpanded,\n } = compositeSection || {};\n const [selected, setSelected] = useState<boolean | undefined>(checked);\n const [expanded, setExpanded] = useState<boolean>(!!initialExpanded);\n const hasCompositeSectionError = useMemo(() => {\n const hasErrorList = Array.isArray(errors) && errors?.length > 0;\n const hasErrorElement = !Array.isArray(errors) && !!errors;\n return hasErrorList || hasErrorElement;\n }, [errors]);\n const uniqueId = useId();\n const generatedId = id ? `${id}` : `tg-${uniqueId}`;\n\n const inputRef = useRef<HTMLInputElement>(null);\n const labelRef = useRef<HTMLLabelElement>(null);\n\n useApplyStyle(labelRef, {\n [styles.tokens.label.desktopLineClamp]:\n childrenMaxLines?.desktop == null\n ? null\n : `${childrenMaxLines.desktop}`,\n [styles.tokens.label.tabletLineClamp]:\n childrenMaxLines?.tablet == null\n ? null\n : `${childrenMaxLines.tablet}`,\n [styles.tokens.label.mobileLineClamp]:\n childrenMaxLines?.mobile == null\n ? null\n : `${childrenMaxLines.mobile}`,\n });\n\n const isFocusableWhenDisabled = !!disabled && !!focusableWhenDisabled;\n const isNativeDisabled = !!disabled && !focusableWhenDisabled;\n const isInteractionBlocked = !!disabled;\n\n // =============================================================================\n // EFFECTS\n // =============================================================================\n useEffect(() => {\n setSelected(checked);\n }, [checked]);\n\n useEffect(() => {\n if (selected) {\n setExpanded(initialExpanded ?? true);\n }\n }, [selected]);\n\n // =============================================================================\n // EVENT HANDLERS\n // =============================================================================\n const handleOnChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (isInteractionBlocked) {\n event.preventDefault();\n return;\n }\n\n if (onChange) {\n onChange(event);\n return;\n }\n\n switch (type) {\n case \"checkbox\":\n setSelected((prevSelected) => {\n return !prevSelected;\n });\n break;\n case \"radio\":\n case \"yes\":\n case \"no\":\n if (!selected) {\n setSelected(true);\n }\n break;\n }\n };\n\n const handleExpandCollapseClick = () => {\n if (!disabled) {\n setExpanded(!expanded);\n }\n };\n\n const handleOnRemove = () => {\n if (!disabled) {\n if (onRemove) {\n onRemove();\n return;\n }\n }\n };\n\n const handleContainerClick = () => {\n inputRef?.current?.click();\n };\n\n const handleInputClick = (e: React.MouseEvent<HTMLInputElement>) => {\n e.stopPropagation();\n };\n\n // =============================================================================\n // HELPER FUNCTIONS\n // =============================================================================\n\n const getContainerStateClass = () => {\n if (styleType === \"no-border\") {\n if (error) {\n return clsx(\n styles.colorBorderError,\n !disabled && styles.toggleContainerError\n );\n }\n\n if (disabled) {\n return selected\n ? styles.toggleContainerNoBorderDisabledSelected\n : styles.toggleContainerNoBorderDisabled;\n }\n\n if (selected) {\n return styles.toggleContainerNoBorderSelected;\n }\n\n return styles.toggleContainerNoBorder;\n }\n\n if (error) {\n return disabled\n ? styles.colorBorderError\n : styles.toggleContainerError;\n }\n\n if (disabled) {\n return selected\n ? styles.toggleContainerDisabledSelected\n : styles.toggleContainerDisabled;\n }\n\n if (selected) {\n return styles.toggleContainerSelected;\n }\n\n return styles.toggleContainer;\n };\n\n const getContainerHoverClass = () => {\n if (disabled) {\n return undefined;\n }\n\n if (!error && selected) {\n return styles.toggleContainerHoverSelected;\n }\n\n return styles.toggleContainerHoverDefault;\n };\n\n const getTextContainerStateClass = () => {\n if (disabled) {\n return selected\n ? styles.toggleTextContainerDisabledSelected\n : styles.colorTextDisabled;\n }\n\n if (selected) {\n return styles.toggleTextContainerSelected;\n }\n };\n\n // =============================================================================\n // RENDER FUNCTIONS\n // =============================================================================\n const renderIndicator = () => {\n let toggleIconType: ToggleIconType;\n\n switch (type) {\n case \"yes\":\n toggleIconType = \"tick\";\n break;\n case \"no\":\n toggleIconType = \"cross\";\n break;\n case \"checkbox\":\n case \"radio\":\n toggleIconType = type;\n break;\n }\n\n return (\n <ToggleIcon\n type={toggleIconType}\n active={selected}\n disabled={disabled}\n />\n );\n };\n\n const renderSubLabel = () => {\n if (!subLabel) {\n return null;\n }\n\n let component: string | JSX.Element;\n\n if (typeof subLabel === \"function\") {\n component = subLabel();\n } else {\n component = subLabel;\n }\n\n // Hide sublabel from screen readers as the main input already has aria-describedby that points to the sublabel\n return (\n <div\n data-id=\"toggle-sublabel\"\n id={`${generatedId}-sublabel`}\n aria-hidden\n className={styles.subLabel}\n >\n {component}\n </div>\n );\n };\n\n const renderCompositeChildren = () => {\n return (\n (!collapsible || expanded) && (\n <div\n data-id=\"toggle-composite-children\"\n className={clsx(\n styles.children,\n !collapsible && styles.childrenIsFinalItem,\n disabled && styles.colorTextDisabled\n )}\n >\n <Markup baseTextSize=\"body-md\">\n {compositeSectionChildren}\n </Markup>\n </div>\n )\n );\n };\n\n const renderExpandButton = () => {\n const collapsedWithoutErrors = !expanded && !hasCompositeSectionError;\n\n return (\n collapsible && (\n <button\n className={clsx(\n styles.expandButton,\n disabled && styles.disabledColorCursor,\n collapsedWithoutErrors &&\n styles.expandButtonPaddingTopRequired\n )}\n disabled={disabled}\n onClick={handleExpandCollapseClick}\n data-testid={expanded ? \"collapse-button\" : \"expand-button\"}\n >\n {expanded ? \"Show less\" : \"Show more\"}\n {expanded ? (\n <ChevronUpIcon aria-hidden />\n ) : (\n <ChevronDownIcon aria-hidden />\n )}\n </button>\n )\n );\n };\n\n const renderToggleWithRemoveButton = () => {\n const ariaDescriptions =\n [\n typeof subLabel === \"string\" ? `${generatedId}-sublabel` : null,\n ariaDescribedBy,\n ]\n .filter(Boolean)\n .join(\" \") || undefined;\n\n return (\n <div\n id={`${generatedId}-header-container`}\n className={styles.headerContainer}\n >\n <div\n className={clsx(\n styles.indicatorLabelContainer,\n removable && styles.indicatorLabelContainerAddPadding\n )}\n >\n <div\n id={`${generatedId}-input-container`}\n onClick={handleContainerClick}\n className={styles.inputContainer}\n >\n <input\n ref={inputRef}\n name={name}\n id={`${generatedId}-input`}\n type={type === \"checkbox\" ? \"checkbox\" : \"radio\"}\n data-testid=\"toggle-input\"\n className={clsx(\n styles.input,\n disabled && styles.toggleInputDisabled\n )}\n disabled={isNativeDisabled}\n aria-disabled={isFocusableWhenDisabled}\n onChange={handleOnChange}\n onClick={handleInputClick}\n checked={selected}\n tabIndex={isFocusableWhenDisabled ? 0 : undefined}\n aria-describedby={ariaDescriptions}\n {...otherProps}\n />\n {indicator && renderIndicator()}\n <div\n className={clsx(\n styles.textContainer,\n getTextContainerStateClass()\n )}\n >\n <label\n ref={labelRef}\n htmlFor={`${generatedId}-input`}\n data-testid={`toggle-label`}\n id={`${generatedId}-label`}\n className={clsx(\n styles.label,\n selected\n ? styles.toggleLabelSelected\n : styles.toggleLabelDefault\n )}\n >\n {children}\n </label>\n {subLabel && renderSubLabel()}\n </div>\n </div>\n </div>\n {removable && (\n <button\n type=\"button\"\n className={clsx(\n styles.removeButton,\n disabled && styles.disabledColorCursor\n )}\n onClick={handleOnRemove}\n id={`${generatedId}-remove-button`}\n >\n Remove\n </button>\n )}\n </div>\n );\n };\n\n const renderErrorList = (errors: string[]) => {\n return (\n <>\n <Typography.BodyMD\n weight=\"semibold\"\n className={clsx(\n styles.colorTextError,\n disabled && styles.colorTextDisabled\n )}\n >\n Error\n </Typography.BodyMD>\n <TextList.Ul\n className={clsx(\n styles.colorTextError,\n disabled && styles.colorTextDisabled\n )}\n >\n {errors?.map((item, index) => {\n return (\n <li\n key={index}\n id={`${generatedId}-error-list-item-${index}`}\n >\n <Typography.BodyMD\n weight=\"semibold\"\n className={clsx(\n styles.colorTextError,\n disabled && styles.colorTextDisabled\n )}\n >\n {item}\n </Typography.BodyMD>\n </li>\n );\n })}\n </TextList.Ul>\n </>\n );\n };\n\n const renderError = () => {\n return (\n collapsible &&\n !expanded &&\n hasCompositeSectionError && (\n <div\n className={clsx(\n styles.errorContainer,\n disabled && styles.disabledColorCursor\n )}\n onClick={handleExpandCollapseClick}\n id={`${generatedId}-error-alert`}\n >\n <Alert\n type={disabled ? \"description\" : \"error\"}\n className={styles.alertContainer}\n showIcon\n >\n {Array.isArray(errors)\n ? renderErrorList(errors)\n : errors}\n </Alert>\n </div>\n )\n );\n };\n\n const renderCompositeSection = () => {\n return (\n compositeSectionChildren && (\n <div>\n {renderCompositeChildren()}\n {renderError()}\n {renderExpandButton()}\n </div>\n )\n );\n };\n\n return (\n <div\n className={clsx(\n styles.container,\n getContainerStateClass(),\n getContainerHoverClass(),\n !indicator && styles.noIndicatorContainer,\n useContentWidth && styles.useContentWidthContainer,\n className\n )}\n id={id}\n data-testid={testId}\n >\n {renderToggleWithRemoveButton()}\n {renderCompositeSection()}\n </div>\n );\n};\n"],"names":["Toggle","_a","type","indicator","checked","styleType","children","childrenMaxLines","subLabel","disabled","error","name","id","className","compositeSection","removable","focusableWhenDisabled","useContentWidth","onRemove","onChange","testId","ariaDescribedBy","otherProps","__rest","collapsible","errors","compositeSectionChildren","initialExpanded","selected","setSelected","useState","expanded","setExpanded","hasCompositeSectionError","useMemo","hasErrorList","Array","isArray","length","hasErrorElement","uniqueId","useId","generatedId","inputRef","useRef","labelRef","useApplyStyle","styles.tokens","label","desktopLineClamp","desktop","tabletLineClamp","tablet","mobileLineClamp","mobile","isFocusableWhenDisabled","isNativeDisabled","isInteractionBlocked","useEffect","handleOnChange","event","preventDefault","prevSelected","handleExpandCollapseClick","handleOnRemove","handleContainerClick","current","click","handleInputClick","e","stopPropagation","renderIndicator","toggleIconType","_jsx","ToggleIcon","active","renderSubLabel","component","styles.subLabel","renderErrorList","_jsxs","_Fragment","Typography","BodyMD","weight","clsx","styles.colorTextError","styles.colorTextDisabled","TextList","Ul","map","item","index","styles.container","styles.colorBorderError","styles.toggleContainerError","styles.toggleContainerNoBorderDisabledSelected","styles.toggleContainerNoBorderDisabled","styles.toggleContainerNoBorderSelected","styles.toggleContainerNoBorder","styles.toggleContainerDisabledSelected","styles.toggleContainerDisabled","styles.toggleContainerSelected","styles.toggleContainer","styles.toggleContainerHoverSelected","styles.toggleContainerHoverDefault","getContainerHoverClass","styles.noIndicatorContainer","styles.useContentWidthContainer","ariaDescriptions","filter","Boolean","join","undefined","styles.headerContainer","styles.indicatorLabelContainer","styles.indicatorLabelContainerAddPadding","onClick","styles.inputContainer","ref","styles.input","styles.toggleInputDisabled","tabIndex","styles.textContainer","styles.toggleTextContainerDisabledSelected","styles.toggleTextContainerSelected","htmlFor","styles.label","styles.toggleLabelSelected","styles.toggleLabelDefault","styles.removeButton","styles.disabledColorCursor","renderToggleWithRemoveButton","styles.children","styles.childrenIsFinalItem","Markup","baseTextSize","styles.errorContainer","Alert","styles.alertContainer","showIcon","styles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PsC,EA9JpBlH,GACOmB,GACDgG,EACArC,EAGN3D,GACOiG,OADX,GA0JqBvH,SAAA,CAEDmE,WACI8C,IAAK1E,GACLiF,QAAS,GAAGpF,WAAmB,cAClB,eACb9B,GAAI,GAAG8B,WACP7B,UAAWwE,EACP0C,EACAnG,GACMoG,EACAC,YAGT3H,KAEJE,IAAYoE,aAIxB7D,IACG0D,EAAA,SAAA,CACIvE,KAAK,SACLW,UAAWwE,EACP6C,EACAzH,IAAY0H,GAEhBd,QAASrD,GACTpD,GAAI,GAAG8B,mBAA2BpC,SAAA,aAKxC,EAiGL8H,GAvBD1G,IACIsD,EAAA,MAAA,CAAA1E,SAAA,GAzMFkB,IAAeO,KACb0C,EAAA,MAAA,CAAA,UACY,4BACR5D,UAAWwE,EACPgD,GACC7G,IAAe8G,EAChB7H,IAAY8E,GACfjF,SAEDmE,EAAC8D,EAAM,CAACC,aAAa,UAASlI,SACzBoB,OAmKbF,KACCO,IACDE,IACIwC,EAAA,MAAA,CACI5D,UAAWwE,EACPoD,EACAhI,IAAY0H,GAEhBd,QAAStD,GACTnD,GAAI,GAAG8B,iBAAyBpC,SAEhCmE,EAACiE,EAAK,CACFxI,KAAMO,GAAW,cAAgB,QACjCI,UAAW8H,EACXC,UAAQ,EAAAtI,SAEP8B,MAAMC,QAAQZ,IACTsD,GAAgBtD,IAChBA,OA1KlBD,IACIwD,EAAA,SAAA,CACInE,UAAWwE,EACPwD,EACApI,IAAY0H,GAPIpG,KAAaE,IASzB6G,IAERrI,SAAUA,GACV4G,QAAStD,GAAyB,cACrBhC,GAAW,kBAAoB,gBAAezB,SAAA,CAE1DyB,GAAW,YAAc,YAEtB0C,EADH1C,GACIgH,EAEAC,EAFa,CAAA,eAAA,YA8LxB"}
|
|
1
|
+
{"version":3,"file":"toggle.js","sources":["../../src/toggle/toggle.tsx"],"sourcesContent":["import { ChevronDownIcon } from \"@lifesg/react-icons/chevron-down\";\nimport { ChevronUpIcon } from \"@lifesg/react-icons/chevron-up\";\nimport clsx from \"clsx\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\n\nimport { Alert } from \"../alert\";\nimport { Markup } from \"../markup\";\nimport { TextList } from \"../text-list\";\nimport { useApplyStyle } from \"../theme\";\nimport { Typography } from \"../typography\";\nimport { useId } from \"../util\";\nimport * as styles from \"./toggle.styles\";\nimport type { ToggleIconType } from \"./toggle-icon\";\nimport { ToggleIcon } from \"./toggle-icon\";\nimport type { ToggleProps } from \"./types\";\n\n/**\n * A selectable control for checkbox and radio interaction patterns.\n *\n * Use `Toggle` to present a labeled option that the user can select or\n * deselect.\n */\nexport const Toggle = ({\n type = \"checkbox\",\n indicator,\n checked,\n styleType = \"default\",\n children,\n childrenMaxLines,\n subLabel,\n disabled,\n error,\n name,\n id,\n className,\n compositeSection,\n removable,\n focusableWhenDisabled,\n useContentWidth,\n onRemove,\n onChange,\n \"data-testid\": testId,\n \"aria-describedby\": ariaDescribedBy,\n ...otherProps\n}: ToggleProps) => {\n // =============================================================================\n // CONST, STATE, REF\n // =============================================================================\n const {\n collapsible = true,\n errors,\n children: compositeSectionChildren,\n initialExpanded,\n } = compositeSection || {};\n const [selected, setSelected] = useState<boolean | undefined>(checked);\n const [expanded, setExpanded] = useState<boolean>(!!initialExpanded);\n const hasCompositeSectionError = useMemo(() => {\n const hasErrorList = Array.isArray(errors) && errors?.length > 0;\n const hasErrorElement = !Array.isArray(errors) && !!errors;\n return hasErrorList || hasErrorElement;\n }, [errors]);\n const uniqueId = useId();\n const generatedId = id ? `${id}` : `tg-${uniqueId}`;\n\n const inputRef = useRef<HTMLInputElement>(null);\n const labelRef = useRef<HTMLLabelElement>(null);\n\n useApplyStyle(labelRef, {\n [styles.tokens.label.desktopLineClamp]:\n childrenMaxLines?.desktop == null\n ? null\n : `${childrenMaxLines.desktop}`,\n [styles.tokens.label.tabletLineClamp]:\n childrenMaxLines?.tablet == null\n ? null\n : `${childrenMaxLines.tablet}`,\n [styles.tokens.label.mobileLineClamp]:\n childrenMaxLines?.mobile == null\n ? null\n : `${childrenMaxLines.mobile}`,\n });\n\n const isFocusableWhenDisabled = !!disabled && !!focusableWhenDisabled;\n const isNativeDisabled = !!disabled && !focusableWhenDisabled;\n const isInteractionBlocked = !!disabled;\n\n // =============================================================================\n // EFFECTS\n // =============================================================================\n useEffect(() => {\n setSelected(checked);\n }, [checked]);\n\n useEffect(() => {\n if (selected) {\n setExpanded(initialExpanded ?? true);\n }\n }, [selected]);\n\n // =============================================================================\n // EVENT HANDLERS\n // =============================================================================\n const handleOnChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (isInteractionBlocked) {\n event.preventDefault();\n return;\n }\n\n if (onChange) {\n onChange(event);\n return;\n }\n\n switch (type) {\n case \"checkbox\":\n setSelected((prevSelected) => {\n return !prevSelected;\n });\n break;\n case \"radio\":\n case \"yes\":\n case \"no\":\n if (!selected) {\n setSelected(true);\n }\n break;\n }\n };\n\n const handleExpandCollapseClick = () => {\n if (!disabled) {\n setExpanded(!expanded);\n }\n };\n\n const handleOnRemove = () => {\n if (!disabled) {\n if (onRemove) {\n onRemove();\n return;\n }\n }\n };\n\n const handleContainerClick = () => {\n inputRef?.current?.click();\n };\n\n const handleInputClick = (e: React.MouseEvent<HTMLInputElement>) => {\n e.stopPropagation();\n };\n\n // =============================================================================\n // HELPER FUNCTIONS\n // =============================================================================\n\n const getContainerStateClass = () => {\n if (styleType === \"no-border\") {\n if (error) {\n return clsx(\n styles.colorBorderError,\n !disabled && styles.toggleContainerError\n );\n }\n\n if (disabled) {\n return selected\n ? styles.toggleContainerNoBorderDisabledSelected\n : styles.toggleContainerNoBorderDisabled;\n }\n\n if (selected) {\n return styles.toggleContainerNoBorderSelected;\n }\n\n return styles.toggleContainerNoBorder;\n }\n\n if (error) {\n return disabled\n ? styles.colorBorderError\n : styles.toggleContainerError;\n }\n\n if (disabled) {\n return selected\n ? styles.toggleContainerDisabledSelected\n : styles.toggleContainerDisabled;\n }\n\n if (selected) {\n return styles.toggleContainerSelected;\n }\n\n return styles.toggleContainer;\n };\n\n const getContainerHoverClass = () => {\n if (disabled) {\n return undefined;\n }\n\n if (!error && selected) {\n return styles.toggleContainerHoverSelected;\n }\n\n return styles.toggleContainerHoverDefault;\n };\n\n const getTextContainerStateClass = () => {\n if (disabled) {\n return selected\n ? styles.toggleTextContainerDisabledSelected\n : styles.colorTextDisabled;\n }\n\n if (selected) {\n return styles.toggleTextContainerSelected;\n }\n };\n\n // =============================================================================\n // RENDER FUNCTIONS\n // =============================================================================\n const renderIndicator = () => {\n let toggleIconType: ToggleIconType;\n\n switch (type) {\n case \"yes\":\n toggleIconType = \"tick\";\n break;\n case \"no\":\n toggleIconType = \"cross\";\n break;\n case \"checkbox\":\n case \"radio\":\n toggleIconType = type;\n break;\n }\n\n return (\n <ToggleIcon\n type={toggleIconType}\n active={selected}\n disabled={disabled}\n />\n );\n };\n\n const renderSubLabel = () => {\n if (!subLabel) {\n return null;\n }\n\n let component: string | JSX.Element;\n\n if (typeof subLabel === \"function\") {\n component = subLabel();\n } else {\n component = subLabel;\n }\n\n // Hide sublabel from screen readers as the main input already has aria-describedby that points to the sublabel\n return (\n <div\n data-id=\"toggle-sublabel\"\n id={`${generatedId}-sublabel`}\n aria-hidden\n className={styles.subLabel}\n >\n {component}\n </div>\n );\n };\n\n const renderCompositeChildren = () => {\n return (\n (!collapsible || expanded) && (\n <div\n data-id=\"toggle-composite-children\"\n className={clsx(\n styles.children,\n !collapsible && styles.childrenIsFinalItem,\n disabled && styles.colorTextDisabled\n )}\n >\n <Markup baseTextSize=\"body-md\">\n {compositeSectionChildren}\n </Markup>\n </div>\n )\n );\n };\n\n const renderExpandButton = () => {\n const collapsedWithoutErrors = !expanded && !hasCompositeSectionError;\n\n return (\n collapsible && (\n <button\n className={clsx(\n styles.expandButton,\n disabled && styles.disabledColorCursor,\n collapsedWithoutErrors &&\n styles.expandButtonPaddingTopRequired\n )}\n disabled={disabled}\n onClick={handleExpandCollapseClick}\n data-testid={expanded ? \"collapse-button\" : \"expand-button\"}\n >\n {expanded ? \"Show less\" : \"Show more\"}\n {expanded ? (\n <ChevronUpIcon aria-hidden />\n ) : (\n <ChevronDownIcon aria-hidden />\n )}\n </button>\n )\n );\n };\n\n const renderToggleWithRemoveButton = () => {\n const ariaDescriptions =\n [\n typeof subLabel === \"string\" ? `${generatedId}-sublabel` : null,\n ariaDescribedBy,\n ]\n .filter(Boolean)\n .join(\" \") || undefined;\n\n return (\n <div\n id={`${generatedId}-header-container`}\n className={styles.headerContainer}\n >\n <div\n className={clsx(\n styles.indicatorLabelContainer,\n removable && styles.indicatorLabelContainerAddPadding\n )}\n >\n <div\n id={`${generatedId}-input-container`}\n onClick={handleContainerClick}\n className={styles.inputContainer}\n >\n <input\n ref={inputRef}\n name={name}\n id={`${generatedId}-input`}\n type={type === \"checkbox\" ? \"checkbox\" : \"radio\"}\n data-testid=\"toggle-input\"\n className={clsx(\n styles.input,\n disabled && styles.toggleInputDisabled\n )}\n disabled={isNativeDisabled}\n aria-disabled={isFocusableWhenDisabled}\n onChange={handleOnChange}\n onClick={handleInputClick}\n checked={selected}\n tabIndex={isFocusableWhenDisabled ? 0 : undefined}\n aria-describedby={ariaDescriptions}\n {...otherProps}\n />\n {indicator && renderIndicator()}\n <div\n className={clsx(\n styles.textContainer,\n getTextContainerStateClass()\n )}\n >\n <label\n ref={labelRef}\n htmlFor={`${generatedId}-input`}\n data-testid={`toggle-label`}\n id={`${generatedId}-label`}\n className={clsx(\n styles.label,\n selected\n ? styles.toggleLabelSelected\n : styles.toggleLabelDefault\n )}\n >\n {children}\n </label>\n {subLabel && renderSubLabel()}\n </div>\n </div>\n </div>\n {removable && (\n <button\n type=\"button\"\n className={clsx(\n styles.removeButton,\n disabled && styles.disabledColorCursor\n )}\n onClick={handleOnRemove}\n id={`${generatedId}-remove-button`}\n >\n Remove\n </button>\n )}\n </div>\n );\n };\n\n const renderErrorList = (errors: string[]) => {\n return (\n <>\n <Typography.BodyMD\n weight=\"semibold\"\n className={clsx(\n styles.colorTextError,\n disabled && styles.colorTextDisabled\n )}\n >\n Error\n </Typography.BodyMD>\n <TextList.Ul\n className={clsx(\n styles.colorTextError,\n disabled && styles.colorTextDisabled\n )}\n >\n {errors?.map((item, index) => {\n return (\n <li\n key={index}\n id={`${generatedId}-error-list-item-${index}`}\n >\n <Typography.BodyMD\n weight=\"semibold\"\n className={clsx(\n styles.colorTextError,\n disabled && styles.colorTextDisabled\n )}\n >\n {item}\n </Typography.BodyMD>\n </li>\n );\n })}\n </TextList.Ul>\n </>\n );\n };\n\n const renderError = () => {\n return (\n collapsible &&\n !expanded &&\n hasCompositeSectionError && (\n <div\n className={clsx(\n styles.errorContainer,\n disabled && styles.disabledColorCursor\n )}\n onClick={handleExpandCollapseClick}\n id={`${generatedId}-error-alert`}\n >\n <Alert\n type={disabled ? \"description\" : \"error\"}\n className={styles.alertContainer}\n showIcon\n >\n {Array.isArray(errors)\n ? renderErrorList(errors)\n : errors}\n </Alert>\n </div>\n )\n );\n };\n\n const renderCompositeSection = () => {\n return (\n compositeSectionChildren && (\n <div>\n {renderCompositeChildren()}\n {renderError()}\n {renderExpandButton()}\n </div>\n )\n );\n };\n\n return (\n <div\n className={clsx(\n styles.container,\n getContainerStateClass(),\n getContainerHoverClass(),\n !indicator && styles.noIndicatorContainer,\n useContentWidth && styles.useContentWidthContainer,\n className\n )}\n id={id}\n data-testid={testId}\n >\n {renderToggleWithRemoveButton()}\n {renderCompositeSection()}\n </div>\n );\n};\n"],"names":["Toggle","_a","type","indicator","checked","styleType","children","childrenMaxLines","subLabel","disabled","error","name","id","className","compositeSection","removable","focusableWhenDisabled","useContentWidth","onRemove","onChange","testId","ariaDescribedBy","otherProps","__rest","collapsible","errors","compositeSectionChildren","initialExpanded","selected","setSelected","useState","expanded","setExpanded","hasCompositeSectionError","useMemo","hasErrorList","Array","isArray","length","hasErrorElement","uniqueId","useId","generatedId","inputRef","useRef","labelRef","useApplyStyle","styles.tokens","label","desktopLineClamp","desktop","tabletLineClamp","tablet","mobileLineClamp","mobile","isFocusableWhenDisabled","isNativeDisabled","isInteractionBlocked","useEffect","handleOnChange","event","preventDefault","prevSelected","handleExpandCollapseClick","handleOnRemove","handleContainerClick","current","click","handleInputClick","e","stopPropagation","renderIndicator","toggleIconType","_jsx","ToggleIcon","active","renderSubLabel","component","styles.subLabel","renderErrorList","_jsxs","_Fragment","Typography","BodyMD","weight","clsx","styles.colorTextError","styles.colorTextDisabled","TextList","Ul","map","item","index","styles.container","styles.colorBorderError","styles.toggleContainerError","styles.toggleContainerNoBorderDisabledSelected","styles.toggleContainerNoBorderDisabled","styles.toggleContainerNoBorderSelected","styles.toggleContainerNoBorder","styles.toggleContainerDisabledSelected","styles.toggleContainerDisabled","styles.toggleContainerSelected","styles.toggleContainer","styles.toggleContainerHoverSelected","styles.toggleContainerHoverDefault","getContainerHoverClass","styles.noIndicatorContainer","styles.useContentWidthContainer","ariaDescriptions","filter","Boolean","join","undefined","styles.headerContainer","styles.indicatorLabelContainer","styles.indicatorLabelContainerAddPadding","onClick","styles.inputContainer","ref","styles.input","styles.toggleInputDisabled","tabIndex","styles.textContainer","styles.toggleTextContainerDisabledSelected","styles.toggleTextContainerSelected","htmlFor","styles.label","styles.toggleLabelSelected","styles.toggleLabelDefault","styles.removeButton","styles.disabledColorCursor","renderToggleWithRemoveButton","styles.children","styles.childrenIsFinalItem","Markup","baseTextSize","styles.errorContainer","Alert","styles.alertContainer","showIcon","styles.expandButton","styles.expandButtonPaddingTopRequired","ChevronUpIcon","ChevronDownIcon"],"mappings":"6kEAsBO,MAAMA,GAAUC,SAAAC,KACnBA,GAAO,WAAUC,UACjBA,GAASC,QACTA,GAAOC,UACPA,GAAY,UAASC,SACrBA,GAAQC,iBACRA,YACAC,GAAQC,SACRA,GAAQC,MACRA,GAAKC,KACLA,GAAIC,GACJA,GAAEC,UACFA,GAASC,iBACTA,GAAgBC,UAChBA,GAASC,sBACTA,GAAqBC,gBACrBA,GAAeC,SACfA,GAAQC,SACRA,GACA,cAA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pC,SAAA,aAKxC,EAiGL8H,GAvBD1G,IACIsD,EAAA,MAAA,CAAA1E,SAAA,GAzMFkB,IAAeO,KACb0C,EAAA,MAAA,CAAA,UACY,4BACR5D,UAAWwE,EACPgD,GACC7G,IAAe8G,EAChB7H,IAAY8E,GACfjF,SAEDmE,EAAC8D,EAAM,CAACC,aAAa,UAASlI,SACzBoB,OAmKbF,KACCO,IACDE,IACIwC,EAAA,MAAA,CACI5D,UAAWwE,EACPoD,EACAhI,IAAY0H,GAEhBd,QAAStD,GACTnD,GAAI,GAAG8B,iBAAyBpC,SAEhCmE,EAACiE,EAAK,CACFxI,KAAMO,GAAW,cAAgB,QACjCI,UAAW8H,EACXC,UAAQ,EAAAtI,SAEP8B,MAAMC,QAAQZ,IACTsD,GAAgBtD,IAChBA,OA1KlBD,IACIwD,EAAA,SAAA,CACInE,UAAWwE,EACPwD,EACApI,IAAY0H,GAPIpG,KAAaE,IASzB6G,IAERrI,SAAUA,GACV4G,QAAStD,GAAyB,cACrBhC,GAAW,kBAAoB,gBAAezB,SAAA,CAE1DyB,GAAW,YAAc,YAEtB0C,EADH1C,GACIgH,EAEAC,EAFa,CAAA,eAAA,YA8LxB"}
|
package/toggle/types.d.ts
CHANGED
|
@@ -1,53 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Controls selection behavior and the indicator icon rendered inside the
|
|
3
|
+
* toggle.
|
|
4
|
+
*
|
|
5
|
+
* - `"checkbox"` allows the user to deselect.
|
|
6
|
+
* - `"radio"`, `"yes"`, and `"no"` only allow selection; once selected,
|
|
7
|
+
* they cannot be deselected.
|
|
8
|
+
*/
|
|
1
9
|
export type ToggleType = "checkbox" | "radio" | "yes" | "no";
|
|
10
|
+
/**
|
|
11
|
+
* Visual border style applied to the toggle container.
|
|
12
|
+
*
|
|
13
|
+
* - `"default"` renders the container with a visible border.
|
|
14
|
+
* - `"no-border"` renders without a border.
|
|
15
|
+
*/
|
|
2
16
|
export type ToggleStyleType = "default" | "no-border";
|
|
17
|
+
/**
|
|
18
|
+
* Props for the `Toggle` selection control.
|
|
19
|
+
*/
|
|
3
20
|
export interface ToggleProps extends React.AriaAttributes, React.DOMAttributes<HTMLInputElement> {
|
|
4
21
|
/**
|
|
5
|
-
*
|
|
22
|
+
* Determines selection behavior and the indicator icon style.
|
|
6
23
|
*
|
|
7
|
-
* "checkbox"
|
|
8
|
-
*
|
|
9
|
-
* "radio", "yes", "no" - does not allow deselection. However they
|
|
10
|
-
* will determine the indicator to be displayed
|
|
24
|
+
* @default "checkbox"
|
|
11
25
|
*/
|
|
12
26
|
type?: ToggleType | undefined;
|
|
13
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Whether to render the selection indicator icon inside the toggle.
|
|
29
|
+
*
|
|
30
|
+
* The icon shape depends on `type`:
|
|
31
|
+
* - `"checkbox"` renders a tick box.
|
|
32
|
+
* - `"radio"` renders a filled circle.
|
|
33
|
+
* - `"yes"` renders a tick.
|
|
34
|
+
* - `"no"` renders a cross.
|
|
35
|
+
*/
|
|
14
36
|
indicator?: boolean | undefined;
|
|
15
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Controlled checked state of the toggle.
|
|
39
|
+
*/
|
|
16
40
|
checked?: boolean | undefined;
|
|
17
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Visual presentation of the toggle container.
|
|
43
|
+
*
|
|
44
|
+
* @default "default"
|
|
45
|
+
*/
|
|
18
46
|
styleType?: ToggleStyleType | undefined;
|
|
19
|
-
/**
|
|
47
|
+
/** Label content for the toggle. */
|
|
20
48
|
children: React.ReactNode;
|
|
21
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Maximum number of visible label lines at each breakpoint.
|
|
51
|
+
*
|
|
52
|
+
* Lines beyond the limit are truncated with an ellipsis. Omit a
|
|
53
|
+
* breakpoint key to leave that viewport unconstrained.
|
|
54
|
+
*/
|
|
22
55
|
childrenMaxLines?: {
|
|
23
56
|
mobile?: number | undefined;
|
|
24
57
|
desktop?: number | undefined;
|
|
25
58
|
tablet?: number | undefined;
|
|
26
59
|
} | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Secondary content rendered below the main label.
|
|
62
|
+
*/
|
|
27
63
|
subLabel?: (() => JSX.Element) | JSX.Element | string | undefined;
|
|
28
64
|
disabled?: boolean | undefined;
|
|
29
|
-
/**
|
|
65
|
+
/** Renders the input in an error state. */
|
|
30
66
|
error?: boolean | undefined;
|
|
31
67
|
className?: string | undefined;
|
|
32
68
|
name?: string | undefined;
|
|
33
69
|
id?: string | undefined;
|
|
34
70
|
"data-testid"?: string | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Called when the toggle selection state changes.
|
|
73
|
+
*
|
|
74
|
+
* When provided, the caller is responsible for reflecting
|
|
75
|
+
* the new value back via `checked`.
|
|
76
|
+
*/
|
|
35
77
|
onChange?: ((event: React.ChangeEvent<HTMLInputElement>) => void) | undefined;
|
|
36
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* Optional collapsible body section rendered below the toggle label.
|
|
80
|
+
*
|
|
81
|
+
* The section automatically expands when the toggle becomes selected.
|
|
82
|
+
*/
|
|
37
83
|
compositeSection?: ToggleCompositeSectionProps | undefined;
|
|
38
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Renders a "Remove" button alongside the label.
|
|
86
|
+
*
|
|
87
|
+
* Clicking the button calls `onRemove` when the toggle is not disabled.
|
|
88
|
+
*/
|
|
39
89
|
removable?: boolean | undefined;
|
|
90
|
+
/** Called when the remove button is clicked and the toggle is not disabled. */
|
|
40
91
|
onRemove?: (() => void) | undefined;
|
|
41
|
-
/**
|
|
92
|
+
/** Constrains the toggle width to its content rather than filling the container. */
|
|
42
93
|
useContentWidth?: boolean | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Keeps the toggle keyboard-focusable when `disabled` is `true`.
|
|
96
|
+
*
|
|
97
|
+
* When set alongside `disabled`, the native `disabled` attribute is omitted
|
|
98
|
+
* in favor of `aria-disabled="true"` and `tabIndex={0}`, keeping the element
|
|
99
|
+
* keyboard-reachable. `onChange` is still suppressed.
|
|
100
|
+
*/
|
|
43
101
|
focusableWhenDisabled?: boolean | undefined;
|
|
44
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Configuration for the collapsible body section attached to a `Toggle`.
|
|
105
|
+
*/
|
|
45
106
|
export interface ToggleCompositeSectionProps {
|
|
107
|
+
/** Content rendered inside the composite section body. */
|
|
46
108
|
children: React.ReactNode;
|
|
47
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Whether the section can be collapsed and expanded by the user.
|
|
111
|
+
*
|
|
112
|
+
* @default true
|
|
113
|
+
*/
|
|
48
114
|
collapsible?: boolean | undefined;
|
|
49
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* Whether the composite section starts in the expanded state.
|
|
117
|
+
*
|
|
118
|
+
* When the toggle becomes selected, the section automatically expands
|
|
119
|
+
* regardless of this value. Only applies when `collapsible` is `true`.
|
|
120
|
+
*
|
|
121
|
+
* @default false
|
|
122
|
+
*/
|
|
50
123
|
initialExpanded?: boolean | undefined;
|
|
51
|
-
/**
|
|
124
|
+
/**
|
|
125
|
+
* Errors shown in an alert banner when the section is collapsed.
|
|
126
|
+
*
|
|
127
|
+
* Pass a `string[]` to render a titled error list, or a `JSX.Element`
|
|
128
|
+
* for a custom error presentation.
|
|
129
|
+
*/
|
|
52
130
|
errors?: string[] | JSX.Element | undefined;
|
|
53
131
|
}
|
package/typography/index.d.ts
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A collection of pre-styled text components covering headings, body copy, and
|
|
3
|
+
* hyperlinks.
|
|
4
|
+
*
|
|
5
|
+
* Use `Typography` sub-components to render consistently sized and weighted
|
|
6
|
+
* text.
|
|
7
|
+
*
|
|
8
|
+
* Sub-components:
|
|
9
|
+
* - Heading variants (`HeadingXXL` through `HeadingXS`) render semantic heading elements by default.
|
|
10
|
+
* - Body variants (`BodyBL`, `BodyMD`, `BodySM`, `BodyXS`) render `p` elements.
|
|
11
|
+
* - Link variants (`LinkBL`, `LinkMD`, `LinkSM`, `LinkXS`) render `a` elements .
|
|
12
|
+
*
|
|
13
|
+
* @remarks All text variants accept an `as` prop to
|
|
14
|
+
* override the rendered element for semantic flexibility.
|
|
15
|
+
*/
|
|
1
16
|
export declare const Typography: {
|
|
17
|
+
/** Renders the largest heading (`h1`). */
|
|
2
18
|
HeadingXXL: (props: Omit<any, "ref"> & {
|
|
3
19
|
weight?: import("./types").TypographyWeight | undefined;
|
|
4
20
|
inline?: boolean | undefined;
|
|
@@ -6,6 +22,7 @@ export declare const Typography: {
|
|
|
6
22
|
maxLines?: number | undefined;
|
|
7
23
|
as?: import("react").ElementType<any> | undefined;
|
|
8
24
|
} & import("react").RefAttributes<HTMLHeadingElement>) => React.ReactElement | null;
|
|
25
|
+
/** Renders an extra-large heading (`h2`). */
|
|
9
26
|
HeadingXL: (props: Omit<any, "ref"> & {
|
|
10
27
|
weight?: import("./types").TypographyWeight | undefined;
|
|
11
28
|
inline?: boolean | undefined;
|
|
@@ -13,6 +30,7 @@ export declare const Typography: {
|
|
|
13
30
|
maxLines?: number | undefined;
|
|
14
31
|
as?: import("react").ElementType<any> | undefined;
|
|
15
32
|
} & import("react").RefAttributes<HTMLHeadingElement>) => React.ReactElement | null;
|
|
33
|
+
/** Renders a large heading (`h3`). */
|
|
16
34
|
HeadingLG: (props: Omit<any, "ref"> & {
|
|
17
35
|
weight?: import("./types").TypographyWeight | undefined;
|
|
18
36
|
inline?: boolean | undefined;
|
|
@@ -20,6 +38,7 @@ export declare const Typography: {
|
|
|
20
38
|
maxLines?: number | undefined;
|
|
21
39
|
as?: import("react").ElementType<any> | undefined;
|
|
22
40
|
} & import("react").RefAttributes<HTMLHeadingElement>) => React.ReactElement | null;
|
|
41
|
+
/** Renders a medium heading (`h4`). */
|
|
23
42
|
HeadingMD: (props: Omit<any, "ref"> & {
|
|
24
43
|
weight?: import("./types").TypographyWeight | undefined;
|
|
25
44
|
inline?: boolean | undefined;
|
|
@@ -27,6 +46,7 @@ export declare const Typography: {
|
|
|
27
46
|
maxLines?: number | undefined;
|
|
28
47
|
as?: import("react").ElementType<any> | undefined;
|
|
29
48
|
} & import("react").RefAttributes<HTMLHeadingElement>) => React.ReactElement | null;
|
|
49
|
+
/** Renders a small heading (`h5`). */
|
|
30
50
|
HeadingSM: (props: Omit<any, "ref"> & {
|
|
31
51
|
weight?: import("./types").TypographyWeight | undefined;
|
|
32
52
|
inline?: boolean | undefined;
|
|
@@ -34,6 +54,7 @@ export declare const Typography: {
|
|
|
34
54
|
maxLines?: number | undefined;
|
|
35
55
|
as?: import("react").ElementType<any> | undefined;
|
|
36
56
|
} & import("react").RefAttributes<HTMLHeadingElement>) => React.ReactElement | null;
|
|
57
|
+
/** Renders the smallest heading (`h6`). */
|
|
37
58
|
HeadingXS: (props: Omit<any, "ref"> & {
|
|
38
59
|
weight?: import("./types").TypographyWeight | undefined;
|
|
39
60
|
inline?: boolean | undefined;
|
|
@@ -41,6 +62,7 @@ export declare const Typography: {
|
|
|
41
62
|
maxLines?: number | undefined;
|
|
42
63
|
as?: import("react").ElementType<any> | undefined;
|
|
43
64
|
} & import("react").RefAttributes<HTMLHeadingElement>) => React.ReactElement | null;
|
|
65
|
+
/** Renders baseline body text (`p`). */
|
|
44
66
|
BodyBL: (props: Omit<any, "ref"> & {
|
|
45
67
|
weight?: import("./types").TypographyWeight | undefined;
|
|
46
68
|
inline?: boolean | undefined;
|
|
@@ -48,6 +70,7 @@ export declare const Typography: {
|
|
|
48
70
|
maxLines?: number | undefined;
|
|
49
71
|
as?: import("react").ElementType<any> | undefined;
|
|
50
72
|
} & import("react").RefAttributes<HTMLParagraphElement>) => React.ReactElement | null;
|
|
73
|
+
/** Renders medium body text (`p`). */
|
|
51
74
|
BodyMD: (props: Omit<any, "ref"> & {
|
|
52
75
|
weight?: import("./types").TypographyWeight | undefined;
|
|
53
76
|
inline?: boolean | undefined;
|
|
@@ -55,6 +78,7 @@ export declare const Typography: {
|
|
|
55
78
|
maxLines?: number | undefined;
|
|
56
79
|
as?: import("react").ElementType<any> | undefined;
|
|
57
80
|
} & import("react").RefAttributes<HTMLParagraphElement>) => React.ReactElement | null;
|
|
81
|
+
/** Renders small body text (`p`). */
|
|
58
82
|
BodySM: (props: Omit<any, "ref"> & {
|
|
59
83
|
weight?: import("./types").TypographyWeight | undefined;
|
|
60
84
|
inline?: boolean | undefined;
|
|
@@ -62,6 +86,7 @@ export declare const Typography: {
|
|
|
62
86
|
maxLines?: number | undefined;
|
|
63
87
|
as?: import("react").ElementType<any> | undefined;
|
|
64
88
|
} & import("react").RefAttributes<HTMLParagraphElement>) => React.ReactElement | null;
|
|
89
|
+
/** Renders extra-small body text (`p`). */
|
|
65
90
|
BodyXS: (props: Omit<any, "ref"> & {
|
|
66
91
|
weight?: import("./types").TypographyWeight | undefined;
|
|
67
92
|
inline?: boolean | undefined;
|
|
@@ -69,9 +94,13 @@ export declare const Typography: {
|
|
|
69
94
|
maxLines?: number | undefined;
|
|
70
95
|
as?: import("react").ElementType<any> | undefined;
|
|
71
96
|
} & import("react").RefAttributes<HTMLParagraphElement>) => React.ReactElement | null;
|
|
97
|
+
/** Renders a baseline-size hyperlink (`a`). */
|
|
72
98
|
LinkBL: (props: import("./types").TypographyLinkProps & import("react").RefAttributes<HTMLAnchorElement>) => React.ReactElement | null;
|
|
99
|
+
/** Renders a medium-size hyperlink (`a`). */
|
|
73
100
|
LinkMD: (props: import("./types").TypographyLinkProps & import("react").RefAttributes<HTMLAnchorElement>) => React.ReactElement | null;
|
|
101
|
+
/** Renders a small-size hyperlink (`a`). */
|
|
74
102
|
LinkSM: (props: import("./types").TypographyLinkProps & import("react").RefAttributes<HTMLAnchorElement>) => React.ReactElement | null;
|
|
103
|
+
/** Renders an extra-small hyperlink (`a`). */
|
|
75
104
|
LinkXS: (props: import("./types").TypographyLinkProps & import("react").RefAttributes<HTMLAnchorElement>) => React.ReactElement | null;
|
|
76
105
|
};
|
|
77
106
|
export * from "./types";
|
package/typography/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/typography/index.ts"],"sourcesContent":["import {\n BodyBL,\n BodyMD,\n BodySM,\n BodyXS,\n HeadingLG,\n HeadingMD,\n HeadingSM,\n HeadingXL,\n HeadingXS,\n HeadingXXL,\n LinkBL,\n LinkMD,\n LinkSM,\n LinkXS,\n} from \"./typography\";\n\nexport const Typography = {\n HeadingXXL,\n HeadingXL,\n HeadingLG,\n HeadingMD,\n HeadingSM,\n HeadingXS,\n BodyBL,\n BodyMD,\n BodySM,\n BodyXS,\n LinkBL,\n LinkMD,\n LinkSM,\n LinkXS,\n};\n\nexport * from \"./types\";\n"],"names":["Typography","HeadingXXL","HeadingXL","HeadingLG","HeadingMD","HeadingSM","HeadingXS","BodyBL","BodyMD","BodySM","BodyXS","LinkBL","LinkMD","LinkSM","LinkXS"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/typography/index.ts"],"sourcesContent":["import {\n BodyBL,\n BodyMD,\n BodySM,\n BodyXS,\n HeadingLG,\n HeadingMD,\n HeadingSM,\n HeadingXL,\n HeadingXS,\n HeadingXXL,\n LinkBL,\n LinkMD,\n LinkSM,\n LinkXS,\n} from \"./typography\";\n\n/**\n * A collection of pre-styled text components covering headings, body copy, and\n * hyperlinks.\n *\n * Use `Typography` sub-components to render consistently sized and weighted\n * text.\n *\n * Sub-components:\n * - Heading variants (`HeadingXXL` through `HeadingXS`) render semantic heading elements by default.\n * - Body variants (`BodyBL`, `BodyMD`, `BodySM`, `BodyXS`) render `p` elements.\n * - Link variants (`LinkBL`, `LinkMD`, `LinkSM`, `LinkXS`) render `a` elements .\n *\n * @remarks All text variants accept an `as` prop to\n * override the rendered element for semantic flexibility.\n */\nexport const Typography = {\n /** Renders the largest heading (`h1`). */\n HeadingXXL,\n /** Renders an extra-large heading (`h2`). */\n HeadingXL,\n /** Renders a large heading (`h3`). */\n HeadingLG,\n /** Renders a medium heading (`h4`). */\n HeadingMD,\n /** Renders a small heading (`h5`). */\n HeadingSM,\n /** Renders the smallest heading (`h6`). */\n HeadingXS,\n /** Renders baseline body text (`p`). */\n BodyBL,\n /** Renders medium body text (`p`). */\n BodyMD,\n /** Renders small body text (`p`). */\n BodySM,\n /** Renders extra-small body text (`p`). */\n BodyXS,\n /** Renders a baseline-size hyperlink (`a`). */\n LinkBL,\n /** Renders a medium-size hyperlink (`a`). */\n LinkMD,\n /** Renders a small-size hyperlink (`a`). */\n LinkSM,\n /** Renders an extra-small hyperlink (`a`). */\n LinkXS,\n};\n\nexport * from \"./types\";\n"],"names":["Typography","HeadingXXL","HeadingXL","HeadingLG","HeadingMD","HeadingSM","HeadingXS","BodyBL","BodyMD","BodySM","BodyXS","LinkBL","LinkMD","LinkSM","LinkXS"],"mappings":"wNAgCO,MAAMA,EAAa,CAEtBC,aAEAC,YAEAC,YAEAC,YAEAC,YAEAC,YAEAC,SAEAC,SAEAC,SAEAC,SAEAC,SAEAC,SAEAC,SAEAC"}
|
package/typography/types.d.ts
CHANGED
|
@@ -1,24 +1,67 @@
|
|
|
1
1
|
import type { FontSize } from "../theme";
|
|
2
|
+
/** Font weight variant applied to a typography element. */
|
|
2
3
|
export type TypographyWeight = "regular" | "semibold" | "bold" | "light";
|
|
4
|
+
/**
|
|
5
|
+
* Text size token for a typography element.
|
|
6
|
+
*/
|
|
3
7
|
export type TypographySize = Exclude<FontSize, "form-label" | "form-description">;
|
|
8
|
+
/**
|
|
9
|
+
* Props shared by all non-link typography variants.
|
|
10
|
+
*
|
|
11
|
+
* The generic `T` narrows the element type for the `as` prop and ensures
|
|
12
|
+
* forwarded HTML attributes match the rendered element.
|
|
13
|
+
*/
|
|
4
14
|
export type TypographyProps<T extends React.ElementType = React.ElementType> = React.ComponentPropsWithoutRef<T> & {
|
|
5
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Font weight of the rendered text.
|
|
17
|
+
*
|
|
18
|
+
* @default "regular"
|
|
19
|
+
*/
|
|
6
20
|
weight?: TypographyWeight | undefined;
|
|
7
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Renders the element as an inline `span`. When `true`, the `as` prop
|
|
23
|
+
* is ignored and `maxLines` clamping is disabled.
|
|
24
|
+
*/
|
|
8
25
|
inline?: boolean | undefined;
|
|
9
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Adds a bottom margin to separate the element from following content.
|
|
28
|
+
*/
|
|
10
29
|
paragraph?: boolean | undefined;
|
|
11
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Clamps visible text to the given number of lines, truncating the
|
|
32
|
+
* remainder.
|
|
33
|
+
*
|
|
34
|
+
* @remarks Has no effect when `inline` is `true`.
|
|
35
|
+
*/
|
|
12
36
|
maxLines?: number | undefined;
|
|
13
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Overrides the rendered HTML element, e.g. `"h2"`.
|
|
39
|
+
*
|
|
40
|
+
* @remarks Has no effect when `inline` is `true`.
|
|
41
|
+
*/
|
|
14
42
|
as?: T | undefined;
|
|
15
43
|
};
|
|
44
|
+
/** Text-decoration style applied to a link typography element. */
|
|
16
45
|
export type TypographyUnderlineStyle = "none" | "underline";
|
|
46
|
+
/**
|
|
47
|
+
* Props for all link typography variants.
|
|
48
|
+
*/
|
|
17
49
|
export interface TypographyLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
18
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Font weight of the link text.
|
|
52
|
+
*
|
|
53
|
+
* @default "regular"
|
|
54
|
+
*/
|
|
19
55
|
weight?: TypographyWeight | undefined;
|
|
20
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Appends an external-link icon after the link text to signal that the
|
|
58
|
+
* destination is outside the current site.
|
|
59
|
+
*/
|
|
21
60
|
external?: boolean | undefined;
|
|
22
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Text-decoration style for the link.
|
|
63
|
+
*
|
|
64
|
+
* @default "underline"
|
|
65
|
+
*/
|
|
23
66
|
underlineStyle?: TypographyUnderlineStyle | undefined;
|
|
24
67
|
}
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
export * from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A read-only summary section for displaying labeled field values.
|
|
4
|
+
*
|
|
5
|
+
* Use `UneditableSection` to present a group of non-editable field–value pairs
|
|
6
|
+
* in a responsive grid layout
|
|
7
|
+
*
|
|
8
|
+
* Sub-components:
|
|
9
|
+
* - `UneditableSection.Item` — a standalone labeled read-only field with optional masking.
|
|
10
|
+
* - `UneditableSection.ItemSection` — a standalone grid list for composing items.
|
|
11
|
+
*/
|
|
2
12
|
export declare const UneditableSection: ((props: import("./types").UneditableSectionProps & import("react").RefAttributes<HTMLDivElement>) => React.ReactElement | null) & {
|
|
13
|
+
/**
|
|
14
|
+
* A standalone grid list for rendering `UneditableSection.Item` elements
|
|
15
|
+
* outside the full section wrapper.
|
|
16
|
+
*/
|
|
3
17
|
ItemSection: (props: import("./types").UneditableSectionItemSectionProps & import("react").RefAttributes<HTMLUListElement>) => React.ReactElement | null;
|
|
18
|
+
/** A standalone labeled read-only field with optional masking support. */
|
|
4
19
|
Item: ({ label, value, displayWidth, maskState, maskLoadingState, maskChar, maskRange, unmaskRange, maskRegex, disableMaskUnmask, alert, maskTransformer, onMask, onUnmask, onTryAgain, fullWidth, }: import("./section-item").UneditableSectionItemComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/uneditable-section/index.ts"],"sourcesContent":["import { UneditableItemSection } from \"./item-section\";\nimport { UneditableSectionItem } from \"./section-item\";\nimport { UneditableSectionBase } from \"./uneditable-section\";\n\nexport * from \"./types\";\nexport const UneditableSection = Object.assign(UneditableSectionBase, {\n ItemSection: UneditableItemSection,\n Item: UneditableSectionItem,\n});\n"],"names":["UneditableSection","Object","assign","UneditableSectionBase","ItemSection","UneditableItemSection","Item","UneditableSectionItem"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/uneditable-section/index.ts"],"sourcesContent":["import { UneditableItemSection } from \"./item-section\";\nimport { UneditableSectionItem } from \"./section-item\";\nimport { UneditableSectionBase } from \"./uneditable-section\";\n\nexport * from \"./types\";\n\n/**\n * A read-only summary section for displaying labeled field values.\n *\n * Use `UneditableSection` to present a group of non-editable field–value pairs\n * in a responsive grid layout\n *\n * Sub-components:\n * - `UneditableSection.Item` — a standalone labeled read-only field with optional masking.\n * - `UneditableSection.ItemSection` — a standalone grid list for composing items.\n */\nexport const UneditableSection = Object.assign(UneditableSectionBase, {\n /**\n * A standalone grid list for rendering `UneditableSection.Item` elements\n * outside the full section wrapper.\n */\n ItemSection: UneditableItemSection,\n /** A standalone labeled read-only field with optional masking support. */\n Item: UneditableSectionItem,\n});\n"],"names":["UneditableSection","Object","assign","UneditableSectionBase","ItemSection","UneditableItemSection","Item","UneditableSectionItem"],"mappings":"0LAgBaA,EAAoBC,OAAOC,OAAOC,EAAuB,CAKlEC,YAAaC,EAEbC,KAAMC"}
|