@westpac/ui 0.50.3 → 0.53.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 (141) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/dist/component-type.json +1 -1
  3. package/dist/components/accordion/components/accordion-item/accordion-item.component.js +15 -4
  4. package/dist/components/accordion/components/accordion-item/accordion-item.styles.d.ts +27 -0
  5. package/dist/components/accordion/components/accordion-item/accordion-item.styles.js +10 -1
  6. package/dist/components/alert/alert.styles.js +1 -1
  7. package/dist/components/autocomplete/autocomplete.styles.js +1 -1
  8. package/dist/components/badge/badge.styles.d.ts +2 -2
  9. package/dist/components/badge/badge.styles.js +2 -2
  10. package/dist/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.styles.js +2 -2
  11. package/dist/components/breadcrumb/components/breadcrumb-item/breadcrumb-item.component.js +1 -1
  12. package/dist/components/button/button.styles.js +1 -1
  13. package/dist/components/button-dropdown/button-dropdown.component.d.ts +1 -1
  14. package/dist/components/button-dropdown/button-dropdown.component.js +5 -3
  15. package/dist/components/button-dropdown/button-dropdown.types.d.ts +7 -2
  16. package/dist/components/button-dropdown/components/button-dropdown-panel/button-dropdown-panel.styles.js +1 -1
  17. package/dist/components/collapsible/collapsible.styles.js +1 -1
  18. package/dist/components/compacta/compacta.styles.js +1 -1
  19. package/dist/components/date-picker-beta/components/date-field/components/date-segment/date-segment.styles.d.ts +2 -2
  20. package/dist/components/date-picker-beta/components/date-field/components/date-segment/date-segment.styles.js +1 -1
  21. package/dist/components/filter/components/filter-buttons/filter-buttons.component.js +2 -3
  22. package/dist/components/filter/components/filter-buttons/filter-buttons.styles.js +5 -5
  23. package/dist/components/filter/filter.component.js +1 -1
  24. package/dist/components/flexi-cell/components/flexi-cell-body/flexi-cell-body.styles.d.ts +2 -2
  25. package/dist/components/flexi-cell/components/flexi-cell-body/flexi-cell-body.styles.js +1 -1
  26. package/dist/components/flexi-cell/flexi-cell.styles.js +1 -1
  27. package/dist/components/footer/footer.styles.js +1 -1
  28. package/dist/components/header/header.component.d.ts +1 -1
  29. package/dist/components/header/header.component.js +13 -10
  30. package/dist/components/header/header.styles.js +1 -1
  31. package/dist/components/header/header.types.d.ts +7 -1
  32. package/dist/components/input-group/components/input-group-add-ons/input-group-add-ons.styles.d.ts +2 -2
  33. package/dist/components/input-group/components/input-group-add-ons/input-group-add-ons.styles.js +3 -3
  34. package/dist/components/input-group/input-group.component.js +2 -1
  35. package/dist/components/modal/components/modal-dialog/index.d.ts +1 -0
  36. package/dist/components/modal/components/modal-dialog/modal-dialog.styles.js +1 -1
  37. package/dist/components/modal/index.d.ts +1 -0
  38. package/dist/components/pagination/components/pagination-item/pagination-item.component.js +8 -2
  39. package/dist/components/pagination/components/pagination-item/pagination-item.styles.d.ts +12 -0
  40. package/dist/components/pagination/components/pagination-item/pagination-item.styles.js +5 -1
  41. package/dist/components/pagination/components/pagination-presentational/pagination-presentational.styles.js +1 -1
  42. package/dist/components/panel/components/panel-footer/panel-footer.styles.js +1 -1
  43. package/dist/components/panel/panel.styles.js +1 -1
  44. package/dist/components/popover/components/panel/panel.component.js +5 -4
  45. package/dist/components/popover/components/panel/panel.styles.js +2 -2
  46. package/dist/components/progress-rope/components/progress-rope-group-step/progress-rope-group-step.component.js +37 -19
  47. package/dist/components/repeater/repeater.styles.js +1 -1
  48. package/dist/components/select/components/index.d.ts +2 -0
  49. package/dist/components/select/components/index.js +2 -0
  50. package/dist/components/select/components/select-with-tooltip/select-with-tooltip.component.d.ts +13 -0
  51. package/dist/components/select/components/select-with-tooltip/select-with-tooltip.component.js +22 -0
  52. package/dist/components/select/components/select-with-tooltip/select-with-tooltip.styles.d.ts +56 -0
  53. package/dist/components/select/components/select-with-tooltip/select-with-tooltip.styles.js +30 -0
  54. package/dist/components/select/components/styled-select/styled-select.component.d.ts +13 -0
  55. package/dist/components/select/components/styled-select/styled-select.component.js +19 -0
  56. package/dist/components/select/components/styled-select/styled-select.styles.d.ts +104 -0
  57. package/dist/components/select/components/styled-select/styled-select.styles.js +46 -0
  58. package/dist/components/select/select.component.d.ts +1 -0
  59. package/dist/components/select/select.component.js +7 -14
  60. package/dist/components/select/select.styles.d.ts +180 -45
  61. package/dist/components/select/select.styles.js +60 -15
  62. package/dist/components/select/select.types.d.ts +6 -0
  63. package/dist/components/table/table.styles.js +1 -1
  64. package/dist/components/tabs/components/tabs-tab/tabs-tab.styles.js +1 -1
  65. package/dist/components/tabs/components/tabs-tab-panel/tabs-tab-panel.styles.d.ts +2 -2
  66. package/dist/components/tabs/components/tabs-tab-panel/tabs-tab-panel.styles.js +1 -1
  67. package/dist/components/tooltip/components/tooltip-content/tooltip-content.component.d.ts +2 -0
  68. package/dist/components/tooltip/components/tooltip-content/tooltip-content.component.js +9 -0
  69. package/dist/components/tooltip/components/tooltip-content/tooltip-content.styles.d.ts +1 -0
  70. package/dist/components/tooltip/components/tooltip-content/tooltip-content.styles.js +4 -0
  71. package/dist/components/tooltip/components/tooltip-content/tooltip-content.types.d.ts +5 -0
  72. package/dist/components/tooltip/components/tooltip-content/tooltip-content.types.js +1 -0
  73. package/dist/components/tooltip/index.d.ts +1 -0
  74. package/dist/components/tooltip/index.js +1 -0
  75. package/dist/components/tooltip/tooltip.component.d.ts +2 -0
  76. package/dist/components/tooltip/tooltip.component.js +55 -0
  77. package/dist/components/tooltip/tooltip.styles.d.ts +1 -0
  78. package/dist/components/tooltip/tooltip.styles.js +4 -0
  79. package/dist/components/tooltip/tooltip.types.d.ts +7 -0
  80. package/dist/components/tooltip/tooltip.types.js +1 -0
  81. package/dist/components/well/well.styles.d.ts +2 -2
  82. package/dist/components/well/well.styles.js +1 -1
  83. package/dist/css/westpac-ui.css +113 -9
  84. package/dist/css/westpac-ui.min.css +113 -9
  85. package/package.json +3 -3
  86. package/src/components/accordion/components/accordion-item/accordion-item.component.tsx +22 -4
  87. package/src/components/accordion/components/accordion-item/accordion-item.styles.ts +10 -1
  88. package/src/components/alert/alert.styles.ts +1 -1
  89. package/src/components/autocomplete/autocomplete.styles.ts +1 -1
  90. package/src/components/badge/badge.styles.ts +2 -2
  91. package/src/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.styles.ts +2 -2
  92. package/src/components/breadcrumb/components/breadcrumb-item/breadcrumb-item.component.tsx +1 -1
  93. package/src/components/button/button.styles.ts +1 -1
  94. package/src/components/button-dropdown/button-dropdown.component.tsx +8 -1
  95. package/src/components/button-dropdown/button-dropdown.types.ts +7 -2
  96. package/src/components/button-dropdown/components/button-dropdown-panel/button-dropdown-panel.styles.ts +1 -1
  97. package/src/components/collapsible/collapsible.styles.ts +1 -1
  98. package/src/components/compacta/compacta.styles.ts +1 -1
  99. package/src/components/date-picker-beta/components/date-field/components/date-segment/date-segment.styles.ts +1 -1
  100. package/src/components/filter/components/filter-buttons/filter-buttons.component.tsx +1 -2
  101. package/src/components/filter/components/filter-buttons/filter-buttons.styles.ts +5 -5
  102. package/src/components/filter/filter.component.tsx +1 -1
  103. package/src/components/flexi-cell/components/flexi-cell-body/flexi-cell-body.styles.ts +1 -1
  104. package/src/components/flexi-cell/flexi-cell.styles.ts +1 -1
  105. package/src/components/footer/footer.styles.ts +1 -1
  106. package/src/components/header/header.component.tsx +17 -4
  107. package/src/components/header/header.styles.ts +1 -1
  108. package/src/components/header/header.types.ts +7 -1
  109. package/src/components/input-group/components/input-group-add-ons/input-group-add-ons.styles.ts +3 -3
  110. package/src/components/input-group/input-group.component.tsx +1 -0
  111. package/src/components/modal/components/modal-dialog/index.ts +1 -0
  112. package/src/components/modal/components/modal-dialog/modal-dialog.styles.ts +1 -1
  113. package/src/components/modal/index.ts +1 -0
  114. package/src/components/pagination/components/pagination-item/pagination-item.component.tsx +9 -2
  115. package/src/components/pagination/components/pagination-item/pagination-item.styles.ts +5 -1
  116. package/src/components/pagination/components/pagination-presentational/pagination-presentational.styles.ts +1 -1
  117. package/src/components/panel/components/panel-footer/panel-footer.styles.ts +1 -1
  118. package/src/components/panel/panel.styles.ts +1 -1
  119. package/src/components/popover/components/panel/panel.component.tsx +8 -5
  120. package/src/components/popover/components/panel/panel.styles.ts +2 -2
  121. package/src/components/progress-rope/components/progress-rope-group-step/progress-rope-group-step.component.tsx +62 -38
  122. package/src/components/repeater/repeater.styles.ts +1 -1
  123. package/src/components/select/components/index.ts +2 -0
  124. package/src/components/select/components/select-with-tooltip/select-with-tooltip.component.tsx +31 -0
  125. package/src/components/select/components/select-with-tooltip/select-with-tooltip.styles.ts +26 -0
  126. package/src/components/select/components/styled-select/styled-select.component.tsx +25 -0
  127. package/src/components/select/components/styled-select/styled-select.styles.ts +42 -0
  128. package/src/components/select/select.component.tsx +9 -14
  129. package/src/components/select/select.styles.ts +18 -15
  130. package/src/components/select/select.types.ts +6 -0
  131. package/src/components/table/table.styles.ts +1 -1
  132. package/src/components/tabs/components/tabs-tab/tabs-tab.styles.ts +1 -1
  133. package/src/components/tabs/components/tabs-tab-panel/tabs-tab-panel.styles.ts +1 -1
  134. package/src/components/tooltip/components/tooltip-content/tooltip-content.component.tsx +12 -0
  135. package/src/components/tooltip/components/tooltip-content/tooltip-content.styles.ts +5 -0
  136. package/src/components/tooltip/components/tooltip-content/tooltip-content.types.ts +6 -0
  137. package/src/components/tooltip/index.ts +1 -0
  138. package/src/components/tooltip/tooltip.component.tsx +61 -0
  139. package/src/components/tooltip/tooltip.styles.ts +3 -0
  140. package/src/components/tooltip/tooltip.types.ts +8 -0
  141. package/src/components/well/well.styles.ts +1 -1
@@ -16,22 +16,67 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
16
16
  true: string;
17
17
  };
18
18
  width: {
19
- auto: string;
20
- full: string;
21
- 1: string;
22
- 2: string;
23
- 3: string;
24
- 4: string;
25
- 5: string;
26
- 6: string;
27
- 7: string;
28
- 8: string;
29
- 9: string;
30
- 10: string;
31
- 20: string;
32
- 30: string;
19
+ auto: {
20
+ base: string;
21
+ tooltip: string;
22
+ };
23
+ full: {
24
+ base: string;
25
+ tooltip: string;
26
+ };
27
+ 1: {
28
+ base: string;
29
+ tooltip: string;
30
+ };
31
+ 2: {
32
+ base: string;
33
+ tooltip: string;
34
+ };
35
+ 3: {
36
+ base: string;
37
+ tooltip: string;
38
+ };
39
+ 4: {
40
+ base: string;
41
+ tooltip: string;
42
+ };
43
+ 5: {
44
+ base: string;
45
+ tooltip: string;
46
+ };
47
+ 6: {
48
+ base: string;
49
+ tooltip: string;
50
+ };
51
+ 7: {
52
+ base: string;
53
+ tooltip: string;
54
+ };
55
+ 8: {
56
+ base: string;
57
+ tooltip: string;
58
+ };
59
+ 9: {
60
+ base: string;
61
+ tooltip: string;
62
+ };
63
+ 10: {
64
+ base: string;
65
+ tooltip: string;
66
+ };
67
+ 20: {
68
+ base: string;
69
+ tooltip: string;
70
+ };
71
+ 30: {
72
+ base: string;
73
+ tooltip: string;
74
+ };
33
75
  };
34
- }, undefined, "form-control bg-no-repeat select-caret disabled:form-control-disabled group-first/add-on-before:!rounded-l group-first/add-on-before:rounded-r-none group-first/add-on-before:!border-x group-last/add-on-after:!rounded-r group-last/add-on-after:rounded-l-none group-last/add-on-after:!border-x group-[.input-group-after]:rounded-r-none group-[.input-group-before]:rounded-l-none group-[.input-group-after]:border-r-0 group-[.input-group-before]:border-l-0", {
76
+ }, {
77
+ base: string;
78
+ tooltip: string;
79
+ }, undefined, {
35
80
  responsiveVariants: string[];
36
81
  }, {
37
82
  size: {
@@ -51,22 +96,67 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
51
96
  true: string;
52
97
  };
53
98
  width: {
54
- auto: string;
55
- full: string;
56
- 1: string;
57
- 2: string;
58
- 3: string;
59
- 4: string;
60
- 5: string;
61
- 6: string;
62
- 7: string;
63
- 8: string;
64
- 9: string;
65
- 10: string;
66
- 20: string;
67
- 30: string;
99
+ auto: {
100
+ base: string;
101
+ tooltip: string;
102
+ };
103
+ full: {
104
+ base: string;
105
+ tooltip: string;
106
+ };
107
+ 1: {
108
+ base: string;
109
+ tooltip: string;
110
+ };
111
+ 2: {
112
+ base: string;
113
+ tooltip: string;
114
+ };
115
+ 3: {
116
+ base: string;
117
+ tooltip: string;
118
+ };
119
+ 4: {
120
+ base: string;
121
+ tooltip: string;
122
+ };
123
+ 5: {
124
+ base: string;
125
+ tooltip: string;
126
+ };
127
+ 6: {
128
+ base: string;
129
+ tooltip: string;
130
+ };
131
+ 7: {
132
+ base: string;
133
+ tooltip: string;
134
+ };
135
+ 8: {
136
+ base: string;
137
+ tooltip: string;
138
+ };
139
+ 9: {
140
+ base: string;
141
+ tooltip: string;
142
+ };
143
+ 10: {
144
+ base: string;
145
+ tooltip: string;
146
+ };
147
+ 20: {
148
+ base: string;
149
+ tooltip: string;
150
+ };
151
+ 30: {
152
+ base: string;
153
+ tooltip: string;
154
+ };
68
155
  };
69
- }, undefined, import("tailwind-variants").TVReturnType<{
156
+ }, {
157
+ base: string;
158
+ tooltip: string;
159
+ }, import("tailwind-variants").TVReturnType<{
70
160
  size: {
71
161
  small: string;
72
162
  medium: string;
@@ -84,21 +174,66 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
84
174
  true: string;
85
175
  };
86
176
  width: {
87
- auto: string;
88
- full: string;
89
- 1: string;
90
- 2: string;
91
- 3: string;
92
- 4: string;
93
- 5: string;
94
- 6: string;
95
- 7: string;
96
- 8: string;
97
- 9: string;
98
- 10: string;
99
- 20: string;
100
- 30: string;
177
+ auto: {
178
+ base: string;
179
+ tooltip: string;
180
+ };
181
+ full: {
182
+ base: string;
183
+ tooltip: string;
184
+ };
185
+ 1: {
186
+ base: string;
187
+ tooltip: string;
188
+ };
189
+ 2: {
190
+ base: string;
191
+ tooltip: string;
192
+ };
193
+ 3: {
194
+ base: string;
195
+ tooltip: string;
196
+ };
197
+ 4: {
198
+ base: string;
199
+ tooltip: string;
200
+ };
201
+ 5: {
202
+ base: string;
203
+ tooltip: string;
204
+ };
205
+ 6: {
206
+ base: string;
207
+ tooltip: string;
208
+ };
209
+ 7: {
210
+ base: string;
211
+ tooltip: string;
212
+ };
213
+ 8: {
214
+ base: string;
215
+ tooltip: string;
216
+ };
217
+ 9: {
218
+ base: string;
219
+ tooltip: string;
220
+ };
221
+ 10: {
222
+ base: string;
223
+ tooltip: string;
224
+ };
225
+ 20: {
226
+ base: string;
227
+ tooltip: string;
228
+ };
229
+ 30: {
230
+ base: string;
231
+ tooltip: string;
232
+ };
101
233
  };
102
- }, undefined, "form-control bg-no-repeat select-caret disabled:form-control-disabled group-first/add-on-before:!rounded-l group-first/add-on-before:rounded-r-none group-first/add-on-before:!border-x group-last/add-on-after:!rounded-r group-last/add-on-after:rounded-l-none group-last/add-on-after:!border-x group-[.input-group-after]:rounded-r-none group-[.input-group-before]:rounded-l-none group-[.input-group-after]:border-r-0 group-[.input-group-before]:border-l-0", {
234
+ }, {
235
+ base: string;
236
+ tooltip: string;
237
+ }, undefined, {
103
238
  responsiveVariants: string[];
104
239
  }, unknown, unknown, undefined>>;
@@ -1,6 +1,9 @@
1
1
  import { tv } from 'tailwind-variants';
2
2
  export const styles = tv({
3
- base: 'form-control bg-no-repeat select-caret disabled:form-control-disabled group-first/add-on-before:!rounded-l group-first/add-on-before:rounded-r-none group-first/add-on-before:!border-x group-last/add-on-after:!rounded-r group-last/add-on-after:rounded-l-none group-last/add-on-after:!border-x group-[.input-group-after]:rounded-r-none group-[.input-group-before]:rounded-l-none group-[.input-group-after]:border-r-0 group-[.input-group-before]:border-l-0',
3
+ slots: {
4
+ base: 'form-control overflow-hidden overflow-ellipsis whitespace-nowrap bg-no-repeat select-caret disabled:form-control-disabled group-first/add-on-before:!rounded-l group-first/add-on-before:rounded-r-none group-first/add-on-before:!border-x group-last/add-on-after:!rounded-r group-last/add-on-after:rounded-l-none group-last/add-on-after:!border-x group-[.input-group-after]:rounded-r-none group-[.input-group-before]:rounded-l-none group-[.input-group-after]:border-r-0 group-[.input-group-before]:border-l-0',
5
+ tooltip: ''
6
+ },
4
7
  variants: {
5
8
  size: {
6
9
  small: 'form-control-small bg-[right_0.5625rem_center] pr-[calc(0.5rem+14px+0.5625rem)]',
@@ -19,20 +22,62 @@ export const styles = tv({
19
22
  true: 'outline-none'
20
23
  },
21
24
  width: {
22
- auto: 'flex-1',
23
- full: 'w-full flex-1',
24
- 1: 'box-content w-[1.81ex]',
25
- 2: 'box-content w-[3.62ex]',
26
- 3: 'box-content w-[5.43ex]',
27
- 4: 'box-content w-[7.24ex]',
28
- 5: 'box-content w-[9.05ex]',
29
- 6: 'box-content w-[10.86ex]',
30
- 7: 'box-content w-[12.67ex]',
31
- 8: 'box-content w-[14.48ex]',
32
- 9: 'box-content w-[16.29ex]',
33
- 10: 'box-content w-[18.1ex]',
34
- 20: 'box-content w-[36.2ex]',
35
- 30: 'box-content w-[54.3ex]'
25
+ auto: {
26
+ base: 'flex-1',
27
+ tooltip: 'flex-1'
28
+ },
29
+ full: {
30
+ base: 'w-full flex-1',
31
+ tooltip: 'w-full flex-1'
32
+ },
33
+ 1: {
34
+ base: 'box-content w-[1.81ex]',
35
+ tooltip: 'w-[1.81ex]'
36
+ },
37
+ 2: {
38
+ base: 'box-content w-[3.62ex]',
39
+ tooltip: 'w-[3.62ex]'
40
+ },
41
+ 3: {
42
+ base: 'box-content w-[5.43ex]',
43
+ tooltip: 'w-[5.43ex]'
44
+ },
45
+ 4: {
46
+ base: 'box-content w-[7.24ex]',
47
+ tooltip: 'w-[7.24ex]'
48
+ },
49
+ 5: {
50
+ base: 'box-content w-[9.05ex]',
51
+ tooltip: 'w-[9.05ex]'
52
+ },
53
+ 6: {
54
+ base: 'box-content w-[10.86ex]',
55
+ tooltip: 'w-[10.86ex]'
56
+ },
57
+ 7: {
58
+ base: 'box-content w-[12.67ex]',
59
+ tooltip: 'w-[12.67ex]'
60
+ },
61
+ 8: {
62
+ base: 'box-content w-[14.48ex]',
63
+ tooltip: 'w-[14.48ex]'
64
+ },
65
+ 9: {
66
+ base: 'box-content w-[16.29ex]',
67
+ tooltip: 'w-[16.29ex]'
68
+ },
69
+ 10: {
70
+ base: 'box-content w-[18.1ex]',
71
+ tooltip: 'w-[18.1ex]'
72
+ },
73
+ 20: {
74
+ base: 'box-content w-[36.2ex]',
75
+ tooltip: 'w-[36.2ex]'
76
+ },
77
+ 30: {
78
+ base: 'box-content w-[54.3ex]',
79
+ tooltip: 'w-[54.3ex]'
80
+ }
36
81
  }
37
82
  }
38
83
  }, {
@@ -3,6 +3,12 @@ import { type VariantProps } from 'tailwind-variants';
3
3
  import { styles } from './select.styles.js';
4
4
  type Variants = VariantProps<typeof styles>;
5
5
  export type SelectProps = {
6
+ /**
7
+ * Whether to set the title for the select to the currently selected option for use with truncation.
8
+ * Optional for accessibility reasons as it should only be enabled when required. Will not be read by screen readers.
9
+ * @default false
10
+ */
11
+ enableTooltip?: boolean;
6
12
  /**
7
13
  * Whether select is invalid
8
14
  * @default false
@@ -1,7 +1,7 @@
1
1
  import { tv } from 'tailwind-variants';
2
2
  export const styles = tv({
3
3
  slots: {
4
- base: 'mb-4 w-full',
4
+ base: 'mb-4 w-full [&_:focus-visible]:focus-outline',
5
5
  wrapper: 'max-xsl:mb-3 max-xsl:w-full max-xsl:overflow-x-auto max-xsl:overflow-y-hidden'
6
6
  },
7
7
  variants: {}
@@ -22,7 +22,7 @@ export const styles = tv({
22
22
  hero: ''
23
23
  },
24
24
  isFocusVisible: {
25
- true: 'focus-outline',
25
+ true: 'z-10 focus-outline',
26
26
  false: 'outline-none'
27
27
  }
28
28
  },
@@ -6,7 +6,7 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
6
6
  isFocused: {
7
7
  true: string;
8
8
  };
9
- }, undefined, "flex-1 bg-white p-4", {
9
+ }, undefined, "flex-1 bg-white p-4 [&_:focus-visible]:focus-outline", {
10
10
  responsiveVariants: string[];
11
11
  }, {
12
12
  look: {
@@ -24,6 +24,6 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
24
24
  isFocused: {
25
25
  true: string;
26
26
  };
27
- }, undefined, "flex-1 bg-white p-4", {
27
+ }, undefined, "flex-1 bg-white p-4 [&_:focus-visible]:focus-outline", {
28
28
  responsiveVariants: string[];
29
29
  }, unknown, unknown, undefined>>;
@@ -1,6 +1,6 @@
1
1
  import { tv } from 'tailwind-variants';
2
2
  export const styles = tv({
3
- base: 'flex-1 bg-white p-4',
3
+ base: 'flex-1 bg-white p-4 [&_:focus-visible]:focus-outline',
4
4
  variants: {
5
5
  look: {
6
6
  default: 'border border-border',
@@ -0,0 +1,2 @@
1
+ import { TooltipContentProps } from './tooltip-content.types.js';
2
+ export declare function TooltipContent({ children, id }: TooltipContentProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { styles } from './tooltip-content.styles.js';
3
+ export function TooltipContent({ children, id }) {
4
+ return children ? React.createElement("span", {
5
+ className: styles(),
6
+ role: "tooltip",
7
+ id: id
8
+ }, children) : null;
9
+ }
@@ -0,0 +1 @@
1
+ export declare const styles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "absolute left-1 top-full z-10 mt-2 whitespace-nowrap rounded-sm border border-border bg-background p-0.5 text-text", TVConfig<V, EV>, {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, "absolute left-1 top-full z-10 mt-2 whitespace-nowrap rounded-sm border border-border bg-background p-0.5 text-text", TVConfig<V, EV>, unknown, unknown, undefined>>;
@@ -0,0 +1,4 @@
1
+ import { tv } from 'tailwind-variants';
2
+ export const styles = tv({
3
+ base: 'absolute left-1 top-full z-10 mt-2 whitespace-nowrap rounded-sm border border-border bg-background p-0.5 text-text'
4
+ });
@@ -0,0 +1,5 @@
1
+ import { ReactNode } from 'react';
2
+ export type TooltipContentProps = {
3
+ children?: ReactNode;
4
+ id: string;
5
+ };
@@ -0,0 +1 @@
1
+ export { Tooltip } from './tooltip.component.js';
@@ -0,0 +1 @@
1
+ export { Tooltip } from './tooltip.component.js';
@@ -0,0 +1,2 @@
1
+ import { TooltipProps } from './tooltip.types.js';
2
+ export declare function Tooltip({ children, tooltip, id, className }: TooltipProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,55 @@
1
+ 'use client';
2
+ import React, { useCallback, useEffect, useId, useRef, useState } from 'react';
3
+ import { mergeProps, useHover, useFocusRing } from 'react-aria';
4
+ import { TooltipContent } from './components/tooltip-content/tooltip-content.component.js';
5
+ import { styles } from './tooltip.styles.js';
6
+ export function Tooltip({ children, tooltip, id, className }) {
7
+ const localId = useId();
8
+ const [isOpen, setIsOpen] = useState(false);
9
+ const tooltipWaitTime = useRef(null);
10
+ const handleKeyDown = (e)=>{
11
+ if (e.key === 'Escape' && isOpen) {
12
+ setIsOpen(false);
13
+ }
14
+ };
15
+ const { hoverProps, isHovered } = useHover({});
16
+ const { isFocusVisible, focusProps } = useFocusRing({
17
+ within: true
18
+ });
19
+ const startTimer = useCallback(()=>{
20
+ tooltipWaitTime.current = setTimeout(()=>{
21
+ setIsOpen(true);
22
+ }, 1000);
23
+ }, []);
24
+ const stopTimer = useCallback(()=>{
25
+ if (tooltipWaitTime.current) {
26
+ clearTimeout(tooltipWaitTime.current);
27
+ }
28
+ }, []);
29
+ useEffect(()=>{
30
+ setIsOpen(isFocusVisible);
31
+ }, [
32
+ isFocusVisible
33
+ ]);
34
+ useEffect(()=>{
35
+ if (isHovered && !isOpen) startTimer();
36
+ if (!isHovered) setIsOpen(false);
37
+ return ()=>stopTimer();
38
+ }, [
39
+ isHovered
40
+ ]);
41
+ useEffect(()=>{
42
+ window.addEventListener('keydown', handleKeyDown);
43
+ return ()=>window.removeEventListener('keydown', handleKeyDown);
44
+ }, [
45
+ isOpen
46
+ ]);
47
+ return React.createElement("span", {
48
+ ...mergeProps(hoverProps, focusProps),
49
+ className: styles({
50
+ className
51
+ })
52
+ }, children, isOpen && React.createElement(TooltipContent, {
53
+ id: id !== null && id !== void 0 ? id : localId
54
+ }, tooltip));
55
+ }
@@ -0,0 +1 @@
1
+ export declare const styles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "relative", TVConfig<V, EV>, {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, "relative", TVConfig<V, EV>, unknown, unknown, undefined>>;
@@ -0,0 +1,4 @@
1
+ import { tv } from 'tailwind-variants';
2
+ export const styles = tv({
3
+ base: 'relative'
4
+ });
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from 'react';
2
+ export type TooltipProps = {
3
+ children: ReactNode;
4
+ tooltip: string;
5
+ id?: string;
6
+ className?: string;
7
+ };
@@ -0,0 +1 @@
1
+ export { };
@@ -3,7 +3,7 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
3
3
  light: string;
4
4
  white: string;
5
5
  };
6
- }, undefined, "rounded border border-border p-2 sm:p-4", {
6
+ }, undefined, "rounded border border-border p-2 sm:p-4 [&_:focus-visible]:focus-outline", {
7
7
  responsiveVariants: string[];
8
8
  }, {
9
9
  color: {
@@ -15,6 +15,6 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
15
15
  light: string;
16
16
  white: string;
17
17
  };
18
- }, undefined, "rounded border border-border p-2 sm:p-4", {
18
+ }, undefined, "rounded border border-border p-2 sm:p-4 [&_:focus-visible]:focus-outline", {
19
19
  responsiveVariants: string[];
20
20
  }, unknown, unknown, undefined>>;
@@ -1,6 +1,6 @@
1
1
  import { tv } from 'tailwind-variants';
2
2
  export const styles = tv({
3
- base: 'rounded border border-border p-2 sm:p-4',
3
+ base: 'rounded border border-border p-2 sm:p-4 [&_:focus-visible]:focus-outline',
4
4
  variants: {
5
5
  color: {
6
6
  light: 'bg-light',