@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,54 @@
|
|
|
1
|
+
// ─── Design System: @/components/ui ───────────────────────────────────────────
|
|
2
|
+
// Components
|
|
3
|
+
|
|
4
|
+
export * from "./Accordion/accordion";
|
|
5
|
+
export * from "./Alert/alert";
|
|
6
|
+
export * from "./AlertDialog/alert-dialog";
|
|
7
|
+
export * from "./AspectRatio/aspect-ratio";
|
|
8
|
+
export * from "./Autocomplete/autocomplete";
|
|
9
|
+
export * from "./Avatar/avatar";
|
|
10
|
+
export * from "./Badge/badge";
|
|
11
|
+
export * from "./Box/box";
|
|
12
|
+
export * from "./Breadcrumbs/breadcrumbs";
|
|
13
|
+
export * from "./Button/button";
|
|
14
|
+
export * from "./Calendar/calendar";
|
|
15
|
+
export * from "./Card/card";
|
|
16
|
+
export * from "./Checkbox/checkbox";
|
|
17
|
+
export * from "./Command/command";
|
|
18
|
+
export * from "./ColorPicker/color-picker";
|
|
19
|
+
export * from "./ColorSwatch/color-swatch";
|
|
20
|
+
export * from "./Combobox/combobox";
|
|
21
|
+
export * from "./Container/container";
|
|
22
|
+
// Export * from "./DatePicker/date-picker";
|
|
23
|
+
export * from "./Dialog/dialog";
|
|
24
|
+
export * from "./Drawer/drawer";
|
|
25
|
+
export * from "./Field/field";
|
|
26
|
+
export * from "./Grid/grid";
|
|
27
|
+
export * from "./Icon/icon";
|
|
28
|
+
export * from "./IconButton";
|
|
29
|
+
export * from "./CopyButton";
|
|
30
|
+
export * from "./CloseButton";
|
|
31
|
+
export * from "./Input/input";
|
|
32
|
+
export * from "./InputGroup/input-group";
|
|
33
|
+
export * from "./OTPField/otp-field";
|
|
34
|
+
export * from "./Menu/menu";
|
|
35
|
+
export * from "./Popover/popover";
|
|
36
|
+
export * from "./Progress/progress";
|
|
37
|
+
export * from "./Radio/radio";
|
|
38
|
+
export * from "./ScrollArea/scroll-area";
|
|
39
|
+
export * from "./SegmentedControl/segmented-control";
|
|
40
|
+
export * from "./Select/select";
|
|
41
|
+
export * from "./Separator/separator";
|
|
42
|
+
export * from "./Sheet/sheet";
|
|
43
|
+
export * from "./Slider/slider";
|
|
44
|
+
export * from "./Spinner/spinner";
|
|
45
|
+
export * from "./Splitter/splitter";
|
|
46
|
+
export * from "./Stack/stack";
|
|
47
|
+
export * from "./Surface/surface";
|
|
48
|
+
export * from "./Switch/switch";
|
|
49
|
+
export * from "./Table/table";
|
|
50
|
+
export * from "./Tabs/tabs";
|
|
51
|
+
export * from "./Text/text";
|
|
52
|
+
export * from "./Textarea/textarea";
|
|
53
|
+
export * from "./Toggle/toggle";
|
|
54
|
+
export * from "./ToggleGroup/toggle-group";
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { semanticVars, tokenVars } from "@blenx-dev/theme/contract";
|
|
2
|
+
import { style } from "@vanilla-extract/css";
|
|
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: "transform, opacity",
|
|
10
|
+
transitionDuration: "200ms",
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const viewport = style({
|
|
14
|
+
position: "fixed",
|
|
15
|
+
inset: 0,
|
|
16
|
+
display: "grid",
|
|
17
|
+
gridTemplateRows: "1fr auto 3fr",
|
|
18
|
+
justifyItems: "center",
|
|
19
|
+
padding: tokenVars.spacing.md,
|
|
20
|
+
boxSizing: "border-box",
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const popup = style({
|
|
24
|
+
position: "relative",
|
|
25
|
+
gridRowStart: 2,
|
|
26
|
+
display: "flex",
|
|
27
|
+
flexDirection: "column",
|
|
28
|
+
width: "100%",
|
|
29
|
+
maxWidth: "28rem",
|
|
30
|
+
minHeight: 0,
|
|
31
|
+
maxHeight: "calc(100svh - 80px)",
|
|
32
|
+
transformOrigin: "center",
|
|
33
|
+
borderWidth: tokenVars.borderWidth.thin,
|
|
34
|
+
borderStyle: "solid",
|
|
35
|
+
borderColor: semanticVars.border.default,
|
|
36
|
+
borderRadius: tokenVars.borderRadius.default,
|
|
37
|
+
backgroundColor: semanticVars.surface.default,
|
|
38
|
+
color: semanticVars.text.primary,
|
|
39
|
+
boxSizing: "border-box",
|
|
40
|
+
opacity: "calc(1 - var(--nested-dialogs))",
|
|
41
|
+
outline: "none",
|
|
42
|
+
boxShadow: tokenVars.shadow.lg,
|
|
43
|
+
transitionProperty: "opacity, translate",
|
|
44
|
+
transitionDuration: "200ms",
|
|
45
|
+
transitionTimingFunction: "ease-in-out",
|
|
46
|
+
willChange: "transform",
|
|
47
|
+
"::before": {
|
|
48
|
+
content: '""',
|
|
49
|
+
pointerEvents: "none",
|
|
50
|
+
position: "absolute",
|
|
51
|
+
inset: 0,
|
|
52
|
+
borderRadius: "calc(16px - 1px)",
|
|
53
|
+
boxShadow: "0 1px 0 rgba(0, 0, 0, 0.04), inset 0 0 0 1px rgba(255, 255, 255, 0.02)",
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export const viewportShellBottomStickOnMobile = style({
|
|
58
|
+
"@media": {
|
|
59
|
+
"(max-width: 768px)": {
|
|
60
|
+
display: "flex",
|
|
61
|
+
alignItems: "flex-end",
|
|
62
|
+
justifyContent: "center",
|
|
63
|
+
padding: tokenVars.spacing.sm,
|
|
64
|
+
paddingBottom: 0,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export const closeButton = style({
|
|
70
|
+
position: "absolute",
|
|
71
|
+
top: tokenVars.spacing.xs,
|
|
72
|
+
insetInlineEnd: tokenVars.spacing.xs,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export const popupBottomStickOnMobile = style({
|
|
76
|
+
"@media": {
|
|
77
|
+
"(max-width: 768px)": {
|
|
78
|
+
width: "100%",
|
|
79
|
+
maxWidth: "100%",
|
|
80
|
+
maxHeight: "70svh",
|
|
81
|
+
borderBottomLeftRadius: 0,
|
|
82
|
+
borderBottomRightRadius: 0,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type NamedHeight =
|
|
2
|
+
| "5svh"
|
|
3
|
+
| "10svh"
|
|
4
|
+
| "15svh"
|
|
5
|
+
| "25svh"
|
|
6
|
+
| "40svh"
|
|
7
|
+
| "60svh"
|
|
8
|
+
| "75svh"
|
|
9
|
+
| "90svh"
|
|
10
|
+
| "full"
|
|
11
|
+
| "screen"
|
|
12
|
+
| "none";
|
|
13
|
+
|
|
14
|
+
export function applyBoxHeightStyle(_height: unknown): undefined {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { semanticVars, tokenVars } from "@blenx-dev/theme/contract";
|
|
2
|
+
import { defineProperties, createSprinkles } from "@vanilla-extract/sprinkles";
|
|
3
|
+
import { colors, containerWidths, responsiveConditions, spacing } from "./sprinkles.tokens";
|
|
4
|
+
|
|
5
|
+
const layoutProperties = defineProperties({
|
|
6
|
+
properties: {
|
|
7
|
+
width: { auto: "auto", full: "100%", fit: "fit-content" },
|
|
8
|
+
maxWidth: containerWidths,
|
|
9
|
+
height: { auto: "auto", full: "100%", fit: "fit-content" },
|
|
10
|
+
maxHeight: {
|
|
11
|
+
"5svh": "5svh",
|
|
12
|
+
"10svh": "10svh",
|
|
13
|
+
"15svh": "15svh",
|
|
14
|
+
"25svh": "25svh",
|
|
15
|
+
"40svh": "40svh",
|
|
16
|
+
"60svh": "60svh",
|
|
17
|
+
"75svh": "75svh",
|
|
18
|
+
"90svh": "90svh",
|
|
19
|
+
full: "100%",
|
|
20
|
+
screen: "100svh",
|
|
21
|
+
none: "none",
|
|
22
|
+
},
|
|
23
|
+
borderRadius: {
|
|
24
|
+
default: tokenVars.borderRadius.default,
|
|
25
|
+
none: "0",
|
|
26
|
+
full: "9999px",
|
|
27
|
+
xxs: tokenVars.borderRadius.xxs,
|
|
28
|
+
xs: tokenVars.borderRadius.xs,
|
|
29
|
+
sm: tokenVars.borderRadius.sm,
|
|
30
|
+
md: tokenVars.borderRadius.md,
|
|
31
|
+
lg: tokenVars.borderRadius.lg,
|
|
32
|
+
xl: tokenVars.borderRadius.xl,
|
|
33
|
+
xxl: tokenVars.borderRadius.xxl,
|
|
34
|
+
xxxl: tokenVars.borderRadius.xxxl,
|
|
35
|
+
},
|
|
36
|
+
fontSize: spacing,
|
|
37
|
+
},
|
|
38
|
+
shorthands: {
|
|
39
|
+
radius: ["borderRadius"],
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const colorProperties = defineProperties({
|
|
44
|
+
properties: {
|
|
45
|
+
color: colors,
|
|
46
|
+
backgroundColor: {
|
|
47
|
+
primary: semanticVars.interactive.primary.default,
|
|
48
|
+
primaryHover: semanticVars.interactive.primary.hover,
|
|
49
|
+
primaryActive: semanticVars.interactive.primary.active,
|
|
50
|
+
secondary: semanticVars.interactive.secondary.default,
|
|
51
|
+
secondaryHover: semanticVars.interactive.secondary.hover,
|
|
52
|
+
secondaryActive: semanticVars.interactive.secondary.active,
|
|
53
|
+
surface: semanticVars.surface.default,
|
|
54
|
+
canvas: semanticVars.background.default,
|
|
55
|
+
subtle: semanticVars.background.subtle,
|
|
56
|
+
default: "inherit",
|
|
57
|
+
disabled: semanticVars.background.subtle,
|
|
58
|
+
error: semanticVars.status.dangerBg,
|
|
59
|
+
success: semanticVars.status.successBg,
|
|
60
|
+
warning: semanticVars.status.warningBg,
|
|
61
|
+
info: semanticVars.status.infoBg,
|
|
62
|
+
},
|
|
63
|
+
borderColor: colors,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const flexProperties = defineProperties({
|
|
68
|
+
conditions: responsiveConditions,
|
|
69
|
+
defaultCondition: "base",
|
|
70
|
+
properties: {
|
|
71
|
+
flex: ["none", 1],
|
|
72
|
+
flexGrow: { 0: 0, 1: 1 },
|
|
73
|
+
flexShrink: { 0: 0, 1: 1 },
|
|
74
|
+
display: ["block", "flex", "grid", "inline-flex", "none"],
|
|
75
|
+
flexDirection: ["row", "row-reverse", "column", "column-reverse"],
|
|
76
|
+
gap: spacing,
|
|
77
|
+
},
|
|
78
|
+
shorthands: {
|
|
79
|
+
direction: ["flexDirection"],
|
|
80
|
+
grow: ["flexGrow"],
|
|
81
|
+
shrink: ["flexShrink"],
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const positionProperties = defineProperties({
|
|
86
|
+
properties: {
|
|
87
|
+
zIndex: {
|
|
88
|
+
"0": 0,
|
|
89
|
+
"1": 1,
|
|
90
|
+
"-1": -1,
|
|
91
|
+
base: 0,
|
|
92
|
+
raised: 100,
|
|
93
|
+
floating: 1000,
|
|
94
|
+
sticky: 1100,
|
|
95
|
+
overlay: 1200,
|
|
96
|
+
popover: 1300,
|
|
97
|
+
modal: 1400,
|
|
98
|
+
toast: 1500,
|
|
99
|
+
tooltip: 1600,
|
|
100
|
+
},
|
|
101
|
+
position: ["static", "relative", "absolute", "fixed", "sticky"],
|
|
102
|
+
top: spacing,
|
|
103
|
+
bottom: spacing,
|
|
104
|
+
left: spacing,
|
|
105
|
+
right: spacing,
|
|
106
|
+
overflow: ["scroll", "visible", "hidden", "auto"],
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const responsiveSpacingProperties = defineProperties({
|
|
111
|
+
conditions: responsiveConditions,
|
|
112
|
+
defaultCondition: "base",
|
|
113
|
+
properties: {
|
|
114
|
+
paddingTop: spacing,
|
|
115
|
+
paddingBottom: spacing,
|
|
116
|
+
paddingLeft: spacing,
|
|
117
|
+
paddingRight: spacing,
|
|
118
|
+
marginTop: spacing,
|
|
119
|
+
marginBottom: spacing,
|
|
120
|
+
marginLeft: spacing,
|
|
121
|
+
marginRight: spacing,
|
|
122
|
+
},
|
|
123
|
+
shorthands: {
|
|
124
|
+
padding: ["paddingTop", "paddingBottom", "paddingLeft", "paddingRight"],
|
|
125
|
+
p: ["paddingTop", "paddingBottom", "paddingLeft", "paddingRight"],
|
|
126
|
+
paddingX: ["paddingLeft", "paddingRight"],
|
|
127
|
+
px: ["paddingLeft", "paddingRight"],
|
|
128
|
+
py: ["paddingTop", "paddingBottom"],
|
|
129
|
+
paddingY: ["paddingTop", "paddingBottom"],
|
|
130
|
+
margin: ["marginTop", "marginBottom", "marginLeft", "marginRight"],
|
|
131
|
+
m: ["marginTop", "marginBottom", "marginLeft", "marginRight"],
|
|
132
|
+
marginX: ["marginLeft", "marginRight"],
|
|
133
|
+
mx: ["marginLeft", "marginRight"],
|
|
134
|
+
my: ["marginTop", "marginBottom"],
|
|
135
|
+
marginY: ["marginTop", "marginBottom"],
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
/* ── Grid properties ── */
|
|
140
|
+
|
|
141
|
+
const columnValues: Record<number, string> = {};
|
|
142
|
+
for (let i = 1; i <= 12; i++) {
|
|
143
|
+
columnValues[i] = `repeat(${i}, minmax(0, 1fr))`;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const gridProperties = defineProperties({
|
|
147
|
+
conditions: responsiveConditions,
|
|
148
|
+
defaultCondition: "base",
|
|
149
|
+
properties: {
|
|
150
|
+
gridTemplateColumns: columnValues,
|
|
151
|
+
gridAutoFlow: {
|
|
152
|
+
row: "row",
|
|
153
|
+
column: "column",
|
|
154
|
+
dense: "dense",
|
|
155
|
+
"row dense": "row dense",
|
|
156
|
+
"column dense": "column dense",
|
|
157
|
+
},
|
|
158
|
+
rowGap: spacing,
|
|
159
|
+
columnGap: spacing,
|
|
160
|
+
},
|
|
161
|
+
shorthands: {
|
|
162
|
+
columns: ["gridTemplateColumns"],
|
|
163
|
+
flow: ["gridAutoFlow"],
|
|
164
|
+
gap: ["rowGap", "columnGap"],
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
const alignmentProperties = defineProperties({
|
|
168
|
+
conditions: responsiveConditions,
|
|
169
|
+
defaultCondition: "base",
|
|
170
|
+
properties: {
|
|
171
|
+
alignItems: ["start", "center", "end", "stretch", "baseline"],
|
|
172
|
+
justifyItems: ["start", "center", "end", "stretch"],
|
|
173
|
+
justifyContent: ["center", "start", "end", "stretch", "between", "around", "evenly"],
|
|
174
|
+
},
|
|
175
|
+
shorthands: {
|
|
176
|
+
align: ["alignItems"],
|
|
177
|
+
justify: ["justifyItems", "justifyContent"],
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
export const baseSprinkles = createSprinkles(
|
|
181
|
+
layoutProperties,
|
|
182
|
+
responsiveSpacingProperties,
|
|
183
|
+
colorProperties,
|
|
184
|
+
flexProperties,
|
|
185
|
+
positionProperties,
|
|
186
|
+
alignmentProperties,
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
export const gridSprinkles = createSprinkles(gridProperties, alignmentProperties);
|
|
190
|
+
|
|
191
|
+
export type GridSprinkles = Parameters<typeof gridSprinkles>[0];
|
|
192
|
+
|
|
193
|
+
export type BaseSprinkles = Parameters<typeof baseSprinkles>[0] & {
|
|
194
|
+
fullWidth?: boolean;
|
|
195
|
+
fullHeight?: boolean;
|
|
196
|
+
withBorder?: boolean;
|
|
197
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { semanticVars, tokenVars } from "@blenx-dev/theme/contract";
|
|
2
|
+
|
|
3
|
+
export const spacing = {
|
|
4
|
+
none: "0",
|
|
5
|
+
xxs: tokenVars.spacing.xxs,
|
|
6
|
+
xs: tokenVars.spacing.xs,
|
|
7
|
+
sm: tokenVars.spacing.sm,
|
|
8
|
+
md: tokenVars.spacing.md,
|
|
9
|
+
lg: tokenVars.spacing.lg,
|
|
10
|
+
xl: tokenVars.spacing.xl,
|
|
11
|
+
huge: tokenVars.spacing.huge,
|
|
12
|
+
xxl: tokenVars.spacing.xxl,
|
|
13
|
+
xxxl: tokenVars.spacing.xxxl,
|
|
14
|
+
massive: tokenVars.spacing.massive,
|
|
15
|
+
"0": tokenVars.spacing["0"],
|
|
16
|
+
"0.5": tokenVars.spacing["0.5"],
|
|
17
|
+
"1": tokenVars.spacing["1"],
|
|
18
|
+
"2": tokenVars.spacing["2"],
|
|
19
|
+
"3": tokenVars.spacing["3"],
|
|
20
|
+
"4": tokenVars.spacing["4"],
|
|
21
|
+
"5": tokenVars.spacing["5"],
|
|
22
|
+
"6": tokenVars.spacing["6"],
|
|
23
|
+
"7": tokenVars.spacing["7"],
|
|
24
|
+
"8": tokenVars.spacing["8"],
|
|
25
|
+
"9": tokenVars.spacing["9"],
|
|
26
|
+
"10": tokenVars.spacing["10"],
|
|
27
|
+
"12": tokenVars.spacing["12"],
|
|
28
|
+
"16": tokenVars.spacing["16"],
|
|
29
|
+
"20": tokenVars.spacing["20"],
|
|
30
|
+
"24": tokenVars.spacing["24"],
|
|
31
|
+
"32": tokenVars.spacing["32"],
|
|
32
|
+
"40": tokenVars.spacing["40"],
|
|
33
|
+
"48": tokenVars.spacing["48"],
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const containerWidths = {
|
|
37
|
+
xxs: "240px",
|
|
38
|
+
xs: "320px",
|
|
39
|
+
sm: "480px",
|
|
40
|
+
md: "640px",
|
|
41
|
+
lg: "768px",
|
|
42
|
+
xl: "1024px",
|
|
43
|
+
xxl: "1280px",
|
|
44
|
+
xxxl: "1440px",
|
|
45
|
+
480: "480px",
|
|
46
|
+
640: "640px",
|
|
47
|
+
400: "400px",
|
|
48
|
+
560: "560px",
|
|
49
|
+
full: "100%",
|
|
50
|
+
screen: "100%",
|
|
51
|
+
viewport: "90svw",
|
|
52
|
+
maxViewport: "98svw",
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const colors = {
|
|
56
|
+
primary: semanticVars.text.primary,
|
|
57
|
+
default: "currentColor",
|
|
58
|
+
secondary: semanticVars.text.secondary,
|
|
59
|
+
disabled: semanticVars.text.disabled,
|
|
60
|
+
inverse: semanticVars.text.inverse,
|
|
61
|
+
link: semanticVars.interactive.primary.default,
|
|
62
|
+
error: semanticVars.status.danger.default,
|
|
63
|
+
success: semanticVars.status.success.default,
|
|
64
|
+
warning: semanticVars.status.warning.default,
|
|
65
|
+
info: semanticVars.status.info.default,
|
|
66
|
+
} as const;
|
|
67
|
+
|
|
68
|
+
export const responsiveConditions = {
|
|
69
|
+
base: {},
|
|
70
|
+
sm: { "@media": "screen and (min-width: 640px)" },
|
|
71
|
+
md: { "@media": "screen and (min-width: 768px)" },
|
|
72
|
+
lg: { "@media": "screen and (min-width: 1280px)" },
|
|
73
|
+
xl: { "@media": "screen and (min-width: 1536px)" },
|
|
74
|
+
} as const;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
2
|
+
|
|
3
|
+
export type PropsWithClassName<T> = Omit<T, "className" | "style"> & {
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type PropsWithStylex<T> = PropsWithClassName<T>;
|
|
9
|
+
|
|
10
|
+
export type _BaseDivProps = useRender.ComponentProps<"div">;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
baseSprinkles,
|
|
3
|
+
gridSprinkles,
|
|
4
|
+
type BaseSprinkles,
|
|
5
|
+
type GridSprinkles,
|
|
6
|
+
} from "./sprinkles.css";
|
|
7
|
+
|
|
8
|
+
const BASE_SPRINKLE_PROPERTIES = baseSprinkles.properties;
|
|
9
|
+
type BasePropKeys = keyof BaseSprinkles;
|
|
10
|
+
type GridPropKeys = keyof GridSprinkles;
|
|
11
|
+
const GRID_SPRINKLE_PROPERTIES = gridSprinkles.properties;
|
|
12
|
+
export function applyBaseSprinkles(
|
|
13
|
+
props: Record<string, unknown>,
|
|
14
|
+
): [string, Record<string, unknown>] {
|
|
15
|
+
const sprinkleProps: BaseSprinkles = {};
|
|
16
|
+
const htmlProps: Record<string, unknown> = {};
|
|
17
|
+
for (const [key, value] of Object.entries(props) as [BasePropKeys, any][]) {
|
|
18
|
+
if (key === "fullWidth") {
|
|
19
|
+
if (props[key]) {
|
|
20
|
+
sprinkleProps.width = "full";
|
|
21
|
+
}
|
|
22
|
+
} else if (key === "withBorder") {
|
|
23
|
+
if (props[key]) {
|
|
24
|
+
sprinkleProps.borderRadius = sprinkleProps.borderRadius || "default";
|
|
25
|
+
sprinkleProps.borderColor = sprinkleProps.borderColor || "default";
|
|
26
|
+
}
|
|
27
|
+
} else if (key === "fullHeight") {
|
|
28
|
+
continue;
|
|
29
|
+
} else if (BASE_SPRINKLE_PROPERTIES.has(key)) {
|
|
30
|
+
sprinkleProps[key as BasePropKeys] = value;
|
|
31
|
+
} else {
|
|
32
|
+
htmlProps[key] = value;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
sprinkleProps.borderRadius = sprinkleProps.borderRadius || "default";
|
|
36
|
+
return [baseSprinkles(sprinkleProps), htmlProps];
|
|
37
|
+
}
|
|
38
|
+
export function applyGridSprinkles(
|
|
39
|
+
props: Record<string, unknown>,
|
|
40
|
+
): [string, Record<string, unknown>] {
|
|
41
|
+
const sprinkleProps: GridSprinkles = {};
|
|
42
|
+
const htmlProps: Record<string, unknown> = {};
|
|
43
|
+
for (const [key, value] of Object.entries(props) as [GridPropKeys, any][]) {
|
|
44
|
+
if (GRID_SPRINKLE_PROPERTIES.has(key)) {
|
|
45
|
+
sprinkleProps[key as GridPropKeys] = value;
|
|
46
|
+
} else {
|
|
47
|
+
htmlProps[key] = value;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return [gridSprinkles(sprinkleProps), htmlProps];
|
|
51
|
+
}
|
package/tsconfig.json
ADDED