@blenx-dev/core 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 (172) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/LICENSE +21 -0
  3. package/package.json +49 -0
  4. package/src/DataTable/data-table-column-toggle.tsx +73 -0
  5. package/src/DataTable/data-table-empty.tsx +27 -0
  6. package/src/DataTable/data-table-error.tsx +25 -0
  7. package/src/DataTable/data-table-infinite-loader.tsx +73 -0
  8. package/src/DataTable/data-table-loading.tsx +67 -0
  9. package/src/DataTable/data-table-pagination.tsx +80 -0
  10. package/src/DataTable/data-table-toolbar.tsx +62 -0
  11. package/src/DataTable/data-table.css.ts +420 -0
  12. package/src/DataTable/data-table.tsx +507 -0
  13. package/src/DataTable/index.ts +24 -0
  14. package/src/DataTable/types.ts +169 -0
  15. package/src/DataTable/use-infinite-scroll.ts +67 -0
  16. package/src/components/Accordion/accordion.css.ts +84 -0
  17. package/src/components/Accordion/accordion.tsx +87 -0
  18. package/src/components/Accordion/index.ts +8 -0
  19. package/src/components/Alert/alert.css.ts +29 -0
  20. package/src/components/Alert/alert.tsx +40 -0
  21. package/src/components/Alert/index.ts +1 -0
  22. package/src/components/AlertDialog/alert-dialog.css.ts +62 -0
  23. package/src/components/AlertDialog/alert-dialog.tsx +199 -0
  24. package/src/components/AlertDialog/index.ts +1 -0
  25. package/src/components/AspectRatio/aspect-ratio.css.ts +7 -0
  26. package/src/components/AspectRatio/aspect-ratio.tsx +20 -0
  27. package/src/components/AspectRatio/index.ts +1 -0
  28. package/src/components/Autocomplete/autocomplete.css.ts +167 -0
  29. package/src/components/Autocomplete/autocomplete.tsx +226 -0
  30. package/src/components/Autocomplete/index.ts +1 -0
  31. package/src/components/Avatar/avatar.css.ts +65 -0
  32. package/src/components/Avatar/avatar.tsx +44 -0
  33. package/src/components/Avatar/index.ts +1 -0
  34. package/src/components/Badge/badge.css.ts +180 -0
  35. package/src/components/Badge/badge.tsx +47 -0
  36. package/src/components/Badge/index.ts +1 -0
  37. package/src/components/Box/box.css.ts +5 -0
  38. package/src/components/Box/box.tsx +21 -0
  39. package/src/components/Box/index.ts +1 -0
  40. package/src/components/Breadcrumbs/breadcrumbs.css.ts +72 -0
  41. package/src/components/Breadcrumbs/breadcrumbs.tsx +79 -0
  42. package/src/components/Breadcrumbs/index.ts +9 -0
  43. package/src/components/Button/button.css.ts +200 -0
  44. package/src/components/Button/button.tsx +55 -0
  45. package/src/components/Button/index.ts +1 -0
  46. package/src/components/Calendar/calendar.css.ts +187 -0
  47. package/src/components/Calendar/calendar.tsx +143 -0
  48. package/src/components/Calendar/index.ts +1 -0
  49. package/src/components/Card/card.tsx +32 -0
  50. package/src/components/Card/index.ts +1 -0
  51. package/src/components/Checkbox/checkbox.css.ts +76 -0
  52. package/src/components/Checkbox/checkbox.tsx +94 -0
  53. package/src/components/Checkbox/index.ts +1 -0
  54. package/src/components/CloseButton/close-button.css.ts +11 -0
  55. package/src/components/CloseButton/close-button.tsx +15 -0
  56. package/src/components/CloseButton/index.ts +2 -0
  57. package/src/components/ColorPicker/color-picker.tsx +123 -0
  58. package/src/components/ColorPicker/index.ts +1 -0
  59. package/src/components/ColorSwatch/color-swatch.tsx +21 -0
  60. package/src/components/ColorSwatch/index.ts +1 -0
  61. package/src/components/Combobox/combobox.css.ts +333 -0
  62. package/src/components/Combobox/combobox.tsx +350 -0
  63. package/src/components/Combobox/index.ts +1 -0
  64. package/src/components/Command/command.css.ts +130 -0
  65. package/src/components/Command/command.tsx +413 -0
  66. package/src/components/Command/index.ts +7 -0
  67. package/src/components/Container/container.css.ts +41 -0
  68. package/src/components/Container/container.tsx +25 -0
  69. package/src/components/Container/index.ts +1 -0
  70. package/src/components/CopyButton/copy-button.css.ts +11 -0
  71. package/src/components/CopyButton/copy-button.tsx +45 -0
  72. package/src/components/CopyButton/index.ts +2 -0
  73. package/src/components/DatePicker/date-picker.tsx +75 -0
  74. package/src/components/DatePicker/index.ts +1 -0
  75. package/src/components/Dialog/dialog.css.ts +57 -0
  76. package/src/components/Dialog/dialog.tsx +181 -0
  77. package/src/components/Dialog/index.ts +1 -0
  78. package/src/components/Drawer/drawer.css.ts +404 -0
  79. package/src/components/Drawer/drawer.tsx +573 -0
  80. package/src/components/Drawer/index.ts +1 -0
  81. package/src/components/Field/field.css.ts +35 -0
  82. package/src/components/Field/field.tsx +101 -0
  83. package/src/components/Field/index.ts +1 -0
  84. package/src/components/Grid/grid.css.ts +12 -0
  85. package/src/components/Grid/grid.tsx +32 -0
  86. package/src/components/Grid/index.ts +1 -0
  87. package/src/components/Icon/icon.css.ts +10 -0
  88. package/src/components/Icon/icon.tsx +15 -0
  89. package/src/components/Icon/index.ts +1 -0
  90. package/src/components/IconButton/icon-button.css.ts +6 -0
  91. package/src/components/IconButton/icon-button.tsx +11 -0
  92. package/src/components/IconButton/index.ts +2 -0
  93. package/src/components/Input/index.ts +1 -0
  94. package/src/components/Input/input.css.ts +72 -0
  95. package/src/components/Input/input.tsx +50 -0
  96. package/src/components/InputGroup/index.ts +1 -0
  97. package/src/components/InputGroup/input-group.css.ts +156 -0
  98. package/src/components/InputGroup/input-group.tsx +133 -0
  99. package/src/components/Menu/index.ts +1 -0
  100. package/src/components/Menu/menu.css.ts +121 -0
  101. package/src/components/Menu/menu.tsx +115 -0
  102. package/src/components/OTPField/index.ts +1 -0
  103. package/src/components/OTPField/otp-field.css.ts +54 -0
  104. package/src/components/OTPField/otp-field.tsx +46 -0
  105. package/src/components/Popover/index.ts +1 -0
  106. package/src/components/Popover/popover.css.ts +81 -0
  107. package/src/components/Popover/popover.tsx +113 -0
  108. package/src/components/Progress/index.ts +7 -0
  109. package/src/components/Progress/progress.css.ts +37 -0
  110. package/src/components/Progress/progress.tsx +62 -0
  111. package/src/components/Radio/index.ts +1 -0
  112. package/src/components/Radio/radio.css.ts +72 -0
  113. package/src/components/Radio/radio.tsx +49 -0
  114. package/src/components/ScrollArea/index.ts +1 -0
  115. package/src/components/ScrollArea/scroll-area.css.ts +79 -0
  116. package/src/components/ScrollArea/scroll-area.tsx +96 -0
  117. package/src/components/SegmentedControl/index.ts +1 -0
  118. package/src/components/SegmentedControl/segmented-control.tsx +42 -0
  119. package/src/components/Select/index.ts +1 -0
  120. package/src/components/Select/select.css.ts +182 -0
  121. package/src/components/Select/select.tsx +165 -0
  122. package/src/components/Separator/index.ts +1 -0
  123. package/src/components/Separator/separator.css.ts +59 -0
  124. package/src/components/Separator/separator.tsx +34 -0
  125. package/src/components/Sheet/index.ts +1 -0
  126. package/src/components/Sheet/sheet.css.ts +184 -0
  127. package/src/components/Sheet/sheet.tsx +215 -0
  128. package/src/components/Slider/index.ts +1 -0
  129. package/src/components/Slider/slider.css.ts +81 -0
  130. package/src/components/Slider/slider.tsx +100 -0
  131. package/src/components/Spinner/index.ts +1 -0
  132. package/src/components/Spinner/spinner.css.ts +17 -0
  133. package/src/components/Spinner/spinner.tsx +15 -0
  134. package/src/components/Splitter/index.ts +1 -0
  135. package/src/components/Splitter/splitter.css.ts +69 -0
  136. package/src/components/Splitter/splitter.tsx +521 -0
  137. package/src/components/Stack/index.ts +1 -0
  138. package/src/components/Stack/stack.css.ts +42 -0
  139. package/src/components/Stack/stack.tsx +32 -0
  140. package/src/components/Surface/index.ts +1 -0
  141. package/src/components/Surface/surface.css.ts +40 -0
  142. package/src/components/Surface/surface.tsx +19 -0
  143. package/src/components/Switch/index.ts +1 -0
  144. package/src/components/Switch/switch.css.ts +46 -0
  145. package/src/components/Switch/switch.tsx +25 -0
  146. package/src/components/Table/index.ts +2 -0
  147. package/src/components/Table/table.css.ts +71 -0
  148. package/src/components/Table/table.tsx +117 -0
  149. package/src/components/Tabs/index.ts +1 -0
  150. package/src/components/Tabs/tabs.css.ts +250 -0
  151. package/src/components/Tabs/tabs.tsx +119 -0
  152. package/src/components/Text/index.ts +2 -0
  153. package/src/components/Text/text.css.ts +118 -0
  154. package/src/components/Text/text.tsx +66 -0
  155. package/src/components/Textarea/index.ts +1 -0
  156. package/src/components/Textarea/textarea.css.ts +66 -0
  157. package/src/components/Textarea/textarea.tsx +48 -0
  158. package/src/components/Toggle/index.ts +1 -0
  159. package/src/components/Toggle/toggle.css.ts +91 -0
  160. package/src/components/Toggle/toggle.tsx +44 -0
  161. package/src/components/ToggleGroup/index.ts +1 -0
  162. package/src/components/ToggleGroup/toggle-group.css.ts +77 -0
  163. package/src/components/ToggleGroup/toggle-group.tsx +131 -0
  164. package/src/components/index.ts +54 -0
  165. package/src/index.ts +3 -0
  166. package/src/utils/drawer-styles.css.ts +85 -0
  167. package/src/utils/heights.ts +16 -0
  168. package/src/utils/sprinkles.css.ts +197 -0
  169. package/src/utils/sprinkles.tokens.ts +74 -0
  170. package/src/utils/types.ts +10 -0
  171. package/src/utils/ve-style.utils.ts +51 -0
  172. package/tsconfig.json +10 -0
@@ -0,0 +1,573 @@
1
+ "use client";
2
+
3
+ import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
4
+ import { Drawer as DrawerPrimitive } from "@base-ui/react/drawer";
5
+ import { Radio as RadioPrimitive } from "@base-ui/react/radio";
6
+ import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group";
7
+ import { useRender } from "@base-ui/react/use-render";
8
+ import { ArrowRightIcon } from "@phosphor-icons/react";
9
+ import clsx from "clsx";
10
+ import type React from "react";
11
+ import { createContext, useContext, useMemo } from "react";
12
+ import { ScrollArea } from "../ScrollArea/scroll-area";
13
+ import {
14
+ swipeArea,
15
+ swipeAreaBottom,
16
+ swipeAreaTop,
17
+ swipeAreaLeft,
18
+ swipeAreaRight,
19
+ backdrop,
20
+ viewport,
21
+ viewportBottom,
22
+ viewportTop,
23
+ viewportLeft,
24
+ viewportRight,
25
+ viewportInset,
26
+ popup,
27
+ popupDefault,
28
+ popupStraight,
29
+ popupInset,
30
+ popupBottom,
31
+ popupTop,
32
+ popupLeft,
33
+ popupRight,
34
+ header,
35
+ footer,
36
+ footerDefault,
37
+ footerBare,
38
+ title,
39
+ description,
40
+ panel,
41
+ bar,
42
+ barHorizontal,
43
+ barVertical,
44
+ barTop,
45
+ barBottom,
46
+ barLeft,
47
+ barRight,
48
+ menu,
49
+ menuItem,
50
+ menuItemDestructive,
51
+ separator,
52
+ menuGroup,
53
+ menuGroupLabel,
54
+ menuTrigger,
55
+ menuTriggerIcon,
56
+ menuCheckbox,
57
+ menuCheckboxDefault,
58
+ menuCheckboxSwitch,
59
+ menuCheckboxSwitchLabel,
60
+ menuCheckboxSwitchIndicator,
61
+ menuCheckboxSwitchThumb,
62
+ menuCheckboxIndicator,
63
+ menuCheckboxLabel,
64
+ menuRadio,
65
+ menuRadioIndicator,
66
+ menuRadioLabel,
67
+ } from "./drawer.css";
68
+ import { CloseButton } from "../CloseButton";
69
+ import type { _BaseDivProps } from "../../utils/types";
70
+ import { Box } from "../Box";
71
+
72
+ type DrawerPosition = "right" | "left" | "top" | "bottom";
73
+
74
+ const DrawerContext: React.Context<{ position: DrawerPosition }> = createContext<{
75
+ position: DrawerPosition;
76
+ }>({
77
+ position: "bottom",
78
+ });
79
+
80
+ const directionMap: Record<DrawerPosition, DrawerPrimitive.Root.Props["swipeDirection"]> = {
81
+ bottom: "down",
82
+ left: "left",
83
+ right: "right",
84
+ top: "up",
85
+ };
86
+
87
+ export const DrawerCreateHandle: typeof DrawerPrimitive.createHandle = DrawerPrimitive.createHandle;
88
+
89
+ export function Drawer({
90
+ swipeDirection,
91
+ position = "bottom",
92
+ ...props
93
+ }: DrawerPrimitive.Root.Props & {
94
+ position?: DrawerPosition;
95
+ }): React.ReactElement {
96
+ const contextValue = useMemo(() => ({ position }), [position]);
97
+ return (
98
+ <DrawerContext.Provider value={contextValue}>
99
+ <DrawerPrimitive.Root swipeDirection={swipeDirection ?? directionMap[position]} {...props} />
100
+ </DrawerContext.Provider>
101
+ );
102
+ }
103
+
104
+ export const DrawerPortal: typeof DrawerPrimitive.Portal = DrawerPrimitive.Portal;
105
+
106
+ export function DrawerTrigger(props: DrawerPrimitive.Trigger.Props): React.ReactElement {
107
+ return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />;
108
+ }
109
+
110
+ export function DrawerClose(props: DrawerPrimitive.Close.Props): React.ReactElement {
111
+ return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />;
112
+ }
113
+
114
+ export function DrawerSwipeArea({
115
+ className,
116
+ position: positionProp,
117
+ ...props
118
+ }: DrawerPrimitive.SwipeArea.Props & {
119
+ position?: DrawerPosition;
120
+ }): React.ReactElement {
121
+ const { position: contextPosition } = useContext(DrawerContext);
122
+ const resolvedPosition = positionProp ?? contextPosition;
123
+
124
+ return (
125
+ <DrawerPrimitive.SwipeArea
126
+ className={clsx(
127
+ swipeArea,
128
+ resolvedPosition === "bottom" && swipeAreaBottom,
129
+ resolvedPosition === "top" && swipeAreaTop,
130
+ resolvedPosition === "left" && swipeAreaLeft,
131
+ resolvedPosition === "right" && swipeAreaRight,
132
+ className,
133
+ )}
134
+ data-slot="drawer-swipe-area"
135
+ {...props}
136
+ />
137
+ );
138
+ }
139
+
140
+ export function DrawerBackdrop({
141
+ className,
142
+ ...props
143
+ }: DrawerPrimitive.Backdrop.Props): React.ReactElement {
144
+ return (
145
+ <DrawerPrimitive.Backdrop
146
+ className={clsx(backdrop, className)}
147
+ data-slot="drawer-backdrop"
148
+ {...props}
149
+ />
150
+ );
151
+ }
152
+
153
+ export function DrawerViewport({
154
+ className,
155
+ position: positionProp,
156
+ variant = "default",
157
+ ...props
158
+ }: DrawerPrimitive.Viewport.Props & {
159
+ position?: DrawerPosition;
160
+ variant?: "default" | "straight" | "inset";
161
+ }): React.ReactElement {
162
+ const { position: contextPosition } = useContext(DrawerContext);
163
+ const resolvedPosition = positionProp ?? contextPosition;
164
+
165
+ return (
166
+ <DrawerPrimitive.Viewport
167
+ className={clsx(
168
+ viewport,
169
+ resolvedPosition === "bottom" && viewportBottom,
170
+ resolvedPosition === "top" && viewportTop,
171
+ resolvedPosition === "left" && viewportLeft,
172
+ resolvedPosition === "right" && viewportRight,
173
+ variant === "inset" && viewportInset,
174
+ className,
175
+ )}
176
+ data-slot="drawer-viewport"
177
+ {...props}
178
+ />
179
+ );
180
+ }
181
+
182
+ export function DrawerPopup({
183
+ children,
184
+ showCloseButton = false,
185
+ position: positionProp,
186
+ variant = "default",
187
+ showBar = false,
188
+ portalProps,
189
+ className,
190
+ ...props
191
+ }: DrawerPrimitive.Popup.Props & {
192
+ showCloseButton?: boolean;
193
+ position?: DrawerPosition;
194
+ variant?: "default" | "straight" | "inset";
195
+ showBar?: boolean;
196
+ portalProps?: DrawerPrimitive.Portal.Props;
197
+ }): React.ReactElement {
198
+ const { position: contextPosition } = useContext(DrawerContext);
199
+ const resolvedPosition = positionProp ?? contextPosition;
200
+
201
+ return (
202
+ <DrawerPortal {...portalProps}>
203
+ <DrawerBackdrop />
204
+ <DrawerViewport position={resolvedPosition} variant={variant}>
205
+ <DrawerPrimitive.Popup
206
+ className={clsx(
207
+ popup,
208
+ resolvedPosition === "bottom" && popupBottom,
209
+ resolvedPosition === "top" && popupTop,
210
+ resolvedPosition === "left" && popupLeft,
211
+ resolvedPosition === "right" && popupRight,
212
+ variant === "default" && popupDefault,
213
+ variant === "straight" && popupStraight,
214
+ variant === "inset" && popupInset,
215
+ className,
216
+ )}
217
+ data-slot="drawer-popup"
218
+ {...props}
219
+ >
220
+ {showCloseButton && (
221
+ <Box position="absolute" top="xs" right="xs">
222
+ <DrawerPrimitive.Close aria-label="Close" render={<CloseButton variant="ghost" />} />
223
+ </Box>
224
+ )}
225
+ {children}
226
+ {showBar && <DrawerBar />}
227
+ </DrawerPrimitive.Popup>
228
+ </DrawerViewport>
229
+ </DrawerPortal>
230
+ );
231
+ }
232
+
233
+ export function DrawerHeader({
234
+ className,
235
+ allowSelection = false,
236
+ render,
237
+ ...props
238
+ }: _BaseDivProps & {
239
+ allowSelection?: boolean;
240
+ }): React.ReactElement {
241
+ return useRender({
242
+ defaultTagName: "div",
243
+ props: {
244
+ className: clsx(header, className),
245
+ "data-slot": "drawer-header",
246
+ ...props,
247
+ } as never,
248
+ render: allowSelection ? <DrawerContent render={render} /> : render,
249
+ });
250
+ }
251
+
252
+ export function DrawerFooter({
253
+ className,
254
+ variant = "default",
255
+ allowSelection = true,
256
+ render,
257
+ ...props
258
+ }: _BaseDivProps & {
259
+ variant?: "default" | "bare";
260
+ allowSelection?: boolean;
261
+ }): React.ReactElement {
262
+ return useRender({
263
+ defaultTagName: "div",
264
+ props: {
265
+ className: clsx(
266
+ footer,
267
+ variant === "default" && footerDefault,
268
+ variant === "bare" && footerBare,
269
+ className,
270
+ ),
271
+ "data-slot": "drawer-footer",
272
+ ...props,
273
+ } as never,
274
+ render: allowSelection ? <DrawerContent render={render} /> : render,
275
+ });
276
+ }
277
+
278
+ export function DrawerTitle(props: DrawerPrimitive.Title.Props): React.ReactElement {
279
+ return <DrawerPrimitive.Title className={title} data-slot="drawer-title" {...props} />;
280
+ }
281
+
282
+ export function DrawerDescription(props: DrawerPrimitive.Description.Props): React.ReactElement {
283
+ return (
284
+ <DrawerPrimitive.Description
285
+ className={description}
286
+ data-slot="drawer-description"
287
+ {...props}
288
+ />
289
+ );
290
+ }
291
+
292
+ export function DrawerPanel({
293
+ scrollFade = true,
294
+ scrollable = true,
295
+ allowSelection = true,
296
+ render,
297
+ className,
298
+ ...props
299
+ }: _BaseDivProps & {
300
+ scrollFade?: boolean;
301
+ scrollable?: boolean;
302
+ allowSelection?: boolean;
303
+ }): React.ReactElement {
304
+ const content = useRender({
305
+ defaultTagName: "div",
306
+ props: {
307
+ className: clsx(panel, className),
308
+ "data-slot": "drawer-panel",
309
+ ...props,
310
+ } as never,
311
+ render: allowSelection ? <DrawerContent render={render} /> : render,
312
+ });
313
+
314
+ if (scrollable) {
315
+ return <ScrollArea scrollFade={scrollFade}>{content}</ScrollArea>;
316
+ }
317
+
318
+ return content;
319
+ }
320
+
321
+ export function DrawerBar({
322
+ className,
323
+ position: positionProp,
324
+ render,
325
+ ...props
326
+ }: _BaseDivProps & {
327
+ position?: DrawerPosition;
328
+ }): React.ReactElement {
329
+ const { position: contextPosition } = useContext(DrawerContext);
330
+ const resolvedPosition = positionProp ?? contextPosition;
331
+ const isHorizontal = resolvedPosition === "left" || resolvedPosition === "right";
332
+
333
+ return useRender({
334
+ defaultTagName: "div",
335
+ props: {
336
+ className: clsx(
337
+ bar,
338
+ isHorizontal && barHorizontal,
339
+ !isHorizontal && barVertical,
340
+ resolvedPosition === "top" && barTop,
341
+ resolvedPosition === "bottom" && barBottom,
342
+ resolvedPosition === "left" && barLeft,
343
+ resolvedPosition === "right" && barRight,
344
+ className,
345
+ ),
346
+ "aria-hidden": true,
347
+ "data-slot": "drawer-bar",
348
+ ...props,
349
+ } as never,
350
+ render,
351
+ });
352
+ }
353
+
354
+ export const DrawerContent: typeof DrawerPrimitive.Content = DrawerPrimitive.Content;
355
+
356
+ export function DrawerMenu({ className, render, ...props }: _BaseDivProps): React.ReactElement {
357
+ return useRender({
358
+ defaultTagName: "nav",
359
+ props: {
360
+ className: clsx(menu, className),
361
+ "data-slot": "drawer-menu",
362
+ ...props,
363
+ } as never,
364
+ render,
365
+ });
366
+ }
367
+
368
+ export function DrawerMenuItem({
369
+ className,
370
+ variant = "default",
371
+ render,
372
+ disabled,
373
+ ...props
374
+ }: _BaseDivProps & {
375
+ variant?: "default" | "destructive";
376
+ disabled?: boolean;
377
+ }): React.ReactElement {
378
+ return useRender({
379
+ defaultTagName: "button",
380
+ props: {
381
+ className: clsx(menuItem, variant === "destructive" && menuItemDestructive, className),
382
+ "data-slot": "drawer-menu-item",
383
+ "data-variant": variant,
384
+ disabled,
385
+ type: "button" as const,
386
+ ...props,
387
+ } as never,
388
+ render,
389
+ });
390
+ }
391
+
392
+ export function DrawerMenuSeparator({
393
+ className,
394
+ render,
395
+ ...props
396
+ }: _BaseDivProps): React.ReactElement {
397
+ return useRender({
398
+ defaultTagName: "div",
399
+ props: {
400
+ className: clsx(separator, className),
401
+ "data-slot": "drawer-menu-separator",
402
+ ...props,
403
+ } as never,
404
+ render,
405
+ });
406
+ }
407
+
408
+ export function DrawerMenuGroup({
409
+ className,
410
+ render,
411
+ ...props
412
+ }: _BaseDivProps): React.ReactElement {
413
+ return useRender({
414
+ defaultTagName: "div",
415
+ props: {
416
+ className: clsx(menuGroup, className),
417
+ "data-slot": "drawer-menu-group",
418
+ ...props,
419
+ } as never,
420
+ render,
421
+ });
422
+ }
423
+
424
+ export function DrawerMenuGroupLabel({
425
+ className,
426
+ render,
427
+ ...props
428
+ }: _BaseDivProps): React.ReactElement {
429
+ return useRender({
430
+ defaultTagName: "div",
431
+ props: {
432
+ className: clsx(menuGroupLabel, className),
433
+ "data-slot": "drawer-menu-group-label",
434
+ ...props,
435
+ } as never,
436
+ render,
437
+ });
438
+ }
439
+
440
+ export function DrawerMenuTrigger({
441
+ className,
442
+ children,
443
+ ...props
444
+ }: DrawerPrimitive.Trigger.Props): React.ReactElement {
445
+ return (
446
+ <DrawerTrigger
447
+ className={clsx(menuTrigger, className)}
448
+ data-slot="drawer-menu-trigger"
449
+ {...props}
450
+ >
451
+ {children}
452
+ <ArrowRightIcon className={menuTriggerIcon} />
453
+ </DrawerTrigger>
454
+ );
455
+ }
456
+
457
+ export function DrawerMenuCheckboxItem({
458
+ className,
459
+ children,
460
+ checked,
461
+ defaultChecked,
462
+ onCheckedChange,
463
+ variant = "default",
464
+ disabled,
465
+ render,
466
+ ...props
467
+ }: CheckboxPrimitive.Root.Props & {
468
+ variant?: "default" | "switch";
469
+ render?: React.ReactElement;
470
+ }): React.ReactElement {
471
+ return (
472
+ <CheckboxPrimitive.Root
473
+ checked={checked}
474
+ className={clsx(
475
+ menuCheckbox,
476
+ variant === "switch" && menuCheckboxSwitch,
477
+ variant !== "switch" && menuCheckboxDefault,
478
+ className,
479
+ )}
480
+ data-slot="drawer-menu-checkbox-item"
481
+ defaultChecked={defaultChecked}
482
+ disabled={disabled}
483
+ onCheckedChange={onCheckedChange}
484
+ render={render}
485
+ {...props}
486
+ >
487
+ {variant === "switch" ? (
488
+ <>
489
+ <span className={menuCheckboxSwitchLabel}>{children}</span>
490
+ <CheckboxPrimitive.Indicator className={menuCheckboxSwitchIndicator} keepMounted>
491
+ <span className={menuCheckboxSwitchThumb} />
492
+ </CheckboxPrimitive.Indicator>
493
+ </>
494
+ ) : (
495
+ <>
496
+ <CheckboxPrimitive.Indicator className={menuCheckboxIndicator}>
497
+ <svg
498
+ fill="none"
499
+ height="24"
500
+ stroke="currentColor"
501
+ strokeLinecap="round"
502
+ strokeLinejoin="round"
503
+ strokeWidth="2"
504
+ viewBox="0 0 24 24"
505
+ width="24"
506
+ xmlns="http://www.w3.org/2000/svg"
507
+ >
508
+ <title>fd</title>
509
+ <path d="M5.252 12.7 10.2 18.63 18.748 5.37" />
510
+ </svg>
511
+ </CheckboxPrimitive.Indicator>
512
+ <span className={menuCheckboxLabel}>{children}</span>
513
+ </>
514
+ )}
515
+ </CheckboxPrimitive.Root>
516
+ );
517
+ }
518
+
519
+ export function DrawerMenuRadioGroup({
520
+ className,
521
+ ...props
522
+ }: RadioGroupPrimitive.Props): React.ReactElement {
523
+ return (
524
+ <RadioGroupPrimitive
525
+ className={clsx(menuGroup, className)}
526
+ data-slot="drawer-menu-radio-group"
527
+ {...props}
528
+ />
529
+ );
530
+ }
531
+
532
+ function DrawerMenuRadioItem({
533
+ className,
534
+ children,
535
+ value,
536
+ disabled,
537
+ render,
538
+ ...props
539
+ }: RadioPrimitive.Root.Props & {
540
+ value: string;
541
+ render?: React.ReactElement;
542
+ }): React.ReactElement {
543
+ return (
544
+ <RadioPrimitive.Root
545
+ className={clsx(menuRadio, className)}
546
+ data-slot="drawer-menu-radio-item"
547
+ disabled={disabled}
548
+ render={render}
549
+ value={value}
550
+ {...props}
551
+ >
552
+ <RadioPrimitive.Indicator className={menuRadioIndicator}>
553
+ <svg
554
+ fill="none"
555
+ height="24"
556
+ stroke="currentColor"
557
+ strokeLinecap="round"
558
+ strokeLinejoin="round"
559
+ strokeWidth="2"
560
+ viewBox="0 0 24 24"
561
+ width="24"
562
+ xmlns="http://www.w3.org/2000/svg"
563
+ >
564
+ <title>fd</title>
565
+ <path d="M5.252 12.7 10.2 18.63 18.748 5.37" />
566
+ </svg>
567
+ </RadioPrimitive.Indicator>
568
+ <span className={menuRadioLabel}>{children}</span>
569
+ </RadioPrimitive.Root>
570
+ );
571
+ }
572
+
573
+ export { DrawerMenuRadioItem };
@@ -0,0 +1 @@
1
+ export * from "./drawer";
@@ -0,0 +1,35 @@
1
+ import { style } from "@vanilla-extract/css";
2
+ import { semanticVars, tokenVars } from "@blenx-dev/theme/contract";
3
+
4
+ export const field = style({
5
+ display: "flex",
6
+ flexDirection: "column",
7
+ alignItems: "flex-start",
8
+ gap: "8px",
9
+ flex: 1,
10
+ });
11
+
12
+ export const label = style({
13
+ display: "inline-flex",
14
+ alignItems: "center",
15
+ fontWeight: 400,
16
+ fontSize: tokenVars.fontSize.md,
17
+ color: "inherit",
18
+ });
19
+
20
+ export const item = style({
21
+ display: "flex",
22
+ flex: 1,
23
+ });
24
+
25
+ export const description = style({
26
+ fontSize: "12px",
27
+ lineHeight: 1.4,
28
+ color: semanticVars.text.secondary,
29
+ });
30
+
31
+ export const error = style({
32
+ fontSize: "12px",
33
+ lineHeight: 1.4,
34
+ color: semanticVars.status.danger.default,
35
+ });
@@ -0,0 +1,101 @@
1
+ "use client";
2
+
3
+ import { Field as FieldPrimitive } from "@base-ui/react/field";
4
+ import clsx from "clsx";
5
+ import type React from "react";
6
+ import { field, label, item, description, error } from "./field.css";
7
+
8
+ export function Field({
9
+ className,
10
+ style,
11
+ ...props
12
+ }: FieldPrimitive.Root.Props & {
13
+ className?: string;
14
+ style?: React.CSSProperties;
15
+ }): React.ReactElement {
16
+ return (
17
+ <FieldPrimitive.Root
18
+ className={clsx(field, className)}
19
+ style={style}
20
+ data-slot="field"
21
+ {...props}
22
+ />
23
+ );
24
+ }
25
+
26
+ export function FieldLabel({
27
+ className,
28
+ style,
29
+ ...props
30
+ }: FieldPrimitive.Label.Props & {
31
+ className?: string;
32
+ style?: React.CSSProperties;
33
+ }): React.ReactElement {
34
+ return (
35
+ <FieldPrimitive.Label
36
+ className={clsx(label, className)}
37
+ style={style}
38
+ data-slot="field-label"
39
+ {...props}
40
+ />
41
+ );
42
+ }
43
+
44
+ export function FieldItem({
45
+ className,
46
+ style,
47
+ ...props
48
+ }: FieldPrimitive.Item.Props & {
49
+ className?: string;
50
+ style?: React.CSSProperties;
51
+ }): React.ReactElement {
52
+ return (
53
+ <FieldPrimitive.Item
54
+ className={clsx(item, className)}
55
+ style={style}
56
+ data-slot="field-item"
57
+ {...props}
58
+ />
59
+ );
60
+ }
61
+
62
+ export function FieldDescription({
63
+ className,
64
+ style,
65
+ ...props
66
+ }: FieldPrimitive.Description.Props & {
67
+ className?: string;
68
+ style?: React.CSSProperties;
69
+ }): React.ReactElement {
70
+ return (
71
+ <FieldPrimitive.Description
72
+ className={clsx(description, className)}
73
+ style={style}
74
+ data-slot="field-description"
75
+ {...props}
76
+ />
77
+ );
78
+ }
79
+
80
+ function FieldError({
81
+ className,
82
+ style,
83
+ ...props
84
+ }: FieldPrimitive.Error.Props & {
85
+ className?: string;
86
+ style?: React.CSSProperties;
87
+ }): React.ReactElement {
88
+ return (
89
+ <FieldPrimitive.Error
90
+ className={clsx(error, className)}
91
+ style={style}
92
+ data-slot="field-error"
93
+ {...props}
94
+ />
95
+ );
96
+ }
97
+
98
+ export const FieldControl: typeof FieldPrimitive.Control = FieldPrimitive.Control;
99
+ export const FieldValidity: typeof FieldPrimitive.Validity = FieldPrimitive.Validity;
100
+
101
+ export { FieldError };
@@ -0,0 +1 @@
1
+ export * from "./field";