@nectary/components 4.12.0 → 4.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/index.d.ts +22 -1
- package/accordion/index.js +39 -41
- package/accordion/types.d.ts +1 -21
- package/accordion/types.js +1 -1
- package/accordion-item/index.d.ts +22 -2
- package/accordion-item/index.js +49 -53
- package/accordion-item/types.d.ts +1 -21
- package/accordion-item/types.js +1 -1
- package/accordion-item/utils.js +1 -4
- package/action-menu/index.d.ts +22 -1
- package/action-menu/index.js +77 -62
- package/action-menu/types.d.ts +1 -21
- package/action-menu/types.js +1 -1
- package/action-menu-option/index.d.ts +22 -1
- package/action-menu-option/index.js +41 -39
- package/action-menu-option/types.d.ts +1 -21
- package/action-menu-option/types.js +1 -1
- package/action-menu-option/utils.js +3 -6
- package/alert/index.d.ts +22 -2
- package/alert/index.js +21 -24
- package/alert/types.d.ts +1 -21
- package/alert/types.js +1 -1
- package/alert/utils.js +1 -4
- package/avatar/colors.js +1 -1
- package/avatar/index.d.ts +22 -2
- package/avatar/index.js +41 -42
- package/avatar/types.d.ts +1 -21
- package/avatar/types.js +1 -1
- package/avatar/utils.js +4 -9
- package/badge/index.d.ts +22 -3
- package/badge/index.js +51 -52
- package/badge/types.d.ts +1 -21
- package/badge/types.js +1 -1
- package/badge/utils.js +1 -4
- package/button/index.d.ts +22 -2
- package/button/index.js +111 -101
- package/button/types.d.ts +1 -21
- package/button/types.js +1 -1
- package/button/utils.js +2 -18
- package/button-group/index.d.ts +22 -1
- package/button-group/index.js +18 -20
- package/button-group/types.d.ts +3 -22
- package/button-group/types.js +1 -1
- package/button-group-item/index.d.ts +22 -2
- package/button-group-item/index.js +42 -31
- package/button-group-item/types.d.ts +3 -22
- package/button-group-item/types.js +1 -1
- package/card/index.d.ts +40 -0
- package/card/index.js +134 -0
- package/card/types.d.ts +17 -0
- package/card/types.js +1 -0
- package/card-container/index.d.ts +21 -1
- package/card-container/index.js +5 -8
- package/card-container/types.d.ts +1 -21
- package/card-container/types.js +1 -1
- package/card-v2/index.d.ts +22 -1
- package/card-v2/index.js +57 -59
- package/card-v2/types.d.ts +1 -21
- package/card-v2/types.js +1 -1
- package/card-v2-title/index.d.ts +22 -2
- package/card-v2-title/index.js +26 -28
- package/card-v2-title/types.d.ts +1 -21
- package/card-v2-title/types.js +1 -1
- package/checkbox/index.d.ts +22 -1
- package/checkbox/index.js +81 -88
- package/checkbox/types.d.ts +1 -21
- package/checkbox/types.js +1 -1
- package/chip/colors.js +1 -1
- package/chip/index.d.ts +22 -1
- package/chip/index.js +75 -62
- package/chip/types.d.ts +1 -21
- package/chip/types.js +1 -1
- package/chip/utils.js +3 -7
- package/code-tag/index.d.ts +22 -1
- package/code-tag/index.js +14 -17
- package/code-tag/types.d.ts +1 -21
- package/code-tag/types.js +1 -1
- package/color-menu/index.d.ts +22 -2
- package/color-menu/index.js +115 -115
- package/color-menu/types.d.ts +1 -21
- package/color-menu/types.js +1 -1
- package/color-menu/utils.js +3 -6
- package/color-menu-option/index.d.ts +22 -1
- package/color-menu-option/index.js +26 -30
- package/color-menu-option/types.d.ts +1 -21
- package/color-menu-option/types.js +1 -1
- package/color-menu-option/utils.js +3 -6
- package/color-swatch/index.d.ts +22 -1
- package/color-swatch/index.js +20 -23
- package/color-swatch/types.d.ts +1 -21
- package/color-swatch/types.js +1 -1
- package/color-swatch/utils.js +3 -7
- package/date-picker/index.d.ts +22 -2
- package/date-picker/index.js +150 -157
- package/date-picker/types.d.ts +1 -21
- package/date-picker/types.js +1 -1
- package/date-picker/utils.js +42 -59
- package/dialog/index.d.ts +22 -1
- package/dialog/index.js +58 -71
- package/dialog/types.d.ts +1 -21
- package/dialog/types.js +1 -1
- package/dialog/utils.js +7 -11
- package/emoji/index.d.ts +22 -1
- package/emoji/index.js +16 -19
- package/emoji/types.d.ts +1 -21
- package/emoji/types.js +1 -1
- package/emoji/utils.js +17 -22
- package/emoji-picker/index.d.ts +22 -2
- package/emoji-picker/index.js +118 -138
- package/emoji-picker/types.d.ts +1 -21
- package/emoji-picker/types.js +1 -1
- package/field/index.d.ts +22 -1
- package/field/index.js +60 -63
- package/field/types.d.ts +1 -21
- package/field/types.js +1 -1
- package/file-drop/index.d.ts +22 -1
- package/file-drop/index.js +98 -103
- package/file-drop/types.d.ts +1 -21
- package/file-drop/types.js +1 -1
- package/file-drop/utils.js +22 -27
- package/file-picker/index.d.ts +22 -1
- package/file-picker/index.js +48 -53
- package/file-picker/types.d.ts +1 -21
- package/file-picker/types.js +1 -1
- package/file-picker/utils.js +3 -6
- package/file-status/index.d.ts +22 -2
- package/file-status/index.js +22 -33
- package/file-status/types.d.ts +1 -21
- package/file-status/types.js +1 -1
- package/file-status/utils.js +1 -4
- package/flag/index.d.ts +22 -1
- package/flag/index.js +16 -19
- package/flag/types.d.ts +1 -21
- package/flag/types.js +1 -1
- package/flag/utils.js +8 -11
- package/grid/index.d.ts +22 -1
- package/grid/index.js +5 -8
- package/grid/types.d.ts +1 -21
- package/grid/types.js +1 -1
- package/grid-item/index.d.ts +22 -1
- package/grid-item/index.js +13 -17
- package/grid-item/types.d.ts +1 -21
- package/grid-item/types.js +1 -1
- package/help-tooltip/index.d.ts +22 -1
- package/help-tooltip/index.js +26 -29
- package/help-tooltip/types.d.ts +1 -21
- package/help-tooltip/types.js +1 -1
- package/horizontal-stepper/index.d.ts +33 -0
- package/horizontal-stepper/index.js +62 -0
- package/horizontal-stepper/types.d.ts +42 -0
- package/horizontal-stepper/types.js +1 -0
- package/horizontal-stepper-item/index.d.ts +38 -0
- package/horizontal-stepper-item/index.js +62 -0
- package/horizontal-stepper-item/types.d.ts +38 -0
- package/horizontal-stepper-item/types.js +1 -0
- package/horizontal-stepper-item/utils.d.ts +2 -0
- package/horizontal-stepper-item/utils.js +1 -0
- package/icon/generated-icon-type.js +1 -1
- package/icon/index.d.ts +22 -1
- package/icon/index.js +28 -30
- package/icon/types.d.ts +1 -21
- package/icon/types.js +1 -1
- package/inline-alert/index.d.ts +22 -2
- package/inline-alert/index.js +39 -58
- package/inline-alert/types.d.ts +1 -21
- package/inline-alert/types.js +1 -1
- package/inline-alert/utils.js +1 -4
- package/input/index.d.ts +22 -2
- package/input/index.js +317 -295
- package/input/types.d.ts +1 -21
- package/input/types.js +1 -1
- package/input/utils.js +46 -56
- package/link/index.d.ts +22 -1
- package/link/index.js +79 -88
- package/link/types.d.ts +1 -21
- package/link/types.js +1 -1
- package/list/index.d.ts +21 -1
- package/list/index.js +6 -9
- package/list/types.d.ts +1 -21
- package/list/types.js +1 -1
- package/list-item/index.d.ts +22 -1
- package/list-item/index.js +6 -9
- package/list-item/types.d.ts +1 -21
- package/list-item/types.js +1 -1
- package/package.json +5 -11
- package/pagination/index.d.ts +22 -2
- package/pagination/index.js +46 -64
- package/pagination/types.d.ts +1 -21
- package/pagination/types.js +1 -1
- package/persistent-overlay/index.d.ts +22 -1
- package/persistent-overlay/index.js +44 -42
- package/persistent-overlay/types.d.ts +1 -21
- package/persistent-overlay/types.js +1 -1
- package/pop/index.d.ts +22 -3
- package/pop/index.js +150 -149
- package/pop/types.d.ts +1 -21
- package/pop/types.js +1 -1
- package/pop/utils.js +8 -24
- package/popover/index.d.ts +22 -2
- package/popover/index.js +68 -75
- package/popover/types.d.ts +1 -21
- package/popover/types.js +1 -1
- package/popover/utils.js +7 -18
- package/progress/index.d.ts +22 -1
- package/progress/index.js +33 -30
- package/progress/types.d.ts +1 -21
- package/progress/types.js +1 -1
- package/progress-stepper/index.d.ts +22 -2
- package/progress-stepper/index.js +66 -64
- package/progress-stepper/types.d.ts +1 -21
- package/progress-stepper/types.js +1 -1
- package/progress-stepper-item/index.d.ts +22 -1
- package/progress-stepper-item/index.js +50 -58
- package/progress-stepper-item/types.d.ts +1 -21
- package/progress-stepper-item/types.js +1 -1
- package/progress-stepper-item/utils.js +11 -22
- package/radio/index.d.ts +22 -1
- package/radio/index.js +83 -79
- package/radio/types.d.ts +1 -21
- package/radio/types.js +1 -1
- package/radio-option/index.d.ts +22 -1
- package/radio-option/index.js +41 -47
- package/radio-option/types.d.ts +1 -21
- package/radio-option/types.js +1 -1
- package/rich-text/index.d.ts +22 -1
- package/rich-text/index.js +46 -45
- package/rich-text/types.d.ts +1 -21
- package/rich-text/types.js +1 -1
- package/rich-text/utils.js +33 -31
- package/rich-textarea/index.d.ts +22 -1
- package/rich-textarea/index.js +194 -201
- package/rich-textarea/types.d.ts +1 -21
- package/rich-textarea/types.js +1 -1
- package/rich-textarea/utils.js +340 -313
- package/segment/index.d.ts +40 -0
- package/segment/index.js +110 -0
- package/segment/types.d.ts +23 -0
- package/segment/types.js +1 -0
- package/segment/utils.d.ts +3 -0
- package/segment/utils.js +16 -0
- package/segment-collapse/index.d.ts +22 -1
- package/segment-collapse/index.js +25 -31
- package/segment-collapse/types.d.ts +1 -21
- package/segment-collapse/types.js +1 -1
- package/segmented-control/index.d.ts +22 -1
- package/segmented-control/index.js +45 -45
- package/segmented-control/types.d.ts +1 -21
- package/segmented-control/types.js +1 -1
- package/segmented-control-option/index.d.ts +22 -1
- package/segmented-control-option/index.js +46 -44
- package/segmented-control-option/types.d.ts +1 -21
- package/segmented-control-option/types.js +1 -1
- package/segmented-icon-control/index.d.ts +22 -1
- package/segmented-icon-control/index.js +50 -51
- package/segmented-icon-control/types.d.ts +1 -21
- package/segmented-icon-control/types.js +1 -1
- package/segmented-icon-control-option/index.d.ts +22 -1
- package/segmented-icon-control-option/index.js +37 -36
- package/segmented-icon-control-option/types.d.ts +1 -21
- package/segmented-icon-control-option/types.js +1 -1
- package/select-button/index.d.ts +26 -1
- package/select-button/index.js +112 -104
- package/select-button/types.d.ts +1 -25
- package/select-button/types.js +1 -1
- package/select-menu/index.d.ts +22 -1
- package/select-menu/index.js +164 -201
- package/select-menu/types.d.ts +1 -21
- package/select-menu/types.js +1 -1
- package/select-menu-option/index.d.ts +22 -1
- package/select-menu-option/index.js +33 -41
- package/select-menu-option/types.d.ts +1 -21
- package/select-menu-option/types.js +1 -1
- package/select-menu-option/utils.js +1 -4
- package/skeleton/index.d.ts +22 -1
- package/skeleton/index.js +38 -35
- package/skeleton/types.d.ts +1 -21
- package/skeleton/types.js +1 -1
- package/skeleton-item/index.d.ts +22 -1
- package/skeleton-item/index.js +5 -8
- package/skeleton-item/types.d.ts +1 -21
- package/skeleton-item/types.js +1 -1
- package/spinner/index.d.ts +22 -1
- package/spinner/index.js +29 -31
- package/spinner/types.d.ts +1 -21
- package/spinner/types.js +1 -1
- package/standalone.d.ts +8 -0
- package/standalone.js +87 -79
- package/standalone.ts +8 -0
- package/stop-events/index.js +12 -12
- package/table/index.d.ts +21 -1
- package/table/index.js +6 -9
- package/table/types.d.ts +1 -21
- package/table/types.js +1 -1
- package/table-body/index.d.ts +21 -1
- package/table-body/index.js +6 -9
- package/table-body/types.d.ts +1 -21
- package/table-body/types.js +1 -1
- package/table-cell/index.d.ts +22 -2
- package/table-cell/index.js +9 -13
- package/table-cell/types.d.ts +1 -21
- package/table-cell/types.js +1 -1
- package/table-cell/utils.js +1 -4
- package/table-head/index.d.ts +21 -1
- package/table-head/index.js +6 -9
- package/table-head/types.d.ts +1 -21
- package/table-head/types.js +1 -1
- package/table-head-cell/index.d.ts +22 -1
- package/table-head-cell/index.js +27 -29
- package/table-head-cell/types.d.ts +1 -21
- package/table-head-cell/types.js +1 -1
- package/table-row/index.d.ts +22 -1
- package/table-row/index.js +17 -20
- package/table-row/types.d.ts +1 -21
- package/table-row/types.js +1 -1
- package/tabs/index.d.ts +22 -2
- package/tabs/index.js +35 -32
- package/tabs/types.d.ts +1 -21
- package/tabs/types.js +1 -1
- package/tabs-icon-option/index.d.ts +22 -1
- package/tabs-icon-option/index.js +40 -38
- package/tabs-icon-option/types.d.ts +1 -21
- package/tabs-icon-option/types.js +1 -1
- package/tabs-option/index.d.ts +22 -1
- package/tabs-option/index.js +43 -41
- package/tabs-option/types.d.ts +1 -21
- package/tabs-option/types.js +1 -1
- package/tag/colors.js +1 -1
- package/tag/index.d.ts +22 -1
- package/tag/index.js +44 -45
- package/tag/types.d.ts +1 -21
- package/tag/types.js +1 -1
- package/tag/utils.js +3 -7
- package/text/index.d.ts +22 -2
- package/text/index.js +28 -33
- package/text/types.d.ts +1 -21
- package/text/types.js +1 -1
- package/text/utils.js +1 -4
- package/textarea/index.d.ts +22 -1
- package/textarea/index.js +152 -147
- package/textarea/types.d.ts +1 -21
- package/textarea/types.js +1 -1
- package/tile-control/index.d.ts +39 -0
- package/tile-control/index.js +111 -0
- package/tile-control/types.d.ts +29 -0
- package/tile-control/types.js +1 -0
- package/tile-control-option/index.d.ts +40 -0
- package/tile-control-option/index.js +99 -0
- package/tile-control-option/types.d.ts +52 -0
- package/tile-control-option/types.js +1 -0
- package/time-picker/index.d.ts +22 -2
- package/time-picker/index.js +123 -119
- package/time-picker/types.d.ts +1 -21
- package/time-picker/types.js +1 -1
- package/time-picker/utils.js +33 -31
- package/title/index.d.ts +22 -2
- package/title/index.js +31 -32
- package/title/types.d.ts +1 -21
- package/title/types.js +1 -1
- package/title/utils.js +14 -18
- package/toast/index.d.ts +22 -2
- package/toast/index.js +34 -37
- package/toast/types.d.ts +1 -21
- package/toast/types.js +1 -1
- package/toast/utils.js +1 -4
- package/toast-manager/index.d.ts +22 -3
- package/toast-manager/index.js +63 -77
- package/toast-manager/types.d.ts +1 -21
- package/toast-manager/types.js +1 -1
- package/toast-manager/utils.js +1 -4
- package/toggle/index.d.ts +22 -1
- package/toggle/index.js +75 -81
- package/toggle/types.d.ts +1 -21
- package/toggle/types.js +1 -1
- package/tooltip/index.d.ts +22 -3
- package/tooltip/index.js +93 -105
- package/tooltip/tooltip-state.js +64 -56
- package/tooltip/types.d.ts +1 -21
- package/tooltip/types.js +1 -1
- package/tooltip/utils.js +13 -32
- package/types.d.ts +29 -12
- package/utils/adapters.js +1 -1
- package/utils/context.js +42 -32
- package/utils/countries.js +2 -490
- package/utils/csv.js +6 -13
- package/utils/debounce.js +3 -10
- package/utils/dom.js +53 -60
- package/utils/element.d.ts +15 -107
- package/utils/element.js +19 -100
- package/utils/event-target.js +5 -11
- package/utils/form.js +12 -17
- package/utils/get-react-event-handler.js +3 -6
- package/utils/index.js +12 -65
- package/utils/markdown.js +43 -56
- package/utils/rect.js +18 -13
- package/utils/size.js +3 -8
- package/utils/slot.js +9 -13
- package/utils/throttle.js +2 -5
- package/utils/uid.js +2 -5
- package/vertical-stepper/index.d.ts +33 -0
- package/vertical-stepper/index.js +58 -0
- package/vertical-stepper/types.d.ts +34 -0
- package/vertical-stepper/types.js +1 -0
- package/vertical-stepper-item/index.d.ts +38 -0
- package/vertical-stepper-item/index.js +62 -0
- package/vertical-stepper-item/types.d.ts +42 -0
- package/vertical-stepper-item/types.js +1 -0
- package/vertical-stepper-item/utils.d.ts +2 -0
- package/vertical-stepper-item/utils.js +1 -0
- package/accordion/global/index.d.ts +0 -1
- package/accordion/global/index.js +0 -2
- package/accordion-item/global/index.d.ts +0 -1
- package/accordion-item/global/index.js +0 -2
- package/action-menu/global/index.d.ts +0 -1
- package/action-menu/global/index.js +0 -2
- package/action-menu-option/global/index.d.ts +0 -1
- package/action-menu-option/global/index.js +0 -2
- package/alert/global/index.d.ts +0 -1
- package/alert/global/index.js +0 -2
- package/avatar/global/index.d.ts +0 -1
- package/avatar/global/index.js +0 -2
- package/badge/global/index.d.ts +0 -1
- package/badge/global/index.js +0 -2
- package/bundle.d.ts +0 -78
- package/bundle.js +0 -13033
- package/bundle.ts +0 -80
- package/button/global/index.d.ts +0 -1
- package/button/global/index.js +0 -2
- package/button-group/global/index.d.ts +0 -1
- package/button-group/global/index.js +0 -2
- package/button-group-item/global/index.d.ts +0 -1
- package/button-group-item/global/index.js +0 -2
- package/card-container/global/index.d.ts +0 -1
- package/card-container/global/index.js +0 -2
- package/card-v2/global/index.d.ts +0 -1
- package/card-v2/global/index.js +0 -2
- package/card-v2-title/global/index.d.ts +0 -1
- package/card-v2-title/global/index.js +0 -2
- package/checkbox/global/index.d.ts +0 -1
- package/checkbox/global/index.js +0 -2
- package/chip/global/index.d.ts +0 -1
- package/chip/global/index.js +0 -2
- package/code-tag/global/index.d.ts +0 -1
- package/code-tag/global/index.js +0 -2
- package/color-menu/global/index.d.ts +0 -1
- package/color-menu/global/index.js +0 -2
- package/color-menu-option/global/index.d.ts +0 -1
- package/color-menu-option/global/index.js +0 -2
- package/color-swatch/global/index.d.ts +0 -1
- package/color-swatch/global/index.js +0 -2
- package/date-picker/global/index.d.ts +0 -1
- package/date-picker/global/index.js +0 -2
- package/dialog/global/index.d.ts +0 -1
- package/dialog/global/index.js +0 -2
- package/emoji/global/index.d.ts +0 -1
- package/emoji/global/index.js +0 -2
- package/emoji-picker/global/index.d.ts +0 -1
- package/emoji-picker/global/index.js +0 -2
- package/field/global/index.d.ts +0 -1
- package/field/global/index.js +0 -2
- package/file-drop/global/index.d.ts +0 -1
- package/file-drop/global/index.js +0 -2
- package/file-picker/global/index.d.ts +0 -1
- package/file-picker/global/index.js +0 -2
- package/file-status/global/index.d.ts +0 -1
- package/file-status/global/index.js +0 -2
- package/flag/global/index.d.ts +0 -1
- package/flag/global/index.js +0 -2
- package/grid/global/index.d.ts +0 -1
- package/grid/global/index.js +0 -2
- package/grid-item/global/index.d.ts +0 -1
- package/grid-item/global/index.js +0 -2
- package/help-tooltip/global/index.d.ts +0 -1
- package/help-tooltip/global/index.js +0 -2
- package/icon/global/index.d.ts +0 -1
- package/icon/global/index.js +0 -2
- package/inline-alert/global/index.d.ts +0 -1
- package/inline-alert/global/index.js +0 -2
- package/input/global/index.d.ts +0 -1
- package/input/global/index.js +0 -2
- package/link/global/index.d.ts +0 -1
- package/link/global/index.js +0 -2
- package/list/global/index.d.ts +0 -1
- package/list/global/index.js +0 -2
- package/list-item/global/index.d.ts +0 -1
- package/list-item/global/index.js +0 -2
- package/pagination/global/index.d.ts +0 -1
- package/pagination/global/index.js +0 -2
- package/persistent-overlay/global/index.d.ts +0 -1
- package/persistent-overlay/global/index.js +0 -2
- package/pop/global/index.d.ts +0 -1
- package/pop/global/index.js +0 -2
- package/popover/global/index.d.ts +0 -1
- package/popover/global/index.js +0 -2
- package/progress/global/index.d.ts +0 -1
- package/progress/global/index.js +0 -2
- package/progress-stepper/global/index.d.ts +0 -1
- package/progress-stepper/global/index.js +0 -2
- package/progress-stepper-item/global/index.d.ts +0 -1
- package/progress-stepper-item/global/index.js +0 -2
- package/radio/global/index.d.ts +0 -1
- package/radio/global/index.js +0 -2
- package/radio-option/global/index.d.ts +0 -1
- package/radio-option/global/index.js +0 -2
- package/rich-text/global/index.d.ts +0 -1
- package/rich-text/global/index.js +0 -2
- package/rich-textarea/global/index.d.ts +0 -1
- package/rich-textarea/global/index.js +0 -2
- package/segment-collapse/global/index.d.ts +0 -1
- package/segment-collapse/global/index.js +0 -2
- package/segmented-control/global/index.d.ts +0 -1
- package/segmented-control/global/index.js +0 -2
- package/segmented-control-option/global/index.d.ts +0 -1
- package/segmented-control-option/global/index.js +0 -2
- package/segmented-icon-control/global/index.d.ts +0 -1
- package/segmented-icon-control/global/index.js +0 -2
- package/segmented-icon-control-option/global/index.d.ts +0 -1
- package/segmented-icon-control-option/global/index.js +0 -2
- package/select-button/global/index.d.ts +0 -1
- package/select-button/global/index.js +0 -2
- package/select-menu/global/index.d.ts +0 -1
- package/select-menu/global/index.js +0 -2
- package/select-menu-option/global/index.d.ts +0 -1
- package/select-menu-option/global/index.js +0 -2
- package/skeleton/global/index.d.ts +0 -1
- package/skeleton/global/index.js +0 -2
- package/skeleton-item/global/index.d.ts +0 -1
- package/skeleton-item/global/index.js +0 -2
- package/spinner/global/index.d.ts +0 -1
- package/spinner/global/index.js +0 -2
- package/table/global/index.d.ts +0 -1
- package/table/global/index.js +0 -2
- package/table-body/global/index.d.ts +0 -1
- package/table-body/global/index.js +0 -2
- package/table-cell/global/index.d.ts +0 -1
- package/table-cell/global/index.js +0 -2
- package/table-head/global/index.d.ts +0 -1
- package/table-head/global/index.js +0 -2
- package/table-head-cell/global/index.d.ts +0 -1
- package/table-head-cell/global/index.js +0 -2
- package/table-row/global/index.d.ts +0 -1
- package/table-row/global/index.js +0 -2
- package/tabs/global/index.d.ts +0 -1
- package/tabs/global/index.js +0 -2
- package/tabs-icon-option/global/index.d.ts +0 -1
- package/tabs-icon-option/global/index.js +0 -2
- package/tabs-option/global/index.d.ts +0 -1
- package/tabs-option/global/index.js +0 -2
- package/tag/global/index.d.ts +0 -1
- package/tag/global/index.js +0 -2
- package/text/global/index.d.ts +0 -1
- package/text/global/index.js +0 -2
- package/textarea/global/index.d.ts +0 -1
- package/textarea/global/index.js +0 -2
- package/time-picker/global/index.d.ts +0 -1
- package/time-picker/global/index.js +0 -2
- package/title/global/index.d.ts +0 -1
- package/title/global/index.js +0 -2
- package/toast/global/index.d.ts +0 -1
- package/toast/global/index.js +0 -2
- package/toast-manager/global/index.d.ts +0 -1
- package/toast-manager/global/index.js +0 -2
- package/toggle/global/index.d.ts +0 -1
- package/toggle/global/index.js +0 -2
- package/tooltip/global/index.d.ts +0 -1
- package/tooltip/global/index.js +0 -2
- package/utils/component-names.d.ts +0 -3
- package/utils/component-names.js +0 -85
- package/utils/global-components-constants.d.ts +0 -3
- package/utils/global-components-constants.js +0 -8
- package/utils/global-components-manager.d.ts +0 -71
- package/utils/global-components-manager.js +0 -24
- package/utils/shared/global-elements-manager.d.js +0 -1
- package/utils/shared/global-elements-manager.d.ts +0 -62
- package/utils/shared/global-elements-manager.js +0 -163
- package/utils/shared/global-elements-store.d.js +0 -1
- package/utils/shared/global-elements-store.d.ts +0 -12
- package/utils/shared/global-elements-store.js +0 -31
- package/utils/shared/index.d.js +0 -11
- package/utils/shared/index.d.ts +0 -3
- package/utils/shared/index.js +0 -11
- package/utils/shared/nectary-element-base.d.js +0 -1
- package/utils/shared/nectary-element-base.d.ts +0 -9
- package/utils/shared/nectary-element-base.js +0 -25
- package/utils/shared/package.json +0 -9
- package/utils/shared/tsconfig.json +0 -20
package/utils/debounce.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const createDebounce = (delayFn, cancelFn) =>
|
|
1
|
+
const createDebounce = (delayFn, cancelFn) => cb => {
|
|
2
2
|
let id = null;
|
|
3
3
|
const delayCallback = () => {
|
|
4
4
|
id = null;
|
|
@@ -18,12 +18,5 @@ const createDebounce = (delayFn, cancelFn) => (cb) => {
|
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
const debounceTimeout =
|
|
22
|
-
|
|
23
|
-
globalThis.clearTimeout
|
|
24
|
-
);
|
|
25
|
-
const debounceAnimationFrame = createDebounce(globalThis.requestAnimationFrame, globalThis.cancelAnimationFrame);
|
|
26
|
-
export {
|
|
27
|
-
debounceAnimationFrame,
|
|
28
|
-
debounceTimeout
|
|
29
|
-
};
|
|
21
|
+
export const debounceTimeout = ms => createDebounce(cb => globalThis.setTimeout(cb, ms), globalThis.clearTimeout);
|
|
22
|
+
export const debounceAnimationFrame = createDebounce(globalThis.requestAnimationFrame, globalThis.cancelAnimationFrame);
|
package/utils/dom.js
CHANGED
|
@@ -1,50 +1,51 @@
|
|
|
1
|
-
const updateExplicitBooleanAttribute = ($element, attrName, attrValue) => {
|
|
2
|
-
$element.setAttribute(attrName, attrValue === true ?
|
|
1
|
+
export const updateExplicitBooleanAttribute = ($element, attrName, attrValue) => {
|
|
2
|
+
$element.setAttribute(attrName, attrValue === true ? 'true' : 'false');
|
|
3
3
|
};
|
|
4
|
-
const isAttrTrue =
|
|
5
|
-
return attrValue !== null && attrValue !==
|
|
4
|
+
export const isAttrTrue = attrValue => {
|
|
5
|
+
return attrValue !== null && attrValue !== 'false';
|
|
6
6
|
};
|
|
7
|
-
const getBooleanAttribute = ($element, attrName) => {
|
|
7
|
+
export const getBooleanAttribute = ($element, attrName) => {
|
|
8
8
|
return isAttrTrue($element.getAttribute(attrName));
|
|
9
9
|
};
|
|
10
|
-
const updateBooleanAttribute = ($element, attrName, attrValue) => {
|
|
10
|
+
export const updateBooleanAttribute = ($element, attrName, attrValue) => {
|
|
11
11
|
const currentAttrValue = $element.getAttribute(attrName);
|
|
12
12
|
if (attrValue === true) {
|
|
13
13
|
if (!isAttrTrue(currentAttrValue)) {
|
|
14
|
-
$element.setAttribute(attrName,
|
|
14
|
+
$element.setAttribute(attrName, '');
|
|
15
15
|
}
|
|
16
16
|
} else if (currentAttrValue !== null) {
|
|
17
17
|
$element.removeAttribute(attrName);
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
const updateAttribute = ($element, attrName, attrValue) => {
|
|
20
|
+
export const updateAttribute = ($element, attrName, attrValue) => {
|
|
21
21
|
if (attrValue != null) {
|
|
22
22
|
$element.setAttribute(attrName, String(attrValue));
|
|
23
23
|
} else {
|
|
24
24
|
$element.removeAttribute(attrName);
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
function getAttribute($element, attrName
|
|
27
|
+
export function getAttribute($element, attrName) {
|
|
28
|
+
let defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
28
29
|
return $element.getAttribute(attrName) ?? defaultValue;
|
|
29
30
|
}
|
|
30
|
-
const isLiteralValue = (literals, value) => {
|
|
31
|
+
export const isLiteralValue = (literals, value) => {
|
|
31
32
|
return value != null && literals.includes(value);
|
|
32
33
|
};
|
|
33
|
-
const updateLiteralAttribute = ($element, literals, attrName, attrValue) => {
|
|
34
|
+
export const updateLiteralAttribute = ($element, literals, attrName, attrValue) => {
|
|
34
35
|
if (isLiteralValue(literals, attrValue)) {
|
|
35
36
|
$element.setAttribute(attrName, attrValue);
|
|
36
37
|
} else {
|
|
37
38
|
$element.removeAttribute(attrName);
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
|
-
function getLiteralAttribute($element, literals, attrName, defaultValue) {
|
|
41
|
+
export function getLiteralAttribute($element, literals, attrName, defaultValue) {
|
|
41
42
|
const attrValue = $element.getAttribute(attrName);
|
|
42
43
|
if (isLiteralValue(literals, attrValue)) {
|
|
43
44
|
return attrValue;
|
|
44
45
|
}
|
|
45
46
|
return defaultValue;
|
|
46
47
|
}
|
|
47
|
-
const clampNumber = (value, min, max) => {
|
|
48
|
+
export const clampNumber = (value, min, max) => {
|
|
48
49
|
return Math.min(max, Math.max(min, value));
|
|
49
50
|
};
|
|
50
51
|
const DEFAULT_INTEGER_OPTIONS = {
|
|
@@ -52,7 +53,11 @@ const DEFAULT_INTEGER_OPTIONS = {
|
|
|
52
53
|
itemSpaceBetween: 0,
|
|
53
54
|
defaultValue: null
|
|
54
55
|
};
|
|
55
|
-
const applyRange = (value,
|
|
56
|
+
const applyRange = (value, _ref) => {
|
|
57
|
+
let {
|
|
58
|
+
min,
|
|
59
|
+
max
|
|
60
|
+
} = _ref;
|
|
56
61
|
let result = value;
|
|
57
62
|
if (min != null) {
|
|
58
63
|
result = Math.max(min, result);
|
|
@@ -62,8 +67,14 @@ const applyRange = (value, { min, max }) => {
|
|
|
62
67
|
}
|
|
63
68
|
return result;
|
|
64
69
|
};
|
|
65
|
-
const attrValueToInteger = (value
|
|
66
|
-
|
|
70
|
+
export const attrValueToInteger = function (value) {
|
|
71
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_INTEGER_OPTIONS;
|
|
72
|
+
const {
|
|
73
|
+
defaultValue = null,
|
|
74
|
+
itemSizeMultiplier = 1,
|
|
75
|
+
itemSpaceBetween = 0,
|
|
76
|
+
addExtraSpace = false
|
|
77
|
+
} = options;
|
|
67
78
|
let intValue = defaultValue;
|
|
68
79
|
if (value !== null) {
|
|
69
80
|
const int = parseInt(value);
|
|
@@ -76,16 +87,21 @@ const attrValueToInteger = (value, options = DEFAULT_INTEGER_OPTIONS) => {
|
|
|
76
87
|
}
|
|
77
88
|
return null;
|
|
78
89
|
};
|
|
79
|
-
const attrValueToPixels = (value
|
|
90
|
+
export const attrValueToPixels = function (value) {
|
|
91
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_INTEGER_OPTIONS;
|
|
80
92
|
const int = attrValueToInteger(value, options);
|
|
81
|
-
return int === null ?
|
|
82
|
-
};
|
|
83
|
-
const updateIntegerAttribute = ($element, attrName, attrValue
|
|
84
|
-
|
|
93
|
+
return int === null ? 'unset' : `${int}px`;
|
|
94
|
+
};
|
|
95
|
+
export const updateIntegerAttribute = function ($element, attrName, attrValue) {
|
|
96
|
+
let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_INTEGER_OPTIONS;
|
|
97
|
+
const {
|
|
98
|
+
defaultValue = null,
|
|
99
|
+
itemSizeMultiplier: multiplier = 1
|
|
100
|
+
} = options;
|
|
85
101
|
let intValue = null;
|
|
86
|
-
if (typeof attrValue ===
|
|
102
|
+
if (typeof attrValue === 'string') {
|
|
87
103
|
intValue = attrValueToInteger(attrValue, options);
|
|
88
|
-
} else if (typeof attrValue ===
|
|
104
|
+
} else if (typeof attrValue === 'number') {
|
|
89
105
|
intValue = applyRange(attrValue, options) * multiplier;
|
|
90
106
|
} else {
|
|
91
107
|
intValue = defaultValue;
|
|
@@ -96,29 +112,29 @@ const updateIntegerAttribute = ($element, attrName, attrValue, options = DEFAULT
|
|
|
96
112
|
$element.setAttribute(attrName, intValue.toFixed(0));
|
|
97
113
|
}
|
|
98
114
|
};
|
|
99
|
-
function getIntegerAttribute($element, attrName, defaultValue) {
|
|
115
|
+
export function getIntegerAttribute($element, attrName, defaultValue) {
|
|
100
116
|
return attrValueToInteger($element.getAttribute(attrName)) ?? defaultValue;
|
|
101
117
|
}
|
|
102
|
-
const setClass = (elem, name, isSet) => {
|
|
118
|
+
export const setClass = (elem, name, isSet) => {
|
|
103
119
|
isSet ? elem.classList.add(name) : elem.classList.remove(name);
|
|
104
120
|
};
|
|
105
|
-
const hasClass = (elem, name) => {
|
|
121
|
+
export const hasClass = (elem, name) => {
|
|
106
122
|
return elem.classList.contains(name);
|
|
107
123
|
};
|
|
108
|
-
const getCssVar = (element, variableName) => {
|
|
124
|
+
export const getCssVar = (element, variableName) => {
|
|
109
125
|
const result = getComputedStyle(element).getPropertyValue(variableName).trim();
|
|
110
|
-
return result ===
|
|
126
|
+
return result === '' ? null : result;
|
|
111
127
|
};
|
|
112
|
-
const getCssVars = (element, variableNames) => {
|
|
128
|
+
export const getCssVars = (element, variableNames) => {
|
|
113
129
|
const style = getComputedStyle(element);
|
|
114
|
-
return variableNames.map(
|
|
130
|
+
return variableNames.map(name => {
|
|
115
131
|
const result = style.getPropertyValue(name).trim();
|
|
116
|
-
return result ===
|
|
132
|
+
return result === '' ? null : result;
|
|
117
133
|
});
|
|
118
134
|
};
|
|
119
|
-
const cloneNode = (el, deep) => {
|
|
135
|
+
export const cloneNode = (el, deep) => {
|
|
120
136
|
const root = el.getRootNode();
|
|
121
|
-
if (root !== document && Reflect.has(root,
|
|
137
|
+
if (root !== document && Reflect.has(root, 'createElement')) {
|
|
122
138
|
const cloned = root.createElement(el.tagName.toLowerCase());
|
|
123
139
|
for (const attr of el.getAttributeNames()) {
|
|
124
140
|
cloned.setAttribute(attr, el.getAttribute(attr));
|
|
@@ -133,30 +149,7 @@ const cloneNode = (el, deep) => {
|
|
|
133
149
|
}
|
|
134
150
|
return el.cloneNode(deep);
|
|
135
151
|
};
|
|
136
|
-
const shouldReduceMotion = () => window.matchMedia(
|
|
137
|
-
const isAttrEqual = (oldVal, newVal) => {
|
|
138
|
-
return oldVal === newVal || newVal === null && oldVal ===
|
|
139
|
-
};
|
|
140
|
-
export {
|
|
141
|
-
attrValueToInteger,
|
|
142
|
-
attrValueToPixels,
|
|
143
|
-
clampNumber,
|
|
144
|
-
cloneNode,
|
|
145
|
-
getAttribute,
|
|
146
|
-
getBooleanAttribute,
|
|
147
|
-
getCssVar,
|
|
148
|
-
getCssVars,
|
|
149
|
-
getIntegerAttribute,
|
|
150
|
-
getLiteralAttribute,
|
|
151
|
-
hasClass,
|
|
152
|
-
isAttrEqual,
|
|
153
|
-
isAttrTrue,
|
|
154
|
-
isLiteralValue,
|
|
155
|
-
setClass,
|
|
156
|
-
shouldReduceMotion,
|
|
157
|
-
updateAttribute,
|
|
158
|
-
updateBooleanAttribute,
|
|
159
|
-
updateExplicitBooleanAttribute,
|
|
160
|
-
updateIntegerAttribute,
|
|
161
|
-
updateLiteralAttribute
|
|
162
|
-
};
|
|
152
|
+
export const shouldReduceMotion = () => window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
153
|
+
export const isAttrEqual = (oldVal, newVal) => {
|
|
154
|
+
return oldVal === newVal || newVal === null && oldVal === 'false' || newVal === '' && oldVal === 'true';
|
|
155
|
+
};
|
package/utils/element.d.ts
CHANGED
|
@@ -1,109 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type SinchElementName = `sinch-${string}`;
|
|
4
|
-
declare class NectaryElementBase extends HTMLElement {
|
|
5
|
-
private static _isGlobal;
|
|
6
|
-
static get elementName(): SinchElementName;
|
|
7
|
-
static get isGlobal(): boolean;
|
|
8
|
-
static set isGlobal(value: boolean);
|
|
9
|
-
}
|
|
10
|
-
declare const BASE_COMPONENT_NAMES_LIST: readonly [
|
|
11
|
-
"accordion-item",
|
|
12
|
-
"accordion",
|
|
13
|
-
"action-menu-option",
|
|
14
|
-
"action-menu",
|
|
15
|
-
"alert",
|
|
16
|
-
"avatar",
|
|
17
|
-
"badge",
|
|
18
|
-
"button-group-item",
|
|
19
|
-
"button-group",
|
|
20
|
-
"button",
|
|
21
|
-
"card-container",
|
|
22
|
-
"card-v2-title",
|
|
23
|
-
"card-v2",
|
|
24
|
-
"checkbox",
|
|
25
|
-
"chip",
|
|
26
|
-
"code-tag",
|
|
27
|
-
"color-menu-option",
|
|
28
|
-
"color-menu",
|
|
29
|
-
"color-swatch",
|
|
30
|
-
"date-picker",
|
|
31
|
-
"dialog",
|
|
32
|
-
"emoji-picker",
|
|
33
|
-
"emoji",
|
|
34
|
-
"field",
|
|
35
|
-
"file-drop",
|
|
36
|
-
"file-picker",
|
|
37
|
-
"file-status",
|
|
38
|
-
"flag",
|
|
39
|
-
"grid-item",
|
|
40
|
-
"grid",
|
|
41
|
-
"help-tooltip",
|
|
42
|
-
"icon",
|
|
43
|
-
"inline-alert",
|
|
44
|
-
"input",
|
|
45
|
-
"link",
|
|
46
|
-
"list-item",
|
|
47
|
-
"list",
|
|
48
|
-
"pagination",
|
|
49
|
-
"persistent-overlay",
|
|
50
|
-
"pop",
|
|
51
|
-
"popover",
|
|
52
|
-
"progress-stepper-item",
|
|
53
|
-
"progress-stepper",
|
|
54
|
-
"progress",
|
|
55
|
-
"radio-option",
|
|
56
|
-
"radio",
|
|
57
|
-
"rich-text",
|
|
58
|
-
"rich-textarea",
|
|
59
|
-
"segment-collapse",
|
|
60
|
-
"segmented-control-option",
|
|
61
|
-
"segmented-control",
|
|
62
|
-
"segmented-icon-control-option",
|
|
63
|
-
"segmented-icon-control",
|
|
64
|
-
"select-button",
|
|
65
|
-
"select-menu-option",
|
|
66
|
-
"select-menu",
|
|
67
|
-
"skeleton-item",
|
|
68
|
-
"skeleton",
|
|
69
|
-
"spinner",
|
|
70
|
-
"stop-events",
|
|
71
|
-
"table-body",
|
|
72
|
-
"table-cell",
|
|
73
|
-
"table-head-cell",
|
|
74
|
-
"table-head",
|
|
75
|
-
"table-row",
|
|
76
|
-
"table",
|
|
77
|
-
"tabs-icon-option",
|
|
78
|
-
"tabs-option",
|
|
79
|
-
"tabs",
|
|
80
|
-
"tag",
|
|
81
|
-
"text",
|
|
82
|
-
"textarea",
|
|
83
|
-
"time-picker",
|
|
84
|
-
"title",
|
|
85
|
-
"toast-manager",
|
|
86
|
-
"toast",
|
|
87
|
-
"toggle",
|
|
88
|
-
"tooltip"
|
|
89
|
-
];
|
|
90
|
-
export type ComponentName = `sinch-${typeof BASE_COMPONENT_NAMES_LIST[number]}`;
|
|
91
|
-
export declare const pascalToKebabCase: (str: string) => string;
|
|
92
|
-
export declare const registerComponent: (name: ComponentName, constructor: CustomElementConstructor) => void;
|
|
93
|
-
export declare const defineCustomElement: (name: ComponentName, constructor?: CustomElementConstructor) => Promise<void>;
|
|
94
|
-
export interface SetNectaryRegistryOptions {
|
|
95
|
-
manualRegistration?: boolean;
|
|
96
|
-
}
|
|
97
|
-
export declare const setNectaryRegistry: (registry?: CustomElementRegistry, options?: SetNectaryRegistryOptions) => void;
|
|
1
|
+
export declare const defineCustomElement: (name: string, constructor: CustomElementConstructor) => void;
|
|
2
|
+
export declare const setNectaryRegistry: (registry: CustomElementRegistry) => void;
|
|
98
3
|
export declare const resetNectaryRegistry: () => void;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
4
|
+
declare global {
|
|
5
|
+
interface ShadowRootInit {
|
|
6
|
+
customElements?: CustomElementRegistry;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare class NectaryElement extends HTMLElement {
|
|
10
|
+
#private;
|
|
11
|
+
attachShadow(options?: Partial<ShadowRootInit>): ShadowRoot;
|
|
12
|
+
version: string;
|
|
13
|
+
get focusable(): boolean;
|
|
14
|
+
connectedCallback(): void;
|
|
15
|
+
disconnectedCallback(): void;
|
|
16
|
+
get isDomConnected(): boolean;
|
|
107
17
|
}
|
|
108
|
-
|
|
109
|
-
export {};
|
package/utils/element.js
CHANGED
|
@@ -1,113 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { COMPONENTS_STORE_KEY } from "./global-components-constants.js";
|
|
4
|
-
const version = "5.0.0";
|
|
5
|
-
const pkg = {
|
|
6
|
-
version
|
|
7
|
-
};
|
|
8
|
-
const nectaryDefinitions = /* @__PURE__ */ new Map();
|
|
1
|
+
import pkg from '../package.json';
|
|
2
|
+
const nectaryDefinitions = new Map();
|
|
9
3
|
let nectaryRegistry = null;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").toLowerCase();
|
|
16
|
-
};
|
|
17
|
-
const safeDefine = (registry, name, constructor) => {
|
|
18
|
-
if (registry.get(name) != null) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
registry.define(name, constructor);
|
|
22
|
-
};
|
|
23
|
-
const registerComponent = (name, constructor) => {
|
|
24
|
-
if (nectaryRegistry === window.customElements) {
|
|
25
|
-
throw new Error("Registering components on the global registry is not allowed. Please set a scoped registry with setNectaryRegistry() first.");
|
|
26
|
-
}
|
|
27
|
-
if (nectaryRegistry == null) {
|
|
28
|
-
throw new Error("Nectary registry is not set. Please set a scoped registry with setNectaryRegistry() first.");
|
|
29
|
-
}
|
|
30
|
-
safeDefine(nectaryRegistry, name, constructor);
|
|
31
|
-
};
|
|
32
|
-
const defineCustomElement = async (name, constructor) => {
|
|
33
|
-
if (manualRegistration) {
|
|
4
|
+
export const defineCustomElement = (name, constructor) => {
|
|
5
|
+
if (nectaryRegistry !== null) {
|
|
6
|
+
if (nectaryRegistry.get(name) == null) {
|
|
7
|
+
nectaryRegistry.define(name, constructor);
|
|
8
|
+
}
|
|
34
9
|
return;
|
|
35
10
|
}
|
|
36
11
|
nectaryDefinitions.set(name, constructor);
|
|
37
|
-
if (nectaryRegistry == null) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (nectaryRegistry === window.customElements) {
|
|
41
|
-
const globalConstructor = await getGlobalConstructor(name);
|
|
42
|
-
if (globalConstructor !== null) {
|
|
43
|
-
safeDefine(nectaryRegistry, name, globalConstructor);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (constructor != null) {
|
|
48
|
-
safeDefine(nectaryRegistry, name, constructor);
|
|
49
|
-
}
|
|
50
12
|
};
|
|
51
|
-
const
|
|
52
|
-
|
|
13
|
+
export const setNectaryRegistry = registry => {
|
|
14
|
+
if (nectaryRegistry !== null) {
|
|
15
|
+
throw new Error('Nectary registry already set');
|
|
16
|
+
}
|
|
17
|
+
nectaryRegistry = registry;
|
|
53
18
|
for (const [name, ctor] of nectaryDefinitions.entries()) {
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
if (globalConstructorPromise !== null) {
|
|
57
|
-
const resolvePromise = globalConstructorPromise.then((globalCtor) => {
|
|
58
|
-
safeDefine(registry, name, globalCtor);
|
|
59
|
-
});
|
|
60
|
-
globalConstructorPromises.push(resolvePromise);
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (ctor == null) {
|
|
65
|
-
throw new Error(
|
|
66
|
-
`Could not find constructor for ${name}.
|
|
67
|
-
|
|
68
|
-
Please make sure to omit '/global' when importing your component: import '@nectary/components/${sinchElementNameToBase(name)}'
|
|
69
|
-
|
|
70
|
-
If you intend to use global components, make sure to set the registry with the global registry: setNectaryRegistry(window.customElements).`
|
|
71
|
-
);
|
|
19
|
+
if (nectaryRegistry.get(name) == null) {
|
|
20
|
+
nectaryRegistry.define(name, ctor);
|
|
72
21
|
}
|
|
73
|
-
safeDefine(registry, name, ctor);
|
|
74
22
|
}
|
|
75
23
|
nectaryDefinitions.clear();
|
|
76
|
-
return globalConstructorPromises;
|
|
77
24
|
};
|
|
78
|
-
const
|
|
79
|
-
manualRegistration = options.manualRegistration ?? false;
|
|
80
|
-
if (nectaryRegistry != null) {
|
|
81
|
-
if (nectaryRegistry === window.customElements) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
throw new Error("Nectary registry already set");
|
|
85
|
-
}
|
|
86
|
-
nectaryRegistry = registry;
|
|
87
|
-
if (manualRegistration) {
|
|
88
|
-
nectaryDefinitions.clear();
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
const globalConstructorPromises = processDefinitionsForRegistry(registry);
|
|
92
|
-
if (globalConstructorPromises.length > 0) {
|
|
93
|
-
Promise.all(globalConstructorPromises).catch((error) => {
|
|
94
|
-
console.error("Error while registering global components", error);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
const resetNectaryRegistry = () => {
|
|
25
|
+
export const resetNectaryRegistry = () => {
|
|
99
26
|
nectaryRegistry = null;
|
|
100
27
|
};
|
|
101
|
-
class NectaryElement extends
|
|
28
|
+
export class NectaryElement extends HTMLElement {
|
|
102
29
|
attachShadow(options) {
|
|
103
30
|
return super.attachShadow({
|
|
104
|
-
mode:
|
|
31
|
+
mode: 'open',
|
|
105
32
|
delegatesFocus: false,
|
|
106
33
|
customElements: nectaryRegistry,
|
|
107
34
|
...options
|
|
108
35
|
});
|
|
109
36
|
}
|
|
110
|
-
version = pkg.version;
|
|
37
|
+
version = (() => pkg.version)();
|
|
111
38
|
get focusable() {
|
|
112
39
|
return false;
|
|
113
40
|
}
|
|
@@ -121,12 +48,4 @@ class NectaryElement extends NectaryElementBase {
|
|
|
121
48
|
get isDomConnected() {
|
|
122
49
|
return this.#isDomConnected;
|
|
123
50
|
}
|
|
124
|
-
}
|
|
125
|
-
export {
|
|
126
|
-
NectaryElement,
|
|
127
|
-
defineCustomElement,
|
|
128
|
-
pascalToKebabCase,
|
|
129
|
-
registerComponent,
|
|
130
|
-
resetNectaryRegistry,
|
|
131
|
-
setNectaryRegistry
|
|
132
|
-
};
|
|
51
|
+
}
|
package/utils/event-target.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const isTargetEqual = (e, $elem) => {
|
|
1
|
+
export const isTargetEqual = (e, $elem) => {
|
|
2
2
|
return e.target === $elem || e.originalTarget === $elem;
|
|
3
3
|
};
|
|
4
|
-
const getTargetByAttribute = (e, attr) => {
|
|
4
|
+
export const getTargetByAttribute = (e, attr) => {
|
|
5
5
|
if (e.target.hasAttribute(attr)) {
|
|
6
6
|
return e.target;
|
|
7
7
|
}
|
|
@@ -10,10 +10,10 @@ const getTargetByAttribute = (e, attr) => {
|
|
|
10
10
|
}
|
|
11
11
|
return null;
|
|
12
12
|
};
|
|
13
|
-
const getTargetAttribute = (e, attr) => {
|
|
13
|
+
export const getTargetAttribute = (e, attr) => {
|
|
14
14
|
return e.target.getAttribute(attr) ?? e.originalTarget?.getAttribute(attr) ?? null;
|
|
15
15
|
};
|
|
16
|
-
const getTargetIndexInParent = (e, parent) => {
|
|
16
|
+
export const getTargetIndexInParent = (e, parent) => {
|
|
17
17
|
const indexOf = Array.prototype.indexOf.call(parent.children, e.target);
|
|
18
18
|
if (indexOf >= 0) {
|
|
19
19
|
return indexOf;
|
|
@@ -23,10 +23,4 @@ const getTargetIndexInParent = (e, parent) => {
|
|
|
23
23
|
return Array.prototype.indexOf.call(parent.children, origTgt);
|
|
24
24
|
}
|
|
25
25
|
return -1;
|
|
26
|
-
};
|
|
27
|
-
export {
|
|
28
|
-
getTargetAttribute,
|
|
29
|
-
getTargetByAttribute,
|
|
30
|
-
getTargetIndexInParent,
|
|
31
|
-
isTargetEqual
|
|
32
|
-
};
|
|
26
|
+
};
|
package/utils/form.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
const setFormValue = (internals, value) => {
|
|
2
|
-
let formValue = value ??
|
|
1
|
+
export const setFormValue = (internals, value) => {
|
|
2
|
+
let formValue = value ?? '';
|
|
3
3
|
if (formValue instanceof FormData && [...formValue.keys()].length === 0) {
|
|
4
|
-
formValue =
|
|
4
|
+
formValue = '';
|
|
5
5
|
}
|
|
6
6
|
if (formValue instanceof File && formValue.size === 0) {
|
|
7
|
-
formValue =
|
|
7
|
+
formValue = '';
|
|
8
8
|
}
|
|
9
9
|
if (internals.form !== null) {
|
|
10
10
|
internals.setFormValue(formValue);
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
const requestSubmitForm = (form, submitter) => {
|
|
14
|
-
const submitterProxy = document.createElement(
|
|
15
|
-
submitterProxy.style.display =
|
|
13
|
+
export const requestSubmitForm = (form, submitter) => {
|
|
14
|
+
const submitterProxy = document.createElement('button');
|
|
15
|
+
submitterProxy.style.display = 'none';
|
|
16
16
|
submitterProxy.type = submitter.formType;
|
|
17
|
-
Array.from(submitter.attributes).filter(
|
|
17
|
+
Array.from(submitter.attributes).filter(attr => attr.name.startsWith('aria-')).forEach(attr => {
|
|
18
18
|
submitterProxy.setAttribute(attr.name, attr.value);
|
|
19
19
|
});
|
|
20
20
|
form.appendChild(submitterProxy);
|
|
@@ -24,18 +24,13 @@ const requestSubmitForm = (form, submitter) => {
|
|
|
24
24
|
form.removeChild(submitterProxy);
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
const CSVToFormData = (name, csv) => {
|
|
27
|
+
export const CSVToFormData = (name, csv) => {
|
|
28
28
|
if (csv.length === 0) {
|
|
29
|
-
return
|
|
29
|
+
return '';
|
|
30
30
|
}
|
|
31
31
|
const formData = new FormData();
|
|
32
|
-
csv.split(
|
|
32
|
+
csv.split(',').forEach(value => {
|
|
33
33
|
formData.append(name, value);
|
|
34
34
|
});
|
|
35
35
|
return formData;
|
|
36
|
-
};
|
|
37
|
-
export {
|
|
38
|
-
CSVToFormData,
|
|
39
|
-
requestSubmitForm,
|
|
40
|
-
setFormValue
|
|
41
|
-
};
|
|
36
|
+
};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
const getReactEventHandler = ($element, handlerName) => {
|
|
1
|
+
export const getReactEventHandler = ($element, handlerName) => {
|
|
2
2
|
for (const key in $element) {
|
|
3
|
-
if (Object.hasOwn($element, key) && key.startsWith(
|
|
3
|
+
if (Object.hasOwn($element, key) && key.startsWith('__reactProps$')) {
|
|
4
4
|
return $element[key][handlerName];
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
7
|
return null;
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
getReactEventHandler
|
|
11
|
-
};
|
|
8
|
+
};
|
package/utils/index.js
CHANGED
|
@@ -1,65 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
CSV_DELIMITER,
|
|
15
|
-
Context,
|
|
16
|
-
NectaryElement,
|
|
17
|
-
attrValueToInteger,
|
|
18
|
-
attrValueToPixels,
|
|
19
|
-
clampNumber,
|
|
20
|
-
cloneNode,
|
|
21
|
-
debounceAnimationFrame,
|
|
22
|
-
debounceTimeout,
|
|
23
|
-
defineCustomElement,
|
|
24
|
-
getAttribute,
|
|
25
|
-
getBooleanAttribute,
|
|
26
|
-
getCssVar,
|
|
27
|
-
getCssVars,
|
|
28
|
-
getFirstCsvValue,
|
|
29
|
-
getFirstFocusableElement,
|
|
30
|
-
getFirstSlotElement,
|
|
31
|
-
getIntegerAttribute,
|
|
32
|
-
getLiteralAttribute,
|
|
33
|
-
getReactEventHandler,
|
|
34
|
-
getRect,
|
|
35
|
-
getTargetAttribute,
|
|
36
|
-
getTargetByAttribute,
|
|
37
|
-
getTargetIndexInParent,
|
|
38
|
-
getTargetRect,
|
|
39
|
-
getUid,
|
|
40
|
-
hasClass,
|
|
41
|
-
isAttrEqual,
|
|
42
|
-
isAttrTrue,
|
|
43
|
-
isElementFocused,
|
|
44
|
-
isEmojiString,
|
|
45
|
-
isLiteralValue,
|
|
46
|
-
isTargetEqual,
|
|
47
|
-
packCsv,
|
|
48
|
-
parseMarkdown,
|
|
49
|
-
pascalToKebabCase,
|
|
50
|
-
rectOverlap,
|
|
51
|
-
registerComponent,
|
|
52
|
-
resetNectaryRegistry,
|
|
53
|
-
setClass,
|
|
54
|
-
setNectaryRegistry,
|
|
55
|
-
shouldReduceMotion,
|
|
56
|
-
subscribeContext,
|
|
57
|
-
throttleAnimationFrame,
|
|
58
|
-
unpackCsv,
|
|
59
|
-
updateAttribute,
|
|
60
|
-
updateBooleanAttribute,
|
|
61
|
-
updateCsv,
|
|
62
|
-
updateExplicitBooleanAttribute,
|
|
63
|
-
updateIntegerAttribute,
|
|
64
|
-
updateLiteralAttribute
|
|
65
|
-
};
|
|
1
|
+
export * from './context';
|
|
2
|
+
export * from './csv';
|
|
3
|
+
export * from './dom';
|
|
4
|
+
export * from './element';
|
|
5
|
+
export * from './rect';
|
|
6
|
+
export * from './slot';
|
|
7
|
+
export * from './throttle';
|
|
8
|
+
export * from './debounce';
|
|
9
|
+
export * from './get-react-event-handler';
|
|
10
|
+
export * from './markdown';
|
|
11
|
+
export * from './event-target';
|
|
12
|
+
export * from './uid';
|