@nectary/components 0.34.0 → 0.35.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.js +35 -10
- package/accordion/types.d.ts +3 -2
- package/accordion-item/index.js +8 -4
- package/action-menu/index.js +7 -8
- package/action-menu/types.d.ts +3 -3
- package/action-menu-option/index.js +23 -3
- package/action-menu-option/types.d.ts +2 -0
- package/alert/index.js +1 -1
- package/avatar/index.js +1 -1
- package/button/index.js +68 -4
- package/button/types.d.ts +6 -0
- package/checkbox/index.js +64 -6
- package/checkbox/types.d.ts +8 -2
- package/date-picker/index.js +37 -12
- package/date-picker/types.d.ts +4 -2
- package/dialog/index.js +5 -6
- package/dialog/types.d.ts +3 -3
- package/dropdown/index.js +44 -28
- package/dropdown/types.d.ts +6 -4
- package/dropdown-checkbox-option/index.js +1 -1
- package/dropdown-checkbox-option/types.d.ts +0 -2
- package/dropdown-radio-option/index.js +1 -1
- package/dropdown-radio-option/types.d.ts +0 -2
- package/dropdown-text-option/index.js +1 -1
- package/dropdown-text-option/types.d.ts +0 -2
- package/horizontal-stepper-item/index.js +1 -1
- package/icon-button/index.js +67 -3
- package/icon-button/types.d.ts +6 -0
- package/icons/create-icon-class.js +1 -1
- package/icons-branded/create-icon-class.js +3 -7
- package/icons-branded/types.d.ts +3 -0
- package/icons-channel/create-icon-class.js +3 -7
- package/icons-channel/types.d.ts +3 -0
- package/input/index.d.ts +0 -1
- package/input/index.js +58 -5
- package/input/types.d.ts +8 -2
- package/link/index.js +81 -3
- package/link/types.d.ts +9 -0
- package/package.json +1 -1
- package/pagination/index.js +24 -8
- package/pagination/types.d.ts +3 -1
- package/popover/index.js +5 -6
- package/popover/types.d.ts +4 -3
- package/radio/index.js +36 -8
- package/radio/types.d.ts +3 -1
- package/radio-option/index.js +1 -1
- package/search/types.d.ts +0 -1
- package/segment-collapse/index.js +28 -12
- package/segment-collapse/types.d.ts +3 -1
- package/segmented-control/index.js +28 -23
- package/segmented-control/types.d.ts +3 -2
- package/segmented-control-option/index.js +59 -13
- package/segmented-control-option/types.d.ts +4 -0
- package/segmented-icon-control/index.js +27 -16
- package/segmented-icon-control/types.d.ts +5 -2
- package/segmented-icon-control-option/index.js +54 -12
- package/segmented-icon-control-option/types.d.ts +4 -0
- package/select/index.js +68 -9
- package/select/types.d.ts +8 -2
- package/tabs/index.js +32 -8
- package/tabs/types.d.ts +3 -2
- package/tabs-option/index.js +2 -2
- package/textarea/index.js +58 -4
- package/textarea/types.d.ts +7 -2
- package/tile-control/index.d.ts +11 -0
- package/tile-control/index.js +181 -0
- package/tile-control/types.d.ts +38 -0
- package/tile-control/types.js +1 -0
- package/tile-control-option/index.d.ts +11 -0
- package/tile-control-option/index.js +161 -0
- package/tile-control-option/types.d.ts +37 -0
- package/tile-control-option/types.js +1 -0
- package/time-picker/index.js +17 -3
- package/time-picker/types.d.ts +4 -2
- package/toggle/index.js +63 -5
- package/toggle/types.d.ts +3 -1
package/time-picker/types.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare type TSinchTimePickerElement = HTMLElement & {
|
|
|
11
11
|
hourDigitRect(hour: number): TRect | null;
|
|
12
12
|
minuteDigitRect(minute: number): TRect | null;
|
|
13
13
|
/** Change value handler, return time in ISO 8601 format */
|
|
14
|
-
addEventListener(type: 'change', listener: (e: CustomEvent<string>) => void): void;
|
|
14
|
+
addEventListener(type: '-change', listener: (e: CustomEvent<string>) => void): void;
|
|
15
15
|
/** Time value in ISO 8601 format */
|
|
16
16
|
setAttribute(name: 'value', value: string): void;
|
|
17
17
|
/** AM/PM 12-hour clock system, `false` by default */
|
|
@@ -27,5 +27,7 @@ export declare type TSinchTimePickerReact = TSinchElementReact<TSinchTimePickerE
|
|
|
27
27
|
/** Submit button label that is used for a11y */
|
|
28
28
|
'submit-aria-label': string;
|
|
29
29
|
/** Change value handler, return time in ISO 8601 format */
|
|
30
|
-
onChange
|
|
30
|
+
onChange?: (e: SyntheticEvent<TSinchTimePickerElement, CustomEvent<string>>) => void;
|
|
31
|
+
/** Change value handler, return time in ISO 8601 format */
|
|
32
|
+
'on-change'?: (e: CustomEvent<string>) => void;
|
|
31
33
|
};
|
package/toggle/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
2
|
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
3
|
|
|
4
|
-
var _$input, _$label, _onInput;
|
|
4
|
+
var _$input, _$label, _onInput, _onCheckboxFocus, _onCheckboxBlur, _onChangeReactHandler, _onFocusReactHandler, _onBlurReactHandler;
|
|
5
5
|
|
|
6
6
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
7
7
|
|
|
8
8
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
9
|
|
|
10
|
-
import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
|
|
10
|
+
import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
|
|
11
11
|
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{display:flex;flex-direction:row;box-sizing:border-box;width:100%;height:32px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);text-align:initial}:host([small]:not([small=false])) #wrapper{font:var(--sinch-font-small-text)}#checkbox{all:initial;display:block;position:absolute;left:0;top:0;width:40px;height:20px;cursor:pointer;pointer-events:initial}#checkbox:disabled{cursor:initial}#knob-container{position:relative;box-sizing:border-box;align-self:center;width:40px;height:20px;border-radius:10px;pointer-events:none;padding:2px;background-color:var(--sinch-color-stormy-100);box-shadow:var(--sinch-elevation-level-1);overflow:hidden}:host([checked]:not([checked=false])) #knob-container{background-color:var(--sinch-color-tropical-500)}:host([small]:not([small=false])) #knob-container{width:32px;height:16px;border-radius:8px}#knob{position:relative;box-sizing:border-box;width:16px;height:16px;border-radius:50%;background-color:var(--sinch-color-snow-100);transform:translateX(0);transition:transform .1s ease-in-out}:host([checked]:not([checked=false])) #knob{transform:translateX(20px)}:host([small]:not([small=false])) #knob{width:12px;height:12px}:host([small]:not([small=false])[checked]:not([checked=false])) #knob{transform:translateX(16px)}#knob::after,#knob::before{color:var(--sinch-color-snow-100);text-transform:uppercase;font-size:8px;line-height:16px;display:none;position:absolute;top:0;padding:0 3px}#knob::before{content:"on";right:100%}#knob::after{content:"off";left:100%}:host([labeled]:not([labeled=false]):is(:not([small]),[small=false])) #knob::after,:host([labeled]:not([labeled=false]):is(:not([small]),[small=false])) #knob::before{display:block}@media (prefers-reduced-motion){#knob{transition:none}}#label{display:none;flex:1;align-self:center;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-left:8px}:host([text]:not([text=""])) #label{display:block}:host([disabled]:not([disabled=false])) #label{color:var(--sinch-color-stormy-200)}:host([disabled]:not([disabled=false])) #knob-container{background-color:var(--sinch-color-snow-700)}:host([checked]:not([checked=false])[disabled]:not([disabled=false])) #knob-container{background-color:var(--sinch-color-tropical-100)}</style><div id="wrapper"><div id="knob-container"><div id="knob"></div><input id="checkbox" type="checkbox"></div><label for="checkbox" id="label"></label></div>';
|
|
12
12
|
const template = document.createElement('template');
|
|
13
13
|
template.innerHTML = templateHTML;
|
|
14
|
-
defineCustomElement('sinch-toggle', (_$input = new WeakMap(), _$label = new WeakMap(), _onInput = new WeakMap(), class extends NectaryElement {
|
|
14
|
+
defineCustomElement('sinch-toggle', (_$input = new WeakMap(), _$label = new WeakMap(), _onInput = new WeakMap(), _onCheckboxFocus = new WeakMap(), _onCheckboxBlur = new WeakMap(), _onChangeReactHandler = new WeakMap(), _onFocusReactHandler = new WeakMap(), _onBlurReactHandler = new WeakMap(), class extends NectaryElement {
|
|
15
15
|
constructor() {
|
|
16
16
|
super();
|
|
17
17
|
|
|
@@ -37,6 +37,44 @@ defineCustomElement('sinch-toggle', (_$input = new WeakMap(), _$label = new Weak
|
|
|
37
37
|
detail: isChecked,
|
|
38
38
|
bubbles: true
|
|
39
39
|
}));
|
|
40
|
+
this.dispatchEvent(new CustomEvent('-change', {
|
|
41
|
+
detail: isChecked
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
_classPrivateFieldInitSpec(this, _onCheckboxFocus, {
|
|
47
|
+
writable: true,
|
|
48
|
+
value: () => {
|
|
49
|
+
this.dispatchEvent(new CustomEvent('-focus'));
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
_classPrivateFieldInitSpec(this, _onCheckboxBlur, {
|
|
54
|
+
writable: true,
|
|
55
|
+
value: () => {
|
|
56
|
+
this.dispatchEvent(new CustomEvent('-blur'));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
_classPrivateFieldInitSpec(this, _onChangeReactHandler, {
|
|
61
|
+
writable: true,
|
|
62
|
+
value: e => {
|
|
63
|
+
getReactEventHandler(this, 'on-change')?.(e);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
_classPrivateFieldInitSpec(this, _onFocusReactHandler, {
|
|
68
|
+
writable: true,
|
|
69
|
+
value: e => {
|
|
70
|
+
getReactEventHandler(this, 'on-focus')?.(e);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
_classPrivateFieldInitSpec(this, _onBlurReactHandler, {
|
|
75
|
+
writable: true,
|
|
76
|
+
value: e => {
|
|
77
|
+
getReactEventHandler(this, 'on-blur')?.(e);
|
|
40
78
|
}
|
|
41
79
|
});
|
|
42
80
|
|
|
@@ -46,13 +84,33 @@ defineCustomElement('sinch-toggle', (_$input = new WeakMap(), _$label = new Weak
|
|
|
46
84
|
_classPrivateFieldSet(this, _$input, shadowRoot.querySelector('input'));
|
|
47
85
|
|
|
48
86
|
_classPrivateFieldSet(this, _$label, shadowRoot.querySelector('label'));
|
|
49
|
-
|
|
50
|
-
_classPrivateFieldGet(this, _$input).addEventListener('input', _classPrivateFieldGet(this, _onInput));
|
|
51
87
|
}
|
|
52
88
|
|
|
53
89
|
connectedCallback() {
|
|
54
90
|
this.setAttribute('role', 'checkbox');
|
|
55
91
|
this.setAttribute('aria-label', 'toggle');
|
|
92
|
+
|
|
93
|
+
_classPrivateFieldGet(this, _$input).addEventListener('input', _classPrivateFieldGet(this, _onInput));
|
|
94
|
+
|
|
95
|
+
_classPrivateFieldGet(this, _$input).addEventListener('focus', _classPrivateFieldGet(this, _onCheckboxFocus));
|
|
96
|
+
|
|
97
|
+
_classPrivateFieldGet(this, _$input).addEventListener('blur', _classPrivateFieldGet(this, _onCheckboxBlur));
|
|
98
|
+
|
|
99
|
+
this.addEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
|
|
100
|
+
this.addEventListener('-focus', _classPrivateFieldGet(this, _onFocusReactHandler));
|
|
101
|
+
this.addEventListener('-blur', _classPrivateFieldGet(this, _onBlurReactHandler));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
disconnectedCallback() {
|
|
105
|
+
_classPrivateFieldGet(this, _$input).removeEventListener('input', _classPrivateFieldGet(this, _onInput));
|
|
106
|
+
|
|
107
|
+
_classPrivateFieldGet(this, _$input).removeEventListener('focus', _classPrivateFieldGet(this, _onCheckboxFocus));
|
|
108
|
+
|
|
109
|
+
_classPrivateFieldGet(this, _$input).removeEventListener('blur', _classPrivateFieldGet(this, _onCheckboxBlur));
|
|
110
|
+
|
|
111
|
+
this.removeEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
|
|
112
|
+
this.removeEventListener('-focus', _classPrivateFieldGet(this, _onFocusReactHandler));
|
|
113
|
+
this.removeEventListener('-blur', _classPrivateFieldGet(this, _onBlurReactHandler));
|
|
56
114
|
}
|
|
57
115
|
|
|
58
116
|
static get observedAttributes() {
|
package/toggle/types.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare type TSinchToggleElement = HTMLElement & {
|
|
|
7
7
|
disabled: boolean;
|
|
8
8
|
text: string | null;
|
|
9
9
|
addEventListener(type: 'change', listener: (e: CustomEvent<boolean>) => void): void;
|
|
10
|
+
addEventListener(type: '-change', listener: (e: CustomEvent<boolean>) => void): void;
|
|
10
11
|
setAttribute(name: 'checked', value: ''): void;
|
|
11
12
|
setAttribute(name: 'small', value: ''): void;
|
|
12
13
|
setAttribute(name: 'labeled', value: ''): void;
|
|
@@ -20,5 +21,6 @@ export declare type TSinchToggleReact = TSinchElementReact<TSinchToggleElement>
|
|
|
20
21
|
disabled?: boolean;
|
|
21
22
|
text?: string;
|
|
22
23
|
'aria-label': string;
|
|
23
|
-
onChange
|
|
24
|
+
onChange?: (e: SyntheticEvent<TSinchToggleElement, CustomEvent<boolean>>) => void;
|
|
25
|
+
'on-change'?: (e: CustomEvent<boolean>) => void;
|
|
24
26
|
};
|