@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/button.js ADDED
@@ -0,0 +1,174 @@
1
+ import { colors } from "./semantic-colors.stylex.js";
2
+ import { borders, controlSizes, fontSizes, fontWeights, lineHeights, motion, radii, spacing, typography } from "./tokens.stylex.js";
3
+ import * as stylex from "@stylexjs/stylex";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ import { Button as Button$1 } from "@base-ui/react/button";
6
+ var spin = stylex.keyframes({
7
+ from: { transform: "rotate(0deg)" },
8
+ to: { transform: "rotate(360deg)" }
9
+ });
10
+ var styles = stylex.create({
11
+ root: {
12
+ position: "relative",
13
+ display: "inline-flex",
14
+ alignItems: "center",
15
+ justifyContent: "center",
16
+ gap: spacing[2],
17
+ paddingBlock: spacing[2],
18
+ paddingInline: spacing[4],
19
+ borderWidth: borders.outline,
20
+ borderStyle: "solid",
21
+ borderColor: "transparent",
22
+ fontFamily: typography.fontFamily,
23
+ fontSize: fontSizes.md,
24
+ fontWeight: fontWeights.semibold,
25
+ lineHeight: lineHeights.normal,
26
+ whiteSpace: "nowrap",
27
+ userSelect: "none",
28
+ cursor: {
29
+ default: "pointer",
30
+ ":disabled": "not-allowed"
31
+ },
32
+ opacity: {
33
+ default: 1,
34
+ ":disabled": .5
35
+ },
36
+ outlineColor: {
37
+ default: "transparent",
38
+ ":focus-visible": colors.focus
39
+ },
40
+ outlineStyle: "solid",
41
+ outlineWidth: "2px",
42
+ outlineOffset: "2px",
43
+ transitionProperty: "background-color, color, border-color, opacity",
44
+ transitionDuration: {
45
+ default: motion.fast,
46
+ "@media (prefers-reduced-motion: reduce)": "0ms"
47
+ },
48
+ transitionTimingFunction: motion.standard
49
+ },
50
+ loading: { cursor: "wait" },
51
+ content: {
52
+ display: "inline-flex",
53
+ alignItems: "center",
54
+ gap: spacing[2],
55
+ opacity: 0
56
+ },
57
+ spinner: {
58
+ position: "absolute",
59
+ inset: 0,
60
+ margin: "auto",
61
+ boxSizing: "border-box",
62
+ width: "1em",
63
+ height: "1em",
64
+ borderRadius: radii.full,
65
+ borderWidth: "0.15em",
66
+ borderStyle: "solid",
67
+ borderColor: "currentColor",
68
+ borderBlockStartColor: "transparent",
69
+ animationName: spin,
70
+ animationDuration: {
71
+ default: "550ms",
72
+ "@media (prefers-reduced-motion: reduce)": "0ms"
73
+ },
74
+ animationTimingFunction: "linear",
75
+ animationIterationCount: "infinite"
76
+ }
77
+ });
78
+ var variantStyles = stylex.create({
79
+ primary: {
80
+ backgroundColor: {
81
+ default: colors.primary,
82
+ ":hover": colors.primaryHover,
83
+ ":active": colors.primaryActive
84
+ },
85
+ color: colors.onPrimary
86
+ },
87
+ secondary: {
88
+ backgroundColor: {
89
+ default: colors.muted,
90
+ ":hover": colors.mutedHover,
91
+ ":active": colors.mutedActive
92
+ },
93
+ color: colors.foreground
94
+ },
95
+ outline: {
96
+ backgroundColor: {
97
+ default: "transparent",
98
+ ":hover": colors.muted,
99
+ ":active": colors.mutedActive
100
+ },
101
+ color: colors.foreground,
102
+ borderColor: colors.border
103
+ },
104
+ danger: {
105
+ backgroundColor: {
106
+ default: colors.danger,
107
+ ":hover": colors.dangerHover,
108
+ ":active": colors.dangerActive
109
+ },
110
+ color: colors.onDanger
111
+ },
112
+ ghost: {
113
+ backgroundColor: {
114
+ default: "transparent",
115
+ ":hover": colors.muted,
116
+ ":active": colors.mutedActive
117
+ },
118
+ color: colors.foreground
119
+ },
120
+ link: {
121
+ backgroundColor: "transparent",
122
+ color: {
123
+ default: colors.primary,
124
+ ":hover": colors.primaryHover,
125
+ ":active": colors.primaryActive
126
+ },
127
+ borderColor: "transparent",
128
+ textDecoration: {
129
+ default: "none",
130
+ ":hover": "underline"
131
+ }
132
+ }
133
+ });
134
+ var sizeStyles = stylex.create({
135
+ sm: {
136
+ minHeight: controlSizes.sm,
137
+ paddingBlock: spacing[1],
138
+ paddingInline: spacing[3],
139
+ fontSize: fontSizes.sm
140
+ },
141
+ md: {
142
+ minHeight: controlSizes.md,
143
+ paddingBlock: spacing[2],
144
+ paddingInline: spacing[4],
145
+ fontSize: fontSizes.md
146
+ },
147
+ lg: {
148
+ minHeight: controlSizes.lg,
149
+ paddingBlock: spacing[3],
150
+ paddingInline: spacing[5],
151
+ fontSize: fontSizes.lg
152
+ }
153
+ });
154
+ var shapeStyles = stylex.create({
155
+ default: { borderRadius: radii.md },
156
+ pill: { borderRadius: radii.full }
157
+ });
158
+ function Button({ children, xstyle, variant = "primary", size = "md", shape = "default", loading = false, disabled, focusableWhenDisabled, ...props }) {
159
+ return jsx(Button$1, {
160
+ ...props,
161
+ disabled: disabled || loading,
162
+ focusableWhenDisabled: loading ? true : focusableWhenDisabled,
163
+ "aria-busy": loading || void 0,
164
+ ...stylex.props(styles.root, variantStyles[variant], shapeStyles[shape], sizeStyles[size], loading && styles.loading, xstyle),
165
+ children: loading ? jsxs(Fragment, { children: [jsx("span", {
166
+ "aria-hidden": "true",
167
+ ...stylex.props(styles.spinner)
168
+ }), jsx("span", {
169
+ ...stylex.props(styles.content),
170
+ children
171
+ })] }) : children
172
+ });
173
+ }
174
+ export { Button };
package/dist/card.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ import type { ComponentPropsWithoutRef } from "react";
2
+ import type { StyleXStyles } from "@stylexjs/stylex";
3
+ type NativeCardProps = Omit<ComponentPropsWithoutRef<"div">, "className" | "style">;
4
+ export type CardProps = NativeCardProps & {
5
+ xstyle?: StyleXStyles;
6
+ };
7
+ export type CardHeaderProps = CardProps;
8
+ export type CardContentProps = CardProps;
9
+ export type CardFooterProps = CardProps;
10
+ type NativeCardTitleProps = Omit<ComponentPropsWithoutRef<"div">, "className" | "style">;
11
+ export type CardTitleProps = NativeCardTitleProps & {
12
+ xstyle?: StyleXStyles;
13
+ };
14
+ type NativeCardDescriptionProps = Omit<ComponentPropsWithoutRef<"p">, "className" | "style">;
15
+ export type CardDescriptionProps = NativeCardDescriptionProps & {
16
+ xstyle?: StyleXStyles;
17
+ };
18
+ export declare function Card({ xstyle, ...props }: CardProps): import("react").JSX.Element;
19
+ export declare function CardHeader({ xstyle, ...props }: CardHeaderProps): import("react").JSX.Element;
20
+ export declare function CardTitle({ xstyle, ...props }: CardTitleProps): import("react").JSX.Element;
21
+ export declare function CardDescription({ xstyle, ...props }: CardDescriptionProps): import("react").JSX.Element;
22
+ export declare function CardContent({ xstyle, ...props }: CardContentProps): import("react").JSX.Element;
23
+ export declare function CardFooter({ xstyle, ...props }: CardFooterProps): import("react").JSX.Element;
24
+ export {};
package/dist/card.js ADDED
@@ -0,0 +1,81 @@
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
+ var styles = stylex.create({
6
+ card: {
7
+ display: "flex",
8
+ flexDirection: "column",
9
+ gap: spacing[4],
10
+ minWidth: 0,
11
+ padding: spacing[5],
12
+ borderRadius: radii.lg,
13
+ backgroundColor: colors.surface,
14
+ color: colors.surfaceForeground
15
+ },
16
+ header: {
17
+ display: "flex",
18
+ flexDirection: "column",
19
+ gap: spacing[1],
20
+ minWidth: 0
21
+ },
22
+ title: {
23
+ color: colors.surfaceForeground,
24
+ fontFamily: typography.fontFamily,
25
+ fontSize: fontSizes.lg,
26
+ fontWeight: fontWeights.semibold,
27
+ lineHeight: lineHeights.tight
28
+ },
29
+ description: {
30
+ margin: 0,
31
+ color: colors.mutedForeground,
32
+ fontFamily: typography.fontFamily,
33
+ fontSize: fontSizes.sm,
34
+ lineHeight: lineHeights.normal
35
+ },
36
+ content: { minWidth: 0 },
37
+ footer: {
38
+ display: "flex",
39
+ alignItems: "center",
40
+ gap: spacing[2],
41
+ flexWrap: "wrap",
42
+ minWidth: 0
43
+ }
44
+ });
45
+ function Card({ xstyle, ...props }) {
46
+ return jsx("div", {
47
+ ...props,
48
+ ...stylex.props(styles.card, xstyle)
49
+ });
50
+ }
51
+ function CardHeader({ xstyle, ...props }) {
52
+ return jsx("div", {
53
+ ...props,
54
+ ...stylex.props(styles.header, xstyle)
55
+ });
56
+ }
57
+ function CardTitle({ xstyle, ...props }) {
58
+ return jsx("div", {
59
+ ...props,
60
+ ...stylex.props(styles.title, xstyle)
61
+ });
62
+ }
63
+ function CardDescription({ xstyle, ...props }) {
64
+ return jsx("p", {
65
+ ...props,
66
+ ...stylex.props(styles.description, xstyle)
67
+ });
68
+ }
69
+ function CardContent({ xstyle, ...props }) {
70
+ return jsx("div", {
71
+ ...props,
72
+ ...stylex.props(styles.content, xstyle)
73
+ });
74
+ }
75
+ function CardFooter({ xstyle, ...props }) {
76
+ return jsx("div", {
77
+ ...props,
78
+ ...stylex.props(styles.footer, xstyle)
79
+ });
80
+ }
81
+ export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
@@ -0,0 +1,9 @@
1
+ import type { ComponentPropsWithoutRef } from "react";
2
+ import { Checkbox as BaseUICheckbox } from "@base-ui/react/checkbox";
3
+ import type { StyleXStyles } from "@stylexjs/stylex";
4
+ type NativeCheckboxProps = Omit<ComponentPropsWithoutRef<typeof BaseUICheckbox.Root>, "children" | "className" | "style" | "indeterminate">;
5
+ export type CheckboxProps = NativeCheckboxProps & {
6
+ xstyle?: StyleXStyles;
7
+ };
8
+ export declare function Checkbox({ xstyle, ...props }: CheckboxProps): import("react").JSX.Element;
9
+ export {};
@@ -0,0 +1,91 @@
1
+ import { colors } from "./semantic-colors.stylex.js";
2
+ import { borders, motion, radii, spacing } from "./tokens.stylex.js";
3
+ import * as stylex from "@stylexjs/stylex";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
6
+ var styles = stylex.create({
7
+ root: {
8
+ display: "inline-flex",
9
+ alignItems: "center",
10
+ justifyContent: "center",
11
+ flexShrink: 0,
12
+ width: spacing[5],
13
+ height: spacing[5],
14
+ borderWidth: borders.control,
15
+ borderStyle: "solid",
16
+ borderColor: colors.border,
17
+ borderRadius: radii.sm,
18
+ cursor: "pointer",
19
+ outlineStyle: "solid",
20
+ outlineWidth: "2px",
21
+ outlineOffset: "2px",
22
+ outlineColor: {
23
+ default: "transparent",
24
+ ":focus-visible": colors.focus
25
+ },
26
+ transitionProperty: "background-color, color, opacity, outline-color",
27
+ transitionDuration: {
28
+ default: motion.fast,
29
+ "@media (prefers-reduced-motion: reduce)": "0ms"
30
+ },
31
+ transitionTimingFunction: motion.standard,
32
+ verticalAlign: "middle"
33
+ },
34
+ unchecked: { backgroundColor: {
35
+ default: colors.muted,
36
+ ":hover": colors.mutedHover,
37
+ ":active": colors.mutedActive
38
+ } },
39
+ checked: {
40
+ backgroundColor: {
41
+ default: colors.primary,
42
+ ":hover": colors.primaryHover,
43
+ ":active": colors.primaryActive
44
+ },
45
+ color: colors.onPrimary
46
+ },
47
+ disabled: {
48
+ cursor: "not-allowed",
49
+ opacity: .5
50
+ },
51
+ indicator: {
52
+ display: "flex",
53
+ alignItems: "center",
54
+ justifyContent: "center",
55
+ width: "100%",
56
+ height: "100%"
57
+ },
58
+ icon: {
59
+ display: "block",
60
+ width: "0.875rem",
61
+ height: "0.875rem"
62
+ }
63
+ });
64
+ function getRootStyles(checked, disabled, xstyle) {
65
+ return stylex.props(styles.root, checked ? styles.checked : styles.unchecked, disabled && styles.disabled, xstyle);
66
+ }
67
+ function CheckIcon() {
68
+ return jsx("svg", {
69
+ viewBox: "0 0 16 16",
70
+ fill: "none",
71
+ stroke: "currentColor",
72
+ strokeWidth: "2",
73
+ strokeLinecap: "round",
74
+ strokeLinejoin: "round",
75
+ "aria-hidden": "true",
76
+ ...stylex.props(styles.icon),
77
+ children: jsx("path", { d: "m3 8 3 3 7-7" })
78
+ });
79
+ }
80
+ function Checkbox({ xstyle, ...props }) {
81
+ return jsx(Checkbox$1.Root, {
82
+ ...props,
83
+ className: (state) => getRootStyles(state.checked, state.disabled, xstyle).className,
84
+ style: (state) => getRootStyles(state.checked, state.disabled, xstyle).style,
85
+ children: jsx(Checkbox$1.Indicator, {
86
+ ...stylex.props(styles.indicator),
87
+ children: jsx(CheckIcon, {})
88
+ })
89
+ });
90
+ }
91
+ export { Checkbox };
@@ -0,0 +1,39 @@
1
+ import type { ComponentPropsWithoutRef, ReactNode } from "react";
2
+ import { Dialog as BaseUIDialog } from "@base-ui/react/dialog";
3
+ import type { StyleXStyles } from "@stylexjs/stylex";
4
+ export type DialogProps = ComponentPropsWithoutRef<typeof BaseUIDialog.Root>;
5
+ type NativeDialogTriggerProps = Omit<ComponentPropsWithoutRef<typeof BaseUIDialog.Trigger>, "className" | "style">;
6
+ export type DialogTriggerProps = NativeDialogTriggerProps & {
7
+ xstyle?: StyleXStyles;
8
+ };
9
+ type NativeDialogContentProps = Omit<ComponentPropsWithoutRef<typeof BaseUIDialog.Popup>, "className" | "style">;
10
+ export type DialogContentProps = NativeDialogContentProps & {
11
+ xstyle?: StyleXStyles;
12
+ };
13
+ type NativeDialogHeaderProps = Omit<ComponentPropsWithoutRef<"div">, "className" | "style">;
14
+ export type DialogHeaderProps = NativeDialogHeaderProps & {
15
+ children: ReactNode;
16
+ xstyle?: StyleXStyles;
17
+ };
18
+ export type DialogFooterProps = DialogHeaderProps;
19
+ type NativeDialogTitleProps = Omit<ComponentPropsWithoutRef<typeof BaseUIDialog.Title>, "className" | "style">;
20
+ export type DialogTitleProps = NativeDialogTitleProps & {
21
+ xstyle?: StyleXStyles;
22
+ };
23
+ type NativeDialogDescriptionProps = Omit<ComponentPropsWithoutRef<typeof BaseUIDialog.Description>, "className" | "style">;
24
+ export type DialogDescriptionProps = NativeDialogDescriptionProps & {
25
+ xstyle?: StyleXStyles;
26
+ };
27
+ type NativeDialogCloseProps = Omit<ComponentPropsWithoutRef<typeof BaseUIDialog.Close>, "className" | "style">;
28
+ export type DialogCloseProps = NativeDialogCloseProps & {
29
+ xstyle?: StyleXStyles;
30
+ };
31
+ export declare function Dialog(props: DialogProps): import("react").JSX.Element;
32
+ export declare function DialogTrigger({ xstyle, ...props }: DialogTriggerProps): import("react").JSX.Element;
33
+ export declare function DialogContent({ xstyle, children, ...props }: DialogContentProps): import("react").JSX.Element;
34
+ export declare function DialogHeader({ xstyle, ...props }: DialogHeaderProps): import("react").JSX.Element;
35
+ export declare function DialogFooter({ xstyle, ...props }: DialogFooterProps): import("react").JSX.Element;
36
+ export declare function DialogTitle({ xstyle, ...props }: DialogTitleProps): import("react").JSX.Element;
37
+ export declare function DialogDescription({ xstyle, ...props }: DialogDescriptionProps): import("react").JSX.Element;
38
+ export declare function DialogClose({ xstyle, ...props }: DialogCloseProps): import("react").JSX.Element;
39
+ export {};
package/dist/dialog.js ADDED
@@ -0,0 +1,195 @@
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 { Dialog as Dialog$1 } from "@base-ui/react/dialog";
8
+ var styles = stylex.create({
9
+ backdrop: {
10
+ position: "fixed",
11
+ inset: 0,
12
+ backgroundColor: colors.backdrop,
13
+ transitionProperty: "opacity",
14
+ transitionDuration: {
15
+ default: motion.normal,
16
+ "@media (prefers-reduced-motion: reduce)": "0ms"
17
+ },
18
+ transitionTimingFunction: motion.standard
19
+ },
20
+ backdropVisible: { opacity: 1 },
21
+ backdropHidden: { opacity: 0 },
22
+ viewport: {
23
+ position: "fixed",
24
+ inset: 0,
25
+ display: "flex",
26
+ alignItems: "center",
27
+ justifyContent: "center",
28
+ padding: spacing[4]
29
+ },
30
+ popup: {
31
+ display: "flex",
32
+ flexDirection: "column",
33
+ gap: spacing[3],
34
+ boxSizing: "border-box",
35
+ width: "100%",
36
+ maxWidth: "24rem",
37
+ borderWidth: borders.surface,
38
+ borderStyle: "solid",
39
+ borderColor: colors.border,
40
+ borderRadius: radii.lg,
41
+ backgroundColor: colors.surface,
42
+ color: colors.surfaceForeground,
43
+ padding: spacing[6],
44
+ boxShadow: elevation.md,
45
+ transitionProperty: "opacity, transform",
46
+ transitionDuration: {
47
+ default: motion.normal,
48
+ "@media (prefers-reduced-motion: reduce)": "0ms"
49
+ },
50
+ transitionTimingFunction: motion.standard
51
+ },
52
+ popupVisible: {
53
+ opacity: 1,
54
+ transform: "scale(1)"
55
+ },
56
+ popupHidden: {
57
+ opacity: 0,
58
+ transform: "scale(0.96)"
59
+ },
60
+ header: {
61
+ display: "flex",
62
+ flexDirection: "column",
63
+ gap: spacing[1],
64
+ minWidth: 0
65
+ },
66
+ footer: {
67
+ display: "flex",
68
+ alignItems: "center",
69
+ justifyContent: "flex-end",
70
+ gap: spacing[2],
71
+ flexWrap: "wrap",
72
+ minWidth: 0
73
+ },
74
+ title: {
75
+ margin: 0,
76
+ color: colors.surfaceForeground,
77
+ fontFamily: typography.fontFamily,
78
+ fontSize: fontSizes.lg,
79
+ fontWeight: fontWeights.bold,
80
+ lineHeight: lineHeights.tight
81
+ },
82
+ description: {
83
+ margin: 0,
84
+ color: colors.mutedForeground,
85
+ fontFamily: typography.fontFamily,
86
+ fontSize: fontSizes.sm,
87
+ lineHeight: lineHeights.normal
88
+ },
89
+ close: {
90
+ borderWidth: borders.control,
91
+ borderStyle: "solid",
92
+ borderColor: colors.border,
93
+ borderRadius: radii.md,
94
+ backgroundColor: {
95
+ default: colors.muted,
96
+ ":hover": colors.mutedHover,
97
+ ":active": colors.mutedActive
98
+ },
99
+ color: colors.foreground,
100
+ paddingBlock: spacing[2],
101
+ paddingInline: spacing[4],
102
+ fontFamily: typography.fontFamily,
103
+ fontSize: fontSizes.sm,
104
+ cursor: "pointer",
105
+ outlineStyle: "solid",
106
+ outlineWidth: "2px",
107
+ outlineOffset: "2px",
108
+ outlineColor: {
109
+ default: "transparent",
110
+ ":focus-visible": colors.focus
111
+ },
112
+ transitionProperty: "background-color, outline-color",
113
+ transitionDuration: {
114
+ default: motion.fast,
115
+ "@media (prefers-reduced-motion: reduce)": "0ms"
116
+ },
117
+ transitionTimingFunction: motion.standard
118
+ }
119
+ });
120
+ function isPopupHidden(open, transitionStatus) {
121
+ return !open || transitionStatus === "starting" || transitionStatus === "ending";
122
+ }
123
+ function Dialog(props) {
124
+ return jsx(PopupDirectionProvider, { children: jsx(DialogRoot, { ...props }) });
125
+ }
126
+ function DialogRoot({ onOpenChange, ...props }) {
127
+ const handleOpenChange = usePopupOpenChange(onOpenChange);
128
+ return jsx(Dialog$1.Root, {
129
+ ...props,
130
+ onOpenChange: handleOpenChange
131
+ });
132
+ }
133
+ function DialogTrigger({ xstyle, ...props }) {
134
+ const anchorRef = usePopupAnchorRef();
135
+ return jsx(Dialog$1.Trigger, {
136
+ ...props,
137
+ ref: anchorRef,
138
+ ...stylex.props(xstyle)
139
+ });
140
+ }
141
+ function DialogContent({ xstyle, children, ...props }) {
142
+ const portalHost = useThemePortalHost();
143
+ const direction = usePopupDirection();
144
+ return jsxs(Dialog$1.Portal, {
145
+ container: portalHost ?? void 0,
146
+ children: [
147
+ jsx(PopupDirectionSync, {}),
148
+ jsx(Dialog$1.Backdrop, {
149
+ className: (state) => stylex.props(styles.backdrop, isPopupHidden(state.open, state.transitionStatus) ? styles.backdropHidden : styles.backdropVisible).className,
150
+ style: (state) => stylex.props(styles.backdrop, isPopupHidden(state.open, state.transitionStatus) ? styles.backdropHidden : styles.backdropVisible).style
151
+ }),
152
+ jsx(Dialog$1.Viewport, {
153
+ dir: direction,
154
+ ...stylex.props(styles.viewport),
155
+ children: jsx(Dialog$1.Popup, {
156
+ ...props,
157
+ className: (state) => stylex.props(styles.popup, isPopupHidden(state.open, state.transitionStatus) ? styles.popupHidden : styles.popupVisible, xstyle).className,
158
+ style: (state) => stylex.props(styles.popup, isPopupHidden(state.open, state.transitionStatus) ? styles.popupHidden : styles.popupVisible, xstyle).style,
159
+ children
160
+ })
161
+ })
162
+ ]
163
+ });
164
+ }
165
+ function DialogHeader({ xstyle, ...props }) {
166
+ return jsx("div", {
167
+ ...props,
168
+ ...stylex.props(styles.header, xstyle)
169
+ });
170
+ }
171
+ function DialogFooter({ xstyle, ...props }) {
172
+ return jsx("div", {
173
+ ...props,
174
+ ...stylex.props(styles.footer, xstyle)
175
+ });
176
+ }
177
+ function DialogTitle({ xstyle, ...props }) {
178
+ return jsx(Dialog$1.Title, {
179
+ ...props,
180
+ ...stylex.props(styles.title, xstyle)
181
+ });
182
+ }
183
+ function DialogDescription({ xstyle, ...props }) {
184
+ return jsx(Dialog$1.Description, {
185
+ ...props,
186
+ ...stylex.props(styles.description, xstyle)
187
+ });
188
+ }
189
+ function DialogClose({ xstyle, ...props }) {
190
+ return jsx(Dialog$1.Close, {
191
+ ...props,
192
+ ...stylex.props(styles.close, xstyle)
193
+ });
194
+ }
195
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger };
@@ -0,0 +1,17 @@
1
+ import { type Dispatch, type ReactNode, type SetStateAction } from "react";
2
+ export type Direction = "ltr" | "rtl";
3
+ export declare function useElementDirection(element: Element | null): readonly [Direction | undefined, (target?: Element | null) => void];
4
+ export declare function ElementDirectionProvider({ direction, children, }: {
5
+ direction: Direction | undefined;
6
+ children: ReactNode;
7
+ }): import("react").JSX.Element;
8
+ export declare function PopupDirectionProvider({ children }: {
9
+ children: ReactNode;
10
+ }): import("react").JSX.Element;
11
+ export declare function usePopupAnchorRef(): Dispatch<SetStateAction<Element | null>>;
12
+ export declare function usePopupDirection(): Direction | undefined;
13
+ export declare function usePopupOpenChange<Details extends {
14
+ trigger: Element | undefined;
15
+ isCanceled: boolean;
16
+ }>(onOpenChange: ((open: boolean, details: Details) => void) | undefined): (open: boolean, details: Details) => void;
17
+ export declare function PopupDirectionSync(): null;