@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/pop/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { NectaryElement } from '../utils';
|
|
2
|
-
import type { TSinchPopOrientation } from './types';
|
|
3
|
-
import type { TRect } from '../types';
|
|
4
|
-
export * from './types';
|
|
2
|
+
import type { TSinchPopOrientation, TSinchPop } from './types';
|
|
3
|
+
import type { NectaryComponentReact, NectaryComponentVanilla, TRect } from '../types';
|
|
5
4
|
export declare class Pop extends NectaryElement {
|
|
6
5
|
#private;
|
|
7
6
|
constructor();
|
|
@@ -20,3 +19,23 @@ export declare class Pop extends NectaryElement {
|
|
|
20
19
|
get popoverRect(): TRect;
|
|
21
20
|
attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null): void;
|
|
22
21
|
}
|
|
22
|
+
declare global {
|
|
23
|
+
interface NectaryComponentMap {
|
|
24
|
+
'sinch-pop': TSinchPop;
|
|
25
|
+
}
|
|
26
|
+
interface HTMLElementTagNameMap {
|
|
27
|
+
'sinch-pop': NectaryComponentVanilla<'sinch-pop'>;
|
|
28
|
+
}
|
|
29
|
+
namespace JSX {
|
|
30
|
+
interface IntrinsicElements {
|
|
31
|
+
'sinch-pop': NectaryComponentReact<'sinch-pop'>;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
declare module 'react' {
|
|
36
|
+
namespace JSX {
|
|
37
|
+
interface IntrinsicElements extends globalThis.JSX.IntrinsicElements {
|
|
38
|
+
'sinch-pop': NectaryComponentReact<'sinch-pop'>;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
package/pop/index.js
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import { Context, subscribeContext } from
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { getFirstSlotElement, getFirstFocusableElement, isElementFocused } from "../utils/slot.js";
|
|
6
|
-
import { throttleAnimationFrame } from "../utils/throttle.js";
|
|
7
|
-
import { getReactEventHandler } from "../utils/get-react-event-handler.js";
|
|
8
|
-
import { isTargetEqual } from "../utils/event-target.js";
|
|
9
|
-
import { orientationValues, disableOverscroll, enableOverscroll } from "./utils.js";
|
|
10
|
-
const templateHTML = '<style>\n:host {\n display: contents;\n position: relative;\n}\n\ndialog {\n position: fixed;\n left: 0;\n top: 0;\n margin: 0;\n outline: none;\n padding: 0;\n border: none;\n box-sizing: border-box;\n max-width: unset;\n max-height: unset;\n z-index: 1;\n background: none;\n overflow: visible;\n}\n\ndialog:not([open]) {\n display: none;\n}\n\ndialog::backdrop {\n background-color: transparent;\n}\n\n#content {\n position: relative;\n z-index: 1;\n}\n\n#target-open {\n display: flex;\n flex-direction: column;\n position: absolute;\n left: 0;\n top: 0;\n}\n\n#focus {\n display: none;\n position: absolute;\n width: 0;\n height: 0;\n}\n</style>\n\n<slot id="target" name="target" aria-haspopup="dialog" aria-expanded="false"></slot>\n<div id="focus"></div>\n<dialog id="dialog">\n <div id="target-open">\n <slot name="target-open"></slot>\n </div>\n <div id="content">\n <slot name="content"></slot>\n </div>\n</dialog>\n';
|
|
11
|
-
const template = document.createElement("template");
|
|
1
|
+
import { defineCustomElement, getBooleanAttribute, getLiteralAttribute, getRect, isAttrTrue, updateLiteralAttribute, getReactEventHandler, updateBooleanAttribute, NectaryElement, throttleAnimationFrame, isElementFocused, updateIntegerAttribute, getIntegerAttribute, getFirstFocusableElement, getFirstSlotElement, Context, subscribeContext, isTargetEqual, isAttrEqual } from '../utils';
|
|
2
|
+
const templateHTML = '<style>:host{display:contents;position:relative}dialog{position:fixed;left:0;top:0;margin:0;outline:0;padding:0;border:none;box-sizing:border-box;max-width:unset;max-height:unset;z-index:1;background:0 0;overflow:visible}dialog:not([open]){display:none}dialog::backdrop{background-color:transparent}#content{position:relative;z-index:1}#target-open{display:flex;flex-direction:column;position:absolute;left:0;top:0}#focus{display:none;position:absolute;width:0;height:0}</style><slot id="target" name="target" aria-haspopup="dialog" aria-expanded="false"></slot><div id="focus"></div><dialog id="dialog"><div id="target-open"><slot name="target-open"></slot></div><div id="content"><slot name="content"></slot></div></dialog>';
|
|
3
|
+
import { disableOverscroll, enableOverscroll, orientationValues } from './utils';
|
|
4
|
+
const template = document.createElement('template');
|
|
12
5
|
template.innerHTML = templateHTML;
|
|
13
|
-
class Pop extends NectaryElement {
|
|
6
|
+
export class Pop extends NectaryElement {
|
|
14
7
|
#$targetWrapper;
|
|
15
8
|
#$focus;
|
|
16
9
|
#$dialog;
|
|
@@ -30,16 +23,16 @@ class Pop extends NectaryElement {
|
|
|
30
23
|
super();
|
|
31
24
|
const shadowRoot = this.attachShadow();
|
|
32
25
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
33
|
-
this.#$targetWrapper = shadowRoot.querySelector(
|
|
34
|
-
this.#$focus = shadowRoot.querySelector(
|
|
35
|
-
this.#$dialog = shadowRoot.querySelector(
|
|
26
|
+
this.#$targetWrapper = shadowRoot.querySelector('#target');
|
|
27
|
+
this.#$focus = shadowRoot.querySelector('#focus');
|
|
28
|
+
this.#$dialog = shadowRoot.querySelector('#dialog');
|
|
36
29
|
this.#$targetSlot = shadowRoot.querySelector('slot[name="target"]');
|
|
37
30
|
this.#$targetOpenSlot = shadowRoot.querySelector('slot[name="target-open"]');
|
|
38
31
|
this.#$contentSlot = shadowRoot.querySelector('slot[name="content"]');
|
|
39
|
-
this.#$targetOpenWrapper = shadowRoot.querySelector(
|
|
32
|
+
this.#$targetOpenWrapper = shadowRoot.querySelector('#target-open');
|
|
40
33
|
this.#resizeThrottle = throttleAnimationFrame(this.#updateOrientation);
|
|
41
|
-
this.#keydownContext = new Context(this.#$contentSlot,
|
|
42
|
-
this.#visibilityContext = new Context(this.#$contentSlot,
|
|
34
|
+
this.#keydownContext = new Context(this.#$contentSlot, 'keydown');
|
|
35
|
+
this.#visibilityContext = new Context(this.#$contentSlot, 'visibility');
|
|
43
36
|
this.#controller = new AbortController();
|
|
44
37
|
}
|
|
45
38
|
connectedCallback() {
|
|
@@ -47,15 +40,23 @@ class Pop extends NectaryElement {
|
|
|
47
40
|
if (this.#controller === null) {
|
|
48
41
|
this.#controller = new AbortController();
|
|
49
42
|
}
|
|
50
|
-
const {
|
|
43
|
+
const {
|
|
44
|
+
signal
|
|
45
|
+
} = this.#controller;
|
|
51
46
|
this.#keydownContext.listen(signal);
|
|
52
47
|
this.#visibilityContext.listen(signal);
|
|
53
|
-
this.setAttribute(
|
|
54
|
-
this.#$dialog.addEventListener(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
this.setAttribute('role', 'dialog');
|
|
49
|
+
this.#$dialog.addEventListener('cancel', this.#onCancel, {
|
|
50
|
+
signal
|
|
51
|
+
});
|
|
52
|
+
this.#$dialog.addEventListener('mousedown', this.#onBackdropMouseDown, {
|
|
53
|
+
signal
|
|
54
|
+
});
|
|
55
|
+
this.addEventListener('-close', this.#onCloseReactHandler, {
|
|
56
|
+
signal
|
|
57
|
+
});
|
|
58
|
+
subscribeContext(this, 'visibility', this.#onContextVisibility, signal);
|
|
59
|
+
if (getBooleanAttribute(this, 'open')) {
|
|
59
60
|
this.#onExpand();
|
|
60
61
|
}
|
|
61
62
|
}
|
|
@@ -67,34 +68,31 @@ class Pop extends NectaryElement {
|
|
|
67
68
|
this.#onCollapse();
|
|
68
69
|
}
|
|
69
70
|
static get observedAttributes() {
|
|
70
|
-
return [
|
|
71
|
-
"orientation",
|
|
72
|
-
"open"
|
|
73
|
-
];
|
|
71
|
+
return ['orientation', 'open'];
|
|
74
72
|
}
|
|
75
73
|
set modal(isModal) {
|
|
76
|
-
updateBooleanAttribute(this,
|
|
74
|
+
updateBooleanAttribute(this, 'modal', isModal);
|
|
77
75
|
}
|
|
78
76
|
get modal() {
|
|
79
|
-
return getBooleanAttribute(this,
|
|
77
|
+
return getBooleanAttribute(this, 'modal');
|
|
80
78
|
}
|
|
81
79
|
set open(isOpen) {
|
|
82
|
-
updateBooleanAttribute(this,
|
|
80
|
+
updateBooleanAttribute(this, 'open', isOpen);
|
|
83
81
|
}
|
|
84
82
|
get open() {
|
|
85
|
-
return getBooleanAttribute(this,
|
|
83
|
+
return getBooleanAttribute(this, 'open');
|
|
86
84
|
}
|
|
87
85
|
get orientation() {
|
|
88
|
-
return getLiteralAttribute(this, orientationValues,
|
|
86
|
+
return getLiteralAttribute(this, orientationValues, 'orientation');
|
|
89
87
|
}
|
|
90
88
|
set orientation(value) {
|
|
91
|
-
updateLiteralAttribute(this, orientationValues,
|
|
89
|
+
updateLiteralAttribute(this, orientationValues, 'orientation', value);
|
|
92
90
|
}
|
|
93
91
|
set inset(inset) {
|
|
94
|
-
updateIntegerAttribute(this,
|
|
92
|
+
updateIntegerAttribute(this, 'inset', inset);
|
|
95
93
|
}
|
|
96
94
|
get inset() {
|
|
97
|
-
return getIntegerAttribute(this,
|
|
95
|
+
return getIntegerAttribute(this, 'inset', 0);
|
|
98
96
|
}
|
|
99
97
|
get footprintRect() {
|
|
100
98
|
return this.#getTargetRect();
|
|
@@ -107,26 +105,28 @@ class Pop extends NectaryElement {
|
|
|
107
105
|
return;
|
|
108
106
|
}
|
|
109
107
|
switch (name) {
|
|
110
|
-
case
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
this
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
108
|
+
case 'open':
|
|
109
|
+
{
|
|
110
|
+
const shouldOpen = isAttrTrue(newVal);
|
|
111
|
+
if (shouldOpen) {
|
|
112
|
+
requestAnimationFrame(() => {
|
|
113
|
+
if (this.isDomConnected && getBooleanAttribute(this, 'open')) {
|
|
114
|
+
this.#onExpand();
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
} else {
|
|
118
|
+
this.#onCollapse();
|
|
119
|
+
}
|
|
120
|
+
updateBooleanAttribute(this, 'open', shouldOpen);
|
|
121
|
+
break;
|
|
120
122
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
case 'orientation':
|
|
124
|
+
{
|
|
125
|
+
if (this.#$dialog.open) {
|
|
126
|
+
this.#updateOrientation();
|
|
127
|
+
}
|
|
128
|
+
break;
|
|
127
129
|
}
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
#getTargetRect() {
|
|
@@ -137,7 +137,7 @@ class Pop extends NectaryElement {
|
|
|
137
137
|
if (item === null) {
|
|
138
138
|
return getRect(this.#$targetWrapper);
|
|
139
139
|
}
|
|
140
|
-
if (Reflect.has(item,
|
|
140
|
+
if (Reflect.has(item, 'footprintRect')) {
|
|
141
141
|
return item.footprintRect;
|
|
142
142
|
}
|
|
143
143
|
return getRect(item);
|
|
@@ -153,17 +153,17 @@ class Pop extends NectaryElement {
|
|
|
153
153
|
if (!this.isDomConnected || this.#$dialog.open) {
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
|
-
this.#$targetSlot.addEventListener(
|
|
157
|
-
this.#$focus.setAttribute(
|
|
158
|
-
this.#$focus.style.display =
|
|
159
|
-
this.#$focus.addEventListener(
|
|
156
|
+
this.#$targetSlot.addEventListener('blur', this.#stopEventPropagation, true);
|
|
157
|
+
this.#$focus.setAttribute('tabindex', '-1');
|
|
158
|
+
this.#$focus.style.display = 'block';
|
|
159
|
+
this.#$focus.addEventListener('focus', this.#captureRelatedActiveElement);
|
|
160
160
|
this.#$focus.focus();
|
|
161
|
-
this.#$focus.removeEventListener(
|
|
162
|
-
this.#$targetSlot.removeEventListener(
|
|
163
|
-
this.#$focus.removeAttribute(
|
|
164
|
-
this.#$focus.removeAttribute(
|
|
161
|
+
this.#$focus.removeEventListener('focus', this.#captureRelatedActiveElement);
|
|
162
|
+
this.#$targetSlot.removeEventListener('blur', this.#stopEventPropagation, true);
|
|
163
|
+
this.#$focus.removeAttribute('tabindex');
|
|
164
|
+
this.#$focus.removeAttribute('style');
|
|
165
165
|
this.#$dialog.showModal();
|
|
166
|
-
this.#$targetWrapper.setAttribute(
|
|
166
|
+
this.#$targetWrapper.setAttribute('aria-expanded', 'true');
|
|
167
167
|
this.#updateOrientation();
|
|
168
168
|
if (this.modal) {
|
|
169
169
|
getFirstFocusableElement(this.#$contentSlot)?.focus();
|
|
@@ -175,41 +175,43 @@ class Pop extends NectaryElement {
|
|
|
175
175
|
const marginTop = parseInt(targetElComputedStyle.marginTop);
|
|
176
176
|
const marginBottom = parseInt(targetElComputedStyle.marginBottom);
|
|
177
177
|
const targetRect = this.#getTargetRect();
|
|
178
|
-
this.#$targetWrapper.style.setProperty(
|
|
179
|
-
this.#$targetWrapper.style.setProperty(
|
|
180
|
-
this.#$targetWrapper.style.setProperty(
|
|
181
|
-
this.#$targetOpenWrapper.style.setProperty(
|
|
182
|
-
this.#$targetOpenWrapper.style.setProperty(
|
|
183
|
-
this.#targetStyleValue = $targetEl.getAttribute(
|
|
184
|
-
$targetEl.style.setProperty(
|
|
185
|
-
$targetEl.style.setProperty(
|
|
186
|
-
if (targetElComputedStyle.transform !==
|
|
178
|
+
this.#$targetWrapper.style.setProperty('display', 'block');
|
|
179
|
+
this.#$targetWrapper.style.setProperty('width', `${targetRect.width + marginLeft + marginRight}px`);
|
|
180
|
+
this.#$targetWrapper.style.setProperty('height', `${targetRect.height + marginTop + marginBottom}px`);
|
|
181
|
+
this.#$targetOpenWrapper.style.setProperty('width', `${targetRect.width}px`);
|
|
182
|
+
this.#$targetOpenWrapper.style.setProperty('height', `${targetRect.height}px`);
|
|
183
|
+
this.#targetStyleValue = $targetEl.getAttribute('style');
|
|
184
|
+
$targetEl.style.setProperty('margin', '0');
|
|
185
|
+
$targetEl.style.setProperty('position', 'static');
|
|
186
|
+
if (targetElComputedStyle.transform !== 'none') {
|
|
187
187
|
const matrix = new DOMMatrixReadOnly(targetElComputedStyle.transform);
|
|
188
|
-
$targetEl.style.setProperty(
|
|
188
|
+
$targetEl.style.setProperty('transform', matrix.translate(-matrix.e, -matrix.f).toString());
|
|
189
189
|
}
|
|
190
|
-
getFirstSlotElement(this.#$targetSlot)?.setAttribute(
|
|
191
|
-
this.#$targetOpenSlot.addEventListener(
|
|
190
|
+
getFirstSlotElement(this.#$targetSlot)?.setAttribute('slot', 'target-open');
|
|
191
|
+
this.#$targetOpenSlot.addEventListener('keydown', this.#onTargetKeydown);
|
|
192
192
|
if (this.#targetActiveElement !== null) {
|
|
193
|
-
this.#$targetOpenSlot.addEventListener(
|
|
193
|
+
this.#$targetOpenSlot.addEventListener('focus', this.#stopEventPropagation, true);
|
|
194
194
|
this.#targetActiveElement.focus();
|
|
195
|
-
this.#$targetOpenSlot.removeEventListener(
|
|
195
|
+
this.#$targetOpenSlot.removeEventListener('focus', this.#stopEventPropagation, true);
|
|
196
196
|
if (!isElementFocused(this.#targetActiveElement)) {
|
|
197
197
|
requestAnimationFrame(() => {
|
|
198
198
|
if (this.isDomConnected && this.#$dialog.open) {
|
|
199
|
-
this.#$targetOpenSlot.addEventListener(
|
|
199
|
+
this.#$targetOpenSlot.addEventListener('focus', this.#stopEventPropagation, true);
|
|
200
200
|
this.#targetActiveElement.focus();
|
|
201
|
-
this.#$targetOpenSlot.removeEventListener(
|
|
201
|
+
this.#$targetOpenSlot.removeEventListener('focus', this.#stopEventPropagation, true);
|
|
202
202
|
}
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
disableOverscroll();
|
|
208
|
-
window.addEventListener(
|
|
209
|
-
|
|
208
|
+
window.addEventListener('scroll', this.#updatePosition, {
|
|
209
|
+
passive: false
|
|
210
|
+
});
|
|
211
|
+
window.addEventListener('resize', this.#onResize);
|
|
210
212
|
requestAnimationFrame(() => {
|
|
211
213
|
if (this.isDomConnected && this.#$dialog.open) {
|
|
212
|
-
this.#$contentSlot.addEventListener(
|
|
214
|
+
this.#$contentSlot.addEventListener('slotchange', this.#onContentSlotChange);
|
|
213
215
|
}
|
|
214
216
|
});
|
|
215
217
|
this.#dispatchContentVisibility(true);
|
|
@@ -220,41 +222,45 @@ class Pop extends NectaryElement {
|
|
|
220
222
|
}
|
|
221
223
|
const isNonModal = !this.modal;
|
|
222
224
|
this.#dispatchContentVisibility(false);
|
|
223
|
-
this.#$targetOpenSlot.removeEventListener(
|
|
225
|
+
this.#$targetOpenSlot.removeEventListener('keydown', this.#onTargetKeydown);
|
|
224
226
|
if (isNonModal) {
|
|
225
|
-
this.#$targetOpenSlot.addEventListener(
|
|
227
|
+
this.#$targetOpenSlot.addEventListener('blur', this.#captureActiveElement, true);
|
|
226
228
|
}
|
|
227
229
|
this.#$dialog.close();
|
|
228
|
-
this.#$targetWrapper.setAttribute(
|
|
230
|
+
this.#$targetWrapper.setAttribute('aria-expanded', 'false');
|
|
229
231
|
if (isNonModal) {
|
|
230
|
-
this.#$targetOpenSlot.removeEventListener(
|
|
232
|
+
this.#$targetOpenSlot.removeEventListener('blur', this.#captureActiveElement, true);
|
|
231
233
|
}
|
|
232
234
|
if (isNonModal) {
|
|
233
235
|
const targetEl = this.#getFirstTargetElement(this.#$targetOpenSlot);
|
|
234
|
-
targetEl.style.removeProperty(
|
|
235
|
-
targetEl.style.removeProperty(
|
|
236
|
-
targetEl.style.removeProperty(
|
|
236
|
+
targetEl.style.removeProperty('margin');
|
|
237
|
+
targetEl.style.removeProperty('position');
|
|
238
|
+
targetEl.style.removeProperty('transform');
|
|
237
239
|
if (this.#targetStyleValue !== null) {
|
|
238
|
-
targetEl.setAttribute(
|
|
240
|
+
targetEl.setAttribute('style', this.#targetStyleValue);
|
|
239
241
|
this.#targetStyleValue = null;
|
|
240
242
|
}
|
|
241
|
-
getFirstSlotElement(this.#$targetOpenSlot)?.setAttribute(
|
|
242
|
-
this.#$targetWrapper.style.removeProperty(
|
|
243
|
-
this.#$targetWrapper.style.removeProperty(
|
|
244
|
-
this.#$targetWrapper.style.removeProperty(
|
|
243
|
+
getFirstSlotElement(this.#$targetOpenSlot)?.setAttribute('slot', 'target');
|
|
244
|
+
this.#$targetWrapper.style.removeProperty('display');
|
|
245
|
+
this.#$targetWrapper.style.removeProperty('width');
|
|
246
|
+
this.#$targetWrapper.style.removeProperty('height');
|
|
245
247
|
}
|
|
246
248
|
if (this.#targetActiveElement !== null) {
|
|
247
249
|
if (!isElementFocused(this.#targetActiveElement)) {
|
|
248
|
-
this.#$targetSlot.addEventListener(
|
|
249
|
-
this.#targetActiveElement.focus({
|
|
250
|
-
|
|
250
|
+
this.#$targetSlot.addEventListener('focus', this.#stopEventPropagation, true);
|
|
251
|
+
this.#targetActiveElement.focus({
|
|
252
|
+
preventScroll: true
|
|
253
|
+
});
|
|
254
|
+
this.#$targetSlot.removeEventListener('focus', this.#stopEventPropagation, true);
|
|
251
255
|
if (!isElementFocused(this.#targetActiveElement)) {
|
|
252
256
|
const $targetEl = this.#targetActiveElement;
|
|
253
257
|
requestAnimationFrame(() => {
|
|
254
258
|
if (this.isDomConnected && !this.#$dialog.open) {
|
|
255
|
-
this.#$targetSlot.addEventListener(
|
|
256
|
-
$targetEl.focus({
|
|
257
|
-
|
|
259
|
+
this.#$targetSlot.addEventListener('focus', this.#stopEventPropagation, true);
|
|
260
|
+
$targetEl.focus({
|
|
261
|
+
preventScroll: true
|
|
262
|
+
});
|
|
263
|
+
this.#$targetSlot.removeEventListener('focus', this.#stopEventPropagation, true);
|
|
258
264
|
}
|
|
259
265
|
});
|
|
260
266
|
}
|
|
@@ -263,9 +269,9 @@ class Pop extends NectaryElement {
|
|
|
263
269
|
}
|
|
264
270
|
enableOverscroll();
|
|
265
271
|
this.#resizeThrottle.cancel();
|
|
266
|
-
window.removeEventListener(
|
|
267
|
-
window.removeEventListener(
|
|
268
|
-
this.#$contentSlot.removeEventListener(
|
|
272
|
+
window.removeEventListener('resize', this.#onResize);
|
|
273
|
+
window.removeEventListener('scroll', this.#updatePosition);
|
|
274
|
+
this.#$contentSlot.removeEventListener('slotchange', this.#onContentSlotChange);
|
|
269
275
|
}
|
|
270
276
|
#onResize = () => {
|
|
271
277
|
this.#resizeThrottle.fn();
|
|
@@ -278,47 +284,47 @@ class Pop extends NectaryElement {
|
|
|
278
284
|
const inset = this.inset;
|
|
279
285
|
let xPos = 0;
|
|
280
286
|
let yPos = 0;
|
|
281
|
-
if (orient ===
|
|
287
|
+
if (orient === 'bottom-right' || orient === 'top-right' || orient === 'top-stretch' || orient === 'bottom-stretch') {
|
|
282
288
|
xPos = targetRect.x;
|
|
283
289
|
}
|
|
284
|
-
if (orient ===
|
|
290
|
+
if (orient === 'bottom-left' || orient === 'top-left') {
|
|
285
291
|
xPos = targetRect.x + targetRect.width - modalWidth;
|
|
286
292
|
}
|
|
287
|
-
if (orient ===
|
|
293
|
+
if (orient === 'bottom-center' || orient === 'top-center') {
|
|
288
294
|
xPos = targetRect.x + targetRect.width / 2 - modalWidth / 2;
|
|
289
295
|
}
|
|
290
|
-
if (orient ===
|
|
296
|
+
if (orient === 'center-right') {
|
|
291
297
|
xPos = targetRect.x + targetRect.width;
|
|
292
298
|
}
|
|
293
|
-
if (orient ===
|
|
299
|
+
if (orient === 'center-left') {
|
|
294
300
|
xPos = targetRect.x - modalWidth;
|
|
295
301
|
}
|
|
296
|
-
if (orient ===
|
|
302
|
+
if (orient === 'bottom-left' || orient === 'bottom-right' || orient === 'bottom-stretch' || orient === 'bottom-center') {
|
|
297
303
|
yPos = targetRect.y + targetRect.height;
|
|
298
304
|
}
|
|
299
|
-
if (orient ===
|
|
305
|
+
if (orient === 'top-left' || orient === 'top-right' || orient === 'top-stretch' || orient === 'top-center') {
|
|
300
306
|
yPos = targetRect.y - modalHeight;
|
|
301
307
|
}
|
|
302
|
-
if (orient ===
|
|
308
|
+
if (orient === 'center-left' || orient === 'center-right') {
|
|
303
309
|
yPos = targetRect.y + targetRect.height / 2 - modalHeight / 2;
|
|
304
310
|
}
|
|
305
311
|
const clampedXPos = Math.max(inset, Math.min(xPos, window.innerWidth - modalWidth - inset));
|
|
306
312
|
const clampedYPos = Math.max(inset, Math.min(yPos, window.innerHeight - modalHeight - inset));
|
|
307
|
-
this.#$dialog.style.setProperty(
|
|
308
|
-
this.#$dialog.style.setProperty(
|
|
313
|
+
this.#$dialog.style.setProperty('left', `${clampedXPos}px`);
|
|
314
|
+
this.#$dialog.style.setProperty('top', `${clampedYPos}px`);
|
|
309
315
|
if (!this.modal) {
|
|
310
316
|
const targetLeftPos = targetRect.x - clampedXPos;
|
|
311
317
|
const targetTopPos = targetRect.y - clampedYPos;
|
|
312
|
-
this.#$targetOpenWrapper.style.setProperty(
|
|
313
|
-
this.#$targetOpenWrapper.style.setProperty(
|
|
318
|
+
this.#$targetOpenWrapper.style.setProperty('left', `${targetLeftPos}px`);
|
|
319
|
+
this.#$targetOpenWrapper.style.setProperty('top', `${targetTopPos}px`);
|
|
314
320
|
}
|
|
315
321
|
};
|
|
316
322
|
#updateOrientation = () => {
|
|
317
|
-
this.#$dialog.style.setProperty(
|
|
323
|
+
this.#$dialog.style.setProperty('width', 'max-content');
|
|
318
324
|
const targetRect = this.#getTargetRect();
|
|
319
325
|
const modalRect = this.#$dialog.getBoundingClientRect();
|
|
320
326
|
const orient = this.orientation;
|
|
321
|
-
const shouldSetWidthToTarget = orient ===
|
|
327
|
+
const shouldSetWidthToTarget = orient === 'top-stretch' || orient === 'bottom-stretch';
|
|
322
328
|
const modalHeight = modalRect.height;
|
|
323
329
|
const modalWidth = shouldSetWidthToTarget ? targetRect.width : modalRect.width;
|
|
324
330
|
const inset = this.inset;
|
|
@@ -326,43 +332,43 @@ class Pop extends NectaryElement {
|
|
|
326
332
|
let yPos = 0;
|
|
327
333
|
this.#modalHeight = modalHeight;
|
|
328
334
|
this.#modalWidth = modalWidth;
|
|
329
|
-
if (orient ===
|
|
335
|
+
if (orient === 'bottom-right' || orient === 'top-right' || orient === 'top-stretch' || orient === 'bottom-stretch') {
|
|
330
336
|
xPos = targetRect.x;
|
|
331
337
|
}
|
|
332
|
-
if (orient ===
|
|
338
|
+
if (orient === 'bottom-left' || orient === 'top-left') {
|
|
333
339
|
xPos = targetRect.x + targetRect.width - modalWidth;
|
|
334
340
|
}
|
|
335
|
-
if (orient ===
|
|
341
|
+
if (orient === 'bottom-center' || orient === 'top-center') {
|
|
336
342
|
xPos = targetRect.x + targetRect.width / 2 - modalWidth / 2;
|
|
337
343
|
}
|
|
338
|
-
if (orient ===
|
|
344
|
+
if (orient === 'center-right') {
|
|
339
345
|
xPos = targetRect.x + targetRect.width;
|
|
340
346
|
}
|
|
341
|
-
if (orient ===
|
|
347
|
+
if (orient === 'center-left') {
|
|
342
348
|
xPos = targetRect.x - modalWidth;
|
|
343
349
|
}
|
|
344
|
-
if (orient ===
|
|
350
|
+
if (orient === 'bottom-left' || orient === 'bottom-right' || orient === 'bottom-stretch' || orient === 'bottom-center') {
|
|
345
351
|
yPos = targetRect.y + targetRect.height;
|
|
346
352
|
}
|
|
347
|
-
if (orient ===
|
|
353
|
+
if (orient === 'top-left' || orient === 'top-right' || orient === 'top-stretch' || orient === 'top-center') {
|
|
348
354
|
yPos = targetRect.y - modalHeight;
|
|
349
355
|
}
|
|
350
|
-
if (orient ===
|
|
356
|
+
if (orient === 'center-left' || orient === 'center-right') {
|
|
351
357
|
yPos = targetRect.y + targetRect.height / 2 - modalHeight / 2;
|
|
352
358
|
}
|
|
353
359
|
xPos = Math.round(Math.max(inset, Math.min(xPos, window.innerWidth - modalWidth - inset)));
|
|
354
360
|
yPos = Math.round(Math.max(inset, Math.min(yPos, window.innerHeight - modalHeight - inset)));
|
|
355
|
-
this.#$dialog.style.setProperty(
|
|
356
|
-
this.#$dialog.style.setProperty(
|
|
357
|
-
this.#$dialog.style.setProperty(
|
|
361
|
+
this.#$dialog.style.setProperty('left', `${xPos}px`);
|
|
362
|
+
this.#$dialog.style.setProperty('top', `${yPos}px`);
|
|
363
|
+
this.#$dialog.style.setProperty('width', `${modalWidth}px`);
|
|
358
364
|
if (!this.modal) {
|
|
359
365
|
const targetLeftPos = targetRect.x - xPos;
|
|
360
366
|
const targetTopPos = targetRect.y - yPos;
|
|
361
|
-
this.#$targetOpenWrapper.style.setProperty(
|
|
362
|
-
this.#$targetOpenWrapper.style.setProperty(
|
|
367
|
+
this.#$targetOpenWrapper.style.setProperty('left', `${targetLeftPos}px`);
|
|
368
|
+
this.#$targetOpenWrapper.style.setProperty('top', `${targetTopPos}px`);
|
|
363
369
|
}
|
|
364
370
|
};
|
|
365
|
-
#onBackdropMouseDown =
|
|
371
|
+
#onBackdropMouseDown = e => {
|
|
366
372
|
if (isTargetEqual(e, this.#$dialog)) {
|
|
367
373
|
const rect = this.popoverRect;
|
|
368
374
|
const isInside = e.x >= rect.x && e.x < rect.x + rect.width && e.y >= rect.y && e.y < rect.y + rect.height;
|
|
@@ -372,34 +378,32 @@ class Pop extends NectaryElement {
|
|
|
372
378
|
}
|
|
373
379
|
}
|
|
374
380
|
};
|
|
375
|
-
#onCancel =
|
|
381
|
+
#onCancel = e => {
|
|
376
382
|
e.preventDefault();
|
|
377
383
|
e.stopPropagation();
|
|
378
384
|
this.#dispatchCloseEvent();
|
|
379
385
|
};
|
|
380
|
-
#onCloseReactHandler =
|
|
381
|
-
getReactEventHandler(this,
|
|
386
|
+
#onCloseReactHandler = e => {
|
|
387
|
+
getReactEventHandler(this, 'on-close')?.(e);
|
|
382
388
|
};
|
|
383
389
|
#dispatchCloseEvent() {
|
|
384
|
-
this.dispatchEvent(
|
|
385
|
-
new CustomEvent("-close")
|
|
386
|
-
);
|
|
390
|
+
this.dispatchEvent(new CustomEvent('-close'));
|
|
387
391
|
}
|
|
388
|
-
#captureRelatedActiveElement =
|
|
392
|
+
#captureRelatedActiveElement = e => {
|
|
389
393
|
e.stopPropagation();
|
|
390
394
|
this.#targetActiveElement = e.relatedTarget;
|
|
391
395
|
};
|
|
392
|
-
#captureActiveElement =
|
|
396
|
+
#captureActiveElement = e => {
|
|
393
397
|
e.stopPropagation();
|
|
394
398
|
this.#targetActiveElement = e.target;
|
|
395
399
|
};
|
|
396
|
-
#stopEventPropagation =
|
|
400
|
+
#stopEventPropagation = e => {
|
|
397
401
|
e.stopPropagation();
|
|
398
402
|
};
|
|
399
403
|
#dispatchContentVisibility(isVisible) {
|
|
400
404
|
this.#visibilityContext.dispatch(isVisible);
|
|
401
405
|
}
|
|
402
|
-
#onTargetKeydown =
|
|
406
|
+
#onTargetKeydown = e => {
|
|
403
407
|
this.#keydownContext.dispatch({
|
|
404
408
|
code: e.code,
|
|
405
409
|
preventDefault: () => {
|
|
@@ -407,19 +411,16 @@ class Pop extends NectaryElement {
|
|
|
407
411
|
}
|
|
408
412
|
});
|
|
409
413
|
};
|
|
410
|
-
#onContextVisibility =
|
|
414
|
+
#onContextVisibility = e => {
|
|
411
415
|
if (!e.detail) {
|
|
412
416
|
this.#dispatchCloseEvent();
|
|
413
417
|
}
|
|
414
418
|
};
|
|
415
|
-
#onContentSlotChange =
|
|
419
|
+
#onContentSlotChange = e => {
|
|
416
420
|
e.stopPropagation();
|
|
417
421
|
if (this.#$dialog.open) {
|
|
418
422
|
this.#updateOrientation();
|
|
419
423
|
}
|
|
420
424
|
};
|
|
421
425
|
}
|
|
422
|
-
defineCustomElement(
|
|
423
|
-
export {
|
|
424
|
-
Pop
|
|
425
|
-
};
|
|
426
|
+
defineCustomElement('sinch-pop', Pop);
|
package/pop/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NectaryComponentReactByType, NectaryComponentVanillaByType, TRect
|
|
1
|
+
import type { NectaryComponentReactByType, NectaryComponentVanillaByType, TRect } from '../types';
|
|
2
2
|
export type TSinchPopOrientation = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'bottom-center' | 'bottom-stretch' | 'top-center' | 'top-stretch' | 'center-right' | 'center-left';
|
|
3
3
|
export type TSinchPopProps = {
|
|
4
4
|
/** Open/close state */
|
|
@@ -23,23 +23,3 @@ export type TSinchPop = {
|
|
|
23
23
|
};
|
|
24
24
|
export type TSinchPopElement = NectaryComponentVanillaByType<TSinchPop>;
|
|
25
25
|
export type TSinchPopReact = NectaryComponentReactByType<TSinchPop>;
|
|
26
|
-
declare global {
|
|
27
|
-
interface NectaryComponentMap {
|
|
28
|
-
'sinch-pop': TSinchPop;
|
|
29
|
-
}
|
|
30
|
-
interface HTMLElementTagNameMap {
|
|
31
|
-
'sinch-pop': NectaryComponentVanilla<'sinch-pop'>;
|
|
32
|
-
}
|
|
33
|
-
namespace JSX {
|
|
34
|
-
interface IntrinsicElements {
|
|
35
|
-
'sinch-pop': NectaryComponentReact<'sinch-pop'>;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
declare module 'react' {
|
|
40
|
-
namespace JSX {
|
|
41
|
-
interface IntrinsicElements extends globalThis.JSX.IntrinsicElements {
|
|
42
|
-
'sinch-pop': NectaryComponentReact<'sinch-pop'>;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
package/pop/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
package/pop/utils.js
CHANGED
|
@@ -1,32 +1,16 @@
|
|
|
1
|
-
const orientationValues = [
|
|
2
|
-
"top-left",
|
|
3
|
-
"top-right",
|
|
4
|
-
"bottom-left",
|
|
5
|
-
"bottom-right",
|
|
6
|
-
"bottom-stretch",
|
|
7
|
-
"bottom-center",
|
|
8
|
-
"top-stretch",
|
|
9
|
-
"top-center",
|
|
10
|
-
"center-left",
|
|
11
|
-
"center-right"
|
|
12
|
-
];
|
|
1
|
+
export const orientationValues = ['top-left', 'top-right', 'bottom-left', 'bottom-right', 'bottom-stretch', 'bottom-center', 'top-stretch', 'top-center', 'center-left', 'center-right'];
|
|
13
2
|
const bodyEl = document.body;
|
|
14
|
-
const disableOverscroll = () => {
|
|
3
|
+
export const disableOverscroll = () => {
|
|
15
4
|
bodyEl.__pop_counter__ = (bodyEl.__pop_counter__ ?? 0) + 1;
|
|
16
5
|
if (bodyEl.__pop_counter__ === 1) {
|
|
17
|
-
bodyEl.style.setProperty(
|
|
18
|
-
document.documentElement.style.setProperty(
|
|
6
|
+
bodyEl.style.setProperty('overscroll-behavior', 'none');
|
|
7
|
+
document.documentElement.style.setProperty('overscroll-behavior', 'none');
|
|
19
8
|
}
|
|
20
9
|
};
|
|
21
|
-
const enableOverscroll = () => {
|
|
10
|
+
export const enableOverscroll = () => {
|
|
22
11
|
bodyEl.__pop_counter__ = Math.max(0, (bodyEl.__pop_counter__ ?? 0) - 1);
|
|
23
12
|
if (bodyEl.__pop_counter__ === 0) {
|
|
24
|
-
bodyEl.style.removeProperty(
|
|
25
|
-
document.documentElement.style.removeProperty(
|
|
13
|
+
bodyEl.style.removeProperty('overscroll-behavior');
|
|
14
|
+
document.documentElement.style.removeProperty('overscroll-behavior');
|
|
26
15
|
}
|
|
27
|
-
};
|
|
28
|
-
export {
|
|
29
|
-
disableOverscroll,
|
|
30
|
-
enableOverscroll,
|
|
31
|
-
orientationValues
|
|
32
|
-
};
|
|
16
|
+
};
|