@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
@@ -0,0 +1,68 @@
1
+ :root,
2
+ :host {
3
+ /* Primary */
4
+ --sinch-icon-button-primary-color-background: var(--sinch-color-tropical-500);
5
+ --sinch-icon-button-primary-color-background-hover: var(--sinch-color-tropical-400);
6
+ --sinch-icon-button-primary-color-background-active: var(--sinch-color-tropical-600);
7
+ --sinch-icon-button-primary-color-background-disabled: var(--sinch-color-tropical-200);
8
+ --sinch-icon-button-primary-color-border: transparent;
9
+ --sinch-icon-button-primary-color-border-hover: transparent;
10
+ --sinch-icon-button-primary-color-border-active: transparent;
11
+ --sinch-icon-button-primary-color-border-disabled: transparent;
12
+ --sinch-icon-button-primary-color-icon: var(--sinch-color-snow-100);
13
+ --sinch-icon-button-primary-color-icon-hover: var(--sinch-color-snow-100);
14
+ --sinch-icon-button-primary-color-icon-active: var(--sinch-color-snow-100);
15
+ --sinch-icon-button-primary-color-icon-disabled: var(--sinch-color-snow-100);
16
+ --sinch-icon-button-primary-mix-blend-mode: initial;
17
+
18
+ /* Secondary */
19
+ --sinch-icon-button-secondary-color-background: var(--sinch-color-snow-100);
20
+ --sinch-icon-button-secondary-color-background-hover: var(--sinch-color-tropical-100);
21
+ --sinch-icon-button-secondary-color-background-active: var(--sinch-color-tropical-200);
22
+ --sinch-icon-button-secondary-color-background-disabled: var(--sinch-color-snow-100);
23
+ --sinch-icon-button-secondary-color-border: var(--sinch-color-tropical-500);
24
+ --sinch-icon-button-secondary-color-border-hover: var(--sinch-color-tropical-500);
25
+ --sinch-icon-button-secondary-color-border-active: var(--sinch-color-tropical-500);
26
+ --sinch-icon-button-secondary-color-border-disabled: var(--sinch-color-tropical-200);
27
+ --sinch-icon-button-secondary-color-icon: var(--sinch-color-tropical-500);
28
+ --sinch-icon-button-secondary-color-icon-hover: var(--sinch-color-tropical-500);
29
+ --sinch-icon-button-secondary-color-icon-active: var(--sinch-color-tropical-500);
30
+ --sinch-icon-button-secondary-color-icon-disabled: var(--sinch-color-tropical-200);
31
+ --sinch-icon-button-secondary-mix-blend-mode: initial;
32
+
33
+ /* Tertiary */
34
+ --sinch-icon-button-tertiary-color-background: transparent;
35
+ --sinch-icon-button-tertiary-color-background-hover: var(--sinch-color-bg-hover);
36
+ --sinch-icon-button-tertiary-color-background-active: var(--sinch-color-bg-active);
37
+ --sinch-icon-button-tertiary-color-background-disabled: transparent;
38
+ --sinch-icon-button-tertiary-color-border: transparent;
39
+ --sinch-icon-button-tertiary-color-border-hover: transparent;
40
+ --sinch-icon-button-tertiary-color-border-active: transparent;
41
+ --sinch-icon-button-tertiary-color-border-disabled: transparent;
42
+ --sinch-icon-button-tertiary-color-icon: var(--sinch-color-stormy-500);
43
+ --sinch-icon-button-tertiary-color-icon-hover: var(--sinch-color-stormy-500);
44
+ --sinch-icon-button-tertiary-color-icon-active: var(--sinch-color-stormy-500);
45
+ --sinch-icon-button-tertiary-color-icon-disabled: var(--sinch-color-stormy-100);
46
+ --sinch-icon-button-tertiary-mix-blend-mode: multiply;
47
+
48
+ /* Default */
49
+ --sinch-icon-button-color-background: var(--sinch-icon-button-tertiary-color-background);
50
+ --sinch-icon-button-color-background-hover: var(--sinch-icon-button-tertiary-color-background-hover);
51
+ --sinch-icon-button-color-background-active: var(--sinch-icon-button-tertiary-color-background-active);
52
+ --sinch-icon-button-color-background-disabled: var(--sinch-icon-button-tertiary-color-background-disabled);
53
+ --sinch-icon-button-color-border: var(--sinch-icon-button-tertiary-color-border);
54
+ --sinch-icon-button-color-border-hover: var(--sinch-icon-button-tertiary-color-border-hover);
55
+ --sinch-icon-button-color-border-active: var(--sinch-icon-button-tertiary-color-border-active);
56
+ --sinch-icon-button-color-border-disabled: var(--sinch-icon-button-tertiary-color-border-disabled);
57
+ --sinch-icon-button-color-icon: var(--sinch-icon-button-tertiary-color-icon);
58
+ --sinch-icon-button-color-icon-hover: var(--sinch-icon-button-tertiary-color-icon-hover);
59
+ --sinch-icon-button-color-icon-active: var(--sinch-icon-button-tertiary-color-icon-active);
60
+ --sinch-icon-button-color-icon-disabled: var(--sinch-icon-button-tertiary-color-icon-disabled);
61
+ --sinch-icon-button-mix-blend-mode: var(--sinch-icon-button-tertiary-mix-blend-mode);
62
+
63
+ /* Icon Size */
64
+ --sinch-icon-button-icon-size-l: 24px;
65
+ --sinch-icon-button-icon-size-m: 24px;
66
+ --sinch-icon-button-icon-size-s: 24px;
67
+ --sinch-icon-button-icon-size-xs: 16px;
68
+ }
@@ -0,0 +1,4 @@
1
+ :root,
2
+ :host {
3
+ --sinch-theme: 1;
4
+ }
@@ -0,0 +1,21 @@
1
+ import './index.css';
2
+ import './palette.css';
3
+ import './contextual.css';
4
+ import './fonts.css';
5
+ import './typography.css';
6
+ import './shapes.css';
7
+ import './elevation.css';
8
+ import './size.css';
9
+ import './avatar.css';
10
+ import './badge.css';
11
+ import './chip.css';
12
+ import './color-swatch.css';
13
+ import './tag.css';
14
+ import './emoji.css';
15
+ import './icon.css';
16
+ import './flag.css';
17
+ import './button.css';
18
+ import './icon-button.css';
19
+ import './input.css';
20
+ import './spinner.css';
21
+ import './select-button.css';
package/theme/index.js ADDED
@@ -0,0 +1,21 @@
1
+ import './index.css';
2
+ import './palette.css';
3
+ import './contextual.css';
4
+ import './fonts.css';
5
+ import './typography.css';
6
+ import './shapes.css';
7
+ import './elevation.css';
8
+ import './size.css';
9
+ import './avatar.css';
10
+ import './badge.css';
11
+ import './chip.css';
12
+ import './color-swatch.css';
13
+ import './tag.css';
14
+ import './emoji.css';
15
+ import './icon.css';
16
+ import './flag.css';
17
+ import './button.css';
18
+ import './icon-button.css';
19
+ import './input.css';
20
+ import './spinner.css';
21
+ import './select-button.css';
@@ -0,0 +1,7 @@
1
+ :root,
2
+ :host {
3
+ /* Icon Size */
4
+ --sinch-input-icon-size-l: 24px;
5
+ --sinch-input-icon-size-m: 24px;
6
+ --sinch-input-icon-size-s: 16px;
7
+ }
@@ -0,0 +1,7 @@
1
+ :root,
2
+ :host {
3
+ /* Icon Size */
4
+ --sinch-select-button-icon-size-l: 24px;
5
+ --sinch-select-button-icon-size-m: 24px;
6
+ --sinch-select-button-icon-size-s: 24px;
7
+ }
package/theme/shapes.css CHANGED
@@ -1,7 +1,8 @@
1
1
  :root,
2
2
  :host {
3
3
  --sinch-shape-radius-xs: 2px;
4
- --sinch-shape-radius-s: 4px;
5
- --sinch-shape-radius-m: 8px;
6
- --sinch-shape-radius-l: 12px;
4
+ --sinch-shape-radius-s: 6px;
5
+ --sinch-shape-radius-m: 10px;
6
+ --sinch-shape-radius-l: 14px;
7
+ --sinch-shape-radius: var(--sinch-shape-radius-m);
7
8
  }
package/theme/size.css ADDED
@@ -0,0 +1,9 @@
1
+ :root,
2
+ :host {
3
+ /* --sinch-sizes: "l-m-s-xs"; */
4
+ --sinch-size-l: 48px;
5
+ --sinch-size-m: 40px;
6
+ --sinch-size-s: 32px;
7
+ --sinch-size-xs: 24px;
8
+ --sinch-size: var(--sinch-size-m);
9
+ }
@@ -0,0 +1,7 @@
1
+ :root,
2
+ :host {
3
+ /* Size */
4
+ --sinch-spinner-size-l: 48px;
5
+ --sinch-spinner-size-m: 24px;
6
+ --sinch-spinner-size-s: 16px;
7
+ }
@@ -1,12 +1,12 @@
1
1
  :root,
2
2
  :host {
3
- --sinch-font-family: "Gilroy", "Arial", "sans-serif";
4
- --sinch-font-weight-emphasized: 600;
5
- --sinch-font-title-xl: 600 40px/48px var(--sinch-font-family);
6
- --sinch-font-title-l: 600 24px/32px var(--sinch-font-family);
7
- --sinch-font-title-m: 600 20px/24px var(--sinch-font-family);
8
- --sinch-font-title-s: 600 16px/24px var(--sinch-font-family);
9
- --sinch-font-title-xs: 600 14px/22px var(--sinch-font-family);
3
+ --sinch-font-family: "DM Sans", "Arial", "sans-serif";
4
+ --sinch-font-weight-emphasized: 700;
5
+ --sinch-font-title-xl: 400 40px/48px var(--sinch-font-family);
6
+ --sinch-font-title-l: 500 24px/32px var(--sinch-font-family);
7
+ --sinch-font-title-m: 500 20px/24px var(--sinch-font-family);
8
+ --sinch-font-title-s: 500 16px/24px var(--sinch-font-family);
9
+ --sinch-font-title-xs: 500 14px/22px var(--sinch-font-family);
10
10
  --sinch-font-text-m: 400 16px/24px var(--sinch-font-family);
11
11
  --sinch-font-text-s: 400 14px/22px var(--sinch-font-family);
12
12
  --sinch-font-text-xs: 400 12px/20px var(--sinch-font-family);
@@ -1,5 +1,5 @@
1
1
  import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
2
- const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}button{all:initial;position:relative;display:flex;flex-direction:column;justify-content:space-between;box-sizing:border-box;width:88px;height:88px;padding:16px 8px 8px;border-radius:var(--sinch-shape-radius-l);background-color:var(--sinch-color-snow-100);box-shadow:var(--sinch-elevation-leve-1);cursor:pointer}:host([data-small])>button{width:64px;height:64px;border-radius:var(--sinch-shape-radius-m);padding:12px 4px 4px}button::before{content:"";position:absolute;left:0;top:0;bottom:0;right:0;border:1px solid var(--sinch-color-snow-700);border-radius:var(--sinch-shape-radius-l);pointer-events:none}:host([data-small])>button::before{border-radius:var(--sinch-shape-radius-m)}button:focus-visible::after{position:absolute;content:"";left:50%;top:50%;transform:translate(-50%,-50%);width:100%;height:100%;padding:2px;border:2px solid var(--sinch-color-border-focus);border-radius:calc(var(--sinch-shape-radius-l) + 4px);pointer-events:none}:host([data-small])>button:focus-visible::after{border-radius:calc(var(--sinch-shape-radius-m) + 4px)}@supports not selector(:focus-visible){button:focus::after{position:absolute;content:"";left:50%;top:50%;transform:translate(-50%,-50%);width:100%;height:100%;padding:2px;border:2px solid var(--sinch-color-border-focus);border-radius:calc(var(--sinch-shape-radius-l) + 4px)}:host([data-small])>button:focus::after{border-radius:calc(var(--sinch-shape-radius-m) + 4px)}}button:enabled:hover{background-color:var(--sinch-color-tropical-100)}button:enabled:hover::before{border-color:var(--sinch-color-tropical-100)}:host([data-checked])>button:enabled,button:enabled:active{box-shadow:var(--sinch-elevation-level-0)}:host([data-checked])>button:enabled::before,button:enabled:active::before{border-width:2px;border-color:var(--sinch-color-stormy-500)}button:disabled{cursor:initial}button:disabled>#icon,button:disabled>#text{opacity:.5}#text{display:inline-block;min-height:20px;text-align:center;font:var(--sinch-font-text-xs);color:var(--sinch-color-stormy-500);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#icon{width:32px;height:32px;align-self:center;--sinch-size-icon:32px;--sinch-color-icon:var(--sinch-color-stormy-500)}:host([data-small]) #icon{width:24px;height:24px;--sinch-size-icon:24px}button>*{pointer-events:none}</style><button><div id="icon"><slot name="icon"></slot></div><span id="text"></span></button>';
2
+ const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}button{all:initial;position:relative;display:flex;flex-direction:column;justify-content:space-between;box-sizing:border-box;width:88px;height:88px;padding:16px 8px 8px;border-radius:var(--sinch-shape-radius-l);background-color:var(--sinch-color-snow-100);box-shadow:var(--sinch-elevation-leve-1);cursor:pointer}:host([data-small])>button{width:64px;height:64px;border-radius:var(--sinch-shape-radius-m);padding:12px 4px 4px}button::before{content:"";position:absolute;left:0;top:0;bottom:0;right:0;border:1px solid var(--sinch-color-snow-700);border-radius:var(--sinch-shape-radius-l);pointer-events:none}:host([data-small])>button::before{border-radius:var(--sinch-shape-radius-m)}button:focus-visible::after{position:absolute;content:"";left:50%;top:50%;transform:translate(-50%,-50%);width:100%;height:100%;padding:2px;border:2px solid var(--sinch-color-border-focus);border-radius:calc(var(--sinch-shape-radius-l) + 4px);pointer-events:none}:host([data-small])>button:focus-visible::after{border-radius:calc(var(--sinch-shape-radius-m) + 4px)}button:enabled:hover{background-color:var(--sinch-color-tropical-100)}button:enabled:hover::before{border-color:var(--sinch-color-tropical-100)}:host([data-checked])>button:enabled,button:enabled:active{box-shadow:var(--sinch-elevation-level-0)}:host([data-checked])>button:enabled::before,button:enabled:active::before{border-width:2px;border-color:var(--sinch-color-stormy-500)}button:disabled{cursor:initial}button:disabled>#icon,button:disabled>#text{opacity:.5}#text{display:inline-block;min-height:20px;text-align:center;font:var(--sinch-font-text-xs);color:var(--sinch-color-stormy-500);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#icon{width:32px;height:32px;align-self:center;--sinch-size-icon:32px;--sinch-color-icon:var(--sinch-color-stormy-500)}:host([data-small]) #icon{width:24px;height:24px;--sinch-size-icon:24px}button>*{pointer-events:none}</style><button><div id="icon"><slot name="icon"></slot></div><span id="text"></span></button>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
5
  defineCustomElement('sinch-tile-control-option', class extends NectaryElement {
@@ -5,7 +5,7 @@ import '../icons/arrow-drop-down';
5
5
  import '../segmented-control';
6
6
  import '../segmented-control-option';
7
7
  import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, getRect, isAttrTrue, NectaryElement, setClass, updateAttribute, updateBooleanAttribute } from '../utils';
8
- const templateHTML = '<style>:host{display:block;outline:0}#wrapper{display:flex;flex-direction:column;width:248px;padding:16px;box-sizing:border-box;gap:16px}#header{position:relative;width:100%;height:48px;font:var(--sinch-font-title-xl);line-height:48px}#footer{display:flex;justify-content:center;width:100%;height:32px}#picker{position:relative;width:216px;height:216px;border-radius:50%;box-sizing:border-box;border:1px solid var(--sinch-color-stormy-500)}#picker-hours,#picker-minutes{position:absolute;left:0;top:0;width:100%;height:100%;border-radius:50%;pointer-events:none;user-select:none}.digit-hour-12,.digit-hour-24,.digit-minute{position:absolute;width:28px;height:28px;font:var(--sinch-font-text-s);line-height:28px;text-align:center;color:var(--sinch-color-text-default);top:calc(50% - 14px);left:calc(50% - 14px);z-index:1;cursor:pointer}.digit-hour-24{font:var(--sinch-font-text-xs);line-height:28px;color:var(--sinch-color-text-muted)}.digit-minute{font:var(--sinch-font-text-xs);line-height:28px;color:var(--sinch-color-text-muted)}.digit-hour-12:hover,.digit-hour-24:hover,.digit-minute:hover{color:var(--sinch-color-tropical-500)}.digit-hour-12.selected,.digit-hour-24.selected,.digit-minute.selected{color:var(--sinch-color-tropical-500)}.digit-hour-12.selected{font-size:16px}.digit-hour-24.selected{font-size:16px}.digit-minute.selected{font-size:16px}#picker-touch{position:absolute;left:0;top:0;width:100%;height:100%;cursor:pointer;border-radius:50%}#needle-hour,#needle-minute,#picker-touch::after{background-color:var(--sinch-color-stormy-500)}#needle-hour,#needle-minute{position:absolute;transform-origin:bottom center;transform:rotate(0);bottom:50%;height:50px;transition-duration:.25s;transition-timing-function:ease-in-out;transition-property:transform height;z-index:2}@media (prefers-reduced-motion){#needle-hour,#needle-minute{transition:none}}#needle-hour{width:4px;left:calc(50% - 2px);border-radius:2px}#needle-minute{width:2px;left:calc(50% - 1px);border-radius:1px}#needle-minute:not(.selected)::after{content:"";position:absolute;transform:translateX(-50%);left:0;top:-16px;width:4px;height:4px;border-radius:50%;background-color:var(--sinch-color-tropical-500)}#picker-touch::after{content:"";position:absolute;top:50%;left:50%;width:12px;height:12px;border-radius:50%;transform:translate(-50%,-50%)}#header-hours,#header-minutes{position:absolute;padding:0 4px;width:50px;outline:0;--sinch-size-icon:24px}#header-hours{right:calc(50% + 8px);text-align:right}#header-minutes{left:calc(50% + 8px)}#header-hours::before,#header-minutes::before{content:"";display:none;position:absolute;border-radius:12px;left:50%;top:50%;width:100%;height:100%;transform:translate(-50%,-50%);padding:1px;border:1px solid var(--sinch-color-border-focus)}#header-hours-down,#header-hours-up,#header-minutes-down,#header-minutes-up{display:none;position:absolute;left:50%;transform:translateX(-50%)}#header-hours-up,#header-minutes-up{top:-18px}#header-hours-down,#header-minutes-down{bottom:-18px}#header-hours:focus #header-hours-down,#header-hours:focus #header-hours-up,#header-hours:focus::before{display:block}#header-minutes:focus #header-minutes-down,#header-minutes:focus #header-minutes-up,#header-minutes:focus::before{display:block}#header-colon{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}#submit{position:absolute;right:0;top:50%;transform:translateY(-50%)}:host([ampm]) .digit-hour-24{display:none}:host(:not([ampm])) #footer{display:none}</style><div id="wrapper"><div id="header"><div id="header-hours" tabindex="0" role="meter" aria-valuemin="0" aria-valuemax="23" aria-valuenow="0" aria-valuetext="0"><span>00</span><sinch-icon-arrow-drop-up id="header-hours-up"></sinch-icon-arrow-drop-up><sinch-icon-arrow-drop-down id="header-hours-down"></sinch-icon-arrow-drop-down></div><div id="header-colon">&colon;</div><div id="header-minutes" tabindex="0" role="meter" aria-valuemin="0" aria-valuemax="59" aria-valuenow="0" aria-valuetext="0"><span>00</span><sinch-icon-arrow-drop-up id="header-minutes-up"></sinch-icon-arrow-drop-up><sinch-icon-arrow-drop-down id="header-minutes-down"></sinch-icon-arrow-drop-down></div><sinch-icon-button id="submit" small aria-label="Submit"><sinch-icon-done slot="icon"></sinch-icon-done></sinch-icon-button></div><div id="picker" aria-hidden="true"><div id="picker-hours"></div><div id="picker-minutes"></div><div id="picker-touch"><div id="needle-hour"></div><div id="needle-minute"></div></div></div><div id="footer"><sinch-segmented-control id="ampm"><sinch-segmented-control-option value="am" text="AM" aria-label="AM"></sinch-segmented-control-option><sinch-segmented-control-option value="pm" text="PM" aria-label="PM"></sinch-segmented-control-option></sinch-segmented-control></div></div>';
8
+ const templateHTML = '<style>:host{display:block;outline:0}#wrapper{display:flex;flex-direction:column;width:248px;padding:16px;box-sizing:border-box;gap:16px}#header{position:relative;width:100%;height:48px;font:var(--sinch-font-title-xl);line-height:48px}#footer{display:flex;justify-content:center;width:100%;height:32px}#picker{position:relative;width:216px;height:216px;border-radius:50%;box-sizing:border-box;border:1px solid var(--sinch-color-stormy-500)}#picker-hours,#picker-minutes{position:absolute;left:0;top:0;width:100%;height:100%;border-radius:50%;pointer-events:none;user-select:none}.digit-hour-12,.digit-hour-24,.digit-minute{position:absolute;width:28px;height:28px;font:var(--sinch-font-text-s);line-height:28px;text-align:center;color:var(--sinch-color-text-default);top:calc(50% - 14px);left:calc(50% - 14px);z-index:1;cursor:pointer}.digit-hour-24{font:var(--sinch-font-text-xs);line-height:28px;color:var(--sinch-color-text-muted)}.digit-minute{font:var(--sinch-font-text-xs);line-height:28px;color:var(--sinch-color-text-muted)}.digit-hour-12:hover,.digit-hour-24:hover,.digit-minute:hover{color:var(--sinch-color-tropical-500)}.digit-hour-12.selected,.digit-hour-24.selected,.digit-minute.selected{color:var(--sinch-color-tropical-500)}.digit-hour-12.selected{font-size:16px}.digit-hour-24.selected{font-size:16px}.digit-minute.selected{font-size:16px}#picker-touch{position:absolute;left:0;top:0;width:100%;height:100%;cursor:pointer;border-radius:50%}#needle-hour,#needle-minute,#picker-touch::after{background-color:var(--sinch-color-stormy-500)}#needle-hour,#needle-minute{position:absolute;transform-origin:bottom center;transform:rotate(0);bottom:50%;height:50px;transition-duration:.25s;transition-timing-function:ease-in-out;transition-property:transform height;z-index:2}@media (prefers-reduced-motion){#needle-hour,#needle-minute{transition:none}}#needle-hour{width:4px;left:calc(50% - 2px);border-radius:2px}#needle-minute{width:2px;left:calc(50% - 1px);border-radius:1px}#needle-minute:not(.selected)::after{content:"";position:absolute;transform:translateX(-50%);left:0;top:-16px;width:4px;height:4px;border-radius:50%;background-color:var(--sinch-color-tropical-500)}#picker-touch::after{content:"";position:absolute;top:50%;left:50%;width:12px;height:12px;border-radius:50%;transform:translate(-50%,-50%)}#header-hours,#header-minutes{position:absolute;padding:0 4px;width:50px;outline:0;--sinch-size-icon:24px}#header-hours{right:calc(50% + 8px);text-align:right}#header-minutes{left:calc(50% + 8px)}#header-hours::before,#header-minutes::before{content:"";display:none;position:absolute;border-radius:12px;left:50%;top:50%;width:100%;height:100%;transform:translate(-50%,-50%);padding:1px;border:1px solid var(--sinch-color-border-focus)}#header-hours-down,#header-hours-up,#header-minutes-down,#header-minutes-up{display:none;position:absolute;left:50%;transform:translateX(-50%)}#header-hours-up,#header-minutes-up{top:-18px}#header-hours-down,#header-minutes-down{bottom:-18px}#header-hours:focus #header-hours-down,#header-hours:focus #header-hours-up,#header-hours:focus::before{display:block}#header-minutes:focus #header-minutes-down,#header-minutes:focus #header-minutes-up,#header-minutes:focus::before{display:block}#header-colon{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}#submit{position:absolute;right:0;top:50%;transform:translateY(-50%)}:host([ampm]) .digit-hour-24{display:none}:host(:not([ampm])) #footer{display:none}</style><div id="wrapper"><div id="header"><div id="header-hours" tabindex="0" role="meter" aria-valuemin="0" aria-valuemax="23" aria-valuenow="0" aria-valuetext="0"><span>00</span><sinch-icon-arrow-drop-up id="header-hours-up"></sinch-icon-arrow-drop-up><sinch-icon-arrow-drop-down id="header-hours-down"></sinch-icon-arrow-drop-down></div><div id="header-colon">&colon;</div><div id="header-minutes" tabindex="0" role="meter" aria-valuemin="0" aria-valuemax="59" aria-valuenow="0" aria-valuetext="0"><span>00</span><sinch-icon-arrow-drop-up id="header-minutes-up"></sinch-icon-arrow-drop-up><sinch-icon-arrow-drop-down id="header-minutes-down"></sinch-icon-arrow-drop-down></div><sinch-icon-button id="submit" size="s" aria-label="Submit"><sinch-icon-done slot="icon"></sinch-icon-done></sinch-icon-button></div><div id="picker" aria-hidden="true"><div id="picker-hours"></div><div id="picker-minutes"></div><div id="picker-touch"><div id="needle-hour"></div><div id="needle-minute"></div></div></div><div id="footer"><sinch-segmented-control id="ampm"><sinch-segmented-control-option value="am" text="AM" aria-label="AM"></sinch-segmented-control-option><sinch-segmented-control-option value="pm" text="PM" aria-label="PM"></sinch-segmented-control-option></sinch-segmented-control></div></div>';
9
9
  import { getNeedleRotationDeg, getShortestCssDeg, hourToIndex, parseTime, stringifyHour, stringifyHourFace, stringifyMinute, stringifyTime } from './utils';
10
10
  const template = document.createElement('template');
11
11
  template.innerHTML = templateHTML;
package/title/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import '../icons/cancel';
2
2
  import { defineCustomElement, getAttribute, updateAttribute, updateLiteralAttribute, getLiteralAttribute, NectaryElement, updateBooleanAttribute, getBooleanAttribute } from '../utils';
3
- const templateHTML = '<style>:host{display:block}:host([type=xl]) #text{font:var(--sinch-font-title-xl)}:host([type="l"]) #text{font:var(--sinch-font-title-l)}:host([type="m"]) #text{font:var(--sinch-font-title-m)}:host([type="s"]) #text{font:var(--sinch-font-title-s)}:host([type=xs]) #text{font:var(--sinch-font-title-xs)}:host([ellipsis]:not([ellipsis=false])) #text{display:block;width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}</style><span id="text"></span>';
3
+ const templateHTML = '<style>:host{display:block}#text{letter-spacing:-2%}:host([type=xl]) #text{font:var(--sinch-font-title-xl)}:host([type="l"]) #text{font:var(--sinch-font-title-l)}:host([type="m"]) #text{font:var(--sinch-font-title-m)}:host([type="s"]) #text{font:var(--sinch-font-title-s)}:host([type=xs]) #text{font:var(--sinch-font-title-xs)}:host([ellipsis]:not([ellipsis=false])) #text{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}</style><span id="text"></span>';
4
4
  import { assertLevel, assertType, typeValues } from './utils';
5
5
  const template = document.createElement('template');
6
6
  template.innerHTML = templateHTML;
@@ -47,13 +47,17 @@ defineCustomElement('sinch-title', class extends NectaryElement {
47
47
  }
48
48
  case 'level':
49
49
  {
50
- assertLevel(newVal);
50
+ if ('production' !== 'production') {
51
+ assertLevel(newVal);
52
+ }
51
53
  updateAttribute(this, 'aria-level', newVal);
52
54
  break;
53
55
  }
54
56
  case 'type':
55
57
  {
56
- assertType(newVal);
58
+ if ('production' !== 'production') {
59
+ assertType(newVal);
60
+ }
57
61
  break;
58
62
  }
59
63
  }
package/toast/index.js CHANGED
@@ -57,7 +57,9 @@ defineCustomElement('sinch-toast', class extends NectaryElement {
57
57
  switch (name) {
58
58
  case 'type':
59
59
  {
60
- assertType(newVal);
60
+ if ('production' !== 'production') {
61
+ assertType(newVal);
62
+ }
61
63
  break;
62
64
  }
63
65
  case 'text':
package/toggle/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
2
- const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}#wrapper{position:relative;display:flex;flex-direction:row;align-items:center;box-sizing:border-box;width:100%;height:32px}:host([small]:not([small=false])) #wrapper{font:var(--sinch-font-small-text)}#input{all:initial;display:block;position:absolute;left:0;top:6px;width:40px;height:20px;cursor:pointer;pointer-events:initial}#input:disabled{cursor:initial}:host([small]:not([small=false])) #input{width:32px;height:16px;top:8px}#input:focus-visible::after{position:absolute;content:"";left:-4px;top:-4px;right:-4px;bottom:-4px;border:2px solid var(--sinch-color-border-focus);border-radius:18px;pointer-events:none}:host([small]:not([small=false])) #input:focus-visible::after{border-radius:14px}@supports not selector(:focus-visible){#input:focus::after{position:absolute;content:"";left:-4px;top:-4px;right:-4px;bottom:-4px;border:2px solid var(--sinch-color-border-focus);border-radius:18px;pointer-events:none}:host([small]:not([small=false])) #input:focus::after{border-radius:14px}}#knob-container{position:relative;box-sizing:border-box;width:40px;height:20px;border-radius:10px;pointer-events:none;padding:2px;background-color:var(--sinch-color-stormy-100);overflow:hidden}:host([small]:not([small=false])) #knob-container{width:32px;height:16px;border-radius:8px}#input:checked~#knob-container{background-color:var(--sinch-color-tropical-500)}#knob{position:relative;box-sizing:border-box;width:16px;height:16px;border-radius:50%;background-color:var(--sinch-color-snow-100);box-shadow:var(--sinch-elevation-level-1);transform:translateX(0);transition:transform .1s ease-in-out}:host([small]:not([small=false])) #knob{width:12px;height:12px}#input:checked~#knob-container>#knob{transform:translateX(20px)}:host([small]:not([small=false])) #input:checked~#knob-container>#knob{transform:translateX(16px)}#knob::after,#knob::before{font:var(--sinch-font-body);color:var(--sinch-color-snow-100);text-transform:uppercase;font-size:8px;line-height:16px;display:none;position:absolute;top:0;padding:0 3px}#knob::before{content:"on";right:100%}#knob::after{content:"off";left:100%}:host([labeled]:not([labeled=false]):is(:not([small]),[small=false])) #knob::after,:host([labeled]:not([labeled=false]):is(:not([small]),[small=false])) #knob::before{display:block}@media (prefers-reduced-motion){#knob{transition:none}}#label{flex:1;align-self:center;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-left:8px;font:var(--sinch-font-body);color:var(--sinch-color-text-default)}#label:empty{display:none}#input:disabled~#label{color:var(--sinch-color-stormy-200)}#input:disabled~#knob-container{background-color:var(--sinch-color-snow-700)}#input:checked:disabled~#knob-container{background-color:var(--sinch-color-tropical-100)}</style><div id="wrapper"><input id="input" type="checkbox"><div id="knob-container"><div id="knob"></div></div><label id="label" for="input"></label></div>';
2
+ const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}#wrapper{position:relative;display:flex;flex-direction:row;align-items:center;box-sizing:border-box;width:100%;height:32px}:host([small]:not([small=false])) #wrapper{font:var(--sinch-font-text-s)}#input{all:initial;display:block;position:absolute;left:0;top:6px;width:40px;height:20px;cursor:pointer;pointer-events:initial}#input:disabled{cursor:initial}:host([small]:not([small=false])) #input{width:32px;height:16px;top:8px}#input:focus-visible::after{position:absolute;content:"";left:-4px;top:-4px;right:-4px;bottom:-4px;border:2px solid var(--sinch-color-border-focus);border-radius:18px;pointer-events:none}:host([small]:not([small=false])) #input:focus-visible::after{border-radius:14px}#knob-container{position:relative;box-sizing:border-box;width:40px;height:20px;border-radius:10px;pointer-events:none;padding:2px;background-color:var(--sinch-color-stormy-100);overflow:hidden}:host([small]:not([small=false])) #knob-container{width:32px;height:16px;border-radius:8px}#input:checked~#knob-container{background-color:var(--sinch-color-tropical-500)}#knob{position:relative;box-sizing:border-box;width:16px;height:16px;border-radius:50%;background-color:var(--sinch-color-snow-100);box-shadow:var(--sinch-elevation-level-1);transform:translateX(0);transition:transform .1s ease-in-out}:host([small]:not([small=false])) #knob{width:12px;height:12px}#input:checked~#knob-container>#knob{transform:translateX(20px)}:host([small]:not([small=false])) #input:checked~#knob-container>#knob{transform:translateX(16px)}#knob::after,#knob::before{font:var(--sinch-font-text-m);color:var(--sinch-color-snow-100);text-transform:uppercase;font-size:8px;line-height:16px;display:none;position:absolute;top:0;padding:0 3px}#knob::before{content:"on";right:100%}#knob::after{content:"off";left:100%}:host([labeled]:not([labeled=false]):is(:not([small]),[small=false])) #knob::after,:host([labeled]:not([labeled=false]):is(:not([small]),[small=false])) #knob::before{display:block}@media (prefers-reduced-motion){#knob{transition:none}}#label{flex:1;align-self:center;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-left:8px;font:var(--sinch-font-text-m);color:var(--sinch-color-text-default)}#label:empty{display:none}#input:disabled~#label{color:var(--sinch-color-stormy-200)}#input:disabled~#knob-container{background-color:var(--sinch-color-snow-700)}#input:checked:disabled~#knob-container{background-color:var(--sinch-color-tropical-100)}</style><div id="wrapper"><input id="input" type="checkbox"><div id="knob-container"><div id="knob"></div></div><label id="label" for="input"></label></div>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
5
  defineCustomElement('sinch-toggle', class extends NectaryElement {
package/tooltip/index.js CHANGED
@@ -21,7 +21,6 @@ defineCustomElement('sinch-tooltip', class extends NectaryElement {
21
21
  #tooltipState;
22
22
  #animation = null;
23
23
  #shouldReduceMotion = false;
24
- #isConnected = false;
25
24
  #isSubscribed = false;
26
25
  constructor() {
27
26
  super();
@@ -44,7 +43,7 @@ defineCustomElement('sinch-tooltip', class extends NectaryElement {
44
43
  });
45
44
  }
46
45
  connectedCallback() {
47
- this.#isConnected = true;
46
+ super.connectedCallback();
48
47
  this.#controller = new AbortController();
49
48
  const options = {
50
49
  signal: this.#controller.signal
@@ -54,6 +53,7 @@ defineCustomElement('sinch-tooltip', class extends NectaryElement {
54
53
  this.#updateText();
55
54
  }
56
55
  disconnectedCallback() {
56
+ super.disconnectedCallback();
57
57
  this.#controller.abort();
58
58
  this.#tooltipState.destroy();
59
59
  }
@@ -93,8 +93,10 @@ defineCustomElement('sinch-tooltip', class extends NectaryElement {
93
93
  }
94
94
  case 'orientation':
95
95
  {
96
- assertOrientation(newVal);
97
- updateAttribute(this.#$pop, 'orientation', getPopOrientation(newVal));
96
+ if ('production' !== 'production') {
97
+ assertOrientation(newVal);
98
+ }
99
+ updateAttribute(this.#$pop, 'orientation', getPopOrientation(this.orientation));
98
100
  if (this.#isOpen()) {
99
101
  this.#resetTipOrientation();
100
102
  this.#updateTipOrientation();
@@ -178,7 +180,7 @@ defineCustomElement('sinch-tooltip', class extends NectaryElement {
178
180
  setClass(this.#$tip, 'hidden', rectOverlap(targetRect, contentRect));
179
181
  };
180
182
  #updateText() {
181
- if (!this.#isConnected) {
183
+ if (!this.isConnected) {
182
184
  return;
183
185
  }
184
186
  const value = this.text;
@@ -194,7 +196,7 @@ defineCustomElement('sinch-tooltip', class extends NectaryElement {
194
196
  this.#subscribeMouseEnterEvent();
195
197
  }
196
198
  #subscribeMouseEnterEvent() {
197
- if (!this.#isConnected || this.#isSubscribed) {
199
+ if (!this.isConnected || this.#isSubscribed) {
198
200
  return;
199
201
  }
200
202
  this.#$target.addEventListener('mouseenter', this.#onMouseEnter, {
@@ -1,15 +1,20 @@
1
- export declare type TContextName = 'visibility' | 'keydown';
2
- export declare type TContextKeyboard = {
1
+ export declare type TContextName = 'visibility' | 'keydown' | 'size';
2
+ export declare type TContextKeydown = {
3
3
  code: string;
4
4
  preventDefault: () => void;
5
5
  };
6
6
  export declare type TContextVisibility = boolean;
7
- export declare class Context {
7
+ export declare type TContextSize = string;
8
+ declare type TContextDataType = {
9
+ visibility: TContextVisibility;
10
+ keydown: TContextKeydown;
11
+ size: TContextSize;
12
+ };
13
+ export declare class Context<T extends TContextName> {
8
14
  #private;
9
- constructor($element: Element, name: TContextName);
10
- get elements(): Iterable<Element>;
11
- subscribe(): void;
12
- unsubscribe(): void;
15
+ constructor($element: Element, name: T);
16
+ listen(signal: AbortSignal): void;
17
+ dispatch(contextValue: TContextDataType[T]): void;
13
18
  }
14
- export declare const dispatchContextConnectEvent: (el: Element, name: TContextName) => void;
15
- export declare const dispatchContextDisconnectEvent: (el: Element, name: TContextName) => void;
19
+ export declare const subscribeContext: <T extends TContextName>($el: Element, name: T, cb: (e: CustomEvent<TContextDataType[T]>) => void, signal: AbortSignal) => void;
20
+ export {};
package/utils/context.js CHANGED
@@ -1,51 +1,85 @@
1
+ const contextNameToEventMap = {
2
+ keydown: '-keydown',
3
+ visibility: '-visibility',
4
+ size: '-size'
5
+ };
6
+ const shouldPersistContextValue = {
7
+ keydown: false,
8
+ visibility: true,
9
+ size: true
10
+ };
1
11
  export class Context {
2
12
  #$root;
3
13
  #listeners = new Set();
4
14
  #name;
5
- #isSubscribed = false;
15
+ #isListening = false;
16
+ #lastContextValue = null;
6
17
  constructor($element, name) {
7
18
  this.#$root = $element;
8
19
  this.#name = name;
9
20
  }
10
- get elements() {
11
- return this.#listeners;
12
- }
13
- subscribe() {
14
- if (this.#isSubscribed) {
21
+ listen(signal) {
22
+ if (this.#isListening) {
15
23
  return;
16
24
  }
17
- this.#$root.addEventListener(`-context-connect-${this.#name}`, this.#onConnect);
18
- this.#$root.addEventListener(`-context-disconnect-${this.#name}`, this.#onDisconnect);
19
- this.#isSubscribed = true;
25
+ this.#$root.addEventListener(`-context-connect-${this.#name}`, this.#onListenerConnect, {
26
+ signal
27
+ });
28
+ this.#$root.addEventListener(`-context-disconnect-${this.#name}`, this.#onListenerDisconnect, {
29
+ signal
30
+ });
31
+ this.#isListening = true;
32
+ signal.addEventListener('abort', () => {
33
+ this.#listeners.clear();
34
+ this.#isListening = false;
35
+ this.#lastContextValue = null;
36
+ }, {
37
+ once: true
38
+ });
20
39
  }
21
- unsubscribe() {
22
- this.#listeners.clear();
23
- this.#$root.removeEventListener(`-context-connect-${this.#name}`, this.#onConnect);
24
- this.#$root.removeEventListener(`-context-disconnect-${this.#name}`, this.#onDisconnect);
25
- this.#isSubscribed = false;
40
+ dispatch(contextValue) {
41
+ for (const el of this.#listeners) {
42
+ el.dispatchEvent(new CustomEvent(contextNameToEventMap[this.#name], {
43
+ detail: contextValue
44
+ }));
45
+ }
46
+ if (shouldPersistContextValue[this.#name]) {
47
+ this.#lastContextValue = contextValue;
48
+ }
26
49
  }
27
- #onConnect = e => {
50
+ #onListenerConnect = e => {
28
51
  e.stopPropagation();
29
52
  this.#listeners.add(e.detail);
53
+ if (this.#lastContextValue !== null) {
54
+ e.detail.dispatchEvent(new CustomEvent(contextNameToEventMap[this.#name], {
55
+ detail: this.#lastContextValue
56
+ }));
57
+ }
30
58
  };
31
- #onDisconnect = e => {
59
+ #onListenerDisconnect = e => {
32
60
  e.stopPropagation();
33
61
  this.#listeners.delete(e.detail);
34
62
  };
35
63
  }
36
- export const dispatchContextConnectEvent = (el, name) => {
64
+ export const subscribeContext = ($el, name, cb, signal) => {
37
65
  requestAnimationFrame(() => {
38
- el.dispatchEvent(new CustomEvent(`-context-connect-${name}`, {
66
+ $el.dispatchEvent(new CustomEvent(`-context-connect-${name}`, {
39
67
  bubbles: true,
40
68
  composed: true,
41
- detail: el
69
+ detail: $el
42
70
  }));
43
71
  });
44
- };
45
- export const dispatchContextDisconnectEvent = (el, name) => {
46
- el.dispatchEvent(new CustomEvent(`-context-disconnect-${name}`, {
47
- bubbles: true,
48
- composed: true,
49
- detail: el
50
- }));
72
+
73
+ $el.addEventListener(contextNameToEventMap[name], cb, {
74
+ signal
75
+ });
76
+ signal.addEventListener('abort', () => {
77
+ $el.dispatchEvent(new CustomEvent(`-context-disconnect-${name}`, {
78
+ bubbles: true,
79
+ composed: true,
80
+ detail: $el
81
+ }));
82
+ }, {
83
+ once: true
84
+ });
51
85
  };
@@ -0,0 +1,5 @@
1
+ export declare type TSinchCountry = {
2
+ name: string;
3
+ phoneCode: string;
4
+ };
5
+ export declare const countries: Record<string, TSinchCountry>;
@@ -0,0 +1,2 @@
1
+ import countriesJson from './countries.json';
2
+ export const countries = countriesJson;