@leitware/composables 1.7.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +16 -28
  2. package/dist/presets/brutalist.css +16 -17
  3. package/dist/presets/default.css +11 -13
  4. package/dist/presets/editorial-grid.css +12 -13
  5. package/dist/presets/kumo.css +14 -20
  6. package/dist/presets/signal-pop.css +14 -26
  7. package/dist/styles.css +1 -1
  8. package/dist/tailwind.css +20 -0
  9. package/package.json +7 -8
  10. package/rules/composables.md +17 -17
  11. package/skills/use-composables/references/public-api.md +2 -7
  12. package/skills/use-composables/references/semantic-utilities.md +5 -0
  13. package/src/_internal/accordion.tsx +10 -10
  14. package/src/_internal/alert-dialog.tsx +3 -3
  15. package/src/_internal/alert.tsx +9 -7
  16. package/src/_internal/avatar.tsx +25 -14
  17. package/src/_internal/badge.tsx +2 -1
  18. package/src/_internal/bubble.tsx +2 -2
  19. package/src/_internal/button.tsx +16 -8
  20. package/src/_internal/calendar.tsx +3 -3
  21. package/src/_internal/card.tsx +53 -17
  22. package/src/_internal/checkbox.tsx +2 -2
  23. package/src/_internal/combobox.tsx +2 -2
  24. package/src/_internal/dialog.tsx +29 -9
  25. package/src/_internal/divider.tsx +14 -16
  26. package/src/_internal/dropdown-menu.tsx +4 -4
  27. package/src/_internal/empty.tsx +6 -3
  28. package/src/_internal/field.tsx +11 -7
  29. package/src/_internal/hover-card.tsx +1 -1
  30. package/src/_internal/input-group.tsx +17 -12
  31. package/src/_internal/input.tsx +33 -4
  32. package/src/_internal/item.tsx +2 -2
  33. package/src/_internal/label.tsx +1 -1
  34. package/src/_internal/message.tsx +1 -1
  35. package/src/_internal/native-select.tsx +1 -1
  36. package/src/_internal/popover.tsx +9 -3
  37. package/src/_internal/progress.tsx +37 -7
  38. package/src/_internal/radio-group.tsx +39 -4
  39. package/src/_internal/select.tsx +2 -2
  40. package/src/_internal/separator.tsx +1 -1
  41. package/src/_internal/sheet.tsx +9 -3
  42. package/src/_internal/sidebar.tsx +0 -35
  43. package/src/_internal/skeleton.tsx +26 -3
  44. package/src/_internal/slider.tsx +9 -7
  45. package/src/_internal/sonner.tsx +4 -4
  46. package/src/_internal/spinner.tsx +43 -3
  47. package/src/_internal/switch.tsx +2 -2
  48. package/src/_internal/table.tsx +20 -5
  49. package/src/_internal/tabs.tsx +4 -1
  50. package/src/_internal/textarea.tsx +1 -1
  51. package/src/_internal/toggle.tsx +1 -1
  52. package/src/_internal/tooltip.tsx +53 -8
  53. package/src/_internal/typography.tsx +4 -2
  54. package/src/index.ts +2 -3
  55. package/src/lib/utils.ts +2 -2
  56. package/src/opinionated/alert.tsx +8 -10
  57. package/src/opinionated/avatar.tsx +2 -2
  58. package/src/opinionated/button.tsx +13 -3
  59. package/src/opinionated/dialog.tsx +10 -1
  60. package/src/opinionated/form-calendar-popover.tsx +5 -10
  61. package/src/opinionated/form-checkbox.tsx +2 -2
  62. package/src/opinionated/form-date-of-birth.tsx +12 -8
  63. package/src/opinionated/form-input-group.tsx +1 -1
  64. package/src/opinionated/form-radiogroup.tsx +24 -7
  65. package/src/opinionated/form-switch.tsx +7 -6
  66. package/src/opinionated/progress.tsx +7 -2
  67. package/src/opinionated/select.tsx +4 -1
  68. package/src/opinionated/sidebar.tsx +0 -1
  69. package/src/opinionated/skeleton.tsx +3 -13
  70. package/src/opinionated/spinner.tsx +2 -0
  71. package/src/opinionated/token-config-panel/spacing-editor.tsx +21 -3
  72. package/src/opinionated/tooltip.tsx +20 -2
  73. package/src/styles/presets/brutalist.css +16 -17
  74. package/src/styles/presets/default.css +11 -13
  75. package/src/styles/presets/editorial-grid.css +12 -13
  76. package/src/styles/presets/kumo.css +14 -20
  77. package/src/styles/presets/signal-pop.css +14 -26
  78. package/src/styles/presets-data/brutalist.ts +16 -19
  79. package/src/styles/presets-data/default.ts +11 -15
  80. package/src/styles/presets-data/editorial-grid.ts +12 -6
  81. package/src/styles/presets-data/kumo.ts +12 -6
  82. package/src/styles/presets-data/signal-pop.ts +14 -30
  83. package/src/styles/tokens/components.css +64 -20
  84. package/src/styles/tokens/registry.ts +33 -0
  85. package/src/styles/tokens/semantic-utilities.css +20 -0
  86. package/src/styles/tokens/semantic.css +10 -0
  87. package/src/styles/tokens/tailwind-color-adapter.css +3 -0
  88. package/src/styles/tokens/tailwind-public-utilities.css +20 -0
  89. package/src/opinionated/blocks/content.tsx +0 -247
  90. package/src/opinionated/blocks/features.tsx +0 -242
  91. package/src/opinionated/blocks/heroes.tsx +0 -711
  92. package/src/opinionated/blocks/index.ts +0 -4
  93. package/src/opinionated/blocks/shared.tsx +0 -185
@@ -1,4 +1,5 @@
1
1
  import { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip'
2
+ import { cva, type VariantProps } from 'class-variance-authority'
2
3
 
3
4
  import { cn } from '../lib/utils'
4
5
 
@@ -14,20 +15,59 @@ function Tooltip({ ...props }: TooltipPrimitive.Root.Props) {
14
15
  )
15
16
  }
16
17
 
17
- function TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) {
18
- return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
18
+ const tooltipTriggerVariants = cva('', {
19
+ variants: {
20
+ variant: {
21
+ default: '',
22
+ // Marks inline text that reveals more on hover.
23
+ underline:
24
+ 'cursor-help underline decoration-dashed decoration-(color:--bg-fill-primary) underline-offset-4',
25
+ },
26
+ },
27
+ defaultVariants: { variant: 'default' },
28
+ })
29
+
30
+ function TooltipTrigger({
31
+ className,
32
+ variant = 'default',
33
+ ...props
34
+ }: TooltipPrimitive.Trigger.Props & VariantProps<typeof tooltipTriggerVariants>) {
35
+ return (
36
+ <TooltipPrimitive.Trigger
37
+ data-slot="tooltip-trigger"
38
+ className={cn(tooltipTriggerVariants({ variant }), className)}
39
+ {...props}
40
+ />
41
+ )
19
42
  }
20
43
 
44
+ const tooltipContentVariants = cva(
45
+ 'data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 rounded-md px-3 py-1.5 text-(length:--body-font-size) leading-(--body-line-height) **:data-[slot=kbd]:rounded-md z-tooltip w-fit max-w-xs origin-(--transform-origin)',
46
+ {
47
+ variants: {
48
+ variant: {
49
+ // The preset's tooltip colours (--tooltip-bg / --tooltip-fg).
50
+ default: 'bg-(--tooltip-bg) text-(color:--tooltip-fg)',
51
+ inverse: 'bg-(--bg-inverse) text-(color:--text-inverse)',
52
+ brand: 'bg-surface-brand text-foreground',
53
+ },
54
+ },
55
+ defaultVariants: { variant: 'default' },
56
+ },
57
+ )
58
+
21
59
  function TooltipContent({
22
60
  className,
23
61
  side = 'top',
24
62
  sideOffset = 4,
25
63
  align = 'center',
26
64
  alignOffset = 0,
65
+ variant = 'default',
27
66
  children,
28
67
  ...props
29
68
  }: TooltipPrimitive.Popup.Props &
30
- Pick<TooltipPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'>) {
69
+ Pick<TooltipPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'> &
70
+ VariantProps<typeof tooltipContentVariants>) {
31
71
  return (
32
72
  <TooltipPrimitive.Portal>
33
73
  <TooltipPrimitive.Positioner
@@ -39,10 +79,8 @@ function TooltipContent({
39
79
  >
40
80
  <TooltipPrimitive.Popup
41
81
  data-slot="tooltip-content"
42
- className={cn(
43
- 'data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 rounded-md px-3 py-1.5 text-xs **:data-[slot=kbd]:rounded-md bg-surface-inverse text-inverse z-tooltip w-fit max-w-xs origin-(--transform-origin)',
44
- className,
45
- )}
82
+ data-variant={variant}
83
+ className={cn(tooltipContentVariants({ variant }), className)}
46
84
  {...props}
47
85
  >
48
86
  {children}
@@ -52,4 +90,11 @@ function TooltipContent({
52
90
  )
53
91
  }
54
92
 
55
- export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
93
+ export {
94
+ Tooltip,
95
+ TooltipContent,
96
+ TooltipProvider,
97
+ TooltipTrigger,
98
+ tooltipContentVariants,
99
+ tooltipTriggerVariants,
100
+ }
@@ -50,8 +50,10 @@ const typographyVariants = cva('', {
50
50
  'caption-100': 'font-sans font-normal text-xs tracking-normal text-muted-foreground',
51
51
 
52
52
  // Link variants - sans font, 500, underline
53
- 'link-100': 'font-sans font-medium text-sm tracking-normal underline',
54
- 'link-200': 'font-sans font-medium text-base tracking-normal underline',
53
+ 'link-100':
54
+ 'font-sans font-medium text-sm tracking-normal underline hover:text-(--text-secondary)',
55
+ 'link-200':
56
+ 'font-sans font-medium text-base tracking-normal underline hover:text-(--text-secondary)',
55
57
  },
56
58
  },
57
59
  defaultVariants: {
package/src/index.ts CHANGED
@@ -23,8 +23,6 @@ export {
23
23
  // ── Opinionated components ──────────────────────────────────────────────────
24
24
  // These are the recommended, higher-level wrappers that most users should use.
25
25
 
26
- // ── Page blocks ─────────────────────────────────────────────────────────────
27
- export * from './opinionated/blocks'
28
26
  export { WindowFrame, type WindowFrameProps } from './opinionated/window-frame'
29
27
 
30
28
  export {
@@ -371,6 +369,7 @@ export {
371
369
  SelectGroup,
372
370
  SelectItem,
373
371
  SelectLabel,
372
+ SelectRoot,
374
373
  SelectTrigger,
375
374
  SelectValue,
376
375
  type SelectOption,
@@ -407,7 +406,6 @@ export {
407
406
  SidebarMenuBadge,
408
407
  SidebarMenuButton,
409
408
  SidebarMenuItem,
410
- SidebarMenuSkeleton,
411
409
  SidebarMenuSub,
412
410
  SidebarMenuSubButton,
413
411
  SidebarMenuSubItem,
@@ -432,6 +430,7 @@ export {
432
430
  export { Slider } from './opinionated/slider'
433
431
  export { Toaster } from './opinionated/sonner'
434
432
  export { Spacer, type SpacerProps } from './opinionated/spacer'
433
+ export { Spinner, spinnerVariants } from './opinionated/spinner'
435
434
  export { Stack, type StackProps } from './opinionated/stack'
436
435
  export { Switch } from './opinionated/switch'
437
436
 
package/src/lib/utils.ts CHANGED
@@ -10,7 +10,7 @@ export function cn(...inputs: ClassValue[]) {
10
10
  * Change this once to update focus behaviour across every component.
11
11
  */
12
12
  export const FOCUS_RING =
13
- 'focus-visible:border-[var(--focus-ring-color)] focus-visible:ring-[color:var(--focus-ring-color)]/30 focus-visible:ring-[length:var(--focus-ring-width)] aria-invalid:ring-stroke-critical/20 dark:aria-invalid:ring-stroke-critical/40 aria-invalid:border-stroke-critical dark:aria-invalid:border-stroke-critical/50 aria-invalid:ring-[length:var(--focus-ring-width)]'
13
+ 'focus-visible:border-[var(--focus-ring-color)] focus-visible:ring-[color:color-mix(in_oklab,var(--focus-ring-color)_var(--focus-ring-opacity),transparent)] focus-visible:ring-[length:var(--focus-ring-width)] focus-visible:ring-offset-[length:var(--focus-ring-offset)] focus-visible:ring-offset-(--background) aria-invalid:ring-fill-critical/20 dark:aria-invalid:ring-fill-critical/40 aria-invalid:border-fill-critical dark:aria-invalid:border-fill-critical/50 aria-invalid:ring-[length:var(--focus-ring-width)]'
14
14
 
15
15
  /**
16
16
  * Centralised hover ring style for all interactive elements.
@@ -25,7 +25,7 @@ export const HOVER_RING =
25
25
  * inside a wrapper, such as InputGroup and chip inputs.
26
26
  */
27
27
  export const GROUP_FOCUS_RING =
28
- 'has-[:focus-visible]:border-[var(--focus-ring-color)] has-[:focus-visible]:ring-[color:var(--focus-ring-color)]/30 has-[:focus-visible]:ring-[length:var(--focus-ring-width)] has-aria-invalid:ring-stroke-critical/20 dark:has-aria-invalid:ring-stroke-critical/40 has-aria-invalid:border-stroke-critical dark:has-aria-invalid:border-stroke-critical/50 has-aria-invalid:ring-[length:var(--focus-ring-width)]'
28
+ 'has-[:focus-visible]:border-[var(--focus-ring-color)] has-[:focus-visible]:ring-[color:color-mix(in_oklab,var(--focus-ring-color)_var(--focus-ring-opacity),transparent)] has-[:focus-visible]:ring-[length:var(--focus-ring-width)] has-[:focus-visible]:ring-offset-[length:var(--focus-ring-offset)] has-[:focus-visible]:ring-offset-(--background) has-aria-invalid:ring-fill-critical/20 dark:has-aria-invalid:ring-fill-critical/40 has-aria-invalid:border-fill-critical dark:has-aria-invalid:border-fill-critical/50 has-aria-invalid:ring-[length:var(--focus-ring-width)]'
29
29
 
30
30
  /** Destructive-variant focus override layered on top of FOCUS_RING. */
31
31
  export const FOCUS_RING_DESTRUCTIVE =
@@ -1,4 +1,4 @@
1
- import { AlertTriangleIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon } from 'lucide-react'
1
+ import { CircleAlertIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon } from 'lucide-react'
2
2
  import type { VariantProps } from 'class-variance-authority'
3
3
  import type * as React from 'react'
4
4
 
@@ -39,7 +39,7 @@ export interface AlertProps extends Omit<React.ComponentProps<typeof AlertPrimit
39
39
  * - `notice` - info icon (ℹ), neutral styling
40
40
  * - `positive` - check icon, green styling
41
41
  * - `warning` - triangle icon, amber styling
42
- * - `negative` - alert triangle icon, red/destructive styling
42
+ * - `negative` - alert circle icon, red/destructive styling
43
43
  * @default 'default'
44
44
  */
45
45
  type?: AlertType
@@ -80,13 +80,13 @@ function Alert({
80
80
  const getIcon = () => {
81
81
  switch (type) {
82
82
  case 'negative':
83
- return <AlertTriangleIcon className="size-3.5" />
83
+ return <CircleAlertIcon />
84
84
  case 'positive':
85
- return <CircleCheckIcon className="size-3.5" />
85
+ return <CircleCheckIcon />
86
86
  case 'notice':
87
- return <InfoIcon className="size-3.5" />
87
+ return <InfoIcon />
88
88
  case 'warning':
89
- return <TriangleAlertIcon className="size-3.5" />
89
+ return <TriangleAlertIcon />
90
90
  default:
91
91
  return null
92
92
  }
@@ -98,10 +98,8 @@ function Alert({
98
98
  return (
99
99
  <AlertPrimitive variant={resolvedVariant} className={className} {...alertProps}>
100
100
  {icon}
101
- <div className="flex-1">
102
- {title && <AlertTitle>{title}</AlertTitle>}
103
- {content && <AlertDescription>{content}</AlertDescription>}
104
- </div>
101
+ {title && <AlertTitle>{title}</AlertTitle>}
102
+ {content && <AlertDescription>{content}</AlertDescription>}
105
103
  {action && <AlertAction>{action}</AlertAction>}
106
104
  </AlertPrimitive>
107
105
  )
@@ -43,11 +43,11 @@ export interface AvatarProps extends VariantProps<typeof avatarVariants> {
43
43
  * <Avatar src="/user.png" fallback="?" />
44
44
  * ```
45
45
  */
46
- function Avatar({ src, alt, name, fallback, size, className }: AvatarProps) {
46
+ function Avatar({ src, alt, name, fallback, size, variant, className }: AvatarProps) {
47
47
  const displayFallback = fallback ?? (name ? getInitials(name) : '?')
48
48
 
49
49
  return (
50
- <AvatarPrimitive size={size} className={className}>
50
+ <AvatarPrimitive size={size} variant={variant} className={className}>
51
51
  {src && <AvatarImage src={src} alt={alt ?? name ?? 'Avatar'} />}
52
52
  <AvatarFallback>{displayFallback}</AvatarFallback>
53
53
  </AvatarPrimitive>
@@ -1,8 +1,9 @@
1
1
  import type { VariantProps } from 'class-variance-authority'
2
- import { Loader2Icon } from 'lucide-react'
3
2
  import type * as React from 'react'
4
3
 
5
4
  import { Button as ButtonPrimitive, type buttonVariants } from '../_internal/button'
5
+ import { Spinner } from '../_internal/spinner'
6
+ import { cn } from '../lib/utils'
6
7
 
7
8
  /**
8
9
  * Props for the opinionated Button component.
@@ -52,12 +53,21 @@ function Button({
52
53
  variant={variant}
53
54
  size={size}
54
55
  shape={shape}
55
- className={className}
56
+ className={cn(loading && 'relative', className)}
56
57
  disabled={isDisabled}
58
+ aria-busy={loading || undefined}
57
59
  type={type}
58
60
  {...buttonProps}
59
61
  >
60
- {loading ? <Loader2Icon className="animate-spin" /> : children}
62
+ {loading ? (
63
+ <>
64
+ {/* Keep the label in flow so the button holds its width. */}
65
+ <span className="invisible inline-flex items-center gap-1">{children}</span>
66
+ <Spinner className="absolute inset-0 m-auto" />
67
+ </>
68
+ ) : (
69
+ children
70
+ )}
61
71
  </ButtonPrimitive>
62
72
  )
63
73
  }
@@ -1,4 +1,5 @@
1
1
  import type { Dialog as DialogPrimitiveBase } from '@base-ui/react/dialog'
2
+ import type { VariantProps } from 'class-variance-authority'
2
3
  import type * as React from 'react'
3
4
 
4
5
  import {
@@ -12,6 +13,7 @@ import {
12
13
  Dialog as DialogPrimitive,
13
14
  DialogTitle,
14
15
  DialogTrigger,
16
+ type dialogContentVariants,
15
17
  } from '../_internal/dialog'
16
18
 
17
19
  /**
@@ -52,6 +54,8 @@ export interface DialogProps extends Omit<DialogPrimitiveBase.Root.Props, 'child
52
54
  footer?: React.ReactNode
53
55
  /** Whether to show the built-in close (×) button. @default true */
54
56
  showCloseButton?: boolean
57
+ /** `responsive` docks the dialog to the bottom of the screen on small viewports. @default 'center' */
58
+ placement?: VariantProps<typeof dialogContentVariants>['placement']
55
59
  className?: string
56
60
  }
57
61
 
@@ -62,6 +66,7 @@ function Dialog({
62
66
  children,
63
67
  footer,
64
68
  showCloseButton = true,
69
+ placement,
65
70
  className,
66
71
  open,
67
72
  onOpenChange,
@@ -77,7 +82,11 @@ function Dialog({
77
82
  return (
78
83
  <DialogPrimitive open={open} onOpenChange={onOpenChange} {...dialogProps}>
79
84
  {trigger && <DialogTrigger>{trigger}</DialogTrigger>}
80
- <DialogContent className={className} showCloseButton={showCloseButton}>
85
+ <DialogContent
86
+ className={className}
87
+ placement={placement}
88
+ showCloseButton={showCloseButton}
89
+ >
81
90
  {(title || description) && (
82
91
  <DialogHeader>
83
92
  {title && <DialogTitle>{title}</DialogTitle>}
@@ -1,11 +1,10 @@
1
1
  import type { VariantProps } from 'class-variance-authority'
2
2
  import { ChevronDownIcon } from 'lucide-react'
3
3
  import * as React from 'react'
4
- import { Button as ButtonPrimitive } from '../_internal/button'
5
4
  import { Calendar } from '../_internal/calendar'
6
5
  import { Field, FieldContent, FieldDescription, FieldError, FieldLabel } from '../_internal/field'
6
+ import { FieldTrigger } from '../_internal/input'
7
7
  import { Popover, PopoverContent, PopoverTrigger } from '../_internal/popover'
8
- import { cn } from '../lib/utils'
9
8
 
10
9
  export interface FormCalendarPopoverProps {
11
10
  label?: string
@@ -96,25 +95,21 @@ function FormCalendarPopover({
96
95
  <Popover open={open} onOpenChange={setOpen}>
97
96
  <PopoverTrigger
98
97
  render={
99
- <ButtonPrimitive
98
+ <FieldTrigger
100
99
  id={inputId}
101
100
  name={name}
102
- variant="outline"
103
101
  disabled={disabled}
104
102
  aria-invalid={hasError}
105
103
  aria-required={required}
106
104
  aria-label={ariaLabel}
107
105
  aria-labelledby={ariaLabelledBy || (label ? inputId : undefined)}
108
106
  onBlur={handleBlur}
109
- className={cn(
110
- 'w-full justify-between font-normal',
111
- !value && 'text-muted-foreground',
112
- )}
107
+ data-placeholder={value ? undefined : ''}
113
108
  {...props}
114
109
  >
115
110
  {value ? value.toLocaleDateString() : placeholder}
116
- <ChevronDownIcon className="ml-2 h-4 w-4 opacity-50" />
117
- </ButtonPrimitive>
111
+ <ChevronDownIcon className="text-muted-foreground size-[1.25em] shrink-0" />
112
+ </FieldTrigger>
118
113
  }
119
114
  />
120
115
  <PopoverContent className="w-auto p-0" align="start">
@@ -28,7 +28,7 @@ export interface FormCheckboxProps extends Omit<
28
28
  description?: string
29
29
  /** Error message(s). Accepts a string, array, or react-hook-form error array. */
30
30
  error?: string | string[] | Array<{ message?: string } | undefined>
31
- /** Controlled checked state. @default false */
31
+ /** Controlled checked state. Omit (or use `defaultChecked`) for uncontrolled. */
32
32
  checked?: boolean
33
33
  /** Called when the user toggles the checkbox. */
34
34
  onCheckedChange?: (checked: boolean) => void
@@ -49,7 +49,7 @@ function FormCheckbox({
49
49
  label,
50
50
  description,
51
51
  error,
52
- checked = false,
52
+ checked,
53
53
  onCheckedChange,
54
54
  disabled = false,
55
55
  required = false,
@@ -110,8 +110,8 @@ function FormDateOfBirth({
110
110
  }
111
111
 
112
112
  const inputClassName = cn(
113
- 'text-center tabular-nums',
114
- hasError && 'aria-invalid:border-stroke-critical aria-invalid:ring-stroke-critical/20',
113
+ 'text-center tabular-nums min-w-0',
114
+ hasError && 'aria-invalid:border-fill-critical aria-invalid:ring-fill-critical/20',
115
115
  )
116
116
 
117
117
  return (
@@ -124,7 +124,7 @@ function FormDateOfBirth({
124
124
  )}
125
125
  <FieldContent>
126
126
  <fieldset
127
- className="flex items-center gap-1 border-none p-0 m-0 min-w-0"
127
+ className="flex items-center gap-2 border-none p-0 m-0 min-w-0"
128
128
  aria-label={ariaLabel || label || 'Date of birth'}
129
129
  aria-labelledby={ariaLabelledBy}
130
130
  >
@@ -143,10 +143,12 @@ function FormDateOfBirth({
143
143
  aria-invalid={hasError}
144
144
  aria-required={required}
145
145
  aria-label="Day"
146
- className={cn(inputClassName, 'w-10')}
146
+ className={cn(inputClassName, 'w-[3.75em]')}
147
147
  maxLength={2}
148
148
  />
149
- <span className="text-muted-foreground text-sm">/</span>
149
+ <span className="text-muted-foreground text-(length:--control-font-size) leading-(--text-sm--line-height)">
150
+ /
151
+ </span>
150
152
  <Input
151
153
  ref={monthRef}
152
154
  id={`${fieldId}-month`}
@@ -161,10 +163,12 @@ function FormDateOfBirth({
161
163
  required={required}
162
164
  aria-invalid={hasError}
163
165
  aria-label="Month"
164
- className={cn(inputClassName, 'w-10')}
166
+ className={cn(inputClassName, 'w-[3.75em]')}
165
167
  maxLength={2}
166
168
  />
167
- <span className="text-muted-foreground text-sm">/</span>
169
+ <span className="text-muted-foreground text-(length:--control-font-size) leading-(--text-sm--line-height)">
170
+ /
171
+ </span>
168
172
  <Input
169
173
  ref={yearRef}
170
174
  id={`${fieldId}-year`}
@@ -179,7 +183,7 @@ function FormDateOfBirth({
179
183
  required={required}
180
184
  aria-invalid={hasError}
181
185
  aria-label="Year"
182
- className={cn(inputClassName, 'w-14')}
186
+ className={cn(inputClassName, 'w-[5em]')}
183
187
  maxLength={4}
184
188
  />
185
189
  </fieldset>
@@ -120,7 +120,7 @@ function FormInputGroup({
120
120
  </FieldLabel>
121
121
  )}
122
122
  <FieldContent>
123
- <InputGroup data-invalid={hasError}>
123
+ <InputGroup data-invalid={hasError} data-disabled={disabled || undefined}>
124
124
  {startAddon && (
125
125
  <InputGroupAddon align="inline-start" {...startAddonProps}>
126
126
  {startAddon}
@@ -2,12 +2,20 @@ import type { RadioGroup as RadioGroupPrimitive } from '@base-ui/react/radio-gro
2
2
  import type { VariantProps } from 'class-variance-authority'
3
3
  import * as React from 'react'
4
4
  import { Field, FieldContent, FieldDescription, FieldError, FieldLabel } from '../_internal/field'
5
- import { Label } from '../_internal/label'
6
- import { RadioGroup, RadioGroupItem } from '../_internal/radio-group'
5
+ import {
6
+ RadioGroup,
7
+ RadioGroupItem,
8
+ RadioGroupOption,
9
+ type radioGroupOptionVariants,
10
+ } from '../_internal/radio-group'
7
11
 
8
12
  export interface FormRadioGroupOption {
9
13
  label: string
10
14
  value: string
15
+ /** Supporting copy under the label. */
16
+ description?: string
17
+ /** Leading icon or illustration. */
18
+ icon?: React.ReactNode
11
19
  disabled?: boolean
12
20
  }
13
21
 
@@ -24,6 +32,8 @@ export interface FormRadioGroupProps extends Omit<
24
32
  disabled?: boolean
25
33
  required?: boolean
26
34
  orientation?: VariantProps<typeof Field>['orientation']
35
+ /** `card` renders each option as a selectable tile. */
36
+ variant?: VariantProps<typeof radioGroupOptionVariants>['variant']
27
37
  className?: string
28
38
  // Additional props
29
39
  id?: string
@@ -40,6 +50,7 @@ function FormRadioGroup({
40
50
  disabled = false,
41
51
  required = false,
42
52
  orientation = 'vertical',
53
+ variant = 'default',
43
54
  className,
44
55
  id,
45
56
  name,
@@ -89,17 +100,23 @@ function FormRadioGroup({
89
100
  {options.map((option) => {
90
101
  const optionId = `${radioGroupId}-${option.value}`
91
102
  return (
92
- <div key={option.value} className="flex items-center space-x-2">
103
+ <RadioGroupOption key={option.value} htmlFor={optionId} variant={variant}>
93
104
  <RadioGroupItem
94
105
  value={option.value}
95
106
  id={optionId}
96
107
  disabled={disabled || option.disabled}
97
108
  aria-invalid={hasError}
98
109
  />
99
- <Label htmlFor={optionId} className="text-sm font-normal cursor-pointer">
100
- {option.label}
101
- </Label>
102
- </div>
110
+ {option.icon}
111
+ <span className="flex flex-col gap-0.5">
112
+ <span className="font-medium">{option.label}</span>
113
+ {option.description && (
114
+ <span className="text-muted-foreground text-xs/relaxed">
115
+ {option.description}
116
+ </span>
117
+ )}
118
+ </span>
119
+ </RadioGroupOption>
103
120
  )
104
121
  })}
105
122
  </RadioGroup>
@@ -28,7 +28,7 @@ export interface FormSwitchProps extends Omit<
28
28
  description?: string
29
29
  /** Error message(s). Accepts a string, array, or react-hook-form error array. */
30
30
  error?: string | string[] | Array<{ message?: string } | undefined>
31
- /** Controlled checked state. @default false */
31
+ /** Controlled checked state. Omit (or use `defaultChecked`) for uncontrolled. */
32
32
  checked?: boolean
33
33
  /** Called when the user toggles the switch. */
34
34
  onCheckedChange?: (checked: boolean) => void
@@ -51,7 +51,7 @@ function FormSwitch({
51
51
  label,
52
52
  description,
53
53
  error,
54
- checked = false,
54
+ checked,
55
55
  onCheckedChange,
56
56
  disabled = false,
57
57
  required = false,
@@ -81,10 +81,11 @@ function FormSwitch({
81
81
  return (
82
82
  <Field orientation={orientation} className={className} data-invalid={hasError}>
83
83
  <FieldContent
84
- className={orientation === 'horizontal' ? 'flex-row items-center gap-2' : undefined}
84
+ className={orientation === 'horizontal' ? 'flex-row items-start gap-2' : undefined}
85
85
  >
86
- {hasLabelOrDescription && (
87
- <div className="flex flex-col gap-0.5 flex-1">
86
+ {/* Text column: label, assistive text and error stack beside the switch. */}
87
+ {(hasLabelOrDescription || hasError) && (
88
+ <div className="flex flex-col gap-1.5 flex-1">
88
89
  {label && (
89
90
  <FieldLabel htmlFor={switchId}>
90
91
  {label}
@@ -92,6 +93,7 @@ function FormSwitch({
92
93
  </FieldLabel>
93
94
  )}
94
95
  {description && <FieldDescription>{description}</FieldDescription>}
96
+ {hasError && <FieldError errors={errorArray} />}
95
97
  </div>
96
98
  )}
97
99
  <Switch
@@ -108,7 +110,6 @@ function FormSwitch({
108
110
  size={size}
109
111
  {...switchProps}
110
112
  />
111
- {hasError && <FieldError errors={errorArray} />}
112
113
  </FieldContent>
113
114
  </Field>
114
115
  )
@@ -1,7 +1,10 @@
1
+ import type { VariantProps } from 'class-variance-authority'
2
+
1
3
  import {
2
4
  ProgressIndicator,
3
5
  ProgressLabel,
4
6
  Progress as ProgressPrimitive,
7
+ progressIndicatorVariants,
5
8
  ProgressTrack,
6
9
  ProgressValue,
7
10
  } from '../_internal/progress'
@@ -9,6 +12,8 @@ import {
9
12
  export interface ProgressProps {
10
13
  /** Progress value (0-100) */
11
14
  value: number
15
+ /** Visual style variant. @default 'default' */
16
+ variant?: VariantProps<typeof progressIndicatorVariants>['variant']
12
17
  /** Optional label text */
13
18
  label?: string
14
19
  /** Whether to display the numeric value */
@@ -27,7 +32,7 @@ export interface ProgressProps {
27
32
  * <Progress value={100} label="Complete" />
28
33
  * ```
29
34
  */
30
- function Progress({ value, label, showValue = false, className }: ProgressProps) {
35
+ function Progress({ value, variant, label, showValue = false, className }: ProgressProps) {
31
36
  return (
32
37
  <ProgressPrimitive value={value} className={className}>
33
38
  {(label || showValue) && (
@@ -37,7 +42,7 @@ function Progress({ value, label, showValue = false, className }: ProgressProps)
37
42
  </div>
38
43
  )}
39
44
  <ProgressTrack>
40
- <ProgressIndicator />
45
+ <ProgressIndicator variant={variant} />
41
46
  </ProgressTrack>
42
47
  </ProgressPrimitive>
43
48
  )
@@ -86,12 +86,15 @@ function Select({
86
86
  )
87
87
  }
88
88
 
89
- // Re-export sub-components for advanced usage
89
+ // Re-export sub-components for advanced usage. SelectRoot is the unstyled
90
+ // Base UI root - compose it with the parts below when the options-array
91
+ // Select API can't express the trigger content (e.g. a labelled null state).
90
92
  export {
91
93
  SelectContent,
92
94
  SelectGroup,
93
95
  SelectItem,
94
96
  SelectLabel,
97
+ SelectPrimitive as SelectRoot,
95
98
  SelectScrollDownButton,
96
99
  SelectScrollUpButton,
97
100
  SelectSeparator,
@@ -56,7 +56,6 @@ export {
56
56
  SidebarMenuBadge,
57
57
  SidebarMenuButton,
58
58
  SidebarMenuItem,
59
- SidebarMenuSkeleton,
60
59
  SidebarMenuSub,
61
60
  SidebarMenuSubButton,
62
61
  SidebarMenuSubItem,
@@ -52,18 +52,6 @@ function Skeleton({
52
52
  style,
53
53
  ...props
54
54
  }: SkeletonProps) {
55
- const sizeStyles = {
56
- sm: 'h-4',
57
- md: 'h-6',
58
- lg: 'h-8',
59
- }
60
-
61
- const variantStyles = {
62
- rectangle: 'rounded-md',
63
- circle: 'rounded-full',
64
- text: 'rounded',
65
- }
66
-
67
55
  const computedStyle: React.CSSProperties = {
68
56
  ...style,
69
57
  ...(width !== undefined && {
@@ -76,7 +64,9 @@ function Skeleton({
76
64
 
77
65
  return (
78
66
  <SkeletonPrimitive
79
- className={cn(variantStyles[variant], size && !height && sizeStyles[size], className)}
67
+ variant={variant}
68
+ size={height === undefined ? size : undefined}
69
+ className={className}
80
70
  style={computedStyle}
81
71
  {...props}
82
72
  />
@@ -0,0 +1,2 @@
1
+ // Re-export Spinner from the base UI component
2
+ export { Spinner, spinnerVariants } from '../_internal/spinner'