@nectary/components 0.23.0 → 0.24.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.
Files changed (67) hide show
  1. package/accordion/index.js +3 -6
  2. package/accordion-item/index.js +3 -6
  3. package/alert/index.js +3 -5
  4. package/alert-button/index.js +3 -6
  5. package/alert-close/index.js +3 -6
  6. package/avatar/index.js +3 -5
  7. package/avatar-badge/index.js +3 -5
  8. package/avatar-status/index.js +3 -5
  9. package/button/index.js +3 -6
  10. package/card/index.js +3 -6
  11. package/card-button/index.js +3 -6
  12. package/card-container/index.js +3 -6
  13. package/card-link/index.js +3 -6
  14. package/chat/index.js +3 -6
  15. package/chat-avatar/index.js +3 -6
  16. package/chat-block/index.js +3 -6
  17. package/chat-bubble/index.js +3 -6
  18. package/checkbox/index.js +3 -6
  19. package/dialog/index.d.ts +2 -3
  20. package/dialog/index.js +3 -6
  21. package/dropdown/index.js +4 -7
  22. package/dropdown-option/index.d.ts +2 -1
  23. package/dropdown-option/index.js +4 -6
  24. package/grid/index.js +3 -5
  25. package/grid-item/index.js +3 -5
  26. package/help-tooltip/index.js +3 -5
  27. package/icon-button/index.js +3 -6
  28. package/icons/create-icon-class.d.ts +1 -1
  29. package/icons/create-icon-class.js +3 -5
  30. package/icons-branded/create-icon-class.d.ts +1 -1
  31. package/icons-branded/create-icon-class.js +3 -5
  32. package/icons-channel/create-icon-class.d.ts +1 -1
  33. package/icons-channel/create-icon-class.js +3 -5
  34. package/illustration/create-illustration-class.d.ts +1 -1
  35. package/illustration/create-illustration-class.js +3 -5
  36. package/input/index.js +3 -6
  37. package/link/index.js +5 -26
  38. package/logo/create-logo-class.d.ts +1 -1
  39. package/logo/create-logo-class.js +3 -5
  40. package/package.json +1 -1
  41. package/pagination/index.d.ts +4 -1
  42. package/pagination/index.js +17 -6
  43. package/popover/index.js +3 -6
  44. package/radio/index.js +3 -6
  45. package/radio-option/index.js +3 -6
  46. package/search/index.js +4 -7
  47. package/search-option/index.js +3 -5
  48. package/segment/index.js +3 -6
  49. package/segment-collapse/index.js +3 -5
  50. package/select/index.js +22 -8
  51. package/spinner/index.js +3 -5
  52. package/table/index.js +3 -5
  53. package/table-body/index.js +3 -5
  54. package/table-cell/index.js +3 -5
  55. package/table-head/index.js +3 -5
  56. package/table-head-cell/index.js +3 -5
  57. package/table-row/index.js +3 -5
  58. package/tabs/index.js +3 -6
  59. package/tabs-option/index.js +4 -7
  60. package/tag/index.js +3 -5
  61. package/tag-close/index.js +3 -6
  62. package/textarea/index.js +3 -6
  63. package/title/index.js +3 -6
  64. package/toggle/index.js +3 -6
  65. package/tooltip/index.js +3 -5
  66. package/utils.d.ts +10 -3
  67. package/utils.js +22 -14
@@ -7,14 +7,14 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
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, updateAttribute, updateBooleanAttribute } from '../utils';
10
+ import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute } from '../utils';
11
11
  const templateHTML = '<style>:host{--sinch-color-radio-outer-circle:var(--sinch-color-transparent);--sinch-color-radio-background:var(--sinch-color-snow-100);--sinch-color-radio-border:var(--sinch-color-stormy-300);--sinch-color-radio-outer-circle-checked:var(--sinch-color-transparent);--sinch-color-radio-border-checked:var(--sinch-color-tropical-500);--sinch-color-radio-outer-circle-hover:var(--sinch-color-snow-500);--sinch-color-radio-border-hover:var(--sinch-color-stormy-300);--sinch-color-radio-outer-circle-hover-checked:var(--sinch-color-tropical-100);--sinch-color-radio-border-hover-checked:var(--sinch-color-tropical-500);--sinch-color-radio-outer-circle-focus:var(--sinch-color-snow-800);--sinch-color-radio-border-focus:var(--sinch-color-stormy-300);--sinch-color-radio-outer-circle-focus-checked:var(--sinch-color-tropical-200);--sinch-color-radio-border-focus-checked:var(--sinch-color-tropical-500);--sinch-color-radio-outer-circle-active:var(--sinch-color-stormy-100);--sinch-color-radio-border-active:var(--sinch-color-stormy-300);--sinch-color-radio-outer-circle-active-checked:var(--sinch-color-tropical-300);--sinch-color-radio-border-active-checked:var(--sinch-color-tropical-500);--sinch-color-radio-outer-circle-disabled:var(--sinch-color-transparent);--sinch-color-radio-border-disabled:var(--sinch-color-stormy-100);--sinch-color-radio-outer-circle-disabled-checked:var(--sinch-color-transparent);--sinch-color-radio-border-disabled-checked:var(--sinch-color-stormy-100);display:block;outline:0}#wrapper{display:flex;height:32px;box-sizing:border-box;width:100%}#input{all:initial;display:block;width:32px;height:32px;cursor:pointer}#input:disabled{cursor:initial}#icon-container{position:relative;width:32px;height:32px}#input::before{content:"";position:absolute;top:0;left:0;width:32px;height:32px;border-radius:50%;pointer-events:none;background-color:var(--sinch-color-radio-outer-circle);transition:background-color .1s linear}#input::after{content:"";position:absolute;top:6px;left:6px;width:20px;height:20px;border-radius:50%;pointer-events:none;background-color:var(--sinch-color-radio-background);box-shadow:0 0 0 2px var(--sinch-color-radio-border) inset;transition:background-color .1s linear}#icon-knob{position:absolute;left:11px;top:11px;width:10px;height:10px;border-radius:50%;transition:opacity .1s linear;opacity:0;background-color:var(--sinch-color-radio-border);pointer-events:none}@media (prefers-reduced-motion){#icon-knob,#input::after,#input::before{transition:none}}#label{align-self:center;flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-left:8px;font:var(--sinch-font-body);color:var(--sinch-color-text-default)}:host([disabled]:not([disabled=false])) #label{color:var(--sinch-color-stormy-200)}#input:checked::before{background-color:var(--sinch-color-radio-outer-circle-checked)}#input:checked::after{box-shadow:0 0 0 2px var(--sinch-color-radio-border-checked) inset}#input:checked~#icon-knob{opacity:1;background-color:var(--sinch-color-radio-border-checked)}#input:focus::before{background-color:var(--sinch-color-radio-outer-circle-focus)}#input:focus::after{box-shadow:0 0 0 2px var(--sinch-color-radio-border-focus) inset}#input:focus~#icon-knob{background-color:var(--sinch-color-radio-border-focus)}#input:hover::before{background-color:var(--sinch-color-radio-outer-circle-hover)}#input:hover::after{box-shadow:0 0 0 2px var(--sinch-color-radio-border-hover) inset}#input:hover~#icon-knob{background-color:var(--sinch-color-radio-border-hover)}#input:active::before{background-color:var(--sinch-color-radio-outer-circle-active)}#input:active::after{box-shadow:0 0 0 2px var(--sinch-color-radio-border-active) inset}#input:active~#icon-knob{background-color:var(--sinch-color-radio-border-active)}#input:disabled::before{background-color:var(--sinch-color-radio-outer-circle-disabled)}#input:disabled::after{box-shadow:0 0 0 2px var(--sinch-color-radio-border-disabled) inset}#input:disabled~#icon-knob{background-color:var(--sinch-color-radio-border-disabled)}#input:focus:checked::before{background-color:var(--sinch-color-radio-outer-circle-focus-checked)}#input:focus:checked::after{box-shadow:0 0 0 2px var(--sinch-color-radio-border-focus-checked) inset}#input:focus:checked~#icon-knob{opacity:1;background-color:var(--sinch-color-radio-border-focus-checked)}#input:hover:checked::before{background-color:var(--sinch-color-radio-outer-circle-hover-checked)}#input:hover:checked::after{box-shadow:0 0 0 2px var(--sinch-color-radio-border-hover-checked) inset}#input:hover:checked~#icon-knob{opacity:1;background-color:var(--sinch-color-radio-border-hover-checked)}#input:active:checked::before{background-color:var(--sinch-color-radio-outer-circle-active-checked)}#input:active:checked::after{box-shadow:0 0 0 2px var(--sinch-color-radio-border-active-checked) inset}#input:active:checked~#icon-knob{opacity:1;background-color:var(--sinch-color-radio-border-active-checked)}#input:disabled:checked::before{background-color:var(--sinch-color-radio-outer-circle-disabled-checked)}#input:disabled:checked::after{box-shadow:0 0 0 2px var(--sinch-color-radio-border-disabled-checked) inset}#input:disabled:checked~#icon-knob{opacity:1;background-color:var(--sinch-color-radio-border-disabled-checked)}</style><div id="wrapper"><div id="icon-container"><input id="input" type="radio"/><div id="icon-knob"></div></div><label for="input" id="label"></label></div>';
12
12
  export const isRadioOptionElement = element => {
13
13
  return element instanceof Element && element.tagName === 'SINCH-RADIO-OPTION';
14
14
  };
15
15
  const template = document.createElement('template');
16
16
  template.innerHTML = templateHTML;
17
- defineCustomElement('sinch-radio-option', (_$input = new WeakMap(), _$label = new WeakMap(), _onInput = new WeakMap(), class extends HTMLElement {
17
+ defineCustomElement('sinch-radio-option', (_$input = new WeakMap(), _$label = new WeakMap(), _onInput = new WeakMap(), class extends NectaryElement {
18
18
  constructor() {
19
19
  super();
20
20
 
@@ -40,10 +40,7 @@ defineCustomElement('sinch-radio-option', (_$input = new WeakMap(), _$label = ne
40
40
  }
41
41
  });
42
42
 
43
- const shadowRoot = this.attachShadow({
44
- mode: 'closed',
45
- delegatesFocus: true
46
- });
43
+ const shadowRoot = this.attachShadow();
47
44
  shadowRoot.appendChild(template.content.cloneNode(true));
48
45
 
49
46
  _classPrivateFieldSet(this, _$input, shadowRoot.querySelector('input'));
package/search/index.js CHANGED
@@ -12,7 +12,7 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
12
12
  function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
13
13
 
14
14
  import { isSearchOptionElement } from '../search-option';
15
- import { attrValueToPixels, defineCustomElement, getAttribute, getIntegerAttribute, getRect, updateAttribute, updateIntegerAttribute } from '../utils';
15
+ import { attrValueToPixels, defineCustomElement, getAttribute, getIntegerAttribute, getRect, NectaryElement, updateAttribute, updateIntegerAttribute } from '../utils';
16
16
  const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;width:100%;box-sizing:border-box;--sinch-size-icon:24px}#label{display:none;font:var(--sinch-font-title-s);color:var(--sinch-color-text-default);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%;height:24px;margin-bottom:2px}#input{all:initial;display:block;border:1px solid var(--sinch-color-stormy-200);box-sizing:border-box;border-radius:4px;width:100%;height:48px;padding:0 44px;padding-right:12px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);caret-color:var(--sinch-caret-color,auto);background-color:var(--sinch-color-snow-100)}#input::placeholder{font:var(--sinch-font-body);color:var(--sinch-color-text-muted)}#input:focus{border-color:var(--sinch-color-stormy-600)}#icon-search{position:absolute;left:12px;top:12px;pointer-events:none;--sinch-color-icon:var(--sinch-color-stormy-500)}#clear{position:absolute;right:8px;top:8px;display:none;--sinch-color-icon:red}#clear:focus{--sinch-color-icon:var(--sinch-color-stormy-500)}:host([value]:not([value=""])) #clear{display:flex}:host([value]:not([value=""])) #input{padding-right:44px}#listbox{display:none;position:absolute;z-index:1;left:0;top:calc(100% + 8px);width:100%;box-sizing:border-box;font:var(--sinch-font-body);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-100);box-shadow:1px 2px 4px rgba(0,0,0,.15);overflow-y:auto;contain:content}:host([aria-expanded=true]) #listbox{display:block}:host([label]:not([label=""])) #label{display:block}</style><label id="label" for="input"></label><div id="wrapper"><input id="input" type="text"/><sinch-icon-search id="icon-search"></sinch-icon-search><sinch-icon-button id="clear" small><sinch-icon-close id="icon-close" slot="icon"></sinch-icon-close></sinch-icon-button><div id="listbox"><slot name="option"></slot></div></div>';
17
17
  import '../icons/search';
18
18
  import '../icons/close';
@@ -31,7 +31,7 @@ const findSelectedOption = elements => {
31
31
 
32
32
  const template = document.createElement('template');
33
33
  template.innerHTML = templateHTML;
34
- defineCustomElement('sinch-search', (_$label = new WeakMap(), _$input = new WeakMap(), _selectionStart = new WeakMap(), _selectionEnd = new WeakMap(), _$optionSlot = new WeakMap(), _$listbox = new WeakMap(), _$clear = new WeakMap(), _isPendingDk = new WeakMap(), _onCompositionStart = new WeakMap(), _onInput = new WeakMap(), _onValueChange = new WeakSet(), _onClearMouseDown = new WeakMap(), _onClear = new WeakMap(), _onInputFocus = new WeakMap(), _onInputBlur = new WeakMap(), _onListboxClick = new WeakMap(), _onListboxKeyPress = new WeakMap(), _onListboxKeyDown = new WeakMap(), _onOptionSlotChange = new WeakMap(), _onExpand = new WeakSet(), _onCollapse = new WeakSet(), _getFirstOption = new WeakSet(), _getLastOption = new WeakSet(), _getNextOption = new WeakSet(), _getPrevOption = new WeakSet(), _selectOption = new WeakSet(), _getOptionElements = new WeakSet(), class extends HTMLElement {
34
+ defineCustomElement('sinch-search', (_$label = new WeakMap(), _$input = new WeakMap(), _selectionStart = new WeakMap(), _selectionEnd = new WeakMap(), _$optionSlot = new WeakMap(), _$listbox = new WeakMap(), _$clear = new WeakMap(), _isPendingDk = new WeakMap(), _onCompositionStart = new WeakMap(), _onInput = new WeakMap(), _onValueChange = new WeakSet(), _onClearMouseDown = new WeakMap(), _onClear = new WeakMap(), _onInputFocus = new WeakMap(), _onInputBlur = new WeakMap(), _onListboxClick = new WeakMap(), _onListboxKeyPress = new WeakMap(), _onListboxKeyDown = new WeakMap(), _onOptionSlotChange = new WeakMap(), _onExpand = new WeakSet(), _onCollapse = new WeakSet(), _getFirstOption = new WeakSet(), _getLastOption = new WeakSet(), _getNextOption = new WeakSet(), _getPrevOption = new WeakSet(), _selectOption = new WeakSet(), _getOptionElements = new WeakSet(), class extends NectaryElement {
35
35
  constructor() {
36
36
  super();
37
37
 
@@ -217,10 +217,7 @@ defineCustomElement('sinch-search', (_$label = new WeakMap(), _$input = new Weak
217
217
  }
218
218
  });
219
219
 
220
- const shadowRoot = this.attachShadow({
221
- mode: 'closed',
222
- delegatesFocus: true
223
- });
220
+ const shadowRoot = this.attachShadow();
224
221
  shadowRoot.appendChild(template.content.cloneNode(true));
225
222
 
226
223
  _classPrivateFieldSet(this, _$input, shadowRoot.querySelector('#input'));
@@ -449,7 +446,7 @@ function _onValueChange2(nextValue) {
449
446
  function _onExpand2() {
450
447
  const elems = _classPrivateMethodGet(this, _getOptionElements, _getOptionElements2).call(this);
451
448
 
452
- if (elems.length === 0 || document.activeElement !== this) {
449
+ if (elems.length === 0 || this.getRootNode().activeElement !== this) {
453
450
  _classPrivateMethodGet(this, _onCollapse, _onCollapse2).call(this);
454
451
 
455
452
  return;
@@ -5,14 +5,14 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
5
5
 
6
6
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
7
7
 
8
- import { defineCustomElement, getAttribute, getBooleanAttribute, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
8
+ import { defineCustomElement, getAttribute, getBooleanAttribute, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
9
9
  const templateHTML = '<style>:host{display:block}#wrapper{display:block;box-sizing:border-box;line-height:40px;padding:0 12px;width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host(:hover)>#wrapper,:host([data-selected])>#wrapper{background-color:var(--sinch-color-snow-500)}</style><div id="wrapper"></div>';
10
10
  const template = document.createElement('template');
11
11
  template.innerHTML = templateHTML;
12
12
 
13
13
  var _$content = new WeakMap();
14
14
 
15
- class SearchOption extends HTMLElement {
15
+ class SearchOption extends NectaryElement {
16
16
  constructor() {
17
17
  super();
18
18
 
@@ -21,9 +21,7 @@ class SearchOption extends HTMLElement {
21
21
  value: void 0
22
22
  });
23
23
 
24
- const shadowRoot = this.attachShadow({
25
- mode: 'closed'
26
- });
24
+ const shadowRoot = this.attachShadow();
27
25
  shadowRoot.appendChild(template.content.cloneNode(true));
28
26
 
29
27
  _classPrivateFieldSet(this, _$content, shadowRoot.querySelector('#wrapper'));
package/segment/index.js CHANGED
@@ -7,11 +7,11 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
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, updateAttribute, updateBooleanAttribute } from '../utils';
10
+ import { defineCustomElement, getAttribute, getBooleanAttribute, NectaryElement, updateAttribute, updateBooleanAttribute } from '../utils';
11
11
  const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:column;width:100%;height:100%;border-radius:4px;box-sizing:border-box;background-color:var(--sinch-color-snow-100);color:var(--sinch-color-text-default);font:var(--sinch-font-body);border:none;box-shadow:1px 2px 8px rgba(0,0,0,.1)}#header{position:relative;display:flex;flex-direction:row;align-items:center;gap:16px;height:32px;padding:24px 32px 16px;--sinch-size-icon:32px}#caption{font:var(--sinch-font-title-l);color:var(--sinch-color-text-default);flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#content-wrapper{padding:0 32px;flex:1;min-height:0;overflow:auto}#action{display:flex;flex-direction:row;justify-content:flex-end;gap:16px;padding:16px 32px 24px}#info{position:relative;display:flex;flex-direction:row;align-items:center;gap:16px;z-index:1}:host([collapsed]:not([collapsed=false])) :is(#content-wrapper,#action){display:none}:host([collapsed]:not([collapsed=false])) #header{padding-bottom:24px}</style><div id="wrapper"><div id="header"><slot name="icon"></slot><span id="caption"></span><div id="info"><slot name="info"></slot></div><slot name="collapse"></slot></div><div id="content-wrapper"><slot name="content"></slot></div><div id="action"><slot name="action"></slot></div></div>';
12
12
  const template = document.createElement('template');
13
13
  template.innerHTML = templateHTML;
14
- defineCustomElement('sinch-segment', (_$caption = new WeakMap(), class extends HTMLElement {
14
+ defineCustomElement('sinch-segment', (_$caption = new WeakMap(), class extends NectaryElement {
15
15
  constructor() {
16
16
  super();
17
17
 
@@ -20,10 +20,7 @@ defineCustomElement('sinch-segment', (_$caption = new WeakMap(), class extends H
20
20
  value: void 0
21
21
  });
22
22
 
23
- const shadowRoot = this.attachShadow({
24
- mode: 'closed',
25
- delegatesFocus: true
26
- });
23
+ const shadowRoot = this.attachShadow();
27
24
  shadowRoot.appendChild(template.content.cloneNode(true));
28
25
 
29
26
  _classPrivateFieldSet(this, _$caption, shadowRoot.querySelector('#caption'));
@@ -10,11 +10,11 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
10
10
 
11
11
  import '../icons/expand-less';
12
12
  import '../icons/expand-more';
13
- import { defineCustomElement, getBooleanAttribute, isAttrTrue, updateBooleanAttribute } from '../utils';
13
+ import { defineCustomElement, getBooleanAttribute, isAttrTrue, NectaryElement, updateBooleanAttribute } from '../utils';
14
14
  const templateHTML = '<style>:host{display:contents;--sinch-size-icon:32px}input{all:initial;position:absolute;left:0;top:0;width:100%;height:100%;box-sizing:border-box;cursor:pointer}input:focus~sinch-icon-expand-less,input:focus~sinch-icon-expand-more{border-radius:4px;box-shadow:0 0 0 1px var(--sinch-color-stormy-500) inset}#up{display:block}#down{display:none}:host([value]:not([value=false])) #up{display:none}:host([value]:not([value=false])) #down{display:block}</style><input type="checkbox"/><sinch-icon-expand-less id="up"></sinch-icon-expand-less><sinch-icon-expand-more id="down"></sinch-icon-expand-more>';
15
15
  const template = document.createElement('template');
16
16
  template.innerHTML = templateHTML;
17
- defineCustomElement('sinch-segment-collapse', (_$input = new WeakMap(), class extends HTMLElement {
17
+ defineCustomElement('sinch-segment-collapse', (_$input = new WeakMap(), class extends NectaryElement {
18
18
  constructor() {
19
19
  super();
20
20
 
@@ -35,9 +35,7 @@ defineCustomElement('sinch-segment-collapse', (_$input = new WeakMap(), class ex
35
35
  }));
36
36
  });
37
37
 
38
- const shadowRoot = this.attachShadow({
39
- mode: 'closed'
40
- });
38
+ const shadowRoot = this.attachShadow();
41
39
  shadowRoot.appendChild(template.content.cloneNode(true));
42
40
 
43
41
  _classPrivateFieldSet(this, _$input, shadowRoot.querySelector('input'));
package/select/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
2
2
  import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
3
3
 
4
- var _$button, _$buttonContent, _$label, _$optionalText, _$additionalText, _$invalidText, _$dropdown, _$optionSlot, _updateButtonContent, _onValueChange, _getOptionWithValue, _onLabelClick, _onDropdownClick, _onDropdownClose;
4
+ var _$button, _$buttonContent, _$label, _$optionalText, _$additionalText, _$invalidText, _$dropdown, _$optionSlot, _$sh, _createElement, _updateButtonContent, _onValueChange, _getOptionWithValue, _onLabelClick, _onDropdownClick, _onDropdownClose;
5
5
 
6
6
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
7
7
 
@@ -14,11 +14,11 @@ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(
14
14
  import { isDropdownOptionElement } from '../dropdown-option';
15
15
  import '../select-option';
16
16
  import '../dropdown';
17
- import { defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, isAttrTrue, updateAttribute, updateBooleanAttribute, updateIntegerAttribute } from '../utils';
17
+ import { defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateIntegerAttribute } from '../utils';
18
18
  const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0;--sinch-color-icon:var(--sinch-color-stormy-500)}#wrapper{position:relative}sinch-dropdown{display:block}#button{all:initial;display:flex;align-items:center;gap:8px;border:1px solid var(--sinch-color-stormy-200);border-radius:4px;box-sizing:border-box;width:100%;height:48px;margin:2px 0;padding:8px 12px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-100);cursor:pointer}#button:focus{border-color:var(--sinch-color-stormy-600)}#dropdown-icon{fill:var(--sinch-color-stormy-500)}#button>*{pointer-events:none}#button[data-unselected]{color:var(--sinch-color-text-muted)}#button:disabled{border-color:var(--sinch-color-snow-500);color:var(--sinch-color-stormy-100);cursor:initial}#button:disabled #dropdown-icon{fill:var(--sinch-color-stormy-100)}:host([invalidtext]:not([invalidtext=""])) #button:not(:disabled){border-color:var(--sinch-color-text-invalid)}#content{flex:1;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}#bottom,#top{display:flex;align-items:baseline}#top{height:24px}#bottom{height:20px}#additional,#invalid,#label,#optional{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#label{font:var(--sinch-font-title-s);color:var(--sinch-color-text-default)}#optional{flex:1;text-align:right;font:var(--sinch-font-small-text);color:var(--sinch-color-text-muted)}#additional{flex:1;text-align:right;font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-muted)}#invalid{font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-invalid)}::slotted(sinch-help-tooltip){align-self:center;margin:0 8px}:host([disabled]:not([disabled=false])) :is(#label,#additional,#optional,#invalid){color:var(--sinch-color-stormy-100)}:host([disabled]:not([disabled=false])){--sinch-color-icon:var(--sinch-color-stormy-100)}#listbox{position:absolute;left:0;top:0;padding-top:74px;width:100%;display:none;list-style:none;outline:0;z-index:1}#listbox-body{font:var(--sinch-font-body);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-100);border:1px solid var(--sinch-color-stormy-500);border-top-width:0;border-bottom-left-radius:2px;border-bottom-right-radius:2px;width:100%;box-sizing:border-box;box-shadow:1px 2px 4px rgba(0,0,0,.15);overflow-y:auto}#button[aria-expanded=true]~#listbox{display:block}</style><div id="wrapper"><div id="top"><label id="label" for="dropdown"></label><slot name="tooltip"></slot><span id="optional"></span></div><sinch-dropdown id="dropdown"><button slot="target" id="button"><span id="content"></span> <svg id="dropdown-icon" width="12" height="8" aria-hidden="true"><path d="M1.41.59 6 5.17 10.59.59 12 2 6 8 0 2 1.41.59Z"/></svg></button><slot name="option" slot="option"></slot></sinch-dropdown><div id="bottom"><span id="invalid"></span> <span id="additional"></span></div></div>';
19
19
  const template = document.createElement('template');
20
20
  template.innerHTML = templateHTML;
21
- defineCustomElement('sinch-select', (_$button = new WeakMap(), _$buttonContent = new WeakMap(), _$label = new WeakMap(), _$optionalText = new WeakMap(), _$additionalText = new WeakMap(), _$invalidText = new WeakMap(), _$dropdown = new WeakMap(), _$optionSlot = new WeakMap(), _updateButtonContent = new WeakSet(), _onValueChange = new WeakMap(), _getOptionWithValue = new WeakSet(), _onLabelClick = new WeakMap(), _onDropdownClick = new WeakMap(), _onDropdownClose = new WeakMap(), class extends HTMLElement {
21
+ defineCustomElement('sinch-select', (_$button = new WeakMap(), _$buttonContent = new WeakMap(), _$label = new WeakMap(), _$optionalText = new WeakMap(), _$additionalText = new WeakMap(), _$invalidText = new WeakMap(), _$dropdown = new WeakMap(), _$optionSlot = new WeakMap(), _$sh = new WeakMap(), _createElement = new WeakSet(), _updateButtonContent = new WeakSet(), _onValueChange = new WeakMap(), _getOptionWithValue = new WeakSet(), _onLabelClick = new WeakMap(), _onDropdownClick = new WeakMap(), _onDropdownClose = new WeakMap(), class extends NectaryElement {
22
22
  constructor() {
23
23
  super();
24
24
 
@@ -26,6 +26,8 @@ defineCustomElement('sinch-select', (_$button = new WeakMap(), _$buttonContent =
26
26
 
27
27
  _classPrivateMethodInitSpec(this, _updateButtonContent);
28
28
 
29
+ _classPrivateMethodInitSpec(this, _createElement);
30
+
29
31
  _classPrivateFieldInitSpec(this, _$button, {
30
32
  writable: true,
31
33
  value: void 0
@@ -66,6 +68,11 @@ defineCustomElement('sinch-select', (_$button = new WeakMap(), _$buttonContent =
66
68
  value: void 0
67
69
  });
68
70
 
71
+ _classPrivateFieldInitSpec(this, _$sh, {
72
+ writable: true,
73
+ value: void 0
74
+ });
75
+
69
76
  _classPrivateFieldInitSpec(this, _onValueChange, {
70
77
  writable: true,
71
78
  value: e => {
@@ -98,12 +105,11 @@ defineCustomElement('sinch-select', (_$button = new WeakMap(), _$buttonContent =
98
105
  }
99
106
  });
100
107
 
101
- const shadowRoot = this.attachShadow({
102
- mode: 'closed',
103
- delegatesFocus: true
104
- });
108
+ const shadowRoot = this.attachShadow();
105
109
  shadowRoot.appendChild(template.content.cloneNode(true));
106
110
 
111
+ _classPrivateFieldSet(this, _$sh, shadowRoot);
112
+
107
113
  _classPrivateFieldSet(this, _$button, shadowRoot.querySelector('#button'));
108
114
 
109
115
  _classPrivateFieldSet(this, _$buttonContent, shadowRoot.querySelector('#content'));
@@ -289,6 +295,14 @@ defineCustomElement('sinch-select', (_$button = new WeakMap(), _$buttonContent =
289
295
 
290
296
  }));
291
297
 
298
+ function _createElement2(name) {
299
+ if (Reflect.has(_classPrivateFieldGet(this, _$sh), 'createElement')) {
300
+ return _classPrivateFieldGet(this, _$sh).createElement(name);
301
+ }
302
+
303
+ return document.createElement(name);
304
+ }
305
+
292
306
  function _updateButtonContent2() {
293
307
  if (_classPrivateFieldGet(this, _$button).firstElementChild !== _classPrivateFieldGet(this, _$buttonContent)) {
294
308
  _classPrivateFieldGet(this, _$button).removeChild(_classPrivateFieldGet(this, _$button).firstElementChild);
@@ -307,7 +321,7 @@ function _updateButtonContent2() {
307
321
  const $icon = $option.icon;
308
322
 
309
323
  if ($icon != null) {
310
- _classPrivateFieldGet(this, _$button).prepend($icon.cloneNode(true));
324
+ _classPrivateFieldGet(this, _$button).prepend(_classPrivateMethodGet(this, _createElement, _createElement2).call(this, $icon.tagName.toLowerCase()));
311
325
  }
312
326
  }
313
327
  }
package/spinner/index.js CHANGED
@@ -1,14 +1,12 @@
1
- import { defineCustomElement, getLiteralAttribute, updateLiteralAttribute } from '../utils';
1
+ import { defineCustomElement, getLiteralAttribute, NectaryElement, updateLiteralAttribute } from '../utils';
2
2
  const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}@keyframes spinner{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}div{animation:1.5s linear infinite spinner;animation-play-state:running;border:solid 3px var(--sinch-color-spinner-bg,#d4dadd);border-bottom-color:var(--sinch-color-spinner-fg,#0a273d);border-radius:50%;height:20px;width:20px;box-sizing:border-box;will-change:transform}:host([type=large]) div{height:46px;width:46px;border-width:4px}:host([type=small]) div{height:14px;width:14px;border-width:2px}:host([static]:not([static=false])) div{animation-play-state:paused}</style><div></div>';
3
3
  const spinnerTypes = ['large', 'medium', 'small'];
4
4
  const template = document.createElement('template');
5
5
  template.innerHTML = templateHTML;
6
- defineCustomElement('sinch-spinner', class extends HTMLElement {
6
+ defineCustomElement('sinch-spinner', class extends NectaryElement {
7
7
  constructor() {
8
8
  super();
9
- const shadowRoot = this.attachShadow({
10
- mode: 'closed'
11
- });
9
+ const shadowRoot = this.attachShadow();
12
10
  shadowRoot.appendChild(template.content.cloneNode(true));
13
11
  }
14
12
 
package/table/index.js CHANGED
@@ -1,13 +1,11 @@
1
- import { defineCustomElement } from '../utils';
1
+ import { defineCustomElement, NectaryElement } from '../utils';
2
2
  const templateHTML = '<style>:host{display:table;font:var(--sinch-font-body);color:var(--sinch-color-text-default)}</style><slot></slot>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
- defineCustomElement('sinch-table', class extends HTMLElement {
5
+ defineCustomElement('sinch-table', class extends NectaryElement {
6
6
  constructor() {
7
7
  super();
8
- const shadowRoot = this.attachShadow({
9
- mode: 'closed'
10
- });
8
+ const shadowRoot = this.attachShadow();
11
9
  shadowRoot.appendChild(template.content.cloneNode(true));
12
10
  }
13
11
 
@@ -1,13 +1,11 @@
1
- import { defineCustomElement } from '../utils';
1
+ import { defineCustomElement, NectaryElement } from '../utils';
2
2
  const templateHTML = '<style>:host{display:table-row-group}::slotted(sinch-table-row:hover){background-color:var(--sinch-color-tropical-50)}::slotted(sinch-table-row[selected]:not([selected=false])){background-color:var(--sinch-color-tropical-100)}</style><slot></slot>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
- defineCustomElement('sinch-table-body', class extends HTMLElement {
5
+ defineCustomElement('sinch-table-body', class extends NectaryElement {
6
6
  constructor() {
7
7
  super();
8
- const shadowRoot = this.attachShadow({
9
- mode: 'closed'
10
- });
8
+ const shadowRoot = this.attachShadow();
11
9
  shadowRoot.appendChild(template.content.cloneNode(true));
12
10
  }
13
11
 
@@ -1,14 +1,12 @@
1
- import { defineCustomElement, getLiteralAttribute, updateLiteralAttribute } from '../utils';
1
+ import { defineCustomElement, getLiteralAttribute, NectaryElement, updateLiteralAttribute } from '../utils';
2
2
  const templateHTML = '<style>:host{display:table-cell;vertical-align:top;border-bottom:1px solid var(--sinch-color-snow-600)}#wrapper{display:flex;flex-direction:column;justify-content:center;min-height:48px;box-sizing:border-box;padding:8px 4px}:host(:first-child) #wrapper{padding-left:8px}:host(:last-child) #wrapper{padding-right:8px}:host([align=end]) #wrapper{text-align:end;align-items:flex-end}:host([align=center]) #wrapper{text-align:center;align-items:center}</style><div id="wrapper"><slot></slot></div>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
5
  const alignValues = ['start', 'center', 'end'];
6
- defineCustomElement('sinch-table-cell', class extends HTMLElement {
6
+ defineCustomElement('sinch-table-cell', class extends NectaryElement {
7
7
  constructor() {
8
8
  super();
9
- const shadowRoot = this.attachShadow({
10
- mode: 'closed'
11
- });
9
+ const shadowRoot = this.attachShadow();
12
10
  shadowRoot.appendChild(template.content.cloneNode(true));
13
11
  }
14
12
 
@@ -1,13 +1,11 @@
1
- import { defineCustomElement } from '../utils';
1
+ import { defineCustomElement, NectaryElement } from '../utils';
2
2
  const templateHTML = '<style>:host{display:table-header-group}</style><slot></slot>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
- defineCustomElement('sinch-table-head', class extends HTMLElement {
5
+ defineCustomElement('sinch-table-head', class extends NectaryElement {
6
6
  constructor() {
7
7
  super();
8
- const shadowRoot = this.attachShadow({
9
- mode: 'closed'
10
- });
8
+ const shadowRoot = this.attachShadow();
11
9
  shadowRoot.appendChild(template.content.cloneNode(true));
12
10
  }
13
11
 
@@ -7,12 +7,12 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
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, getLiteralAttribute, updateAttribute, updateBooleanAttribute, updateLiteralAttribute } from '../utils';
10
+ import { defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, NectaryElement, updateAttribute, updateBooleanAttribute, updateLiteralAttribute } from '../utils';
11
11
  const templateHTML = '<style>:host{display:table-cell;border-bottom:1px solid var(--sinch-color-stormy-200);height:48px;vertical-align:middle;padding:0 6px;--sinch-color-icon:var(--sinch-color-stormy-200)}:host(:first-child){padding-left:8px}:host(:last-child){padding-right:8px}#wrapper{position:relative;display:flex;align-items:center;gap:8px;width:100%;height:100%;box-sizing:border-box;font:var(--sinch-font-title-s);color:var(--sinch-color-stormy-300);--sinch-icon-button-color:var(--sinch-color-stormy-100)}#text{flex-shrink:1;min-width:0;font:var(--sinch-font-title-s);color:var(--sinch-color-stormy-200);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host([align=center])>#wrapper{justify-content:center}:host([align=end])>#wrapper{justify-content:flex-end}:host(:is([text=""],:not([text])))>#wrapper{display:none}:host([fit]:not([fit=false])){width:1px}</style><slot name="checkbox"></slot><div id="wrapper"><slot name="left"></slot><span id="text"></span><slot name="tooltip"></slot><slot name="right"></slot></div>';
12
12
  const template = document.createElement('template');
13
13
  template.innerHTML = templateHTML;
14
14
  const alignValues = ['start', 'center', 'end'];
15
- defineCustomElement('sinch-table-head-cell', (_$text = new WeakMap(), class extends HTMLElement {
15
+ defineCustomElement('sinch-table-head-cell', (_$text = new WeakMap(), class extends NectaryElement {
16
16
  constructor() {
17
17
  super();
18
18
 
@@ -21,9 +21,7 @@ defineCustomElement('sinch-table-head-cell', (_$text = new WeakMap(), class exte
21
21
  value: void 0
22
22
  });
23
23
 
24
- const shadowRoot = this.attachShadow({
25
- mode: 'closed'
26
- });
24
+ const shadowRoot = this.attachShadow();
27
25
  shadowRoot.appendChild(template.content.cloneNode(true));
28
26
 
29
27
  _classPrivateFieldSet(this, _$text, shadowRoot.querySelector('#text'));
@@ -1,13 +1,11 @@
1
- import { defineCustomElement, getBooleanAttribute, updateBooleanAttribute } from '../utils';
1
+ import { defineCustomElement, getBooleanAttribute, NectaryElement, updateBooleanAttribute } from '../utils';
2
2
  const templateHTML = '<style>:host{display:table-row}:host([sticky]) ::slotted(sinch-table-head-cell){position:sticky;top:0;z-index:1;background-color:var(--sinch-color-snow-100)}</style><slot></slot>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
- defineCustomElement('sinch-table-row', class extends HTMLElement {
5
+ defineCustomElement('sinch-table-row', class extends NectaryElement {
6
6
  constructor() {
7
7
  super();
8
- const shadowRoot = this.attachShadow({
9
- mode: 'closed'
10
- });
8
+ const shadowRoot = this.attachShadow();
11
9
  shadowRoot.appendChild(template.content.cloneNode(true));
12
10
  }
13
11
 
package/tabs/index.js CHANGED
@@ -12,7 +12,7 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
12
12
  function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
13
13
 
14
14
  import { isTabsOptionElement } from '../tabs-option';
15
- import { defineCustomElement, getAttribute, updateAttribute } from '../utils';
15
+ import { defineCustomElement, getAttribute, NectaryElement, updateAttribute } from '../utils';
16
16
  const templateHTML = '<style>:host{display:block;outline:0}#wrapper{display:flex;flex-direction:row;height:60px;width:100%;box-sizing:border-box;overflow-x:auto}</style><div id="wrapper"><slot></slot></div>';
17
17
 
18
18
  const findSelectedOption = elements => {
@@ -21,7 +21,7 @@ const findSelectedOption = elements => {
21
21
 
22
22
  const template = document.createElement('template');
23
23
  template.innerHTML = templateHTML;
24
- defineCustomElement('sinch-tabs', (_$slot = new WeakMap(), _onOptionKeyDown = new WeakMap(), _onSlotChange = new WeakMap(), _onOptionChange = new WeakMap(), _onValueChange = new WeakSet(), _dispatchChangeEvent = new WeakSet(), _getFirstOption = new WeakSet(), _getLastOption = new WeakSet(), _getNextOption = new WeakSet(), _getPrevOption = new WeakSet(), _getEnabledRadioElements = new WeakSet(), class extends HTMLElement {
24
+ defineCustomElement('sinch-tabs', (_$slot = new WeakMap(), _onOptionKeyDown = new WeakMap(), _onSlotChange = new WeakMap(), _onOptionChange = new WeakMap(), _onValueChange = new WeakSet(), _dispatchChangeEvent = new WeakSet(), _getFirstOption = new WeakSet(), _getLastOption = new WeakSet(), _getNextOption = new WeakSet(), _getPrevOption = new WeakSet(), _getEnabledRadioElements = new WeakSet(), class extends NectaryElement {
25
25
  constructor() {
26
26
  super();
27
27
 
@@ -99,10 +99,7 @@ defineCustomElement('sinch-tabs', (_$slot = new WeakMap(), _onOptionKeyDown = ne
99
99
  }
100
100
  });
101
101
 
102
- const shadowRoot = this.attachShadow({
103
- mode: 'closed',
104
- delegatesFocus: true
105
- });
102
+ const shadowRoot = this.attachShadow();
106
103
  shadowRoot.appendChild(template.content.cloneNode(true));
107
104
  shadowRoot.addEventListener('keydown', _classPrivateFieldGet(this, _onOptionKeyDown));
108
105
  shadowRoot.addEventListener('change', _classPrivateFieldGet(this, _onOptionChange));
@@ -6,14 +6,14 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
6
6
 
7
7
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
8
8
 
9
- import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, updateAttribute, updateBooleanAttribute } from '../utils';
10
- const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}*{pointer-events:none}#wrapper{display:flex;flex-direction:row;align-items:center;gap:12px;position:relative;width:100%;height:42px;padding:8px 20px;box-sizing:border-box;box-shadow:0 1px 0 0 var(--sinch-color-stormy-100);color:var(--sinch-color-stormy-500);--sinch-color-icon:var(--sinch-color-stormy-500);--sinch-size-icon:16px}#content{font:var(--sinch-font-title-s);flex-shrink:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host([checked]) #wrapper{box-shadow:0 2px 0 0 var(--sinch-color-stormy-500)}input{all:initial;position:absolute;left:0;top:0;box-sizing:border-box;width:100%;height:100%;cursor:pointer}:host([disabled]:not([disabled=false])) #wrapper{color:var(--sinch-color-stormy-100);--sinch-color-icon:var(--sinch-color-stormy-100)}input:disabled{cursor:unset}</style><div id="wrapper"><slot name="icon"></slot><label for="input" id="content" aria-hidden="true"></label> <input id="input" type="radio" aria-hidden="true"/></div>';
9
+ import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute } from '../utils';
10
+ const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}:host()>*{pointer-events:none}#wrapper{display:flex;flex-direction:row;align-items:center;gap:12px;position:relative;width:100%;height:42px;padding:8px 20px;box-sizing:border-box;box-shadow:0 1px 0 0 var(--sinch-color-stormy-100);color:var(--sinch-color-stormy-500);--sinch-color-icon:var(--sinch-color-stormy-500);--sinch-size-icon:16px}#content{font:var(--sinch-font-title-s);flex-shrink:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host([checked]) #wrapper{box-shadow:0 2px 0 0 var(--sinch-color-stormy-500)}input{all:initial;position:absolute;left:0;top:0;box-sizing:border-box;width:100%;height:100%;cursor:pointer}:host([disabled]:not([disabled=false])) #wrapper{color:var(--sinch-color-stormy-100);--sinch-color-icon:var(--sinch-color-stormy-100)}input:disabled{cursor:unset}</style><div id="wrapper"><slot name="icon"></slot><label for="input" id="content" aria-hidden="true"></label> <input id="input" type="radio" aria-hidden="true"/></div>';
11
11
  export const isTabsOptionElement = element => {
12
12
  return element instanceof Element && element.tagName === 'SINCH-TABS-OPTION';
13
13
  };
14
14
  const template = document.createElement('template');
15
15
  template.innerHTML = templateHTML;
16
- defineCustomElement('sinch-tabs-option', (_onInput = new WeakMap(), class extends HTMLElement {
16
+ defineCustomElement('sinch-tabs-option', (_onInput = new WeakMap(), class extends NectaryElement {
17
17
  constructor() {
18
18
  super();
19
19
 
@@ -29,10 +29,7 @@ defineCustomElement('sinch-tabs-option', (_onInput = new WeakMap(), class extend
29
29
  }
30
30
  });
31
31
 
32
- const shadowRoot = this.attachShadow({
33
- mode: 'closed',
34
- delegatesFocus: true
35
- });
32
+ const shadowRoot = this.attachShadow();
36
33
  shadowRoot.appendChild(template.content.cloneNode(true));
37
34
  this.$input = shadowRoot.querySelector('input');
38
35
  this.$label = shadowRoot.querySelector('#content');
package/tag/index.js CHANGED
@@ -8,12 +8,12 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
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
10
  import '../icons/cancel';
11
- import { defineCustomElement, getBooleanAttribute, getAttribute, getLiteralAttribute, updateBooleanAttribute, updateAttribute, updateLiteralAttribute } from '../utils';
11
+ import { defineCustomElement, getBooleanAttribute, getAttribute, getLiteralAttribute, updateBooleanAttribute, updateAttribute, updateLiteralAttribute, NectaryElement } from '../utils';
12
12
  const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{display:flex;flex-direction:row;align-items:center;gap:4px;position:relative;padding:2px 8px;border-radius:12px;font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-600);width:100%;height:24px;box-sizing:border-box;--sinch-color-icon:var(--sinch-color-stormy-400);--sinch-size-icon:16px}:host([category=candy])>#wrapper{background-color:var(--sinch-color-candy-200)}:host([category=bolt])>#wrapper{background-color:var(--sinch-color-bolt-200)}:host([category=aqua])>#wrapper{background-color:var(--sinch-color-aqua-200)}:host([category=grass])>#wrapper{background-color:var(--sinch-color-grass-200)}:host([category=berry])>#wrapper{background-color:var(--sinch-color-berry-200)}:host([category=orange])>#wrapper{background-color:var(--sinch-color-orange-200)}:host([category=night])>#wrapper{background-color:var(--sinch-color-night-200)}:host([category=mud])>#wrapper{background-color:var(--sinch-color-mud-200)}:host([category=dirt])>#wrapper{background-color:var(--sinch-color-dirt-200)}:host([inverted]:not([inverted=false]))>#wrapper{background-color:var(--sinch-color-stormy-500);color:var(--sinch-color-snow-100);--sinch-color-icon:var(--sinch-color-snow-100)}:host([small]:not([small=false])) #wrapper{height:20px;border-radius:10px;padding:0 8px;--sinch-size-icon:14px}#text{text-overflow:ellipsis;white-space:nowrap;overflow:auto;flex:1}</style><div id="wrapper"><slot name="icon"></slot><span id="text"></span><slot name="close"></slot></div>';
13
13
  const categoryValues = ['candy', 'bolt', 'aqua', 'grass', 'berry', 'orange', 'night', 'mud', 'dirt'];
14
14
  const template = document.createElement('template');
15
15
  template.innerHTML = templateHTML;
16
- defineCustomElement('sinch-tag', (_$text = new WeakMap(), class extends HTMLElement {
16
+ defineCustomElement('sinch-tag', (_$text = new WeakMap(), class extends NectaryElement {
17
17
  constructor() {
18
18
  super();
19
19
 
@@ -22,9 +22,7 @@ defineCustomElement('sinch-tag', (_$text = new WeakMap(), class extends HTMLElem
22
22
  value: void 0
23
23
  });
24
24
 
25
- const shadowRoot = this.attachShadow({
26
- mode: 'closed'
27
- });
25
+ const shadowRoot = this.attachShadow();
28
26
  shadowRoot.appendChild(template.content.cloneNode(true));
29
27
 
30
28
  _classPrivateFieldSet(this, _$text, shadowRoot.querySelector('#text'));
@@ -8,11 +8,11 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
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
10
  import '../icons/cancel';
11
- import { defineCustomElement } from '../utils';
11
+ import { defineCustomElement, NectaryElement } from '../utils';
12
12
  const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;width:14px;height:14px}button{all:initial;position:absolute;display:flex;align-items:center;justify-content:center;width:24px;height:24px;box-sizing:border-box;left:50%;top:50%;transform:translateX(-50%) translateY(-50%);cursor:pointer}button>*{pointer-events:none}</style><div id="wrapper"><button aria-label="dismiss tag"><sinch-icon-cancel></sinch-icon-cancel></button></div>';
13
13
  const template = document.createElement('template');
14
14
  template.innerHTML = templateHTML;
15
- defineCustomElement('sinch-tag-close', (_$button = new WeakMap(), class extends HTMLElement {
15
+ defineCustomElement('sinch-tag-close', (_$button = new WeakMap(), class extends NectaryElement {
16
16
  constructor() {
17
17
  super();
18
18
 
@@ -21,10 +21,7 @@ defineCustomElement('sinch-tag-close', (_$button = new WeakMap(), class extends
21
21
  value: void 0
22
22
  });
23
23
 
24
- const shadowRoot = this.attachShadow({
25
- mode: 'closed',
26
- delegatesFocus: true
27
- });
24
+ const shadowRoot = this.attachShadow();
28
25
  shadowRoot.appendChild(template.content.cloneNode(true));
29
26
 
30
27
  _classPrivateFieldSet(this, _$button, shadowRoot.querySelector('button'));
package/textarea/index.js CHANGED
@@ -7,11 +7,11 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
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, getIntegerAttribute, isAttrTrue, updateAttribute, updateBooleanAttribute } from '../utils';
10
+ import { defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute } from '../utils';
11
11
  const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0;--sinch-color-icon:var(--sinch-color-stormy-500)}#wrapper{width:100%;box-sizing:border-box}#input{all:initial;border:1px solid var(--sinch-color-stormy-200);box-sizing:border-box;border-radius:4px;width:100%;margin:2px 0;padding:8px 12px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);caret-color:var(--sinch-caret-color,auto);background-color:var(--sinch-color-snow-100);resize:none}#input::placeholder{font:var(--sinch-font-body);color:var(--sinch-color-text-muted)}#input:disabled{border-color:var(--sinch-color-snow-500);color:var(--sinch-color-stormy-100)}#input:disabled::placeholder{color:var(--sinch-color-snow-500)}#input:focus{border-color:var(--sinch-color-stormy-600)}:host([resizable]:not([resizable=false])) #input{resize:vertical}:host([invalidtext]:not([invalidtext=""])) #input:not(:disabled){border-color:var(--sinch-color-text-invalid)}#bottom,#top{display:flex;align-items:baseline}#top{height:24px}#bottom{height:20px}#additional,#invalid,#label,#optional{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#label{font:var(--sinch-font-title-s);color:var(--sinch-color-text-default)}#optional{flex:1;text-align:right;font:var(--sinch-font-small-text);color:var(--sinch-color-text-muted)}#additional{flex:1;text-align:right;font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-muted)}#invalid{font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-invalid)}::slotted(sinch-help-tooltip){align-self:center;margin:0 8px}:host([disabled]:not([disabled=false])) :is(#label,#additional,#optional,#invalid){color:var(--sinch-color-stormy-100)}:host([disabled]:not([disabled=false])){--sinch-color-icon:var(--sinch-color-stormy-100)}</style><div id="wrapper"><div id="top"><label id="label" for="input"></label><slot name="tooltip"></slot><span id="optional"></span></div><textarea id="input"></textarea><div id="bottom"><span id="invalid"></span> <span id="additional"></span></div></div>';
12
12
  const template = document.createElement('template');
13
13
  template.innerHTML = templateHTML;
14
- defineCustomElement('sinch-textarea', (_$input = new WeakMap(), _$label = new WeakMap(), _$optionalText = new WeakMap(), _$additionalText = new WeakMap(), _$invalidText = new WeakMap(), _selectionStart = new WeakMap(), _selectionEnd = new WeakMap(), _isPendingDk = new WeakMap(), _onCompositionStart = new WeakMap(), _onInput = new WeakMap(), class extends HTMLElement {
14
+ defineCustomElement('sinch-textarea', (_$input = new WeakMap(), _$label = new WeakMap(), _$optionalText = new WeakMap(), _$additionalText = new WeakMap(), _$invalidText = new WeakMap(), _selectionStart = new WeakMap(), _selectionEnd = new WeakMap(), _isPendingDk = new WeakMap(), _onCompositionStart = new WeakMap(), _onInput = new WeakMap(), class extends NectaryElement {
15
15
  constructor() {
16
16
  super();
17
17
 
@@ -104,10 +104,7 @@ defineCustomElement('sinch-textarea', (_$input = new WeakMap(), _$label = new We
104
104
  }
105
105
  });
106
106
 
107
- const shadowRoot = this.attachShadow({
108
- mode: 'closed',
109
- delegatesFocus: true
110
- });
107
+ const shadowRoot = this.attachShadow();
111
108
  shadowRoot.appendChild(template.content.cloneNode(true));
112
109
 
113
110
  _classPrivateFieldSet(this, _$input, shadowRoot.querySelector('#input'));
package/title/index.js CHANGED
@@ -8,7 +8,7 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
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
10
  import '../icons/cancel';
11
- import { defineCustomElement, getAttribute, updateAttribute, updateLiteralAttribute, getLiteralAttribute } from '../utils';
11
+ import { defineCustomElement, getAttribute, updateAttribute, updateLiteralAttribute, getLiteralAttribute, NectaryElement } from '../utils';
12
12
  const templateHTML = '<style>:host{display:block}:host([type=xl])>*{font:var(--sinch-font-title-xl)}:host([type="l"])>*{font:var(--sinch-font-title-l)}:host([type="m"])>*{font:var(--sinch-font-title-m)}:host([type="s"])>*{font:var(--sinch-font-title-s)}:host([type=xs])>*{font:var(--sinch-font-title-xs)}</style><span id="text"></span>';
13
13
  const typeValues = ['xl', 'l', 'm', 's', 'xs'];
14
14
  const levelValues = ['1', '2', '3', '4', '5', '6'];
@@ -27,7 +27,7 @@ const assertType = value => {
27
27
 
28
28
  const template = document.createElement('template');
29
29
  template.innerHTML = templateHTML;
30
- defineCustomElement('sinch-title', (_$text = new WeakMap(), class extends HTMLElement {
30
+ defineCustomElement('sinch-title', (_$text = new WeakMap(), class extends NectaryElement {
31
31
  constructor() {
32
32
  super();
33
33
 
@@ -36,10 +36,7 @@ defineCustomElement('sinch-title', (_$text = new WeakMap(), class extends HTMLEl
36
36
  value: void 0
37
37
  });
38
38
 
39
- const shadowRoot = this.attachShadow({
40
- mode: 'closed',
41
- delegatesFocus: true
42
- });
39
+ const shadowRoot = this.attachShadow();
43
40
  shadowRoot.appendChild(template.content.cloneNode(true));
44
41
 
45
42
  _classPrivateFieldSet(this, _$text, shadowRoot.querySelector('#text'));
package/toggle/index.js CHANGED
@@ -7,11 +7,11 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
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, updateAttribute, updateBooleanAttribute } from '../utils';
10
+ import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute } 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);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 HTMLElement {
14
+ defineCustomElement('sinch-toggle', (_$input = new WeakMap(), _$label = new WeakMap(), _onInput = new WeakMap(), class extends NectaryElement {
15
15
  constructor() {
16
16
  super();
17
17
 
@@ -40,10 +40,7 @@ defineCustomElement('sinch-toggle', (_$input = new WeakMap(), _$label = new Weak
40
40
  }
41
41
  });
42
42
 
43
- const shadowRoot = this.attachShadow({
44
- mode: 'closed',
45
- delegatesFocus: true
46
- });
43
+ const shadowRoot = this.attachShadow();
47
44
  shadowRoot.appendChild(template.content.cloneNode(true));
48
45
 
49
46
  _classPrivateFieldSet(this, _$input, shadowRoot.querySelector('input'));