@behavioral-agentic-design-system/core 0.38.0 → 0.39.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/scripts/a11y-lint.cjs +47 -34
- package/scripts/a11y-ratchet.mjs +10 -23
- package/scripts/build-tokens.cjs +42 -5
- package/scripts/health-report.mjs +52 -10
- package/scripts/lib/scan-roots.cjs +143 -0
- package/scripts/lint-slop.mjs +21 -28
- package/scripts/lint-token-intent.mjs +10 -16
- package/scripts/size-audit.cjs +15 -27
- package/src/api/layers/file.ts +1 -0
- package/src/app/preview/components/page.tsx +366 -0
- package/src/app/preview/health/page.tsx +8 -5
- package/src/app/preview/history/page.tsx +11 -0
- package/src/app/shell.tsx +262 -86
- package/src/components/Foundations/Typography.stories.tsx +82 -21
- package/src/components/customize/discipline-section.tsx +94 -0
- package/src/components/customize-tab.tsx +2 -0
- package/src/components/ui/accordion.tsx +67 -5
- package/src/components/ui/alert.tsx +20 -7
- package/src/components/ui/avatar.tsx +18 -4
- package/src/components/ui/breadcrumb.tsx +47 -0
- package/src/components/ui/checkbox-card.tsx +48 -8
- package/src/components/ui/checkbox.tsx +17 -8
- package/src/components/ui/format-date.tsx +107 -0
- package/src/components/ui/progress.tsx +6 -5
- package/src/components/ui/sparkline.tsx +210 -0
- package/src/components/ui/tag.tsx +17 -1
- package/src/components/ui/tags-input.tsx +84 -11
- package/src/components/ui/toggle-group.tsx +13 -0
- package/src/components/ui/week-picker.tsx +463 -0
- package/src/data/docs-index.ts +11 -0
- package/src/data/history.json +269 -0
- package/src/stories/Accordion.stories.tsx +59 -1
- package/src/stories/ActionBar.stories.tsx +1 -1
- package/src/stories/Affix.stories.tsx +1 -1
- package/src/stories/AiBadge.stories.tsx +1 -1
- package/src/stories/Alert.stories.tsx +36 -1
- package/src/stories/AlertDialog.stories.tsx +1 -1
- package/src/stories/Anchor.stories.tsx +1 -1
- package/src/stories/AngleSlider.stories.tsx +1 -1
- package/src/stories/AspectRatio.stories.tsx +1 -1
- package/src/stories/Autocomplete.stories.tsx +1 -1
- package/src/stories/Avatar.stories.tsx +41 -1
- package/src/stories/Badge.stories.tsx +1 -1
- package/src/stories/Blockquote.stories.tsx +1 -1
- package/src/stories/BottomNavigation.stories.tsx +1 -1
- package/src/stories/Breadcrumb.stories.tsx +38 -5
- package/src/stories/Burger.stories.tsx +1 -1
- package/src/stories/Button.stories.tsx +9 -1
- package/src/stories/ButtonGroup.stories.tsx +1 -1
- package/src/stories/Calendar.stories.tsx +1 -1
- package/src/stories/Card.stories.tsx +1 -1
- package/src/stories/Carousel.stories.tsx +1 -1
- package/src/stories/Cascader.stories.tsx +1 -1
- package/src/stories/Chart.stories.tsx +1 -1
- package/src/stories/ChatBubble.stories.tsx +1 -1
- package/src/stories/ChatMarker.stories.tsx +1 -1
- package/src/stories/Checkbox.stories.tsx +36 -5
- package/src/stories/CheckboxCard.stories.tsx +37 -2
- package/src/stories/CheckboxGroup.stories.tsx +1 -1
- package/src/stories/Chip.stories.tsx +1 -1
- package/src/stories/CircularProgress.stories.tsx +17 -1
- package/src/stories/Clipboard.stories.tsx +1 -1
- package/src/stories/CloseButton.stories.tsx +1 -1
- package/src/stories/Code.stories.tsx +1 -1
- package/src/stories/Collapsible.stories.tsx +1 -1
- package/src/stories/ColorPicker.stories.tsx +1 -1
- package/src/stories/ColorSwatch.stories.tsx +1 -1
- package/src/stories/Combobox.stories.tsx +1 -1
- package/src/stories/Command.stories.tsx +1 -1
- package/src/stories/Container.stories.tsx +1 -1
- package/src/stories/ContextMenu.stories.tsx +1 -1
- package/src/stories/CopyButton.stories.tsx +9 -1
- package/src/stories/DataList.stories.tsx +1 -1
- package/src/stories/DataTable.stories.tsx +1 -1
- package/src/stories/DateField.stories.tsx +1 -1
- package/src/stories/DatePicker.stories.tsx +1 -1
- package/src/stories/DateRangePicker.stories.tsx +1 -1
- package/src/stories/Dialog.stories.tsx +1 -1
- package/src/stories/Drawer.stories.tsx +1 -1
- package/src/stories/DropdownMenu.stories.tsx +1 -1
- package/src/stories/Editable.stories.tsx +1 -1
- package/src/stories/EmptyState.stories.tsx +1 -1
- package/src/stories/Field.stories.tsx +1 -1
- package/src/stories/Fieldset.stories.tsx +1 -1
- package/src/stories/FileButton.stories.tsx +1 -1
- package/src/stories/FileUpload.stories.tsx +1 -1
- package/src/stories/FloatLabel.stories.tsx +1 -1
- package/src/stories/FloatingActionButton.stories.tsx +1 -1
- package/src/stories/FloatingIndicator.stories.tsx +1 -1
- package/src/stories/FloatingPanel.stories.tsx +9 -1
- package/src/stories/FocusTrap.stories.tsx +1 -1
- package/src/stories/FormatByte.stories.tsx +1 -1
- package/src/stories/FormatDate.stories.tsx +174 -0
- package/src/stories/FormatNumber.stories.tsx +1 -1
- package/src/stories/Highlight.stories.tsx +1 -1
- package/src/stories/HoverCard.stories.tsx +1 -1
- package/src/stories/Image.stories.tsx +1 -1
- package/src/stories/Indicator.stories.tsx +17 -1
- package/src/stories/Input.stories.tsx +1 -1
- package/src/stories/InputClearButton.stories.tsx +1 -1
- package/src/stories/InputGroup.stories.tsx +1 -1
- package/src/stories/Kbd.stories.tsx +1 -1
- package/src/stories/KeyboardShortcut.stories.tsx +1 -1
- package/src/stories/Label.stories.tsx +1 -1
- package/src/stories/Link.stories.tsx +1 -1
- package/src/stories/List.stories.tsx +1 -1
- package/src/stories/Listbox.stories.tsx +1 -1
- package/src/stories/LoadingDots.stories.tsx +1 -1
- package/src/stories/LoadingOverlay.stories.tsx +1 -1
- package/src/stories/Mark.stories.tsx +1 -1
- package/src/stories/Marquee.stories.tsx +1 -1
- package/src/stories/Masonry.stories.tsx +1 -1
- package/src/stories/Menubar.stories.tsx +1 -1
- package/src/stories/Meter.stories.tsx +1 -1
- package/src/stories/MonthPicker.stories.tsx +1 -1
- package/src/stories/MotionToggle.stories.tsx +1 -1
- package/src/stories/MultiSelect.stories.tsx +1 -1
- package/src/stories/NativeSelect.stories.tsx +1 -1
- package/src/stories/NavLink.stories.tsx +1 -1
- package/src/stories/NavigationMenu.stories.tsx +1 -1
- package/src/stories/NavigationRail.stories.tsx +9 -1
- package/src/stories/Notification.stories.tsx +1 -1
- package/src/stories/NumberInput.stories.tsx +1 -1
- package/src/stories/Overlay.stories.tsx +1 -1
- package/src/stories/Pagination.stories.tsx +1 -1
- package/src/stories/PasswordInput.stories.tsx +1 -1
- package/src/stories/PinInput.stories.tsx +1 -1
- package/src/stories/Popover.stories.tsx +1 -1
- package/src/stories/Progress.stories.tsx +11 -1
- package/src/stories/Prose.stories.tsx +1 -1
- package/src/stories/QrCode.stories.tsx +1 -1
- package/src/stories/Questionnaire.stories.tsx +1 -1
- package/src/stories/RadioGroup.stories.tsx +1 -1
- package/src/stories/RatingGroup.stories.tsx +1 -1
- package/src/stories/Resizable.stories.tsx +1 -1
- package/src/stories/Result.stories.tsx +1 -1
- package/src/stories/Reveal.stories.tsx +1 -1
- package/src/stories/RollingNumber.stories.tsx +1 -1
- package/src/stories/ScrollArea.stories.tsx +1 -1
- package/src/stories/SearchInput.stories.tsx +1 -1
- package/src/stories/SegmentedControl.stories.tsx +1 -1
- package/src/stories/Select.stories.tsx +1 -1
- package/src/stories/Separator.stories.tsx +1 -1
- package/src/stories/Sheet.stories.tsx +10 -4
- package/src/stories/Sidebar.stories.tsx +1 -1
- package/src/stories/SignaturePad.stories.tsx +1 -1
- package/src/stories/SimpleGrid.stories.tsx +1 -1
- package/src/stories/Skeleton.stories.tsx +1 -1
- package/src/stories/SkeletonTable.stories.tsx +1 -1
- package/src/stories/SkipLink.stories.tsx +1 -1
- package/src/stories/Slider.stories.tsx +1 -1
- package/src/stories/Sonner.stories.tsx +1 -1
- package/src/stories/Sparkline.stories.tsx +244 -0
- package/src/stories/Spinner.stories.tsx +9 -1
- package/src/stories/Spoiler.stories.tsx +1 -1
- package/src/stories/Squircle.stories.tsx +1 -1
- package/src/stories/Stack.stories.tsx +1 -1
- package/src/stories/StatusBadge.stories.tsx +1 -1
- package/src/stories/Stepper.stories.tsx +1 -1
- package/src/stories/Switch.stories.tsx +1 -1
- package/src/stories/Table.stories.tsx +1 -1
- package/src/stories/Tabs.stories.tsx +1 -1
- package/src/stories/Tag.stories.tsx +23 -1
- package/src/stories/TagsInput.stories.tsx +46 -1
- package/src/stories/Text.stories.tsx +1 -1
- package/src/stories/Textarea.stories.tsx +1 -1
- package/src/stories/ThemeIcon.stories.tsx +1 -1
- package/src/stories/TimePicker.stories.tsx +1 -1
- package/src/stories/Timeline.stories.tsx +9 -1
- package/src/stories/Timer.stories.tsx +1 -1
- package/src/stories/Toggle.stories.tsx +1 -1
- package/src/stories/ToggleGroup.stories.tsx +21 -1
- package/src/stories/ToggleTip.stories.tsx +1 -1
- package/src/stories/Toolbar.stories.tsx +1 -1
- package/src/stories/Tooltip.stories.tsx +1 -1
- package/src/stories/Tour.stories.tsx +1 -1
- package/src/stories/TransferList.stories.tsx +1 -1
- package/src/stories/TreeSelect.stories.tsx +1 -1
- package/src/stories/TreeView.stories.tsx +1 -1
- package/src/stories/TypingIndicator.stories.tsx +1 -1
- package/src/stories/VisuallyHidden.stories.tsx +1 -1
- package/src/stories/Watermark.stories.tsx +1 -1
- package/src/stories/WeekPicker.stories.tsx +90 -0
- package/src/stories/WordRotate.stories.tsx +1 -1
- package/src/stories/YearPicker.stories.tsx +1 -1
- package/src/stories/story-groups.json +199 -0
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
import { TypeScalePanel } from "@behavioral-agentic-design-system/core/components/customize/type-scale";
|
|
37
37
|
import { LetterSpacingPanel } from "@behavioral-agentic-design-system/core/components/customize/letter-spacing";
|
|
38
38
|
import { SaveBar } from "@behavioral-agentic-design-system/core/components/customize/save-bar";
|
|
39
|
+
import { DisciplineSection } from "@behavioral-agentic-design-system/core/components/customize/discipline-section";
|
|
39
40
|
import { nameFromHex } from "@behavioral-agentic-design-system/core/lib/color-name";
|
|
40
41
|
|
|
41
42
|
type TokenSwatchPickerCtx = {
|
|
@@ -776,6 +777,7 @@ export function CustomizeTab() {
|
|
|
776
777
|
return (
|
|
777
778
|
<ScrollArea className="size-full">
|
|
778
779
|
<div className="motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-bottom-2 motion-safe:duration-500">
|
|
780
|
+
<DisciplineSection />
|
|
779
781
|
<ColorPalette />
|
|
780
782
|
</div>
|
|
781
783
|
</ScrollArea>
|
|
@@ -1,24 +1,78 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import * as React from "react";
|
|
3
4
|
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
4
5
|
import { ChevronDownIcon } from "lucide-react";
|
|
5
6
|
|
|
6
7
|
import { cn } from "@behavioral-agentic-design-system/core/lib/utils";
|
|
7
8
|
|
|
9
|
+
// Context propagates the visual variant from Accordion root to AccordionItem
|
|
10
|
+
// and AccordionTrigger / AccordionContent without prop-drilling.
|
|
11
|
+
type AccordionVariant = "default" | "contained" | "separated";
|
|
12
|
+
|
|
13
|
+
const AccordionContext = React.createContext<{ variant: AccordionVariant }>({
|
|
14
|
+
variant: "default",
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
type AccordionProps = React.ComponentProps<typeof AccordionPrimitive.Root> & {
|
|
18
|
+
/**
|
|
19
|
+
* Visual container style (peer parity: Mantine contained/separated/filled,
|
|
20
|
+
* Chakra enclosed/flush/elevated, Ant Design bordered/ghost).
|
|
21
|
+
*
|
|
22
|
+
* default — border-b separator between items, no card wrapper (current
|
|
23
|
+
* behavior; unchanged rendering).
|
|
24
|
+
* contained — items sit inside a shared rounded-lg card with divide-y
|
|
25
|
+
* separator lines. Use for settings panels, entity detail
|
|
26
|
+
* drawers, or anywhere an accordion lives on a non-card surface
|
|
27
|
+
* and needs clear visual containment.
|
|
28
|
+
* separated — each item is its own rounded-lg card. Use for content-heavy
|
|
29
|
+
* FAQs and panels where each item should read as independent.
|
|
30
|
+
*/
|
|
31
|
+
variant?: AccordionVariant;
|
|
32
|
+
};
|
|
33
|
+
|
|
8
34
|
function Accordion({
|
|
35
|
+
variant = "default",
|
|
36
|
+
className,
|
|
9
37
|
...props
|
|
10
|
-
}:
|
|
11
|
-
return
|
|
38
|
+
}: AccordionProps) {
|
|
39
|
+
return (
|
|
40
|
+
<AccordionContext.Provider value={{ variant }}>
|
|
41
|
+
<AccordionPrimitive.Root
|
|
42
|
+
data-slot="accordion"
|
|
43
|
+
data-variant={variant}
|
|
44
|
+
className={cn(
|
|
45
|
+
// contained: shared card — divide-y handles item separators so
|
|
46
|
+
// AccordionItem needs no border of its own.
|
|
47
|
+
variant === "contained" &&
|
|
48
|
+
"overflow-hidden rounded-lg border bg-card divide-y divide-border",
|
|
49
|
+
// separated: flex column with a gap so each card floats independently.
|
|
50
|
+
variant === "separated" && "flex flex-col gap-2",
|
|
51
|
+
className
|
|
52
|
+
)}
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
</AccordionContext.Provider>
|
|
56
|
+
);
|
|
12
57
|
}
|
|
13
58
|
|
|
14
59
|
function AccordionItem({
|
|
15
60
|
className,
|
|
16
61
|
...props
|
|
17
62
|
}: React.ComponentProps<typeof AccordionPrimitive.Item>) {
|
|
63
|
+
const { variant } = React.useContext(AccordionContext);
|
|
18
64
|
return (
|
|
19
65
|
<AccordionPrimitive.Item
|
|
20
66
|
data-slot="accordion-item"
|
|
21
|
-
className={cn(
|
|
67
|
+
className={cn(
|
|
68
|
+
// default: bottom border on every item except the last.
|
|
69
|
+
variant === "default" && "border-b last:border-b-0",
|
|
70
|
+
// contained: borders come from divide-y on the root; items need nothing.
|
|
71
|
+
variant === "contained" && "",
|
|
72
|
+
// separated: each item is its own rounded card.
|
|
73
|
+
variant === "separated" && "overflow-hidden rounded-lg border bg-card",
|
|
74
|
+
className
|
|
75
|
+
)}
|
|
22
76
|
{...props}
|
|
23
77
|
/>
|
|
24
78
|
);
|
|
@@ -29,6 +83,8 @@ function AccordionTrigger({
|
|
|
29
83
|
children,
|
|
30
84
|
...props
|
|
31
85
|
}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
|
|
86
|
+
const { variant } = React.useContext(AccordionContext);
|
|
87
|
+
const isInset = variant === "contained" || variant === "separated";
|
|
32
88
|
return (
|
|
33
89
|
<AccordionPrimitive.Header className="flex">
|
|
34
90
|
<AccordionPrimitive.Trigger
|
|
@@ -37,7 +93,10 @@ function AccordionTrigger({
|
|
|
37
93
|
// Layout + interactivity (tokens via Tailwind utilities work for
|
|
38
94
|
// color/spacing/radius — the v4 namespaces for --color-* and friends
|
|
39
95
|
// are wired correctly).
|
|
40
|
-
"group/accordion-trigger flex flex-1 items-center justify-between gap-4 py-4 text-left text-sm font-medium
|
|
96
|
+
"group/accordion-trigger flex flex-1 items-center justify-between gap-4 py-4 text-left text-sm font-medium",
|
|
97
|
+
// contained/separated: triggers are inset — add px-4 and remove
|
|
98
|
+
// rounded-sm so the hover bg fills flush with the card edge.
|
|
99
|
+
isInset ? "rounded-none px-4" : "rounded-sm",
|
|
41
100
|
// The transition PROPERTY is Tailwind-driven (transition-colors is
|
|
42
101
|
// a stock utility that maps to transition-property: color, ...).
|
|
43
102
|
"transition-colors",
|
|
@@ -97,6 +156,8 @@ function AccordionContent({
|
|
|
97
156
|
children,
|
|
98
157
|
...props
|
|
99
158
|
}: React.ComponentProps<typeof AccordionPrimitive.Content>) {
|
|
159
|
+
const { variant } = React.useContext(AccordionContext);
|
|
160
|
+
const isInset = variant === "contained" || variant === "separated";
|
|
100
161
|
return (
|
|
101
162
|
<AccordionPrimitive.Content
|
|
102
163
|
data-slot="accordion-content"
|
|
@@ -109,9 +170,10 @@ function AccordionContent({
|
|
|
109
170
|
// var(--duration-base) + var(--ease-out) motion tokens.
|
|
110
171
|
{...props}
|
|
111
172
|
>
|
|
112
|
-
<div className="pb-4 pt-0">{children}</div>
|
|
173
|
+
<div className={cn("pb-4 pt-0", isInset && "px-4")}>{children}</div>
|
|
113
174
|
</AccordionPrimitive.Content>
|
|
114
175
|
);
|
|
115
176
|
}
|
|
116
177
|
|
|
117
178
|
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
179
|
+
export type { AccordionVariant };
|
|
@@ -5,13 +5,20 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|
|
5
5
|
import { cn } from "../../lib/utils"
|
|
6
6
|
|
|
7
7
|
const alertVariants = cva(
|
|
8
|
-
// Icon is
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// with the title's cap height
|
|
12
|
-
|
|
8
|
+
// Icon is pinned to row 1 / col 1 so it sits alongside the title, not
|
|
9
|
+
// auto-placed. Padding, icon size, and icon column width vary per size —
|
|
10
|
+
// default: size-5 (20px) icon, px-6 py-5 padding, mt-0.5 nudges the icon
|
|
11
|
+
// top ~2px so the vertical center aligns with the title's cap height
|
|
12
|
+
// (text-lg leading-tight ≈ 22px line-box). sm: size-4 (16px) icon,
|
|
13
|
+
// px-4 py-3 padding, no mt offset needed.
|
|
14
|
+
"relative grid w-full grid-cols-[0_1fr] items-start gap-y-1.5 rounded-lg border text-sm [&>svg]:row-start-1 [&>svg]:col-start-1 [&>svg]:text-current",
|
|
13
15
|
{
|
|
14
16
|
variants: {
|
|
17
|
+
size: {
|
|
18
|
+
default:
|
|
19
|
+
"px-6 py-5 [&>svg]:size-5 [&>svg]:mt-0.5 has-[>svg]:grid-cols-[calc(var(--spacing)*5)_1fr] has-[>svg]:gap-x-3.5",
|
|
20
|
+
sm: "px-4 py-3 [&>svg]:size-4 has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3",
|
|
21
|
+
},
|
|
15
22
|
variant: {
|
|
16
23
|
// Subtle primary tint (bg-primary/5) gives default alerts a surface
|
|
17
24
|
// bump so they read as a callout even nested in a Card, plus a 4px
|
|
@@ -52,6 +59,7 @@ const alertVariants = cva(
|
|
|
52
59
|
},
|
|
53
60
|
defaultVariants: {
|
|
54
61
|
variant: "default",
|
|
62
|
+
size: "default",
|
|
55
63
|
},
|
|
56
64
|
}
|
|
57
65
|
)
|
|
@@ -59,6 +67,7 @@ const alertVariants = cva(
|
|
|
59
67
|
function Alert({
|
|
60
68
|
className,
|
|
61
69
|
variant,
|
|
70
|
+
size,
|
|
62
71
|
onDismiss,
|
|
63
72
|
action,
|
|
64
73
|
children,
|
|
@@ -73,8 +82,9 @@ function Alert({
|
|
|
73
82
|
return (
|
|
74
83
|
<div
|
|
75
84
|
data-slot="alert"
|
|
85
|
+
data-size={size ?? "default"}
|
|
76
86
|
role="alert"
|
|
77
|
-
className={cn(alertVariants({ variant }), onDismiss && "pr-10", className)}
|
|
87
|
+
className={cn(alertVariants({ variant, size }), onDismiss && "pr-10", className)}
|
|
78
88
|
{...props}
|
|
79
89
|
>
|
|
80
90
|
{children}
|
|
@@ -109,7 +119,10 @@ function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
109
119
|
<div
|
|
110
120
|
data-slot="alert-title"
|
|
111
121
|
className={cn(
|
|
112
|
-
|
|
122
|
+
// Default size: text-lg. In a sm alert the parent sets data-slot="alert"
|
|
123
|
+
// and the Tailwind v4 arbitrary-variant [[data-size=sm]_&] applies
|
|
124
|
+
// text-base when any ancestor carries data-size="sm".
|
|
125
|
+
"col-start-2 line-clamp-1 text-lg font-semibold leading-tight tracking-tight [[data-size=sm]_&]:text-base",
|
|
113
126
|
className
|
|
114
127
|
)}
|
|
115
128
|
{...props}
|
|
@@ -11,7 +11,7 @@ function Avatar({
|
|
|
11
11
|
shape = "circle",
|
|
12
12
|
...props
|
|
13
13
|
}: React.ComponentProps<typeof AvatarPrimitive.Root> & {
|
|
14
|
-
size?: "
|
|
14
|
+
size?: "xs" | "sm" | "default" | "lg" | "xl"
|
|
15
15
|
/** Circle (default) or a rounded square, for product/brand avatars. */
|
|
16
16
|
shape?: "circle" | "square"
|
|
17
17
|
}) {
|
|
@@ -23,7 +23,10 @@ function Avatar({
|
|
|
23
23
|
className={cn(
|
|
24
24
|
// shape drives the radius; circle (default) keeps rounded-full so every
|
|
25
25
|
// existing avatar is unchanged, square opts into rounded-md.
|
|
26
|
-
|
|
26
|
+
// Size ladder: xs=20px, sm=24px, default=32px, lg=40px, xl=48px.
|
|
27
|
+
"group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none",
|
|
28
|
+
"data-[size=xs]:size-5 data-[size=sm]:size-6 data-[size=lg]:size-10 data-[size=xl]:size-12",
|
|
29
|
+
"data-[shape=square]:rounded-md",
|
|
27
30
|
className
|
|
28
31
|
)}
|
|
29
32
|
{...props}
|
|
@@ -52,7 +55,11 @@ function AvatarFallback({
|
|
|
52
55
|
<AvatarPrimitive.Fallback
|
|
53
56
|
data-slot="avatar-fallback"
|
|
54
57
|
className={cn(
|
|
55
|
-
"flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[
|
|
58
|
+
"flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[shape=square]/avatar:rounded-md",
|
|
59
|
+
// xs/sm: text-xs (14px in BADS scale — fills the avatar with 1–2 initials, acceptable for dense contexts)
|
|
60
|
+
"group-data-[size=xs]/avatar:text-xs group-data-[size=sm]/avatar:text-xs",
|
|
61
|
+
// xl: text-base (18px) for the larger canvas
|
|
62
|
+
"group-data-[size=xl]/avatar:text-base",
|
|
56
63
|
className
|
|
57
64
|
)}
|
|
58
65
|
{...props}
|
|
@@ -66,9 +73,11 @@ function AvatarBadge({ className, ...props }: React.ComponentProps<"span">) {
|
|
|
66
73
|
data-slot="avatar-badge"
|
|
67
74
|
className={cn(
|
|
68
75
|
"absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground ring-2 ring-background select-none",
|
|
76
|
+
"group-data-[size=xs]/avatar:size-1.5 group-data-[size=xs]/avatar:[&>svg]:hidden",
|
|
69
77
|
"group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden",
|
|
70
78
|
"group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2",
|
|
71
79
|
"group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2",
|
|
80
|
+
"group-data-[size=xl]/avatar:size-4 group-data-[size=xl]/avatar:[&>svg]:size-2.5",
|
|
72
81
|
className
|
|
73
82
|
)}
|
|
74
83
|
{...props}
|
|
@@ -97,7 +106,12 @@ function AvatarGroupCount({
|
|
|
97
106
|
<div
|
|
98
107
|
data-slot="avatar-group-count"
|
|
99
108
|
className={cn(
|
|
100
|
-
"relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background
|
|
109
|
+
"relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background",
|
|
110
|
+
"group-has-data-[size=xs]/avatar-group:size-5 group-has-data-[size=xs]/avatar-group:text-xs group-has-data-[size=xs]/avatar-group:[&>svg]:size-2.5",
|
|
111
|
+
"group-has-data-[size=sm]/avatar-group:size-6 group-has-data-[size=sm]/avatar-group:text-xs group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",
|
|
112
|
+
"[&>svg]:size-4",
|
|
113
|
+
"group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5",
|
|
114
|
+
"group-has-data-[size=xl]/avatar-group:size-12 group-has-data-[size=xl]/avatar-group:text-base group-has-data-[size=xl]/avatar-group:[&>svg]:size-6",
|
|
101
115
|
className
|
|
102
116
|
)}
|
|
103
117
|
{...props}
|
|
@@ -3,6 +3,12 @@ import { ChevronRight, MoreHorizontal } from "lucide-react"
|
|
|
3
3
|
import { Slot } from "@radix-ui/react-slot"
|
|
4
4
|
|
|
5
5
|
import { cn } from "../../lib/utils"
|
|
6
|
+
import {
|
|
7
|
+
DropdownMenu,
|
|
8
|
+
DropdownMenuContent,
|
|
9
|
+
DropdownMenuItem,
|
|
10
|
+
DropdownMenuTrigger,
|
|
11
|
+
} from "./dropdown-menu"
|
|
6
12
|
|
|
7
13
|
function Breadcrumb({ ...props }: React.ComponentProps<"nav">) {
|
|
8
14
|
return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />
|
|
@@ -98,6 +104,45 @@ function BreadcrumbEllipsis({
|
|
|
98
104
|
)
|
|
99
105
|
}
|
|
100
106
|
|
|
107
|
+
type BreadcrumbDropdownItem = { label: string; href?: string }
|
|
108
|
+
|
|
109
|
+
function BreadcrumbDropdown({
|
|
110
|
+
items,
|
|
111
|
+
align = "start",
|
|
112
|
+
className,
|
|
113
|
+
}: {
|
|
114
|
+
items: BreadcrumbDropdownItem[]
|
|
115
|
+
align?: "start" | "center" | "end"
|
|
116
|
+
className?: string
|
|
117
|
+
}) {
|
|
118
|
+
return (
|
|
119
|
+
<DropdownMenu>
|
|
120
|
+
<DropdownMenuTrigger
|
|
121
|
+
className={cn(
|
|
122
|
+
"flex min-h-11 min-w-11 items-center justify-center rounded-sm",
|
|
123
|
+
"transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
124
|
+
className
|
|
125
|
+
)}
|
|
126
|
+
aria-label="Show collapsed breadcrumb items"
|
|
127
|
+
>
|
|
128
|
+
<MoreHorizontal className="size-4" strokeWidth={1.5} />
|
|
129
|
+
<span className="sr-only">More</span>
|
|
130
|
+
</DropdownMenuTrigger>
|
|
131
|
+
<DropdownMenuContent align={align}>
|
|
132
|
+
{items.map((item, i) =>
|
|
133
|
+
item.href ? (
|
|
134
|
+
<DropdownMenuItem key={i} asChild>
|
|
135
|
+
<a href={item.href}>{item.label}</a>
|
|
136
|
+
</DropdownMenuItem>
|
|
137
|
+
) : (
|
|
138
|
+
<DropdownMenuItem key={i}>{item.label}</DropdownMenuItem>
|
|
139
|
+
)
|
|
140
|
+
)}
|
|
141
|
+
</DropdownMenuContent>
|
|
142
|
+
</DropdownMenu>
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
|
|
101
146
|
export {
|
|
102
147
|
Breadcrumb,
|
|
103
148
|
BreadcrumbList,
|
|
@@ -106,4 +151,6 @@ export {
|
|
|
106
151
|
BreadcrumbPage,
|
|
107
152
|
BreadcrumbSeparator,
|
|
108
153
|
BreadcrumbEllipsis,
|
|
154
|
+
BreadcrumbDropdown,
|
|
109
155
|
}
|
|
156
|
+
export type { BreadcrumbDropdownItem }
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
5
|
|
|
5
6
|
import { cn } from "../../lib/utils"
|
|
6
7
|
|
|
@@ -15,14 +16,37 @@ import { cn } from "../../lib/utils"
|
|
|
15
16
|
* React state alone, so uncontrolled native radio groups — where selecting a
|
|
16
17
|
* sibling deselects this card without React knowing — always paint correctly.
|
|
17
18
|
* `data-checked` mirrors the known React state as an external CSS/test hook.
|
|
19
|
+
*
|
|
20
|
+
* `size` (sm / default / lg) sets the card's density — padding, the gap
|
|
21
|
+
* between title and description, and the base font size children inherit.
|
|
22
|
+
* Peer parity: Mantine CheckboxCard size, Chakra CheckboxCard size, MUI
|
|
23
|
+
* Card+checkbox size. Children that set their own `text-*` still win, so
|
|
24
|
+
* existing markup renders byte-identically at `default`. Every size keeps
|
|
25
|
+
* the card ≥44px tall (min-h-11) and text ≥14px (`text-sm` = 16px here).
|
|
18
26
|
*/
|
|
19
27
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
const cardVariants = cva(
|
|
29
|
+
cn(
|
|
30
|
+
"relative flex min-h-11 cursor-pointer flex-col rounded-lg border border-border bg-card shadow-sm transition-colors",
|
|
31
|
+
"hover:bg-accent/40",
|
|
32
|
+
"has-[:checked]:border-primary has-[:checked]:bg-primary/10"
|
|
33
|
+
),
|
|
34
|
+
{
|
|
35
|
+
variants: {
|
|
36
|
+
size: {
|
|
37
|
+
sm: "gap-0.5 p-3 text-sm",
|
|
38
|
+
default: "gap-1 p-4 text-sm",
|
|
39
|
+
lg: "gap-1.5 p-5 text-base",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: {
|
|
43
|
+
size: "default",
|
|
44
|
+
},
|
|
45
|
+
}
|
|
24
46
|
)
|
|
25
47
|
|
|
48
|
+
type CardSize = NonNullable<VariantProps<typeof cardVariants>["size"]>
|
|
49
|
+
|
|
26
50
|
const disabledClasses = "pointer-events-none cursor-not-allowed opacity-50"
|
|
27
51
|
|
|
28
52
|
const motionStyle: React.CSSProperties = {
|
|
@@ -52,6 +76,8 @@ interface CheckboxCardProps
|
|
|
52
76
|
onCheckedChange?: (checked: boolean) => void
|
|
53
77
|
disabled?: boolean
|
|
54
78
|
value?: string
|
|
79
|
+
/** Card density: sm (p-3), default (p-4), lg (p-5, text-base). */
|
|
80
|
+
size?: CardSize
|
|
55
81
|
children?: React.ReactNode
|
|
56
82
|
}
|
|
57
83
|
|
|
@@ -65,6 +91,7 @@ const CheckboxCard = React.forwardRef<HTMLLabelElement, CheckboxCardProps>(
|
|
|
65
91
|
onCheckedChange,
|
|
66
92
|
disabled,
|
|
67
93
|
value,
|
|
94
|
+
size,
|
|
68
95
|
children,
|
|
69
96
|
...props
|
|
70
97
|
},
|
|
@@ -80,9 +107,14 @@ const CheckboxCard = React.forwardRef<HTMLLabelElement, CheckboxCardProps>(
|
|
|
80
107
|
<label
|
|
81
108
|
ref={ref}
|
|
82
109
|
data-slot="checkbox-card"
|
|
110
|
+
data-size={size ?? "default"}
|
|
83
111
|
data-checked={isChecked || undefined}
|
|
84
112
|
data-disabled={disabled || undefined}
|
|
85
|
-
className={cn(
|
|
113
|
+
className={cn(
|
|
114
|
+
cardVariants({ size }),
|
|
115
|
+
disabled && disabledClasses,
|
|
116
|
+
className
|
|
117
|
+
)}
|
|
86
118
|
style={{ ...motionStyle, ...style }}
|
|
87
119
|
{...props}
|
|
88
120
|
>
|
|
@@ -116,6 +148,8 @@ interface RadioCardProps
|
|
|
116
148
|
disabled?: boolean
|
|
117
149
|
value?: string
|
|
118
150
|
name?: string
|
|
151
|
+
/** Card density: sm (p-3), default (p-4), lg (p-5, text-base). */
|
|
152
|
+
size?: CardSize
|
|
119
153
|
children?: React.ReactNode
|
|
120
154
|
}
|
|
121
155
|
|
|
@@ -130,6 +164,7 @@ const RadioCard = React.forwardRef<HTMLLabelElement, RadioCardProps>(
|
|
|
130
164
|
disabled,
|
|
131
165
|
value,
|
|
132
166
|
name,
|
|
167
|
+
size,
|
|
133
168
|
children,
|
|
134
169
|
...props
|
|
135
170
|
},
|
|
@@ -145,9 +180,14 @@ const RadioCard = React.forwardRef<HTMLLabelElement, RadioCardProps>(
|
|
|
145
180
|
<label
|
|
146
181
|
ref={ref}
|
|
147
182
|
data-slot="radio-card"
|
|
183
|
+
data-size={size ?? "default"}
|
|
148
184
|
data-checked={isChecked || undefined}
|
|
149
185
|
data-disabled={disabled || undefined}
|
|
150
|
-
className={cn(
|
|
186
|
+
className={cn(
|
|
187
|
+
cardVariants({ size }),
|
|
188
|
+
disabled && disabledClasses,
|
|
189
|
+
className
|
|
190
|
+
)}
|
|
151
191
|
style={{ ...motionStyle, ...style }}
|
|
152
192
|
{...props}
|
|
153
193
|
>
|
|
@@ -172,5 +212,5 @@ const RadioCard = React.forwardRef<HTMLLabelElement, RadioCardProps>(
|
|
|
172
212
|
)
|
|
173
213
|
RadioCard.displayName = "RadioCard"
|
|
174
214
|
|
|
175
|
-
export { CheckboxCard, RadioCard }
|
|
176
|
-
export type { CheckboxCardProps, RadioCardProps }
|
|
215
|
+
export { CheckboxCard, RadioCard, cardVariants as checkboxCardVariants }
|
|
216
|
+
export type { CheckboxCardProps, RadioCardProps, CardSize as CheckboxCardSize }
|
|
@@ -9,15 +9,24 @@ import { cn } from "../../lib/utils"
|
|
|
9
9
|
type CheckboxProps = React.ComponentProps<typeof CheckboxPrimitive.Root> & {
|
|
10
10
|
/**
|
|
11
11
|
* Visual size of the checkbox box (peer parity: Mantine size, MUI size,
|
|
12
|
-
* Chakra size).
|
|
13
|
-
* sm = 24px visible box · default = 32px visible box (unchanged)
|
|
14
|
-
*
|
|
12
|
+
* Chakra size, Ant Design size).
|
|
13
|
+
* sm = 24px visible box · default = 32px visible box (unchanged) ·
|
|
14
|
+
* lg = 40px visible box for large-touch / accessible contexts.
|
|
15
|
+
* The transparent ::before hit-area stays 44px in every size (WCAG 2.2
|
|
15
16
|
* SC 2.5.5 Enhanced — the AAA pointer-target floor). An explicit size
|
|
16
17
|
* utility in className still wins for one-off overrides.
|
|
17
18
|
*/
|
|
18
|
-
size?: "sm" | "default"
|
|
19
|
+
size?: "sm" | "default" | "lg"
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
// Box + glyph classes per size. The visible box scales; the ::before
|
|
23
|
+
// hit-area overlay in the root className is size-independent (44px).
|
|
24
|
+
const SIZE_CLASSES = {
|
|
25
|
+
sm: { box: "size-6 rounded-[3px]", icon: "size-4" },
|
|
26
|
+
default: { box: "size-8 rounded-[4px]", icon: "size-6" },
|
|
27
|
+
lg: { box: "size-10 rounded-[5px]", icon: "size-7" },
|
|
28
|
+
} as const
|
|
29
|
+
|
|
21
30
|
function Checkbox({
|
|
22
31
|
className,
|
|
23
32
|
size = "default",
|
|
@@ -28,7 +37,7 @@ function Checkbox({
|
|
|
28
37
|
data-slot="checkbox"
|
|
29
38
|
data-size={size}
|
|
30
39
|
className={cn(
|
|
31
|
-
// The visible box is 24px (sm)
|
|
40
|
+
// The visible box is 24px (sm), 32px (default), or 40px (lg), but the
|
|
32
41
|
// POINTER TARGET must hit WCAG 2.2 SC 2.5.5 Enhanced (44×44, the AAA
|
|
33
42
|
// floor). A centered transparent ::before overlay (before:size-11 =
|
|
34
43
|
// 44px) extends the interactive area without enlarging the box — a
|
|
@@ -37,7 +46,7 @@ function Checkbox({
|
|
|
37
46
|
// (respects the no-jump / layout-stability principle) and never touches
|
|
38
47
|
// a neighbor's flow. Focus ring stays on the visible box.
|
|
39
48
|
"peer relative inline-flex shrink-0 items-center justify-center border-2 border-muted-foreground/60 bg-white leading-none shadow-xs transition-[background-color,border-color,color] duration-[210ms] ease-in-out outline-none before:absolute before:left-1/2 before:top-1/2 before:size-11 before:-translate-x-1/2 before:-translate-y-1/2 before:content-[''] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground dark:aria-invalid:ring-destructive/40",
|
|
40
|
-
|
|
49
|
+
SIZE_CLASSES[size].box,
|
|
41
50
|
className
|
|
42
51
|
)}
|
|
43
52
|
{...props}
|
|
@@ -52,11 +61,11 @@ function Checkbox({
|
|
|
52
61
|
which Radix already announces). Icons keep the CheckIcon's stroke
|
|
53
62
|
weight so the glyphs read identically inside the same indicator. */}
|
|
54
63
|
<CheckIcon
|
|
55
|
-
className={cn("hidden group-data-[state=checked]/indicator:block", size
|
|
64
|
+
className={cn("hidden group-data-[state=checked]/indicator:block", SIZE_CLASSES[size].icon)}
|
|
56
65
|
strokeWidth={3}
|
|
57
66
|
/>
|
|
58
67
|
<MinusIcon
|
|
59
|
-
className={cn("hidden group-data-[state=indeterminate]/indicator:block", size
|
|
68
|
+
className={cn("hidden group-data-[state=indeterminate]/indicator:block", SIZE_CLASSES[size].icon)}
|
|
60
69
|
strokeWidth={3}
|
|
61
70
|
/>
|
|
62
71
|
</CheckboxPrimitive.Indicator>
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Explicit default locale. FormatDate never reads the runtime locale
|
|
7
|
+
* (navigator.language): an implicit locale formats differently on the
|
|
8
|
+
* server and the client, which is the classic hydration-mismatch bug.
|
|
9
|
+
* Consumers localizing for real pass `locale` from their own i18n layer.
|
|
10
|
+
* Same contract as FormatNumber and FormatByte.
|
|
11
|
+
*/
|
|
12
|
+
const FORMAT_DATE_DEFAULT_LOCALE = "en-US"
|
|
13
|
+
|
|
14
|
+
export interface FormatDateProps
|
|
15
|
+
extends Omit<React.ComponentProps<"span">, "children"> {
|
|
16
|
+
/**
|
|
17
|
+
* The date to format. Accepts a `Date` object, a millisecond timestamp
|
|
18
|
+
* (number), or a date string that `new Date()` can parse.
|
|
19
|
+
*
|
|
20
|
+
* When `undefined` or `null`, the component renders an empty `<span>` —
|
|
21
|
+
* useful for optional/async date values without a conditional at the call
|
|
22
|
+
* site.
|
|
23
|
+
*/
|
|
24
|
+
value: Date | number | string | null | undefined
|
|
25
|
+
/**
|
|
26
|
+
* BCP 47 locale tag. Defaults to "en-US" (explicit, SSR-safe) — pass your
|
|
27
|
+
* i18n layer's locale to localize.
|
|
28
|
+
*/
|
|
29
|
+
locale?: string
|
|
30
|
+
/**
|
|
31
|
+
* Controls the length of the date portion (maps to
|
|
32
|
+
* `Intl.DateTimeFormatOptions.dateStyle`). Defaults to "medium".
|
|
33
|
+
*
|
|
34
|
+
* Ignored when `options` is also provided.
|
|
35
|
+
*/
|
|
36
|
+
dateStyle?: "full" | "long" | "medium" | "short"
|
|
37
|
+
/**
|
|
38
|
+
* When provided, includes a time component at the specified length (maps to
|
|
39
|
+
* `Intl.DateTimeFormatOptions.timeStyle`). Omit for date-only output.
|
|
40
|
+
*
|
|
41
|
+
* Ignored when `options` is also provided.
|
|
42
|
+
*/
|
|
43
|
+
timeStyle?: "full" | "long" | "medium" | "short"
|
|
44
|
+
/**
|
|
45
|
+
* Escape hatch for full `Intl.DateTimeFormatOptions` control. When present,
|
|
46
|
+
* it completely overrides `dateStyle` and `timeStyle` — the formatter is
|
|
47
|
+
* constructed with exactly these options.
|
|
48
|
+
*/
|
|
49
|
+
options?: Intl.DateTimeFormatOptions
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Locale-aware date display primitive — a thin wrapper around
|
|
54
|
+
* `Intl.DateTimeFormat`. Renders a `<span data-slot="format-date">` with
|
|
55
|
+
* the formatted date string. Display-only: for editable date fields use
|
|
56
|
+
* DateField or the Calendar-backed DatePicker.
|
|
57
|
+
*
|
|
58
|
+
* Follows the same SSR-safe locale convention as FormatNumber and
|
|
59
|
+
* FormatByte: the default locale is the explicit constant "en-US", never
|
|
60
|
+
* `navigator.language`, so server and client produce identical markup.
|
|
61
|
+
*
|
|
62
|
+
* When `value` is `undefined` or `null`, the component renders an empty
|
|
63
|
+
* span — no null-check boilerplate at the call site.
|
|
64
|
+
*/
|
|
65
|
+
function FormatDate({
|
|
66
|
+
value,
|
|
67
|
+
locale = FORMAT_DATE_DEFAULT_LOCALE,
|
|
68
|
+
dateStyle = "medium",
|
|
69
|
+
timeStyle,
|
|
70
|
+
options,
|
|
71
|
+
className,
|
|
72
|
+
...props
|
|
73
|
+
}: FormatDateProps) {
|
|
74
|
+
// Guard: undefined/null renders an empty span (graceful empty state).
|
|
75
|
+
if (value == null) {
|
|
76
|
+
return (
|
|
77
|
+
<span
|
|
78
|
+
data-slot="format-date"
|
|
79
|
+
className={cn(className)}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const date = value instanceof Date ? value : new Date(value)
|
|
86
|
+
|
|
87
|
+
// Build the formatter options. Consumer-supplied `options` wins entirely;
|
|
88
|
+
// otherwise compose from dateStyle + optional timeStyle.
|
|
89
|
+
const resolvedOptions: Intl.DateTimeFormatOptions = options ?? {
|
|
90
|
+
dateStyle,
|
|
91
|
+
...(timeStyle !== undefined ? { timeStyle } : {}),
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const formatted = new Intl.DateTimeFormat(locale, resolvedOptions).format(date)
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<span
|
|
98
|
+
data-slot="format-date"
|
|
99
|
+
className={cn(className)}
|
|
100
|
+
{...props}
|
|
101
|
+
>
|
|
102
|
+
{formatted}
|
|
103
|
+
</span>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { FormatDate, FORMAT_DATE_DEFAULT_LOCALE }
|
|
@@ -26,11 +26,12 @@ type ProgressProps = React.ComponentProps<typeof ProgressPrimitive.Root> & {
|
|
|
26
26
|
* Track height (peer parity: Mantine / Chakra / Ark Progress size).
|
|
27
27
|
* sm = 4px (quiet inline progress — table rows, list items),
|
|
28
28
|
* default = 8px (unchanged), lg = 12px (prominent surfaces — upload
|
|
29
|
-
* panels, onboarding)
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* panels, onboarding), xl = 16px (hero surfaces — storage dashboards,
|
|
30
|
+
* onboarding stepper fill). Only the track thickness changes; the header
|
|
31
|
+
* row (label / showValue) is size-independent. An explicit height utility
|
|
32
|
+
* in className still wins for one-off values.
|
|
32
33
|
*/
|
|
33
|
-
size?: "sm" | "default" | "lg"
|
|
34
|
+
size?: "sm" | "default" | "lg" | "xl"
|
|
34
35
|
/**
|
|
35
36
|
* Semantic color intent for the indicator fill (peer parity: Mantine
|
|
36
37
|
* Progress `color`, MUI LinearProgress `color`, Chakra `colorScheme`,
|
|
@@ -109,7 +110,7 @@ function Progress({
|
|
|
109
110
|
// Size ladder rides data-size so the base h-2 (default) stays
|
|
110
111
|
// byte-identical and a consumer's explicit height utility in
|
|
111
112
|
// className still wins (data-[size]:h-* only fires for sm/lg).
|
|
112
|
-
"relative h-2 w-full overflow-hidden rounded-full bg-primary/30 data-[size=lg]:h-3 data-[size=
|
|
113
|
+
"relative h-2 w-full overflow-hidden rounded-full bg-primary/30 data-[size=sm]:h-1 data-[size=lg]:h-3 data-[size=xl]:h-4 dark:bg-primary/60",
|
|
113
114
|
className
|
|
114
115
|
)}
|
|
115
116
|
// max / getValueLabel always reach Radix (they rode {...props} before
|