@nectary/components 0.48.1 → 0.49.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 (149) hide show
  1. package/accordion/types.d.ts +2 -2
  2. package/accordion-item/types.d.ts +3 -3
  3. package/action-menu/index.js +0 -1
  4. package/action-menu/types.d.ts +2 -2
  5. package/action-menu-option/index.js +1 -1
  6. package/action-menu-option/types.d.ts +2 -2
  7. package/alert/index.d.ts +2 -1
  8. package/alert/index.js +4 -3
  9. package/alert/types.d.ts +3 -3
  10. package/alert/utils.d.ts +1 -1
  11. package/avatar/types.d.ts +3 -3
  12. package/avatar/utils.d.ts +1 -1
  13. package/badge/types.d.ts +3 -3
  14. package/badge/utils.d.ts +1 -1
  15. package/button/types.d.ts +3 -3
  16. package/button/utils.d.ts +1 -1
  17. package/card/types.d.ts +2 -2
  18. package/card-container/types.d.ts +2 -2
  19. package/chat/types.d.ts +2 -2
  20. package/chat-block/types.d.ts +3 -3
  21. package/chat-bubble/types.d.ts +4 -4
  22. package/checkbox/types.d.ts +2 -2
  23. package/chip/types.d.ts +2 -2
  24. package/code-tag/index.d.ts +13 -0
  25. package/code-tag/index.js +36 -0
  26. package/code-tag/types.d.ts +11 -0
  27. package/code-tag/types.js +1 -0
  28. package/color-menu/index.js +0 -3
  29. package/color-menu/types.d.ts +2 -2
  30. package/color-swatch/types.d.ts +2 -2
  31. package/date-picker/index.js +0 -6
  32. package/date-picker/types.d.ts +2 -2
  33. package/date-picker/utils.d.ts +6 -6
  34. package/dialog/index.js +0 -1
  35. package/dialog/types.d.ts +2 -2
  36. package/emoji/types.d.ts +2 -2
  37. package/emoji/utils.js +0 -4
  38. package/emoji-picker/index.js +1 -3
  39. package/emoji-picker/types.d.ts +4 -4
  40. package/field/types.d.ts +2 -2
  41. package/file-drop/types.d.ts +3 -3
  42. package/file-picker/index.js +0 -1
  43. package/file-picker/types.d.ts +3 -3
  44. package/file-status/types.d.ts +3 -3
  45. package/file-status/utils.d.ts +1 -1
  46. package/flag/types.d.ts +2 -2
  47. package/flag/utils.js +0 -2
  48. package/grid/types.d.ts +2 -2
  49. package/grid-item/types.d.ts +2 -2
  50. package/help-tooltip/types.d.ts +2 -2
  51. package/horizontal-stepper/types.d.ts +2 -2
  52. package/horizontal-stepper-item/types.d.ts +3 -3
  53. package/icon/types.d.ts +2 -2
  54. package/icon-button/types.d.ts +3 -3
  55. package/icon-button/utils.d.ts +1 -1
  56. package/icons/types.d.ts +2 -2
  57. package/icons-branded/types.d.ts +2 -2
  58. package/icons-channel/types.d.ts +2 -2
  59. package/illustrations/types.d.ts +4 -4
  60. package/inline-alert/index.d.ts +4 -3
  61. package/inline-alert/index.js +6 -5
  62. package/inline-alert/types.d.ts +3 -3
  63. package/inline-alert/utils.d.ts +1 -1
  64. package/input/index.js +17 -3
  65. package/input/types.d.ts +9 -3
  66. package/input/utils.d.ts +3 -0
  67. package/input/utils.js +6 -1
  68. package/link/types.d.ts +2 -2
  69. package/list/types.d.ts +2 -2
  70. package/list-item/types.d.ts +2 -2
  71. package/logo/types.d.ts +2 -2
  72. package/package.json +10 -9
  73. package/pagination/index.js +0 -6
  74. package/pagination/types.d.ts +2 -2
  75. package/pop/index.js +0 -16
  76. package/pop/types.d.ts +3 -3
  77. package/pop/utils.d.ts +1 -1
  78. package/popover/types.d.ts +3 -3
  79. package/popover/utils.d.ts +2 -2
  80. package/progress/types.d.ts +2 -2
  81. package/radio/types.d.ts +2 -2
  82. package/radio-option/types.d.ts +2 -2
  83. package/rich-text/index.d.ts +12 -0
  84. package/rich-text/index.js +56 -0
  85. package/rich-text/types.d.ts +12 -0
  86. package/rich-text/types.js +1 -0
  87. package/rich-text/utils.d.ts +5 -0
  88. package/rich-text/utils.js +6 -0
  89. package/segment/types.d.ts +2 -2
  90. package/segment-collapse/types.d.ts +2 -2
  91. package/segmented-control/types.d.ts +2 -2
  92. package/segmented-control-option/types.d.ts +2 -2
  93. package/segmented-icon-control/types.d.ts +2 -2
  94. package/segmented-icon-control-option/types.d.ts +2 -2
  95. package/select-button/index.js +1 -1
  96. package/select-button/types.d.ts +2 -2
  97. package/select-menu/index.js +0 -1
  98. package/select-menu/types.d.ts +2 -2
  99. package/select-menu-option/index.js +1 -1
  100. package/select-menu-option/types.d.ts +2 -2
  101. package/spinner/types.d.ts +2 -2
  102. package/table/types.d.ts +2 -2
  103. package/table-body/types.d.ts +2 -2
  104. package/table-cell/types.d.ts +3 -3
  105. package/table-head/types.d.ts +2 -2
  106. package/table-head-cell/types.d.ts +2 -2
  107. package/table-row/types.d.ts +2 -2
  108. package/tabs/types.d.ts +2 -2
  109. package/tabs-icon-option/index.js +1 -1
  110. package/tabs-icon-option/types.d.ts +2 -2
  111. package/tabs-option/index.js +1 -1
  112. package/tabs-option/types.d.ts +2 -2
  113. package/tag/types.d.ts +2 -2
  114. package/text/index.js +1 -3
  115. package/text/types.d.ts +3 -3
  116. package/text/utils.d.ts +1 -1
  117. package/text/utils.js +1 -1
  118. package/textarea/index.js +1 -1
  119. package/textarea/types.d.ts +2 -2
  120. package/theme/fonts.css +33 -0
  121. package/theme/fonts.json +33 -0
  122. package/tile-control/types.d.ts +2 -2
  123. package/tile-control-option/types.d.ts +2 -2
  124. package/time-picker/index.js +0 -4
  125. package/time-picker/types.d.ts +2 -2
  126. package/title/index.js +0 -2
  127. package/title/types.d.ts +4 -4
  128. package/title/utils.d.ts +3 -2
  129. package/title/utils.js +17 -0
  130. package/toast/types.d.ts +3 -3
  131. package/toast/utils.d.ts +1 -1
  132. package/toast-manager/index.js +0 -1
  133. package/toast-manager/types.d.ts +2 -2
  134. package/toggle/types.d.ts +2 -2
  135. package/tooltip/tooltip-state.d.ts +1 -1
  136. package/tooltip/types.d.ts +3 -3
  137. package/tooltip/utils.d.ts +2 -2
  138. package/utils/context.d.ts +5 -5
  139. package/utils/context.js +0 -1
  140. package/utils/countries.d.ts +1 -1
  141. package/utils/dom.d.ts +1 -1
  142. package/utils/index.d.ts +1 -0
  143. package/utils/index.js +2 -1
  144. package/utils/markdown.d.ts +1 -0
  145. package/utils/markdown.js +128 -0
  146. package/utils/rect.js +0 -1
  147. package/utils/size.d.ts +4 -4
  148. package/vertical-stepper/types.d.ts +2 -2
  149. package/vertical-stepper-item/types.d.ts +3 -3
@@ -1,16 +1,16 @@
1
1
  import type { TRect, TSinchElementReact } from '../types';
2
- export declare type TEmoji = {
2
+ export type TEmoji = {
3
3
  emoji: string;
4
4
  code: string;
5
5
  label: string;
6
6
  skins?: TEmoji[];
7
7
  tone: number | number[];
8
8
  };
9
- export declare type TEmojiGroup = {
9
+ export type TEmojiGroup = {
10
10
  name: string;
11
11
  emojis: TEmoji[];
12
12
  };
13
- export declare type TSinchEmojiPickerElement = HTMLElement & {
13
+ export type TSinchEmojiPickerElement = HTMLElement & {
14
14
  readonly skinToneButtonRect: TRect;
15
15
  readonly searchInputRect: TRect;
16
16
  readonly searchClearButtonRect: TRect;
@@ -20,7 +20,7 @@ export declare type TSinchEmojiPickerElement = HTMLElement & {
20
20
  /** Change value event */
21
21
  addEventListener(type: '-change', listener: (e: CustomEvent<string>) => void): void;
22
22
  };
23
- export declare type TSinchEmojiPickerReact = TSinchElementReact<TSinchEmojiPickerElement> & {
23
+ export type TSinchEmojiPickerReact = TSinchElementReact<TSinchEmojiPickerElement> & {
24
24
  /** Change value handler */
25
25
  'on-change': (e: CustomEvent<string>) => void;
26
26
  };
package/field/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchFieldElement = HTMLElement & {
2
+ export type TSinchFieldElement = HTMLElement & {
3
3
  /** Label */
4
4
  label: string;
5
5
  /** Optional text */
@@ -21,7 +21,7 @@ export declare type TSinchFieldElement = HTMLElement & {
21
21
  /** Disabled */
22
22
  setAttribute(name: 'disabled', value: ''): void;
23
23
  };
24
- export declare type TSinchFieldReact = TSinchElementReact<TSinchFieldElement> & {
24
+ export type TSinchFieldReact = TSinchElementReact<TSinchFieldElement> & {
25
25
  /** Label that shows in UI */
26
26
  label: string;
27
27
  /** Optional text */
@@ -1,6 +1,6 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchFileDropInvalidType = 'accept' | 'multiple' | 'size';
3
- export declare type TSinchFileDropElement = HTMLElement & {
2
+ export type TSinchFileDropInvalidType = 'accept' | 'multiple' | 'size';
3
+ export type TSinchFileDropElement = HTMLElement & {
4
4
  /** Allows to choose multiple files */
5
5
  multiple: boolean;
6
6
  /** [A unique file type specifier](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers) */
@@ -30,7 +30,7 @@ export declare type TSinchFileDropElement = HTMLElement & {
30
30
  /** Disabled state */
31
31
  setAttribute(name: 'disabled', value: ''): void;
32
32
  };
33
- export declare type TSinchFileDropReact = TSinchElementReact<TSinchFileDropElement> & {
33
+ export type TSinchFileDropReact = TSinchElementReact<TSinchFileDropElement> & {
34
34
  /** Allows to choose multiple files */
35
35
  multiple?: boolean;
36
36
  /** [A unique file type specifier](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers) */
@@ -81,7 +81,6 @@ defineCustomElement('sinch-file-picker', class extends NectaryElement {
81
81
  return;
82
82
  }
83
83
  const files = Array.from(this.#$input.files);
84
-
85
84
  this.#$input.value = '';
86
85
  if (!doFilesSatisfySize(files, this.size)) {
87
86
  this.dispatchEvent(new CustomEvent('-invalid', {
@@ -1,6 +1,6 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchFilePickerInvalidType = 'size';
3
- export declare type TSinchFilePickerElement = HTMLElement & {
2
+ export type TSinchFilePickerInvalidType = 'size';
3
+ export type TSinchFilePickerElement = HTMLElement & {
4
4
  /** Allows to choose multiple files */
5
5
  multiple: boolean;
6
6
  /** [A unique file type specifier](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers) */
@@ -18,7 +18,7 @@ export declare type TSinchFilePickerElement = HTMLElement & {
18
18
  /** Max file size in bytes */
19
19
  setAttribute(name: 'size', value: string): void;
20
20
  };
21
- export declare type TSinchFilePickerReact = TSinchElementReact<TSinchFilePickerElement> & {
21
+ export type TSinchFilePickerReact = TSinchElementReact<TSinchFilePickerElement> & {
22
22
  /** Allows to choose multiple files */
23
23
  multiple?: boolean;
24
24
  /** [A unique file type specifier](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers) */
@@ -1,6 +1,6 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchFileStatusType = 'pending' | 'loading' | 'progress' | 'success' | 'error';
3
- export declare type TSinchFileStatusElement = HTMLElement & {
2
+ export type TSinchFileStatusType = 'pending' | 'loading' | 'progress' | 'success' | 'error';
3
+ export type TSinchFileStatusElement = HTMLElement & {
4
4
  /** File status type */
5
5
  type: TSinchFileStatusType;
6
6
  /** File name */
@@ -10,7 +10,7 @@ export declare type TSinchFileStatusElement = HTMLElement & {
10
10
  /** File name */
11
11
  setAttribute(name: 'filename', value: string): void;
12
12
  };
13
- export declare type TSinchFileStatusReact = TSinchElementReact<TSinchFileStatusElement> & {
13
+ export type TSinchFileStatusReact = TSinchElementReact<TSinchFileStatusElement> & {
14
14
  /** File status type */
15
15
  type: TSinchFileStatusType;
16
16
  /** File name */
@@ -1,5 +1,5 @@
1
1
  import type { TSinchFileStatusType } from './types';
2
2
  export declare const typeValues: readonly TSinchFileStatusType[];
3
- declare type TAssertType = (value: string | null) => asserts value is TSinchFileStatusType;
3
+ type TAssertType = (value: string | null) => asserts value is TSinchFileStatusType;
4
4
  export declare const assertType: TAssertType;
5
5
  export {};
package/flag/types.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchFlagElement = HTMLElement & {
2
+ export type TSinchFlagElement = HTMLElement & {
3
3
  /** Flag country code */
4
4
  code: string;
5
5
  /** Flag country code */
6
6
  setAttribute(code: 'name', value: string): void;
7
7
  };
8
- export declare type TSinchFlagReact = TSinchElementReact<TSinchFlagElement> & {
8
+ export type TSinchFlagReact = TSinchElementReact<TSinchFlagElement> & {
9
9
  /** Flag country code */
10
10
  code: string;
11
11
  };
package/flag/utils.js CHANGED
@@ -1,11 +1,9 @@
1
1
  import { getCssVar } from '../utils';
2
-
3
2
  let flagUrl = null;
4
3
  export const getFlagUrl = (root, code) => {
5
4
  if (code === null || code.length === 0) {
6
5
  return '';
7
6
  }
8
-
9
7
  if (flagUrl === null) {
10
8
  flagUrl = getCssVar(root, '--sinch-flag-src-url');
11
9
  if (flagUrl !== null) {
package/grid/types.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchGridElement = HTMLElement;
3
- export declare type TSinchGridReact = TSinchElementReact<TSinchGridElement>;
2
+ export type TSinchGridElement = HTMLElement;
3
+ export type TSinchGridReact = TSinchElementReact<TSinchGridElement>;
@@ -1,5 +1,5 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchGridItemElement = HTMLElement & {
2
+ export type TSinchGridItemElement = HTMLElement & {
3
3
  xl: number | null;
4
4
  l: number | null;
5
5
  m: number | null;
@@ -9,7 +9,7 @@ export declare type TSinchGridItemElement = HTMLElement & {
9
9
  setAttribute(name: 'm', value: string): void;
10
10
  setAttribute(name: 's', value: string): void;
11
11
  };
12
- export declare type TSinchGridItemReact = TSinchElementReact<TSinchGridItemElement> & {
12
+ export type TSinchGridItemReact = TSinchElementReact<TSinchGridItemElement> & {
13
13
  xl?: number;
14
14
  l?: number;
15
15
  m?: number;
@@ -1,3 +1,3 @@
1
1
  import type { TSinchTooltipElement, TSinchTooltipReact } from '../tooltip/types';
2
- export declare type TSinchHelpTooltipElement = TSinchTooltipElement;
3
- export declare type TSinchHelpTooltipReact = TSinchTooltipReact;
2
+ export type TSinchHelpTooltipElement = TSinchTooltipElement;
3
+ export type TSinchHelpTooltipReact = TSinchTooltipReact;
@@ -1,11 +1,11 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchHorizontalStepperElement = HTMLElement & {
2
+ export type TSinchHorizontalStepperElement = HTMLElement & {
3
3
  /** Current item index, starting from 1 */
4
4
  index: string;
5
5
  /** Current item index, starting from 1 */
6
6
  setAttribute(name: 'index', value: string): void;
7
7
  };
8
- export declare type TSinchHorizontalStepperReact = TSinchElementReact<TSinchHorizontalStepperElement> & {
8
+ export type TSinchHorizontalStepperReact = TSinchElementReact<TSinchHorizontalStepperElement> & {
9
9
  /** Current item index, starting from 1 */
10
10
  index: string;
11
11
  /** Label that is used for a11y */
@@ -1,6 +1,6 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchHorizontalStepperStatusType = 'error' | 'skip';
3
- export declare type TSinchHorizontalStepperItemElement = HTMLElement & {
2
+ export type TSinchHorizontalStepperStatusType = 'error' | 'skip';
3
+ export type TSinchHorizontalStepperItemElement = HTMLElement & {
4
4
  /** Label */
5
5
  label: string;
6
6
  /** Description */
@@ -14,7 +14,7 @@ export declare type TSinchHorizontalStepperItemElement = HTMLElement & {
14
14
  /** Status */
15
15
  setAttribute(name: 'status', value: TSinchHorizontalStepperStatusType): void;
16
16
  };
17
- export declare type TSinchHorizontalStepperItemReact = TSinchElementReact<TSinchHorizontalStepperItemElement> & {
17
+ export type TSinchHorizontalStepperItemReact = TSinchElementReact<TSinchHorizontalStepperItemElement> & {
18
18
  /** Label */
19
19
  label: string;
20
20
  /** Description */
package/icon/types.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchIconElement = HTMLElement & {
2
+ export type TSinchIconElement = HTMLElement & {
3
3
  /** Icon name */
4
4
  name: string;
5
5
  /** Icon name */
6
6
  setAttribute(name: 'name', value: string): void;
7
7
  };
8
- export declare type TSinchIconReact = TSinchElementReact<TSinchIconElement> & {
8
+ export type TSinchIconReact = TSinchElementReact<TSinchIconElement> & {
9
9
  /** Icon name */
10
10
  name: string;
11
11
  };
@@ -1,7 +1,7 @@
1
1
  import type { TRect, TSinchElementReact } from '../types';
2
2
  import type { TSinchSizeEx } from '../utils/size';
3
- export declare type TSinchIconButtonType = 'primary' | 'secondary' | 'tertiary';
4
- export declare type TSinchIconButtonElement = HTMLElement & {
3
+ export type TSinchIconButtonType = 'primary' | 'secondary' | 'tertiary';
4
+ export type TSinchIconButtonElement = HTMLElement & {
5
5
  /** Type, `tertiary` by default */
6
6
  type: TSinchIconButtonType;
7
7
  /** Size, `m` by default */
@@ -22,7 +22,7 @@ export declare type TSinchIconButtonElement = HTMLElement & {
22
22
  /** Disabled */
23
23
  setAttribute(name: 'disabled', value: ''): void;
24
24
  };
25
- export declare type TSinchIconButtonReact = TSinchElementReact<TSinchIconButtonElement> & {
25
+ export type TSinchIconButtonReact = TSinchElementReact<TSinchIconButtonElement> & {
26
26
  /** Type, `tertiary` by default */
27
27
  type?: TSinchIconButtonType;
28
28
  /** Size, `m` by default */
@@ -1,5 +1,5 @@
1
1
  import type { TSinchIconButtonType } from './types';
2
2
  export declare const typeValues: readonly TSinchIconButtonType[];
3
- declare type TAssertType = (value: string | null) => asserts value is TSinchIconButtonType;
3
+ type TAssertType = (value: string | null) => asserts value is TSinchIconButtonType;
4
4
  export declare const assertType: TAssertType;
5
5
  export {};
package/icons/types.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchIconElement = HTMLElement & {
2
+ export type TSinchIconElement = HTMLElement & {
3
3
  size: number;
4
4
  setAttribute(name: 'size', value: string): void;
5
5
  };
6
- export declare type TSinchIconReact = TSinchElementReact<TSinchIconElement> & {
6
+ export type TSinchIconReact = TSinchElementReact<TSinchIconElement> & {
7
7
  size?: number;
8
8
  };
@@ -1,5 +1,5 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchIconBrandedElement = HTMLElement & {
2
+ export type TSinchIconBrandedElement = HTMLElement & {
3
3
  /** @deprecated */
4
4
  size: number;
5
5
  inverted: boolean;
@@ -7,7 +7,7 @@ export declare type TSinchIconBrandedElement = HTMLElement & {
7
7
  setAttribute(name: 'size', value: string): void;
8
8
  setAttribute(name: 'inverted', value: ''): void;
9
9
  };
10
- export declare type TSinchIconBrandedReact = TSinchElementReact<TSinchIconBrandedElement> & {
10
+ export type TSinchIconBrandedReact = TSinchElementReact<TSinchIconBrandedElement> & {
11
11
  /** @deprecated */
12
12
  size?: number;
13
13
  inverted?: boolean;
@@ -1,11 +1,11 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchIconChannelElement = HTMLElement & {
2
+ export type TSinchIconChannelElement = HTMLElement & {
3
3
  /** @deprecated */
4
4
  size: number;
5
5
  /** @deprecated */
6
6
  setAttribute(name: 'size', value: string): void;
7
7
  };
8
- export declare type TSinchIconChannelReact = TSinchElementReact<TSinchIconChannelElement> & {
8
+ export type TSinchIconChannelReact = TSinchElementReact<TSinchIconChannelElement> & {
9
9
  /** @deprecated */
10
10
  size?: number;
11
11
  };
@@ -1,7 +1,7 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchIllustrationBackground = 'grey' | 'green' | 'blue' | 'yellow' | 'white';
3
- export declare type TSinchIllustrationVAlign = 'top' | 'center' | 'bottom';
4
- export declare type TSinchIllustrationElement = HTMLElement & {
2
+ export type TSinchIllustrationBackground = 'grey' | 'green' | 'blue' | 'yellow' | 'white';
3
+ export type TSinchIllustrationVAlign = 'top' | 'center' | 'bottom';
4
+ export type TSinchIllustrationElement = HTMLElement & {
5
5
  size: number;
6
6
  background: TSinchIllustrationBackground | null;
7
7
  valign: TSinchIllustrationVAlign | null;
@@ -9,7 +9,7 @@ export declare type TSinchIllustrationElement = HTMLElement & {
9
9
  setAttribute(name: 'background', value: TSinchIllustrationBackground): void;
10
10
  setAttribute(name: 'valign', value: TSinchIllustrationVAlign): void;
11
11
  };
12
- export declare type TSinchIllustrationReact = TSinchElementReact<TSinchIllustrationElement> & {
12
+ export type TSinchIllustrationReact = TSinchElementReact<TSinchIllustrationElement> & {
13
13
  size?: number;
14
14
  background?: TSinchIllustrationBackground;
15
15
  valign?: TSinchIllustrationVAlign;
@@ -1,9 +1,10 @@
1
- import '../icons/report-problem';
2
- import '../icons/report';
3
1
  import '../icons/check-circle';
4
2
  import '../icons/info';
5
- import '../title';
3
+ import '../icons/report-problem';
4
+ import '../icons/report';
5
+ import '../rich-text';
6
6
  import '../text';
7
+ import '../title';
7
8
  import type { TSinchInlineAlertElement, TSinchInlineAlertReact } from './types';
8
9
  declare global {
9
10
  namespace JSX {
@@ -1,11 +1,12 @@
1
- import '../icons/report-problem';
2
- import '../icons/report';
3
1
  import '../icons/check-circle';
4
2
  import '../icons/info';
5
- import '../title';
3
+ import '../icons/report-problem';
4
+ import '../icons/report';
5
+ import '../rich-text';
6
6
  import '../text';
7
+ import '../title';
7
8
  import { defineCustomElement, getAttribute, getLiteralAttribute, updateAttribute, updateLiteralAttribute, NectaryElement, setClass } from '../utils';
8
- 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-feedback-success-bg)}:host([type=warn]) #wrapper{background-color:var(--sinch-color-feedback-warning-bg)}:host([type=error]) #wrapper{background-color:var(--sinch-color-feedback-invalid-bg)}:host([type=info]) #wrapper{background-color:var(--sinch-color-feedback-info-bg)}:host([type=success]) #icon-success{display:block;--sinch-color-icon:var(--sinch-color-feedback-success-icon)}:host([type=warn]) #icon-warn{display:block;--sinch-color-icon:var(--sinch-color-feedback-warning-icon)}:host([type=error]) #icon-error{display:block;--sinch-color-icon:var(--sinch-color-feedback-invalid-icon)}:host([type=info]) #icon-info{display:block;--sinch-color-icon:var(--sinch-color-feedback-info-icon)}#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>';
9
+ 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{display:flex;flex-direction:column;gap:8px;color:var(--sinch-color-stormy-500);margin-top:4px;align-self:stretch}#icon-error,#icon-info,#icon-success,#icon-warn{display:none}:host([type=success]) #wrapper{background-color:var(--sinch-color-feedback-success-bg)}:host([type=warn]) #wrapper{background-color:var(--sinch-color-feedback-warning-bg)}:host([type=error]) #wrapper{background-color:var(--sinch-color-feedback-invalid-bg)}:host([type=info]) #wrapper{background-color:var(--sinch-color-feedback-info-bg)}:host([type=success]) #icon-success{display:block;--sinch-color-icon:var(--sinch-color-feedback-success-icon)}:host([type=warn]) #icon-warn{display:block;--sinch-color-icon:var(--sinch-color-feedback-warning-icon)}:host([type=error]) #icon-error{display:block;--sinch-color-icon:var(--sinch-color-feedback-invalid-icon)}:host([type=info]) #icon-info{display:block;--sinch-color-icon:var(--sinch-color-feedback-info-icon)}#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-rich-text id="text"></sinch-rich-text><div id="action"><slot name="action"></slot></div></div><div id="close"><slot name="close"></slot></div></div>';
9
10
  import { assertType, typeValues } from './utils';
10
11
  const template = document.createElement('template');
11
12
  template.innerHTML = templateHTML;
@@ -71,7 +72,7 @@ defineCustomElement('sinch-inline-alert', class extends NectaryElement {
71
72
  }
72
73
  case 'text':
73
74
  {
74
- this.#$text.textContent = newVal;
75
+ updateAttribute(this.#$text, 'text', newVal);
75
76
  break;
76
77
  }
77
78
  case 'caption':
@@ -1,6 +1,6 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchInlineAlertType = 'info' | 'success' | 'warn' | 'error';
3
- export declare type TSinchInlineAlertElement = HTMLElement & {
2
+ export type TSinchInlineAlertType = 'info' | 'success' | 'warn' | 'error';
3
+ export type TSinchInlineAlertElement = HTMLElement & {
4
4
  type: TSinchInlineAlertType;
5
5
  text: string | null;
6
6
  caption: string;
@@ -8,7 +8,7 @@ export declare type TSinchInlineAlertElement = HTMLElement & {
8
8
  setAttribute(name: 'text', value: string): void;
9
9
  setAttribute(name: 'caption', value: string): void;
10
10
  };
11
- export declare type TSinchInlineAlertReact = TSinchElementReact<TSinchInlineAlertElement> & {
11
+ export type TSinchInlineAlertReact = TSinchElementReact<TSinchInlineAlertElement> & {
12
12
  type: TSinchInlineAlertType;
13
13
  text?: string;
14
14
  caption: string;
@@ -1,5 +1,5 @@
1
1
  import type { TSinchInlineAlertType } from './types';
2
2
  export declare const typeValues: readonly TSinchInlineAlertType[];
3
- declare type TAssertType = (value: string | null) => asserts value is TSinchInlineAlertType;
3
+ type TAssertType = (value: string | null) => asserts value is TSinchInlineAlertType;
4
4
  export declare const assertType: TAssertType;
5
5
  export {};
package/input/index.js CHANGED
@@ -3,8 +3,8 @@ import '../icons/close';
3
3
  import '../stop-events';
4
4
  import { Context, defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, getReactEventHandler, getRect, isAttrTrue, NectaryElement, setClass, subscribeContext, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute, updateLiteralAttribute } from '../utils';
5
5
  import { assertSize, DEFAULT_SIZE, sizeValues } from '../utils/size';
6
- const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}:host([data-size="l"]){--sinch-size:var(--sinch-size-l);--sinch-size-icon:var(--sinch-input-icon-size-l);--sinch-shape-radius:var(--sinch-shape-radius-l)}:host([data-size="m"]){--sinch-size:var(--sinch-size-m);--sinch-size-icon:var(--sinch-input-icon-size-m);--sinch-shape-radius:var(--sinch-shape-radius-m)}:host([data-size="s"]){--sinch-size:var(--sinch-size-s);--sinch-size-icon:var(--sinch-input-icon-size-s);--sinch-shape-radius:var(--sinch-shape-radius-s)}#wrapper{position:relative;display:flex;flex-direction:row;align-items:center;box-sizing:border-box;border-radius:var(--sinch-shape-radius);width:100%;height:var(--sinch-size);background-color:var(--sinch-color-bg-primary-light)}#input{all:initial;flex:1;min-width:0;height:100%;padding:0 12px 0 40px;font:var(--sinch-font-text-m);color:var(--sinch-color-text-default)}:host([data-size="s"]) #input{padding-left:32px}#input::placeholder{font:var(--sinch-font-text-m);color:var(--sinch-color-text-muted);opacity:1}#border{position:absolute;border:1px solid var(--sinch-color-border-dark);border-radius:var(--sinch-shape-radius);inset:0;pointer-events:none}:host([invalid]:not([invalid=false]):not([disabled])) #border{border-color:var(--sinch-color-text-invalid)}#input:disabled{color:var(--sinch-color-text-disabled)}#input:disabled::placeholder{color:var(--sinch-color-text-disabled)}#input:disabled+#border{border-color:var(--sinch-color-border-disabled)}#input:focus+#border{border-color:var(--sinch-color-border-focus);border-width:2px}#input[type=password]{font-size:1.5em;letter-spacing:.1em}#icon-wrapper{position:relative;height:100%}#icon{position:absolute;display:flex;align-items:center;left:10px;top:0;bottom:0;pointer-events:none;--sinch-color-icon:var(--sinch-color-stormy-500)}:host([disabled]:not([disabled=false])) #icon{--sinch-color-icon:var(--sinch-color-border-disabled)}#icon-wrapper.empty{display:none}#icon-wrapper.empty~#input{padding-left:12px}#clear-wrapper{margin-left:-10px;margin-right:4px}#clear{display:none;--sinch-icon-button-color-icon:var(--sinch-color-stormy-500)}:host([value]:not([value=""])) #clear[data-focus],:host([value]:not([value=""])) #clear[data-tooltip]{display:block}#right{display:flex;flex-direction:row;align-self:stretch;align-items:center;gap:4px;padding-right:4px}#right.empty{display:none}#left{display:flex;flex-direction:row;align-self:stretch;align-items:center;gap:4px;padding-left:4px}#left.empty{display:none}</style><div id="wrapper"><div id="left"><slot name="left"></slot></div><div id="icon-wrapper"><div id="icon"><slot name="icon"></slot></div></div><input id="input" type="text"/><div id="border"></div><div id="clear-wrapper"><sinch-stop-events events="keydown"><sinch-icon-button id="clear" aria-label="Clear input value"><sinch-icon-close slot="icon"></sinch-icon-close></sinch-icon-button></sinch-stop-events></div><div id="right"><slot name="right"></slot></div></div>';
7
- import { inputTypes } from './utils';
6
+ const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}:host([data-size="l"]){--sinch-size:var(--sinch-size-l);--sinch-size-icon:var(--sinch-input-icon-size-l);--sinch-shape-radius:var(--sinch-shape-radius-l)}:host([data-size="m"]){--sinch-size:var(--sinch-size-m);--sinch-size-icon:var(--sinch-input-icon-size-m);--sinch-shape-radius:var(--sinch-shape-radius-m)}:host([data-size="s"]){--sinch-size:var(--sinch-size-s);--sinch-size-icon:var(--sinch-input-icon-size-s);--sinch-shape-radius:var(--sinch-shape-radius-s)}#wrapper{position:relative;display:flex;flex-direction:row;align-items:center;box-sizing:border-box;border-radius:var(--sinch-shape-radius);width:100%;height:var(--sinch-size);background-color:var(--sinch-color-bg-primary-light)}#input{all:initial;flex:1;min-width:0;height:100%;padding:0 12px 0 40px;font:var(--sinch-font-text-m);color:var(--sinch-color-text-default)}#input::placeholder{font:var(--sinch-font-text-m);color:var(--sinch-color-text-muted);opacity:1}#border{position:absolute;border:1px solid var(--sinch-color-border-dark);border-radius:var(--sinch-shape-radius);inset:0;pointer-events:none}#input:disabled{color:var(--sinch-color-text-disabled);-webkit-text-fill-color:var(--sinch-color-text-disabled)}:host([data-size="s"]) #input{padding-left:32px}:host([invalid]:not([invalid=false]):not([disabled])) #border{border-color:var(--sinch-color-text-invalid)}#input:disabled::placeholder{color:var(--sinch-color-text-disabled)}#input:disabled+#border{border-color:var(--sinch-color-border-disabled)}#input:focus+#border{border-color:var(--sinch-color-border-focus);border-width:2px}#input[type=password]{font-size:1.5em;letter-spacing:.1em}#icon-wrapper{position:relative;height:100%}#icon{position:absolute;display:flex;align-items:center;left:10px;top:0;bottom:0;pointer-events:none;--sinch-color-icon:var(--sinch-color-stormy-500)}:host([disabled]:not([disabled=false])) #icon{--sinch-color-icon:var(--sinch-color-text-disabled)}#icon-wrapper.empty{display:none}#icon-wrapper.empty~#input{padding-left:12px}#clear-wrapper{margin-left:-10px;margin-right:4px}#clear{display:none;--sinch-icon-button-color-icon:var(--sinch-color-stormy-500)}:host([value]:not([value=""])) #clear[data-focus],:host([value]:not([value=""])) #clear[data-tooltip]{display:block}#right{display:flex;flex-direction:row;align-self:stretch;align-items:center;gap:4px;padding-right:4px}#right.empty{display:none}#left{display:flex;flex-direction:row;align-self:stretch;align-items:center;gap:4px;padding-left:4px}#left.empty{display:none}</style><div id="wrapper"><div id="left"><slot name="left"></slot></div><div id="icon-wrapper"><div id="icon"><slot name="icon"></slot></div></div><input id="input" type="text"/><div id="border"></div><div id="clear-wrapper"><sinch-stop-events events="keydown"><sinch-icon-button id="clear" aria-label="Clear input value"><sinch-icon-close slot="icon"></sinch-icon-close></sinch-icon-button></sinch-stop-events></div><div id="right"><slot name="right"></slot></div></div>';
7
+ import { assertType, inputTypes } from './utils';
8
8
  const template = document.createElement('template');
9
9
  template.innerHTML = templateHTML;
10
10
  defineCustomElement('sinch-input', class extends NectaryElement {
@@ -73,13 +73,17 @@ defineCustomElement('sinch-input', class extends NectaryElement {
73
73
  this.#controller.abort();
74
74
  }
75
75
  static get observedAttributes() {
76
- return ['type', 'value', 'placeholder', 'invalid', 'disabled', 'size', 'data-size'];
76
+ return ['type', 'value', 'placeholder', 'invalid', 'disabled', 'size', 'autocomplete', 'data-size'];
77
77
  }
78
78
  attributeChangedCallback(name, _, newVal) {
79
79
  switch (name) {
80
80
  case 'type':
81
81
  {
82
+ if ('production' !== 'production') {
83
+ assertType(newVal);
84
+ }
82
85
  updateLiteralAttribute(this.#$input, inputTypes, 'type', newVal);
86
+ updateAttribute(this.#$input, 'spellcheck', newVal === 'password' ? 'false' : null);
83
87
  break;
84
88
  }
85
89
  case 'value':
@@ -128,6 +132,10 @@ defineCustomElement('sinch-input', class extends NectaryElement {
128
132
  this.#onSizeUpdate();
129
133
  break;
130
134
  }
135
+ case 'autocomplete':
136
+ {
137
+ updateAttribute(this.#$input, 'autocomplete', newVal);
138
+ }
131
139
  }
132
140
  }
133
141
  get nodeName() {
@@ -169,6 +177,12 @@ defineCustomElement('sinch-input', class extends NectaryElement {
169
177
  get size() {
170
178
  return getLiteralAttribute(this, sizeValues, 'size', DEFAULT_SIZE);
171
179
  }
180
+ set autocomplete(value) {
181
+ updateAttribute(this, 'autocomplete', value);
182
+ }
183
+ get autocomplete() {
184
+ return getAttribute(this, 'autocomplete', '');
185
+ }
172
186
  get selectionStart() {
173
187
  return this.#$input.selectionStart;
174
188
  }
package/input/types.d.ts CHANGED
@@ -1,14 +1,16 @@
1
1
  import type { TRect, TSinchElementReact } from '../types';
2
2
  import type { TSinchSize } from '../utils/size';
3
3
  import type { SyntheticEvent } from 'react';
4
- export declare type TSinchInputType = 'text' | 'password';
5
- export declare type TSinchInputElement = HTMLElement & {
4
+ export type TSinchInputType = 'text' | 'password';
5
+ export type TSinchInputElement = HTMLElement & {
6
6
  /** Text field type, `text` by default */
7
7
  type: TSinchInputType;
8
8
  /** Value */
9
9
  value: string;
10
10
  /** Text that appears in the text field when it has no value set */
11
11
  placeholder: string | null;
12
+ /** The HTML autocomplete attribute */
13
+ autocomplete: string;
12
14
  /** Invalid state */
13
15
  invalid: boolean;
14
16
  /** Disabled */
@@ -31,6 +33,8 @@ export declare type TSinchInputElement = HTMLElement & {
31
33
  setAttribute(name: 'value', value: string): void;
32
34
  /** Text that appears in the text field when it has no value set */
33
35
  setAttribute(name: 'placeholder', value: string): void;
36
+ /** The HTML autocomplete attribute */
37
+ setAttribute(name: 'autocomplete', value: string): void;
34
38
  /** Invalid state */
35
39
  setAttribute(name: 'invalid', value: ''): void;
36
40
  /** Disabled */
@@ -38,13 +42,15 @@ export declare type TSinchInputElement = HTMLElement & {
38
42
  /** Size, `m` by default */
39
43
  setAttribute(name: 'size', value: TSinchSize): void;
40
44
  };
41
- export declare type TSinchInputReact = TSinchElementReact<TSinchInputElement> & {
45
+ export type TSinchInputReact = TSinchElementReact<TSinchInputElement> & {
42
46
  /** Controlled value, doesn't change on its own and requres an onChange-value state loop */
43
47
  value: string;
44
48
  /** Label that is used for a11y – might be different from `label` */
45
49
  'aria-label': string;
46
50
  /** Text field type, `text` by default */
47
51
  type?: TSinchInputType;
52
+ /** The HTML autocomplete attribute */
53
+ autocomplete?: string;
48
54
  /** Text that appears in the text field when it has no value set */
49
55
  placeholder?: string;
50
56
  /** Invalid state */
package/input/utils.d.ts CHANGED
@@ -1,2 +1,5 @@
1
1
  import type { TSinchInputType } from './types';
2
2
  export declare const inputTypes: readonly TSinchInputType[];
3
+ type TAssertType = (value: string | null) => asserts value is TSinchInputType | null;
4
+ export declare const assertType: TAssertType;
5
+ export {};
package/input/utils.js CHANGED
@@ -1 +1,6 @@
1
- export const inputTypes = ['text', 'password'];
1
+ export const inputTypes = ['text', 'password'];
2
+ export const assertType = value => {
3
+ if (value !== null && !inputTypes.includes(value)) {
4
+ throw new Error(`sinch-input: invalid type attribute: ${value}`);
5
+ }
6
+ };
package/link/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchLinkElement = HTMLElement & {
2
+ export type TSinchLinkElement = HTMLElement & {
3
3
  /** Text content of hyperlink */
4
4
  text: string;
5
5
  /** URL that hyperlink point to */
@@ -31,7 +31,7 @@ export declare type TSinchLinkElement = HTMLElement & {
31
31
  /** Prevents default behaviour on hyperlink click */
32
32
  setAttribute(name: 'preventdefault', value: ''): void;
33
33
  };
34
- export declare type TSinchLinkReact = TSinchElementReact<TSinchLinkElement> & {
34
+ export type TSinchLinkReact = TSinchElementReact<TSinchLinkElement> & {
35
35
  /** Text content of hyperlink */
36
36
  text: string;
37
37
  /** URL that hyperlink point to */
package/list/types.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchListElement = HTMLElement;
3
- export declare type TSinchListReact = TSinchElementReact<TSinchListElement>;
2
+ export type TSinchListElement = HTMLElement;
3
+ export type TSinchListReact = TSinchElementReact<TSinchListElement>;
@@ -1,3 +1,3 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchListItemElement = HTMLElement;
3
- export declare type TSinchListItemReact = TSinchElementReact<TSinchListItemElement>;
2
+ export type TSinchListItemElement = HTMLElement;
3
+ export type TSinchListItemReact = TSinchElementReact<TSinchListItemElement>;
package/logo/types.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- export declare type TSinchLogoElement = HTMLElement & {
2
+ export type TSinchLogoElement = HTMLElement & {
3
3
  size: number;
4
4
  inverted: boolean;
5
5
  setAttribute(name: 'size', value: string): void;
6
6
  setAttribute(name: 'inverted', value: ''): void;
7
7
  };
8
- export declare type TSinchLogoReact = TSinchElementReact<TSinchLogoElement> & {
8
+ export type TSinchLogoReact = TSinchElementReact<TSinchLogoElement> & {
9
9
  size?: number;
10
10
  inverted?: boolean;
11
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "0.48.1",
3
+ "version": "0.49.0",
4
4
  "files": [
5
5
  "**/*/*.css",
6
6
  "**/*/*.json",
@@ -13,18 +13,19 @@
13
13
  "build": "NODE_ENV=production babel . --extensions '.ts' --out-dir . && tsc --declaration --emitDeclarationOnly"
14
14
  },
15
15
  "dependencies": {
16
- "@babel/runtime": "^7.19.0"
16
+ "@babel/runtime": "^7.20.13",
17
+ "xss": "^1.0.14"
17
18
  },
18
19
  "devDependencies": {
19
- "@babel/cli": "^7.19.3",
20
- "@babel/core": "^7.19.3",
21
- "@babel/plugin-transform-runtime": "^7.19.1",
22
- "@babel/preset-env": "^7.19.3",
20
+ "@babel/cli": "^7.20.7",
21
+ "@babel/core": "^7.20.12",
22
+ "@babel/plugin-transform-runtime": "^7.19.6",
23
+ "@babel/preset-env": "^7.20.2",
23
24
  "@babel/preset-typescript": "^7.18.6",
24
- "@types/node": "^17.0.45",
25
- "@types/react": "^17.0.50",
25
+ "@types/node": "^18.11.18",
26
+ "@types/react": "^18.0.27",
26
27
  "babel-plugin-html-inline-minifier": "workspace:^0.0.0",
27
28
  "babel-plugin-transform-inline-environment-variables": "^0.4.4",
28
- "typescript": "^4.8.4"
29
+ "typescript": "^4.9.4"
29
30
  }
30
31
  }