@nectary/components 0.38.0 → 0.39.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 (54) hide show
  1. package/accordion/types.d.ts +1 -0
  2. package/card/index.d.ts +2 -0
  3. package/card/index.js +6 -31
  4. package/date-picker/index.js +42 -2
  5. package/date-picker/types.d.ts +25 -1
  6. package/dialog/index.d.ts +1 -0
  7. package/dialog/index.js +3 -2
  8. package/dropdown/types.d.ts +2 -0
  9. package/inline-alert/index.js +1 -1
  10. package/package.json +1 -1
  11. package/pagination/types.d.ts +1 -0
  12. package/radio/types.d.ts +1 -0
  13. package/segment/index.js +1 -1
  14. package/segment-collapse/types.d.ts +1 -0
  15. package/segmented-control/types.d.ts +1 -0
  16. package/segmented-icon-control/types.d.ts +1 -0
  17. package/select/types.d.ts +1 -1
  18. package/tabs/types.d.ts +1 -0
  19. package/tag/index.d.ts +1 -0
  20. package/tag/index.js +10 -3
  21. package/tag/utils.d.ts +3 -0
  22. package/tag/utils.js +6 -1
  23. package/tag-close/index.js +5 -1
  24. package/tag-close/types.d.ts +3 -1
  25. package/time-picker/index.js +9 -1
  26. package/time-picker/types.d.ts +5 -1
  27. package/toast/index.d.ts +17 -0
  28. package/toast/index.js +153 -0
  29. package/toast/types.d.ts +28 -0
  30. package/toast/utils.d.ts +5 -0
  31. package/toast/utils.js +6 -0
  32. package/toast-manager/index.d.ts +17 -0
  33. package/toast-manager/index.js +271 -0
  34. package/toast-manager/types.d.ts +7 -0
  35. package/toggle/index.js +3 -4
  36. package/toggle/types.d.ts +1 -0
  37. package/utils.d.ts +1 -0
  38. package/utils.js +22 -0
  39. package/card-button/index.d.ts +0 -11
  40. package/card-button/index.js +0 -77
  41. package/card-button/types.d.ts +0 -12
  42. package/card-link/index.d.ts +0 -12
  43. package/card-link/index.js +0 -115
  44. package/card-link/types.d.ts +0 -14
  45. package/search/index.d.ts +0 -14
  46. package/search/index.js +0 -523
  47. package/search/types.d.ts +0 -25
  48. package/search/types.js +0 -1
  49. package/search-option/index.d.ts +0 -11
  50. package/search-option/index.js +0 -55
  51. package/search-option/types.d.ts +0 -9
  52. package/search-option/types.js +0 -1
  53. /package/{card-link → toast}/types.js +0 -0
  54. /package/{card-button → toast-manager}/types.js +0 -0
@@ -10,6 +10,7 @@ export declare type TSinchAccordionElement = HTMLElement & {
10
10
  export declare type TSinchAccordionReact = TSinchElementReact<TSinchAccordionElement> & {
11
11
  multiple?: boolean;
12
12
  value: string;
13
+ /** @deprecated */
13
14
  onChange?: (e: SyntheticEvent<TSinchAccordionElement, CustomEvent<string>>) => void;
14
15
  'on-change'?: (e: CustomEvent<string>) => void;
15
16
  };
package/card/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import '../title';
2
+ import '../text';
1
3
  import type { TSinchCardElement, TSinchCardReact } from './types';
2
4
  declare global {
3
5
  namespace JSX {
package/card/index.js CHANGED
@@ -1,17 +1,19 @@
1
1
  import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
2
2
  import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
3
3
 
4
- var _$text, _$label, _$caption, _$illustrationSlot, _$actionSlot, _$illustrationSlotWrapper, _onIllustrationSlotChange, _updateDisabledAttributeInChildren;
4
+ var _$text, _$label, _$caption, _$illustrationSlot, _$illustrationSlotWrapper, _onIllustrationSlotChange;
5
5
 
6
6
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
7
7
 
8
8
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
9
9
 
10
+ import '../title';
11
+ import '../text';
10
12
  import { defineCustomElement, getBooleanAttribute, getAttribute, updateBooleanAttribute, updateAttribute, setClass, NectaryElement } from '../utils';
11
- const templateHTML = '<style>:host{display:block;outline:0}#wrapper{border-radius:var(--sinch-shape-radius-l);border:1px solid var(--sinch-color-snow-700);background-color:var(--sinch-color-snow-100);box-shadow:var(--sinch-elevation-level-0);overflow:hidden}:host(:hover) #wrapper{box-shadow:var(--sinch-elevation-level-1)}#card-body{padding:24px;box-sizing:border-box;display:flex;flex-direction:column;gap:16px}#illustration-wrapper{display:none;overflow:hidden;height:240px}#illustration-wrapper.active{display:block}#label{margin:0;font:var(--sinch-font-title-xs);color:var(--sinch-color-stormy-300);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#label:empty{display:none}#header{display:flex;flex-direction:row;align-items:center;gap:8px;--sinch-size-icon:48px}#caption{font:var(--sinch-font-title-m);color:var(--sinch-color-stormy-500);flex:1;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#description{margin:0;font:var(--sinch-font-body);color:var(--sinch-color-stormy-500);flex:1;min-height:0;max-height:120px;overflow-y:auto}#description:empty{display:none}:host([disabled]:not([disabled=false])) :is(#illustration-wrapper,#description,#header,#label){opacity:.6}::slotted(sinch-card-button),::slotted(sinch-card-link){margin-top:20px;align-self:flex-start;max-width:100%}</style><div id="wrapper"><div id="illustration-wrapper"><slot name="illustration"></slot></div><div id="card-body"><p id="label"></p><div id="header"><slot name="icon"></slot><span id="caption"></span></div><p id="description"></p><slot name="action"></slot></div></div>';
13
+ const templateHTML = '<style>:host{display:block;outline:0}#wrapper{border-radius:var(--sinch-shape-radius-l);border:1px solid var(--sinch-color-snow-700);background-color:var(--sinch-color-snow-100);box-shadow:var(--sinch-elevation-level-0);overflow:hidden}:host(:hover) #wrapper{box-shadow:var(--sinch-elevation-level-1)}#card-body{padding:24px;box-sizing:border-box;display:flex;flex-direction:column;gap:16px}#illustration-wrapper{display:none;overflow:hidden;height:240px}#illustration-wrapper.active{display:block}#label{color:var(--sinch-color-stormy-300)}#label:empty{display:none}#header{display:flex;flex-direction:row;align-items:center;gap:8px;--sinch-size-icon:48px}#caption{color:var(--sinch-color-stormy-500);flex:1;min-width:0}#description{color:var(--sinch-color-stormy-500);flex:1;min-height:0;max-height:120px;overflow-y:auto}#description:empty{display:none}:host([disabled]:not([disabled=false])) :is(#illustration-wrapper,#description,#header,#label){opacity:.6}slot[name=action]::slotted(*){margin-top:20px;align-self:flex-start;max-width:100%}</style><div id="wrapper"><div id="illustration-wrapper"><slot name="illustration"></slot></div><div id="card-body"><sinch-text id="label" type="s" emphasized ellipsis></sinch-text><div id="header"><slot name="icon"></slot><sinch-title id="caption" type="m" level="3" ellipsis></sinch-title></div><sinch-text id="description" type="m"></sinch-text><slot name="action"></slot></div></div>';
12
14
  const template = document.createElement('template');
13
15
  template.innerHTML = templateHTML;
14
- defineCustomElement('sinch-card', (_$text = new WeakMap(), _$label = new WeakMap(), _$caption = new WeakMap(), _$illustrationSlot = new WeakMap(), _$actionSlot = new WeakMap(), _$illustrationSlotWrapper = new WeakMap(), _onIllustrationSlotChange = new WeakMap(), _updateDisabledAttributeInChildren = new WeakMap(), class extends NectaryElement {
16
+ defineCustomElement('sinch-card', (_$text = new WeakMap(), _$label = new WeakMap(), _$caption = new WeakMap(), _$illustrationSlot = new WeakMap(), _$illustrationSlotWrapper = new WeakMap(), _onIllustrationSlotChange = new WeakMap(), class extends NectaryElement {
15
17
  constructor() {
16
18
  super();
17
19
 
@@ -35,11 +37,6 @@ defineCustomElement('sinch-card', (_$text = new WeakMap(), _$label = new WeakMap
35
37
  value: void 0
36
38
  });
37
39
 
38
- _classPrivateFieldInitSpec(this, _$actionSlot, {
39
- writable: true,
40
- value: void 0
41
- });
42
-
43
40
  _classPrivateFieldInitSpec(this, _$illustrationSlotWrapper, {
44
41
  writable: true,
45
42
  value: void 0
@@ -52,15 +49,6 @@ defineCustomElement('sinch-card', (_$text = new WeakMap(), _$label = new WeakMap
52
49
  }
53
50
  });
54
51
 
55
- _classPrivateFieldInitSpec(this, _updateDisabledAttributeInChildren, {
56
- writable: true,
57
- value: () => {
58
- for (const $el of _classPrivateFieldGet(this, _$actionSlot).assignedElements()) {
59
- updateAttribute($el, 'disabled', this.getAttribute('disabled'));
60
- }
61
- }
62
- });
63
-
64
52
  const shadowRoot = this.attachShadow();
65
53
  shadowRoot.appendChild(template.content.cloneNode(true));
66
54
 
@@ -72,21 +60,15 @@ defineCustomElement('sinch-card', (_$text = new WeakMap(), _$label = new WeakMap
72
60
 
73
61
  _classPrivateFieldSet(this, _$illustrationSlot, shadowRoot.querySelector('slot[name="illustration"]'));
74
62
 
75
- _classPrivateFieldSet(this, _$actionSlot, shadowRoot.querySelector('slot[name="action"]'));
76
-
77
63
  _classPrivateFieldSet(this, _$illustrationSlotWrapper, shadowRoot.querySelector('#illustration-wrapper'));
78
64
  }
79
65
 
80
66
  connectedCallback() {
81
67
  _classPrivateFieldGet(this, _$illustrationSlot).addEventListener('slotchange', _classPrivateFieldGet(this, _onIllustrationSlotChange));
82
-
83
- _classPrivateFieldGet(this, _$actionSlot).addEventListener('slotchange', _classPrivateFieldGet(this, _updateDisabledAttributeInChildren));
84
68
  }
85
69
 
86
70
  disconnectedCallback() {
87
71
  _classPrivateFieldGet(this, _$illustrationSlot).removeEventListener('slotchange', _classPrivateFieldGet(this, _onIllustrationSlotChange));
88
-
89
- _classPrivateFieldGet(this, _$actionSlot).removeEventListener('slotchange', _classPrivateFieldGet(this, _updateDisabledAttributeInChildren));
90
72
  }
91
73
 
92
74
  static get observedAttributes() {
@@ -109,14 +91,7 @@ defineCustomElement('sinch-card', (_$text = new WeakMap(), _$label = new WeakMap
109
91
 
110
92
  case 'caption':
111
93
  {
112
- _classPrivateFieldGet(this, _$caption).textContent = newVal;
113
- break;
114
- }
115
-
116
- case 'disabled':
117
- {
118
- _classPrivateFieldGet(this, _updateDisabledAttributeInChildren).call(this);
119
-
94
+ updateAttribute(_classPrivateFieldGet(this, _$caption), 'text', newVal);
120
95
  break;
121
96
  }
122
97
  }
@@ -20,7 +20,7 @@ import '../icons/delete-outline';
20
20
  import '../icons/today';
21
21
  import '../text';
22
22
  import { defineCustomElement, getAttribute, getReactEventHandler, getRect, NectaryElement, setClass, updateAttribute, updateBooleanAttribute } from '../utils';
23
- const templateHTML = '<style>:host{display:block;outline:0}#content{width:fit-content;box-sizing:border-box;padding:16px;display:flex;flex-direction:column;gap:8px}#month{display:flex;flex-direction:column;row-gap:8px}.week{display:flex;flex-direction:row;column-gap:8px}.week.empty{display:none}.day{all:initial;font:var(--sinch-font-text-xs);color:var(--sinch-color-text-default);text-align:center;border-radius:var(--sinch-shape-radius-m);width:24px;height:24px;line-height:22px;cursor:pointer;border:1px solid transparent;background-color:transparent;box-sizing:border-box;user-select:none}.day.today{border:1px solid var(--sinch-color-stormy-500)}.day:disabled{cursor:initial;color:var(--sinch-color-snow-700)}.day:focus-visible{outline:1px solid var(--sinch-color-aqua-400);outline-offset:1px}@supports not selector(:focus-visible){.day:focus{outline:1px solid var(--sinch-color-aqua-400);outline-offset:1px}}.day.selected{background-color:var(--sinch-color-stormy-500);color:var(--sinch-color-snow-100)}.day:hover:not(:disabled):not(.selected){background-color:var(--sinch-color-snow-600)}#week-day-names{display:flex;flex-direction:row;gap:8px;height:24px}.week-day-name{font:var(--sinch-font-text-xs);font-weight:var(--sinch-font-weight-emphasized);color:var(--sinch-color-text-default);text-align:center;width:24px;height:24px;line-height:24px;user-select:none;text-transform:uppercase}#content-header{display:flex;flex-direction:row;height:32px;align-items:center}#date{flex:1;text-align:center;text-transform:capitalize}#prev-year{margin-left:-4px}#next-year{margin-right:-4px}</style><div id="content"><div id="content-header"><sinch-icon-button small id="prev-year"><sinch-icon-keyboard-double-arrow-left slot="icon"></sinch-icon-keyboard-double-arrow-left></sinch-icon-button><sinch-icon-button small id="prev-month"><sinch-icon-keyboard-arrow-left slot="icon"></sinch-icon-keyboard-arrow-left></sinch-icon-button><sinch-text type="m" emphasized id="date"></sinch-text><sinch-icon-button small id="next-month"><sinch-icon-keyboard-arrow-right slot="icon"></sinch-icon-keyboard-arrow-right></sinch-icon-button><sinch-icon-button small id="next-year"><sinch-icon-keyboard-double-arrow-right slot="icon"></sinch-icon-keyboard-double-arrow-right></sinch-icon-button></div><div id="week-day-names"><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div></div><div id="month"><div class="week"><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button></div><div class="week"><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button></div><div class="week"><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button></div><div class="week"><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button></div><div class="week"><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button></div><div class="week"><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button></div></div></div>';
23
+ const templateHTML = '<style>:host{display:block;outline:0}#content{width:fit-content;box-sizing:border-box;padding:16px;display:flex;flex-direction:column;gap:8px}#month{display:flex;flex-direction:column;row-gap:8px}.week{display:flex;flex-direction:row;column-gap:8px}.week.empty{display:none}.day{all:initial;font:var(--sinch-font-text-xs);color:var(--sinch-color-text-default);text-align:center;border-radius:var(--sinch-shape-radius-m);width:24px;height:24px;line-height:22px;cursor:pointer;border:1px solid transparent;background-color:transparent;box-sizing:border-box;user-select:none}.day.today{border:1px solid var(--sinch-color-stormy-500)}.day:disabled{cursor:initial;color:var(--sinch-color-snow-700)}.day:focus-visible{outline:1px solid var(--sinch-color-aqua-400);outline-offset:1px}@supports not selector(:focus-visible){.day:focus{outline:1px solid var(--sinch-color-aqua-400);outline-offset:1px}}.day.selected{background-color:var(--sinch-color-stormy-500);color:var(--sinch-color-snow-100)}.day:hover:not(:disabled):not(.selected){background-color:var(--sinch-color-snow-600)}#week-day-names{display:flex;flex-direction:row;gap:8px;height:24px}.week-day-name{font:var(--sinch-font-text-xs);font-weight:var(--sinch-font-weight-emphasized);color:var(--sinch-color-text-default);text-align:center;width:24px;height:24px;line-height:24px;user-select:none;text-transform:uppercase}#content-header{display:flex;flex-direction:row;height:32px;align-items:center}#date{flex:1;text-align:center;text-transform:capitalize}#prev-year{margin-left:-4px}#next-year{margin-right:-4px}</style><div id="content"><div id="content-header"><sinch-icon-button id="prev-year" small><sinch-icon-keyboard-double-arrow-left slot="icon"></sinch-icon-keyboard-double-arrow-left></sinch-icon-button><sinch-icon-button id="prev-month" small><sinch-icon-keyboard-arrow-left slot="icon"></sinch-icon-keyboard-arrow-left></sinch-icon-button><sinch-text id="date" type="m" emphasized aria-live="polite"></sinch-text><sinch-icon-button id="next-month" small><sinch-icon-keyboard-arrow-right slot="icon"></sinch-icon-keyboard-arrow-right></sinch-icon-button><sinch-icon-button id="next-year" small><sinch-icon-keyboard-double-arrow-right slot="icon"></sinch-icon-keyboard-double-arrow-right></sinch-icon-button></div><div id="week-day-names"><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div></div><div id="month"><div class="week"><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button></div><div class="week"><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button></div><div class="week"><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button></div><div class="week"><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button></div><div class="week"><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button></div><div class="week"><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button></div></div></div>';
24
24
  import { areDatesEqual, assertDate, assertLocale, assertMinMax, assertValue, canGoNextMonth, canGoNextYear, canGoPrevMonth, canGoPrevYear, clampMaxDate, clampMinDate, dateToIso, decMonth, decYear, getCalendarMonth, getDayNames, getMonthNames, incMonth, incYear, isDateBetween, isoToDate, isValidDate, today } from './utils';
25
25
  const template = document.createElement('template');
26
26
  template.innerHTML = templateHTML;
@@ -220,7 +220,7 @@ defineCustomElement('sinch-date-picker', (_$month = new WeakMap(), _$weeks = new
220
220
  }
221
221
 
222
222
  static get observedAttributes() {
223
- return ['value', 'min', 'max', 'locale'];
223
+ return ['value', 'min', 'max', 'locale', 'prev-year-aria-label', 'next-year-aria-label', 'prev-month-aria-label', 'next-month-aria-label'];
224
224
  }
225
225
 
226
226
  attributeChangedCallback(name, prevValue, newVal) {
@@ -301,6 +301,30 @@ defineCustomElement('sinch-date-picker', (_$month = new WeakMap(), _$weeks = new
301
301
 
302
302
  break;
303
303
  }
304
+
305
+ case 'prev-year-aria-label':
306
+ {
307
+ updateAttribute(_classPrivateFieldGet(this, _$prevYear), 'aria-label', newVal);
308
+ break;
309
+ }
310
+
311
+ case 'next-year-aria-label':
312
+ {
313
+ updateAttribute(_classPrivateFieldGet(this, _$nextYear), 'aria-label', newVal);
314
+ break;
315
+ }
316
+
317
+ case 'prev-month-aria-label':
318
+ {
319
+ updateAttribute(_classPrivateFieldGet(this, _$prevMonth), 'aria-label', newVal);
320
+ break;
321
+ }
322
+
323
+ case 'next-month-aria-label':
324
+ {
325
+ updateAttribute(_classPrivateFieldGet(this, _$nextMonth), 'aria-label', newVal);
326
+ break;
327
+ }
304
328
  }
305
329
  }
306
330
 
@@ -340,6 +364,22 @@ defineCustomElement('sinch-date-picker', (_$month = new WeakMap(), _$weeks = new
340
364
  return getAttribute(this, 'max', '');
341
365
  }
342
366
 
367
+ set prevMonthAriaLabel(value) {
368
+ updateAttribute(this, 'prev-month-aria-label', value);
369
+ }
370
+
371
+ get prevMonthAriaLabel() {
372
+ return getAttribute(this, 'prev-month-aria-label', '');
373
+ }
374
+
375
+ set nextMonthAriaLabel(value) {
376
+ updateAttribute(this, 'next-month-aria-label', value);
377
+ }
378
+
379
+ get nextMonthAriaLabel() {
380
+ return getAttribute(this, 'next-month-aria-label', '');
381
+ }
382
+
343
383
  get prevYearButtonRect() {
344
384
  return getRect(_classPrivateFieldGet(this, _$prevYear));
345
385
  }
@@ -9,6 +9,14 @@ export declare type TSinchDatePickerElement = HTMLElement & {
9
9
  max: string;
10
10
  /** BCP 47 language tag (e.g. en-US), which changes day and month display names in the calendar */
11
11
  locale: string;
12
+ /** Label that is used for a11y */
13
+ prevYearAriaLabel: string;
14
+ /** Label that is used for a11y */
15
+ nextYearAriaLabel: string;
16
+ /** Label that is used for a11y */
17
+ prevMonthAriaLabel: string;
18
+ /** Label that is used for a11y */
19
+ nextMonthAriaLabel: string;
12
20
  readonly prevYearButtonRect: TRect;
13
21
  readonly nextYearButtonRect: TRect;
14
22
  readonly prevMonthButtonRect: TRect;
@@ -24,6 +32,14 @@ export declare type TSinchDatePickerElement = HTMLElement & {
24
32
  setAttribute(name: 'max', value: string): void;
25
33
  /** BCP 47 language tag (e.g. en-US), which changes day and month display names in the calendar */
26
34
  setAttribute(name: 'locale', value: string): void;
35
+ /** Label that is used for a11y */
36
+ setAttribute(name: 'prev-year-aria-label', value: string): void;
37
+ /** Label that is used for a11y */
38
+ setAttribute(name: 'next-year-aria-label', value: string): void;
39
+ /** Label that is used for a11y */
40
+ setAttribute(name: 'prev-month-aria-label', value: string): void;
41
+ /** Label that is used for a11y */
42
+ setAttribute(name: 'next-month-aria-label', value: string): void;
27
43
  };
28
44
  export declare type TSinchDatePickerReact = TSinchElementReact<TSinchDatePickerElement> & {
29
45
  /** Date value in ISO 8601 format */
@@ -36,7 +52,15 @@ export declare type TSinchDatePickerReact = TSinchElementReact<TSinchDatePickerE
36
52
  locale: string;
37
53
  /** Label that is used for a11y */
38
54
  'aria-label': string;
39
- /** Change value handler, return date in ISO 8601 format */
55
+ /** Label that is used for a11y */
56
+ 'prev-year-aria-label': string;
57
+ /** Label that is used for a11y */
58
+ 'next-year-aria-label': string;
59
+ /** Label that is used for a11y */
60
+ 'prev-month-aria-label': string;
61
+ /** Label that is used for a11y */
62
+ 'next-month-aria-label': string;
63
+ /** @deprecated Change value handler, return date in ISO 8601 format */
40
64
  onChange?: (e: SyntheticEvent<TSinchDatePickerElement, CustomEvent<string>>) => void;
41
65
  /** Change value handler, return date in ISO 8601 format */
42
66
  'on-change'?: (e: CustomEvent<string>) => void;
package/dialog/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import '../icon-button';
2
2
  import '../icons/close';
3
3
  import '../stop-events';
4
+ import '../title';
4
5
  import type { TSinchDialogElement, TSinchDialogReact } from './types';
5
6
  declare global {
6
7
  namespace JSX {
package/dialog/index.js CHANGED
@@ -15,8 +15,9 @@ import dialogPolyfill from 'dialog-polyfill';
15
15
  import '../icon-button';
16
16
  import '../icons/close';
17
17
  import '../stop-events';
18
+ import '../title';
18
19
  import { defineCustomElement, getAttribute, getBooleanAttribute, getRect, isAttrTrue, updateAttribute, getReactEventHandler, NectaryElement, updateBooleanAttribute } from '../utils';
19
- const templateHTML = '<style>:host{display:inline-block}dialog{position:fixed;left:0;right:0;margin:auto;display:flex;flex-direction:column;padding:24px;max-width:var(--sinch-dialog-max-width,512px);max-height:unset;border-radius:var(--sinch-shape-radius-l);box-sizing:border-box;contain:content;background-color:var(--sinch-color-snow-100);color:var(--sinch-color-text-default);font:var(--sinch-font-body);border:none;box-shadow:var(--sinch-elevation-level-3)}dialog:not([open]){display:none}dialog+.backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#000;opacity:.55}dialog::backdrop{background-color:#000;opacity:.55}._dialog_overlay{position:fixed;top:0;right:0;bottom:0;left:0}dialog.fixed{position:fixed;top:50%;transform:translate(0,-50%)}#header{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start;margin-bottom:16px}#caption{font:var(--sinch-font-title-m);color:var(--sinch-color-text-default);white-space:nowrap;text-overflow:ellipsis;overflow:hidden}#content{min-height:0;overflow:auto;max-height:var(--sinch-dialog-max-height,50vh)}#buttons{display:flex;flex-direction:row;justify-content:flex-end;gap:16px;margin-top:24px}sinch-icon-button{transform:translate(4px,-4px)}</style><dialog><div id="header"><span id="caption"></span><sinch-icon-button id="close" small tabindex="0"><sinch-icon-close slot="icon"></sinch-icon-close></sinch-icon-button></div><div id="content"><sinch-stop-events events="close"><slot name="content"></slot></sinch-stop-events></div><div id="buttons"><sinch-stop-events events="close"><slot name="buttons"></slot></sinch-stop-events></div></dialog>';
20
+ const templateHTML = '<style>:host{display:inline-block}dialog{position:fixed;left:0;right:0;margin:auto;display:flex;flex-direction:column;padding:24px;max-width:var(--sinch-dialog-max-width,512px);max-height:unset;border-radius:var(--sinch-shape-radius-l);box-sizing:border-box;contain:content;background-color:var(--sinch-color-snow-100);color:var(--sinch-color-text-default);font:var(--sinch-font-body);border:none;box-shadow:var(--sinch-elevation-level-3)}dialog:not([open]){display:none}dialog+.backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#000;opacity:.55}dialog::backdrop{background-color:#000;opacity:.55}._dialog_overlay{position:fixed;top:0;right:0;bottom:0;left:0}dialog.fixed{position:fixed;top:50%;transform:translate(0,-50%)}#header{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start;margin-bottom:16px}#caption{color:var(--sinch-color-text-default)}#content{min-height:0;overflow:auto;max-height:var(--sinch-dialog-max-height,50vh)}#buttons{display:flex;flex-direction:row;justify-content:flex-end;gap:16px;margin-top:24px}sinch-icon-button{transform:translate(4px,-4px)}</style><dialog><div id="header"><sinch-title id="caption" type="m" level="3" ellipsis></sinch-title><sinch-icon-button id="close" small tabindex="0"><sinch-icon-close slot="icon"></sinch-icon-close></sinch-icon-button></div><div id="content"><sinch-stop-events events="close"><slot name="content"></slot></sinch-stop-events></div><div id="buttons"><sinch-stop-events events="close"><slot name="buttons"></slot></sinch-stop-events></div></dialog>';
20
21
  const template = document.createElement('template');
21
22
  template.innerHTML = templateHTML;
22
23
  defineCustomElement('sinch-dialog', (_$dialog = new WeakMap(), _$closeButton = new WeakMap(), _$caption = new WeakMap(), _isConnected = new WeakMap(), _prevOverflowValue = new WeakMap(), _onCancel = new WeakMap(), _onCloseClick = new WeakMap(), _onBackdropClick = new WeakMap(), _onCloseReactHandler = new WeakMap(), _dispatchCloseEvent = new WeakSet(), _setOpen = new WeakSet(), class extends NectaryElement {
@@ -142,7 +143,7 @@ defineCustomElement('sinch-dialog', (_$dialog = new WeakMap(), _$closeButton = n
142
143
  switch (name) {
143
144
  case 'caption':
144
145
  {
145
- _classPrivateFieldGet(this, _$caption).textContent = newVal;
146
+ updateAttribute(_classPrivateFieldGet(this, _$caption), 'text', newVal);
146
147
  break;
147
148
  }
148
149
 
@@ -23,8 +23,10 @@ export declare type TSinchDropdownReact = TSinchElementReact<TSinchDropdownEleme
23
23
  value: string;
24
24
  maxVisibleItems?: number;
25
25
  'aria-label': string;
26
+ /** @deprecated */
26
27
  onClose?: () => void;
27
28
  'on-close'?: (e: CustomEvent<void>) => void;
29
+ /** @deprecated */
28
30
  onChange?: (e: SyntheticEvent<TSinchDropdownElement, CustomEvent<string>>) => void;
29
31
  'on-change'?: (e: CustomEvent<string>) => void;
30
32
  };
@@ -14,7 +14,7 @@ import '../icons/info';
14
14
  import '../title';
15
15
  import '../text';
16
16
  import { defineCustomElement, getAttribute, getLiteralAttribute, updateAttribute, updateLiteralAttribute, NectaryElement, setClass } from '../utils';
17
- const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;align-items:flex-start;padding:16px;border-radius:var(--sinch-shape-radius-l);background-color:var(--sinch-color-alert-info-background);box-sizing:border-box;width:100%}#body-wrapper{display:flex;flex-direction:column;align-items:flex-start;margin-left:8px;min-width:0;flex:1}#caption{color:var(--sinch-color-stormy-500);align-self:stretch}#text{color:var(--sinch-color-stormy-500);margin-top:4px;align-self:stretch}#text:empty{display:none}#icon-error,#icon-info,#icon-success,#icon-warn{display:none}:host([type=success]) #wrapper{background-color:var(--sinch-color-success-200)}:host([type=warn]) #wrapper{background-color:var(--sinch-color-warning-200)}:host([type=error]) #wrapper{background-color:var(--sinch-color-error-200)}:host([type=info]) #wrapper{background-color:var(--sinch-color-informative-200)}:host([type=success]) #icon-success{display:block;--sinch-color-icon:var(--sinch-color-success-500)}:host([type=warn]) #icon-warn{display:block;--sinch-color-icon:var(--sinch-color-warning-500)}:host([type=error]) #icon-error{display:block;--sinch-color-icon:var(--sinch-color-error-500)}:host([type=info]) #icon-info{display:block;--sinch-color-icon:var(--sinch-color-informative-500)}#action{display:flex;margin-top:16px;min-width:0}#action.empty{display:none}#close{margin-left:16px}#close.empty{display:none}</style><div id="wrapper"><sinch-icon-info id="icon-info"></sinch-icon-info><sinch-icon-check-circle id="icon-success"></sinch-icon-check-circle><sinch-icon-report-problem id="icon-warn"></sinch-icon-report-problem><sinch-icon-report id="icon-error"></sinch-icon-report><div id="body-wrapper"><sinch-title id="caption" level="3" type="s" ellipsis></sinch-title><sinch-text id="text" type="m"></sinch-text><div id="action"><slot name="action"></slot></div></div><div id="close"><slot name="close"></slot></div></div>';
17
+ const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;align-items:flex-start;padding:16px;border-radius:var(--sinch-shape-radius-l);box-sizing:border-box;width:100%}#body-wrapper{display:flex;flex-direction:column;align-items:flex-start;margin-left:8px;min-width:0;flex:1}#caption{color:var(--sinch-color-stormy-500);align-self:stretch}#text{color:var(--sinch-color-stormy-500);margin-top:4px;align-self:stretch}#text:empty{display:none}#icon-error,#icon-info,#icon-success,#icon-warn{display:none}:host([type=success]) #wrapper{background-color:var(--sinch-color-success-200)}:host([type=warn]) #wrapper{background-color:var(--sinch-color-warning-200)}:host([type=error]) #wrapper{background-color:var(--sinch-color-error-200)}:host([type=info]) #wrapper{background-color:var(--sinch-color-informative-200)}:host([type=success]) #icon-success{display:block;--sinch-color-icon:var(--sinch-color-success-500)}:host([type=warn]) #icon-warn{display:block;--sinch-color-icon:var(--sinch-color-warning-500)}:host([type=error]) #icon-error{display:block;--sinch-color-icon:var(--sinch-color-error-500)}:host([type=info]) #icon-info{display:block;--sinch-color-icon:var(--sinch-color-informative-500)}#action{display:flex;margin-top:16px;min-width:0}#action.empty{display:none}#close{margin-left:16px}#close.empty{display:none}</style><div id="wrapper"><sinch-icon-info id="icon-info"></sinch-icon-info><sinch-icon-check-circle id="icon-success"></sinch-icon-check-circle><sinch-icon-report-problem id="icon-warn"></sinch-icon-report-problem><sinch-icon-report id="icon-error"></sinch-icon-report><div id="body-wrapper"><sinch-title id="caption" level="3" type="s" ellipsis></sinch-title><sinch-text id="text" type="m"></sinch-text><div id="action"><slot name="action"></slot></div></div><div id="close"><slot name="close"></slot></div></div>';
18
18
  import { assertType, typeValues } from './utils';
19
19
  const template = document.createElement('template');
20
20
  template.innerHTML = templateHTML;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "0.38.0",
3
+ "version": "0.39.0",
4
4
  "files": [
5
5
  "theme.css",
6
6
  "**/*/*.js",
@@ -14,6 +14,7 @@ export declare type TSinchPaginationElement = HTMLElement & {
14
14
  export declare type TSinchPaginationReact = TSinchElementReact<TSinchPaginationElement> & {
15
15
  value: number;
16
16
  max: number;
17
+ /** @deprecated */
17
18
  onChange?: (event: SyntheticEvent<TSinchPaginationElement, CustomEvent<number>>) => void;
18
19
  'on-change': (e: CustomEvent<number>) => void;
19
20
  };
package/radio/types.d.ts CHANGED
@@ -9,6 +9,7 @@ export declare type TSinchRadioElement = HTMLElement & {
9
9
  export declare type TSinchRadioReact = TSinchElementReact<TSinchRadioElement> & {
10
10
  value: string;
11
11
  'aria-label': string;
12
+ /** @deprecated */
12
13
  onChange?: (event: SyntheticEvent<TSinchRadioElement, CustomEvent<boolean>>) => void;
13
14
  'on-change'?: (e: CustomEvent<string>) => void;
14
15
  };
package/segment/index.js CHANGED
@@ -10,7 +10,7 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
10
10
  import '../title';
11
11
  import { getTitleLevelFromType } from '../title/utils';
12
12
  import { defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, getRect, isAttrTrue, NectaryElement, setClass, updateAttribute, updateBooleanAttribute, updateLiteralAttribute } from '../utils';
13
- const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:column;gap:16px;width:100%;height:100%;border:1px solid var(--sinch-color-snow-700);border-radius:var(--sinch-shape-radius-l);box-sizing:border-box;background-color:var(--sinch-color-snow-100);color:var(--sinch-color-text-default);font:var(--sinch-font-body);box-shadow:var(--sinch-elevation-level-2);padding:8px 24px 16px}#header{display:flex;flex-direction:row;align-items:center;height:48px;gap:8px;--sinch-size-icon:32px}#caption{font:var(--sinch-font-title-l);color:var(--sinch-color-text-default);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:1em}#info{display:flex;flex-direction:row;align-items:center;gap:8px;margin-left:auto;align-self:stretch}#info.empty{display:none}#preview{flex:1;flex-basis:auto;height:48px;min-width:0;overflow:hidden;margin-left:24px}#preview.empty{display:none}#info.empty+#collapse{margin-left:auto}#collapse.empty{display:none}#preview:not(.empty)+#info.empty+#collapse:not(.empty),#preview:not(.empty)+#info:not(.empty){margin-left:24px}#content-wrapper{flex:1;min-height:0;overflow-y:auto}#action{display:flex;flex-direction:row;justify-content:flex-end;gap:16px}#action.empty{display:none}:host([collapsed]:not([collapsed=false])) :is(#content-wrapper,#action){display:none}:host([collapsed]:not([collapsed=false])) #wrapper{padding-bottom:8px}::slotted([slot=icon]){margin-right:8px}</style><div id="wrapper"><div id="header"><slot name="icon"></slot><sinch-title id="caption" level="3" type="m"></sinch-title><div id="preview"><slot name="preview"></slot></div><div id="info"><slot name="info"></slot></div><div id="collapse"><slot name="collapse"></slot></div></div><div id="content-wrapper"><slot name="content"></slot></div><div id="action"><slot name="action"></slot></div></div>';
13
+ const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:column;gap:16px;width:100%;height:100%;border:1px solid var(--sinch-color-snow-700);border-radius:var(--sinch-shape-radius-l);box-sizing:border-box;background-color:var(--sinch-color-snow-100);color:var(--sinch-color-text-default);font:var(--sinch-font-body);box-shadow:var(--sinch-elevation-level-2);padding:8px 24px 16px}#header{display:flex;flex-direction:row;align-items:center;height:48px;gap:8px;--sinch-size-icon:32px}#caption{color:var(--sinch-color-text-default);min-width:1em}#info{display:flex;flex-direction:row;align-items:center;gap:8px;margin-left:auto;align-self:stretch}#info.empty{display:none}#preview{flex:1;flex-basis:auto;height:48px;min-width:0;overflow:hidden;margin-left:24px}#preview.empty{display:none}#info.empty+#collapse{margin-left:auto}#collapse.empty{display:none}#preview:not(.empty)+#info.empty+#collapse:not(.empty),#preview:not(.empty)+#info:not(.empty){margin-left:24px}#content-wrapper{flex:1;min-height:0;overflow-y:auto}#action{display:flex;flex-direction:row;justify-content:flex-end;gap:16px}#action.empty{display:none}:host([collapsed]:not([collapsed=false])) :is(#content-wrapper,#action){display:none}:host([collapsed]:not([collapsed=false])) #wrapper{padding-bottom:8px}::slotted([slot=icon]){margin-right:8px}</style><div id="wrapper"><div id="header"><slot name="icon"></slot><sinch-title id="caption" level="3" type="m" ellipsis></sinch-title><div id="preview"><slot name="preview"></slot></div><div id="info"><slot name="info"></slot></div><div id="collapse"><slot name="collapse"></slot></div></div><div id="content-wrapper"><slot name="content"></slot></div><div id="action"><slot name="action"></slot></div></div>';
14
14
  import { assertSize, sizeValues } from './utils';
15
15
  const template = document.createElement('template');
16
16
  template.innerHTML = templateHTML;
@@ -9,6 +9,7 @@ export declare type TSinchSegmentExpandElement = HTMLElement & {
9
9
  export declare type TSinchSegmentExpandReact = TSinchElementReact<TSinchSegmentExpandElement> & {
10
10
  value: boolean;
11
11
  'aria-label': string;
12
+ /** @deprecated */
12
13
  onChange?: (e: SyntheticEvent<TSinchSegmentExpandElement, CustomEvent<boolean>>) => void;
13
14
  'on-change'?: (e: CustomEvent<boolean>) => void;
14
15
  };
@@ -8,6 +8,7 @@ export declare type TSinchSegmentedControlElement = HTMLElement & {
8
8
  export declare type TSinchSegmentedControlReact = TSinchElementReact<TSinchSegmentedControlElement> & {
9
9
  value: string;
10
10
  'aria-label': string;
11
+ /** @deprecated */
11
12
  onChange?: (event: SyntheticEvent<TSinchSegmentedControlElement, CustomEvent<string>>) => void;
12
13
  'on-change'?: (e: CustomEvent<string>) => void;
13
14
  };
@@ -11,6 +11,7 @@ export declare type TSinchSegmentedIconControlReact = TSinchElementReact<TSinchS
11
11
  value: string;
12
12
  multiple?: boolean;
13
13
  'aria-label': string;
14
+ /** @deprecated */
14
15
  onChange?: (event: SyntheticEvent<TSinchSegmentedIconControlElement, CustomEvent<string>>) => void;
15
16
  'on-change'?: (e: CustomEvent<string>) => void;
16
17
  };
package/select/types.d.ts CHANGED
@@ -42,7 +42,7 @@ export declare type TSinchSelectReact = TSinchElementReact<TSinchSelectElement>
42
42
  disabled?: boolean;
43
43
  /** Number of visible at the same time options in the list */
44
44
  maxVisibleItems?: number;
45
- /** Change value handler */
45
+ /** @deprecated Change value handler */
46
46
  onChange?: (e: SyntheticEvent<TSinchSelectElement, CustomEvent<string>>) => void;
47
47
  /** Change value handler */
48
48
  'on-change'?: (e: CustomEvent<string>) => void;
package/tabs/types.d.ts CHANGED
@@ -8,6 +8,7 @@ export declare type TSinchTabsElement = HTMLElement & {
8
8
  export declare type TSinchTabsReact = TSinchElementReact<TSinchTabsElement> & {
9
9
  value: string;
10
10
  'aria-label': string;
11
+ /** @deprecated */
11
12
  onChange?: (event: SyntheticEvent<TSinchTabsElement, CustomEvent<string>>) => void;
12
13
  'on-change'?: (e: CustomEvent<string>) => void;
13
14
  };
package/tag/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import '../icons/cancel';
2
+ import '../text';
2
3
  import type { TSinchTagElement, TSinchTagReact } from './types';
3
4
  declare global {
4
5
  namespace JSX {
package/tag/index.js CHANGED
@@ -8,9 +8,10 @@ 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 '../text';
11
12
  import { defineCustomElement, getBooleanAttribute, getAttribute, getLiteralAttribute, updateBooleanAttribute, updateAttribute, updateLiteralAttribute, NectaryElement } from '../utils';
12
- const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;display:flex;flex-direction:row;align-items:center;gap:4px;width:100%;height:24px;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);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:hidden;flex:1}</style><div id="wrapper"><slot name="icon"></slot><span id="text"></span><slot name="close"></slot></div>';
13
- import { categoryValues } from './utils';
13
+ const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;display:flex;flex-direction:row;align-items:center;gap:4px;width:100%;height:24px;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);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{flex:1}</style><div id="wrapper"><slot name="icon"></slot><sinch-text id="text" type="xs" ellipsis></sinch-text><slot name="close"></slot></div>';
14
+ import { assertCategoryValue, categoryValues } from './utils';
14
15
  const template = document.createElement('template');
15
16
  template.innerHTML = templateHTML;
16
17
  defineCustomElement('sinch-tag', (_$text = new WeakMap(), class extends NectaryElement {
@@ -61,11 +62,17 @@ defineCustomElement('sinch-tag', (_$text = new WeakMap(), class extends NectaryE
61
62
  }
62
63
 
63
64
  static get observedAttributes() {
64
- return ['text'];
65
+ return ['text', 'category'];
65
66
  }
66
67
 
67
68
  attributeChangedCallback(name, _, newVal) {
68
69
  switch (name) {
70
+ case 'category':
71
+ {
72
+ assertCategoryValue(newVal);
73
+ break;
74
+ }
75
+
69
76
  case 'text':
70
77
  {
71
78
  _classPrivateFieldGet(this, _$text).textContent = newVal;
package/tag/utils.d.ts CHANGED
@@ -1,2 +1,5 @@
1
1
  import type { TSinchTagCategory } from './types';
2
2
  export declare const categoryValues: readonly TSinchTagCategory[];
3
+ declare type TAssertCategory = (value: string | null) => asserts value is TSinchTagCategory;
4
+ export declare const assertCategoryValue: TAssertCategory;
5
+ export {};
package/tag/utils.js CHANGED
@@ -1 +1,6 @@
1
- export const categoryValues = ['candy', 'bolt', 'aqua', 'grass', 'berry', 'orange', 'night', 'mud', 'dirt'];
1
+ export const categoryValues = ['candy', 'bolt', 'aqua', 'grass', 'berry', 'orange', 'night', 'mud', 'dirt'];
2
+ export const assertCategoryValue = value => {
3
+ if (value === null || !categoryValues.includes(value)) {
4
+ throw new Error(`sinch-tag: invalid category attribute: ${value}`);
5
+ }
6
+ };
@@ -9,7 +9,7 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
9
9
 
10
10
  import '../icons/cancel';
11
11
  import { defineCustomElement, NectaryElement } from '../utils';
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>';
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><sinch-icon-cancel></sinch-icon-cancel></button></div>';
13
13
  const template = document.createElement('template');
14
14
  template.innerHTML = templateHTML;
15
15
  defineCustomElement('sinch-tag-close', (_$button = new WeakMap(), class extends NectaryElement {
@@ -27,6 +27,10 @@ defineCustomElement('sinch-tag-close', (_$button = new WeakMap(), class extends
27
27
  _classPrivateFieldSet(this, _$button, shadowRoot.querySelector('button'));
28
28
  }
29
29
 
30
+ connectedCallback() {
31
+ this.setAttribute('role', 'button');
32
+ }
33
+
30
34
  focus() {
31
35
  _classPrivateFieldGet(this, _$button).focus();
32
36
  }
@@ -1,3 +1,5 @@
1
1
  import type { TSinchElementReact } from '../types';
2
2
  export declare type TSinchTagCloseElement = HTMLElement;
3
- export declare type TSinchTagCloseReact = TSinchElementReact<TSinchTagCloseElement>;
3
+ export declare type TSinchTagCloseReact = TSinchElementReact<TSinchTagCloseElement> & {
4
+ 'aria-label': string;
5
+ };
@@ -401,7 +401,7 @@ defineCustomElement('sinch-time-picker', (_$pickerHours = new WeakMap(), _$picke
401
401
 
402
402
  case 'submit-aria-label':
403
403
  {
404
- _classPrivateFieldGet(this, _$submitButton).ariaLabel = newVal;
404
+ updateAttribute(_classPrivateFieldGet(this, _$submitButton), 'aria-label', newVal);
405
405
  break;
406
406
  }
407
407
  }
@@ -427,6 +427,14 @@ defineCustomElement('sinch-time-picker', (_$pickerHours = new WeakMap(), _$picke
427
427
  return getBooleanAttribute(this, 'ampm');
428
428
  }
429
429
 
430
+ set submitAriaLabel(value) {
431
+ updateAttribute(this, 'submit-aria-label', value);
432
+ }
433
+
434
+ get submitAriaLabel() {
435
+ return getAttribute(this, 'submit-aria-label', '');
436
+ }
437
+
430
438
  get submitButtonRect() {
431
439
  return getRect(_classPrivateFieldGet(this, _$submitButton));
432
440
  }
@@ -5,6 +5,8 @@ export declare type TSinchTimePickerElement = HTMLElement & {
5
5
  value: string;
6
6
  /** AM/PM 12-hour clock system, `false` by default */
7
7
  ampm: boolean;
8
+ /** Submit button label that is used for a11y */
9
+ submitAriaLabel: string;
8
10
  readonly submitButtonRect: TRect;
9
11
  readonly amButtonRect: TRect | null;
10
12
  readonly pmButtonRect: TRect | null;
@@ -16,6 +18,8 @@ export declare type TSinchTimePickerElement = HTMLElement & {
16
18
  setAttribute(name: 'value', value: string): void;
17
19
  /** AM/PM 12-hour clock system, `false` by default */
18
20
  setAttribute(name: 'ampm', value: boolean): void;
21
+ /** Submit button label that is used for a11y */
22
+ setAttribute(name: 'submit-aria-label', value: string): void;
19
23
  };
20
24
  export declare type TSinchTimePickerReact = TSinchElementReact<TSinchTimePickerElement> & {
21
25
  /** Time value in ISO 8601 format */
@@ -26,7 +30,7 @@ export declare type TSinchTimePickerReact = TSinchElementReact<TSinchTimePickerE
26
30
  'aria-label': string;
27
31
  /** Submit button label that is used for a11y */
28
32
  'submit-aria-label': string;
29
- /** Change value handler, return time in ISO 8601 format */
33
+ /** @deprecated Change value handler, return time in ISO 8601 format */
30
34
  onChange?: (e: SyntheticEvent<TSinchTimePickerElement, CustomEvent<string>>) => void;
31
35
  /** Change value handler, return time in ISO 8601 format */
32
36
  'on-change'?: (e: CustomEvent<string>) => void;
@@ -0,0 +1,17 @@
1
+ import '../icons/report-problem';
2
+ import '../icons/report';
3
+ import '../icons/check-circle';
4
+ import '../icons/info';
5
+ import '../title';
6
+ import '../text';
7
+ import type { TSinchToastElement, TSinchToastReact } from './types';
8
+ declare global {
9
+ namespace JSX {
10
+ interface IntrinsicElements {
11
+ 'sinch-toast': TSinchToastReact;
12
+ }
13
+ }
14
+ interface HTMLElementTagNameMap {
15
+ 'sinch-toast': TSinchToastElement;
16
+ }
17
+ }