@nectary/components 4.12.0 → 4.12.1
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/index.d.ts +22 -1
- package/accordion/index.js +39 -41
- package/accordion/types.d.ts +1 -21
- package/accordion/types.js +1 -1
- package/accordion-item/index.d.ts +22 -2
- package/accordion-item/index.js +49 -53
- package/accordion-item/types.d.ts +1 -21
- package/accordion-item/types.js +1 -1
- package/accordion-item/utils.js +1 -4
- package/action-menu/index.d.ts +22 -1
- package/action-menu/index.js +77 -62
- package/action-menu/types.d.ts +1 -21
- package/action-menu/types.js +1 -1
- package/action-menu-option/index.d.ts +22 -1
- package/action-menu-option/index.js +41 -39
- package/action-menu-option/types.d.ts +1 -21
- package/action-menu-option/types.js +1 -1
- package/action-menu-option/utils.js +3 -6
- package/alert/index.d.ts +22 -2
- package/alert/index.js +21 -24
- package/alert/types.d.ts +1 -21
- package/alert/types.js +1 -1
- package/alert/utils.js +1 -4
- package/avatar/colors.js +1 -1
- package/avatar/index.d.ts +22 -2
- package/avatar/index.js +41 -42
- package/avatar/types.d.ts +1 -21
- package/avatar/types.js +1 -1
- package/avatar/utils.js +4 -9
- package/badge/index.d.ts +22 -3
- package/badge/index.js +51 -52
- package/badge/types.d.ts +1 -21
- package/badge/types.js +1 -1
- package/badge/utils.js +1 -4
- package/button/index.d.ts +22 -2
- package/button/index.js +111 -101
- package/button/types.d.ts +1 -21
- package/button/types.js +1 -1
- package/button/utils.js +2 -18
- package/button-group/index.d.ts +22 -1
- package/button-group/index.js +18 -20
- package/button-group/types.d.ts +3 -22
- package/button-group/types.js +1 -1
- package/button-group-item/index.d.ts +22 -2
- package/button-group-item/index.js +42 -31
- package/button-group-item/types.d.ts +3 -22
- package/button-group-item/types.js +1 -1
- package/card/index.d.ts +40 -0
- package/card/index.js +134 -0
- package/card/types.d.ts +17 -0
- package/card/types.js +1 -0
- package/card-container/index.d.ts +21 -1
- package/card-container/index.js +5 -8
- package/card-container/types.d.ts +1 -21
- package/card-container/types.js +1 -1
- package/card-v2/index.d.ts +22 -1
- package/card-v2/index.js +57 -59
- package/card-v2/types.d.ts +1 -21
- package/card-v2/types.js +1 -1
- package/card-v2-title/index.d.ts +22 -2
- package/card-v2-title/index.js +26 -28
- package/card-v2-title/types.d.ts +1 -21
- package/card-v2-title/types.js +1 -1
- package/checkbox/index.d.ts +22 -1
- package/checkbox/index.js +81 -88
- package/checkbox/types.d.ts +1 -21
- package/checkbox/types.js +1 -1
- package/chip/colors.js +1 -1
- package/chip/index.d.ts +22 -1
- package/chip/index.js +75 -62
- package/chip/types.d.ts +1 -21
- package/chip/types.js +1 -1
- package/chip/utils.js +3 -7
- package/code-tag/index.d.ts +22 -1
- package/code-tag/index.js +14 -17
- package/code-tag/types.d.ts +1 -21
- package/code-tag/types.js +1 -1
- package/color-menu/index.d.ts +22 -2
- package/color-menu/index.js +115 -115
- package/color-menu/types.d.ts +1 -21
- package/color-menu/types.js +1 -1
- package/color-menu/utils.js +3 -6
- package/color-menu-option/index.d.ts +22 -1
- package/color-menu-option/index.js +26 -30
- package/color-menu-option/types.d.ts +1 -21
- package/color-menu-option/types.js +1 -1
- package/color-menu-option/utils.js +3 -6
- package/color-swatch/index.d.ts +22 -1
- package/color-swatch/index.js +20 -23
- package/color-swatch/types.d.ts +1 -21
- package/color-swatch/types.js +1 -1
- package/color-swatch/utils.js +3 -7
- package/date-picker/index.d.ts +22 -2
- package/date-picker/index.js +150 -157
- package/date-picker/types.d.ts +1 -21
- package/date-picker/types.js +1 -1
- package/date-picker/utils.js +42 -59
- package/dialog/index.d.ts +22 -1
- package/dialog/index.js +58 -71
- package/dialog/types.d.ts +1 -21
- package/dialog/types.js +1 -1
- package/dialog/utils.js +7 -11
- package/emoji/index.d.ts +22 -1
- package/emoji/index.js +16 -19
- package/emoji/types.d.ts +1 -21
- package/emoji/types.js +1 -1
- package/emoji/utils.js +17 -22
- package/emoji-picker/index.d.ts +22 -2
- package/emoji-picker/index.js +118 -138
- package/emoji-picker/types.d.ts +1 -21
- package/emoji-picker/types.js +1 -1
- package/field/index.d.ts +22 -1
- package/field/index.js +60 -63
- package/field/types.d.ts +1 -21
- package/field/types.js +1 -1
- package/file-drop/index.d.ts +22 -1
- package/file-drop/index.js +98 -103
- package/file-drop/types.d.ts +1 -21
- package/file-drop/types.js +1 -1
- package/file-drop/utils.js +22 -27
- package/file-picker/index.d.ts +22 -1
- package/file-picker/index.js +48 -53
- package/file-picker/types.d.ts +1 -21
- package/file-picker/types.js +1 -1
- package/file-picker/utils.js +3 -6
- package/file-status/index.d.ts +22 -2
- package/file-status/index.js +22 -33
- package/file-status/types.d.ts +1 -21
- package/file-status/types.js +1 -1
- package/file-status/utils.js +1 -4
- package/flag/index.d.ts +22 -1
- package/flag/index.js +16 -19
- package/flag/types.d.ts +1 -21
- package/flag/types.js +1 -1
- package/flag/utils.js +8 -11
- package/grid/index.d.ts +22 -1
- package/grid/index.js +5 -8
- package/grid/types.d.ts +1 -21
- package/grid/types.js +1 -1
- package/grid-item/index.d.ts +22 -1
- package/grid-item/index.js +13 -17
- package/grid-item/types.d.ts +1 -21
- package/grid-item/types.js +1 -1
- package/help-tooltip/index.d.ts +22 -1
- package/help-tooltip/index.js +26 -29
- package/help-tooltip/types.d.ts +1 -21
- package/help-tooltip/types.js +1 -1
- package/horizontal-stepper/index.d.ts +33 -0
- package/horizontal-stepper/index.js +62 -0
- package/horizontal-stepper/types.d.ts +42 -0
- package/horizontal-stepper/types.js +1 -0
- package/horizontal-stepper-item/index.d.ts +38 -0
- package/horizontal-stepper-item/index.js +62 -0
- package/horizontal-stepper-item/types.d.ts +38 -0
- package/horizontal-stepper-item/types.js +1 -0
- package/horizontal-stepper-item/utils.d.ts +2 -0
- package/horizontal-stepper-item/utils.js +1 -0
- package/icon/generated-icon-type.js +1 -1
- package/icon/index.d.ts +22 -1
- package/icon/index.js +28 -30
- package/icon/types.d.ts +1 -21
- package/icon/types.js +1 -1
- package/inline-alert/index.d.ts +22 -2
- package/inline-alert/index.js +39 -58
- package/inline-alert/types.d.ts +1 -21
- package/inline-alert/types.js +1 -1
- package/inline-alert/utils.js +1 -4
- package/input/index.d.ts +22 -2
- package/input/index.js +317 -295
- package/input/types.d.ts +1 -21
- package/input/types.js +1 -1
- package/input/utils.js +46 -56
- package/link/index.d.ts +22 -1
- package/link/index.js +79 -88
- package/link/types.d.ts +1 -21
- package/link/types.js +1 -1
- package/list/index.d.ts +21 -1
- package/list/index.js +6 -9
- package/list/types.d.ts +1 -21
- package/list/types.js +1 -1
- package/list-item/index.d.ts +22 -1
- package/list-item/index.js +6 -9
- package/list-item/types.d.ts +1 -21
- package/list-item/types.js +1 -1
- package/package.json +5 -11
- package/pagination/index.d.ts +22 -2
- package/pagination/index.js +46 -64
- package/pagination/types.d.ts +1 -21
- package/pagination/types.js +1 -1
- package/persistent-overlay/index.d.ts +22 -1
- package/persistent-overlay/index.js +44 -42
- package/persistent-overlay/types.d.ts +1 -21
- package/persistent-overlay/types.js +1 -1
- package/pop/index.d.ts +22 -3
- package/pop/index.js +150 -149
- package/pop/types.d.ts +1 -21
- package/pop/types.js +1 -1
- package/pop/utils.js +8 -24
- package/popover/index.d.ts +22 -2
- package/popover/index.js +68 -75
- package/popover/types.d.ts +1 -21
- package/popover/types.js +1 -1
- package/popover/utils.js +7 -18
- package/progress/index.d.ts +22 -1
- package/progress/index.js +33 -30
- package/progress/types.d.ts +1 -21
- package/progress/types.js +1 -1
- package/progress-stepper/index.d.ts +22 -2
- package/progress-stepper/index.js +66 -64
- package/progress-stepper/types.d.ts +1 -21
- package/progress-stepper/types.js +1 -1
- package/progress-stepper-item/index.d.ts +22 -1
- package/progress-stepper-item/index.js +50 -58
- package/progress-stepper-item/types.d.ts +1 -21
- package/progress-stepper-item/types.js +1 -1
- package/progress-stepper-item/utils.js +11 -22
- package/radio/index.d.ts +22 -1
- package/radio/index.js +83 -79
- package/radio/types.d.ts +1 -21
- package/radio/types.js +1 -1
- package/radio-option/index.d.ts +22 -1
- package/radio-option/index.js +41 -47
- package/radio-option/types.d.ts +1 -21
- package/radio-option/types.js +1 -1
- package/rich-text/index.d.ts +22 -1
- package/rich-text/index.js +46 -45
- package/rich-text/types.d.ts +1 -21
- package/rich-text/types.js +1 -1
- package/rich-text/utils.js +33 -31
- package/rich-textarea/index.d.ts +22 -1
- package/rich-textarea/index.js +194 -201
- package/rich-textarea/types.d.ts +1 -21
- package/rich-textarea/types.js +1 -1
- package/rich-textarea/utils.js +340 -313
- package/segment/index.d.ts +40 -0
- package/segment/index.js +110 -0
- package/segment/types.d.ts +23 -0
- package/segment/types.js +1 -0
- package/segment/utils.d.ts +3 -0
- package/segment/utils.js +16 -0
- package/segment-collapse/index.d.ts +22 -1
- package/segment-collapse/index.js +25 -31
- package/segment-collapse/types.d.ts +1 -21
- package/segment-collapse/types.js +1 -1
- package/segmented-control/index.d.ts +22 -1
- package/segmented-control/index.js +45 -45
- package/segmented-control/types.d.ts +1 -21
- package/segmented-control/types.js +1 -1
- package/segmented-control-option/index.d.ts +22 -1
- package/segmented-control-option/index.js +46 -44
- package/segmented-control-option/types.d.ts +1 -21
- package/segmented-control-option/types.js +1 -1
- package/segmented-icon-control/index.d.ts +22 -1
- package/segmented-icon-control/index.js +50 -51
- package/segmented-icon-control/types.d.ts +1 -21
- package/segmented-icon-control/types.js +1 -1
- package/segmented-icon-control-option/index.d.ts +22 -1
- package/segmented-icon-control-option/index.js +37 -36
- package/segmented-icon-control-option/types.d.ts +1 -21
- package/segmented-icon-control-option/types.js +1 -1
- package/select-button/index.d.ts +26 -1
- package/select-button/index.js +112 -104
- package/select-button/types.d.ts +1 -25
- package/select-button/types.js +1 -1
- package/select-menu/index.d.ts +22 -1
- package/select-menu/index.js +164 -201
- package/select-menu/types.d.ts +1 -21
- package/select-menu/types.js +1 -1
- package/select-menu-option/index.d.ts +22 -1
- package/select-menu-option/index.js +33 -41
- package/select-menu-option/types.d.ts +1 -21
- package/select-menu-option/types.js +1 -1
- package/select-menu-option/utils.js +1 -4
- package/skeleton/index.d.ts +22 -1
- package/skeleton/index.js +38 -35
- package/skeleton/types.d.ts +1 -21
- package/skeleton/types.js +1 -1
- package/skeleton-item/index.d.ts +22 -1
- package/skeleton-item/index.js +5 -8
- package/skeleton-item/types.d.ts +1 -21
- package/skeleton-item/types.js +1 -1
- package/spinner/index.d.ts +22 -1
- package/spinner/index.js +29 -31
- package/spinner/types.d.ts +1 -21
- package/spinner/types.js +1 -1
- package/standalone.d.ts +8 -0
- package/standalone.js +87 -79
- package/standalone.ts +8 -0
- package/stop-events/index.js +12 -12
- package/table/index.d.ts +21 -1
- package/table/index.js +6 -9
- package/table/types.d.ts +1 -21
- package/table/types.js +1 -1
- package/table-body/index.d.ts +21 -1
- package/table-body/index.js +6 -9
- package/table-body/types.d.ts +1 -21
- package/table-body/types.js +1 -1
- package/table-cell/index.d.ts +22 -2
- package/table-cell/index.js +9 -13
- package/table-cell/types.d.ts +1 -21
- package/table-cell/types.js +1 -1
- package/table-cell/utils.js +1 -4
- package/table-head/index.d.ts +21 -1
- package/table-head/index.js +6 -9
- package/table-head/types.d.ts +1 -21
- package/table-head/types.js +1 -1
- package/table-head-cell/index.d.ts +22 -1
- package/table-head-cell/index.js +27 -29
- package/table-head-cell/types.d.ts +1 -21
- package/table-head-cell/types.js +1 -1
- package/table-row/index.d.ts +22 -1
- package/table-row/index.js +17 -20
- package/table-row/types.d.ts +1 -21
- package/table-row/types.js +1 -1
- package/tabs/index.d.ts +22 -2
- package/tabs/index.js +35 -32
- package/tabs/types.d.ts +1 -21
- package/tabs/types.js +1 -1
- package/tabs-icon-option/index.d.ts +22 -1
- package/tabs-icon-option/index.js +40 -38
- package/tabs-icon-option/types.d.ts +1 -21
- package/tabs-icon-option/types.js +1 -1
- package/tabs-option/index.d.ts +22 -1
- package/tabs-option/index.js +43 -41
- package/tabs-option/types.d.ts +1 -21
- package/tabs-option/types.js +1 -1
- package/tag/colors.js +1 -1
- package/tag/index.d.ts +22 -1
- package/tag/index.js +44 -45
- package/tag/types.d.ts +1 -21
- package/tag/types.js +1 -1
- package/tag/utils.js +3 -7
- package/text/index.d.ts +22 -2
- package/text/index.js +28 -33
- package/text/types.d.ts +1 -21
- package/text/types.js +1 -1
- package/text/utils.js +1 -4
- package/textarea/index.d.ts +22 -1
- package/textarea/index.js +152 -147
- package/textarea/types.d.ts +1 -21
- package/textarea/types.js +1 -1
- package/tile-control/index.d.ts +39 -0
- package/tile-control/index.js +111 -0
- package/tile-control/types.d.ts +29 -0
- package/tile-control/types.js +1 -0
- package/tile-control-option/index.d.ts +40 -0
- package/tile-control-option/index.js +99 -0
- package/tile-control-option/types.d.ts +52 -0
- package/tile-control-option/types.js +1 -0
- package/time-picker/index.d.ts +22 -2
- package/time-picker/index.js +123 -119
- package/time-picker/types.d.ts +1 -21
- package/time-picker/types.js +1 -1
- package/time-picker/utils.js +33 -31
- package/title/index.d.ts +22 -2
- package/title/index.js +31 -32
- package/title/types.d.ts +1 -21
- package/title/types.js +1 -1
- package/title/utils.js +14 -18
- package/toast/index.d.ts +22 -2
- package/toast/index.js +34 -37
- package/toast/types.d.ts +1 -21
- package/toast/types.js +1 -1
- package/toast/utils.js +1 -4
- package/toast-manager/index.d.ts +22 -3
- package/toast-manager/index.js +63 -77
- package/toast-manager/types.d.ts +1 -21
- package/toast-manager/types.js +1 -1
- package/toast-manager/utils.js +1 -4
- package/toggle/index.d.ts +22 -1
- package/toggle/index.js +75 -81
- package/toggle/types.d.ts +1 -21
- package/toggle/types.js +1 -1
- package/tooltip/index.d.ts +22 -3
- package/tooltip/index.js +93 -105
- package/tooltip/tooltip-state.js +64 -56
- package/tooltip/types.d.ts +1 -21
- package/tooltip/types.js +1 -1
- package/tooltip/utils.js +13 -32
- package/types.d.ts +29 -12
- package/utils/adapters.js +1 -1
- package/utils/context.js +42 -32
- package/utils/countries.js +2 -490
- package/utils/csv.js +6 -13
- package/utils/debounce.js +3 -10
- package/utils/dom.js +53 -60
- package/utils/element.d.ts +15 -107
- package/utils/element.js +19 -100
- package/utils/event-target.js +5 -11
- package/utils/form.js +12 -17
- package/utils/get-react-event-handler.js +3 -6
- package/utils/index.js +12 -65
- package/utils/markdown.js +43 -56
- package/utils/rect.js +18 -13
- package/utils/size.js +3 -8
- package/utils/slot.js +9 -13
- package/utils/throttle.js +2 -5
- package/utils/uid.js +2 -5
- package/vertical-stepper/index.d.ts +33 -0
- package/vertical-stepper/index.js +58 -0
- package/vertical-stepper/types.d.ts +34 -0
- package/vertical-stepper/types.js +1 -0
- package/vertical-stepper-item/index.d.ts +38 -0
- package/vertical-stepper-item/index.js +62 -0
- package/vertical-stepper-item/types.d.ts +42 -0
- package/vertical-stepper-item/types.js +1 -0
- package/vertical-stepper-item/utils.d.ts +2 -0
- package/vertical-stepper-item/utils.js +1 -0
- package/accordion/global/index.d.ts +0 -1
- package/accordion/global/index.js +0 -2
- package/accordion-item/global/index.d.ts +0 -1
- package/accordion-item/global/index.js +0 -2
- package/action-menu/global/index.d.ts +0 -1
- package/action-menu/global/index.js +0 -2
- package/action-menu-option/global/index.d.ts +0 -1
- package/action-menu-option/global/index.js +0 -2
- package/alert/global/index.d.ts +0 -1
- package/alert/global/index.js +0 -2
- package/avatar/global/index.d.ts +0 -1
- package/avatar/global/index.js +0 -2
- package/badge/global/index.d.ts +0 -1
- package/badge/global/index.js +0 -2
- package/bundle.d.ts +0 -78
- package/bundle.js +0 -13033
- package/bundle.ts +0 -80
- package/button/global/index.d.ts +0 -1
- package/button/global/index.js +0 -2
- package/button-group/global/index.d.ts +0 -1
- package/button-group/global/index.js +0 -2
- package/button-group-item/global/index.d.ts +0 -1
- package/button-group-item/global/index.js +0 -2
- package/card-container/global/index.d.ts +0 -1
- package/card-container/global/index.js +0 -2
- package/card-v2/global/index.d.ts +0 -1
- package/card-v2/global/index.js +0 -2
- package/card-v2-title/global/index.d.ts +0 -1
- package/card-v2-title/global/index.js +0 -2
- package/checkbox/global/index.d.ts +0 -1
- package/checkbox/global/index.js +0 -2
- package/chip/global/index.d.ts +0 -1
- package/chip/global/index.js +0 -2
- package/code-tag/global/index.d.ts +0 -1
- package/code-tag/global/index.js +0 -2
- package/color-menu/global/index.d.ts +0 -1
- package/color-menu/global/index.js +0 -2
- package/color-menu-option/global/index.d.ts +0 -1
- package/color-menu-option/global/index.js +0 -2
- package/color-swatch/global/index.d.ts +0 -1
- package/color-swatch/global/index.js +0 -2
- package/date-picker/global/index.d.ts +0 -1
- package/date-picker/global/index.js +0 -2
- package/dialog/global/index.d.ts +0 -1
- package/dialog/global/index.js +0 -2
- package/emoji/global/index.d.ts +0 -1
- package/emoji/global/index.js +0 -2
- package/emoji-picker/global/index.d.ts +0 -1
- package/emoji-picker/global/index.js +0 -2
- package/field/global/index.d.ts +0 -1
- package/field/global/index.js +0 -2
- package/file-drop/global/index.d.ts +0 -1
- package/file-drop/global/index.js +0 -2
- package/file-picker/global/index.d.ts +0 -1
- package/file-picker/global/index.js +0 -2
- package/file-status/global/index.d.ts +0 -1
- package/file-status/global/index.js +0 -2
- package/flag/global/index.d.ts +0 -1
- package/flag/global/index.js +0 -2
- package/grid/global/index.d.ts +0 -1
- package/grid/global/index.js +0 -2
- package/grid-item/global/index.d.ts +0 -1
- package/grid-item/global/index.js +0 -2
- package/help-tooltip/global/index.d.ts +0 -1
- package/help-tooltip/global/index.js +0 -2
- package/icon/global/index.d.ts +0 -1
- package/icon/global/index.js +0 -2
- package/inline-alert/global/index.d.ts +0 -1
- package/inline-alert/global/index.js +0 -2
- package/input/global/index.d.ts +0 -1
- package/input/global/index.js +0 -2
- package/link/global/index.d.ts +0 -1
- package/link/global/index.js +0 -2
- package/list/global/index.d.ts +0 -1
- package/list/global/index.js +0 -2
- package/list-item/global/index.d.ts +0 -1
- package/list-item/global/index.js +0 -2
- package/pagination/global/index.d.ts +0 -1
- package/pagination/global/index.js +0 -2
- package/persistent-overlay/global/index.d.ts +0 -1
- package/persistent-overlay/global/index.js +0 -2
- package/pop/global/index.d.ts +0 -1
- package/pop/global/index.js +0 -2
- package/popover/global/index.d.ts +0 -1
- package/popover/global/index.js +0 -2
- package/progress/global/index.d.ts +0 -1
- package/progress/global/index.js +0 -2
- package/progress-stepper/global/index.d.ts +0 -1
- package/progress-stepper/global/index.js +0 -2
- package/progress-stepper-item/global/index.d.ts +0 -1
- package/progress-stepper-item/global/index.js +0 -2
- package/radio/global/index.d.ts +0 -1
- package/radio/global/index.js +0 -2
- package/radio-option/global/index.d.ts +0 -1
- package/radio-option/global/index.js +0 -2
- package/rich-text/global/index.d.ts +0 -1
- package/rich-text/global/index.js +0 -2
- package/rich-textarea/global/index.d.ts +0 -1
- package/rich-textarea/global/index.js +0 -2
- package/segment-collapse/global/index.d.ts +0 -1
- package/segment-collapse/global/index.js +0 -2
- package/segmented-control/global/index.d.ts +0 -1
- package/segmented-control/global/index.js +0 -2
- package/segmented-control-option/global/index.d.ts +0 -1
- package/segmented-control-option/global/index.js +0 -2
- package/segmented-icon-control/global/index.d.ts +0 -1
- package/segmented-icon-control/global/index.js +0 -2
- package/segmented-icon-control-option/global/index.d.ts +0 -1
- package/segmented-icon-control-option/global/index.js +0 -2
- package/select-button/global/index.d.ts +0 -1
- package/select-button/global/index.js +0 -2
- package/select-menu/global/index.d.ts +0 -1
- package/select-menu/global/index.js +0 -2
- package/select-menu-option/global/index.d.ts +0 -1
- package/select-menu-option/global/index.js +0 -2
- package/skeleton/global/index.d.ts +0 -1
- package/skeleton/global/index.js +0 -2
- package/skeleton-item/global/index.d.ts +0 -1
- package/skeleton-item/global/index.js +0 -2
- package/spinner/global/index.d.ts +0 -1
- package/spinner/global/index.js +0 -2
- package/table/global/index.d.ts +0 -1
- package/table/global/index.js +0 -2
- package/table-body/global/index.d.ts +0 -1
- package/table-body/global/index.js +0 -2
- package/table-cell/global/index.d.ts +0 -1
- package/table-cell/global/index.js +0 -2
- package/table-head/global/index.d.ts +0 -1
- package/table-head/global/index.js +0 -2
- package/table-head-cell/global/index.d.ts +0 -1
- package/table-head-cell/global/index.js +0 -2
- package/table-row/global/index.d.ts +0 -1
- package/table-row/global/index.js +0 -2
- package/tabs/global/index.d.ts +0 -1
- package/tabs/global/index.js +0 -2
- package/tabs-icon-option/global/index.d.ts +0 -1
- package/tabs-icon-option/global/index.js +0 -2
- package/tabs-option/global/index.d.ts +0 -1
- package/tabs-option/global/index.js +0 -2
- package/tag/global/index.d.ts +0 -1
- package/tag/global/index.js +0 -2
- package/text/global/index.d.ts +0 -1
- package/text/global/index.js +0 -2
- package/textarea/global/index.d.ts +0 -1
- package/textarea/global/index.js +0 -2
- package/time-picker/global/index.d.ts +0 -1
- package/time-picker/global/index.js +0 -2
- package/title/global/index.d.ts +0 -1
- package/title/global/index.js +0 -2
- package/toast/global/index.d.ts +0 -1
- package/toast/global/index.js +0 -2
- package/toast-manager/global/index.d.ts +0 -1
- package/toast-manager/global/index.js +0 -2
- package/toggle/global/index.d.ts +0 -1
- package/toggle/global/index.js +0 -2
- package/tooltip/global/index.d.ts +0 -1
- package/tooltip/global/index.js +0 -2
- package/utils/component-names.d.ts +0 -3
- package/utils/component-names.js +0 -85
- package/utils/global-components-constants.d.ts +0 -3
- package/utils/global-components-constants.js +0 -8
- package/utils/global-components-manager.d.ts +0 -71
- package/utils/global-components-manager.js +0 -24
- package/utils/shared/global-elements-manager.d.js +0 -1
- package/utils/shared/global-elements-manager.d.ts +0 -62
- package/utils/shared/global-elements-manager.js +0 -163
- package/utils/shared/global-elements-store.d.js +0 -1
- package/utils/shared/global-elements-store.d.ts +0 -12
- package/utils/shared/global-elements-store.js +0 -31
- package/utils/shared/index.d.js +0 -11
- package/utils/shared/index.d.ts +0 -3
- package/utils/shared/index.js +0 -11
- package/utils/shared/nectary-element-base.d.js +0 -1
- package/utils/shared/nectary-element-base.d.ts +0 -9
- package/utils/shared/nectary-element-base.js +0 -25
- package/utils/shared/package.json +0 -9
- package/utils/shared/tsconfig.json +0 -20
package/time-picker/index.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import { stringifyHourFace, stringifyMinute, parseTime, hourToIndex, stringifyHour, getNeedleRotationDeg, getShortestCssDeg, stringifyTime } from "./utils.js";
|
|
9
|
-
const templateHTML = '<style>\n :host {\n display: block;\n outline: none;\n }\n\n #wrapper {\n display: flex;\n flex-direction: column;\n width: 248px;\n padding: 16px;\n box-sizing: border-box;\n gap: 16px;\n }\n\n #header {\n position: relative;\n width: 100%;\n height: 48px;\n font: var(--sinch-comp-time-picker-header-font);\n line-height: 48px;\n user-select: none;\n color: var(--sinch-comp-time-picker-header-color-default-text-initial);\n }\n\n #footer {\n display: flex;\n justify-content: center;\n width: 100%;\n height: 32px;\n }\n\n #picker {\n position: relative;\n width: 216px;\n height: 216px;\n border-radius: 50%;\n box-sizing: border-box;\n border:\n 1px solid\n var(--sinch-comp-time-picker-watch-face-color-default-border-initial);\n background-color:\n var(\n --sinch-comp-time-picker-watch-face-color-default-background-initial\n );\n }\n\n #picker-hours,\n #picker-minutes {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n border-radius: 50%;\n pointer-events: none;\n user-select: none;\n }\n\n .digit-hour-12,\n .digit-hour-24,\n .digit-minute {\n position: absolute;\n width: 28px;\n height: 28px;\n text-align: center;\n top: calc(50% - 14px);\n left: calc(50% - 14px);\n z-index: 1;\n cursor: pointer;\n }\n\n .digit-hour-12 {\n font: var(--sinch-comp-time-picker-digit-font-default-h12);\n color: var(--sinch-comp-time-picker-digit-color-default-h12-initial);\n line-height: 28px;\n }\n\n .digit-hour-12.selected {\n font: var(--sinch-comp-time-picker-digit-font-checked-h12);\n color: var(--sinch-comp-time-picker-digit-color-checked-h12-default);\n }\n\n .digit-hour-24 {\n font: var(--sinch-comp-time-picker-digit-font-default-h24);\n color: var(--sinch-comp-time-picker-digit-color-default-h24-initial);\n line-height: 28px;\n }\n\n .digit-hour-24.selected {\n font: var(--sinch-comp-time-picker-digit-font-checked-h24);\n color: var(--sinch-comp-time-picker-digit-color-checked-h24-initial);\n }\n\n .digit-minute {\n font: var(--sinch-comp-time-picker-digit-font-default-minutes);\n color: var(--sinch-comp-time-picker-digit-color-default-minute-initial);\n line-height: 28px;\n }\n\n .digit-minute.selected {\n font: var(--sinch-comp-time-picker-digit-font-checked-minutes);\n color: var(--sinch-comp-time-picker-digit-color-checked-minute-initial);\n }\n\n #picker-touch {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n cursor: pointer;\n border-radius: 50%;\n }\n\n #needle-hour,\n #needle-minute,\n #picker-touch::after {\n background-color:\n var(\n --sinch-comp-time-picker-needle-color-default-background-initial\n );\n }\n\n #needle-hour,\n #needle-minute {\n position: absolute;\n transform-origin: bottom center;\n transform: rotate(0deg);\n bottom: 50%;\n height: 50px;\n transition-duration: 0.25s;\n transition-timing-function: ease-in-out;\n transition-property: transform height;\n z-index: 2;\n outline: none;\n }\n\n @media (prefers-reduced-motion) {\n #needle-hour,\n #needle-minute {\n transition: none;\n }\n }\n\n #needle-hour {\n width: 4px;\n left: calc(50% - 2px);\n border-radius: 2px;\n }\n\n #needle-minute {\n width: 2px;\n left: calc(50% - 1px);\n border-radius: 1px;\n }\n\n #needle-hour:focus-visible,\n #needle-minute:focus-visible {\n background-color:\n var(\n --sinch-comp-time-picker-needle-color-default-background-focus\n );\n }\n\n #needle-minute:not(.selected)::after {\n content: "";\n position: absolute;\n transform: translateX(-50%);\n left: 0;\n top: -16px;\n width: 4px;\n height: 4px;\n border-radius: 50%;\n background-color:\n var(\n --sinch-comp-time-picker-digit-color-checked-minute-initial\n );\n }\n\n #picker-touch::after {\n content: "";\n position: absolute;\n top: 50%;\n left: 50%;\n width: 12px;\n height: 12px;\n border-radius: 50%;\n transform: translate(-50%, -50%);\n }\n\n #header-hours,\n #header-minutes {\n position: absolute;\n padding: 0 4px;\n width: 50px;\n outline: none;\n }\n\n #header-hours {\n right: calc(50% + 8px);\n text-align: right;\n }\n\n #header-minutes {\n left: calc(50% + 8px);\n }\n\n #header-colon {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n\n #submit {\n position: absolute;\n right: 0;\n top: 50%;\n transform: translateY(-50%);\n }\n\n #submit-icon {\n --sinch-global-color-icon:\n var(\n --sinch-comp-time-picker-header-color-default-icon-initial\n );\n }\n\n :host([ampm]) .digit-hour-24 {\n display: none;\n }\n\n :host(:not([ampm])) #footer {\n display: none;\n }\n</style>\n\n<div id="wrapper">\n <div id="header">\n <div\n id="header-hours"\n role="meter"\n aria-valuemin="0"\n aria-valuemax="23"\n aria-valuenow="0"\n aria-valuetext="0"\n >\n <span>00</span>\n </div>\n <div id="header-colon">:</div>\n <div\n id="header-minutes"\n role="meter"\n aria-valuemin="0"\n aria-valuemax="59"\n aria-valuenow="0"\n aria-valuetext="0"\n >\n <span>00</span>\n </div>\n <sinch-button id="submit" size="s" aria-label="Submit">\n <sinch-icon icons-version="2" name="fa-check" id="icon-submit" slot="icon"></sinch-icon>\n </sinch-button>\n </div>\n <div id="picker" aria-hidden="true">\n <div id="picker-hours"></div>\n <div id="picker-minutes"></div>\n <div id="picker-touch">\n <div id="needle-hour" tabindex="0"></div>\n <div id="needle-minute" tabindex="0"></div>\n </div>\n </div>\n <div id="footer">\n <sinch-segmented-control id="ampm">\n <sinch-segmented-control-option\n value="am"\n text="AM"\n aria-label="AM"\n ></sinch-segmented-control-option>\n <sinch-segmented-control-option\n value="pm"\n text="PM"\n aria-label="PM"\n ></sinch-segmented-control-option>\n </sinch-segmented-control>\n </div>\n</div>\n';
|
|
10
|
-
const template = document.createElement("template");
|
|
1
|
+
import '../icon';
|
|
2
|
+
import '../segmented-control';
|
|
3
|
+
import '../segmented-control-option';
|
|
4
|
+
import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, getRect, isAttrEqual, isAttrTrue, NectaryElement, setClass, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
5
|
+
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{display:flex;flex-direction:column;width:248px;padding:16px;box-sizing:border-box;gap:16px}#header{position:relative;width:100%;height:48px;font:var(--sinch-comp-time-picker-header-font);line-height:48px;user-select:none;color:var(--sinch-comp-time-picker-header-color-default-text-initial)}#footer{display:flex;justify-content:center;width:100%;height:32px}#picker{position:relative;width:216px;height:216px;border-radius:50%;box-sizing:border-box;border:1px solid var(--sinch-comp-time-picker-watch-face-color-default-border-initial);background-color:var(--sinch-comp-time-picker-watch-face-color-default-background-initial)}#picker-hours,#picker-minutes{position:absolute;left:0;top:0;width:100%;height:100%;border-radius:50%;pointer-events:none;user-select:none}.digit-hour-12,.digit-hour-24,.digit-minute{position:absolute;width:28px;height:28px;text-align:center;top:calc(50% - 14px);left:calc(50% - 14px);z-index:1;cursor:pointer}.digit-hour-12{font:var(--sinch-comp-time-picker-digit-font-default-h12);color:var(--sinch-comp-time-picker-digit-color-default-h12-initial);line-height:28px}.digit-hour-12.selected{font:var(--sinch-comp-time-picker-digit-font-checked-h12);color:var(--sinch-comp-time-picker-digit-color-checked-h12-default)}.digit-hour-24{font:var(--sinch-comp-time-picker-digit-font-default-h24);color:var(--sinch-comp-time-picker-digit-color-default-h24-initial);line-height:28px}.digit-hour-24.selected{font:var(--sinch-comp-time-picker-digit-font-checked-h24);color:var(--sinch-comp-time-picker-digit-color-checked-h24-initial)}.digit-minute{font:var(--sinch-comp-time-picker-digit-font-default-minutes);color:var(--sinch-comp-time-picker-digit-color-default-minute-initial);line-height:28px}.digit-minute.selected{font:var(--sinch-comp-time-picker-digit-font-checked-minutes);color:var(--sinch-comp-time-picker-digit-color-checked-minute-initial)}#picker-touch{position:absolute;left:0;top:0;width:100%;height:100%;cursor:pointer;border-radius:50%}#needle-hour,#needle-minute,#picker-touch::after{background-color:var(--sinch-comp-time-picker-needle-color-default-background-initial)}#needle-hour,#needle-minute{position:absolute;transform-origin:bottom center;transform:rotate(0);bottom:50%;height:50px;transition-duration:.25s;transition-timing-function:ease-in-out;transition-property:transform height;z-index:2;outline:0}@media (prefers-reduced-motion){#needle-hour,#needle-minute{transition:none}}#needle-hour{width:4px;left:calc(50% - 2px);border-radius:2px}#needle-minute{width:2px;left:calc(50% - 1px);border-radius:1px}#needle-hour:focus-visible,#needle-minute:focus-visible{background-color:var(--sinch-comp-time-picker-needle-color-default-background-focus)}#needle-minute:not(.selected)::after{content:"";position:absolute;transform:translateX(-50%);left:0;top:-16px;width:4px;height:4px;border-radius:50%;background-color:var(--sinch-comp-time-picker-digit-color-checked-minute-initial)}#picker-touch::after{content:"";position:absolute;top:50%;left:50%;width:12px;height:12px;border-radius:50%;transform:translate(-50%,-50%)}#header-hours,#header-minutes{position:absolute;padding:0 4px;width:50px;outline:0}#header-hours{right:calc(50% + 8px);text-align:right}#header-minutes{left:calc(50% + 8px)}#header-colon{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}#submit{position:absolute;right:0;top:50%;transform:translateY(-50%)}#submit-icon{--sinch-global-color-icon:var(--sinch-comp-time-picker-header-color-default-icon-initial)}:host([ampm]) .digit-hour-24{display:none}:host(:not([ampm])) #footer{display:none}</style><div id="wrapper"><div id="header"><div id="header-hours" role="meter" aria-valuemin="0" aria-valuemax="23" aria-valuenow="0" aria-valuetext="0"><span>00</span></div><div id="header-colon">:</div><div id="header-minutes" role="meter" aria-valuemin="0" aria-valuemax="59" aria-valuenow="0" aria-valuetext="0"><span>00</span></div><sinch-button id="submit" size="s" aria-label="Submit"><sinch-icon icons-version="2" name="fa-check" id="icon-submit" slot="icon"></sinch-icon></sinch-button></div><div id="picker" aria-hidden="true"><div id="picker-hours"></div><div id="picker-minutes"></div><div id="picker-touch"><div id="needle-hour" tabindex="0"></div><div id="needle-minute" tabindex="0"></div></div></div><div id="footer"><sinch-segmented-control id="ampm"><sinch-segmented-control-option value="am" text="AM" aria-label="AM"></sinch-segmented-control-option><sinch-segmented-control-option value="pm" text="PM" aria-label="PM"></sinch-segmented-control-option></sinch-segmented-control></div></div>';
|
|
6
|
+
import { getNeedleRotationDeg, getShortestCssDeg, hourToIndex, parseTime, stringifyHour, stringifyHourFace, stringifyMinute, stringifyTime } from './utils';
|
|
7
|
+
const template = document.createElement('template');
|
|
11
8
|
template.innerHTML = templateHTML;
|
|
12
9
|
const PICKER_RADIUS = 216 / 2;
|
|
13
10
|
const MINUTE_DIGIT_SIZE = 30;
|
|
@@ -19,7 +16,7 @@ const HOUR_24_RADIUS = HOUR_12_RADIUS - HOUR_24_DIGIT_SIZE;
|
|
|
19
16
|
const NEEDLE_HOUR_12_LENGTH = HOUR_12_RADIUS;
|
|
20
17
|
const NEEDLE_HOUR_24_LENGTH = HOUR_24_RADIUS;
|
|
21
18
|
const NEEDLE_MINUTE_LENGTH = MINUTE_RADIUS;
|
|
22
|
-
class TimePicker extends NectaryElement {
|
|
19
|
+
export class TimePicker extends NectaryElement {
|
|
23
20
|
#$pickerHours;
|
|
24
21
|
#$pickerMinutes;
|
|
25
22
|
#$pickerTouch;
|
|
@@ -38,17 +35,17 @@ class TimePicker extends NectaryElement {
|
|
|
38
35
|
super();
|
|
39
36
|
const shadowRoot = this.attachShadow();
|
|
40
37
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
41
|
-
this.#$pickerHours = shadowRoot.querySelector(
|
|
42
|
-
this.#$pickerMinutes = shadowRoot.querySelector(
|
|
43
|
-
this.#$pickerTouch = shadowRoot.querySelector(
|
|
44
|
-
this.#$needleHour = shadowRoot.querySelector(
|
|
45
|
-
this.#$needleMinute = shadowRoot.querySelector(
|
|
46
|
-
this.#$headerHours = shadowRoot.querySelector(
|
|
47
|
-
this.#$headerMinutes = shadowRoot.querySelector(
|
|
48
|
-
this.#$headerHoursText = shadowRoot.querySelector(
|
|
49
|
-
this.#$headerMinutesText = shadowRoot.querySelector(
|
|
50
|
-
this.#$ampm = shadowRoot.querySelector(
|
|
51
|
-
this.#$submitButton = shadowRoot.querySelector(
|
|
38
|
+
this.#$pickerHours = shadowRoot.querySelector('#picker-hours');
|
|
39
|
+
this.#$pickerMinutes = shadowRoot.querySelector('#picker-minutes');
|
|
40
|
+
this.#$pickerTouch = shadowRoot.querySelector('#picker');
|
|
41
|
+
this.#$needleHour = shadowRoot.querySelector('#needle-hour');
|
|
42
|
+
this.#$needleMinute = shadowRoot.querySelector('#needle-minute');
|
|
43
|
+
this.#$headerHours = shadowRoot.querySelector('#header-hours');
|
|
44
|
+
this.#$headerMinutes = shadowRoot.querySelector('#header-minutes');
|
|
45
|
+
this.#$headerHoursText = shadowRoot.querySelector('#header-hours > span');
|
|
46
|
+
this.#$headerMinutesText = shadowRoot.querySelector('#header-minutes > span');
|
|
47
|
+
this.#$ampm = shadowRoot.querySelector('#ampm');
|
|
48
|
+
this.#$submitButton = shadowRoot.querySelector('#submit');
|
|
52
49
|
this.#$needleMinute.style.height = `${NEEDLE_MINUTE_LENGTH}px`;
|
|
53
50
|
this.#$needleHour.style.height = `${NEEDLE_HOUR_12_LENGTH}px`;
|
|
54
51
|
const MINUTE_DIGIT_RADIUS = MINUTE_RADIUS + MINUTE_DIGIT_SIZE / 2;
|
|
@@ -57,11 +54,11 @@ class TimePicker extends NectaryElement {
|
|
|
57
54
|
const hours12Frag = document.createDocumentFragment();
|
|
58
55
|
for (let i = 0; i < 12; i++) {
|
|
59
56
|
const rad = Math.PI / 6 * (i - 3);
|
|
60
|
-
const el = document.createElement(
|
|
57
|
+
const el = document.createElement('div');
|
|
61
58
|
const x = Math.cos(rad) * HOUR_12_DIGIT_RADIUS;
|
|
62
59
|
const y = Math.sin(rad) * HOUR_12_DIGIT_RADIUS;
|
|
63
60
|
const hourDisplayValue = stringifyHourFace(i);
|
|
64
|
-
el.className =
|
|
61
|
+
el.className = 'digit-hour-12';
|
|
65
62
|
el.style.transform = `translate(${x}px, ${y}px)`;
|
|
66
63
|
el.textContent = hourDisplayValue;
|
|
67
64
|
hours12Frag.appendChild(el);
|
|
@@ -70,11 +67,11 @@ class TimePicker extends NectaryElement {
|
|
|
70
67
|
const hours24Frag = document.createDocumentFragment();
|
|
71
68
|
for (let i = 12; i < 24; i++) {
|
|
72
69
|
const rad = Math.PI / 6 * (i - 3);
|
|
73
|
-
const el = document.createElement(
|
|
70
|
+
const el = document.createElement('div');
|
|
74
71
|
const x = Math.cos(rad) * HOUR_24_DIGIT_RADIUS;
|
|
75
72
|
const y = Math.sin(rad) * HOUR_24_DIGIT_RADIUS;
|
|
76
73
|
const hourDisplayValue = stringifyHourFace(i);
|
|
77
|
-
el.className =
|
|
74
|
+
el.className = 'digit-hour-24';
|
|
78
75
|
el.style.transform = `translate(${x}px, ${y}px)`;
|
|
79
76
|
el.textContent = hourDisplayValue;
|
|
80
77
|
hours24Frag.appendChild(el);
|
|
@@ -83,10 +80,10 @@ class TimePicker extends NectaryElement {
|
|
|
83
80
|
const minutesFrag = document.createDocumentFragment();
|
|
84
81
|
for (let i = 0; i < 60; i += 5) {
|
|
85
82
|
const rad = Math.PI / 30 * (i - 15);
|
|
86
|
-
const el = document.createElement(
|
|
83
|
+
const el = document.createElement('div');
|
|
87
84
|
const x = Math.cos(rad) * MINUTE_DIGIT_RADIUS;
|
|
88
85
|
const y = Math.sin(rad) * MINUTE_DIGIT_RADIUS;
|
|
89
|
-
el.className =
|
|
86
|
+
el.className = 'digit-minute';
|
|
90
87
|
el.style.transform = `translate(${x}px, ${y}px)`;
|
|
91
88
|
el.textContent = stringifyMinute(i);
|
|
92
89
|
minutesFrag.appendChild(el);
|
|
@@ -98,60 +95,66 @@ class TimePicker extends NectaryElement {
|
|
|
98
95
|
const options = {
|
|
99
96
|
signal: this.#controller.signal
|
|
100
97
|
};
|
|
101
|
-
this.#$pickerTouch.addEventListener(
|
|
102
|
-
this.#$ampm.addEventListener(
|
|
103
|
-
this.#$submitButton.addEventListener(
|
|
104
|
-
this.#$needleHour.addEventListener(
|
|
105
|
-
this.#$needleMinute.addEventListener(
|
|
106
|
-
this.addEventListener(
|
|
98
|
+
this.#$pickerTouch.addEventListener('click', this.#onPickerClick, options);
|
|
99
|
+
this.#$ampm.addEventListener('-change', this.#onAmPmChange, options);
|
|
100
|
+
this.#$submitButton.addEventListener('click', this.#onSubmitButtonClick, options);
|
|
101
|
+
this.#$needleHour.addEventListener('keydown', this.#onHoursKeydown, options);
|
|
102
|
+
this.#$needleMinute.addEventListener('keydown', this.#onMinutesKeydown, options);
|
|
103
|
+
this.addEventListener('-change', this.#onChangeReactHandler, options);
|
|
107
104
|
}
|
|
108
105
|
disconnectedCallback() {
|
|
109
106
|
this.#controller.abort();
|
|
110
107
|
this.#controller = null;
|
|
111
108
|
}
|
|
112
109
|
static get observedAttributes() {
|
|
113
|
-
return [
|
|
110
|
+
return ['value', 'ampm', 'submit-aria-label'];
|
|
114
111
|
}
|
|
115
112
|
attributeChangedCallback(name, prevValue, newVal) {
|
|
116
113
|
if (isAttrEqual(prevValue, newVal)) {
|
|
117
114
|
return;
|
|
118
115
|
}
|
|
119
116
|
switch (name) {
|
|
120
|
-
case
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
117
|
+
case 'value':
|
|
118
|
+
{
|
|
119
|
+
const {
|
|
120
|
+
hours,
|
|
121
|
+
minutes
|
|
122
|
+
} = parseTime(newVal);
|
|
123
|
+
this.#hour = hours;
|
|
124
|
+
this.#minute = minutes;
|
|
125
|
+
this.#render();
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
case 'ampm':
|
|
129
|
+
{
|
|
130
|
+
this.#render();
|
|
131
|
+
updateBooleanAttribute(this, 'ampm', isAttrTrue(newVal));
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
case 'submit-aria-label':
|
|
135
|
+
{
|
|
136
|
+
updateAttribute(this.#$submitButton, 'aria-label', newVal);
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
136
139
|
}
|
|
137
140
|
}
|
|
138
141
|
set value(value) {
|
|
139
|
-
updateAttribute(this,
|
|
142
|
+
updateAttribute(this, 'value', value);
|
|
140
143
|
}
|
|
141
144
|
get value() {
|
|
142
|
-
return getAttribute(this,
|
|
145
|
+
return getAttribute(this, 'value', '');
|
|
143
146
|
}
|
|
144
147
|
set ampm(value) {
|
|
145
|
-
updateBooleanAttribute(this,
|
|
148
|
+
updateBooleanAttribute(this, 'ampm', value);
|
|
146
149
|
}
|
|
147
150
|
get ampm() {
|
|
148
|
-
return getBooleanAttribute(this,
|
|
151
|
+
return getBooleanAttribute(this, 'ampm');
|
|
149
152
|
}
|
|
150
153
|
set submitAriaLabel(value) {
|
|
151
|
-
updateAttribute(this,
|
|
154
|
+
updateAttribute(this, 'submit-aria-label', value);
|
|
152
155
|
}
|
|
153
156
|
get submitAriaLabel() {
|
|
154
|
-
return getAttribute(this,
|
|
157
|
+
return getAttribute(this, 'submit-aria-label', '');
|
|
155
158
|
}
|
|
156
159
|
get submitButtonRect() {
|
|
157
160
|
return getRect(this.#$submitButton);
|
|
@@ -197,13 +200,13 @@ class TimePicker extends NectaryElement {
|
|
|
197
200
|
const rowIndex = len > MINUTE_RADIUS ? 0 : len > HOUR_12_RADIUS ? 1 : 2;
|
|
198
201
|
return [cssDeg, rowIndex];
|
|
199
202
|
}
|
|
200
|
-
#onPickerClick =
|
|
203
|
+
#onPickerClick = e => {
|
|
201
204
|
const [cssDeg, rowIndex] = this.#getClickDegree(e.x, e.y);
|
|
202
205
|
const isHourRowClick = rowIndex > 0;
|
|
203
206
|
const isHour24RowClick = rowIndex > 1;
|
|
204
207
|
if (isHourRowClick) {
|
|
205
208
|
const digitIndex = Math.round(cssDeg / 30) % 12;
|
|
206
|
-
const is24 = getBooleanAttribute(this,
|
|
209
|
+
const is24 = getBooleanAttribute(this, 'ampm') === false;
|
|
207
210
|
if (is24) {
|
|
208
211
|
if (isHour24RowClick) {
|
|
209
212
|
this.#hour = digitIndex === 0 ? 0 : digitIndex + 12;
|
|
@@ -211,7 +214,7 @@ class TimePicker extends NectaryElement {
|
|
|
211
214
|
this.#hour = digitIndex === 0 ? 12 : digitIndex;
|
|
212
215
|
}
|
|
213
216
|
} else {
|
|
214
|
-
this.#hour = digitIndex + (this.#$ampm.value ===
|
|
217
|
+
this.#hour = digitIndex + (this.#$ampm.value === 'pm' ? 12 : 0);
|
|
215
218
|
}
|
|
216
219
|
this.#$headerHours.focus();
|
|
217
220
|
} else {
|
|
@@ -221,15 +224,15 @@ class TimePicker extends NectaryElement {
|
|
|
221
224
|
this.#render();
|
|
222
225
|
};
|
|
223
226
|
#render() {
|
|
224
|
-
const is24 = getBooleanAttribute(this,
|
|
227
|
+
const is24 = getBooleanAttribute(this, 'ampm') === false;
|
|
225
228
|
this.#selectHour(is24);
|
|
226
229
|
this.#selectMinute();
|
|
227
230
|
this.#$headerHoursText.textContent = stringifyHour(this.#hour, is24);
|
|
228
231
|
this.#$headerMinutesText.textContent = stringifyMinute(this.#minute);
|
|
229
|
-
updateAttribute(this.#$headerHours,
|
|
230
|
-
updateAttribute(this.#$headerHours,
|
|
231
|
-
updateAttribute(this.#$headerMinutes,
|
|
232
|
-
updateAttribute(this.#$headerMinutes,
|
|
232
|
+
updateAttribute(this.#$headerHours, 'aria-valuenow', this.#hour);
|
|
233
|
+
updateAttribute(this.#$headerHours, 'aria-valuetext', this.#hour);
|
|
234
|
+
updateAttribute(this.#$headerMinutes, 'aria-valuenow', this.#minute);
|
|
235
|
+
updateAttribute(this.#$headerMinutes, 'aria-valuetext', this.#minute);
|
|
233
236
|
}
|
|
234
237
|
#selectHour(is24) {
|
|
235
238
|
const $hours = this.#$pickerHours.children;
|
|
@@ -238,7 +241,7 @@ class TimePicker extends NectaryElement {
|
|
|
238
241
|
const currentCssDeg = getNeedleRotationDeg(this.#$needleHour);
|
|
239
242
|
const hourCssDeg = getShortestCssDeg(currentCssDeg, hourDigitIndex * 30);
|
|
240
243
|
for (let i = 0; i < $hours.length; i++) {
|
|
241
|
-
setClass($hours[i],
|
|
244
|
+
setClass($hours[i], 'selected', i === selectedIndex);
|
|
242
245
|
}
|
|
243
246
|
this.#$needleHour.style.transform = `rotate(${hourCssDeg}deg)`;
|
|
244
247
|
if (is24) {
|
|
@@ -250,7 +253,7 @@ class TimePicker extends NectaryElement {
|
|
|
250
253
|
} else {
|
|
251
254
|
this.#$needleHour.style.height = `${NEEDLE_HOUR_12_LENGTH}px`;
|
|
252
255
|
}
|
|
253
|
-
this.#$ampm.setAttribute(
|
|
256
|
+
this.#$ampm.setAttribute('value', this.#hour >= 0 && this.#hour < 12 ? 'am' : 'pm');
|
|
254
257
|
}
|
|
255
258
|
#selectMinute() {
|
|
256
259
|
const $minutes = this.#$pickerMinutes.children;
|
|
@@ -259,75 +262,76 @@ class TimePicker extends NectaryElement {
|
|
|
259
262
|
const currentCssDeg = getNeedleRotationDeg(this.#$needleMinute);
|
|
260
263
|
const minuteCssDeg = getShortestCssDeg(currentCssDeg, this.#minute * 6);
|
|
261
264
|
for (let i = 0; i < $minutes.length; i++) {
|
|
262
|
-
setClass($minutes[i],
|
|
265
|
+
setClass($minutes[i], 'selected', selectedIndex === i);
|
|
263
266
|
}
|
|
264
|
-
setClass(this.#$needleMinute,
|
|
267
|
+
setClass(this.#$needleMinute, 'selected', isNeedleSelected);
|
|
265
268
|
this.#$needleMinute.style.transform = `rotate(${minuteCssDeg}deg)`;
|
|
266
269
|
}
|
|
267
|
-
#onAmPmChange =
|
|
270
|
+
#onAmPmChange = e => {
|
|
268
271
|
const value = e.detail;
|
|
269
272
|
switch (value) {
|
|
270
|
-
case
|
|
271
|
-
|
|
272
|
-
this.#hour
|
|
273
|
-
|
|
273
|
+
case 'am':
|
|
274
|
+
{
|
|
275
|
+
if (this.#hour >= 12) {
|
|
276
|
+
this.#hour -= 12;
|
|
277
|
+
this.#render();
|
|
278
|
+
}
|
|
279
|
+
break;
|
|
274
280
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
+
case 'pm':
|
|
282
|
+
{
|
|
283
|
+
if (this.#hour < 12) {
|
|
284
|
+
this.#hour += 12;
|
|
285
|
+
this.#render();
|
|
286
|
+
}
|
|
287
|
+
break;
|
|
281
288
|
}
|
|
282
|
-
break;
|
|
283
|
-
}
|
|
284
289
|
}
|
|
285
290
|
};
|
|
286
291
|
#onSubmitButtonClick = () => {
|
|
287
292
|
const value = stringifyTime(this.#hour, this.#minute);
|
|
288
|
-
this.dispatchEvent(
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
})
|
|
292
|
-
);
|
|
293
|
+
this.dispatchEvent(new CustomEvent('-change', {
|
|
294
|
+
detail: value
|
|
295
|
+
}));
|
|
293
296
|
};
|
|
294
|
-
#onHoursKeydown =
|
|
297
|
+
#onHoursKeydown = e => {
|
|
295
298
|
switch (e.key) {
|
|
296
|
-
case
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
299
|
+
case 'ArrowUp':
|
|
300
|
+
{
|
|
301
|
+
e.preventDefault();
|
|
302
|
+
this.#hour = (this.#hour + 1) % 24;
|
|
303
|
+
this.#render();
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
case 'ArrowDown':
|
|
307
|
+
{
|
|
308
|
+
e.preventDefault();
|
|
309
|
+
this.#hour = (this.#hour + 23) % 24;
|
|
310
|
+
this.#render();
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
308
313
|
}
|
|
309
314
|
};
|
|
310
|
-
#onMinutesKeydown =
|
|
315
|
+
#onMinutesKeydown = e => {
|
|
311
316
|
switch (e.key) {
|
|
312
|
-
case
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
317
|
+
case 'ArrowUp':
|
|
318
|
+
{
|
|
319
|
+
e.preventDefault();
|
|
320
|
+
this.#minute = (this.#minute + 1) % 60;
|
|
321
|
+
this.#render();
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
case 'ArrowDown':
|
|
325
|
+
{
|
|
326
|
+
e.preventDefault();
|
|
327
|
+
this.#minute = (this.#minute + 59) % 60;
|
|
328
|
+
this.#render();
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
324
331
|
}
|
|
325
332
|
};
|
|
326
|
-
#onChangeReactHandler =
|
|
327
|
-
getReactEventHandler(this,
|
|
333
|
+
#onChangeReactHandler = e => {
|
|
334
|
+
getReactEventHandler(this, 'on-change')?.(e);
|
|
328
335
|
};
|
|
329
336
|
}
|
|
330
|
-
defineCustomElement(
|
|
331
|
-
export {
|
|
332
|
-
TimePicker
|
|
333
|
-
};
|
|
337
|
+
defineCustomElement('sinch-time-picker', TimePicker);
|
package/time-picker/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NectaryComponentReactByType, NectaryComponentVanillaByType, TRect
|
|
1
|
+
import type { NectaryComponentReactByType, NectaryComponentVanillaByType, TRect } from '../types';
|
|
2
2
|
export type TSinchTimePickerProps = {
|
|
3
3
|
/** Time value in ISO 8601 format */
|
|
4
4
|
value: string;
|
|
@@ -50,23 +50,3 @@ export type TSinchTimePicker = {
|
|
|
50
50
|
};
|
|
51
51
|
export type TSinchTimePickerElement = NectaryComponentVanillaByType<TSinchTimePicker>;
|
|
52
52
|
export type TSinchTimePickerReact = NectaryComponentReactByType<TSinchTimePicker>;
|
|
53
|
-
declare global {
|
|
54
|
-
interface NectaryComponentMap {
|
|
55
|
-
'sinch-time-picker': TSinchTimePicker;
|
|
56
|
-
}
|
|
57
|
-
interface HTMLElementTagNameMap {
|
|
58
|
-
'sinch-time-picker': NectaryComponentVanilla<'sinch-time-picker'>;
|
|
59
|
-
}
|
|
60
|
-
namespace JSX {
|
|
61
|
-
interface IntrinsicElements {
|
|
62
|
-
'sinch-time-picker': NectaryComponentReact<'sinch-time-picker'>;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
declare module 'react' {
|
|
67
|
-
namespace JSX {
|
|
68
|
-
interface IntrinsicElements extends globalThis.JSX.IntrinsicElements {
|
|
69
|
-
'sinch-time-picker': NectaryComponentReact<'sinch-time-picker'>;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
package/time-picker/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
package/time-picker/utils.js
CHANGED
|
@@ -1,40 +1,52 @@
|
|
|
1
|
-
const parseTime =
|
|
2
|
-
if (value ===
|
|
3
|
-
return {
|
|
1
|
+
export const parseTime = value => {
|
|
2
|
+
if (value === '' || value === null) {
|
|
3
|
+
return {
|
|
4
|
+
hours: 0,
|
|
5
|
+
minutes: 0
|
|
6
|
+
};
|
|
4
7
|
}
|
|
5
|
-
const timeParts = value.split(
|
|
6
|
-
const hours = parseInt(timeParts[0] ??
|
|
7
|
-
const minutes = parseInt(timeParts[1] ??
|
|
8
|
+
const timeParts = value.split(':');
|
|
9
|
+
const hours = parseInt(timeParts[0] ?? '00');
|
|
10
|
+
const minutes = parseInt(timeParts[1] ?? '00');
|
|
8
11
|
if (isNaN(hours) || hours > 23 || hours < 0) {
|
|
9
|
-
return {
|
|
12
|
+
return {
|
|
13
|
+
hours: 0,
|
|
14
|
+
minutes: 0
|
|
15
|
+
};
|
|
10
16
|
}
|
|
11
17
|
if (isNaN(minutes) || minutes > 59 || minutes < 0) {
|
|
12
|
-
return {
|
|
18
|
+
return {
|
|
19
|
+
hours: 0,
|
|
20
|
+
minutes: 0
|
|
21
|
+
};
|
|
13
22
|
}
|
|
14
|
-
return {
|
|
23
|
+
return {
|
|
24
|
+
hours,
|
|
25
|
+
minutes
|
|
26
|
+
};
|
|
15
27
|
};
|
|
16
|
-
const pad =
|
|
17
|
-
return value.toString().padStart(2,
|
|
28
|
+
const pad = value => {
|
|
29
|
+
return value.toString().padStart(2, '0');
|
|
18
30
|
};
|
|
19
|
-
const stringifyTime = (hour, minute) => {
|
|
31
|
+
export const stringifyTime = (hour, minute) => {
|
|
20
32
|
return `${pad(hour)}:${pad(minute)}:00`;
|
|
21
33
|
};
|
|
22
|
-
const stringifyHour = (hour, is24) => {
|
|
34
|
+
export const stringifyHour = (hour, is24) => {
|
|
23
35
|
if (is24) {
|
|
24
36
|
return pad(hour);
|
|
25
37
|
}
|
|
26
38
|
if (hour === 0 || hour === 12) {
|
|
27
|
-
return
|
|
39
|
+
return '12';
|
|
28
40
|
}
|
|
29
41
|
return pad(hour % 12);
|
|
30
42
|
};
|
|
31
|
-
const stringifyHourFace =
|
|
32
|
-
return hour === 0 ?
|
|
43
|
+
export const stringifyHourFace = hour => {
|
|
44
|
+
return hour === 0 ? '12' : hour === 12 ? '24' : String(hour);
|
|
33
45
|
};
|
|
34
|
-
const stringifyMinute =
|
|
46
|
+
export const stringifyMinute = minute => {
|
|
35
47
|
return pad(minute);
|
|
36
48
|
};
|
|
37
|
-
const hourToIndex = (hour, is24) => {
|
|
49
|
+
export const hourToIndex = (hour, is24) => {
|
|
38
50
|
if (is24) {
|
|
39
51
|
if (hour === 0) {
|
|
40
52
|
return 12;
|
|
@@ -46,28 +58,18 @@ const hourToIndex = (hour, is24) => {
|
|
|
46
58
|
}
|
|
47
59
|
return hour % 12;
|
|
48
60
|
};
|
|
49
|
-
const getNeedleRotationDeg =
|
|
61
|
+
export const getNeedleRotationDeg = elem => {
|
|
50
62
|
const match = elem.style.transform.match(/^rotate\((-?\d+)deg\)$/);
|
|
51
63
|
if (match === null) {
|
|
52
64
|
return 0;
|
|
53
65
|
}
|
|
54
66
|
return Number(match[1]);
|
|
55
67
|
};
|
|
56
|
-
const getShortestCssDeg = (currentDeg, nextDeg) => {
|
|
68
|
+
export const getShortestCssDeg = (currentDeg, nextDeg) => {
|
|
57
69
|
const angle = currentDeg % 360;
|
|
58
70
|
const diff = (360 - (angle - nextDeg)) % 360;
|
|
59
71
|
if (diff > 180) {
|
|
60
72
|
return currentDeg - 360 + diff;
|
|
61
73
|
}
|
|
62
74
|
return currentDeg + diff;
|
|
63
|
-
};
|
|
64
|
-
export {
|
|
65
|
-
getNeedleRotationDeg,
|
|
66
|
-
getShortestCssDeg,
|
|
67
|
-
hourToIndex,
|
|
68
|
-
parseTime,
|
|
69
|
-
stringifyHour,
|
|
70
|
-
stringifyHourFace,
|
|
71
|
-
stringifyMinute,
|
|
72
|
-
stringifyTime
|
|
73
|
-
};
|
|
75
|
+
};
|
package/title/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NectaryElement } from '../utils';
|
|
2
|
-
import type { TSinchTitleType } from './types';
|
|
3
|
-
|
|
2
|
+
import type { TSinchTitleType, TSinchTitle } from './types';
|
|
3
|
+
import type { NectaryComponentReact, NectaryComponentVanilla } from '../types';
|
|
4
4
|
export declare class Title extends NectaryElement {
|
|
5
5
|
#private;
|
|
6
6
|
constructor();
|
|
@@ -14,3 +14,23 @@ export declare class Title extends NectaryElement {
|
|
|
14
14
|
set ellipsis(isEllipsis: boolean);
|
|
15
15
|
get ellipsis(): boolean;
|
|
16
16
|
}
|
|
17
|
+
declare global {
|
|
18
|
+
interface NectaryComponentMap {
|
|
19
|
+
'sinch-title': TSinchTitle;
|
|
20
|
+
}
|
|
21
|
+
interface HTMLElementTagNameMap {
|
|
22
|
+
'sinch-title': NectaryComponentVanilla<'sinch-title'>;
|
|
23
|
+
}
|
|
24
|
+
namespace JSX {
|
|
25
|
+
interface IntrinsicElements {
|
|
26
|
+
'sinch-title': NectaryComponentReact<'sinch-title'>;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
declare module 'react' {
|
|
31
|
+
namespace JSX {
|
|
32
|
+
interface IntrinsicElements extends globalThis.JSX.IntrinsicElements {
|
|
33
|
+
'sinch-title': NectaryComponentReact<'sinch-title'>;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|