@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
package/dist/radio.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { colors } from "./semantic-colors.stylex.js";
|
|
2
|
+
import { borders, motion, radii, spacing } 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 { Radio as Radio$1 } from "@base-ui/react/radio";
|
|
8
|
+
import { RadioGroup as RadioGroup$1 } from "@base-ui/react/radio-group";
|
|
9
|
+
var groupStyles = stylex.create({ root: {} });
|
|
10
|
+
var styles = stylex.create({
|
|
11
|
+
root: {
|
|
12
|
+
display: "inline-flex",
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
justifyContent: "center",
|
|
15
|
+
flexShrink: 0,
|
|
16
|
+
width: spacing[5],
|
|
17
|
+
height: spacing[5],
|
|
18
|
+
borderWidth: borders.control,
|
|
19
|
+
borderStyle: "solid",
|
|
20
|
+
borderColor: colors.border,
|
|
21
|
+
borderRadius: radii.full,
|
|
22
|
+
cursor: "pointer",
|
|
23
|
+
outlineStyle: "solid",
|
|
24
|
+
outlineWidth: "2px",
|
|
25
|
+
outlineOffset: "2px",
|
|
26
|
+
outlineColor: {
|
|
27
|
+
default: "transparent",
|
|
28
|
+
":focus-visible": colors.focus
|
|
29
|
+
},
|
|
30
|
+
transitionProperty: "background-color, color, opacity, outline-color",
|
|
31
|
+
transitionDuration: {
|
|
32
|
+
default: motion.fast,
|
|
33
|
+
"@media (prefers-reduced-motion: reduce)": "0ms"
|
|
34
|
+
},
|
|
35
|
+
transitionTimingFunction: motion.standard,
|
|
36
|
+
verticalAlign: "middle"
|
|
37
|
+
},
|
|
38
|
+
unchecked: { backgroundColor: {
|
|
39
|
+
default: colors.muted,
|
|
40
|
+
":hover": colors.mutedHover,
|
|
41
|
+
":active": colors.mutedActive
|
|
42
|
+
} },
|
|
43
|
+
checked: { backgroundColor: {
|
|
44
|
+
default: colors.primary,
|
|
45
|
+
":hover": colors.primaryHover,
|
|
46
|
+
":active": colors.primaryActive
|
|
47
|
+
} },
|
|
48
|
+
disabled: {
|
|
49
|
+
cursor: "not-allowed",
|
|
50
|
+
opacity: .5
|
|
51
|
+
},
|
|
52
|
+
indicator: {
|
|
53
|
+
display: "flex",
|
|
54
|
+
alignItems: "center",
|
|
55
|
+
justifyContent: "center",
|
|
56
|
+
width: "100%",
|
|
57
|
+
height: "100%"
|
|
58
|
+
},
|
|
59
|
+
dot: {
|
|
60
|
+
display: "block",
|
|
61
|
+
width: "0.5rem",
|
|
62
|
+
height: "0.5rem",
|
|
63
|
+
borderRadius: radii.full,
|
|
64
|
+
backgroundColor: colors.onPrimary
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
function getRootStyles(checked, disabled, xstyle) {
|
|
68
|
+
return stylex.props(styles.root, checked ? styles.checked : styles.unchecked, disabled && styles.disabled, xstyle);
|
|
69
|
+
}
|
|
70
|
+
function RadioGroup({ xstyle, ...props }) {
|
|
71
|
+
const [root, setRoot] = useState(null);
|
|
72
|
+
const [direction] = useElementDirection(root);
|
|
73
|
+
return jsx(ElementDirectionProvider, {
|
|
74
|
+
direction,
|
|
75
|
+
children: jsx(RadioGroup$1, {
|
|
76
|
+
...props,
|
|
77
|
+
ref: setRoot,
|
|
78
|
+
...stylex.props(groupStyles.root, xstyle)
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function Radio({ xstyle, ...props }) {
|
|
83
|
+
return jsx(Radio$1.Root, {
|
|
84
|
+
...props,
|
|
85
|
+
className: (state) => getRootStyles(state.checked, state.disabled, xstyle).className,
|
|
86
|
+
style: (state) => getRootStyles(state.checked, state.disabled, xstyle).style,
|
|
87
|
+
children: jsx(Radio$1.Indicator, {
|
|
88
|
+
...stylex.props(styles.indicator),
|
|
89
|
+
children: jsx("span", { ...stylex.props(styles.dot) })
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export { Radio, RadioGroup };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import { ScrollArea as BaseUIScrollArea } from "@base-ui/react/scroll-area";
|
|
3
|
+
import type { StyleXStyles } from "@stylexjs/stylex";
|
|
4
|
+
export type ScrollAreaScrollbars = "vertical" | "horizontal" | "both";
|
|
5
|
+
export type ScrollAreaOverscroll = "auto" | "contain";
|
|
6
|
+
export type ScrollAreaProps = Omit<ComponentPropsWithoutRef<typeof BaseUIScrollArea.Root>, "className" | "style"> & {
|
|
7
|
+
/**
|
|
8
|
+
* Which custom scrollbars to render. The viewport itself stays scrollable
|
|
9
|
+
* on both axes; this only decides which thumbs are drawn.
|
|
10
|
+
* @default "vertical"
|
|
11
|
+
*/
|
|
12
|
+
scrollbars?: ScrollAreaScrollbars;
|
|
13
|
+
/**
|
|
14
|
+
* `overscroll-behavior` of the scrolling viewport. Use `contain` for
|
|
15
|
+
* panes that must not hand their scroll over to the page at the edges.
|
|
16
|
+
* @default "auto"
|
|
17
|
+
*/
|
|
18
|
+
overscroll?: ScrollAreaOverscroll;
|
|
19
|
+
xstyle?: StyleXStyles;
|
|
20
|
+
};
|
|
21
|
+
export declare function ScrollArea({ scrollbars, overscroll, xstyle, children, ...props }: ScrollAreaProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { colors } from "./semantic-colors.stylex.js";
|
|
2
|
+
import { motion, radii } 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 { useState } from "react";
|
|
7
|
+
import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
|
|
8
|
+
var thumbColor = `color-mix(in srgb, ${colors.mutedForeground} 55%, transparent)`;
|
|
9
|
+
var thumbColorHover = `color-mix(in srgb, ${colors.mutedForeground} 80%, transparent)`;
|
|
10
|
+
var thumbColorActive = colors.mutedForeground;
|
|
11
|
+
var styles = stylex.create({
|
|
12
|
+
root: {
|
|
13
|
+
display: "flex",
|
|
14
|
+
flexDirection: "column",
|
|
15
|
+
minInlineSize: 0,
|
|
16
|
+
minBlockSize: 0,
|
|
17
|
+
maxInlineSize: "100%"
|
|
18
|
+
},
|
|
19
|
+
viewport: {
|
|
20
|
+
flexGrow: 1,
|
|
21
|
+
flexShrink: 1,
|
|
22
|
+
flexBasis: "auto",
|
|
23
|
+
minInlineSize: 0,
|
|
24
|
+
minBlockSize: 0,
|
|
25
|
+
borderRadius: "inherit",
|
|
26
|
+
outlineStyle: "solid",
|
|
27
|
+
outlineWidth: "2px",
|
|
28
|
+
outlineOffset: "-2px",
|
|
29
|
+
outlineColor: {
|
|
30
|
+
default: "transparent",
|
|
31
|
+
":focus-visible": colors.focus
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
contain: { overscrollBehavior: "contain" },
|
|
35
|
+
scrollbar: {
|
|
36
|
+
display: "flex",
|
|
37
|
+
boxSizing: "border-box",
|
|
38
|
+
opacity: 0,
|
|
39
|
+
transitionProperty: "opacity",
|
|
40
|
+
transitionDuration: {
|
|
41
|
+
default: motion.normal,
|
|
42
|
+
"@media (prefers-reduced-motion: reduce)": "0ms"
|
|
43
|
+
},
|
|
44
|
+
transitionTimingFunction: motion.standard
|
|
45
|
+
},
|
|
46
|
+
scrollbarVertical: {
|
|
47
|
+
inlineSize: "8px",
|
|
48
|
+
paddingInline: "1px",
|
|
49
|
+
paddingBlock: "2px"
|
|
50
|
+
},
|
|
51
|
+
scrollbarHorizontal: {
|
|
52
|
+
blockSize: "8px",
|
|
53
|
+
paddingBlock: "1px",
|
|
54
|
+
paddingInline: "2px"
|
|
55
|
+
},
|
|
56
|
+
scrollbarVisible: { opacity: 1 },
|
|
57
|
+
thumb: {
|
|
58
|
+
borderRadius: radii.full,
|
|
59
|
+
backgroundColor: {
|
|
60
|
+
default: thumbColor,
|
|
61
|
+
":hover": thumbColorHover,
|
|
62
|
+
":active": thumbColorActive
|
|
63
|
+
},
|
|
64
|
+
transitionProperty: "background-color",
|
|
65
|
+
transitionDuration: {
|
|
66
|
+
default: motion.fast,
|
|
67
|
+
"@media (prefers-reduced-motion: reduce)": "0ms"
|
|
68
|
+
},
|
|
69
|
+
transitionTimingFunction: motion.standard
|
|
70
|
+
},
|
|
71
|
+
thumbVertical: { inlineSize: "100%" },
|
|
72
|
+
thumbHorizontal: { blockSize: "100%" }
|
|
73
|
+
});
|
|
74
|
+
function isFocusVisible(element) {
|
|
75
|
+
try {
|
|
76
|
+
return element.matches(":focus-visible");
|
|
77
|
+
} catch {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function ScrollArea({ scrollbars = "vertical", overscroll = "auto", xstyle, children, ...props }) {
|
|
82
|
+
const [root, setRoot] = useState(null);
|
|
83
|
+
const [direction] = useElementDirection(root);
|
|
84
|
+
const [focusVisible, setFocusVisible] = useState(false);
|
|
85
|
+
const vertical = scrollbars !== "horizontal";
|
|
86
|
+
const horizontal = scrollbars !== "vertical";
|
|
87
|
+
const scrollbarStyles = (state) => stylex.props(styles.scrollbar, state.orientation === "vertical" ? styles.scrollbarVertical : styles.scrollbarHorizontal, (state.hovering || state.scrolling || focusVisible) && styles.scrollbarVisible);
|
|
88
|
+
const thumbStyles = (state) => stylex.props(styles.thumb, state.orientation === "vertical" ? styles.thumbVertical : styles.thumbHorizontal);
|
|
89
|
+
const renderScrollbar = (orientation) => jsx(ScrollArea$1.Scrollbar, {
|
|
90
|
+
orientation,
|
|
91
|
+
className: (state) => scrollbarStyles(state).className,
|
|
92
|
+
style: (state) => scrollbarStyles(state).style,
|
|
93
|
+
children: jsx(ScrollArea$1.Thumb, {
|
|
94
|
+
className: (state) => thumbStyles(state).className,
|
|
95
|
+
style: (state) => thumbStyles(state).style
|
|
96
|
+
})
|
|
97
|
+
});
|
|
98
|
+
return jsx(ElementDirectionProvider, {
|
|
99
|
+
direction,
|
|
100
|
+
children: jsxs(ScrollArea$1.Root, {
|
|
101
|
+
...props,
|
|
102
|
+
ref: setRoot,
|
|
103
|
+
...stylex.props(styles.root, xstyle),
|
|
104
|
+
children: [
|
|
105
|
+
jsx(ScrollArea$1.Viewport, {
|
|
106
|
+
onFocus: (event) => setFocusVisible(event.target === event.currentTarget && isFocusVisible(event.currentTarget)),
|
|
107
|
+
onBlur: (event) => {
|
|
108
|
+
if (event.target === event.currentTarget) setFocusVisible(false);
|
|
109
|
+
},
|
|
110
|
+
...stylex.props(styles.viewport, overscroll === "contain" && styles.contain),
|
|
111
|
+
children: jsx(ScrollArea$1.Content, { children })
|
|
112
|
+
}),
|
|
113
|
+
vertical && renderScrollbar("vertical"),
|
|
114
|
+
horizontal && renderScrollbar("horizontal"),
|
|
115
|
+
vertical && horizontal && jsx(ScrollArea$1.Corner, {})
|
|
116
|
+
]
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
export { ScrollArea };
|
package/dist/select.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
import { Select as BaseUISelect } from "@base-ui/react/select";
|
|
3
|
+
import type { StyleXStyles } from "@stylexjs/stylex";
|
|
4
|
+
export type SelectProps = ComponentPropsWithoutRef<typeof BaseUISelect.Root>;
|
|
5
|
+
type NativeSelectLabelProps = Omit<ComponentPropsWithoutRef<typeof BaseUISelect.Label>, "className" | "style">;
|
|
6
|
+
export type SelectLabelProps = NativeSelectLabelProps & {
|
|
7
|
+
xstyle?: StyleXStyles;
|
|
8
|
+
};
|
|
9
|
+
type NativeSelectTriggerProps = Omit<ComponentPropsWithoutRef<typeof BaseUISelect.Trigger>, "className" | "style">;
|
|
10
|
+
export type SelectTriggerProps = NativeSelectTriggerProps & {
|
|
11
|
+
xstyle?: StyleXStyles;
|
|
12
|
+
};
|
|
13
|
+
type NativeSelectValueProps = Omit<ComponentPropsWithoutRef<typeof BaseUISelect.Value>, "className" | "style">;
|
|
14
|
+
export type SelectValueProps = NativeSelectValueProps & {
|
|
15
|
+
xstyle?: StyleXStyles;
|
|
16
|
+
};
|
|
17
|
+
type NativeSelectContentProps = Omit<ComponentPropsWithoutRef<typeof BaseUISelect.Popup>, "className" | "style">;
|
|
18
|
+
type SelectPositionerProps = ComponentPropsWithoutRef<typeof BaseUISelect.Positioner>;
|
|
19
|
+
export type SelectContentProps = NativeSelectContentProps & {
|
|
20
|
+
side?: SelectPositionerProps["side"];
|
|
21
|
+
align?: SelectPositionerProps["align"];
|
|
22
|
+
sideOffset?: SelectPositionerProps["sideOffset"];
|
|
23
|
+
alignOffset?: SelectPositionerProps["alignOffset"];
|
|
24
|
+
xstyle?: StyleXStyles;
|
|
25
|
+
};
|
|
26
|
+
type NativeSelectItemProps = Omit<ComponentPropsWithoutRef<typeof BaseUISelect.Item>, "children" | "className" | "style">;
|
|
27
|
+
export type SelectItemProps = NativeSelectItemProps & {
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
xstyle?: StyleXStyles;
|
|
30
|
+
};
|
|
31
|
+
export declare function Select(props: SelectProps): import("react").JSX.Element;
|
|
32
|
+
export declare function SelectLabel({ xstyle, ...props }: SelectLabelProps): import("react").JSX.Element;
|
|
33
|
+
export declare function SelectTrigger({ xstyle, children, ...props }: SelectTriggerProps): import("react").JSX.Element;
|
|
34
|
+
export declare function SelectValue({ xstyle, ...props }: SelectValueProps): import("react").JSX.Element;
|
|
35
|
+
export declare function SelectContent({ side, align, sideOffset, alignOffset, xstyle, children, ...props }: SelectContentProps): import("react").JSX.Element;
|
|
36
|
+
export declare function SelectItem({ xstyle, children, ...props }: SelectItemProps): import("react").JSX.Element;
|
|
37
|
+
export {};
|
package/dist/select.js
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { colors } from "./semantic-colors.stylex.js";
|
|
2
|
+
import { borders, controlSizes, elevation, fontSizes, fontWeights, lineHeights, motion, radii, spacing, typography } from "./tokens.stylex.js";
|
|
3
|
+
import { PopupDirectionProvider, PopupDirectionSync, usePopupAnchorRef, usePopupDirection, usePopupOpenChange } from "./direction.js";
|
|
4
|
+
import { useThemePortalHost } from "./theme-root.js";
|
|
5
|
+
import * as stylex from "@stylexjs/stylex";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Select as Select$1 } from "@base-ui/react/select";
|
|
8
|
+
var styles = stylex.create({
|
|
9
|
+
label: {
|
|
10
|
+
color: colors.foreground,
|
|
11
|
+
fontFamily: typography.fontFamily,
|
|
12
|
+
fontSize: fontSizes.sm,
|
|
13
|
+
fontWeight: fontWeights.medium,
|
|
14
|
+
lineHeight: lineHeights.normal
|
|
15
|
+
},
|
|
16
|
+
trigger: {
|
|
17
|
+
display: "inline-flex",
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
justifyContent: "space-between",
|
|
20
|
+
gap: spacing[2],
|
|
21
|
+
boxSizing: "border-box",
|
|
22
|
+
width: "100%",
|
|
23
|
+
minWidth: 0,
|
|
24
|
+
minHeight: controlSizes.md,
|
|
25
|
+
paddingBlock: spacing[2],
|
|
26
|
+
paddingInline: spacing[3],
|
|
27
|
+
borderWidth: borders.control,
|
|
28
|
+
borderStyle: "solid",
|
|
29
|
+
borderColor: colors.border,
|
|
30
|
+
borderRadius: radii.md,
|
|
31
|
+
backgroundColor: {
|
|
32
|
+
default: colors.muted,
|
|
33
|
+
":hover": colors.mutedHover,
|
|
34
|
+
":active": colors.mutedActive
|
|
35
|
+
},
|
|
36
|
+
color: colors.foreground,
|
|
37
|
+
fontFamily: typography.fontFamily,
|
|
38
|
+
fontSize: fontSizes.md,
|
|
39
|
+
lineHeight: lineHeights.normal,
|
|
40
|
+
cursor: "pointer",
|
|
41
|
+
outlineStyle: "solid",
|
|
42
|
+
outlineWidth: "2px",
|
|
43
|
+
outlineOffset: "2px",
|
|
44
|
+
outlineColor: {
|
|
45
|
+
default: "transparent",
|
|
46
|
+
":focus-visible": colors.focus
|
|
47
|
+
},
|
|
48
|
+
opacity: {
|
|
49
|
+
default: 1,
|
|
50
|
+
":disabled": .5
|
|
51
|
+
},
|
|
52
|
+
transitionProperty: "background-color, opacity, outline-color",
|
|
53
|
+
transitionDuration: {
|
|
54
|
+
default: motion.fast,
|
|
55
|
+
"@media (prefers-reduced-motion: reduce)": "0ms"
|
|
56
|
+
},
|
|
57
|
+
transitionTimingFunction: motion.standard
|
|
58
|
+
},
|
|
59
|
+
value: {
|
|
60
|
+
minWidth: 0,
|
|
61
|
+
overflow: "hidden",
|
|
62
|
+
textOverflow: "ellipsis",
|
|
63
|
+
whiteSpace: "nowrap"
|
|
64
|
+
},
|
|
65
|
+
icon: {
|
|
66
|
+
display: "flex",
|
|
67
|
+
flexShrink: 0,
|
|
68
|
+
alignItems: "center",
|
|
69
|
+
justifyContent: "center",
|
|
70
|
+
width: "1rem",
|
|
71
|
+
height: "1rem",
|
|
72
|
+
color: colors.mutedForeground,
|
|
73
|
+
transitionProperty: "transform",
|
|
74
|
+
transitionDuration: {
|
|
75
|
+
default: motion.fast,
|
|
76
|
+
"@media (prefers-reduced-motion: reduce)": "0ms"
|
|
77
|
+
},
|
|
78
|
+
transitionTimingFunction: motion.standard
|
|
79
|
+
},
|
|
80
|
+
iconOpen: { transform: "rotate(180deg)" },
|
|
81
|
+
popup: {
|
|
82
|
+
boxSizing: "border-box",
|
|
83
|
+
minWidth: "var(--anchor-width)",
|
|
84
|
+
maxWidth: "min(22rem, var(--available-width))",
|
|
85
|
+
maxHeight: "min(20rem, var(--available-height))",
|
|
86
|
+
borderWidth: borders.surface,
|
|
87
|
+
borderStyle: "solid",
|
|
88
|
+
borderColor: colors.border,
|
|
89
|
+
borderRadius: radii.lg,
|
|
90
|
+
backgroundColor: colors.surface,
|
|
91
|
+
color: colors.surfaceForeground,
|
|
92
|
+
boxShadow: elevation.md,
|
|
93
|
+
overflow: "auto",
|
|
94
|
+
transformOrigin: "var(--transform-origin)",
|
|
95
|
+
transitionProperty: "opacity, transform",
|
|
96
|
+
transitionDuration: {
|
|
97
|
+
default: motion.fast,
|
|
98
|
+
"@media (prefers-reduced-motion: reduce)": "0ms"
|
|
99
|
+
},
|
|
100
|
+
transitionTimingFunction: motion.standard
|
|
101
|
+
},
|
|
102
|
+
popupVisible: {
|
|
103
|
+
opacity: 1,
|
|
104
|
+
transform: "scale(1)"
|
|
105
|
+
},
|
|
106
|
+
popupHidden: {
|
|
107
|
+
opacity: 0,
|
|
108
|
+
transform: "scale(0.98)"
|
|
109
|
+
},
|
|
110
|
+
list: {
|
|
111
|
+
display: "flex",
|
|
112
|
+
flexDirection: "column"
|
|
113
|
+
},
|
|
114
|
+
item: {
|
|
115
|
+
display: "flex",
|
|
116
|
+
alignItems: "center",
|
|
117
|
+
gap: spacing[2],
|
|
118
|
+
minWidth: 0,
|
|
119
|
+
paddingBlock: spacing[2],
|
|
120
|
+
paddingInline: spacing[3],
|
|
121
|
+
borderRadius: radii.md,
|
|
122
|
+
color: colors.surfaceForeground,
|
|
123
|
+
fontFamily: typography.fontFamily,
|
|
124
|
+
fontSize: fontSizes.sm,
|
|
125
|
+
lineHeight: lineHeights.normal,
|
|
126
|
+
cursor: "pointer",
|
|
127
|
+
outline: "none"
|
|
128
|
+
},
|
|
129
|
+
itemHighlighted: { backgroundColor: colors.mutedHover },
|
|
130
|
+
itemDisabled: {
|
|
131
|
+
cursor: "not-allowed",
|
|
132
|
+
opacity: .5
|
|
133
|
+
},
|
|
134
|
+
indicator: {
|
|
135
|
+
display: "flex",
|
|
136
|
+
alignItems: "center",
|
|
137
|
+
justifyContent: "center",
|
|
138
|
+
flexShrink: 0,
|
|
139
|
+
width: "1rem",
|
|
140
|
+
height: "1rem",
|
|
141
|
+
color: colors.primary
|
|
142
|
+
},
|
|
143
|
+
itemText: {
|
|
144
|
+
minWidth: 0,
|
|
145
|
+
flexGrow: 1
|
|
146
|
+
},
|
|
147
|
+
checkIcon: {
|
|
148
|
+
display: "block",
|
|
149
|
+
width: "0.875rem",
|
|
150
|
+
height: "0.875rem"
|
|
151
|
+
},
|
|
152
|
+
caretIcon: {
|
|
153
|
+
display: "block",
|
|
154
|
+
width: "1rem",
|
|
155
|
+
height: "1rem"
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
function isPopupHidden(open, transitionStatus) {
|
|
159
|
+
return !open || transitionStatus === "starting" || transitionStatus === "ending";
|
|
160
|
+
}
|
|
161
|
+
function CheckIcon() {
|
|
162
|
+
return jsx("svg", {
|
|
163
|
+
viewBox: "0 0 16 16",
|
|
164
|
+
fill: "none",
|
|
165
|
+
stroke: "currentColor",
|
|
166
|
+
strokeWidth: "2",
|
|
167
|
+
strokeLinecap: "round",
|
|
168
|
+
strokeLinejoin: "round",
|
|
169
|
+
"aria-hidden": "true",
|
|
170
|
+
...stylex.props(styles.checkIcon),
|
|
171
|
+
children: jsx("path", { d: "m3 8 3 3 7-7" })
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function CaretIcon() {
|
|
175
|
+
return jsx("svg", {
|
|
176
|
+
viewBox: "0 0 16 16",
|
|
177
|
+
fill: "none",
|
|
178
|
+
stroke: "currentColor",
|
|
179
|
+
strokeWidth: "2",
|
|
180
|
+
strokeLinecap: "round",
|
|
181
|
+
strokeLinejoin: "round",
|
|
182
|
+
"aria-hidden": "true",
|
|
183
|
+
...stylex.props(styles.caretIcon),
|
|
184
|
+
children: jsx("path", { d: "m4 6 4 4 4-4" })
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
function Select(props) {
|
|
188
|
+
return jsx(PopupDirectionProvider, { children: jsx(SelectRoot, { ...props }) });
|
|
189
|
+
}
|
|
190
|
+
function SelectLabel({ xstyle, ...props }) {
|
|
191
|
+
return jsx(Select$1.Label, {
|
|
192
|
+
...props,
|
|
193
|
+
...stylex.props(styles.label, xstyle)
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
function SelectRoot({ onOpenChange, ...props }) {
|
|
197
|
+
const handleOpenChange = usePopupOpenChange(onOpenChange);
|
|
198
|
+
return jsx(Select$1.Root, {
|
|
199
|
+
...props,
|
|
200
|
+
onOpenChange: handleOpenChange
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function SelectTrigger({ xstyle, children, ...props }) {
|
|
204
|
+
const anchorRef = usePopupAnchorRef();
|
|
205
|
+
return jsxs(Select$1.Trigger, {
|
|
206
|
+
...props,
|
|
207
|
+
ref: anchorRef,
|
|
208
|
+
...stylex.props(styles.trigger, xstyle),
|
|
209
|
+
children: [children, jsx(Select$1.Icon, {
|
|
210
|
+
className: (state) => stylex.props(styles.icon, state.open && styles.iconOpen).className,
|
|
211
|
+
style: (state) => stylex.props(styles.icon, state.open && styles.iconOpen).style,
|
|
212
|
+
children: jsx(CaretIcon, {})
|
|
213
|
+
})]
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function SelectValue({ xstyle, ...props }) {
|
|
217
|
+
return jsx(Select$1.Value, {
|
|
218
|
+
...props,
|
|
219
|
+
...stylex.props(styles.value, xstyle)
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
function SelectContent({ side = "bottom", align = "start", sideOffset = 6, alignOffset = 0, xstyle, children, ...props }) {
|
|
223
|
+
const portalHost = useThemePortalHost();
|
|
224
|
+
const direction = usePopupDirection();
|
|
225
|
+
return jsxs(Select$1.Portal, {
|
|
226
|
+
container: portalHost ?? void 0,
|
|
227
|
+
children: [jsx(PopupDirectionSync, {}), jsx(Select$1.Positioner, {
|
|
228
|
+
dir: direction,
|
|
229
|
+
alignItemWithTrigger: false,
|
|
230
|
+
side,
|
|
231
|
+
align,
|
|
232
|
+
sideOffset,
|
|
233
|
+
alignOffset,
|
|
234
|
+
children: jsx(Select$1.Popup, {
|
|
235
|
+
...props,
|
|
236
|
+
className: (state) => stylex.props(styles.popup, isPopupHidden(state.open, state.transitionStatus) ? styles.popupHidden : styles.popupVisible, xstyle).className,
|
|
237
|
+
style: (state) => stylex.props(styles.popup, isPopupHidden(state.open, state.transitionStatus) ? styles.popupHidden : styles.popupVisible, xstyle).style,
|
|
238
|
+
children: jsx(Select$1.List, {
|
|
239
|
+
...stylex.props(styles.list),
|
|
240
|
+
children
|
|
241
|
+
})
|
|
242
|
+
})
|
|
243
|
+
})]
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
function SelectItem({ xstyle, children, ...props }) {
|
|
247
|
+
return jsxs(Select$1.Item, {
|
|
248
|
+
...props,
|
|
249
|
+
className: (state) => stylex.props(styles.item, state.highlighted && styles.itemHighlighted, state.disabled && styles.itemDisabled, xstyle).className,
|
|
250
|
+
style: (state) => stylex.props(styles.item, state.highlighted && styles.itemHighlighted, state.disabled && styles.itemDisabled, xstyle).style,
|
|
251
|
+
children: [jsx(Select$1.ItemIndicator, {
|
|
252
|
+
...stylex.props(styles.indicator),
|
|
253
|
+
children: jsx(CheckIcon, {})
|
|
254
|
+
}), jsx(Select$1.ItemText, {
|
|
255
|
+
...stylex.props(styles.itemText),
|
|
256
|
+
children
|
|
257
|
+
})]
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
export { Select, SelectContent, SelectItem, SelectLabel, SelectTrigger, SelectValue };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as stylex from "@stylexjs/stylex";
|
|
2
|
+
export declare const colors: stylex.VarGroup<Readonly<{
|
|
3
|
+
background: string;
|
|
4
|
+
foreground: string;
|
|
5
|
+
surface: string;
|
|
6
|
+
surfaceForeground: string;
|
|
7
|
+
muted: string;
|
|
8
|
+
mutedForeground: string;
|
|
9
|
+
border: string;
|
|
10
|
+
backdrop: string;
|
|
11
|
+
primary: string;
|
|
12
|
+
onPrimary: string;
|
|
13
|
+
danger: string;
|
|
14
|
+
onDanger: string;
|
|
15
|
+
focus: string;
|
|
16
|
+
primaryHover: string;
|
|
17
|
+
primaryActive: string;
|
|
18
|
+
mutedHover: string;
|
|
19
|
+
mutedActive: string;
|
|
20
|
+
dangerHover: string;
|
|
21
|
+
dangerActive: string;
|
|
22
|
+
}>, symbol>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as stylex from "@stylexjs/stylex";
|
|
2
|
+
var colors = stylex.defineVars({
|
|
3
|
+
background: "light-dark(#ffffff, #111111)",
|
|
4
|
+
foreground: "light-dark(#181818, #f5f5f5)",
|
|
5
|
+
surface: "light-dark(#fafafa, #181818)",
|
|
6
|
+
surfaceForeground: "light-dark(#181818, #f5f5f5)",
|
|
7
|
+
muted: "light-dark(#f5f5f5, #262626)",
|
|
8
|
+
mutedForeground: "light-dark(#707070, #a3a3a3)",
|
|
9
|
+
border: "light-dark(#e5e5e5, #404040)",
|
|
10
|
+
backdrop: "light-dark(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.7))",
|
|
11
|
+
primary: "light-dark(#171717, #fafafa)",
|
|
12
|
+
onPrimary: "light-dark(#ffffff, #171717)",
|
|
13
|
+
danger: "light-dark(#dc2626, #f87171)",
|
|
14
|
+
onDanger: "#ffffff",
|
|
15
|
+
focus: "light-dark(#525252, #d4d4d4)",
|
|
16
|
+
primaryHover: "light-dark(#262626, #e5e5e5)",
|
|
17
|
+
primaryActive: "light-dark(#404040, #d4d4d4)",
|
|
18
|
+
mutedHover: "light-dark(#e5e5e5, #404040)",
|
|
19
|
+
mutedActive: "light-dark(#d4d4d4, #525252)",
|
|
20
|
+
dangerHover: "light-dark(#b91c1c, #b91c1c)",
|
|
21
|
+
dangerActive: "light-dark(#991b1b, #991b1b)"
|
|
22
|
+
});
|
|
23
|
+
export { colors };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import { Separator as BaseUISeparator } from "@base-ui/react/separator";
|
|
3
|
+
import type { StyleXStyles } from "@stylexjs/stylex";
|
|
4
|
+
type NativeSeparatorProps = Omit<ComponentPropsWithoutRef<typeof BaseUISeparator>, "children" | "className" | "style">;
|
|
5
|
+
export type SeparatorProps = NativeSeparatorProps & {
|
|
6
|
+
xstyle?: StyleXStyles;
|
|
7
|
+
};
|
|
8
|
+
export declare function Separator({ orientation, xstyle, ...props }: SeparatorProps): import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { colors } from "./semantic-colors.stylex.js";
|
|
2
|
+
import * as stylex from "@stylexjs/stylex";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Separator as Separator$1 } from "@base-ui/react/separator";
|
|
5
|
+
var styles = stylex.create({
|
|
6
|
+
root: {
|
|
7
|
+
flexShrink: 0,
|
|
8
|
+
backgroundColor: colors.border
|
|
9
|
+
},
|
|
10
|
+
horizontal: {
|
|
11
|
+
width: "100%",
|
|
12
|
+
height: "1px"
|
|
13
|
+
},
|
|
14
|
+
vertical: {
|
|
15
|
+
width: "1px",
|
|
16
|
+
alignSelf: "stretch"
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
function Separator({ orientation = "horizontal", xstyle, ...props }) {
|
|
20
|
+
return jsx(Separator$1, {
|
|
21
|
+
...props,
|
|
22
|
+
orientation,
|
|
23
|
+
...stylex.props(styles.root, orientation === "horizontal" ? styles.horizontal : styles.vertical, xstyle)
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export { Separator };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import type { StyleXStyles } from "@stylexjs/stylex";
|
|
3
|
+
export type SkeletonProps = Omit<ComponentPropsWithoutRef<"div">, "className" | "style"> & {
|
|
4
|
+
xstyle?: StyleXStyles;
|
|
5
|
+
};
|
|
6
|
+
export declare function Skeleton({ xstyle, "aria-hidden": ariaHidden, ...props }: SkeletonProps): import("react").JSX.Element;
|
package/dist/skeleton.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
|
+
inlineSize: "100%",
|
|
7
|
+
blockSize: spacing[4],
|
|
8
|
+
borderRadius: radii.md,
|
|
9
|
+
backgroundColor: colors.muted
|
|
10
|
+
} });
|
|
11
|
+
function Skeleton({ xstyle, "aria-hidden": ariaHidden = true, ...props }) {
|
|
12
|
+
return jsx("div", {
|
|
13
|
+
...props,
|
|
14
|
+
"aria-hidden": ariaHidden,
|
|
15
|
+
...stylex.props(styles.root, xstyle)
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export { Skeleton };
|
package/dist/stack.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
import type { StyleXStyles } from "@stylexjs/stylex";
|
|
3
|
+
import type { SpacingKey } from "./token-types";
|
|
4
|
+
type NativeStackProps = Omit<ComponentPropsWithoutRef<"div">, "children" | "className" | "style">;
|
|
5
|
+
export type StackProps = NativeStackProps & {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
gap?: SpacingKey;
|
|
8
|
+
xstyle?: StyleXStyles;
|
|
9
|
+
};
|
|
10
|
+
export declare function Stack({ children, gap, xstyle, ...props }: StackProps): import("react").JSX.Element;
|
|
11
|
+
export {};
|
package/dist/stack.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { spacing } from "./tokens.stylex.js";
|
|
2
|
+
import * as stylex from "@stylexjs/stylex";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var styles = stylex.create({ root: {
|
|
5
|
+
display: "flex",
|
|
6
|
+
flexDirection: "column"
|
|
7
|
+
} });
|
|
8
|
+
var gapStyles = stylex.create({
|
|
9
|
+
1: { gap: spacing[1] },
|
|
10
|
+
2: { gap: spacing[2] },
|
|
11
|
+
3: { gap: spacing[3] },
|
|
12
|
+
4: { gap: spacing[4] },
|
|
13
|
+
5: { gap: spacing[5] },
|
|
14
|
+
6: { gap: spacing[6] },
|
|
15
|
+
8: { gap: spacing[8] }
|
|
16
|
+
});
|
|
17
|
+
function Stack({ children, gap = 4, xstyle, ...props }) {
|
|
18
|
+
return jsx("div", {
|
|
19
|
+
...props,
|
|
20
|
+
...stylex.props(styles.root, gapStyles[gap], xstyle),
|
|
21
|
+
children
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export { Stack };
|