@nectary/components 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/index.d.ts +11 -0
- package/accordion/index.js +86 -0
- package/accordion/types.d.ts +21 -0
- package/accordion/types.js +1 -0
- package/accordion-item/index.d.ts +14 -0
- package/accordion-item/index.js +95 -0
- package/accordion-item/types.d.ts +36 -0
- package/accordion-item/types.js +1 -0
- package/accordion-item/utils.d.ts +2 -0
- package/accordion-item/utils.js +1 -0
- package/action-menu/index.d.ts +11 -0
- package/action-menu/index.js +195 -0
- package/action-menu/types.d.ts +13 -0
- package/action-menu/types.js +1 -0
- package/action-menu-option/index.d.ts +12 -0
- package/action-menu-option/index.js +82 -0
- package/action-menu-option/types.d.ts +23 -0
- package/action-menu-option/types.js +1 -0
- package/action-menu-option/utils.d.ts +2 -0
- package/action-menu-option/utils.js +3 -0
- package/alert/index.d.ts +14 -0
- package/alert/index.js +48 -0
- package/alert/types.d.ts +18 -0
- package/alert/types.js +1 -0
- package/alert/utils.d.ts +2 -0
- package/alert/utils.js +1 -0
- package/avatar/index.d.ts +11 -0
- package/avatar/index.js +94 -0
- package/avatar/types.d.ts +37 -0
- package/avatar/types.js +1 -0
- package/avatar/utils.d.ts +4 -0
- package/avatar/utils.js +7 -0
- package/badge/index.d.ts +11 -0
- package/badge/index.js +114 -0
- package/badge/types.d.ts +34 -0
- package/badge/types.js +1 -0
- package/badge/utils.d.ts +2 -0
- package/badge/utils.js +1 -0
- package/button/index.d.ts +11 -0
- package/button/index.js +168 -0
- package/button/types.d.ts +45 -0
- package/button/types.js +1 -0
- package/button/utils.d.ts +2 -0
- package/button/utils.js +1 -0
- package/card/index.d.ts +13 -0
- package/card/index.js +133 -0
- package/card/types.d.ts +28 -0
- package/card/types.js +1 -0
- package/card-container/index.d.ts +11 -0
- package/card-container/index.js +11 -0
- package/card-container/types.d.ts +3 -0
- package/card-container/types.js +1 -0
- package/chat/index.d.ts +11 -0
- package/chat/index.js +11 -0
- package/chat/types.d.ts +3 -0
- package/chat/types.js +1 -0
- package/chat-block/index.d.ts +11 -0
- package/chat-block/index.js +86 -0
- package/chat-block/types.d.ts +30 -0
- package/chat-block/types.js +1 -0
- package/chat-bubble/index.d.ts +11 -0
- package/chat-bubble/index.js +41 -0
- package/chat-bubble/types.d.ts +20 -0
- package/chat-bubble/types.js +1 -0
- package/chat-bubble/utils.d.ts +3 -0
- package/chat-bubble/utils.js +2 -0
- package/checkbox/index.d.ts +11 -0
- package/checkbox/index.js +126 -0
- package/checkbox/types.d.ts +49 -0
- package/checkbox/types.js +1 -0
- package/chip/index.d.ts +13 -0
- package/chip/index.js +144 -0
- package/chip/types.d.ts +37 -0
- package/chip/types.js +1 -0
- package/chip/utils.d.ts +2 -0
- package/chip/utils.js +6 -0
- package/code-tag/index.d.ts +11 -0
- package/code-tag/index.js +31 -0
- package/code-tag/types.d.ts +11 -0
- package/code-tag/types.js +1 -0
- package/color-menu/index.d.ts +11 -0
- package/color-menu/index.js +308 -0
- package/color-menu/types.d.ts +32 -0
- package/color-menu/types.js +1 -0
- package/color-menu/utils.d.ts +1 -0
- package/color-menu/utils.js +11 -0
- package/color-menu-option/index.d.ts +13 -0
- package/color-menu-option/index.js +48 -0
- package/color-menu-option/types.d.ts +11 -0
- package/color-menu-option/types.js +1 -0
- package/color-menu-option/utils.d.ts +1 -0
- package/color-menu-option/utils.js +11 -0
- package/color-swatch/index.d.ts +12 -0
- package/color-swatch/index.js +54 -0
- package/color-swatch/types.d.ts +11 -0
- package/color-swatch/types.js +1 -0
- package/color-swatch/utils.d.ts +2 -0
- package/color-swatch/utils.js +6 -0
- package/colors.json +88 -0
- package/date-picker/index.d.ts +14 -0
- package/date-picker/index.js +381 -0
- package/date-picker/types.d.ts +70 -0
- package/date-picker/types.js +1 -0
- package/date-picker/utils.d.ts +28 -0
- package/date-picker/utils.js +142 -0
- package/dialog/index.d.ts +15 -0
- package/dialog/index.js +144 -0
- package/dialog/types.d.ts +28 -0
- package/dialog/types.js +1 -0
- package/dialog/utils.d.ts +2 -0
- package/dialog/utils.js +18 -0
- package/emoji/index.d.ts +11 -0
- package/emoji/index.js +46 -0
- package/emoji/types.d.ts +11 -0
- package/emoji/types.js +1 -0
- package/emoji/utils.d.ts +1 -0
- package/emoji/utils.js +42 -0
- package/emoji-picker/data.json +1 -0
- package/emoji-picker/index.d.ts +22 -0
- package/emoji-picker/index.js +304 -0
- package/emoji-picker/types.d.ts +26 -0
- package/emoji-picker/types.js +1 -0
- package/field/index.d.ts +11 -0
- package/field/index.js +112 -0
- package/field/types.d.ts +35 -0
- package/field/types.js +1 -0
- package/file-drop/index.d.ts +13 -0
- package/file-drop/index.js +205 -0
- package/file-drop/types.d.ts +50 -0
- package/file-drop/types.js +1 -0
- package/file-drop/utils.d.ts +2 -0
- package/file-drop/utils.js +31 -0
- package/file-picker/index.d.ts +11 -0
- package/file-picker/index.js +103 -0
- package/file-picker/types.d.ts +32 -0
- package/file-picker/types.js +1 -0
- package/file-picker/utils.d.ts +1 -0
- package/file-picker/utils.js +8 -0
- package/file-status/index.d.ts +14 -0
- package/file-status/index.js +61 -0
- package/file-status/types.d.ts +18 -0
- package/file-status/types.js +1 -0
- package/file-status/utils.d.ts +2 -0
- package/file-status/utils.js +1 -0
- package/flag/index.d.ts +11 -0
- package/flag/index.js +46 -0
- package/flag/types.d.ts +11 -0
- package/flag/types.js +1 -0
- package/flag/utils.d.ts +1 -0
- package/flag/utils.js +17 -0
- package/grid/index.d.ts +11 -0
- package/grid/index.js +11 -0
- package/grid/types.d.ts +3 -0
- package/grid/types.js +1 -0
- package/grid-item/index.d.ts +11 -0
- package/grid-item/index.js +35 -0
- package/grid-item/types.d.ts +17 -0
- package/grid-item/types.js +1 -0
- package/help-tooltip/index.d.ts +13 -0
- package/help-tooltip/index.js +74 -0
- package/help-tooltip/types.d.ts +3 -0
- package/help-tooltip/types.js +1 -0
- package/horizontal-stepper/index.d.ts +11 -0
- package/horizontal-stepper/index.js +61 -0
- package/horizontal-stepper/types.d.ts +13 -0
- package/horizontal-stepper/types.js +1 -0
- package/horizontal-stepper-item/index.d.ts +14 -0
- package/horizontal-stepper-item/index.js +61 -0
- package/horizontal-stepper-item/types.d.ts +24 -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/index.d.ts +11 -0
- package/icon/index.js +32 -0
- package/icon/types.d.ts +11 -0
- package/icon/types.js +1 -0
- package/icon-button/index.d.ts +12 -0
- package/icon-button/index.js +173 -0
- package/icon-button/types.d.ts +44 -0
- package/icon-button/types.js +1 -0
- package/icon-button/utils.d.ts +2 -0
- package/icon-button/utils.js +1 -0
- package/inline-alert/index.d.ts +15 -0
- package/inline-alert/index.js +83 -0
- package/inline-alert/types.d.ts +15 -0
- package/inline-alert/types.js +1 -0
- package/inline-alert/utils.d.ts +2 -0
- package/inline-alert/utils.js +1 -0
- package/input/index.d.ts +11 -0
- package/input/index.js +620 -0
- package/input/types.d.ts +80 -0
- package/input/types.js +1 -0
- package/input/utils.d.ts +26 -0
- package/input/utils.js +302 -0
- package/link/index.d.ts +12 -0
- package/link/index.js +132 -0
- package/link/types.d.ts +55 -0
- package/link/types.js +1 -0
- package/list/index.d.ts +11 -0
- package/list/index.js +14 -0
- package/list/types.d.ts +3 -0
- package/list/types.js +1 -0
- package/list-item/index.d.ts +11 -0
- package/list-item/index.js +14 -0
- package/list-item/types.d.ts +3 -0
- package/list-item/types.js +1 -0
- package/package.json +30 -0
- package/pagination/index.d.ts +12 -0
- package/pagination/index.js +147 -0
- package/pagination/types.d.ts +16 -0
- package/pagination/types.js +1 -0
- package/pop/index.d.ts +11 -0
- package/pop/index.js +425 -0
- package/pop/types.d.ts +35 -0
- package/pop/types.js +1 -0
- package/pop/utils.d.ts +4 -0
- package/pop/utils.js +16 -0
- package/popover/index.d.ts +12 -0
- package/popover/index.js +140 -0
- package/popover/types.d.ts +40 -0
- package/popover/types.js +1 -0
- package/popover/utils.d.ts +4 -0
- package/popover/utils.js +10 -0
- package/progress/index.d.ts +12 -0
- package/progress/index.js +58 -0
- package/progress/types.d.ts +12 -0
- package/progress/types.js +1 -0
- package/progress-stepper/index.d.ts +11 -0
- package/progress-stepper/index.js +206 -0
- package/progress-stepper/types.d.ts +22 -0
- package/progress-stepper/types.js +1 -0
- package/progress-stepper-item/index.d.ts +12 -0
- package/progress-stepper-item/index.js +82 -0
- package/progress-stepper-item/types.d.ts +23 -0
- package/progress-stepper-item/types.js +1 -0
- package/progress-stepper-item/utils.d.ts +11 -0
- package/progress-stepper-item/utils.js +13 -0
- package/radio/index.d.ts +11 -0
- package/radio/index.js +154 -0
- package/radio/types.d.ts +14 -0
- package/radio/types.js +1 -0
- package/radio-option/index.d.ts +11 -0
- package/radio-option/index.js +79 -0
- package/radio-option/types.d.ts +17 -0
- package/radio-option/types.js +1 -0
- package/readme.md +179 -0
- package/rich-text/index.d.ts +11 -0
- package/rich-text/index.js +48 -0
- package/rich-text/types.d.ts +12 -0
- package/rich-text/types.js +1 -0
- package/rich-text/utils.d.ts +2 -0
- package/rich-text/utils.js +1 -0
- package/segment/index.d.ts +12 -0
- package/segment/index.js +109 -0
- package/segment/types.d.ts +16 -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 +13 -0
- package/segment-collapse/index.js +60 -0
- package/segment-collapse/types.d.ts +11 -0
- package/segment-collapse/types.js +1 -0
- package/segmented-control/index.d.ts +11 -0
- package/segmented-control/index.js +85 -0
- package/segmented-control/types.d.ts +11 -0
- package/segmented-control/types.js +1 -0
- package/segmented-control-option/index.d.ts +11 -0
- package/segmented-control-option/index.js +95 -0
- package/segmented-control-option/types.d.ts +19 -0
- package/segmented-control-option/types.js +1 -0
- package/segmented-icon-control/index.d.ts +11 -0
- package/segmented-icon-control/index.js +101 -0
- package/segmented-icon-control/types.d.ts +14 -0
- package/segmented-icon-control/types.js +1 -0
- package/segmented-icon-control-option/index.d.ts +11 -0
- package/segmented-icon-control-option/index.js +82 -0
- package/segmented-icon-control-option/types.d.ts +16 -0
- package/segmented-icon-control-option/types.js +1 -0
- package/select-button/index.d.ts +13 -0
- package/select-button/index.js +200 -0
- package/select-button/types.d.ts +50 -0
- package/select-button/types.js +1 -0
- package/select-menu/index.d.ts +15 -0
- package/select-menu/index.js +307 -0
- package/select-menu/types.d.ts +29 -0
- package/select-menu/types.js +1 -0
- package/select-menu-option/index.d.ts +28 -0
- package/select-menu-option/index.js +65 -0
- package/select-menu-option/types.d.ts +26 -0
- package/select-menu-option/types.js +1 -0
- package/skeleton/index.d.ts +11 -0
- package/skeleton/index.js +108 -0
- package/skeleton/types.d.ts +9 -0
- package/skeleton/types.js +1 -0
- package/skeleton-item/index.d.ts +11 -0
- package/skeleton-item/index.js +11 -0
- package/skeleton-item/types.d.ts +13 -0
- package/skeleton-item/types.js +1 -0
- package/spinner/index.d.ts +11 -0
- package/spinner/index.js +58 -0
- package/spinner/types.d.ts +12 -0
- package/spinner/types.js +1 -0
- package/stop-events/index.d.ts +1 -0
- package/stop-events/index.js +27 -0
- package/table/index.d.ts +11 -0
- package/table/index.js +14 -0
- package/table/types.d.ts +3 -0
- package/table/types.js +1 -0
- package/table-body/index.d.ts +11 -0
- package/table-body/index.js +14 -0
- package/table-body/types.d.ts +3 -0
- package/table-body/types.js +1 -0
- package/table-cell/index.d.ts +11 -0
- package/table-cell/index.js +21 -0
- package/table-cell/types.d.ts +9 -0
- package/table-cell/types.js +1 -0
- package/table-cell/utils.d.ts +2 -0
- package/table-cell/utils.js +1 -0
- package/table-head/index.d.ts +11 -0
- package/table-head/index.js +14 -0
- package/table-head/types.d.ts +3 -0
- package/table-head/types.js +1 -0
- package/table-head-cell/index.d.ts +12 -0
- package/table-head-cell/index.js +57 -0
- package/table-head-cell/types.d.ts +15 -0
- package/table-head-cell/types.js +1 -0
- package/table-row/index.d.ts +11 -0
- package/table-row/index.js +42 -0
- package/table-row/types.d.ts +11 -0
- package/table-row/types.js +1 -0
- package/tabs/index.d.ts +11 -0
- package/tabs/index.js +80 -0
- package/tabs/types.d.ts +18 -0
- package/tabs/types.js +1 -0
- package/tabs-icon-option/index.d.ts +11 -0
- package/tabs-icon-option/index.js +79 -0
- package/tabs-icon-option/types.d.ts +19 -0
- package/tabs-icon-option/types.js +1 -0
- package/tabs-option/index.d.ts +12 -0
- package/tabs-option/index.js +86 -0
- package/tabs-option/types.d.ts +25 -0
- package/tabs-option/types.js +1 -0
- package/tag/index.d.ts +12 -0
- package/tag/index.js +84 -0
- package/tag/types.d.ts +23 -0
- package/tag/types.js +1 -0
- package/tag/utils.d.ts +2 -0
- package/tag/utils.js +6 -0
- package/text/index.d.ts +11 -0
- package/text/index.js +64 -0
- package/text/types.d.ts +30 -0
- package/text/types.js +1 -0
- package/text/utils.d.ts +2 -0
- package/text/utils.js +1 -0
- package/textarea/index.d.ts +11 -0
- package/textarea/index.js +228 -0
- package/textarea/types.d.ts +57 -0
- package/textarea/types.js +1 -0
- package/tile-control/index.d.ts +11 -0
- package/tile-control/index.js +110 -0
- package/tile-control/types.d.ts +35 -0
- package/tile-control/types.js +1 -0
- package/tile-control-option/index.d.ts +11 -0
- package/tile-control-option/index.js +98 -0
- package/tile-control-option/types.d.ts +37 -0
- package/tile-control-option/types.js +1 -0
- package/time-picker/index.d.ts +15 -0
- package/time-picker/index.js +337 -0
- package/time-picker/types.d.ts +34 -0
- package/time-picker/types.js +1 -0
- package/time-picker/utils.d.ts +11 -0
- package/time-picker/utils.js +75 -0
- package/title/index.d.ts +11 -0
- package/title/index.js +60 -0
- package/title/types.d.ts +31 -0
- package/title/types.js +1 -0
- package/title/utils.d.ts +3 -0
- package/title/utils.js +17 -0
- package/toast/index.d.ts +14 -0
- package/toast/index.js +87 -0
- package/toast/types.d.ts +28 -0
- package/toast/types.js +1 -0
- package/toast/utils.d.ts +2 -0
- package/toast/utils.js +1 -0
- package/toast-manager/index.d.ts +13 -0
- package/toast-manager/index.js +163 -0
- package/toast-manager/types.d.ts +7 -0
- package/toast-manager/types.js +1 -0
- package/toggle/index.d.ts +11 -0
- package/toggle/index.js +126 -0
- package/toggle/types.d.ts +23 -0
- package/toggle/types.js +1 -0
- package/tooltip/index.d.ts +13 -0
- package/tooltip/index.js +258 -0
- package/tooltip/tooltip-state.d.ts +19 -0
- package/tooltip/tooltip-state.js +126 -0
- package/tooltip/types.d.ts +35 -0
- package/tooltip/types.js +1 -0
- package/tooltip/utils.d.ts +5 -0
- package/tooltip/utils.js +17 -0
- package/types.d.ts +14 -0
- package/utils/context.d.ts +20 -0
- package/utils/context.js +84 -0
- package/utils/countries.d.ts +6 -0
- package/utils/countries.js +2 -0
- package/utils/countries.json +1217 -0
- package/utils/csv.d.ts +5 -0
- package/utils/csv.js +22 -0
- package/utils/debounce.d.ts +8 -0
- package/utils/debounce.js +22 -0
- package/utils/dom.d.ts +34 -0
- package/utils/dom.js +154 -0
- package/utils/element.d.ts +16 -0
- package/utils/element.js +48 -0
- package/utils/event-target.d.ts +4 -0
- package/utils/event-target.js +26 -0
- package/utils/get-react-event-handler.d.ts +1 -0
- package/utils/get-react-event-handler.js +8 -0
- package/utils/index.d.ts +12 -0
- package/utils/index.js +12 -0
- package/utils/markdown.d.ts +1 -0
- package/utils/markdown.js +128 -0
- package/utils/rect.d.ts +4 -0
- package/utils/rect.js +28 -0
- package/utils/size.d.ts +5 -0
- package/utils/size.js +3 -0
- package/utils/slot.d.ts +4 -0
- package/utils/slot.js +38 -0
- package/utils/throttle.d.ts +4 -0
- package/utils/throttle.js +20 -0
- package/utils/uid.d.ts +1 -0
- package/utils/uid.js +13 -0
- package/vertical-stepper/index.d.ts +11 -0
- package/vertical-stepper/index.js +57 -0
- package/vertical-stepper/types.d.ts +13 -0
- package/vertical-stepper/types.js +1 -0
- package/vertical-stepper-item/index.d.ts +14 -0
- package/vertical-stepper-item/index.js +61 -0
- package/vertical-stepper-item/types.d.ts +24 -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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import '../color-swatch';
|
|
2
|
+
import '../tooltip';
|
|
3
|
+
import type { TSinchColorMenuOptionElement, TSinchColorMenuOptionReact } from './types';
|
|
4
|
+
declare global {
|
|
5
|
+
namespace JSX {
|
|
6
|
+
interface IntrinsicElements {
|
|
7
|
+
'sinch-color-menu-option': TSinchColorMenuOptionReact;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
interface HTMLElementTagNameMap {
|
|
11
|
+
'sinch-color-menu-option': TSinchColorMenuOptionElement;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import '../color-swatch';
|
|
2
|
+
import '../tooltip';
|
|
3
|
+
import { getSwatchColorFg } from '../color-swatch/utils';
|
|
4
|
+
import { defineCustomElement, getAttribute, NectaryElement, updateAttribute } from '../utils';
|
|
5
|
+
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{width:44px;height:56px;padding:12px 6px;box-sizing:border-box}#swatch-wrapper{position:relative;cursor:pointer;width:32px;height:32px}#swatch-wrapper::after{content:"";position:absolute;width:34px;height:34px;inset:-3px;border:2px solid var(--sinch-comp-color-menu-option-color-default-border-initial);border-radius:50%;pointer-events:none}:host([data-checked]) #swatch-wrapper::after{border-color:var(--sinch-comp-color-menu-option-color-default-border-selected)}:host([data-selected]) #swatch-wrapper::after{border-color:var(--sinch-comp-color-menu-option-color-default-border-focus)}:host(:hover) #swatch-wrapper::after{border-color:var(--sinch-comp-color-menu-option-color-default-border-hover)}:host(:active) #swatch-wrapper::after{border-color:var(--sinch-comp-color-menu-option-color-default-border-active)}</style><div id="wrapper"><sinch-tooltip id="tooltip"><div id="swatch-wrapper"><sinch-color-swatch id="swatch"></sinch-color-swatch></div></sinch-tooltip></div>';
|
|
6
|
+
const template = document.createElement('template');
|
|
7
|
+
template.innerHTML = templateHTML;
|
|
8
|
+
defineCustomElement('sinch-color-menu-option', class extends NectaryElement {
|
|
9
|
+
#$wrapper;
|
|
10
|
+
#$tooltip;
|
|
11
|
+
#$swatch;
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
const shadowRoot = this.attachShadow();
|
|
15
|
+
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
16
|
+
this.#$wrapper = shadowRoot.querySelector('#wrapper');
|
|
17
|
+
this.#$tooltip = shadowRoot.querySelector('#tooltip');
|
|
18
|
+
this.#$swatch = shadowRoot.querySelector('#swatch');
|
|
19
|
+
}
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
this.role = 'option';
|
|
22
|
+
}
|
|
23
|
+
disconnectedCallback() {}
|
|
24
|
+
static get observedAttributes() {
|
|
25
|
+
return ['value'];
|
|
26
|
+
}
|
|
27
|
+
attributeChangedCallback(name, _, newVal) {
|
|
28
|
+
switch (name) {
|
|
29
|
+
case 'value':
|
|
30
|
+
{
|
|
31
|
+
updateAttribute(this.#$tooltip, 'text', newVal);
|
|
32
|
+
updateAttribute(this.#$swatch, 'name', newVal);
|
|
33
|
+
if (newVal !== null) {
|
|
34
|
+
this.#$wrapper.style.setProperty('--sinch-global-color-icon', getSwatchColorFg(newVal));
|
|
35
|
+
} else {
|
|
36
|
+
this.#$wrapper.style.removeProperty('--sinch-global-color-icon');
|
|
37
|
+
}
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
set value(value) {
|
|
43
|
+
updateAttribute(this, 'value', value);
|
|
44
|
+
}
|
|
45
|
+
get value() {
|
|
46
|
+
return getAttribute(this, 'value', '');
|
|
47
|
+
}
|
|
48
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TSinchElementReact } from '../types';
|
|
2
|
+
export type TSinchColorMenuOptionElement = HTMLElement & {
|
|
3
|
+
/** Value */
|
|
4
|
+
value: string;
|
|
5
|
+
/** Value */
|
|
6
|
+
setAttribute(name: 'value', value: string): void;
|
|
7
|
+
};
|
|
8
|
+
export type TSinchColorMenuOptionReact = TSinchElementReact<TSinchColorMenuOptionElement> & {
|
|
9
|
+
/** Value */
|
|
10
|
+
value: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getParentOption: ($element: Element) => Element | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import '../text';
|
|
2
|
+
import type { TSinchColorSwatchElement, TSinchColorSwatchReact } from './types';
|
|
3
|
+
declare global {
|
|
4
|
+
namespace JSX {
|
|
5
|
+
interface IntrinsicElements {
|
|
6
|
+
'sinch-color-swatch': TSinchColorSwatchReact;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
'sinch-color-swatch': TSinchColorSwatchElement;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import '../text';
|
|
2
|
+
import { defineCustomElement, NectaryElement, setClass, getAttribute, updateAttribute } from '../utils';
|
|
3
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}#wrapper{width:var(--sinch-global-size-icon,32px);height:var(--sinch-global-size-icon,32px);border-radius:50%}#wrapper.no-color{background:linear-gradient(45deg,var(--sinch-ref-color-complementary-orange-200),var(--sinch-ref-color-complementary-bolt-200),var(--sinch-ref-color-complementary-grass-200),var(--sinch-ref-color-complementary-night-200),var(--sinch-ref-color-complementary-violet-200))}</style><div id="wrapper"></div>';
|
|
4
|
+
import { getSwatchColorBg } from './utils';
|
|
5
|
+
const template = document.createElement('template');
|
|
6
|
+
template.innerHTML = templateHTML;
|
|
7
|
+
defineCustomElement('sinch-color-swatch', class extends NectaryElement {
|
|
8
|
+
#$wrapper;
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
const shadowRoot = this.attachShadow();
|
|
12
|
+
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
13
|
+
this.#$wrapper = shadowRoot.querySelector('#wrapper');
|
|
14
|
+
}
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
super.connectedCallback();
|
|
17
|
+
this.#updateColor();
|
|
18
|
+
}
|
|
19
|
+
disconnectedCallback() {
|
|
20
|
+
super.disconnectedCallback();
|
|
21
|
+
}
|
|
22
|
+
static get observedAttributes() {
|
|
23
|
+
return ['name'];
|
|
24
|
+
}
|
|
25
|
+
attributeChangedCallback(name) {
|
|
26
|
+
switch (name) {
|
|
27
|
+
case 'name':
|
|
28
|
+
{
|
|
29
|
+
this.#updateColor();
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
get name() {
|
|
35
|
+
return getAttribute(this, 'name');
|
|
36
|
+
}
|
|
37
|
+
set name(value) {
|
|
38
|
+
updateAttribute(this, 'name', value);
|
|
39
|
+
}
|
|
40
|
+
#updateColor() {
|
|
41
|
+
if (!this.isDomConnected) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const colorName = this.name;
|
|
45
|
+
if (colorName !== null && colorName.length > 0) {
|
|
46
|
+
const bg = getSwatchColorBg(colorName);
|
|
47
|
+
this.#$wrapper.style.setProperty('background-color', bg);
|
|
48
|
+
setClass(this.#$wrapper, 'no-color', false);
|
|
49
|
+
} else {
|
|
50
|
+
this.#$wrapper.style.removeProperty('background-color');
|
|
51
|
+
setClass(this.#$wrapper, 'no-color', true);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TSinchElementReact } from '../types';
|
|
2
|
+
export type TSinchColorSwatchElement = HTMLElement & {
|
|
3
|
+
/** Color name */
|
|
4
|
+
name: string | null;
|
|
5
|
+
/** Color name */
|
|
6
|
+
setAttribute(name: 'name', value: string): void;
|
|
7
|
+
};
|
|
8
|
+
export type TSinchColorSwatchReact = TSinchElementReact<TSinchColorSwatchElement> & {
|
|
9
|
+
/** Color name */
|
|
10
|
+
name?: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/colors.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"colorHoney700": "#CC8800",
|
|
3
|
+
"colorHoney600": "#FFAA00",
|
|
4
|
+
"colorHoney500": "#FFBE3C",
|
|
5
|
+
"colorHoney400": "#FFCC66",
|
|
6
|
+
"colorHoney300": "#FFDF9E",
|
|
7
|
+
"colorHoney200": "#FCECCB",
|
|
8
|
+
"colorHoney100": "#FFF7E6",
|
|
9
|
+
"colorTropical700": "#003D3D",
|
|
10
|
+
"colorTropical600": "#005757",
|
|
11
|
+
"colorTropical500": "#007171",
|
|
12
|
+
"colorTropical400": "#059688",
|
|
13
|
+
"colorTropical300": "#66AAAA",
|
|
14
|
+
"colorTropical200": "#A7D5C2",
|
|
15
|
+
"colorTropical100": "#DCEDE1",
|
|
16
|
+
"colorTropical50": "#E5F1F1",
|
|
17
|
+
"colorStormy700": "#000000",
|
|
18
|
+
"colorStormy600": "#171717",
|
|
19
|
+
"colorStormy500": "#242424",
|
|
20
|
+
"colorStormy400": "#595959",
|
|
21
|
+
"colorStormy300": "#767676",
|
|
22
|
+
"colorStormy200": "#8C8C8C",
|
|
23
|
+
"colorStormy100": "#A6A6A6",
|
|
24
|
+
"colorOcean700": "#1B3E65",
|
|
25
|
+
"colorOcean600": "#1686CB",
|
|
26
|
+
"colorOcean500": "#3AA7EA",
|
|
27
|
+
"colorOcean400": "#6EBBEE",
|
|
28
|
+
"colorOcean300": "#A1D5F5",
|
|
29
|
+
"colorOcean200": "#C8E6F9",
|
|
30
|
+
"colorOcean100": "#DEF2FF",
|
|
31
|
+
"colorOcean50": "#F3FAFE",
|
|
32
|
+
"colorSnow700": "#CCCCCC",
|
|
33
|
+
"colorSnow600": "#D9D9D9",
|
|
34
|
+
"colorSnow500": "#E0E0E0",
|
|
35
|
+
"colorSnow400": "#F2F2F2",
|
|
36
|
+
"colorSnow200": "#F8F8F8",
|
|
37
|
+
"colorSnow100": "#FFFFFF",
|
|
38
|
+
"colorRaspberry700": "#882024",
|
|
39
|
+
"colorRaspberry600": "#D13D42",
|
|
40
|
+
"colorRaspberry500": "#EF5858",
|
|
41
|
+
"colorRaspberry400": "#F38686",
|
|
42
|
+
"colorRaspberry300": "#FFB8B8",
|
|
43
|
+
"colorRaspberry200": "#FBD5D5",
|
|
44
|
+
"colorRaspberry100": "#FFE8E4",
|
|
45
|
+
"colorRaspberry50": "#FFF6F5",
|
|
46
|
+
"colorNight700": "#1223a1",
|
|
47
|
+
"colorNight400": "#3247E9",
|
|
48
|
+
"colorNight200": "#D1D6FA",
|
|
49
|
+
"colorGrass700": "#006602",
|
|
50
|
+
"colorGrass400": "#39B93D",
|
|
51
|
+
"colorGrass200": "#B4E4B5",
|
|
52
|
+
"colorDirt700": "#363230",
|
|
53
|
+
"colorDirt400": "#828282",
|
|
54
|
+
"colorDirt200": "#E0DDDC",
|
|
55
|
+
"colorCandy700": "#981b77",
|
|
56
|
+
"colorCandy400": "#E467C3",
|
|
57
|
+
"colorCandy200": "#F6CBEA",
|
|
58
|
+
"colorMud700": "#6d4e46",
|
|
59
|
+
"colorMud400": "#8B6559",
|
|
60
|
+
"colorMud200": "#D7C6C1",
|
|
61
|
+
"colorOrange700": "#974302",
|
|
62
|
+
"colorOrange400": "#FF8C34",
|
|
63
|
+
"colorOrange200": "#FFD4B3",
|
|
64
|
+
"colorBolt700": "#805500",
|
|
65
|
+
"colorBolt400": "#FFBE3C",
|
|
66
|
+
"colorBolt200": "#FFE6B3",
|
|
67
|
+
"colorViolet700": "#4F1B98",
|
|
68
|
+
"colorViolet400": "#9E67E4",
|
|
69
|
+
"colorViolet200": "#DECBF6",
|
|
70
|
+
"colorOlive700": "#275D33",
|
|
71
|
+
"colorOlive400": "#46A65A",
|
|
72
|
+
"colorOlive200": "#D7F1D8",
|
|
73
|
+
"colorCeltic700": "#003B7E",
|
|
74
|
+
"colorCeltic400": "#2071CE",
|
|
75
|
+
"colorCeltic200": "#D5E5F8",
|
|
76
|
+
"colorJasper700": "#B71C1C",
|
|
77
|
+
"colorJasper400": "#F44336",
|
|
78
|
+
"colorJasper200": "#FFCDD2",
|
|
79
|
+
"colorPumpkin700": "#9C2E00",
|
|
80
|
+
"colorPumpkin400": "#F35B1C",
|
|
81
|
+
"colorPumpkin200": "#FFE8D6",
|
|
82
|
+
"colorColorSkinTone0": "#FFCC4D",
|
|
83
|
+
"colorColorSkinTone10": "#F7DECE",
|
|
84
|
+
"colorColorSkinTone20": "#F3D2A2",
|
|
85
|
+
"colorColorSkinTone30": "#D4AB88",
|
|
86
|
+
"colorColorSkinTone40": "#AF7E57",
|
|
87
|
+
"colorColorSkinTone50": "#7C533E"
|
|
88
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import '../icon-button';
|
|
2
|
+
import '../icon';
|
|
3
|
+
import '../text';
|
|
4
|
+
import type { TSinchDatePickerElement, TSinchDatePickerReact } from './types';
|
|
5
|
+
declare global {
|
|
6
|
+
namespace JSX {
|
|
7
|
+
interface IntrinsicElements {
|
|
8
|
+
'sinch-date-picker': TSinchDatePickerReact;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
interface HTMLElementTagNameMap {
|
|
12
|
+
'sinch-date-picker': TSinchDatePickerElement;
|
|
13
|
+
}
|
|
14
|
+
}
|