@nectary/components 4.8.2 → 4.9.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 (178) hide show
  1. package/accordion/index.d.ts +8 -4
  2. package/accordion/types.d.ts +11 -16
  3. package/accordion-item/index.d.ts +8 -4
  4. package/accordion-item/types.d.ts +30 -47
  5. package/action-menu/index.d.ts +8 -4
  6. package/action-menu/types.d.ts +7 -8
  7. package/action-menu-option/index.d.ts +8 -4
  8. package/action-menu-option/types.d.ts +28 -32
  9. package/action-menu-option/utils.d.ts +1 -2
  10. package/alert/index.d.ts +8 -4
  11. package/alert/types.d.ts +22 -27
  12. package/avatar/index.d.ts +8 -4
  13. package/avatar/types.d.ts +25 -42
  14. package/badge/index.d.ts +8 -4
  15. package/badge/types.d.ts +18 -32
  16. package/button/index.d.ts +8 -4
  17. package/button/types.d.ts +140 -160
  18. package/button-group/index.d.ts +8 -4
  19. package/button-group/types.d.ts +10 -9
  20. package/button-group-item/index.d.ts +8 -4
  21. package/button-group-item/types.d.ts +42 -42
  22. package/card/index.d.ts +8 -4
  23. package/card/types.d.ts +8 -19
  24. package/card-container/index.d.ts +7 -4
  25. package/card-container/types.d.ts +2 -2
  26. package/card-v2/index.d.ts +8 -4
  27. package/card-v2/types.d.ts +41 -53
  28. package/card-v2-title/index.d.ts +8 -4
  29. package/card-v2-title/types.d.ts +21 -33
  30. package/checkbox/index.d.ts +8 -4
  31. package/checkbox/types.d.ts +45 -65
  32. package/chip/index.d.ts +8 -4
  33. package/chip/types.d.ts +30 -44
  34. package/code-tag/index.d.ts +8 -4
  35. package/code-tag/types.d.ts +15 -16
  36. package/color-menu/index.d.ts +8 -4
  37. package/color-menu/types.d.ts +15 -22
  38. package/color-menu-option/index.d.ts +8 -4
  39. package/color-menu-option/types.d.ts +14 -15
  40. package/color-swatch/index.d.ts +8 -4
  41. package/color-swatch/types.d.ts +15 -16
  42. package/date-picker/index.d.ts +8 -4
  43. package/date-picker/types.d.ts +50 -79
  44. package/dialog/index.d.ts +8 -4
  45. package/dialog/types.d.ts +30 -34
  46. package/emoji/index.d.ts +8 -4
  47. package/emoji/types.d.ts +11 -12
  48. package/emoji-picker/index.d.ts +8 -4
  49. package/emoji-picker/types.d.ts +25 -18
  50. package/field/index.d.ts +8 -4
  51. package/field/types.d.ts +21 -38
  52. package/file-drop/index.d.ts +8 -4
  53. package/file-drop/types.d.ts +33 -55
  54. package/file-picker/index.d.ts +8 -4
  55. package/file-picker/types.d.ts +12 -22
  56. package/file-status/index.d.ts +8 -4
  57. package/file-status/types.d.ts +27 -32
  58. package/flag/index.d.ts +8 -4
  59. package/flag/types.d.ts +10 -11
  60. package/grid/index.d.ts +8 -4
  61. package/grid/types.d.ts +19 -17
  62. package/grid-item/index.d.ts +8 -4
  63. package/grid-item/types.d.ts +7 -12
  64. package/help-tooltip/index.d.ts +8 -4
  65. package/help-tooltip/types.d.ts +11 -6
  66. package/horizontal-stepper/index.d.ts +8 -4
  67. package/horizontal-stepper/types.d.ts +37 -38
  68. package/horizontal-stepper-item/index.d.ts +8 -4
  69. package/horizontal-stepper-item/types.d.ts +30 -39
  70. package/icon/index.d.ts +8 -4
  71. package/icon/types.d.ts +18 -28
  72. package/inline-alert/index.d.ts +8 -4
  73. package/inline-alert/types.d.ts +30 -33
  74. package/input/index.d.ts +8 -4
  75. package/input/types.d.ts +54 -89
  76. package/link/index.d.ts +8 -4
  77. package/link/types.d.ts +31 -57
  78. package/list/index.d.ts +7 -4
  79. package/list/types.d.ts +2 -2
  80. package/list-item/index.d.ts +8 -4
  81. package/list-item/types.d.ts +10 -8
  82. package/package.json +3 -3
  83. package/pagination/index.d.ts +8 -4
  84. package/pagination/types.d.ts +31 -27
  85. package/persistent-overlay/index.d.ts +8 -4
  86. package/persistent-overlay/types.d.ts +19 -21
  87. package/pop/index.d.ts +8 -4
  88. package/pop/types.d.ts +13 -23
  89. package/popover/index.d.ts +8 -4
  90. package/popover/types.d.ts +20 -32
  91. package/progress/index.d.ts +8 -4
  92. package/progress/types.d.ts +13 -14
  93. package/progress-stepper/index.d.ts +8 -4
  94. package/progress-stepper/types.d.ts +10 -15
  95. package/progress-stepper-item/index.d.ts +8 -4
  96. package/progress-stepper-item/types.d.ts +35 -44
  97. package/radio/index.d.ts +8 -4
  98. package/radio/types.d.ts +16 -15
  99. package/radio-option/index.d.ts +8 -4
  100. package/radio-option/types.d.ts +35 -40
  101. package/rich-text/index.d.ts +8 -4
  102. package/rich-text/types.d.ts +31 -31
  103. package/rich-text/utils.js +1 -1
  104. package/rich-textarea/index.d.ts +8 -4
  105. package/rich-textarea/types.d.ts +37 -43
  106. package/segment/index.d.ts +8 -4
  107. package/segment/types.d.ts +18 -21
  108. package/segment-collapse/index.d.ts +8 -4
  109. package/segment-collapse/types.d.ts +15 -12
  110. package/segmented-control/index.d.ts +8 -4
  111. package/segmented-control/types.d.ts +11 -8
  112. package/segmented-control-option/index.d.ts +8 -4
  113. package/segmented-control-option/types.d.ts +32 -34
  114. package/segmented-icon-control/index.d.ts +8 -4
  115. package/segmented-icon-control/types.d.ts +11 -10
  116. package/segmented-icon-control-option/index.d.ts +8 -4
  117. package/segmented-icon-control-option/types.d.ts +28 -28
  118. package/select-button/index.d.ts +12 -4
  119. package/select-button/types.d.ts +38 -58
  120. package/select-menu/index.d.ts +8 -4
  121. package/select-menu/index.js +1 -1
  122. package/select-menu/types.d.ts +19 -38
  123. package/select-menu-option/index.d.ts +8 -4
  124. package/select-menu-option/types.d.ts +27 -33
  125. package/select-menu-option/utils.d.ts +2 -2
  126. package/skeleton/index.d.ts +8 -4
  127. package/skeleton/types.d.ts +14 -13
  128. package/skeleton-item/index.d.ts +8 -4
  129. package/skeleton-item/types.d.ts +20 -19
  130. package/spinner/index.d.ts +8 -4
  131. package/spinner/types.d.ts +12 -13
  132. package/table/index.d.ts +7 -4
  133. package/table/types.d.ts +2 -2
  134. package/table-body/index.d.ts +7 -4
  135. package/table-body/types.d.ts +2 -2
  136. package/table-cell/index.d.ts +8 -4
  137. package/table-cell/types.d.ts +11 -10
  138. package/table-head/index.d.ts +7 -4
  139. package/table-head/types.d.ts +2 -2
  140. package/table-head-cell/index.d.ts +8 -4
  141. package/table-head-cell/types.d.ts +15 -18
  142. package/table-row/index.d.ts +8 -4
  143. package/table-row/types.d.ts +14 -15
  144. package/tabs/index.d.ts +8 -4
  145. package/tabs/types.d.ts +19 -16
  146. package/tabs-icon-option/index.d.ts +8 -4
  147. package/tabs-icon-option/types.d.ts +21 -26
  148. package/tabs-option/index.d.ts +8 -4
  149. package/tabs-option/types.d.ts +26 -35
  150. package/tag/index.d.ts +8 -4
  151. package/tag/types.d.ts +22 -35
  152. package/text/index.d.ts +8 -4
  153. package/text/types.d.ts +21 -34
  154. package/textarea/index.d.ts +8 -4
  155. package/textarea/types.d.ts +30 -56
  156. package/tile-control/index.d.ts +8 -4
  157. package/tile-control/types.d.ts +15 -27
  158. package/tile-control-option/index.d.ts +8 -4
  159. package/tile-control-option/types.d.ts +41 -55
  160. package/time-picker/index.d.ts +8 -4
  161. package/time-picker/types.d.ts +42 -47
  162. package/title/index.d.ts +8 -4
  163. package/title/types.d.ts +18 -31
  164. package/toast/index.d.ts +8 -4
  165. package/toast/types.d.ts +31 -39
  166. package/toast-manager/index.d.ts +8 -4
  167. package/toast-manager/types.d.ts +13 -10
  168. package/toggle/index.d.ts +8 -4
  169. package/toggle/types.d.ts +29 -34
  170. package/tooltip/index.d.ts +8 -4
  171. package/tooltip/types.d.ts +25 -39
  172. package/types.d.ts +20 -6
  173. package/utils/adapters.d.ts +30 -0
  174. package/utils/adapters.js +1 -0
  175. package/vertical-stepper/index.d.ts +8 -4
  176. package/vertical-stepper/types.d.ts +29 -30
  177. package/vertical-stepper-item/index.d.ts +8 -4
  178. package/vertical-stepper-item/types.d.ts +34 -43
@@ -1,26 +1,5 @@
1
- import type { TRect, TSinchElementReact } from '../types';
2
- export type TSinchTimePickerElement = HTMLElement & {
3
- /** Time value in ISO 8601 format */
4
- value: string;
5
- /** AM/PM 12-hour clock system, `false` by default */
6
- ampm: boolean;
7
- /** Submit button label that is used for a11y */
8
- submitAriaLabel: string;
9
- readonly submitButtonRect: TRect;
10
- readonly amButtonRect: TRect | null;
11
- readonly pmButtonRect: TRect | null;
12
- hourDigitRect(hour: number): TRect | null;
13
- minuteDigitRect(minute: number): TRect | null;
14
- /** Change value handler, return time in ISO 8601 format */
15
- addEventListener(type: '-change', listener: (e: CustomEvent<string>) => void): void;
16
- /** Time value in ISO 8601 format */
17
- setAttribute(name: 'value', value: string): void;
18
- /** AM/PM 12-hour clock system, `false` by default */
19
- setAttribute(name: 'ampm', value: boolean): void;
20
- /** Submit button label that is used for a11y */
21
- setAttribute(name: 'submit-aria-label', value: string): void;
22
- };
23
- export type TSinchTimePickerReact = TSinchElementReact<TSinchTimePickerElement> & {
1
+ import type { NectaryComponentReactByType, NectaryComponentVanillaByType, TRect } from '../types';
2
+ export type TSinchTimePickerProps = {
24
3
  /** Time value in ISO 8601 format */
25
4
  value: string;
26
5
  /** AM/PM 12-hour clock system, `false` by default */
@@ -29,29 +8,45 @@ export type TSinchTimePickerReact = TSinchElementReact<TSinchTimePickerElement>
29
8
  'aria-label': string;
30
9
  /** Submit button label that is used for a11y */
31
10
  'submit-aria-label': string;
11
+ readonly submitButtonRect?: TRect;
12
+ readonly amButtonRect?: TRect | null;
13
+ readonly pmButtonRect?: TRect | null;
14
+ };
15
+ export type TSinchTimePickerMethods = {
16
+ hourDigitRect(hour: number): TRect | null;
17
+ minuteDigitRect(minute: number): TRect | null;
18
+ };
19
+ export type TSinchTimePickerEvents = {
32
20
  /** Change value handler, return time in ISO 8601 format */
33
- 'on-change'?: (e: CustomEvent<string>) => void;
34
- } & {
35
- style?: {
36
- '--sinch-comp-time-picker-header-font'?: string;
37
- '--sinch-comp-time-picker-digit-font-default-h12'?: string;
38
- '--sinch-comp-time-picker-digit-font-checked-h12'?: string;
39
- '--sinch-comp-time-picker-digit-font-default-h24'?: string;
40
- '--sinch-comp-time-picker-digit-font-checked-h24'?: string;
41
- '--sinch-comp-time-picker-digit-font-default-minutes'?: string;
42
- '--sinch-comp-time-picker-digit-font-checked-minutes'?: string;
43
- '--sinch-comp-time-picker-header-color-default-text-initial'?: string;
44
- '--sinch-comp-time-picker-header-color-default-icon-initial'?: string;
45
- '--sinch-comp-time-picker-watch-face-color-default-border-initial'?: string;
46
- '--sinch-comp-time-picker-watch-face-color-default-background-initial'?: string;
47
- '--sinch-comp-time-picker-digit-color-default-h12-initial'?: string;
48
- '--sinch-comp-time-picker-digit-color-checked-h12-default'?: string;
49
- '--sinch-comp-time-picker-digit-color-default-h24-initial'?: string;
50
- '--sinch-comp-time-picker-digit-color-checked-h24-initial'?: string;
51
- '--sinch-comp-time-picker-digit-color-default-minute-initial'?: string;
52
- '--sinch-comp-time-picker-digit-color-checked-minute-initial'?: string;
53
- '--sinch-comp-time-picker-needle-color-default-background-initial'?: string;
54
- '--sinch-comp-time-picker-needle-color-default-background-focus'?: string;
55
- '--sinch-global-color-icon'?: string;
56
- };
21
+ '-change'?: (e: CustomEvent<string>) => void;
22
+ };
23
+ export type TSinchTimePickerStyle = {
24
+ '--sinch-comp-time-picker-header-font'?: string;
25
+ '--sinch-comp-time-picker-digit-font-default-h12'?: string;
26
+ '--sinch-comp-time-picker-digit-font-checked-h12'?: string;
27
+ '--sinch-comp-time-picker-digit-font-default-h24'?: string;
28
+ '--sinch-comp-time-picker-digit-font-checked-h24'?: string;
29
+ '--sinch-comp-time-picker-digit-font-default-minutes'?: string;
30
+ '--sinch-comp-time-picker-digit-font-checked-minutes'?: string;
31
+ '--sinch-comp-time-picker-header-color-default-text-initial'?: string;
32
+ '--sinch-comp-time-picker-header-color-default-icon-initial'?: string;
33
+ '--sinch-comp-time-picker-watch-face-color-default-border-initial'?: string;
34
+ '--sinch-comp-time-picker-watch-face-color-default-background-initial'?: string;
35
+ '--sinch-comp-time-picker-digit-color-default-h12-initial'?: string;
36
+ '--sinch-comp-time-picker-digit-color-checked-h12-default'?: string;
37
+ '--sinch-comp-time-picker-digit-color-default-h24-initial'?: string;
38
+ '--sinch-comp-time-picker-digit-color-checked-h24-initial'?: string;
39
+ '--sinch-comp-time-picker-digit-color-default-minute-initial'?: string;
40
+ '--sinch-comp-time-picker-digit-color-checked-minute-initial'?: string;
41
+ '--sinch-comp-time-picker-needle-color-default-background-initial'?: string;
42
+ '--sinch-comp-time-picker-needle-color-default-background-focus'?: string;
43
+ '--sinch-global-color-icon'?: string;
44
+ };
45
+ export type TSinchTimePicker = {
46
+ props: TSinchTimePickerProps;
47
+ methods: TSinchTimePickerMethods;
48
+ events: TSinchTimePickerEvents;
49
+ style: TSinchTimePickerStyle;
57
50
  };
51
+ export type TSinchTimePickerElement = NectaryComponentVanillaByType<TSinchTimePicker>;
52
+ export type TSinchTimePickerReact = NectaryComponentReactByType<TSinchTimePicker>;
package/title/index.d.ts CHANGED
@@ -1,18 +1,22 @@
1
- import type { TSinchTitleElement, TSinchTitleReact } from './types';
1
+ import type { TSinchTitle } from './types';
2
+ import type { NectaryComponentReact, NectaryComponentVanilla } from '../types';
2
3
  declare global {
4
+ interface NectaryComponentMap {
5
+ 'sinch-title': TSinchTitle;
6
+ }
3
7
  interface HTMLElementTagNameMap {
4
- 'sinch-title': TSinchTitleElement;
8
+ 'sinch-title': NectaryComponentVanilla<'sinch-title'>;
5
9
  }
6
10
  namespace JSX {
7
11
  interface IntrinsicElements {
8
- 'sinch-title': TSinchTitleReact;
12
+ 'sinch-title': NectaryComponentReact<'sinch-title'>;
9
13
  }
10
14
  }
11
15
  }
12
16
  declare module 'react' {
13
17
  namespace JSX {
14
18
  interface IntrinsicElements {
15
- 'sinch-title': TSinchTitleReact;
19
+ 'sinch-title': NectaryComponentReact<'sinch-title'>;
16
20
  }
17
21
  }
18
22
  }
package/title/types.d.ts CHANGED
@@ -1,25 +1,7 @@
1
- import type { TSinchElementReact } from '../types';
1
+ import type { NectaryComponentReactByType, NectaryComponentVanillaByType } from '../types';
2
2
  export type TSinchTitleType = 'xl' | 'l' | 'm' | 's' | 'xs';
3
3
  export type TSinchTitleLevel = '1' | '2' | '3' | '4' | '5' | '6';
4
- export type TSinchTitleElement = HTMLElement & {
5
- /** Text */
6
- text: string;
7
- /** Type */
8
- type: TSinchTitleType;
9
- /** Semantical level */
10
- level: TSinchTitleLevel;
11
- /** Cuts the long title with “…” ellipsis */
12
- ellipsis: boolean;
13
- /** Text */
14
- setAttribute(name: 'text', value: string): void;
15
- /** Type */
16
- setAttribute(name: 'type', value: TSinchTitleType): void;
17
- /** Semantical level */
18
- setAttribute(name: 'level', value: TSinchTitleLevel): void;
19
- /** Cuts the long title with “…” ellipsis */
20
- setAttribute(name: 'ellipsis', value: ''): void;
21
- };
22
- export type TSinchTitleReact = TSinchElementReact<TSinchTitleElement> & {
4
+ export type TSinchTitleProps = {
23
5
  /** Text */
24
6
  text: string;
25
7
  /** Type */
@@ -28,15 +10,20 @@ export type TSinchTitleReact = TSinchElementReact<TSinchTitleElement> & {
28
10
  level: TSinchTitleLevel;
29
11
  /** Cuts the long title with “…” ellipsis */
30
12
  ellipsis?: boolean;
31
- } & {
32
- style?: {
33
- '--sinch-comp-title-font'?: string;
34
- '--sinch-sys-font-desktop-title-xl'?: string;
35
- '--sinch-sys-font-desktop-title-l'?: string;
36
- '--sinch-sys-font-desktop-title-m'?: string;
37
- '--sinch-sys-font-desktop-title-s'?: string;
38
- '--sinch-sys-font-desktop-title-xs'?: string;
39
- '--sinch-global-color-text'?: string;
40
- '--sinch-sys-color-text-default'?: string;
41
- };
42
13
  };
14
+ export type TSinchTitleStyle = {
15
+ '--sinch-comp-title-font'?: string;
16
+ '--sinch-sys-font-desktop-title-xl'?: string;
17
+ '--sinch-sys-font-desktop-title-l'?: string;
18
+ '--sinch-sys-font-desktop-title-m'?: string;
19
+ '--sinch-sys-font-desktop-title-s'?: string;
20
+ '--sinch-sys-font-desktop-title-xs'?: string;
21
+ '--sinch-global-color-text'?: string;
22
+ '--sinch-sys-color-text-default'?: string;
23
+ };
24
+ export type TSinchTitle = {
25
+ props: TSinchTitleProps;
26
+ style: TSinchTitleStyle;
27
+ };
28
+ export type TSinchTitleElement = NectaryComponentVanillaByType<TSinchTitle>;
29
+ export type TSinchTitleReact = NectaryComponentReactByType<TSinchTitle>;
package/toast/index.d.ts CHANGED
@@ -1,20 +1,24 @@
1
1
  import '../icon';
2
2
  import '../rich-text';
3
- import type { TSinchToastElement, TSinchToastReact } from './types';
3
+ import type { TSinchToast } from './types';
4
+ import type { NectaryComponentReact, NectaryComponentVanilla } from '../types';
4
5
  declare global {
6
+ interface NectaryComponentMap {
7
+ 'sinch-toast': TSinchToast;
8
+ }
5
9
  interface HTMLElementTagNameMap {
6
- 'sinch-toast': TSinchToastElement;
10
+ 'sinch-toast': NectaryComponentVanilla<'sinch-toast'>;
7
11
  }
8
12
  namespace JSX {
9
13
  interface IntrinsicElements {
10
- 'sinch-toast': TSinchToastReact;
14
+ 'sinch-toast': NectaryComponentReact<'sinch-toast'>;
11
15
  }
12
16
  }
13
17
  }
14
18
  declare module 'react' {
15
19
  namespace JSX {
16
20
  interface IntrinsicElements {
17
- 'sinch-toast': TSinchToastReact;
21
+ 'sinch-toast': NectaryComponentReact<'sinch-toast'>;
18
22
  }
19
23
  }
20
24
  }
package/toast/types.d.ts CHANGED
@@ -1,48 +1,40 @@
1
- import type { TSinchElementReact } from '../types';
1
+ import type { NectaryComponentReactByType, NectaryComponentVanillaByType } from '../types';
2
2
  export type TSinchToastType = 'info' | 'warn' | 'error' | 'success';
3
- export type TSinchToastElement = HTMLElement & {
4
- /** Type */
5
- type: TSinchToastType;
6
- /** Text */
7
- text: string;
8
- /** Persistent, i.e. doesn't automatically dissapear after 5s */
9
- persistent: boolean;
10
- /** Timeout event */
11
- addEventListener(type: '-timeout', listener: (e: CustomEvent<void>) => void): void;
12
- /** Type */
13
- setAttribute(name: 'type', value: TSinchToastType): void;
14
- /** Text */
15
- setAttribute(name: 'text', value: string): void;
16
- /** Persistent, i.e. doesn't automatically dissapear after 5s */
17
- setAttribute(name: 'persistent', value: ''): void;
18
- };
19
- export type TSinchToastReact = TSinchElementReact<TSinchToastElement> & {
3
+ export type TSinchToastProps = {
20
4
  /** Type */
21
5
  type: TSinchToastType;
22
6
  /** Text */
23
7
  text: string;
24
8
  /** Persistent, i.e. doesn't automatically dissapear after 5s */
25
9
  persistent?: boolean;
10
+ };
11
+ export type TSinchToastEvents = {
26
12
  /** Timeout handler */
27
- 'on-timeout'?: (e: CustomEvent<void>) => void;
28
- } & {
29
- style?: {
30
- '--sinch-comp-toast-shape-radius'?: string;
31
- '--sinch-comp-toast-font-body'?: string;
32
- '--sinch-comp-toast-shadow'?: string;
33
- '--sinch-comp-toast-color-success-default-background'?: string;
34
- '--sinch-comp-toast-color-success-default-text'?: string;
35
- '--sinch-comp-toast-color-success-default-icon'?: string;
36
- '--sinch-comp-toast-color-warning-default-background'?: string;
37
- '--sinch-comp-toast-color-warning-default-text'?: string;
38
- '--sinch-comp-toast-color-warning-default-icon'?: string;
39
- '--sinch-comp-toast-color-error-default-background'?: string;
40
- '--sinch-comp-toast-color-error-default-text'?: string;
41
- '--sinch-comp-toast-color-error-default-icon'?: string;
42
- '--sinch-comp-toast-color-info-default-background'?: string;
43
- '--sinch-comp-toast-color-info-default-text'?: string;
44
- '--sinch-comp-toast-color-info-default-icon'?: string;
45
- '--sinch-global-color-text'?: string;
46
- '--sinch-global-color-icon'?: string;
47
- };
13
+ '-timeout'?: (e: CustomEvent<void>) => void;
14
+ };
15
+ export type TSinchToastStyle = {
16
+ '--sinch-comp-toast-shape-radius'?: string;
17
+ '--sinch-comp-toast-font-body'?: string;
18
+ '--sinch-comp-toast-shadow'?: string;
19
+ '--sinch-comp-toast-color-success-default-background'?: string;
20
+ '--sinch-comp-toast-color-success-default-text'?: string;
21
+ '--sinch-comp-toast-color-success-default-icon'?: string;
22
+ '--sinch-comp-toast-color-warning-default-background'?: string;
23
+ '--sinch-comp-toast-color-warning-default-text'?: string;
24
+ '--sinch-comp-toast-color-warning-default-icon'?: string;
25
+ '--sinch-comp-toast-color-error-default-background'?: string;
26
+ '--sinch-comp-toast-color-error-default-text'?: string;
27
+ '--sinch-comp-toast-color-error-default-icon'?: string;
28
+ '--sinch-comp-toast-color-info-default-background'?: string;
29
+ '--sinch-comp-toast-color-info-default-text'?: string;
30
+ '--sinch-comp-toast-color-info-default-icon'?: string;
31
+ '--sinch-global-color-text'?: string;
32
+ '--sinch-global-color-icon'?: string;
33
+ };
34
+ export type TSinchToast = {
35
+ props: TSinchToastProps;
36
+ events: TSinchToastEvents;
37
+ style: TSinchToastStyle;
48
38
  };
39
+ export type TSinchToastElement = NectaryComponentVanillaByType<TSinchToast>;
40
+ export type TSinchToastReact = NectaryComponentReactByType<TSinchToast>;
@@ -1,20 +1,24 @@
1
1
  import '../title';
2
2
  import '../text';
3
- import type { TSinchToastManagerElement, TSinchToastManagerReact } from './types';
3
+ import type { TSinchToastManager } from './types';
4
+ import type { NectaryComponentReact, NectaryComponentVanilla } from '../types';
4
5
  declare global {
6
+ interface NectaryComponentMap {
7
+ 'sinch-toast-manager': TSinchToastManager;
8
+ }
5
9
  interface HTMLElementTagNameMap {
6
- 'sinch-toast-manager': TSinchToastManagerElement;
10
+ 'sinch-toast-manager': NectaryComponentVanilla<'sinch-toast-manager'>;
7
11
  }
8
12
  namespace JSX {
9
13
  interface IntrinsicElements {
10
- 'sinch-toast-manager': TSinchToastManagerReact;
14
+ 'sinch-toast-manager': NectaryComponentReact<'sinch-toast-manager'>;
11
15
  }
12
16
  }
13
17
  }
14
18
  declare module 'react' {
15
19
  namespace JSX {
16
20
  interface IntrinsicElements {
17
- 'sinch-toast-manager': TSinchToastManagerReact;
21
+ 'sinch-toast-manager': NectaryComponentReact<'sinch-toast-manager'>;
18
22
  }
19
23
  }
20
24
  }
@@ -1,13 +1,16 @@
1
- import type { TRect, TSinchElementReact } from '../types';
1
+ import type { NectaryComponentReactByType, NectaryComponentVanillaByType, TRect } from '../types';
2
2
  export type TSinchToastManagerOrigin = 'top-right' | 'bottom-right';
3
- export type TSinchToastManagerElement = HTMLElement & {
4
- readonly containerRect: TRect;
5
- nthActionRect: (nth: number) => TRect | null;
6
- nthCloseRect: (nth: number) => TRect | null;
7
- origin: TSinchToastManagerOrigin;
8
- /** Origin */
9
- setAttribute(name: 'origin', value: TSinchToastManagerOrigin): void;
10
- };
11
- export type TSinchToastManagerReact = TSinchElementReact<TSinchToastManagerElement> & {
3
+ export type TSinchToastManagerProps = {
12
4
  origin?: TSinchToastManagerOrigin;
5
+ readonly containerRect?: TRect;
6
+ };
7
+ export type TSinchToastManagerMethods = {
8
+ nthActionRect(nth: number): TRect | null;
9
+ nthCloseRect(nth: number): TRect | null;
10
+ };
11
+ export type TSinchToastManager = {
12
+ props: TSinchToastManagerProps;
13
+ methods: TSinchToastManagerMethods;
13
14
  };
15
+ export type TSinchToastManagerElement = NectaryComponentVanillaByType<TSinchToastManager>;
16
+ export type TSinchToastManagerReact = NectaryComponentReactByType<TSinchToastManager>;
package/toggle/index.d.ts CHANGED
@@ -1,18 +1,22 @@
1
- import type { TSinchToggleElement, TSinchToggleReact } from './types';
1
+ import type { TSinchToggle } from './types';
2
+ import type { NectaryComponentReact, NectaryComponentVanilla } from '../types';
2
3
  declare global {
4
+ interface NectaryComponentMap {
5
+ 'sinch-toggle': TSinchToggle;
6
+ }
3
7
  interface HTMLElementTagNameMap {
4
- 'sinch-toggle': TSinchToggleElement;
8
+ 'sinch-toggle': NectaryComponentVanilla<'sinch-toggle'>;
5
9
  }
6
10
  namespace JSX {
7
11
  interface IntrinsicElements {
8
- 'sinch-toggle': TSinchToggleReact;
12
+ 'sinch-toggle': NectaryComponentReact<'sinch-toggle'>;
9
13
  }
10
14
  }
11
15
  }
12
16
  declare module 'react' {
13
17
  namespace JSX {
14
18
  interface IntrinsicElements {
15
- 'sinch-toggle': TSinchToggleReact;
19
+ 'sinch-toggle': NectaryComponentReact<'sinch-toggle'>;
16
20
  }
17
21
  }
18
22
  }
package/toggle/types.d.ts CHANGED
@@ -1,41 +1,36 @@
1
- import type { TSinchElementReact } from '../types';
2
- export type TSinchToggleElement = HTMLElement & {
3
- checked: boolean;
4
- small: boolean;
5
- labeled: boolean;
6
- disabled: boolean;
7
- text: string | null;
8
- addEventListener(type: '-change', listener: (e: CustomEvent<boolean>) => void): void;
9
- setAttribute(name: 'checked', value: ''): void;
10
- setAttribute(name: 'small', value: ''): void;
11
- setAttribute(name: 'labeled', value: ''): void;
12
- setAttribute(name: 'disabled', value: ''): void;
13
- setAttribute(name: 'text', value: string): void;
14
- };
15
- export type TSinchToggleReact = TSinchElementReact<TSinchToggleElement> & {
1
+ import type { NectaryComponentReactByType, NectaryComponentVanillaByType } from '../types';
2
+ export type TSinchToggleProps = {
16
3
  checked?: boolean;
17
4
  small?: boolean;
18
5
  labeled?: boolean;
19
6
  disabled?: boolean;
20
7
  text?: string;
21
8
  'aria-label': string;
22
- 'on-change'?: (e: CustomEvent<boolean>) => void;
23
- } & {
24
- style?: {
25
- '--sinch-local-size'?: string;
26
- '--sinch-comp-toggle-color-default-background-initial'?: string;
27
- '--sinch-comp-toggle-color-default-knob-background-initial'?: string;
28
- '--sinch-comp-toggle-color-default-text-inside-initial'?: string;
29
- '--sinch-comp-toggle-color-default-outline-focus'?: string;
30
- '--sinch-comp-toggle-color-default-label-initial'?: string;
31
- '--sinch-comp-toggle-color-checked-background-initial'?: string;
32
- '--sinch-comp-toggle-color-disabled-background-initial'?: string;
33
- '--sinch-comp-toggle-color-disabled-label-initial'?: string;
34
- '--sinch-comp-toggle-color-checked-disabled-background-initial'?: string;
35
- '--sinch-comp-toggle-shadow-knob-default'?: string;
36
- '--sinch-comp-toggle-shadow-knob-disabled'?: string;
37
- '--sinch-comp-toggle-font-size-m-inside-text'?: string;
38
- '--sinch-comp-toggle-font-size-m-label'?: string;
39
- '--sinch-comp-toggle-font-size-s-label'?: string;
40
- };
41
9
  };
10
+ export type TSinchToggleEvents = {
11
+ '-change'?: (e: CustomEvent<boolean>) => void;
12
+ };
13
+ export type TSinchToggleStyle = {
14
+ '--sinch-local-size'?: string;
15
+ '--sinch-comp-toggle-color-default-background-initial'?: string;
16
+ '--sinch-comp-toggle-color-default-knob-background-initial'?: string;
17
+ '--sinch-comp-toggle-color-default-text-inside-initial'?: string;
18
+ '--sinch-comp-toggle-color-default-outline-focus'?: string;
19
+ '--sinch-comp-toggle-color-default-label-initial'?: string;
20
+ '--sinch-comp-toggle-color-checked-background-initial'?: string;
21
+ '--sinch-comp-toggle-color-disabled-background-initial'?: string;
22
+ '--sinch-comp-toggle-color-disabled-label-initial'?: string;
23
+ '--sinch-comp-toggle-color-checked-disabled-background-initial'?: string;
24
+ '--sinch-comp-toggle-shadow-knob-default'?: string;
25
+ '--sinch-comp-toggle-shadow-knob-disabled'?: string;
26
+ '--sinch-comp-toggle-font-size-m-inside-text'?: string;
27
+ '--sinch-comp-toggle-font-size-m-label'?: string;
28
+ '--sinch-comp-toggle-font-size-s-label'?: string;
29
+ };
30
+ export type TSinchToggle = {
31
+ props: TSinchToggleProps;
32
+ events: TSinchToggleEvents;
33
+ style: TSinchToggleStyle;
34
+ };
35
+ export type TSinchToggleElement = NectaryComponentVanillaByType<TSinchToggle>;
36
+ export type TSinchToggleReact = NectaryComponentReactByType<TSinchToggle>;
@@ -1,20 +1,24 @@
1
1
  import '../text';
2
2
  import '../pop';
3
- import type { TSinchTooltipElement, TSinchTooltipReact } from './types';
3
+ import type { TSinchTooltip } from './types';
4
+ import type { NectaryComponentReact, NectaryComponentVanilla } from '../types';
4
5
  declare global {
6
+ interface NectaryComponentMap {
7
+ 'sinch-tooltip': TSinchTooltip;
8
+ }
5
9
  interface HTMLElementTagNameMap {
6
- 'sinch-tooltip': TSinchTooltipElement;
10
+ 'sinch-tooltip': NectaryComponentVanilla<'sinch-tooltip'>;
7
11
  }
8
12
  namespace JSX {
9
13
  interface IntrinsicElements {
10
- 'sinch-tooltip': TSinchTooltipReact;
14
+ 'sinch-tooltip': NectaryComponentReact<'sinch-tooltip'>;
11
15
  }
12
16
  }
13
17
  }
14
18
  declare module 'react' {
15
19
  namespace JSX {
16
20
  interface IntrinsicElements {
17
- 'sinch-tooltip': TSinchTooltipReact;
21
+ 'sinch-tooltip': NectaryComponentReact<'sinch-tooltip'>;
18
22
  }
19
23
  }
20
24
  }
@@ -1,32 +1,8 @@
1
- import type { TRect, TSinchElementReact } from '../types';
1
+ import type { NectaryComponentReactByType, NectaryComponentVanillaByType, TRect } from '../types';
2
2
  export type TSinchTooltipOrientation = 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
3
3
  export type TSinchTooltipTextAlign = 'center' | 'right' | 'left';
4
4
  export type TSinchTooltipType = 'slow' | 'fast';
5
- export type TSinchTooltipElement = HTMLElement & {
6
- /** Text */
7
- text: string;
8
- /** Orientation, where it *points to* from origin */
9
- orientation: TSinchTooltipOrientation;
10
- /** Type */
11
- type: TSinchTooltipType;
12
- /** Text Align */
13
- 'text-align': TSinchTooltipTextAlign;
14
- readonly footprintRect: TRect;
15
- readonly tooltipRect: TRect;
16
- /** Show event */
17
- addEventListener(type: '-show', listener: (e: CustomEvent<void>) => void): void;
18
- /** Hide event */
19
- addEventListener(type: '-hide', listener: (e: CustomEvent<void>) => void): void;
20
- /** Text */
21
- setAttribute(name: 'text', value: string): void;
22
- /** Orientation, where it *points to* from origin */
23
- setAttribute(name: 'orientation', value: TSinchTooltipOrientation): void;
24
- /** Type */
25
- setAttribute(name: 'type', value: TSinchTooltipType): void;
26
- /** Text Align */
27
- setAttribute(name: 'text-align', value: TSinchTooltipTextAlign): void;
28
- };
29
- export type TSinchTooltipReact = TSinchElementReact<TSinchTooltipElement> & {
5
+ export type TSinchTooltipProps = {
30
6
  /** Text */
31
7
  text: string;
32
8
  /** Orientation, where it *points to* from origin */
@@ -35,19 +11,29 @@ export type TSinchTooltipReact = TSinchElementReact<TSinchTooltipElement> & {
35
11
  type?: TSinchTooltipType;
36
12
  /** Text Align */
37
13
  'text-align'?: TSinchTooltipTextAlign;
14
+ readonly footprintRect?: TRect;
15
+ readonly tooltipRect?: TRect;
16
+ };
17
+ export type TSinchTooltipEvents = {
38
18
  /** Show event handler */
39
- 'on-show'?: (e: CustomEvent<void>) => void;
19
+ '-show'?: (e: CustomEvent<void>) => void;
40
20
  /** Hide event handler */
41
- 'on-hide'?: (e: CustomEvent<void>) => void;
42
- } & {
43
- style?: {
44
- '--sinch-comp-tooltip-shadow'?: string;
45
- '--sinch-comp-tooltip-shape-radius'?: string;
46
- '--sinch-comp-tooltip-color-background'?: string;
47
- '--sinch-comp-tooltip-color-text'?: string;
48
- '--sinch-local-color-background'?: string;
49
- '--sinch-comp-tooltip-font-body'?: string;
50
- '--sinch-comp-text-align'?: string;
51
- '--sinch-global-color-text'?: string;
52
- };
21
+ '-hide'?: (e: CustomEvent<void>) => void;
22
+ };
23
+ export type TSinchTooltipStyle = {
24
+ '--sinch-comp-tooltip-shadow'?: string;
25
+ '--sinch-comp-tooltip-shape-radius'?: string;
26
+ '--sinch-comp-tooltip-color-background'?: string;
27
+ '--sinch-comp-tooltip-color-text'?: string;
28
+ '--sinch-local-color-background'?: string;
29
+ '--sinch-comp-tooltip-font-body'?: string;
30
+ '--sinch-comp-text-align'?: string;
31
+ '--sinch-global-color-text'?: string;
32
+ };
33
+ export type TSinchTooltip = {
34
+ props: TSinchTooltipProps;
35
+ events: TSinchTooltipEvents;
36
+ style: TSinchTooltipStyle;
53
37
  };
38
+ export type TSinchTooltipElement = NectaryComponentVanillaByType<TSinchTooltip>;
39
+ export type TSinchTooltipReact = NectaryComponentReactByType<TSinchTooltip>;
package/types.d.ts CHANGED
@@ -1,10 +1,5 @@
1
1
  import type { ClassAttributes, DOMAttributes, HTMLAttributes } from 'react'
2
-
3
- export type TSinchElementReact<TElement> =
4
- Pick<HTMLAttributes<HTMLElement>, 'id' | 'className' | 'style' | 'slot' | 'children'> &
5
- ClassAttributes<TElement> &
6
- Pick<DOMAttributes<TElement>, 'onClick' | 'onDoubleClick' | 'onMouseDown' | 'onMouseUp' | 'onMouseMove' | 'onMouseOver' | 'onMouseOut' | 'onFocus' | 'onBlur' | 'onKeyDown' | 'onKeyUp' | 'onKeyPress'> &
7
- { class?: string }
2
+ import type { ReactifyEvents, ReactifyElement, SafeSelect, CamelCaseify, RemoveReadonly, SetAttributes, ExtendEventListeners } from './utils/adapters'
8
3
 
9
4
  export type TRect = {
10
5
  x: number,
@@ -12,3 +7,22 @@ export type TRect = {
12
7
  width: number,
13
8
  height: number,
14
9
  }
10
+
11
+ export type NectaryComponentVanillaByType<T extends object> =
12
+ Omit<HTMLElement, 'addEventListener' | 'removeEventListener'> &
13
+ ExtendEventListeners<Required<SafeSelect<T, 'events'>>> &
14
+ SetAttributes<Required<RemoveReadonly<SafeSelect<T, 'props'>>>> &
15
+ Required<CamelCaseify<SafeSelect<T, 'props'>>> &
16
+ Required<SafeSelect<T, 'methods'>>
17
+
18
+ export type NectaryComponentReactByType<T extends object> =
19
+ ReactifyElement<HTMLElement> &
20
+ ReactifyEvents<SafeSelect<T, 'events'>> &
21
+ RemoveReadonly<SafeSelect<T, 'props'>> &
22
+ { style?: SafeSelect<T, 'style'> }
23
+
24
+ export type NectaryComponentVanilla<K extends keyof NectaryComponentMap> =
25
+ NectaryComponentVanillaByType<NectaryComponentMap[K]>
26
+
27
+ export type NectaryComponentReact<K extends keyof NectaryComponentMap> =
28
+ NectaryComponentReactByType<NectaryComponentMap[K]>
@@ -0,0 +1,30 @@
1
+ import type { ClassAttributes, DOMAttributes, HTMLAttributes } from 'react';
2
+ export type SafeSelect<T extends object, K extends string | number | symbol> = K extends keyof T ? T[K] extends object ? T[K] : {} : {};
3
+ type CamelCaseString<S extends string> = S extends `${infer P1}-${infer P2}${infer P3}` ? `${Lowercase<P1>}${Uppercase<P2>}${CamelCaseString<P3>}` : S;
4
+ export type CamelCaseify<T> = T extends object ? {
5
+ [K in keyof T as K extends string ? CamelCaseString<K> : K]: T[K];
6
+ } : T;
7
+ export type RemoveReadonly<T> = {
8
+ [P in keyof T as T[P] extends {
9
+ readonly [K: string]: any;
10
+ } ? never : P]: T[P];
11
+ };
12
+ type ExtractEventTypes<T> = {
13
+ [K in keyof T]: T[K] extends (e: infer E) => void ? E : T[K];
14
+ };
15
+ export type ExtendEventListeners<Events> = {
16
+ addEventListener<K extends keyof (ExtractEventTypes<Events> & HTMLElementEventMap)>(type: K, listener: (this: HTMLElement, ev: (ExtractEventTypes<Events> & HTMLElementEventMap)[K]) => any, options?: boolean | AddEventListenerOptions): void;
17
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
18
+ removeEventListener<K extends keyof (ExtractEventTypes<Events> & HTMLElementEventMap)>(type: K, listener: (this: HTMLElement, ev: (ExtractEventTypes<Events> & HTMLElementEventMap)[K]) => any, options?: boolean | EventListenerOptions): void;
19
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
20
+ };
21
+ export type SetAttributes<Props> = {
22
+ setAttribute<K extends keyof Props>(attr: K, value: Props[K] extends boolean ? '' : Props[K]): void;
23
+ };
24
+ export type ReactifyElement<TElement> = Pick<HTMLAttributes<HTMLElement>, 'id' | 'className' | 'style' | 'slot' | 'children'> & ClassAttributes<TElement> & Pick<DOMAttributes<TElement>, 'onClick' | 'onDoubleClick' | 'onMouseDown' | 'onMouseUp' | 'onMouseMove' | 'onMouseOver' | 'onMouseOut' | 'onFocus' | 'onBlur' | 'onKeyDown' | 'onKeyUp' | 'onKeyPress'> & {
25
+ class?: string;
26
+ };
27
+ export type ReactifyEvents<T> = {
28
+ [K in keyof T as K extends string ? `on${K}` : never]: T[K];
29
+ };
30
+ export {};
@@ -0,0 +1 @@
1
+ export {};