@nectary/components 0.44.1 → 0.45.1

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 (110) hide show
  1. package/accordion-item/index.js +1 -1
  2. package/action-menu/index.js +3 -11
  3. package/alert/index.js +3 -1
  4. package/avatar/index.js +12 -13
  5. package/avatar/types.d.ts +4 -4
  6. package/avatar/utils.d.ts +1 -4
  7. package/avatar/utils.js +4 -7
  8. package/badge/index.js +9 -7
  9. package/badge/types.d.ts +4 -4
  10. package/badge/utils.d.ts +1 -4
  11. package/badge/utils.js +0 -6
  12. package/button/index.js +88 -23
  13. package/button/types.d.ts +12 -11
  14. package/button/utils.d.ts +4 -1
  15. package/button/utils.js +9 -1
  16. package/card-container/index.js +1 -1
  17. package/chat-block/index.js +1 -1
  18. package/chat-bubble/index.js +1 -1
  19. package/checkbox/index.js +4 -2
  20. package/chip/index.js +7 -6
  21. package/color-menu/index.js +9 -18
  22. package/color-swatch/index.js +5 -7
  23. package/date-picker/index.js +1 -1
  24. package/dialog/index.js +4 -7
  25. package/emoji/index.js +2 -6
  26. package/emoji-picker/index.js +6 -14
  27. package/field/index.js +1 -1
  28. package/file-status/index.js +4 -2
  29. package/flag/index.d.ts +11 -0
  30. package/flag/index.js +43 -0
  31. package/flag/types.d.ts +11 -0
  32. package/flag/types.js +1 -0
  33. package/flag/utils.d.ts +1 -0
  34. package/flag/utils.js +19 -0
  35. package/icon/index.js +1 -1
  36. package/icon-button/index.js +77 -9
  37. package/icon-button/types.d.ts +14 -6
  38. package/icon-button/utils.d.ts +5 -0
  39. package/icon-button/utils.js +9 -0
  40. package/icons/create-icon-class.js +1 -1
  41. package/inline-alert/index.js +3 -1
  42. package/input/index.d.ts +3 -0
  43. package/input/index.js +148 -71
  44. package/input/types.d.ts +7 -0
  45. package/link/index.js +1 -1
  46. package/package.json +2 -4
  47. package/pagination/index.js +1 -1
  48. package/pop/index.js +15 -37
  49. package/popover/index.js +7 -9
  50. package/radio-option/index.js +1 -1
  51. package/segment/index.js +10 -6
  52. package/segment/types.d.ts +4 -4
  53. package/segment/utils.d.ts +3 -5
  54. package/segment/utils.js +14 -4
  55. package/segment-collapse/index.js +1 -1
  56. package/segmented-control-option/index.js +1 -1
  57. package/segmented-icon-control-option/index.js +1 -1
  58. package/select-button/index.js +93 -28
  59. package/select-button/types.d.ts +8 -1
  60. package/select-menu/index.d.ts +5 -0
  61. package/select-menu/index.js +46 -17
  62. package/select-menu-option/index.d.ts +1 -0
  63. package/select-menu-option/index.js +3 -0
  64. package/select-menu-option/types.d.ts +1 -0
  65. package/spinner/index.js +52 -7
  66. package/spinner/types.d.ts +4 -5
  67. package/stop-events/index.js +9 -5
  68. package/table/index.js +1 -1
  69. package/tag/index.js +2 -6
  70. package/text/index.js +3 -1
  71. package/textarea/index.js +1 -1
  72. package/theme/button.css +146 -0
  73. package/{theme.css → theme/contextual.css} +3 -25
  74. package/theme/elevation.css +1 -1
  75. package/theme/flag.css +4 -0
  76. package/theme/fonts.css +0 -33
  77. package/theme/fonts.json +0 -33
  78. package/theme/icon-button.css +68 -0
  79. package/theme/index.css +4 -0
  80. package/theme/index.d.ts +21 -0
  81. package/theme/index.js +21 -0
  82. package/theme/input.css +7 -0
  83. package/theme/select-button.css +7 -0
  84. package/theme/shapes.css +4 -3
  85. package/theme/size.css +9 -0
  86. package/theme/spinner.css +7 -0
  87. package/theme/typography.css +7 -7
  88. package/tile-control-option/index.js +1 -1
  89. package/time-picker/index.js +1 -1
  90. package/title/index.js +7 -3
  91. package/toast/index.js +3 -1
  92. package/toggle/index.js +1 -1
  93. package/tooltip/index.js +8 -6
  94. package/utils/context.d.ts +14 -9
  95. package/utils/context.js +60 -26
  96. package/utils/countries.d.ts +5 -0
  97. package/utils/countries.js +2 -0
  98. package/utils/countries.json +998 -0
  99. package/utils/debounce.d.ts +4 -0
  100. package/utils/debounce.js +21 -0
  101. package/utils/element.d.ts +4 -0
  102. package/utils/element.js +10 -0
  103. package/utils/index.d.ts +1 -0
  104. package/utils/index.js +1 -0
  105. package/utils/size.d.ts +10 -0
  106. package/utils/size.js +19 -0
  107. package/utils/throttle.d.ts +2 -2
  108. package/utils/throttle.js +4 -9
  109. package/spinner/utils.d.ts +0 -2
  110. package/spinner/utils.js +0 -1
@@ -1,18 +1,30 @@
1
- import { attrValueToPixels, defineCustomElement, dispatchContextConnectEvent, dispatchContextDisconnectEvent, getAttribute, getBooleanAttribute, unpackCsv, getFirstCsvValue, getIntegerAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateCsv, updateExplicitBooleanAttribute, updateIntegerAttribute } from '../utils';
2
- const templateHTML = '<style>:host{display:block;outline:0}#listbox{overflow-y:auto}</style><div id="listbox" role="presentation"><slot></slot></div>';
1
+ import '../input';
2
+ import '../icon-button';
3
+ import '../icons/search';
4
+ import '../icons/close';
5
+ import '../text';
6
+ import { attrValueToPixels, defineCustomElement, getAttribute, getBooleanAttribute, unpackCsv, getFirstCsvValue, getIntegerAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateCsv, updateExplicitBooleanAttribute, updateIntegerAttribute, debounceTimeout, setClass, subscribeContext } from '../utils';
7
+ const templateHTML = '<style>:host{display:block;outline:0}#listbox{overflow-y:auto}#search{display:none;margin:10px}#search.active{display:block}#not-found{display:none;width:100%;height:30px;align-items:center;justify-content:center;margin-bottom:10px;color:var(--sinch-color-text-muted);pointer-events:none;user-select:none}#not-found.active{display:flex}::slotted(.hidden){display:none}</style><sinch-input id="search" size="s" placeholder="Search"><sinch-icon-search slot="icon"></sinch-icon-search></sinch-input><div id="not-found"><sinch-text type="m">No results</sinch-text></div><div id="listbox" role="presentation"><slot></slot></div>';
3
8
  const ITEM_HEIGHT = 40;
9
+ const NUM_ITEMS_SEARCH = 20;
4
10
  const template = document.createElement('template');
5
11
  template.innerHTML = templateHTML;
6
12
  defineCustomElement('sinch-select-menu', class extends NectaryElement {
7
13
  #$optionSlot;
8
14
  #$listbox;
15
+ #$search;
16
+ #$notFound;
9
17
  #controller = null;
18
+ #searchDebounce;
10
19
  constructor() {
11
20
  super();
12
21
  const shadowRoot = this.attachShadow();
13
22
  shadowRoot.appendChild(template.content.cloneNode(true));
14
23
  this.#$optionSlot = shadowRoot.querySelector('slot');
15
24
  this.#$listbox = shadowRoot.querySelector('#listbox');
25
+ this.#$search = shadowRoot.querySelector('#search');
26
+ this.#$notFound = shadowRoot.querySelector('#not-found');
27
+ this.#searchDebounce = debounceTimeout(200)(this.#updateSearch);
16
28
  }
17
29
  connectedCallback() {
18
30
  this.#controller = new AbortController();
@@ -24,9 +36,6 @@ defineCustomElement('sinch-select-menu', class extends NectaryElement {
24
36
  this.addEventListener('keydown', this.#onListboxKeyDown, {
25
37
  signal
26
38
  });
27
- this.addEventListener('-keydown', this.#onContexKeydown, {
28
- signal
29
- });
30
39
  this.addEventListener('blur', this.#onListboxBlur, {
31
40
  signal
32
41
  });
@@ -36,22 +45,21 @@ defineCustomElement('sinch-select-menu', class extends NectaryElement {
36
45
  this.#$listbox.addEventListener('click', this.#onListboxClick, {
37
46
  signal
38
47
  });
39
- this.#$optionSlot.addEventListener('slotchange', this.#onOptionSlotChange, {
48
+ this.#$search.addEventListener('-change', this.#onSearchChange, {
40
49
  signal
41
50
  });
42
- this.addEventListener('-change', this.#onChangeReactHandler, {
51
+ this.#$optionSlot.addEventListener('slotchange', this.#onOptionSlotChange, {
43
52
  signal
44
53
  });
45
- this.addEventListener('-visibility', this.#onContextVisibility, {
54
+ this.addEventListener('-change', this.#onChangeReactHandler, {
46
55
  signal
47
56
  });
48
- dispatchContextConnectEvent(this, 'keydown');
49
- dispatchContextConnectEvent(this, 'visibility');
57
+ subscribeContext(this, 'keydown', this.#onContextKeyDown, signal);
58
+ subscribeContext(this, 'visibility', this.#onContextVisibility, signal);
50
59
  }
51
60
  disconnectedCallback() {
52
- dispatchContextDisconnectEvent(this, 'keydown');
53
- dispatchContextDisconnectEvent(this, 'visibility');
54
61
  this.#controller.abort();
62
+ this.#searchDebounce.cancel();
55
63
  }
56
64
  static get observedAttributes() {
57
65
  return ['value', 'rows', 'multiple'];
@@ -115,7 +123,23 @@ defineCustomElement('sinch-select-menu', class extends NectaryElement {
115
123
  this.#selectOption($elem);
116
124
  }
117
125
  };
118
- #onContexKeydown = e => {
126
+ #onSearchChange = e => {
127
+ this.#$search.value = e.detail;
128
+ this.#searchDebounce.fn();
129
+ };
130
+ #updateSearch = () => {
131
+ const searchValue = this.#$search.value.toLowerCase();
132
+ const $options = this.#getOptionElements();
133
+ let someFound = false;
134
+ for (const $opt of $options) {
135
+ const isHidden = searchValue.length > 0 && !$opt.matchesSearch(searchValue);
136
+ someFound ||= !isHidden;
137
+ setClass($opt, 'hidden', isHidden);
138
+ }
139
+ setClass(this.#$notFound, 'active', !someFound);
140
+ this.#selectOption(null);
141
+ };
142
+ #onContextKeyDown = e => {
119
143
  this.#handleKeydown(e.detail);
120
144
  };
121
145
  #onContextVisibility = e => {
@@ -155,6 +179,11 @@ defineCustomElement('sinch-select-menu', class extends NectaryElement {
155
179
  }
156
180
  }
157
181
  #onOptionSlotChange = () => {
182
+ const isSearchActive = this.#$optionSlot.assignedElements().length >= NUM_ITEMS_SEARCH;
183
+ if (!isSearchActive) {
184
+ updateAttribute(this.#$search, 'value', null);
185
+ }
186
+ setClass(this.#$search, 'active', isSearchActive);
158
187
  this.#onValueChange(this.value);
159
188
  };
160
189
  #onValueChange(csv) {
@@ -176,7 +205,7 @@ defineCustomElement('sinch-select-menu', class extends NectaryElement {
176
205
  const $options = this.#getOptionElements();
177
206
  for (let i = 0; i < $options.length; i++) {
178
207
  const el = $options[i];
179
- if (!getBooleanAttribute(el, 'disabled')) {
208
+ if (!getBooleanAttribute(el, 'disabled') && !el.classList.contains('hidden')) {
180
209
  return el;
181
210
  }
182
211
  }
@@ -186,7 +215,7 @@ defineCustomElement('sinch-select-menu', class extends NectaryElement {
186
215
  const $options = this.#getOptionElements();
187
216
  for (let i = $options.length - 1; i >= 0; i--) {
188
217
  const el = $options[i];
189
- if (!getBooleanAttribute(el, 'disabled')) {
218
+ if (!getBooleanAttribute(el, 'disabled') && !el.classList.contains('hidden')) {
190
219
  return el;
191
220
  }
192
221
  }
@@ -198,7 +227,7 @@ defineCustomElement('sinch-select-menu', class extends NectaryElement {
198
227
  const $options = this.#getOptionElements();
199
228
  for (let i = 1; i <= $options.length; i++) {
200
229
  const el = $options[(i + index) % $options.length];
201
- if (!getBooleanAttribute(el, 'disabled')) {
230
+ if (!getBooleanAttribute(el, 'disabled') && !el.classList.contains('hidden')) {
202
231
  return el;
203
232
  }
204
233
  }
@@ -211,7 +240,7 @@ defineCustomElement('sinch-select-menu', class extends NectaryElement {
211
240
  const $options = this.#getOptionElements();
212
241
  for (let i = 1; i <= $options.length; i++) {
213
242
  const el = $options[(index - i + $options.length) % $options.length];
214
- if (!getBooleanAttribute(el, 'disabled')) {
243
+ if (!getBooleanAttribute(el, 'disabled') && !el.classList.contains('hidden')) {
215
244
  return el;
216
245
  }
217
246
  }
@@ -14,6 +14,7 @@ export declare class SelectMenuOption extends NectaryElement {
14
14
  get text(): string;
15
15
  set disabled(isDisabled: boolean);
16
16
  get disabled(): boolean;
17
+ matchesSearch(searchValue: string): boolean;
17
18
  }
18
19
  declare global {
19
20
  namespace JSX {
@@ -58,5 +58,8 @@ export class SelectMenuOption extends NectaryElement {
58
58
  get disabled() {
59
59
  return getBooleanAttribute(this, 'disabled');
60
60
  }
61
+ matchesSearch(searchValue) {
62
+ return this.text.toLowerCase().includes(searchValue);
63
+ }
61
64
  }
62
65
  defineCustomElement('sinch-select-menu-option', SelectMenuOption);
@@ -6,6 +6,7 @@ export declare type TSinchSelectMenuOptionElement = HTMLElement & {
6
6
  text: string;
7
7
  /** Disabled state */
8
8
  disabled: boolean;
9
+ matchesSearch(value: string): boolean;
9
10
  /** Value */
10
11
  setAttribute(name: 'value', value: string): void;
11
12
  /** Display text */
package/spinner/index.js CHANGED
@@ -1,22 +1,67 @@
1
- import { defineCustomElement, getLiteralAttribute, NectaryElement, updateLiteralAttribute } from '../utils';
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;margin:2px}:host([type=large]) div{height:48px;width:48px;border-width:4px}:host([type=small]) div{height:14px;width:14px;border-width:2px;margin:1px}:host([static]:not([static=false])) div{animation-play-state:paused}</style><div></div>';
3
- import { spinnerTypes } from './utils';
1
+ import { defineCustomElement, getLiteralAttribute, NectaryElement, subscribeContext, updateAttribute, updateLiteralAttribute } from '../utils';
2
+ import { assertSize, DEFAULT_SIZE, sizeValues } from '../utils/size';
3
+ const templateHTML = '<style>@keyframes spinner{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}:host{display:block;--sinch-size-icon:var(--sinch-spinner-size-m);--sinch-spinner-thickness:3px}:host([data-size="l"]){--sinch-size-icon:var(--sinch-spinner-size-l);--sinch-spinner-thickness:4px}:host([data-size="m"]){--sinch-size-icon:var(--sinch-spinner-size-m);--sinch-spinner-thickness:3px}:host([data-size="s"]){--sinch-size-icon:var(--sinch-spinner-size-s);--sinch-spinner-thickness:2px}#wrapper{position:relative;height:var(--sinch-size-icon);width:var(--sinch-size-icon)}#bg{position:absolute;inset:1px;border:solid var(--sinch-spinner-thickness) var(--sinch-color-icon);border-radius:50%;opacity:.3}#fg{position:absolute;inset:1px;border:solid var(--sinch-spinner-thickness) transparent;border-bottom-color:var(--sinch-color-icon);border-radius:50%;will-change:transform;animation:1.5s linear infinite spinner;animation-play-state:running}</style><div id="wrapper"><div id="bg"></div><div id="fg"></div></div>';
4
4
  const template = document.createElement('template');
5
5
  template.innerHTML = templateHTML;
6
6
  defineCustomElement('sinch-spinner', class extends NectaryElement {
7
+ #controller = null;
7
8
  constructor() {
8
9
  super();
9
10
  const shadowRoot = this.attachShadow();
10
11
  shadowRoot.appendChild(template.content.cloneNode(true));
11
12
  }
12
13
  connectedCallback() {
14
+ this.#controller = new AbortController();
13
15
  this.setAttribute('aria-live', 'polite');
14
16
  this.setAttribute('aria-busy', 'true');
17
+ subscribeContext(this, 'size', this.#onContextSize, this.#controller.signal);
15
18
  }
16
- set type(value) {
17
- updateLiteralAttribute(this, spinnerTypes, 'type', value);
19
+ disconnectedCallback() {
20
+ this.#controller.abort();
18
21
  }
19
- get type() {
20
- return getLiteralAttribute(this, spinnerTypes, 'type', 'medium');
22
+ static get observedAttributes() {
23
+ return ['size', 'data-size'];
21
24
  }
25
+ attributeChangedCallback(name, oldVal, newVal) {
26
+ if (oldVal === newVal) {
27
+ return;
28
+ }
29
+ switch (name) {
30
+ case 'size':
31
+ {
32
+ updateAttribute(this, 'data-size', newVal);
33
+ break;
34
+ }
35
+ case 'data-size':
36
+ {
37
+ if ('production' !== 'production') {
38
+ assertSize(newVal, 'sinch-spinner');
39
+ }
40
+ break;
41
+ }
42
+ }
43
+ }
44
+ set size(size) {
45
+ updateLiteralAttribute(this, sizeValues, 'size', size);
46
+ }
47
+ get size() {
48
+ return getLiteralAttribute(this, sizeValues, 'size', DEFAULT_SIZE);
49
+ }
50
+ #onContextSize = e => {
51
+ if (this.hasAttribute('size')) {
52
+ return;
53
+ }
54
+ switch (e.detail) {
55
+ case 'l':
56
+ case 'm':
57
+ {
58
+ this.setAttribute('data-size', 'm');
59
+ break;
60
+ }
61
+ default:
62
+ {
63
+ this.setAttribute('data-size', 's');
64
+ }
65
+ }
66
+ };
22
67
  });
@@ -1,10 +1,9 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchSpinnerType = 'large' | 'medium' | 'small';
2
+ import type { TSinchSize } from '../utils/size';
3
3
  export declare type TSinchSpinnerElement = HTMLElement & {
4
- type: TSinchSpinnerType;
5
- setAttribute(name: 'type', value: TSinchSpinnerType): void;
4
+ size: TSinchSize;
5
+ setAttribute(name: 'size', value: TSinchSize): void;
6
6
  };
7
7
  export declare type TSinchSpinnerReact = TSinchElementReact<TSinchSpinnerElement> & {
8
- type?: TSinchSpinnerType;
9
- static?: boolean;
8
+ size?: TSinchSize;
10
9
  };
@@ -1,20 +1,24 @@
1
1
  import { defineCustomElement, unpackCsv } from '../utils';
2
2
  defineCustomElement('sinch-stop-events', class extends HTMLElement {
3
+ #controller = null;
3
4
  constructor() {
4
5
  super();
5
6
  this.style.display = 'contents';
6
7
  }
7
8
  connectedCallback() {
9
+ this.#controller = new AbortController();
10
+ const {
11
+ signal
12
+ } = this.#controller;
8
13
  const events = unpackCsv(this.getAttribute('events'));
9
14
  for (const event of events) {
10
- this.addEventListener(event, this.#stopEvent);
15
+ this.addEventListener(event, this.#stopEvent, {
16
+ signal
17
+ });
11
18
  }
12
19
  }
13
20
  disconnectedCallback() {
14
- const events = unpackCsv(this.getAttribute('events'));
15
- for (const event of events) {
16
- this.removeEventListener(event, this.#stopEvent);
17
- }
21
+ this.#controller.abort();
18
22
  }
19
23
  #stopEvent = e => {
20
24
  e.stopPropagation();
package/table/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineCustomElement, NectaryElement } from '../utils';
2
- const templateHTML = '<style>:host{display:table;font:var(--sinch-font-body);color:var(--sinch-color-text-default);--sinch-color-icon:var(--sinch-color-text-default)}</style><slot></slot>';
2
+ const templateHTML = '<style>:host{display:table;font:var(--sinch-font-text-m);color:var(--sinch-color-text-default);--sinch-color-icon:var(--sinch-color-stormy-500)}</style><slot></slot>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
5
  defineCustomElement('sinch-table', class extends NectaryElement {
package/tag/index.js CHANGED
@@ -7,7 +7,6 @@ template.innerHTML = templateHTML;
7
7
  defineCustomElement('sinch-tag', class extends NectaryElement {
8
8
  #$text;
9
9
  #$wrapper;
10
- #isConnected = false;
11
10
  constructor() {
12
11
  super();
13
12
  const shadowRoot = this.attachShadow();
@@ -16,12 +15,9 @@ defineCustomElement('sinch-tag', class extends NectaryElement {
16
15
  this.#$text = shadowRoot.querySelector('#text');
17
16
  }
18
17
  connectedCallback() {
19
- this.#isConnected = true;
18
+ super.connectedCallback();
20
19
  this.#updateColor();
21
20
  }
22
- disconnectedCallback() {
23
- this.#isConnected = false;
24
- }
25
21
  get color() {
26
22
  return getAttribute(this, 'color');
27
23
  }
@@ -58,7 +54,7 @@ defineCustomElement('sinch-tag', class extends NectaryElement {
58
54
  }
59
55
  }
60
56
  #updateColor() {
61
- if (!this.#isConnected) {
57
+ if (!this.isConnected) {
62
58
  return;
63
59
  }
64
60
  const colorName = this.color;
package/text/index.js CHANGED
@@ -46,7 +46,9 @@ defineCustomElement('sinch-text', class extends NectaryElement {
46
46
  switch (name) {
47
47
  case 'type':
48
48
  {
49
- assertType(newVal);
49
+ if ('production' !== 'production') {
50
+ assertType(newVal);
51
+ }
50
52
  break;
51
53
  }
52
54
  case 'inline':
package/textarea/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
2
- const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}#input{all:initial;display:block;border:1px solid var(--sinch-color-stormy-200);box-sizing:border-box;border-radius:var(--sinch-shape-radius-s);width:100%;padding:8px 12px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-100);resize:none}#input::placeholder{font:var(--sinch-font-body);color:var(--sinch-color-text-muted);opacity:1}#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([invalid]:not([invalid=false])) #input:enabled{border-color:var(--sinch-color-text-invalid)}</style><textarea id="input"></textarea>';
2
+ const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}#input{all:initial;display:block;border:1px solid var(--sinch-color-stormy-200);box-sizing:border-box;border-radius:var(--sinch-shape-radius-s);width:100%;padding:8px 12px;font:var(--sinch-font-text-m);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-100);resize:none}#input::placeholder{font:var(--sinch-font-text-m);color:var(--sinch-color-text-muted);opacity:1}#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([invalid]:not([invalid=false])) #input:enabled{border-color:var(--sinch-color-text-invalid)}</style><textarea id="input"></textarea>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
5
  defineCustomElement('sinch-textarea', class extends NectaryElement {
@@ -0,0 +1,146 @@
1
+ :root,
2
+ :host {
3
+ /* Primary */
4
+ --sinch-button-primary-color-background: var(--sinch-color-tropical-500);
5
+ --sinch-button-primary-color-background-hover: var(--sinch-color-tropical-400);
6
+ --sinch-button-primary-color-background-active: var(--sinch-color-tropical-600);
7
+ --sinch-button-primary-color-background-disabled: var(--sinch-color-tropical-200);
8
+ --sinch-button-primary-color-border: transparent;
9
+ --sinch-button-primary-color-border-hover: transparent;
10
+ --sinch-button-primary-color-border-active: transparent;
11
+ --sinch-button-primary-color-border-disabled: transparent;
12
+ --sinch-button-primary-color-text: var(--sinch-color-snow-100);
13
+ --sinch-button-primary-color-text-hover: var(--sinch-color-snow-100);
14
+ --sinch-button-primary-color-text-active: var(--sinch-color-snow-100);
15
+ --sinch-button-primary-color-text-disabled: var(--sinch-color-snow-100);
16
+ --sinch-button-primary-color-icon: var(--sinch-color-snow-100);
17
+ --sinch-button-primary-color-icon-hover: var(--sinch-color-snow-100);
18
+ --sinch-button-primary-color-icon-active: var(--sinch-color-snow-100);
19
+ --sinch-button-primary-color-icon-disabled: var(--sinch-color-snow-100);
20
+ --sinch-button-primary-mix-blend-mode: initial;
21
+
22
+ /* Secondary */
23
+ --sinch-button-secondary-color-background: var(--sinch-color-snow-100);
24
+ --sinch-button-secondary-color-background-hover: var(--sinch-color-tropical-100);
25
+ --sinch-button-secondary-color-background-active: var(--sinch-color-tropical-200);
26
+ --sinch-button-secondary-color-background-disabled: var(--sinch-color-snow-100);
27
+ --sinch-button-secondary-color-border: var(--sinch-color-tropical-500);
28
+ --sinch-button-secondary-color-border-hover: var(--sinch-color-tropical-500);
29
+ --sinch-button-secondary-color-border-active: var(--sinch-color-tropical-500);
30
+ --sinch-button-secondary-color-border-disabled: var(--sinch-color-tropical-200);
31
+ --sinch-button-secondary-color-text: var(--sinch-color-tropical-500);
32
+ --sinch-button-secondary-color-text-hover: var(--sinch-color-tropical-500);
33
+ --sinch-button-secondary-color-text-active: var(--sinch-color-tropical-500);
34
+ --sinch-button-secondary-color-text-disabled: var(--sinch-color-tropical-200);
35
+ --sinch-button-secondary-color-icon: var(--sinch-color-tropical-500);
36
+ --sinch-button-secondary-color-icon-hover: var(--sinch-color-tropical-500);
37
+ --sinch-button-secondary-color-icon-active: var(--sinch-color-tropical-500);
38
+ --sinch-button-secondary-color-icon-disabled: var(--sinch-color-tropical-200);
39
+ --sinch-button-secondary-mix-blend-mode: initial;
40
+
41
+ /* Tertiary */
42
+ --sinch-button-tertiary-color-background: transparent;
43
+ --sinch-button-tertiary-color-background-hover: var(--sinch-color-bg-hover);
44
+ --sinch-button-tertiary-color-background-active: var(--sinch-color-bg-active);
45
+ --sinch-button-tertiary-color-background-disabled: transparent;
46
+ --sinch-button-tertiary-color-border: transparent;
47
+ --sinch-button-tertiary-color-border-hover: transparent;
48
+ --sinch-button-tertiary-color-border-active: transparent;
49
+ --sinch-button-tertiary-color-border-disabled: transparent;
50
+ --sinch-button-tertiary-color-text: var(--sinch-color-tropical-500);
51
+ --sinch-button-tertiary-color-text-hover: var(--sinch-color-tropical-500);
52
+ --sinch-button-tertiary-color-text-active: var(--sinch-color-tropical-500);
53
+ --sinch-button-tertiary-color-text-disabled: var(--sinch-color-tropical-200);
54
+ --sinch-button-tertiary-color-icon: var(--sinch-color-tropical-500);
55
+ --sinch-button-tertiary-color-icon-hover: var(--sinch-color-tropical-500);
56
+ --sinch-button-tertiary-color-icon-active: var(--sinch-color-tropical-500);
57
+ --sinch-button-tertiary-color-icon-disabled: var(--sinch-color-tropical-200);
58
+ --sinch-button-tertiary-mix-blend-mode: multiply;
59
+
60
+ /* Cta Primary */
61
+ --sinch-button-cta-primary-color-background: var(--sinch-color-honey-500);
62
+ --sinch-button-cta-primary-color-background-hover: var(--sinch-color-honey-400);
63
+ --sinch-button-cta-primary-color-background-active: var(--sinch-color-honey-600);
64
+ --sinch-button-cta-primary-color-background-disabled: var(--sinch-color-honey-200);
65
+ --sinch-button-cta-primary-color-border: transparent;
66
+ --sinch-button-cta-primary-color-border-hover: transparent;
67
+ --sinch-button-cta-primary-color-border-active: transparent;
68
+ --sinch-button-cta-primary-color-border-disabled: transparent;
69
+ --sinch-button-cta-primary-color-text: var(--sinch-color-stormy-500);
70
+ --sinch-button-cta-primary-color-text-hover: var(--sinch-color-stormy-500);
71
+ --sinch-button-cta-primary-color-text-active: var(--sinch-color-stormy-500);
72
+ --sinch-button-cta-primary-color-text-disabled: var(--sinch-color-stormy-300);
73
+ --sinch-button-cta-primary-color-icon: var(--sinch-color-stormy-500);
74
+ --sinch-button-cta-primary-color-icon-hover: var(--sinch-color-stormy-500);
75
+ --sinch-button-cta-primary-color-icon-active: var(--sinch-color-stormy-500);
76
+ --sinch-button-cta-primary-color-icon-disabled: var(--sinch-color-stormy-300);
77
+ --sinch-button-cta-primary-mix-blend-mode: initial;
78
+
79
+ /* Cta Secondary */
80
+ --sinch-button-cta-secondary-color-background: var(--sinch-color-snow-100);
81
+ --sinch-button-cta-secondary-color-background-hover: var(--sinch-color-snow-200);
82
+ --sinch-button-cta-secondary-color-background-active: var(--sinch-color-snow-400);
83
+ --sinch-button-cta-secondary-color-background-disabled: var(--sinch-color-snow-100);
84
+ --sinch-button-cta-secondary-color-border: var(--sinch-color-stormy-500);
85
+ --sinch-button-cta-secondary-color-border-hover: var(--sinch-color-stormy-500);
86
+ --sinch-button-cta-secondary-color-border-active: var(--sinch-color-stormy-500);
87
+ --sinch-button-cta-secondary-color-border-disabled: var(--sinch-color-stormy-100);
88
+ --sinch-button-cta-secondary-color-text: var(--sinch-color-stormy-500);
89
+ --sinch-button-cta-secondary-color-text-hover: var(--sinch-color-stormy-500);
90
+ --sinch-button-cta-secondary-color-text-active: var(--sinch-color-stormy-500);
91
+ --sinch-button-cta-secondary-color-text-disabled: var(--sinch-color-stormy-100);
92
+ --sinch-button-cta-secondary-color-icon: var(--sinch-color-stormy-500);
93
+ --sinch-button-cta-secondary-color-icon-hover: var(--sinch-color-stormy-500);
94
+ --sinch-button-cta-secondary-color-icon-active: var(--sinch-color-stormy-500);
95
+ --sinch-button-cta-secondary-color-icon-disabled: var(--sinch-color-stormy-100);
96
+ --sinch-button-cta-secondary-mix-blend-mode: initial;
97
+
98
+ /* Destructive */
99
+ --sinch-button-destructive-color-background: transparent;
100
+ --sinch-button-destructive-color-background-hover: var(--sinch-color-raspberry-100);
101
+ --sinch-button-destructive-color-background-active: var(--sinch-color-raspberry-100);
102
+ --sinch-button-destructive-color-background-disabled: transparent;
103
+ --sinch-button-destructive-color-border: var(--sinch-color-raspberry-500);
104
+ --sinch-button-destructive-color-border-hover: var(--sinch-color-raspberry-500);
105
+ --sinch-button-destructive-color-border-active: var(--sinch-color-raspberry-500);
106
+ --sinch-button-destructive-color-border-disabled: var(--sinch-color-raspberry-200);
107
+ --sinch-button-destructive-color-text: var(--sinch-color-raspberry-500);
108
+ --sinch-button-destructive-color-text-hover: var(--sinch-color-raspberry-500);
109
+ --sinch-button-destructive-color-text-active: var(--sinch-color-raspberry-500);
110
+ --sinch-button-destructive-color-text-disabled: var(--sinch-color-raspberry-200);
111
+ --sinch-button-destructive-color-icon: var(--sinch-color-raspberry-500);
112
+ --sinch-button-destructive-color-icon-hover: var(--sinch-color-raspberry-500);
113
+ --sinch-button-destructive-color-icon-active: var(--sinch-color-raspberry-500);
114
+ --sinch-button-destructive-color-icon-disabled: var(--sinch-color-raspberry-200);
115
+ --sinch-button-destructive-mix-blend-mode: initial;
116
+
117
+ /* Default */
118
+ --sinch-button-color-background: var(--sinch-button-primary-color-background);
119
+ --sinch-button-color-background-hover: var(--sinch-button-primary-color-background-hover);
120
+ --sinch-button-color-background-active: var(--sinch-button-primary-color-background-active);
121
+ --sinch-button-color-background-disabled: var(--sinch-button-primary-color-background-disabled);
122
+ --sinch-button-color-border: var(--sinch-button-primary-color-border);
123
+ --sinch-button-color-border-hover: var(--sinch-button-primary-color-border-hover);
124
+ --sinch-button-color-border-active: var(--sinch-button-primary-color-border-active);
125
+ --sinch-button-color-border-disabled: var(--sinch-button-primary-color-border-disabled);
126
+ --sinch-button-color-text: var(--sinch-button-primary-color-text);
127
+ --sinch-button-color-text-hover: var(--sinch-button-primary-color-text-hover);
128
+ --sinch-button-color-text-active: var(--sinch-button-primary-color-text-active);
129
+ --sinch-button-color-text-disabled: var(--sinch-button-primary-color-text-disabled);
130
+ --sinch-button-color-icon: var(--sinch-button-primary-color-icon);
131
+ --sinch-button-color-icon-hover: var(--sinch-button-primary-color-icon-hover);
132
+ --sinch-button-color-icon-active: var(--sinch-button-primary-color-icon-active);
133
+ --sinch-button-color-icon-disabled: var(--sinch-button-primary-color-icon-disabled);
134
+ --sinch-button-mix-blend-mode: var(--sinch-button-primary-mix-blend-mode);
135
+
136
+ /* Font */
137
+ --sinch-button-font-l: 700 16px/24px var(--sinch-font-family);
138
+ --sinch-button-font-m: 700 16px/24px var(--sinch-font-family);
139
+ --sinch-button-font-s: 700 14px/20px var(--sinch-font-family);
140
+ --sinch-button-font: var(--sinch-button-font-m);
141
+
142
+ /* Icon Size */
143
+ --sinch-button-icon-size-l: 24px;
144
+ --sinch-button-icon-size-m: 24px;
145
+ --sinch-button-icon-size-s: 16px;
146
+ }
@@ -1,22 +1,5 @@
1
- @import "theme/palette.css";
2
- @import "theme/fonts.css";
3
- @import "theme/typography.css";
4
- @import "theme/shapes.css";
5
- @import "theme/elevation.css";
6
-
7
- /* Components */
8
- @import "theme/avatar.css";
9
- @import "theme/badge.css";
10
- @import "theme/chip.css";
11
- @import "theme/color-swatch.css";
12
- @import "theme/tag.css";
13
- @import "theme/emoji.css";
14
- @import "theme/icon.css";
15
-
16
1
  :root,
17
2
  :host {
18
- --sinch-theme: 1;
19
-
20
3
  /* Contextual */
21
4
  --sinch-color-bg-primary-light: var(--sinch-color-snow-100);
22
5
  --sinch-color-bg-primary-contrast: var(--sinch-color-snow-200);
@@ -24,6 +7,8 @@
24
7
  --sinch-color-bg-comp-blue: var(--sinch-color-ocean-100);
25
8
  --sinch-color-bg-comp-yellow: var(--sinch-color-honey-200);
26
9
  --sinch-color-bg-comp-red: var(--sinch-color-raspberry-100);
10
+ --sinch-color-bg-hover: var(--sinch-color-snow-200);
11
+ --sinch-color-bg-active: var(--sinch-color-snow-400);
27
12
  --sinch-color-text-default: var(--sinch-color-stormy-700);
28
13
  --sinch-color-text-inverted: var(--sinch-color-snow-100);
29
14
  --sinch-color-text-muted: var(--sinch-color-stormy-300);
@@ -39,12 +24,5 @@
39
24
  --sinch-color-border-disabled: var(--sinch-color-snow-400);
40
25
  --sinch-color-border-focus: var(--sinch-color-ocean-500);
41
26
  --sinch-color-border-invalid: var(--sinch-color-raspberry-600);
42
-
43
- /* Deprecated */
44
- --sinch-font-hero: 700 56px/72px var(--sinch-font-family);
45
- --sinch-font-body: 400 16px/24px var(--sinch-font-family);
46
- --sinch-font-emphasized-body: 600 16px/24px var(--sinch-font-family);
47
- --sinch-font-small-text: 400 14px/22px var(--sinch-font-family);
48
- --sinch-font-extra-small-text: 400 12px/20px var(--sinch-font-family);
49
- --sinch-font-monospace: 400 16px/24px "monospace";
27
+ --sinch-color-icon: var(--sinch-color-stormy-500);
50
28
  }
@@ -1,6 +1,6 @@
1
1
  :root,
2
2
  :host {
3
- --sinch-elevation-level-0: 0 0 0 0 rgba(10, 39, 61, 0.1);
3
+ --sinch-elevation-level-0: none;
4
4
  --sinch-elevation-level-1: 1px 2px 6px rgba(10, 39, 61, 0.1);
5
5
  --sinch-elevation-level-2: 1px 4px 8px rgba(10, 39, 61, 0.1);
6
6
  --sinch-elevation-level-3: 1px 6px 12px rgba(10, 39, 61, 0.15);
package/theme/flag.css ADDED
@@ -0,0 +1,4 @@
1
+ :root,
2
+ :host {
3
+ --sinch-flag-src-url: "https://flagcdn.com/%s.svg";
4
+ }
package/theme/fonts.css CHANGED
@@ -1,36 +1,3 @@
1
- @font-face {
2
- font-family: "Gilroy";
3
- font-weight: 400;
4
- font-style: normal;
5
- font-display: swap;
6
- src:
7
- local("Gilroy-Regular"),
8
- url("https://d2vu40klajma73.cloudfront.net/Gilroy-Regular.woff2") format("woff2"),
9
- url("https://d2vu40klajma73.cloudfront.net/Gilroy-Regular.woff") format("woff");
10
- }
11
-
12
- @font-face {
13
- font-family: "Gilroy";
14
- font-weight: 600;
15
- font-style: normal;
16
- font-display: swap;
17
- src:
18
- local("Gilroy-SemiBold"),
19
- url("https://d2vu40klajma73.cloudfront.net/Gilroy-SemiBold.woff2") format("woff2"),
20
- url("https://d2vu40klajma73.cloudfront.net/Gilroy-SemiBold.woff") format("woff");
21
- }
22
-
23
- @font-face {
24
- font-family: "Gilroy";
25
- font-weight: 700;
26
- font-style: normal;
27
- font-display: swap;
28
- src:
29
- local("Gilroy-Bold"),
30
- url("https://d2vu40klajma73.cloudfront.net/Gilroy-Bold.woff2") format("woff2"),
31
- url("https://d2vu40klajma73.cloudfront.net/Gilroy-Bold.woff") format("woff");
32
- }
33
-
34
1
  @font-face {
35
2
  font-family: "DM Sans";
36
3
  font-weight: 400;
package/theme/fonts.json CHANGED
@@ -1,37 +1,4 @@
1
1
  [
2
- {
3
- "family": "Gilroy",
4
- "weight": 400,
5
- "style": "normal",
6
- "display": "swap",
7
- "src": {
8
- "local": "Gilroy-Regular",
9
- "woff2": "https://d2vu40klajma73.cloudfront.net/Gilroy-Regular.woff2",
10
- "woff": "https://d2vu40klajma73.cloudfront.net/Gilroy-Regular.woff"
11
- }
12
- },
13
- {
14
- "family": "Gilroy",
15
- "weight": 600,
16
- "style": "normal",
17
- "display": "swap",
18
- "src": {
19
- "local": "Gilroy-SemiBold",
20
- "woff2": "https://d2vu40klajma73.cloudfront.net/Gilroy-SemiBold.woff2",
21
- "woff": "https://d2vu40klajma73.cloudfront.net/Gilroy-SemiBold.woff"
22
- }
23
- },
24
- {
25
- "family": "Gilroy",
26
- "weight": 700,
27
- "style": "normal",
28
- "display": "swap",
29
- "src": {
30
- "local": "Gilroy-Bold",
31
- "woff2": "https://d2vu40klajma73.cloudfront.net/Gilroy-Bold.woff2",
32
- "woff": "https://d2vu40klajma73.cloudfront.net/Gilroy-Bold.woff"
33
- }
34
- },
35
2
  {
36
3
  "family": "DM Sans",
37
4
  "weight": 400,