@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,47 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import {
|
|
3
|
+
badgeBase,
|
|
4
|
+
badgeDanger,
|
|
5
|
+
badgeDefault,
|
|
6
|
+
badgeOutline,
|
|
7
|
+
badgePrimary,
|
|
8
|
+
badgeRecipe,
|
|
9
|
+
badgeSecondary,
|
|
10
|
+
badgeSoft,
|
|
11
|
+
badgeSolid,
|
|
12
|
+
badgeSuccess,
|
|
13
|
+
} from "./badge.css";
|
|
14
|
+
import { Box, type BoxProps } from "../Box/box";
|
|
15
|
+
import type { RecipeVariants } from "@vanilla-extract/recipes";
|
|
16
|
+
|
|
17
|
+
type Props = BoxProps & RecipeVariants<typeof badgeRecipe>;
|
|
18
|
+
|
|
19
|
+
export const variantStyles: Record<string, string> = {
|
|
20
|
+
default: badgeDefault,
|
|
21
|
+
primary: badgePrimary,
|
|
22
|
+
secondary: badgeSecondary,
|
|
23
|
+
success: badgeSuccess,
|
|
24
|
+
danger: badgeDanger,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const appearanceStyles: Record<string, string> = {
|
|
28
|
+
solid: badgeSolid,
|
|
29
|
+
outline: badgeOutline,
|
|
30
|
+
soft: badgeSoft,
|
|
31
|
+
};
|
|
32
|
+
export function getBadgeStyles(variant: string, appearance: string): string {
|
|
33
|
+
const base = badgeBase;
|
|
34
|
+
const v = variantStyles[variant] ?? badgeDefault;
|
|
35
|
+
const a = appearanceStyles[appearance] ?? badgeSolid;
|
|
36
|
+
return `${base} ${v} ${a}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function Badge({ variant, appearance, className, style, ...props }: Props) {
|
|
40
|
+
return (
|
|
41
|
+
<Box
|
|
42
|
+
className={clsx(badgeRecipe({ variant, appearance }), className)}
|
|
43
|
+
style={style}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./badge";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { baseBox } from "./box.css";
|
|
4
|
+
import type { BaseSprinkles } from "../../utils/sprinkles.css";
|
|
5
|
+
import { applyBaseSprinkles } from "../../utils/ve-style.utils";
|
|
6
|
+
|
|
7
|
+
type BoxProps = useRender.ComponentProps<"div"> & BaseSprinkles;
|
|
8
|
+
|
|
9
|
+
function Box({ render, className, ...props }: BoxProps) {
|
|
10
|
+
const [styleProps, htmlProps] = applyBaseSprinkles(props);
|
|
11
|
+
return useRender({
|
|
12
|
+
defaultTagName: "div",
|
|
13
|
+
render,
|
|
14
|
+
props: {
|
|
15
|
+
...htmlProps,
|
|
16
|
+
className: clsx(baseBox, styleProps, className),
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export type { BoxProps };
|
|
21
|
+
export { Box };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./box";
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { style } from "@vanilla-extract/css";
|
|
2
|
+
import { semanticVars, tokenVars } from "@blenx-dev/theme/contract";
|
|
3
|
+
|
|
4
|
+
export const root = style({
|
|
5
|
+
display: "flex",
|
|
6
|
+
alignItems: "center",
|
|
7
|
+
gap: "4px",
|
|
8
|
+
color: semanticVars.text.secondary,
|
|
9
|
+
fontSize: 14,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const list = style({
|
|
13
|
+
display: "flex",
|
|
14
|
+
flexWrap: "wrap",
|
|
15
|
+
alignItems: "center",
|
|
16
|
+
gap: 6,
|
|
17
|
+
fontSize: tokenVars.fontSize.md,
|
|
18
|
+
color: semanticVars.text.secondary,
|
|
19
|
+
"@media": {
|
|
20
|
+
"screen and (min-width: 768px)": {
|
|
21
|
+
gap: 10,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const item = style({
|
|
27
|
+
display: "inline-flex",
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
gap: 6,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const link = style({
|
|
33
|
+
color: "inherit",
|
|
34
|
+
textDecoration: "none",
|
|
35
|
+
cursor: "pointer",
|
|
36
|
+
transitionProperty: "color",
|
|
37
|
+
transitionDuration: "150ms",
|
|
38
|
+
transitionTimingFunction: "ease",
|
|
39
|
+
selectors: {
|
|
40
|
+
"&:hover": {
|
|
41
|
+
color: semanticVars.text.primary,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export const page = style({
|
|
47
|
+
fontWeight: 400,
|
|
48
|
+
color: semanticVars.text.primary,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export const separator = style({
|
|
52
|
+
display: "inline-flex",
|
|
53
|
+
alignItems: "center",
|
|
54
|
+
opacity: 0.8,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export const ellipsis = style({
|
|
58
|
+
display: "inline-flex",
|
|
59
|
+
alignItems: "center",
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const srOnly = style({
|
|
63
|
+
position: "absolute",
|
|
64
|
+
width: 1,
|
|
65
|
+
height: 1,
|
|
66
|
+
padding: 0,
|
|
67
|
+
margin: -1,
|
|
68
|
+
overflow: "hidden",
|
|
69
|
+
clip: "rect(0, 0, 0, 0)",
|
|
70
|
+
whiteSpace: "nowrap",
|
|
71
|
+
borderWidth: 0,
|
|
72
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { mergeProps, useRender } from "@base-ui/react";
|
|
4
|
+
import { CaretRightIcon, DotsThreeIcon } from "@phosphor-icons/react";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
7
|
+
import { root, list, item, link, page, separator, ellipsis, srOnly } from "./breadcrumbs.css";
|
|
8
|
+
|
|
9
|
+
type NavProps = useRender.ComponentProps<"nav"> & {
|
|
10
|
+
className?: string;
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function Breadcrumb({ className, style, render, ...props }: NavProps) {
|
|
15
|
+
const merged = mergeProps({ className: clsx(root, className), style }, props, {
|
|
16
|
+
"aria-label": "breadcrumb",
|
|
17
|
+
});
|
|
18
|
+
return useRender({ defaultTagName: "nav", props: merged, render });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type OlProps = ComponentPropsWithoutRef<"ol"> & {
|
|
22
|
+
className?: string;
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export function BreadcrumbList({ className, style, ...props }: OlProps) {
|
|
27
|
+
return <ol className={clsx(list, className)} style={style} {...props} />;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type LiProps = ComponentPropsWithoutRef<"li"> & {
|
|
31
|
+
className?: string;
|
|
32
|
+
style?: React.CSSProperties;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export function BreadcrumbItem({ className, style, ...props }: LiProps) {
|
|
36
|
+
return <li className={clsx(item, className)} style={style} {...props} />;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
type LinkProps = useRender.ComponentProps<"a"> & {
|
|
40
|
+
className?: string;
|
|
41
|
+
style?: React.CSSProperties;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export function BreadcrumbLink({ className, style, render, ...props }: LinkProps) {
|
|
45
|
+
const merged = mergeProps({ className: clsx(link, className), style }, props);
|
|
46
|
+
return useRender({ defaultTagName: "a", props: merged, render });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
type SpanProps = ComponentPropsWithoutRef<"span"> & {
|
|
50
|
+
className?: string;
|
|
51
|
+
style?: React.CSSProperties;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export function BreadcrumbPage({ className, style, ...props }: SpanProps) {
|
|
55
|
+
return <span className={clsx(page, className)} style={style} aria-current="page" {...props} />;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function BreadcrumbSeparator({ children, className, style, ...props }: LiProps) {
|
|
59
|
+
return (
|
|
60
|
+
<li
|
|
61
|
+
role="presentation"
|
|
62
|
+
aria-hidden="true"
|
|
63
|
+
className={clsx(separator, className)}
|
|
64
|
+
style={style}
|
|
65
|
+
{...props}
|
|
66
|
+
>
|
|
67
|
+
{children ?? <CaretRightIcon size={16} />}
|
|
68
|
+
</li>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function BreadcrumbEllipsis({ className, style, ...props }: SpanProps) {
|
|
73
|
+
return (
|
|
74
|
+
<span role="presentation" className={clsx(ellipsis, className)} style={style} {...props}>
|
|
75
|
+
<DotsThreeIcon size={16} />
|
|
76
|
+
<span className={srOnly}>More</span>
|
|
77
|
+
</span>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { createVar } from "@vanilla-extract/css";
|
|
2
|
+
import { recipe } from "@vanilla-extract/recipes";
|
|
3
|
+
import { semanticVars, tokenVars } from "@blenx-dev/theme/contract";
|
|
4
|
+
|
|
5
|
+
export const intentVars = {
|
|
6
|
+
solidBg: createVar(),
|
|
7
|
+
solidFg: createVar(),
|
|
8
|
+
solidHoverBg: createVar(),
|
|
9
|
+
softBg: createVar(),
|
|
10
|
+
softFg: createVar(),
|
|
11
|
+
softHoverBg: createVar(),
|
|
12
|
+
border: createVar(),
|
|
13
|
+
fg: createVar(),
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const variant = recipe({
|
|
17
|
+
base: {
|
|
18
|
+
display: "inline-flex",
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
justifyContent: "center",
|
|
21
|
+
gap: tokenVars.spacing.sm,
|
|
22
|
+
borderStyle: "solid",
|
|
23
|
+
borderWidth: 1,
|
|
24
|
+
borderRadius: tokenVars.borderRadius.default,
|
|
25
|
+
cursor: "pointer",
|
|
26
|
+
fontWeight: 500,
|
|
27
|
+
width: "fit-content",
|
|
28
|
+
height: "fit-content",
|
|
29
|
+
fontSize: tokenVars.fontSize.md,
|
|
30
|
+
fontFamily: tokenVars.font.body,
|
|
31
|
+
textDecoration: "none",
|
|
32
|
+
position: "relative",
|
|
33
|
+
transition: "all 0.2s ease",
|
|
34
|
+
selectors: {
|
|
35
|
+
"&:disabled": {
|
|
36
|
+
opacity: 0.4,
|
|
37
|
+
cursor: "not-allowed",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
variants: {
|
|
42
|
+
intent: {
|
|
43
|
+
primary: {
|
|
44
|
+
vars: {
|
|
45
|
+
[intentVars.solidBg]: semanticVars.interactive.primary.default,
|
|
46
|
+
[intentVars.solidFg]: semanticVars.interactive.primaryFg,
|
|
47
|
+
[intentVars.solidHoverBg]: semanticVars.interactive.primary.hover,
|
|
48
|
+
[intentVars.softBg]: semanticVars.interactive.primaryBg.default,
|
|
49
|
+
[intentVars.softFg]: semanticVars.interactive.primary.default,
|
|
50
|
+
[intentVars.softHoverBg]: semanticVars.interactive.primaryBg.hover,
|
|
51
|
+
[intentVars.border]: semanticVars.interactive.primary.active,
|
|
52
|
+
[intentVars.fg]: semanticVars.interactive.primary.default,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
neutral: {
|
|
56
|
+
vars: {
|
|
57
|
+
[intentVars.solidBg]: semanticVars.surface.raised,
|
|
58
|
+
[intentVars.solidFg]: semanticVars.text.primary,
|
|
59
|
+
[intentVars.solidHoverBg]: semanticVars.background.subtle,
|
|
60
|
+
[intentVars.softBg]: semanticVars.background.subtle,
|
|
61
|
+
[intentVars.softFg]: semanticVars.text.primary,
|
|
62
|
+
[intentVars.softHoverBg]: semanticVars.background.subtle,
|
|
63
|
+
[intentVars.border]: semanticVars.border.default,
|
|
64
|
+
[intentVars.fg]: semanticVars.text.primary,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
success: {
|
|
68
|
+
vars: {
|
|
69
|
+
[intentVars.solidBg]: semanticVars.status.success.default,
|
|
70
|
+
[intentVars.solidFg]: semanticVars.text.inverse,
|
|
71
|
+
[intentVars.solidHoverBg]: semanticVars.status.success.hover,
|
|
72
|
+
[intentVars.softBg]: semanticVars.status.successBg,
|
|
73
|
+
[intentVars.softFg]: semanticVars.status.success.default,
|
|
74
|
+
[intentVars.softHoverBg]: semanticVars.status.successBg,
|
|
75
|
+
[intentVars.border]: semanticVars.status.success.active,
|
|
76
|
+
[intentVars.fg]: semanticVars.status.success.default,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
warning: {
|
|
80
|
+
vars: {
|
|
81
|
+
[intentVars.solidBg]: semanticVars.status.warning.default,
|
|
82
|
+
[intentVars.solidFg]: semanticVars.text.inverse,
|
|
83
|
+
[intentVars.solidHoverBg]: semanticVars.status.warning.hover,
|
|
84
|
+
[intentVars.softBg]: semanticVars.status.warningBg,
|
|
85
|
+
[intentVars.softFg]: semanticVars.status.warning.default,
|
|
86
|
+
[intentVars.softHoverBg]: semanticVars.status.warningBg,
|
|
87
|
+
[intentVars.border]: semanticVars.status.warning.active,
|
|
88
|
+
[intentVars.fg]: semanticVars.status.warning.default,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
danger: {
|
|
92
|
+
vars: {
|
|
93
|
+
[intentVars.solidBg]: semanticVars.status.danger.default,
|
|
94
|
+
[intentVars.solidFg]: semanticVars.text.inverse,
|
|
95
|
+
[intentVars.solidHoverBg]: semanticVars.status.danger.hover,
|
|
96
|
+
[intentVars.softBg]: semanticVars.status.dangerBg,
|
|
97
|
+
[intentVars.softFg]: semanticVars.status.danger.default,
|
|
98
|
+
[intentVars.softHoverBg]: semanticVars.status.dangerBg,
|
|
99
|
+
[intentVars.border]: semanticVars.status.danger.active,
|
|
100
|
+
[intentVars.fg]: semanticVars.status.danger.default,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
info: {
|
|
104
|
+
vars: {
|
|
105
|
+
[intentVars.solidBg]: semanticVars.status.info.default,
|
|
106
|
+
[intentVars.solidFg]: semanticVars.text.inverse,
|
|
107
|
+
[intentVars.solidHoverBg]: semanticVars.status.info.hover,
|
|
108
|
+
[intentVars.softBg]: semanticVars.status.infoBg,
|
|
109
|
+
[intentVars.softFg]: semanticVars.status.info.default,
|
|
110
|
+
[intentVars.softHoverBg]: semanticVars.status.infoBg,
|
|
111
|
+
[intentVars.border]: semanticVars.status.info.active,
|
|
112
|
+
[intentVars.fg]: semanticVars.status.info.default,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
mono: {
|
|
116
|
+
vars: {
|
|
117
|
+
[intentVars.solidBg]: semanticVars.background.default,
|
|
118
|
+
[intentVars.solidFg]: semanticVars.text.primary,
|
|
119
|
+
[intentVars.solidHoverBg]: semanticVars.background.subtle,
|
|
120
|
+
[intentVars.softBg]: semanticVars.background.default,
|
|
121
|
+
[intentVars.softFg]: semanticVars.text.primary,
|
|
122
|
+
[intentVars.softHoverBg]: semanticVars.background.subtle,
|
|
123
|
+
[intentVars.border]: semanticVars.border.default,
|
|
124
|
+
[intentVars.fg]: semanticVars.text.primary,
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
size: {
|
|
129
|
+
xs: {
|
|
130
|
+
padding: `${tokenVars.spacing.xxs} ${tokenVars.spacing.xs}`,
|
|
131
|
+
fontSize: tokenVars.fontSize.sm,
|
|
132
|
+
},
|
|
133
|
+
sm: {
|
|
134
|
+
padding: `${tokenVars.spacing.xs} ${tokenVars.spacing.sm}`,
|
|
135
|
+
fontSize: tokenVars.fontSize.sm,
|
|
136
|
+
},
|
|
137
|
+
icon: {
|
|
138
|
+
padding: `${tokenVars.spacing.xs} ${tokenVars.spacing.xs}`,
|
|
139
|
+
},
|
|
140
|
+
md: { padding: `${tokenVars.spacing.sm} ${tokenVars.spacing.md}` },
|
|
141
|
+
lg: {
|
|
142
|
+
padding: `${tokenVars.spacing.md} ${tokenVars.spacing.lg}`,
|
|
143
|
+
fontSize: tokenVars.fontSize.lg,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
variant: {
|
|
147
|
+
solid: {
|
|
148
|
+
backgroundColor: intentVars.solidBg,
|
|
149
|
+
borderColor: intentVars.border,
|
|
150
|
+
color: intentVars.solidFg,
|
|
151
|
+
selectors: {
|
|
152
|
+
"&:hover:not(:disabled)": {
|
|
153
|
+
backgroundColor: intentVars.solidHoverBg,
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
soft: {
|
|
158
|
+
backgroundColor: `color-mix(in srgb, ${intentVars.softBg} 30%, transparent)`,
|
|
159
|
+
color: intentVars.solidBg,
|
|
160
|
+
borderColor: "transparent",
|
|
161
|
+
selectors: {
|
|
162
|
+
"&:hover:not(:disabled)": {
|
|
163
|
+
backgroundColor: `color-mix(in srgb, ${intentVars.solidHoverBg} 20%, transparent)`,
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
outline: {
|
|
168
|
+
backgroundColor: "transparent",
|
|
169
|
+
borderColor: intentVars.border,
|
|
170
|
+
color: intentVars.fg,
|
|
171
|
+
selectors: {
|
|
172
|
+
"&:hover:not(:disabled)": {
|
|
173
|
+
backgroundColor: `color-mix(in srgb, ${intentVars.solidBg} 10%, transparent)`,
|
|
174
|
+
borderColor: intentVars.border,
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
ghost: {
|
|
179
|
+
backgroundColor: "transparent",
|
|
180
|
+
borderColor: "transparent",
|
|
181
|
+
color: intentVars.fg,
|
|
182
|
+
selectors: {
|
|
183
|
+
"&:hover:not(:disabled)": {
|
|
184
|
+
backgroundColor: `color-mix(in srgb, ${intentVars.solidBg} 12%, transparent)`,
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
link: {
|
|
189
|
+
backgroundColor: "transparent",
|
|
190
|
+
borderColor: "transparent",
|
|
191
|
+
color: intentVars.fg,
|
|
192
|
+
selectors: {
|
|
193
|
+
"&:hover:not(:disabled)": {
|
|
194
|
+
textDecoration: "underline",
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { Spinner } from "../Spinner/spinner";
|
|
4
|
+
import { variant as variantRecipe } from "./button.css";
|
|
5
|
+
import type { RecipeVariants } from "@vanilla-extract/recipes";
|
|
6
|
+
import type { BaseSprinkles } from "../../utils/sprinkles.css";
|
|
7
|
+
import { applyBaseSprinkles } from "../../utils/ve-style.utils";
|
|
8
|
+
|
|
9
|
+
type ButtonVariants = RecipeVariants<typeof variantRecipe>;
|
|
10
|
+
|
|
11
|
+
type ButtonProps = ButtonPrimitive.Props &
|
|
12
|
+
BaseSprinkles &
|
|
13
|
+
ButtonVariants & {
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
fullWidth?: boolean;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
function Button({
|
|
20
|
+
children,
|
|
21
|
+
variant = "solid",
|
|
22
|
+
intent,
|
|
23
|
+
size = "sm",
|
|
24
|
+
disabled: disabledProp,
|
|
25
|
+
loading,
|
|
26
|
+
className,
|
|
27
|
+
...props
|
|
28
|
+
}: ButtonProps) {
|
|
29
|
+
const isDisabled = Boolean(loading || disabledProp);
|
|
30
|
+
const resolvedVariant = intent === "mono" ? "soft" : variant;
|
|
31
|
+
const [boxProps, restProps] = applyBaseSprinkles(props);
|
|
32
|
+
const rootCls = clsx(
|
|
33
|
+
boxProps,
|
|
34
|
+
variantRecipe({ variant: resolvedVariant, intent: intent ?? "primary", size }),
|
|
35
|
+
className,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<ButtonPrimitive
|
|
40
|
+
className={rootCls}
|
|
41
|
+
aria-disabled={loading || undefined}
|
|
42
|
+
data-loading={loading ? "" : undefined}
|
|
43
|
+
data-slot="button"
|
|
44
|
+
nativeButton={!props.render}
|
|
45
|
+
disabled={isDisabled}
|
|
46
|
+
{...restProps}
|
|
47
|
+
>
|
|
48
|
+
{loading && <Spinner data-slot="button-loading-indicator" />}
|
|
49
|
+
{children}
|
|
50
|
+
</ButtonPrimitive>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { Button };
|
|
55
|
+
export type { ButtonProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./button";
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { style } from "@vanilla-extract/css";
|
|
2
|
+
import { semanticVars, tokenVars } from "@blenx-dev/theme/contract";
|
|
3
|
+
|
|
4
|
+
export const root = style({
|
|
5
|
+
display: "inline-block",
|
|
6
|
+
width: "100%",
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const months = style({
|
|
10
|
+
display: "flex",
|
|
11
|
+
flexDirection: "column",
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const monthCaption = style({
|
|
15
|
+
display: "flex",
|
|
16
|
+
alignItems: "center",
|
|
17
|
+
justifyContent: "center",
|
|
18
|
+
position: "relative",
|
|
19
|
+
paddingBottom: tokenVars.spacing.sm,
|
|
20
|
+
minHeight: 40,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const captionLabel = style({
|
|
24
|
+
fontSize: tokenVars.fontSize.md,
|
|
25
|
+
fontWeight: tokenVars.fontWeight.semibold,
|
|
26
|
+
color: semanticVars.text.primary,
|
|
27
|
+
margin: 0,
|
|
28
|
+
padding: 0,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const nav = style({
|
|
32
|
+
height: "fit-content",
|
|
33
|
+
display: "flex",
|
|
34
|
+
justifyContent: "space-between",
|
|
35
|
+
alignItems: "center",
|
|
36
|
+
position: "absolute",
|
|
37
|
+
inset: 0,
|
|
38
|
+
padding: tokenVars.spacing.xs,
|
|
39
|
+
pointerEvents: "none",
|
|
40
|
+
zIndex: 10,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const buttonNav = style({
|
|
44
|
+
pointerEvents: "auto",
|
|
45
|
+
appearance: "none",
|
|
46
|
+
backgroundColor: "transparent",
|
|
47
|
+
border: "none",
|
|
48
|
+
padding: 0,
|
|
49
|
+
font: "inherit",
|
|
50
|
+
WebkitTapHighlightColor: "transparent",
|
|
51
|
+
width: 28,
|
|
52
|
+
height: 28,
|
|
53
|
+
borderRadius: tokenVars.borderRadius.default,
|
|
54
|
+
display: "flex",
|
|
55
|
+
alignItems: "center",
|
|
56
|
+
justifyContent: "center",
|
|
57
|
+
color: semanticVars.text.secondary,
|
|
58
|
+
cursor: "pointer",
|
|
59
|
+
flexShrink: 0,
|
|
60
|
+
selectors: {
|
|
61
|
+
"&:hover": {
|
|
62
|
+
backgroundColor: semanticVars.background.subtle,
|
|
63
|
+
},
|
|
64
|
+
"&:focus-visible": {
|
|
65
|
+
boxShadow: `0 0 0 2px ${semanticVars.focus.ring}`,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export const monthGrid = style({
|
|
71
|
+
width: "100%",
|
|
72
|
+
borderCollapse: "collapse",
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export const weekday = style({
|
|
76
|
+
fontSize: tokenVars.fontSize.xs,
|
|
77
|
+
fontWeight: tokenVars.fontWeight.medium,
|
|
78
|
+
color: semanticVars.text.secondary,
|
|
79
|
+
textAlign: "center",
|
|
80
|
+
verticalAlign: "middle",
|
|
81
|
+
padding: tokenVars.spacing.xxs,
|
|
82
|
+
width: 40,
|
|
83
|
+
height: 32,
|
|
84
|
+
boxSizing: "border-box",
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export const day = style({
|
|
88
|
+
textAlign: "center",
|
|
89
|
+
verticalAlign: "middle",
|
|
90
|
+
padding: 1,
|
|
91
|
+
width: 40,
|
|
92
|
+
height: 40,
|
|
93
|
+
boxSizing: "border-box",
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export const dayButton = style({
|
|
97
|
+
display: "flex",
|
|
98
|
+
alignItems: "center",
|
|
99
|
+
justifyContent: "center",
|
|
100
|
+
width: "100%",
|
|
101
|
+
height: "100%",
|
|
102
|
+
minWidth: 32,
|
|
103
|
+
minHeight: 32,
|
|
104
|
+
maxWidth: 36,
|
|
105
|
+
maxHeight: 36,
|
|
106
|
+
borderRadius: tokenVars.borderRadius.default,
|
|
107
|
+
border: "none",
|
|
108
|
+
backgroundColor: "transparent",
|
|
109
|
+
cursor: "pointer",
|
|
110
|
+
fontSize: tokenVars.fontSize.sm,
|
|
111
|
+
color: semanticVars.text.primary,
|
|
112
|
+
outline: "none",
|
|
113
|
+
margin: "0 auto",
|
|
114
|
+
padding: 0,
|
|
115
|
+
fontFamily: "inherit",
|
|
116
|
+
lineHeight: 1,
|
|
117
|
+
transitionProperty: "background-color, color",
|
|
118
|
+
transitionDuration: "100ms",
|
|
119
|
+
transitionTimingFunction: "ease",
|
|
120
|
+
selectors: {
|
|
121
|
+
"&:hover": {
|
|
122
|
+
backgroundColor: semanticVars.background.subtle,
|
|
123
|
+
},
|
|
124
|
+
"&:focus-visible": {
|
|
125
|
+
boxShadow: `0 0 0 2px ${semanticVars.focus.ring}`,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
export const dayButtonSelected = style({
|
|
131
|
+
backgroundColor: semanticVars.interactive.primary.default,
|
|
132
|
+
color: semanticVars.interactive.primaryFg,
|
|
133
|
+
fontWeight: tokenVars.fontWeight.semibold,
|
|
134
|
+
selectors: {
|
|
135
|
+
"&:hover": {
|
|
136
|
+
backgroundColor: semanticVars.interactive.primary.default,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
export const dayButtonToday = style({
|
|
142
|
+
fontWeight: tokenVars.fontWeight.semibold,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
export const dayButtonDisabled = style({
|
|
146
|
+
color: semanticVars.text.disabled,
|
|
147
|
+
cursor: "not-allowed",
|
|
148
|
+
opacity: 0.5,
|
|
149
|
+
selectors: {
|
|
150
|
+
"&:hover": {
|
|
151
|
+
backgroundColor: "transparent",
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
export const dayButtonOutside = style({
|
|
157
|
+
color: semanticVars.text.disabled,
|
|
158
|
+
opacity: 0.5,
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
export const footer = style({
|
|
162
|
+
paddingTop: tokenVars.spacing.sm,
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
export const dropdowns = style({
|
|
166
|
+
display: "flex",
|
|
167
|
+
gap: tokenVars.spacing.xs,
|
|
168
|
+
alignItems: "center",
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
export const dropdown = style({
|
|
172
|
+
appearance: "none",
|
|
173
|
+
backgroundColor: semanticVars.background.subtle,
|
|
174
|
+
border: `1px solid ${semanticVars.border.default}`,
|
|
175
|
+
borderRadius: tokenVars.borderRadius.default,
|
|
176
|
+
color: semanticVars.text.primary,
|
|
177
|
+
fontSize: tokenVars.fontSize.sm,
|
|
178
|
+
padding: `${tokenVars.spacing.xxs} ${tokenVars.spacing.sm}`,
|
|
179
|
+
cursor: "pointer",
|
|
180
|
+
outline: "none",
|
|
181
|
+
selectors: {
|
|
182
|
+
"&:focus-visible": {
|
|
183
|
+
borderColor: semanticVars.border.strong,
|
|
184
|
+
boxShadow: `0 0 0 2px ${semanticVars.border.strong}`,
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
});
|