@zicas/ui 0.0.0-stage → 0.1.0-beta.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/LICENSE +21 -0
- package/README.md +76 -2
- package/dist/accordion.d.ts +23 -0
- package/dist/accordion.js +105 -0
- package/dist/alert.d.ts +16 -0
- package/dist/alert.js +50 -0
- package/dist/avatar.d.ts +14 -0
- package/dist/avatar.js +53 -0
- package/dist/badge.d.ts +11 -0
- package/dist/badge.js +46 -0
- package/dist/breadcrumb.d.ts +26 -0
- package/dist/breadcrumb.js +92 -0
- package/dist/button.d.ts +17 -0
- package/dist/button.js +174 -0
- package/dist/card.d.ts +24 -0
- package/dist/card.js +81 -0
- package/dist/checkbox.d.ts +9 -0
- package/dist/checkbox.js +91 -0
- package/dist/dialog.d.ts +39 -0
- package/dist/dialog.js +195 -0
- package/dist/direction.d.ts +17 -0
- package/dist/direction.js +93 -0
- package/dist/dropdown-menu.d.ts +39 -0
- package/dist/dropdown-menu.js +189 -0
- package/dist/field.d.ts +24 -0
- package/dist/field.js +59 -0
- package/dist/icon-button.d.ts +15 -0
- package/dist/icon-button.js +50 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +36 -0
- package/dist/inline.d.ts +12 -0
- package/dist/inline.js +25 -0
- package/dist/input.d.ts +9 -0
- package/dist/input.js +54 -0
- package/dist/navbar.d.ts +44 -0
- package/dist/navbar.js +258 -0
- package/dist/popover.d.ts +36 -0
- package/dist/popover.js +148 -0
- package/dist/progress.d.ts +23 -0
- package/dist/progress.js +67 -0
- package/dist/radio.d.ts +15 -0
- package/dist/radio.js +93 -0
- package/dist/scroll-area.d.ts +21 -0
- package/dist/scroll-area.js +120 -0
- package/dist/select.d.ts +37 -0
- package/dist/select.js +260 -0
- package/dist/semantic-colors.stylex.d.ts +22 -0
- package/dist/semantic-colors.stylex.js +23 -0
- package/dist/separator.d.ts +9 -0
- package/dist/separator.js +26 -0
- package/dist/skeleton.d.ts +6 -0
- package/dist/skeleton.js +18 -0
- package/dist/stack.d.ts +11 -0
- package/dist/stack.js +24 -0
- package/dist/surface.d.ts +9 -0
- package/dist/surface.js +18 -0
- package/dist/switch.d.ts +9 -0
- package/dist/switch.js +73 -0
- package/dist/table.d.ts +34 -0
- package/dist/table.js +84 -0
- package/dist/tabs.d.ts +19 -0
- package/dist/tabs.js +115 -0
- package/dist/text.d.ts +14 -0
- package/dist/text.js +31 -0
- package/dist/textarea.d.ts +8 -0
- package/dist/textarea.js +70 -0
- package/dist/theme-root.d.ts +9 -0
- package/dist/theme-root.js +61 -0
- package/dist/theme-types.d.ts +16 -0
- package/dist/theme-types.js +0 -0
- package/dist/themes/atelier-theme.d.ts +2 -0
- package/dist/themes/atelier-theme.js +3 -0
- package/dist/themes/compact-theme.d.ts +2 -0
- package/dist/themes/compact-theme.js +3 -0
- package/dist/themes/compose-theme.d.ts +27 -0
- package/dist/themes/compose-theme.js +82 -0
- package/dist/themes/fragments/borders.d.ts +34 -0
- package/dist/themes/fragments/borders.js +19 -0
- package/dist/themes/fragments/density.d.ts +58 -0
- package/dist/themes/fragments/density.js +31 -0
- package/dist/themes/fragments/elevation.d.ts +34 -0
- package/dist/themes/fragments/elevation.js +19 -0
- package/dist/themes/fragments/font-family.d.ts +16 -0
- package/dist/themes/fragments/font-family.js +9 -0
- package/dist/themes/fragments/line-height.d.ts +24 -0
- package/dist/themes/fragments/line-height.js +13 -0
- package/dist/themes/fragments/motion.d.ts +40 -0
- package/dist/themes/fragments/motion.js +21 -0
- package/dist/themes/fragments/radius.d.ts +60 -0
- package/dist/themes/fragments/radius.js +13 -0
- package/dist/themes/fragments/semantic-colors.d.ts +151 -0
- package/dist/themes/fragments/semantic-colors.js +68 -0
- package/dist/themes/fragments/type-scale.d.ts +36 -0
- package/dist/themes/fragments/type-scale.js +16 -0
- package/dist/themes/nitro-theme.d.ts +2 -0
- package/dist/themes/nitro-theme.js +3 -0
- package/dist/token-types.d.ts +1 -0
- package/dist/token-types.js +0 -0
- package/dist/tokens.stylex.d.ts +59 -0
- package/dist/tokens.stylex.js +61 -0
- package/dist/tooltip.d.ts +23 -0
- package/dist/tooltip.js +89 -0
- package/package.json +42 -4
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
import type { StyleXStyles } from "@stylexjs/stylex";
|
|
3
|
+
type NativeSurfaceProps = Omit<ComponentPropsWithoutRef<"div">, "children" | "className" | "style">;
|
|
4
|
+
export type SurfaceProps = NativeSurfaceProps & {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
xstyle?: StyleXStyles;
|
|
7
|
+
};
|
|
8
|
+
export declare function Surface({ children, xstyle, ...props }: SurfaceProps): import("react").JSX.Element;
|
|
9
|
+
export {};
|
package/dist/surface.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { colors } from "./semantic-colors.stylex.js";
|
|
2
|
+
import { radii, spacing } from "./tokens.stylex.js";
|
|
3
|
+
import * as stylex from "@stylexjs/stylex";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
var styles = stylex.create({ root: {
|
|
6
|
+
backgroundColor: colors.surface,
|
|
7
|
+
color: colors.surfaceForeground,
|
|
8
|
+
borderRadius: radii.md,
|
|
9
|
+
padding: spacing[4]
|
|
10
|
+
} });
|
|
11
|
+
function Surface({ children, xstyle, ...props }) {
|
|
12
|
+
return jsx("div", {
|
|
13
|
+
...props,
|
|
14
|
+
...stylex.props(styles.root, xstyle),
|
|
15
|
+
children
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export { Surface };
|
package/dist/switch.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import { Switch as BaseUISwitch } from "@base-ui/react/switch";
|
|
3
|
+
import type { StyleXStyles } from "@stylexjs/stylex";
|
|
4
|
+
type NativeSwitchProps = Omit<ComponentPropsWithoutRef<typeof BaseUISwitch.Root>, "children" | "className" | "style">;
|
|
5
|
+
export type SwitchProps = NativeSwitchProps & {
|
|
6
|
+
xstyle?: StyleXStyles;
|
|
7
|
+
};
|
|
8
|
+
export declare function Switch({ xstyle, ...props }: SwitchProps): import("react").JSX.Element;
|
|
9
|
+
export {};
|
package/dist/switch.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { colors } from "./semantic-colors.stylex.js";
|
|
2
|
+
import { borders, motion, radii } from "./tokens.stylex.js";
|
|
3
|
+
import * as stylex from "@stylexjs/stylex";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Switch as Switch$1 } from "@base-ui/react/switch";
|
|
6
|
+
var styles = stylex.create({
|
|
7
|
+
root: {
|
|
8
|
+
display: "inline-flex",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
verticalAlign: "middle",
|
|
11
|
+
flexShrink: 0,
|
|
12
|
+
width: "2.75rem",
|
|
13
|
+
height: "1.5rem",
|
|
14
|
+
padding: "0.1875rem",
|
|
15
|
+
borderWidth: borders.control,
|
|
16
|
+
borderStyle: "solid",
|
|
17
|
+
borderColor: colors.border,
|
|
18
|
+
borderRadius: radii.full,
|
|
19
|
+
cursor: "pointer",
|
|
20
|
+
outlineStyle: "solid",
|
|
21
|
+
outlineWidth: "2px",
|
|
22
|
+
outlineOffset: "2px",
|
|
23
|
+
outlineColor: {
|
|
24
|
+
default: "transparent",
|
|
25
|
+
":focus-visible": colors.focus
|
|
26
|
+
},
|
|
27
|
+
transitionProperty: "background-color, opacity, outline-color",
|
|
28
|
+
transitionDuration: {
|
|
29
|
+
default: motion.fast,
|
|
30
|
+
"@media (prefers-reduced-motion: reduce)": "0ms"
|
|
31
|
+
},
|
|
32
|
+
transitionTimingFunction: motion.standard
|
|
33
|
+
},
|
|
34
|
+
unchecked: {
|
|
35
|
+
justifyContent: "flex-start",
|
|
36
|
+
backgroundColor: {
|
|
37
|
+
default: colors.muted,
|
|
38
|
+
":hover": colors.mutedHover,
|
|
39
|
+
":active": colors.mutedActive
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
checked: {
|
|
43
|
+
justifyContent: "flex-end",
|
|
44
|
+
backgroundColor: {
|
|
45
|
+
default: colors.primary,
|
|
46
|
+
":hover": colors.primaryHover,
|
|
47
|
+
":active": colors.primaryActive
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
disabled: {
|
|
51
|
+
cursor: "not-allowed",
|
|
52
|
+
opacity: .5
|
|
53
|
+
},
|
|
54
|
+
thumb: {
|
|
55
|
+
display: "block",
|
|
56
|
+
width: "1.125rem",
|
|
57
|
+
height: "1.125rem",
|
|
58
|
+
borderRadius: radii.full,
|
|
59
|
+
backgroundColor: colors.onPrimary
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
function getRootStyles(checked, disabled, xstyle) {
|
|
63
|
+
return stylex.props(styles.root, checked ? styles.checked : styles.unchecked, disabled && styles.disabled, xstyle);
|
|
64
|
+
}
|
|
65
|
+
function Switch({ xstyle, ...props }) {
|
|
66
|
+
return jsx(Switch$1.Root, {
|
|
67
|
+
...props,
|
|
68
|
+
className: (state) => getRootStyles(state.checked, state.disabled, xstyle).className,
|
|
69
|
+
style: (state) => getRootStyles(state.checked, state.disabled, xstyle).style,
|
|
70
|
+
children: jsx(Switch$1.Thumb, { ...stylex.props(styles.thumb) })
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
export { Switch };
|
package/dist/table.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import type { StyleXStyles } from "@stylexjs/stylex";
|
|
3
|
+
export type TableProps = Omit<ComponentPropsWithoutRef<"table">, "className" | "style"> & {
|
|
4
|
+
xstyle?: StyleXStyles;
|
|
5
|
+
};
|
|
6
|
+
export type TableCaptionProps = Omit<ComponentPropsWithoutRef<"caption">, "className" | "style"> & {
|
|
7
|
+
xstyle?: StyleXStyles;
|
|
8
|
+
};
|
|
9
|
+
export type TableHeadProps = Omit<ComponentPropsWithoutRef<"thead">, "className" | "style"> & {
|
|
10
|
+
xstyle?: StyleXStyles;
|
|
11
|
+
};
|
|
12
|
+
export type TableBodyProps = Omit<ComponentPropsWithoutRef<"tbody">, "className" | "style"> & {
|
|
13
|
+
xstyle?: StyleXStyles;
|
|
14
|
+
};
|
|
15
|
+
export type TableFootProps = Omit<ComponentPropsWithoutRef<"tfoot">, "className" | "style"> & {
|
|
16
|
+
xstyle?: StyleXStyles;
|
|
17
|
+
};
|
|
18
|
+
export type TableRowProps = Omit<ComponentPropsWithoutRef<"tr">, "className" | "style"> & {
|
|
19
|
+
xstyle?: StyleXStyles;
|
|
20
|
+
};
|
|
21
|
+
export type TableHeaderProps = Omit<ComponentPropsWithoutRef<"th">, "className" | "style"> & {
|
|
22
|
+
xstyle?: StyleXStyles;
|
|
23
|
+
};
|
|
24
|
+
export type TableCellProps = Omit<ComponentPropsWithoutRef<"td">, "className" | "style"> & {
|
|
25
|
+
xstyle?: StyleXStyles;
|
|
26
|
+
};
|
|
27
|
+
export declare function Table({ xstyle, ...props }: TableProps): import("react").JSX.Element;
|
|
28
|
+
export declare function TableCaption({ xstyle, ...props }: TableCaptionProps): import("react").JSX.Element;
|
|
29
|
+
export declare function TableHead({ xstyle, ...props }: TableHeadProps): import("react").JSX.Element;
|
|
30
|
+
export declare function TableBody({ xstyle, ...props }: TableBodyProps): import("react").JSX.Element;
|
|
31
|
+
export declare function TableFoot({ xstyle, ...props }: TableFootProps): import("react").JSX.Element;
|
|
32
|
+
export declare function TableRow({ xstyle, ...props }: TableRowProps): import("react").JSX.Element;
|
|
33
|
+
export declare function TableHeader({ xstyle, ...props }: TableHeaderProps): import("react").JSX.Element;
|
|
34
|
+
export declare function TableCell({ xstyle, ...props }: TableCellProps): import("react").JSX.Element;
|
package/dist/table.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { colors } from "./semantic-colors.stylex.js";
|
|
2
|
+
import { fontSizes, fontWeights, lineHeights, spacing, typography } from "./tokens.stylex.js";
|
|
3
|
+
import * as stylex from "@stylexjs/stylex";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
var styles = stylex.create({
|
|
6
|
+
root: {
|
|
7
|
+
inlineSize: "100%",
|
|
8
|
+
borderCollapse: "collapse",
|
|
9
|
+
color: colors.foreground,
|
|
10
|
+
fontFamily: typography.fontFamily,
|
|
11
|
+
fontSize: fontSizes.sm,
|
|
12
|
+
lineHeight: lineHeights.normal
|
|
13
|
+
},
|
|
14
|
+
caption: {
|
|
15
|
+
captionSide: "bottom",
|
|
16
|
+
paddingBlock: spacing[3],
|
|
17
|
+
paddingInline: spacing[3],
|
|
18
|
+
color: colors.mutedForeground,
|
|
19
|
+
textAlign: "start"
|
|
20
|
+
},
|
|
21
|
+
head: { color: colors.mutedForeground },
|
|
22
|
+
foot: { fontWeight: fontWeights.medium },
|
|
23
|
+
row: {
|
|
24
|
+
borderBlockEndWidth: "1px",
|
|
25
|
+
borderBlockEndStyle: "solid",
|
|
26
|
+
borderBlockEndColor: colors.border
|
|
27
|
+
},
|
|
28
|
+
cell: {
|
|
29
|
+
paddingBlock: spacing[3],
|
|
30
|
+
paddingInline: spacing[3],
|
|
31
|
+
textAlign: "start",
|
|
32
|
+
verticalAlign: "middle"
|
|
33
|
+
},
|
|
34
|
+
header: { fontWeight: fontWeights.medium }
|
|
35
|
+
});
|
|
36
|
+
function Table({ xstyle, ...props }) {
|
|
37
|
+
return jsx("table", {
|
|
38
|
+
...props,
|
|
39
|
+
...stylex.props(styles.root, xstyle)
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function TableCaption({ xstyle, ...props }) {
|
|
43
|
+
return jsx("caption", {
|
|
44
|
+
...props,
|
|
45
|
+
...stylex.props(styles.caption, xstyle)
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function TableHead({ xstyle, ...props }) {
|
|
49
|
+
return jsx("thead", {
|
|
50
|
+
...props,
|
|
51
|
+
...stylex.props(styles.head, xstyle)
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function TableBody({ xstyle, ...props }) {
|
|
55
|
+
return jsx("tbody", {
|
|
56
|
+
...props,
|
|
57
|
+
...stylex.props(xstyle)
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function TableFoot({ xstyle, ...props }) {
|
|
61
|
+
return jsx("tfoot", {
|
|
62
|
+
...props,
|
|
63
|
+
...stylex.props(styles.foot, xstyle)
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function TableRow({ xstyle, ...props }) {
|
|
67
|
+
return jsx("tr", {
|
|
68
|
+
...props,
|
|
69
|
+
...stylex.props(styles.row, xstyle)
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function TableHeader({ xstyle, ...props }) {
|
|
73
|
+
return jsx("th", {
|
|
74
|
+
...props,
|
|
75
|
+
...stylex.props(styles.cell, styles.header, xstyle)
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function TableCell({ xstyle, ...props }) {
|
|
79
|
+
return jsx("td", {
|
|
80
|
+
...props,
|
|
81
|
+
...stylex.props(styles.cell, xstyle)
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export { Table, TableBody, TableCaption, TableCell, TableFoot, TableHead, TableHeader, TableRow };
|
package/dist/tabs.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import { Tabs as BaseUITabs } from "@base-ui/react/tabs";
|
|
3
|
+
import type { StyleXStyles } from "@stylexjs/stylex";
|
|
4
|
+
export type TabsProps = Omit<ComponentPropsWithoutRef<typeof BaseUITabs.Root>, "className" | "style"> & {
|
|
5
|
+
xstyle?: StyleXStyles;
|
|
6
|
+
};
|
|
7
|
+
export type TabsListProps = Omit<ComponentPropsWithoutRef<typeof BaseUITabs.List>, "className" | "style"> & {
|
|
8
|
+
xstyle?: StyleXStyles;
|
|
9
|
+
};
|
|
10
|
+
export type TabsTabProps = Omit<ComponentPropsWithoutRef<typeof BaseUITabs.Tab>, "className" | "style"> & {
|
|
11
|
+
xstyle?: StyleXStyles;
|
|
12
|
+
};
|
|
13
|
+
export type TabsPanelProps = Omit<ComponentPropsWithoutRef<typeof BaseUITabs.Panel>, "className" | "style"> & {
|
|
14
|
+
xstyle?: StyleXStyles;
|
|
15
|
+
};
|
|
16
|
+
export declare function Tabs({ orientation, xstyle, ...props }: TabsProps): import("react").JSX.Element;
|
|
17
|
+
export declare function TabsList({ xstyle, ...props }: TabsListProps): import("react").JSX.Element;
|
|
18
|
+
export declare function TabsTab({ xstyle, ...props }: TabsTabProps): import("react").JSX.Element;
|
|
19
|
+
export declare function TabsPanel({ xstyle, ...props }: TabsPanelProps): import("react").JSX.Element;
|
package/dist/tabs.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { colors } from "./semantic-colors.stylex.js";
|
|
2
|
+
import { controlSizes, fontSizes, fontWeights, lineHeights, radii, spacing, typography } from "./tokens.stylex.js";
|
|
3
|
+
import { ElementDirectionProvider, useElementDirection } from "./direction.js";
|
|
4
|
+
import * as stylex from "@stylexjs/stylex";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
8
|
+
var styles = stylex.create({
|
|
9
|
+
root: {
|
|
10
|
+
display: "flex",
|
|
11
|
+
flexDirection: "column",
|
|
12
|
+
gap: spacing[3],
|
|
13
|
+
minInlineSize: 0,
|
|
14
|
+
color: colors.foreground,
|
|
15
|
+
fontFamily: typography.fontFamily,
|
|
16
|
+
fontSize: fontSizes.sm,
|
|
17
|
+
lineHeight: lineHeights.normal
|
|
18
|
+
},
|
|
19
|
+
verticalRoot: { flexDirection: "row" },
|
|
20
|
+
list: {
|
|
21
|
+
display: "flex",
|
|
22
|
+
flexDirection: "row",
|
|
23
|
+
alignSelf: "flex-start",
|
|
24
|
+
gap: spacing[1],
|
|
25
|
+
maxInlineSize: "100%",
|
|
26
|
+
padding: spacing[1],
|
|
27
|
+
borderRadius: radii.md,
|
|
28
|
+
backgroundColor: colors.muted,
|
|
29
|
+
overflowX: "auto"
|
|
30
|
+
},
|
|
31
|
+
verticalList: {
|
|
32
|
+
flexDirection: "column",
|
|
33
|
+
flexShrink: 0
|
|
34
|
+
},
|
|
35
|
+
tab: {
|
|
36
|
+
display: "inline-flex",
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
justifyContent: "center",
|
|
39
|
+
flexShrink: 0,
|
|
40
|
+
minBlockSize: controlSizes.sm,
|
|
41
|
+
paddingBlock: spacing[2],
|
|
42
|
+
paddingInline: spacing[3],
|
|
43
|
+
borderWidth: 0,
|
|
44
|
+
borderRadius: radii.sm,
|
|
45
|
+
fontFamily: "inherit",
|
|
46
|
+
fontSize: "inherit",
|
|
47
|
+
lineHeight: "inherit",
|
|
48
|
+
fontWeight: fontWeights.medium,
|
|
49
|
+
cursor: "pointer"
|
|
50
|
+
},
|
|
51
|
+
inactive: {
|
|
52
|
+
backgroundColor: {
|
|
53
|
+
default: "transparent",
|
|
54
|
+
":hover": colors.mutedHover
|
|
55
|
+
},
|
|
56
|
+
color: colors.foreground
|
|
57
|
+
},
|
|
58
|
+
active: {
|
|
59
|
+
backgroundColor: colors.primary,
|
|
60
|
+
color: colors.onPrimary
|
|
61
|
+
},
|
|
62
|
+
disabled: {
|
|
63
|
+
cursor: "not-allowed",
|
|
64
|
+
opacity: .5
|
|
65
|
+
},
|
|
66
|
+
panel: {
|
|
67
|
+
minInlineSize: 0,
|
|
68
|
+
flex: 1,
|
|
69
|
+
borderRadius: radii.sm
|
|
70
|
+
},
|
|
71
|
+
focus: {
|
|
72
|
+
outlineStyle: "solid",
|
|
73
|
+
outlineWidth: "2px",
|
|
74
|
+
outlineOffset: "2px",
|
|
75
|
+
outlineColor: {
|
|
76
|
+
default: "transparent",
|
|
77
|
+
":focus-visible": colors.focus
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
function Tabs({ orientation = "horizontal", xstyle, ...props }) {
|
|
82
|
+
const [root, setRoot] = useState(null);
|
|
83
|
+
const [direction] = useElementDirection(root);
|
|
84
|
+
return jsx(ElementDirectionProvider, {
|
|
85
|
+
direction,
|
|
86
|
+
children: jsx(Tabs$1.Root, {
|
|
87
|
+
...props,
|
|
88
|
+
orientation,
|
|
89
|
+
ref: setRoot,
|
|
90
|
+
...stylex.props(styles.root, orientation === "vertical" && styles.verticalRoot, xstyle)
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function TabsList({ xstyle, ...props }) {
|
|
95
|
+
return jsx(Tabs$1.List, {
|
|
96
|
+
...props,
|
|
97
|
+
className: (state) => stylex.props(styles.list, state.orientation === "vertical" && styles.verticalList, xstyle).className,
|
|
98
|
+
style: (state) => stylex.props(styles.list, state.orientation === "vertical" && styles.verticalList, xstyle).style
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function TabsTab({ xstyle, ...props }) {
|
|
102
|
+
const getStyles = (state) => stylex.props(styles.tab, styles.focus, state.active ? styles.active : styles.inactive, state.disabled && styles.disabled, xstyle);
|
|
103
|
+
return jsx(Tabs$1.Tab, {
|
|
104
|
+
...props,
|
|
105
|
+
className: (state) => getStyles(state).className,
|
|
106
|
+
style: (state) => getStyles(state).style
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function TabsPanel({ xstyle, ...props }) {
|
|
110
|
+
return jsx(Tabs$1.Panel, {
|
|
111
|
+
...props,
|
|
112
|
+
...stylex.props(styles.panel, styles.focus, xstyle)
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
export { Tabs, TabsList, TabsPanel, TabsTab };
|
package/dist/text.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode, ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import type { StyleXStyles } from "@stylexjs/stylex";
|
|
3
|
+
type NativeTextProps = Omit<ComponentPropsWithoutRef<"span">, "children" | "className" | "style">;
|
|
4
|
+
export type TextSize = "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
5
|
+
export type TextWeight = "regular" | "medium" | "semibold" | "bold";
|
|
6
|
+
export type TextProps = NativeTextProps & {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
as?: "span" | "p";
|
|
9
|
+
size?: TextSize;
|
|
10
|
+
weight?: TextWeight;
|
|
11
|
+
xstyle?: StyleXStyles;
|
|
12
|
+
};
|
|
13
|
+
export declare function Text({ children, as: Component, size, weight, xstyle, ...props }: TextProps): import("react").JSX.Element;
|
|
14
|
+
export {};
|
package/dist/text.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { colors } from "./semantic-colors.stylex.js";
|
|
2
|
+
import { fontSizes, fontWeights, lineHeights } from "./tokens.stylex.js";
|
|
3
|
+
import * as stylex from "@stylexjs/stylex";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
var styles = stylex.create({ base: {
|
|
6
|
+
color: colors.foreground,
|
|
7
|
+
lineHeight: lineHeights.normal,
|
|
8
|
+
margin: 0
|
|
9
|
+
} });
|
|
10
|
+
var sizeStyles = stylex.create({
|
|
11
|
+
xs: { fontSize: fontSizes.xs },
|
|
12
|
+
sm: { fontSize: fontSizes.sm },
|
|
13
|
+
md: { fontSize: fontSizes.md },
|
|
14
|
+
lg: { fontSize: fontSizes.lg },
|
|
15
|
+
xl: { fontSize: fontSizes.xl },
|
|
16
|
+
"2xl": { fontSize: fontSizes["2xl"] }
|
|
17
|
+
});
|
|
18
|
+
var weightStyles = stylex.create({
|
|
19
|
+
regular: { fontWeight: fontWeights.regular },
|
|
20
|
+
medium: { fontWeight: fontWeights.medium },
|
|
21
|
+
semibold: { fontWeight: fontWeights.semibold },
|
|
22
|
+
bold: { fontWeight: fontWeights.bold }
|
|
23
|
+
});
|
|
24
|
+
function Text({ children, as: Component = "span", size = "md", weight = "regular", xstyle, ...props }) {
|
|
25
|
+
return jsx(Component, {
|
|
26
|
+
...props,
|
|
27
|
+
...stylex.props(styles.base, sizeStyles[size], weightStyles[weight], xstyle),
|
|
28
|
+
children
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export { Text };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import type { StyleXStyles } from "@stylexjs/stylex";
|
|
3
|
+
type NativeTextareaProps = Omit<ComponentPropsWithoutRef<"textarea">, "children" | "className" | "style">;
|
|
4
|
+
export type TextareaProps = NativeTextareaProps & {
|
|
5
|
+
xstyle?: StyleXStyles;
|
|
6
|
+
};
|
|
7
|
+
export declare function Textarea({ xstyle, id, name, value, defaultValue, disabled, autoFocus, onChange, onFocus, onBlur, ...textareaProps }: TextareaProps): import("react").JSX.Element;
|
|
8
|
+
export {};
|
package/dist/textarea.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { colors } from "./semantic-colors.stylex.js";
|
|
2
|
+
import { borders, fontSizes, lineHeights, motion, radii, spacing, typography } from "./tokens.stylex.js";
|
|
3
|
+
import * as stylex from "@stylexjs/stylex";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Input } from "@base-ui/react/input";
|
|
6
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
7
|
+
var styles = stylex.create({ root: {
|
|
8
|
+
boxSizing: "border-box",
|
|
9
|
+
display: "block",
|
|
10
|
+
width: "100%",
|
|
11
|
+
minWidth: 0,
|
|
12
|
+
minHeight: "6rem",
|
|
13
|
+
paddingBlock: spacing[2],
|
|
14
|
+
paddingInline: spacing[3],
|
|
15
|
+
borderWidth: borders.control,
|
|
16
|
+
borderStyle: "solid",
|
|
17
|
+
borderColor: colors.border,
|
|
18
|
+
borderRadius: radii.md,
|
|
19
|
+
backgroundColor: colors.muted,
|
|
20
|
+
color: colors.foreground,
|
|
21
|
+
fontFamily: typography.fontFamily,
|
|
22
|
+
fontSize: fontSizes.md,
|
|
23
|
+
lineHeight: lineHeights.normal,
|
|
24
|
+
resize: "vertical",
|
|
25
|
+
outlineStyle: "solid",
|
|
26
|
+
outlineWidth: "2px",
|
|
27
|
+
outlineOffset: "2px",
|
|
28
|
+
outlineColor: {
|
|
29
|
+
default: "transparent",
|
|
30
|
+
":focus-visible": colors.focus
|
|
31
|
+
},
|
|
32
|
+
opacity: {
|
|
33
|
+
default: 1,
|
|
34
|
+
":disabled": .5
|
|
35
|
+
},
|
|
36
|
+
cursor: {
|
|
37
|
+
default: "text",
|
|
38
|
+
":disabled": "not-allowed"
|
|
39
|
+
},
|
|
40
|
+
transitionProperty: "background-color, color, opacity, outline-color",
|
|
41
|
+
transitionDuration: {
|
|
42
|
+
default: motion.fast,
|
|
43
|
+
"@media (prefers-reduced-motion: reduce)": "0ms"
|
|
44
|
+
},
|
|
45
|
+
transitionTimingFunction: motion.standard,
|
|
46
|
+
"::placeholder": {
|
|
47
|
+
color: colors.mutedForeground,
|
|
48
|
+
opacity: 1
|
|
49
|
+
}
|
|
50
|
+
} });
|
|
51
|
+
function Textarea({ xstyle, id, name, value, defaultValue, disabled, autoFocus, onChange, onFocus, onBlur, ...textareaProps }) {
|
|
52
|
+
const styleProps = stylex.props(styles.root, xstyle);
|
|
53
|
+
return jsx(Input, {
|
|
54
|
+
id,
|
|
55
|
+
name,
|
|
56
|
+
value,
|
|
57
|
+
defaultValue,
|
|
58
|
+
disabled,
|
|
59
|
+
autoFocus,
|
|
60
|
+
className: styleProps.className,
|
|
61
|
+
style: styleProps.style,
|
|
62
|
+
render: (baseProps) => jsx("textarea", { ...mergeProps(baseProps, {
|
|
63
|
+
...textareaProps,
|
|
64
|
+
onChange,
|
|
65
|
+
onFocus,
|
|
66
|
+
onBlur
|
|
67
|
+
}) })
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
export { Textarea };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { MyUITheme } from "./theme-types";
|
|
3
|
+
export type ThemeRootProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
colorScheme: "light" | "dark";
|
|
6
|
+
theme?: MyUITheme;
|
|
7
|
+
};
|
|
8
|
+
export declare function useThemePortalHost(): HTMLDivElement | null;
|
|
9
|
+
export declare function ThemeRoot({ children, colorScheme, theme }: ThemeRootProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { colors } from "./semantic-colors.stylex.js";
|
|
2
|
+
import { typography } from "./tokens.stylex.js";
|
|
3
|
+
import { ElementDirectionProvider, useElementDirection } from "./direction.js";
|
|
4
|
+
import * as stylex from "@stylexjs/stylex";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
7
|
+
var styles = stylex.create({
|
|
8
|
+
root: {
|
|
9
|
+
minHeight: "100svh",
|
|
10
|
+
backgroundColor: colors.background,
|
|
11
|
+
color: colors.foreground,
|
|
12
|
+
fontFamily: typography.fontFamily
|
|
13
|
+
},
|
|
14
|
+
light: { colorScheme: "light" },
|
|
15
|
+
dark: { colorScheme: "dark" },
|
|
16
|
+
portalHost: { display: "contents" },
|
|
17
|
+
colorScope: { display: "contents" }
|
|
18
|
+
});
|
|
19
|
+
var ThemePortalHostContext = createContext(null);
|
|
20
|
+
var ThemeRootBoundaryContext = createContext(false);
|
|
21
|
+
function useThemePortalHost() {
|
|
22
|
+
return useContext(ThemePortalHostContext);
|
|
23
|
+
}
|
|
24
|
+
function ThemeRoot({ children, colorScheme, theme }) {
|
|
25
|
+
const isNestedThemeRoot = useContext(ThemeRootBoundaryContext);
|
|
26
|
+
const [portalHost, setPortalHost] = useState(null);
|
|
27
|
+
const [root, setRoot] = useState(null);
|
|
28
|
+
const [direction] = useElementDirection(root);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (isNestedThemeRoot) return;
|
|
31
|
+
const root = document.documentElement;
|
|
32
|
+
const previousColorScheme = root.style.colorScheme;
|
|
33
|
+
root.style.colorScheme = colorScheme;
|
|
34
|
+
return () => {
|
|
35
|
+
root.style.colorScheme = previousColorScheme;
|
|
36
|
+
};
|
|
37
|
+
}, [colorScheme, isNestedThemeRoot]);
|
|
38
|
+
const hasColorOverrideScope = theme !== void 0 && Object.hasOwn(theme, "semanticColorOverrides");
|
|
39
|
+
const themedRoot = jsx("div", {
|
|
40
|
+
ref: setRoot,
|
|
41
|
+
...stylex.props(styles.root, !hasColorOverrideScope && theme?.colors, theme?.spacing, theme?.radii, theme?.typography, theme?.controlSizes, theme?.elevation, theme?.borders, theme?.fontSizes, theme?.lineHeights, theme?.motion, theme?.semanticColorOverrides, colorScheme === "light" ? styles.light : styles.dark),
|
|
42
|
+
children: jsx(ElementDirectionProvider, {
|
|
43
|
+
direction,
|
|
44
|
+
children: jsxs(ThemeRootBoundaryContext.Provider, {
|
|
45
|
+
value: true,
|
|
46
|
+
children: [jsx(ThemePortalHostContext.Provider, {
|
|
47
|
+
value: portalHost,
|
|
48
|
+
children
|
|
49
|
+
}), jsx("div", {
|
|
50
|
+
ref: setPortalHost,
|
|
51
|
+
...stylex.props(styles.portalHost)
|
|
52
|
+
})]
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
return hasColorOverrideScope ? jsx("div", {
|
|
57
|
+
...stylex.props(styles.colorScope, theme?.colors),
|
|
58
|
+
children: themedRoot
|
|
59
|
+
}) : themedRoot;
|
|
60
|
+
}
|
|
61
|
+
export { ThemeRoot, useThemePortalHost };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { StaticStyles, Theme } from "@stylexjs/stylex";
|
|
2
|
+
import { colors, radii, spacing, typography, controlSizes, elevation, borders, fontSizes, lineHeights, motion } from "./tokens.stylex";
|
|
3
|
+
export type SemanticColorOverrides = StaticStyles<Record<string, string>> & StaticStyles<Record<never, never>>;
|
|
4
|
+
export type MyUITheme = {
|
|
5
|
+
colors?: Theme<typeof colors>;
|
|
6
|
+
semanticColorOverrides?: SemanticColorOverrides;
|
|
7
|
+
radii?: Theme<typeof radii>;
|
|
8
|
+
spacing?: Theme<typeof spacing>;
|
|
9
|
+
typography?: Theme<typeof typography>;
|
|
10
|
+
controlSizes?: Theme<typeof controlSizes>;
|
|
11
|
+
elevation?: Theme<typeof elevation>;
|
|
12
|
+
borders?: Theme<typeof borders>;
|
|
13
|
+
fontSizes?: Theme<typeof fontSizes>;
|
|
14
|
+
lineHeights?: Theme<typeof lineHeights>;
|
|
15
|
+
motion?: Theme<typeof motion>;
|
|
16
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { MyUITheme, SemanticColorOverrides } from "../theme-types";
|
|
2
|
+
import { type BorderOption } from "./fragments/borders";
|
|
3
|
+
import { type DensityOption } from "./fragments/density";
|
|
4
|
+
import { type ElevationOption } from "./fragments/elevation";
|
|
5
|
+
import { type FontFamilyOption } from "./fragments/font-family";
|
|
6
|
+
import { type LineHeightOption } from "./fragments/line-height";
|
|
7
|
+
import { type MotionOption } from "./fragments/motion";
|
|
8
|
+
import { type RadiusOption } from "./fragments/radius";
|
|
9
|
+
import { type SemanticColorOption } from "./fragments/semantic-colors";
|
|
10
|
+
import { type TypeScaleOption } from "./fragments/type-scale";
|
|
11
|
+
export type ThemeOptions = {
|
|
12
|
+
semanticColors: SemanticColorOption;
|
|
13
|
+
/** Static StyleX color-variable styles; omitted roles retain the preset.
|
|
14
|
+
* Consumers own on-color pair selection and contrast validation. */
|
|
15
|
+
semanticColorOverrides?: SemanticColorOverrides;
|
|
16
|
+
density: DensityOption;
|
|
17
|
+
radius: RadiusOption;
|
|
18
|
+
borders: BorderOption;
|
|
19
|
+
elevation: ElevationOption;
|
|
20
|
+
motion: MotionOption;
|
|
21
|
+
fontFamily: FontFamilyOption;
|
|
22
|
+
typeScale: TypeScaleOption;
|
|
23
|
+
lineHeight: LineHeightOption;
|
|
24
|
+
};
|
|
25
|
+
export type ThemePreset = "default" | "compact" | "atelier" | "nitro";
|
|
26
|
+
export declare const themePresetOptions: Readonly<Record<ThemePreset, Readonly<ThemeOptions>>>;
|
|
27
|
+
export declare function composeTheme(options: ThemeOptions): MyUITheme;
|