tw-react-components 0.0.187 → 0.0.191
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.
- package/README.md +1 -1
- package/index.css +2 -2
- package/index.esm.js +475 -490
- package/package.json +1 -1
- package/src/components/Card/index.d.ts +30 -3
- package/src/components/Form/controls/primitive/BasicInput.d.ts +0 -1
- package/src/components/Form/controls/with-form.d.ts +1 -0
- package/src/components/Spinner/index.d.ts +1 -0
- package/src/components/types.d.ts +1 -1
package/index.esm.js
CHANGED
|
@@ -166,471 +166,410 @@ const Accordion = Object.assign($Accordion, {
|
|
|
166
166
|
Content: AccordionContent,
|
|
167
167
|
});
|
|
168
168
|
|
|
169
|
-
const
|
|
170
|
-
var { children, className, centered, container, fullWidth, fullHeight, dataTestId = 'block' } = _a, props = __rest(_a, ["children", "className", "centered", "container", "fullWidth", "fullHeight", "dataTestId"]);
|
|
171
|
-
return (jsx("div", Object.assign({ "data-testid": dataTestId, className: cn(centered && 'mx-auto', container && 'container', fullWidth && 'w-full', fullHeight && 'h-full', className) }, props, { children: children })));
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
const directionClasses = {
|
|
175
|
-
row: {
|
|
176
|
-
normal: 'flex-row',
|
|
177
|
-
reverse: 'flex-row-reverse',
|
|
178
|
-
},
|
|
179
|
-
column: {
|
|
180
|
-
normal: 'flex-col',
|
|
181
|
-
reverse: 'flex-col-reverse',
|
|
182
|
-
},
|
|
183
|
-
};
|
|
184
|
-
const alignClasses = {
|
|
185
|
-
start: 'items-start',
|
|
186
|
-
center: 'items-center',
|
|
187
|
-
end: 'items-end',
|
|
188
|
-
};
|
|
189
|
-
const justifyClasses = {
|
|
190
|
-
start: 'justify-start',
|
|
191
|
-
center: 'justify-center',
|
|
192
|
-
between: 'justify-between',
|
|
193
|
-
end: 'justify-end',
|
|
194
|
-
};
|
|
195
|
-
const Flex = (_a) => {
|
|
196
|
-
var { children, className, reverse, wrap, direction = 'row', align = 'start', justify = 'start', dataTestId = 'flex' } = _a, blockProps = __rest(_a, ["children", "className", "reverse", "wrap", "direction", "align", "justify", "dataTestId"]);
|
|
197
|
-
return (jsx(Block, Object.assign({ className: cn('flex gap-2', wrap && 'flex-wrap', directionClasses[direction][reverse ? 'reverse' : 'normal'], alignClasses[align], justifyClasses[justify], className), dataTestId: dataTestId }, blockProps, { children: children })));
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
const Spinner = ({ className, fullScreen, dataTestId = 'spinner' }) => (jsx("div", { className: cn('flex w-full items-center justify-center bg-white dark:bg-slate-900', {
|
|
169
|
+
const Spinner = ({ className, spinnerClassName, fullScreen, dataTestId = 'spinner', }) => (jsx("div", { className: cn('flex w-full items-center justify-center bg-white dark:bg-slate-900', {
|
|
201
170
|
'h-screen': fullScreen,
|
|
202
171
|
'h-full': !fullScreen,
|
|
203
|
-
}, className), "data-testid": dataTestId, children: jsxs("svg", { className:
|
|
172
|
+
}, className), "data-testid": dataTestId, children: jsxs("svg", { className: cn('h-8 w-8 animate-spin text-black dark:text-white', spinnerClassName), fill: "none", viewBox: "0 0 24 24", children: [jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }) }));
|
|
204
173
|
|
|
205
174
|
const variantClassNames = {
|
|
206
175
|
filled: {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
176
|
+
base: 'shadow-xs',
|
|
177
|
+
colors: {
|
|
178
|
+
primary: {
|
|
179
|
+
base: 'bg-primary text-primary-foreground',
|
|
180
|
+
hover: 'hover:bg-primary/90',
|
|
181
|
+
focus: 'focus:bg-primary/90',
|
|
182
|
+
active: 'active:bg-primary/90',
|
|
183
|
+
},
|
|
184
|
+
secondary: {
|
|
185
|
+
base: 'bg-secondary text-secondary-foreground',
|
|
186
|
+
hover: 'hover:bg-secondary/80',
|
|
187
|
+
focus: 'focus:bg-secondary/80',
|
|
188
|
+
active: 'active:bg-secondary/80',
|
|
189
|
+
},
|
|
190
|
+
slate: {
|
|
191
|
+
base: 'bg-slate-100 dark:bg-slate-900/70',
|
|
192
|
+
hover: 'hover:bg-slate-200 dark:hover:bg-slate-700',
|
|
193
|
+
focus: 'focus:bg-slate-200 dark:focus:bg-slate-700',
|
|
194
|
+
active: 'active:bg-slate-300 dark:active:bg-slate-800/50',
|
|
195
|
+
},
|
|
196
|
+
gray: {
|
|
197
|
+
base: 'text-white bg-gray-500 dark:bg-gray-600',
|
|
198
|
+
hover: 'hover:bg-gray-400 dark:hover:bg-gray-500',
|
|
199
|
+
focus: 'focus:bg-gray-400 dark:focus:bg-gray-500',
|
|
200
|
+
active: 'active:bg-gray-600 dark:active:bg-gray-700',
|
|
201
|
+
},
|
|
202
|
+
zinc: {
|
|
203
|
+
base: 'text-white bg-zinc-500 dark:bg-zinc-600',
|
|
204
|
+
hover: 'hover:bg-zinc-400 dark:hover:bg-zinc-500',
|
|
205
|
+
focus: 'focus:bg-zinc-400 dark:focus:bg-zinc-500',
|
|
206
|
+
active: 'active:bg-zinc-600 dark:active:bg-zinc-700',
|
|
207
|
+
},
|
|
208
|
+
neutral: {
|
|
209
|
+
base: 'text-white bg-neutral-500 dark:bg-neutral-600',
|
|
210
|
+
hover: 'hover:bg-neutral-400 dark:hover:bg-neutral-500',
|
|
211
|
+
focus: 'focus:bg-neutral-400 dark:focus:bg-neutral-500',
|
|
212
|
+
active: 'active:bg-neutral-600 dark:active:bg-neutral-700',
|
|
213
|
+
},
|
|
214
|
+
stone: {
|
|
215
|
+
base: 'text-white bg-stone-500 dark:bg-stone-600',
|
|
216
|
+
hover: 'hover:bg-stone-400 dark:hover:bg-stone-500',
|
|
217
|
+
focus: 'focus:bg-stone-400 dark:focus:bg-stone-500',
|
|
218
|
+
active: 'active:bg-stone-600 dark:active:bg-stone-700',
|
|
219
|
+
},
|
|
220
|
+
red: {
|
|
221
|
+
base: 'text-white bg-red-500 dark:bg-red-600',
|
|
222
|
+
hover: 'hover:bg-red-400 dark:hover:bg-red-500',
|
|
223
|
+
focus: 'focus:bg-red-400 dark:focus:bg-red-500',
|
|
224
|
+
active: 'active:bg-red-600 dark:active:bg-red-700',
|
|
225
|
+
},
|
|
226
|
+
orange: {
|
|
227
|
+
base: 'text-white bg-orange-500 dark:bg-orange-600',
|
|
228
|
+
hover: 'hover:bg-orange-400 dark:hover:bg-orange-500',
|
|
229
|
+
focus: 'focus:bg-orange-400 dark:focus:bg-orange-500',
|
|
230
|
+
active: 'active:bg-orange-600 dark:active:bg-orange-700',
|
|
231
|
+
},
|
|
232
|
+
amber: {
|
|
233
|
+
base: 'text-white bg-amber-500 dark:bg-amber-600',
|
|
234
|
+
hover: 'hover:bg-amber-400 dark:hover:bg-amber-500',
|
|
235
|
+
focus: 'focus:bg-amber-400 dark:focus:bg-amber-500',
|
|
236
|
+
active: 'active:bg-amber-600 dark:active:bg-amber-700',
|
|
237
|
+
},
|
|
238
|
+
yellow: {
|
|
239
|
+
base: 'text-white bg-yellow-500 dark:bg-yellow-600',
|
|
240
|
+
hover: 'hover:bg-yellow-400 dark:hover:bg-yellow-500',
|
|
241
|
+
focus: 'focus:bg-yellow-400 dark:focus:bg-yellow-500',
|
|
242
|
+
active: 'active:bg-yellow-600 dark:active:bg-yellow-700',
|
|
243
|
+
},
|
|
244
|
+
lime: {
|
|
245
|
+
base: 'text-white bg-lime-500 dark:bg-lime-600',
|
|
246
|
+
hover: 'hover:bg-lime-400 dark:hover:bg-lime-500',
|
|
247
|
+
focus: 'focus:bg-lime-400 dark:focus:bg-lime-500',
|
|
248
|
+
active: 'active:bg-lime-600 dark:active:bg-lime-700',
|
|
249
|
+
},
|
|
250
|
+
green: {
|
|
251
|
+
base: 'text-white bg-green-500 dark:bg-green-600',
|
|
252
|
+
hover: 'hover:bg-green-400 dark:hover:bg-green-500',
|
|
253
|
+
focus: 'focus:bg-green-400 dark:focus:bg-green-500',
|
|
254
|
+
active: 'active:bg-green-600 dark:active:bg-green-700',
|
|
255
|
+
},
|
|
256
|
+
emerald: {
|
|
257
|
+
base: 'text-white bg-emerald-500 dark:bg-emerald-600',
|
|
258
|
+
hover: 'hover:bg-emerald-400 dark:hover:bg-emerald-500',
|
|
259
|
+
focus: 'focus:bg-emerald-400 dark:focus:bg-emerald-500',
|
|
260
|
+
active: 'active:bg-emerald-600 dark:active:bg-emerald-700',
|
|
261
|
+
},
|
|
262
|
+
teal: {
|
|
263
|
+
base: 'text-white bg-teal-500 dark:bg-teal-600',
|
|
264
|
+
hover: 'hover:bg-teal-400 dark:hover:bg-teal-500',
|
|
265
|
+
focus: 'focus:bg-teal-400 dark:focus:bg-teal-500',
|
|
266
|
+
active: 'active:bg-teal-600 dark:active:bg-teal-700',
|
|
267
|
+
},
|
|
268
|
+
cyan: {
|
|
269
|
+
base: 'text-white bg-cyan-500 dark:bg-cyan-600',
|
|
270
|
+
hover: 'hover:bg-cyan-400 dark:hover:bg-cyan-500',
|
|
271
|
+
focus: 'focus:bg-cyan-400 dark:focus:bg-cyan-500',
|
|
272
|
+
active: 'active:bg-cyan-600 dark:active:bg-cyan-700',
|
|
273
|
+
},
|
|
274
|
+
sky: {
|
|
275
|
+
base: 'text-white bg-sky-500 dark:bg-sky-600',
|
|
276
|
+
hover: 'hover:bg-sky-400 dark:hover:bg-sky-500',
|
|
277
|
+
focus: 'focus:bg-sky-400 dark:focus:bg-sky-500',
|
|
278
|
+
active: 'active:bg-sky-600 dark:active:bg-sky-700',
|
|
279
|
+
},
|
|
280
|
+
blue: {
|
|
281
|
+
base: 'text-white bg-blue-500 dark:bg-blue-600',
|
|
282
|
+
hover: 'hover:bg-blue-400 dark:hover:bg-blue-500',
|
|
283
|
+
focus: 'focus:bg-blue-400 dark:focus:bg-blue-500',
|
|
284
|
+
active: 'active:bg-blue-600 dark:active:bg-blue-700',
|
|
285
|
+
},
|
|
286
|
+
indigo: {
|
|
287
|
+
base: 'text-white bg-indigo-500 dark:bg-indigo-600',
|
|
288
|
+
hover: 'hover:bg-indigo-400 dark:hover:bg-indigo-500',
|
|
289
|
+
focus: 'focus:bg-indigo-400 dark:focus:bg-indigo-500',
|
|
290
|
+
active: 'active:bg-indigo-600 dark:active:bg-indigo-700',
|
|
291
|
+
},
|
|
292
|
+
violet: {
|
|
293
|
+
base: 'text-white bg-violet-500 dark:bg-violet-600',
|
|
294
|
+
hover: 'hover:bg-violet-400 dark:hover:bg-violet-500',
|
|
295
|
+
focus: 'focus:bg-violet-400 dark:focus:bg-violet-500',
|
|
296
|
+
active: 'active:bg-violet-600 dark:active:bg-violet-700',
|
|
297
|
+
},
|
|
298
|
+
fuchsia: {
|
|
299
|
+
base: 'text-white bg-fuchsia-500 dark:bg-fuchsia-600',
|
|
300
|
+
hover: 'hover:bg-fuchsia-400 dark:hover:bg-fuchsia-500',
|
|
301
|
+
focus: 'focus:bg-fuchsia-400 dark:focus:bg-fuchsia-500',
|
|
302
|
+
active: 'active:bg-fuchsia-600 dark:active:bg-fuchsia-700',
|
|
303
|
+
},
|
|
304
|
+
purple: {
|
|
305
|
+
base: 'text-white bg-purple-500 dark:bg-purple-600',
|
|
306
|
+
hover: 'hover:bg-purple-400 dark:hover:bg-purple-500',
|
|
307
|
+
focus: 'focus:bg-purple-400 dark:focus:bg-purple-500',
|
|
308
|
+
active: 'active:bg-purple-600 dark:active:bg-purple-700',
|
|
309
|
+
},
|
|
310
|
+
pink: {
|
|
311
|
+
base: 'text-white bg-pink-500 dark:bg-pink-600',
|
|
312
|
+
hover: 'hover:bg-pink-400 dark:hover:bg-pink-500',
|
|
313
|
+
focus: 'focus:bg-pink-400 dark:focus:bg-pink-500',
|
|
314
|
+
active: 'active:bg-pink-600 dark:active:bg-pink-700',
|
|
315
|
+
},
|
|
316
|
+
rose: {
|
|
317
|
+
base: 'text-white bg-rose-500 dark:bg-rose-600',
|
|
318
|
+
hover: 'hover:bg-rose-400 dark:hover:bg-rose-500',
|
|
319
|
+
focus: 'focus:bg-rose-400 dark:focus:bg-rose-500',
|
|
320
|
+
active: 'active:bg-rose-600 dark:active:bg-rose-700',
|
|
321
|
+
},
|
|
338
322
|
},
|
|
339
323
|
},
|
|
340
324
|
outlined: {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
325
|
+
base: 'border bg-background shadow-xs dark:bg-input/30 dark:hover:bg-input/50',
|
|
326
|
+
colors: {
|
|
327
|
+
primary: {
|
|
328
|
+
base: 'border-primary dark:text-accent-foreground',
|
|
329
|
+
hover: 'hover:bg-primary/90 hover:text-primary-foreground',
|
|
330
|
+
focus: 'focus:bg-primary/90 focus:text-primary-foreground',
|
|
331
|
+
active: 'active:bg-primary/90 active:text-primary-foreground',
|
|
332
|
+
},
|
|
333
|
+
secondary: {
|
|
334
|
+
base: 'border-secondary text-secondary-foreground',
|
|
335
|
+
hover: 'hover:bg-secondary/80',
|
|
336
|
+
focus: 'focus:bg-secondary/80',
|
|
337
|
+
active: 'active:bg-secondary/80',
|
|
338
|
+
},
|
|
339
|
+
slate: {
|
|
340
|
+
base: 'dark:border-slate-600',
|
|
341
|
+
hover: 'hover:bg-slate-200 dark:hover:bg-slate-600',
|
|
342
|
+
focus: 'focus:bg-slate-200 dark:focus:bg-slate-600',
|
|
343
|
+
active: 'active:bg-slate-300 active:border-slate-300 dark:active:bg-slate-700 dark:active:border-slate-700',
|
|
344
|
+
},
|
|
345
|
+
gray: {
|
|
346
|
+
base: 'border-gray-500 text-gray-600 dark:border-gray-600 dark:text-gray-500',
|
|
347
|
+
hover: 'hover:text-white hover:bg-gray-500 dark:hover:text-white dark:hover:bg-gray-600',
|
|
348
|
+
focus: 'focus:text-white focus:bg-gray-500 dark:focus:text-white dark:focus:bg-gray-600',
|
|
349
|
+
active: 'active:bg-gray-600 active:border-gray-600 dark:active:bg-gray-700 dark:active:border-gray-700',
|
|
350
|
+
},
|
|
351
|
+
zinc: {
|
|
352
|
+
base: 'border-zinc-500 text-zinc-600 dark:border-zinc-600 dark:text-zinc-500',
|
|
353
|
+
hover: 'hover:text-white hover:bg-zinc-500 dark:hover:text-white dark:hover:bg-zinc-600',
|
|
354
|
+
focus: 'focus:text-white focus:bg-zinc-500 dark:focus:text-white dark:focus:bg-zinc-600',
|
|
355
|
+
active: 'active:bg-zinc-600 active:border-zinc-600 dark:active:bg-zinc-700 dark:active:border-zinc-700',
|
|
356
|
+
},
|
|
357
|
+
neutral: {
|
|
358
|
+
base: 'border-neutral-500 text-neutral-600 dark:border-neutral-600 dark:text-neutral-500',
|
|
359
|
+
hover: 'hover:text-white hover:bg-neutral-500 dark:hover:text-white dark:hover:bg-neutral-600',
|
|
360
|
+
focus: 'focus:text-white focus:bg-neutral-500 dark:focus:text-white dark:focus:bg-neutral-600',
|
|
361
|
+
active: 'active:bg-neutral-600 active:border-neutral-600 dark:active:bg-neutral-700 dark:active:border-neutral-700',
|
|
362
|
+
},
|
|
363
|
+
stone: {
|
|
364
|
+
base: 'border-stone-500 text-stone-600 dark:border-stone-600 dark:text-stone-500',
|
|
365
|
+
hover: 'hover:text-white hover:bg-stone-500 dark:hover:text-white dark:hover:bg-stone-600',
|
|
366
|
+
focus: 'focus:text-white focus:bg-stone-500 dark:focus:text-white dark:focus:bg-stone-600',
|
|
367
|
+
active: 'active:bg-stone-600 active:border-stone-600 dark:active:bg-stone-700 dark:active:border-stone-700',
|
|
368
|
+
},
|
|
369
|
+
red: {
|
|
370
|
+
base: 'border-red-500 text-red-600 dark:border-red-600 dark:text-red-500',
|
|
371
|
+
hover: 'hover:text-white hover:bg-red-500 dark:hover:text-white dark:hover:bg-red-600',
|
|
372
|
+
focus: 'focus:text-white focus:bg-red-500 dark:focus:text-white dark:focus:bg-red-600',
|
|
373
|
+
active: 'active:bg-red-600 active:border-red-600 dark:active:bg-red-700 dark:active:border-red-700',
|
|
374
|
+
},
|
|
375
|
+
orange: {
|
|
376
|
+
base: 'border-orange-500 text-orange-600 dark:border-orange-600 dark:text-orange-500',
|
|
377
|
+
hover: 'hover:text-white hover:bg-orange-500 dark:hover:text-white dark:hover:bg-orange-600',
|
|
378
|
+
focus: 'focus:text-white focus:bg-orange-500 dark:focus:text-white dark:focus:bg-orange-600',
|
|
379
|
+
active: 'active:bg-orange-600 active:border-orange-600 dark:active:bg-orange-700 dark:active:border-orange-700',
|
|
380
|
+
},
|
|
381
|
+
amber: {
|
|
382
|
+
base: 'border-amber-500 text-amber-600 dark:border-amber-600 dark:text-amber-500',
|
|
383
|
+
hover: 'hover:text-white hover:bg-amber-500 dark:hover:text-white dark:hover:bg-amber-600',
|
|
384
|
+
focus: 'focus:text-white focus:bg-amber-500 dark:focus:text-white dark:focus:bg-amber-600',
|
|
385
|
+
active: 'active:bg-amber-600 active:border-amber-600 dark:active:bg-amber-700 dark:active:border-amber-700',
|
|
386
|
+
},
|
|
387
|
+
yellow: {
|
|
388
|
+
base: 'border-yellow-500 text-yellow-600 dark:border-yellow-600 dark:text-yellow-500',
|
|
389
|
+
hover: 'hover:text-white hover:bg-yellow-500 dark:hover:text-white dark:hover:bg-yellow-600',
|
|
390
|
+
focus: 'focus:text-white focus:bg-yellow-500 dark:focus:text-white dark:focus:bg-yellow-600',
|
|
391
|
+
active: 'active:bg-yellow-600 active:border-yellow-600 dark:active:bg-yellow-700 dark:active:border-yellow-700',
|
|
392
|
+
},
|
|
393
|
+
lime: {
|
|
394
|
+
base: 'border-lime-500 text-lime-600 dark:border-lime-600 dark:text-lime-500',
|
|
395
|
+
hover: 'hover:text-white hover:bg-lime-500 dark:hover:text-white dark:hover:bg-lime-600',
|
|
396
|
+
focus: 'focus:text-white focus:bg-lime-500 dark:focus:text-white dark:focus:bg-lime-600',
|
|
397
|
+
active: 'active:bg-lime-600 active:border-lime-600 dark:active:bg-lime-700 dark:active:border-lime-700',
|
|
398
|
+
},
|
|
399
|
+
green: {
|
|
400
|
+
base: 'border-green-500 text-green-600 dark:border-green-600 dark:text-green-500',
|
|
401
|
+
hover: 'hover:text-white hover:bg-green-500 dark:hover:text-white dark:hover:bg-green-600',
|
|
402
|
+
focus: 'focus:text-white focus:bg-green-500 dark:focus:text-white dark:focus:bg-green-600',
|
|
403
|
+
active: 'active:bg-green-600 active:border-green-600 dark:active:bg-green-700 dark:active:border-green-700',
|
|
404
|
+
},
|
|
405
|
+
emerald: {
|
|
406
|
+
base: 'border-emerald-500 text-emerald-600 dark:border-emerald-600 dark:text-emerald-500',
|
|
407
|
+
hover: 'hover:text-white hover:bg-emerald-500 dark:hover:text-white dark:hover:bg-emerald-600',
|
|
408
|
+
focus: 'focus:text-white focus:bg-emerald-500 dark:focus:text-white dark:focus:bg-emerald-600',
|
|
409
|
+
active: 'active:bg-emerald-600 active:border-emerald-600 dark:active:bg-emerald-700 dark:active:border-emerald-700',
|
|
410
|
+
},
|
|
411
|
+
teal: {
|
|
412
|
+
base: 'border-teal-500 text-teal-600 dark:border-teal-600 dark:text-teal-500',
|
|
413
|
+
hover: 'hover:text-white hover:bg-teal-500 dark:hover:text-white dark:hover:bg-teal-600',
|
|
414
|
+
focus: 'focus:text-white focus:bg-teal-500 dark:focus:text-white dark:focus:bg-teal-600',
|
|
415
|
+
active: 'active:bg-teal-600 active:border-teal-600 dark:active:bg-teal-700 dark:active:border-teal-700',
|
|
416
|
+
},
|
|
417
|
+
cyan: {
|
|
418
|
+
base: 'border-cyan-500 text-cyan-600 dark:border-cyan-600 dark:text-cyan-500',
|
|
419
|
+
hover: 'hover:text-white hover:bg-cyan-500 dark:hover:text-white dark:hover:bg-cyan-600',
|
|
420
|
+
focus: 'focus:text-white focus:bg-cyan-500 dark:focus:text-white dark:focus:bg-cyan-600',
|
|
421
|
+
active: 'active:bg-cyan-600 active:border-cyan-600 dark:active:bg-cyan-700 dark:active:border-cyan-700',
|
|
422
|
+
},
|
|
423
|
+
sky: {
|
|
424
|
+
base: 'border-sky-500 text-sky-600 dark:border-sky-600 dark:text-sky-500',
|
|
425
|
+
hover: 'hover:text-white hover:bg-sky-500 dark:hover:text-white dark:hover:bg-sky-600',
|
|
426
|
+
focus: 'focus:text-white focus:bg-sky-500 dark:focus:text-white dark:focus:bg-sky-600',
|
|
427
|
+
active: 'active:bg-sky-600 active:border-sky-600 dark:active:bg-sky-700 dark:active:border-sky-700',
|
|
428
|
+
},
|
|
429
|
+
blue: {
|
|
430
|
+
base: 'border-blue-500 text-blue-600 dark:border-blue-600 dark:text-blue-500',
|
|
431
|
+
hover: 'hover:text-white hover:bg-blue-500 dark:hover:text-white dark:hover:bg-blue-600',
|
|
432
|
+
focus: 'focus:text-white focus:bg-blue-500 dark:focus:text-white dark:focus:bg-blue-600',
|
|
433
|
+
active: 'active:bg-blue-600 active:border-blue-600 dark:active:bg-blue-700 dark:active:border-blue-700',
|
|
434
|
+
},
|
|
435
|
+
indigo: {
|
|
436
|
+
base: 'border-indigo-500 text-indigo-600 dark:border-indigo-600 dark:text-indigo-500',
|
|
437
|
+
hover: 'hover:text-white hover:bg-indigo-500 dark:hover:text-white dark:hover:bg-indigo-600',
|
|
438
|
+
focus: 'focus:text-white focus:bg-indigo-500 dark:focus:text-white dark:focus:bg-indigo-600',
|
|
439
|
+
active: 'active:bg-indigo-600 active:border-indigo-600 dark:active:bg-indigo-700 dark:active:border-indigo-700',
|
|
440
|
+
},
|
|
441
|
+
violet: {
|
|
442
|
+
base: 'border-violet-500 text-violet-600 dark:border-violet-600 dark:text-violet-500',
|
|
443
|
+
hover: 'hover:text-white hover:bg-violet-500 dark:hover:text-white dark:hover:bg-violet-600',
|
|
444
|
+
focus: 'focus:text-white focus:bg-violet-500 dark:focus:text-white dark:focus:bg-violet-600',
|
|
445
|
+
active: 'active:bg-violet-600 active:border-violet-600 dark:active:bg-violet-700 dark:active:border-violet-700',
|
|
446
|
+
},
|
|
447
|
+
fuchsia: {
|
|
448
|
+
base: 'border-fuchsia-500 text-fuchsia-600 dark:border-fuchsia-600 dark:text-fuchsia-500',
|
|
449
|
+
hover: 'hover:text-white hover:bg-fuchsia-500 dark:hover:text-white dark:hover:bg-fuchsia-600',
|
|
450
|
+
focus: 'focus:text-white focus:bg-fuchsia-500 dark:focus:text-white dark:focus:bg-fuchsia-600',
|
|
451
|
+
active: 'active:bg-fuchsia-600 active:border-fuchsia-600 dark:active:bg-fuchsia-700 dark:active:border-fuchsia-700',
|
|
452
|
+
},
|
|
453
|
+
purple: {
|
|
454
|
+
base: 'border-purple-500 text-purple-600 dark:border-purple-600 dark:text-purple-500',
|
|
455
|
+
hover: 'hover:text-white hover:bg-purple-500 dark:hover:text-white dark:hover:bg-purple-600',
|
|
456
|
+
focus: 'focus:text-white focus:bg-purple-500 dark:focus:text-white dark:focus:bg-purple-600',
|
|
457
|
+
active: 'active:bg-purple-600 active:border-purple-600 dark:active:bg-purple-700 dark:active:border-purple-700',
|
|
458
|
+
},
|
|
459
|
+
pink: {
|
|
460
|
+
base: 'border-pink-500 text-pink-600 dark:border-pink-600 dark:text-pink-500',
|
|
461
|
+
hover: 'hover:text-white hover:bg-pink-500 dark:hover:text-white dark:hover:bg-pink-600',
|
|
462
|
+
focus: 'focus:text-white focus:bg-pink-500 dark:focus:text-white dark:focus:bg-pink-600',
|
|
463
|
+
active: 'active:bg-pink-600 active:border-pink-600 dark:active:bg-pink-700 dark:active:border-pink-700',
|
|
464
|
+
},
|
|
465
|
+
rose: {
|
|
466
|
+
base: 'border-rose-500 text-rose-600 dark:border-rose-600 dark:text-rose-500',
|
|
467
|
+
hover: 'hover:text-white hover:bg-rose-500 dark:hover:text-white dark:hover:bg-rose-600',
|
|
468
|
+
focus: 'focus:text-white focus:bg-rose-500 dark:focus:text-white dark:focus:bg-rose-600',
|
|
469
|
+
active: 'active:bg-rose-600 active:border-rose-600 dark:active:bg-rose-700 dark:active:border-rose-700',
|
|
470
|
+
},
|
|
472
471
|
},
|
|
473
472
|
},
|
|
474
473
|
text: {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
hover: 'hover:text-white hover:bg-teal-500 dark:hover:bg-teal-600',
|
|
550
|
-
focus: 'focus:text-white focus:bg-teal-500 dark:focus:bg-teal-600',
|
|
551
|
-
active: 'active:bg-teal-600 dark:active:bg-teal-700',
|
|
552
|
-
},
|
|
553
|
-
cyan: {
|
|
554
|
-
base: 'bg-transparent',
|
|
555
|
-
hover: 'hover:text-white hover:bg-cyan-500 dark:hover:bg-cyan-600',
|
|
556
|
-
focus: 'focus:text-white focus:bg-cyan-500 dark:focus:bg-cyan-600',
|
|
557
|
-
active: 'active:bg-cyan-600 dark:active:bg-cyan-700',
|
|
558
|
-
},
|
|
559
|
-
sky: {
|
|
560
|
-
base: 'bg-transparent',
|
|
561
|
-
hover: 'hover:text-white hover:bg-sky-500 dark:hover:bg-sky-600',
|
|
562
|
-
focus: 'focus:text-white focus:bg-sky-500 dark:focus:bg-sky-600',
|
|
563
|
-
active: 'active:bg-sky-600 dark:active:bg-sky-700',
|
|
564
|
-
},
|
|
565
|
-
blue: {
|
|
566
|
-
base: 'bg-transparent',
|
|
567
|
-
hover: 'hover:text-white hover:bg-blue-500 dark:hover:bg-blue-600',
|
|
568
|
-
focus: 'focus:text-white focus:bg-blue-500 dark:focus:bg-blue-600',
|
|
569
|
-
active: 'active:bg-blue-600 dark:active:bg-blue-700',
|
|
570
|
-
},
|
|
571
|
-
indigo: {
|
|
572
|
-
base: 'bg-transparent',
|
|
573
|
-
hover: 'hover:text-white hover:bg-indigo-500 dark:hover:bg-indigo-600',
|
|
574
|
-
focus: 'focus:text-white focus:bg-indigo-500 dark:focus:bg-indigo-600',
|
|
575
|
-
active: 'active:bg-indigo-600 dark:active:bg-indigo-700',
|
|
576
|
-
},
|
|
577
|
-
violet: {
|
|
578
|
-
base: 'bg-transparent',
|
|
579
|
-
hover: 'hover:text-white hover:bg-violet-500 dark:hover:bg-violet-600',
|
|
580
|
-
focus: 'focus:text-white focus:bg-violet-500 dark:focus:bg-violet-600',
|
|
581
|
-
active: 'active:bg-violet-600 dark:active:bg-violet-700',
|
|
582
|
-
},
|
|
583
|
-
fuchsia: {
|
|
584
|
-
base: 'bg-transparent',
|
|
585
|
-
hover: 'hover:text-white hover:bg-fuchsia-500 dark:hover:bg-fuchsia-600',
|
|
586
|
-
focus: 'focus:text-white focus:bg-fuchsia-500 dark:focus:bg-fuchsia-600',
|
|
587
|
-
active: 'active:bg-fuchsia-600 dark:active:bg-fuchsia-700',
|
|
588
|
-
},
|
|
589
|
-
purple: {
|
|
590
|
-
base: 'bg-transparent',
|
|
591
|
-
hover: 'hover:text-white hover:bg-purple-500 dark:hover:bg-purple-600',
|
|
592
|
-
focus: 'focus:text-white focus:bg-purple-500 dark:focus:bg-purple-600',
|
|
593
|
-
active: 'active:bg-purple-600 dark:active:bg-purple-700',
|
|
594
|
-
},
|
|
595
|
-
pink: {
|
|
596
|
-
base: 'bg-transparent',
|
|
597
|
-
hover: 'hover:text-white hover:bg-pink-500 dark:hover:bg-pink-600',
|
|
598
|
-
focus: 'focus:text-white focus:bg-pink-500 dark:focus:bg-pink-600',
|
|
599
|
-
active: 'active:bg-pink-600 dark:active:bg-pink-700',
|
|
600
|
-
},
|
|
601
|
-
rose: {
|
|
602
|
-
base: 'bg-transparent',
|
|
603
|
-
hover: 'hover:text-white hover:bg-rose-500 dark:hover:bg-rose-600',
|
|
604
|
-
focus: 'focus:text-white focus:bg-rose-500 dark:focus:bg-rose-600',
|
|
605
|
-
active: 'active:bg-rose-600 dark:active:bg-rose-700',
|
|
474
|
+
base: 'bg-transparent underline-offset-4 hover:underline',
|
|
475
|
+
colors: {
|
|
476
|
+
primary: {
|
|
477
|
+
base: 'dark:text-accent-foreground',
|
|
478
|
+
},
|
|
479
|
+
secondary: {
|
|
480
|
+
base: 'text-secondary-foreground',
|
|
481
|
+
},
|
|
482
|
+
slate: {
|
|
483
|
+
base: 'text-slate-600 dark:text-slate-400',
|
|
484
|
+
},
|
|
485
|
+
gray: {
|
|
486
|
+
base: 'text-gray-600 dark:text-gray-400',
|
|
487
|
+
},
|
|
488
|
+
zinc: {
|
|
489
|
+
base: 'text-zinc-600 dark:text-zinc-400',
|
|
490
|
+
},
|
|
491
|
+
neutral: {
|
|
492
|
+
base: 'text-neutral-600 dark:text-neutral-400',
|
|
493
|
+
},
|
|
494
|
+
stone: {
|
|
495
|
+
base: 'text-stone-600 dark:text-stone-400',
|
|
496
|
+
},
|
|
497
|
+
red: {
|
|
498
|
+
base: 'text-red-600 dark:text-red-400',
|
|
499
|
+
},
|
|
500
|
+
orange: {
|
|
501
|
+
base: 'text-orange-600 dark:text-orange-400',
|
|
502
|
+
},
|
|
503
|
+
amber: {
|
|
504
|
+
base: 'text-amber-600 dark:text-amber-400',
|
|
505
|
+
},
|
|
506
|
+
yellow: {
|
|
507
|
+
base: 'text-yellow-600 dark:text-yellow-400',
|
|
508
|
+
},
|
|
509
|
+
lime: {
|
|
510
|
+
base: 'text-lime-600 dark:text-lime-400',
|
|
511
|
+
},
|
|
512
|
+
green: {
|
|
513
|
+
base: 'text-green-600 dark:text-green-400',
|
|
514
|
+
},
|
|
515
|
+
emerald: {
|
|
516
|
+
base: 'text-emerald-600 dark:text-emerald-400',
|
|
517
|
+
},
|
|
518
|
+
teal: {
|
|
519
|
+
base: 'text-teal-600 dark:text-teal-400',
|
|
520
|
+
},
|
|
521
|
+
cyan: {
|
|
522
|
+
base: 'text-cyan-600 dark:text-cyan-400',
|
|
523
|
+
},
|
|
524
|
+
sky: {
|
|
525
|
+
base: 'text-sky-600 dark:text-sky-400',
|
|
526
|
+
},
|
|
527
|
+
blue: {
|
|
528
|
+
base: 'text-blue-600 dark:text-blue-400',
|
|
529
|
+
},
|
|
530
|
+
indigo: {
|
|
531
|
+
base: 'text-indigo-600 dark:text-indigo-400',
|
|
532
|
+
},
|
|
533
|
+
violet: {
|
|
534
|
+
base: 'text-violet-600 dark:text-violet-400',
|
|
535
|
+
},
|
|
536
|
+
fuchsia: {
|
|
537
|
+
base: 'text-fuchsia-600 dark:text-fuchsia-400',
|
|
538
|
+
},
|
|
539
|
+
purple: {
|
|
540
|
+
base: 'text-purple-600 dark:text-purple-400',
|
|
541
|
+
},
|
|
542
|
+
pink: {
|
|
543
|
+
base: 'text-pink-600 dark:text-pink-400',
|
|
544
|
+
},
|
|
545
|
+
rose: {
|
|
546
|
+
base: 'text-rose-600 dark:text-rose-400',
|
|
547
|
+
},
|
|
606
548
|
},
|
|
607
549
|
},
|
|
608
550
|
};
|
|
609
551
|
const sizeClassNames = {
|
|
610
552
|
small: {
|
|
611
|
-
base: 'gap-1 text-
|
|
612
|
-
withChildren: 'px-1
|
|
553
|
+
base: 'gap-1 text-xs h-6',
|
|
554
|
+
withChildren: 'px-2 gap-1',
|
|
613
555
|
icon: {
|
|
614
556
|
base: 'h-3 w-3',
|
|
615
|
-
withChildren: 'h-2 w-2',
|
|
557
|
+
withChildren: 'h-2.5 w-2.5',
|
|
616
558
|
},
|
|
617
559
|
},
|
|
618
560
|
medium: {
|
|
619
|
-
base: 'gap-
|
|
620
|
-
withChildren: 'px-
|
|
561
|
+
base: 'gap-2 text-sm font-medium h-9 py-2',
|
|
562
|
+
withChildren: 'px-4 has-[>svg]:px-3',
|
|
621
563
|
icon: {
|
|
622
|
-
base: 'h-
|
|
623
|
-
withChildren: 'h-
|
|
564
|
+
base: 'h-5 w-5',
|
|
565
|
+
withChildren: 'h-4 w-4',
|
|
624
566
|
},
|
|
625
567
|
},
|
|
626
568
|
};
|
|
627
569
|
const Button = (_a) => {
|
|
628
570
|
var { children, className, size = 'medium', color = 'slate', variant = 'filled', rounded, loading, disabled, prefixIcon: PrefixIcon, suffixIcon: SuffixIcon, unstyled, dataTestId = 'button' } = _a, props = __rest(_a, ["children", "className", "size", "color", "variant", "rounded", "loading", "disabled", "prefixIcon", "suffixIcon", "unstyled", "dataTestId"]);
|
|
629
|
-
return (jsxs("button", Object.assign({ className: cn('
|
|
630
|
-
|
|
631
|
-
: !unstyled
|
|
632
|
-
? `${variantClassNames[variant][color].hover} ${variantClassNames[variant][color].focus} ${variantClassNames[variant][color].active} cursor-pointer`
|
|
633
|
-
: 'cursor-default', children ? `${sizeClassNames[size].withChildren} aspect-[initial]` : 'justify-center', className), "data-testid": dataTestId, type: "button", disabled: disabled || loading }, props, { children: [loading && (jsx(Flex, { className: cn('absolute inset-0', rounded ? 'rounded-full' : 'rounded-md'), align: "center", justify: "center", children: jsx(Spinner, { className: "h-5 w-5 animate-spin bg-transparent dark:bg-transparent", dataTestId: `${dataTestId}-spinner` }) })), PrefixIcon && (jsx(PrefixIcon, { className: children ? sizeClassNames[size].icon.withChildren : sizeClassNames[size].icon.base })), children, SuffixIcon && (jsx(SuffixIcon, { className: children ? sizeClassNames[size].icon.withChildren : sizeClassNames[size].icon.base }))] })));
|
|
571
|
+
return (jsxs("button", Object.assign({ className: cn('inline-flex aspect-square shrink-0 items-center justify-center font-medium whitespace-nowrap transition-all outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:shrink-0', 'focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive focus-visible:ring-[3px]', sizeClassNames[size].base, variantClassNames[variant].base, variantClassNames[variant].colors[color].base, !unstyled &&
|
|
572
|
+
`${variantClassNames[variant].colors[color].hover} ${variantClassNames[variant].colors[color].focus} ${variantClassNames[variant].colors[color].active} cursor-pointer`, unstyled && 'cursor-default', rounded ? 'rounded-full' : 'rounded-md', children ? `${sizeClassNames[size].withChildren} aspect-[initial]` : 'justify-center', className), "data-testid": dataTestId, type: "button", disabled: disabled || loading }, props, { children: [PrefixIcon && !loading && (jsx(PrefixIcon, { className: children ? sizeClassNames[size].icon.withChildren : sizeClassNames[size].icon.base })), loading && (jsx(Spinner, { className: "bg-transparent dark:bg-transparent", spinnerClassName: children ? sizeClassNames[size].icon.withChildren : sizeClassNames[size].icon.base, dataTestId: `${dataTestId}-spinner` })), children, SuffixIcon && !loading && (jsx(SuffixIcon, { className: children ? sizeClassNames[size].icon.withChildren : sizeClassNames[size].icon.base }))] })));
|
|
634
573
|
};
|
|
635
574
|
|
|
636
575
|
const Badge = (_a) => {
|
|
@@ -638,11 +577,48 @@ const Badge = (_a) => {
|
|
|
638
577
|
return (jsx(Button, Object.assign({ size: size, dataTestId: dataTestId }, props)));
|
|
639
578
|
};
|
|
640
579
|
|
|
641
|
-
const
|
|
642
|
-
var { children, className, dataTestId = '
|
|
643
|
-
return (jsx(
|
|
580
|
+
const Block = (_a) => {
|
|
581
|
+
var { children, className, centered, container, fullWidth, fullHeight, dataTestId = 'block' } = _a, props = __rest(_a, ["children", "className", "centered", "container", "fullWidth", "fullHeight", "dataTestId"]);
|
|
582
|
+
return (jsx("div", Object.assign({ "data-testid": dataTestId, className: cn(centered && 'mx-auto', container && 'container', fullWidth && 'w-full', fullHeight && 'h-full', className) }, props, { children: children })));
|
|
644
583
|
};
|
|
645
584
|
|
|
585
|
+
const $Card = (_a) => {
|
|
586
|
+
var { className, dataTestId = 'card' } = _a, props = __rest(_a, ["className", "dataTestId"]);
|
|
587
|
+
return (jsx("div", Object.assign({ className: cn('bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm', className), "data-slot": "card", "data-testid": dataTestId }, props)));
|
|
588
|
+
};
|
|
589
|
+
const CardHeader = (_a) => {
|
|
590
|
+
var { className, dataTestId = 'card-header' } = _a, props = __rest(_a, ["className", "dataTestId"]);
|
|
591
|
+
return (jsx("div", Object.assign({ className: cn('@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6', className), "data-slot": "card-header", "data-testid": dataTestId }, props)));
|
|
592
|
+
};
|
|
593
|
+
const CardTitle = (_a) => {
|
|
594
|
+
var { className, dataTestId = 'card-title' } = _a, props = __rest(_a, ["className", "dataTestId"]);
|
|
595
|
+
return (jsx("div", Object.assign({ className: cn('leading-none font-semibold', className), "data-slot": "card-title", "data-testid": dataTestId }, props)));
|
|
596
|
+
};
|
|
597
|
+
const CardDescription = (_a) => {
|
|
598
|
+
var { className, dataTestId = 'card-description' } = _a, props = __rest(_a, ["className", "dataTestId"]);
|
|
599
|
+
return (jsx("div", Object.assign({ className: cn('text-muted-foreground text-sm', className), "data-slot": "card-description", "data-testid": dataTestId }, props)));
|
|
600
|
+
};
|
|
601
|
+
const CardAction = (_a) => {
|
|
602
|
+
var { className, dataTestId = 'card-action' } = _a, props = __rest(_a, ["className", "dataTestId"]);
|
|
603
|
+
return (jsx("div", Object.assign({ className: cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className), "data-slot": "card-action", "data-testid": dataTestId }, props)));
|
|
604
|
+
};
|
|
605
|
+
const CardContent = (_a) => {
|
|
606
|
+
var { className, dataTestId = 'card-content' } = _a, props = __rest(_a, ["className", "dataTestId"]);
|
|
607
|
+
return (jsx("div", Object.assign({ className: cn('px-6', className), "data-slot": "card-content", "data-testid": dataTestId }, props)));
|
|
608
|
+
};
|
|
609
|
+
const CardFooter = (_a) => {
|
|
610
|
+
var { className, dataTestId = 'card-footer' } = _a, props = __rest(_a, ["className", "dataTestId"]);
|
|
611
|
+
return (jsx("div", Object.assign({ className: cn('flex items-center px-6 [.border-t]:pt-6', className), "data-slot": "card-footer", "data-testid": dataTestId }, props)));
|
|
612
|
+
};
|
|
613
|
+
const Card = Object.assign($Card, {
|
|
614
|
+
Header: CardHeader,
|
|
615
|
+
Footer: CardFooter,
|
|
616
|
+
Title: CardTitle,
|
|
617
|
+
Action: CardAction,
|
|
618
|
+
Description: CardDescription,
|
|
619
|
+
Content: CardContent,
|
|
620
|
+
});
|
|
621
|
+
|
|
646
622
|
const CollapsibleRoot = (_a) => {
|
|
647
623
|
var { dataTestId = 'collapsible' } = _a, props = __rest(_a, ["dataTestId"]);
|
|
648
624
|
return (jsx(CollapsiblePrimitive.Root, Object.assign({ "data-testid": dataTestId }, props)));
|
|
@@ -660,6 +636,32 @@ const Collapsible = Object.assign(CollapsibleRoot, {
|
|
|
660
636
|
Content: CollapsibleContent,
|
|
661
637
|
});
|
|
662
638
|
|
|
639
|
+
const directionClasses = {
|
|
640
|
+
row: {
|
|
641
|
+
normal: 'flex-row',
|
|
642
|
+
reverse: 'flex-row-reverse',
|
|
643
|
+
},
|
|
644
|
+
column: {
|
|
645
|
+
normal: 'flex-col',
|
|
646
|
+
reverse: 'flex-col-reverse',
|
|
647
|
+
},
|
|
648
|
+
};
|
|
649
|
+
const alignClasses = {
|
|
650
|
+
start: 'items-start',
|
|
651
|
+
center: 'items-center',
|
|
652
|
+
end: 'items-end',
|
|
653
|
+
};
|
|
654
|
+
const justifyClasses = {
|
|
655
|
+
start: 'justify-start',
|
|
656
|
+
center: 'justify-center',
|
|
657
|
+
between: 'justify-between',
|
|
658
|
+
end: 'justify-end',
|
|
659
|
+
};
|
|
660
|
+
const Flex = (_a) => {
|
|
661
|
+
var { children, className, reverse, wrap, direction = 'row', align = 'start', justify = 'start', dataTestId = 'flex' } = _a, blockProps = __rest(_a, ["children", "className", "reverse", "wrap", "direction", "align", "justify", "dataTestId"]);
|
|
662
|
+
return (jsx(Block, Object.assign({ className: cn('flex gap-2', wrap && 'flex-wrap', directionClasses[direction][reverse ? 'reverse' : 'normal'], alignClasses[align], justifyClasses[justify], className), dataTestId: dataTestId }, blockProps, { children: children })));
|
|
663
|
+
};
|
|
664
|
+
|
|
663
665
|
dayjs.extend(localeData);
|
|
664
666
|
function useDays(locale = 'en') {
|
|
665
667
|
return useMemo(() => {
|
|
@@ -812,6 +814,12 @@ function usePagination(currentIndex, totalPages) {
|
|
|
812
814
|
|
|
813
815
|
const TOAST_LIMIT = 1;
|
|
814
816
|
const TOAST_REMOVE_DELAY = 5000; // 5 seconds
|
|
817
|
+
const actionTypes = {
|
|
818
|
+
ADD_TOAST: 'ADD_TOAST',
|
|
819
|
+
UPDATE_TOAST: 'UPDATE_TOAST',
|
|
820
|
+
DISMISS_TOAST: 'DISMISS_TOAST',
|
|
821
|
+
REMOVE_TOAST: 'REMOVE_TOAST',
|
|
822
|
+
};
|
|
815
823
|
let count = 0;
|
|
816
824
|
function genId() {
|
|
817
825
|
count = (count + 1) % Number.MAX_SAFE_INTEGER;
|
|
@@ -833,11 +841,11 @@ const addToRemoveQueue = (toastId) => {
|
|
|
833
841
|
};
|
|
834
842
|
const reducer = (state, action) => {
|
|
835
843
|
switch (action.type) {
|
|
836
|
-
case
|
|
844
|
+
case actionTypes.ADD_TOAST:
|
|
837
845
|
return Object.assign(Object.assign({}, state), { toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT) });
|
|
838
|
-
case
|
|
846
|
+
case actionTypes.UPDATE_TOAST:
|
|
839
847
|
return Object.assign(Object.assign({}, state), { toasts: state.toasts.map((t) => (t.id === action.toast.id ? Object.assign(Object.assign({}, t), action.toast) : t)) });
|
|
840
|
-
case
|
|
848
|
+
case actionTypes.DISMISS_TOAST: {
|
|
841
849
|
const { toastId } = action;
|
|
842
850
|
// ! Side effects ! - This could be extracted into a dismissToast() action,
|
|
843
851
|
// but I'll keep it here for simplicity
|
|
@@ -852,7 +860,7 @@ const reducer = (state, action) => {
|
|
|
852
860
|
return Object.assign(Object.assign({}, state), { toasts: state.toasts.map((t) => t.id === toastId || toastId === undefined
|
|
853
861
|
? Object.assign(Object.assign({}, t), { open: false }) : t) });
|
|
854
862
|
}
|
|
855
|
-
case
|
|
863
|
+
case actionTypes.REMOVE_TOAST:
|
|
856
864
|
if (action.toastId === undefined) {
|
|
857
865
|
return Object.assign(Object.assign({}, state), { toasts: [] });
|
|
858
866
|
}
|
|
@@ -871,12 +879,12 @@ function toast(_a) {
|
|
|
871
879
|
var props = __rest(_a, []);
|
|
872
880
|
const id = genId();
|
|
873
881
|
const update = (props) => dispatch({
|
|
874
|
-
type:
|
|
882
|
+
type: actionTypes.UPDATE_TOAST,
|
|
875
883
|
toast: Object.assign(Object.assign({}, props), { id }),
|
|
876
884
|
});
|
|
877
|
-
const dismiss = () => dispatch({ type:
|
|
885
|
+
const dismiss = () => dispatch({ type: actionTypes.DISMISS_TOAST, toastId: id });
|
|
878
886
|
dispatch({
|
|
879
|
-
type:
|
|
887
|
+
type: actionTypes.ADD_TOAST,
|
|
880
888
|
toast: Object.assign(Object.assign({}, props), { id, open: true, onOpenChange: (open) => {
|
|
881
889
|
if (!open)
|
|
882
890
|
dismiss();
|
|
@@ -899,7 +907,7 @@ function useToast() {
|
|
|
899
907
|
}
|
|
900
908
|
};
|
|
901
909
|
}, [state]);
|
|
902
|
-
return Object.assign(Object.assign({}, state), { toast, dismiss: (toastId) => dispatch({ type:
|
|
910
|
+
return Object.assign(Object.assign({}, state), { toast, dismiss: (toastId) => dispatch({ type: actionTypes.DISMISS_TOAST, toastId }) });
|
|
903
911
|
}
|
|
904
912
|
|
|
905
913
|
const Tooltip = ({ children, className, content, asChild, placement, dataTestId = 'tooltip', }) => (jsx(TooltipPrimitive.Provider, { delayDuration: 200, children: jsxs(TooltipPrimitive.Root, { children: [jsx(TooltipPrimitive.Trigger, { asChild: asChild, "data-testid": `${dataTestId}-trigger`, children: children }), jsx(TooltipPrimitive.Portal, { children: jsx(TooltipPrimitive.Content, { className: cn('animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', 'z-[101] overflow-hidden rounded-md border bg-white px-3 py-1.5 text-sm shadow-md dark:border-slate-700 dark:bg-slate-800 dark:text-white', className), side: placement, sideOffset: 5, "data-testid": `${dataTestId}-content`, children: content }) })] }) }));
|
|
@@ -911,24 +919,13 @@ const Label = ({ children, className, description, required, hasErrors, htmlFor,
|
|
|
911
919
|
}, className), htmlFor: htmlFor, "data-testid": dataTestId, children: [children, description && (jsx(Tooltip, { content: jsx("div", { className: "max-w-xs", children: description }), placement: "top", asChild: true, dataTestId: `${dataTestId}-description-tooltip`, children: jsx(HelpCircle, { className: "h-4 w-4", "data-testid": `${dataTestId}-description-tooltip-icon` }) })), required && jsx("span", { className: "text-red-600", children: "*" })] }));
|
|
912
920
|
};
|
|
913
921
|
|
|
914
|
-
const
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
disabled: 'opacity-60',
|
|
918
|
-
},
|
|
919
|
-
withoutErrors: {
|
|
920
|
-
input: 'border-slate-300 dark:border-slate-700 focus:border-blue-500 dark:focus:border-blue-600 dark:placeholder-slate-400',
|
|
921
|
-
extension: 'bg-white dark:bg-transparent border-slate-300 text-slate-600 peer-focus:border-blue-500 dark:peer-focus:border-blue-600 dark:border-slate-700 dark:text-white',
|
|
922
|
-
},
|
|
923
|
-
withErrors: {
|
|
924
|
-
input: 'text-red-600 border-red-500 placeholder-red-500 focus:border-red-500 dark:border-red-600 dark:peer-focus:border-red-600 dark:placeholder-red-600',
|
|
925
|
-
extension: 'text-red-600 border-red-500 peer-focus:border-red-500 dark:border-red-600 dark:peer-focus:border-red-600 dark:text-red-500',
|
|
926
|
-
},
|
|
927
|
-
};
|
|
922
|
+
const baseInputClasses = 'peer file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex w-full min-w-0 rounded-md border bg-transparent' +
|
|
923
|
+
'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 transition-color outline-none file:inline-flex file:border-0 file:bg-transparent file:font-medium' +
|
|
924
|
+
'border-input focus:ring-0';
|
|
928
925
|
const sizeClasses = {
|
|
929
926
|
small: {
|
|
930
927
|
label: 'text-xs',
|
|
931
|
-
input: 'text-xs py-
|
|
928
|
+
input: 'text-sm md:text-xs py-0.5 px-2 h-6 file:h-5 file:text-xs',
|
|
932
929
|
checkbox: {
|
|
933
930
|
input: 'w-3 h-3',
|
|
934
931
|
wrapper: 'h-6 gap-1',
|
|
@@ -944,7 +941,7 @@ const sizeClasses = {
|
|
|
944
941
|
},
|
|
945
942
|
medium: {
|
|
946
943
|
label: 'text-sm',
|
|
947
|
-
input: 'text-sm py-
|
|
944
|
+
input: 'text-base md:text-sm py-1 px-3 h-9 file:h-7 file:text-sm',
|
|
948
945
|
checkbox: {
|
|
949
946
|
input: 'w-4 h-4',
|
|
950
947
|
wrapper: 'h-8 gap-2',
|
|
@@ -970,31 +967,17 @@ const BasicInput = (_a) => {
|
|
|
970
967
|
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, { target: { value: '', checked: false } });
|
|
971
968
|
};
|
|
972
969
|
return (jsxs("div", { className: cn('w-full dark:text-white', className), "data-testid": dataTestId, children: [type !== 'checkbox' && memoLabel, jsxs("div", { className: cn('group relative flex', {
|
|
970
|
+
errors: hasErrors,
|
|
973
971
|
'mt-1': label && type !== 'checkbox',
|
|
974
972
|
[`items-center ${sizeClasses[size].checkbox.wrapper}`]: type === 'checkbox',
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
'rounded-r-none border-r-0': SuffixIcon,
|
|
980
|
-
}, inputClassName) }, props, { value: props.value, "data-testid": `${dataTestId}-textarea` }))) : type === 'checkbox' ? (jsx("input", Object.assign({ id: id, className: cn('rounded-sm border-slate-300 text-blue-600', sizeClasses[size].checkbox.input, {
|
|
981
|
-
[inputClasses.base.disabled]: props.disabled,
|
|
982
|
-
'bg-red-100': hasErrors,
|
|
983
|
-
}, inputClassName), type: type, checked: Boolean(props.value) }, props, { "data-testid": `${dataTestId}-checkbox` }))) : (jsx("input", Object.assign({ id: id, className: cn(inputClasses.base.input, sizeClasses[size].input, {
|
|
984
|
-
[inputClasses.base.disabled]: props.disabled,
|
|
985
|
-
[inputClasses.withoutErrors.input]: !hasErrors,
|
|
986
|
-
[inputClasses.withErrors.input]: hasErrors,
|
|
987
|
-
'rounded-r-none border-r-0': SuffixIcon,
|
|
988
|
-
}, inputClassName), type: type !== null && type !== void 0 ? type : 'text' }, props, { value: props.value, "data-testid": `${dataTestId}-input` }))), type === 'checkbox' && memoLabel, clearable && (onClear || !!props.value) && !props.disabled && (jsx(XIcon, { className: cn('absolute top-1/2 right-2 -translate-y-1/2 cursor-pointer rounded-full bg-white p-0.5 opacity-0 duration-200 group-hover:opacity-100 hover:bg-slate-200 dark:bg-slate-700 dark:hover:bg-slate-800', sizeClasses[size].clearButton.base, {
|
|
973
|
+
'has-[input:focus-visible]:border-ring has-[input:focus-visible]:ring-ring/50 has-[textarea:focus-visible]:border-ring has-[textarea:focus-visible]:ring-ring/50 rounded-md has-[input:focus-visible]:ring-[3px] has-[textarea:focus-visible]:ring-[3px]': type !== 'checkbox',
|
|
974
|
+
'aria-invalid:!ring-destructive/20 dark:aria-invalid:!ring-destructive/40 aria-invalid:[&>input,&>textarea,&>div]:border-destructive': type !== 'checkbox',
|
|
975
|
+
'shadow-xs transition-[color,box-shadow]': type !== 'checkbox',
|
|
976
|
+
}), title: type !== 'textarea' && typeof props.value === 'string' ? props.value : undefined, "data-testid": `${dataTestId}-wrapper`, "aria-invalid": hasErrors, children: [type === 'textarea' ? (jsx("textarea", Object.assign({ id: id, className: cn(baseInputClasses, sizeClasses[size].input.replace(/ h-\d/g, ''), 'field-sizing-content min-h-16 py-2', SuffixIcon && 'rounded-r-none border-r-0', inputClassName) }, props, { value: props.value, "data-testid": `${dataTestId}-textarea` }))) : type === 'checkbox' ? (jsx("input", Object.assign({ id: id, className: cn('border-input rounded-sm disabled:opacity-50', 'focus:ring-ring/50 focus:border-ring focus:ring-[3px] focus:ring-offset-0', 'aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40', sizeClasses[size].checkbox.input, hasErrors && 'bg-red-100', inputClassName), type: type, checked: Boolean(props.value) }, props, { "data-testid": `${dataTestId}-checkbox`, "aria-invalid": hasErrors }))) : (jsx("input", Object.assign({ id: id, className: cn(baseInputClasses, sizeClasses[size].input, SuffixIcon && 'rounded-r-none border-r-0', inputClassName), type: type !== null && type !== void 0 ? type : 'text' }, props, { value: props.value, "data-testid": `${dataTestId}-input` }))), type === 'checkbox' && memoLabel, clearable && (onClear || !!props.value) && !props.disabled && (jsx(XIcon, { className: cn('absolute top-1/2 right-2 -translate-y-1/2 cursor-pointer rounded-full bg-white p-0.5 opacity-0 duration-200 group-hover:opacity-100 hover:bg-slate-200 dark:bg-slate-700 dark:hover:bg-slate-800', sizeClasses[size].clearButton.base, {
|
|
989
977
|
[sizeClasses[size].clearButton.withSuffixIcon]: SuffixIcon,
|
|
990
|
-
}), onClick: handleClear, onPointerDown: (event) => event.stopPropagation(), "data-testid": `${dataTestId}-clear` })), type !== 'checkbox' && SuffixIcon && (jsx(BasicInputExtension, { className: extensionClassName,
|
|
978
|
+
}), onClick: handleClear, onPointerDown: (event) => event.stopPropagation(), "data-testid": `${dataTestId}-clear` })), type !== 'checkbox' && SuffixIcon && (jsx(BasicInputExtension, { className: extensionClassName, size: size, disabled: props.disabled, onClick: onSuffixIconClick, dataTestId: `${dataTestId}-suffix`, children: jsx(SuffixIcon, { className: sizeClasses[size].suffix.icon }) }))] })] }));
|
|
991
979
|
};
|
|
992
|
-
const BasicInputExtension = ({ children, className, size,
|
|
993
|
-
[inputClasses.base.disabled]: disabled,
|
|
994
|
-
[inputClasses.withoutErrors.extension]: !hasErrors,
|
|
995
|
-
[inputClasses.withErrors.extension]: hasErrors,
|
|
996
|
-
'cursor-pointer': onClick,
|
|
997
|
-
}, className), onClick: !disabled ? onClick : undefined, onPointerDown: (event) => event.stopPropagation(), "data-testid": dataTestId, children: children }));
|
|
980
|
+
const BasicInputExtension = ({ children, className, size, disabled, onClick, dataTestId }) => (jsx("div", { className: cn('dark:bg-input/30 border-input flex aspect-square items-center justify-center rounded-r-md border border-l-0 bg-transparent aria-disabled:opacity-50', sizeClasses[size].suffix.wrapper, onClick && 'cursor-pointer', className), onClick: !disabled ? onClick : undefined, onPointerDown: (event) => event.stopPropagation(), "data-testid": dataTestId, "aria-disabled": disabled, children: children }));
|
|
998
981
|
|
|
999
982
|
const CheckboxInput = (_a) => {
|
|
1000
983
|
var { dataTestId = 'checkbox-input' } = _a, props = __rest(_a, ["dataTestId"]);
|
|
@@ -1273,7 +1256,7 @@ const DateTimeInput = (_a) => {
|
|
|
1273
1256
|
setIsOpen(false);
|
|
1274
1257
|
}
|
|
1275
1258
|
};
|
|
1276
|
-
return (jsxs("div", { className: cn('relative w-full', className), ref: ref, children: [jsx(
|
|
1259
|
+
return (jsxs("div", { className: cn('relative w-full', className), ref: ref, children: [jsx(TextInput, Object.assign({}, props, { readOnly: true, value: displayDate !== null && displayDate !== void 0 ? displayDate : '', hasErrors: hasErrors, onClick: handleOnClick, onKeyUp: handleOnKeyUp, clearable: clearable && !!displayDate, onClear: clearDate, suffixIcon: (type === null || type === void 0 ? void 0 : type.includes('date')) ? CalendarIcon : ClockIcon, onSuffixIconClick: handleOnClick, dataTestId: dataTestId })), isOpen && (jsxs("div", { className: "absolute z-20 mt-2 flex origin-top-left flex-col rounded-md border bg-white shadow-sm duration-200 dark:border-slate-700 dark:bg-slate-900 dark:text-white", tabIndex: 0, onBlur: handleOnBlur, ref: calendarRef, "data-testid": `${dataTestId}-popup`, children: [(type === null || type === void 0 ? void 0 : type.includes('date')) && (jsx(DateSelector, { date: date, value: value, minDate: minDate, maxDate: maxDate, locale: displayLocale, calendarView: calendarView, setCalendarView: setCalendarView, setNewDate: setNewDate, dataTestId: `${dataTestId}-date-selector` })), calendarView === 'days' && (jsxs("div", { className: "flex items-center justify-end gap-2 px-3 py-2 select-none", "data-testid": `${dataTestId}-time-selector`, children: [(type === null || type === void 0 ? void 0 : type.includes('time')) && (jsx(TimeSelector, { date: date, step: step, minDate: minDate, maxDate: maxDate, setNewDate: setNewDate, dataTestId: `${dataTestId}-time-selector` })), jsx("div", { className: "cursor-pointer rounded-lg border border-transparent p-1 text-sm font-bold text-blue-600 uppercase transition duration-100 ease-in-out hover:bg-slate-100 dark:text-blue-500 dark:hover:bg-slate-700", onClick: () => setIsOpen(false), "data-testid": `${dataTestId}-ok`, children: "OK" })] }))] }))] }));
|
|
1277
1260
|
};
|
|
1278
1261
|
|
|
1279
1262
|
const ListContent = (_a) => {
|
|
@@ -1475,7 +1458,7 @@ const SelectInput = (_a) => {
|
|
|
1475
1458
|
handleOnSelect(option.id);
|
|
1476
1459
|
}, dataTestId: option.dataTestId, children: jsx("span", { children: renderItem(option, isNotNullOrUndefined(selectedMap[option.id])) }) }));
|
|
1477
1460
|
}, [ItemComponent, handleOnSelect, multiple, renderItem, selectedMap]);
|
|
1478
|
-
return (jsxs(DropdownMenu, { open: open, onOpenChange: setOpen, children: [jsx(DropdownMenu.Trigger, { className: cn('w-full', className), dataTestId: `${dataTestId}-trigger`, children: jsx(TextInput, Object.assign({ className: "[&>div>*]:cursor-pointer", inputClassName:
|
|
1461
|
+
return (jsxs(DropdownMenu, { open: open, onOpenChange: setOpen, children: [jsx(DropdownMenu.Trigger, { className: cn('w-full', className), dataTestId: `${dataTestId}-trigger`, children: jsx(TextInput, Object.assign({}, props, { readOnly: true, className: "[&>div>*]:cursor-pointer", inputClassName: cn('text-left', props.inputClassName), value: text !== null && text !== void 0 ? text : '', clearable: clearable && !!selectedItems.length, onClear: handleOnClear, suffixIcon: ChevronDownIcon, onSuffixIconClick: () => setOpen((open) => !open), dataTestId: dataTestId })) }), jsxs(DropdownMenu.Content, { className: "flex max-h-80 w-[calc(var(--radix-popper-anchor-width))] flex-col overflow-hidden", dataTestId: `${dataTestId}-content`, children: [search && (jsxs(Fragment, { children: [jsx(TextInput, { autoFocus: true, value: searchValue, placeholder: "Search...", size: props.size, onChange: handleOnSearchValueChange, onKeyUp: (event) => event.stopPropagation(), onKeyDown: (event) => event.stopPropagation(), clearable: !!searchValue.length, onClear: clearSearchValue, dataTestId: `${dataTestId}-search` }), jsx(DropdownMenu.Separator, { className: "w-full", dataTestId: `${dataTestId}-separator` })] })), filteredItems.length === 0 &&
|
|
1479
1462
|
(allowAddition && searchValue ? (jsxs("button", { className: "rounded-sm bg-slate-100 py-1.5 text-center hover:bg-slate-200 dark:bg-slate-900/30 dark:hover:bg-slate-700/30", onClick: handleOnAddItemClicked, "data-testid": `${dataTestId}-add-button`, children: ["Add '", searchValue, "'"] })) : (jsx("div", { className: "py-1.5 text-center text-slate-500", "data-testid": `${dataTestId}-no-items`, children: "No items" }))), jsx(GroupComponent, { className: "flex flex-col gap-1 overflow-auto", value: !multiple && selectedItems.length ? String(selectedItems[0].id) : undefined, dataTestId: `${dataTestId}-group`, children: filteredItems.map((item, index) => item.group ? (jsxs(Flex, { className: "gap-1", direction: "column", fullWidth: true, children: [jsx(DropdownMenu.Label, { className: "sticky top-0 z-[51] w-full rounded-md border bg-white py-1 dark:bg-slate-900", dataTestId: `${dataTestId}-group-label-${item.id}`, children: item.label }), item.items.map((subItem) => (jsx(RenderOption, Object.assign({}, subItem, { dataTestId: `${dataTestId}-item-${subItem.id}` }), subItem.id))), index < filteredItems.length - 1 && (jsx("div", { className: "mb-1 h-px w-full bg-slate-200 dark:bg-slate-700" }))] }, item.id)) : (jsx(RenderOption, Object.assign({}, item, { dataTestId: `${dataTestId}-item-${item.id}` }), item.id))) })] })] }));
|
|
1480
1463
|
};
|
|
1481
1464
|
function isNotNullOrUndefined(value) {
|
|
@@ -1517,11 +1500,12 @@ function withForm(Component) {
|
|
|
1517
1500
|
return (jsx(Component, Object.assign({}, restProps, field, { onChange: Component === NumberInput
|
|
1518
1501
|
? (value) => field.onChange(value.target.valueAsNumber)
|
|
1519
1502
|
: field.onChange, value: (_a = field.value) !== null && _a !== void 0 ? _a : '', disabled: ((_b = field.disabled) !== null && _b !== void 0 ? _b : restProps.disabled) ||
|
|
1520
|
-
formState.isSubmitting, hasErrors: fieldState.error })));
|
|
1503
|
+
formState.isSubmitting, hasErrors: !!fieldState.error })));
|
|
1521
1504
|
} }));
|
|
1522
1505
|
};
|
|
1523
1506
|
}
|
|
1524
1507
|
const FormInputs = {
|
|
1508
|
+
BasicInput: withForm(BasicInput),
|
|
1525
1509
|
Text: withForm(TextInput),
|
|
1526
1510
|
Email: withForm(EmailInput),
|
|
1527
1511
|
Password: withForm(PasswordInput),
|
|
@@ -1552,6 +1536,8 @@ const dotSizeClassNames = {
|
|
|
1552
1536
|
},
|
|
1553
1537
|
};
|
|
1554
1538
|
const colorClassNames = {
|
|
1539
|
+
primary: 'bg-primary text-primary-foreground',
|
|
1540
|
+
secondary: 'bg-secondary text-secondary-foreground',
|
|
1555
1541
|
slate: 'bg-slate-500 dark:bg-slate-600',
|
|
1556
1542
|
gray: 'bg-gray-500 dark:bg-gray-600',
|
|
1557
1543
|
zinc: 'bg-zinc-500 dark:bg-zinc-600',
|
|
@@ -1987,7 +1973,6 @@ const SidebarContextProvider = (_a) => {
|
|
|
1987
1973
|
var { defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children } = _a, props = __rest(_a, ["defaultOpen", "open", "onOpenChange", "className", "style", "children"]);
|
|
1988
1974
|
const isMobile = useIsMobile();
|
|
1989
1975
|
const [openMobile, setOpenMobile] = useState(false);
|
|
1990
|
-
useRef(typeof document === 'undefined' ? null : document.documentElement);
|
|
1991
1976
|
// This is the internal state of the sidebar.
|
|
1992
1977
|
// We use openProp and setOpenProp for control from outside the component.
|
|
1993
1978
|
const [_open, _setOpen] = useState(getValueFromCookie(SIDEBAR_COOKIE_NAME, defaultOpen));
|