@shadow-js/ui 0.0.0-stage → 1.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 (190) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/LICENSE +21 -0
  3. package/README.md +598 -2
  4. package/dist/cli.mjs +2293 -0
  5. package/dist/dev/cli/schema.d.ts +73 -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 +141 -0
  9. package/dist/dev/locales/ar.js +128 -0
  10. package/dist/dev/locales/ar.js.map +1 -0
  11. package/dist/dev/locales/en.d.ts +141 -0
  12. package/dist/dev/locales/en.js +128 -0
  13. package/dist/dev/locales/en.js.map +1 -0
  14. package/dist/dev/registry/utils/utils.d.ts +29 -0
  15. package/dist/dev/registry/utils/utils.js +27 -0
  16. package/dist/dev/registry/utils/utils.js.map +1 -0
  17. package/dist/dev/theme/theme-logic.d.ts +187 -0
  18. package/dist/dev/theme/theme-logic.js +184 -0
  19. package/dist/dev/theme/theme-logic.js.map +1 -0
  20. package/dist/dev/theme/theme-provider.d.ts +90 -0
  21. package/dist/dev/theme/theme-provider.js +150 -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,311 @@
1
+ import { splitProps } from "@shadow-js/core";
2
+ import type { ComponentProps, JSX } from "@shadow-js/web";
3
+ import { cn } from "@/lib/utils";
4
+
5
+ /**
6
+ * Props of {@link Card}: the `div` attributes, and `size` (`"default"` or `"sm"`).
7
+ * @since 1.0.0
8
+ * @see {@link Card}
9
+ */
10
+ export type CardProps = ComponentProps<"div"> & {
11
+ /** `"sm"` tightens the gap, the vertical padding and the side padding of the parts. */
12
+ readonly size?: "default" | "sm" | undefined;
13
+ };
14
+
15
+ /**
16
+ * A surface that groups related content, with a border, rounded corners and a shadow. Compose it
17
+ * from {@link CardHeader} (with {@link CardTitle}, {@link CardDescription} and an optional
18
+ * {@link CardAction}), {@link CardContent} and {@link CardFooter}.
19
+ *
20
+ * Keyboard and ARIA: the card is a plain `div` with no role and no keys. When it is a region of its
21
+ * own, give it `role="region"` and an `aria-labelledby` that points at the {@link CardTitle}.
22
+ *
23
+ * Compared with shadcn/ui: `class` replaces `className`, and every part carries a `data-slot`.
24
+ *
25
+ * @param props - The card props: `size` (`"default"` or `"sm"`, which tightens the gap and padding),
26
+ * `children`, `class`, and the `div` attributes.
27
+ * @returns The card element.
28
+ * @example
29
+ * ```tsx
30
+ * import {
31
+ * Card,
32
+ * CardContent,
33
+ * CardDescription,
34
+ * CardHeader,
35
+ * CardTitle,
36
+ * } from "@/components/ui/card";
37
+ *
38
+ * export function Notifications() {
39
+ * return (
40
+ * <Card>
41
+ * <CardHeader>
42
+ * <CardTitle>Notifications</CardTitle>
43
+ * <CardDescription>You have 3 unread messages.</CardDescription>
44
+ * </CardHeader>
45
+ * <CardContent>Your latest messages appear here.</CardContent>
46
+ * </Card>
47
+ * );
48
+ * }
49
+ * ```
50
+ * @since 1.0.0
51
+ * @see {@link CardHeader}
52
+ * @see {@link CardContent}
53
+ * @see {@link CardFooter}
54
+ */
55
+ function Card(props: CardProps): JSX.Element {
56
+ const [local, rest] = splitProps(props, ["class", "children", "size"]);
57
+ return (
58
+ <div
59
+ data-slot="card"
60
+ data-size={local.size ?? "default"}
61
+ class={cn(
62
+ "flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm [--card-padding-x:1.5rem] data-[size=sm]:gap-4 data-[size=sm]:py-4 data-[size=sm]:[--card-padding-x:1rem]",
63
+ local.class,
64
+ )}
65
+ {...rest}
66
+ >
67
+ {local.children}
68
+ </div>
69
+ );
70
+ }
71
+
72
+ /**
73
+ * The top of a card: the title and description, with an optional {@link CardAction} in the
74
+ * corner. When a card action is inside, the title takes the first column and the action the second.
75
+ *
76
+ * @param props - The header props: `children`, `class`, and the `div` attributes.
77
+ * @returns The header element.
78
+ * @example
79
+ * ```tsx
80
+ * import { Card, CardAction, CardHeader, CardTitle } from "@/components/ui/card";
81
+ * import { Button } from "@/components/ui/button";
82
+ *
83
+ * export function ProjectHeader() {
84
+ * return (
85
+ * <Card>
86
+ * <CardHeader>
87
+ * <CardTitle>Create project</CardTitle>
88
+ * <CardAction>
89
+ * <Button size="sm">Edit</Button>
90
+ * </CardAction>
91
+ * </CardHeader>
92
+ * </Card>
93
+ * );
94
+ * }
95
+ * ```
96
+ * @since 1.0.0
97
+ * @see {@link Card}
98
+ * @see {@link CardTitle}
99
+ */
100
+ function CardHeader(props: ComponentProps<"div">): JSX.Element {
101
+ const [local, rest] = splitProps(props, ["class", "children"]);
102
+ return (
103
+ <div
104
+ data-slot="card-header"
105
+ class={cn(
106
+ "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-[var(--card-padding-x,1.5rem)] has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
107
+ local.class,
108
+ )}
109
+ {...rest}
110
+ >
111
+ {local.children}
112
+ </div>
113
+ );
114
+ }
115
+
116
+ /**
117
+ * The title of a card: a semibold line. It renders a `div`, so it has no heading role. Pass
118
+ * `role="heading"` and `aria-level` when the title should be a heading in the page outline.
119
+ *
120
+ * @param props - The title props: `children`, `class`, and the `div` attributes.
121
+ * @returns The title element.
122
+ * @example
123
+ * ```tsx
124
+ * import { Card, CardHeader, CardTitle } from "@/components/ui/card";
125
+ *
126
+ * export function Titled() {
127
+ * return (
128
+ * <Card>
129
+ * <CardHeader>
130
+ * <CardTitle role="heading" aria-level={2}>
131
+ * Create project
132
+ * </CardTitle>
133
+ * </CardHeader>
134
+ * </Card>
135
+ * );
136
+ * }
137
+ * ```
138
+ * @since 1.0.0
139
+ * @see {@link CardHeader}
140
+ * @see {@link CardDescription}
141
+ */
142
+ function CardTitle(props: ComponentProps<"div">): JSX.Element {
143
+ const [local, rest] = splitProps(props, ["class", "children"]);
144
+ return (
145
+ <div data-slot="card-title" class={cn("leading-none font-semibold", local.class)} {...rest}>
146
+ {local.children}
147
+ </div>
148
+ );
149
+ }
150
+
151
+ /**
152
+ * The muted description under the title. It renders a `div` with the muted text color.
153
+ *
154
+ * @param props - The description props: `children`, `class`, and the `div` attributes.
155
+ * @returns The description element.
156
+ * @example
157
+ * ```tsx
158
+ * import {
159
+ * Card,
160
+ * CardDescription,
161
+ * CardHeader,
162
+ * CardTitle,
163
+ * } from "@/components/ui/card";
164
+ *
165
+ * export function DeployCard() {
166
+ * return (
167
+ * <Card>
168
+ * <CardHeader>
169
+ * <CardTitle>Deploy</CardTitle>
170
+ * <CardDescription>Deploy your new project in one click.</CardDescription>
171
+ * </CardHeader>
172
+ * </Card>
173
+ * );
174
+ * }
175
+ * ```
176
+ * @since 1.0.0
177
+ * @see {@link CardHeader}
178
+ * @see {@link CardTitle}
179
+ */
180
+ function CardDescription(props: ComponentProps<"div">): JSX.Element {
181
+ const [local, rest] = splitProps(props, ["class", "children"]);
182
+ return (
183
+ <div
184
+ data-slot="card-description"
185
+ class={cn("text-sm text-muted-foreground", local.class)}
186
+ {...rest}
187
+ >
188
+ {local.children}
189
+ </div>
190
+ );
191
+ }
192
+
193
+ /**
194
+ * An action, such as a button or a menu, placed at the end of the header beside the title. The
195
+ * {@link CardHeader} makes room for it when it is present.
196
+ *
197
+ * @param props - The action props: `children`, `class`, and the `div` attributes.
198
+ * @returns The action element.
199
+ * @example
200
+ * ```tsx
201
+ * import { Card, CardAction, CardHeader, CardTitle } from "@/components/ui/card";
202
+ * import { Button } from "@/components/ui/button";
203
+ *
204
+ * export function EditableCard() {
205
+ * return (
206
+ * <Card>
207
+ * <CardHeader>
208
+ * <CardTitle>Profile</CardTitle>
209
+ * <CardAction>
210
+ * <Button size="sm" variant="outline">Edit</Button>
211
+ * </CardAction>
212
+ * </CardHeader>
213
+ * </Card>
214
+ * );
215
+ * }
216
+ * ```
217
+ * @since 1.0.0
218
+ * @see {@link CardHeader}
219
+ */
220
+ function CardAction(props: ComponentProps<"div">): JSX.Element {
221
+ const [local, rest] = splitProps(props, ["class", "children"]);
222
+ return (
223
+ <div
224
+ data-slot="card-action"
225
+ class={cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", local.class)}
226
+ {...rest}
227
+ >
228
+ {local.children}
229
+ </div>
230
+ );
231
+ }
232
+
233
+ /**
234
+ * The main content of a card, with horizontal padding.
235
+ *
236
+ * @param props - The content props: `children`, `class`, and the `div` attributes.
237
+ * @returns The content element.
238
+ * @example
239
+ * ```tsx
240
+ * import { Card, CardContent } from "@/components/ui/card";
241
+ *
242
+ * export function Body() {
243
+ * return (
244
+ * <Card>
245
+ * <CardContent>
246
+ * <p>Your latest messages appear here.</p>
247
+ * </CardContent>
248
+ * </Card>
249
+ * );
250
+ * }
251
+ * ```
252
+ * @since 1.0.0
253
+ * @see {@link Card}
254
+ * @see {@link CardFooter}
255
+ */
256
+ function CardContent(props: ComponentProps<"div">): JSX.Element {
257
+ const [local, rest] = splitProps(props, ["class", "children"]);
258
+ return (
259
+ <div
260
+ data-slot="card-content"
261
+ class={cn("px-[var(--card-padding-x,1.5rem)]", local.class)}
262
+ {...rest}
263
+ >
264
+ {local.children}
265
+ </div>
266
+ );
267
+ }
268
+
269
+ /**
270
+ * The bottom of a card, usually one or more buttons in a row. It is a flex row, centered
271
+ * vertically.
272
+ *
273
+ * @param props - The footer props: `children`, `class`, and the `div` attributes.
274
+ * @returns The footer element.
275
+ * @example
276
+ * ```tsx
277
+ * import { Button } from "@/components/ui/button";
278
+ * import { Card, CardContent, CardFooter } from "@/components/ui/card";
279
+ *
280
+ * export function SaveCard() {
281
+ * return (
282
+ * <Card>
283
+ * <CardContent>Unsaved changes.</CardContent>
284
+ * <CardFooter>
285
+ * <Button>Save</Button>
286
+ * </CardFooter>
287
+ * </Card>
288
+ * );
289
+ * }
290
+ * ```
291
+ * @since 1.0.0
292
+ * @see {@link Card}
293
+ * @see {@link CardContent}
294
+ */
295
+ function CardFooter(props: ComponentProps<"div">): JSX.Element {
296
+ const [local, rest] = splitProps(props, ["class", "children"]);
297
+ return (
298
+ <div
299
+ data-slot="card-footer"
300
+ class={cn(
301
+ "flex items-center px-[var(--card-padding-x,1.5rem)] [.border-t]:pt-6",
302
+ local.class,
303
+ )}
304
+ {...rest}
305
+ >
306
+ {local.children}
307
+ </div>
308
+ );
309
+ }
310
+
311
+ export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
@@ -0,0 +1,4 @@
1
+ {
2
+ "title": "Card",
3
+ "description": "Displays a card with header, content, and footer."
4
+ }