@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,68 @@
|
|
|
1
|
+
import { colors } from "../../semantic-colors.stylex.js";
|
|
2
|
+
import * as stylex from "@stylexjs/stylex";
|
|
3
|
+
var defaultSemanticColorTheme = stylex.createTheme(colors, {});
|
|
4
|
+
var compactSemanticColorTheme = stylex.createTheme(colors, {
|
|
5
|
+
background: "light-dark(#ffffff, #111318)",
|
|
6
|
+
foreground: "light-dark(#18181b, #f4f4f5)",
|
|
7
|
+
surface: "light-dark(#fafafa, #18181b)",
|
|
8
|
+
surfaceForeground: "light-dark(#18181b, #f4f4f5)",
|
|
9
|
+
muted: "light-dark(#f4f4f5, #27272a)",
|
|
10
|
+
mutedForeground: "light-dark(#71717a, #a1a1aa)",
|
|
11
|
+
border: "light-dark(#e4e4e7, #3f3f46)",
|
|
12
|
+
primary: "light-dark(#6d28d9, #7c3aed)",
|
|
13
|
+
onPrimary: "#ffffff",
|
|
14
|
+
danger: "light-dark(#dc2626, #dc2626)",
|
|
15
|
+
focus: "light-dark(#7c3aed, #a78bfa)",
|
|
16
|
+
primaryHover: "light-dark(#5b21b6, #6d28d9)",
|
|
17
|
+
primaryActive: "light-dark(#4c1d95, #5b21b6)",
|
|
18
|
+
mutedHover: "light-dark(#e4e4e7, #3f3f46)",
|
|
19
|
+
mutedActive: "light-dark(#d4d4d8, #52525b)"
|
|
20
|
+
});
|
|
21
|
+
var warmSemanticColorTheme = stylex.createTheme(colors, {
|
|
22
|
+
background: "light-dark(#f7f2ea, #171411)",
|
|
23
|
+
foreground: "light-dark(#231f1a, #f5efe5)",
|
|
24
|
+
surface: "light-dark(#fffaf2, #211d18)",
|
|
25
|
+
surfaceForeground: "light-dark(#231f1a, #f5efe5)",
|
|
26
|
+
muted: "light-dark(#ece3d6, #2c261f)",
|
|
27
|
+
mutedForeground: "light-dark(#6f6254, #c4b6a4)",
|
|
28
|
+
border: "light-dark(#d8cab9, #4b4034)",
|
|
29
|
+
backdrop: "light-dark(rgba(23, 20, 17, 0.5), rgba(23, 20, 17, 0.7))",
|
|
30
|
+
primary: "light-dark(#7b4f2b, #d6a45f)",
|
|
31
|
+
onPrimary: "light-dark(#fffaf2, #1d1711)",
|
|
32
|
+
primaryHover: "light-dark(#684123, #e0b06e)",
|
|
33
|
+
primaryActive: "light-dark(#55341d, #c88f48)",
|
|
34
|
+
mutedHover: "light-dark(#e3d7c7, #382f27)",
|
|
35
|
+
mutedActive: "light-dark(#d7c6b2, #44382e)",
|
|
36
|
+
danger: "light-dark(#a33d31, #e26d61)",
|
|
37
|
+
onDanger: "light-dark(#fffaf2, #1d1711)",
|
|
38
|
+
dangerHover: "light-dark(#873129, #ef8378)",
|
|
39
|
+
dangerActive: "light-dark(#6f2823, #cf5d54)",
|
|
40
|
+
focus: "light-dark(#9f6a35, #e0b66f)"
|
|
41
|
+
});
|
|
42
|
+
var vividSemanticColorTheme = stylex.createTheme(colors, {
|
|
43
|
+
background: "light-dark(#f5f6fc, #0a0b16)",
|
|
44
|
+
foreground: "light-dark(#0b0c1d, #f5f6ff)",
|
|
45
|
+
surface: "light-dark(#ffffff, #141629)",
|
|
46
|
+
surfaceForeground: "light-dark(#0b0c1d, #f5f6ff)",
|
|
47
|
+
muted: "light-dark(#e8eaf6, #1f2240)",
|
|
48
|
+
mutedForeground: "light-dark(#4b5070, #aab0d6)",
|
|
49
|
+
border: "light-dark(#c5cae2, #373c64)",
|
|
50
|
+
backdrop: "light-dark(rgba(10, 11, 22, 0.5), rgba(10, 11, 22, 0.7))",
|
|
51
|
+
primary: "light-dark(#3d3dff, #8b8bff)",
|
|
52
|
+
onPrimary: "light-dark(#ffffff, #0a0b16)",
|
|
53
|
+
primaryHover: "light-dark(#2a2ae6, #a3a3ff)",
|
|
54
|
+
primaryActive: "light-dark(#1f1fbf, #7373f5)",
|
|
55
|
+
mutedHover: "light-dark(#dcdff0, #2a2e52)",
|
|
56
|
+
mutedActive: "light-dark(#cbd0e8, #363b66)",
|
|
57
|
+
danger: "light-dark(#e0183f, #ff5c7a)",
|
|
58
|
+
onDanger: "light-dark(#ffffff, #0a0b16)",
|
|
59
|
+
dangerHover: "light-dark(#c21036, #ff7a92)",
|
|
60
|
+
dangerActive: "light-dark(#9f0d2d, #f0405f)",
|
|
61
|
+
focus: "light-dark(#e3169a, #ff6fd0)"
|
|
62
|
+
});
|
|
63
|
+
var semanticColorThemes = {
|
|
64
|
+
default: defaultSemanticColorTheme,
|
|
65
|
+
warm: warmSemanticColorTheme,
|
|
66
|
+
vivid: vividSemanticColorTheme
|
|
67
|
+
};
|
|
68
|
+
export { compactSemanticColorTheme, defaultSemanticColorTheme, semanticColorThemes, vividSemanticColorTheme, warmSemanticColorTheme };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as stylex from "@stylexjs/stylex";
|
|
2
|
+
export type TypeScaleOption = "default" | "expanded";
|
|
3
|
+
export declare const defaultTypeScaleTheme: stylex.Theme<stylex.VarGroup<Readonly<{
|
|
4
|
+
xs: string;
|
|
5
|
+
sm: string;
|
|
6
|
+
md: string;
|
|
7
|
+
lg: string;
|
|
8
|
+
xl: string;
|
|
9
|
+
"2xl": string;
|
|
10
|
+
}>, symbol>, symbol>;
|
|
11
|
+
export declare const expandedTypeScaleTheme: stylex.Theme<stylex.VarGroup<Readonly<{
|
|
12
|
+
xs: string;
|
|
13
|
+
sm: string;
|
|
14
|
+
md: string;
|
|
15
|
+
lg: string;
|
|
16
|
+
xl: string;
|
|
17
|
+
"2xl": string;
|
|
18
|
+
}>, symbol>, symbol>;
|
|
19
|
+
export declare const typeScaleThemes: {
|
|
20
|
+
readonly default: stylex.Theme<stylex.VarGroup<Readonly<{
|
|
21
|
+
xs: string;
|
|
22
|
+
sm: string;
|
|
23
|
+
md: string;
|
|
24
|
+
lg: string;
|
|
25
|
+
xl: string;
|
|
26
|
+
"2xl": string;
|
|
27
|
+
}>, symbol>, symbol>;
|
|
28
|
+
readonly expanded: stylex.Theme<stylex.VarGroup<Readonly<{
|
|
29
|
+
xs: string;
|
|
30
|
+
sm: string;
|
|
31
|
+
md: string;
|
|
32
|
+
lg: string;
|
|
33
|
+
xl: string;
|
|
34
|
+
"2xl": string;
|
|
35
|
+
}>, symbol>, symbol>;
|
|
36
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { fontSizes } from "../../tokens.stylex.js";
|
|
2
|
+
import * as stylex from "@stylexjs/stylex";
|
|
3
|
+
var defaultTypeScaleTheme = stylex.createTheme(fontSizes, {});
|
|
4
|
+
var expandedTypeScaleTheme = stylex.createTheme(fontSizes, {
|
|
5
|
+
xs: "0.8125rem",
|
|
6
|
+
sm: "0.9375rem",
|
|
7
|
+
md: "1.0625rem",
|
|
8
|
+
lg: "1.25rem",
|
|
9
|
+
xl: "1.5rem",
|
|
10
|
+
"2xl": "2rem"
|
|
11
|
+
});
|
|
12
|
+
var typeScaleThemes = {
|
|
13
|
+
default: defaultTypeScaleTheme,
|
|
14
|
+
expanded: expandedTypeScaleTheme
|
|
15
|
+
};
|
|
16
|
+
export { defaultTypeScaleTheme, expandedTypeScaleTheme, typeScaleThemes };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SpacingKey = 1 | 2 | 3 | 4 | 5 | 6 | 8;
|
|
File without changes
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as stylex from "@stylexjs/stylex";
|
|
2
|
+
import type { VarGroup } from "@stylexjs/stylex";
|
|
3
|
+
import type { SpacingKey } from "./token-types";
|
|
4
|
+
export { colors } from "./semantic-colors.stylex";
|
|
5
|
+
type RadiiTokens = {
|
|
6
|
+
base: string;
|
|
7
|
+
sm: string;
|
|
8
|
+
md: string;
|
|
9
|
+
lg: string;
|
|
10
|
+
full: string;
|
|
11
|
+
};
|
|
12
|
+
type SpacingTokens = {
|
|
13
|
+
base: string;
|
|
14
|
+
} & Record<SpacingKey, string>;
|
|
15
|
+
export declare const radii: VarGroup<RadiiTokens>;
|
|
16
|
+
export declare const typography: stylex.VarGroup<Readonly<{
|
|
17
|
+
fontFamily: string;
|
|
18
|
+
}>, symbol>;
|
|
19
|
+
export declare const spacing: VarGroup<SpacingTokens>;
|
|
20
|
+
export declare const fontSizes: stylex.VarGroup<Readonly<{
|
|
21
|
+
xs: string;
|
|
22
|
+
sm: string;
|
|
23
|
+
md: string;
|
|
24
|
+
lg: string;
|
|
25
|
+
xl: string;
|
|
26
|
+
"2xl": string;
|
|
27
|
+
}>, symbol>;
|
|
28
|
+
export declare const fontWeights: {
|
|
29
|
+
regular: string;
|
|
30
|
+
medium: string;
|
|
31
|
+
semibold: string;
|
|
32
|
+
bold: string;
|
|
33
|
+
};
|
|
34
|
+
export declare const lineHeights: stylex.VarGroup<Readonly<{
|
|
35
|
+
tight: string;
|
|
36
|
+
normal: string;
|
|
37
|
+
relaxed: string;
|
|
38
|
+
}>, symbol>;
|
|
39
|
+
export declare const motion: stylex.VarGroup<Readonly<{
|
|
40
|
+
fast: string;
|
|
41
|
+
normal: string;
|
|
42
|
+
slow: string;
|
|
43
|
+
standard: string;
|
|
44
|
+
}>, symbol>;
|
|
45
|
+
export declare const elevation: stylex.VarGroup<Readonly<{
|
|
46
|
+
sm: string;
|
|
47
|
+
md: string;
|
|
48
|
+
lg: string;
|
|
49
|
+
}>, symbol>;
|
|
50
|
+
export declare const controlSizes: stylex.VarGroup<Readonly<{
|
|
51
|
+
sm: string;
|
|
52
|
+
md: string;
|
|
53
|
+
lg: string;
|
|
54
|
+
}>, symbol>;
|
|
55
|
+
export declare const borders: stylex.VarGroup<Readonly<{
|
|
56
|
+
control: string;
|
|
57
|
+
surface: string;
|
|
58
|
+
outline: string;
|
|
59
|
+
}>, symbol>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { colors } from "./semantic-colors.stylex.js";
|
|
2
|
+
import * as stylex from "@stylexjs/stylex";
|
|
3
|
+
var radii = stylex.defineVars({
|
|
4
|
+
base: "0.5rem",
|
|
5
|
+
sm: () => `max(0px, calc(${radii.base} - 0.25rem))`,
|
|
6
|
+
md: () => radii.base,
|
|
7
|
+
lg: () => `calc(${radii.base} + 0.25rem)`,
|
|
8
|
+
full: "9999px"
|
|
9
|
+
});
|
|
10
|
+
var typography = stylex.defineVars({ fontFamily: "system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif" });
|
|
11
|
+
var spacing = stylex.defineVars({
|
|
12
|
+
base: "0.25rem",
|
|
13
|
+
1: () => spacing.base,
|
|
14
|
+
2: () => `calc(${spacing.base} * 2)`,
|
|
15
|
+
3: () => `calc(${spacing.base} * 3)`,
|
|
16
|
+
4: () => `calc(${spacing.base} * 4)`,
|
|
17
|
+
5: () => `calc(${spacing.base} * 5)`,
|
|
18
|
+
6: () => `calc(${spacing.base} * 6)`,
|
|
19
|
+
8: () => `calc(${spacing.base} * 8)`
|
|
20
|
+
});
|
|
21
|
+
var fontSizes = stylex.defineVars({
|
|
22
|
+
xs: "0.75rem",
|
|
23
|
+
sm: "0.875rem",
|
|
24
|
+
md: "1rem",
|
|
25
|
+
lg: "1.125rem",
|
|
26
|
+
xl: "1.25rem",
|
|
27
|
+
"2xl": "1.5rem"
|
|
28
|
+
});
|
|
29
|
+
var fontWeights = stylex.defineConsts({
|
|
30
|
+
regular: "400",
|
|
31
|
+
medium: "500",
|
|
32
|
+
semibold: "600",
|
|
33
|
+
bold: "700"
|
|
34
|
+
});
|
|
35
|
+
var lineHeights = stylex.defineVars({
|
|
36
|
+
tight: "1.25",
|
|
37
|
+
normal: "1.5",
|
|
38
|
+
relaxed: "1.625"
|
|
39
|
+
});
|
|
40
|
+
var motion = stylex.defineVars({
|
|
41
|
+
fast: "120ms",
|
|
42
|
+
normal: "180ms",
|
|
43
|
+
slow: "260ms",
|
|
44
|
+
standard: "cubic-bezier(0.2, 0, 0, 1)"
|
|
45
|
+
});
|
|
46
|
+
var elevation = stylex.defineVars({
|
|
47
|
+
sm: "0 6px 20px rgba(0, 0, 0, 0.18)",
|
|
48
|
+
md: "0 8px 24px rgba(0, 0, 0, 0.18)",
|
|
49
|
+
lg: "0 10px 30px rgba(0, 0, 0, 0.2)"
|
|
50
|
+
});
|
|
51
|
+
var controlSizes = stylex.defineVars({
|
|
52
|
+
sm: "2rem",
|
|
53
|
+
md: "2.5rem",
|
|
54
|
+
lg: "3rem"
|
|
55
|
+
});
|
|
56
|
+
var borders = stylex.defineVars({
|
|
57
|
+
control: "0px",
|
|
58
|
+
surface: "0px",
|
|
59
|
+
outline: "1px"
|
|
60
|
+
});
|
|
61
|
+
export { borders, colors, controlSizes, elevation, fontSizes, fontWeights, lineHeights, motion, radii, spacing, typography };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import { Tooltip as BaseUITooltip } from "@base-ui/react/tooltip";
|
|
3
|
+
import type { StyleXStyles } from "@stylexjs/stylex";
|
|
4
|
+
export type TooltipProviderProps = ComponentPropsWithoutRef<typeof BaseUITooltip.Provider>;
|
|
5
|
+
export type TooltipProps = ComponentPropsWithoutRef<typeof BaseUITooltip.Root>;
|
|
6
|
+
type NativeTooltipTriggerProps = Omit<ComponentPropsWithoutRef<typeof BaseUITooltip.Trigger>, "className" | "style">;
|
|
7
|
+
export type TooltipTriggerProps = NativeTooltipTriggerProps & {
|
|
8
|
+
xstyle?: StyleXStyles;
|
|
9
|
+
};
|
|
10
|
+
type NativeTooltipContentProps = Omit<ComponentPropsWithoutRef<typeof BaseUITooltip.Popup>, "className" | "style">;
|
|
11
|
+
type TooltipPositionerProps = ComponentPropsWithoutRef<typeof BaseUITooltip.Positioner>;
|
|
12
|
+
export type TooltipContentProps = NativeTooltipContentProps & {
|
|
13
|
+
side?: TooltipPositionerProps["side"];
|
|
14
|
+
align?: TooltipPositionerProps["align"];
|
|
15
|
+
sideOffset?: TooltipPositionerProps["sideOffset"];
|
|
16
|
+
alignOffset?: TooltipPositionerProps["alignOffset"];
|
|
17
|
+
xstyle?: StyleXStyles;
|
|
18
|
+
};
|
|
19
|
+
export declare function TooltipProvider(props: TooltipProviderProps): import("react").JSX.Element;
|
|
20
|
+
export declare function Tooltip(props: TooltipProps): import("react").JSX.Element;
|
|
21
|
+
export declare function TooltipTrigger({ xstyle, ...props }: TooltipTriggerProps): import("react").JSX.Element;
|
|
22
|
+
export declare function TooltipContent({ side, align, sideOffset, alignOffset, xstyle, children, ...props }: TooltipContentProps): import("react").JSX.Element;
|
|
23
|
+
export {};
|
package/dist/tooltip.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { colors } from "./semantic-colors.stylex.js";
|
|
2
|
+
import { borders, elevation, fontSizes, 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 { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
|
|
8
|
+
var styles = stylex.create({
|
|
9
|
+
positioner: { pointerEvents: "none" },
|
|
10
|
+
popup: {
|
|
11
|
+
boxSizing: "border-box",
|
|
12
|
+
maxWidth: "20rem",
|
|
13
|
+
paddingBlock: spacing[1],
|
|
14
|
+
paddingInline: spacing[2],
|
|
15
|
+
borderWidth: borders.surface,
|
|
16
|
+
borderStyle: "solid",
|
|
17
|
+
borderColor: colors.border,
|
|
18
|
+
borderRadius: radii.md,
|
|
19
|
+
backgroundColor: colors.surface,
|
|
20
|
+
color: colors.surfaceForeground,
|
|
21
|
+
fontFamily: typography.fontFamily,
|
|
22
|
+
fontSize: fontSizes.sm,
|
|
23
|
+
lineHeight: lineHeights.normal,
|
|
24
|
+
boxShadow: elevation.sm,
|
|
25
|
+
transformOrigin: "var(--transform-origin)",
|
|
26
|
+
transitionProperty: "opacity, transform",
|
|
27
|
+
transitionDuration: {
|
|
28
|
+
default: motion.fast,
|
|
29
|
+
"@media (prefers-reduced-motion: reduce)": "0ms"
|
|
30
|
+
},
|
|
31
|
+
transitionTimingFunction: motion.standard
|
|
32
|
+
},
|
|
33
|
+
visible: {
|
|
34
|
+
opacity: 1,
|
|
35
|
+
transform: "scale(1)"
|
|
36
|
+
},
|
|
37
|
+
hidden: {
|
|
38
|
+
opacity: 0,
|
|
39
|
+
transform: "scale(0.96)"
|
|
40
|
+
},
|
|
41
|
+
instant: { transitionDuration: "0ms" }
|
|
42
|
+
});
|
|
43
|
+
function isHidden(open, transitionStatus) {
|
|
44
|
+
return !open || transitionStatus === "starting" || transitionStatus === "ending";
|
|
45
|
+
}
|
|
46
|
+
function TooltipProvider(props) {
|
|
47
|
+
return jsx(Tooltip$1.Provider, { ...props });
|
|
48
|
+
}
|
|
49
|
+
function Tooltip(props) {
|
|
50
|
+
return jsx(PopupDirectionProvider, { children: jsx(TooltipRoot, { ...props }) });
|
|
51
|
+
}
|
|
52
|
+
function TooltipRoot({ onOpenChange, ...props }) {
|
|
53
|
+
const handleOpenChange = usePopupOpenChange(onOpenChange);
|
|
54
|
+
return jsx(Tooltip$1.Root, {
|
|
55
|
+
...props,
|
|
56
|
+
onOpenChange: handleOpenChange
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function TooltipTrigger({ xstyle, ...props }) {
|
|
60
|
+
const anchorRef = usePopupAnchorRef();
|
|
61
|
+
return jsx(Tooltip$1.Trigger, {
|
|
62
|
+
...props,
|
|
63
|
+
ref: anchorRef,
|
|
64
|
+
...stylex.props(xstyle)
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function TooltipContent({ side = "top", align = "center", sideOffset = 8, alignOffset = 0, xstyle, children, ...props }) {
|
|
68
|
+
const portalHost = useThemePortalHost();
|
|
69
|
+
const direction = usePopupDirection();
|
|
70
|
+
return jsxs(Tooltip$1.Portal, {
|
|
71
|
+
container: portalHost ?? void 0,
|
|
72
|
+
dir: direction,
|
|
73
|
+
children: [jsx(PopupDirectionSync, {}), jsx(Tooltip$1.Positioner, {
|
|
74
|
+
dir: direction,
|
|
75
|
+
side,
|
|
76
|
+
align,
|
|
77
|
+
sideOffset,
|
|
78
|
+
alignOffset,
|
|
79
|
+
...stylex.props(styles.positioner),
|
|
80
|
+
children: jsx(Tooltip$1.Popup, {
|
|
81
|
+
...props,
|
|
82
|
+
className: (state) => stylex.props(styles.popup, isHidden(state.open, state.transitionStatus) ? styles.hidden : styles.visible, state.instant && styles.instant, xstyle).className,
|
|
83
|
+
style: (state) => stylex.props(styles.popup, isHidden(state.open, state.transitionStatus) ? styles.hidden : styles.visible, state.instant && styles.instant, xstyle).style,
|
|
84
|
+
children
|
|
85
|
+
})
|
|
86
|
+
})]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
package/package.json
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zicas/ui",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-beta.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./semantic-colors.stylex": {
|
|
15
|
+
"types": "./dist/semantic-colors.stylex.d.ts",
|
|
16
|
+
"import": "./dist/semantic-colors.stylex.js",
|
|
17
|
+
"default": "./dist/semantic-colors.stylex.js"
|
|
18
|
+
},
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"dev": "vite build --watch & tsc -p tsconfig.json --watch --preserveWatchOutput & wait",
|
|
26
|
+
"build": "vite build && tsc -p tsconfig.json",
|
|
27
|
+
"prepack": "pnpm run build"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@stylexjs/stylex": "^0.19.0",
|
|
31
|
+
"react": ">=18",
|
|
32
|
+
"react-dom": ">=18"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@base-ui/react": "^1.8.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@stylexjs/stylex": "^0.19.0",
|
|
39
|
+
"@types/react": "^19.2.18",
|
|
40
|
+
"react": "^19.2.8",
|
|
41
|
+
"typescript": "~6.0.2",
|
|
42
|
+
"vite": "^8.2.2"
|
|
43
|
+
}
|
|
44
|
+
}
|