@nectary/components 0.23.0 → 0.25.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 (74) 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/colors.json +2 -0
  20. package/dialog/index.d.ts +2 -3
  21. package/dialog/index.js +3 -6
  22. package/dropdown/index.js +4 -7
  23. package/dropdown-option/index.d.ts +2 -1
  24. package/dropdown-option/index.js +4 -6
  25. package/grid/index.js +3 -5
  26. package/grid-item/index.js +3 -5
  27. package/help-tooltip/index.js +3 -5
  28. package/icon-button/index.js +3 -6
  29. package/icons/create-icon-class.d.ts +1 -1
  30. package/icons/create-icon-class.js +3 -5
  31. package/icons-branded/create-icon-class.d.ts +1 -1
  32. package/icons-branded/create-icon-class.js +3 -5
  33. package/icons-channel/create-icon-class.d.ts +1 -1
  34. package/icons-channel/create-icon-class.js +3 -5
  35. package/illustration/create-illustration-class.d.ts +1 -1
  36. package/illustration/create-illustration-class.js +3 -5
  37. package/index.d.ts +1 -0
  38. package/index.js +2 -1
  39. package/input/index.js +3 -6
  40. package/link/index.js +5 -26
  41. package/logo/create-logo-class.d.ts +1 -1
  42. package/logo/create-logo-class.js +3 -5
  43. package/package.json +3 -5
  44. package/pagination/index.d.ts +4 -1
  45. package/pagination/index.js +17 -6
  46. package/popover/index.js +3 -6
  47. package/radio/index.js +3 -6
  48. package/radio-option/index.js +3 -6
  49. package/search/index.js +38 -26
  50. package/search-option/index.js +3 -5
  51. package/segment/index.js +3 -6
  52. package/segment-collapse/index.js +13 -33
  53. package/segmented-control/index.d.ts +20 -0
  54. package/segmented-control/index.js +208 -0
  55. package/segmented-control-option/index.d.ts +29 -0
  56. package/segmented-control-option/index.js +112 -0
  57. package/select/index.js +22 -8
  58. package/spinner/index.js +3 -5
  59. package/table/index.js +3 -5
  60. package/table-body/index.js +3 -5
  61. package/table-cell/index.js +3 -5
  62. package/table-head/index.js +3 -5
  63. package/table-head-cell/index.js +3 -5
  64. package/table-row/index.js +3 -5
  65. package/tabs/index.js +4 -7
  66. package/tabs-option/index.js +12 -31
  67. package/tag/index.js +3 -5
  68. package/tag-close/index.js +3 -6
  69. package/textarea/index.js +3 -6
  70. package/title/index.js +3 -6
  71. package/toggle/index.js +3 -6
  72. package/tooltip/index.js +3 -5
  73. package/utils.d.ts +10 -3
  74. package/utils.js +22 -14
package/dropdown/index.js CHANGED
@@ -13,7 +13,7 @@ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(
13
13
 
14
14
  import dialogPolyfill from 'dialog-polyfill';
15
15
  import { isDropdownOptionElement } from '../dropdown-option';
16
- import { attrValueToPixels, defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, getLiteralAttribute, getReactEventHandler, getRect, isAttrTrue, updateAttribute, updateBooleanAttribute, updateIntegerAttribute, updateLiteralAttribute } from '../utils';
16
+ import { attrValueToPixels, defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, getLiteralAttribute, getReactEventHandler, getRect, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateIntegerAttribute, updateLiteralAttribute } from '../utils';
17
17
  const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;width:100%;box-sizing:border-box}dialog{outline:0;border:none;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;padding:0;border-radius:4px;cursor:pointer}dialog::backdrop{background-color:transparent}dialog+.backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background-color:transparent}dialog.fixed{position:fixed;top:50%;transform:translate(0,-50%)}._dialog_overlay{position:fixed;top:0;right:0;bottom:0;left:0}::slotted(*){display:block}</style><div id="wrapper"><div id="target" aria-haspopup="listbox" aria-expanded="false"><slot name="target"></slot></div><dialog id="listbox" tabindex="-1"><slot name="option"></slot></dialog></div>';
18
18
  const orientationValues = ['top-left', 'top-right', 'bottom-left', 'bottom-right'];
19
19
  const ITEM_HEIGHT = 40;
@@ -30,7 +30,7 @@ const findSelectedOption = elements => {
30
30
 
31
31
  const template = document.createElement('template');
32
32
  template.innerHTML = templateHTML;
33
- defineCustomElement('sinch-dropdown', (_$target = new WeakMap(), _$optionSlot = new WeakMap(), _$listbox = new WeakMap(), _isConnected = new WeakMap(), _onListboxClick = new WeakMap(), _onListboxKeyPress = new WeakMap(), _onListboxKeyDown = new WeakMap(), _onOptionSlotChange = new WeakMap(), _onExpand = new WeakSet(), _onCollapse = new WeakSet(), _isOpen = new WeakSet(), _updateOrientation = new WeakSet(), _onValueChange = new WeakSet(), _getFirstOption = new WeakSet(), _getLastOption = new WeakSet(), _getNextOption = new WeakSet(), _getPrevOption = new WeakSet(), _selectOption = new WeakSet(), _getOptionWithValue = new WeakSet(), _getOptionElements = new WeakSet(), _getEnabledOptionElements = new WeakSet(), _dispatchChangeEvent = new WeakSet(), _dispatchCloseEvent = new WeakSet(), _onCancel = new WeakMap(), _onCloseReactHandler = new WeakMap(), class extends HTMLElement {
33
+ defineCustomElement('sinch-dropdown', (_$target = new WeakMap(), _$optionSlot = new WeakMap(), _$listbox = new WeakMap(), _isConnected = new WeakMap(), _onListboxClick = new WeakMap(), _onListboxKeyPress = new WeakMap(), _onListboxKeyDown = new WeakMap(), _onOptionSlotChange = new WeakMap(), _onExpand = new WeakSet(), _onCollapse = new WeakSet(), _isOpen = new WeakSet(), _updateOrientation = new WeakSet(), _onValueChange = new WeakSet(), _getFirstOption = new WeakSet(), _getLastOption = new WeakSet(), _getNextOption = new WeakSet(), _getPrevOption = new WeakSet(), _selectOption = new WeakSet(), _getOptionWithValue = new WeakSet(), _getOptionElements = new WeakSet(), _getEnabledOptionElements = new WeakSet(), _dispatchChangeEvent = new WeakSet(), _dispatchCloseEvent = new WeakSet(), _onCancel = new WeakMap(), _onCloseReactHandler = new WeakMap(), class extends NectaryElement {
34
34
  constructor() {
35
35
  super();
36
36
 
@@ -173,10 +173,7 @@ defineCustomElement('sinch-dropdown', (_$target = new WeakMap(), _$optionSlot =
173
173
  }
174
174
  });
175
175
 
176
- const shadowRoot = this.attachShadow({
177
- mode: 'closed',
178
- delegatesFocus: true
179
- });
176
+ const shadowRoot = this.attachShadow();
180
177
  shadowRoot.appendChild(template.content.cloneNode(true));
181
178
 
182
179
  _classPrivateFieldSet(this, _$target, shadowRoot.querySelector('#target'));
@@ -470,7 +467,7 @@ function _getEnabledOptionElements2() {
470
467
  }
471
468
 
472
469
  function _dispatchChangeEvent2($opt) {
473
- if ($opt != null && this.value !== $opt.value) {
470
+ if ($opt != null) {
474
471
  this.dispatchEvent(new CustomEvent('change', {
475
472
  detail: $opt.value,
476
473
  bubbles: true
@@ -1,5 +1,6 @@
1
+ import { NectaryElement } from '../utils';
1
2
  import type { TSinchElementReact } from '../types';
2
- export declare class DropdownOption extends HTMLElement {
3
+ export declare class DropdownOption extends NectaryElement {
3
4
  #private;
4
5
  constructor();
5
6
  connectedCallback(): void;
@@ -5,8 +5,8 @@ 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, isAttrTrue, updateAttribute, updateBooleanAttribute } from '../utils';
9
- const templateHTML = '<style>:host{display:block}*{pointer-events:none}#wrapper{display:flex;position:relative;box-sizing:border-box;height:40px;padding:6px 12px;width:100%;align-items:center;gap:12px;--sinch-size-icon:24px}#content{flex-shrink:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host(:hover)>#wrapper,:host([data-selected])>#wrapper{background-color:var(--sinch-color-snow-500)}:host([checked])>#wrapper{padding-right:36px}:host([checked])>#wrapper::after{content:"";position:absolute;top:12px;right:11px;width:18px;height:14px;background-image:url("data:image/svg+xml,%3Csvg xmlns=\'http://www.w3.org/2000/svg\'%3E%3Cpath d=\'M6 11.17 1.83 7 .41 8.41 6 14 18 2 16.59.59 6 11.17Z\' fill=\'%230A273D\'/%3E%3C/svg%3E");background-size:cover;background-repeat:no-repeat}:host([disabled]:not([disabled=false]))>#wrapper{color:var(--sinch-color-stormy-100);--sinch-color-icon:var(--sinch-color-stormy-100)}</style><div id="wrapper"><slot name="icon"></slot><span id="content"></span></div>';
8
+ import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute } from '../utils';
9
+ const templateHTML = '<style>:host{display:block}:host()>*{pointer-events:none}#wrapper{display:flex;position:relative;box-sizing:border-box;height:40px;padding:6px 12px;width:100%;align-items:center;gap:12px;--sinch-size-icon:24px}#content{flex-shrink:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host(:hover)>#wrapper,:host([data-selected])>#wrapper{background-color:var(--sinch-color-snow-500)}:host([checked])>#wrapper{padding-right:36px}:host([checked])>#wrapper::after{content:"";position:absolute;top:12px;right:11px;width:18px;height:14px;background-image:url("data:image/svg+xml,%3Csvg xmlns=\'http://www.w3.org/2000/svg\'%3E%3Cpath d=\'M6 11.17 1.83 7 .41 8.41 6 14 18 2 16.59.59 6 11.17Z\' fill=\'%230A273D\'/%3E%3C/svg%3E");background-size:cover;background-repeat:no-repeat}:host([disabled]:not([disabled=false]))>#wrapper{color:var(--sinch-color-stormy-100);--sinch-color-icon:var(--sinch-color-stormy-100)}</style><div id="wrapper"><slot name="icon"></slot><span id="content"></span></div>';
10
10
  const template = document.createElement('template');
11
11
  template.innerHTML = templateHTML;
12
12
 
@@ -14,7 +14,7 @@ var _$iconSlot = new WeakMap();
14
14
 
15
15
  var _$content = new WeakMap();
16
16
 
17
- export class DropdownOption extends HTMLElement {
17
+ export class DropdownOption extends NectaryElement {
18
18
  constructor() {
19
19
  super();
20
20
 
@@ -28,9 +28,7 @@ export class DropdownOption extends HTMLElement {
28
28
  value: void 0
29
29
  });
30
30
 
31
- const shadowRoot = this.attachShadow({
32
- mode: 'closed'
33
- });
31
+ const shadowRoot = this.attachShadow();
34
32
  shadowRoot.appendChild(template.content.cloneNode(true));
35
33
 
36
34
  _classPrivateFieldSet(this, _$iconSlot, shadowRoot.querySelector('slot'));
package/grid/index.js CHANGED
@@ -1,14 +1,12 @@
1
- import { defineCustomElement } from '../utils';
1
+ import { defineCustomElement, NectaryElement } from '../utils';
2
2
  const templateHTML = '<style>:host{--sinch-grid-gutter:24px;--sinch-grid-margin:32px;--sinch-grid-num-columns:12;display:grid;grid-template-columns:repeat(var(--sinch-grid-num-columns),minmax(0,1fr));grid-column-gap:var(--sinch-grid-gutter);grid-row-gap:var(--sinch-grid-gutter);padding:var(--sinch-grid-margin)}@media only screen and (max-width:1439px){:host{--sinch-grid-gutter:24px;--sinch-grid-margin:24px;--sinch-grid-num-columns:12}}@media only screen and (max-width:1023px){:host{--sinch-grid-gutter:24px;--sinch-grid-margin:24px;--sinch-grid-num-columns:8}}@media only screen and (max-width:767px){:host{--sinch-grid-gutter:16px;--sinch-grid-margin:16px;--sinch-grid-num-columns:4}}</style><slot name="item"></slot>';
3
3
  import '../grid-item';
4
4
  const template = document.createElement('template');
5
5
  template.innerHTML = templateHTML;
6
- defineCustomElement('sinch-grid', class extends HTMLElement {
6
+ defineCustomElement('sinch-grid', 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, getIntegerAttribute, updateIntegerAttribute } from '../utils';
1
+ import { defineCustomElement, getIntegerAttribute, NectaryElement, updateIntegerAttribute } from '../utils';
2
2
  const templateHTML = '<style>:host{display:block;grid-column:span 12}:host([xl="2"]){grid-column:span 2}:host([xl="3"]){grid-column:span 3}:host([xl="4"]){grid-column:span 4}:host([xl="5"]){grid-column:span 5}:host([xl="6"]){grid-column:span 6}:host([xl="7"]){grid-column:span 7}:host([xl="8"]){grid-column:span 8}:host([xl="9"]){grid-column:span 9}:host([xl="10"]){grid-column:span 10}:host([xl="11"]){grid-column:span 11}:host([xl="12"]){grid-column:span 12}@media only screen and (max-width:1439px){:host{grid-column:span 12}:host([l="2"]){grid-column:span 2}:host([l="3"]){grid-column:span 3}:host([l="4"]){grid-column:span 4}:host([l="5"]){grid-column:span 5}:host([l="6"]){grid-column:span 6}:host([l="7"]){grid-column:span 7}:host([l="8"]){grid-column:span 8}:host([l="9"]){grid-column:span 9}:host([l="10"]){grid-column:span 10}:host([l="11"]){grid-column:span 11}:host([l="12"]){grid-column:span 12}}@media only screen and (max-width:1023px){:host{grid-column:span 8}:host([m="2"]){grid-column:span 2}:host([m="3"]){grid-column:span 3}:host([m="4"]){grid-column:span 4}:host([m="5"]){grid-column:span 5}:host([m="6"]){grid-column:span 6}:host([m="7"]){grid-column:span 7}:host([m="8"]){grid-column:span 8}}@media only screen and (max-width:767px){:host{grid-column:span 4}:host([s="2"]){grid-column:span 2}:host([s="3"]){grid-column:span 3}:host([s="4"]){grid-column:span 4}}</style><slot name="content"></slot>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
- defineCustomElement('sinch-grid-item', class extends HTMLElement {
5
+ defineCustomElement('sinch-grid-item', 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,15 +1,13 @@
1
1
  import '../tooltip';
2
2
  import '../icons/help-outline';
3
- import { defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, updateAttribute, updateBooleanAttribute, updateIntegerAttribute } from '../utils';
3
+ import { defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, NectaryElement, updateAttribute, updateBooleanAttribute, updateIntegerAttribute } from '../utils';
4
4
  const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;--sinch-size-icon:18px}sinch-tooltip{display:block}</style><sinch-tooltip><sinch-icon-help-outline></sinch-icon-help-outline></sinch-tooltip>';
5
5
  const template = document.createElement('template');
6
6
  template.innerHTML = templateHTML;
7
- defineCustomElement('sinch-help-tooltip', class extends HTMLElement {
7
+ defineCustomElement('sinch-help-tooltip', class extends NectaryElement {
8
8
  constructor() {
9
9
  super();
10
- const shadowRoot = this.attachShadow({
11
- mode: 'closed'
12
- });
10
+ const shadowRoot = this.attachShadow();
13
11
  shadowRoot.appendChild(template.content.cloneNode(true));
14
12
  this.$tooltip = shadowRoot.querySelector('sinch-tooltip');
15
13
  }
@@ -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, getBooleanAttribute, isAttrTrue, updateBooleanAttribute } from '../utils';
10
+ import { defineCustomElement, getBooleanAttribute, isAttrTrue, NectaryElement, updateBooleanAttribute } from '../utils';
11
11
  const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}button{all:initial;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:48px;height:48px;border-radius:4px;background-color:transparent;box-shadow:0 0 0 1px transparent inset;cursor:pointer;--sinch-size-icon:24px;--sinch-color-icon:var(--sinch-icon-button-color, var(--sinch-color-stormy-500))}button:focus{box-shadow:0 0 0 1px var(--sinch-color-stormy-500) inset}button:hover{background-color:var(--sinch-color-snow-500)}button:active{background-color:var(--sinch-color-snow-600)}button:disabled{background-color:transparent;cursor:initial;--sinch-color-spinner-bg:var(--sinch-color-snow-200);--sinch-color-spinner-fg:var(--sinch-color-stormy-200);--sinch-color-icon:var(--sinch-color-stormy-100)}:host([small]:not([small=false]))>button{width:32px;height:32px}button>*{pointer-events:none}</style><button><slot name="icon"></slot></button>';
12
12
  const template = document.createElement('template');
13
13
  template.innerHTML = templateHTML;
14
- defineCustomElement('sinch-icon-button', (_$button = new WeakMap(), class extends HTMLElement {
14
+ defineCustomElement('sinch-icon-button', (_$button = new WeakMap(), class extends NectaryElement {
15
15
  constructor() {
16
16
  super();
17
17
 
@@ -20,10 +20,7 @@ defineCustomElement('sinch-icon-button', (_$button = new WeakMap(), class extend
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, _$button, shadowRoot.querySelector('button'));
@@ -2,6 +2,7 @@ export declare const createIconClass: (templateHTML: string) => {
2
2
  new (): {
3
3
  $svg: SVGElement;
4
4
  connectedCallback(): void;
5
+ attachShadow(): ShadowRoot;
5
6
  accessKey: string;
6
7
  readonly accessKeyLabel: string;
7
8
  autocapitalize: string;
@@ -48,7 +49,6 @@ export declare const createIconClass: (templateHTML: string) => {
48
49
  readonly shadowRoot: ShadowRoot | null;
49
50
  slot: string;
50
51
  readonly tagName: string;
51
- attachShadow(init: ShadowRootInit): ShadowRoot;
52
52
  closest<K_2 extends keyof HTMLElementTagNameMap>(selector: K_2): HTMLElementTagNameMap[K_2] | null;
53
53
  closest<K_3 extends keyof SVGElementTagNameMap>(selector: K_3): SVGElementTagNameMap[K_3] | null;
54
54
  closest<E extends Element = Element>(selectors: string): E | null;
@@ -1,14 +1,12 @@
1
- import { updateAttribute } from '../utils';
1
+ import { NectaryElement, updateAttribute } from '../utils';
2
2
  const iconStylesHtml = '<style>:host{display:inline-block;vertical-align:middle}svg{display:block;fill:var(--sinch-color-icon,--sinch-color-text-default);height:var(--sinch-size-icon,24px)}</style>';
3
3
  export const createIconClass = templateHTML => {
4
4
  const template = document.createElement('template');
5
5
  template.innerHTML = iconStylesHtml + templateHTML;
6
- return class extends HTMLElement {
6
+ return 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
  this.$svg = shadowRoot.querySelector('svg');
14
12
  }
@@ -5,6 +5,7 @@ export declare const createIconClass: (templateHTML: string) => {
5
5
  inverted: boolean;
6
6
  connectedCallback(): void;
7
7
  attributeChangedCallback(name: string, _: string | null, newVal: string | null): void;
8
+ attachShadow(): ShadowRoot;
8
9
  accessKey: string;
9
10
  readonly accessKeyLabel: string;
10
11
  autocapitalize: string;
@@ -51,7 +52,6 @@ export declare const createIconClass: (templateHTML: string) => {
51
52
  readonly shadowRoot: ShadowRoot | null;
52
53
  slot: string;
53
54
  readonly tagName: string;
54
- attachShadow(init: ShadowRootInit): ShadowRoot;
55
55
  closest<K_2 extends keyof HTMLElementTagNameMap>(selector: K_2): HTMLElementTagNameMap[K_2] | null;
56
56
  closest<K_3 extends keyof SVGElementTagNameMap>(selector: K_3): SVGElementTagNameMap[K_3] | null;
57
57
  closest<E extends Element = Element>(selectors: string): E | null;
@@ -1,4 +1,4 @@
1
- import { getBooleanAttribute, getIntegerAttribute, updateAttribute, updateBooleanAttribute, updateIntegerAttribute } from '../utils';
1
+ import { getBooleanAttribute, getIntegerAttribute, NectaryElement, updateAttribute, updateBooleanAttribute, updateIntegerAttribute } from '../utils';
2
2
  const iconStylesHtml = '<style>:host{display:inline-block;vertical-align:middle}svg{display:block;fill:var(--sinch-color-stormy-500)}.accent{fill:var(--sinch-color-text-link)}:host([inverted]:not([inverted=false])) svg{fill:var(--sinch-color-snow-100)}:host([inverted]:not([inverted=false])) .accent{fill:var(--sinch-color-honey-500)}</style>';
3
3
  const DEFAULT_SIZE = 48;
4
4
  const MIN_SIZE = 4;
@@ -6,12 +6,10 @@ const MAX_SIZE = 256;
6
6
  export const createIconClass = templateHTML => {
7
7
  const template = document.createElement('template');
8
8
  template.innerHTML = iconStylesHtml + templateHTML;
9
- return class extends HTMLElement {
9
+ return class extends NectaryElement {
10
10
  constructor() {
11
11
  super();
12
- const shadowRoot = this.attachShadow({
13
- mode: 'closed'
14
- });
12
+ const shadowRoot = this.attachShadow();
15
13
  shadowRoot.appendChild(template.content.cloneNode(true));
16
14
  this.$svg = shadowRoot.querySelector('svg');
17
15
  }
@@ -4,6 +4,7 @@ export declare const createIconClass: (templateHTML: string) => {
4
4
  size: number;
5
5
  connectedCallback(): void;
6
6
  attributeChangedCallback(name: string, _: string | null, newVal: string | null): void;
7
+ attachShadow(): ShadowRoot;
7
8
  accessKey: string;
8
9
  readonly accessKeyLabel: string;
9
10
  autocapitalize: string;
@@ -50,7 +51,6 @@ export declare const createIconClass: (templateHTML: string) => {
50
51
  readonly shadowRoot: ShadowRoot | null;
51
52
  slot: string;
52
53
  readonly tagName: string;
53
- attachShadow(init: ShadowRootInit): ShadowRoot;
54
54
  closest<K_2 extends keyof HTMLElementTagNameMap>(selector: K_2): HTMLElementTagNameMap[K_2] | null;
55
55
  closest<K_3 extends keyof SVGElementTagNameMap>(selector: K_3): SVGElementTagNameMap[K_3] | null;
56
56
  closest<E extends Element = Element>(selectors: string): E | null;
@@ -1,4 +1,4 @@
1
- import { getIntegerAttribute, updateAttribute, updateIntegerAttribute } from '../utils';
1
+ import { getIntegerAttribute, NectaryElement, updateAttribute, updateIntegerAttribute } from '../utils';
2
2
  const iconStylesHtml = '<style>:host{display:inline-block;vertical-align:middle}</style>';
3
3
  const DEFAULT_SIZE = 48;
4
4
  const MIN_SIZE = 4;
@@ -6,12 +6,10 @@ const MAX_SIZE = 256;
6
6
  export const createIconClass = templateHTML => {
7
7
  const template = document.createElement('template');
8
8
  template.innerHTML = iconStylesHtml + templateHTML;
9
- return class extends HTMLElement {
9
+ return class extends NectaryElement {
10
10
  constructor() {
11
11
  super();
12
- const shadowRoot = this.attachShadow({
13
- mode: 'closed'
14
- });
12
+ const shadowRoot = this.attachShadow();
15
13
  shadowRoot.appendChild(template.content.cloneNode(true));
16
14
  this.$svg = shadowRoot.querySelector('svg');
17
15
  }
@@ -4,6 +4,7 @@ export declare const createIllustrationClass: (templateHTML: string) => {
4
4
  size: number;
5
5
  connectedCallback(): void;
6
6
  attributeChangedCallback(name: string, _: string | null, newVal: string | null): void;
7
+ attachShadow(): ShadowRoot;
7
8
  accessKey: string;
8
9
  readonly accessKeyLabel: string;
9
10
  autocapitalize: string;
@@ -50,7 +51,6 @@ export declare const createIllustrationClass: (templateHTML: string) => {
50
51
  readonly shadowRoot: ShadowRoot | null;
51
52
  slot: string;
52
53
  readonly tagName: string;
53
- attachShadow(init: ShadowRootInit): ShadowRoot;
54
54
  closest<K_2 extends keyof HTMLElementTagNameMap>(selector: K_2): HTMLElementTagNameMap[K_2] | null;
55
55
  closest<K_3 extends keyof SVGElementTagNameMap>(selector: K_3): SVGElementTagNameMap[K_3] | null;
56
56
  closest<E extends Element = Element>(selectors: string): E | null;
@@ -1,4 +1,4 @@
1
- import { getIntegerAttribute, updateAttribute, updateIntegerAttribute } from '../utils';
1
+ import { getIntegerAttribute, NectaryElement, updateAttribute, updateIntegerAttribute } from '../utils';
2
2
  const illustrationStylesHtml = '<style>:host{display:inline-block;vertical-align:middle}svg{display:block;pointer-events:none}</style>';
3
3
  const DEFAULT_SIZE = 256;
4
4
  const MIN_SIZE = 16;
@@ -6,12 +6,10 @@ const MAX_SIZE = 2048;
6
6
  export const createIllustrationClass = templateHTML => {
7
7
  const template = document.createElement('template');
8
8
  template.innerHTML = illustrationStylesHtml + templateHTML;
9
- return class extends HTMLElement {
9
+ return class extends NectaryElement {
10
10
  constructor() {
11
11
  super();
12
- const shadowRoot = this.attachShadow({
13
- mode: 'closed'
14
- });
12
+ const shadowRoot = this.attachShadow();
15
13
  shadowRoot.appendChild(template.content.cloneNode(true));
16
14
  this.$svg = shadowRoot.querySelector('svg');
17
15
  }
package/index.d.ts CHANGED
@@ -193,3 +193,4 @@ import './chat-block';
193
193
  import './chat';
194
194
  import './title';
195
195
  import './popover';
196
+ import './segmented-control';
package/index.js CHANGED
@@ -192,4 +192,5 @@ import './chat-bubble';
192
192
  import './chat-block';
193
193
  import './chat';
194
194
  import './title';
195
- import './popover';
195
+ import './popover';
196
+ import './segmented-control';
package/input/index.js CHANGED
@@ -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, isAttrTrue, updateAttribute, updateBooleanAttribute, updateLiteralAttribute } from '../utils';
10
+ import { defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateLiteralAttribute } 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%;height:48px;margin:2px 0;padding:0 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: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)}#input[type=password]{font-size:1.5em;letter-spacing:.1em}: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><input id="input" type="text"/><div id="bottom"><span id="invalid"></span> <span id="additional"></span></div></div>';
12
12
  const inputTypes = ['text', 'password'];
13
13
  const template = document.createElement('template');
14
14
  template.innerHTML = templateHTML;
15
- defineCustomElement('sinch-input', (_$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 {
15
+ defineCustomElement('sinch-input', (_$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 {
16
16
  constructor() {
17
17
  super();
18
18
 
@@ -105,10 +105,7 @@ defineCustomElement('sinch-input', (_$input = new WeakMap(), _$label = new WeakM
105
105
  }
106
106
  });
107
107
 
108
- const shadowRoot = this.attachShadow({
109
- mode: 'closed',
110
- delegatesFocus: true
111
- });
108
+ const shadowRoot = this.attachShadow();
112
109
  shadowRoot.appendChild(template.content.cloneNode(true));
113
110
 
114
111
  _classPrivateFieldSet(this, _$input, shadowRoot.querySelector('#input'));
package/link/index.js CHANGED
@@ -1,18 +1,18 @@
1
1
  import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
2
2
  import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
3
3
 
4
- var _$anchor, _$text, _onClick;
4
+ var _$anchor, _$text;
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
10
  import '../icons/cancel';
11
- import { defineCustomElement, getBooleanAttribute, getAttribute, updateBooleanAttribute, updateAttribute } from '../utils';
12
- const templateHTML = '<style>:host{display:inline;outline:0}a{font:var(--sinch-font-body);font-size:inherit;line-height:inherit;color:var(--sinch-color-text-link);fill:var(--sinch-color-text-link)}svg{display:none;transform:translateY(.15em);margin-left:.4em;width:.8em;pointer-events:none}a:hover{color:var(--sinch-color-tropical-600);fill:var(--sinch-color-tropical-600)}:host([disabled]:not([disabled=false])) a{color:var(--sinch-color-tropical-200);pointer-events:none;cursor:initial;fill:var(--sinch-color-tropical-200)}:host([external]:not([external=false])) svg{display:inline-block}</style><a><span></span><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M14.222 14.222H1.778V1.778H8V0H1.778C.79 0 0 .8 0 1.778v12.444C0 15.2.791 16 1.778 16h12.444C15.2 16 16 15.2 16 14.222V8h-1.778v6.222ZM9.778 0v1.778h3.19l-8.737 8.738 1.253 1.253 8.738-8.738v3.191H16V0H9.778Z"/></svg></a>';
11
+ import { defineCustomElement, getBooleanAttribute, getAttribute, updateBooleanAttribute, updateAttribute, NectaryElement } from '../utils';
12
+ const templateHTML = '<style>:host{display:inline;outline:0}a{font:var(--sinch-font-body);font-size:inherit;line-height:inherit;color:var(--sinch-color-text-link);fill:var(--sinch-color-text-link)}svg{display:none;transform:translateY(.15em);margin-left:.4em;width:.8em;pointer-events:none}a:hover{color:var(--sinch-color-tropical-600);fill:var(--sinch-color-tropical-600)}:host([disabled]:not([disabled=false])) a{color:var(--sinch-color-tropical-200);pointer-events:none;cursor:initial;fill:var(--sinch-color-tropical-200)}:host([external]:not([external=false])) svg{display:inline-block}</style><a><span></span> <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M14.222 14.222H1.778V1.778H8V0H1.778C.79 0 0 .8 0 1.778v12.444C0 15.2.791 16 1.778 16h12.444C15.2 16 16 15.2 16 14.222V8h-1.778v6.222ZM9.778 0v1.778h3.19l-8.737 8.738 1.253 1.253 8.738-8.738v3.191H16V0H9.778Z"/></svg></a>';
13
13
  const template = document.createElement('template');
14
14
  template.innerHTML = templateHTML;
15
- defineCustomElement('sinch-link', (_$anchor = new WeakMap(), _$text = new WeakMap(), _onClick = new WeakMap(), class extends HTMLElement {
15
+ defineCustomElement('sinch-link', (_$anchor = new WeakMap(), _$text = new WeakMap(), class extends NectaryElement {
16
16
  constructor() {
17
17
  super();
18
18
 
@@ -26,20 +26,7 @@ defineCustomElement('sinch-link', (_$anchor = new WeakMap(), _$text = new WeakMa
26
26
  value: void 0
27
27
  });
28
28
 
29
- _classPrivateFieldInitSpec(this, _onClick, {
30
- writable: true,
31
- value: e => {
32
- if (this.disabled) {
33
- e.preventDefault();
34
- e.stopPropagation();
35
- }
36
- }
37
- });
38
-
39
- const shadowRoot = this.attachShadow({
40
- mode: 'closed',
41
- delegatesFocus: true
42
- });
29
+ const shadowRoot = this.attachShadow();
43
30
  shadowRoot.appendChild(template.content.cloneNode(true));
44
31
 
45
32
  _classPrivateFieldSet(this, _$anchor, shadowRoot.querySelector('a'));
@@ -47,14 +34,6 @@ defineCustomElement('sinch-link', (_$anchor = new WeakMap(), _$text = new WeakMa
47
34
  _classPrivateFieldSet(this, _$text, shadowRoot.querySelector('span'));
48
35
  }
49
36
 
50
- connectedCallback() {
51
- _classPrivateFieldGet(this, _$anchor).addEventListener('click', _classPrivateFieldGet(this, _onClick));
52
- }
53
-
54
- disconnectedCallback() {
55
- _classPrivateFieldGet(this, _$anchor).removeEventListener('click', _classPrivateFieldGet(this, _onClick));
56
- }
57
-
58
37
  get text() {
59
38
  return getAttribute(this, 'text', '');
60
39
  }
@@ -5,6 +5,7 @@ export declare const createLogoClass: (templateHTML: string) => {
5
5
  inverted: boolean;
6
6
  connectedCallback(): void;
7
7
  attributeChangedCallback(name: string, _: string | null, newVal: string | null): void;
8
+ attachShadow(): ShadowRoot;
8
9
  accessKey: string;
9
10
  readonly accessKeyLabel: string;
10
11
  autocapitalize: string;
@@ -51,7 +52,6 @@ export declare const createLogoClass: (templateHTML: string) => {
51
52
  readonly shadowRoot: ShadowRoot | null;
52
53
  slot: string;
53
54
  readonly tagName: string;
54
- attachShadow(init: ShadowRootInit): ShadowRoot;
55
55
  closest<K_2 extends keyof HTMLElementTagNameMap>(selector: K_2): HTMLElementTagNameMap[K_2] | null;
56
56
  closest<K_3 extends keyof SVGElementTagNameMap>(selector: K_3): SVGElementTagNameMap[K_3] | null;
57
57
  closest<E extends Element = Element>(selectors: string): E | null;
@@ -1,4 +1,4 @@
1
- import { getBooleanAttribute, getIntegerAttribute, updateAttribute, updateBooleanAttribute, updateIntegerAttribute } from '../utils';
1
+ import { getBooleanAttribute, getIntegerAttribute, NectaryElement, updateAttribute, updateBooleanAttribute, updateIntegerAttribute } from '../utils';
2
2
  const logoStylesHtml = '<style>:host{display:inline-block;vertical-align:middle}svg{display:block;fill:var(--sinch-color-stormy-500)}:host([inverted]:not([inverted=false])) svg{fill:var(--sinch-color-snow-100)}</style>';
3
3
  const DEFAULT_SIZE = 16;
4
4
  const MIN_SIZE = 4;
@@ -6,12 +6,10 @@ const MAX_SIZE = 256;
6
6
  export const createLogoClass = templateHTML => {
7
7
  const template = document.createElement('template');
8
8
  template.innerHTML = logoStylesHtml + templateHTML;
9
- return class extends HTMLElement {
9
+ return class extends NectaryElement {
10
10
  constructor() {
11
11
  super();
12
- const shadowRoot = this.attachShadow({
13
- mode: 'closed'
14
- });
12
+ const shadowRoot = this.attachShadow();
15
13
  shadowRoot.appendChild(template.content.cloneNode(true));
16
14
  this.$svg = shadowRoot.querySelector('svg');
17
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "files": [
5
5
  "theme.css",
6
6
  "**/*/*.js",
@@ -13,9 +13,7 @@
13
13
  "colors.json"
14
14
  ],
15
15
  "scripts": {
16
- "prebuild": "rimraf utils.{js,d.ts} index.{js,d.ts} */*.{js,d.ts} */**/*.{js,d.ts}",
17
- "build": "NODE_ENV=production babel . --extensions '.ts' --ignore '*.d.ts' --out-dir .",
18
- "postbuild": "tsc"
16
+ "build": "NODE_ENV=production babel . --extensions '.ts' --out-dir . && tsc"
19
17
  },
20
18
  "dependencies": {
21
19
  "@babel/runtime": "^7.17.0",
@@ -29,8 +27,8 @@
29
27
  "@babel/preset-typescript": "^7.16.0",
30
28
  "@types/node": "^17.0.14",
31
29
  "@types/react": "^17.0.0",
30
+ "babel-plugin-html-inline-minifier": "workspace:babel-plugin-html-inline-minifier@*",
32
31
  "babel-plugin-transform-inline-environment-variables": "^0.4.3",
33
- "rimraf": "^3.0.2",
34
32
  "typescript": "^4.4.2"
35
33
  }
36
34
  }
@@ -1,12 +1,15 @@
1
1
  import '../icons/keyboard-arrow-left';
2
2
  import '../icons/keyboard-arrow-right';
3
- import type { TSinchElementReact } from '../types';
3
+ import type { TRect, TSinchElementReact } from '../types';
4
4
  import type { FocusEvent, SyntheticEvent } from 'react';
5
5
  export declare type TSinchPaginationElement = HTMLElement & {
6
6
  value: number;
7
7
  max: number;
8
8
  focus(): void;
9
9
  blur(): void;
10
+ readonly prevButtonRect: TRect;
11
+ readonly nextButtonRect: TRect;
12
+ nthButtonRect(index: number): TRect | null;
10
13
  };
11
14
  export declare type TSinchPaginationReact = TSinchElementReact<TSinchPaginationElement> & {
12
15
  value: number;
@@ -13,7 +13,7 @@ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(
13
13
 
14
14
  import '../icons/keyboard-arrow-left';
15
15
  import '../icons/keyboard-arrow-right';
16
- import { defineCustomElement, updateAttribute, getIntegerAttribute, setClass } from '../utils';
16
+ import { defineCustomElement, updateAttribute, getIntegerAttribute, setClass, NectaryElement, getRect } from '../utils';
17
17
  const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{display:flex;justify-content:center;gap:8px;width:100%;box-sizing:border-box}button{all:initial;width:28px;height:28px;box-sizing:border-box;cursor:pointer;text-align:center;contain:strict;--sinch-color-icon:var(--sinch-color-stormy-500)}button:disabled{--sinch-color-icon:var(--sinch-color-stormy-100);cursor:initial}button>*{pointer-events:none}.page{border-radius:50%;font:var(--sinch-font-body);color:var(--sinch-color-stormy-500)}.page.dots>span{display:none}.page.dots::after{content:"..."}.page.active{font:var(--sinch-font-emphasized-body);background-color:var(--sinch-color-snow-600);pointer-events:none;cursor:initial}.page.hidden{display:none}</style><div id="wrapper"><button id="left"><sinch-icon-keyboard-arrow-left></sinch-icon-keyboard-arrow-left></button> <button class="page"><span>1</span></button> <button class="page active"><span>2</span></button> <button class="page"><span>3</span></button> <button class="page"><span>4</span></button> <button class="page"><span>5</span></button> <button class="page dots"><span>6</span></button> <button class="page"><span>20</span></button> <button id="right"><sinch-icon-keyboard-arrow-right></sinch-icon-keyboard-arrow-right></button></div>';
18
18
  const NUM_BUTTONS = 7;
19
19
  const MIDDLE_BTN_INDEX = Math.floor(NUM_BUTTONS / 2);
@@ -23,7 +23,7 @@ const DOTS_LEFT_INDEX = 1;
23
23
  const DOTS_RIGHT_INDEX = LAST_BTN_INDEX - 1;
24
24
  const template = document.createElement('template');
25
25
  template.innerHTML = templateHTML;
26
- defineCustomElement('sinch-pagination', (_$left = new WeakMap(), _$right = new WeakMap(), _$buttons = new WeakMap(), _$wrapper = new WeakMap(), _onValueChange = new WeakSet(), _onButtonClick = new WeakMap(), _clamp = new WeakSet(), _dispatchChangeEvent = new WeakSet(), class extends HTMLElement {
26
+ defineCustomElement('sinch-pagination', (_$left = new WeakMap(), _$right = new WeakMap(), _$buttons = new WeakMap(), _$wrapper = new WeakMap(), _onValueChange = new WeakSet(), _onButtonClick = new WeakMap(), _clamp = new WeakSet(), _dispatchChangeEvent = new WeakSet(), class extends NectaryElement {
27
27
  constructor() {
28
28
  super();
29
29
 
@@ -92,10 +92,7 @@ defineCustomElement('sinch-pagination', (_$left = new WeakMap(), _$right = new W
92
92
  }
93
93
  });
94
94
 
95
- const shadowRoot = this.attachShadow({
96
- mode: 'production' === 'development' ? 'open' : 'closed',
97
- delegatesFocus: true
98
- });
95
+ const shadowRoot = this.attachShadow();
99
96
  shadowRoot.appendChild(template.content.cloneNode(true));
100
97
 
101
98
  _classPrivateFieldSet(this, _$left, shadowRoot.querySelector('#left'));
@@ -171,6 +168,20 @@ defineCustomElement('sinch-pagination', (_$left = new WeakMap(), _$right = new W
171
168
  _classPrivateFieldGet(this, _$buttons).forEach($b => $b.blur());
172
169
  }
173
170
 
171
+ get prevButtonRect() {
172
+ return getRect(_classPrivateFieldGet(this, _$left));
173
+ }
174
+
175
+ get nextButtonRect() {
176
+ return getRect(_classPrivateFieldGet(this, _$right));
177
+ }
178
+
179
+ nthButtonRect(index) {
180
+ const btn = _classPrivateFieldGet(this, _$buttons)[index];
181
+
182
+ return btn == null ? null : getRect(btn);
183
+ }
184
+
174
185
  }));
175
186
 
176
187
  function _onValueChange2() {
package/popover/index.js CHANGED
@@ -12,12 +12,12 @@ 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 dialogPolyfill from 'dialog-polyfill';
15
- import { defineCustomElement, getBooleanAttribute, getLiteralAttribute, getRect, isAttrTrue, updateLiteralAttribute, getReactEventHandler, updateBooleanAttribute } from '../utils';
15
+ import { defineCustomElement, getBooleanAttribute, getLiteralAttribute, getRect, isAttrTrue, updateLiteralAttribute, getReactEventHandler, updateBooleanAttribute, NectaryElement } from '../utils';
16
16
  const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative}dialog{outline:0;font:var(--sinch-font-body);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-100);box-shadow:1px 2px 6px rgba(0,0,0,.15);border:1px solid var(--sinch-color-snow-500);border-radius:4px;overflow-y:auto;contain:content;padding:12px;box-sizing:border-box}dialog:not([open]){display:none}dialog::backdrop{background-color:transparent}dialog+.backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background-color:transparent}dialog.fixed{position:fixed;top:50%;transform:translate(0,-50%)}._dialog_overlay{position:fixed;top:0;right:0;bottom:0;left:0}</style><div id="wrapper"><div id="target" aria-haspopup="dialog" aria-expanded="false"><slot name="target"></slot></div><dialog id="dialog" tabindex="-1"><slot name="content"></slot></dialog></div>';
17
17
  const orientationValues = ['top-left', 'top-right', 'bottom-left', 'bottom-right'];
18
18
  const template = document.createElement('template');
19
19
  template.innerHTML = templateHTML;
20
- defineCustomElement('sinch-popover', (_$target = new WeakMap(), _$dialog = new WeakMap(), _isConnected = new WeakMap(), _onExpand = new WeakSet(), _onCollapse = new WeakSet(), _isOpen = new WeakSet(), _updateOrientation = new WeakSet(), _onBackdropClick = new WeakMap(), _onCancel = new WeakMap(), _onCloseReactHandler = new WeakMap(), _dispatchCloseEvent = new WeakSet(), class extends HTMLElement {
20
+ defineCustomElement('sinch-popover', (_$target = new WeakMap(), _$dialog = new WeakMap(), _isConnected = new WeakMap(), _onExpand = new WeakSet(), _onCollapse = new WeakSet(), _isOpen = new WeakSet(), _updateOrientation = new WeakSet(), _onBackdropClick = new WeakMap(), _onCancel = new WeakMap(), _onCloseReactHandler = new WeakMap(), _dispatchCloseEvent = new WeakSet(), class extends NectaryElement {
21
21
  constructor() {
22
22
  super();
23
23
 
@@ -74,10 +74,7 @@ defineCustomElement('sinch-popover', (_$target = new WeakMap(), _$dialog = new W
74
74
  }
75
75
  });
76
76
 
77
- const shadowRoot = this.attachShadow({
78
- mode: 'closed',
79
- delegatesFocus: true
80
- });
77
+ const shadowRoot = this.attachShadow();
81
78
  shadowRoot.appendChild(template.content.cloneNode(true));
82
79
 
83
80
  _classPrivateFieldSet(this, _$target, shadowRoot.querySelector('#target'));