@behavioral-agentic-design-system/core 0.34.0 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -869,6 +869,29 @@ export default function ComponentsPreview() {
869
869
  />
870
870
  </div>
871
871
  </div>
872
+ <div className="mt-6 space-y-2">
873
+ <p className="text-sm font-medium">Variants</p>
874
+ <div className="flex flex-col gap-4 sm:flex-row">
875
+ <div className="flex-1 space-y-2">
876
+ <Label htmlFor="in-variant-outline" className="text-muted-foreground">
877
+ outline (default)
878
+ </Label>
879
+ <Input id="in-variant-outline" variant="outline" placeholder="Search projects…" />
880
+ </div>
881
+ <div className="flex-1 space-y-2">
882
+ <Label htmlFor="in-variant-ghost" className="text-muted-foreground">
883
+ ghost
884
+ </Label>
885
+ <Input id="in-variant-ghost" variant="ghost" placeholder="Search projects…" />
886
+ </div>
887
+ <div className="flex-1 space-y-2">
888
+ <Label htmlFor="in-variant-filled" className="text-muted-foreground">
889
+ filled
890
+ </Label>
891
+ <Input id="in-variant-filled" variant="filled" placeholder="Search projects…" />
892
+ </div>
893
+ </div>
894
+ </div>
872
895
  </Section>
873
896
 
874
897
  <Section title="Password Input">
@@ -946,6 +969,21 @@ export default function ComponentsPreview() {
946
969
  <Label htmlFor="cb-default-size">Default (32px)</Label>
947
970
  </div>
948
971
  </div>
972
+ <Label>Radio sizes</Label>
973
+ <RadioGroup defaultValue="default" className="flex items-center gap-6">
974
+ <div className="flex items-center gap-2">
975
+ <RadioGroupItem id="rg-sm" value="sm" size="sm" />
976
+ <Label htmlFor="rg-sm">sm (28px)</Label>
977
+ </div>
978
+ <div className="flex items-center gap-2">
979
+ <RadioGroupItem id="rg-default" value="default" />
980
+ <Label htmlFor="rg-default">default (36px)</Label>
981
+ </div>
982
+ <div className="flex items-center gap-2">
983
+ <RadioGroupItem id="rg-lg" value="lg" size="lg" />
984
+ <Label htmlFor="rg-lg">lg (44px)</Label>
985
+ </div>
986
+ </RadioGroup>
949
987
  <Label id="form-controls-slider-label">Slider</Label>
950
988
  <Slider
951
989
  defaultValue={[40]}
@@ -994,6 +1032,13 @@ export default function ComponentsPreview() {
994
1032
  <Progress value={100} intent="error" label="Build failed" showValue />
995
1033
  <Progress value={42} intent="info" label="Syncing design tokens" showValue />
996
1034
  </div>
1035
+ <Label className="pt-3">Progress striped &amp; animated</Label>
1036
+ <div className="space-y-4">
1037
+ <Progress value={55} striped label="Processing tokens" showValue />
1038
+ <Progress value={40} striped animated label="Uploading brand-fonts.woff2" showValue />
1039
+ <Progress value={60} striped intent="success" label="Deployment" showValue />
1040
+ <Progress value={78} striped intent="warning" label="Disk quota: 78% used" showValue />
1041
+ </div>
997
1042
  </div>
998
1043
  </Section>
999
1044
 
@@ -1500,6 +1545,27 @@ export default function ComponentsPreview() {
1500
1545
  </PaginationContent>
1501
1546
  </Pagination>
1502
1547
  </div>
1548
+ <div>
1549
+ <p className="mb-3 text-xs text-muted-foreground">Sizes: sm / default / lg</p>
1550
+ <div className="space-y-4">
1551
+ {(["sm", "default", "lg"] as const).map((size) => (
1552
+ <div key={size} className="space-y-1">
1553
+ <p className="text-xs text-muted-foreground/60">size=&quot;{size}&quot;</p>
1554
+ <Pagination size={size}>
1555
+ <PaginationContent>
1556
+ <PaginationItem><PaginationPrevious href="#" /></PaginationItem>
1557
+ <PaginationItem><PaginationLink href="#">1</PaginationLink></PaginationItem>
1558
+ <PaginationItem><PaginationLink href="#" isActive>2</PaginationLink></PaginationItem>
1559
+ <PaginationItem><PaginationLink href="#">3</PaginationLink></PaginationItem>
1560
+ <PaginationItem><PaginationEllipsis /></PaginationItem>
1561
+ <PaginationItem><PaginationLink href="#">10</PaginationLink></PaginationItem>
1562
+ <PaginationItem><PaginationNext href="#" /></PaginationItem>
1563
+ </PaginationContent>
1564
+ </Pagination>
1565
+ </div>
1566
+ ))}
1567
+ </div>
1568
+ </div>
1503
1569
  </div>
1504
1570
  </Section>
1505
1571
 
@@ -2910,6 +2976,41 @@ export default function ComponentsPreview() {
2910
2976
  </TableRow>
2911
2977
  </TableFooter>
2912
2978
  </Table>
2979
+ <div className="mt-6 grid gap-6 lg:grid-cols-2">
2980
+ {([
2981
+ { label: "Striped", props: { striped: true } },
2982
+ { label: "Bordered", props: { bordered: true } },
2983
+ { label: "Compact", props: { compact: true } },
2984
+ { label: "Compact + striped + bordered", props: { compact: true, striped: true, bordered: true } },
2985
+ ] as const).map(({ label, props }) => (
2986
+ <div key={label} className="space-y-2">
2987
+ <p className="text-sm font-medium text-muted-foreground">{label}</p>
2988
+ <Table {...props}>
2989
+ <TableHeader>
2990
+ <TableRow>
2991
+ <TableHead>Contributor</TableHead>
2992
+ <TableHead>Team</TableHead>
2993
+ <TableHead className="text-right">PRs</TableHead>
2994
+ </TableRow>
2995
+ </TableHeader>
2996
+ <TableBody>
2997
+ {[
2998
+ { name: "Avery Castillo", squad: "Core", prs: "48" },
2999
+ { name: "Noah Kim", squad: "Core", prs: "41" },
3000
+ { name: "Priya Raman", squad: "Web", prs: "37" },
3001
+ { name: "Liam O'Connor", squad: "Web", prs: "29" },
3002
+ ].map((r) => (
3003
+ <TableRow key={r.name}>
3004
+ <TableCell className="font-medium">{r.name}</TableCell>
3005
+ <TableCell className="text-muted-foreground">{r.squad}</TableCell>
3006
+ <TableCell className="text-right font-mono tabular-nums">{r.prs}</TableCell>
3007
+ </TableRow>
3008
+ ))}
3009
+ </TableBody>
3010
+ </Table>
3011
+ </div>
3012
+ ))}
3013
+ </div>
2913
3014
  </Section>
2914
3015
 
2915
3016
  <Section title="Calendar">
@@ -3035,6 +3136,27 @@ export default function ComponentsPreview() {
3035
3136
  />
3036
3137
  </div>
3037
3138
  </div>
3139
+ <div className="mt-6 space-y-3">
3140
+ <p className="text-sm font-medium text-muted-foreground">Size variants</p>
3141
+ <div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
3142
+ <div className="space-y-2">
3143
+ <Label htmlFor="ta-sm">sm</Label>
3144
+ <Textarea id="ta-sm" size="sm" placeholder="Brief note…" />
3145
+ </div>
3146
+ <div className="space-y-2">
3147
+ <Label htmlFor="ta-default-size">default</Label>
3148
+ <Textarea id="ta-default-size" placeholder="Message…" />
3149
+ </div>
3150
+ <div className="space-y-2">
3151
+ <Label htmlFor="ta-lg">lg</Label>
3152
+ <Textarea id="ta-lg" size="lg" placeholder="Describe your project…" />
3153
+ </div>
3154
+ <div className="space-y-2">
3155
+ <Label htmlFor="ta-xl">xl</Label>
3156
+ <Textarea id="ta-xl" size="xl" placeholder="Long-form content…" />
3157
+ </div>
3158
+ </div>
3159
+ </div>
3038
3160
  </Section>
3039
3161
 
3040
3162
  <Section title="Toggle &amp; Toggle Group">
@@ -10143,6 +10265,16 @@ function DataTableShowcase() {
10143
10265
  pagination={{ pageSize: 5 }}
10144
10266
  rowSelection={true}
10145
10267
  />
10268
+ <div className="space-y-2">
10269
+ <p className="text-xs font-medium text-muted-foreground">Sticky header — header stays visible as rows scroll (stickyHeader + scrollHeight)</p>
10270
+ <DataTable
10271
+ columns={SHOWCASE_TABLE_COLUMNS}
10272
+ data={SHOWCASE_TABLE_DATA}
10273
+ stickyHeader
10274
+ scrollHeight="220px"
10275
+ sorting={true}
10276
+ />
10277
+ </div>
10146
10278
  </div>
10147
10279
  );
10148
10280
  }
@@ -112,6 +112,23 @@ const STARTER_CARDS: StarterCard[] = [
112
112
  * (direction-first exploration, story coverage, token source-of-truth, AAA
113
113
  * checks) in plain language so it works in any fork's CLAUDE.md context.
114
114
  */
115
+ // Shown only on the upstream template, where the reader has NOT installed the
116
+ // system yet and the one useful next step is starting their own copy. A fork's
117
+ // staff already have it installed, so this prompt is meaningless there — they
118
+ // see CLAUDE_PROMPTS instead. Gated on brand.isUpstreamTemplate.
119
+ const FORK_PROMPT: {
120
+ icon: React.ComponentType<{ className?: string; strokeWidth?: number }>;
121
+ title: string;
122
+ blurb: string;
123
+ prompt: string;
124
+ } = {
125
+ icon: GitBranch,
126
+ title: "Create your own fork",
127
+ blurb: "Stand up a branded copy of this system.",
128
+ prompt:
129
+ "I want to create my own design system by forking BADS (https://github.com/matthewlarn/behavioral-agentic-design-system). Interview me one question at a time — what the product or client is called, what it does and who uses it, the brand colors and typefaces if they exist yet, and the tone the interface should take. Do not assume any of it and do not start editing files until I have answered. Then walk the onboarding in CLIENT_ONBOARDING.md end to end: run the rename with the display name and slug I give you, point the fork at the published @behavioral-agentic-design-system/core package rather than a vendored copy so it keeps receiving updates, replace the placeholder tokens with my real brand values and regenerate the CSS through the token build, fill in the brand voice and BRIEF files, and seed the exemplars and real-content pool. When you are done, run the accessibility and drift checks and show me what is still a placeholder.",
130
+ };
131
+
115
132
  const CLAUDE_PROMPTS: {
116
133
  id: string;
117
134
  icon: React.ComponentType<{ className?: string; strokeWidth?: number }>;
@@ -397,24 +414,38 @@ export function HomeTab({ onBrowseDocs, onBrowseComponents }: HomeTabProps) {
397
414
  <section className="flex flex-col gap-5">
398
415
  <div>
399
416
  <h2 className="text-2xl font-semibold tracking-tight">
400
- Already have BADS installed? Copy a prompt to get started
417
+ {brand.isUpstreamTemplate
418
+ ? "Copy this prompt to create your own fork of BADS"
419
+ : `Copy a prompt to get started with ${brand.name}`}
401
420
  </h2>
402
421
  <p className="mt-1 max-w-2xl text-sm text-muted-foreground">
403
- Paste any of these into Claude Code exactly as written. Each one
404
- interviews you for the specifics, so nothing needs filling in first.
422
+ {brand.isUpstreamTemplate
423
+ ? "Paste it into Claude Code exactly as written. It interviews you for the brand, the audience, and the tone, then walks the whole onboarding — so nothing needs filling in first."
424
+ : "Paste any of these into Claude Code exactly as written. Each one interviews you for the specifics, so nothing needs filling in first."}
405
425
  </p>
406
426
  </div>
407
- <div className="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4">
408
- {CLAUDE_PROMPTS.map((p) => (
427
+ {brand.isUpstreamTemplate ? (
428
+ <div className="grid grid-cols-1 gap-3 sm:max-w-md">
409
429
  <PromptCard
410
- key={p.id}
411
- icon={p.icon}
412
- title={p.title}
413
- blurb={p.blurb}
414
- prompt={p.prompt}
430
+ icon={FORK_PROMPT.icon}
431
+ title={FORK_PROMPT.title}
432
+ blurb={FORK_PROMPT.blurb}
433
+ prompt={FORK_PROMPT.prompt}
415
434
  />
416
- ))}
417
- </div>
435
+ </div>
436
+ ) : (
437
+ <div className="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4">
438
+ {CLAUDE_PROMPTS.map((p) => (
439
+ <PromptCard
440
+ key={p.id}
441
+ icon={p.icon}
442
+ title={p.title}
443
+ blurb={p.blurb}
444
+ prompt={p.prompt}
445
+ />
446
+ ))}
447
+ </div>
448
+ )}
418
449
  </section>
419
450
 
420
451
  <Separator />
@@ -83,6 +83,18 @@ export interface DataTableProps<TData> extends VariantProps<typeof cellVariants>
83
83
  * Defaults to the text "No results."
84
84
  */
85
85
  emptyMessage?: React.ReactNode
86
+ /**
87
+ * When true, the header row sticks to the top of the table scroll container
88
+ * so it remains visible as rows scroll past. Pair with `scrollHeight` to cap
89
+ * the table's height; without a height cap the container never overflows and
90
+ * nothing scrolls.
91
+ */
92
+ stickyHeader?: boolean
93
+ /**
94
+ * CSS length (e.g. `"400px"`, `"60vh"`) that caps the table's scrollable
95
+ * height when `stickyHeader` is true. Defaults to `"400px"`.
96
+ */
97
+ scrollHeight?: string
86
98
  className?: string
87
99
  }
88
100
 
@@ -191,6 +203,8 @@ function DataTable<TData>({
191
203
  rowSelection: rowSelectionEnabled = false,
192
204
  onRowClick,
193
205
  emptyMessage = "No results.",
206
+ stickyHeader = false,
207
+ scrollHeight = "400px",
194
208
  density = "comfortable",
195
209
  className,
196
210
  }: DataTableProps<TData>) {
@@ -240,8 +254,12 @@ function DataTable<TData>({
240
254
  >
241
255
  {/* Scrollable table wrapper */}
242
256
  <div className="overflow-x-auto">
243
- <Table role="grid">
244
- <TableHeader>
257
+ <Table
258
+ role="grid"
259
+ wrapperClassName={stickyHeader ? "overflow-y-auto" : undefined}
260
+ wrapperStyle={stickyHeader ? { maxHeight: scrollHeight } : undefined}
261
+ >
262
+ <TableHeader className={stickyHeader ? "sticky top-0 z-10 bg-card" : undefined}>
245
263
  {table.getHeaderGroups().map((headerGroup) => (
246
264
  <TableRow key={headerGroup.id}>
247
265
  {headerGroup.headers.map((header) => {
@@ -4,9 +4,17 @@ import { cn } from "../../lib/utils"
4
4
  import { InputClearButton } from "./input-clear-button"
5
5
 
6
6
  const inputVariants = cva(
7
- "w-full min-w-0 rounded-md border border-input bg-transparent shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:border-0 file:bg-transparent file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 dark:bg-input/30 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
7
+ "w-full min-w-0 rounded-md transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:border-0 file:bg-transparent file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
8
8
  {
9
9
  variants: {
10
+ variant: {
11
+ outline:
12
+ "border border-input bg-transparent shadow-xs dark:bg-input/30 focus-visible:border-ring",
13
+ ghost:
14
+ "border-0 border-b border-transparent bg-transparent shadow-none rounded-none hover:border-b hover:border-input focus-visible:border-b-2 focus-visible:border-ring focus-visible:ring-0",
15
+ filled:
16
+ "border border-transparent bg-muted shadow-none dark:bg-muted/60 focus-visible:border-ring",
17
+ },
10
18
  size: {
11
19
  sm: "h-8 px-2.5 py-1 text-sm file:h-6 file:text-xs",
12
20
  default: "h-9 px-3 py-1 text-base file:h-7 file:text-sm md:text-sm",
@@ -16,6 +24,7 @@ const inputVariants = cva(
16
24
  },
17
25
  },
18
26
  defaultVariants: {
27
+ variant: "outline",
19
28
  size: "default",
20
29
  },
21
30
  }
@@ -38,6 +47,7 @@ type InputProps = Omit<React.ComponentProps<"input">, "size"> &
38
47
  function Input({
39
48
  className,
40
49
  type,
50
+ variant,
41
51
  size,
42
52
  clearable,
43
53
  leftSection,
@@ -54,9 +64,10 @@ function Input({
54
64
  <input
55
65
  type={type}
56
66
  data-slot="input"
67
+ data-variant={variant ?? "outline"}
57
68
  data-size={size ?? "default"}
58
69
  className={cn(
59
- inputVariants({ size, className }),
70
+ inputVariants({ variant, size, className }),
60
71
  clearable && "pr-8",
61
72
  leftSection && "pl-9",
62
73
  rightSection && "pr-9",
@@ -1,18 +1,62 @@
1
+ "use client"
2
+
1
3
  import * as React from "react"
2
4
  import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react"
3
5
 
4
6
  import { cn } from "../../lib/utils"
5
7
  import { buttonVariants } from "./button"
6
8
 
7
- function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
9
+ type PaginationSize = "sm" | "default" | "lg"
10
+
11
+ // Context lets Pagination.size propagate to every PaginationLink /
12
+ // PaginationPrevious / PaginationNext / PaginationEllipsis without
13
+ // each consumer threading the prop manually.
14
+ const PaginationContext = React.createContext<PaginationSize>("default")
15
+
16
+ // Per-size target dimensions:
17
+ // sm → 36×36px (dense chrome — table footers, list paginators)
18
+ // default → 44×44px (CTA floor per CLAUDE.md min-h-11)
19
+ // lg → 48×48px (prominent surfaces — full-bleed paginators)
20
+ const linkSizeClass: Record<PaginationSize, string> = {
21
+ sm: "min-h-9 min-w-9",
22
+ default: "min-h-11 min-w-11",
23
+ lg: "min-h-12 min-w-12",
24
+ }
25
+
26
+ const prevNextSizeClass: Record<PaginationSize, string> = {
27
+ sm: "px-3",
28
+ default: "px-4",
29
+ lg: "px-5",
30
+ }
31
+
32
+ type PaginationProps = React.ComponentProps<"nav"> & {
33
+ /**
34
+ * Controls the hit-target size of every page link, Previous, Next, and
35
+ * ellipsis within this nav (peer parity: MUI Pagination `size`, Mantine
36
+ * Pagination `size`, Chakra UI Pagination `size`).
37
+ *
38
+ * sm = 36×36px (dense chrome — table footers, list paginators)
39
+ * default = 44×44px (CTA floor — the baseline)
40
+ * lg = 48×48px (prominent surfaces — full-bleed paginators)
41
+ *
42
+ * sm is below the WCAG 2.5.5 Enhanced 44px floor; use it only in dense
43
+ * non-CTA chrome where the layout cannot accommodate min-h-11 controls.
44
+ */
45
+ size?: PaginationSize
46
+ }
47
+
48
+ function Pagination({ className, size = "default", ...props }: PaginationProps) {
8
49
  return (
9
- <nav
10
- role="navigation"
11
- aria-label="pagination"
12
- data-slot="pagination"
13
- className={cn("mx-auto flex w-full justify-center", className)}
14
- {...props}
15
- />
50
+ <PaginationContext.Provider value={size}>
51
+ <nav
52
+ role="navigation"
53
+ aria-label="pagination"
54
+ data-slot="pagination"
55
+ data-size={size}
56
+ className={cn("mx-auto flex w-full justify-center", className)}
57
+ {...props}
58
+ />
59
+ </PaginationContext.Provider>
16
60
  )
17
61
  }
18
62
 
@@ -50,6 +94,7 @@ function PaginationLink({
50
94
  disabled,
51
95
  ...props
52
96
  }: PaginationLinkProps) {
97
+ const size = React.useContext(PaginationContext)
53
98
  return (
54
99
  <a
55
100
  aria-current={isActive ? "page" : undefined}
@@ -61,7 +106,7 @@ function PaginationLink({
61
106
  variant: isActive ? "default" : "ghost",
62
107
  size: "icon",
63
108
  }),
64
- "min-h-11 min-w-11",
109
+ linkSizeClass[size],
65
110
  disabled && "pointer-events-none opacity-50",
66
111
  className
67
112
  )}
@@ -75,12 +120,15 @@ function PaginationPrevious({
75
120
  disabled,
76
121
  ...props
77
122
  }: React.ComponentProps<typeof PaginationLink>) {
123
+ const size = React.useContext(PaginationContext)
78
124
  return (
79
125
  <PaginationLink
80
126
  aria-label="Previous page"
81
127
  disabled={disabled}
82
128
  className={cn(
83
- "w-auto gap-1 px-4 text-sm font-medium min-h-11",
129
+ "w-auto gap-1 text-sm font-medium",
130
+ linkSizeClass[size],
131
+ prevNextSizeClass[size],
84
132
  className
85
133
  )}
86
134
  {...props}
@@ -96,12 +144,15 @@ function PaginationNext({
96
144
  disabled,
97
145
  ...props
98
146
  }: React.ComponentProps<typeof PaginationLink>) {
147
+ const size = React.useContext(PaginationContext)
99
148
  return (
100
149
  <PaginationLink
101
150
  aria-label="Next page"
102
151
  disabled={disabled}
103
152
  className={cn(
104
- "w-auto gap-1 px-4 text-sm font-medium min-h-11",
153
+ "w-auto gap-1 text-sm font-medium",
154
+ linkSizeClass[size],
155
+ prevNextSizeClass[size],
105
156
  className
106
157
  )}
107
158
  {...props}
@@ -116,12 +167,14 @@ function PaginationEllipsis({
116
167
  className,
117
168
  ...props
118
169
  }: React.ComponentProps<"span">) {
170
+ const size = React.useContext(PaginationContext)
119
171
  return (
120
172
  <span
121
173
  aria-hidden
122
174
  data-slot="pagination-ellipsis"
123
175
  className={cn(
124
- "flex min-h-11 min-w-11 items-center justify-center text-muted-foreground",
176
+ "flex items-center justify-center text-muted-foreground",
177
+ linkSizeClass[size],
125
178
  className
126
179
  )}
127
180
  {...props}
@@ -40,6 +40,20 @@ type ProgressProps = React.ComponentProps<typeof ProgressPrimitive.Root> & {
40
40
  * pair with a label or aria-label that names the state.
41
41
  */
42
42
  intent?: "default" | "success" | "warning" | "error" | "info"
43
+ /**
44
+ * Renders diagonal stripe marks across the indicator fill. Stripes are a
45
+ * semi-transparent white overlay so they read on every intent without
46
+ * hardcoded colors. Pair with `animated` to animate the stripe sweep.
47
+ * Never use stripes as the sole signal of a state — pair with a label
48
+ * or aria-label (e.g. "Uploading…", "Processing…").
49
+ */
50
+ striped?: boolean
51
+ /**
52
+ * Animates the stripe pattern with a left-to-right sweep (ambient loop).
53
+ * Only meaningful when `striped` is also true. Reduced-motion users see
54
+ * a static stripe — the base layer collapses the animation to 0.01ms.
55
+ */
56
+ animated?: boolean
43
57
  }
44
58
 
45
59
  // Mirrors Radix Progress's built-in getValueLabel default so the visible
@@ -65,6 +79,8 @@ function Progress({
65
79
  showValue,
66
80
  size = "default",
67
81
  intent = "default",
82
+ striped = false,
83
+ animated = false,
68
84
  ...props
69
85
  }: ProgressProps) {
70
86
  const labelId = React.useId()
@@ -119,6 +135,8 @@ function Progress({
119
135
  <ProgressPrimitive.Indicator
120
136
  data-slot="progress-indicator"
121
137
  data-intent={intent}
138
+ data-striped={striped ? "true" : undefined}
139
+ data-animated={striped && animated ? "true" : undefined}
122
140
  className={cn(
123
141
  "h-full w-full flex-1 transition-transform",
124
142
  intentIndicatorClass[intent]
@@ -3,33 +3,64 @@
3
3
  import * as React from "react"
4
4
  import { CircleIcon } from "lucide-react"
5
5
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
6
+ import { cva, type VariantProps } from "class-variance-authority"
6
7
 
7
8
  import { cn } from "../../lib/utils"
8
9
 
9
10
  function RadioGroup({
10
11
  className,
12
+ orientation,
11
13
  ...props
12
14
  }: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
13
15
  return (
14
16
  <RadioGroupPrimitive.Root
15
17
  data-slot="radio-group"
16
- className={cn("grid gap-3", className)}
18
+ orientation={orientation}
19
+ className={cn(
20
+ orientation === "horizontal"
21
+ ? "flex flex-row flex-wrap gap-x-6 gap-y-3"
22
+ : "grid gap-3",
23
+ className
24
+ )}
17
25
  {...props}
18
26
  />
19
27
  )
20
28
  }
21
29
 
30
+ const radioGroupItemVariants = cva(
31
+ "aspect-square shrink-0 rounded-full border-2 border-muted-foreground/60 bg-white text-primary shadow-xs transition-[background-color,border-color,color] duration-[210ms] ease-in-out outline-none 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 dark:aria-invalid:ring-destructive/40 data-[state=checked]:bg-primary data-[state=checked]:border-primary",
32
+ {
33
+ variants: {
34
+ size: {
35
+ sm: "size-7",
36
+ default: "size-9",
37
+ lg: "size-11",
38
+ },
39
+ },
40
+ defaultVariants: { size: "default" },
41
+ }
42
+ )
43
+
44
+ const indicatorIconSizeMap: Record<NonNullable<VariantProps<typeof radioGroupItemVariants>["size"]>, string> = {
45
+ sm: "size-3",
46
+ default: "size-4",
47
+ lg: "size-5",
48
+ }
49
+
50
+ interface RadioGroupItemProps
51
+ extends React.ComponentProps<typeof RadioGroupPrimitive.Item>,
52
+ VariantProps<typeof radioGroupItemVariants> {}
53
+
22
54
  function RadioGroupItem({
23
55
  className,
56
+ size,
24
57
  ...props
25
- }: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
58
+ }: RadioGroupItemProps) {
59
+ const iconSize = indicatorIconSizeMap[size ?? "default"]
26
60
  return (
27
61
  <RadioGroupPrimitive.Item
28
62
  data-slot="radio-group-item"
29
- className={cn(
30
- "aspect-square size-9 shrink-0 rounded-full border-2 border-muted-foreground/60 bg-white text-primary shadow-xs transition-[background-color,border-color,color] duration-[210ms] ease-in-out outline-none 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 dark:aria-invalid:ring-destructive/40 data-[state=checked]:bg-primary data-[state=checked]:border-primary",
31
- className
32
- )}
63
+ className={cn(radioGroupItemVariants({ size }), className)}
33
64
  {...props}
34
65
  >
35
66
  <RadioGroupPrimitive.Indicator
@@ -37,10 +68,10 @@ function RadioGroupItem({
37
68
  data-slot="radio-group-indicator"
38
69
  className="flex h-full w-full items-center justify-center opacity-0 scale-75 transition-[opacity,transform] duration-[120ms] ease-out data-[state=checked]:opacity-100 data-[state=checked]:scale-100"
39
70
  >
40
- <CircleIcon className="size-4 fill-primary-foreground stroke-primary-foreground" />
71
+ <CircleIcon className={cn(iconSize, "fill-primary-foreground stroke-primary-foreground")} />
41
72
  </RadioGroupPrimitive.Indicator>
42
73
  </RadioGroupPrimitive.Item>
43
74
  )
44
75
  }
45
76
 
46
- export { RadioGroup, RadioGroupItem }
77
+ export { RadioGroup, RadioGroupItem, radioGroupItemVariants }
@@ -11,14 +11,14 @@ function Switch({
11
11
  size = "default",
12
12
  ...props
13
13
  }: React.ComponentProps<typeof SwitchPrimitive.Root> & {
14
- size?: "sm" | "default"
14
+ size?: "sm" | "default" | "lg"
15
15
  }) {
16
16
  return (
17
17
  <SwitchPrimitive.Root
18
18
  data-slot="switch"
19
19
  data-size={size}
20
20
  className={cn(
21
- "peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-[background-color] duration-[210ms] ease-in-out outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[2.3rem] data-[size=default]:w-16 data-[size=sm]:h-7 data-[size=sm]:w-12 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",
21
+ "peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-[background-color] duration-[210ms] ease-in-out outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[2.3rem] data-[size=default]:w-16 data-[size=sm]:h-7 data-[size=sm]:w-12 data-[size=lg]:h-11 data-[size=lg]:w-20 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",
22
22
  className
23
23
  )}
24
24
  {...props}
@@ -30,7 +30,7 @@ function Switch({
30
30
  // check overlaps the thumb (lands ~20px); `left-1.5 size-3` leaves a
31
31
  // ~2px gap. Default keeps left-2 size-4 — it already clears its 32px
32
32
  // thumb.
33
- className="pointer-events-none absolute text-primary-foreground opacity-0 scale-75 transition-[opacity,transform] duration-[120ms] ease-out group-data-[size=default]/switch:left-2 group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:left-1.5 group-data-[size=sm]/switch:size-3 group-data-[state=checked]/switch:opacity-100 group-data-[state=checked]/switch:scale-100"
33
+ className="pointer-events-none absolute text-primary-foreground opacity-0 scale-75 transition-[opacity,transform] duration-[120ms] ease-out group-data-[size=default]/switch:left-2 group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:left-1.5 group-data-[size=sm]/switch:size-3 group-data-[size=lg]/switch:left-2.5 group-data-[size=lg]/switch:size-5 group-data-[state=checked]/switch:opacity-100 group-data-[state=checked]/switch:scale-100"
34
34
  />
35
35
  <SwitchPrimitive.Thumb
36
36
  data-slot="switch-thumb"
@@ -41,7 +41,7 @@ function Switch({
41
41
  // the thumb always contrasts the track: near-white thumb on
42
42
  // near-black track in light, near-black thumb on near-white
43
43
  // track in dark.
44
- "pointer-events-none block rounded-full bg-white data-[state=checked]:bg-primary-foreground ring-0 shadow-sm transition-[translate,background-color] duration-[175ms] ease-[cubic-bezier(0.25,0.46,0.45,0.94)] group-data-[size=default]/switch:size-8 group-data-[size=sm]/switch:size-6 data-[state=checked]:translate-x-[calc(100%-4px)] data-[state=unchecked]:translate-x-[2px]"
44
+ "pointer-events-none block rounded-full bg-white data-[state=checked]:bg-primary-foreground ring-0 shadow-sm transition-[translate,background-color] duration-[175ms] ease-[cubic-bezier(0.25,0.46,0.45,0.94)] group-data-[size=default]/switch:size-8 group-data-[size=sm]/switch:size-6 group-data-[size=lg]/switch:size-10 data-[state=checked]:translate-x-[calc(100%-4px)] data-[state=unchecked]:translate-x-[2px]"
45
45
  )}
46
46
  />
47
47
  </SwitchPrimitive.Root>