@codefast/ui 0.3.16-canary.3 → 0.4.0-canary.4
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/CHANGELOG.md +60 -0
- package/README.md +27 -16
- package/dist/components/accordion.d.mts +7 -22
- package/dist/components/accordion.mjs +26 -29
- package/dist/components/alert-dialog.d.mts +27 -26
- package/dist/components/alert-dialog.mjs +53 -45
- package/dist/components/alert.d.mts +12 -2
- package/dist/components/alert.mjs +15 -6
- package/dist/components/aspect-ratio.d.mts +2 -2
- package/dist/components/aspect-ratio.mjs +2 -3
- package/dist/components/avatar.d.mts +41 -5
- package/dist/components/avatar.mjs +40 -10
- package/dist/components/badge.mjs +4 -4
- package/dist/components/breadcrumb.d.mts +1 -0
- package/dist/components/breadcrumb.mjs +11 -10
- package/dist/components/button-group.d.mts +1 -1
- package/dist/components/button-group.mjs +6 -7
- package/dist/components/button.d.mts +0 -1
- package/dist/components/button.mjs +7 -7
- package/dist/components/calendar.d.mts +6 -2
- package/dist/components/calendar.mjs +39 -43
- package/dist/components/card.d.mts +4 -2
- package/dist/components/card.mjs +9 -9
- package/dist/components/carousel.d.mts +16 -4
- package/dist/components/carousel.mjs +24 -11
- package/dist/components/chart.d.mts +8 -3
- package/dist/components/chart.mjs +21 -15
- package/dist/components/checkbox-cards.mjs +4 -4
- package/dist/components/checkbox-group.mjs +3 -4
- package/dist/components/checkbox.d.mts +2 -2
- package/dist/components/checkbox.mjs +6 -7
- package/dist/components/collapsible.d.mts +4 -4
- package/dist/components/collapsible.mjs +4 -5
- package/dist/components/command.d.mts +11 -1
- package/dist/components/command.mjs +35 -32
- package/dist/components/context-menu.d.mts +22 -15
- package/dist/components/context-menu.mjs +44 -39
- package/dist/components/dialog.d.mts +19 -23
- package/dist/components/dialog.mjs +48 -47
- package/dist/components/direction.d.mts +24 -0
- package/dist/components/direction.mjs +18 -0
- package/dist/components/drawer.d.mts +2 -20
- package/dist/components/drawer.mjs +17 -25
- package/dist/components/dropdown-menu.d.mts +22 -15
- package/dist/components/dropdown-menu.mjs +41 -37
- package/dist/components/empty.mjs +5 -5
- package/dist/components/field.d.mts +1 -1
- package/dist/components/field.mjs +11 -12
- package/dist/components/form.d.mts +6 -7
- package/dist/components/form.mjs +6 -7
- package/dist/components/hover-card.d.mts +5 -5
- package/dist/components/hover-card.mjs +14 -12
- package/dist/components/input-group.d.mts +1 -1
- package/dist/components/input-group.mjs +12 -7
- package/dist/components/input-number.d.mts +3 -1
- package/dist/components/input-number.mjs +49 -27
- package/dist/components/input-otp.mjs +9 -7
- package/dist/components/input-password.mjs +1 -4
- package/dist/components/input-search.mjs +3 -5
- package/dist/components/input.mjs +1 -2
- package/dist/components/item.mjs +9 -9
- package/dist/components/kbd.mjs +1 -1
- package/dist/components/label.d.mts +2 -2
- package/dist/components/label.mjs +3 -4
- package/dist/components/menubar.d.mts +22 -16
- package/dist/components/menubar.mjs +54 -47
- package/dist/components/native-select.d.mts +5 -1
- package/dist/components/native-select.mjs +9 -6
- package/dist/components/navigation-menu.d.mts +30 -8
- package/dist/components/navigation-menu.mjs +33 -23
- package/dist/components/pagination.d.mts +6 -0
- package/dist/components/pagination.mjs +26 -11
- package/dist/components/popover.d.mts +40 -7
- package/dist/components/popover.mjs +46 -14
- package/dist/components/progress-circle.d.mts +1 -1
- package/dist/components/progress-circle.mjs +1 -2
- package/dist/components/progress.d.mts +2 -2
- package/dist/components/progress.mjs +5 -6
- package/dist/components/radio-cards.d.mts +3 -3
- package/dist/components/radio-cards.mjs +11 -11
- package/dist/components/radio-group.d.mts +3 -3
- package/dist/components/radio-group.mjs +9 -9
- package/dist/components/radio.mjs +2 -3
- package/dist/components/resizable.mjs +3 -8
- package/dist/components/scroll-area.d.mts +5 -5
- package/dist/components/scroll-area.mjs +13 -10
- package/dist/components/select.d.mts +14 -14
- package/dist/components/select.mjs +47 -47
- package/dist/components/separator.d.mts +2 -2
- package/dist/components/separator.mjs +3 -4
- package/dist/components/sheet.d.mts +13 -14
- package/dist/components/sheet.mjs +41 -39
- package/dist/components/sidebar.d.mts +2 -3
- package/dist/components/sidebar.mjs +46 -46
- package/dist/components/skeleton.mjs +1 -1
- package/dist/components/slider.d.mts +2 -2
- package/dist/components/slider.mjs +9 -11
- package/dist/components/sonner.mjs +11 -3
- package/dist/components/spinner.mjs +6 -7
- package/dist/components/switch.d.mts +5 -2
- package/dist/components/switch.mjs +7 -7
- package/dist/components/table.mjs +10 -10
- package/dist/components/tabs.d.mts +8 -5
- package/dist/components/tabs.mjs +18 -12
- package/dist/components/textarea.mjs +1 -1
- package/dist/components/toggle-group.d.mts +9 -6
- package/dist/components/toggle-group.mjs +19 -20
- package/dist/components/toggle.d.mts +2 -3
- package/dist/components/toggle.mjs +4 -6
- package/dist/components/tooltip.d.mts +7 -6
- package/dist/components/tooltip.mjs +19 -17
- package/dist/hooks/use-animated-value.mjs +0 -1
- package/dist/hooks/use-copy-to-clipboard.mjs +0 -1
- package/dist/hooks/use-is-mobile.mjs +0 -1
- package/dist/hooks/use-media-query.mjs +0 -1
- package/dist/hooks/use-mutation-observer.mjs +0 -1
- package/dist/hooks/use-pagination.mjs +0 -1
- package/dist/index.d.mts +15 -13
- package/dist/index.mjs +18 -16
- package/dist/primitives/checkbox-group.d.mts +9 -10
- package/dist/primitives/checkbox-group.mjs +14 -19
- package/dist/primitives/input-number.d.mts +3 -3
- package/dist/primitives/input-number.mjs +3 -5
- package/dist/primitives/input.d.mts +4 -4
- package/dist/primitives/input.mjs +2 -3
- package/dist/primitives/progress-circle.d.mts +3 -3
- package/dist/primitives/progress-circle.mjs +2 -3
- package/dist/variants/alert.d.mts +1 -1
- package/dist/variants/alert.mjs +3 -13
- package/dist/variants/badge.d.mts +6 -4
- package/dist/variants/badge.mjs +7 -34
- package/dist/variants/button-group.d.mts +2 -2
- package/dist/variants/button-group.mjs +3 -14
- package/dist/variants/button.d.mts +12 -10
- package/dist/variants/button.mjs +15 -57
- package/dist/variants/empty.d.mts +1 -1
- package/dist/variants/empty.mjs +2 -7
- package/dist/variants/field.d.mts +3 -3
- package/dist/variants/field.mjs +4 -22
- package/dist/variants/input-group.d.mts +9 -9
- package/dist/variants/input-group.mjs +11 -70
- package/dist/variants/input-number.d.mts +45 -0
- package/dist/variants/input-number.mjs +40 -0
- package/dist/variants/item.d.mts +5 -4
- package/dist/variants/item.mjs +9 -31
- package/dist/variants/navigation-menu.d.mts +1 -1
- package/dist/variants/navigation-menu.mjs +1 -5
- package/dist/variants/progress-circle.d.mts +1 -1
- package/dist/variants/progress-circle.mjs +1 -5
- package/dist/variants/scroll-area.d.mts +2 -2
- package/dist/variants/scroll-area.mjs +3 -8
- package/dist/variants/separator.mjs +6 -6
- package/dist/variants/sheet.d.mts +4 -4
- package/dist/variants/sheet.mjs +5 -38
- package/dist/variants/sidebar.d.mts +4 -4
- package/dist/variants/sidebar.mjs +6 -23
- package/dist/variants/tabs.d.mts +18 -0
- package/dist/variants/tabs.mjs +15 -0
- package/dist/variants/toggle.d.mts +4 -4
- package/dist/variants/toggle.mjs +9 -27
- package/package.json +27 -44
- package/src/components/accordion.tsx +26 -68
- package/src/components/alert-dialog.tsx +70 -86
- package/src/components/alert.tsx +27 -19
- package/src/components/aspect-ratio.tsx +1 -4
- package/src/components/avatar.tsx +99 -12
- package/src/components/badge.tsx +5 -8
- package/src/components/breadcrumb.tsx +18 -24
- package/src/components/button-group.tsx +10 -20
- package/src/components/button.tsx +8 -19
- package/src/components/calendar.tsx +77 -132
- package/src/components/card.tsx +16 -22
- package/src/components/carousel.tsx +38 -56
- package/src/components/chart.tsx +41 -92
- package/src/components/checkbox-cards.tsx +10 -30
- package/src/components/checkbox-group.tsx +5 -28
- package/src/components/checkbox.tsx +5 -26
- package/src/components/collapsible.tsx +1 -4
- package/src/components/command.tsx +52 -65
- package/src/components/context-menu.tsx +46 -125
- package/src/components/dialog.tsx +49 -101
- package/src/components/direction.tsx +32 -0
- package/src/components/drawer.tsx +17 -79
- package/src/components/dropdown-menu.tsx +39 -118
- package/src/components/empty.tsx +6 -20
- package/src/components/field.tsx +19 -52
- package/src/components/form.tsx +19 -61
- package/src/components/hover-card.tsx +4 -27
- package/src/components/input-group.tsx +13 -52
- package/src/components/input-number.tsx +55 -75
- package/src/components/input-otp.tsx +19 -38
- package/src/components/input-password.tsx +5 -29
- package/src/components/input-search.tsx +6 -23
- package/src/components/input.tsx +1 -17
- package/src/components/item.tsx +17 -31
- package/src/components/kbd.tsx +2 -14
- package/src/components/label.tsx +2 -10
- package/src/components/menubar.tsx +34 -125
- package/src/components/native-select.tsx +21 -30
- package/src/components/navigation-menu.tsx +34 -94
- package/src/components/pagination.tsx +28 -34
- package/src/components/popover.tsx +66 -35
- package/src/components/progress-circle.tsx +7 -25
- package/src/components/progress.tsx +3 -16
- package/src/components/radio-cards.tsx +8 -27
- package/src/components/radio-group.tsx +7 -27
- package/src/components/radio.tsx +3 -24
- package/src/components/resizable.tsx +5 -26
- package/src/components/scroll-area.tsx +12 -32
- package/src/components/select.tsx +36 -59
- package/src/components/separator.tsx +4 -18
- package/src/components/sheet.tsx +37 -74
- package/src/components/sidebar.tsx +47 -177
- package/src/components/skeleton.tsx +1 -3
- package/src/components/slider.tsx +7 -36
- package/src/components/sonner.tsx +16 -6
- package/src/components/spinner.tsx +6 -15
- package/src/components/switch.tsx +8 -30
- package/src/components/table.tsx +18 -35
- package/src/components/tabs.tsx +16 -34
- package/src/components/textarea.tsx +1 -15
- package/src/components/toggle-group.tsx +34 -38
- package/src/components/toggle.tsx +4 -13
- package/src/components/tooltip.tsx +11 -37
- package/src/css/foundation/base.css +50 -0
- package/src/css/foundation/motion.css +36 -0
- package/src/css/foundation/source.css +3 -0
- package/src/css/foundation/tokens.css +71 -0
- package/src/css/foundation/variants.css +113 -0
- package/src/css/preset.css +5 -214
- package/src/css/style.css +1 -1
- package/src/hooks/use-animated-value.ts +1 -7
- package/src/hooks/use-copy-to-clipboard.ts +1 -6
- package/src/hooks/use-is-mobile.ts +0 -2
- package/src/hooks/use-media-query.ts +0 -2
- package/src/hooks/use-mutation-observer.ts +0 -3
- package/src/hooks/use-pagination.ts +0 -2
- package/src/index.ts +39 -80
- package/src/primitives/checkbox-group.tsx +25 -39
- package/src/primitives/input-number.tsx +17 -63
- package/src/primitives/input.tsx +8 -24
- package/src/primitives/progress-circle.tsx +13 -43
- package/src/variants/alert.ts +3 -14
- package/src/variants/badge.ts +8 -35
- package/src/variants/button-group.ts +5 -18
- package/src/variants/button.ts +21 -58
- package/src/variants/empty.ts +2 -11
- package/src/variants/field.ts +6 -19
- package/src/variants/input-group.ts +12 -64
- package/src/variants/input-number.ts +65 -0
- package/src/variants/item.ts +10 -32
- package/src/variants/navigation-menu.ts +1 -8
- package/src/variants/progress-circle.ts +1 -2
- package/src/variants/scroll-area.ts +3 -9
- package/src/variants/separator.ts +6 -7
- package/src/variants/sheet.ts +6 -39
- package/src/variants/sidebar.ts +7 -27
- package/src/variants/tabs.ts +34 -0
- package/src/variants/toggle.ts +9 -28
- /package/src/css/{amber.css → themes/amber.css} +0 -0
- /package/src/css/{blue.css → themes/blue.css} +0 -0
- /package/src/css/{cyan.css → themes/cyan.css} +0 -0
- /package/src/css/{emerald.css → themes/emerald.css} +0 -0
- /package/src/css/{fuchsia.css → themes/fuchsia.css} +0 -0
- /package/src/css/{gray.css → themes/gray.css} +0 -0
- /package/src/css/{green.css → themes/green.css} +0 -0
- /package/src/css/{indigo.css → themes/indigo.css} +0 -0
- /package/src/css/{lime.css → themes/lime.css} +0 -0
- /package/src/css/{neutral.css → themes/neutral.css} +0 -0
- /package/src/css/{orange.css → themes/orange.css} +0 -0
- /package/src/css/{pink.css → themes/pink.css} +0 -0
- /package/src/css/{purple.css → themes/purple.css} +0 -0
- /package/src/css/{red.css → themes/red.css} +0 -0
- /package/src/css/{rose.css → themes/rose.css} +0 -0
- /package/src/css/{sky.css → themes/sky.css} +0 -0
- /package/src/css/{slate.css → themes/slate.css} +0 -0
- /package/src/css/{stone.css → themes/stone.css} +0 -0
- /package/src/css/{teal.css → themes/teal.css} +0 -0
- /package/src/css/{violet.css → themes/violet.css} +0 -0
- /package/src/css/{yellow.css → themes/yellow.css} +0 -0
- /package/src/css/{zinc.css → themes/zinc.css} +0 -0
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { Scope } from "@radix-ui/react-context";
|
|
1
|
+
import { Context } from "radix-ui/internal";
|
|
4
2
|
import type { ComponentProps, ReactNode } from "react";
|
|
5
|
-
|
|
6
|
-
import { createContextScope } from "@radix-ui/react-context";
|
|
7
3
|
import { useId, useMemo } from "react";
|
|
8
4
|
|
|
9
5
|
/* -----------------------------------------------------------------------------
|
|
@@ -12,7 +8,7 @@ import { useId, useMemo } from "react";
|
|
|
12
8
|
|
|
13
9
|
const PROGRESS_CIRCLE_PROVIDER_NAME = "ProgressCircleProvider";
|
|
14
10
|
|
|
15
|
-
type ScopedProps<P> = P & { __scopeProgressCircle?: Scope };
|
|
11
|
+
type ScopedProps<P> = P & { __scopeProgressCircle?: Context.Scope };
|
|
16
12
|
|
|
17
13
|
/**
|
|
18
14
|
* Defines color thresholds based on progress values
|
|
@@ -109,9 +105,8 @@ interface ProgressCircleContextValue {
|
|
|
109
105
|
valueText: string;
|
|
110
106
|
}
|
|
111
107
|
|
|
112
|
-
const [createProgressCircleContext, createProgressCircleScope] =
|
|
113
|
-
PROGRESS_CIRCLE_PROVIDER_NAME
|
|
114
|
-
);
|
|
108
|
+
const [createProgressCircleContext, createProgressCircleScope] =
|
|
109
|
+
Context.createContextScope(PROGRESS_CIRCLE_PROVIDER_NAME);
|
|
115
110
|
|
|
116
111
|
const [ProgressCircleContextProvider, useProgressCircleContext] =
|
|
117
112
|
createProgressCircleContext<ProgressCircleContextValue>(PROGRESS_CIRCLE_PROVIDER_NAME);
|
|
@@ -237,19 +232,13 @@ function ProgressCircleProvider({
|
|
|
237
232
|
const isIndeterminate = value === null || value === undefined;
|
|
238
233
|
const clampedValue = isIndeterminate ? undefined : clamp(validMin, validMax, value);
|
|
239
234
|
const range = validMax - validMin;
|
|
240
|
-
const percentage =
|
|
241
|
-
clampedValue !== undefined && range > 0 ? ((clampedValue - validMin) / range) * 100 : 0;
|
|
235
|
+
const percentage = clampedValue !== undefined && range > 0 ? ((clampedValue - validMin) / range) * 100 : 0;
|
|
242
236
|
const valueText =
|
|
243
|
-
clampedValue !== undefined && formatValue
|
|
244
|
-
? formatValue(clampedValue)
|
|
245
|
-
: `${Math.round(percentage).toString()}%`;
|
|
237
|
+
clampedValue !== undefined && formatValue ? formatValue(clampedValue) : `${Math.round(percentage).toString()}%`;
|
|
246
238
|
|
|
247
239
|
// Sort thresholds by value
|
|
248
240
|
const sortedThresholds = useMemo(
|
|
249
|
-
() =>
|
|
250
|
-
thresholds && thresholds.length > 0
|
|
251
|
-
? [...thresholds].toSorted((a, b) => a.value - b.value)
|
|
252
|
-
: [],
|
|
241
|
+
() => (thresholds && thresholds.length > 0 ? [...thresholds].toSorted((a, b) => a.value - b.value) : []),
|
|
253
242
|
[thresholds],
|
|
254
243
|
);
|
|
255
244
|
|
|
@@ -314,10 +303,7 @@ type ProgressCircleProps = ComponentProps<"div">;
|
|
|
314
303
|
*
|
|
315
304
|
* @since 0.3.16-canary.0
|
|
316
305
|
*/
|
|
317
|
-
function ProgressCircle({
|
|
318
|
-
__scopeProgressCircle,
|
|
319
|
-
...props
|
|
320
|
-
}: ScopedProps<ProgressCircleProps>): ReactNode {
|
|
306
|
+
function ProgressCircle({ __scopeProgressCircle, ...props }: ScopedProps<ProgressCircleProps>): ReactNode {
|
|
321
307
|
return <div {...props} />;
|
|
322
308
|
}
|
|
323
309
|
|
|
@@ -339,10 +325,7 @@ type ProgressCircleSVGProps = ComponentProps<"svg">;
|
|
|
339
325
|
*
|
|
340
326
|
* @since 0.3.16-canary.0
|
|
341
327
|
*/
|
|
342
|
-
function ProgressCircleSVG({
|
|
343
|
-
__scopeProgressCircle,
|
|
344
|
-
...props
|
|
345
|
-
}: ScopedProps<ProgressCircleSVGProps>): ReactNode {
|
|
328
|
+
function ProgressCircleSVG({ __scopeProgressCircle, ...props }: ScopedProps<ProgressCircleSVGProps>): ReactNode {
|
|
346
329
|
const { clampedValue, id, max, min, size, valueText } = useProgressCircleContext(
|
|
347
330
|
PROGRESS_CIRCLE_SVG_NAME,
|
|
348
331
|
__scopeProgressCircle,
|
|
@@ -383,10 +366,7 @@ type ProgressCircleTrackProps = ComponentProps<"circle">;
|
|
|
383
366
|
*
|
|
384
367
|
* @since 0.3.16-canary.0
|
|
385
368
|
*/
|
|
386
|
-
function ProgressCircleTrack({
|
|
387
|
-
__scopeProgressCircle,
|
|
388
|
-
...props
|
|
389
|
-
}: ScopedProps<ProgressCircleTrackProps>): ReactNode {
|
|
369
|
+
function ProgressCircleTrack({ __scopeProgressCircle, ...props }: ScopedProps<ProgressCircleTrackProps>): ReactNode {
|
|
390
370
|
const { center, radius, strokeWidth, threshold } = useProgressCircleContext(
|
|
391
371
|
PROGRESS_CIRCLE_TRACK_NAME,
|
|
392
372
|
__scopeProgressCircle,
|
|
@@ -427,15 +407,8 @@ function ProgressCircleIndicator({
|
|
|
427
407
|
__scopeProgressCircle,
|
|
428
408
|
...props
|
|
429
409
|
}: ScopedProps<ProgressCircleIndicatorProps>): ReactNode {
|
|
430
|
-
const {
|
|
431
|
-
|
|
432
|
-
circumference,
|
|
433
|
-
radius,
|
|
434
|
-
rotationTransform,
|
|
435
|
-
strokeDashoffset,
|
|
436
|
-
strokeWidth,
|
|
437
|
-
threshold,
|
|
438
|
-
} = useProgressCircleContext(PROGRESS_CIRCLE_INDICATOR_NAME, __scopeProgressCircle);
|
|
410
|
+
const { center, circumference, radius, rotationTransform, strokeDashoffset, strokeWidth, threshold } =
|
|
411
|
+
useProgressCircleContext(PROGRESS_CIRCLE_INDICATOR_NAME, __scopeProgressCircle);
|
|
439
412
|
|
|
440
413
|
return (
|
|
441
414
|
<circle
|
|
@@ -479,10 +452,7 @@ function ProgressCircleValue({
|
|
|
479
452
|
children,
|
|
480
453
|
...props
|
|
481
454
|
}: ScopedProps<ProgressCircleValueProps>): ReactNode {
|
|
482
|
-
const { clampedValue, valueText } = useProgressCircleContext(
|
|
483
|
-
PROGRESS_CIRCLE_VALUE_NAME,
|
|
484
|
-
__scopeProgressCircle,
|
|
485
|
-
);
|
|
455
|
+
const { clampedValue, valueText } = useProgressCircleContext(PROGRESS_CIRCLE_VALUE_NAME, __scopeProgressCircle);
|
|
486
456
|
|
|
487
457
|
if (typeof children === "function") {
|
|
488
458
|
return children({ value: clampedValue, valueText });
|
package/src/variants/alert.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { VariantProps } from "#/lib/utils";
|
|
2
|
-
|
|
3
2
|
import { tv } from "#/lib/utils";
|
|
4
3
|
|
|
5
4
|
/* -----------------------------------------------------------------------------
|
|
@@ -10,24 +9,14 @@ import { tv } from "#/lib/utils";
|
|
|
10
9
|
* @since 0.3.16-canary.0
|
|
11
10
|
*/
|
|
12
11
|
const alertVariants = tv({
|
|
13
|
-
base: [
|
|
14
|
-
"relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 px-4 py-3",
|
|
15
|
-
"rounded-xl border",
|
|
16
|
-
"bg-card text-sm",
|
|
17
|
-
"has-[>svg]:grid-cols-[--spacing(4)_1fr] has-[>svg]:gap-x-3",
|
|
18
|
-
"[&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
|
|
19
|
-
],
|
|
12
|
+
base: "group/alert relative grid w-full gap-0.5 rounded-lg border px-4 py-3 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",
|
|
20
13
|
defaultVariants: {
|
|
21
14
|
variant: "default",
|
|
22
15
|
},
|
|
23
16
|
variants: {
|
|
24
17
|
variant: {
|
|
25
|
-
default: "text-card-foreground",
|
|
26
|
-
destructive: [
|
|
27
|
-
"text-destructive",
|
|
28
|
-
"*:data-[slot=alert-description]:text-destructive/90",
|
|
29
|
-
"[&>svg]:text-current",
|
|
30
|
-
],
|
|
18
|
+
default: "bg-card text-card-foreground",
|
|
19
|
+
destructive: "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current",
|
|
31
20
|
},
|
|
32
21
|
},
|
|
33
22
|
});
|
package/src/variants/badge.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { VariantProps } from "#/lib/utils";
|
|
2
|
-
|
|
3
2
|
import { tv } from "#/lib/utils";
|
|
4
3
|
|
|
5
4
|
/* -----------------------------------------------------------------------------
|
|
@@ -10,45 +9,19 @@ import { tv } from "#/lib/utils";
|
|
|
10
9
|
* @since 0.3.16-canary.0
|
|
11
10
|
*/
|
|
12
11
|
const badgeVariants = tv({
|
|
13
|
-
base: [
|
|
14
|
-
"inline-flex w-fit shrink-0 items-center justify-center gap-2 px-1.5 py-0.5",
|
|
15
|
-
"rounded-md border outline-hidden",
|
|
16
|
-
"text-xs font-medium whitespace-nowrap",
|
|
17
|
-
"transition",
|
|
18
|
-
"focus-visible:ring-3 focus-visible:ring-ring/50",
|
|
19
|
-
"[&>svg]:size-3 [&>svg]:shrink-0",
|
|
20
|
-
],
|
|
12
|
+
base: "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
|
|
21
13
|
defaultVariants: {
|
|
22
14
|
variant: "default",
|
|
23
15
|
},
|
|
24
16
|
variants: {
|
|
25
17
|
variant: {
|
|
26
|
-
default: [
|
|
27
|
-
|
|
28
|
-
"bg-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
],
|
|
33
|
-
destructive: [
|
|
34
|
-
"border-transparent",
|
|
35
|
-
"bg-destructive text-white",
|
|
36
|
-
"focus-visible:ring-destructive/20",
|
|
37
|
-
"dark:bg-destructive/60",
|
|
38
|
-
"dark:focus-visible:ring-destructive/40",
|
|
39
|
-
"[a&]:hover:bg-destructive/90",
|
|
40
|
-
],
|
|
41
|
-
outline: [
|
|
42
|
-
"border-input",
|
|
43
|
-
"bg-background",
|
|
44
|
-
"focus-visible:border-ring",
|
|
45
|
-
"[a&]:hover:border-ring/60 [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
|
46
|
-
],
|
|
47
|
-
secondary: [
|
|
48
|
-
"border-transparent",
|
|
49
|
-
"bg-secondary text-secondary-foreground",
|
|
50
|
-
"[a&]:hover:bg-secondary/80",
|
|
51
|
-
],
|
|
18
|
+
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
19
|
+
destructive:
|
|
20
|
+
"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
|
|
21
|
+
ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
22
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
23
|
+
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
24
|
+
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
52
25
|
},
|
|
53
26
|
},
|
|
54
27
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { VariantProps } from "#/lib/utils";
|
|
2
|
-
|
|
3
2
|
import { tv } from "#/lib/utils";
|
|
4
3
|
|
|
5
4
|
/* -----------------------------------------------------------------------------
|
|
@@ -10,28 +9,16 @@ import { tv } from "#/lib/utils";
|
|
|
10
9
|
* @since 0.3.16-canary.0
|
|
11
10
|
*/
|
|
12
11
|
const buttonGroupVariants = tv({
|
|
13
|
-
base: [
|
|
14
|
-
"flex w-fit items-stretch",
|
|
15
|
-
"has-[>[data-slot=button-group]]:gap-2",
|
|
16
|
-
"[&>*]:focus-visible:relative [&>*]:focus-visible:z-10",
|
|
17
|
-
"has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg",
|
|
18
|
-
"[&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit",
|
|
19
|
-
"[&>input]:flex-1",
|
|
20
|
-
],
|
|
12
|
+
base: "group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
|
|
21
13
|
defaultVariants: {
|
|
22
14
|
orientation: "horizontal",
|
|
23
15
|
},
|
|
24
16
|
variants: {
|
|
25
17
|
orientation: {
|
|
26
|
-
horizontal:
|
|
27
|
-
"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0",
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
vertical: [
|
|
31
|
-
"flex-col",
|
|
32
|
-
"[&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0",
|
|
33
|
-
"[&>*:not(:last-child)]:rounded-b-none",
|
|
34
|
-
],
|
|
18
|
+
horizontal:
|
|
19
|
+
"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-md!",
|
|
20
|
+
vertical:
|
|
21
|
+
"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-md!",
|
|
35
22
|
},
|
|
36
23
|
},
|
|
37
24
|
});
|
package/src/variants/button.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { VariantProps } from "#/lib/utils";
|
|
2
|
-
|
|
3
2
|
import { tv } from "#/lib/utils";
|
|
4
3
|
|
|
5
4
|
/* -----------------------------------------------------------------------------
|
|
@@ -10,72 +9,36 @@ import { tv } from "#/lib/utils";
|
|
|
10
9
|
* @since 0.3.16-canary.0
|
|
11
10
|
*/
|
|
12
11
|
const buttonVariants = tv({
|
|
13
|
-
base: [
|
|
14
|
-
"inline-flex shrink-0 items-center justify-center gap-2",
|
|
15
|
-
"rounded-lg outline-hidden",
|
|
16
|
-
"text-sm font-medium whitespace-nowrap",
|
|
17
|
-
"transition duration-150 ease-snappy select-none",
|
|
18
|
-
"motion-reduce:transition-none motion-reduce:duration-0",
|
|
19
|
-
"active:not-disabled:translate-y-px",
|
|
20
|
-
"focus-visible:ring-3",
|
|
21
|
-
"disabled:opacity-50",
|
|
22
|
-
"[&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
23
|
-
],
|
|
12
|
+
base: "group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
24
13
|
defaultVariants: {
|
|
25
|
-
size: "
|
|
14
|
+
size: "default",
|
|
26
15
|
variant: "default",
|
|
27
16
|
},
|
|
28
17
|
variants: {
|
|
29
18
|
size: {
|
|
30
|
-
|
|
19
|
+
default:
|
|
20
|
+
"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2", // 36px
|
|
21
|
+
xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3", // 24px
|
|
22
|
+
sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5", // 32px
|
|
23
|
+
lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2", // 40px
|
|
24
|
+
|
|
31
25
|
icon: "size-9", // 36px
|
|
26
|
+
"icon-xs":
|
|
27
|
+
"size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3", // 24px
|
|
28
|
+
"icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md", // 32px
|
|
32
29
|
"icon-lg": "size-10", // 40px
|
|
33
|
-
|
|
34
|
-
sm: ["h-8 px-3", "has-[>svg]:px-2.5"], // 32px
|
|
35
|
-
md: ["h-9 px-4", "has-[>svg]:px-3"], // 36px
|
|
36
|
-
lg: ["h-10 px-6", "has-[>svg]:px-4"], // 40px
|
|
37
30
|
},
|
|
38
31
|
variant: {
|
|
39
|
-
default:
|
|
40
|
-
|
|
41
|
-
"hover:
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"bg-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
"dark:bg-destructive/60",
|
|
50
|
-
"dark:focus-visible:ring-destructive/40",
|
|
51
|
-
],
|
|
52
|
-
ghost: [
|
|
53
|
-
"hover:not-disabled:bg-secondary hover:not-disabled:text-secondary-foreground",
|
|
54
|
-
"focus-visible:ring-ring/50",
|
|
55
|
-
"dark:hover:not-disabled:bg-secondary/50",
|
|
56
|
-
],
|
|
57
|
-
link: [
|
|
58
|
-
"text-primary underline-offset-4",
|
|
59
|
-
"hover:not-disabled:underline",
|
|
60
|
-
"focus-visible:ring-ring/50",
|
|
61
|
-
],
|
|
62
|
-
outline: [
|
|
63
|
-
"border border-input shadow-xs",
|
|
64
|
-
"hover:not-disabled:border-ring/60 hover:not-disabled:bg-secondary hover:not-disabled:text-secondary-foreground",
|
|
65
|
-
"focus-visible:border-ring focus-visible:ring-ring/50",
|
|
66
|
-
"aria-invalid:border-destructive",
|
|
67
|
-
"focus-within:aria-invalid:ring-destructive/20",
|
|
68
|
-
"hover:not-disabled:aria-invalid:border-destructive/60",
|
|
69
|
-
"dark:bg-input/30",
|
|
70
|
-
"dark:hover:not-disabled:bg-input/50",
|
|
71
|
-
"dark:aria-invalid:border-destructive/70",
|
|
72
|
-
"dark:focus-within:aria-invalid:ring-destructive/40",
|
|
73
|
-
],
|
|
74
|
-
secondary: [
|
|
75
|
-
"bg-secondary text-secondary-foreground",
|
|
76
|
-
"hover:not-disabled:bg-secondary/80",
|
|
77
|
-
"focus-visible:ring-ring/50",
|
|
78
|
-
],
|
|
32
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
33
|
+
destructive:
|
|
34
|
+
"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
35
|
+
ghost:
|
|
36
|
+
"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
37
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
38
|
+
outline:
|
|
39
|
+
"border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
40
|
+
secondary:
|
|
41
|
+
"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
79
42
|
},
|
|
80
43
|
},
|
|
81
44
|
});
|
package/src/variants/empty.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { VariantProps } from "#/lib/utils";
|
|
2
|
-
|
|
3
2
|
import { tv } from "#/lib/utils";
|
|
4
3
|
|
|
5
4
|
/* -----------------------------------------------------------------------------
|
|
@@ -10,22 +9,14 @@ import { tv } from "#/lib/utils";
|
|
|
10
9
|
* @since 0.3.16-canary.0
|
|
11
10
|
*/
|
|
12
11
|
const emptyMediaVariants = tv({
|
|
13
|
-
base: [
|
|
14
|
-
"mb-2 flex shrink-0 items-center justify-center",
|
|
15
|
-
"[&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
16
|
-
],
|
|
12
|
+
base: "mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
17
13
|
defaultVariants: {
|
|
18
14
|
variant: "default",
|
|
19
15
|
},
|
|
20
16
|
variants: {
|
|
21
17
|
variant: {
|
|
22
18
|
default: "bg-transparent",
|
|
23
|
-
icon: [
|
|
24
|
-
"flex size-10 shrink-0 items-center justify-center",
|
|
25
|
-
"rounded-xl",
|
|
26
|
-
"bg-muted text-foreground",
|
|
27
|
-
"[&_svg:not([class*='size-'])]:size-6",
|
|
28
|
-
],
|
|
19
|
+
icon: "flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6",
|
|
29
20
|
},
|
|
30
21
|
},
|
|
31
22
|
});
|
package/src/variants/field.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { VariantProps } from "#/lib/utils";
|
|
2
|
-
|
|
3
2
|
import { tv } from "#/lib/utils";
|
|
4
3
|
|
|
5
4
|
/* -----------------------------------------------------------------------------
|
|
@@ -10,29 +9,17 @@ import { tv } from "#/lib/utils";
|
|
|
10
9
|
* @since 0.3.16-canary.0
|
|
11
10
|
*/
|
|
12
11
|
const fieldVariants = tv({
|
|
13
|
-
base:
|
|
12
|
+
base: "group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
|
|
14
13
|
defaultVariants: {
|
|
15
14
|
orientation: "vertical",
|
|
16
15
|
},
|
|
17
16
|
variants: {
|
|
18
17
|
orientation: {
|
|
19
|
-
horizontal:
|
|
20
|
-
"flex-row items-center",
|
|
21
|
-
|
|
22
|
-
"[
|
|
23
|
-
|
|
24
|
-
],
|
|
25
|
-
responsive: [
|
|
26
|
-
"flex-col",
|
|
27
|
-
"@md/field-group:flex-row @md/field-group:items-center",
|
|
28
|
-
"@md/field-group:has-[>[data-slot=field-content]]:items-start",
|
|
29
|
-
"[&>*]:w-full",
|
|
30
|
-
"@md/field-group:[&>*]:w-auto",
|
|
31
|
-
"[&>.sr-only]:w-auto",
|
|
32
|
-
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
33
|
-
"@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
34
|
-
],
|
|
35
|
-
vertical: ["flex-col", "[&>*]:w-full", "[&>.sr-only]:w-auto"],
|
|
18
|
+
horizontal:
|
|
19
|
+
"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
20
|
+
responsive:
|
|
21
|
+
"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
22
|
+
vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
|
|
36
23
|
},
|
|
37
24
|
},
|
|
38
25
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { VariantProps } from "#/lib/utils";
|
|
2
|
-
|
|
3
2
|
import { tv } from "#/lib/utils";
|
|
4
3
|
|
|
5
4
|
/* -----------------------------------------------------------------------------
|
|
@@ -10,23 +9,7 @@ import { tv } from "#/lib/utils";
|
|
|
10
9
|
* @since 0.3.16-canary.0
|
|
11
10
|
*/
|
|
12
11
|
const inputGroupVariants = tv({
|
|
13
|
-
base: [
|
|
14
|
-
"group/input-group relative flex h-9 w-full min-w-0 items-center",
|
|
15
|
-
"rounded-lg border border-input shadow-xs outline-none",
|
|
16
|
-
"transition-[color,box-shadow]",
|
|
17
|
-
"motion-reduce:transition-none",
|
|
18
|
-
"dark:bg-input/30",
|
|
19
|
-
"has-[>textarea]:h-auto",
|
|
20
|
-
"has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col",
|
|
21
|
-
"has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col",
|
|
22
|
-
"has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50",
|
|
23
|
-
"has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20",
|
|
24
|
-
"dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
|
|
25
|
-
"has-[>[data-align=block-end]]:[&>[data-slot=input-group-control]]:pt-3",
|
|
26
|
-
"has-[>[data-align=block-start]]:[&>[data-slot=input-group-control]]:pb-3",
|
|
27
|
-
"has-[>[data-align=inline-end]]:[&>[data-slot=input-group-control]]:pr-2",
|
|
28
|
-
"has-[>[data-align=inline-start]]:[&>[data-slot=input-group-control]]:pl-2",
|
|
29
|
-
],
|
|
12
|
+
base: "group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",
|
|
30
13
|
});
|
|
31
14
|
|
|
32
15
|
/* -----------------------------------------------------------------------------
|
|
@@ -37,41 +20,17 @@ const inputGroupVariants = tv({
|
|
|
37
20
|
* @since 0.3.16-canary.0
|
|
38
21
|
*/
|
|
39
22
|
const inputGroupAddonVariants = tv({
|
|
40
|
-
base: [
|
|
41
|
-
"flex h-auto items-center justify-center gap-2 py-1.5",
|
|
42
|
-
"text-sm font-medium text-muted-foreground",
|
|
43
|
-
"cursor-text select-none",
|
|
44
|
-
"group-data-disabled/input-group:opacity-50",
|
|
45
|
-
"[&>kbd]:rounded-[calc(var(--radius)-5px)]",
|
|
46
|
-
"[&>svg:not([class*='size-'])]:size-4",
|
|
47
|
-
],
|
|
23
|
+
base: "flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-disabled/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-3px)] [&>svg:not([class*='size-'])]:size-4",
|
|
48
24
|
defaultVariants: {
|
|
49
25
|
align: "inline-start",
|
|
50
26
|
},
|
|
51
27
|
variants: {
|
|
52
28
|
align: {
|
|
53
|
-
"block-end": [
|
|
54
|
-
|
|
55
|
-
"group-has-[>input]/input-group:pb-2
|
|
56
|
-
|
|
57
|
-
],
|
|
58
|
-
"block-start": [
|
|
59
|
-
"order-first w-full justify-start px-3 pt-3",
|
|
60
|
-
"group-has-[>input]/input-group:pt-2.5",
|
|
61
|
-
"[.border-b]:pb-3",
|
|
62
|
-
],
|
|
63
|
-
"inline-end": [
|
|
64
|
-
"order-last",
|
|
65
|
-
"pr-3",
|
|
66
|
-
"has-[>button]:mr-[-0.45rem]",
|
|
67
|
-
"has-[>kbd]:mr-[-0.35rem]",
|
|
68
|
-
],
|
|
69
|
-
"inline-start": [
|
|
70
|
-
"order-first",
|
|
71
|
-
"pl-3",
|
|
72
|
-
"has-[>button]:ml-[-0.45rem]",
|
|
73
|
-
"has-[>kbd]:ml-[-0.35rem]",
|
|
74
|
-
],
|
|
29
|
+
"block-end": "order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2",
|
|
30
|
+
"block-start":
|
|
31
|
+
"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2",
|
|
32
|
+
"inline-end": "order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]",
|
|
33
|
+
"inline-start": "order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]",
|
|
75
34
|
},
|
|
76
35
|
},
|
|
77
36
|
});
|
|
@@ -84,27 +43,16 @@ const inputGroupAddonVariants = tv({
|
|
|
84
43
|
* @since 0.3.16-canary.0
|
|
85
44
|
*/
|
|
86
45
|
const inputGroupButtonVariants = tv({
|
|
87
|
-
base:
|
|
88
|
-
"flex items-center gap-2",
|
|
89
|
-
"shadow-none",
|
|
90
|
-
"text-sm",
|
|
91
|
-
"[&>svg:not([class*='size-'])]:size-4",
|
|
92
|
-
],
|
|
46
|
+
base: "flex items-center gap-2 text-sm shadow-none",
|
|
93
47
|
defaultVariants: {
|
|
94
48
|
size: "xs",
|
|
95
49
|
},
|
|
96
50
|
variants: {
|
|
97
51
|
size: {
|
|
98
|
-
"icon-xs":
|
|
99
|
-
"icon-sm":
|
|
100
|
-
|
|
101
|
-
xs: [
|
|
102
|
-
"h-6 gap-1 px-2",
|
|
103
|
-
"rounded-[calc(var(--radius)-5px)]",
|
|
104
|
-
"has-[>svg]:px-2",
|
|
105
|
-
"[&>svg]:size-3.5",
|
|
106
|
-
],
|
|
107
|
-
sm: ["h-8 gap-1.5 px-2.5", "rounded-md", "has-[>svg]:px-2.5"],
|
|
52
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0",
|
|
53
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0",
|
|
54
|
+
sm: "",
|
|
55
|
+
xs: "h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
108
56
|
},
|
|
109
57
|
},
|
|
110
58
|
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { VariantProps } from "#/lib/utils";
|
|
2
|
+
import { tv } from "#/lib/utils";
|
|
3
|
+
|
|
4
|
+
/* -----------------------------------------------------------------------------
|
|
5
|
+
* Variant: InputNumber
|
|
6
|
+
* -------------------------------------------------------------------------- */
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @since 0.3.16-canary.0
|
|
10
|
+
*/
|
|
11
|
+
const inputNumberVariants = tv({
|
|
12
|
+
defaultVariants: {
|
|
13
|
+
variant: "stepper",
|
|
14
|
+
},
|
|
15
|
+
slots: {
|
|
16
|
+
/**
|
|
17
|
+
* Split layout: trailing increment button (always on the inline end).
|
|
18
|
+
*/
|
|
19
|
+
incrementButton:
|
|
20
|
+
"order-last h-full w-9 shrink-0 rounded-none rounded-r-[calc(var(--radius-md)-1px)] border-l border-l-input text-muted-foreground group-focus-within/input-number:border-l-ring group-has-aria-invalid/input-number:border-l-destructive focus-visible:bg-ring/50 focus-visible:ring-0 group-has-aria-invalid/input-number:focus-visible:bg-destructive/20 dark:group-has-aria-invalid/input-number:focus-visible:bg-destructive/40",
|
|
21
|
+
/**
|
|
22
|
+
* Split layout: leading decrement button (always on the inline start).
|
|
23
|
+
*/
|
|
24
|
+
decrementButton:
|
|
25
|
+
"order-first h-full w-9 shrink-0 rounded-none rounded-l-[calc(var(--radius-md)-1px)] border-r border-r-input text-muted-foreground group-focus-within/input-number:border-r-ring group-has-aria-invalid/input-number:border-r-destructive focus-visible:bg-ring/50 focus-visible:ring-0 group-has-aria-invalid/input-number:focus-visible:bg-destructive/20 dark:group-has-aria-invalid/input-number:focus-visible:bg-destructive/40",
|
|
26
|
+
/**
|
|
27
|
+
* Editable numeric input.
|
|
28
|
+
*/
|
|
29
|
+
field:
|
|
30
|
+
"h-full min-w-0 flex-1 bg-transparent px-2.5 py-1 outline-hidden selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed",
|
|
31
|
+
/**
|
|
32
|
+
* Outer container.
|
|
33
|
+
*/
|
|
34
|
+
root: "group/input-number relative flex h-9 w-full min-w-0 items-center overflow-hidden rounded-md border border-input bg-transparent text-base transition-[color,box-shadow] not-has-disabled:shadow-xs focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-disabled:opacity-50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 motion-reduce:transition-none md:text-sm dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40 [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
35
|
+
/**
|
|
36
|
+
* Stepper layout: stacked chevron column on the trailing edge.
|
|
37
|
+
*/
|
|
38
|
+
stepper:
|
|
39
|
+
"order-last grid h-full w-8 shrink-0 divide-y divide-input border-l border-l-input transition-colors group-focus-within/input-number:divide-ring group-focus-within/input-number:border-l-ring group-has-aria-invalid/input-number:divide-destructive group-has-aria-invalid/input-number:border-l-destructive motion-reduce:transition-none *:[button]:focus-visible:bg-ring/50 *:[button]:focus-visible:ring-0 group-has-aria-invalid/input-number:*:[button]:focus-visible:bg-destructive/20 dark:group-has-aria-invalid/input-number:*:[button]:focus-visible:bg-destructive/40",
|
|
40
|
+
/**
|
|
41
|
+
* Stepper layout: individual chevron button (shared by increment/decrement).
|
|
42
|
+
*/
|
|
43
|
+
stepperButton: "h-auto min-w-0 rounded-none px-0 text-muted-foreground",
|
|
44
|
+
},
|
|
45
|
+
variants: {
|
|
46
|
+
variant: {
|
|
47
|
+
split: {
|
|
48
|
+
field: "text-center tabular-nums",
|
|
49
|
+
},
|
|
50
|
+
stepper: {},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @since 0.3.16-canary.0
|
|
57
|
+
*/
|
|
58
|
+
type InputNumberVariants = VariantProps<typeof inputNumberVariants>;
|
|
59
|
+
|
|
60
|
+
/* -----------------------------------------------------------------------------
|
|
61
|
+
* Exports
|
|
62
|
+
* -------------------------------------------------------------------------- */
|
|
63
|
+
|
|
64
|
+
export { inputNumberVariants };
|
|
65
|
+
export type { InputNumberVariants };
|