@lifesg/react-design-system 4.0.0-alpha.4 → 4.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/accordion-item.styles_1j4eb32.css +2 -2
- package/accordion/accordion.d.ts +19 -0
- package/accordion/accordion.js.map +1 -1
- package/accordion/accordion.styles_bzrfrs.css +2 -2
- package/accordion/types.d.ts +42 -2
- package/alert/alert.d.ts +8 -0
- package/alert/alert.js.map +1 -1
- package/alert/alert.styles_patwo2.css +2 -2
- package/alert/types.d.ts +26 -2
- package/animations/loading-dots/loading-dots.styles_1rgrrmw.css +2 -2
- package/animations/loading-dots/lottie-animation.styles_1m15v69.css +1 -1
- package/animations/loading-dots-spinner/loading-dots-spinner.styles_1hcqkhs.css +2 -2
- package/animations/loading-dots-spinner/lottie-animation.styles_13d1unb.css +1 -1
- package/animations/loading-spinner/loading-spinner.styles_n6xoft.css +2 -2
- package/animations/loading-spinner/lottie-animation.styles_bnn4qt.css +1 -1
- package/avatar/avatar.d.ts +7 -0
- package/avatar/avatar.js.map +1 -1
- package/avatar/avatar.styles_16efw4.css +2 -2
- package/avatar/types.d.ts +11 -0
- package/badge/badge.d.ts +7 -0
- package/badge/badge.js.map +1 -1
- package/badge/badge.styles_1c3c6wj.css +2 -2
- package/badge/types.d.ts +20 -0
- package/box-container/box-container.d.ts +8 -0
- package/box-container/box-container.js.map +1 -1
- package/box-container/box-container.styles_5t2j9k.css +2 -2
- package/box-container/types.d.ts +24 -0
- package/breadcrumb/breadcrumb.styles_1nl4aua.css +2 -2
- package/button/button.styles_1pxy0co.css +2 -2
- package/calendar/calendar.styles_11ho5x8.css +2 -2
- package/card/card.styles_1gh9gs3.css +2 -2
- package/checkbox/checkbox.styles_gm5bu1.css +2 -2
- package/cjs/accordion/accordion-item.styles_1j4eb32.css +2 -2
- package/cjs/accordion/accordion.js.map +1 -1
- package/cjs/accordion/accordion.styles_bzrfrs.css +2 -2
- package/cjs/alert/alert.js.map +1 -1
- package/cjs/alert/alert.styles_patwo2.css +2 -2
- package/cjs/animations/loading-dots/loading-dots.styles_1rgrrmw.css +2 -2
- package/cjs/animations/loading-dots/lottie-animation.styles_1m15v69.css +1 -1
- package/cjs/animations/loading-dots-spinner/loading-dots-spinner.styles_1hcqkhs.css +2 -2
- package/cjs/animations/loading-dots-spinner/lottie-animation.styles_13d1unb.css +1 -1
- package/cjs/animations/loading-spinner/loading-spinner.styles_n6xoft.css +2 -2
- package/cjs/animations/loading-spinner/lottie-animation.styles_bnn4qt.css +1 -1
- package/cjs/avatar/avatar.js.map +1 -1
- package/cjs/avatar/avatar.styles_16efw4.css +2 -2
- package/cjs/badge/badge.js.map +1 -1
- package/cjs/badge/badge.styles_1c3c6wj.css +2 -2
- package/cjs/box-container/box-container.js.map +1 -1
- package/cjs/box-container/box-container.styles_5t2j9k.css +2 -2
- package/cjs/breadcrumb/breadcrumb.styles_1nl4aua.css +2 -2
- package/cjs/button/button.styles_1pxy0co.css +2 -2
- package/cjs/calendar/calendar.styles_11ho5x8.css +2 -2
- package/cjs/card/card.styles_1gh9gs3.css +2 -2
- package/cjs/checkbox/checkbox.styles_gm5bu1.css +2 -2
- package/cjs/countdown-timer/countdown-timer.js.map +1 -1
- package/cjs/countdown-timer/countdown-timer.styles_ipn1b0.css +2 -2
- package/cjs/dashed-border/dashed-border.js.map +1 -1
- package/cjs/dashed-border/dashed-border.styles_zszoox.css +2 -2
- package/cjs/data-table/data-table.js.map +1 -1
- package/cjs/data-table/data-table.styles_1iqq1g7.css +2 -2
- package/cjs/date-input/date-input.js.map +1 -1
- package/cjs/date-input/date-input.styles_1r5kcc7.css +1 -1
- package/cjs/date-navigator/date-navigator.js.map +1 -1
- package/cjs/date-navigator/date-navigator.styles_wokh56.css +2 -2
- package/cjs/date-range-input/date-range-input.js.map +1 -1
- package/cjs/date-range-input/date-range-input.styles_1s7ojnj.css +2 -2
- package/cjs/divider/divider.js.map +1 -1
- package/cjs/divider/divider.styles_1xpzh8p.css +2 -2
- package/cjs/drawer/drawer.js.map +1 -1
- package/cjs/drawer/drawer.styles_94hx3y.css +2 -2
- package/cjs/e-signature/e-signature-canvas.js +1 -1
- package/cjs/e-signature/e-signature-canvas.js.map +1 -1
- package/cjs/e-signature/e-signature.js.map +1 -1
- package/cjs/e-signature/e-signature.styles_lukd9f.css +2 -2
- package/cjs/error-display/error-display.js.map +1 -1
- package/cjs/error-display/error-display.styles_d3tql1.css +2 -2
- package/cjs/external/dompurify/dist/purify.es.js +3 -3
- package/cjs/external/dompurify/dist/purify.es.js.map +1 -1
- package/cjs/feedback-rating/feedback-rating-stars-container.styles_dmi8z9.css +2 -2
- package/cjs/feedback-rating/feedback-rating.js.map +1 -1
- package/cjs/feedback-rating/feedback-rating.styles_1kdklb6.css +2 -2
- package/cjs/file-download/file-download.js.map +1 -1
- package/cjs/file-download/file-download.styles_iggk8q.css +2 -2
- package/cjs/file-download/file-list-card/file-list-card.styles.js +1 -1
- package/cjs/file-download/file-list-card/file-list-card.styles.js.map +1 -1
- package/cjs/file-download/file-list-card/{file-list-card.styles_oom8ii.css → file-list-card.styles_18j2gut.css} +3 -3
- package/cjs/file-upload/dropzone.styles_1pllsau.css +2 -2
- package/cjs/file-upload/file-item-edit.js +1 -1
- package/cjs/file-upload/file-item-edit.js.map +1 -1
- package/cjs/file-upload/file-item-edit.styles.js +1 -1
- package/cjs/file-upload/file-item-edit.styles.js.map +1 -1
- package/cjs/file-upload/{file-item-edit.styles_1qbpbxj.css → file-item-edit.styles_19bvztn.css} +6 -5
- package/cjs/file-upload/file-list/file-list.js +1 -1
- package/cjs/file-upload/file-list/file-list.js.map +1 -1
- package/cjs/file-upload/file-list/file-list.styles.js +1 -1
- package/cjs/file-upload/file-list/file-list.styles.js.map +1 -1
- package/cjs/file-upload/file-list/file-list.styles_1w7so98.css +3 -0
- package/cjs/file-upload/file-list-item/file-list-item-thumbnail.styles_1y4si19.css +2 -2
- package/cjs/file-upload/file-list-item/file-list-item.js +1 -1
- package/cjs/file-upload/file-list-item/file-list-item.js.map +1 -1
- package/cjs/file-upload/file-list-item/file-list-item.styles.js +1 -1
- package/cjs/file-upload/file-list-item/file-list-item.styles.js.map +1 -1
- package/cjs/file-upload/file-list-item/file-list-item.styles_o8000f.css +17 -0
- package/cjs/file-upload/file-upload.js +1 -1
- package/cjs/file-upload/file-upload.js.map +1 -1
- package/cjs/file-upload/file-upload.styles_9ffwcd.css +2 -2
- package/cjs/filter/addons/filter-item-checkbox.styles_7degw7.css +2 -2
- package/cjs/filter/filter-item-page.styles_17ewfrz.css +1 -1
- package/cjs/filter/filter-item.js.map +1 -1
- package/cjs/filter/filter-item.styles_cphjnj.css +2 -2
- package/cjs/filter/filter-modal.styles_qw3xlg.css +2 -2
- package/cjs/filter/filter-sidebar.styles_1otwpjl.css +2 -2
- package/cjs/filter/filter.js.map +1 -1
- package/cjs/filter/filter.styles_1ykijwm.css +2 -2
- package/cjs/footer/footer-download-app.styles_1v1j2us.css +2 -2
- package/cjs/footer/footer-resource-addon.styles_1jepb1d.css +2 -2
- package/cjs/footer/footer.js +1 -1
- package/cjs/footer/footer.js.map +1 -1
- package/cjs/footer/footer.styles_1msorhc.css +2 -2
- package/cjs/form/form-label-addon.styles_b00z8p.css +1 -1
- package/cjs/form/form-label.styles.js +1 -1
- package/cjs/form/form-label.styles.js.map +1 -1
- package/cjs/form/{form-label.styles_11r0652.css → form-label.styles_1nbe0bm.css} +2 -2
- package/cjs/form/form-textarea.styles_3p9qoy.css +2 -2
- package/cjs/form/form-wrapper.styles_199rslu.css +1 -1
- package/cjs/fullscreen-image-carousel/fullscreen-image-carousel.styles_vc6y5c.css +2 -2
- package/cjs/fullscreen-image-carousel/stateful-image.styles_1xe8ypm.css +2 -2
- package/cjs/histogram-slider/histogram-slider.styles_wvd4w.css +2 -2
- package/cjs/image-button/image-button.styles_6n1qsr.css +2 -2
- package/cjs/index.js +1 -1
- package/cjs/input/input.styles_1cblor0.css +2 -2
- package/cjs/input-group/input-group-list-addon.styles_17iuqtw.css +2 -2
- package/cjs/input-group/input-group.styles_bqye6f.css +2 -2
- package/cjs/input-range-select/input-range-select.styles_adbrbm.css +2 -2
- package/cjs/input-range-slider/input-range-slider.styles_aljl2v.css +2 -2
- package/cjs/input-textarea/textarea-counter.styles_1n3wsnv.css +1 -1
- package/cjs/input-textarea/textarea.styles_22z4n3.css +2 -2
- package/cjs/language-switcher/dropdown-panel.styles_1qsjf8d.css +2 -2
- package/cjs/language-switcher/dropdown-variant.styles_1vrdfky.css +2 -2
- package/cjs/language-switcher/link-container-variant.styles_1iw6zux.css +2 -2
- package/cjs/layout/col-div.styles_16o6mwx.css +1 -1
- package/cjs/layout/container.styles_v70ec6.css +2 -2
- package/cjs/layout/section.styles_hstcaf.css +1 -1
- package/cjs/link-list/link-list.styles_m57vks.css +2 -2
- package/cjs/local-nav/local-nav-dropdown/local-nav-dropdown.styles_uhd4xl.css +2 -2
- package/cjs/local-nav/local-nav-menu/local-nav-menu.styles_pq19dh.css +2 -2
- package/cjs/markup/markup.style_1iu40x9.css +2 -2
- package/cjs/masked-input/masked-input.styles_1cm388a.css +2 -2
- package/cjs/masthead/masthead.styles_1huzon9.css +2 -2
- package/cjs/menu/menu-content.styles_p7ijll.css +2 -2
- package/cjs/menu/menu-item.styles_liyed8.css +2 -2
- package/cjs/menu/menu-link.styles_hfxoez.css +2 -2
- package/cjs/menu/menu-section.styles_g7my4d.css +2 -2
- package/cjs/modal/modal-box.styles_y52cts.css +2 -2
- package/cjs/modal/modal.styles_1lbblx6.css +2 -2
- package/cjs/modal-v2/modal-v2.styles_a8gv5i.css +2 -2
- package/cjs/modal-v2/slots/slot-styles_13sd376.css +2 -2
- package/cjs/navbar/brand.styles_zcgddp.css +1 -1
- package/cjs/navbar/drawer.js +1 -1
- package/cjs/navbar/drawer.js.map +1 -1
- package/cjs/navbar/drawer.styles_7hnxp5.css +2 -2
- package/cjs/navbar/menu.styles_gdpqc.css +2 -2
- package/cjs/navbar/navbar-action-buttons.styles_1vpm0nk.css +2 -2
- package/cjs/navbar/navbar-items.styles_1i3ltot.css +2 -2
- package/cjs/navbar/navbar.js +1 -1
- package/cjs/navbar/navbar.js.map +1 -1
- package/cjs/navbar/navbar.styles_koy0c7.css +2 -2
- package/cjs/notification-banner/notification-banner.styles_uxlysy.css +2 -2
- package/cjs/otp-input/otp-input.styles_5sbutl.css +2 -2
- package/cjs/otp-verification/contact-input-section.styles_odrjvt.css +2 -2
- package/cjs/otp-verification/otp-verification.styles_dg9bm8.css +1 -1
- package/cjs/otp-verification/thumbnail/thumbnail.styles_shqylh.css +2 -2
- package/cjs/otp-verification/verification-section.styles_x8jj.css +2 -2
- package/cjs/overlay/overlay.js +1 -1
- package/cjs/overlay/overlay.js.map +1 -1
- package/cjs/overlay/overlay.styles_12wym18.css +2 -2
- package/cjs/pagination/pagination.styles_6bcgva.css +2 -2
- package/cjs/pill/pill.styles_xwrniu.css +2 -2
- package/cjs/popover/popover-inline/popover-inline.styles_bkopnt.css +2 -2
- package/cjs/popover/popover-trigger.styles_8zokig.css +1 -1
- package/cjs/popover/popover.styles_ujnf0h.css +2 -2
- package/cjs/progress-indicator/progress-indicator.styles_1c038s4.css +2 -2
- package/cjs/radio-button/radio-button.styles_1c4v6v.css +2 -2
- package/cjs/schedule/schedule-day-view/schedule-day-view.styles_8ti149.css +2 -2
- package/cjs/schedule/schedule-header/schedule-header.js +1 -1
- package/cjs/schedule/schedule-header/schedule-header.js.map +1 -1
- package/cjs/schedule/schedule-header/schedule-header.styles_1n2u5vj.css +2 -2
- package/cjs/schedule/schedule-week-view/schedule-week-view.styles_x7x50m.css +2 -2
- package/cjs/schedule/schedule-week-view/time-cell.styles_1sorjz8.css +2 -2
- package/cjs/schedule/schedule.styles_fdy5a1.css +2 -2
- package/cjs/schedule/shared/with-optional-popover.styles_7mv3p2.css +1 -1
- package/cjs/schedule/time-indicator/time-indicator.styles_1eaxyes.css +2 -2
- package/cjs/select-histogram/select-histogram.styles_n260dy.css +2 -2
- package/cjs/shared/accessibility/index_13g9vp.css +1 -1
- package/cjs/shared/clickable-icon/clickable-icon.styles_1v2imml.css +2 -2
- package/cjs/shared/component-loading-spinner/component-loading-spinner.styles_15eq02i.css +2 -2
- package/cjs/shared/dropdown-list/dropdown-label.styles_mloii0.css +2 -2
- package/cjs/shared/dropdown-list/dropdown-list.styles_konwm.css +2 -2
- package/cjs/shared/dropdown-list/dropdown-search.styles_1hc1gkh.css +2 -2
- package/cjs/shared/dropdown-list/expandable-element.styles_rkkvqr.css +2 -2
- package/cjs/shared/dropdown-list/nested-dropdown-list.styles_wdhxoe.css +2 -2
- package/cjs/shared/dropdown-wrapper/dropdown-wrapper.styles_15hwwoj.css +2 -2
- package/cjs/shared/fade-wrapper/fade-wrapper.styles_16iug7l.css +2 -2
- package/cjs/shared/image-placeholder/image-placeholder.styles_44nwil.css +1 -1
- package/cjs/shared/input-wrapper/input-wrapper.styles_je6maw.css +2 -2
- package/cjs/shared/internal-calendar/calendar-dropdown.styles_wybjai.css +1 -1
- package/cjs/shared/internal-calendar/calendar-manager.js +1 -1
- package/cjs/shared/internal-calendar/calendar-manager.js.map +1 -1
- package/cjs/shared/internal-calendar/calendar-manager.styles.js +1 -1
- package/cjs/shared/internal-calendar/calendar-manager.styles.js.map +1 -1
- package/cjs/shared/internal-calendar/{calendar-manager.styles_1iuq5zw.css → calendar-manager.styles_1njwkj2.css} +3 -3
- package/cjs/shared/internal-calendar/day-cell/day-cell.styles_1t5oqc1.css +2 -2
- package/cjs/shared/internal-calendar/internal-calendar-month.styles_14oh57f.css +2 -2
- package/cjs/shared/internal-calendar/internal-calendar-year.styles_therlc.css +2 -2
- package/cjs/shared/internal-calendar/internal-calendar.styles_gnc3eq.css +1 -1
- package/cjs/shared/internal-calendar/standard/standard-calendar-day-view.styles_1bw26au.css +2 -2
- package/cjs/shared/progress-bar/progress-bar.styles_125ri7a.css +1 -1
- package/cjs/shared/range-input-inner-container/range-input-inner-container.styles_1v61utg.css +2 -2
- package/cjs/shared/standalone-date-input/standalone-date-input.styles_157qo89.css +2 -2
- package/cjs/shared/time-slot/time-slot.styles_18s0to7.css +2 -2
- package/cjs/shared/timepicker-dropdown/timepicker-dropdown.styles_119l6k6.css +2 -2
- package/cjs/sidenav/sidenav-drawer-item.styles_1ljnyx2.css +2 -2
- package/cjs/sidenav/sidenav-drawer-subitem.styles_2y58kf.css +1 -1
- package/cjs/sidenav/sidenav-group.styles_1x604sw.css +2 -2
- package/cjs/sidenav/sidenav-item.styles_lqw3kh.css +2 -2
- package/cjs/sidenav/sidenav.styles_1vxezie.css +2 -2
- package/cjs/singpass-button/singpass-button.styles_1miyex3.css +2 -2
- package/cjs/smart-app-banner/smart-app-banner.styles_15u6yv4.css +2 -2
- package/cjs/tab/tab-link-chain.styles_49got4.css +2 -2
- package/cjs/tab/tab.styles_1najffw.css +1 -1
- package/cjs/table/table.styles_1af5ipv.css +2 -2
- package/cjs/tag/tag.style_d98c53.css +2 -2
- package/cjs/text-list/text-list.styles_w3fvyt.css +2 -2
- package/cjs/theme/types.js +1 -1
- package/cjs/theme/types.js.map +1 -1
- package/cjs/theme/utils/use-design-token-override.js +2 -0
- package/cjs/theme/utils/use-design-token-override.js.map +1 -0
- package/cjs/time-range-picker/combobox-picker/combobox-picker.styles_7i9vso.css +1 -1
- package/cjs/time-range-picker/common.styles_1qwp4xa.css +2 -2
- package/cjs/time-slot-bar/time-slot-bar.styles_wigbyd.css +2 -2
- package/cjs/time-slot-bar-week/time-slot-bar-week-days.styles_evdvs9.css +2 -2
- package/cjs/time-slot-bar-week/time-slot-bar-week.styles_11ybf42.css +1 -1
- package/cjs/time-slot-week-view/time-slot-week-days.styles_1h21vyw.css +2 -2
- package/cjs/time-slot-week-view/time-slot-week-view.styles_gqgsw2.css +1 -1
- package/cjs/timeline/timeline.styles_1jxzik4.css +2 -2
- package/cjs/timepicker/timepicker.styles_1jm33yw.css +1 -1
- package/cjs/timetable/timetable-header/timetable-header.styles_11gl1h4.css +2 -2
- package/cjs/timetable/timetable-row/row-bar.styles_1x0vrsz.css +1 -1
- package/cjs/timetable/timetable-row/row-cell.styles_y1dl5j.css +2 -2
- package/cjs/timetable/timetable.styles_7rp8kz.css +2 -2
- package/cjs/toast/toast.styles_1e0l60w.css +2 -2
- package/cjs/toggle/toggle-icon.styles_ba71y.css +2 -2
- package/cjs/toggle/toggle.styles_1t5qrye.css +2 -2
- package/cjs/typography/typography-text.styles_1734x2k.css +2 -2
- package/cjs/typography/typography.styles.js +1 -1
- package/cjs/typography/typography.styles.js.map +1 -1
- package/cjs/typography/{typography.styles_1155j4c.css → typography.styles_1wd82dn.css} +2 -2
- package/cjs/uneditable-section/section-item.styles_mwx8ht.css +2 -2
- package/cjs/uneditable-section/uneditable-section.js +1 -1
- package/cjs/uneditable-section/uneditable-section.js.map +1 -1
- package/cjs/uneditable-section/uneditable-section.styles_aj9zun.css +2 -2
- package/cjs/unit-number/unit-number-input.styles_8yizj.css +2 -2
- package/countdown-timer/countdown-timer.d.ts +6 -0
- package/countdown-timer/countdown-timer.js.map +1 -1
- package/countdown-timer/countdown-timer.styles_ipn1b0.css +2 -2
- package/countdown-timer/types.d.ts +55 -11
- package/dashed-border/dashed-border.d.ts +6 -0
- package/dashed-border/dashed-border.js.map +1 -1
- package/dashed-border/dashed-border.styles_zszoox.css +2 -2
- package/dashed-border/types.d.ts +27 -5
- package/data-table/data-table.d.ts +8 -0
- package/data-table/data-table.js.map +1 -1
- package/data-table/data-table.styles_1iqq1g7.css +2 -2
- package/data-table/types.d.ts +58 -12
- package/date-input/date-input.d.ts +5 -0
- package/date-input/date-input.js.map +1 -1
- package/date-input/date-input.styles_1r5kcc7.css +1 -1
- package/date-input/types.d.ts +32 -16
- package/date-navigator/date-navigator.d.ts +6 -0
- package/date-navigator/date-navigator.js.map +1 -1
- package/date-navigator/date-navigator.styles_wokh56.css +2 -2
- package/date-navigator/types.d.ts +44 -7
- package/date-range-input/date-range-input.d.ts +4 -0
- package/date-range-input/date-range-input.js.map +1 -1
- package/date-range-input/date-range-input.styles_1s7ojnj.css +2 -2
- package/date-range-input/types.d.ts +50 -14
- package/divider/divider.d.ts +6 -0
- package/divider/divider.js.map +1 -1
- package/divider/divider.styles_1xpzh8p.css +2 -2
- package/divider/types.d.ts +27 -4
- package/drawer/drawer.d.ts +7 -0
- package/drawer/drawer.js.map +1 -1
- package/drawer/drawer.styles_94hx3y.css +2 -2
- package/drawer/types.d.ts +16 -4
- package/e-signature/e-signature-canvas.js +1 -1
- package/e-signature/e-signature-canvas.js.map +1 -1
- package/e-signature/e-signature.d.ts +5 -0
- package/e-signature/e-signature.js.map +1 -1
- package/e-signature/e-signature.styles_lukd9f.css +2 -2
- package/e-signature/types.d.ts +23 -1
- package/error-display/error-display.d.ts +7 -0
- package/error-display/error-display.js.map +1 -1
- package/error-display/error-display.styles_d3tql1.css +2 -2
- package/error-display/types.d.ts +36 -6
- package/external/dompurify/dist/purify.es.js +2 -2
- package/external/dompurify/dist/purify.es.js.map +1 -1
- package/feedback-rating/feedback-rating-stars-container.styles_dmi8z9.css +2 -2
- package/feedback-rating/feedback-rating.d.ts +6 -0
- package/feedback-rating/feedback-rating.js.map +1 -1
- package/feedback-rating/feedback-rating.styles_1kdklb6.css +2 -2
- package/feedback-rating/types.d.ts +29 -0
- package/file-download/file-download.d.ts +6 -0
- package/file-download/file-download.js.map +1 -1
- package/file-download/file-download.styles_iggk8q.css +2 -2
- package/file-download/file-list-card/file-list-card.styles.js +1 -1
- package/file-download/file-list-card/file-list-card.styles.js.map +1 -1
- package/file-download/file-list-card/{file-list-card.styles_oom8ii.css → file-list-card.styles_18j2gut.css} +3 -3
- package/file-download/types.d.ts +44 -11
- package/file-upload/dropzone.styles_1pllsau.css +2 -2
- package/file-upload/file-item-edit.d.ts +4 -1
- package/file-upload/file-item-edit.js +1 -1
- package/file-upload/file-item-edit.js.map +1 -1
- package/file-upload/file-item-edit.styles.d.ts +1 -0
- package/file-upload/file-item-edit.styles.js +1 -1
- package/file-upload/file-item-edit.styles.js.map +1 -1
- package/file-upload/{file-item-edit.styles_1qbpbxj.css → file-item-edit.styles_19bvztn.css} +6 -5
- package/file-upload/file-list/file-list.d.ts +3 -0
- package/file-upload/file-list/file-list.js +1 -1
- package/file-upload/file-list/file-list.js.map +1 -1
- package/file-upload/file-list/file-list.styles.js +1 -1
- package/file-upload/file-list/file-list.styles.js.map +1 -1
- package/file-upload/file-list/file-list.styles_1w7so98.css +3 -0
- package/file-upload/file-list-item/file-list-item-thumbnail.styles_1y4si19.css +2 -2
- package/file-upload/file-list-item/file-list-item.d.ts +3 -1
- package/file-upload/file-list-item/file-list-item.js +1 -1
- package/file-upload/file-list-item/file-list-item.js.map +1 -1
- package/file-upload/file-list-item/file-list-item.styles.d.ts +3 -0
- package/file-upload/file-list-item/file-list-item.styles.js +1 -1
- package/file-upload/file-list-item/file-list-item.styles.js.map +1 -1
- package/file-upload/file-list-item/file-list-item.styles_o8000f.css +17 -0
- package/file-upload/file-upload.d.ts +2 -1
- package/file-upload/file-upload.js +1 -1
- package/file-upload/file-upload.js.map +1 -1
- package/file-upload/file-upload.styles_9ffwcd.css +2 -2
- package/file-upload/types.d.ts +125 -20
- package/filter/addons/filter-item-checkbox.styles_7degw7.css +2 -2
- package/filter/filter-item-page.styles_17ewfrz.css +1 -1
- package/filter/filter-item.js.map +1 -1
- package/filter/filter-item.styles_cphjnj.css +2 -2
- package/filter/filter-modal.styles_qw3xlg.css +2 -2
- package/filter/filter-sidebar.styles_1otwpjl.css +2 -2
- package/filter/filter.d.ts +21 -0
- package/filter/filter.js.map +1 -1
- package/filter/filter.styles_1ykijwm.css +2 -2
- package/filter/types.d.ts +161 -21
- package/footer/footer-download-app.styles_1v1j2us.css +2 -2
- package/footer/footer-resource-addon.styles_1jepb1d.css +2 -2
- package/footer/footer.d.ts +8 -1
- package/footer/footer.js +1 -1
- package/footer/footer.js.map +1 -1
- package/footer/footer.styles_1msorhc.css +2 -2
- package/footer/types.d.ts +55 -4
- package/form/form-label-addon.styles_b00z8p.css +1 -1
- package/form/form-label.styles.js +1 -1
- package/form/form-label.styles.js.map +1 -1
- package/form/{form-label.styles_11r0652.css → form-label.styles_1nbe0bm.css} +2 -2
- package/form/form-textarea.styles_3p9qoy.css +2 -2
- package/form/form-wrapper.styles_199rslu.css +1 -1
- package/fullscreen-image-carousel/fullscreen-image-carousel.styles_vc6y5c.css +2 -2
- package/fullscreen-image-carousel/stateful-image.styles_1xe8ypm.css +2 -2
- package/histogram-slider/histogram-slider.styles_wvd4w.css +2 -2
- package/image-button/image-button.styles_6n1qsr.css +2 -2
- package/index.d.ts +0 -1
- package/index.js +1 -1
- package/input/input.styles_1cblor0.css +2 -2
- package/input-group/input-group-list-addon.styles_17iuqtw.css +2 -2
- package/input-group/input-group.styles_bqye6f.css +2 -2
- package/input-range-select/input-range-select.styles_adbrbm.css +2 -2
- package/input-range-slider/input-range-slider.styles_aljl2v.css +2 -2
- package/input-textarea/textarea-counter.styles_1n3wsnv.css +1 -1
- package/input-textarea/textarea.styles_22z4n3.css +2 -2
- package/language-switcher/dropdown-panel.styles_1qsjf8d.css +2 -2
- package/language-switcher/dropdown-variant.styles_1vrdfky.css +2 -2
- package/language-switcher/link-container-variant.styles_1iw6zux.css +2 -2
- package/layout/col-div.styles_16o6mwx.css +1 -1
- package/layout/container.styles_v70ec6.css +2 -2
- package/layout/section.styles_hstcaf.css +1 -1
- package/link-list/link-list.styles_m57vks.css +2 -2
- package/local-nav/local-nav-dropdown/local-nav-dropdown.styles_uhd4xl.css +2 -2
- package/local-nav/local-nav-menu/local-nav-menu.styles_pq19dh.css +2 -2
- package/markup/markup.style_1iu40x9.css +2 -2
- package/masked-input/masked-input.styles_1cm388a.css +2 -2
- package/masthead/masthead.styles_1huzon9.css +2 -2
- package/menu/menu-content.styles_p7ijll.css +2 -2
- package/menu/menu-item.styles_liyed8.css +2 -2
- package/menu/menu-link.styles_hfxoez.css +2 -2
- package/menu/menu-section.styles_g7my4d.css +2 -2
- package/modal/modal-box.styles_y52cts.css +2 -2
- package/modal/modal.styles_1lbblx6.css +2 -2
- package/modal-v2/modal-v2.styles_a8gv5i.css +2 -2
- package/modal-v2/slots/slot-styles_13sd376.css +2 -2
- package/navbar/brand.styles_zcgddp.css +1 -1
- package/navbar/drawer.js +1 -1
- package/navbar/drawer.js.map +1 -1
- package/navbar/drawer.styles_7hnxp5.css +2 -2
- package/navbar/menu.styles_gdpqc.css +2 -2
- package/navbar/navbar-action-buttons.styles_1vpm0nk.css +2 -2
- package/navbar/navbar-items.styles_1i3ltot.css +2 -2
- package/navbar/navbar.js +1 -1
- package/navbar/navbar.js.map +1 -1
- package/navbar/navbar.styles_koy0c7.css +2 -2
- package/notification-banner/notification-banner.styles_uxlysy.css +2 -2
- package/otp-input/otp-input.styles_5sbutl.css +2 -2
- package/otp-verification/contact-input-section.styles_odrjvt.css +2 -2
- package/otp-verification/otp-verification.styles_dg9bm8.css +1 -1
- package/otp-verification/thumbnail/thumbnail.styles_shqylh.css +2 -2
- package/otp-verification/verification-section.styles_x8jj.css +2 -2
- package/overlay/overlay.js +1 -1
- package/overlay/overlay.js.map +1 -1
- package/overlay/overlay.styles_12wym18.css +2 -2
- package/overlay/types.d.ts +0 -13
- package/package.json +1 -7
- package/pagination/pagination.styles_6bcgva.css +2 -2
- package/pill/pill.styles_xwrniu.css +2 -2
- package/popover/popover-inline/popover-inline.styles_bkopnt.css +2 -2
- package/popover/popover-trigger.styles_8zokig.css +1 -1
- package/popover/popover.styles_ujnf0h.css +2 -2
- package/progress-indicator/progress-indicator.styles_1c038s4.css +2 -2
- package/radio-button/radio-button.styles_1c4v6v.css +2 -2
- package/schedule/schedule-day-view/schedule-day-view.styles_8ti149.css +2 -2
- package/schedule/schedule-header/schedule-header.js +1 -1
- package/schedule/schedule-header/schedule-header.js.map +1 -1
- package/schedule/schedule-header/schedule-header.styles_1n2u5vj.css +2 -2
- package/schedule/schedule-week-view/schedule-week-view.styles_x7x50m.css +2 -2
- package/schedule/schedule-week-view/time-cell.styles_1sorjz8.css +2 -2
- package/schedule/schedule.styles_fdy5a1.css +2 -2
- package/schedule/shared/with-optional-popover.styles_7mv3p2.css +1 -1
- package/schedule/time-indicator/time-indicator.styles_1eaxyes.css +2 -2
- package/select-histogram/select-histogram.styles_n260dy.css +2 -2
- package/shared/accessibility/index_13g9vp.css +1 -1
- package/shared/clickable-icon/clickable-icon.styles_1v2imml.css +2 -2
- package/shared/component-loading-spinner/component-loading-spinner.styles_15eq02i.css +2 -2
- package/shared/dropdown-list/dropdown-label.styles_mloii0.css +2 -2
- package/shared/dropdown-list/dropdown-list.styles_konwm.css +2 -2
- package/shared/dropdown-list/dropdown-search.styles_1hc1gkh.css +2 -2
- package/shared/dropdown-list/expandable-element.styles_rkkvqr.css +2 -2
- package/shared/dropdown-list/nested-dropdown-list.styles_wdhxoe.css +2 -2
- package/shared/dropdown-wrapper/dropdown-wrapper.styles_15hwwoj.css +2 -2
- package/shared/fade-wrapper/fade-wrapper.styles_16iug7l.css +2 -2
- package/shared/image-placeholder/image-placeholder.styles_44nwil.css +1 -1
- package/shared/input-wrapper/input-wrapper.styles_je6maw.css +2 -2
- package/shared/internal-calendar/calendar-dropdown.styles_wybjai.css +1 -1
- package/shared/internal-calendar/calendar-manager.js +1 -1
- package/shared/internal-calendar/calendar-manager.js.map +1 -1
- package/shared/internal-calendar/calendar-manager.styles.js +1 -1
- package/shared/internal-calendar/calendar-manager.styles.js.map +1 -1
- package/shared/internal-calendar/{calendar-manager.styles_1iuq5zw.css → calendar-manager.styles_1njwkj2.css} +3 -3
- package/shared/internal-calendar/day-cell/day-cell.styles_1t5oqc1.css +2 -2
- package/shared/internal-calendar/internal-calendar-month.styles_14oh57f.css +2 -2
- package/shared/internal-calendar/internal-calendar-year.styles_therlc.css +2 -2
- package/shared/internal-calendar/internal-calendar.styles_gnc3eq.css +1 -1
- package/shared/internal-calendar/standard/standard-calendar-day-view.styles_1bw26au.css +2 -2
- package/shared/progress-bar/progress-bar.styles_125ri7a.css +1 -1
- package/shared/range-input-inner-container/range-input-inner-container.styles_1v61utg.css +2 -2
- package/shared/standalone-date-input/standalone-date-input.styles_157qo89.css +2 -2
- package/shared/time-slot/time-slot.styles_18s0to7.css +2 -2
- package/shared/timepicker-dropdown/timepicker-dropdown.styles_119l6k6.css +2 -2
- package/sidenav/sidenav-drawer-item.styles_1ljnyx2.css +2 -2
- package/sidenav/sidenav-drawer-subitem.styles_2y58kf.css +1 -1
- package/sidenav/sidenav-group.styles_1x604sw.css +2 -2
- package/sidenav/sidenav-item.styles_lqw3kh.css +2 -2
- package/sidenav/sidenav.styles_1vxezie.css +2 -2
- package/singpass-button/singpass-button.styles_1miyex3.css +2 -2
- package/smart-app-banner/smart-app-banner.styles_15u6yv4.css +2 -2
- package/tab/tab-link-chain.styles_49got4.css +2 -2
- package/tab/tab.styles_1najffw.css +1 -1
- package/table/table.styles_1af5ipv.css +2 -2
- package/tag/tag.style_d98c53.css +2 -2
- package/text-list/text-list.styles_w3fvyt.css +2 -2
- package/theme/styles/a11y-playground.css +3 -0
- package/theme/styles/bookingsg.css +7 -4
- package/theme/styles/careercompass.css +4 -1
- package/theme/styles/ccube.css +3 -0
- package/theme/styles/default.css +9 -5
- package/theme/styles/imda.css +3 -0
- package/theme/styles/lifesg.css +3 -0
- package/theme/styles/mylegacy.css +7 -4
- package/theme/styles/oneservice.css +52 -0
- package/theme/styles/pa.css +3 -0
- package/theme/styles/rbs.css +3 -0
- package/theme/styles/sgw-digital-lobby.css +5 -2
- package/theme/styles/smgs.css +3 -0
- package/theme/styles/spf.css +3 -0
- package/theme/styles/supportgowhere.css +3 -0
- package/theme/types.d.ts +1 -1
- package/theme/types.js +1 -1
- package/theme/types.js.map +1 -1
- package/theme/utils/index.d.ts +1 -0
- package/theme/utils/use-design-token-override.d.ts +11 -0
- package/theme/utils/use-design-token-override.js +2 -0
- package/theme/utils/use-design-token-override.js.map +1 -0
- package/time-range-picker/combobox-picker/combobox-picker.styles_7i9vso.css +1 -1
- package/time-range-picker/common.styles_1qwp4xa.css +2 -2
- package/time-slot-bar/time-slot-bar.styles_wigbyd.css +2 -2
- package/time-slot-bar-week/time-slot-bar-week-days.styles_evdvs9.css +2 -2
- package/time-slot-bar-week/time-slot-bar-week.styles_11ybf42.css +1 -1
- package/time-slot-week-view/time-slot-week-days.styles_1h21vyw.css +2 -2
- package/time-slot-week-view/time-slot-week-view.styles_gqgsw2.css +1 -1
- package/timeline/timeline.styles_1jxzik4.css +2 -2
- package/timepicker/timepicker.styles_1jm33yw.css +1 -1
- package/timetable/timetable-header/timetable-header.styles_11gl1h4.css +2 -2
- package/timetable/timetable-row/row-bar.styles_1x0vrsz.css +1 -1
- package/timetable/timetable-row/row-cell.styles_y1dl5j.css +2 -2
- package/timetable/timetable.styles_7rp8kz.css +2 -2
- package/toast/toast.styles_1e0l60w.css +2 -2
- package/toggle/toggle-icon.styles_ba71y.css +2 -2
- package/toggle/toggle.styles_1t5qrye.css +2 -2
- package/typography/typography-text.styles_1734x2k.css +2 -2
- package/typography/typography.styles.js +1 -1
- package/typography/typography.styles.js.map +1 -1
- package/typography/{typography.styles_1155j4c.css → typography.styles_1wd82dn.css} +2 -2
- package/uneditable-section/index.d.ts +1 -1
- package/uneditable-section/section-item.styles_mwx8ht.css +2 -2
- package/uneditable-section/uneditable-section.d.ts +2 -1
- package/uneditable-section/uneditable-section.js +1 -1
- package/uneditable-section/uneditable-section.js.map +1 -1
- package/uneditable-section/uneditable-section.styles_aj9zun.css +2 -2
- package/unit-number/unit-number-input.styles_8yizj.css +2 -2
- package/cjs/example/example.js +0 -2
- package/cjs/example/example.js.map +0 -1
- package/cjs/example/example_r47nvz.css +0 -1
- package/cjs/example/index.js +0 -2
- package/cjs/example/index.js.map +0 -1
- package/cjs/file-upload/file-list/file-list.styles_1ea12kj.css +0 -3
- package/cjs/file-upload/file-list-item/file-list-item.styles_y7my2m.css +0 -14
- package/example/example.d.ts +0 -2
- package/example/example.js +0 -2
- package/example/example.js.map +0 -1
- package/example/example_r47nvz.css +0 -1
- package/example/index.d.ts +0 -1
- package/example/index.js +0 -2
- package/example/index.js.map +0 -1
- package/example/types.d.ts +0 -3
- package/file-upload/file-list/file-list.styles_1ea12kj.css +0 -3
- package/file-upload/file-list-item/file-list-item.styles_y7my2m.css +0 -14
|
@@ -1,52 +1,88 @@
|
|
|
1
1
|
import type { RefObject } from "react";
|
|
2
2
|
import type { CommonCalendarProps, Variant, YearMonthDisplay } from "../shared/internal-calendar/types";
|
|
3
|
+
/** Props for `DateRangeInput`. */
|
|
3
4
|
export interface DateRangeInputProps extends CommonCalendarProps {
|
|
4
5
|
className?: string | undefined;
|
|
5
6
|
id?: string | undefined;
|
|
6
7
|
"data-testid"?: string | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* When `true`, suppresses the native on-screen keyboard on mobile devices
|
|
10
|
+
* while still allowing the calendar picker to open.
|
|
11
|
+
*/
|
|
7
12
|
hideInputKeyboard?: boolean | undefined;
|
|
8
13
|
/**
|
|
9
|
-
* The value of the
|
|
14
|
+
* The controlled value of the date input in `"YYYY-MM-DD"` or `"YYYY-M-D"` string format.
|
|
15
|
+
*
|
|
16
|
+
* @remarks Passing `undefined` or an invalid string clears the selection.
|
|
10
17
|
*/
|
|
11
18
|
value?: string | undefined;
|
|
12
19
|
/**
|
|
13
|
-
* The value of the end date input in "YYYY-MM-DD" or "YYYY-M-D" string format.
|
|
20
|
+
* The controlled value of the end date input in `"YYYY-MM-DD"` or `"YYYY-M-D"` string format.
|
|
21
|
+
*
|
|
22
|
+
* @remarks Passing `undefined` or an invalid string clears the selection.
|
|
14
23
|
*/
|
|
15
24
|
valueEnd?: string | undefined;
|
|
25
|
+
/** Renders the input in an error state. */
|
|
16
26
|
error?: boolean | undefined;
|
|
17
27
|
disabled?: boolean | undefined;
|
|
18
28
|
readOnly?: boolean | undefined;
|
|
19
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Selection model used by the calendar.
|
|
31
|
+
* - `"range"` — user picks a free-form start and end date independently.
|
|
32
|
+
* - `"week"` — selecting any day automatically expands the selection to the full calendar week.
|
|
33
|
+
* - `"fixed-range"` — selecting a start date automatically sets the end date to `numberOfDays - 1` days later.
|
|
34
|
+
*
|
|
35
|
+
* @default "range"
|
|
36
|
+
*/
|
|
20
37
|
variant?: Exclude<Variant, "single" | "multi"> | undefined;
|
|
21
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Number of days in the selection window when `variant` is `"fixed-range"`.
|
|
40
|
+
* The end date is calculated as the selected start date plus `numberOfDays - 1` days.
|
|
41
|
+
*
|
|
42
|
+
* @default 7
|
|
43
|
+
*/
|
|
22
44
|
numberOfDays?: number;
|
|
23
45
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
46
|
+
* Whether to show "Done" and "Cancel" action buttons inside the calendar dropdown.
|
|
47
|
+
* When `false`, a selection immediately commits and closes the calendar.
|
|
48
|
+
*
|
|
49
|
+
* @default true
|
|
26
50
|
*/
|
|
27
51
|
withButton?: boolean | undefined;
|
|
28
52
|
/** The z-index of the calendar dropdown */
|
|
29
53
|
zIndex?: number | undefined;
|
|
30
54
|
/**
|
|
31
|
-
* The root element that contains the dropdown element.
|
|
55
|
+
* The root element that contains the dropdown element.
|
|
56
|
+
*
|
|
57
|
+
* @remarks Specify this if you need to change the parent of the
|
|
58
|
+
* dropdown in the HTML DOM.
|
|
59
|
+
* Possible use case: sharing a stacking context.
|
|
32
60
|
*
|
|
33
|
-
*
|
|
34
|
-
* the dropdown may
|
|
61
|
+
* Note: if a parent of the trigger has a higher `z-index` than the dropdown,
|
|
62
|
+
* the dropdown may be obscured.
|
|
63
|
+
*
|
|
64
|
+
* @default `document.body`
|
|
35
65
|
*/
|
|
36
66
|
dropdownRootNode?: RefObject<HTMLElement> | undefined;
|
|
37
67
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
68
|
+
* Called when the user completes a valid date range selection.
|
|
69
|
+
* Both dates are provided in `"YYYY-MM-DD"` format. An empty string is passed
|
|
70
|
+
* for either date when the selection is cleared.
|
|
71
|
+
*
|
|
72
|
+
* @remarks When `withButton` is `true`, this fires only after the user
|
|
73
|
+
* confirms via the "Done" button.
|
|
40
74
|
*/
|
|
41
75
|
onChange?: ((startDate: string, endDate: string) => void) | undefined;
|
|
42
76
|
/**
|
|
43
|
-
* Called when
|
|
77
|
+
* Called when the input receives focus.
|
|
44
78
|
*/
|
|
45
79
|
onFocus?: (() => void) | undefined;
|
|
46
80
|
/**
|
|
47
|
-
*
|
|
81
|
+
* Called when focus leaves both the input and the calendar dropdown.
|
|
48
82
|
*/
|
|
49
83
|
onBlur?: (() => void) | undefined;
|
|
50
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Called when the visible month or year in the calendar changes.
|
|
86
|
+
*/
|
|
51
87
|
onYearMonthDisplayChange?: ((value: YearMonthDisplay) => void) | undefined;
|
|
52
88
|
}
|
package/divider/divider.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import type { DividerProps } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A horizontal line that visually separates sections of content.
|
|
4
|
+
*
|
|
5
|
+
* Use `Divider` to draw a clear boundary between distinct groups of content on
|
|
6
|
+
* a page or within a layout.
|
|
7
|
+
*/
|
|
2
8
|
export declare const Divider: ({ thickness, lineStyle, layoutType, color, className, xxsCols, xsCols, smCols, mdCols, lgCols, xlCols, xxlCols, ...otherProps }: DividerProps) => import("react/jsx-runtime").JSX.Element;
|
package/divider/divider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divider.js","sources":["../../src/divider/divider.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useRef } from \"react\";\n\nimport { ColDiv } from \"../layout/col-div\";\nimport { Colour, useApplyStyle } from \"../theme\";\nimport { useResolvedTokenValue } from \"../theme/utils\";\nimport { isColourToken } from \"../util/styling-helper\";\nimport * as styles from \"./divider.styles\";\nimport type { DividerLineStyleType, DividerProps } from \"./types\";\n\nconst lineStyleMap: Record<DividerLineStyleType, string> = {\n solid: styles.solidLine,\n dashed: styles.dashedLine,\n};\n\nexport const Divider = ({\n thickness = 1,\n lineStyle = \"solid\",\n layoutType = \"flex\",\n color,\n className,\n xxsCols,\n xsCols,\n smCols,\n mdCols,\n lgCols,\n xlCols,\n xxlCols,\n ...otherProps\n}: DividerProps) => {\n const ref = useRef<HTMLHRElement>(null);\n\n const effectiveColor = useResolvedTokenValue({\n value: color,\n fallback: Colour[\"border\"],\n isToken: isColourToken,\n normalizeCustom: String,\n });\n\n const encodedColor = encodeURIComponent(effectiveColor);\n const strokeWidth = thickness + 1; // best fit\n\n useApplyStyle(ref, {\n [styles.tokens.thickness]: `${thickness}px`,\n [styles.tokens.color]: color,\n [styles.tokens.backgroundImage]: `\n url('data:image/svg+xml,<svg width=\"8\" height=\"${thickness}\" viewBox=\"0 0 8 1\" xmlns=\"http://www.w3.org/2000/svg\"><line x1=\"2\" y1=\"1\" x2=\"6\" y2=\"1\" stroke=\"${encodedColor}\" stroke-width=\"${strokeWidth}\" stroke-dasharray=\"4 4\" /></svg>')`,\n });\n\n const getColumnProps = () => {\n const xxsColsProp = xxsCols || [1, -1];\n const xsColsProp = xsCols || xxsColsProp;\n const smColsProp = smCols || xsColsProp;\n const mdColsProp = mdCols || smColsProp;\n const lgColsProp = lgCols || mdColsProp;\n const xlColsProp = xlCols || lgColsProp;\n const xxlColsProp = xxlCols || xlColsProp;\n\n return {\n xxlCols: xxlColsProp,\n xlCols: xlColsProp,\n lgCols: lgColsProp,\n mdCols: mdColsProp,\n smCols: smColsProp,\n xsCols: xsColsProp,\n xxsCols: xxsColsProp,\n };\n };\n\n const lineClass = clsx(styles.lineBase, lineStyleMap[lineStyle]);\n\n switch (layoutType) {\n case \"flex\":\n return (\n <hr\n ref={ref}\n className={clsx(lineClass, className)}\n {...otherProps}\n />\n );\n case \"grid\":\n return (\n <ColDiv\n className={className}\n {...getColumnProps()}\n {...otherProps}\n >\n <hr ref={ref} className={lineClass} />\n </ColDiv>\n );\n }\n};\n"],"names":["lineStyleMap","solid","styles.solidLine","dashed","styles.dashedLine","Divider","_a","thickness","lineStyle","layoutType","color","className","xxsCols","xsCols","smCols","mdCols","lgCols","xlCols","xxlCols","otherProps","__rest","ref","useRef","effectiveColor","useResolvedTokenValue","value","fallback","Colour","isToken","isColourToken","normalizeCustom","String","encodedColor","encodeURIComponent","strokeWidth","useApplyStyle","styles.tokens","backgroundImage","lineClass","clsx","styles.lineBase","_jsx","Object","assign","ColDiv","xxsColsProp","xsColsProp","smColsProp","mdColsProp","lgColsProp","xlColsProp","getColumnProps"],"mappings":"ovBAUA,MAAMA,EAAqD,CACvDC,MAAOC,EACPC,OAAQC,
|
|
1
|
+
{"version":3,"file":"divider.js","sources":["../../src/divider/divider.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useRef } from \"react\";\n\nimport { ColDiv } from \"../layout/col-div\";\nimport { Colour, useApplyStyle } from \"../theme\";\nimport { useResolvedTokenValue } from \"../theme/utils\";\nimport { isColourToken } from \"../util/styling-helper\";\nimport * as styles from \"./divider.styles\";\nimport type { DividerLineStyleType, DividerProps } from \"./types\";\n\nconst lineStyleMap: Record<DividerLineStyleType, string> = {\n solid: styles.solidLine,\n dashed: styles.dashedLine,\n};\n\n/**\n * A horizontal line that visually separates sections of content.\n *\n * Use `Divider` to draw a clear boundary between distinct groups of content on\n * a page or within a layout.\n */\nexport const Divider = ({\n thickness = 1,\n lineStyle = \"solid\",\n layoutType = \"flex\",\n color,\n className,\n xxsCols,\n xsCols,\n smCols,\n mdCols,\n lgCols,\n xlCols,\n xxlCols,\n ...otherProps\n}: DividerProps) => {\n const ref = useRef<HTMLHRElement>(null);\n\n const effectiveColor = useResolvedTokenValue({\n value: color,\n fallback: Colour[\"border\"],\n isToken: isColourToken,\n normalizeCustom: String,\n });\n\n const encodedColor = encodeURIComponent(effectiveColor);\n const strokeWidth = thickness + 1; // best fit\n\n useApplyStyle(ref, {\n [styles.tokens.thickness]: `${thickness}px`,\n [styles.tokens.color]: color,\n [styles.tokens.backgroundImage]: `\n url('data:image/svg+xml,<svg width=\"8\" height=\"${thickness}\" viewBox=\"0 0 8 1\" xmlns=\"http://www.w3.org/2000/svg\"><line x1=\"2\" y1=\"1\" x2=\"6\" y2=\"1\" stroke=\"${encodedColor}\" stroke-width=\"${strokeWidth}\" stroke-dasharray=\"4 4\" /></svg>')`,\n });\n\n const getColumnProps = () => {\n const xxsColsProp = xxsCols || [1, -1];\n const xsColsProp = xsCols || xxsColsProp;\n const smColsProp = smCols || xsColsProp;\n const mdColsProp = mdCols || smColsProp;\n const lgColsProp = lgCols || mdColsProp;\n const xlColsProp = xlCols || lgColsProp;\n const xxlColsProp = xxlCols || xlColsProp;\n\n return {\n xxlCols: xxlColsProp,\n xlCols: xlColsProp,\n lgCols: lgColsProp,\n mdCols: mdColsProp,\n smCols: smColsProp,\n xsCols: xsColsProp,\n xxsCols: xxsColsProp,\n };\n };\n\n const lineClass = clsx(styles.lineBase, lineStyleMap[lineStyle]);\n\n switch (layoutType) {\n case \"flex\":\n return (\n <hr\n ref={ref}\n className={clsx(lineClass, className)}\n {...otherProps}\n />\n );\n case \"grid\":\n return (\n <ColDiv\n className={className}\n {...getColumnProps()}\n {...otherProps}\n >\n <hr ref={ref} className={lineClass} />\n </ColDiv>\n );\n }\n};\n"],"names":["lineStyleMap","solid","styles.solidLine","dashed","styles.dashedLine","Divider","_a","thickness","lineStyle","layoutType","color","className","xxsCols","xsCols","smCols","mdCols","lgCols","xlCols","xxlCols","otherProps","__rest","ref","useRef","effectiveColor","useResolvedTokenValue","value","fallback","Colour","isToken","isColourToken","normalizeCustom","String","encodedColor","encodeURIComponent","strokeWidth","useApplyStyle","styles.tokens","backgroundImage","lineClass","clsx","styles.lineBase","_jsx","Object","assign","ColDiv","xxsColsProp","xsColsProp","smColsProp","mdColsProp","lgColsProp","xlColsProp","getColumnProps"],"mappings":"ovBAUA,MAAMA,EAAqD,CACvDC,MAAOC,EACPC,OAAQ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ickness:initial;height:var(--fds-internal-divider-line-thickness, 1px);}
|
|
1
|
+
@layer fds{.l1oo3ku9{width:100%;margin:0;border:none;--fds-internal-divider-line-thickness:initial;height:var(--fds-internal-divider-line-thickness, 1px);}
|
|
2
2
|
.s7a32sz{--fds-internal-divider-line-color:initial;background-color:var(--fds-internal-divider-line-color, var(--fds-colour-border));}
|
|
3
|
-
.d1etlddg{background-color:transparent;background-repeat:repeat-x;background-image:var(--fds-internal-divider-line-backgroundImage);}
|
|
3
|
+
.d1etlddg{background-color:transparent;background-repeat:repeat-x;background-image:var(--fds-internal-divider-line-backgroundImage);}}
|
package/divider/types.d.ts
CHANGED
|
@@ -1,14 +1,37 @@
|
|
|
1
1
|
import type { ColProps } from "../layout";
|
|
2
|
+
/** Visual style of the line. */
|
|
2
3
|
export type DividerLineStyleType = "solid" | "dashed";
|
|
3
4
|
type DividerLayoutType = "flex" | "grid";
|
|
5
|
+
/** Props for the `Divider` component. */
|
|
4
6
|
export interface DividerProps extends ColProps, Omit<React.HTMLAttributes<HTMLElement>, "color"> {
|
|
5
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Thickness of the line in pixels.
|
|
9
|
+
*
|
|
10
|
+
* @default 1
|
|
11
|
+
*/
|
|
6
12
|
thickness?: number | undefined;
|
|
7
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Visual style of the line.
|
|
15
|
+
*
|
|
16
|
+
* @default "solid"
|
|
17
|
+
*/
|
|
8
18
|
lineStyle?: DividerLineStyleType | undefined;
|
|
9
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Controls how the divider is rendered relative to its parent layout.
|
|
21
|
+
*
|
|
22
|
+
* Use `"flex"` when the divider is a direct child of a flex container.
|
|
23
|
+
* Use `"grid"` to wrap the line in a `ColDiv`, enabling responsive
|
|
24
|
+
* column-span control via the `xxsCols`–`xxlCols` props.
|
|
25
|
+
*
|
|
26
|
+
* @default "flex"
|
|
27
|
+
*/
|
|
10
28
|
layoutType?: DividerLayoutType | undefined;
|
|
11
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Color of the line. Accepts a design-system colour token or any valid CSS
|
|
31
|
+
* color value.
|
|
32
|
+
*
|
|
33
|
+
* @default `Colour["border"]`
|
|
34
|
+
*/
|
|
12
35
|
color?: string | undefined;
|
|
13
36
|
}
|
|
14
37
|
export {};
|
package/drawer/drawer.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import type { DrawerProps } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A slide-in panel that overlays the page content.
|
|
4
|
+
*
|
|
5
|
+
* Use `Drawer` to surface supplementary content or navigation options without
|
|
6
|
+
* navigating away from the current page. Focus is trapped inside the dialog
|
|
7
|
+
* while it is open and returns to the triggering element on close.
|
|
8
|
+
*/
|
|
2
9
|
export declare const Drawer: ({ children, heading, show, onClose, onOverlayClick, className, ...otherProps }: DrawerProps) => import("react/jsx-runtime").JSX.Element;
|
package/drawer/drawer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.js","sources":["../../src/drawer/drawer.tsx"],"sourcesContent":["import {\n FloatingFocusManager,\n useDismiss,\n useFloating,\n useInteractions,\n useTransitionStatus,\n} from \"@floating-ui/react\";\nimport { CrossIcon } from \"@lifesg/react-icons/cross\";\nimport clsx from \"clsx\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport { Overlay } from \"../overlay\";\nimport { ClickableIcon } from \"../shared/clickable-icon\";\nimport { Typography } from \"../typography\";\nimport { useId } from \"../util\";\nimport * as styles from \"./drawer.styles\";\nimport type { DrawerProps } from \"./types\";\n\nexport const Drawer = ({\n children,\n heading,\n show,\n onClose,\n onOverlayClick,\n className,\n ...otherProps\n}: DrawerProps) => {\n // =========================================================================\n // CONST, STATE, REFS\n // =========================================================================\n const [showOverlay, setShowOverlay] = useState(show);\n const id = useId();\n const initialFocusRef = useRef<HTMLHeadingElement>(null);\n\n // =========================================================================\n // FLOATING UI CONFIG\n // =========================================================================\n const { context, refs } = useFloating({\n open: show,\n onOpenChange: (open) => {\n if (!open && onClose) {\n onClose();\n }\n },\n });\n\n const dismiss = useDismiss(context, {\n escapeKey: true,\n outsidePress: false, // defer to Overlay click\n });\n\n const { getFloatingProps } = useInteractions([dismiss]);\n\n const { isMounted, status } = useTransitionStatus(context, {\n duration: 800,\n });\n\n // =========================================================================\n // EFFECTS\n // =========================================================================\n useEffect(() => {\n if (!show) {\n const timer = setTimeout(() => setShowOverlay(false), 800);\n return () => clearTimeout(timer);\n } else {\n setShowOverlay(true);\n }\n }, [show]);\n\n // =========================================================================\n // EVENT HANDLERS\n // =========================================================================\n const handleDialogVisibility = (e: React.TransitionEvent) => {\n if (e.propertyName === \"visibility\" && show) {\n // focus the first element so that the screenreader enters the dialog\n initialFocusRef.current?.focus();\n }\n };\n\n // =========================================================================\n // RENDER FUNCTIONS\n // =========================================================================\n return (\n <Overlay\n show={showOverlay}\n enableOverlayClick\n onOverlayClick={onOverlayClick}\n >\n {isMounted ? (\n <FloatingFocusManager\n context={context}\n initialFocus={-1}\n returnFocus={true}\n >\n <div\n ref={refs.setFloating}\n data-status={status}\n data-testid=\"drawer\"\n aria-modal\n role=\"dialog\"\n aria-labelledby={id}\n onTransitionEnd={handleDialogVisibility}\n className={clsx(styles.container, className)}\n {...getFloatingProps()}\n {...otherProps}\n >\n <div className={styles.header}>\n <Typography.HeadingMD\n as=\"h2\"\n className={styles.heading}\n id={id}\n ref={initialFocusRef}\n tabIndex={-1}\n weight=\"bold\"\n >\n {heading}\n </Typography.HeadingMD>\n </div>\n <div className={styles.content}>{children}</div>\n <ClickableIcon\n aria-label=\"Close drawer\"\n onClick={onClose}\n focusHighlight={false}\n className={styles.closeButton}\n >\n <CrossIcon aria-hidden />\n </ClickableIcon>\n </div>\n </FloatingFocusManager>\n ) : undefined}\n </Overlay>\n );\n};\n"],"names":["Drawer","_a","children","heading","show","onClose","onOverlayClick","className","otherProps","__rest","showOverlay","setShowOverlay","useState","id","useId","initialFocusRef","useRef","context","refs","useFloating","open","onOpenChange","dismiss","useDismiss","escapeKey","outsidePress","getFloatingProps","useInteractions","isMounted","status","useTransitionStatus","duration","useEffect","timer","setTimeout","clearTimeout","_jsx","Overlay","enableOverlayClick","FloatingFocusManager","initialFocus","returnFocus","_jsxs","ref","setFloating","role","onTransitionEnd","e","propertyName","current","focus","clsx","styles.container","styles.header","Typography","HeadingMD","as","styles.heading","tabIndex","weight","styles.content","ClickableIcon","onClick","focusHighlight","styles.closeButton","CrossIcon","undefined"],"mappings":"
|
|
1
|
+
{"version":3,"file":"drawer.js","sources":["../../src/drawer/drawer.tsx"],"sourcesContent":["import {\n FloatingFocusManager,\n useDismiss,\n useFloating,\n useInteractions,\n useTransitionStatus,\n} from \"@floating-ui/react\";\nimport { CrossIcon } from \"@lifesg/react-icons/cross\";\nimport clsx from \"clsx\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport { Overlay } from \"../overlay\";\nimport { ClickableIcon } from \"../shared/clickable-icon\";\nimport { Typography } from \"../typography\";\nimport { useId } from \"../util\";\nimport * as styles from \"./drawer.styles\";\nimport type { DrawerProps } from \"./types\";\n\n/**\n * A slide-in panel that overlays the page content.\n *\n * Use `Drawer` to surface supplementary content or navigation options without\n * navigating away from the current page. Focus is trapped inside the dialog\n * while it is open and returns to the triggering element on close.\n */\nexport const Drawer = ({\n children,\n heading,\n show,\n onClose,\n onOverlayClick,\n className,\n ...otherProps\n}: DrawerProps) => {\n // =========================================================================\n // CONST, STATE, REFS\n // =========================================================================\n const [showOverlay, setShowOverlay] = useState(show);\n const id = useId();\n const initialFocusRef = useRef<HTMLHeadingElement>(null);\n\n // =========================================================================\n // FLOATING UI CONFIG\n // =========================================================================\n const { context, refs } = useFloating({\n open: show,\n onOpenChange: (open) => {\n if (!open && onClose) {\n onClose();\n }\n },\n });\n\n const dismiss = useDismiss(context, {\n escapeKey: true,\n outsidePress: false, // defer to Overlay click\n });\n\n const { getFloatingProps } = useInteractions([dismiss]);\n\n const { isMounted, status } = useTransitionStatus(context, {\n duration: 800,\n });\n\n // =========================================================================\n // EFFECTS\n // =========================================================================\n useEffect(() => {\n if (!show) {\n const timer = setTimeout(() => setShowOverlay(false), 800);\n return () => clearTimeout(timer);\n } else {\n setShowOverlay(true);\n }\n }, [show]);\n\n // =========================================================================\n // EVENT HANDLERS\n // =========================================================================\n const handleDialogVisibility = (e: React.TransitionEvent) => {\n if (e.propertyName === \"visibility\" && show) {\n // focus the first element so that the screenreader enters the dialog\n initialFocusRef.current?.focus();\n }\n };\n\n // =========================================================================\n // RENDER FUNCTIONS\n // =========================================================================\n return (\n <Overlay\n show={showOverlay}\n enableOverlayClick\n onOverlayClick={onOverlayClick}\n >\n {isMounted ? (\n <FloatingFocusManager\n context={context}\n initialFocus={-1}\n returnFocus={true}\n >\n <div\n ref={refs.setFloating}\n data-status={status}\n data-testid=\"drawer\"\n aria-modal\n role=\"dialog\"\n aria-labelledby={id}\n onTransitionEnd={handleDialogVisibility}\n className={clsx(styles.container, className)}\n {...getFloatingProps()}\n {...otherProps}\n >\n <div className={styles.header}>\n <Typography.HeadingMD\n as=\"h2\"\n className={styles.heading}\n id={id}\n ref={initialFocusRef}\n tabIndex={-1}\n weight=\"bold\"\n >\n {heading}\n </Typography.HeadingMD>\n </div>\n <div className={styles.content}>{children}</div>\n <ClickableIcon\n aria-label=\"Close drawer\"\n onClick={onClose}\n focusHighlight={false}\n className={styles.closeButton}\n >\n <CrossIcon aria-hidden />\n </ClickableIcon>\n </div>\n </FloatingFocusManager>\n ) : undefined}\n </Overlay>\n );\n};\n"],"names":["Drawer","_a","children","heading","show","onClose","onOverlayClick","className","otherProps","__rest","showOverlay","setShowOverlay","useState","id","useId","initialFocusRef","useRef","context","refs","useFloating","open","onOpenChange","dismiss","useDismiss","escapeKey","outsidePress","getFloatingProps","useInteractions","isMounted","status","useTransitionStatus","duration","useEffect","timer","setTimeout","clearTimeout","_jsx","Overlay","enableOverlayClick","FloatingFocusManager","initialFocus","returnFocus","_jsxs","ref","setFloating","role","onTransitionEnd","e","propertyName","current","focus","clsx","styles.container","styles.header","Typography","HeadingMD","as","styles.heading","tabIndex","weight","styles.content","ClickableIcon","onClick","focusHighlight","styles.closeButton","CrossIcon","undefined"],"mappings":"00BAyBO,MAAMA,EAAUC,IAAA,IAAAC,SACnBA,EAAQC,QACRA,EAAOC,KACPA,EAAIC,QACJA,EAAOC,eACPA,EAAcC,UACdA,GAASN,EACNO,EAAUC,EAAAR,EAPM,sEAYnB,MAAOS,EAAaC,GAAkBC,EAASR,GACzCS,EAAKC,IACLC,EAAkBC,EAA2B,OAK7CC,QAAEA,EAAOC,KAAEA,GAASC,EAAY,CAClCC,KAAMhB,EACNiB,aAAeD,KACNA,GAAQf,GACTA,GACJ,IAIFiB,EAAUC,EAAWN,EAAS,CAChCO,WAAW,EACXC,cAAc,KAGZC,iBAAEA,GAAqBC,EAAgB,CAACL,KAExCM,UAAEA,EAASC,OAAEA,GAAWC,EAAoBb,EAAS,CACvDc,SAAU,MAMdC,GAAU,KACN,IAAK5B,EAAM,CACP,MAAM6B,EAAQC,YAAW,IAAMvB,GAAe,IAAQ,KACtD,MAAO,IAAMwB,aAAaF,EAC9B,CACItB,GAAe,EACnB,GACD,CAACP,IAeJ,OACIgC,EAACC,EAAO,CACJjC,KAAMM,EACN4B,oBAAkB,EAClBhC,eAAgBA,EAAcJ,SAE7B0B,EACGQ,EAACG,EAAoB,CACjBtB,QAASA,EACTuB,cAAc,EACdC,aAAa,EAAIvC,SAEjBwC,uBACIC,IAAKzB,EAAK0B,YAAW,cACRf,EAAM,cACP,yBAEZgB,KAAK,SAAQ,kBACIhC,EACjBiC,gBA7BYC,UACL,eAAnBA,EAAEC,cAAiC5C,IAEZ,QAAvBH,EAAAc,EAAgBkC,eAAO,IAAAhD,GAAAA,EAAEiD,QAC7B,EA0BgB3C,UAAW4C,EAAKC,EAAkB7C,IAC9BmB,IACAlB,EAAU,CAAAN,SAAA,CAEdkC,EAAA,MAAA,CAAK7B,UAAW8C,EAAanD,SACzBkC,EAACkB,EAAWC,UAAS,CACjBC,GAAG,KACHjD,UAAWkD,EACX5C,GAAIA,EACJ8B,IAAK5B,EACL2C,UAAU,EACVC,OAAO,gBAENxD,MAGTiC,SAAK7B,UAAWqD,EAAc1D,SAAGA,IACjCkC,EAACyB,EAAa,CAAA,aACC,eACXC,QAASzD,EACT0D,gBAAgB,EAChBxD,UAAWyD,EAAkB9D,SAE7BkC,EAAC6B,EAAS,CAAA,eAAA,iBAItBC,GACE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
.c1agands{position:fixed;top:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;height:100%;width:40%;overflow:hidden;background-color:var(--fds-colour-bg);box-shadow:var(--fds-shadow-lg-subtle);border-top-left-radius:var(--fds-radius-md);border-bottom-left-radius:var(--fds-radius-md);transition-property:right,visibility;}.c1agands[data-status="initial"]{right:-100%;visibility:hidden;}.c1agands[data-status="open"]{transition-duration:var(--fds-motion-duration-800);transition-timing-function:var(--fds-motion-timing-ease-entrance);right:0;visibility:visible;}.c1agands[data-status="close"]{transition-duration:var(--fds-motion-duration-800);transition-timing-function:var(--fds-motion-timing-ease-exit);right:-100%;visibility:hidden;}:where(body.fds-breakpoint-xl-max) .c1agands{width:50%;min-width:700px;}:where(body.fds-breakpoint-lg-max) .c1agands{width:100%;min-width:unset;border-top-left-radius:0;border-bottom-left-radius:0;}
|
|
1
|
+
@layer fds{.c1agands{position:fixed;top:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;height:100%;width:40%;overflow:hidden;background-color:var(--fds-colour-bg);box-shadow:var(--fds-shadow-lg-subtle);border-top-left-radius:var(--fds-radius-md);border-bottom-left-radius:var(--fds-radius-md);transition-property:right,visibility;}.c1agands[data-status="initial"]{right:-100%;visibility:hidden;}.c1agands[data-status="open"]{transition-duration:var(--fds-motion-duration-800);transition-timing-function:var(--fds-motion-timing-ease-entrance);right:0;visibility:visible;}.c1agands[data-status="close"]{transition-duration:var(--fds-motion-duration-800);transition-timing-function:var(--fds-motion-timing-ease-exit);right:-100%;visibility:hidden;}:where(body.fds-breakpoint-xl-max) .c1agands{width:50%;min-width:700px;}:where(body.fds-breakpoint-lg-max) .c1agands{width:100%;min-width:unset;border-top-left-radius:0;border-bottom-left-radius:0;}
|
|
2
2
|
.h1kc1wos{top:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:var(--fds-spacing-16);padding:var(--fds-spacing-32) var(--fds-spacing-16) var(--fds-spacing-16) calc(var(--fds-font-heading-lh-md) + var(--fds-spacing-32));background-color:var(--fds-colour-bg);border-bottom:var(--fds-border-width-010) var(--fds-border-style-solid) var(--fds-colour-border);}:where(body.fds-breakpoint-lg-max) .h1kc1wos{gap:var(--fds-spacing-8);padding:var(--fds-spacing-32) var(--fds-spacing-20) var(--fds-spacing-16) calc(var(--fds-font-heading-lh-md) + var(--fds-spacing-24));}
|
|
3
3
|
.c1njxz6r{color:var(--fds-colour-icon);padding:0;position:absolute;top:var(--fds-spacing-32);left:var(--fds-spacing-16);}.c1njxz6r:active,.c1njxz6r:focus{color:var(--fds-colour-icon-hover);}.c1njxz6r svg{height:var(--fds-font-heading-lh-md);width:var(--fds-font-heading-lh-md);}
|
|
4
4
|
.hcrz6mg{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
|
|
5
|
-
.c2k10hw{-webkit-flex:1;-ms-flex:1;flex:1;overflow-y:auto;}
|
|
5
|
+
.c2k10hw{-webkit-flex:1;-ms-flex:1;flex:1;overflow-y:auto;}}
|
package/drawer/types.d.ts
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
|
+
/** Props for the `Drawer` slide-in panel component. */
|
|
1
2
|
export interface DrawerProps {
|
|
2
3
|
children?: React.ReactNode | undefined;
|
|
3
4
|
className?: string | undefined;
|
|
4
5
|
"data-testid"?: string | undefined;
|
|
5
6
|
id?: string | undefined;
|
|
6
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Text rendered as the drawer title and used as the accessible label for
|
|
9
|
+
* the dialog.
|
|
10
|
+
*/
|
|
7
11
|
heading?: string | undefined;
|
|
8
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Controls whether the drawer is visible.
|
|
14
|
+
*
|
|
15
|
+
* @remarks This is a controlled prop; the parent is responsible for
|
|
16
|
+
* updating it in response to `onClose` and `onOverlayClick`.
|
|
17
|
+
*/
|
|
9
18
|
show?: boolean | undefined;
|
|
10
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Called when the user requests to close the drawer via the close button
|
|
21
|
+
* or the Escape key.
|
|
22
|
+
*/
|
|
11
23
|
onClose?: (() => void) | undefined;
|
|
12
|
-
/** Called when the
|
|
24
|
+
/** Called when the user clicks the background overlay. */
|
|
13
25
|
onOverlayClick?: (() => void) | undefined;
|
|
14
26
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__awaiter as e}from"../_virtual/_tslib.js";import{jsx as r}from"react/jsx-runtime";import{Canvas as t,PencilBrush as n,FabricImage as i}from"fabric";import{forwardRef as o,useRef as c,useImperativeHandle as u,useCallback as s,useEffect as a}from"react";import"../theme/theme-provider/index.js";import"../theme/theme-provider/context.js";import"../theme/tokens/border.js";import{Colour as l}from"../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
|
|
1
|
+
import{__awaiter as e}from"../_virtual/_tslib.js";import{jsx as r}from"react/jsx-runtime";import{Canvas as t,PencilBrush as n,FabricImage as i}from"fabric";import{forwardRef as o,useRef as c,useImperativeHandle as u,useCallback as s,useEffect as a}from"react";import"../theme/theme-provider/index.js";import"../theme/theme-provider/context.js";import"../theme/tokens/border.js";import{Colour as l}from"../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{useDesignTokenOverride as m}from"../theme/utils/use-design-token-override.js";import{signatureCanvasContainer as d,signatureCanvas as h}from"./e-signature.styles.js";const v=o(((o,v)=>{const{baseImageDataURL:p}=o,f=c(null),j=c(null),g=c(),w=c(),b=m({token:l.text});u(v,(()=>({clear:()=>{var e;return null===(e=g.current)||void 0===e?void 0:e.clear()},export:()=>y()})));const y=()=>{if(!g.current)return null;if(!g.current.getObjects().length)return null;return g.current.toDataURL({multiplier:1,format:"png",quality:1,enableRetinaScaling:!0})},x=s((()=>e(void 0,void 0,void 0,(function*(){if(yield new Promise((e=>setTimeout(e))),f.current&&j.current&&g.current){const e=f.current.clientWidth,r=f.current.clientHeight;j.current.width=e,j.current.height=r,g.current.setDimensions({width:e,height:r}),g.current.forEachObject((e=>{g.current&&g.current.centerObject(e)}))}}))),[]);return a((()=>{if(f.current&&j.current)return g.current=new t("eSignatureCanvas"),g.current.selection=!1,g.current.isDrawingMode=!0,w.current=new n(g.current),w.current.color=b||"#000000",w.current.width=3,g.current.freeDrawingBrush=w.current,()=>{var e;null===(e=g.current)||void 0===e||e.dispose()}}),[]),a((()=>{w.current&&b&&(w.current.color=b)}),[b]),a((()=>{var e;if(window)return window.addEventListener("resize",x),null===(e=screen.orientation)||void 0===e||e.addEventListener("change",x),x(),()=>{var e;window.removeEventListener("resize",x),null===(e=screen.orientation)||void 0===e||e.removeEventListener("change",x)}}),[x]),a((()=>{e(void 0,void 0,void 0,(function*(){if(p){const e=yield i.fromURL(p);g.current&&(g.current.clear(),e.selectable=!1,e.hoverCursor="default",g.current.width&&e.width&&e.scale(g.current.width/e.width),g.current.add(e),g.current.centerObject(e))}}))}),[p]),r("div",{className:d,ref:f,children:r("canvas",{className:h,id:"eSignatureCanvas",ref:j})})}));export{v as ESignatureCanvas};
|
|
2
2
|
//# sourceMappingURL=e-signature-canvas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e-signature-canvas.js","sources":["../../src/e-signature/e-signature-canvas.tsx"],"sourcesContent":["import { Canvas as FabricCanvas, FabricImage, PencilBrush } from \"fabric\";\nimport type { Ref } from \"react\";\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n} from \"react\";\n\nimport { Colour
|
|
1
|
+
{"version":3,"file":"e-signature-canvas.js","sources":["../../src/e-signature/e-signature-canvas.tsx"],"sourcesContent":["import { Canvas as FabricCanvas, FabricImage, PencilBrush } from \"fabric\";\nimport type { Ref } from \"react\";\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n} from \"react\";\n\nimport { Colour } from \"../theme\";\nimport { useDesignTokenOverride } from \"../theme/utils\";\nimport * as styles from \"./e-signature.styles\";\n\ninterface ESignatureCanvasProps {\n baseImageDataURL?: string | null | undefined;\n forwardedRef?: Ref<ESignatureCanvasRef> | undefined;\n}\n\nexport interface ESignatureCanvasRef {\n clear: VoidFunction;\n export: () => string | null;\n}\n\nconst Component = (\n props: ESignatureCanvasProps,\n ref: Ref<ESignatureCanvasRef>\n) => {\n // =============================================================================\n // CONST, STATE, REF\n // =============================================================================\n const { baseImageDataURL } = props;\n const containerRef = useRef<HTMLDivElement>(null);\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const fabricCanvas = useRef<FabricCanvas>();\n const pencilBrush = useRef<PencilBrush>();\n const resolvedColor = useDesignTokenOverride({ token: Colour[\"text\"] });\n\n // =============================================================================\n // HOOKS\n // =============================================================================\n useImperativeHandle(ref, () => ({\n clear: () => fabricCanvas.current?.clear(),\n export: () => exportAsImage(),\n }));\n\n // =============================================================================\n // HELPER FUNCTIONS\n // =============================================================================\n const exportAsImage = () => {\n if (!fabricCanvas.current) return null;\n if (!fabricCanvas.current.getObjects().length) return null;\n const dataURL = fabricCanvas.current.toDataURL({\n multiplier: 1,\n format: \"png\",\n quality: 1,\n enableRetinaScaling: true,\n });\n return dataURL;\n };\n\n const handleResize = useCallback(async () => {\n // slight delay for fabricjs to update on orientation change\n await new Promise((resolve) => setTimeout(resolve));\n if (containerRef.current && canvasRef.current && fabricCanvas.current) {\n const canvasWidth = containerRef.current.clientWidth;\n const canvasHeight = containerRef.current.clientHeight;\n canvasRef.current.width = canvasWidth;\n canvasRef.current.height = canvasHeight;\n fabricCanvas.current.setDimensions({\n width: canvasWidth,\n height: canvasHeight,\n });\n\n fabricCanvas.current.forEachObject((obj) => {\n if (fabricCanvas.current) {\n fabricCanvas.current.centerObject(obj);\n }\n });\n }\n }, []);\n\n // =============================================================================\n // EFFECTS\n // =============================================================================\n // initialise fabric and brushes\n useEffect(() => {\n if (containerRef.current && canvasRef.current) {\n fabricCanvas.current = new FabricCanvas(\"eSignatureCanvas\");\n fabricCanvas.current.selection = false;\n fabricCanvas.current.isDrawingMode = true;\n\n pencilBrush.current = new PencilBrush(fabricCanvas.current);\n pencilBrush.current.color = resolvedColor || \"#000000\";\n pencilBrush.current.width = 3;\n\n fabricCanvas.current.freeDrawingBrush = pencilBrush.current;\n\n return () => {\n fabricCanvas.current?.dispose();\n };\n }\n }, []);\n\n useEffect(() => {\n if (pencilBrush.current && resolvedColor) {\n pencilBrush.current.color = resolvedColor;\n }\n }, [resolvedColor]);\n\n // resize\n useEffect(() => {\n if (window) {\n window.addEventListener(\"resize\", handleResize);\n screen.orientation?.addEventListener(\"change\", handleResize);\n handleResize();\n return () => {\n window.removeEventListener(\"resize\", handleResize);\n screen.orientation?.removeEventListener(\"change\", handleResize);\n };\n }\n }, [handleResize]);\n\n // update base image\n useEffect(() => {\n const updateImage = async () => {\n if (baseImageDataURL) {\n const img = await FabricImage.fromURL(baseImageDataURL);\n if (fabricCanvas.current) {\n fabricCanvas.current.clear();\n img.selectable = false;\n img.hoverCursor = \"default\";\n\n if (fabricCanvas.current.width && img.width) {\n img.scale(fabricCanvas.current.width / img.width);\n }\n fabricCanvas.current.add(img);\n fabricCanvas.current.centerObject(img);\n }\n }\n };\n\n updateImage();\n }, [baseImageDataURL]);\n\n // =============================================================================\n // RENDER FUNCTIONS\n // =============================================================================\n return (\n <div className={styles.signatureCanvasContainer} ref={containerRef}>\n <canvas\n className={styles.signatureCanvas}\n id=\"eSignatureCanvas\"\n ref={canvasRef}\n />\n </div>\n );\n};\n\nexport const ESignatureCanvas = forwardRef<\n ESignatureCanvasRef,\n ESignatureCanvasProps\n>(Component);\n"],"names":["ESignatureCanvas","forwardRef","props","ref","baseImageDataURL","containerRef","useRef","canvasRef","fabricCanvas","pencilBrush","resolvedColor","useDesignTokenOverride","token","Colour","useImperativeHandle","clear","_a","current","export","exportAsImage","getObjects","length","toDataURL","multiplier","format","quality","enableRetinaScaling","handleResize","useCallback","__awaiter","Promise","resolve","setTimeout","canvasWidth","clientWidth","canvasHeight","clientHeight","width","height","setDimensions","forEachObject","obj","centerObject","useEffect","FabricCanvas","selection","isDrawingMode","PencilBrush","color","freeDrawingBrush","dispose","window","addEventListener","screen","orientation","removeEventListener","img","FabricImage","fromURL","selectable","hoverCursor","scale","add","_jsx","className","styles.signatureCanvasContainer","children","styles.signatureCanvas","id"],"mappings":"g4BAwBA,MAuIaA,EAAmBC,GAvId,CACdC,EACAC,KAKA,MAAMC,iBAAEA,GAAqBF,EACvBG,EAAeC,EAAuB,MACtCC,EAAYD,EAA0B,MACtCE,EAAeF,IACfG,EAAcH,IACdI,EAAgBC,EAAuB,CAAEC,MAAOC,EAAa,OAKnEC,EAAoBX,GAAK,KAAA,CACrBY,MAAO,KAAK,IAAAC,EAAC,OAAoB,QAApBA,EAAAR,EAAaS,eAAO,IAAAD,OAAA,EAAAA,EAAED,OAAO,EAC1CG,OAAQ,IAAMC,QAMlB,MAAMA,EAAgB,KAClB,IAAKX,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SAAUzB,GAC/CA,IACO,WACHwB,OAAOI,oBAAoB,SAAU5B,GACnB,QAAlBX,EAAAqC,OAAOC,mBAAW,IAAAtC,GAAAA,EAAEuC,oBAAoB,SAAU5B,EAAa,CAEvE,GACD,CAACA,IAGJgB,GAAU,KACyBd,OAAA,OAAA,OAAA,GAAA,YAC3B,GAAIzB,EAAkB,CAClB,MAAMoD,QAAYC,EAAYC,QAAQtD,GAClCI,EAAaS,UACbT,EAAaS,QAAQF,QACrByC,EAAIG,YAAa,EACjBH,EAAII,YAAc,UAEdpD,EAAaS,QAAQoB,OAASmB,EAAInB,OAClCmB,EAAIK,MAAMrD,EAAaS,QAAQoB,MAAQmB,EAAInB,OAE/C7B,EAAaS,QAAQ6C,IAAIN,GACzBhD,EAAaS,QAAQyB,aAAac,GAE1C,CACJ,GAEa,GACd,CAACpD,IAMA2D,EAAA,MAAA,CAAKC,UAAWC,EAAiC9D,IAAKE,EAAY6D,SAC9DH,EAAA,SAAA,CACIC,UAAWG,EACXC,GAAG,mBACHjE,IAAKI,KAEP"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { EsignatureProps } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A field that lets users draw and save a signature.
|
|
4
|
+
*
|
|
5
|
+
* Use in forms that require a handwritten signature.
|
|
6
|
+
*/
|
|
2
7
|
export declare const ESignature: (props: EsignatureProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e-signature.js","sources":["../../src/e-signature/e-signature.tsx"],"sourcesContent":["import { EraserIcon, PencilIcon } from \"@lifesg/react-icons\";\nimport { lazy, Suspense, useEffect, useRef, useState } from \"react\";\n\nimport { Button } from \"../button\";\nimport { DashedBorder } from \"../dashed-border\";\nimport { Modal } from \"../modal\";\nimport { ProgressBar } from \"../shared/progress-bar\";\nimport {\n Border,\n Breakpoint,\n Colour,\n Radius,\n useMaxWidthMediaQuery,\n useMediaQuery,\n useResolvedBreakpointToken,\n} from \"../theme\";\nimport { Typography } from \"../typography\";\nimport * as styles from \"./e-signature.styles\";\nimport type { ESignatureCanvasRef } from \"./e-signature-canvas\";\nimport type { EsignatureProps } from \"./types\";\n\n// lazy load to fix next.js SSR errors\nconst ESignatureCanvas = lazy(async () => ({\n default: (await import(\"./e-signature-canvas\")).ESignatureCanvas,\n}));\n\nexport const ESignature = (props: EsignatureProps) => {\n // =============================================================================\n // CONST, STATE, REF\n // =============================================================================\n const {\n description,\n id,\n loadingProgress,\n loadingLabel = \"Uploading...\",\n onChange,\n value,\n disabled,\n ...otherProps\n } = props;\n const [showModal, setShowModal] = useState(false);\n const eSignatureCanvasRef = useRef<ESignatureCanvasRef>(null);\n const [dataURL, setDataURL] = useState<string | null | undefined>(value);\n const isMobile = useMaxWidthMediaQuery(\"sm\");\n const mobileBreakpoint = useResolvedBreakpointToken(Breakpoint[\"sm-max\"]);\n const isMobileLandscape = useMediaQuery({\n clauses: [\n {\n feature: \"orientation\",\n value: \"landscape\",\n },\n {\n feature: \"max-height\",\n value: mobileBreakpoint,\n },\n ],\n });\n\n // =============================================================================\n // EVENT HANDLERS\n // =============================================================================\n const handleClearDrawing = () => {\n eSignatureCanvasRef.current?.clear();\n };\n\n const handleClickSave = () => {\n if (eSignatureCanvasRef.current) {\n const dataURL = eSignatureCanvasRef.current.export();\n setDataURL(dataURL);\n setShowModal(false);\n onChange?.(dataURL);\n }\n };\n\n // =============================================================================\n // EFFECTS\n // =============================================================================\n useEffect(() => {\n setDataURL(value);\n }, [value]);\n\n // =============================================================================\n // RENDER FUNCTIONS\n // =============================================================================\n const renderSignatureArea = () => {\n if (!dataURL) {\n return (\n <Button\n className={styles.addSignatureButton}\n type=\"button\"\n styleType=\"secondary\"\n aria-label=\"Add signature\"\n id={id}\n onClick={() => setShowModal(true)}\n disabled={disabled}\n >\n Add signature\n </Button>\n );\n }\n\n return (\n <>\n <img\n className={styles.signaturePreviewImage}\n src={dataURL}\n alt=\"Signature preview\"\n />\n <Button\n className={styles.editSignatureButton}\n styleType=\"light\"\n onClick={() => setShowModal(true)}\n id={id}\n icon={<PencilIcon />}\n aria-label=\"Edit signature\"\n disabled={disabled}\n />\n </>\n );\n };\n\n const renderLoadingIndicator = () => {\n return (\n <div className={styles.progressBox}>\n {loadingLabel && (\n <Typography.BodyMD>{loadingLabel}</Typography.BodyMD>\n )}\n <ProgressBar\n progress={loadingProgress ?? 0}\n data-testid={`${id || \"e-signature\"}-progress-bar`}\n />\n </div>\n );\n };\n\n const renderModal = () => {\n return (\n <Modal\n className={styles.scrollableModal}\n data-testid=\"signature-modal\"\n show={showModal}\n >\n <div\n className={styles.growContainer}\n data-mobile-landscape={isMobileLandscape}\n >\n <Modal.Box\n className={styles.modalBox}\n data-mobile-landscape={isMobileLandscape}\n onClose={() => setShowModal(false)}\n >\n <h2\n className={styles.modalTitle}\n data-mobile-landscape={isMobileLandscape}\n >\n Signature\n </h2>\n <div\n className={styles.eSignatureContainer}\n data-mobile-landscape={isMobileLandscape}\n >\n <div\n className={styles.eSignatureDrawable}\n data-mobile-landscape={isMobileLandscape}\n >\n <div\n className={styles.signatureLine}\n data-mobile-landscape={isMobileLandscape}\n />\n <Suspense fallback={null}>\n {showModal && (\n <ESignatureCanvas\n ref={eSignatureCanvasRef}\n baseImageDataURL={dataURL}\n />\n )}\n </Suspense>\n </div>\n </div>\n <div\n className={styles.modalButtons}\n data-mobile-landscape={isMobileLandscape}\n >\n <Button\n className={styles.modalActionButton}\n data-mobile-landscape={isMobileLandscape}\n sizeType={\n isMobileLandscape ? \"small\" : \"default\"\n }\n type=\"button\"\n styleType={\n isMobile && !isMobileLandscape\n ? \"light\"\n : \"link\"\n }\n icon={<EraserIcon />}\n onClick={handleClearDrawing}\n >\n Clear\n </Button>\n <Button\n className={styles.modalActionButton}\n data-mobile-landscape={isMobileLandscape}\n sizeType={\n isMobileLandscape ? \"small\" : \"default\"\n }\n type=\"button\"\n onClick={handleClickSave}\n >\n Save\n </Button>\n </div>\n </Modal.Box>\n </div>\n </Modal>\n );\n };\n\n const renderDescription = () => {\n if (!description) return null;\n return (\n <Typography.BodySM className={styles.instructions}>\n {description}\n </Typography.BodySM>\n );\n };\n\n return (\n <div {...otherProps}>\n <DashedBorder\n className={styles.signatureArea}\n thickness={Border[\"width-040\"]}\n radius={Radius[\"sm\"]}\n colour={disabled ? Colour[\"border-disabled\"] : Colour[\"border\"]}\n backgroundColor={\n disabled ? Colour[\"bg-disabled\"] : Colour[\"bg\"]\n }\n >\n {typeof loadingProgress === \"number\"\n ? renderLoadingIndicator()\n : renderSignatureArea()}\n </DashedBorder>\n {renderModal()}\n {renderDescription()}\n </div>\n );\n};\n"],"names":["ESignatureCanvas","lazy","__awaiter","default","import","ESignature","props","description","id","loadingProgress","loadingLabel","onChange","value","disabled","otherProps","__rest","showModal","setShowModal","useState","eSignatureCanvasRef","useRef","dataURL","setDataURL","isMobile","useMaxWidthMediaQuery","mobileBreakpoint","useResolvedBreakpointToken","Breakpoint","isMobileLandscape","useMediaQuery","clauses","feature","handleClearDrawing","_a","current","clear","handleClickSave","export","useEffect","_jsxs","Object","assign","children","_jsx","DashedBorder","className","styles.signatureArea","thickness","Border","radius","Radius","colour","Colour","backgroundColor","styles.progressBox","Typography","BodyMD","ProgressBar","progress","_Fragment","styles.signaturePreviewImage","src","alt","Button","styles.editSignatureButton","styleType","onClick","icon","PencilIcon","styles.addSignatureButton","type","Modal","styles.scrollableModal","show","styles.growContainer","Box","styles.modalBox","onClose","styles.modalTitle","styles.eSignatureContainer","styles.eSignatureDrawable","styles.signatureLine","Suspense","fallback","ref","baseImageDataURL","styles.modalButtons","styles.modalActionButton","sizeType","EraserIcon","BodySM","styles.instructions"],"mappings":"+hDAsBA,MAAMA,EAAmBC,GAAK,IAAWC,OAAA,OAAA,OAAA,GAAA,YAAC,MAAA,CACtCC,eAAgBC,OAAO,4BAAyBJ,iBAClD,MAEWK,EAAcC,IAIvB,MAAMC,YACFA,EAAWC,GACXA,EAAEC,gBACFA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
+
{"version":3,"file":"e-signature.js","sources":["../../src/e-signature/e-signature.tsx"],"sourcesContent":["import { EraserIcon, PencilIcon } from \"@lifesg/react-icons\";\nimport { lazy, Suspense, useEffect, useRef, useState } from \"react\";\n\nimport { Button } from \"../button\";\nimport { DashedBorder } from \"../dashed-border\";\nimport { Modal } from \"../modal\";\nimport { ProgressBar } from \"../shared/progress-bar\";\nimport {\n Border,\n Breakpoint,\n Colour,\n Radius,\n useMaxWidthMediaQuery,\n useMediaQuery,\n useResolvedBreakpointToken,\n} from \"../theme\";\nimport { Typography } from \"../typography\";\nimport * as styles from \"./e-signature.styles\";\nimport type { ESignatureCanvasRef } from \"./e-signature-canvas\";\nimport type { EsignatureProps } from \"./types\";\n\n// lazy load to fix next.js SSR errors\nconst ESignatureCanvas = lazy(async () => ({\n default: (await import(\"./e-signature-canvas\")).ESignatureCanvas,\n}));\n\n/**\n * A field that lets users draw and save a signature.\n *\n * Use in forms that require a handwritten signature.\n */\nexport const ESignature = (props: EsignatureProps) => {\n // =============================================================================\n // CONST, STATE, REF\n // =============================================================================\n const {\n description,\n id,\n loadingProgress,\n loadingLabel = \"Uploading...\",\n onChange,\n value,\n disabled,\n ...otherProps\n } = props;\n const [showModal, setShowModal] = useState(false);\n const eSignatureCanvasRef = useRef<ESignatureCanvasRef>(null);\n const [dataURL, setDataURL] = useState<string | null | undefined>(value);\n const isMobile = useMaxWidthMediaQuery(\"sm\");\n const mobileBreakpoint = useResolvedBreakpointToken(Breakpoint[\"sm-max\"]);\n const isMobileLandscape = useMediaQuery({\n clauses: [\n {\n feature: \"orientation\",\n value: \"landscape\",\n },\n {\n feature: \"max-height\",\n value: mobileBreakpoint,\n },\n ],\n });\n\n // =============================================================================\n // EVENT HANDLERS\n // =============================================================================\n const handleClearDrawing = () => {\n eSignatureCanvasRef.current?.clear();\n };\n\n const handleClickSave = () => {\n if (eSignatureCanvasRef.current) {\n const dataURL = eSignatureCanvasRef.current.export();\n setDataURL(dataURL);\n setShowModal(false);\n onChange?.(dataURL);\n }\n };\n\n // =============================================================================\n // EFFECTS\n // =============================================================================\n useEffect(() => {\n setDataURL(value);\n }, [value]);\n\n // =============================================================================\n // RENDER FUNCTIONS\n // =============================================================================\n const renderSignatureArea = () => {\n if (!dataURL) {\n return (\n <Button\n className={styles.addSignatureButton}\n type=\"button\"\n styleType=\"secondary\"\n aria-label=\"Add signature\"\n id={id}\n onClick={() => setShowModal(true)}\n disabled={disabled}\n >\n Add signature\n </Button>\n );\n }\n\n return (\n <>\n <img\n className={styles.signaturePreviewImage}\n src={dataURL}\n alt=\"Signature preview\"\n />\n <Button\n className={styles.editSignatureButton}\n styleType=\"light\"\n onClick={() => setShowModal(true)}\n id={id}\n icon={<PencilIcon />}\n aria-label=\"Edit signature\"\n disabled={disabled}\n />\n </>\n );\n };\n\n const renderLoadingIndicator = () => {\n return (\n <div className={styles.progressBox}>\n {loadingLabel && (\n <Typography.BodyMD>{loadingLabel}</Typography.BodyMD>\n )}\n <ProgressBar\n progress={loadingProgress ?? 0}\n data-testid={`${id || \"e-signature\"}-progress-bar`}\n />\n </div>\n );\n };\n\n const renderModal = () => {\n return (\n <Modal\n className={styles.scrollableModal}\n data-testid=\"signature-modal\"\n show={showModal}\n >\n <div\n className={styles.growContainer}\n data-mobile-landscape={isMobileLandscape}\n >\n <Modal.Box\n className={styles.modalBox}\n data-mobile-landscape={isMobileLandscape}\n onClose={() => setShowModal(false)}\n >\n <h2\n className={styles.modalTitle}\n data-mobile-landscape={isMobileLandscape}\n >\n Signature\n </h2>\n <div\n className={styles.eSignatureContainer}\n data-mobile-landscape={isMobileLandscape}\n >\n <div\n className={styles.eSignatureDrawable}\n data-mobile-landscape={isMobileLandscape}\n >\n <div\n className={styles.signatureLine}\n data-mobile-landscape={isMobileLandscape}\n />\n <Suspense fallback={null}>\n {showModal && (\n <ESignatureCanvas\n ref={eSignatureCanvasRef}\n baseImageDataURL={dataURL}\n />\n )}\n </Suspense>\n </div>\n </div>\n <div\n className={styles.modalButtons}\n data-mobile-landscape={isMobileLandscape}\n >\n <Button\n className={styles.modalActionButton}\n data-mobile-landscape={isMobileLandscape}\n sizeType={\n isMobileLandscape ? \"small\" : \"default\"\n }\n type=\"button\"\n styleType={\n isMobile && !isMobileLandscape\n ? \"light\"\n : \"link\"\n }\n icon={<EraserIcon />}\n onClick={handleClearDrawing}\n >\n Clear\n </Button>\n <Button\n className={styles.modalActionButton}\n data-mobile-landscape={isMobileLandscape}\n sizeType={\n isMobileLandscape ? \"small\" : \"default\"\n }\n type=\"button\"\n onClick={handleClickSave}\n >\n Save\n </Button>\n </div>\n </Modal.Box>\n </div>\n </Modal>\n );\n };\n\n const renderDescription = () => {\n if (!description) return null;\n return (\n <Typography.BodySM className={styles.instructions}>\n {description}\n </Typography.BodySM>\n );\n };\n\n return (\n <div {...otherProps}>\n <DashedBorder\n className={styles.signatureArea}\n thickness={Border[\"width-040\"]}\n radius={Radius[\"sm\"]}\n colour={disabled ? Colour[\"border-disabled\"] : Colour[\"border\"]}\n backgroundColor={\n disabled ? Colour[\"bg-disabled\"] : Colour[\"bg\"]\n }\n >\n {typeof loadingProgress === \"number\"\n ? renderLoadingIndicator()\n : renderSignatureArea()}\n </DashedBorder>\n {renderModal()}\n {renderDescription()}\n </div>\n );\n};\n"],"names":["ESignatureCanvas","lazy","__awaiter","default","import","ESignature","props","description","id","loadingProgress","loadingLabel","onChange","value","disabled","otherProps","__rest","showModal","setShowModal","useState","eSignatureCanvasRef","useRef","dataURL","setDataURL","isMobile","useMaxWidthMediaQuery","mobileBreakpoint","useResolvedBreakpointToken","Breakpoint","isMobileLandscape","useMediaQuery","clauses","feature","handleClearDrawing","_a","current","clear","handleClickSave","export","useEffect","_jsxs","Object","assign","children","_jsx","DashedBorder","className","styles.signatureArea","thickness","Border","radius","Radius","colour","Colour","backgroundColor","styles.progressBox","Typography","BodyMD","ProgressBar","progress","_Fragment","styles.signaturePreviewImage","src","alt","Button","styles.editSignatureButton","styleType","onClick","icon","PencilIcon","styles.addSignatureButton","type","Modal","styles.scrollableModal","show","styles.growContainer","Box","styles.modalBox","onClose","styles.modalTitle","styles.eSignatureContainer","styles.eSignatureDrawable","styles.signatureLine","Suspense","fallback","ref","baseImageDataURL","styles.modalButtons","styles.modalActionButton","sizeType","EraserIcon","BodySM","styles.instructions"],"mappings":"+hDAsBA,MAAMA,EAAmBC,GAAK,IAAWC,OAAA,OAAA,OAAA,GAAA,YAAC,MAAA,CACtCC,eAAgBC,OAAO,4BAAyBJ,iBAClD,MAOWK,EAAcC,IAIvB,MAAMC,YACFA,EAAWC,GACXA,EAAEC,gBACFA,EAAeC,aACfA,EAAe,eAAcC,SAC7BA,EAAQC,MACRA,EAAKC,SACLA,GAEAP,EADGQ,EAAUC,EACbT,EATE,CAAA,cAAA,KAAA,kBAAA,eAAA,WAAA,QAAA,cAUCU,EAAWC,GAAgBC,GAAS,GACrCC,EAAsBC,EAA4B,OACjDC,EAASC,GAAcJ,EAAoCN,GAC5DW,EAAWC,EAAsB,MACjCC,EAAmBC,EAA2BC,EAAW,WACzDC,GAAoBC,EAAc,CACpCC,QAAS,CACL,CACIC,QAAS,cACTnB,MAAO,aAEX,CACImB,QAAS,aACTnB,MAAOa,MAQbO,GAAqB,WACI,QAA3BC,EAAAd,EAAoBe,eAAO,IAAAD,GAAAA,EAAEE,OAAO,EAGlCC,GAAkB,KACpB,GAAIjB,EAAoBe,QAAS,CAC7B,MAAMb,EAAUF,EAAoBe,QAAQG,SAC5Cf,EAAWD,GACXJ,GAAa,GACbN,SAAAA,EAAWU,EACf,GAMJiB,GAAU,KACNhB,EAAWV,EAAM,GAClB,CAACA,IAoJJ,OACI2B,EAAA,MAAAC,OAAAC,OAAA,GAAS3B,EAAU,CAAA4B,SAAA,CACfC,EAACC,EAAY,CACTC,UAAWC,EACXC,UAAWC,EAAO,aAClBC,OAAQC,EAAW,GACnBC,OAAQtC,EAAWuC,EAAO,mBAAqBA,EAAe,OAC9DC,gBACIxC,EAAWuC,EAAO,eAAiBA,E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D,GACvB4D,SACI5D,GAAoB,QAAU,UAElC0C,KAAK,SACLL,UACI1C,IAAaK,GACP,QACA,OAEVuC,KAAMxB,EAAC8C,EAAU,CAAA,GACjBvB,QAASlC,GAAkBU,SAAA,UAI/BC,EAACoB,EAAM,CACHlB,UAAW0C,EAAwB,wBACZ3D,GACvB4D,SACI5D,GAAoB,QAAU,UAElC0C,KAAK,SACLJ,QAAS9B,GAAeM,SAAA,mBAY3CnC,EAEDoC,EAACY,EAAWmC,OAAM,CAAC7C,UAAW8C,EAAmBjD,SAC5CnC,IAHgB,QAyBnB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.sf6ex5f{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;height:14.125rem;}
|
|
1
|
+
@layer fds{.sf6ex5f{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;height:14.125rem;}
|
|
2
2
|
.ar63c10{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;margin:0 var(--fds-spacing-20);}.ar63c10:disabled{border-color:var(--fds-colour-border-strong);}
|
|
3
3
|
.ewm2h5q{position:absolute;top:var(--fds-spacing-16);right:var(--fds-spacing-16);}.ewm2h5q:disabled{border-color:var(--fds-colour-border-strong);}
|
|
4
4
|
.s10kgaon{display:block;object-fit:contain;object-position:center;width:calc(100% - (3rem + var(--fds-spacing-16)) * 2);height:100%;}[data-fds-theme-mode="dark"] .s10kgaon{-webkit-filter:invert(1);filter:invert(1);}
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
.mkkmrzr{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:space-between;-webkit-justify-content:space-between;justify-content:space-between;margin-top:var(--fds-spacing-16);}:where(body.fds-breakpoint-sm-max) .mkkmrzr{-webkit-flex-direction:column-reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;margin:var(--fds-spacing-16) var(--fds-spacing-24) var(--fds-spacing-48);gap:var(--fds-spacing-16);}.mkkmrzr[data-mobile-landscape="true"]{-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;margin:var(--fds-spacing-16) var(--fds-spacing-20);}
|
|
15
15
|
.m19bpnkq{width:8.5rem;}:where(body.fds-breakpoint-sm-max) .m19bpnkq{width:100%;}.m19bpnkq[data-mobile-landscape="true"]{height:2.5rem;}
|
|
16
16
|
.s1ngo83b{width:100%;height:100%;overflow:hidden;}
|
|
17
|
-
.s13sbvhj{cursor:crosshair;}[data-fds-theme-mode="dark"] .s13sbvhj{-webkit-filter:invert(1);filter:invert(1);}
|
|
17
|
+
.s13sbvhj{cursor:crosshair;}[data-fds-theme-mode="dark"] .s13sbvhj{-webkit-filter:invert(1);filter:invert(1);}}
|
package/e-signature/types.d.ts
CHANGED
|
@@ -1,12 +1,34 @@
|
|
|
1
|
+
/** Props for the `ESignature` signature-capture field. */
|
|
1
2
|
export interface EsignatureProps {
|
|
2
3
|
className?: string | undefined;
|
|
3
4
|
id?: string | undefined;
|
|
4
5
|
"data-testid"?: string | undefined;
|
|
5
6
|
disabled?: boolean | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Text rendered below the signature area.
|
|
9
|
+
*/
|
|
6
10
|
description?: string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Label displayed alongside the upload progress bar.
|
|
13
|
+
*
|
|
14
|
+
* @default "Uploading..."
|
|
15
|
+
*/
|
|
7
16
|
loadingLabel?: string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* When set to a number, replaces the signature area with an upload progress
|
|
19
|
+
* indicator. Remove or set to `undefined` to restore the signature area.
|
|
20
|
+
*/
|
|
8
21
|
loadingProgress?: number | undefined;
|
|
9
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* The current signature as a base64 image dataURL.
|
|
24
|
+
* Pass `undefined` or omit to render the empty "Add signature" state.
|
|
25
|
+
*/
|
|
10
26
|
value?: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Called when the user saves a signature.
|
|
29
|
+
*
|
|
30
|
+
* @param value The new signature as a base64 image dataURL, or `null` if
|
|
31
|
+
* the canvas was empty when saved.
|
|
32
|
+
*/
|
|
11
33
|
onChange?: ((value: string | null) => void) | undefined;
|
|
12
34
|
}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import type { ErrorDisplayProps } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Displays a predefined error or status state with an illustration, title,
|
|
4
|
+
* description, and optional action button.
|
|
5
|
+
*
|
|
6
|
+
* Use `ErrorDisplay` to communicate HTTP error codes, session lifecycle states,
|
|
7
|
+
* maintenance windows, and other system-level statuses to users.
|
|
8
|
+
*/
|
|
2
9
|
export declare const ErrorDisplay: ({ type, img, title, description, actionButton, additionalProps, imageOnly, illustrationScheme, className, ...otherProps }: ErrorDisplayProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-display.js","sources":["../../src/error-display/error-display.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport type React from \"react\";\nimport { useContext } from \"react\";\n\nimport { Button } from \"../button\";\nimport { Markup } from \"../markup\";\nimport { ThemeContext } from \"../theme/theme-provider/context\";\nimport { Typography } from \"../typography\";\nimport * as styles from \"./error-display.styles\";\nimport { getErrorDisplayData } from \"./error-display-data\";\nimport { InactivityTimer } from \"./inactivity-timer\";\nimport type {\n ErrorDisplayProps,\n InactivityAdditionalAttributes,\n MaintenanceAdditionalAttributes,\n} from \"./types\";\n\nexport const ErrorDisplay = ({\n type,\n img,\n title,\n description,\n actionButton,\n additionalProps,\n imageOnly,\n illustrationScheme,\n className,\n ...otherProps\n}: ErrorDisplayProps) => {\n // =============================================================================\n // CONST, STATE, REF\n // =============================================================================\n const theme = useContext(ThemeContext);\n const defaultAssets = getErrorDisplayData(\n type,\n illustrationScheme || theme?.theme || \"lifesg\"\n );\n const inactivityAttrs =\n type === \"inactivity\"\n ? (additionalProps as InactivityAdditionalAttributes | undefined)\n : undefined;\n\n const secondsLeft = inactivityAttrs?.secondsLeft;\n const reminderInterval = inactivityAttrs?.reminderInterval;\n const testId = otherProps[\"data-testid\"] || \"error-display\";\n\n // =============================================================================\n // HELPER FUNCTIONS\n // =============================================================================\n const getCustomDescription = (): string | JSX.Element | undefined => {\n switch (type) {\n case \"maintenance\": {\n const typecastProps =\n additionalProps as MaintenanceAdditionalAttributes;\n return additionalProps && typecastProps.dateString\n ? defaultAssets?.renderDescription?.(typecastProps)\n : description || undefined;\n }\n case \"inactivity\": {\n const typecastProps =\n additionalProps as InactivityAdditionalAttributes;\n return additionalProps && typecastProps.secondsLeft\n ? defaultAssets?.renderDescription?.(typecastProps)\n : description || undefined;\n }\n default:\n return description || undefined;\n }\n };\n\n // =============================================================================\n // RENDER\n // =============================================================================\n if (!defaultAssets) {\n return null;\n }\n\n const renderActionButton = () => {\n const buttonProps: React.ButtonHTMLAttributes<HTMLButtonElement> = {\n children: \"Proceed\",\n ...actionButton,\n };\n\n return <Button className={styles.actionButton} {...buttonProps} />;\n };\n\n const updatedAssets = {\n ...defaultAssets,\n ...(img && { img }),\n ...(title && { title }),\n ...(getCustomDescription() && { description: getCustomDescription() }),\n };\n\n const renderContentDisplay = () => {\n if (updatedAssets.title || updatedAssets.description) {\n return (\n <div className={styles.textContainer}>\n {updatedAssets.title &&\n (typeof updatedAssets.title === \"string\" ? (\n <Typography.HeadingMD\n className={styles.title}\n data-testid={`${testId}--title`}\n data-id=\"error-display-title\"\n as=\"h2\"\n weight=\"semibold\"\n >\n {updatedAssets.title}\n </Typography.HeadingMD>\n ) : (\n updatedAssets.title\n ))}\n {updatedAssets.description && (\n <Markup\n className={styles.descriptionContainer}\n data-testid={`${testId}--description`}\n data-id=\"error-display-description\"\n baseTextSize=\"body-baseline\"\n >\n {typeof updatedAssets.description === \"string\" ? (\n <p>{updatedAssets.description}</p>\n ) : (\n updatedAssets.description\n )}\n </Markup>\n )}\n </div>\n );\n }\n\n return null;\n };\n\n return (\n <div\n {...otherProps}\n data-testid={testId}\n className={clsx(styles.container, className)}\n >\n {type === \"inactivity\" && (\n <InactivityTimer\n secondsLeft={secondsLeft}\n reminderInterval={reminderInterval}\n imageOnly={imageOnly}\n hasCustomDescription={!!description}\n />\n )}\n <img\n {...updatedAssets.img}\n alt=\"\"\n data-id=\"error-display-image\"\n className={clsx(styles.img, updatedAssets.img?.className)}\n />\n {!imageOnly && renderContentDisplay()}\n {actionButton && renderActionButton()}\n </div>\n );\n};\n"],"names":["ErrorDisplay","_a","type","img","title","description","actionButton","additionalProps","imageOnly","illustrationScheme","className","otherProps","__rest","theme","useContext","ThemeContext","defaultAssets","getErrorDisplayData","inactivityAttrs","undefined","secondsLeft","reminderInterval","testId","getCustomDescription","typecastProps","dateString","renderDescription","call","_b","updatedAssets","Object","assign","_jsxs","clsx","styles.container","children","_jsx","InactivityTimer","hasCustomDescription","alt","styles.img","styles.textContainer","Typography","HeadingMD","styles.title","as","weight","Markup","styles.descriptionContainer","baseTextSize","buttonProps","Button","styles.actionButton","renderActionButton"],"mappings":"
|
|
1
|
+
{"version":3,"file":"error-display.js","sources":["../../src/error-display/error-display.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport type React from \"react\";\nimport { useContext } from \"react\";\n\nimport { Button } from \"../button\";\nimport { Markup } from \"../markup\";\nimport { ThemeContext } from \"../theme/theme-provider/context\";\nimport { Typography } from \"../typography\";\nimport * as styles from \"./error-display.styles\";\nimport { getErrorDisplayData } from \"./error-display-data\";\nimport { InactivityTimer } from \"./inactivity-timer\";\nimport type {\n ErrorDisplayProps,\n InactivityAdditionalAttributes,\n MaintenanceAdditionalAttributes,\n} from \"./types\";\n\n/**\n * Displays a predefined error or status state with an illustration, title,\n * description, and optional action button.\n *\n * Use `ErrorDisplay` to communicate HTTP error codes, session lifecycle states,\n * maintenance windows, and other system-level statuses to users.\n */\nexport const ErrorDisplay = ({\n type,\n img,\n title,\n description,\n actionButton,\n additionalProps,\n imageOnly,\n illustrationScheme,\n className,\n ...otherProps\n}: ErrorDisplayProps) => {\n // =============================================================================\n // CONST, STATE, REF\n // =============================================================================\n const theme = useContext(ThemeContext);\n const defaultAssets = getErrorDisplayData(\n type,\n illustrationScheme || theme?.theme || \"lifesg\"\n );\n const inactivityAttrs =\n type === \"inactivity\"\n ? (additionalProps as InactivityAdditionalAttributes | undefined)\n : undefined;\n\n const secondsLeft = inactivityAttrs?.secondsLeft;\n const reminderInterval = inactivityAttrs?.reminderInterval;\n const testId = otherProps[\"data-testid\"] || \"error-display\";\n\n // =============================================================================\n // HELPER FUNCTIONS\n // =============================================================================\n const getCustomDescription = (): string | JSX.Element | undefined => {\n switch (type) {\n case \"maintenance\": {\n const typecastProps =\n additionalProps as MaintenanceAdditionalAttributes;\n return additionalProps && typecastProps.dateString\n ? defaultAssets?.renderDescription?.(typecastProps)\n : description || undefined;\n }\n case \"inactivity\": {\n const typecastProps =\n additionalProps as InactivityAdditionalAttributes;\n return additionalProps && typecastProps.secondsLeft\n ? defaultAssets?.renderDescription?.(typecastProps)\n : description || undefined;\n }\n default:\n return description || undefined;\n }\n };\n\n // =============================================================================\n // RENDER\n // =============================================================================\n if (!defaultAssets) {\n return null;\n }\n\n const renderActionButton = () => {\n const buttonProps: React.ButtonHTMLAttributes<HTMLButtonElement> = {\n children: \"Proceed\",\n ...actionButton,\n };\n\n return <Button className={styles.actionButton} {...buttonProps} />;\n };\n\n const updatedAssets = {\n ...defaultAssets,\n ...(img && { img }),\n ...(title && { title }),\n ...(getCustomDescription() && { description: getCustomDescription() }),\n };\n\n const renderContentDisplay = () => {\n if (updatedAssets.title || updatedAssets.description) {\n return (\n <div className={styles.textContainer}>\n {updatedAssets.title &&\n (typeof updatedAssets.title === \"string\" ? (\n <Typography.HeadingMD\n className={styles.title}\n data-testid={`${testId}--title`}\n data-id=\"error-display-title\"\n as=\"h2\"\n weight=\"semibold\"\n >\n {updatedAssets.title}\n </Typography.HeadingMD>\n ) : (\n updatedAssets.title\n ))}\n {updatedAssets.description && (\n <Markup\n className={styles.descriptionContainer}\n data-testid={`${testId}--description`}\n data-id=\"error-display-description\"\n baseTextSize=\"body-baseline\"\n >\n {typeof updatedAssets.description === \"string\" ? (\n <p>{updatedAssets.description}</p>\n ) : (\n updatedAssets.description\n )}\n </Markup>\n )}\n </div>\n );\n }\n\n return null;\n };\n\n return (\n <div\n {...otherProps}\n data-testid={testId}\n className={clsx(styles.container, className)}\n >\n {type === \"inactivity\" && (\n <InactivityTimer\n secondsLeft={secondsLeft}\n reminderInterval={reminderInterval}\n imageOnly={imageOnly}\n hasCustomDescription={!!description}\n />\n )}\n <img\n {...updatedAssets.img}\n alt=\"\"\n data-id=\"error-display-image\"\n className={clsx(styles.img, updatedAssets.img?.className)}\n />\n {!imageOnly && renderContentDisplay()}\n {actionButton && renderActionButton()}\n </div>\n );\n};\n"],"names":["ErrorDisplay","_a","type","img","title","description","actionButton","additionalProps","imageOnly","illustrationScheme","className","otherProps","__rest","theme","useContext","ThemeContext","defaultAssets","getErrorDisplayData","inactivityAttrs","undefined","secondsLeft","reminderInterval","testId","getCustomDescription","typecastProps","dateString","renderDescription","call","_b","updatedAssets","Object","assign","_jsxs","clsx","styles.container","children","_jsx","InactivityTimer","hasCustomDescription","alt","styles.img","styles.textContainer","Typography","HeadingMD","styles.title","as","weight","Markup","styles.descriptionContainer","baseTextSize","buttonProps","Button","styles.actionButton","renderActionButton"],"mappings":"umBAwBO,MAAMA,EAAgBC,WAAAC,KACzBA,EAAIC,IACJA,EAAGC,MACHA,EAAKC,YACLA,EAAWC,aACXA,EAAYC,gBACZA,EAAeC,UACfA,EAASC,mBACTA,EAAkBC,UAClBA,KACGC,EAAUC,EAA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Z,EAAAC,EAAc1B,WAAG,IAAAyB,OAAA,EAAAA,EAAElB,eAEjDF,IA1DFqB,EAAczB,OAASyB,EAAcxB,YAEjC2B,EAAA,MAAA,CAAKtB,UAAW+B,EAAoBN,SAAA,CAC/BN,EAAczB,QACqB,iBAAxByB,EAAczB,MAClBgC,EAACM,EAAWC,WACRjC,UAAWkC,EAAY,cACV,GAAGtB,qBACR,sBACRuB,GAAG,KACHC,OAAO,WAAUX,SAEhBN,EAAczB,QAGnByB,EAAmB,OAE1BA,EAAcxB,aACX+B,EAACW,GACGrC,UAAWsC,EAA2B,cACzB,GAAG1B,2BACR,4BACR2B,aAAa,gBAAed,SAEU,iBAA9BN,EAAcxB,YAClB+B,EAAA,IAAA,CAAAD,SAAIN,EAAcxB,cAElBwB,EAAyB,iBAQ1C,MAwBFvB,GA5EkB,MACvB,MAAM4C,iBACFf,SAAU,WACP7B,GAGP,OAAO8B,EAACe,EAAMrB,OAAAC,OAAA,CAACrB,UAAW0C,GAAyBF,GAAe,EAsE7CG,MACf"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
.c3ln52v{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;position:relative;}
|
|
1
|
+
@layer fds{.c3ln52v{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;position:relative;}
|
|
2
2
|
.i1z0ejqa{position:relative;width:400px;height:auto;}:where(body.fds-breakpoint-sm-max) .i1z0ejqa{width:320px;}:where(body.fds-breakpoint-xs-max) .i1z0ejqa{width:288px;}:where(body.fds-breakpoint-xxs-max) .i1z0ejqa{width:240px;}
|
|
3
3
|
.t13aw2m4{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;max-width:656px;white-space:pre-wrap;}
|
|
4
4
|
.twamush{margin:var(--fds-spacing-32) 0 var(--fds-spacing-16);text-align:center;}
|
|
5
5
|
.d1h7mokv{color:var(--fds-colour-text);text-align:center;}.d1h7mokv p+p{margin-top:var(--fds-spacing-16);}
|
|
6
|
-
.akp6wv{margin:var(--fds-spacing-32) auto 0;width:21rem;}:where(body.fds-breakpoint-sm-max) .akp6wv{width:100%;}
|
|
6
|
+
.akp6wv{margin:var(--fds-spacing-32) auto 0;width:21rem;}:where(body.fds-breakpoint-sm-max) .akp6wv{width:100%;}}
|