@nectary/components 4.11.2 → 4.12.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/date-picker/index.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import "../icon/index.js";
|
|
2
|
+
import "../text/index.js";
|
|
3
|
+
import { packCsv, unpackCsv } from "../utils/csv.js";
|
|
4
|
+
import { getBooleanAttribute, updateAttribute, getAttribute, updateBooleanAttribute, setClass, isAttrTrue } 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 { getTargetAttribute } from "../utils/event-target.js";
|
|
9
|
+
import { setFormValue } from "../utils/form.js";
|
|
10
|
+
import { getDayNames, getMonthNames, isoToDate, clampMaxDate, clampMinDate, decMonth, incMonth, decYear, incYear, today, isDateBetween, areDatesEqual, sortDates, dateToIso, isValidDate, isDateOnScreen, cloneDate, getCalendarMonth, canGoPrevMonth, canGoNextMonth, canGoPrevYear, canGoNextYear } from "./utils.js";
|
|
11
|
+
const templateHTML = '<style>\n :host {\n display: block;\n outline: none;\n }\n\n #content {\n width: fit-content;\n box-sizing: border-box;\n padding: 16px;\n display: flex;\n flex-direction: column;\n gap: 8px;\n }\n\n #month {\n display: flex;\n flex-direction: column;\n row-gap: 8px;\n }\n\n .week {\n display: flex;\n flex-direction: row;\n column-gap: 8px;\n }\n\n .week.empty {\n display: none;\n }\n\n .day {\n all: initial;\n font: var(--sinch-comp-date-picker-font-day);\n width: 24px;\n height: 24px;\n line-height: 22px;\n color: var(--sinch-comp-date-picker-day-color-default-text-initial);\n background-color:\n var(\n --sinch-comp-date-picker-day-color-default-background-initial\n );\n border:\n 1px solid\n var(--sinch-comp-date-picker-day-color-default-border-initial);\n border-radius: var(--sinch-comp-date-picker-day-shape-radius);\n text-align: center;\n box-sizing: border-box;\n user-select: none;\n cursor: pointer;\n }\n\n .day:focus-visible {\n outline:\n 1px solid\n var(--sinch-comp-date-picker-day-color-default-outline-focus);\n outline-offset: 1px;\n }\n\n .day:disabled {\n cursor: initial;\n color: var(--sinch-comp-date-picker-day-color-disabled-text-initial);\n }\n\n .day:enabled:hover {\n background-color:\n var(\n --sinch-comp-date-picker-day-color-default-background-hover\n );\n }\n\n .day:enabled.range {\n background-color:\n var(\n --sinch-comp-date-picker-day-color-default-range-background\n );\n }\n\n .day:enabled.selected {\n color: var(--sinch-comp-date-picker-day-color-checked-text-initial);\n background-color:\n var(\n --sinch-comp-date-picker-day-color-checked-background-initial\n );\n border-color:\n var(\n --sinch-comp-date-picker-day-color-checked-border-initial\n );\n }\n\n .day.today {\n font: var(--sinch-comp-date-picker-font-today);\n color: var(--sinch-comp-date-picker-today-color-default-text-initial);\n background-color:\n var(\n --sinch-comp-date-picker-today-color-default-background-initial\n );\n border-color:\n var(\n --sinch-comp-date-picker-today-color-default-border-initial\n );\n }\n\n .day.today:hover {\n background-color:\n var(\n --sinch-comp-date-picker-today-color-default-background-hover\n );\n }\n\n .day.today:disabled {\n color: var(--sinch-comp-date-picker-today-color-disabled-text-initial);\n border-color:\n var(\n --sinch-comp-date-picker-today-color-disabled-border-initial\n );\n }\n\n .day.today.selected {\n color: var(--sinch-comp-date-picker-today-color-checked-text-initial);\n background-color:\n var(\n --sinch-comp-date-picker-today-color-checked-background-initial\n );\n border-color:\n var(\n --sinch-comp-date-picker-today-color-checked-border-initial\n );\n }\n\n #week-day-names {\n display: flex;\n flex-direction: row;\n gap: 8px;\n height: 24px;\n }\n\n .week-day-name {\n font: var(--sinch-comp-date-picker-font-weekday);\n color: var(--sinch-comp-date-picker-weekday-color-default-text-initial);\n text-align: center;\n width: 24px;\n height: 24px;\n line-height: 24px;\n user-select: none;\n text-transform: uppercase;\n }\n\n #content-header {\n display: flex;\n flex-direction: row;\n height: 32px;\n align-items: center;\n }\n\n #date {\n flex: 1;\n text-align: center;\n text-transform: capitalize;\n\n --sinch-com-text-font: var(--sinch-comp-date-picker-font-header);\n --sinch-global-color-text:\n var(\n --sinch-comp-date-picker-header-color-default-text-initial\n );\n }\n\n #prev-year {\n margin-left: -4px;\n }\n\n #next-year {\n margin-right: -4px;\n }\n</style>\n\n<div id="content">\n <div id="content-header">\n <sinch-button id="prev-year" size="s">\n <sinch-icon icons-version="2" name="fa-angles-left"\n id="icon-prev-year"\n slot="icon"\n ></sinch-icon>\n </sinch-button>\n <sinch-button id="prev-month" size="s">\n <sinch-icon icons-version="2" name="fa-angle-left"\n id="icon-prev-month"\n slot="icon"\n ></sinch-icon>\n </sinch-button>\n <sinch-text id="date" type="m" emphasized aria-live="polite"></sinch-text>\n <sinch-button id="next-month" size="s">\n <sinch-icon icons-version="2" name="fa-angle-right"\n id="icon-next-month"\n slot="icon"\n ></sinch-icon>\n </sinch-button>\n <sinch-button id="next-year" size="s">\n <sinch-icon icons-version="2" name="fa-angles-right"\n id="icon-next-year"\n slot="icon"\n ></sinch-icon>\n </sinch-button>\n </div>\n <div id="week-day-names">\n <div class="week-day-name"></div>\n <div class="week-day-name"></div>\n <div class="week-day-name"></div>\n <div class="week-day-name"></div>\n <div class="week-day-name"></div>\n <div class="week-day-name"></div>\n <div class="week-day-name"></div>\n </div>\n <div id="month">\n <div class="week">\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n </div>\n <div class="week">\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n </div>\n <div class="week">\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n </div>\n <div class="week">\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n </div>\n <div class="week">\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n </div>\n <div class="week">\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n <button class="day"></button>\n </div>\n </div>\n</div>\n';
|
|
12
|
+
const template = document.createElement("template");
|
|
8
13
|
template.innerHTML = templateHTML;
|
|
9
|
-
|
|
14
|
+
class DatePicker extends NectaryElement {
|
|
10
15
|
#$month;
|
|
11
16
|
#$weeks;
|
|
12
17
|
#$days;
|
|
@@ -28,40 +33,38 @@ export class DatePicker extends NectaryElement {
|
|
|
28
33
|
static formAssociated = true;
|
|
29
34
|
constructor() {
|
|
30
35
|
super();
|
|
31
|
-
const shadowRoot = this.attachShadow({
|
|
32
|
-
delegatesFocus: true
|
|
33
|
-
});
|
|
36
|
+
const shadowRoot = this.attachShadow({ delegatesFocus: true });
|
|
34
37
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
35
38
|
this.#internals = this.attachInternals();
|
|
36
|
-
this.#$prevMonth = shadowRoot.querySelector(
|
|
37
|
-
this.#$nextMonth = shadowRoot.querySelector(
|
|
38
|
-
this.#$prevYear = shadowRoot.querySelector(
|
|
39
|
-
this.#$nextYear = shadowRoot.querySelector(
|
|
40
|
-
this.#$date = shadowRoot.querySelector(
|
|
41
|
-
this.#$month = shadowRoot.querySelector(
|
|
39
|
+
this.#$prevMonth = shadowRoot.querySelector("#prev-month");
|
|
40
|
+
this.#$nextMonth = shadowRoot.querySelector("#next-month");
|
|
41
|
+
this.#$prevYear = shadowRoot.querySelector("#prev-year");
|
|
42
|
+
this.#$nextYear = shadowRoot.querySelector("#next-year");
|
|
43
|
+
this.#$date = shadowRoot.querySelector("#date");
|
|
44
|
+
this.#$month = shadowRoot.querySelector("#month");
|
|
42
45
|
this.#$days = [];
|
|
43
46
|
this.#$weeks = [];
|
|
44
47
|
this.#monthNames = [];
|
|
45
|
-
shadowRoot.querySelectorAll(
|
|
48
|
+
shadowRoot.querySelectorAll(".week").forEach((week, i) => {
|
|
46
49
|
this.#$weeks.push(week);
|
|
47
50
|
this.#$days[i] = [];
|
|
48
|
-
week.querySelectorAll(
|
|
51
|
+
week.querySelectorAll(".day").forEach((day) => {
|
|
49
52
|
this.#$days[i].push(day);
|
|
50
53
|
});
|
|
51
54
|
});
|
|
52
|
-
this.#$weekDayNames = Array.from(shadowRoot.querySelectorAll(
|
|
55
|
+
this.#$weekDayNames = Array.from(shadowRoot.querySelectorAll("#week-day-names > .week-day-name"));
|
|
53
56
|
}
|
|
54
57
|
connectedCallback() {
|
|
55
58
|
this.#controller = new AbortController();
|
|
56
59
|
const options = {
|
|
57
60
|
signal: this.#controller.signal
|
|
58
61
|
};
|
|
59
|
-
this.#$prevMonth.addEventListener(
|
|
60
|
-
this.#$nextMonth.addEventListener(
|
|
61
|
-
this.#$prevYear.addEventListener(
|
|
62
|
-
this.#$nextYear.addEventListener(
|
|
63
|
-
this.#$month.addEventListener(
|
|
64
|
-
this.addEventListener(
|
|
62
|
+
this.#$prevMonth.addEventListener("click", this.#onPrevMonthClick, options);
|
|
63
|
+
this.#$nextMonth.addEventListener("click", this.#onNextMonthClick, options);
|
|
64
|
+
this.#$prevYear.addEventListener("click", this.#onPrevYearClick, options);
|
|
65
|
+
this.#$nextYear.addEventListener("click", this.#onNextYearClick, options);
|
|
66
|
+
this.#$month.addEventListener("click", this.#onDateClick, options);
|
|
67
|
+
this.addEventListener("-change", this.#onChangeReactHandler, options);
|
|
65
68
|
}
|
|
66
69
|
disconnectedCallback() {
|
|
67
70
|
this.#unsubscribeRangeHover();
|
|
@@ -72,136 +75,137 @@ export class DatePicker extends NectaryElement {
|
|
|
72
75
|
setFormValue(this.#internals, this.value);
|
|
73
76
|
}
|
|
74
77
|
formResetCallback() {
|
|
75
|
-
this.value =
|
|
76
|
-
setFormValue(this.#internals,
|
|
78
|
+
this.value = "";
|
|
79
|
+
setFormValue(this.#internals, "");
|
|
77
80
|
}
|
|
78
81
|
formStateRestoreCallback(state) {
|
|
79
|
-
if (this.#internals.form === null || getBooleanAttribute(this.#internals.form,
|
|
82
|
+
if (this.#internals.form === null || getBooleanAttribute(this.#internals.form, "data-form-state-restore") === false) {
|
|
80
83
|
return;
|
|
81
84
|
}
|
|
82
85
|
if (state !== null) {
|
|
83
|
-
const value = typeof state ===
|
|
84
|
-
this.value = value?.toString() ??
|
|
85
|
-
setFormValue(this.#internals, value?.toString() ??
|
|
86
|
+
const value = typeof state === "string" ? state : state.get(this.name);
|
|
87
|
+
this.value = value?.toString() ?? "";
|
|
88
|
+
setFormValue(this.#internals, value?.toString() ?? "");
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
91
|
static get observedAttributes() {
|
|
89
|
-
return [
|
|
92
|
+
return [
|
|
93
|
+
"value",
|
|
94
|
+
"min",
|
|
95
|
+
"max",
|
|
96
|
+
"locale",
|
|
97
|
+
"range",
|
|
98
|
+
"prev-year-aria-label",
|
|
99
|
+
"next-year-aria-label",
|
|
100
|
+
"prev-month-aria-label",
|
|
101
|
+
"next-month-aria-label"
|
|
102
|
+
];
|
|
90
103
|
}
|
|
91
104
|
attributeChangedCallback(name, prevValue, newVal) {
|
|
92
105
|
switch (name) {
|
|
93
|
-
case
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
{
|
|
100
|
-
this.#minDate
|
|
101
|
-
if (this.#uiDate !== null) {
|
|
102
|
-
clampMinDate(this.#uiDate, this.#minDate);
|
|
103
|
-
}
|
|
104
|
-
this.#render();
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
case 'max':
|
|
108
|
-
{
|
|
109
|
-
this.#maxDate = isoToDate(newVal);
|
|
110
|
-
if (this.#uiDate !== null) {
|
|
111
|
-
clampMaxDate(this.#uiDate, this.#maxDate);
|
|
112
|
-
}
|
|
113
|
-
this.#render();
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
case 'locale':
|
|
117
|
-
{
|
|
118
|
-
const names = getDayNames(newVal);
|
|
119
|
-
this.#$weekDayNames.forEach(($day, i) => {
|
|
120
|
-
$day.textContent = names[i];
|
|
121
|
-
});
|
|
122
|
-
this.#monthNames = getMonthNames(newVal);
|
|
123
|
-
this.#render();
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
case 'range':
|
|
127
|
-
{
|
|
128
|
-
const isRange = isAttrTrue(newVal);
|
|
129
|
-
if (isRange) {
|
|
130
|
-
this.#onValueChange();
|
|
131
|
-
} else {
|
|
132
|
-
this.#unsubscribeRangeHover();
|
|
133
|
-
}
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
case 'prev-year-aria-label':
|
|
137
|
-
{
|
|
138
|
-
updateAttribute(this.#$prevYear, 'aria-label', newVal);
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
case 'next-year-aria-label':
|
|
142
|
-
{
|
|
143
|
-
updateAttribute(this.#$nextYear, 'aria-label', newVal);
|
|
144
|
-
break;
|
|
106
|
+
case "value": {
|
|
107
|
+
this.#onValueChange();
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
case "min": {
|
|
111
|
+
this.#minDate = isoToDate(newVal);
|
|
112
|
+
if (this.#uiDate !== null) {
|
|
113
|
+
clampMinDate(this.#uiDate, this.#minDate);
|
|
145
114
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
115
|
+
this.#render();
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
case "max": {
|
|
119
|
+
this.#maxDate = isoToDate(newVal);
|
|
120
|
+
if (this.#uiDate !== null) {
|
|
121
|
+
clampMaxDate(this.#uiDate, this.#maxDate);
|
|
150
122
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
123
|
+
this.#render();
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
case "locale": {
|
|
127
|
+
const names = getDayNames(newVal);
|
|
128
|
+
this.#$weekDayNames.forEach(($day, i) => {
|
|
129
|
+
$day.textContent = names[i];
|
|
130
|
+
});
|
|
131
|
+
this.#monthNames = getMonthNames(newVal);
|
|
132
|
+
this.#render();
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
case "range": {
|
|
136
|
+
const isRange = isAttrTrue(newVal);
|
|
137
|
+
if (isRange) {
|
|
138
|
+
this.#onValueChange();
|
|
139
|
+
} else {
|
|
140
|
+
this.#unsubscribeRangeHover();
|
|
155
141
|
}
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
case "prev-year-aria-label": {
|
|
145
|
+
updateAttribute(this.#$prevYear, "aria-label", newVal);
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
case "next-year-aria-label": {
|
|
149
|
+
updateAttribute(this.#$nextYear, "aria-label", newVal);
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
case "prev-month-aria-label": {
|
|
153
|
+
updateAttribute(this.#$prevMonth, "aria-label", newVal);
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
case "next-month-aria-label": {
|
|
157
|
+
updateAttribute(this.#$nextMonth, "aria-label", newVal);
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
156
160
|
}
|
|
157
161
|
}
|
|
158
162
|
set name(value) {
|
|
159
|
-
updateAttribute(this,
|
|
163
|
+
updateAttribute(this, "name", value);
|
|
160
164
|
}
|
|
161
165
|
get name() {
|
|
162
|
-
return getAttribute(this,
|
|
166
|
+
return getAttribute(this, "name", "");
|
|
163
167
|
}
|
|
164
168
|
set locale(value) {
|
|
165
|
-
updateAttribute(this,
|
|
169
|
+
updateAttribute(this, "locale", value);
|
|
166
170
|
}
|
|
167
171
|
get locale() {
|
|
168
|
-
return getAttribute(this,
|
|
172
|
+
return getAttribute(this, "locale", "");
|
|
169
173
|
}
|
|
170
174
|
set value(value) {
|
|
171
|
-
updateAttribute(this,
|
|
175
|
+
updateAttribute(this, "value", value);
|
|
172
176
|
}
|
|
173
177
|
get value() {
|
|
174
|
-
return getAttribute(this,
|
|
178
|
+
return getAttribute(this, "value", "");
|
|
175
179
|
}
|
|
176
180
|
set min(value) {
|
|
177
|
-
updateAttribute(this,
|
|
181
|
+
updateAttribute(this, "min", value);
|
|
178
182
|
}
|
|
179
183
|
get min() {
|
|
180
|
-
return getAttribute(this,
|
|
184
|
+
return getAttribute(this, "min", "");
|
|
181
185
|
}
|
|
182
186
|
set max(value) {
|
|
183
|
-
updateAttribute(this,
|
|
187
|
+
updateAttribute(this, "max", value);
|
|
184
188
|
}
|
|
185
189
|
get max() {
|
|
186
|
-
return getAttribute(this,
|
|
190
|
+
return getAttribute(this, "max", "");
|
|
187
191
|
}
|
|
188
192
|
set range(isRanged) {
|
|
189
|
-
updateBooleanAttribute(this,
|
|
193
|
+
updateBooleanAttribute(this, "range", isRanged);
|
|
190
194
|
}
|
|
191
195
|
get range() {
|
|
192
|
-
return getBooleanAttribute(this,
|
|
196
|
+
return getBooleanAttribute(this, "range");
|
|
193
197
|
}
|
|
194
198
|
set prevMonthAriaLabel(value) {
|
|
195
|
-
updateAttribute(this,
|
|
199
|
+
updateAttribute(this, "prev-month-aria-label", value);
|
|
196
200
|
}
|
|
197
201
|
get prevMonthAriaLabel() {
|
|
198
|
-
return getAttribute(this,
|
|
202
|
+
return getAttribute(this, "prev-month-aria-label", "");
|
|
199
203
|
}
|
|
200
204
|
set nextMonthAriaLabel(value) {
|
|
201
|
-
updateAttribute(this,
|
|
205
|
+
updateAttribute(this, "next-month-aria-label", value);
|
|
202
206
|
}
|
|
203
207
|
get nextMonthAriaLabel() {
|
|
204
|
-
return getAttribute(this,
|
|
208
|
+
return getAttribute(this, "next-month-aria-label", "");
|
|
205
209
|
}
|
|
206
210
|
get prevYearButtonRect() {
|
|
207
211
|
return getRect(this.#$prevYear);
|
|
@@ -219,7 +223,7 @@ export class DatePicker extends NectaryElement {
|
|
|
219
223
|
if (index < 0 || index > 30) {
|
|
220
224
|
return null;
|
|
221
225
|
}
|
|
222
|
-
const indexOffset = this.#$days[0].findIndex(el => el.getAttribute(
|
|
226
|
+
const indexOffset = this.#$days[0].findIndex((el) => el.getAttribute("data-date") !== null);
|
|
223
227
|
if (indexOffset < 0) {
|
|
224
228
|
return null;
|
|
225
229
|
}
|
|
@@ -231,29 +235,29 @@ export class DatePicker extends NectaryElement {
|
|
|
231
235
|
}
|
|
232
236
|
return getRect($el);
|
|
233
237
|
}
|
|
234
|
-
#onPrevMonthClick = e => {
|
|
238
|
+
#onPrevMonthClick = (e) => {
|
|
235
239
|
e.stopPropagation();
|
|
236
240
|
decMonth(this.#uiDate, this.#minDate);
|
|
237
241
|
this.#render();
|
|
238
242
|
};
|
|
239
|
-
#onNextMonthClick = e => {
|
|
243
|
+
#onNextMonthClick = (e) => {
|
|
240
244
|
e.stopPropagation();
|
|
241
245
|
incMonth(this.#uiDate, this.#maxDate);
|
|
242
246
|
this.#render();
|
|
243
247
|
};
|
|
244
|
-
#onPrevYearClick = e => {
|
|
248
|
+
#onPrevYearClick = (e) => {
|
|
245
249
|
e.stopPropagation();
|
|
246
250
|
decYear(this.#uiDate, this.#minDate);
|
|
247
251
|
this.#render();
|
|
248
252
|
};
|
|
249
|
-
#onNextYearClick = e => {
|
|
253
|
+
#onNextYearClick = (e) => {
|
|
250
254
|
e.stopPropagation();
|
|
251
255
|
incYear(this.#uiDate, this.#maxDate);
|
|
252
256
|
this.#render();
|
|
253
257
|
};
|
|
254
|
-
#onDateMouseEnter = e => {
|
|
258
|
+
#onDateMouseEnter = (e) => {
|
|
255
259
|
if (this.#date1 !== null && this.#date2 === null) {
|
|
256
|
-
const hoverDateIso = getTargetAttribute(e,
|
|
260
|
+
const hoverDateIso = getTargetAttribute(e, "data-date");
|
|
257
261
|
if (hoverDateIso === null) {
|
|
258
262
|
return;
|
|
259
263
|
}
|
|
@@ -261,18 +265,18 @@ export class DatePicker extends NectaryElement {
|
|
|
261
265
|
const todayDate = today();
|
|
262
266
|
for (const week of this.#$days) {
|
|
263
267
|
for (const $day of week) {
|
|
264
|
-
if ($day.hasAttribute(
|
|
268
|
+
if ($day.hasAttribute("disabled")) {
|
|
265
269
|
continue;
|
|
266
270
|
}
|
|
267
|
-
const dayDate = isoToDate($day.getAttribute(
|
|
268
|
-
setClass($day,
|
|
271
|
+
const dayDate = isoToDate($day.getAttribute("data-date"));
|
|
272
|
+
setClass($day, "range", !areDatesEqual(todayDate, dayDate) && (isDateBetween(dayDate, this.#date1, hoverDate) || isDateBetween(dayDate, hoverDate, this.#date1)));
|
|
269
273
|
}
|
|
270
274
|
}
|
|
271
275
|
}
|
|
272
276
|
};
|
|
273
|
-
#onDateClick = e => {
|
|
277
|
+
#onDateClick = (e) => {
|
|
274
278
|
e.stopPropagation();
|
|
275
|
-
const dateIso = getTargetAttribute(e,
|
|
279
|
+
const dateIso = getTargetAttribute(e, "data-date");
|
|
276
280
|
if (dateIso === null || dateIso.length === 0) {
|
|
277
281
|
return;
|
|
278
282
|
}
|
|
@@ -285,9 +289,9 @@ export class DatePicker extends NectaryElement {
|
|
|
285
289
|
this.#date2 = dateTuple[1];
|
|
286
290
|
this.#unsubscribeRangeHover();
|
|
287
291
|
this.#render();
|
|
288
|
-
this.dispatchEvent(
|
|
289
|
-
detail: value
|
|
290
|
-
|
|
292
|
+
this.dispatchEvent(
|
|
293
|
+
new CustomEvent("-change", { detail: value })
|
|
294
|
+
);
|
|
291
295
|
return;
|
|
292
296
|
}
|
|
293
297
|
this.#date1 = isoToDate(dateIso);
|
|
@@ -296,9 +300,9 @@ export class DatePicker extends NectaryElement {
|
|
|
296
300
|
this.#render();
|
|
297
301
|
return;
|
|
298
302
|
}
|
|
299
|
-
this.dispatchEvent(
|
|
300
|
-
detail: dateIso
|
|
301
|
-
|
|
303
|
+
this.dispatchEvent(
|
|
304
|
+
new CustomEvent("-change", { detail: dateIso })
|
|
305
|
+
);
|
|
302
306
|
};
|
|
303
307
|
#onValueChange() {
|
|
304
308
|
const value = this.value;
|
|
@@ -350,10 +354,10 @@ export class DatePicker extends NectaryElement {
|
|
|
350
354
|
}
|
|
351
355
|
const todayDate = today();
|
|
352
356
|
const month = getCalendarMonth(this.#uiDate);
|
|
353
|
-
updateBooleanAttribute(this.#$prevMonth,
|
|
354
|
-
updateBooleanAttribute(this.#$nextMonth,
|
|
355
|
-
updateBooleanAttribute(this.#$prevYear,
|
|
356
|
-
updateBooleanAttribute(this.#$nextYear,
|
|
357
|
+
updateBooleanAttribute(this.#$prevMonth, "disabled", canGoPrevMonth(this.#uiDate, this.#minDate) === false);
|
|
358
|
+
updateBooleanAttribute(this.#$nextMonth, "disabled", canGoNextMonth(this.#uiDate, this.#maxDate) === false);
|
|
359
|
+
updateBooleanAttribute(this.#$prevYear, "disabled", canGoPrevYear(this.#uiDate, this.#minDate) === false);
|
|
360
|
+
updateBooleanAttribute(this.#$nextYear, "disabled", canGoNextYear(this.#uiDate, this.#maxDate) === false);
|
|
357
361
|
this.#$date.textContent = `${this.#monthNames[this.#uiDate.getUTCMonth()]} ${this.#uiDate.getUTCFullYear()}`;
|
|
358
362
|
for (let wi = 0; wi < this.#$days.length; wi++) {
|
|
359
363
|
const $week = this.#$days[wi];
|
|
@@ -362,50 +366,53 @@ export class DatePicker extends NectaryElement {
|
|
|
362
366
|
const $day = $week[di];
|
|
363
367
|
const week = month[wi];
|
|
364
368
|
const day = week?.[di];
|
|
365
|
-
$day.classList.remove(
|
|
369
|
+
$day.classList.remove("selected", "range", "today");
|
|
366
370
|
if (day == null) {
|
|
367
|
-
$day.textContent =
|
|
368
|
-
$day.removeAttribute(
|
|
369
|
-
$day.setAttribute(
|
|
370
|
-
$day.setAttribute(
|
|
371
|
+
$day.textContent = "";
|
|
372
|
+
$day.removeAttribute("data-date");
|
|
373
|
+
$day.setAttribute("disabled", "");
|
|
374
|
+
$day.setAttribute("aria-hidden", "true");
|
|
371
375
|
} else {
|
|
372
376
|
const dayIso = dateToIso(day);
|
|
373
377
|
$day.textContent = day.getUTCDate().toString();
|
|
374
|
-
$day.setAttribute(
|
|
378
|
+
$day.setAttribute("data-date", dayIso);
|
|
375
379
|
if (isDateBetween(day, this.#minDate, this.#maxDate)) {
|
|
376
|
-
$day.removeAttribute(
|
|
377
|
-
$day.removeAttribute(
|
|
380
|
+
$day.removeAttribute("disabled");
|
|
381
|
+
$day.removeAttribute("aria-hidden");
|
|
378
382
|
} else {
|
|
379
|
-
$day.setAttribute(
|
|
380
|
-
$day.setAttribute(
|
|
383
|
+
$day.setAttribute("disabled", "");
|
|
384
|
+
$day.setAttribute("aria-hidden", "true");
|
|
381
385
|
}
|
|
382
386
|
if (areDatesEqual(day, this.#date1) || areDatesEqual(day, this.#date2)) {
|
|
383
|
-
$day.classList.add(
|
|
387
|
+
$day.classList.add("selected");
|
|
384
388
|
} else if (areDatesEqual(day, todayDate)) {
|
|
385
|
-
$day.classList.add(
|
|
389
|
+
$day.classList.add("today");
|
|
386
390
|
} else if (isDateBetween(day, this.#date1, this.#date2)) {
|
|
387
|
-
$day.classList.add(
|
|
391
|
+
$day.classList.add("range");
|
|
388
392
|
}
|
|
389
393
|
isEmptyWeek = false;
|
|
390
394
|
}
|
|
391
395
|
}
|
|
392
|
-
setClass(this.#$weeks[wi],
|
|
396
|
+
setClass(this.#$weeks[wi], "empty", isEmptyWeek);
|
|
393
397
|
}
|
|
394
398
|
}
|
|
395
399
|
#subscribeRangeHover() {
|
|
396
400
|
if (!this.#isHoverSubscribed) {
|
|
397
|
-
this.#$month.addEventListener(
|
|
401
|
+
this.#$month.addEventListener("mouseover", this.#onDateMouseEnter);
|
|
398
402
|
this.#isHoverSubscribed = true;
|
|
399
403
|
}
|
|
400
404
|
}
|
|
401
405
|
#unsubscribeRangeHover() {
|
|
402
406
|
if (this.#isHoverSubscribed) {
|
|
403
|
-
this.#$month.removeEventListener(
|
|
407
|
+
this.#$month.removeEventListener("mouseover", this.#onDateMouseEnter);
|
|
404
408
|
this.#isHoverSubscribed = false;
|
|
405
409
|
}
|
|
406
410
|
}
|
|
407
|
-
#onChangeReactHandler = e => {
|
|
408
|
-
getReactEventHandler(this,
|
|
411
|
+
#onChangeReactHandler = (e) => {
|
|
412
|
+
getReactEventHandler(this, "on-change")?.(e);
|
|
409
413
|
};
|
|
410
414
|
}
|
|
411
|
-
defineCustomElement(
|
|
415
|
+
defineCustomElement("sinch-date-picker", DatePicker);
|
|
416
|
+
export {
|
|
417
|
+
DatePicker
|
|
418
|
+
};
|
package/date-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 TSinchDatePickerProps = {
|
|
3
3
|
/** Identification for uncontrolled form submissions */
|
|
4
4
|
name?: string;
|
|
@@ -72,3 +72,23 @@ export type TSinchDatePicker = {
|
|
|
72
72
|
};
|
|
73
73
|
export type TSinchDatePickerElement = NectaryComponentVanillaByType<TSinchDatePicker>;
|
|
74
74
|
export type TSinchDatePickerReact = NectaryComponentReactByType<TSinchDatePicker>;
|
|
75
|
+
declare global {
|
|
76
|
+
interface NectaryComponentMap {
|
|
77
|
+
'sinch-date-picker': TSinchDatePicker;
|
|
78
|
+
}
|
|
79
|
+
interface HTMLElementTagNameMap {
|
|
80
|
+
'sinch-date-picker': NectaryComponentVanilla<'sinch-date-picker'>;
|
|
81
|
+
}
|
|
82
|
+
namespace JSX {
|
|
83
|
+
interface IntrinsicElements {
|
|
84
|
+
'sinch-date-picker': NectaryComponentReact<'sinch-date-picker'>;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
declare module 'react' {
|
|
89
|
+
namespace JSX {
|
|
90
|
+
interface IntrinsicElements extends globalThis.JSX.IntrinsicElements {
|
|
91
|
+
'sinch-date-picker': NectaryComponentReact<'sinch-date-picker'>;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
package/date-picker/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|