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