@nectary/components 2.8.7 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/types.d.ts +1 -1
- package/accordion/index.d.ts +0 -11
- package/accordion/index.js +0 -86
- package/accordion/types.d.ts +0 -21
- package/accordion/types.js +0 -1
- package/accordion-item/index.d.ts +0 -14
- package/accordion-item/index.js +0 -95
- package/accordion-item/types.d.ts +0 -36
- package/accordion-item/types.js +0 -1
- package/accordion-item/utils.d.ts +0 -2
- package/accordion-item/utils.js +0 -1
- package/action-menu/index.d.ts +0 -11
- package/action-menu/index.js +0 -195
- package/action-menu/types.d.ts +0 -13
- package/action-menu/types.js +0 -1
- package/action-menu-option/index.d.ts +0 -12
- package/action-menu-option/index.js +0 -82
- package/action-menu-option/types.d.ts +0 -23
- package/action-menu-option/types.js +0 -1
- package/action-menu-option/utils.d.ts +0 -2
- package/action-menu-option/utils.js +0 -3
- package/alert/index.d.ts +0 -14
- package/alert/index.js +0 -48
- package/alert/types.d.ts +0 -18
- package/alert/types.js +0 -1
- package/alert/utils.d.ts +0 -2
- package/alert/utils.js +0 -1
- package/avatar/index.d.ts +0 -11
- package/avatar/index.js +0 -94
- package/avatar/types.d.ts +0 -37
- package/avatar/types.js +0 -1
- package/avatar/utils.d.ts +0 -4
- package/avatar/utils.js +0 -7
- package/badge/index.d.ts +0 -11
- package/badge/index.js +0 -114
- package/badge/types.d.ts +0 -34
- package/badge/types.js +0 -1
- package/badge/utils.d.ts +0 -2
- package/badge/utils.js +0 -1
- package/button/index.d.ts +0 -11
- package/button/index.js +0 -182
- package/button/types.d.ts +0 -53
- package/button/types.js +0 -1
- package/button/utils.d.ts +0 -2
- package/button/utils.js +0 -1
- package/card/index.d.ts +0 -13
- package/card/index.js +0 -133
- package/card/types.d.ts +0 -28
- package/card/types.js +0 -1
- package/card-container/index.d.ts +0 -11
- package/card-container/index.js +0 -11
- package/card-container/types.d.ts +0 -3
- package/card-container/types.js +0 -1
- package/chat/index.d.ts +0 -11
- package/chat/index.js +0 -11
- package/chat/types.d.ts +0 -3
- package/chat/types.js +0 -1
- package/chat-block/index.d.ts +0 -11
- package/chat-block/index.js +0 -86
- package/chat-block/types.d.ts +0 -30
- package/chat-block/types.js +0 -1
- package/chat-bubble/index.d.ts +0 -11
- package/chat-bubble/index.js +0 -41
- package/chat-bubble/types.d.ts +0 -20
- package/chat-bubble/types.js +0 -1
- package/chat-bubble/utils.d.ts +0 -3
- package/chat-bubble/utils.js +0 -2
- package/checkbox/index.d.ts +0 -11
- package/checkbox/index.js +0 -126
- package/checkbox/types.d.ts +0 -49
- package/checkbox/types.js +0 -1
- package/chip/index.d.ts +0 -13
- package/chip/index.js +0 -144
- package/chip/types.d.ts +0 -37
- package/chip/types.js +0 -1
- package/chip/utils.d.ts +0 -2
- package/chip/utils.js +0 -6
- package/code-tag/index.d.ts +0 -11
- package/code-tag/index.js +0 -31
- package/code-tag/types.d.ts +0 -11
- package/code-tag/types.js +0 -1
- package/color-menu/index.d.ts +0 -11
- package/color-menu/index.js +0 -308
- package/color-menu/types.d.ts +0 -32
- package/color-menu/types.js +0 -1
- package/color-menu/utils.d.ts +0 -1
- package/color-menu/utils.js +0 -11
- package/color-menu-option/index.d.ts +0 -13
- package/color-menu-option/index.js +0 -48
- package/color-menu-option/types.d.ts +0 -11
- package/color-menu-option/types.js +0 -1
- package/color-menu-option/utils.d.ts +0 -1
- package/color-menu-option/utils.js +0 -11
- package/color-swatch/index.d.ts +0 -12
- package/color-swatch/index.js +0 -54
- package/color-swatch/types.d.ts +0 -11
- package/color-swatch/types.js +0 -1
- package/color-swatch/utils.d.ts +0 -2
- package/color-swatch/utils.js +0 -6
- package/date-picker/index.d.ts +0 -14
- package/date-picker/index.js +0 -381
- package/date-picker/types.d.ts +0 -70
- package/date-picker/types.js +0 -1
- package/date-picker/utils.d.ts +0 -28
- package/date-picker/utils.js +0 -142
- package/dialog/index.d.ts +0 -15
- package/dialog/index.js +0 -144
- package/dialog/types.d.ts +0 -28
- package/dialog/types.js +0 -1
- package/dialog/utils.d.ts +0 -2
- package/dialog/utils.js +0 -18
- package/emoji/index.d.ts +0 -11
- package/emoji/index.js +0 -46
- package/emoji/types.d.ts +0 -11
- package/emoji/types.js +0 -1
- package/emoji/utils.d.ts +0 -3
- package/emoji/utils.js +0 -47
- package/emoji-picker/index.d.ts +0 -22
- package/emoji-picker/index.js +0 -308
- package/emoji-picker/types.d.ts +0 -26
- package/emoji-picker/types.js +0 -1
- package/field/index.d.ts +0 -11
- package/field/index.js +0 -120
- package/field/types.d.ts +0 -35
- package/field/types.js +0 -1
- package/file-drop/index.d.ts +0 -13
- package/file-drop/index.js +0 -205
- package/file-drop/types.d.ts +0 -50
- package/file-drop/types.js +0 -1
- package/file-drop/utils.d.ts +0 -2
- package/file-drop/utils.js +0 -31
- package/file-picker/index.d.ts +0 -11
- package/file-picker/index.js +0 -103
- package/file-picker/types.d.ts +0 -32
- package/file-picker/types.js +0 -1
- package/file-picker/utils.d.ts +0 -1
- package/file-picker/utils.js +0 -8
- package/file-status/index.d.ts +0 -14
- package/file-status/index.js +0 -61
- package/file-status/types.d.ts +0 -18
- package/file-status/types.js +0 -1
- package/file-status/utils.d.ts +0 -2
- package/file-status/utils.js +0 -1
- package/flag/index.d.ts +0 -11
- package/flag/index.js +0 -46
- package/flag/types.d.ts +0 -11
- package/flag/types.js +0 -1
- package/flag/utils.d.ts +0 -1
- package/flag/utils.js +0 -17
- package/grid/index.d.ts +0 -11
- package/grid/index.js +0 -11
- package/grid/types.d.ts +0 -3
- package/grid/types.js +0 -1
- package/grid-item/index.d.ts +0 -11
- package/grid-item/index.js +0 -35
- package/grid-item/types.d.ts +0 -17
- package/grid-item/types.js +0 -1
- package/help-tooltip/index.d.ts +0 -13
- package/help-tooltip/index.js +0 -74
- package/help-tooltip/types.d.ts +0 -3
- package/help-tooltip/types.js +0 -1
- package/horizontal-stepper/index.d.ts +0 -11
- package/horizontal-stepper/index.js +0 -61
- package/horizontal-stepper/types.d.ts +0 -13
- package/horizontal-stepper/types.js +0 -1
- package/horizontal-stepper-item/index.d.ts +0 -14
- package/horizontal-stepper-item/index.js +0 -61
- package/horizontal-stepper-item/types.d.ts +0 -24
- 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/icon/index.d.ts +0 -11
- package/icon/index.js +0 -32
- package/icon/types.d.ts +0 -11
- package/icon/types.js +0 -1
- package/icon-button/index.d.ts +0 -12
- package/icon-button/index.js +0 -175
- package/icon-button/types.d.ts +0 -44
- package/icon-button/types.js +0 -1
- package/icon-button/utils.d.ts +0 -2
- package/icon-button/utils.js +0 -1
- package/inline-alert/index.d.ts +0 -15
- package/inline-alert/index.js +0 -83
- package/inline-alert/types.d.ts +0 -15
- package/inline-alert/types.js +0 -1
- package/inline-alert/utils.d.ts +0 -2
- package/inline-alert/utils.js +0 -1
- package/input/index.d.ts +0 -11
- package/input/index.js +0 -637
- package/input/types.d.ts +0 -86
- package/input/types.js +0 -1
- package/input/utils.d.ts +0 -26
- package/input/utils.js +0 -302
- package/link/index.d.ts +0 -12
- package/link/index.js +0 -150
- package/link/types.d.ts +0 -59
- package/link/types.js +0 -1
- package/list/index.d.ts +0 -11
- package/list/index.js +0 -14
- package/list/types.d.ts +0 -3
- package/list/types.js +0 -1
- package/list-item/index.d.ts +0 -11
- package/list-item/index.js +0 -14
- package/list-item/types.d.ts +0 -3
- package/list-item/types.js +0 -1
- package/pagination/index.d.ts +0 -12
- package/pagination/index.js +0 -147
- package/pagination/types.d.ts +0 -16
- package/pagination/types.js +0 -1
- package/pop/index.d.ts +0 -11
- package/pop/index.js +0 -425
- package/pop/types.d.ts +0 -35
- package/pop/types.js +0 -1
- package/pop/utils.d.ts +0 -4
- package/pop/utils.js +0 -16
- package/popover/index.d.ts +0 -12
- package/popover/index.js +0 -146
- package/popover/types.d.ts +0 -40
- package/popover/types.js +0 -1
- package/popover/utils.d.ts +0 -4
- package/popover/utils.js +0 -10
- package/progress/index.d.ts +0 -12
- package/progress/index.js +0 -58
- package/progress/types.d.ts +0 -12
- package/progress/types.js +0 -1
- package/progress-stepper/index.d.ts +0 -11
- package/progress-stepper/index.js +0 -206
- package/progress-stepper/types.d.ts +0 -22
- package/progress-stepper/types.js +0 -1
- package/progress-stepper-item/index.d.ts +0 -12
- package/progress-stepper-item/index.js +0 -82
- package/progress-stepper-item/types.d.ts +0 -23
- package/progress-stepper-item/types.js +0 -1
- package/progress-stepper-item/utils.d.ts +0 -11
- package/progress-stepper-item/utils.js +0 -13
- package/radio/index.d.ts +0 -11
- package/radio/index.js +0 -154
- package/radio/types.d.ts +0 -14
- package/radio/types.js +0 -1
- package/radio-option/index.d.ts +0 -11
- package/radio-option/index.js +0 -79
- package/radio-option/types.d.ts +0 -18
- package/radio-option/types.js +0 -1
- package/rich-text/index.d.ts +0 -14
- package/rich-text/index.js +0 -75
- package/rich-text/types.d.ts +0 -12
- package/rich-text/types.js +0 -1
- package/rich-text/utils.d.ts +0 -7
- package/rich-text/utils.js +0 -107
- package/rich-textarea/index.d.ts +0 -11
- package/rich-textarea/index.js +0 -464
- package/rich-textarea/types.d.ts +0 -48
- package/rich-textarea/types.js +0 -1
- package/rich-textarea/utils.d.ts +0 -39
- package/rich-textarea/utils.js +0 -1730
- package/segment/index.d.ts +0 -12
- package/segment/index.js +0 -109
- package/segment/types.d.ts +0 -16
- package/segment/types.js +0 -1
- package/segment/utils.d.ts +0 -3
- package/segment/utils.js +0 -16
- package/segment-collapse/index.d.ts +0 -13
- package/segment-collapse/index.js +0 -60
- package/segment-collapse/types.d.ts +0 -11
- package/segment-collapse/types.js +0 -1
- package/segmented-control/index.d.ts +0 -11
- package/segmented-control/index.js +0 -85
- package/segmented-control/types.d.ts +0 -11
- package/segmented-control/types.js +0 -1
- package/segmented-control-option/index.d.ts +0 -11
- package/segmented-control-option/index.js +0 -95
- package/segmented-control-option/types.d.ts +0 -19
- package/segmented-control-option/types.js +0 -1
- package/segmented-icon-control/index.d.ts +0 -11
- package/segmented-icon-control/index.js +0 -101
- package/segmented-icon-control/types.d.ts +0 -14
- package/segmented-icon-control/types.js +0 -1
- package/segmented-icon-control-option/index.d.ts +0 -11
- package/segmented-icon-control-option/index.js +0 -82
- package/segmented-icon-control-option/types.d.ts +0 -16
- package/segmented-icon-control-option/types.js +0 -1
- package/select-button/index.d.ts +0 -13
- package/select-button/index.js +0 -202
- package/select-button/types.d.ts +0 -50
- package/select-button/types.js +0 -1
- package/select-menu/index.d.ts +0 -15
- package/select-menu/index.js +0 -332
- package/select-menu/types.d.ts +0 -41
- package/select-menu/types.js +0 -1
- package/select-menu-option/index.d.ts +0 -28
- package/select-menu-option/index.js +0 -65
- package/select-menu-option/types.d.ts +0 -26
- package/select-menu-option/types.js +0 -1
- package/skeleton/index.d.ts +0 -11
- package/skeleton/index.js +0 -108
- package/skeleton/types.d.ts +0 -9
- package/skeleton/types.js +0 -1
- package/skeleton-item/index.d.ts +0 -11
- package/skeleton-item/index.js +0 -11
- package/skeleton-item/types.d.ts +0 -13
- package/skeleton-item/types.js +0 -1
- package/spinner/index.d.ts +0 -11
- package/spinner/index.js +0 -58
- package/spinner/types.d.ts +0 -12
- package/spinner/types.js +0 -1
- package/standalone.d.ts +0 -85
- package/standalone.js +0 -87
- package/stop-events/index.d.ts +0 -1
- package/stop-events/index.js +0 -27
- package/table/index.d.ts +0 -11
- package/table/index.js +0 -14
- package/table/types.d.ts +0 -3
- package/table/types.js +0 -1
- package/table-body/index.d.ts +0 -11
- package/table-body/index.js +0 -14
- package/table-body/types.d.ts +0 -3
- package/table-body/types.js +0 -1
- package/table-cell/index.d.ts +0 -11
- package/table-cell/index.js +0 -21
- package/table-cell/types.d.ts +0 -9
- package/table-cell/types.js +0 -1
- package/table-cell/utils.d.ts +0 -2
- package/table-cell/utils.js +0 -1
- package/table-head/index.d.ts +0 -11
- package/table-head/index.js +0 -14
- package/table-head/types.d.ts +0 -3
- package/table-head/types.js +0 -1
- package/table-head-cell/index.d.ts +0 -12
- package/table-head-cell/index.js +0 -57
- package/table-head-cell/types.d.ts +0 -15
- package/table-head-cell/types.js +0 -1
- package/table-row/index.d.ts +0 -11
- package/table-row/index.js +0 -42
- package/table-row/types.d.ts +0 -11
- package/table-row/types.js +0 -1
- package/tabs/index.d.ts +0 -11
- package/tabs/index.js +0 -80
- package/tabs/types.d.ts +0 -18
- package/tabs/types.js +0 -1
- package/tabs-icon-option/index.d.ts +0 -11
- package/tabs-icon-option/index.js +0 -79
- package/tabs-icon-option/types.d.ts +0 -19
- package/tabs-icon-option/types.js +0 -1
- package/tabs-option/index.d.ts +0 -12
- package/tabs-option/index.js +0 -86
- package/tabs-option/types.d.ts +0 -25
- package/tabs-option/types.js +0 -1
- package/tag/index.d.ts +0 -12
- package/tag/index.js +0 -84
- package/tag/types.d.ts +0 -23
- package/tag/types.js +0 -1
- package/tag/utils.d.ts +0 -2
- package/tag/utils.js +0 -6
- package/text/index.d.ts +0 -11
- package/text/index.js +0 -64
- package/text/types.d.ts +0 -30
- package/text/types.js +0 -1
- package/text/utils.d.ts +0 -2
- package/text/utils.js +0 -1
- package/textarea/index.d.ts +0 -11
- package/textarea/index.js +0 -322
- package/textarea/types.d.ts +0 -60
- package/textarea/types.js +0 -1
- package/tile-control/index.d.ts +0 -11
- package/tile-control/index.js +0 -110
- package/tile-control/types.d.ts +0 -37
- package/tile-control/types.js +0 -1
- package/tile-control-option/index.d.ts +0 -11
- package/tile-control-option/index.js +0 -98
- package/tile-control-option/types.d.ts +0 -37
- package/tile-control-option/types.js +0 -1
- package/time-picker/index.d.ts +0 -15
- package/time-picker/index.js +0 -337
- package/time-picker/types.d.ts +0 -34
- package/time-picker/types.js +0 -1
- package/time-picker/utils.d.ts +0 -11
- package/time-picker/utils.js +0 -75
- package/title/index.d.ts +0 -11
- package/title/index.js +0 -60
- package/title/types.d.ts +0 -31
- package/title/types.js +0 -1
- package/title/utils.d.ts +0 -3
- package/title/utils.js +0 -17
- package/toast/index.d.ts +0 -13
- package/toast/index.js +0 -86
- package/toast/types.d.ts +0 -28
- package/toast/types.js +0 -1
- package/toast/utils.d.ts +0 -2
- package/toast/utils.js +0 -1
- package/toast-manager/index.d.ts +0 -13
- package/toast-manager/index.js +0 -170
- package/toast-manager/types.d.ts +0 -13
- package/toast-manager/types.js +0 -1
- package/toast-manager/utils.d.ts +0 -2
- package/toast-manager/utils.js +0 -1
- package/toggle/index.d.ts +0 -11
- package/toggle/index.js +0 -141
- package/toggle/types.d.ts +0 -23
- package/toggle/types.js +0 -1
- package/tooltip/index.d.ts +0 -13
- package/tooltip/index.js +0 -264
- package/tooltip/tooltip-state.d.ts +0 -19
- package/tooltip/tooltip-state.js +0 -126
- package/tooltip/types.d.ts +0 -35
- package/tooltip/types.js +0 -1
- package/tooltip/utils.d.ts +0 -5
- package/tooltip/utils.js +0 -17
- package/utils/context.d.ts +0 -20
- package/utils/context.js +0 -84
- package/utils/countries.d.ts +0 -6
- package/utils/countries.js +0 -2
- package/utils/csv.d.ts +0 -5
- package/utils/csv.js +0 -22
- package/utils/debounce.d.ts +0 -8
- package/utils/debounce.js +0 -22
- package/utils/dom.d.ts +0 -34
- package/utils/dom.js +0 -154
- package/utils/element.d.ts +0 -16
- package/utils/element.js +0 -48
- package/utils/event-target.d.ts +0 -4
- package/utils/event-target.js +0 -26
- package/utils/get-react-event-handler.d.ts +0 -1
- package/utils/get-react-event-handler.js +0 -8
- package/utils/index.d.ts +0 -12
- package/utils/index.js +0 -12
- package/utils/markdown.d.ts +0 -19
- package/utils/markdown.js +0 -143
- package/utils/rect.d.ts +0 -4
- package/utils/rect.js +0 -28
- package/utils/size.d.ts +0 -5
- package/utils/size.js +0 -3
- package/utils/slot.d.ts +0 -4
- package/utils/slot.js +0 -38
- package/utils/throttle.d.ts +0 -4
- package/utils/throttle.js +0 -20
- package/utils/uid.d.ts +0 -1
- package/utils/uid.js +0 -13
- package/vertical-stepper/index.d.ts +0 -11
- package/vertical-stepper/index.js +0 -57
- package/vertical-stepper/types.d.ts +0 -13
- package/vertical-stepper/types.js +0 -1
- package/vertical-stepper-item/index.d.ts +0 -14
- package/vertical-stepper-item/index.js +0 -61
- package/vertical-stepper-item/types.d.ts +0 -24
- 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,82 +0,0 @@
|
|
|
1
|
-
import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, isAttrEqual, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
|
|
2
|
-
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{position:relative;width:56px;height:32px;padding:3px 16px;box-sizing:border-box;background-color:var(--sinch-local-color-background);cursor:pointer;--sinch-global-color-icon:var(--sinch-comp-segmented-control-color-default-icon-initial);--sinch-global-size-icon:var(--sinch-comp-segmented-control-size-icon);--sinch-local-shape-radius:var(--sinch-comp-segmented-control-shape-radius);--sinch-local-color-border:var(--sinch-comp-segmented-control-color-default-border-initial);--sinch-local-color-background:var(--sinch-comp-segmented-control-color-default-background-initial)}:host(:hover){--sinch-local-color-background:var(--sinch-comp-segmented-control-color-default-background-hover)}:host(:first-child) #wrapper{border-top-left-radius:var(--sinch-local-shape-radius);border-bottom-left-radius:var(--sinch-local-shape-radius)}:host(:last-child) #wrapper{border-top-right-radius:var(--sinch-local-shape-radius);border-bottom-right-radius:var(--sinch-local-shape-radius)}:host([data-checked]) #wrapper{--sinch-global-color-icon:var(--sinch-comp-segmented-control-color-checked-icon-initial);--sinch-local-color-border:var(--sinch-comp-segmented-control-color-checked-border-initial);--sinch-local-color-background:var(--sinch-comp-segmented-control-color-checked-background-initial)}:host([disabled]) #wrapper{--sinch-global-color-icon:var(--sinch-comp-segmented-control-color-disabled-icon-initial);--sinch-local-color-border:var(--sinch-comp-segmented-control-color-disabled-border-initial);--sinch-local-color-background:var(--sinch-comp-segmented-control-color-disabled-background-initial);cursor:initial}#border{position:absolute;inset:0;border:1px solid var(--sinch-local-color-border);pointer-events:none;box-sizing:border-box}:host(:first-child) #border{border-top-left-radius:var(--sinch-local-shape-radius);border-bottom-left-radius:var(--sinch-local-shape-radius)}:host(:last-child) #border{border-top-right-radius:var(--sinch-local-shape-radius);border-bottom-right-radius:var(--sinch-local-shape-radius)}:host(:not(:first-child)) #border{border-left-width:0}:host([data-checked]) #border{border-width:2px}:host([data-checked]:not(:first-child)) #border{left:-1px}#outline{display:none;position:absolute;inset:-3px;border:2px solid var(--sinch-comp-segmented-control-color-default-outline-focus);pointer-events:none;box-sizing:border-box;z-index:1}:host(:focus-visible) #outline{display:block}:host(:first-child) #outline{border-top-left-radius:calc(var(--sinch-local-shape-radius) + 3px);border-bottom-left-radius:calc(var(--sinch-local-shape-radius) + 3px)}:host(:last-child) #outline{border-top-right-radius:calc(var(--sinch-local-shape-radius) + 3px);border-bottom-right-radius:calc(var(--sinch-local-shape-radius) + 3px)}:host(:not(:first-child)) #outline{left:-4px}::slotted(*){display:block;pointer-events:none}</style><div id="wrapper"><slot name="icon"></slot><div id="border"></div><div id="outline"></div></div>';
|
|
3
|
-
const template = document.createElement('template');
|
|
4
|
-
template.innerHTML = templateHTML;
|
|
5
|
-
defineCustomElement('sinch-segmented-icon-control-option', class extends NectaryElement {
|
|
6
|
-
#controller = null;
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
const shadowRoot = this.attachShadow();
|
|
10
|
-
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
11
|
-
}
|
|
12
|
-
connectedCallback() {
|
|
13
|
-
this.#controller = new AbortController();
|
|
14
|
-
const {
|
|
15
|
-
signal
|
|
16
|
-
} = this.#controller;
|
|
17
|
-
const options = {
|
|
18
|
-
signal
|
|
19
|
-
};
|
|
20
|
-
this.role = 'tab';
|
|
21
|
-
this.addEventListener('focus', this.#onButtonFocus, options);
|
|
22
|
-
this.addEventListener('blur', this.#onButtonBlur, options);
|
|
23
|
-
this.addEventListener('-focus', this.#onFocusReactHandler, options);
|
|
24
|
-
this.addEventListener('-blur', this.#onBlurReactHandler, options);
|
|
25
|
-
this.#updateTabIndex();
|
|
26
|
-
}
|
|
27
|
-
disconnectedCallback() {
|
|
28
|
-
this.#controller.abort();
|
|
29
|
-
this.#controller = null;
|
|
30
|
-
}
|
|
31
|
-
static get observedAttributes() {
|
|
32
|
-
return ['data-checked', 'disabled'];
|
|
33
|
-
}
|
|
34
|
-
attributeChangedCallback(name, oldVal, newVal) {
|
|
35
|
-
switch (name) {
|
|
36
|
-
case 'data-checked':
|
|
37
|
-
{
|
|
38
|
-
updateExplicitBooleanAttribute(this, 'aria-selected', isAttrTrue(newVal));
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
case 'disabled':
|
|
42
|
-
{
|
|
43
|
-
if (isAttrEqual(oldVal, newVal)) {
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
this.#updateTabIndex();
|
|
47
|
-
updateBooleanAttribute(this, name, isAttrTrue(newVal));
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
set value(value) {
|
|
53
|
-
updateAttribute(this, 'value', value);
|
|
54
|
-
}
|
|
55
|
-
get value() {
|
|
56
|
-
return getAttribute(this, 'value', '');
|
|
57
|
-
}
|
|
58
|
-
set disabled(isDisabled) {
|
|
59
|
-
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
60
|
-
}
|
|
61
|
-
get disabled() {
|
|
62
|
-
return getBooleanAttribute(this, 'disabled');
|
|
63
|
-
}
|
|
64
|
-
get focusable() {
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
#updateTabIndex() {
|
|
68
|
-
this.tabIndex = this.disabled ? -1 : 0;
|
|
69
|
-
}
|
|
70
|
-
#onButtonFocus = () => {
|
|
71
|
-
this.dispatchEvent(new CustomEvent('-focus'));
|
|
72
|
-
};
|
|
73
|
-
#onButtonBlur = () => {
|
|
74
|
-
this.dispatchEvent(new CustomEvent('-blur'));
|
|
75
|
-
};
|
|
76
|
-
#onFocusReactHandler = () => {
|
|
77
|
-
getReactEventHandler(this, 'on-focus')?.();
|
|
78
|
-
};
|
|
79
|
-
#onBlurReactHandler = () => {
|
|
80
|
-
getReactEventHandler(this, 'on-blur')?.();
|
|
81
|
-
};
|
|
82
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { TSinchElementReact } from '../types';
|
|
2
|
-
export type TSinchSegmentedIconControlOptionElement = HTMLElement & {
|
|
3
|
-
value: string;
|
|
4
|
-
disabled: boolean;
|
|
5
|
-
addEventListener(type: '-focus', listener: (e: CustomEvent<void>) => void): void;
|
|
6
|
-
addEventListener(type: '-blur', listener: (e: CustomEvent<void>) => void): void;
|
|
7
|
-
setAttribute(name: 'value', value: string): void;
|
|
8
|
-
setAttribute(name: 'disabled', value: ''): void;
|
|
9
|
-
};
|
|
10
|
-
export type TSinchSegmentedIconControlOptionReact = TSinchElementReact<TSinchSegmentedIconControlOptionElement> & {
|
|
11
|
-
value: string;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
'aria-label': string;
|
|
14
|
-
'on-focus'?: (e: CustomEvent<void>) => void;
|
|
15
|
-
'on-blur'?: (e: CustomEvent<void>) => void;
|
|
16
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/select-button/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import '../text';
|
|
2
|
-
import '../icon';
|
|
3
|
-
import type { TSinchSelectButtonElement, TSinchSelectButtonReact } from './types';
|
|
4
|
-
declare global {
|
|
5
|
-
namespace JSX {
|
|
6
|
-
interface IntrinsicElements {
|
|
7
|
-
'sinch-select-button': TSinchSelectButtonReact;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
interface HTMLElementTagNameMap {
|
|
11
|
-
'sinch-select-button': TSinchSelectButtonElement;
|
|
12
|
-
}
|
|
13
|
-
}
|
package/select-button/index.js
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import '../text';
|
|
2
|
-
import '../icon';
|
|
3
|
-
import { defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, getReactEventHandler, isAttrTrue, NectaryElement, setClass, subscribeContext, updateAttribute, updateBooleanAttribute, updateLiteralAttribute, Context, isAttrEqual } from '../utils';
|
|
4
|
-
import { DEFAULT_SIZE, sizeValues } from '../utils/size';
|
|
5
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0;cursor:pointer}:host([disabled]){cursor:initial}#wrapper{position:relative;display:flex;flex-direction:row;align-items:center;gap:8px;box-sizing:border-box;width:100%;height:var(--sinch-local-size);padding:0 8px 0 12px;background-color:var(--sinch-comp-select-button-color-default-background-initial);border-radius:var(--sinch-local-shape-radius);--sinch-local-size:var(--sinch-comp-select-button-size-container-m);--sinch-global-size-icon:var(--sinch-comp-select-button-size-icon-m);--sinch-local-shape-radius:var(--sinch-comp-select-button-shape-radius-size-m);--sinch-global-color-icon:var(--sinch-comp-select-button-color-default-icon-initial)}:host([data-size="l"])>#wrapper{--sinch-local-size:var(--sinch-comp-select-button-size-container-l);--sinch-global-size-icon:var(--sinch-comp-select-button-size-icon-l);--sinch-local-shape-radius:var(--sinch-comp-select-button-shape-radius-size-l)}:host([data-size="m"])>#wrapper{--sinch-local-size:var(--sinch-comp-select-button-size-container-m);--sinch-global-size-icon:var(--sinch-comp-select-button-size-icon-m);--sinch-local-shape-radius:var(--sinch-comp-select-button-shape-radius-size-m)}:host([data-size="s"])>#wrapper{--sinch-local-size:var(--sinch-comp-select-button-size-container-s);--sinch-global-size-icon:var(--sinch-comp-select-button-size-icon-s);--sinch-local-shape-radius:var(--sinch-comp-select-button-shape-radius-size-s)}:host([data-size="l"]) #wrapper{padding:0 12px}:host([data-size="m"]) #wrapper{padding:0 8px 0 12px}:host([data-size="s"]) #wrapper{padding:0 4px 0 12px}:host([disabled]) #wrapper{--sinch-global-color-icon:var(--sinch-comp-select-button-color-disabled-icon-initial)}#text{flex:1;min-width:0;--sinch-comp-text-font:var(--sinch-comp-select-button-font-input);--sinch-global-color-text:var(--sinch-comp-select-button-color-default-text-initial)}#text:empty{display:none}#placeholder{display:none;flex:1;min-width:0;--sinch-comp-text-font:var(--sinch-comp-select-button-font-placeholder);--sinch-global-color-text:var(--sinch-comp-select-button-color-default-placeholder-initial)}#text:empty+#placeholder{display:block}#border{position:absolute;border:1px solid var(--sinch-comp-select-button-color-default-border-initial);border-radius:var(--sinch-local-shape-radius);inset:0;pointer-events:none}:host(:focus-visible) #border{border-color:var(--sinch-comp-select-button-color-default-border-focus);border-width:2px}:host([invalid]) #border{border-color:var(--sinch-comp-select-button-color-invalid-border-initial)}:host([disabled]) #border{border-color:var(--sinch-comp-select-button-color-disabled-border-initial)}:host([disabled]) #text{--sinch-global-color-text:var(--sinch-comp-select-button-color-disabled-text-initial)}:host([disabled]) #placeholder{--sinch-global-color-text:var(--sinch-comp-select-button-color-disabled-placeholder-initial)}#left{display:flex;flex-direction:row;align-self:stretch;align-items:center;gap:4px;margin-left:-4px}#left.empty{display:none}#dropdown-icon{margin-left:-4px}</style><div id="wrapper" inert><div id="border"></div><div id="left"><slot name="left"></slot></div><slot name="icon"></slot><sinch-text id="text" type="m" ellipsis></sinch-text><sinch-text id="placeholder" type="m" ellipsis></sinch-text><sinch-icon id="dropdown-icon" name="keyboard_arrow_down"></sinch-icon></div>';
|
|
6
|
-
const template = document.createElement('template');
|
|
7
|
-
template.innerHTML = templateHTML;
|
|
8
|
-
defineCustomElement('sinch-select-button', class extends NectaryElement {
|
|
9
|
-
#$text;
|
|
10
|
-
#$placeholder;
|
|
11
|
-
#$leftSlot;
|
|
12
|
-
#$leftWrapper;
|
|
13
|
-
#$wrapper;
|
|
14
|
-
#controller = null;
|
|
15
|
-
#sizeContext;
|
|
16
|
-
constructor() {
|
|
17
|
-
super();
|
|
18
|
-
const shadowRoot = this.attachShadow();
|
|
19
|
-
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
20
|
-
this.#$text = shadowRoot.querySelector('#text');
|
|
21
|
-
this.#$placeholder = shadowRoot.querySelector('#placeholder');
|
|
22
|
-
this.#$leftSlot = shadowRoot.querySelector('slot[name="left"]');
|
|
23
|
-
this.#$leftWrapper = shadowRoot.querySelector('#left');
|
|
24
|
-
this.#$wrapper = shadowRoot.querySelector('#wrapper');
|
|
25
|
-
this.#sizeContext = new Context(this.#$wrapper, 'size');
|
|
26
|
-
}
|
|
27
|
-
connectedCallback() {
|
|
28
|
-
super.connectedCallback();
|
|
29
|
-
this.#controller = new AbortController();
|
|
30
|
-
const {
|
|
31
|
-
signal
|
|
32
|
-
} = this.#controller;
|
|
33
|
-
this.role = 'button';
|
|
34
|
-
this.tabIndex = 0;
|
|
35
|
-
this.addEventListener('click', this.#onButtonClick, {
|
|
36
|
-
signal
|
|
37
|
-
});
|
|
38
|
-
this.addEventListener('focus', this.#onButtonFocus, {
|
|
39
|
-
signal
|
|
40
|
-
});
|
|
41
|
-
this.addEventListener('blur', this.#onButtonBlur, {
|
|
42
|
-
signal
|
|
43
|
-
});
|
|
44
|
-
this.addEventListener('keydown', this.#onButtonKeydown, {
|
|
45
|
-
signal
|
|
46
|
-
});
|
|
47
|
-
this.addEventListener('-click', this.#onClickReactHandler, {
|
|
48
|
-
signal
|
|
49
|
-
});
|
|
50
|
-
this.addEventListener('-focus', this.#onFocusReactHandler, {
|
|
51
|
-
signal
|
|
52
|
-
});
|
|
53
|
-
this.addEventListener('-blur', this.#onBlurReactHandler, {
|
|
54
|
-
signal
|
|
55
|
-
});
|
|
56
|
-
this.#$leftSlot.addEventListener('slotchange', this.#onLeftSlotChange, {
|
|
57
|
-
signal
|
|
58
|
-
});
|
|
59
|
-
this.#sizeContext.listen(this.#controller.signal);
|
|
60
|
-
subscribeContext(this, 'size', this.#onContextSize, signal);
|
|
61
|
-
this.#onLeftSlotChange();
|
|
62
|
-
this.#onSizeUpdate();
|
|
63
|
-
}
|
|
64
|
-
disconnectedCallback() {
|
|
65
|
-
super.disconnectedCallback();
|
|
66
|
-
this.#controller.abort();
|
|
67
|
-
this.#controller = null;
|
|
68
|
-
}
|
|
69
|
-
static get observedAttributes() {
|
|
70
|
-
return ['text', 'placeholder', 'invalid', 'disabled', 'size', 'data-size'];
|
|
71
|
-
}
|
|
72
|
-
attributeChangedCallback(name, oldVal, newVal) {
|
|
73
|
-
if (isAttrEqual(oldVal, newVal)) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
switch (name) {
|
|
77
|
-
case 'text':
|
|
78
|
-
{
|
|
79
|
-
this.#$text.textContent = newVal;
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
case 'placeholder':
|
|
83
|
-
{
|
|
84
|
-
this.#$placeholder.textContent = newVal;
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
case 'invalid':
|
|
88
|
-
{
|
|
89
|
-
const isInvalid = isAttrTrue(newVal);
|
|
90
|
-
this.ariaInvalid = isInvalid.toString();
|
|
91
|
-
updateBooleanAttribute(this, 'invalid', isInvalid);
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
case 'disabled':
|
|
95
|
-
{
|
|
96
|
-
const isDisabled = isAttrTrue(newVal);
|
|
97
|
-
this.ariaDisabled = isDisabled.toString();
|
|
98
|
-
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
case 'size':
|
|
102
|
-
{
|
|
103
|
-
updateAttribute(this, 'data-size', newVal);
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
case 'data-size':
|
|
107
|
-
{
|
|
108
|
-
this.#onSizeUpdate();
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
set text(value) {
|
|
114
|
-
updateAttribute(this, 'text', value);
|
|
115
|
-
}
|
|
116
|
-
get text() {
|
|
117
|
-
return getAttribute(this, 'text', '');
|
|
118
|
-
}
|
|
119
|
-
set placeholder(value) {
|
|
120
|
-
updateAttribute(this, 'placeholder', value);
|
|
121
|
-
}
|
|
122
|
-
get placeholder() {
|
|
123
|
-
return getAttribute(this, 'placeholder');
|
|
124
|
-
}
|
|
125
|
-
set invalid(isInvalid) {
|
|
126
|
-
updateBooleanAttribute(this, 'invalid', isInvalid);
|
|
127
|
-
}
|
|
128
|
-
get invalid() {
|
|
129
|
-
return getBooleanAttribute(this, 'invalid');
|
|
130
|
-
}
|
|
131
|
-
set disabled(isDisabled) {
|
|
132
|
-
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
133
|
-
}
|
|
134
|
-
get disabled() {
|
|
135
|
-
return getBooleanAttribute(this, 'disabled');
|
|
136
|
-
}
|
|
137
|
-
set size(size) {
|
|
138
|
-
updateLiteralAttribute(this, sizeValues, 'size', size);
|
|
139
|
-
}
|
|
140
|
-
get size() {
|
|
141
|
-
return getLiteralAttribute(this, sizeValues, 'size', DEFAULT_SIZE);
|
|
142
|
-
}
|
|
143
|
-
get focusable() {
|
|
144
|
-
return true;
|
|
145
|
-
}
|
|
146
|
-
#onContextSize = e => {
|
|
147
|
-
if (this.hasAttribute('size')) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
switch (e.detail) {
|
|
151
|
-
case 'l':
|
|
152
|
-
{
|
|
153
|
-
this.setAttribute('data-size', 'm');
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
default:
|
|
157
|
-
{
|
|
158
|
-
this.setAttribute('data-size', 's');
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
#onSizeUpdate() {
|
|
163
|
-
if (!this.isDomConnected) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
const size = this.getAttribute('data-size') ?? DEFAULT_SIZE;
|
|
167
|
-
this.#sizeContext.dispatch(size);
|
|
168
|
-
}
|
|
169
|
-
#onLeftSlotChange = () => {
|
|
170
|
-
setClass(this.#$leftWrapper, 'empty', this.#$leftSlot.assignedElements().length === 0);
|
|
171
|
-
};
|
|
172
|
-
#onButtonFocus = () => {
|
|
173
|
-
this.dispatchEvent(new CustomEvent('-focus'));
|
|
174
|
-
};
|
|
175
|
-
#onButtonBlur = () => {
|
|
176
|
-
this.dispatchEvent(new CustomEvent('-blur'));
|
|
177
|
-
};
|
|
178
|
-
#onButtonKeydown = e => {
|
|
179
|
-
switch (e.code) {
|
|
180
|
-
case 'Space':
|
|
181
|
-
case 'Enter':
|
|
182
|
-
{
|
|
183
|
-
e.preventDefault();
|
|
184
|
-
this.click();
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
#onButtonClick = () => {
|
|
189
|
-
if (!this.disabled) {
|
|
190
|
-
this.dispatchEvent(new CustomEvent('-click'));
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
#onClickReactHandler = e => {
|
|
194
|
-
getReactEventHandler(this, 'on-click')?.(e);
|
|
195
|
-
};
|
|
196
|
-
#onFocusReactHandler = () => {
|
|
197
|
-
getReactEventHandler(this, 'on-focus')?.();
|
|
198
|
-
};
|
|
199
|
-
#onBlurReactHandler = () => {
|
|
200
|
-
getReactEventHandler(this, 'on-blur')?.();
|
|
201
|
-
};
|
|
202
|
-
});
|
package/select-button/types.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { TSinchElementReact } from '../types';
|
|
2
|
-
import type { TSinchSize } from '../utils/size';
|
|
3
|
-
export type TSinchSelectButtonElement = HTMLElement & {
|
|
4
|
-
/** Text */
|
|
5
|
-
text: string;
|
|
6
|
-
/** Text that appears in the text field when it has no text set */
|
|
7
|
-
placeholder: string;
|
|
8
|
-
/** Invalid state */
|
|
9
|
-
invalid: boolean;
|
|
10
|
-
/** Disabled */
|
|
11
|
-
disabled: boolean;
|
|
12
|
-
/** Size, `m` by default */
|
|
13
|
-
size: TSinchSize;
|
|
14
|
-
/** Click event */
|
|
15
|
-
addEventListener(type: '-click', listener: (e: CustomEvent<void>) => void): void;
|
|
16
|
-
/** Focus event */
|
|
17
|
-
addEventListener(type: '-focus', listener: (e: CustomEvent<void>) => void): void;
|
|
18
|
-
/** Blur event */
|
|
19
|
-
addEventListener(type: '-blur', listener: (e: CustomEvent<void>) => void): void;
|
|
20
|
-
/** Text */
|
|
21
|
-
setAttribute(name: 'text', value: string): void;
|
|
22
|
-
/** Text that appears in the text field when it has no value set */
|
|
23
|
-
setAttribute(name: 'placeholder', value: string): void;
|
|
24
|
-
/** Invalid state */
|
|
25
|
-
setAttribute(name: 'invalid', value: ''): void;
|
|
26
|
-
/** Disabled */
|
|
27
|
-
setAttribute(name: 'disabled', value: ''): void;
|
|
28
|
-
/** Size, `m` by default */
|
|
29
|
-
setAttribute(name: 'size', value: TSinchSize): void;
|
|
30
|
-
};
|
|
31
|
-
export type TSinchSelectButtonReact = TSinchElementReact<TSinchSelectButtonElement> & {
|
|
32
|
-
/** Text */
|
|
33
|
-
text: string;
|
|
34
|
-
/** Label that is used for a11y` */
|
|
35
|
-
'aria-label': string;
|
|
36
|
-
/** Text that appears in the text field when it has no text set */
|
|
37
|
-
placeholder: string;
|
|
38
|
-
/** Invalid state */
|
|
39
|
-
invalid?: boolean;
|
|
40
|
-
/** Disabled */
|
|
41
|
-
disabled?: boolean;
|
|
42
|
-
/** Size, `m` by default */
|
|
43
|
-
size?: TSinchSize;
|
|
44
|
-
/** Click handler */
|
|
45
|
-
'on-click': (e: CustomEvent<void>) => void;
|
|
46
|
-
/** Focus handler */
|
|
47
|
-
'on-focus'?: (e: CustomEvent<void>) => void;
|
|
48
|
-
/** Blur handler */
|
|
49
|
-
'on-blur'?: (e: CustomEvent<void>) => void;
|
|
50
|
-
};
|
package/select-button/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/select-menu/index.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import '../input';
|
|
2
|
-
import '../icon-button';
|
|
3
|
-
import '../icon';
|
|
4
|
-
import '../text';
|
|
5
|
-
import type { TSinchSelectMenuElement, TSinchSelectMenuReact } from './types';
|
|
6
|
-
declare global {
|
|
7
|
-
namespace JSX {
|
|
8
|
-
interface IntrinsicElements {
|
|
9
|
-
'sinch-select-menu': TSinchSelectMenuReact;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
interface HTMLElementTagNameMap {
|
|
13
|
-
'sinch-select-menu': TSinchSelectMenuElement;
|
|
14
|
-
}
|
|
15
|
-
}
|