@nectary/components 4.12.1 → 5.0.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/global/index.d.ts +1 -0
- package/accordion/global/index.js +2 -0
- package/accordion/index.d.ts +1 -22
- package/accordion/index.js +41 -39
- package/accordion/types.d.ts +21 -1
- package/accordion/types.js +1 -1
- package/accordion-item/global/index.d.ts +1 -0
- package/accordion-item/global/index.js +2 -0
- package/accordion-item/index.d.ts +2 -22
- package/accordion-item/index.js +53 -49
- package/accordion-item/types.d.ts +21 -1
- package/accordion-item/types.js +1 -1
- package/accordion-item/utils.js +4 -1
- package/action-menu/global/index.d.ts +1 -0
- package/action-menu/global/index.js +2 -0
- package/action-menu/index.d.ts +1 -22
- package/action-menu/index.js +62 -77
- package/action-menu/types.d.ts +21 -1
- package/action-menu/types.js +1 -1
- package/action-menu-option/global/index.d.ts +1 -0
- package/action-menu-option/global/index.js +2 -0
- package/action-menu-option/index.d.ts +1 -22
- package/action-menu-option/index.js +39 -41
- package/action-menu-option/types.d.ts +21 -1
- package/action-menu-option/types.js +1 -1
- package/action-menu-option/utils.js +6 -3
- package/alert/global/index.d.ts +1 -0
- package/alert/global/index.js +2 -0
- package/alert/index.d.ts +2 -22
- package/alert/index.js +24 -21
- package/alert/types.d.ts +21 -1
- package/alert/types.js +1 -1
- package/alert/utils.js +4 -1
- package/avatar/colors.js +1 -1
- package/avatar/global/index.d.ts +1 -0
- package/avatar/global/index.js +2 -0
- package/avatar/index.d.ts +2 -22
- package/avatar/index.js +42 -41
- package/avatar/types.d.ts +21 -1
- package/avatar/types.js +1 -1
- package/avatar/utils.js +9 -4
- package/badge/global/index.d.ts +1 -0
- package/badge/global/index.js +2 -0
- package/badge/index.d.ts +3 -22
- package/badge/index.js +52 -51
- package/badge/types.d.ts +21 -1
- package/badge/types.js +1 -1
- package/badge/utils.js +4 -1
- package/bundle.d.ts +78 -0
- package/bundle.js +13069 -0
- package/bundle.ts +80 -0
- package/button/global/index.d.ts +1 -0
- package/button/global/index.js +2 -0
- package/button/index.d.ts +2 -22
- package/button/index.js +101 -111
- package/button/types.d.ts +21 -1
- package/button/types.js +1 -1
- package/button/utils.js +18 -2
- package/button-group/global/index.d.ts +1 -0
- package/button-group/global/index.js +2 -0
- package/button-group/index.d.ts +1 -22
- package/button-group/index.js +20 -18
- package/button-group/types.d.ts +22 -3
- package/button-group/types.js +1 -1
- package/button-group-item/global/index.d.ts +1 -0
- package/button-group-item/global/index.js +2 -0
- package/button-group-item/index.d.ts +2 -22
- package/button-group-item/index.js +31 -42
- package/button-group-item/types.d.ts +22 -3
- package/button-group-item/types.js +1 -1
- package/card-container/global/index.d.ts +1 -0
- package/card-container/global/index.js +2 -0
- package/card-container/index.d.ts +1 -21
- package/card-container/index.js +8 -5
- package/card-container/types.d.ts +21 -1
- package/card-container/types.js +1 -1
- package/card-v2/global/index.d.ts +1 -0
- package/card-v2/global/index.js +2 -0
- package/card-v2/index.d.ts +1 -22
- package/card-v2/index.js +59 -57
- package/card-v2/types.d.ts +21 -1
- package/card-v2/types.js +1 -1
- package/card-v2-title/global/index.d.ts +1 -0
- package/card-v2-title/global/index.js +2 -0
- package/card-v2-title/index.d.ts +2 -22
- package/card-v2-title/index.js +28 -26
- package/card-v2-title/types.d.ts +21 -1
- package/card-v2-title/types.js +1 -1
- package/checkbox/global/index.d.ts +1 -0
- package/checkbox/global/index.js +2 -0
- package/checkbox/index.d.ts +1 -22
- package/checkbox/index.js +90 -81
- package/checkbox/types.d.ts +21 -1
- package/checkbox/types.js +1 -1
- package/chip/colors.js +1 -1
- package/chip/global/index.d.ts +1 -0
- package/chip/global/index.js +2 -0
- package/chip/index.d.ts +1 -22
- package/chip/index.js +64 -75
- package/chip/types.d.ts +21 -1
- package/chip/types.js +1 -1
- package/chip/utils.js +7 -3
- package/code-tag/global/index.d.ts +1 -0
- package/code-tag/global/index.js +2 -0
- package/code-tag/index.d.ts +1 -22
- package/code-tag/index.js +17 -14
- package/code-tag/types.d.ts +21 -1
- package/code-tag/types.js +1 -1
- package/color-menu/global/index.d.ts +1 -0
- package/color-menu/global/index.js +2 -0
- package/color-menu/index.d.ts +2 -22
- package/color-menu/index.js +115 -115
- package/color-menu/types.d.ts +21 -1
- package/color-menu/types.js +1 -1
- package/color-menu/utils.js +6 -3
- package/color-menu-option/global/index.d.ts +1 -0
- package/color-menu-option/global/index.js +2 -0
- package/color-menu-option/index.d.ts +1 -22
- package/color-menu-option/index.js +30 -26
- package/color-menu-option/types.d.ts +21 -1
- package/color-menu-option/types.js +1 -1
- package/color-menu-option/utils.js +6 -3
- package/color-swatch/global/index.d.ts +1 -0
- package/color-swatch/global/index.js +2 -0
- package/color-swatch/index.d.ts +1 -22
- package/color-swatch/index.js +23 -20
- package/color-swatch/types.d.ts +21 -1
- package/color-swatch/types.js +1 -1
- package/color-swatch/utils.js +7 -3
- package/date-picker/global/index.d.ts +1 -0
- package/date-picker/global/index.js +2 -0
- package/date-picker/index.d.ts +2 -22
- package/date-picker/index.js +157 -150
- package/date-picker/types.d.ts +21 -1
- package/date-picker/types.js +1 -1
- package/date-picker/utils.js +59 -42
- package/dialog/global/index.d.ts +1 -0
- package/dialog/global/index.js +2 -0
- package/dialog/index.d.ts +1 -22
- package/dialog/index.js +71 -58
- package/dialog/types.d.ts +21 -1
- package/dialog/types.js +1 -1
- package/dialog/utils.js +11 -7
- package/emoji/global/index.d.ts +1 -0
- package/emoji/global/index.js +2 -0
- package/emoji/index.d.ts +1 -22
- package/emoji/index.js +19 -16
- package/emoji/types.d.ts +21 -1
- package/emoji/types.js +1 -1
- package/emoji/utils.js +22 -17
- package/emoji-picker/global/index.d.ts +1 -0
- package/emoji-picker/global/index.js +2 -0
- package/emoji-picker/index.d.ts +2 -22
- package/emoji-picker/index.js +138 -118
- package/emoji-picker/types.d.ts +21 -1
- package/emoji-picker/types.js +1 -1
- package/field/global/index.d.ts +1 -0
- package/field/global/index.js +2 -0
- package/field/index.d.ts +1 -22
- package/field/index.js +63 -60
- package/field/types.d.ts +21 -1
- package/field/types.js +1 -1
- package/file-drop/global/index.d.ts +1 -0
- package/file-drop/global/index.js +2 -0
- package/file-drop/index.d.ts +1 -22
- package/file-drop/index.js +103 -98
- package/file-drop/types.d.ts +21 -1
- package/file-drop/types.js +1 -1
- package/file-drop/utils.js +27 -22
- package/file-picker/global/index.d.ts +1 -0
- package/file-picker/global/index.js +2 -0
- package/file-picker/index.d.ts +1 -22
- package/file-picker/index.js +53 -48
- package/file-picker/types.d.ts +21 -1
- package/file-picker/types.js +1 -1
- package/file-picker/utils.js +6 -3
- package/file-status/global/index.d.ts +1 -0
- package/file-status/global/index.js +2 -0
- package/file-status/index.d.ts +2 -22
- package/file-status/index.js +33 -22
- package/file-status/types.d.ts +21 -1
- package/file-status/types.js +1 -1
- package/file-status/utils.js +4 -1
- package/flag/global/index.d.ts +1 -0
- package/flag/global/index.js +2 -0
- package/flag/index.d.ts +1 -22
- package/flag/index.js +19 -16
- package/flag/types.d.ts +21 -1
- package/flag/types.js +1 -1
- package/flag/utils.js +11 -8
- package/grid/global/index.d.ts +1 -0
- package/grid/global/index.js +2 -0
- package/grid/index.d.ts +1 -22
- package/grid/index.js +8 -5
- package/grid/types.d.ts +21 -1
- package/grid/types.js +1 -1
- package/grid-item/global/index.d.ts +1 -0
- package/grid-item/global/index.js +2 -0
- package/grid-item/index.d.ts +1 -22
- package/grid-item/index.js +17 -13
- package/grid-item/types.d.ts +21 -1
- package/grid-item/types.js +1 -1
- package/help-tooltip/global/index.d.ts +1 -0
- package/help-tooltip/global/index.js +2 -0
- package/help-tooltip/index.d.ts +1 -22
- package/help-tooltip/index.js +29 -26
- package/help-tooltip/types.d.ts +21 -1
- package/help-tooltip/types.js +1 -1
- package/icon/generated-icon-type.js +1 -1
- package/icon/global/index.d.ts +1 -0
- package/icon/global/index.js +2 -0
- package/icon/index.d.ts +1 -22
- package/icon/index.js +30 -28
- package/icon/types.d.ts +21 -1
- package/icon/types.js +1 -1
- package/inline-alert/global/index.d.ts +1 -0
- package/inline-alert/global/index.js +2 -0
- package/inline-alert/index.d.ts +2 -22
- package/inline-alert/index.js +58 -39
- package/inline-alert/types.d.ts +21 -1
- package/inline-alert/types.js +1 -1
- package/inline-alert/utils.js +4 -1
- package/input/global/index.d.ts +1 -0
- package/input/global/index.js +2 -0
- package/input/index.d.ts +2 -22
- package/input/index.js +295 -317
- package/input/types.d.ts +21 -1
- package/input/types.js +1 -1
- package/input/utils.js +56 -46
- package/link/global/index.d.ts +1 -0
- package/link/global/index.js +2 -0
- package/link/index.d.ts +1 -22
- package/link/index.js +88 -79
- package/link/types.d.ts +21 -1
- package/link/types.js +1 -1
- package/list/global/index.d.ts +1 -0
- package/list/global/index.js +2 -0
- package/list/index.d.ts +1 -21
- package/list/index.js +9 -6
- package/list/types.d.ts +21 -1
- package/list/types.js +1 -1
- package/list-item/global/index.d.ts +1 -0
- package/list-item/global/index.js +2 -0
- package/list-item/index.d.ts +1 -22
- package/list-item/index.js +9 -6
- package/list-item/types.d.ts +21 -1
- package/list-item/types.js +1 -1
- package/package.json +11 -5
- package/pagination/global/index.d.ts +1 -0
- package/pagination/global/index.js +2 -0
- package/pagination/index.d.ts +2 -22
- package/pagination/index.js +64 -46
- package/pagination/types.d.ts +21 -1
- package/pagination/types.js +1 -1
- package/persistent-overlay/global/index.d.ts +1 -0
- package/persistent-overlay/global/index.js +2 -0
- package/persistent-overlay/index.d.ts +1 -22
- package/persistent-overlay/index.js +42 -44
- package/persistent-overlay/types.d.ts +21 -1
- package/persistent-overlay/types.js +1 -1
- package/pop/global/index.d.ts +1 -0
- package/pop/global/index.js +2 -0
- package/pop/index.d.ts +3 -22
- package/pop/index.js +149 -150
- package/pop/types.d.ts +21 -1
- package/pop/types.js +1 -1
- package/pop/utils.js +24 -8
- package/popover/global/index.d.ts +1 -0
- package/popover/global/index.js +2 -0
- package/popover/index.d.ts +2 -22
- package/popover/index.js +104 -67
- package/popover/types.d.ts +21 -1
- package/popover/types.js +1 -1
- package/popover/utils.js +18 -7
- package/progress/global/index.d.ts +1 -0
- package/progress/global/index.js +2 -0
- package/progress/index.d.ts +1 -22
- package/progress/index.js +31 -33
- package/progress/types.d.ts +21 -1
- package/progress/types.js +1 -1
- package/progress-stepper/global/index.d.ts +1 -0
- package/progress-stepper/global/index.js +2 -0
- package/progress-stepper/index.d.ts +2 -22
- package/progress-stepper/index.js +64 -66
- package/progress-stepper/types.d.ts +21 -1
- package/progress-stepper/types.js +1 -1
- package/progress-stepper-item/global/index.d.ts +1 -0
- package/progress-stepper-item/global/index.js +2 -0
- package/progress-stepper-item/index.d.ts +1 -22
- package/progress-stepper-item/index.js +58 -50
- package/progress-stepper-item/types.d.ts +21 -1
- package/progress-stepper-item/types.js +1 -1
- package/progress-stepper-item/utils.js +22 -11
- package/radio/global/index.d.ts +1 -0
- package/radio/global/index.js +2 -0
- package/radio/index.d.ts +1 -22
- package/radio/index.js +79 -83
- package/radio/types.d.ts +21 -1
- package/radio/types.js +1 -1
- package/radio-option/global/index.d.ts +1 -0
- package/radio-option/global/index.js +2 -0
- package/radio-option/index.d.ts +1 -22
- package/radio-option/index.js +47 -41
- package/radio-option/types.d.ts +21 -1
- package/radio-option/types.js +1 -1
- package/rich-text/global/index.d.ts +1 -0
- package/rich-text/global/index.js +2 -0
- package/rich-text/index.d.ts +1 -22
- package/rich-text/index.js +45 -46
- package/rich-text/types.d.ts +21 -1
- package/rich-text/types.js +1 -1
- package/rich-text/utils.js +31 -33
- package/rich-textarea/global/index.d.ts +1 -0
- package/rich-textarea/global/index.js +2 -0
- package/rich-textarea/index.d.ts +1 -22
- package/rich-textarea/index.js +201 -194
- package/rich-textarea/types.d.ts +21 -1
- package/rich-textarea/types.js +1 -1
- package/rich-textarea/utils.js +313 -340
- package/segment-collapse/global/index.d.ts +1 -0
- package/segment-collapse/global/index.js +2 -0
- package/segment-collapse/index.d.ts +1 -22
- package/segment-collapse/index.js +31 -25
- package/segment-collapse/types.d.ts +21 -1
- package/segment-collapse/types.js +1 -1
- package/segmented-control/global/index.d.ts +1 -0
- package/segmented-control/global/index.js +2 -0
- package/segmented-control/index.d.ts +1 -22
- package/segmented-control/index.js +45 -45
- package/segmented-control/types.d.ts +21 -1
- package/segmented-control/types.js +1 -1
- package/segmented-control-option/global/index.d.ts +1 -0
- package/segmented-control-option/global/index.js +2 -0
- package/segmented-control-option/index.d.ts +1 -22
- package/segmented-control-option/index.js +44 -46
- package/segmented-control-option/types.d.ts +21 -1
- package/segmented-control-option/types.js +1 -1
- package/segmented-icon-control/global/index.d.ts +1 -0
- package/segmented-icon-control/global/index.js +2 -0
- package/segmented-icon-control/index.d.ts +1 -22
- package/segmented-icon-control/index.js +51 -50
- package/segmented-icon-control/types.d.ts +21 -1
- package/segmented-icon-control/types.js +1 -1
- package/segmented-icon-control-option/global/index.d.ts +1 -0
- package/segmented-icon-control-option/global/index.js +2 -0
- package/segmented-icon-control-option/index.d.ts +1 -22
- package/segmented-icon-control-option/index.js +36 -37
- package/segmented-icon-control-option/types.d.ts +21 -1
- package/segmented-icon-control-option/types.js +1 -1
- package/select-button/global/index.d.ts +1 -0
- package/select-button/global/index.js +2 -0
- package/select-button/index.d.ts +1 -26
- package/select-button/index.js +104 -112
- package/select-button/types.d.ts +25 -1
- package/select-button/types.js +1 -1
- package/select-menu/global/index.d.ts +1 -0
- package/select-menu/global/index.js +2 -0
- package/select-menu/index.d.ts +1 -22
- package/select-menu/index.js +201 -164
- package/select-menu/types.d.ts +21 -1
- package/select-menu/types.js +1 -1
- package/select-menu-option/global/index.d.ts +1 -0
- package/select-menu-option/global/index.js +2 -0
- package/select-menu-option/index.d.ts +1 -22
- package/select-menu-option/index.js +42 -33
- package/select-menu-option/types.d.ts +21 -1
- package/select-menu-option/types.js +1 -1
- package/select-menu-option/utils.js +4 -1
- package/skeleton/global/index.d.ts +1 -0
- package/skeleton/global/index.js +2 -0
- package/skeleton/index.d.ts +1 -22
- package/skeleton/index.js +35 -38
- package/skeleton/types.d.ts +21 -1
- package/skeleton/types.js +1 -1
- package/skeleton-item/global/index.d.ts +1 -0
- package/skeleton-item/global/index.js +2 -0
- package/skeleton-item/index.d.ts +1 -22
- package/skeleton-item/index.js +8 -5
- package/skeleton-item/types.d.ts +21 -1
- package/skeleton-item/types.js +1 -1
- package/spinner/global/index.d.ts +1 -0
- package/spinner/global/index.js +2 -0
- package/spinner/index.d.ts +1 -22
- package/spinner/index.js +31 -29
- package/spinner/types.d.ts +21 -1
- package/spinner/types.js +1 -1
- package/standalone.d.ts +0 -8
- package/standalone.js +79 -87
- package/standalone.ts +0 -8
- package/stop-events/index.js +12 -12
- package/table/global/index.d.ts +1 -0
- package/table/global/index.js +2 -0
- package/table/index.d.ts +1 -21
- package/table/index.js +9 -6
- package/table/types.d.ts +21 -1
- package/table/types.js +1 -1
- package/table-body/global/index.d.ts +1 -0
- package/table-body/global/index.js +2 -0
- package/table-body/index.d.ts +1 -21
- package/table-body/index.js +9 -6
- package/table-body/types.d.ts +21 -1
- package/table-body/types.js +1 -1
- package/table-cell/global/index.d.ts +1 -0
- package/table-cell/global/index.js +2 -0
- package/table-cell/index.d.ts +2 -22
- package/table-cell/index.js +13 -9
- package/table-cell/types.d.ts +21 -1
- package/table-cell/types.js +1 -1
- package/table-cell/utils.js +4 -1
- package/table-head/global/index.d.ts +1 -0
- package/table-head/global/index.js +2 -0
- package/table-head/index.d.ts +1 -21
- package/table-head/index.js +9 -6
- package/table-head/types.d.ts +21 -1
- package/table-head/types.js +1 -1
- package/table-head-cell/global/index.d.ts +1 -0
- package/table-head-cell/global/index.js +2 -0
- package/table-head-cell/index.d.ts +1 -22
- package/table-head-cell/index.js +29 -27
- package/table-head-cell/types.d.ts +21 -1
- package/table-head-cell/types.js +1 -1
- package/table-row/global/index.d.ts +1 -0
- package/table-row/global/index.js +2 -0
- package/table-row/index.d.ts +1 -22
- package/table-row/index.js +20 -17
- package/table-row/types.d.ts +21 -1
- package/table-row/types.js +1 -1
- package/tabs/global/index.d.ts +1 -0
- package/tabs/global/index.js +2 -0
- package/tabs/index.d.ts +2 -22
- package/tabs/index.js +32 -35
- package/tabs/types.d.ts +21 -1
- package/tabs/types.js +1 -1
- package/tabs-icon-option/global/index.d.ts +1 -0
- package/tabs-icon-option/global/index.js +2 -0
- package/tabs-icon-option/index.d.ts +1 -22
- package/tabs-icon-option/index.js +38 -40
- package/tabs-icon-option/types.d.ts +21 -1
- package/tabs-icon-option/types.js +1 -1
- package/tabs-option/global/index.d.ts +1 -0
- package/tabs-option/global/index.js +2 -0
- package/tabs-option/index.d.ts +1 -22
- package/tabs-option/index.js +41 -43
- package/tabs-option/types.d.ts +21 -1
- package/tabs-option/types.js +1 -1
- package/tag/colors.js +1 -1
- package/tag/global/index.d.ts +1 -0
- package/tag/global/index.js +2 -0
- package/tag/index.d.ts +1 -22
- package/tag/index.js +45 -44
- package/tag/types.d.ts +21 -1
- package/tag/types.js +1 -1
- package/tag/utils.js +7 -3
- package/text/global/index.d.ts +1 -0
- package/text/global/index.js +2 -0
- package/text/index.d.ts +2 -22
- package/text/index.js +33 -28
- package/text/types.d.ts +21 -1
- package/text/types.js +1 -1
- package/text/utils.js +4 -1
- package/textarea/global/index.d.ts +1 -0
- package/textarea/global/index.js +2 -0
- package/textarea/index.d.ts +1 -22
- package/textarea/index.js +147 -152
- package/textarea/types.d.ts +21 -1
- package/textarea/types.js +1 -1
- package/time-picker/global/index.d.ts +1 -0
- package/time-picker/global/index.js +2 -0
- package/time-picker/index.d.ts +2 -22
- package/time-picker/index.js +119 -123
- package/time-picker/types.d.ts +21 -1
- package/time-picker/types.js +1 -1
- package/time-picker/utils.js +31 -33
- package/title/global/index.d.ts +1 -0
- package/title/global/index.js +2 -0
- package/title/index.d.ts +2 -22
- package/title/index.js +32 -31
- package/title/types.d.ts +21 -1
- package/title/types.js +1 -1
- package/title/utils.js +18 -14
- package/toast/global/index.d.ts +1 -0
- package/toast/global/index.js +2 -0
- package/toast/index.d.ts +2 -22
- package/toast/index.js +37 -34
- package/toast/types.d.ts +21 -1
- package/toast/types.js +1 -1
- package/toast/utils.js +4 -1
- package/toast-manager/global/index.d.ts +1 -0
- package/toast-manager/global/index.js +2 -0
- package/toast-manager/index.d.ts +3 -22
- package/toast-manager/index.js +77 -63
- package/toast-manager/types.d.ts +21 -1
- package/toast-manager/types.js +1 -1
- package/toast-manager/utils.js +4 -1
- package/toggle/global/index.d.ts +1 -0
- package/toggle/global/index.js +2 -0
- package/toggle/index.d.ts +1 -22
- package/toggle/index.js +81 -75
- package/toggle/types.d.ts +21 -1
- package/toggle/types.js +1 -1
- package/tooltip/global/index.d.ts +1 -0
- package/tooltip/global/index.js +2 -0
- package/tooltip/index.d.ts +3 -22
- package/tooltip/index.js +105 -93
- package/tooltip/tooltip-state.js +56 -64
- package/tooltip/types.d.ts +21 -1
- package/tooltip/types.js +1 -1
- package/tooltip/utils.js +32 -13
- package/types.d.ts +12 -29
- package/utils/adapters.js +1 -1
- package/utils/component-names.d.ts +3 -0
- package/utils/component-names.js +85 -0
- package/utils/context.js +32 -42
- package/utils/countries.js +490 -2
- package/utils/csv.js +13 -6
- package/utils/debounce.js +10 -3
- package/utils/dom.js +60 -53
- package/utils/element.d.ts +107 -15
- package/utils/element.js +100 -19
- package/utils/event-target.js +11 -5
- package/utils/form.js +17 -12
- package/utils/get-react-event-handler.js +6 -3
- package/utils/global-components-constants.d.ts +3 -0
- package/utils/global-components-constants.js +8 -0
- package/utils/global-components-manager.d.ts +71 -0
- package/utils/global-components-manager.js +24 -0
- package/utils/index.js +65 -12
- package/utils/markdown.js +56 -43
- package/utils/rect.js +13 -18
- package/utils/shared/global-elements-manager.d.js +1 -0
- package/utils/shared/global-elements-manager.d.ts +62 -0
- package/utils/shared/global-elements-manager.js +163 -0
- package/utils/shared/global-elements-store.d.js +1 -0
- package/utils/shared/global-elements-store.d.ts +12 -0
- package/utils/shared/global-elements-store.js +31 -0
- package/utils/shared/index.d.js +11 -0
- package/utils/shared/index.d.ts +3 -0
- package/utils/shared/index.js +11 -0
- package/utils/shared/nectary-element-base.d.js +1 -0
- package/utils/shared/nectary-element-base.d.ts +9 -0
- package/utils/shared/nectary-element-base.js +25 -0
- package/utils/shared/package.json +9 -0
- package/utils/shared/tsconfig.json +20 -0
- package/utils/size.js +8 -3
- package/utils/slot.js +13 -9
- package/utils/throttle.js +5 -2
- package/utils/uid.js +5 -2
- package/card/index.d.ts +0 -40
- package/card/index.js +0 -134
- package/card/types.d.ts +0 -17
- package/card/types.js +0 -1
- package/horizontal-stepper/index.d.ts +0 -33
- package/horizontal-stepper/index.js +0 -62
- package/horizontal-stepper/types.d.ts +0 -42
- package/horizontal-stepper/types.js +0 -1
- package/horizontal-stepper-item/index.d.ts +0 -38
- package/horizontal-stepper-item/index.js +0 -62
- package/horizontal-stepper-item/types.d.ts +0 -38
- package/horizontal-stepper-item/types.js +0 -1
- package/horizontal-stepper-item/utils.d.ts +0 -2
- package/horizontal-stepper-item/utils.js +0 -1
- package/segment/index.d.ts +0 -40
- package/segment/index.js +0 -110
- package/segment/types.d.ts +0 -23
- package/segment/types.js +0 -1
- package/segment/utils.d.ts +0 -3
- package/segment/utils.js +0 -16
- package/tile-control/index.d.ts +0 -39
- package/tile-control/index.js +0 -111
- package/tile-control/types.d.ts +0 -29
- package/tile-control/types.js +0 -1
- package/tile-control-option/index.d.ts +0 -40
- package/tile-control-option/index.js +0 -99
- package/tile-control-option/types.d.ts +0 -52
- package/tile-control-option/types.js +0 -1
- package/vertical-stepper/index.d.ts +0 -33
- package/vertical-stepper/index.js +0 -58
- package/vertical-stepper/types.d.ts +0 -34
- package/vertical-stepper/types.js +0 -1
- package/vertical-stepper-item/index.d.ts +0 -38
- package/vertical-stepper-item/index.js +0 -62
- package/vertical-stepper-item/types.d.ts +0 -42
- package/vertical-stepper-item/types.js +0 -1
- package/vertical-stepper-item/utils.d.ts +0 -2
- package/vertical-stepper-item/utils.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TSinchDialogProps } from '../dialog/types';
|
|
2
|
-
import type { NectaryComponentReactByType, NectaryComponentVanillaByType } from '../types';
|
|
2
|
+
import type { NectaryComponentReactByType, NectaryComponentVanillaByType, NectaryComponentReact, NectaryComponentVanilla } from '../types';
|
|
3
3
|
export type TSinchPersistentOverlayProps = {
|
|
4
4
|
/** Controls whether the dialog should be open */
|
|
5
5
|
open: TSinchDialogProps['open'];
|
|
@@ -22,3 +22,23 @@ export type TSinchPersistentOverlay = {
|
|
|
22
22
|
};
|
|
23
23
|
export type TSinchPersistentOverlayElement = NectaryComponentVanillaByType<TSinchPersistentOverlay>;
|
|
24
24
|
export type TSinchPersistentOverlayReact = NectaryComponentReactByType<TSinchPersistentOverlay>;
|
|
25
|
+
declare global {
|
|
26
|
+
interface NectaryComponentMap {
|
|
27
|
+
'sinch-persistent-overlay': TSinchPersistentOverlay;
|
|
28
|
+
}
|
|
29
|
+
interface HTMLElementTagNameMap {
|
|
30
|
+
'sinch-persistent-overlay': NectaryComponentVanilla<'sinch-persistent-overlay'>;
|
|
31
|
+
}
|
|
32
|
+
namespace JSX {
|
|
33
|
+
interface IntrinsicElements {
|
|
34
|
+
'sinch-persistent-overlay': NectaryComponentReact<'sinch-persistent-overlay'>;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
declare module 'react' {
|
|
39
|
+
namespace JSX {
|
|
40
|
+
interface IntrinsicElements extends globalThis.JSX.IntrinsicElements {
|
|
41
|
+
'sinch-persistent-overlay': NectaryComponentReact<'sinch-persistent-overlay'>;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../types';
|
package/pop/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NectaryElement } from '../utils';
|
|
2
|
-
import type { TSinchPopOrientation
|
|
3
|
-
import type {
|
|
2
|
+
import type { TSinchPopOrientation } from './types';
|
|
3
|
+
import type { TRect } from '../types';
|
|
4
|
+
export * from './types';
|
|
4
5
|
export declare class Pop extends NectaryElement {
|
|
5
6
|
#private;
|
|
6
7
|
constructor();
|
|
@@ -19,23 +20,3 @@ export declare class Pop extends NectaryElement {
|
|
|
19
20
|
get popoverRect(): TRect;
|
|
20
21
|
attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null): void;
|
|
21
22
|
}
|
|
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,9 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { Context, subscribeContext } from "../utils/context.js";
|
|
2
|
+
import { getBooleanAttribute, updateBooleanAttribute, getLiteralAttribute, updateLiteralAttribute, updateIntegerAttribute, getIntegerAttribute, isAttrEqual, isAttrTrue } from "../utils/dom.js";
|
|
3
|
+
import { defineCustomElement, NectaryElement } from "../utils/element.js";
|
|
4
|
+
import { getRect } from "../utils/rect.js";
|
|
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");
|
|
5
12
|
template.innerHTML = templateHTML;
|
|
6
|
-
|
|
13
|
+
class Pop extends NectaryElement {
|
|
7
14
|
#$targetWrapper;
|
|
8
15
|
#$focus;
|
|
9
16
|
#$dialog;
|
|
@@ -23,16 +30,16 @@ export class Pop extends NectaryElement {
|
|
|
23
30
|
super();
|
|
24
31
|
const shadowRoot = this.attachShadow();
|
|
25
32
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
26
|
-
this.#$targetWrapper = shadowRoot.querySelector(
|
|
27
|
-
this.#$focus = shadowRoot.querySelector(
|
|
28
|
-
this.#$dialog = shadowRoot.querySelector(
|
|
33
|
+
this.#$targetWrapper = shadowRoot.querySelector("#target");
|
|
34
|
+
this.#$focus = shadowRoot.querySelector("#focus");
|
|
35
|
+
this.#$dialog = shadowRoot.querySelector("#dialog");
|
|
29
36
|
this.#$targetSlot = shadowRoot.querySelector('slot[name="target"]');
|
|
30
37
|
this.#$targetOpenSlot = shadowRoot.querySelector('slot[name="target-open"]');
|
|
31
38
|
this.#$contentSlot = shadowRoot.querySelector('slot[name="content"]');
|
|
32
|
-
this.#$targetOpenWrapper = shadowRoot.querySelector(
|
|
39
|
+
this.#$targetOpenWrapper = shadowRoot.querySelector("#target-open");
|
|
33
40
|
this.#resizeThrottle = throttleAnimationFrame(this.#updateOrientation);
|
|
34
|
-
this.#keydownContext = new Context(this.#$contentSlot,
|
|
35
|
-
this.#visibilityContext = new Context(this.#$contentSlot,
|
|
41
|
+
this.#keydownContext = new Context(this.#$contentSlot, "keydown");
|
|
42
|
+
this.#visibilityContext = new Context(this.#$contentSlot, "visibility");
|
|
36
43
|
this.#controller = new AbortController();
|
|
37
44
|
}
|
|
38
45
|
connectedCallback() {
|
|
@@ -40,23 +47,15 @@ export class Pop extends NectaryElement {
|
|
|
40
47
|
if (this.#controller === null) {
|
|
41
48
|
this.#controller = new AbortController();
|
|
42
49
|
}
|
|
43
|
-
const {
|
|
44
|
-
signal
|
|
45
|
-
} = this.#controller;
|
|
50
|
+
const { signal } = this.#controller;
|
|
46
51
|
this.#keydownContext.listen(signal);
|
|
47
52
|
this.#visibilityContext.listen(signal);
|
|
48
|
-
this.setAttribute(
|
|
49
|
-
this.#$dialog.addEventListener(
|
|
50
|
-
|
|
51
|
-
});
|
|
52
|
-
this
|
|
53
|
-
|
|
54
|
-
});
|
|
55
|
-
this.addEventListener('-close', this.#onCloseReactHandler, {
|
|
56
|
-
signal
|
|
57
|
-
});
|
|
58
|
-
subscribeContext(this, 'visibility', this.#onContextVisibility, signal);
|
|
59
|
-
if (getBooleanAttribute(this, 'open')) {
|
|
53
|
+
this.setAttribute("role", "dialog");
|
|
54
|
+
this.#$dialog.addEventListener("cancel", this.#onCancel, { signal });
|
|
55
|
+
this.#$dialog.addEventListener("mousedown", this.#onBackdropMouseDown, { signal });
|
|
56
|
+
this.addEventListener("-close", this.#onCloseReactHandler, { signal });
|
|
57
|
+
subscribeContext(this, "visibility", this.#onContextVisibility, signal);
|
|
58
|
+
if (getBooleanAttribute(this, "open")) {
|
|
60
59
|
this.#onExpand();
|
|
61
60
|
}
|
|
62
61
|
}
|
|
@@ -68,31 +67,34 @@ export class Pop extends NectaryElement {
|
|
|
68
67
|
this.#onCollapse();
|
|
69
68
|
}
|
|
70
69
|
static get observedAttributes() {
|
|
71
|
-
return [
|
|
70
|
+
return [
|
|
71
|
+
"orientation",
|
|
72
|
+
"open"
|
|
73
|
+
];
|
|
72
74
|
}
|
|
73
75
|
set modal(isModal) {
|
|
74
|
-
updateBooleanAttribute(this,
|
|
76
|
+
updateBooleanAttribute(this, "modal", isModal);
|
|
75
77
|
}
|
|
76
78
|
get modal() {
|
|
77
|
-
return getBooleanAttribute(this,
|
|
79
|
+
return getBooleanAttribute(this, "modal");
|
|
78
80
|
}
|
|
79
81
|
set open(isOpen) {
|
|
80
|
-
updateBooleanAttribute(this,
|
|
82
|
+
updateBooleanAttribute(this, "open", isOpen);
|
|
81
83
|
}
|
|
82
84
|
get open() {
|
|
83
|
-
return getBooleanAttribute(this,
|
|
85
|
+
return getBooleanAttribute(this, "open");
|
|
84
86
|
}
|
|
85
87
|
get orientation() {
|
|
86
|
-
return getLiteralAttribute(this, orientationValues,
|
|
88
|
+
return getLiteralAttribute(this, orientationValues, "orientation");
|
|
87
89
|
}
|
|
88
90
|
set orientation(value) {
|
|
89
|
-
updateLiteralAttribute(this, orientationValues,
|
|
91
|
+
updateLiteralAttribute(this, orientationValues, "orientation", value);
|
|
90
92
|
}
|
|
91
93
|
set inset(inset) {
|
|
92
|
-
updateIntegerAttribute(this,
|
|
94
|
+
updateIntegerAttribute(this, "inset", inset);
|
|
93
95
|
}
|
|
94
96
|
get inset() {
|
|
95
|
-
return getIntegerAttribute(this,
|
|
97
|
+
return getIntegerAttribute(this, "inset", 0);
|
|
96
98
|
}
|
|
97
99
|
get footprintRect() {
|
|
98
100
|
return this.#getTargetRect();
|
|
@@ -105,28 +107,26 @@ export class Pop extends NectaryElement {
|
|
|
105
107
|
return;
|
|
106
108
|
}
|
|
107
109
|
switch (name) {
|
|
108
|
-
case
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
this.#onCollapse();
|
|
119
|
-
}
|
|
120
|
-
updateBooleanAttribute(this, 'open', shouldOpen);
|
|
121
|
-
break;
|
|
110
|
+
case "open": {
|
|
111
|
+
const shouldOpen = isAttrTrue(newVal);
|
|
112
|
+
if (shouldOpen) {
|
|
113
|
+
requestAnimationFrame(() => {
|
|
114
|
+
if (this.isDomConnected && getBooleanAttribute(this, "open")) {
|
|
115
|
+
this.#onExpand();
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
} else {
|
|
119
|
+
this.#onCollapse();
|
|
122
120
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
121
|
+
updateBooleanAttribute(this, "open", shouldOpen);
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
case "orientation": {
|
|
125
|
+
if (this.#$dialog.open) {
|
|
126
|
+
this.#updateOrientation();
|
|
129
127
|
}
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
#getTargetRect() {
|
|
@@ -137,7 +137,7 @@ export 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 @@ export 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,43 +175,41 @@ export 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
|
-
|
|
210
|
-
});
|
|
211
|
-
window.addEventListener('resize', this.#onResize);
|
|
208
|
+
window.addEventListener("scroll", this.#updatePosition, { passive: false });
|
|
209
|
+
window.addEventListener("resize", this.#onResize);
|
|
212
210
|
requestAnimationFrame(() => {
|
|
213
211
|
if (this.isDomConnected && this.#$dialog.open) {
|
|
214
|
-
this.#$contentSlot.addEventListener(
|
|
212
|
+
this.#$contentSlot.addEventListener("slotchange", this.#onContentSlotChange);
|
|
215
213
|
}
|
|
216
214
|
});
|
|
217
215
|
this.#dispatchContentVisibility(true);
|
|
@@ -222,45 +220,41 @@ export class Pop extends NectaryElement {
|
|
|
222
220
|
}
|
|
223
221
|
const isNonModal = !this.modal;
|
|
224
222
|
this.#dispatchContentVisibility(false);
|
|
225
|
-
this.#$targetOpenSlot.removeEventListener(
|
|
223
|
+
this.#$targetOpenSlot.removeEventListener("keydown", this.#onTargetKeydown);
|
|
226
224
|
if (isNonModal) {
|
|
227
|
-
this.#$targetOpenSlot.addEventListener(
|
|
225
|
+
this.#$targetOpenSlot.addEventListener("blur", this.#captureActiveElement, true);
|
|
228
226
|
}
|
|
229
227
|
this.#$dialog.close();
|
|
230
|
-
this.#$targetWrapper.setAttribute(
|
|
228
|
+
this.#$targetWrapper.setAttribute("aria-expanded", "false");
|
|
231
229
|
if (isNonModal) {
|
|
232
|
-
this.#$targetOpenSlot.removeEventListener(
|
|
230
|
+
this.#$targetOpenSlot.removeEventListener("blur", this.#captureActiveElement, true);
|
|
233
231
|
}
|
|
234
232
|
if (isNonModal) {
|
|
235
233
|
const targetEl = this.#getFirstTargetElement(this.#$targetOpenSlot);
|
|
236
|
-
targetEl.style.removeProperty(
|
|
237
|
-
targetEl.style.removeProperty(
|
|
238
|
-
targetEl.style.removeProperty(
|
|
234
|
+
targetEl.style.removeProperty("margin");
|
|
235
|
+
targetEl.style.removeProperty("position");
|
|
236
|
+
targetEl.style.removeProperty("transform");
|
|
239
237
|
if (this.#targetStyleValue !== null) {
|
|
240
|
-
targetEl.setAttribute(
|
|
238
|
+
targetEl.setAttribute("style", this.#targetStyleValue);
|
|
241
239
|
this.#targetStyleValue = null;
|
|
242
240
|
}
|
|
243
|
-
getFirstSlotElement(this.#$targetOpenSlot)?.setAttribute(
|
|
244
|
-
this.#$targetWrapper.style.removeProperty(
|
|
245
|
-
this.#$targetWrapper.style.removeProperty(
|
|
246
|
-
this.#$targetWrapper.style.removeProperty(
|
|
241
|
+
getFirstSlotElement(this.#$targetOpenSlot)?.setAttribute("slot", "target");
|
|
242
|
+
this.#$targetWrapper.style.removeProperty("display");
|
|
243
|
+
this.#$targetWrapper.style.removeProperty("width");
|
|
244
|
+
this.#$targetWrapper.style.removeProperty("height");
|
|
247
245
|
}
|
|
248
246
|
if (this.#targetActiveElement !== null) {
|
|
249
247
|
if (!isElementFocused(this.#targetActiveElement)) {
|
|
250
|
-
this.#$targetSlot.addEventListener(
|
|
251
|
-
this.#targetActiveElement.focus({
|
|
252
|
-
|
|
253
|
-
});
|
|
254
|
-
this.#$targetSlot.removeEventListener('focus', this.#stopEventPropagation, true);
|
|
248
|
+
this.#$targetSlot.addEventListener("focus", this.#stopEventPropagation, true);
|
|
249
|
+
this.#targetActiveElement.focus({ preventScroll: true });
|
|
250
|
+
this.#$targetSlot.removeEventListener("focus", this.#stopEventPropagation, true);
|
|
255
251
|
if (!isElementFocused(this.#targetActiveElement)) {
|
|
256
252
|
const $targetEl = this.#targetActiveElement;
|
|
257
253
|
requestAnimationFrame(() => {
|
|
258
254
|
if (this.isDomConnected && !this.#$dialog.open) {
|
|
259
|
-
this.#$targetSlot.addEventListener(
|
|
260
|
-
$targetEl.focus({
|
|
261
|
-
|
|
262
|
-
});
|
|
263
|
-
this.#$targetSlot.removeEventListener('focus', this.#stopEventPropagation, true);
|
|
255
|
+
this.#$targetSlot.addEventListener("focus", this.#stopEventPropagation, true);
|
|
256
|
+
$targetEl.focus({ preventScroll: true });
|
|
257
|
+
this.#$targetSlot.removeEventListener("focus", this.#stopEventPropagation, true);
|
|
264
258
|
}
|
|
265
259
|
});
|
|
266
260
|
}
|
|
@@ -269,9 +263,9 @@ export class Pop extends NectaryElement {
|
|
|
269
263
|
}
|
|
270
264
|
enableOverscroll();
|
|
271
265
|
this.#resizeThrottle.cancel();
|
|
272
|
-
window.removeEventListener(
|
|
273
|
-
window.removeEventListener(
|
|
274
|
-
this.#$contentSlot.removeEventListener(
|
|
266
|
+
window.removeEventListener("resize", this.#onResize);
|
|
267
|
+
window.removeEventListener("scroll", this.#updatePosition);
|
|
268
|
+
this.#$contentSlot.removeEventListener("slotchange", this.#onContentSlotChange);
|
|
275
269
|
}
|
|
276
270
|
#onResize = () => {
|
|
277
271
|
this.#resizeThrottle.fn();
|
|
@@ -284,47 +278,47 @@ export class Pop extends NectaryElement {
|
|
|
284
278
|
const inset = this.inset;
|
|
285
279
|
let xPos = 0;
|
|
286
280
|
let yPos = 0;
|
|
287
|
-
if (orient ===
|
|
281
|
+
if (orient === "bottom-right" || orient === "top-right" || orient === "top-stretch" || orient === "bottom-stretch") {
|
|
288
282
|
xPos = targetRect.x;
|
|
289
283
|
}
|
|
290
|
-
if (orient ===
|
|
284
|
+
if (orient === "bottom-left" || orient === "top-left") {
|
|
291
285
|
xPos = targetRect.x + targetRect.width - modalWidth;
|
|
292
286
|
}
|
|
293
|
-
if (orient ===
|
|
287
|
+
if (orient === "bottom-center" || orient === "top-center") {
|
|
294
288
|
xPos = targetRect.x + targetRect.width / 2 - modalWidth / 2;
|
|
295
289
|
}
|
|
296
|
-
if (orient ===
|
|
290
|
+
if (orient === "center-right") {
|
|
297
291
|
xPos = targetRect.x + targetRect.width;
|
|
298
292
|
}
|
|
299
|
-
if (orient ===
|
|
293
|
+
if (orient === "center-left") {
|
|
300
294
|
xPos = targetRect.x - modalWidth;
|
|
301
295
|
}
|
|
302
|
-
if (orient ===
|
|
296
|
+
if (orient === "bottom-left" || orient === "bottom-right" || orient === "bottom-stretch" || orient === "bottom-center") {
|
|
303
297
|
yPos = targetRect.y + targetRect.height;
|
|
304
298
|
}
|
|
305
|
-
if (orient ===
|
|
299
|
+
if (orient === "top-left" || orient === "top-right" || orient === "top-stretch" || orient === "top-center") {
|
|
306
300
|
yPos = targetRect.y - modalHeight;
|
|
307
301
|
}
|
|
308
|
-
if (orient ===
|
|
302
|
+
if (orient === "center-left" || orient === "center-right") {
|
|
309
303
|
yPos = targetRect.y + targetRect.height / 2 - modalHeight / 2;
|
|
310
304
|
}
|
|
311
305
|
const clampedXPos = Math.max(inset, Math.min(xPos, window.innerWidth - modalWidth - inset));
|
|
312
306
|
const clampedYPos = Math.max(inset, Math.min(yPos, window.innerHeight - modalHeight - inset));
|
|
313
|
-
this.#$dialog.style.setProperty(
|
|
314
|
-
this.#$dialog.style.setProperty(
|
|
307
|
+
this.#$dialog.style.setProperty("left", `${clampedXPos}px`);
|
|
308
|
+
this.#$dialog.style.setProperty("top", `${clampedYPos}px`);
|
|
315
309
|
if (!this.modal) {
|
|
316
310
|
const targetLeftPos = targetRect.x - clampedXPos;
|
|
317
311
|
const targetTopPos = targetRect.y - clampedYPos;
|
|
318
|
-
this.#$targetOpenWrapper.style.setProperty(
|
|
319
|
-
this.#$targetOpenWrapper.style.setProperty(
|
|
312
|
+
this.#$targetOpenWrapper.style.setProperty("left", `${targetLeftPos}px`);
|
|
313
|
+
this.#$targetOpenWrapper.style.setProperty("top", `${targetTopPos}px`);
|
|
320
314
|
}
|
|
321
315
|
};
|
|
322
316
|
#updateOrientation = () => {
|
|
323
|
-
this.#$dialog.style.setProperty(
|
|
317
|
+
this.#$dialog.style.setProperty("width", "max-content");
|
|
324
318
|
const targetRect = this.#getTargetRect();
|
|
325
319
|
const modalRect = this.#$dialog.getBoundingClientRect();
|
|
326
320
|
const orient = this.orientation;
|
|
327
|
-
const shouldSetWidthToTarget = orient ===
|
|
321
|
+
const shouldSetWidthToTarget = orient === "top-stretch" || orient === "bottom-stretch";
|
|
328
322
|
const modalHeight = modalRect.height;
|
|
329
323
|
const modalWidth = shouldSetWidthToTarget ? targetRect.width : modalRect.width;
|
|
330
324
|
const inset = this.inset;
|
|
@@ -332,43 +326,43 @@ export class Pop extends NectaryElement {
|
|
|
332
326
|
let yPos = 0;
|
|
333
327
|
this.#modalHeight = modalHeight;
|
|
334
328
|
this.#modalWidth = modalWidth;
|
|
335
|
-
if (orient ===
|
|
329
|
+
if (orient === "bottom-right" || orient === "top-right" || orient === "top-stretch" || orient === "bottom-stretch") {
|
|
336
330
|
xPos = targetRect.x;
|
|
337
331
|
}
|
|
338
|
-
if (orient ===
|
|
332
|
+
if (orient === "bottom-left" || orient === "top-left") {
|
|
339
333
|
xPos = targetRect.x + targetRect.width - modalWidth;
|
|
340
334
|
}
|
|
341
|
-
if (orient ===
|
|
335
|
+
if (orient === "bottom-center" || orient === "top-center") {
|
|
342
336
|
xPos = targetRect.x + targetRect.width / 2 - modalWidth / 2;
|
|
343
337
|
}
|
|
344
|
-
if (orient ===
|
|
338
|
+
if (orient === "center-right") {
|
|
345
339
|
xPos = targetRect.x + targetRect.width;
|
|
346
340
|
}
|
|
347
|
-
if (orient ===
|
|
341
|
+
if (orient === "center-left") {
|
|
348
342
|
xPos = targetRect.x - modalWidth;
|
|
349
343
|
}
|
|
350
|
-
if (orient ===
|
|
344
|
+
if (orient === "bottom-left" || orient === "bottom-right" || orient === "bottom-stretch" || orient === "bottom-center") {
|
|
351
345
|
yPos = targetRect.y + targetRect.height;
|
|
352
346
|
}
|
|
353
|
-
if (orient ===
|
|
347
|
+
if (orient === "top-left" || orient === "top-right" || orient === "top-stretch" || orient === "top-center") {
|
|
354
348
|
yPos = targetRect.y - modalHeight;
|
|
355
349
|
}
|
|
356
|
-
if (orient ===
|
|
350
|
+
if (orient === "center-left" || orient === "center-right") {
|
|
357
351
|
yPos = targetRect.y + targetRect.height / 2 - modalHeight / 2;
|
|
358
352
|
}
|
|
359
353
|
xPos = Math.round(Math.max(inset, Math.min(xPos, window.innerWidth - modalWidth - inset)));
|
|
360
354
|
yPos = Math.round(Math.max(inset, Math.min(yPos, window.innerHeight - modalHeight - inset)));
|
|
361
|
-
this.#$dialog.style.setProperty(
|
|
362
|
-
this.#$dialog.style.setProperty(
|
|
363
|
-
this.#$dialog.style.setProperty(
|
|
355
|
+
this.#$dialog.style.setProperty("left", `${xPos}px`);
|
|
356
|
+
this.#$dialog.style.setProperty("top", `${yPos}px`);
|
|
357
|
+
this.#$dialog.style.setProperty("width", `${modalWidth}px`);
|
|
364
358
|
if (!this.modal) {
|
|
365
359
|
const targetLeftPos = targetRect.x - xPos;
|
|
366
360
|
const targetTopPos = targetRect.y - yPos;
|
|
367
|
-
this.#$targetOpenWrapper.style.setProperty(
|
|
368
|
-
this.#$targetOpenWrapper.style.setProperty(
|
|
361
|
+
this.#$targetOpenWrapper.style.setProperty("left", `${targetLeftPos}px`);
|
|
362
|
+
this.#$targetOpenWrapper.style.setProperty("top", `${targetTopPos}px`);
|
|
369
363
|
}
|
|
370
364
|
};
|
|
371
|
-
#onBackdropMouseDown = e => {
|
|
365
|
+
#onBackdropMouseDown = (e) => {
|
|
372
366
|
if (isTargetEqual(e, this.#$dialog)) {
|
|
373
367
|
const rect = this.popoverRect;
|
|
374
368
|
const isInside = e.x >= rect.x && e.x < rect.x + rect.width && e.y >= rect.y && e.y < rect.y + rect.height;
|
|
@@ -378,32 +372,34 @@ export class Pop extends NectaryElement {
|
|
|
378
372
|
}
|
|
379
373
|
}
|
|
380
374
|
};
|
|
381
|
-
#onCancel = e => {
|
|
375
|
+
#onCancel = (e) => {
|
|
382
376
|
e.preventDefault();
|
|
383
377
|
e.stopPropagation();
|
|
384
378
|
this.#dispatchCloseEvent();
|
|
385
379
|
};
|
|
386
|
-
#onCloseReactHandler = e => {
|
|
387
|
-
getReactEventHandler(this,
|
|
380
|
+
#onCloseReactHandler = (e) => {
|
|
381
|
+
getReactEventHandler(this, "on-close")?.(e);
|
|
388
382
|
};
|
|
389
383
|
#dispatchCloseEvent() {
|
|
390
|
-
this.dispatchEvent(
|
|
384
|
+
this.dispatchEvent(
|
|
385
|
+
new CustomEvent("-close")
|
|
386
|
+
);
|
|
391
387
|
}
|
|
392
|
-
#captureRelatedActiveElement = e => {
|
|
388
|
+
#captureRelatedActiveElement = (e) => {
|
|
393
389
|
e.stopPropagation();
|
|
394
390
|
this.#targetActiveElement = e.relatedTarget;
|
|
395
391
|
};
|
|
396
|
-
#captureActiveElement = e => {
|
|
392
|
+
#captureActiveElement = (e) => {
|
|
397
393
|
e.stopPropagation();
|
|
398
394
|
this.#targetActiveElement = e.target;
|
|
399
395
|
};
|
|
400
|
-
#stopEventPropagation = e => {
|
|
396
|
+
#stopEventPropagation = (e) => {
|
|
401
397
|
e.stopPropagation();
|
|
402
398
|
};
|
|
403
399
|
#dispatchContentVisibility(isVisible) {
|
|
404
400
|
this.#visibilityContext.dispatch(isVisible);
|
|
405
401
|
}
|
|
406
|
-
#onTargetKeydown = e => {
|
|
402
|
+
#onTargetKeydown = (e) => {
|
|
407
403
|
this.#keydownContext.dispatch({
|
|
408
404
|
code: e.code,
|
|
409
405
|
preventDefault: () => {
|
|
@@ -411,16 +407,19 @@ export class Pop extends NectaryElement {
|
|
|
411
407
|
}
|
|
412
408
|
});
|
|
413
409
|
};
|
|
414
|
-
#onContextVisibility = e => {
|
|
410
|
+
#onContextVisibility = (e) => {
|
|
415
411
|
if (!e.detail) {
|
|
416
412
|
this.#dispatchCloseEvent();
|
|
417
413
|
}
|
|
418
414
|
};
|
|
419
|
-
#onContentSlotChange = e => {
|
|
415
|
+
#onContentSlotChange = (e) => {
|
|
420
416
|
e.stopPropagation();
|
|
421
417
|
if (this.#$dialog.open) {
|
|
422
418
|
this.#updateOrientation();
|
|
423
419
|
}
|
|
424
420
|
};
|
|
425
421
|
}
|
|
426
|
-
defineCustomElement(
|
|
422
|
+
defineCustomElement("sinch-pop", Pop);
|
|
423
|
+
export {
|
|
424
|
+
Pop
|
|
425
|
+
};
|
package/pop/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NectaryComponentReactByType, NectaryComponentVanillaByType, TRect } from '../types';
|
|
1
|
+
import type { NectaryComponentReactByType, NectaryComponentVanillaByType, TRect, NectaryComponentReact, NectaryComponentVanilla } from '../types';
|
|
2
2
|
export type 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,3 +23,23 @@ 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
|
+
|