pdyform 2.0.2 → 2.2.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/README.md +98 -74
- package/package.json +9 -3
- package/packages/core/dist/chunk-6F4PWJZI.js +0 -0
- package/packages/core/dist/chunk-KA6QUMVR.js +158 -0
- package/packages/core/dist/chunk-REHKL5VH.js +76 -0
- package/packages/core/dist/formState.cjs +132 -78
- package/packages/core/dist/formState.d.cts +14 -10
- package/packages/core/dist/formState.d.ts +14 -10
- package/packages/core/dist/formState.js +4 -12
- package/packages/core/dist/index.cjs +138 -78
- package/packages/core/dist/index.d.cts +4 -3
- package/packages/core/dist/index.d.ts +4 -3
- package/packages/core/dist/index.js +11 -12
- package/packages/core/dist/types.d.cts +17 -5
- package/packages/core/dist/types.d.ts +17 -5
- package/packages/core/dist/types.js +1 -0
- package/packages/core/dist/utils.cjs +78 -19
- package/packages/core/dist/utils.d.cts +17 -5
- package/packages/core/dist/utils.d.ts +17 -5
- package/packages/core/dist/utils.js +7 -1
- package/packages/react/dist/index.cjs +1 -461
- package/packages/react/dist/index.d.cts +33 -2
- package/packages/react/dist/index.d.ts +33 -2
- package/packages/react/dist/index.js +1 -411
- package/packages/vue/dist/index.d.ts +51 -39
- package/packages/vue/dist/index.js +1 -28
- package/packages/vue/dist/index.mjs +630 -6527
- package/eslint.config.mjs +0 -53
- package/example/README.md +0 -36
- package/example/react-demo/index.html +0 -12
- package/example/react-demo/node_modules/.bin/browserslist +0 -17
- package/example/react-demo/node_modules/.bin/tsc +0 -17
- package/example/react-demo/node_modules/.bin/tsserver +0 -17
- package/example/react-demo/node_modules/.bin/vite +0 -17
- package/example/react-demo/node_modules/.vite/deps/@radix-ui_react-checkbox.js +0 -300
- package/example/react-demo/node_modules/.vite/deps/@radix-ui_react-checkbox.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/@radix-ui_react-label.js +0 -194
- package/example/react-demo/node_modules/.vite/deps/@radix-ui_react-label.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/@radix-ui_react-radio-group.js +0 -530
- package/example/react-demo/node_modules/.vite/deps/@radix-ui_react-radio-group.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/@radix-ui_react-select.js +0 -4808
- package/example/react-demo/node_modules/.vite/deps/@radix-ui_react-select.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/_metadata.json +0 -115
- package/example/react-demo/node_modules/.vite/deps/chunk-3D5PZ6F6.js +0 -49
- package/example/react-demo/node_modules/.vite/deps/chunk-3D5PZ6F6.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/chunk-5Q2RBQLA.js +0 -127
- package/example/react-demo/node_modules/.vite/deps/chunk-5Q2RBQLA.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/chunk-G3PMV62Z.js +0 -36
- package/example/react-demo/node_modules/.vite/deps/chunk-G3PMV62Z.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/chunk-GX7YZ5KV.js +0 -370
- package/example/react-demo/node_modules/.vite/deps/chunk-GX7YZ5KV.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/chunk-PUFJGYAC.js +0 -928
- package/example/react-demo/node_modules/.vite/deps/chunk-PUFJGYAC.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/chunk-SIU35MPB.js +0 -21
- package/example/react-demo/node_modules/.vite/deps/chunk-SIU35MPB.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/chunk-TOMGVNQP.js +0 -1906
- package/example/react-demo/node_modules/.vite/deps/chunk-TOMGVNQP.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/chunk-YYN6DZAU.js +0 -21628
- package/example/react-demo/node_modules/.vite/deps/chunk-YYN6DZAU.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/chunk-ZE5VSJFE.js +0 -144
- package/example/react-demo/node_modules/.vite/deps/chunk-ZE5VSJFE.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/class-variance-authority.js +0 -51
- package/example/react-demo/node_modules/.vite/deps/class-variance-authority.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/clsx.js +0 -10
- package/example/react-demo/node_modules/.vite/deps/clsx.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/lucide-react.js +0 -29725
- package/example/react-demo/node_modules/.vite/deps/lucide-react.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/package.json +0 -3
- package/example/react-demo/node_modules/.vite/deps/react-dom.js +0 -7
- package/example/react-demo/node_modules/.vite/deps/react-dom.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/react-dom_client.js +0 -39
- package/example/react-demo/node_modules/.vite/deps/react-dom_client.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/react.js +0 -6
- package/example/react-demo/node_modules/.vite/deps/react.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/react_jsx-dev-runtime.js +0 -913
- package/example/react-demo/node_modules/.vite/deps/react_jsx-dev-runtime.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/react_jsx-runtime.js +0 -7
- package/example/react-demo/node_modules/.vite/deps/react_jsx-runtime.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/tailwind-merge.js +0 -2534
- package/example/react-demo/node_modules/.vite/deps/tailwind-merge.js.map +0 -7
- package/example/react-demo/package.json +0 -23
- package/example/react-demo/postcss.config.mjs +0 -6
- package/example/react-demo/src/App.tsx +0 -64
- package/example/react-demo/src/main.tsx +0 -10
- package/example/react-demo/src/styles.css +0 -102
- package/example/react-demo/tailwind.config.mjs +0 -50
- package/example/react-demo/tsconfig.json +0 -16
- package/example/react-demo/vite.config.ts +0 -14
- package/example/shared/defaultSchema.ts +0 -68
- package/example/vue-demo/index.html +0 -12
- package/example/vue-demo/node_modules/.bin/tsc +0 -17
- package/example/vue-demo/node_modules/.bin/tsserver +0 -17
- package/example/vue-demo/node_modules/.bin/vite +0 -17
- package/example/vue-demo/node_modules/.vite/deps/_metadata.json +0 -46
- package/example/vue-demo/node_modules/.vite/deps/chunk-PZ5AY32C.js +0 -10
- package/example/vue-demo/node_modules/.vite/deps/chunk-PZ5AY32C.js.map +0 -7
- package/example/vue-demo/node_modules/.vite/deps/chunk-TCXBSQ4M.js +0 -12877
- package/example/vue-demo/node_modules/.vite/deps/chunk-TCXBSQ4M.js.map +0 -7
- package/example/vue-demo/node_modules/.vite/deps/clsx.js +0 -22
- package/example/vue-demo/node_modules/.vite/deps/clsx.js.map +0 -7
- package/example/vue-demo/node_modules/.vite/deps/lucide-vue-next.js +0 -29720
- package/example/vue-demo/node_modules/.vite/deps/lucide-vue-next.js.map +0 -7
- package/example/vue-demo/node_modules/.vite/deps/package.json +0 -3
- package/example/vue-demo/node_modules/.vite/deps/radix-vue.js +0 -24321
- package/example/vue-demo/node_modules/.vite/deps/radix-vue.js.map +0 -7
- package/example/vue-demo/node_modules/.vite/deps/tailwind-merge.js +0 -2534
- package/example/vue-demo/node_modules/.vite/deps/tailwind-merge.js.map +0 -7
- package/example/vue-demo/node_modules/.vite/deps/vue.js +0 -348
- package/example/vue-demo/node_modules/.vite/deps/vue.js.map +0 -7
- package/example/vue-demo/package.json +0 -20
- package/example/vue-demo/postcss.config.mjs +0 -6
- package/example/vue-demo/src/App.vue +0 -61
- package/example/vue-demo/src/env.d.ts +0 -1
- package/example/vue-demo/src/main.ts +0 -5
- package/example/vue-demo/src/style.css +0 -102
- package/example/vue-demo/tailwind.config.mjs +0 -50
- package/example/vue-demo/tsconfig.json +0 -15
- package/example/vue-demo/vite.config.ts +0 -14
- package/packages/core/dist/chunk-TP3IHKWV.js +0 -69
- package/packages/core/dist/chunk-WEDHXOHH.js +0 -102
- package/packages/core/node_modules/.bin/api-extractor +0 -17
- package/packages/core/node_modules/.bin/esbuild +0 -14
- package/packages/core/node_modules/.bin/jiti +0 -17
- package/packages/core/node_modules/.bin/tsc +0 -17
- package/packages/core/node_modules/.bin/tsserver +0 -17
- package/packages/core/node_modules/.bin/tsup +0 -17
- package/packages/core/node_modules/.bin/tsup-node +0 -17
- package/packages/core/node_modules/.bin/vitest +0 -17
- package/packages/core/node_modules/.vite/vitest/results.json +0 -1
- package/packages/core/package.json +0 -37
- package/packages/core/src/formState.ts +0 -79
- package/packages/core/src/index.ts +0 -3
- package/packages/core/src/types.ts +0 -42
- package/packages/core/src/utils.ts +0 -104
- package/packages/core/test/formState.test.ts +0 -71
- package/packages/core/test/utils.test.ts +0 -178
- package/packages/core/tsconfig.json +0 -15
- package/packages/core/tsup.config.ts +0 -9
- package/packages/react/node_modules/.bin/api-extractor +0 -17
- package/packages/react/node_modules/.bin/browserslist +0 -17
- package/packages/react/node_modules/.bin/esbuild +0 -14
- package/packages/react/node_modules/.bin/jiti +0 -17
- package/packages/react/node_modules/.bin/tsc +0 -17
- package/packages/react/node_modules/.bin/tsserver +0 -17
- package/packages/react/node_modules/.bin/tsup +0 -17
- package/packages/react/node_modules/.bin/tsup-node +0 -17
- package/packages/react/node_modules/.bin/vite +0 -17
- package/packages/react/node_modules/.bin/vitest +0 -17
- package/packages/react/node_modules/.vite/vitest/results.json +0 -1
- package/packages/react/package.json +0 -57
- package/packages/react/postcss.config.mjs +0 -6
- package/packages/react/src/DynamicForm.tsx +0 -69
- package/packages/react/src/FormFieldRenderer.tsx +0 -50
- package/packages/react/src/components/Checkbox.tsx +0 -28
- package/packages/react/src/components/CheckboxRenderer.tsx +0 -37
- package/packages/react/src/components/Input.tsx +0 -24
- package/packages/react/src/components/InputRenderer.tsx +0 -25
- package/packages/react/src/components/Label.tsx +0 -24
- package/packages/react/src/components/RadioGroup.tsx +0 -42
- package/packages/react/src/components/RadioRenderer.tsx +0 -29
- package/packages/react/src/components/Select.tsx +0 -93
- package/packages/react/src/components/SelectRenderer.tsx +0 -27
- package/packages/react/src/components/Textarea.tsx +0 -23
- package/packages/react/src/components/TextareaRenderer.tsx +0 -17
- package/packages/react/src/components/index.ts +0 -55
- package/packages/react/src/components/types.ts +0 -17
- package/packages/react/src/index.tsx +0 -3
- package/packages/react/src/utils.ts +0 -7
- package/packages/react/tailwind.config.mjs +0 -10
- package/packages/react/test/DynamicForm.test.tsx +0 -25
- package/packages/react/test/FormFieldRenderer.test.tsx +0 -127
- package/packages/react/tsconfig.json +0 -15
- package/packages/react/vitest.config.ts +0 -16
- package/packages/vue/node_modules/.bin/rollup +0 -17
- package/packages/vue/node_modules/.bin/tsc +0 -17
- package/packages/vue/node_modules/.bin/tsserver +0 -17
- package/packages/vue/node_modules/.bin/vite +0 -17
- package/packages/vue/node_modules/.bin/vitest +0 -17
- package/packages/vue/node_modules/.bin/vue-tsc +0 -17
- package/packages/vue/node_modules/.vite/vitest/results.json +0 -1
- package/packages/vue/node_modules/.vue-global-types/vue_3.5_0_0_0.d.ts +0 -118
- package/packages/vue/node_modules/.vue-global-types/vue_3.5_false.d.ts +0 -128
- package/packages/vue/package.json +0 -53
- package/packages/vue/postcss.config.mjs +0 -6
- package/packages/vue/src/DynamicForm.vue +0 -63
- package/packages/vue/src/FormFieldRenderer.vue +0 -70
- package/packages/vue/src/components/Checkbox.vue +0 -28
- package/packages/vue/src/components/CheckboxRenderer.vue +0 -35
- package/packages/vue/src/components/Input.vue +0 -21
- package/packages/vue/src/components/InputRenderer.vue +0 -24
- package/packages/vue/src/components/Label.vue +0 -21
- package/packages/vue/src/components/RadioGroup.vue +0 -30
- package/packages/vue/src/components/RadioGroupItem.vue +0 -26
- package/packages/vue/src/components/RadioRenderer.vue +0 -24
- package/packages/vue/src/components/Select.vue +0 -40
- package/packages/vue/src/components/SelectContent.vue +0 -38
- package/packages/vue/src/components/SelectItem.vue +0 -43
- package/packages/vue/src/components/SelectRenderer.vue +0 -30
- package/packages/vue/src/components/SelectTrigger.vue +0 -27
- package/packages/vue/src/components/Textarea.vue +0 -19
- package/packages/vue/src/components/TextareaRenderer.vue +0 -18
- package/packages/vue/src/components/index.ts +0 -24
- package/packages/vue/src/env.d.ts +0 -7
- package/packages/vue/src/fieldComponentMap.ts +0 -34
- package/packages/vue/src/index.ts +0 -4
- package/packages/vue/src/utils.ts +0 -6
- package/packages/vue/tailwind.config.mjs +0 -10
- package/packages/vue/test/DynamicForm.test.ts +0 -19
- package/packages/vue/test/FormFieldRenderer.test.ts +0 -133
- package/packages/vue/tsconfig.json +0 -16
- package/packages/vue/vite.config.ts +0 -29
- package/packages/vue/vitest.config.ts +0 -16
- package/pnpm-workspace.yaml +0 -4
- package/tsconfig.json +0 -21
- package/turbo.json +0 -25
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useLayoutEffect2
|
|
3
|
-
} from "./chunk-GX7YZ5KV.js";
|
|
4
|
-
import {
|
|
5
|
-
useComposedRefs
|
|
6
|
-
} from "./chunk-3D5PZ6F6.js";
|
|
7
|
-
import {
|
|
8
|
-
require_react
|
|
9
|
-
} from "./chunk-TOMGVNQP.js";
|
|
10
|
-
import {
|
|
11
|
-
__toESM
|
|
12
|
-
} from "./chunk-G3PMV62Z.js";
|
|
13
|
-
|
|
14
|
-
// ../../node_modules/.pnpm/@radix-ui+react-presence@1.1.5_@types+react-dom@18.3.7_@types+react@18.3.28__@types+react@18._km26if5rvjtp6t26unwu2ijjvq/node_modules/@radix-ui/react-presence/dist/index.mjs
|
|
15
|
-
var React2 = __toESM(require_react(), 1);
|
|
16
|
-
var React = __toESM(require_react(), 1);
|
|
17
|
-
function useStateMachine(initialState, machine) {
|
|
18
|
-
return React.useReducer((state, event) => {
|
|
19
|
-
const nextState = machine[state][event];
|
|
20
|
-
return nextState ?? state;
|
|
21
|
-
}, initialState);
|
|
22
|
-
}
|
|
23
|
-
var Presence = (props) => {
|
|
24
|
-
const { present, children } = props;
|
|
25
|
-
const presence = usePresence(present);
|
|
26
|
-
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React2.Children.only(children);
|
|
27
|
-
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
28
|
-
const forceMount = typeof children === "function";
|
|
29
|
-
return forceMount || presence.isPresent ? React2.cloneElement(child, { ref }) : null;
|
|
30
|
-
};
|
|
31
|
-
Presence.displayName = "Presence";
|
|
32
|
-
function usePresence(present) {
|
|
33
|
-
const [node, setNode] = React2.useState();
|
|
34
|
-
const stylesRef = React2.useRef(null);
|
|
35
|
-
const prevPresentRef = React2.useRef(present);
|
|
36
|
-
const prevAnimationNameRef = React2.useRef("none");
|
|
37
|
-
const initialState = present ? "mounted" : "unmounted";
|
|
38
|
-
const [state, send] = useStateMachine(initialState, {
|
|
39
|
-
mounted: {
|
|
40
|
-
UNMOUNT: "unmounted",
|
|
41
|
-
ANIMATION_OUT: "unmountSuspended"
|
|
42
|
-
},
|
|
43
|
-
unmountSuspended: {
|
|
44
|
-
MOUNT: "mounted",
|
|
45
|
-
ANIMATION_END: "unmounted"
|
|
46
|
-
},
|
|
47
|
-
unmounted: {
|
|
48
|
-
MOUNT: "mounted"
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
React2.useEffect(() => {
|
|
52
|
-
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
53
|
-
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
54
|
-
}, [state]);
|
|
55
|
-
useLayoutEffect2(() => {
|
|
56
|
-
const styles = stylesRef.current;
|
|
57
|
-
const wasPresent = prevPresentRef.current;
|
|
58
|
-
const hasPresentChanged = wasPresent !== present;
|
|
59
|
-
if (hasPresentChanged) {
|
|
60
|
-
const prevAnimationName = prevAnimationNameRef.current;
|
|
61
|
-
const currentAnimationName = getAnimationName(styles);
|
|
62
|
-
if (present) {
|
|
63
|
-
send("MOUNT");
|
|
64
|
-
} else if (currentAnimationName === "none" || (styles == null ? void 0 : styles.display) === "none") {
|
|
65
|
-
send("UNMOUNT");
|
|
66
|
-
} else {
|
|
67
|
-
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
68
|
-
if (wasPresent && isAnimating) {
|
|
69
|
-
send("ANIMATION_OUT");
|
|
70
|
-
} else {
|
|
71
|
-
send("UNMOUNT");
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
prevPresentRef.current = present;
|
|
75
|
-
}
|
|
76
|
-
}, [present, send]);
|
|
77
|
-
useLayoutEffect2(() => {
|
|
78
|
-
if (node) {
|
|
79
|
-
let timeoutId;
|
|
80
|
-
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
81
|
-
const handleAnimationEnd = (event) => {
|
|
82
|
-
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
83
|
-
const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
|
|
84
|
-
if (event.target === node && isCurrentAnimation) {
|
|
85
|
-
send("ANIMATION_END");
|
|
86
|
-
if (!prevPresentRef.current) {
|
|
87
|
-
const currentFillMode = node.style.animationFillMode;
|
|
88
|
-
node.style.animationFillMode = "forwards";
|
|
89
|
-
timeoutId = ownerWindow.setTimeout(() => {
|
|
90
|
-
if (node.style.animationFillMode === "forwards") {
|
|
91
|
-
node.style.animationFillMode = currentFillMode;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
const handleAnimationStart = (event) => {
|
|
98
|
-
if (event.target === node) {
|
|
99
|
-
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
node.addEventListener("animationstart", handleAnimationStart);
|
|
103
|
-
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
104
|
-
node.addEventListener("animationend", handleAnimationEnd);
|
|
105
|
-
return () => {
|
|
106
|
-
ownerWindow.clearTimeout(timeoutId);
|
|
107
|
-
node.removeEventListener("animationstart", handleAnimationStart);
|
|
108
|
-
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
109
|
-
node.removeEventListener("animationend", handleAnimationEnd);
|
|
110
|
-
};
|
|
111
|
-
} else {
|
|
112
|
-
send("ANIMATION_END");
|
|
113
|
-
}
|
|
114
|
-
}, [node, send]);
|
|
115
|
-
return {
|
|
116
|
-
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
117
|
-
ref: React2.useCallback((node2) => {
|
|
118
|
-
stylesRef.current = node2 ? getComputedStyle(node2) : null;
|
|
119
|
-
setNode(node2);
|
|
120
|
-
}, [])
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
function getAnimationName(styles) {
|
|
124
|
-
return (styles == null ? void 0 : styles.animationName) || "none";
|
|
125
|
-
}
|
|
126
|
-
function getElementRef(element) {
|
|
127
|
-
var _a, _b;
|
|
128
|
-
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
129
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
130
|
-
if (mayWarn) {
|
|
131
|
-
return element.ref;
|
|
132
|
-
}
|
|
133
|
-
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
134
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
135
|
-
if (mayWarn) {
|
|
136
|
-
return element.props.ref;
|
|
137
|
-
}
|
|
138
|
-
return element.props.ref || element.ref;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export {
|
|
142
|
-
Presence
|
|
143
|
-
};
|
|
144
|
-
//# sourceMappingURL=chunk-ZE5VSJFE.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../node_modules/.pnpm/@radix-ui+react-presence@1.1.5_@types+react-dom@18.3.7_@types+react@18.3.28__@types+react@18._km26if5rvjtp6t26unwu2ijjvq/node_modules/@radix-ui/react-presence/src/presence.tsx", "../../../../../node_modules/.pnpm/@radix-ui+react-presence@1.1.5_@types+react-dom@18.3.7_@types+react@18.3.28__@types+react@18._km26if5rvjtp6t26unwu2ijjvq/node_modules/@radix-ui/react-presence/src/use-state-machine.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { useStateMachine } from './use-state-machine';\n\ninterface PresenceProps {\n children: React.ReactElement | ((props: { present: boolean }) => React.ReactElement);\n present: boolean;\n}\n\nconst Presence: React.FC<PresenceProps> = (props) => {\n const { present, children } = props;\n const presence = usePresence(present);\n\n const child = (\n typeof children === 'function'\n ? children({ present: presence.isPresent })\n : React.Children.only(children)\n ) as React.ReactElement<{ ref?: React.Ref<HTMLElement> }>;\n\n const ref = useComposedRefs(presence.ref, getElementRef(child));\n const forceMount = typeof children === 'function';\n return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;\n};\n\nPresence.displayName = 'Presence';\n\n/* -------------------------------------------------------------------------------------------------\n * usePresence\n * -----------------------------------------------------------------------------------------------*/\n\nfunction usePresence(present: boolean) {\n const [node, setNode] = React.useState<HTMLElement>();\n const stylesRef = React.useRef<CSSStyleDeclaration | null>(null);\n const prevPresentRef = React.useRef(present);\n const prevAnimationNameRef = React.useRef<string>('none');\n const initialState = present ? 'mounted' : 'unmounted';\n const [state, send] = useStateMachine(initialState, {\n mounted: {\n UNMOUNT: 'unmounted',\n ANIMATION_OUT: 'unmountSuspended',\n },\n unmountSuspended: {\n MOUNT: 'mounted',\n ANIMATION_END: 'unmounted',\n },\n unmounted: {\n MOUNT: 'mounted',\n },\n });\n\n React.useEffect(() => {\n const currentAnimationName = getAnimationName(stylesRef.current);\n prevAnimationNameRef.current = state === 'mounted' ? currentAnimationName : 'none';\n }, [state]);\n\n useLayoutEffect(() => {\n const styles = stylesRef.current;\n const wasPresent = prevPresentRef.current;\n const hasPresentChanged = wasPresent !== present;\n\n if (hasPresentChanged) {\n const prevAnimationName = prevAnimationNameRef.current;\n const currentAnimationName = getAnimationName(styles);\n\n if (present) {\n send('MOUNT');\n } else if (currentAnimationName === 'none' || styles?.display === 'none') {\n // If there is no exit animation or the element is hidden, animations won't run\n // so we unmount instantly\n send('UNMOUNT');\n } else {\n /**\n * When `present` changes to `false`, we check changes to animation-name to\n * determine whether an animation has started. We chose this approach (reading\n * computed styles) because there is no `animationrun` event and `animationstart`\n * fires after `animation-delay` has expired which would be too late.\n */\n const isAnimating = prevAnimationName !== currentAnimationName;\n\n if (wasPresent && isAnimating) {\n send('ANIMATION_OUT');\n } else {\n send('UNMOUNT');\n }\n }\n\n prevPresentRef.current = present;\n }\n }, [present, send]);\n\n useLayoutEffect(() => {\n if (node) {\n let timeoutId: number;\n const ownerWindow = node.ownerDocument.defaultView ?? window;\n /**\n * Triggering an ANIMATION_OUT during an ANIMATION_IN will fire an `animationcancel`\n * event for ANIMATION_IN after we have entered `unmountSuspended` state. So, we\n * make sure we only trigger ANIMATION_END for the currently active animation.\n */\n const handleAnimationEnd = (event: AnimationEvent) => {\n const currentAnimationName = getAnimationName(stylesRef.current);\n // The event.animationName is unescaped for CSS syntax,\n // so we need to escape it to compare with the animationName computed from the style.\n const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));\n if (event.target === node && isCurrentAnimation) {\n // With React 18 concurrency this update is applied a frame after the\n // animation ends, creating a flash of visible content. By setting the\n // animation fill mode to \"forwards\", we force the node to keep the\n // styles of the last keyframe, removing the flash.\n //\n // Previously we flushed the update via ReactDom.flushSync, but with\n // exit animations this resulted in the node being removed from the\n // DOM before the synthetic animationEnd event was dispatched, meaning\n // user-provided event handlers would not be called.\n // https://github.com/radix-ui/primitives/pull/1849\n send('ANIMATION_END');\n if (!prevPresentRef.current) {\n const currentFillMode = node.style.animationFillMode;\n node.style.animationFillMode = 'forwards';\n // Reset the style after the node had time to unmount (for cases\n // where the component chooses not to unmount). Doing this any\n // sooner than `setTimeout` (e.g. with `requestAnimationFrame`)\n // still causes a flash.\n timeoutId = ownerWindow.setTimeout(() => {\n if (node.style.animationFillMode === 'forwards') {\n node.style.animationFillMode = currentFillMode;\n }\n });\n }\n }\n };\n const handleAnimationStart = (event: AnimationEvent) => {\n if (event.target === node) {\n // if animation occurred, store its name as the previous animation.\n prevAnimationNameRef.current = getAnimationName(stylesRef.current);\n }\n };\n node.addEventListener('animationstart', handleAnimationStart);\n node.addEventListener('animationcancel', handleAnimationEnd);\n node.addEventListener('animationend', handleAnimationEnd);\n return () => {\n ownerWindow.clearTimeout(timeoutId);\n node.removeEventListener('animationstart', handleAnimationStart);\n node.removeEventListener('animationcancel', handleAnimationEnd);\n node.removeEventListener('animationend', handleAnimationEnd);\n };\n } else {\n // Transition to the unmounted state if the node is removed prematurely.\n // We avoid doing so during cleanup as the node may change but still exist.\n send('ANIMATION_END');\n }\n }, [node, send]);\n\n return {\n isPresent: ['mounted', 'unmountSuspended'].includes(state),\n ref: React.useCallback((node: HTMLElement) => {\n stylesRef.current = node ? getComputedStyle(node) : null;\n setNode(node);\n }, []),\n };\n}\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getAnimationName(styles: CSSStyleDeclaration | null) {\n return styles?.animationName || 'none';\n}\n\n// Before React 19 accessing `element.props.ref` will throw a warning and suggest using `element.ref`\n// After React 19 accessing `element.ref` does the opposite.\n// https://github.com/facebook/react/pull/28348\n//\n// Access the ref using the method that doesn't yield a warning.\nfunction getElementRef(element: React.ReactElement<{ ref?: React.Ref<unknown> }>) {\n // React <=18 in DEV\n let getter = Object.getOwnPropertyDescriptor(element.props, 'ref')?.get;\n let mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;\n if (mayWarn) {\n return (element as any).ref;\n }\n\n // React 19 in DEV\n getter = Object.getOwnPropertyDescriptor(element, 'ref')?.get;\n mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n\n // Not DEV\n return element.props.ref || (element as any).ref;\n}\n\nconst Root = Presence;\n\nexport {\n Presence,\n //\n Root,\n};\nexport type { PresenceProps };\n", "import * as React from 'react';\n\ntype Machine<S> = { [k: string]: { [k: string]: S } };\ntype MachineState<T> = keyof T;\ntype MachineEvent<T> = keyof UnionToIntersection<T[keyof T]>;\n\n// \uD83E\uDD2F https://fettblog.eu/typescript-union-to-intersection/\ntype UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any\n ? R\n : never;\n\nexport function useStateMachine<M>(\n initialState: MachineState<M>,\n machine: M & Machine<MachineState<M>>\n) {\n return React.useReducer((state: MachineState<M>, event: MachineEvent<M>): MachineState<M> => {\n const nextState = (machine[state] as any)[event];\n return nextState ?? state;\n }, initialState);\n}\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": ["node"]
|
|
7
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
clsx
|
|
3
|
-
} from "./chunk-SIU35MPB.js";
|
|
4
|
-
import "./chunk-G3PMV62Z.js";
|
|
5
|
-
|
|
6
|
-
// ../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.mjs
|
|
7
|
-
var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
8
|
-
var cx = clsx;
|
|
9
|
-
var cva = (base, config) => (props) => {
|
|
10
|
-
var _config_compoundVariants;
|
|
11
|
-
if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
12
|
-
const { variants, defaultVariants } = config;
|
|
13
|
-
const getVariantClassNames = Object.keys(variants).map((variant) => {
|
|
14
|
-
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
|
|
15
|
-
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
|
|
16
|
-
if (variantProp === null) return null;
|
|
17
|
-
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
|
|
18
|
-
return variants[variant][variantKey];
|
|
19
|
-
});
|
|
20
|
-
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => {
|
|
21
|
-
let [key, value] = param;
|
|
22
|
-
if (value === void 0) {
|
|
23
|
-
return acc;
|
|
24
|
-
}
|
|
25
|
-
acc[key] = value;
|
|
26
|
-
return acc;
|
|
27
|
-
}, {});
|
|
28
|
-
const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param) => {
|
|
29
|
-
let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
|
|
30
|
-
return Object.entries(compoundVariantOptions).every((param2) => {
|
|
31
|
-
let [key, value] = param2;
|
|
32
|
-
return Array.isArray(value) ? value.includes({
|
|
33
|
-
...defaultVariants,
|
|
34
|
-
...propsWithoutUndefined
|
|
35
|
-
}[key]) : {
|
|
36
|
-
...defaultVariants,
|
|
37
|
-
...propsWithoutUndefined
|
|
38
|
-
}[key] === value;
|
|
39
|
-
}) ? [
|
|
40
|
-
...acc,
|
|
41
|
-
cvClass,
|
|
42
|
-
cvClassName
|
|
43
|
-
] : acc;
|
|
44
|
-
}, []);
|
|
45
|
-
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
46
|
-
};
|
|
47
|
-
export {
|
|
48
|
-
cva,
|
|
49
|
-
cx
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=class-variance-authority.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.mjs"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright 2022 Joe Bell. All rights reserved.\n *\n * This file is licensed to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with the\n * License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */ import { clsx } from \"clsx\";\nconst falsyToString = (value)=>typeof value === \"boolean\" ? `${value}` : value === 0 ? \"0\" : value;\nexport const cx = clsx;\nexport const cva = (base, config)=>(props)=>{\n var _config_compoundVariants;\n if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n const { variants, defaultVariants } = config;\n const getVariantClassNames = Object.keys(variants).map((variant)=>{\n const variantProp = props === null || props === void 0 ? void 0 : props[variant];\n const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];\n if (variantProp === null) return null;\n const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);\n return variants[variant][variantKey];\n });\n const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{\n let [key, value] = param;\n if (value === undefined) {\n return acc;\n }\n acc[key] = value;\n return acc;\n }, {});\n const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param)=>{\n let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;\n return Object.entries(compoundVariantOptions).every((param)=>{\n let [key, value] = param;\n return Array.isArray(value) ? value.includes({\n ...defaultVariants,\n ...propsWithoutUndefined\n }[key]) : ({\n ...defaultVariants,\n ...propsWithoutUndefined\n })[key] === value;\n }) ? [\n ...acc,\n cvClass,\n cvClassName\n ] : acc;\n }, []);\n return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n };\n\n"],
|
|
5
|
-
"mappings": ";;;;;;AAeA,IAAM,gBAAgB,CAAC,UAAQ,OAAO,UAAU,YAAY,GAAG,KAAK,KAAK,UAAU,IAAI,MAAM;AACtF,IAAM,KAAK;AACX,IAAM,MAAM,CAAC,MAAM,WAAS,CAAC,UAAQ;AACpC,MAAI;AACJ,OAAK,WAAW,QAAQ,WAAW,SAAS,SAAS,OAAO,aAAa,KAAM,QAAO,GAAG,MAAM,UAAU,QAAQ,UAAU,SAAS,SAAS,MAAM,OAAO,UAAU,QAAQ,UAAU,SAAS,SAAS,MAAM,SAAS;AACvN,QAAM,EAAE,UAAU,gBAAgB,IAAI;AACtC,QAAM,uBAAuB,OAAO,KAAK,QAAQ,EAAE,IAAI,CAAC,YAAU;AAC9D,UAAM,cAAc,UAAU,QAAQ,UAAU,SAAS,SAAS,MAAM,OAAO;AAC/E,UAAM,qBAAqB,oBAAoB,QAAQ,oBAAoB,SAAS,SAAS,gBAAgB,OAAO;AACpH,QAAI,gBAAgB,KAAM,QAAO;AACjC,UAAM,aAAa,cAAc,WAAW,KAAK,cAAc,kBAAkB;AACjF,WAAO,SAAS,OAAO,EAAE,UAAU;AAAA,EACvC,CAAC;AACD,QAAM,wBAAwB,SAAS,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,KAAK,UAAQ;AAC9E,QAAI,CAAC,KAAK,KAAK,IAAI;AACnB,QAAI,UAAU,QAAW;AACrB,aAAO;AAAA,IACX;AACA,QAAI,GAAG,IAAI;AACX,WAAO;AAAA,EACX,GAAG,CAAC,CAAC;AACL,QAAM,+BAA+B,WAAW,QAAQ,WAAW,SAAS,UAAU,2BAA2B,OAAO,sBAAsB,QAAQ,6BAA6B,SAAS,SAAS,yBAAyB,OAAO,CAAC,KAAK,UAAQ;AAC/O,QAAI,EAAE,OAAO,SAAS,WAAW,aAAa,GAAG,uBAAuB,IAAI;AAC5E,WAAO,OAAO,QAAQ,sBAAsB,EAAE,MAAM,CAACA,WAAQ;AACzD,UAAI,CAAC,KAAK,KAAK,IAAIA;AACnB,aAAO,MAAM,QAAQ,KAAK,IAAI,MAAM,SAAS;AAAA,QACzC,GAAG;AAAA,QACH,GAAG;AAAA,MACP,EAAE,GAAG,CAAC,IAAK;AAAA,QACP,GAAG;AAAA,QACH,GAAG;AAAA,MACP,EAAG,GAAG,MAAM;AAAA,IAChB,CAAC,IAAI;AAAA,MACD,GAAG;AAAA,MACH;AAAA,MACA;AAAA,IACJ,IAAI;AAAA,EACR,GAAG,CAAC,CAAC;AACL,SAAO,GAAG,MAAM,sBAAsB,8BAA8B,UAAU,QAAQ,UAAU,SAAS,SAAS,MAAM,OAAO,UAAU,QAAQ,UAAU,SAAS,SAAS,MAAM,SAAS;AAChM;",
|
|
6
|
-
"names": ["param"]
|
|
7
|
-
}
|