@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.
Files changed (103) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +76 -2
  3. package/dist/accordion.d.ts +23 -0
  4. package/dist/accordion.js +105 -0
  5. package/dist/alert.d.ts +16 -0
  6. package/dist/alert.js +50 -0
  7. package/dist/avatar.d.ts +14 -0
  8. package/dist/avatar.js +53 -0
  9. package/dist/badge.d.ts +11 -0
  10. package/dist/badge.js +46 -0
  11. package/dist/breadcrumb.d.ts +26 -0
  12. package/dist/breadcrumb.js +92 -0
  13. package/dist/button.d.ts +17 -0
  14. package/dist/button.js +174 -0
  15. package/dist/card.d.ts +24 -0
  16. package/dist/card.js +81 -0
  17. package/dist/checkbox.d.ts +9 -0
  18. package/dist/checkbox.js +91 -0
  19. package/dist/dialog.d.ts +39 -0
  20. package/dist/dialog.js +195 -0
  21. package/dist/direction.d.ts +17 -0
  22. package/dist/direction.js +93 -0
  23. package/dist/dropdown-menu.d.ts +39 -0
  24. package/dist/dropdown-menu.js +189 -0
  25. package/dist/field.d.ts +24 -0
  26. package/dist/field.js +59 -0
  27. package/dist/icon-button.d.ts +15 -0
  28. package/dist/icon-button.js +50 -0
  29. package/dist/index.d.ts +68 -0
  30. package/dist/index.js +36 -0
  31. package/dist/inline.d.ts +12 -0
  32. package/dist/inline.js +25 -0
  33. package/dist/input.d.ts +9 -0
  34. package/dist/input.js +54 -0
  35. package/dist/navbar.d.ts +44 -0
  36. package/dist/navbar.js +258 -0
  37. package/dist/popover.d.ts +36 -0
  38. package/dist/popover.js +148 -0
  39. package/dist/progress.d.ts +23 -0
  40. package/dist/progress.js +67 -0
  41. package/dist/radio.d.ts +15 -0
  42. package/dist/radio.js +93 -0
  43. package/dist/scroll-area.d.ts +21 -0
  44. package/dist/scroll-area.js +120 -0
  45. package/dist/select.d.ts +37 -0
  46. package/dist/select.js +260 -0
  47. package/dist/semantic-colors.stylex.d.ts +22 -0
  48. package/dist/semantic-colors.stylex.js +23 -0
  49. package/dist/separator.d.ts +9 -0
  50. package/dist/separator.js +26 -0
  51. package/dist/skeleton.d.ts +6 -0
  52. package/dist/skeleton.js +18 -0
  53. package/dist/stack.d.ts +11 -0
  54. package/dist/stack.js +24 -0
  55. package/dist/surface.d.ts +9 -0
  56. package/dist/surface.js +18 -0
  57. package/dist/switch.d.ts +9 -0
  58. package/dist/switch.js +73 -0
  59. package/dist/table.d.ts +34 -0
  60. package/dist/table.js +84 -0
  61. package/dist/tabs.d.ts +19 -0
  62. package/dist/tabs.js +115 -0
  63. package/dist/text.d.ts +14 -0
  64. package/dist/text.js +31 -0
  65. package/dist/textarea.d.ts +8 -0
  66. package/dist/textarea.js +70 -0
  67. package/dist/theme-root.d.ts +9 -0
  68. package/dist/theme-root.js +61 -0
  69. package/dist/theme-types.d.ts +16 -0
  70. package/dist/theme-types.js +0 -0
  71. package/dist/themes/atelier-theme.d.ts +2 -0
  72. package/dist/themes/atelier-theme.js +3 -0
  73. package/dist/themes/compact-theme.d.ts +2 -0
  74. package/dist/themes/compact-theme.js +3 -0
  75. package/dist/themes/compose-theme.d.ts +27 -0
  76. package/dist/themes/compose-theme.js +82 -0
  77. package/dist/themes/fragments/borders.d.ts +34 -0
  78. package/dist/themes/fragments/borders.js +19 -0
  79. package/dist/themes/fragments/density.d.ts +58 -0
  80. package/dist/themes/fragments/density.js +31 -0
  81. package/dist/themes/fragments/elevation.d.ts +34 -0
  82. package/dist/themes/fragments/elevation.js +19 -0
  83. package/dist/themes/fragments/font-family.d.ts +16 -0
  84. package/dist/themes/fragments/font-family.js +9 -0
  85. package/dist/themes/fragments/line-height.d.ts +24 -0
  86. package/dist/themes/fragments/line-height.js +13 -0
  87. package/dist/themes/fragments/motion.d.ts +40 -0
  88. package/dist/themes/fragments/motion.js +21 -0
  89. package/dist/themes/fragments/radius.d.ts +60 -0
  90. package/dist/themes/fragments/radius.js +13 -0
  91. package/dist/themes/fragments/semantic-colors.d.ts +151 -0
  92. package/dist/themes/fragments/semantic-colors.js +68 -0
  93. package/dist/themes/fragments/type-scale.d.ts +36 -0
  94. package/dist/themes/fragments/type-scale.js +16 -0
  95. package/dist/themes/nitro-theme.d.ts +2 -0
  96. package/dist/themes/nitro-theme.js +3 -0
  97. package/dist/token-types.d.ts +1 -0
  98. package/dist/token-types.js +0 -0
  99. package/dist/tokens.stylex.d.ts +59 -0
  100. package/dist/tokens.stylex.js +61 -0
  101. package/dist/tooltip.d.ts +23 -0
  102. package/dist/tooltip.js +89 -0
  103. package/package.json +42 -4
package/dist/input.js ADDED
@@ -0,0 +1,54 @@
1
+ import { colors } from "./semantic-colors.stylex.js";
2
+ import { borders, controlSizes, 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 as Input$1 } from "@base-ui/react/input";
6
+ var styles = stylex.create({ root: {
7
+ boxSizing: "border-box",
8
+ width: "100%",
9
+ minWidth: 0,
10
+ minHeight: controlSizes.md,
11
+ paddingBlock: spacing[2],
12
+ paddingInline: spacing[3],
13
+ borderWidth: borders.control,
14
+ borderStyle: "solid",
15
+ borderColor: colors.border,
16
+ borderRadius: radii.md,
17
+ backgroundColor: colors.muted,
18
+ color: colors.foreground,
19
+ fontFamily: typography.fontFamily,
20
+ fontSize: fontSizes.md,
21
+ lineHeight: lineHeights.normal,
22
+ outlineStyle: "solid",
23
+ outlineWidth: "2px",
24
+ outlineOffset: "2px",
25
+ outlineColor: {
26
+ default: "transparent",
27
+ ":focus-visible": colors.focus
28
+ },
29
+ opacity: {
30
+ default: 1,
31
+ ":disabled": .5
32
+ },
33
+ cursor: {
34
+ default: "text",
35
+ ":disabled": "not-allowed"
36
+ },
37
+ transitionProperty: "background-color, border-color, color, opacity, outline-color",
38
+ transitionDuration: {
39
+ default: motion.fast,
40
+ "@media (prefers-reduced-motion: reduce)": "0ms"
41
+ },
42
+ transitionTimingFunction: motion.standard,
43
+ "::placeholder": {
44
+ color: colors.mutedForeground,
45
+ opacity: 1
46
+ }
47
+ } });
48
+ function Input({ xstyle, ...props }) {
49
+ return jsx(Input$1, {
50
+ ...props,
51
+ ...stylex.props(styles.root, xstyle)
52
+ });
53
+ }
54
+ export { Input };
@@ -0,0 +1,44 @@
1
+ import { type ComponentPropsWithoutRef, type ReactNode } from "react";
2
+ import { NavigationMenu as BaseUINavigationMenu } from "@base-ui/react/navigation-menu";
3
+ import type { StyleXStyles } from "@stylexjs/stylex";
4
+ type NativeNavbarProps = Omit<ComponentPropsWithoutRef<"header">, "className" | "style">;
5
+ export type NavbarProps = NativeNavbarProps & {
6
+ children: ReactNode;
7
+ xstyle?: StyleXStyles;
8
+ };
9
+ type NativeNavbarBrandProps = Omit<ComponentPropsWithoutRef<"div">, "className" | "style">;
10
+ export type NavbarBrandProps = NativeNavbarBrandProps & {
11
+ children: ReactNode;
12
+ xstyle?: StyleXStyles;
13
+ };
14
+ export type NavbarActionsProps = NavbarBrandProps;
15
+ type NativeNavbarMenuProps = Omit<ComponentPropsWithoutRef<typeof BaseUINavigationMenu.Root>, "className" | "style">;
16
+ export type NavbarMenuProps = NativeNavbarMenuProps & {
17
+ children: ReactNode;
18
+ xstyle?: StyleXStyles;
19
+ };
20
+ type NativeNavbarItemProps = Omit<ComponentPropsWithoutRef<typeof BaseUINavigationMenu.Item>, "className" | "style">;
21
+ export type NavbarItemProps = NativeNavbarItemProps & {
22
+ xstyle?: StyleXStyles;
23
+ };
24
+ type NativeNavbarTriggerProps = Omit<ComponentPropsWithoutRef<typeof BaseUINavigationMenu.Trigger>, "className" | "style">;
25
+ export type NavbarTriggerProps = NativeNavbarTriggerProps & {
26
+ xstyle?: StyleXStyles;
27
+ };
28
+ type NativeNavbarContentProps = Omit<ComponentPropsWithoutRef<typeof BaseUINavigationMenu.Content>, "className" | "style">;
29
+ export type NavbarContentProps = NativeNavbarContentProps & {
30
+ xstyle?: StyleXStyles;
31
+ };
32
+ type NativeNavbarLinkProps = Omit<ComponentPropsWithoutRef<typeof BaseUINavigationMenu.Link>, "className" | "style">;
33
+ export type NavbarLinkProps = NativeNavbarLinkProps & {
34
+ xstyle?: StyleXStyles;
35
+ };
36
+ export declare function Navbar({ children, xstyle, ...props }: NavbarProps): import("react").JSX.Element;
37
+ export declare function NavbarBrand({ children, xstyle, ...props }: NavbarBrandProps): import("react").JSX.Element;
38
+ export declare function NavbarActions({ children, xstyle, ...props }: NavbarActionsProps): import("react").JSX.Element;
39
+ export declare function NavbarMenu({ children, xstyle, ...props }: NavbarMenuProps): import("react").JSX.Element;
40
+ export declare function NavbarItem({ xstyle, ...props }: NavbarItemProps): import("react").JSX.Element;
41
+ export declare function NavbarTrigger({ children, xstyle, ...props }: NavbarTriggerProps): import("react").JSX.Element;
42
+ export declare function NavbarContent({ xstyle, ...props }: NavbarContentProps): import("react").JSX.Element;
43
+ export declare function NavbarLink({ xstyle, ...props }: NavbarLinkProps): import("react").JSX.Element;
44
+ export {};
package/dist/navbar.js ADDED
@@ -0,0 +1,258 @@
1
+ import { colors } from "./semantic-colors.stylex.js";
2
+ import { borders, elevation, fontSizes, fontWeights, lineHeights, motion, radii, spacing, typography } from "./tokens.stylex.js";
3
+ import { ElementDirectionProvider, PopupDirectionProvider, PopupDirectionSync, useElementDirection, usePopupAnchorRef, usePopupDirection } 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 { useState } from "react";
8
+ import { NavigationMenu } from "@base-ui/react/navigation-menu";
9
+ var navbarStyles = stylex.create({
10
+ root: {
11
+ boxSizing: "border-box",
12
+ display: "flex",
13
+ alignItems: "center",
14
+ gap: spacing[4],
15
+ width: "100%",
16
+ paddingInline: spacing[5],
17
+ paddingBlock: spacing[3],
18
+ backgroundColor: colors.background,
19
+ color: colors.foreground,
20
+ fontFamily: typography.fontFamily
21
+ },
22
+ brand: {
23
+ display: "flex",
24
+ alignItems: "center",
25
+ flexShrink: 0
26
+ },
27
+ actions: {
28
+ display: "flex",
29
+ alignItems: "center",
30
+ gap: spacing[2],
31
+ flexShrink: 0,
32
+ marginInlineStart: "auto"
33
+ }
34
+ });
35
+ var menuStyles = stylex.create({
36
+ root: {
37
+ display: "flex",
38
+ minWidth: 0
39
+ },
40
+ list: {
41
+ boxSizing: "border-box",
42
+ display: "flex",
43
+ alignItems: "center",
44
+ gap: spacing[1],
45
+ margin: 0,
46
+ padding: 0,
47
+ listStyleType: "none"
48
+ },
49
+ positioner: {
50
+ boxSizing: "border-box",
51
+ zIndex: 50
52
+ },
53
+ popupBase: {
54
+ boxSizing: "border-box",
55
+ overflow: "hidden",
56
+ borderWidth: borders.surface,
57
+ borderStyle: "solid",
58
+ borderColor: colors.border,
59
+ borderRadius: radii.md,
60
+ backgroundColor: colors.surface,
61
+ color: colors.surfaceForeground,
62
+ boxShadow: elevation.md,
63
+ transitionProperty: "opacity",
64
+ transitionDuration: {
65
+ default: motion.normal,
66
+ "@media (prefers-reduced-motion: reduce)": "0ms"
67
+ },
68
+ transitionTimingFunction: motion.standard
69
+ },
70
+ popupVisible: { opacity: 1 },
71
+ popupHidden: { opacity: 0 },
72
+ viewport: { boxSizing: "border-box" },
73
+ content: {
74
+ boxSizing: "border-box",
75
+ display: "flex",
76
+ flexDirection: "column",
77
+ gap: spacing[2],
78
+ minWidth: "12rem",
79
+ padding: spacing[4]
80
+ }
81
+ });
82
+ var itemStyles = stylex.create({
83
+ interactive: {
84
+ boxSizing: "border-box",
85
+ display: "inline-flex",
86
+ alignItems: "center",
87
+ gap: spacing[1],
88
+ paddingInline: spacing[3],
89
+ paddingBlock: spacing[2],
90
+ borderWidth: borders.control,
91
+ borderStyle: "solid",
92
+ borderColor: colors.border,
93
+ borderRadius: radii.md,
94
+ color: colors.foreground,
95
+ fontFamily: typography.fontFamily,
96
+ fontSize: fontSizes.sm,
97
+ fontWeight: fontWeights.medium,
98
+ lineHeight: lineHeights.normal,
99
+ textDecoration: "none",
100
+ whiteSpace: "nowrap",
101
+ cursor: "pointer",
102
+ outlineStyle: "solid",
103
+ outlineWidth: "2px",
104
+ outlineOffset: "2px",
105
+ outlineColor: {
106
+ default: "transparent",
107
+ ":focus-visible": colors.focus
108
+ },
109
+ transitionProperty: "background-color, color, outline-color",
110
+ transitionDuration: {
111
+ default: motion.fast,
112
+ "@media (prefers-reduced-motion: reduce)": "0ms"
113
+ },
114
+ transitionTimingFunction: motion.standard
115
+ },
116
+ inactive: { backgroundColor: {
117
+ default: "transparent",
118
+ ":hover": colors.mutedHover
119
+ } },
120
+ active: { backgroundColor: colors.mutedActive },
121
+ caret: {
122
+ flexShrink: 0,
123
+ display: "inline-flex",
124
+ width: "0.75rem",
125
+ height: "0.75rem",
126
+ transitionProperty: "transform",
127
+ transitionDuration: {
128
+ default: motion.fast,
129
+ "@media (prefers-reduced-motion: reduce)": "0ms"
130
+ },
131
+ transitionTimingFunction: motion.standard
132
+ },
133
+ caretOpen: { transform: "rotate(180deg)" },
134
+ caretIcon: {
135
+ display: "block",
136
+ width: "100%",
137
+ height: "100%"
138
+ }
139
+ });
140
+ function getItemStyles(active, xstyle) {
141
+ return stylex.props(itemStyles.interactive, active ? itemStyles.active : itemStyles.inactive, xstyle);
142
+ }
143
+ function getPopupStyles(open, transitionStatus) {
144
+ const hidden = !open || transitionStatus === "starting" || transitionStatus === "ending";
145
+ return stylex.props(menuStyles.popupBase, hidden ? menuStyles.popupHidden : menuStyles.popupVisible);
146
+ }
147
+ function CaretIcon() {
148
+ return jsx("svg", {
149
+ viewBox: "0 0 12 12",
150
+ fill: "none",
151
+ stroke: "currentColor",
152
+ strokeWidth: "1.5",
153
+ strokeLinecap: "round",
154
+ strokeLinejoin: "round",
155
+ "aria-hidden": "true",
156
+ ...stylex.props(itemStyles.caretIcon),
157
+ children: jsx("path", { d: "m2.5 4.5 3.5 3.5 3.5-3.5" })
158
+ });
159
+ }
160
+ function Navbar({ children, xstyle, ...props }) {
161
+ return jsx("header", {
162
+ ...props,
163
+ ...stylex.props(navbarStyles.root, xstyle),
164
+ children
165
+ });
166
+ }
167
+ function NavbarBrand({ children, xstyle, ...props }) {
168
+ return jsx("div", {
169
+ ...props,
170
+ ...stylex.props(navbarStyles.brand, xstyle),
171
+ children
172
+ });
173
+ }
174
+ function NavbarActions({ children, xstyle, ...props }) {
175
+ return jsx("div", {
176
+ ...props,
177
+ ...stylex.props(navbarStyles.actions, xstyle),
178
+ children
179
+ });
180
+ }
181
+ function NavbarPopup() {
182
+ return jsx(NavigationMenu.Popup, {
183
+ className: (state) => getPopupStyles(state.open, state.transitionStatus).className,
184
+ style: (state) => getPopupStyles(state.open, state.transitionStatus).style,
185
+ children: jsx(NavigationMenu.Viewport, { ...stylex.props(menuStyles.viewport) })
186
+ });
187
+ }
188
+ function NavbarMenu({ children, xstyle, ...props }) {
189
+ return jsx(PopupDirectionProvider, { children: jsx(NavbarMenuRoot, {
190
+ ...props,
191
+ xstyle,
192
+ children
193
+ }) });
194
+ }
195
+ function NavbarMenuRoot({ children, xstyle, ...props }) {
196
+ const portalHost = useThemePortalHost();
197
+ const [root, setRoot] = useState(null);
198
+ const [direction] = useElementDirection(root);
199
+ const popupDirection = usePopupDirection();
200
+ return jsx(ElementDirectionProvider, {
201
+ direction,
202
+ children: jsxs(NavigationMenu.Root, {
203
+ ...props,
204
+ ref: setRoot,
205
+ ...stylex.props(menuStyles.root, xstyle),
206
+ children: [jsx(NavigationMenu.List, {
207
+ ...stylex.props(menuStyles.list),
208
+ children
209
+ }), jsxs(NavigationMenu.Portal, {
210
+ container: portalHost,
211
+ children: [jsx(PopupDirectionSync, {}), jsx(ElementDirectionProvider, {
212
+ direction: popupDirection,
213
+ children: jsx(NavigationMenu.Positioner, {
214
+ dir: popupDirection,
215
+ sideOffset: 8,
216
+ collisionPadding: 16,
217
+ ...stylex.props(menuStyles.positioner),
218
+ children: jsx(NavbarPopup, {})
219
+ })
220
+ })]
221
+ })]
222
+ })
223
+ });
224
+ }
225
+ function NavbarItem({ xstyle, ...props }) {
226
+ return jsx(NavigationMenu.Item, {
227
+ ...props,
228
+ ...stylex.props(xstyle)
229
+ });
230
+ }
231
+ function NavbarTrigger({ children, xstyle, ...props }) {
232
+ const anchorRef = usePopupAnchorRef();
233
+ return jsxs(NavigationMenu.Trigger, {
234
+ ...props,
235
+ ref: anchorRef,
236
+ className: (state) => getItemStyles(state.open, xstyle).className,
237
+ style: (state) => getItemStyles(state.open, xstyle).style,
238
+ children: [children, jsx(NavigationMenu.Icon, {
239
+ className: (state) => stylex.props(itemStyles.caret, state.open && itemStyles.caretOpen).className,
240
+ style: (state) => stylex.props(itemStyles.caret, state.open && itemStyles.caretOpen).style,
241
+ children: jsx(CaretIcon, {})
242
+ })]
243
+ });
244
+ }
245
+ function NavbarContent({ xstyle, ...props }) {
246
+ return jsx(NavigationMenu.Content, {
247
+ ...props,
248
+ ...stylex.props(menuStyles.content, xstyle)
249
+ });
250
+ }
251
+ function NavbarLink({ xstyle, ...props }) {
252
+ return jsx(NavigationMenu.Link, {
253
+ ...props,
254
+ className: (state) => getItemStyles(state.active, xstyle).className,
255
+ style: (state) => getItemStyles(state.active, xstyle).style
256
+ });
257
+ }
258
+ export { Navbar, NavbarActions, NavbarBrand, NavbarContent, NavbarItem, NavbarLink, NavbarMenu, NavbarTrigger };
@@ -0,0 +1,36 @@
1
+ import type { ComponentPropsWithoutRef } from "react";
2
+ import { Popover as BaseUIPopover } from "@base-ui/react/popover";
3
+ import type { StyleXStyles } from "@stylexjs/stylex";
4
+ export type PopoverProps = ComponentPropsWithoutRef<typeof BaseUIPopover.Root>;
5
+ type NativePopoverTriggerProps = Omit<ComponentPropsWithoutRef<typeof BaseUIPopover.Trigger>, "className" | "style">;
6
+ export type PopoverTriggerProps = NativePopoverTriggerProps & {
7
+ xstyle?: StyleXStyles;
8
+ };
9
+ type NativePopoverContentProps = Omit<ComponentPropsWithoutRef<typeof BaseUIPopover.Popup>, "className" | "style">;
10
+ type PopoverPositionerProps = ComponentPropsWithoutRef<typeof BaseUIPopover.Positioner>;
11
+ export type PopoverContentProps = NativePopoverContentProps & {
12
+ side?: PopoverPositionerProps["side"];
13
+ align?: PopoverPositionerProps["align"];
14
+ sideOffset?: PopoverPositionerProps["sideOffset"];
15
+ alignOffset?: PopoverPositionerProps["alignOffset"];
16
+ xstyle?: StyleXStyles;
17
+ };
18
+ type NativePopoverTitleProps = Omit<ComponentPropsWithoutRef<typeof BaseUIPopover.Title>, "className" | "style">;
19
+ export type PopoverTitleProps = NativePopoverTitleProps & {
20
+ xstyle?: StyleXStyles;
21
+ };
22
+ type NativePopoverDescriptionProps = Omit<ComponentPropsWithoutRef<typeof BaseUIPopover.Description>, "className" | "style">;
23
+ export type PopoverDescriptionProps = NativePopoverDescriptionProps & {
24
+ xstyle?: StyleXStyles;
25
+ };
26
+ type NativePopoverCloseProps = Omit<ComponentPropsWithoutRef<typeof BaseUIPopover.Close>, "className" | "style">;
27
+ export type PopoverCloseProps = NativePopoverCloseProps & {
28
+ xstyle?: StyleXStyles;
29
+ };
30
+ export declare function Popover(props: PopoverProps): import("react").JSX.Element;
31
+ export declare function PopoverTrigger({ xstyle, ...props }: PopoverTriggerProps): import("react").JSX.Element;
32
+ export declare function PopoverContent({ side, align, sideOffset, alignOffset, xstyle, children, ...props }: PopoverContentProps): import("react").JSX.Element;
33
+ export declare function PopoverTitle({ xstyle, ...props }: PopoverTitleProps): import("react").JSX.Element;
34
+ export declare function PopoverDescription({ xstyle, ...props }: PopoverDescriptionProps): import("react").JSX.Element;
35
+ export declare function PopoverClose({ xstyle, ...props }: PopoverCloseProps): import("react").JSX.Element;
36
+ export {};
@@ -0,0 +1,148 @@
1
+ import { colors } from "./semantic-colors.stylex.js";
2
+ import { borders, 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 { Popover as Popover$1 } from "@base-ui/react/popover";
8
+ var styles = stylex.create({
9
+ popup: {
10
+ display: "flex",
11
+ flexDirection: "column",
12
+ gap: spacing[3],
13
+ boxSizing: "border-box",
14
+ minWidth: "14rem",
15
+ maxWidth: "20rem",
16
+ padding: spacing[4],
17
+ borderWidth: borders.surface,
18
+ borderStyle: "solid",
19
+ borderColor: colors.border,
20
+ borderRadius: radii.lg,
21
+ backgroundColor: colors.surface,
22
+ color: colors.surfaceForeground,
23
+ boxShadow: elevation.md,
24
+ transformOrigin: "var(--transform-origin)",
25
+ transitionProperty: "opacity, transform",
26
+ transitionDuration: {
27
+ default: motion.fast,
28
+ "@media (prefers-reduced-motion: reduce)": "0ms"
29
+ },
30
+ transitionTimingFunction: motion.standard
31
+ },
32
+ popupVisible: {
33
+ opacity: 1,
34
+ transform: "scale(1)"
35
+ },
36
+ popupHidden: {
37
+ opacity: 0,
38
+ transform: "scale(0.96)"
39
+ },
40
+ popupInstant: { transitionDuration: "0ms" },
41
+ title: {
42
+ margin: 0,
43
+ color: colors.surfaceForeground,
44
+ fontFamily: typography.fontFamily,
45
+ fontSize: fontSizes.md,
46
+ fontWeight: fontWeights.semibold,
47
+ lineHeight: lineHeights.tight
48
+ },
49
+ description: {
50
+ margin: 0,
51
+ color: colors.mutedForeground,
52
+ fontFamily: typography.fontFamily,
53
+ fontSize: fontSizes.sm,
54
+ lineHeight: lineHeights.normal
55
+ },
56
+ close: {
57
+ alignSelf: "flex-start",
58
+ borderWidth: borders.control,
59
+ borderStyle: "solid",
60
+ borderColor: colors.border,
61
+ borderRadius: radii.md,
62
+ paddingBlock: spacing[2],
63
+ paddingInline: spacing[3],
64
+ backgroundColor: {
65
+ default: colors.muted,
66
+ ":hover": colors.mutedHover,
67
+ ":active": colors.mutedActive
68
+ },
69
+ color: colors.foreground,
70
+ fontFamily: typography.fontFamily,
71
+ fontSize: fontSizes.sm,
72
+ lineHeight: lineHeights.normal,
73
+ cursor: "pointer",
74
+ outlineStyle: "solid",
75
+ outlineWidth: "2px",
76
+ outlineOffset: "2px",
77
+ outlineColor: {
78
+ default: "transparent",
79
+ ":focus-visible": colors.focus
80
+ },
81
+ transitionProperty: "background-color, outline-color",
82
+ transitionDuration: {
83
+ default: motion.fast,
84
+ "@media (prefers-reduced-motion: reduce)": "0ms"
85
+ },
86
+ transitionTimingFunction: motion.standard
87
+ }
88
+ });
89
+ function isPopupHidden(open, transitionStatus) {
90
+ return !open || transitionStatus === "starting" || transitionStatus === "ending";
91
+ }
92
+ function Popover(props) {
93
+ return jsx(PopupDirectionProvider, { children: jsx(PopoverRoot, { ...props }) });
94
+ }
95
+ function PopoverRoot({ onOpenChange, ...props }) {
96
+ const handleOpenChange = usePopupOpenChange(onOpenChange);
97
+ return jsx(Popover$1.Root, {
98
+ ...props,
99
+ onOpenChange: handleOpenChange
100
+ });
101
+ }
102
+ function PopoverTrigger({ xstyle, ...props }) {
103
+ const anchorRef = usePopupAnchorRef();
104
+ return jsx(Popover$1.Trigger, {
105
+ ...props,
106
+ ref: anchorRef,
107
+ ...stylex.props(xstyle)
108
+ });
109
+ }
110
+ function PopoverContent({ side = "bottom", align = "center", sideOffset = 8, alignOffset = 0, xstyle, children, ...props }) {
111
+ const portalHost = useThemePortalHost();
112
+ const direction = usePopupDirection();
113
+ return jsxs(Popover$1.Portal, {
114
+ container: portalHost ?? void 0,
115
+ children: [jsx(PopupDirectionSync, {}), jsx(Popover$1.Positioner, {
116
+ dir: direction,
117
+ side,
118
+ align,
119
+ sideOffset,
120
+ alignOffset,
121
+ children: jsx(Popover$1.Popup, {
122
+ ...props,
123
+ className: (state) => stylex.props(styles.popup, isPopupHidden(state.open, state.transitionStatus) ? styles.popupHidden : styles.popupVisible, state.instant && styles.popupInstant, xstyle).className,
124
+ style: (state) => stylex.props(styles.popup, isPopupHidden(state.open, state.transitionStatus) ? styles.popupHidden : styles.popupVisible, state.instant && styles.popupInstant, xstyle).style,
125
+ children
126
+ })
127
+ })]
128
+ });
129
+ }
130
+ function PopoverTitle({ xstyle, ...props }) {
131
+ return jsx(Popover$1.Title, {
132
+ ...props,
133
+ ...stylex.props(styles.title, xstyle)
134
+ });
135
+ }
136
+ function PopoverDescription({ xstyle, ...props }) {
137
+ return jsx(Popover$1.Description, {
138
+ ...props,
139
+ ...stylex.props(styles.description, xstyle)
140
+ });
141
+ }
142
+ function PopoverClose({ xstyle, ...props }) {
143
+ return jsx(Popover$1.Close, {
144
+ ...props,
145
+ ...stylex.props(styles.close, xstyle)
146
+ });
147
+ }
148
+ export { Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger };
@@ -0,0 +1,23 @@
1
+ import type { ComponentPropsWithoutRef } from "react";
2
+ import { Progress as BaseUIProgress } from "@base-ui/react/progress";
3
+ import type { StyleXStyles } from "@stylexjs/stylex";
4
+ export type ProgressProps = Omit<ComponentPropsWithoutRef<typeof BaseUIProgress.Root>, "className" | "style"> & {
5
+ xstyle?: StyleXStyles;
6
+ };
7
+ export type ProgressLabelProps = Omit<ComponentPropsWithoutRef<typeof BaseUIProgress.Label>, "className" | "style"> & {
8
+ xstyle?: StyleXStyles;
9
+ };
10
+ export type ProgressTrackProps = Omit<ComponentPropsWithoutRef<typeof BaseUIProgress.Track>, "className" | "style"> & {
11
+ xstyle?: StyleXStyles;
12
+ };
13
+ export type ProgressIndicatorProps = Omit<ComponentPropsWithoutRef<typeof BaseUIProgress.Indicator>, "className" | "style"> & {
14
+ xstyle?: StyleXStyles;
15
+ };
16
+ export type ProgressValueProps = Omit<ComponentPropsWithoutRef<typeof BaseUIProgress.Value>, "className" | "style"> & {
17
+ xstyle?: StyleXStyles;
18
+ };
19
+ export declare function Progress({ xstyle, ...props }: ProgressProps): import("react").JSX.Element;
20
+ export declare function ProgressLabel({ xstyle, ...props }: ProgressLabelProps): import("react").JSX.Element;
21
+ export declare function ProgressTrack({ xstyle, ...props }: ProgressTrackProps): import("react").JSX.Element;
22
+ export declare function ProgressIndicator({ xstyle, ...props }: ProgressIndicatorProps): import("react").JSX.Element;
23
+ export declare function ProgressValue({ xstyle, ...props }: ProgressValueProps): import("react").JSX.Element;
@@ -0,0 +1,67 @@
1
+ import { colors } from "./semantic-colors.stylex.js";
2
+ import { fontSizes, fontWeights, lineHeights, radii, spacing, typography } from "./tokens.stylex.js";
3
+ import * as stylex from "@stylexjs/stylex";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { Progress as Progress$1 } from "@base-ui/react/progress";
6
+ var styles = stylex.create({
7
+ root: {
8
+ display: "flex",
9
+ flexDirection: "column",
10
+ gap: spacing[2],
11
+ inlineSize: "100%",
12
+ minInlineSize: 0,
13
+ color: colors.foreground,
14
+ fontFamily: typography.fontFamily,
15
+ fontSize: fontSizes.sm,
16
+ lineHeight: lineHeights.normal
17
+ },
18
+ label: { fontWeight: fontWeights.medium },
19
+ track: {
20
+ display: "flex",
21
+ inlineSize: "100%",
22
+ blockSize: spacing[2],
23
+ overflow: "hidden",
24
+ borderRadius: radii.full,
25
+ backgroundColor: colors.muted
26
+ },
27
+ indicator: {
28
+ flexShrink: 0,
29
+ blockSize: "100%",
30
+ borderRadius: radii.full,
31
+ backgroundColor: colors.primary
32
+ },
33
+ indeterminate: { inlineSize: "33.333%" },
34
+ value: { color: colors.mutedForeground }
35
+ });
36
+ function Progress({ xstyle, ...props }) {
37
+ return jsx(Progress$1.Root, {
38
+ ...props,
39
+ ...stylex.props(styles.root, xstyle)
40
+ });
41
+ }
42
+ function ProgressLabel({ xstyle, ...props }) {
43
+ return jsx(Progress$1.Label, {
44
+ ...props,
45
+ ...stylex.props(styles.label, xstyle)
46
+ });
47
+ }
48
+ function ProgressTrack({ xstyle, ...props }) {
49
+ return jsx(Progress$1.Track, {
50
+ ...props,
51
+ ...stylex.props(styles.track, xstyle)
52
+ });
53
+ }
54
+ function ProgressIndicator({ xstyle, ...props }) {
55
+ return jsx(Progress$1.Indicator, {
56
+ ...props,
57
+ className: (state) => stylex.props(styles.indicator, state.status === "indeterminate" && styles.indeterminate, xstyle).className,
58
+ style: (state) => stylex.props(styles.indicator, state.status === "indeterminate" && styles.indeterminate, xstyle).style
59
+ });
60
+ }
61
+ function ProgressValue({ xstyle, ...props }) {
62
+ return jsx(Progress$1.Value, {
63
+ ...props,
64
+ ...stylex.props(styles.value, xstyle)
65
+ });
66
+ }
67
+ export { Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue };
@@ -0,0 +1,15 @@
1
+ import { type ComponentPropsWithoutRef } from "react";
2
+ import { Radio as BaseUIRadio } from "@base-ui/react/radio";
3
+ import { RadioGroup as BaseUIRadioGroup } from "@base-ui/react/radio-group";
4
+ import type { StyleXStyles } from "@stylexjs/stylex";
5
+ type NativeRadioGroupProps = Omit<ComponentPropsWithoutRef<typeof BaseUIRadioGroup>, "className" | "style">;
6
+ export type RadioGroupProps = NativeRadioGroupProps & {
7
+ xstyle?: StyleXStyles;
8
+ };
9
+ type NativeRadioProps = Omit<ComponentPropsWithoutRef<typeof BaseUIRadio.Root>, "children" | "className" | "style">;
10
+ export type RadioProps = NativeRadioProps & {
11
+ xstyle?: StyleXStyles;
12
+ };
13
+ export declare function RadioGroup({ xstyle, ...props }: RadioGroupProps): import("react").JSX.Element;
14
+ export declare function Radio({ xstyle, ...props }: RadioProps): import("react").JSX.Element;
15
+ export {};