@simplybusiness/mobius 5.4.0 → 5.6.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 (100) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/components/Checkbox/Checkbox.js +14 -5
  3. package/dist/cjs/components/Checkbox/Checkbox.js.map +1 -1
  4. package/dist/cjs/components/Combobox/Combobox.js +152 -0
  5. package/dist/cjs/components/Combobox/Combobox.js.map +1 -0
  6. package/dist/cjs/components/Combobox/Listbox.js +58 -0
  7. package/dist/cjs/components/Combobox/Listbox.js.map +1 -0
  8. package/dist/cjs/components/Combobox/Option.js +44 -0
  9. package/dist/cjs/components/Combobox/Option.js.map +1 -0
  10. package/dist/cjs/components/Combobox/fixtures.js +359 -0
  11. package/dist/cjs/components/Combobox/fixtures.js.map +1 -0
  12. package/dist/cjs/components/Combobox/index.js +21 -0
  13. package/dist/cjs/components/Combobox/index.js.map +1 -0
  14. package/dist/cjs/components/Combobox/types.js +6 -0
  15. package/dist/cjs/components/Combobox/types.js.map +1 -0
  16. package/dist/cjs/components/Combobox/useComboboxHighlight.js +86 -0
  17. package/dist/cjs/components/Combobox/useComboboxHighlight.js.map +1 -0
  18. package/dist/cjs/components/Combobox/utils.js +46 -0
  19. package/dist/cjs/components/Combobox/utils.js.map +1 -0
  20. package/dist/cjs/components/TextArea/TextArea.js +4 -4
  21. package/dist/cjs/components/TextArea/TextArea.js.map +1 -1
  22. package/dist/cjs/components/TextAreaInput/TextAreaInput.js +6 -3
  23. package/dist/cjs/components/TextAreaInput/TextAreaInput.js.map +1 -1
  24. package/dist/cjs/components/TextField/TextField.js +4 -3
  25. package/dist/cjs/components/TextField/TextField.js.map +1 -1
  26. package/dist/cjs/components/index.js +1 -0
  27. package/dist/cjs/components/index.js.map +1 -1
  28. package/dist/cjs/hooks/useTextField/useTextField.js +1 -0
  29. package/dist/cjs/hooks/useTextField/useTextField.js.map +1 -1
  30. package/dist/cjs/tsconfig.tsbuildinfo +1 -1
  31. package/dist/esm/components/Checkbox/Checkbox.js +15 -6
  32. package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
  33. package/dist/esm/components/Combobox/Combobox.js +137 -0
  34. package/dist/esm/components/Combobox/Combobox.js.map +1 -0
  35. package/dist/esm/components/Combobox/Listbox.js +43 -0
  36. package/dist/esm/components/Combobox/Listbox.js.map +1 -0
  37. package/dist/esm/components/Combobox/Option.js +29 -0
  38. package/dist/esm/components/Combobox/Option.js.map +1 -0
  39. package/dist/esm/components/Combobox/fixtures.js +335 -0
  40. package/dist/esm/components/Combobox/fixtures.js.map +1 -0
  41. package/dist/esm/components/Combobox/index.js +4 -0
  42. package/dist/esm/components/Combobox/index.js.map +1 -0
  43. package/dist/esm/components/Combobox/types.js +3 -0
  44. package/dist/esm/components/Combobox/types.js.map +1 -0
  45. package/dist/esm/components/Combobox/useComboboxHighlight.js +76 -0
  46. package/dist/esm/components/Combobox/useComboboxHighlight.js.map +1 -0
  47. package/dist/esm/components/Combobox/utils.js +20 -0
  48. package/dist/esm/components/Combobox/utils.js.map +1 -0
  49. package/dist/esm/components/TextArea/TextArea.js +4 -4
  50. package/dist/esm/components/TextArea/TextArea.js.map +1 -1
  51. package/dist/esm/components/TextAreaInput/TextAreaInput.js +6 -3
  52. package/dist/esm/components/TextAreaInput/TextAreaInput.js.map +1 -1
  53. package/dist/esm/components/TextField/TextField.js +4 -3
  54. package/dist/esm/components/TextField/TextField.js.map +1 -1
  55. package/dist/esm/components/index.js +1 -0
  56. package/dist/esm/components/index.js.map +1 -1
  57. package/dist/esm/hooks/useTextField/types.js.map +1 -1
  58. package/dist/esm/hooks/useTextField/useTextField.js +1 -0
  59. package/dist/esm/hooks/useTextField/useTextField.js.map +1 -1
  60. package/dist/types/components/Combobox/Combobox.d.ts +3 -0
  61. package/dist/types/components/Combobox/Combobox.stories.d.ts +10 -0
  62. package/dist/types/components/Combobox/Combobox.test.d.ts +1 -0
  63. package/dist/types/components/Combobox/Listbox.d.ts +10 -0
  64. package/dist/types/components/Combobox/Option.d.ts +2 -0
  65. package/dist/types/components/Combobox/fixtures.d.ts +10 -0
  66. package/dist/types/components/Combobox/index.d.ts +2 -0
  67. package/dist/types/components/Combobox/types.d.ts +31 -0
  68. package/dist/types/components/Combobox/useComboboxHighlight.d.ts +10 -0
  69. package/dist/types/components/Combobox/useComboboxHighlight.test.d.ts +1 -0
  70. package/dist/types/components/Combobox/utils.d.ts +6 -0
  71. package/dist/types/components/Combobox/utils.test.d.ts +1 -0
  72. package/dist/types/components/TextArea/TextArea.d.ts +2 -2
  73. package/dist/types/components/TextAreaInput/TextAreaInput.d.ts +3 -1
  74. package/dist/types/components/index.d.ts +1 -0
  75. package/dist/types/hooks/useTextField/types.d.ts +3 -2
  76. package/package.json +1 -1
  77. package/src/components/Checkbox/Checkbox.test.tsx +1 -2
  78. package/src/components/Checkbox/Checkbox.tsx +21 -7
  79. package/src/components/Combobox/Combobox.css +77 -0
  80. package/src/components/Combobox/Combobox.mdx +147 -0
  81. package/src/components/Combobox/Combobox.stories.tsx +71 -0
  82. package/src/components/Combobox/Combobox.test.tsx +797 -0
  83. package/src/components/Combobox/Combobox.tsx +174 -0
  84. package/src/components/Combobox/Listbox.tsx +74 -0
  85. package/src/components/Combobox/Option.tsx +41 -0
  86. package/src/components/Combobox/fixtures.tsx +204 -0
  87. package/src/components/Combobox/index.tsx +2 -0
  88. package/src/components/Combobox/types.tsx +38 -0
  89. package/src/components/Combobox/useComboboxHighlight.test.tsx +242 -0
  90. package/src/components/Combobox/useComboboxHighlight.tsx +88 -0
  91. package/src/components/Combobox/utils.test.tsx +120 -0
  92. package/src/components/Combobox/utils.tsx +50 -0
  93. package/src/components/TextArea/TextArea.tsx +6 -6
  94. package/src/components/TextAreaInput/TextAreaInput.tsx +16 -4
  95. package/src/components/TextField/TextField.test.tsx +8 -0
  96. package/src/components/TextField/TextField.tsx +3 -1
  97. package/src/components/index.tsx +1 -0
  98. package/src/hooks/useTextField/types.tsx +7 -1
  99. package/src/hooks/useTextField/useTextField.test.tsx +1 -0
  100. package/src/hooks/useTextField/useTextField.tsx +1 -0
@@ -0,0 +1,359 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ FRUITS: function() {
13
+ return FRUITS;
14
+ },
15
+ FRUITS_GROUPS: function() {
16
+ return FRUITS_GROUPS;
17
+ },
18
+ FRUITS_OBJECTS: function() {
19
+ return FRUITS_OBJECTS;
20
+ },
21
+ US_STATES: function() {
22
+ return US_STATES;
23
+ }
24
+ });
25
+ const FRUITS = [
26
+ "Apple",
27
+ "Apricot",
28
+ "Avocado",
29
+ "Banana",
30
+ "Blackberry",
31
+ "Blueberry",
32
+ "Cantaloupe",
33
+ "Cherry",
34
+ "Clementine",
35
+ "Coconut",
36
+ "Cranberry",
37
+ "Date",
38
+ "Dragonfruit",
39
+ "Durian",
40
+ "Elderberry",
41
+ "Fig",
42
+ "Grape",
43
+ "Grapefruit",
44
+ "Guava",
45
+ "Honeydew",
46
+ "Jackfruit",
47
+ "Kiwi",
48
+ "Kumquat",
49
+ "Lemon",
50
+ "Lime",
51
+ "Lychee",
52
+ "Mango",
53
+ "Mulberry",
54
+ "Nectarine",
55
+ "Orange",
56
+ "Papaya",
57
+ "Passionfruit",
58
+ "Peach",
59
+ "Pear",
60
+ "Persimmon",
61
+ "Pineapple",
62
+ "Plum",
63
+ "Pomegranate",
64
+ "Raspberry",
65
+ "Redcurrant",
66
+ "Starfruit",
67
+ "Strawberry",
68
+ "Tangerine",
69
+ "Watermelon"
70
+ ];
71
+ const FRUITS_OBJECTS = [
72
+ {
73
+ label: "Apple",
74
+ value: "apple"
75
+ },
76
+ {
77
+ label: "Apricot",
78
+ value: "apricot"
79
+ },
80
+ {
81
+ label: "Avocado",
82
+ value: "avocado"
83
+ },
84
+ {
85
+ label: "Banana",
86
+ value: "banana"
87
+ },
88
+ {
89
+ label: "Blackberry",
90
+ value: "blackberry"
91
+ },
92
+ {
93
+ label: "Blueberry",
94
+ value: "blueberry"
95
+ },
96
+ {
97
+ label: "Cantaloupe",
98
+ value: "cantaloupe"
99
+ },
100
+ {
101
+ label: "Cherry",
102
+ value: "cherry"
103
+ },
104
+ {
105
+ label: "Clementine",
106
+ value: "clementine"
107
+ },
108
+ {
109
+ label: "Coconut",
110
+ value: "coconut"
111
+ },
112
+ {
113
+ label: "Cranberry",
114
+ value: "cranberry"
115
+ },
116
+ {
117
+ label: "Date",
118
+ value: "date"
119
+ },
120
+ {
121
+ label: "Dragonfruit",
122
+ value: "dragonfruit"
123
+ },
124
+ {
125
+ label: "Durian",
126
+ value: "durian"
127
+ },
128
+ {
129
+ label: "Elderberry",
130
+ value: "elderberry"
131
+ },
132
+ {
133
+ label: "Fig",
134
+ value: "fig"
135
+ },
136
+ {
137
+ label: "Grape",
138
+ value: "grape"
139
+ },
140
+ {
141
+ label: "Grapefruit",
142
+ value: "grapefruit"
143
+ },
144
+ {
145
+ label: "Guava",
146
+ value: "guava"
147
+ },
148
+ {
149
+ label: "Honeydew",
150
+ value: "honeydew"
151
+ },
152
+ {
153
+ label: "Jackfruit",
154
+ value: "jackfruit"
155
+ },
156
+ {
157
+ label: "Kiwi",
158
+ value: "kiwi"
159
+ },
160
+ {
161
+ label: "Kumquat",
162
+ value: "kumquat"
163
+ },
164
+ {
165
+ label: "Lemon",
166
+ value: "lemon"
167
+ },
168
+ {
169
+ label: "Lime",
170
+ value: "lime"
171
+ },
172
+ {
173
+ label: "Lychee",
174
+ value: "lychee"
175
+ },
176
+ {
177
+ label: "Mango",
178
+ value: "mango"
179
+ },
180
+ {
181
+ label: "Mulberry",
182
+ value: "mulberry"
183
+ },
184
+ {
185
+ label: "Nectarine",
186
+ value: "nectarine"
187
+ },
188
+ {
189
+ label: "Orange",
190
+ value: "orange"
191
+ },
192
+ {
193
+ label: "Papaya",
194
+ value: "papaya"
195
+ },
196
+ {
197
+ label: "Passionfruit",
198
+ value: "passionfruit"
199
+ },
200
+ {
201
+ label: "Peach",
202
+ value: "peach"
203
+ },
204
+ {
205
+ label: "Pear",
206
+ value: "pear"
207
+ },
208
+ {
209
+ label: "Persimmon",
210
+ value: "persimmon"
211
+ },
212
+ {
213
+ label: "Pineapple",
214
+ value: "pineapple"
215
+ },
216
+ {
217
+ label: "Plum",
218
+ value: "plum"
219
+ },
220
+ {
221
+ label: "Pomegranate",
222
+ value: "pomegranate"
223
+ },
224
+ {
225
+ label: "Raspberry",
226
+ value: "raspberry"
227
+ },
228
+ {
229
+ label: "Redcurrant",
230
+ value: "redcurrant"
231
+ },
232
+ {
233
+ label: "Starfruit",
234
+ value: "starfruit"
235
+ },
236
+ {
237
+ label: "Strawberry",
238
+ value: "strawberry"
239
+ },
240
+ {
241
+ label: "Tangerine",
242
+ value: "tangerine"
243
+ },
244
+ {
245
+ label: "Watermelon",
246
+ value: "watermelon"
247
+ }
248
+ ];
249
+ const FRUITS_GROUPS = [
250
+ {
251
+ heading: "A-L",
252
+ options: [
253
+ "Apple",
254
+ "Apricot",
255
+ "Avocado",
256
+ "Banana",
257
+ "Blackberry",
258
+ "Blueberry",
259
+ "Cantaloupe",
260
+ "Cherry",
261
+ "Clementine",
262
+ "Coconut",
263
+ "Cranberry",
264
+ "Date",
265
+ "Dragonfruit",
266
+ "Durian",
267
+ "Elderberry",
268
+ "Fig",
269
+ "Grape",
270
+ "Grapefruit",
271
+ "Guava",
272
+ "Honeydew",
273
+ "Jackfruit",
274
+ "Kiwi",
275
+ "Kumquat",
276
+ "Lemon",
277
+ "Lime",
278
+ "Lychee"
279
+ ]
280
+ },
281
+ {
282
+ heading: "M-Z",
283
+ options: [
284
+ "Mango",
285
+ "Mulberry",
286
+ "Nectarine",
287
+ "Orange",
288
+ "Papaya",
289
+ "Passionfruit",
290
+ "Peach",
291
+ "Pear",
292
+ "Persimmon",
293
+ "Pineapple",
294
+ "Plum",
295
+ "Pomegranate",
296
+ "Raspberry",
297
+ "Redcurrant",
298
+ "Starfruit",
299
+ "Strawberry",
300
+ "Tangerine",
301
+ "Watermelon"
302
+ ]
303
+ }
304
+ ];
305
+ const US_STATES = [
306
+ "Alabama",
307
+ "Alaska",
308
+ "Arizona",
309
+ "Arkansas",
310
+ "California",
311
+ "Colorado",
312
+ "Connecticut",
313
+ "Delaware",
314
+ "District Of Columbia",
315
+ "Florida",
316
+ "Georgia",
317
+ "Hawaii",
318
+ "Idaho",
319
+ "Illinois",
320
+ "Indiana",
321
+ "Iowa",
322
+ "Kansas",
323
+ "Kentucky",
324
+ "Louisiana",
325
+ "Maine",
326
+ "Maryland",
327
+ "Massachusetts",
328
+ "Michigan",
329
+ "Minnesota",
330
+ "Mississippi",
331
+ "Missouri",
332
+ "Montana",
333
+ "Nebraska",
334
+ "Nevada",
335
+ "New Hampshire",
336
+ "New Jersey",
337
+ "New Mexico",
338
+ "New York",
339
+ "North Carolina",
340
+ "North Dakota",
341
+ "Ohio",
342
+ "Oklahoma",
343
+ "Oregon",
344
+ "Pennsylvania",
345
+ "Rhode Island",
346
+ "South Carolina",
347
+ "South Dakota",
348
+ "Tennessee",
349
+ "Texas",
350
+ "Utah",
351
+ "Vermont",
352
+ "Virginia",
353
+ "Washington",
354
+ "West Virginia",
355
+ "Wisconsin",
356
+ "Wyoming"
357
+ ];
358
+
359
+ //# sourceMappingURL=fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/Combobox/fixtures.tsx"],"sourcesContent":["export const FRUITS = [\n \"Apple\",\n \"Apricot\",\n \"Avocado\",\n \"Banana\",\n \"Blackberry\",\n \"Blueberry\",\n \"Cantaloupe\",\n \"Cherry\",\n \"Clementine\",\n \"Coconut\",\n \"Cranberry\",\n \"Date\",\n \"Dragonfruit\",\n \"Durian\",\n \"Elderberry\",\n \"Fig\",\n \"Grape\",\n \"Grapefruit\",\n \"Guava\",\n \"Honeydew\",\n \"Jackfruit\",\n \"Kiwi\",\n \"Kumquat\",\n \"Lemon\",\n \"Lime\",\n \"Lychee\",\n \"Mango\",\n \"Mulberry\",\n \"Nectarine\",\n \"Orange\",\n \"Papaya\",\n \"Passionfruit\",\n \"Peach\",\n \"Pear\",\n \"Persimmon\",\n \"Pineapple\",\n \"Plum\",\n \"Pomegranate\",\n \"Raspberry\",\n \"Redcurrant\",\n \"Starfruit\",\n \"Strawberry\",\n \"Tangerine\",\n \"Watermelon\",\n];\n\nexport const FRUITS_OBJECTS = [\n { label: \"Apple\", value: \"apple\" },\n { label: \"Apricot\", value: \"apricot\" },\n { label: \"Avocado\", value: \"avocado\" },\n { label: \"Banana\", value: \"banana\" },\n { label: \"Blackberry\", value: \"blackberry\" },\n { label: \"Blueberry\", value: \"blueberry\" },\n { label: \"Cantaloupe\", value: \"cantaloupe\" },\n { label: \"Cherry\", value: \"cherry\" },\n { label: \"Clementine\", value: \"clementine\" },\n { label: \"Coconut\", value: \"coconut\" },\n { label: \"Cranberry\", value: \"cranberry\" },\n { label: \"Date\", value: \"date\" },\n { label: \"Dragonfruit\", value: \"dragonfruit\" },\n { label: \"Durian\", value: \"durian\" },\n { label: \"Elderberry\", value: \"elderberry\" },\n { label: \"Fig\", value: \"fig\" },\n { label: \"Grape\", value: \"grape\" },\n { label: \"Grapefruit\", value: \"grapefruit\" },\n { label: \"Guava\", value: \"guava\" },\n { label: \"Honeydew\", value: \"honeydew\" },\n { label: \"Jackfruit\", value: \"jackfruit\" },\n { label: \"Kiwi\", value: \"kiwi\" },\n { label: \"Kumquat\", value: \"kumquat\" },\n { label: \"Lemon\", value: \"lemon\" },\n { label: \"Lime\", value: \"lime\" },\n { label: \"Lychee\", value: \"lychee\" },\n { label: \"Mango\", value: \"mango\" },\n { label: \"Mulberry\", value: \"mulberry\" },\n { label: \"Nectarine\", value: \"nectarine\" },\n { label: \"Orange\", value: \"orange\" },\n { label: \"Papaya\", value: \"papaya\" },\n { label: \"Passionfruit\", value: \"passionfruit\" },\n { label: \"Peach\", value: \"peach\" },\n { label: \"Pear\", value: \"pear\" },\n { label: \"Persimmon\", value: \"persimmon\" },\n { label: \"Pineapple\", value: \"pineapple\" },\n { label: \"Plum\", value: \"plum\" },\n { label: \"Pomegranate\", value: \"pomegranate\" },\n { label: \"Raspberry\", value: \"raspberry\" },\n { label: \"Redcurrant\", value: \"redcurrant\" },\n { label: \"Starfruit\", value: \"starfruit\" },\n { label: \"Strawberry\", value: \"strawberry\" },\n { label: \"Tangerine\", value: \"tangerine\" },\n { label: \"Watermelon\", value: \"watermelon\" },\n];\n\nexport const FRUITS_GROUPS = [\n {\n heading: \"A-L\",\n options: [\n \"Apple\",\n \"Apricot\",\n \"Avocado\",\n \"Banana\",\n \"Blackberry\",\n \"Blueberry\",\n \"Cantaloupe\",\n \"Cherry\",\n \"Clementine\",\n \"Coconut\",\n \"Cranberry\",\n \"Date\",\n \"Dragonfruit\",\n \"Durian\",\n \"Elderberry\",\n \"Fig\",\n \"Grape\",\n \"Grapefruit\",\n \"Guava\",\n \"Honeydew\",\n \"Jackfruit\",\n \"Kiwi\",\n \"Kumquat\",\n \"Lemon\",\n \"Lime\",\n \"Lychee\",\n ],\n },\n {\n heading: \"M-Z\",\n options: [\n \"Mango\",\n \"Mulberry\",\n \"Nectarine\",\n \"Orange\",\n \"Papaya\",\n \"Passionfruit\",\n \"Peach\",\n \"Pear\",\n \"Persimmon\",\n \"Pineapple\",\n \"Plum\",\n \"Pomegranate\",\n \"Raspberry\",\n \"Redcurrant\",\n \"Starfruit\",\n \"Strawberry\",\n \"Tangerine\",\n \"Watermelon\",\n ],\n },\n];\n\nexport const US_STATES = [\n \"Alabama\",\n \"Alaska\",\n \"Arizona\",\n \"Arkansas\",\n \"California\",\n \"Colorado\",\n \"Connecticut\",\n \"Delaware\",\n \"District Of Columbia\",\n \"Florida\",\n \"Georgia\",\n \"Hawaii\",\n \"Idaho\",\n \"Illinois\",\n \"Indiana\",\n \"Iowa\",\n \"Kansas\",\n \"Kentucky\",\n \"Louisiana\",\n \"Maine\",\n \"Maryland\",\n \"Massachusetts\",\n \"Michigan\",\n \"Minnesota\",\n \"Mississippi\",\n \"Missouri\",\n \"Montana\",\n \"Nebraska\",\n \"Nevada\",\n \"New Hampshire\",\n \"New Jersey\",\n \"New Mexico\",\n \"New York\",\n \"North Carolina\",\n \"North Dakota\",\n \"Ohio\",\n \"Oklahoma\",\n \"Oregon\",\n \"Pennsylvania\",\n \"Rhode Island\",\n \"South Carolina\",\n \"South Dakota\",\n \"Tennessee\",\n \"Texas\",\n \"Utah\",\n \"Vermont\",\n \"Virginia\",\n \"Washington\",\n \"West Virginia\",\n \"Wisconsin\",\n \"Wyoming\",\n];\n"],"names":["FRUITS","FRUITS_GROUPS","FRUITS_OBJECTS","US_STATES","label","value","heading","options"],"mappings":";;;;;;;;;;;IAAaA,MAAM;eAANA;;IA8FAC,aAAa;eAAbA;;IA/CAC,cAAc;eAAdA;;IAwGAC,SAAS;eAATA;;;AAvJN,MAAMH,SAAS;IACpB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAEM,MAAME,iBAAiB;IAC5B;QAAEE,OAAO;QAASC,OAAO;IAAQ;IACjC;QAAED,OAAO;QAAWC,OAAO;IAAU;IACrC;QAAED,OAAO;QAAWC,OAAO;IAAU;IACrC;QAAED,OAAO;QAAUC,OAAO;IAAS;IACnC;QAAED,OAAO;QAAcC,OAAO;IAAa;IAC3C;QAAED,OAAO;QAAaC,OAAO;IAAY;IACzC;QAAED,OAAO;QAAcC,OAAO;IAAa;IAC3C;QAAED,OAAO;QAAUC,OAAO;IAAS;IACnC;QAAED,OAAO;QAAcC,OAAO;IAAa;IAC3C;QAAED,OAAO;QAAWC,OAAO;IAAU;IACrC;QAAED,OAAO;QAAaC,OAAO;IAAY;IACzC;QAAED,OAAO;QAAQC,OAAO;IAAO;IAC/B;QAAED,OAAO;QAAeC,OAAO;IAAc;IAC7C;QAAED,OAAO;QAAUC,OAAO;IAAS;IACnC;QAAED,OAAO;QAAcC,OAAO;IAAa;IAC3C;QAAED,OAAO;QAAOC,OAAO;IAAM;IAC7B;QAAED,OAAO;QAASC,OAAO;IAAQ;IACjC;QAAED,OAAO;QAAcC,OAAO;IAAa;IAC3C;QAAED,OAAO;QAASC,OAAO;IAAQ;IACjC;QAAED,OAAO;QAAYC,OAAO;IAAW;IACvC;QAAED,OAAO;QAAaC,OAAO;IAAY;IACzC;QAAED,OAAO;QAAQC,OAAO;IAAO;IAC/B;QAAED,OAAO;QAAWC,OAAO;IAAU;IACrC;QAAED,OAAO;QAASC,OAAO;IAAQ;IACjC;QAAED,OAAO;QAAQC,OAAO;IAAO;IAC/B;QAAED,OAAO;QAAUC,OAAO;IAAS;IACnC;QAAED,OAAO;QAASC,OAAO;IAAQ;IACjC;QAAED,OAAO;QAAYC,OAAO;IAAW;IACvC;QAAED,OAAO;QAAaC,OAAO;IAAY;IACzC;QAAED,OAAO;QAAUC,OAAO;IAAS;IACnC;QAAED,OAAO;QAAUC,OAAO;IAAS;IACnC;QAAED,OAAO;QAAgBC,OAAO;IAAe;IAC/C;QAAED,OAAO;QAASC,OAAO;IAAQ;IACjC;QAAED,OAAO;QAAQC,OAAO;IAAO;IAC/B;QAAED,OAAO;QAAaC,OAAO;IAAY;IACzC;QAAED,OAAO;QAAaC,OAAO;IAAY;IACzC;QAAED,OAAO;QAAQC,OAAO;IAAO;IAC/B;QAAED,OAAO;QAAeC,OAAO;IAAc;IAC7C;QAAED,OAAO;QAAaC,OAAO;IAAY;IACzC;QAAED,OAAO;QAAcC,OAAO;IAAa;IAC3C;QAAED,OAAO;QAAaC,OAAO;IAAY;IACzC;QAAED,OAAO;QAAcC,OAAO;IAAa;IAC3C;QAAED,OAAO;QAAaC,OAAO;IAAY;IACzC;QAAED,OAAO;QAAcC,OAAO;IAAa;CAC5C;AAEM,MAAMJ,gBAAgB;IAC3B;QACEK,SAAS;QACTC,SAAS;YACP;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;IACH;IACA;QACED,SAAS;QACTC,SAAS;YACP;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;IACH;CACD;AAEM,MAAMJ,YAAY;IACvB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./Combobox"), exports);
6
+ _export_star(require("./types"), exports);
7
+ function _export_star(from, to) {
8
+ Object.keys(from).forEach(function(k) {
9
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
10
+ Object.defineProperty(to, k, {
11
+ enumerable: true,
12
+ get: function() {
13
+ return from[k];
14
+ }
15
+ });
16
+ }
17
+ });
18
+ return from;
19
+ }
20
+
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/Combobox/index.tsx"],"sourcesContent":["export * from \"./Combobox\";\nexport * from \"./types\";\n"],"names":[],"mappings":";;;;qBAAc;qBACA"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/Combobox/types.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useComboboxHighlight", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return useComboboxHighlight;
9
+ }
10
+ });
11
+ const _react = require("react");
12
+ const _utils = require("./utils");
13
+ function useComboboxHighlight(options) {
14
+ const [highlightedIndex, setHighlightedIndex] = (0, _react.useState)(options.length ? 0 : -1);
15
+ const [highlightedGroupIndex, setHighlightedGroupIndex] = (0, _react.useState)(0);
16
+ function highlightNextOption() {
17
+ const isGroup = (0, _utils.isOptionGroup)(options);
18
+ if (isGroup) {
19
+ const group = options[highlightedGroupIndex];
20
+ if (highlightedIndex === group.options.length - 1) {
21
+ if (highlightedGroupIndex === options.length - 1) {
22
+ return; // At the end of last group
23
+ }
24
+ // Move to next group
25
+ setHighlightedIndex(0);
26
+ setHighlightedGroupIndex(highlightedGroupIndex + 1);
27
+ } else {
28
+ setHighlightedIndex(highlightedIndex + 1);
29
+ }
30
+ } else {
31
+ if (highlightedIndex === options.length - 1) {
32
+ return; // At the end of options
33
+ }
34
+ setHighlightedIndex(highlightedIndex + 1);
35
+ }
36
+ }
37
+ function highlightPreviousOption() {
38
+ const isGroup = (0, _utils.isOptionGroup)(options);
39
+ if (highlightedIndex === 0 && highlightedGroupIndex === 0) {
40
+ return; // Already at start
41
+ }
42
+ if (isGroup) {
43
+ if (highlightedIndex === 0) {
44
+ // Move to previous group
45
+ const prevGroupIndex = highlightedGroupIndex - 1;
46
+ const prevGroup = options[prevGroupIndex];
47
+ setHighlightedGroupIndex(prevGroupIndex);
48
+ setHighlightedIndex(prevGroup.options.length - 1);
49
+ } else {
50
+ setHighlightedIndex(highlightedIndex - 1);
51
+ }
52
+ } else {
53
+ setHighlightedIndex(highlightedIndex - 1);
54
+ }
55
+ }
56
+ function highlightFirstOption() {
57
+ setHighlightedIndex(0);
58
+ setHighlightedGroupIndex(0);
59
+ }
60
+ function highlightLastOption() {
61
+ const isGroup = (0, _utils.isOptionGroup)(options);
62
+ if (isGroup) {
63
+ const lastGroupIndex = options.length - 1;
64
+ const lastGroup = options[lastGroupIndex];
65
+ setHighlightedGroupIndex(lastGroupIndex);
66
+ setHighlightedIndex(lastGroup.options.length - 1);
67
+ } else {
68
+ setHighlightedIndex(options.length - 1);
69
+ }
70
+ }
71
+ const clearHighlight = ()=>{
72
+ setHighlightedIndex(options.length ? 0 : -1);
73
+ setHighlightedGroupIndex(0);
74
+ };
75
+ return {
76
+ highlightedIndex,
77
+ highlightedGroupIndex,
78
+ highlightPreviousOption,
79
+ highlightNextOption,
80
+ highlightFirstOption,
81
+ highlightLastOption,
82
+ clearHighlight
83
+ };
84
+ }
85
+
86
+ //# sourceMappingURL=useComboboxHighlight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/Combobox/useComboboxHighlight.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { ComboboxOptions } from \"./types\";\nimport { isOptionGroup } from \"./utils\";\n\nexport function useComboboxHighlight(options: ComboboxOptions) {\n const [highlightedIndex, setHighlightedIndex] = useState(\n options.length ? 0 : -1,\n );\n const [highlightedGroupIndex, setHighlightedGroupIndex] = useState(0);\n\n function highlightNextOption() {\n const isGroup = isOptionGroup(options);\n\n if (isGroup) {\n const group = options[highlightedGroupIndex];\n if (highlightedIndex === group.options.length - 1) {\n if (highlightedGroupIndex === options.length - 1) {\n return; // At the end of last group\n }\n // Move to next group\n setHighlightedIndex(0);\n setHighlightedGroupIndex(highlightedGroupIndex + 1);\n } else {\n setHighlightedIndex(highlightedIndex + 1);\n }\n } else {\n if (highlightedIndex === options.length - 1) {\n return; // At the end of options\n }\n setHighlightedIndex(highlightedIndex + 1);\n }\n }\n\n function highlightPreviousOption() {\n const isGroup = isOptionGroup(options);\n\n if (highlightedIndex === 0 && highlightedGroupIndex === 0) {\n return; // Already at start\n }\n\n if (isGroup) {\n if (highlightedIndex === 0) {\n // Move to previous group\n const prevGroupIndex = highlightedGroupIndex - 1;\n const prevGroup = options[prevGroupIndex];\n setHighlightedGroupIndex(prevGroupIndex);\n setHighlightedIndex(prevGroup.options.length - 1);\n } else {\n setHighlightedIndex(highlightedIndex - 1);\n }\n } else {\n setHighlightedIndex(highlightedIndex - 1);\n }\n }\n\n function highlightFirstOption() {\n setHighlightedIndex(0);\n setHighlightedGroupIndex(0);\n }\n\n function highlightLastOption() {\n const isGroup = isOptionGroup(options);\n\n if (isGroup) {\n const lastGroupIndex = options.length - 1;\n const lastGroup = options[lastGroupIndex];\n setHighlightedGroupIndex(lastGroupIndex);\n setHighlightedIndex(lastGroup.options.length - 1);\n } else {\n setHighlightedIndex(options.length - 1);\n }\n }\n\n const clearHighlight = () => {\n setHighlightedIndex(options.length ? 0 : -1);\n setHighlightedGroupIndex(0);\n };\n\n return {\n highlightedIndex,\n highlightedGroupIndex,\n highlightPreviousOption,\n highlightNextOption,\n highlightFirstOption,\n highlightLastOption,\n clearHighlight,\n };\n}\n"],"names":["useComboboxHighlight","options","highlightedIndex","setHighlightedIndex","useState","length","highlightedGroupIndex","setHighlightedGroupIndex","highlightNextOption","isGroup","isOptionGroup","group","highlightPreviousOption","prevGroupIndex","prevGroup","highlightFirstOption","highlightLastOption","lastGroupIndex","lastGroup","clearHighlight"],"mappings":";;;;+BAIgBA;;;eAAAA;;;uBAJS;uBAEK;AAEvB,SAASA,qBAAqBC,OAAwB;IAC3D,MAAM,CAACC,kBAAkBC,oBAAoB,GAAGC,IAAAA,eAAQ,EACtDH,QAAQI,MAAM,GAAG,IAAI,CAAC;IAExB,MAAM,CAACC,uBAAuBC,yBAAyB,GAAGH,IAAAA,eAAQ,EAAC;IAEnE,SAASI;QACP,MAAMC,UAAUC,IAAAA,oBAAa,EAACT;QAE9B,IAAIQ,SAAS;YACX,MAAME,QAAQV,OAAO,CAACK,sBAAsB;YAC5C,IAAIJ,qBAAqBS,MAAMV,OAAO,CAACI,MAAM,GAAG,GAAG;gBACjD,IAAIC,0BAA0BL,QAAQI,MAAM,GAAG,GAAG;oBAChD,QAAQ,2BAA2B;gBACrC;gBACA,qBAAqB;gBACrBF,oBAAoB;gBACpBI,yBAAyBD,wBAAwB;YACnD,OAAO;gBACLH,oBAAoBD,mBAAmB;YACzC;QACF,OAAO;YACL,IAAIA,qBAAqBD,QAAQI,MAAM,GAAG,GAAG;gBAC3C,QAAQ,wBAAwB;YAClC;YACAF,oBAAoBD,mBAAmB;QACzC;IACF;IAEA,SAASU;QACP,MAAMH,UAAUC,IAAAA,oBAAa,EAACT;QAE9B,IAAIC,qBAAqB,KAAKI,0BAA0B,GAAG;YACzD,QAAQ,mBAAmB;QAC7B;QAEA,IAAIG,SAAS;YACX,IAAIP,qBAAqB,GAAG;gBAC1B,yBAAyB;gBACzB,MAAMW,iBAAiBP,wBAAwB;gBAC/C,MAAMQ,YAAYb,OAAO,CAACY,eAAe;gBACzCN,yBAAyBM;gBACzBV,oBAAoBW,UAAUb,OAAO,CAACI,MAAM,GAAG;YACjD,OAAO;gBACLF,oBAAoBD,mBAAmB;YACzC;QACF,OAAO;YACLC,oBAAoBD,mBAAmB;QACzC;IACF;IAEA,SAASa;QACPZ,oBAAoB;QACpBI,yBAAyB;IAC3B;IAEA,SAASS;QACP,MAAMP,UAAUC,IAAAA,oBAAa,EAACT;QAE9B,IAAIQ,SAAS;YACX,MAAMQ,iBAAiBhB,QAAQI,MAAM,GAAG;YACxC,MAAMa,YAAYjB,OAAO,CAACgB,eAAe;YACzCV,yBAAyBU;YACzBd,oBAAoBe,UAAUjB,OAAO,CAACI,MAAM,GAAG;QACjD,OAAO;YACLF,oBAAoBF,QAAQI,MAAM,GAAG;QACvC;IACF;IAEA,MAAMc,iBAAiB;QACrBhB,oBAAoBF,QAAQI,MAAM,GAAG,IAAI,CAAC;QAC1CE,yBAAyB;IAC3B;IAEA,OAAO;QACLL;QACAI;QACAM;QACAJ;QACAO;QACAC;QACAG;IACF;AACF"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ clamp: function() {
13
+ return clamp;
14
+ },
15
+ filterOptions: function() {
16
+ return filterOptions;
17
+ },
18
+ getOptionLabel: function() {
19
+ return getOptionLabel;
20
+ },
21
+ getOptionValue: function() {
22
+ return getOptionValue;
23
+ },
24
+ isOptionGroup: function() {
25
+ return isOptionGroup;
26
+ }
27
+ });
28
+ function isOptionGroup(options) {
29
+ return typeof options[0] === "object" && "options" in options[0] && options[0].options !== undefined && "heading" in options[0] && options[0].heading !== undefined;
30
+ }
31
+ const getOptionValue = (option)=>typeof option === "string" ? option : option === null || option === void 0 ? void 0 : option.value;
32
+ const getOptionLabel = (option)=>typeof option === "string" ? option : option === null || option === void 0 ? void 0 : option.label;
33
+ function filterOptions(options, inputValue) {
34
+ if (isOptionGroup(options)) {
35
+ return options.map((optionGroup)=>({
36
+ ...optionGroup,
37
+ options: optionGroup.options.filter((option)=>getOptionLabel(option).toLowerCase().includes(inputValue.toLowerCase()))
38
+ })).filter((optionGroup)=>optionGroup.options.length > 0);
39
+ }
40
+ return options.filter((option)=>getOptionLabel(option).toLowerCase().includes(inputValue.toLowerCase()));
41
+ }
42
+ function clamp(value, min, max) {
43
+ return Math.min(Math.max(value, min), max);
44
+ }
45
+
46
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/Combobox/utils.tsx"],"sourcesContent":["import type {\n ComboboxOption,\n ComboboxOptionGroup,\n ComboboxOptions,\n} from \"./types\";\n\n// FIXME: This might be better handled with Zod\nexport function isOptionGroup(\n options: ComboboxOptions,\n): options is ComboboxOptionGroup[] {\n return (\n typeof options[0] === \"object\" &&\n \"options\" in options[0] &&\n options[0].options !== undefined &&\n \"heading\" in options[0] &&\n options[0].heading !== undefined\n );\n}\n\nexport const getOptionValue = (option: ComboboxOption | undefined) =>\n typeof option === \"string\" ? option : option?.value;\n\nexport const getOptionLabel = (option: ComboboxOption | undefined) =>\n typeof option === \"string\" ? option : option?.label;\n\nexport function filterOptions(\n options: ComboboxOptions,\n inputValue: string,\n): ComboboxOptions {\n if (isOptionGroup(options)) {\n return options\n .map(optionGroup => ({\n ...optionGroup,\n options: optionGroup.options.filter(option =>\n getOptionLabel(option)!\n .toLowerCase()\n .includes(inputValue.toLowerCase()),\n ),\n }))\n .filter(optionGroup => optionGroup.options.length > 0);\n }\n\n return options.filter(option =>\n getOptionLabel(option)!.toLowerCase().includes(inputValue.toLowerCase()),\n );\n}\n\nexport function clamp(value: number, min: number, max: number) {\n return Math.min(Math.max(value, min), max);\n}\n"],"names":["clamp","filterOptions","getOptionLabel","getOptionValue","isOptionGroup","options","undefined","heading","option","value","label","inputValue","map","optionGroup","filter","toLowerCase","includes","length","min","max","Math"],"mappings":";;;;;;;;;;;IA+CgBA,KAAK;eAALA;;IAtBAC,aAAa;eAAbA;;IAHHC,cAAc;eAAdA;;IAHAC,cAAc;eAAdA;;IAZGC,aAAa;eAAbA;;;AAAT,SAASA,cACdC,OAAwB;IAExB,OACE,OAAOA,OAAO,CAAC,EAAE,KAAK,YACtB,aAAaA,OAAO,CAAC,EAAE,IACvBA,OAAO,CAAC,EAAE,CAACA,OAAO,KAAKC,aACvB,aAAaD,OAAO,CAAC,EAAE,IACvBA,OAAO,CAAC,EAAE,CAACE,OAAO,KAAKD;AAE3B;AAEO,MAAMH,iBAAiB,CAACK,SAC7B,OAAOA,WAAW,WAAWA,SAASA,mBAAAA,6BAAAA,OAAQC,KAAK;AAE9C,MAAMP,iBAAiB,CAACM,SAC7B,OAAOA,WAAW,WAAWA,SAASA,mBAAAA,6BAAAA,OAAQE,KAAK;AAE9C,SAAST,cACdI,OAAwB,EACxBM,UAAkB;IAElB,IAAIP,cAAcC,UAAU;QAC1B,OAAOA,QACJO,GAAG,CAACC,CAAAA,cAAgB,CAAA;gBACnB,GAAGA,WAAW;gBACdR,SAASQ,YAAYR,OAAO,CAACS,MAAM,CAACN,CAAAA,SAClCN,eAAeM,QACZO,WAAW,GACXC,QAAQ,CAACL,WAAWI,WAAW;YAEtC,CAAA,GACCD,MAAM,CAACD,CAAAA,cAAeA,YAAYR,OAAO,CAACY,MAAM,GAAG;IACxD;IAEA,OAAOZ,QAAQS,MAAM,CAACN,CAAAA,SACpBN,eAAeM,QAASO,WAAW,GAAGC,QAAQ,CAACL,WAAWI,WAAW;AAEzE;AAEO,SAASf,MAAMS,KAAa,EAAES,GAAW,EAAEC,GAAW;IAC3D,OAAOC,KAAKF,GAAG,CAACE,KAAKD,GAAG,CAACV,OAAOS,MAAMC;AACxC"}
@@ -10,13 +10,13 @@ Object.defineProperty(exports, "TextArea", {
10
10
  }
11
11
  });
12
12
  const _jsxruntime = require("react/jsx-runtime");
13
- const _react = require("react");
14
13
  const _dedupe = /*#__PURE__*/ _interop_require_default(require("classnames/dedupe"));
15
- const _TextAreaInput = require("../TextAreaInput");
16
- const _Label = require("../Label");
17
- const _ErrorMessage = require("../ErrorMessage");
14
+ const _react = require("react");
18
15
  const _hooks = require("../../hooks");
16
+ const _ErrorMessage = require("../ErrorMessage");
17
+ const _Label = require("../Label");
19
18
  const _Stack = require("../Stack");
19
+ const _TextAreaInput = require("../TextAreaInput");
20
20
  function _interop_require_default(obj) {
21
21
  return obj && obj.__esModule ? obj : {
22
22
  default: obj
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["\"use client\";\n\nimport { Ref, forwardRef, RefAttributes } from \"react\";\nimport classNames from \"classnames/dedupe\";\nimport { DOMProps } from \"../../types/dom\";\nimport { TextAreaInput } from \"../TextAreaInput\";\nimport { Label } from \"../Label\";\nimport { ForwardedRefComponent } from \"../../types/components\";\nimport { ErrorMessage } from \"../ErrorMessage\";\nimport {\n UseTextFieldProps,\n useTextField,\n useValidationClasses,\n} from \"../../hooks\";\nimport { Stack } from \"../Stack\";\n\nexport type TextAreaElementType = HTMLTextAreaElement;\n\nexport interface TextAreaProps\n extends UseTextFieldProps,\n DOMProps,\n RefAttributes<TextAreaElementType> {\n className?: string;\n errorMessage?: string;\n}\n\nexport type TextAreaRef = Ref<TextAreaElementType>;\n\nconst TextArea: ForwardedRefComponent<TextAreaProps, TextAreaElementType> =\n forwardRef((props: TextAreaProps, ref: TextAreaRef) => {\n const {\n isDisabled,\n className,\n errorMessage,\n label,\n validationState,\n isInvalid,\n ...otherProps\n } = props;\n\n const { inputProps, labelProps, errorMessageProps } = useTextField(props);\n\n // Set class name for atom, including interaction state\n const classes = classNames(\"mobius\", \"mobius-text-area\", className);\n const validationClasses = useValidationClasses({\n validationState,\n isInvalid,\n });\n const inputClasses = classNames(\n \"mobius-text-area__input\",\n validationClasses,\n );\n const labelClasses = classNames(\n {\n \"--is-disabled\": isDisabled,\n },\n validationClasses,\n );\n\n return (\n <Stack className={classes} gap=\"xs\">\n {label && (\n <Label {...labelProps} className={labelClasses}>\n {props.label}\n </Label>\n )}\n <TextAreaInput\n {...otherProps}\n {...inputProps}\n ref={ref}\n className={inputClasses}\n isDisabled={isDisabled}\n aria-invalid={errorMessage != null}\n />\n <ErrorMessage {...errorMessageProps} errorMessage={errorMessage} />\n </Stack>\n );\n });\n\nTextArea.displayName = \"TextArea\";\nexport { TextArea };\n"],"names":["TextArea","forwardRef","props","ref","isDisabled","className","errorMessage","label","validationState","isInvalid","otherProps","inputProps","labelProps","errorMessageProps","useTextField","classes","classNames","validationClasses","useValidationClasses","inputClasses","labelClasses","Stack","gap","Label","TextAreaInput","aria-invalid","ErrorMessage","displayName"],"mappings":"AAAA;;;;;+BAgFSA;;;eAAAA;;;;uBA9EsC;+DACxB;+BAEO;uBACR;8BAEO;uBAKtB;uBACe;;;;;;AActB,MAAMA,yBACJC,IAAAA,iBAAU,EAAC,CAACC,OAAsBC;IAChC,MAAM,EACJC,UAAU,EACVC,SAAS,EACTC,YAAY,EACZC,KAAK,EACLC,eAAe,EACfC,SAAS,EACT,GAAGC,YACJ,GAAGR;IAEJ,MAAM,EAAES,UAAU,EAAEC,UAAU,EAAEC,iBAAiB,EAAE,GAAGC,IAAAA,mBAAY,EAACZ;IAEnE,uDAAuD;IACvD,MAAMa,UAAUC,IAAAA,eAAU,EAAC,UAAU,oBAAoBX;IACzD,MAAMY,oBAAoBC,IAAAA,2BAAoB,EAAC;QAC7CV;QACAC;IACF;IACA,MAAMU,eAAeH,IAAAA,eAAU,EAC7B,2BACAC;IAEF,MAAMG,eAAeJ,IAAAA,eAAU,EAC7B;QACE,iBAAiBZ;IACnB,GACAa;IAGF,qBACE,sBAACI,YAAK;QAAChB,WAAWU;QAASO,KAAI;;YAC5Bf,uBACC,qBAACgB,YAAK;gBAAE,GAAGX,UAAU;gBAAEP,WAAWe;0BAC/BlB,MAAMK,KAAK;;0BAGhB,qBAACiB,4BAAa;gBACX,GAAGd,UAAU;gBACb,GAAGC,UAAU;gBACdR,KAAKA;gBACLE,WAAWc;gBACXf,YAAYA;gBACZqB,gBAAcnB,gBAAgB;;0BAEhC,qBAACoB,0BAAY;gBAAE,GAAGb,iBAAiB;gBAAEP,cAAcA;;;;AAGzD;AAEFN,SAAS2B,WAAW,GAAG"}
1
+ {"version":3,"sources":["../../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["\"use client\";\n\nimport classNames from \"classnames/dedupe\";\nimport { Ref, RefAttributes, forwardRef } from \"react\";\nimport {\n UseTextFieldProps,\n useTextField,\n useValidationClasses,\n} from \"../../hooks\";\nimport { ForwardedRefComponent } from \"../../types/components\";\nimport { DOMProps } from \"../../types/dom\";\nimport { ErrorMessage } from \"../ErrorMessage\";\nimport { Label } from \"../Label\";\nimport { Stack } from \"../Stack\";\nimport { TextAreaInput } from \"../TextAreaInput\";\n\nexport type TextAreaElementType = HTMLTextAreaElement;\n\nexport interface TextAreaProps\n extends UseTextFieldProps,\n DOMProps,\n RefAttributes<TextAreaElementType> {\n className?: string;\n errorMessage?: string;\n}\n\nexport type TextAreaRef = Ref<TextAreaElementType>;\n\nconst TextArea: ForwardedRefComponent<TextAreaProps, TextAreaElementType> =\n forwardRef((props: TextAreaProps, ref: TextAreaRef) => {\n const {\n isDisabled,\n className,\n errorMessage,\n label,\n validationState,\n isInvalid,\n ...otherProps\n } = props;\n\n const { inputProps, labelProps, errorMessageProps } = useTextField(props);\n\n // Set class name for atom, including interaction state\n const classes = classNames(\"mobius\", \"mobius-text-area\", className);\n const validationClasses = useValidationClasses({\n validationState,\n isInvalid,\n });\n const inputClasses = classNames(\n \"mobius-text-area__input\",\n validationClasses,\n );\n const labelClasses = classNames(\n {\n \"--is-disabled\": isDisabled,\n },\n validationClasses,\n );\n\n return (\n <Stack className={classes} gap=\"xs\">\n {label && (\n <Label {...labelProps} className={labelClasses}>\n {props.label}\n </Label>\n )}\n <TextAreaInput\n {...otherProps}\n {...inputProps}\n ref={ref}\n className={inputClasses}\n isDisabled={isDisabled}\n aria-invalid={errorMessage != null}\n />\n <ErrorMessage {...errorMessageProps} errorMessage={errorMessage} />\n </Stack>\n );\n });\n\nTextArea.displayName = \"TextArea\";\nexport { TextArea };\n"],"names":["TextArea","forwardRef","props","ref","isDisabled","className","errorMessage","label","validationState","isInvalid","otherProps","inputProps","labelProps","errorMessageProps","useTextField","classes","classNames","validationClasses","useValidationClasses","inputClasses","labelClasses","Stack","gap","Label","TextAreaInput","aria-invalid","ErrorMessage","displayName"],"mappings":"AAAA;;;;;+BAgFSA;;;eAAAA;;;;+DA9Ec;uBACwB;uBAKxC;8BAGsB;uBACP;uBACA;+BACQ;;;;;;AAc9B,MAAMA,yBACJC,IAAAA,iBAAU,EAAC,CAACC,OAAsBC;IAChC,MAAM,EACJC,UAAU,EACVC,SAAS,EACTC,YAAY,EACZC,KAAK,EACLC,eAAe,EACfC,SAAS,EACT,GAAGC,YACJ,GAAGR;IAEJ,MAAM,EAAES,UAAU,EAAEC,UAAU,EAAEC,iBAAiB,EAAE,GAAGC,IAAAA,mBAAY,EAACZ;IAEnE,uDAAuD;IACvD,MAAMa,UAAUC,IAAAA,eAAU,EAAC,UAAU,oBAAoBX;IACzD,MAAMY,oBAAoBC,IAAAA,2BAAoB,EAAC;QAC7CV;QACAC;IACF;IACA,MAAMU,eAAeH,IAAAA,eAAU,EAC7B,2BACAC;IAEF,MAAMG,eAAeJ,IAAAA,eAAU,EAC7B;QACE,iBAAiBZ;IACnB,GACAa;IAGF,qBACE,sBAACI,YAAK;QAAChB,WAAWU;QAASO,KAAI;;YAC5Bf,uBACC,qBAACgB,YAAK;gBAAE,GAAGX,UAAU;gBAAEP,WAAWe;0BAC/BlB,MAAMK,KAAK;;0BAGhB,qBAACiB,4BAAa;gBACX,GAAGd,UAAU;gBACb,GAAGC,UAAU;gBACdR,KAAKA;gBACLE,WAAWc;gBACXf,YAAYA;gBACZqB,gBAAcnB,gBAAgB;;0BAEhC,qBAACoB,0BAAY;gBAAE,GAAGb,iBAAiB;gBAAEP,cAAcA;;;;AAGzD;AAEFN,SAAS2B,WAAW,GAAG"}
@@ -9,8 +9,8 @@ Object.defineProperty(exports, "TextAreaInput", {
9
9
  }
10
10
  });
11
11
  const _jsxruntime = require("react/jsx-runtime");
12
- const _react = require("react");
13
12
  const _dedupe = /*#__PURE__*/ _interop_require_default(require("classnames/dedupe"));
13
+ const _react = require("react");
14
14
  function _interop_require_default(obj) {
15
15
  return obj && obj.__esModule ? obj : {
16
16
  default: obj
@@ -18,14 +18,17 @@ function _interop_require_default(obj) {
18
18
  }
19
19
  const TextAreaInput = /*#__PURE__*/ (0, _react.forwardRef)((props, ref)=>{
20
20
  // Extract interaction props:
21
- const { isSelected, isDisabled, ...otherProps } = props;
21
+ const { isSelected, isDisabled, isReadOnly, isRequired, ...otherProps } = props;
22
22
  const classes = (0, _dedupe.default)("mobius", "mobius-text-area__input", {
23
23
  "--is-disabled": isDisabled,
24
- "--is-selected": isSelected
24
+ "--is-selected": isSelected,
25
+ "--is-required": isRequired
25
26
  }, otherProps.className);
26
27
  return /*#__PURE__*/ (0, _jsxruntime.jsx)("textarea", {
27
28
  ref: ref,
28
29
  ...otherProps,
30
+ required: isRequired,
31
+ readOnly: isReadOnly,
29
32
  className: classes
30
33
  });
31
34
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/TextAreaInput/TextAreaInput.tsx"],"sourcesContent":["import { Ref, forwardRef, RefAttributes } from \"react\";\nimport classNames from \"classnames/dedupe\";\nimport { DOMProps } from \"../../types/dom\";\nimport { ForwardedRefComponent } from \"../../types/components\";\n\nexport type TextAreaInputElementType = HTMLTextAreaElement;\n\nexport interface InteractionStateProps {\n isSelected?: boolean;\n isDisabled?: boolean;\n}\n\nexport interface TextAreaInputProps\n extends DOMProps,\n InteractionStateProps,\n RefAttributes<TextAreaInputElementType> {\n className?: string;\n}\n\nexport type TextAreaInputRef = Ref<TextAreaInputElementType>;\n\nconst TextAreaInput: ForwardedRefComponent<\n TextAreaInputProps,\n TextAreaInputElementType\n> = forwardRef((props: TextAreaInputProps, ref: TextAreaInputRef) => {\n // Extract interaction props:\n const { isSelected, isDisabled, ...otherProps } = props;\n\n const classes = classNames(\n \"mobius\",\n \"mobius-text-area__input\",\n {\n \"--is-disabled\": isDisabled,\n \"--is-selected\": isSelected,\n },\n otherProps.className,\n );\n\n return <textarea ref={ref} {...otherProps} className={classes} />;\n});\n\nTextAreaInput.displayName = \"TextAreaInput\";\nexport { TextAreaInput };\n"],"names":["TextAreaInput","forwardRef","props","ref","isSelected","isDisabled","otherProps","classes","classNames","className","textarea","displayName"],"mappings":";;;;+BA0CSA;;;eAAAA;;;;uBA1CsC;+DACxB;;;;;;AAoBvB,MAAMA,8BAGFC,IAAAA,iBAAU,EAAC,CAACC,OAA2BC;IACzC,6BAA6B;IAC7B,MAAM,EAAEC,UAAU,EAAEC,UAAU,EAAE,GAAGC,YAAY,GAAGJ;IAElD,MAAMK,UAAUC,IAAAA,eAAU,EACxB,UACA,2BACA;QACE,iBAAiBH;QACjB,iBAAiBD;IACnB,GACAE,WAAWG,SAAS;IAGtB,qBAAO,qBAACC;QAASP,KAAKA;QAAM,GAAGG,UAAU;QAAEG,WAAWF;;AACxD;AAEAP,cAAcW,WAAW,GAAG"}
1
+ {"version":3,"sources":["../../../../src/components/TextAreaInput/TextAreaInput.tsx"],"sourcesContent":["import classNames from \"classnames/dedupe\";\nimport { forwardRef, Ref, RefAttributes } from \"react\";\nimport { ForwardedRefComponent } from \"../../types/components\";\nimport { DOMProps } from \"../../types/dom\";\n\nexport type TextAreaInputElementType = HTMLTextAreaElement;\n\nexport interface InteractionStateProps {\n isSelected?: boolean;\n isDisabled?: boolean;\n}\n\nexport interface TextAreaInputProps\n extends DOMProps,\n InteractionStateProps,\n RefAttributes<TextAreaInputElementType> {\n className?: string;\n isReadOnly?: boolean;\n isRequired?: boolean;\n}\n\nexport type TextAreaInputRef = Ref<TextAreaInputElementType>;\n\nconst TextAreaInput: ForwardedRefComponent<\n TextAreaInputProps,\n TextAreaInputElementType\n> = forwardRef((props: TextAreaInputProps, ref: TextAreaInputRef) => {\n // Extract interaction props:\n const { isSelected, isDisabled, isReadOnly, isRequired, ...otherProps } =\n props;\n\n const classes = classNames(\n \"mobius\",\n \"mobius-text-area__input\",\n {\n \"--is-disabled\": isDisabled,\n \"--is-selected\": isSelected,\n \"--is-required\": isRequired,\n },\n otherProps.className,\n );\n\n return (\n <textarea\n ref={ref}\n {...otherProps}\n required={isRequired}\n readOnly={isReadOnly}\n className={classes}\n />\n );\n});\n\nTextAreaInput.displayName = \"TextAreaInput\";\nexport { TextAreaInput };\n"],"names":["TextAreaInput","forwardRef","props","ref","isSelected","isDisabled","isReadOnly","isRequired","otherProps","classes","classNames","className","textarea","required","readOnly","displayName"],"mappings":";;;;+BAsDSA;;;eAAAA;;;;+DAtDc;uBACwB;;;;;;AAsB/C,MAAMA,8BAGFC,IAAAA,iBAAU,EAAC,CAACC,OAA2BC;IACzC,6BAA6B;IAC7B,MAAM,EAAEC,UAAU,EAAEC,UAAU,EAAEC,UAAU,EAAEC,UAAU,EAAE,GAAGC,YAAY,GACrEN;IAEF,MAAMO,UAAUC,IAAAA,eAAU,EACxB,UACA,2BACA;QACE,iBAAiBL;QACjB,iBAAiBD;QACjB,iBAAiBG;IACnB,GACAC,WAAWG,SAAS;IAGtB,qBACE,qBAACC;QACCT,KAAKA;QACJ,GAAGK,UAAU;QACdK,UAAUN;QACVO,UAAUR;QACVK,WAAWF;;AAGjB;AAEAT,cAAce,WAAW,GAAG"}