@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.
- package/CHANGELOG.md +77 -0
- package/LICENSE +21 -0
- package/package.json +49 -0
- package/src/DataTable/data-table-column-toggle.tsx +73 -0
- package/src/DataTable/data-table-empty.tsx +27 -0
- package/src/DataTable/data-table-error.tsx +25 -0
- package/src/DataTable/data-table-infinite-loader.tsx +73 -0
- package/src/DataTable/data-table-loading.tsx +67 -0
- package/src/DataTable/data-table-pagination.tsx +80 -0
- package/src/DataTable/data-table-toolbar.tsx +62 -0
- package/src/DataTable/data-table.css.ts +420 -0
- package/src/DataTable/data-table.tsx +507 -0
- package/src/DataTable/index.ts +24 -0
- package/src/DataTable/types.ts +169 -0
- package/src/DataTable/use-infinite-scroll.ts +67 -0
- package/src/components/Accordion/accordion.css.ts +84 -0
- package/src/components/Accordion/accordion.tsx +87 -0
- package/src/components/Accordion/index.ts +8 -0
- package/src/components/Alert/alert.css.ts +29 -0
- package/src/components/Alert/alert.tsx +40 -0
- package/src/components/Alert/index.ts +1 -0
- package/src/components/AlertDialog/alert-dialog.css.ts +62 -0
- package/src/components/AlertDialog/alert-dialog.tsx +199 -0
- package/src/components/AlertDialog/index.ts +1 -0
- package/src/components/AspectRatio/aspect-ratio.css.ts +7 -0
- package/src/components/AspectRatio/aspect-ratio.tsx +20 -0
- package/src/components/AspectRatio/index.ts +1 -0
- package/src/components/Autocomplete/autocomplete.css.ts +167 -0
- package/src/components/Autocomplete/autocomplete.tsx +226 -0
- package/src/components/Autocomplete/index.ts +1 -0
- package/src/components/Avatar/avatar.css.ts +65 -0
- package/src/components/Avatar/avatar.tsx +44 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Badge/badge.css.ts +180 -0
- package/src/components/Badge/badge.tsx +47 -0
- package/src/components/Badge/index.ts +1 -0
- package/src/components/Box/box.css.ts +5 -0
- package/src/components/Box/box.tsx +21 -0
- package/src/components/Box/index.ts +1 -0
- package/src/components/Breadcrumbs/breadcrumbs.css.ts +72 -0
- package/src/components/Breadcrumbs/breadcrumbs.tsx +79 -0
- package/src/components/Breadcrumbs/index.ts +9 -0
- package/src/components/Button/button.css.ts +200 -0
- package/src/components/Button/button.tsx +55 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Calendar/calendar.css.ts +187 -0
- package/src/components/Calendar/calendar.tsx +143 -0
- package/src/components/Calendar/index.ts +1 -0
- package/src/components/Card/card.tsx +32 -0
- package/src/components/Card/index.ts +1 -0
- package/src/components/Checkbox/checkbox.css.ts +76 -0
- package/src/components/Checkbox/checkbox.tsx +94 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/CloseButton/close-button.css.ts +11 -0
- package/src/components/CloseButton/close-button.tsx +15 -0
- package/src/components/CloseButton/index.ts +2 -0
- package/src/components/ColorPicker/color-picker.tsx +123 -0
- package/src/components/ColorPicker/index.ts +1 -0
- package/src/components/ColorSwatch/color-swatch.tsx +21 -0
- package/src/components/ColorSwatch/index.ts +1 -0
- package/src/components/Combobox/combobox.css.ts +333 -0
- package/src/components/Combobox/combobox.tsx +350 -0
- package/src/components/Combobox/index.ts +1 -0
- package/src/components/Command/command.css.ts +130 -0
- package/src/components/Command/command.tsx +413 -0
- package/src/components/Command/index.ts +7 -0
- package/src/components/Container/container.css.ts +41 -0
- package/src/components/Container/container.tsx +25 -0
- package/src/components/Container/index.ts +1 -0
- package/src/components/CopyButton/copy-button.css.ts +11 -0
- package/src/components/CopyButton/copy-button.tsx +45 -0
- package/src/components/CopyButton/index.ts +2 -0
- package/src/components/DatePicker/date-picker.tsx +75 -0
- package/src/components/DatePicker/index.ts +1 -0
- package/src/components/Dialog/dialog.css.ts +57 -0
- package/src/components/Dialog/dialog.tsx +181 -0
- package/src/components/Dialog/index.ts +1 -0
- package/src/components/Drawer/drawer.css.ts +404 -0
- package/src/components/Drawer/drawer.tsx +573 -0
- package/src/components/Drawer/index.ts +1 -0
- package/src/components/Field/field.css.ts +35 -0
- package/src/components/Field/field.tsx +101 -0
- package/src/components/Field/index.ts +1 -0
- package/src/components/Grid/grid.css.ts +12 -0
- package/src/components/Grid/grid.tsx +32 -0
- package/src/components/Grid/index.ts +1 -0
- package/src/components/Icon/icon.css.ts +10 -0
- package/src/components/Icon/icon.tsx +15 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/IconButton/icon-button.css.ts +6 -0
- package/src/components/IconButton/icon-button.tsx +11 -0
- package/src/components/IconButton/index.ts +2 -0
- package/src/components/Input/index.ts +1 -0
- package/src/components/Input/input.css.ts +72 -0
- package/src/components/Input/input.tsx +50 -0
- package/src/components/InputGroup/index.ts +1 -0
- package/src/components/InputGroup/input-group.css.ts +156 -0
- package/src/components/InputGroup/input-group.tsx +133 -0
- package/src/components/Menu/index.ts +1 -0
- package/src/components/Menu/menu.css.ts +121 -0
- package/src/components/Menu/menu.tsx +115 -0
- package/src/components/OTPField/index.ts +1 -0
- package/src/components/OTPField/otp-field.css.ts +54 -0
- package/src/components/OTPField/otp-field.tsx +46 -0
- package/src/components/Popover/index.ts +1 -0
- package/src/components/Popover/popover.css.ts +81 -0
- package/src/components/Popover/popover.tsx +113 -0
- package/src/components/Progress/index.ts +7 -0
- package/src/components/Progress/progress.css.ts +37 -0
- package/src/components/Progress/progress.tsx +62 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/Radio/radio.css.ts +72 -0
- package/src/components/Radio/radio.tsx +49 -0
- package/src/components/ScrollArea/index.ts +1 -0
- package/src/components/ScrollArea/scroll-area.css.ts +79 -0
- package/src/components/ScrollArea/scroll-area.tsx +96 -0
- package/src/components/SegmentedControl/index.ts +1 -0
- package/src/components/SegmentedControl/segmented-control.tsx +42 -0
- package/src/components/Select/index.ts +1 -0
- package/src/components/Select/select.css.ts +182 -0
- package/src/components/Select/select.tsx +165 -0
- package/src/components/Separator/index.ts +1 -0
- package/src/components/Separator/separator.css.ts +59 -0
- package/src/components/Separator/separator.tsx +34 -0
- package/src/components/Sheet/index.ts +1 -0
- package/src/components/Sheet/sheet.css.ts +184 -0
- package/src/components/Sheet/sheet.tsx +215 -0
- package/src/components/Slider/index.ts +1 -0
- package/src/components/Slider/slider.css.ts +81 -0
- package/src/components/Slider/slider.tsx +100 -0
- package/src/components/Spinner/index.ts +1 -0
- package/src/components/Spinner/spinner.css.ts +17 -0
- package/src/components/Spinner/spinner.tsx +15 -0
- package/src/components/Splitter/index.ts +1 -0
- package/src/components/Splitter/splitter.css.ts +69 -0
- package/src/components/Splitter/splitter.tsx +521 -0
- package/src/components/Stack/index.ts +1 -0
- package/src/components/Stack/stack.css.ts +42 -0
- package/src/components/Stack/stack.tsx +32 -0
- package/src/components/Surface/index.ts +1 -0
- package/src/components/Surface/surface.css.ts +40 -0
- package/src/components/Surface/surface.tsx +19 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/Switch/switch.css.ts +46 -0
- package/src/components/Switch/switch.tsx +25 -0
- package/src/components/Table/index.ts +2 -0
- package/src/components/Table/table.css.ts +71 -0
- package/src/components/Table/table.tsx +117 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/Tabs/tabs.css.ts +250 -0
- package/src/components/Tabs/tabs.tsx +119 -0
- package/src/components/Text/index.ts +2 -0
- package/src/components/Text/text.css.ts +118 -0
- package/src/components/Text/text.tsx +66 -0
- package/src/components/Textarea/index.ts +1 -0
- package/src/components/Textarea/textarea.css.ts +66 -0
- package/src/components/Textarea/textarea.tsx +48 -0
- package/src/components/Toggle/index.ts +1 -0
- package/src/components/Toggle/toggle.css.ts +91 -0
- package/src/components/Toggle/toggle.tsx +44 -0
- package/src/components/ToggleGroup/index.ts +1 -0
- package/src/components/ToggleGroup/toggle-group.css.ts +77 -0
- package/src/components/ToggleGroup/toggle-group.tsx +131 -0
- package/src/components/index.ts +54 -0
- package/src/index.ts +3 -0
- package/src/utils/drawer-styles.css.ts +85 -0
- package/src/utils/heights.ts +16 -0
- package/src/utils/sprinkles.css.ts +197 -0
- package/src/utils/sprinkles.tokens.ts +74 -0
- package/src/utils/types.ts +10 -0
- package/src/utils/ve-style.utils.ts +51 -0
- package/tsconfig.json +10 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { style } from "@vanilla-extract/css";
|
|
2
|
+
import { semanticVars, tokenVars } from "@blenx-dev/theme/contract";
|
|
3
|
+
|
|
4
|
+
export const backdrop = style({
|
|
5
|
+
position: "fixed",
|
|
6
|
+
inset: 0,
|
|
7
|
+
backgroundColor: "rgba(0, 0, 0, 0.32)",
|
|
8
|
+
backdropFilter: "blur(4px)",
|
|
9
|
+
transitionProperty: "opacity",
|
|
10
|
+
transitionDuration: "200ms",
|
|
11
|
+
"@media": {
|
|
12
|
+
"(prefers-reduced-motion: reduce)": {
|
|
13
|
+
transitionProperty: "none",
|
|
14
|
+
transitionDuration: "0ms",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const viewport = style({
|
|
20
|
+
position: "fixed",
|
|
21
|
+
inset: 0,
|
|
22
|
+
boxSizing: "border-box",
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const viewportBottom = style({
|
|
26
|
+
display: "grid",
|
|
27
|
+
gridTemplateRows: "1fr auto",
|
|
28
|
+
paddingTop: tokenVars.spacing.xxl,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const viewportTop = style({
|
|
32
|
+
display: "grid",
|
|
33
|
+
gridTemplateRows: "auto 1fr",
|
|
34
|
+
paddingBottom: tokenVars.spacing.xxl,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const viewportLeft = style({
|
|
38
|
+
display: "flex",
|
|
39
|
+
justifyContent: "flex-start",
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const viewportRight = style({
|
|
43
|
+
display: "flex",
|
|
44
|
+
justifyContent: "flex-end",
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const viewportInset = style({
|
|
48
|
+
"@media": {
|
|
49
|
+
"(min-width: 640px)": {
|
|
50
|
+
padding: tokenVars.spacing.md,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export const popup = style({
|
|
56
|
+
position: "relative",
|
|
57
|
+
display: "flex",
|
|
58
|
+
flexDirection: "column",
|
|
59
|
+
maxHeight: "100%",
|
|
60
|
+
minHeight: 0,
|
|
61
|
+
minWidth: 0,
|
|
62
|
+
width: "100%",
|
|
63
|
+
boxSizing: "border-box",
|
|
64
|
+
backgroundColor: semanticVars.surface.default,
|
|
65
|
+
color: semanticVars.text.primary,
|
|
66
|
+
borderStyle: "solid",
|
|
67
|
+
borderColor: semanticVars.border.default,
|
|
68
|
+
outline: "none",
|
|
69
|
+
boxShadow: tokenVars.shadow.lg,
|
|
70
|
+
willChange: "translate",
|
|
71
|
+
transitionProperty: "opacity, translate",
|
|
72
|
+
transitionDuration: "200ms",
|
|
73
|
+
transitionTimingFunction: "ease-in-out",
|
|
74
|
+
"::before": {
|
|
75
|
+
content: '""',
|
|
76
|
+
pointerEvents: "none",
|
|
77
|
+
position: "absolute",
|
|
78
|
+
inset: 0,
|
|
79
|
+
boxShadow: "0 1px 0 rgba(0, 0, 0, 0.04), inset 0 0 0 1px rgba(255, 255, 255, 0.02)",
|
|
80
|
+
},
|
|
81
|
+
"@media": {
|
|
82
|
+
"(prefers-reduced-motion: reduce)": {
|
|
83
|
+
transitionProperty: "none",
|
|
84
|
+
transitionDuration: "0ms",
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export const popupBottom = style({
|
|
90
|
+
gridRowStart: 2,
|
|
91
|
+
borderTopWidth: tokenVars.borderWidth.thin,
|
|
92
|
+
borderTopLeftRadius: tokenVars.borderRadius.xl,
|
|
93
|
+
borderTopRightRadius: tokenVars.borderRadius.xl,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export const popupTop = style({
|
|
97
|
+
borderBottomWidth: tokenVars.borderWidth.thin,
|
|
98
|
+
borderBottomLeftRadius: tokenVars.borderRadius.xl,
|
|
99
|
+
borderBottomRightRadius: tokenVars.borderRadius.xl,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
export const popupLeft = style({
|
|
103
|
+
width: "calc(100% - 48px)",
|
|
104
|
+
maxWidth: "28rem",
|
|
105
|
+
borderRightWidth: tokenVars.borderWidth.thin,
|
|
106
|
+
borderTopRightRadius: tokenVars.borderRadius.xl,
|
|
107
|
+
borderBottomRightRadius: tokenVars.borderRadius.xl,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
export const popupRight = style({
|
|
111
|
+
width: "calc(100% - 48px)",
|
|
112
|
+
maxWidth: "28rem",
|
|
113
|
+
borderLeftWidth: tokenVars.borderWidth.thin,
|
|
114
|
+
borderTopLeftRadius: tokenVars.borderRadius.xl,
|
|
115
|
+
borderBottomLeftRadius: tokenVars.borderRadius.xl,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
export const popupInset = style({
|
|
119
|
+
borderRadius: 0,
|
|
120
|
+
borderWidth: 0,
|
|
121
|
+
"::before": {
|
|
122
|
+
content: "none",
|
|
123
|
+
},
|
|
124
|
+
"@media": {
|
|
125
|
+
"(min-width: 640px)": {
|
|
126
|
+
borderRadius: tokenVars.borderRadius.xl,
|
|
127
|
+
borderWidth: tokenVars.borderWidth.thin,
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
export const header = style({
|
|
133
|
+
display: "flex",
|
|
134
|
+
flexDirection: "column",
|
|
135
|
+
gap: tokenVars.spacing.sm,
|
|
136
|
+
padding: tokenVars.spacing.lg,
|
|
137
|
+
boxSizing: "border-box",
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
export const footer = style({
|
|
141
|
+
display: "flex",
|
|
142
|
+
flexDirection: "column-reverse",
|
|
143
|
+
gap: tokenVars.spacing.sm,
|
|
144
|
+
paddingLeft: tokenVars.spacing.lg,
|
|
145
|
+
paddingRight: tokenVars.spacing.lg,
|
|
146
|
+
boxSizing: "border-box",
|
|
147
|
+
"@media": {
|
|
148
|
+
"(min-width: 640px)": {
|
|
149
|
+
flexDirection: "row",
|
|
150
|
+
justifyContent: "flex-end",
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
export const footerDefault = style({
|
|
156
|
+
borderTopWidth: tokenVars.borderWidth.thin,
|
|
157
|
+
borderTopStyle: "solid",
|
|
158
|
+
borderTopColor: semanticVars.border.subtle,
|
|
159
|
+
backgroundColor: semanticVars.background.subtle,
|
|
160
|
+
paddingTop: tokenVars.spacing.md,
|
|
161
|
+
paddingBottom: tokenVars.spacing.md,
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
export const footerBare = style({
|
|
165
|
+
paddingTop: tokenVars.spacing.md,
|
|
166
|
+
paddingBottom: tokenVars.spacing.lg,
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
export const title = style({
|
|
170
|
+
fontSize: tokenVars.fontSize.xl,
|
|
171
|
+
lineHeight: 1,
|
|
172
|
+
fontWeight: tokenVars.fontWeight.semibold,
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
export const description = style({
|
|
176
|
+
fontSize: tokenVars.fontSize.sm,
|
|
177
|
+
lineHeight: 1.4,
|
|
178
|
+
color: semanticVars.text.secondary,
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
export const panel = style({
|
|
182
|
+
boxSizing: "border-box",
|
|
183
|
+
padding: tokenVars.spacing.lg,
|
|
184
|
+
});
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import type React from "react";
|
|
7
|
+
import { ScrollArea } from "../ScrollArea/scroll-area";
|
|
8
|
+
import {
|
|
9
|
+
backdrop,
|
|
10
|
+
viewport,
|
|
11
|
+
viewportBottom,
|
|
12
|
+
viewportTop,
|
|
13
|
+
viewportLeft,
|
|
14
|
+
viewportRight,
|
|
15
|
+
viewportInset,
|
|
16
|
+
popup,
|
|
17
|
+
popupBottom,
|
|
18
|
+
popupTop,
|
|
19
|
+
popupLeft,
|
|
20
|
+
popupRight,
|
|
21
|
+
popupInset,
|
|
22
|
+
header,
|
|
23
|
+
footer,
|
|
24
|
+
footerDefault,
|
|
25
|
+
footerBare,
|
|
26
|
+
title,
|
|
27
|
+
description,
|
|
28
|
+
panel,
|
|
29
|
+
} from "./sheet.css";
|
|
30
|
+
import { CloseButton } from "../CloseButton";
|
|
31
|
+
import type { _BaseDivProps } from "../../utils/types";
|
|
32
|
+
import { Box } from "../Box";
|
|
33
|
+
|
|
34
|
+
type Side = "right" | "left" | "top" | "bottom";
|
|
35
|
+
|
|
36
|
+
export const Sheet: typeof SheetPrimitive.Root = SheetPrimitive.Root;
|
|
37
|
+
|
|
38
|
+
export const SheetPortal: typeof SheetPrimitive.Portal = SheetPrimitive.Portal;
|
|
39
|
+
|
|
40
|
+
export function SheetTrigger(props: SheetPrimitive.Trigger.Props): React.ReactElement {
|
|
41
|
+
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function SheetClose(props: SheetPrimitive.Close.Props): React.ReactElement {
|
|
45
|
+
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function SheetBackdrop({
|
|
49
|
+
className,
|
|
50
|
+
...props
|
|
51
|
+
}: SheetPrimitive.Backdrop.Props): React.ReactElement {
|
|
52
|
+
return (
|
|
53
|
+
<SheetPrimitive.Backdrop
|
|
54
|
+
className={clsx(backdrop, className)}
|
|
55
|
+
data-slot="sheet-backdrop"
|
|
56
|
+
{...props}
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
type SheetViewportProps = SheetPrimitive.Viewport.Props & {
|
|
62
|
+
side?: Side;
|
|
63
|
+
variant?: "default" | "inset";
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export function SheetViewport({
|
|
67
|
+
className,
|
|
68
|
+
side,
|
|
69
|
+
variant = "default",
|
|
70
|
+
...props
|
|
71
|
+
}: SheetViewportProps): React.ReactElement {
|
|
72
|
+
return (
|
|
73
|
+
<SheetPrimitive.Viewport
|
|
74
|
+
className={clsx(
|
|
75
|
+
viewport,
|
|
76
|
+
side === "bottom" && viewportBottom,
|
|
77
|
+
side === "top" && viewportTop,
|
|
78
|
+
side === "left" && viewportLeft,
|
|
79
|
+
side === "right" && viewportRight,
|
|
80
|
+
variant === "inset" && viewportInset,
|
|
81
|
+
className,
|
|
82
|
+
)}
|
|
83
|
+
data-slot="sheet-viewport"
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function SheetPopup({
|
|
90
|
+
children,
|
|
91
|
+
showCloseButton = true,
|
|
92
|
+
side = "right",
|
|
93
|
+
variant = "default",
|
|
94
|
+
closeProps,
|
|
95
|
+
portalProps,
|
|
96
|
+
className,
|
|
97
|
+
...props
|
|
98
|
+
}: SheetPrimitive.Popup.Props & {
|
|
99
|
+
showCloseButton?: boolean;
|
|
100
|
+
side?: Side;
|
|
101
|
+
variant?: "default" | "inset";
|
|
102
|
+
closeProps?: SheetPrimitive.Close.Props;
|
|
103
|
+
portalProps?: SheetPrimitive.Portal.Props;
|
|
104
|
+
}): React.ReactElement {
|
|
105
|
+
return (
|
|
106
|
+
<SheetPortal {...portalProps}>
|
|
107
|
+
<SheetBackdrop />
|
|
108
|
+
<SheetViewport side={side} variant={variant}>
|
|
109
|
+
<SheetPrimitive.Popup
|
|
110
|
+
className={clsx(
|
|
111
|
+
popup,
|
|
112
|
+
side === "bottom" && popupBottom,
|
|
113
|
+
side === "top" && popupTop,
|
|
114
|
+
side === "left" && popupLeft,
|
|
115
|
+
side === "right" && popupRight,
|
|
116
|
+
variant === "inset" && popupInset,
|
|
117
|
+
className,
|
|
118
|
+
)}
|
|
119
|
+
data-slot="sheet-popup"
|
|
120
|
+
{...props}
|
|
121
|
+
>
|
|
122
|
+
{children}
|
|
123
|
+
{showCloseButton && (
|
|
124
|
+
<Box position="absolute" top="xs" right="xs">
|
|
125
|
+
<SheetPrimitive.Close
|
|
126
|
+
aria-label="Close"
|
|
127
|
+
render={<CloseButton variant="ghost" />}
|
|
128
|
+
{...closeProps}
|
|
129
|
+
/>
|
|
130
|
+
</Box>
|
|
131
|
+
)}
|
|
132
|
+
</SheetPrimitive.Popup>
|
|
133
|
+
</SheetViewport>
|
|
134
|
+
</SheetPortal>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
type HeaderProps = _BaseDivProps;
|
|
139
|
+
|
|
140
|
+
export function SheetHeader({ className, render, ...props }: HeaderProps): React.ReactElement {
|
|
141
|
+
return useRender({
|
|
142
|
+
defaultTagName: "div",
|
|
143
|
+
props: {
|
|
144
|
+
className: clsx(header, className),
|
|
145
|
+
"data-slot": "sheet-header",
|
|
146
|
+
...props,
|
|
147
|
+
} as never,
|
|
148
|
+
render,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
type FooterProps = _BaseDivProps & {
|
|
153
|
+
variant?: "default" | "bare";
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export function SheetFooter({
|
|
157
|
+
className,
|
|
158
|
+
variant = "default",
|
|
159
|
+
render,
|
|
160
|
+
...props
|
|
161
|
+
}: FooterProps): React.ReactElement {
|
|
162
|
+
return useRender({
|
|
163
|
+
defaultTagName: "div",
|
|
164
|
+
props: {
|
|
165
|
+
className: clsx(
|
|
166
|
+
footer,
|
|
167
|
+
variant === "default" && footerDefault,
|
|
168
|
+
variant === "bare" && footerBare,
|
|
169
|
+
className,
|
|
170
|
+
),
|
|
171
|
+
"data-slot": "sheet-footer",
|
|
172
|
+
...props,
|
|
173
|
+
} as never,
|
|
174
|
+
render,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export function SheetTitle(props: SheetPrimitive.Title.Props): React.ReactElement {
|
|
179
|
+
return <SheetPrimitive.Title className={title} data-slot="sheet-title" {...props} />;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export function SheetDescription(props: SheetPrimitive.Description.Props): React.ReactElement {
|
|
183
|
+
return (
|
|
184
|
+
<SheetPrimitive.Description className={description} data-slot="sheet-description" {...props} />
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
type PanelProps = _BaseDivProps & {
|
|
189
|
+
scrollFade?: boolean;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export function SheetPanel({
|
|
193
|
+
scrollFade = true,
|
|
194
|
+
render,
|
|
195
|
+
className,
|
|
196
|
+
...props
|
|
197
|
+
}: PanelProps): React.ReactElement {
|
|
198
|
+
return (
|
|
199
|
+
<ScrollArea scrollFade={scrollFade}>
|
|
200
|
+
{useRender({
|
|
201
|
+
defaultTagName: "div",
|
|
202
|
+
props: {
|
|
203
|
+
className: clsx(panel, className),
|
|
204
|
+
"data-slot": "sheet-panel",
|
|
205
|
+
...props,
|
|
206
|
+
} as never,
|
|
207
|
+
render,
|
|
208
|
+
})}
|
|
209
|
+
</ScrollArea>
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export type { SheetViewportProps };
|
|
214
|
+
|
|
215
|
+
export { SheetBackdrop as SheetOverlay, SheetPopup as SheetContent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Slider, SliderValue } from "./slider";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { style } from "@vanilla-extract/css";
|
|
2
|
+
import { semanticVars, tokenVars } from "@blenx-dev/theme/contract";
|
|
3
|
+
|
|
4
|
+
export const disabled = style({
|
|
5
|
+
pointerEvents: "none",
|
|
6
|
+
opacity: 0.64,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const control = style({
|
|
10
|
+
display: "flex",
|
|
11
|
+
touchAction: "none",
|
|
12
|
+
userSelect: "none",
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const controlHorizontal = style({
|
|
16
|
+
width: "100%",
|
|
17
|
+
minWidth: 176,
|
|
18
|
+
height: 7,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const controlVertical = style({
|
|
22
|
+
height: "100%",
|
|
23
|
+
minHeight: 176,
|
|
24
|
+
flexDirection: "column",
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const track = style({
|
|
28
|
+
position: "relative",
|
|
29
|
+
flexGrow: 1,
|
|
30
|
+
userSelect: "none",
|
|
31
|
+
borderRadius: tokenVars.borderRadius.full,
|
|
32
|
+
backgroundColor: semanticVars.border.default,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const trackHorizontal = style({
|
|
36
|
+
width: "100%",
|
|
37
|
+
height: 7,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export const trackVertical = style({
|
|
41
|
+
height: "100%",
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export const indicator = style({
|
|
45
|
+
userSelect: "none",
|
|
46
|
+
borderRadius: tokenVars.borderRadius.full,
|
|
47
|
+
backgroundColor: semanticVars.interactive.primary.default,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export const thumb = style({
|
|
51
|
+
display: "block",
|
|
52
|
+
flexShrink: 0,
|
|
53
|
+
userSelect: "none",
|
|
54
|
+
borderRadius: tokenVars.borderRadius.full,
|
|
55
|
+
borderWidth: tokenVars.borderWidth.thin,
|
|
56
|
+
borderStyle: "solid",
|
|
57
|
+
borderColor: semanticVars.border.default,
|
|
58
|
+
backgroundColor: semanticVars.surface.default,
|
|
59
|
+
outline: "none",
|
|
60
|
+
transitionProperty: "box-shadow, transform",
|
|
61
|
+
transitionDuration: "150ms",
|
|
62
|
+
width: 16,
|
|
63
|
+
height: 16,
|
|
64
|
+
boxShadow: tokenVars.shadow.sm,
|
|
65
|
+
selectors: {
|
|
66
|
+
"&:has(:focus-visible)": {
|
|
67
|
+
boxShadow: `0 0 0 3px ${semanticVars.focus.ring}`,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export const thumbDragging = style({
|
|
73
|
+
transform: "scale(1.2)",
|
|
74
|
+
boxShadow: "none",
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
export const value = style({
|
|
78
|
+
display: "flex",
|
|
79
|
+
justifyContent: "flex-end",
|
|
80
|
+
fontSize: tokenVars.fontSize.sm,
|
|
81
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Slider as SliderPrimitive } from "@base-ui/react/slider";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import {
|
|
7
|
+
disabled,
|
|
8
|
+
control,
|
|
9
|
+
controlHorizontal,
|
|
10
|
+
controlVertical,
|
|
11
|
+
track,
|
|
12
|
+
trackHorizontal,
|
|
13
|
+
trackVertical,
|
|
14
|
+
indicator,
|
|
15
|
+
thumb,
|
|
16
|
+
thumbDragging,
|
|
17
|
+
value,
|
|
18
|
+
} from "./slider.css";
|
|
19
|
+
|
|
20
|
+
type SliderProps = Omit<SliderPrimitive.Root.Props, "style"> & {
|
|
21
|
+
className?: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type SliderValueProps = Omit<SliderPrimitive.Value.Props, "style"> & {
|
|
25
|
+
className?: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function Slider({
|
|
29
|
+
className,
|
|
30
|
+
children,
|
|
31
|
+
defaultValue,
|
|
32
|
+
value: controlledValue,
|
|
33
|
+
min = 0,
|
|
34
|
+
max = 100,
|
|
35
|
+
...props
|
|
36
|
+
}: SliderProps): React.ReactElement {
|
|
37
|
+
const values = React.useMemo(() => {
|
|
38
|
+
if (controlledValue !== undefined) {
|
|
39
|
+
return Array.isArray(controlledValue) ? controlledValue : [controlledValue];
|
|
40
|
+
}
|
|
41
|
+
if (defaultValue !== undefined) {
|
|
42
|
+
return Array.isArray(defaultValue) ? defaultValue : [defaultValue];
|
|
43
|
+
}
|
|
44
|
+
return [min];
|
|
45
|
+
}, [controlledValue, defaultValue, min]);
|
|
46
|
+
const orientation = props.orientation || "horizontal";
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<SliderPrimitive.Root
|
|
50
|
+
className={clsx(props.disabled && disabled, className)}
|
|
51
|
+
defaultValue={defaultValue}
|
|
52
|
+
max={max}
|
|
53
|
+
min={min}
|
|
54
|
+
thumbAlignment="edge"
|
|
55
|
+
value={controlledValue}
|
|
56
|
+
{...props}
|
|
57
|
+
>
|
|
58
|
+
{children}
|
|
59
|
+
<SliderPrimitive.Control
|
|
60
|
+
className={clsx(
|
|
61
|
+
control,
|
|
62
|
+
orientation === "horizontal" ? controlHorizontal : controlVertical,
|
|
63
|
+
)}
|
|
64
|
+
data-slot="slider-control"
|
|
65
|
+
>
|
|
66
|
+
<SliderPrimitive.Track
|
|
67
|
+
className={clsx(track, orientation === "horizontal" ? trackHorizontal : trackVertical)}
|
|
68
|
+
data-slot="slider-track"
|
|
69
|
+
>
|
|
70
|
+
<SliderPrimitive.Indicator className={indicator} data-slot="slider-indicator" />
|
|
71
|
+
{Array.from({ length: values.length }, (_, index) => (
|
|
72
|
+
<SliderPrimitive.Thumb
|
|
73
|
+
index={index}
|
|
74
|
+
key={index}
|
|
75
|
+
render={(thumbRenderProps, state) => (
|
|
76
|
+
<div
|
|
77
|
+
{...thumbRenderProps}
|
|
78
|
+
className={clsx(
|
|
79
|
+
thumbRenderProps.className,
|
|
80
|
+
thumb,
|
|
81
|
+
state.dragging && thumbDragging,
|
|
82
|
+
state.disabled && disabled,
|
|
83
|
+
)}
|
|
84
|
+
/>
|
|
85
|
+
)}
|
|
86
|
+
/>
|
|
87
|
+
))}
|
|
88
|
+
</SliderPrimitive.Track>
|
|
89
|
+
</SliderPrimitive.Control>
|
|
90
|
+
</SliderPrimitive.Root>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function SliderValue({ className, ...props }: SliderValueProps): React.ReactElement {
|
|
95
|
+
return (
|
|
96
|
+
<SliderPrimitive.Value className={clsx(value, className)} data-slot="slider-value" {...props} />
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export { SliderValue, Slider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./spinner";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { style, keyframes } from "@vanilla-extract/css";
|
|
2
|
+
|
|
3
|
+
export const spin = keyframes({
|
|
4
|
+
from: { transform: "rotate(0deg)" },
|
|
5
|
+
to: { transform: "rotate(360deg)" },
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const spinner = style({
|
|
9
|
+
display: "inline-flex",
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
justifyContent: "center",
|
|
12
|
+
transformOrigin: "center",
|
|
13
|
+
animationName: spin,
|
|
14
|
+
animationDuration: "1s",
|
|
15
|
+
animationIterationCount: "infinite",
|
|
16
|
+
animationTimingFunction: "linear",
|
|
17
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CircleNotchIcon } from "@phosphor-icons/react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import type React from "react";
|
|
4
|
+
import { spinner } from "./spinner.css";
|
|
5
|
+
|
|
6
|
+
type Props = Omit<React.ComponentProps<typeof CircleNotchIcon>, "className" | "style"> & {
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export function Spinner({ className, style, ...props }: Props): React.ReactElement {
|
|
12
|
+
return (
|
|
13
|
+
<CircleNotchIcon weight="bold" className={clsx(spinner, className)} style={style} {...props} />
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Splitter, SplitterHandle, SplitterPanel } from "./splitter";
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { style } from "@vanilla-extract/css";
|
|
2
|
+
import { semanticVars, tokenVars } from "@blenx-dev/theme/contract";
|
|
3
|
+
|
|
4
|
+
export const HANDLE_SIZE = 8;
|
|
5
|
+
|
|
6
|
+
export const root = style({
|
|
7
|
+
display: "flex",
|
|
8
|
+
overflow: "hidden",
|
|
9
|
+
width: "100%",
|
|
10
|
+
height: "100%",
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const rootHorizontal = style({
|
|
14
|
+
flexDirection: "row",
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const rootVertical = style({
|
|
18
|
+
flexDirection: "column",
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const rootDisabled = style({
|
|
22
|
+
pointerEvents: "none",
|
|
23
|
+
opacity: 0.6,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const panel = style({
|
|
27
|
+
overflow: "hidden",
|
|
28
|
+
flexShrink: 0,
|
|
29
|
+
flexBasis: 0,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const handle = style({
|
|
33
|
+
position: "relative",
|
|
34
|
+
display: "flex",
|
|
35
|
+
alignItems: "center",
|
|
36
|
+
justifyContent: "center",
|
|
37
|
+
flexShrink: 0,
|
|
38
|
+
backgroundColor: semanticVars.border.subtle,
|
|
39
|
+
transitionProperty: "background-color",
|
|
40
|
+
transitionDuration: tokenVars.duration.fast,
|
|
41
|
+
outline: "none",
|
|
42
|
+
selectors: {
|
|
43
|
+
"&:hover": {
|
|
44
|
+
backgroundColor: semanticVars.border.default,
|
|
45
|
+
},
|
|
46
|
+
"&:focus-visible": {
|
|
47
|
+
backgroundColor: semanticVars.interactive.primary.default,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const handleActive = style({
|
|
53
|
+
backgroundColor: semanticVars.interactive.primary.default,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export const handleDisabled = style({
|
|
57
|
+
cursor: "not-allowed",
|
|
58
|
+
opacity: 0.4,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export const handleHorizontal = style({
|
|
62
|
+
width: HANDLE_SIZE,
|
|
63
|
+
cursor: "col-resize",
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export const handleVertical = style({
|
|
67
|
+
height: HANDLE_SIZE,
|
|
68
|
+
cursor: "row-resize",
|
|
69
|
+
});
|