@vouched-id/ui 0.0.0-stage → 0.1.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 (228) hide show
  1. package/dist/Accordion.d.ts +8 -0
  2. package/dist/Accordion.d.ts.map +1 -0
  3. package/dist/Accordion.js +20 -0
  4. package/dist/Accordion.js.map +1 -0
  5. package/dist/Alert.d.ts +12 -0
  6. package/dist/Alert.d.ts.map +1 -0
  7. package/dist/Alert.js +64 -0
  8. package/dist/Alert.js.map +1 -0
  9. package/dist/AlertDialog.d.ts +90 -0
  10. package/dist/AlertDialog.d.ts.map +1 -0
  11. package/dist/AlertDialog.js +148 -0
  12. package/dist/AlertDialog.js.map +1 -0
  13. package/dist/Avatar.d.ts +43 -0
  14. package/dist/Avatar.d.ts.map +1 -0
  15. package/dist/Avatar.js +29 -0
  16. package/dist/Avatar.js.map +1 -0
  17. package/dist/Badge.d.ts +31 -0
  18. package/dist/Badge.d.ts.map +1 -0
  19. package/dist/Badge.js +22 -0
  20. package/dist/Badge.js.map +1 -0
  21. package/dist/Banner.d.ts +57 -0
  22. package/dist/Banner.d.ts.map +1 -0
  23. package/dist/Banner.js +30 -0
  24. package/dist/Banner.js.map +1 -0
  25. package/dist/Button.d.ts +56 -0
  26. package/dist/Button.d.ts.map +1 -0
  27. package/dist/Button.js +106 -0
  28. package/dist/Button.js.map +1 -0
  29. package/dist/Card.d.ts +79 -0
  30. package/dist/Card.d.ts.map +1 -0
  31. package/dist/Card.js +50 -0
  32. package/dist/Card.js.map +1 -0
  33. package/dist/Chart.d.ts +63 -0
  34. package/dist/Chart.d.ts.map +1 -0
  35. package/dist/Chart.js +120 -0
  36. package/dist/Chart.js.map +1 -0
  37. package/dist/Checkbox.d.ts +4 -0
  38. package/dist/Checkbox.d.ts.map +1 -0
  39. package/dist/Checkbox.js +10 -0
  40. package/dist/Checkbox.js.map +1 -0
  41. package/dist/CodeBlock.d.ts +101 -0
  42. package/dist/CodeBlock.d.ts.map +1 -0
  43. package/dist/CodeBlock.js +99 -0
  44. package/dist/CodeBlock.js.map +1 -0
  45. package/dist/Collapsible.d.ts +6 -0
  46. package/dist/Collapsible.d.ts.map +1 -0
  47. package/dist/Collapsible.js +14 -0
  48. package/dist/Collapsible.js.map +1 -0
  49. package/dist/DataTable.d.ts +59 -0
  50. package/dist/DataTable.d.ts.map +1 -0
  51. package/dist/DataTable.js +162 -0
  52. package/dist/DataTable.js.map +1 -0
  53. package/dist/Dialog.d.ts +71 -0
  54. package/dist/Dialog.d.ts.map +1 -0
  55. package/dist/Dialog.js +185 -0
  56. package/dist/Dialog.js.map +1 -0
  57. package/dist/DropdownMenu.d.ts +82 -0
  58. package/dist/DropdownMenu.d.ts.map +1 -0
  59. package/dist/DropdownMenu.js +111 -0
  60. package/dist/DropdownMenu.js.map +1 -0
  61. package/dist/EditorialHeading.d.ts +42 -0
  62. package/dist/EditorialHeading.d.ts.map +1 -0
  63. package/dist/EditorialHeading.js +36 -0
  64. package/dist/EditorialHeading.js.map +1 -0
  65. package/dist/EmptyState.d.ts +40 -0
  66. package/dist/EmptyState.d.ts.map +1 -0
  67. package/dist/EmptyState.js +7 -0
  68. package/dist/EmptyState.js.map +1 -0
  69. package/dist/Eyebrow.d.ts +27 -0
  70. package/dist/Eyebrow.d.ts.map +1 -0
  71. package/dist/Eyebrow.js +23 -0
  72. package/dist/Eyebrow.js.map +1 -0
  73. package/dist/Field.d.ts +33 -0
  74. package/dist/Field.d.ts.map +1 -0
  75. package/dist/Field.js +26 -0
  76. package/dist/Field.js.map +1 -0
  77. package/dist/HoverCard.d.ts +7 -0
  78. package/dist/HoverCard.d.ts.map +1 -0
  79. package/dist/HoverCard.js +17 -0
  80. package/dist/HoverCard.js.map +1 -0
  81. package/dist/Input.d.ts +20 -0
  82. package/dist/Input.d.ts.map +1 -0
  83. package/dist/Input.js +17 -0
  84. package/dist/Input.js.map +1 -0
  85. package/dist/InstallCommand.d.ts +48 -0
  86. package/dist/InstallCommand.d.ts.map +1 -0
  87. package/dist/InstallCommand.js +60 -0
  88. package/dist/InstallCommand.js.map +1 -0
  89. package/dist/Kbd.d.ts +23 -0
  90. package/dist/Kbd.d.ts.map +1 -0
  91. package/dist/Kbd.js +7 -0
  92. package/dist/Kbd.js.map +1 -0
  93. package/dist/Label.d.ts +5 -0
  94. package/dist/Label.d.ts.map +1 -0
  95. package/dist/Label.js +9 -0
  96. package/dist/Label.js.map +1 -0
  97. package/dist/Popover.d.ts +41 -0
  98. package/dist/Popover.d.ts.map +1 -0
  99. package/dist/Popover.js +27 -0
  100. package/dist/Popover.js.map +1 -0
  101. package/dist/Progress.d.ts +6 -0
  102. package/dist/Progress.d.ts.map +1 -0
  103. package/dist/Progress.js +9 -0
  104. package/dist/Progress.js.map +1 -0
  105. package/dist/RadioGroup.d.ts +5 -0
  106. package/dist/RadioGroup.d.ts.map +1 -0
  107. package/dist/RadioGroup.js +15 -0
  108. package/dist/RadioGroup.js.map +1 -0
  109. package/dist/ScrollArea.d.ts +32 -0
  110. package/dist/ScrollArea.d.ts.map +1 -0
  111. package/dist/ScrollArea.js +13 -0
  112. package/dist/ScrollArea.js.map +1 -0
  113. package/dist/SegmentedControl.d.ts +37 -0
  114. package/dist/SegmentedControl.d.ts.map +1 -0
  115. package/dist/SegmentedControl.js +85 -0
  116. package/dist/SegmentedControl.js.map +1 -0
  117. package/dist/Select.d.ts +21 -0
  118. package/dist/Select.d.ts.map +1 -0
  119. package/dist/Select.js +52 -0
  120. package/dist/Select.js.map +1 -0
  121. package/dist/Separator.d.ts +4 -0
  122. package/dist/Separator.d.ts.map +1 -0
  123. package/dist/Separator.js +9 -0
  124. package/dist/Separator.js.map +1 -0
  125. package/dist/Sheet.d.ts +71 -0
  126. package/dist/Sheet.d.ts.map +1 -0
  127. package/dist/Sheet.js +173 -0
  128. package/dist/Sheet.js.map +1 -0
  129. package/dist/Skeleton.d.ts +26 -0
  130. package/dist/Skeleton.d.ts.map +1 -0
  131. package/dist/Skeleton.js +9 -0
  132. package/dist/Skeleton.js.map +1 -0
  133. package/dist/Slider.d.ts +5 -0
  134. package/dist/Slider.d.ts.map +1 -0
  135. package/dist/Slider.js +12 -0
  136. package/dist/Slider.js.map +1 -0
  137. package/dist/StatusDot.d.ts +29 -0
  138. package/dist/StatusDot.d.ts.map +1 -0
  139. package/dist/StatusDot.js +55 -0
  140. package/dist/StatusDot.js.map +1 -0
  141. package/dist/StatusText.d.ts +15 -0
  142. package/dist/StatusText.d.ts.map +1 -0
  143. package/dist/StatusText.js +49 -0
  144. package/dist/StatusText.js.map +1 -0
  145. package/dist/Switch.d.ts +47 -0
  146. package/dist/Switch.d.ts.map +1 -0
  147. package/dist/Switch.js +17 -0
  148. package/dist/Switch.js.map +1 -0
  149. package/dist/Table.d.ts +22 -0
  150. package/dist/Table.d.ts.map +1 -0
  151. package/dist/Table.js +42 -0
  152. package/dist/Table.js.map +1 -0
  153. package/dist/Tabs.d.ts +96 -0
  154. package/dist/Tabs.d.ts.map +1 -0
  155. package/dist/Tabs.js +319 -0
  156. package/dist/Tabs.js.map +1 -0
  157. package/dist/Tag.d.ts +19 -0
  158. package/dist/Tag.d.ts.map +1 -0
  159. package/dist/Tag.js +50 -0
  160. package/dist/Tag.js.map +1 -0
  161. package/dist/Textarea.d.ts +32 -0
  162. package/dist/Textarea.d.ts.map +1 -0
  163. package/dist/Textarea.js +11 -0
  164. package/dist/Textarea.js.map +1 -0
  165. package/dist/Toast.d.ts +47 -0
  166. package/dist/Toast.d.ts.map +1 -0
  167. package/dist/Toast.js +110 -0
  168. package/dist/Toast.js.map +1 -0
  169. package/dist/ToggleGroup.d.ts +48 -0
  170. package/dist/ToggleGroup.d.ts.map +1 -0
  171. package/dist/ToggleGroup.js +27 -0
  172. package/dist/ToggleGroup.js.map +1 -0
  173. package/dist/Tooltip.d.ts +8 -0
  174. package/dist/Tooltip.d.ts.map +1 -0
  175. package/dist/Tooltip.js +81 -0
  176. package/dist/Tooltip.js.map +1 -0
  177. package/dist/_code-copy-button.d.ts +9 -0
  178. package/dist/_code-copy-button.d.ts.map +1 -0
  179. package/dist/_code-copy-button.js +72 -0
  180. package/dist/_code-copy-button.js.map +1 -0
  181. package/dist/_code-syntax.d.ts +81 -0
  182. package/dist/_code-syntax.d.ts.map +1 -0
  183. package/dist/_code-syntax.js +293 -0
  184. package/dist/_code-syntax.js.map +1 -0
  185. package/dist/_status-icons.d.ts +22 -0
  186. package/dist/_status-icons.d.ts.map +1 -0
  187. package/dist/_status-icons.js +40 -0
  188. package/dist/_status-icons.js.map +1 -0
  189. package/dist/index.d.ts +11 -0
  190. package/dist/index.d.ts.map +1 -0
  191. package/dist/index.js +11 -0
  192. package/dist/index.js.map +1 -0
  193. package/dist/lib/format-numbers.d.ts +51 -0
  194. package/dist/lib/format-numbers.d.ts.map +1 -0
  195. package/dist/lib/format-numbers.js +158 -0
  196. package/dist/lib/format-numbers.js.map +1 -0
  197. package/dist/lib/utils.d.ts +20 -0
  198. package/dist/lib/utils.d.ts.map +1 -0
  199. package/dist/lib/utils.js +23 -0
  200. package/dist/lib/utils.js.map +1 -0
  201. package/dist/public.d.ts +61 -0
  202. package/dist/public.d.ts.map +1 -0
  203. package/dist/public.js +65 -0
  204. package/dist/public.js.map +1 -0
  205. package/dist/theme-scope.d.ts +55 -0
  206. package/dist/theme-scope.d.ts.map +1 -0
  207. package/dist/theme-scope.js +90 -0
  208. package/dist/theme-scope.js.map +1 -0
  209. package/dist/tokens.generated.d.ts +335 -0
  210. package/dist/tokens.generated.d.ts.map +1 -0
  211. package/dist/tokens.generated.js +349 -0
  212. package/dist/tokens.generated.js.map +1 -0
  213. package/package.json +100 -3
  214. package/styles/README.md +104 -0
  215. package/styles/base.css +301 -0
  216. package/styles/canvas.css +147 -0
  217. package/styles/colors_and_type.css +136 -0
  218. package/styles/component-contracts.css +471 -0
  219. package/styles/fonts.css +28 -0
  220. package/styles/package.css +6 -0
  221. package/styles/primitive-skins.css +104 -0
  222. package/styles/semantic-bindings.css +119 -0
  223. package/styles/shell.css +50 -0
  224. package/styles/source.css +4 -0
  225. package/styles/tailwind-bridge.css +255 -0
  226. package/styles/theme.css +14 -0
  227. package/styles/tokens.css +1281 -0
  228. package/README.md +0 -3
@@ -0,0 +1,20 @@
1
+ import { type ClassValue } from 'clsx';
2
+ /**
3
+ * Combines and merges CSS class names using clsx and tailwind-merge.
4
+ *
5
+ * This utility combines multiple class values and resolves Tailwind CSS conflicts
6
+ * by merging conflicting classes intelligently. Essential for building flexible
7
+ * component APIs where multiple class sources need to be combined.
8
+ *
9
+ * @param inputs - Variable number of class values (strings, objects, arrays, etc.)
10
+ * @returns Merged and deduplicated class string
11
+ *
12
+ * @example
13
+ * cn("px-4 py-2", "bg-blue-500", { "text-white": isActive })
14
+ * // Returns: "px-4 py-2 bg-blue-500 text-white"
15
+ *
16
+ * cn("px-4", "px-6") // Tailwind conflict resolution
17
+ * // Returns: "px-6" (latest px- class wins)
18
+ */
19
+ export declare function cn(...inputs: ClassValue[]): string;
20
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAC;AAG7C;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
@@ -0,0 +1,23 @@
1
+ import { clsx } from 'clsx';
2
+ import { twMerge } from 'tailwind-merge';
3
+ /**
4
+ * Combines and merges CSS class names using clsx and tailwind-merge.
5
+ *
6
+ * This utility combines multiple class values and resolves Tailwind CSS conflicts
7
+ * by merging conflicting classes intelligently. Essential for building flexible
8
+ * component APIs where multiple class sources need to be combined.
9
+ *
10
+ * @param inputs - Variable number of class values (strings, objects, arrays, etc.)
11
+ * @returns Merged and deduplicated class string
12
+ *
13
+ * @example
14
+ * cn("px-4 py-2", "bg-blue-500", { "text-white": isActive })
15
+ * // Returns: "px-4 py-2 bg-blue-500 text-white"
16
+ *
17
+ * cn("px-4", "px-6") // Tailwind conflict resolution
18
+ * // Returns: "px-6" (latest px- class wins)
19
+ */
20
+ export function cn(...inputs) {
21
+ return twMerge(clsx(inputs));
22
+ }
23
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,IAAI,EAAE,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,EAAE,CAAC,GAAG,MAAoB;IACxC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * The canonical barrel: every public primitive and nothing else.
3
+ *
4
+ * The package entry (`./index.ts`) re-exports it, and the shadcn registry's
5
+ * `all` item installs it as a consumer's `components/kya-ds/index.ts`, so
6
+ * both kinds of consumer get the same primitives.
7
+ *
8
+ * import { Button, Field, Input, SegmentedControl, Eyebrow, EditorialHeading } from '@vouched-id/ui';
9
+ *
10
+ * These primitives read the theme: `@vouched-id/ui/theme.css` from the
11
+ * package, or the registry's theme item, both with Fontsource faces. An app
12
+ * that loads its faces another way (next/font, say) sets the same font
13
+ * variables instead.
14
+ */
15
+ export { Button, Slot, buttonVariants, type ButtonProps } from './Button.js';
16
+ export { Alert, AlertDescription, AlertTitle, alertVariants, type AlertProps } from './Alert.js';
17
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from './Accordion.js';
18
+ export { Input, type InputProps } from './Input.js';
19
+ export { Field } from './Field.js';
20
+ export { Label } from './Label.js';
21
+ export { HoverCard, HoverCardContent, HoverCardTrigger } from './HoverCard.js';
22
+ export { Checkbox } from './Checkbox.js';
23
+ export { Collapsible, CollapsibleContent, CollapsibleTrigger } from './Collapsible.js';
24
+ export { Progress } from './Progress.js';
25
+ export { RadioGroup, RadioGroupItem } from './RadioGroup.js';
26
+ export { SegmentedControl } from './SegmentedControl.js';
27
+ export { AnimatedTabs, TabCount, Tabs, TabsContent, TabsList, TabsTrigger, type AnimatedTabsProps, type TabItem, type TabLinkComponent, type TabLinkProps, } from './Tabs.js';
28
+ export { Eyebrow } from './Eyebrow.js';
29
+ export { EditorialHeading } from './EditorialHeading.js';
30
+ export { NativeSelect, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type NativeSelectProps, type SelectProps, } from './Select.js';
31
+ export { Separator } from './Separator.js';
32
+ export { ScrollArea, ScrollBar } from './ScrollArea.js';
33
+ export { Slider } from './Slider.js';
34
+ export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, } from './Table.js';
35
+ export { DataTable, type ColumnDef, type DataTableProps, type PaginationData, } from './DataTable.js';
36
+ export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, type ChartConfig, } from './Chart.js';
37
+ export { Switch, type SwitchProps } from './Switch.js';
38
+ export { Textarea, type TextareaProps } from './Textarea.js';
39
+ export { Avatar, AvatarFallback, AvatarImage, AvatarStack, type AvatarProps, type AvatarStackProps, } from './Avatar.js';
40
+ export { Badge, type BadgeProps } from './Badge.js';
41
+ export { Tag, tagVariants, type TagProps } from './Tag.js';
42
+ export { StatusDot, type StatusDotProps, type StatusTone } from './StatusDot.js';
43
+ export { StatusText, type StatusTextProps } from './StatusText.js';
44
+ export { ToggleGroup, ToggleGroupItem, type ToggleGroupProps, type ToggleGroupItemProps, } from './ToggleGroup.js';
45
+ export { Kbd, type KbdProps } from './Kbd.js';
46
+ export { EmptyState, type EmptyStateProps } from './EmptyState.js';
47
+ export { Skeleton, type SkeletonProps } from './Skeleton.js';
48
+ export { DenyGlyph, SuccessGlyph } from './_status-icons.js';
49
+ export { DEFAULT_THEME, ThemeScopeProvider, themeScopeProps, modeOfScope, useThemeScope, useCheckpointThemeAttr, type ThemeMode, type ThemeScope, } from './theme-scope.js';
50
+ export { CodeBlock, CodeToken, CodeCopyButton, type CodeBlockProps, type CodeTokenProps, type CodeTokenKind, type CodeCopyButtonProps, } from './CodeBlock.js';
51
+ export { InstallCommand, buildInstallCommand, type InstallCommandProps, type PackageManager, type InstallKind, } from './InstallCommand.js';
52
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from './Tooltip.js';
53
+ export { CpPopoverContent, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, type CpPopoverContentProps, } from './Popover.js';
54
+ export { Toaster, toast, type ToasterProps } from './Toast.js';
55
+ export { Banner, type BannerProps, type BannerVariant } from './Banner.js';
56
+ export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardLabel, CardTitle, CardValue, type CardProps, type CardVariant, } from './Card.js';
57
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, type DialogContentProps, } from './Dialog.js';
58
+ export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, type SheetContentProps, } from './Sheet.js';
59
+ export { AlertDialog, AlertDialogPortal, AlertDialogOverlay, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, type AlertDialogContentProps, type AlertDialogActionProps, } from './AlertDialog.js';
60
+ export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, type DropdownMenuContentProps, type DropdownMenuSubContentProps, } from './DropdownMenu.js';
61
+ //# sourceMappingURL=public.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../src/public.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACjG,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC9F,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,WAAW,EACX,KAAK,iBAAiB,EACtB,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,YAAY,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,OAAO,EAAE,MAAM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AM,aAAa,CAAC;AAC3E,OAAO,EACL,IAAI,EACJ,UAAU,EACV,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,KAAK,SAAS,EACd,KAAK,WAAW,GACjB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,EACb,KAAK,kBAAkB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,EACL,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,EACV,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,GAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,GACjC,MAAM,mBAAmB,CAAC"}
package/dist/public.js ADDED
@@ -0,0 +1,65 @@
1
+ /**
2
+ * The canonical barrel: every public primitive and nothing else.
3
+ *
4
+ * The package entry (`./index.ts`) re-exports it, and the shadcn registry's
5
+ * `all` item installs it as a consumer's `components/kya-ds/index.ts`, so
6
+ * both kinds of consumer get the same primitives.
7
+ *
8
+ * import { Button, Field, Input, SegmentedControl, Eyebrow, EditorialHeading } from '@vouched-id/ui';
9
+ *
10
+ * These primitives read the theme: `@vouched-id/ui/theme.css` from the
11
+ * package, or the registry's theme item, both with Fontsource faces. An app
12
+ * that loads its faces another way (next/font, say) sets the same font
13
+ * variables instead.
14
+ */
15
+ export { Button, Slot, buttonVariants } from './Button.js';
16
+ export { Alert, AlertDescription, AlertTitle, alertVariants } from './Alert.js';
17
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from './Accordion.js';
18
+ export { Input } from './Input.js';
19
+ export { Field } from './Field.js';
20
+ export { Label } from './Label.js';
21
+ export { HoverCard, HoverCardContent, HoverCardTrigger } from './HoverCard.js';
22
+ export { Checkbox } from './Checkbox.js';
23
+ export { Collapsible, CollapsibleContent, CollapsibleTrigger } from './Collapsible.js';
24
+ export { Progress } from './Progress.js';
25
+ export { RadioGroup, RadioGroupItem } from './RadioGroup.js';
26
+ export { SegmentedControl } from './SegmentedControl.js';
27
+ export { AnimatedTabs, TabCount, Tabs, TabsContent, TabsList, TabsTrigger, } from './Tabs.js';
28
+ export { Eyebrow } from './Eyebrow.js';
29
+ export { EditorialHeading } from './EditorialHeading.js';
30
+ // Form primitives · SSOT v5 spec
31
+ export { NativeSelect, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, } from './Select.js';
32
+ export { Separator } from './Separator.js';
33
+ export { ScrollArea, ScrollBar } from './ScrollArea.js';
34
+ export { Slider } from './Slider.js';
35
+ export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, } from './Table.js';
36
+ export { DataTable, } from './DataTable.js';
37
+ export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, } from './Chart.js';
38
+ export { Switch } from './Switch.js';
39
+ export { Textarea } from './Textarea.js';
40
+ // Atoms · Group A (status + small atoms)
41
+ export { Avatar, AvatarFallback, AvatarImage, AvatarStack, } from './Avatar.js';
42
+ export { Badge } from './Badge.js';
43
+ export { Tag, tagVariants } from './Tag.js';
44
+ export { StatusDot } from './StatusDot.js';
45
+ export { StatusText } from './StatusText.js';
46
+ export { ToggleGroup, ToggleGroupItem, } from './ToggleGroup.js';
47
+ export { Kbd } from './Kbd.js';
48
+ export { EmptyState } from './EmptyState.js';
49
+ export { Skeleton } from './Skeleton.js';
50
+ export { DenyGlyph, SuccessGlyph } from './_status-icons.js';
51
+ export { DEFAULT_THEME, ThemeScopeProvider, themeScopeProps, modeOfScope, useThemeScope, useCheckpointThemeAttr, } from './theme-scope.js';
52
+ // Code display — recessed ink-well code + install commands
53
+ export { CodeBlock, CodeToken, CodeCopyButton, } from './CodeBlock.js';
54
+ export { InstallCommand, buildInstallCommand, } from './InstallCommand.js';
55
+ // Chrome · Group B (replaces shadcn defaults with checkpoint-themed wrappers)
56
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from './Tooltip.js';
57
+ export { CpPopoverContent, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, } from './Popover.js';
58
+ export { Toaster, toast } from './Toast.js';
59
+ export { Banner } from './Banner.js';
60
+ export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardLabel, CardTitle, CardValue, } from './Card.js';
61
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, } from './Dialog.js';
62
+ export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, } from './Sheet.js';
63
+ export { AlertDialog, AlertDialogPortal, AlertDialogOverlay, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, } from './AlertDialog.js';
64
+ export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, } from './DropdownMenu.js';
65
+ //# sourceMappingURL=public.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.js","sourceRoot":"","sources":["../src/public.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAoB,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,aAAa,EAAmB,MAAM,YAAY,CAAC;AACjG,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC9F,OAAO,EAAE,KAAK,EAAmB,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,WAAW,GAKZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,OAAO,EAAE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ClB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,GAGlB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,GAGvB,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { type ReactNode } from 'react';
2
+ /**
3
+ * Theme and mode are two stamps on one scope element: `data-theme` names the
4
+ * theme and the `dark` or `light` class picks the mode, the way next-themes'
5
+ * `attribute="class"` sets it on <html>. The token sheets declare every role
6
+ * on any element with a mode class, so a scope resolves the roles of its own
7
+ * theme in its own mode.
8
+ */
9
+ export type ThemeMode = 'dark' | 'light';
10
+ export interface ThemeScope {
11
+ theme: string;
12
+ mode: ThemeMode;
13
+ }
14
+ /** The theme the primitives render in when no scope above them names another. */
15
+ export declare const DEFAULT_THEME = "checkpoint";
16
+ /**
17
+ * The stamps for a scope element. Spread them on the element and merge
18
+ * `className` into its own classes, or set both by hand.
19
+ *
20
+ * @example <div {...themeScopeProps({ theme: 'checkpoint', mode: 'dark' })} />
21
+ */
22
+ export declare function themeScopeProps(scope: ThemeScope): {
23
+ 'data-theme': string;
24
+ className: ThemeMode;
25
+ };
26
+ /**
27
+ * The mode a scope element selects, or undefined when it selects none. The
28
+ * mode class wins; without one, the deprecated stamps that fold the mode into
29
+ * the theme name still read: `checkpoint` is dark, any `*-light` is light.
30
+ */
31
+ export declare function modeOfScope(element: Element | null | undefined): ThemeMode | undefined;
32
+ /**
33
+ * Hands a scope to the primitives rendered below it. Dialog, Sheet, Popover,
34
+ * Tooltip, Select, DropdownMenu and Toast portal to <body>, outside the
35
+ * element that carries the scope, so they stamp the scope they read here on
36
+ * their own surface. A subtree whose portals should follow its theme or mode
37
+ * wraps itself in this provider beside the stamps on its element.
38
+ */
39
+ export declare function ThemeScopeProvider({ scope, children, }: {
40
+ scope: ThemeScope;
41
+ children: ReactNode;
42
+ }): import("react").FunctionComponentElement<import("react").ProviderProps<ThemeScope | null>>;
43
+ /**
44
+ * The scope a portaled surface stamps on itself: the nearest
45
+ * ThemeScopeProvider's, else DEFAULT_THEME in the page's mode.
46
+ */
47
+ export declare function useThemeScope(): ThemeScope;
48
+ /**
49
+ * The scope as one `data-theme` value, in the deprecated form that folds the
50
+ * mode into the theme name (`checkpoint` for dark, `checkpoint-light`).
51
+ *
52
+ * @deprecated Stamp `useThemeScope()` with `themeScopeProps`.
53
+ */
54
+ export declare function useCheckpointThemeAttr(): 'checkpoint' | 'checkpoint-light';
55
+ //# sourceMappingURL=theme-scope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-scope.d.ts","sourceRoot":"","sources":["../src/theme-scope.ts"],"names":[],"mappings":"AAEA,OAAO,EAA4C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGjF;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAEzC,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,iFAAiF;AACjF,eAAO,MAAM,aAAa,eAAe,CAAC;AAE1C;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG;IAClD,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,SAAS,CAAC;CACtB,CAEA;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAQtF;AAID;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB,8FAEA;AA4BD;;;GAGG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAI1C;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,YAAY,GAAG,kBAAkB,CAE1E"}
@@ -0,0 +1,90 @@
1
+ 'use client';
2
+ import { createContext, createElement, useContext } from 'react';
3
+ import { useTheme } from 'next-themes';
4
+ /** The theme the primitives render in when no scope above them names another. */
5
+ export const DEFAULT_THEME = 'checkpoint';
6
+ /**
7
+ * The stamps for a scope element. Spread them on the element and merge
8
+ * `className` into its own classes, or set both by hand.
9
+ *
10
+ * @example <div {...themeScopeProps({ theme: 'checkpoint', mode: 'dark' })} />
11
+ */
12
+ export function themeScopeProps(scope) {
13
+ return { 'data-theme': scope.theme, className: scope.mode };
14
+ }
15
+ /**
16
+ * The mode a scope element selects, or undefined when it selects none. The
17
+ * mode class wins; without one, the deprecated stamps that fold the mode into
18
+ * the theme name still read: `checkpoint` is dark, any `*-light` is light.
19
+ */
20
+ export function modeOfScope(element) {
21
+ if (!element)
22
+ return undefined;
23
+ if (element.classList.contains('dark'))
24
+ return 'dark';
25
+ if (element.classList.contains('light'))
26
+ return 'light';
27
+ const theme = element.getAttribute('data-theme');
28
+ if (theme === DEFAULT_THEME)
29
+ return 'dark';
30
+ if (theme?.endsWith('-light'))
31
+ return 'light';
32
+ return undefined;
33
+ }
34
+ const ThemeScopeContext = createContext(null);
35
+ /**
36
+ * Hands a scope to the primitives rendered below it. Dialog, Sheet, Popover,
37
+ * Tooltip, Select, DropdownMenu and Toast portal to <body>, outside the
38
+ * element that carries the scope, so they stamp the scope they read here on
39
+ * their own surface. A subtree whose portals should follow its theme or mode
40
+ * wraps itself in this provider beside the stamps on its element.
41
+ */
42
+ export function ThemeScopeProvider({ scope, children, }) {
43
+ return createElement(ThemeScopeContext.Provider, { value: scope }, children);
44
+ }
45
+ /**
46
+ * The page's mode: next-themes' forced theme, else its resolved theme.
47
+ *
48
+ * `resolvedTheme` is undefined until next-themes hydrates. A portaled surface
49
+ * has no scope ancestor to inherit from, so during that window it adopts the
50
+ * mode the pre-paint script stamped on the first Checkpoint scope in the
51
+ * document rather than defaulting to dark, or a dialog open before hydration
52
+ * would render dark chrome under a light shell. With nothing stamped it is
53
+ * light: brand surfaces are pinned light, and server-rendered portals must not
54
+ * flash dark chrome. It reads the DOM so the design system imports nothing
55
+ * from an app's shell.
56
+ */
57
+ function usePageMode() {
58
+ const { resolvedTheme, forcedTheme } = useTheme();
59
+ // forcedTheme wins: on a page that forces light, `resolvedTheme` still
60
+ // reports the system preference when the app keeps enableSystem on, and
61
+ // portaled chrome must follow what the page actually renders.
62
+ const effectiveTheme = forcedTheme ?? resolvedTheme;
63
+ if (effectiveTheme !== undefined)
64
+ return effectiveTheme === 'dark' ? 'dark' : 'light';
65
+ if (typeof document !== 'undefined') {
66
+ const stamped = modeOfScope(document.querySelector("[data-theme*='checkpoint']"));
67
+ if (stamped)
68
+ return stamped;
69
+ }
70
+ return 'light';
71
+ }
72
+ /**
73
+ * The scope a portaled surface stamps on itself: the nearest
74
+ * ThemeScopeProvider's, else DEFAULT_THEME in the page's mode.
75
+ */
76
+ export function useThemeScope() {
77
+ const provided = useContext(ThemeScopeContext);
78
+ const mode = usePageMode();
79
+ return provided ?? { theme: DEFAULT_THEME, mode };
80
+ }
81
+ /**
82
+ * The scope as one `data-theme` value, in the deprecated form that folds the
83
+ * mode into the theme name (`checkpoint` for dark, `checkpoint-light`).
84
+ *
85
+ * @deprecated Stamp `useThemeScope()` with `themeScopeProps`.
86
+ */
87
+ export function useCheckpointThemeAttr() {
88
+ return useThemeScope().mode === 'dark' ? 'checkpoint' : 'checkpoint-light';
89
+ }
90
+ //# sourceMappingURL=theme-scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-scope.js","sourceRoot":"","sources":["../src/theme-scope.ts"],"names":[],"mappings":"AA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