@shadow-js/ui 0.0.0-stage → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/LICENSE +21 -0
  3. package/README.md +598 -2
  4. package/dist/cli.mjs +2281 -0
  5. package/dist/dev/cli/schema.d.ts +71 -0
  6. package/dist/dev/index.d.ts +6 -0
  7. package/dist/dev/index.js +5 -0
  8. package/dist/dev/locales/ar.d.ts +139 -0
  9. package/dist/dev/locales/ar.js +127 -0
  10. package/dist/dev/locales/ar.js.map +1 -0
  11. package/dist/dev/locales/en.d.ts +139 -0
  12. package/dist/dev/locales/en.js +127 -0
  13. package/dist/dev/locales/en.js.map +1 -0
  14. package/dist/dev/registry/utils/utils.d.ts +27 -0
  15. package/dist/dev/registry/utils/utils.js +26 -0
  16. package/dist/dev/registry/utils/utils.js.map +1 -0
  17. package/dist/dev/theme/theme-logic.d.ts +185 -0
  18. package/dist/dev/theme/theme-logic.js +183 -0
  19. package/dist/dev/theme/theme-logic.js.map +1 -0
  20. package/dist/dev/theme/theme-provider.d.ts +88 -0
  21. package/dist/dev/theme/theme-provider.js +149 -0
  22. package/dist/dev/theme/theme-provider.js.map +1 -0
  23. package/dist/prod/index.js +1 -0
  24. package/dist/prod/locales/ar.js +2 -0
  25. package/dist/prod/locales/ar.js.map +1 -0
  26. package/dist/prod/locales/en.js +2 -0
  27. package/dist/prod/locales/en.js.map +1 -0
  28. package/dist/prod/registry/utils/utils.js +2 -0
  29. package/dist/prod/registry/utils/utils.js.map +1 -0
  30. package/dist/prod/theme/theme-logic.js +2 -0
  31. package/dist/prod/theme/theme-logic.js.map +1 -0
  32. package/dist/prod/theme/theme-provider.js +2 -0
  33. package/dist/prod/theme/theme-provider.js.map +1 -0
  34. package/package.json +102 -4
  35. package/registry/accordion/accordion.tsx +210 -0
  36. package/registry/accordion/item.json +4 -0
  37. package/registry/alert/alert.tsx +200 -0
  38. package/registry/alert/item.json +4 -0
  39. package/registry/alert-dialog/alert-dialog.tsx +530 -0
  40. package/registry/alert-dialog/item.json +4 -0
  41. package/registry/aspect-ratio/aspect-ratio.tsx +71 -0
  42. package/registry/aspect-ratio/item.json +4 -0
  43. package/registry/attachment/attachment.tsx +459 -0
  44. package/registry/attachment/item.json +4 -0
  45. package/registry/avatar/avatar.tsx +385 -0
  46. package/registry/avatar/item.json +4 -0
  47. package/registry/badge/badge.tsx +108 -0
  48. package/registry/badge/item.json +4 -0
  49. package/registry/breadcrumb/breadcrumb.tsx +354 -0
  50. package/registry/breadcrumb/item.json +4 -0
  51. package/registry/bubble/bubble.tsx +260 -0
  52. package/registry/bubble/item.json +4 -0
  53. package/registry/button/button.tsx +125 -0
  54. package/registry/button/item.json +4 -0
  55. package/registry/button-group/button-group.tsx +189 -0
  56. package/registry/button-group/item.json +4 -0
  57. package/registry/calendar/calendar.tsx +348 -0
  58. package/registry/calendar/item.json +4 -0
  59. package/registry/card/card.tsx +311 -0
  60. package/registry/card/item.json +4 -0
  61. package/registry/carousel/carousel.tsx +851 -0
  62. package/registry/carousel/item.json +4 -0
  63. package/registry/chart/chart.tsx +1956 -0
  64. package/registry/chart/item.json +4 -0
  65. package/registry/chart-scale/chart-scale.ts +670 -0
  66. package/registry/chart-scale/item.json +5 -0
  67. package/registry/checkbox/checkbox.tsx +79 -0
  68. package/registry/checkbox/item.json +4 -0
  69. package/registry/code-block/code-block.tsx +470 -0
  70. package/registry/code-block/item.json +4 -0
  71. package/registry/collapsible/collapsible.tsx +117 -0
  72. package/registry/collapsible/item.json +4 -0
  73. package/registry/combobox/combobox.tsx +977 -0
  74. package/registry/combobox/item.json +4 -0
  75. package/registry/command/command.tsx +757 -0
  76. package/registry/command/item.json +4 -0
  77. package/registry/context-menu/context-menu.tsx +697 -0
  78. package/registry/context-menu/item.json +4 -0
  79. package/registry/data-table/data-table.tsx +437 -0
  80. package/registry/data-table/item.json +4 -0
  81. package/registry/date-picker/date-picker.tsx +349 -0
  82. package/registry/date-picker/item.json +4 -0
  83. package/registry/dialog/dialog.tsx +412 -0
  84. package/registry/dialog/item.json +4 -0
  85. package/registry/direction/direction.tsx +88 -0
  86. package/registry/direction/item.json +4 -0
  87. package/registry/drawer/drawer.tsx +787 -0
  88. package/registry/drawer/item.json +4 -0
  89. package/registry/dropdown-menu/dropdown-menu.tsx +692 -0
  90. package/registry/dropdown-menu/item.json +4 -0
  91. package/registry/empty/empty.tsx +240 -0
  92. package/registry/empty/item.json +4 -0
  93. package/registry/field/field.tsx +624 -0
  94. package/registry/field/item.json +4 -0
  95. package/registry/form/form.tsx +1112 -0
  96. package/registry/form/item.json +4 -0
  97. package/registry/hover-card/hover-card.tsx +144 -0
  98. package/registry/hover-card/item.json +4 -0
  99. package/registry/icons/icons.tsx +1691 -0
  100. package/registry/icons/item.json +4 -0
  101. package/registry/input/input.tsx +43 -0
  102. package/registry/input/item.json +4 -0
  103. package/registry/input-group/input-group.tsx +315 -0
  104. package/registry/input-group/item.json +4 -0
  105. package/registry/input-otp/input-otp.tsx +329 -0
  106. package/registry/input-otp/item.json +4 -0
  107. package/registry/item/item.json +4 -0
  108. package/registry/item/item.tsx +439 -0
  109. package/registry/kbd/item.json +4 -0
  110. package/registry/kbd/kbd.tsx +65 -0
  111. package/registry/label/item.json +4 -0
  112. package/registry/label/label.tsx +60 -0
  113. package/registry/marker/item.json +4 -0
  114. package/registry/marker/marker.tsx +175 -0
  115. package/registry/menubar/item.json +4 -0
  116. package/registry/menubar/menubar.tsx +694 -0
  117. package/registry/message/item.json +4 -0
  118. package/registry/message/message.tsx +280 -0
  119. package/registry/message-scroller/item.json +4 -0
  120. package/registry/message-scroller/message-scroller.tsx +262 -0
  121. package/registry/native-select/item.json +4 -0
  122. package/registry/native-select/native-select.tsx +113 -0
  123. package/registry/navigation-menu/item.json +4 -0
  124. package/registry/navigation-menu/navigation-menu.tsx +362 -0
  125. package/registry/pagination/item.json +4 -0
  126. package/registry/pagination/pagination.tsx +460 -0
  127. package/registry/password-input/item.json +5 -0
  128. package/registry/password-input/password-input.tsx +494 -0
  129. package/registry/popover/item.json +4 -0
  130. package/registry/popover/popover.tsx +284 -0
  131. package/registry/progress/item.json +4 -0
  132. package/registry/progress/progress.tsx +190 -0
  133. package/registry/questionnaire/item.json +4 -0
  134. package/registry/questionnaire/questionnaire.tsx +569 -0
  135. package/registry/radio-group/item.json +4 -0
  136. package/registry/radio-group/radio-group.tsx +101 -0
  137. package/registry/resizable/item.json +4 -0
  138. package/registry/resizable/resizable.tsx +455 -0
  139. package/registry/scroll-area/item.json +4 -0
  140. package/registry/scroll-area/scroll-area.tsx +149 -0
  141. package/registry/select/item.json +4 -0
  142. package/registry/select/select.tsx +571 -0
  143. package/registry/separator/item.json +4 -0
  144. package/registry/separator/separator.tsx +52 -0
  145. package/registry/sheet/item.json +4 -0
  146. package/registry/sheet/sheet.tsx +476 -0
  147. package/registry/sidebar/item.json +4 -0
  148. package/registry/sidebar/sidebar.tsx +1870 -0
  149. package/registry/skeleton/item.json +4 -0
  150. package/registry/skeleton/skeleton.tsx +47 -0
  151. package/registry/slider/item.json +4 -0
  152. package/registry/slider/slider.tsx +149 -0
  153. package/registry/spinner/item.json +4 -0
  154. package/registry/spinner/spinner.tsx +51 -0
  155. package/registry/switch/item.json +4 -0
  156. package/registry/switch/switch.tsx +93 -0
  157. package/registry/table/item.json +4 -0
  158. package/registry/table/table.tsx +373 -0
  159. package/registry/tabs/item.json +4 -0
  160. package/registry/tabs/tabs.tsx +209 -0
  161. package/registry/textarea/item.json +4 -0
  162. package/registry/textarea/textarea.tsx +51 -0
  163. package/registry/toast/item.json +4 -0
  164. package/registry/toast/toast.tsx +949 -0
  165. package/registry/toggle/item.json +4 -0
  166. package/registry/toggle/toggle.tsx +110 -0
  167. package/registry/toggle-group/item.json +4 -0
  168. package/registry/toggle-group/toggle-group.tsx +189 -0
  169. package/registry/tooltip/item.json +4 -0
  170. package/registry/tooltip/tooltip.tsx +169 -0
  171. package/registry/trace/item.json +4 -0
  172. package/registry/trace/trace.tsx +356 -0
  173. package/registry/ui-strings/item.json +5 -0
  174. package/registry/ui-strings/ui-strings.tsx +454 -0
  175. package/registry/use-highlighted-code/item.json +5 -0
  176. package/registry/use-highlighted-code/use-highlighted-code.tsx +145 -0
  177. package/registry/use-mobile/item.json +5 -0
  178. package/registry/use-mobile/use-mobile.ts +46 -0
  179. package/registry/utils/item.json +5 -0
  180. package/registry/utils/utils.ts +38 -0
  181. package/registry.json +3274 -0
  182. package/styles/animations.css +321 -0
  183. package/styles/theme-core.css +55 -0
  184. package/styles/theme.css +12 -0
  185. package/styles/themes/gray.css +69 -0
  186. package/styles/themes/neutral.css +69 -0
  187. package/styles/themes/slate.css +69 -0
  188. package/styles/themes/stone.css +69 -0
  189. package/styles/themes/zinc.css +69 -0
  190. package/styles/typeset.css +251 -0
@@ -0,0 +1,175 @@
1
+ import { splitProps } from "@shadow-js/core";
2
+ import { Polymorphic, type PolymorphicProps, type PolymorphicTarget } from "@shadow-js/primitives";
3
+ import type { ComponentProps, JSX } from "@shadow-js/web";
4
+ import { cva, type VariantProps } from "class-variance-authority";
5
+ import { type ClassValue, cn } from "@/lib/utils";
6
+
7
+ /**
8
+ * The class list of a marker for each `variant`. Use it to give another element the look of a marker.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * import { markerVariants } from "@/components/ui/marker";
13
+ *
14
+ * export function Divider() {
15
+ * return <p class={markerVariants({ variant: "separator" })}>Today</p>;
16
+ * }
17
+ * ```
18
+ * @since 1.0.0
19
+ * @see {@link Marker}
20
+ */
21
+ const markerVariants = cva(
22
+ "group/marker flex w-full min-w-0 items-center gap-2 text-sm text-muted-foreground outline-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [a&]:transition-colors [a&]:hover:text-foreground [button&]:transition-colors [button&]:hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 motion-reduce:transition-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-transparent",
23
+ {
24
+ variants: {
25
+ variant: {
26
+ default: "",
27
+ border: "border-b pb-2",
28
+ separator:
29
+ "justify-center gap-3 text-xs before:h-px before:flex-1 before:bg-border after:h-px after:flex-1 after:bg-border",
30
+ },
31
+ },
32
+ defaultVariants: { variant: "default" },
33
+ },
34
+ );
35
+
36
+ /** The props as the implementation sees them. */
37
+ type Loose = VariantProps<typeof markerVariants> & {
38
+ readonly as?: PolymorphicTarget;
39
+ readonly class?: ClassValue;
40
+ readonly [prop: string]: unknown;
41
+ };
42
+
43
+ /**
44
+ * Props of {@link Marker}: every attribute of the chosen element plus `variant`, which is
45
+ * `"default"` (an inline note), `"border"` (a rule under the row) or `"separator"` (a centered label
46
+ * between two lines). The `as` prop picks the element (a `div` by default).
47
+ * @since 1.0.0
48
+ * @see {@link Marker}
49
+ */
50
+ export type MarkerProps<T extends PolymorphicTarget = "div"> = PolymorphicProps<
51
+ "div",
52
+ VariantProps<typeof markerVariants>,
53
+ T
54
+ >;
55
+
56
+ /**
57
+ * An inline note between the messages of a conversation: "Checking the logs...", "Ada joined", a
58
+ * date, or a place the thread can be restored to. It is a row with an optional {@link MarkerIcon} and
59
+ * a {@link MarkerContent}. Render a link or a button with `as` to make the whole row interactive.
60
+ *
61
+ * Keyboard and ARIA: a marker is presentational and has no role of its own, so choose one for its
62
+ * purpose: `role="status"` for work in progress (with a `Spinner` in the icon, so the change is
63
+ * announced). Do not give a labeled separator `role="separator"`: a separator has no name, so its text
64
+ * would not be announced. As a `button` or a link it takes the native keys and shows a focus ring.
65
+ *
66
+ * Compared with shadcn/ui: `as` replaces `render`, `class` replaces `className`, and every part has a `data-slot`.
67
+ *
68
+ * @param props - The marker props: `variant`, `as`, `children` and the attributes of the element.
69
+ * @returns The marker element.
70
+ * @example
71
+ * ```tsx
72
+ * import { Marker, MarkerContent } from "@/components/ui/marker";
73
+ *
74
+ * export function Today() {
75
+ * return (
76
+ * <Marker variant="separator">
77
+ * <MarkerContent>Today</MarkerContent>
78
+ * </Marker>
79
+ * );
80
+ * }
81
+ * ```
82
+ * @since 1.0.0
83
+ * @see {@link MarkerIcon}
84
+ * @see {@link MarkerContent}
85
+ */
86
+ function Marker<T extends PolymorphicTarget = "div">(props: MarkerProps<T>): JSX.Element {
87
+ const [local, rest] = splitProps(props as unknown as Loose, ["as", "class", "variant"]);
88
+ return (
89
+ <Polymorphic
90
+ as={local.as ?? "div"}
91
+ data-slot="marker"
92
+ data-variant={local.variant ?? "default"}
93
+ class={cn(markerVariants({ variant: local.variant }), local.class)}
94
+ {...rest}
95
+ />
96
+ );
97
+ }
98
+
99
+ /**
100
+ * The icon of a marker, before its content. It is decorative: it is hidden from assistive
101
+ * technology, so a marker that shows only an icon needs an `aria-label` or visible text.
102
+ *
103
+ * Keyboard and ARIA: no keys, and `aria-hidden="true"`.
104
+ *
105
+ * @param props - The `span` attributes and `class`.
106
+ * @returns The icon slot.
107
+ * @example
108
+ * ```tsx
109
+ * import { CheckIcon } from "@/components/ui/icons";
110
+ * import { Marker, MarkerContent, MarkerIcon } from "@/components/ui/marker";
111
+ *
112
+ * export function Done() {
113
+ * return (
114
+ * <Marker>
115
+ * <MarkerIcon>
116
+ * <CheckIcon />
117
+ * </MarkerIcon>
118
+ * <MarkerContent>Changes saved</MarkerContent>
119
+ * </Marker>
120
+ * );
121
+ * }
122
+ * ```
123
+ * @since 1.0.0
124
+ * @see {@link Marker}
125
+ */
126
+ function MarkerIcon(props: ComponentProps<"span">): JSX.Element {
127
+ const [local, rest] = splitProps(props, ["class"]);
128
+ return (
129
+ <span
130
+ data-slot="marker-icon"
131
+ aria-hidden="true"
132
+ class={cn("inline-flex shrink-0 items-center", local.class)}
133
+ {...rest}
134
+ />
135
+ );
136
+ }
137
+
138
+ /**
139
+ * The text of a marker. It truncates in a row; in a separator it is the label between the lines. Add the
140
+ * `shimmer` class from `animations.css` to a streaming line.
141
+ *
142
+ * Keyboard and ARIA: no keys and no role. The text is what a screen reader reads.
143
+ *
144
+ * @param props - The `span` attributes and `class`.
145
+ * @returns The content slot.
146
+ * @example
147
+ * ```tsx
148
+ * import { Marker, MarkerContent } from "@/components/ui/marker";
149
+ *
150
+ * export function Thinking() {
151
+ * return (
152
+ * <Marker role="status">
153
+ * <MarkerContent class="shimmer">Checking the logs...</MarkerContent>
154
+ * </Marker>
155
+ * );
156
+ * }
157
+ * ```
158
+ * @since 1.0.0
159
+ * @see {@link Marker}
160
+ */
161
+ function MarkerContent(props: ComponentProps<"span">): JSX.Element {
162
+ const [local, rest] = splitProps(props, ["class"]);
163
+ return (
164
+ <span
165
+ data-slot="marker-content"
166
+ class={cn(
167
+ "min-w-0 truncate group-data-[variant=separator]/marker:overflow-visible",
168
+ local.class,
169
+ )}
170
+ {...rest}
171
+ />
172
+ );
173
+ }
174
+
175
+ export { Marker, MarkerContent, MarkerIcon, markerVariants };
@@ -0,0 +1,4 @@
1
+ {
2
+ "title": "Menubar",
3
+ "description": "A visually persistent menu common in desktop applications that provides quick access to a consistent set of commands."
4
+ }