autumn-js 0.0.72 → 0.0.76
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/components.json +2 -2
- package/dist/libraries/backend/better-auth.d.mts +8 -0
- package/dist/libraries/backend/better-auth.d.ts +8 -0
- package/dist/libraries/backend/better-auth.js +20061 -0
- package/dist/libraries/backend/better-auth.mjs +19201 -0
- package/dist/libraries/backend/{chunk-6DZX6EAA.mjs → chunk-XGB3TDIC.mjs} +5 -0
- package/dist/libraries/backend/constants.mjs +1 -1
- package/dist/libraries/backend/express.d.mts +1 -1
- package/dist/libraries/backend/express.d.ts +1 -1
- package/dist/libraries/backend/express.mjs +1 -1
- package/dist/libraries/backend/fastify.mjs +1 -1
- package/dist/libraries/backend/hono.mjs +1 -1
- package/dist/libraries/backend/next.mjs +1 -1
- package/dist/libraries/backend/react-router.mjs +1 -1
- package/dist/libraries/backend/{referralTypes-qdpA4XBw.d.ts → referralTypes-CSbCGBim.d.ts} +2 -0
- package/dist/libraries/backend/{referralTypes-C-jpvu6u.d.mts → referralTypes-DiYwS4QY.d.mts} +2 -0
- package/dist/libraries/backend/remix_dep.mjs +1 -1
- package/dist/libraries/backend/routes/backendRouter.mjs +1 -1
- package/dist/libraries/backend/routes/entityRoutes.mjs +1 -1
- package/dist/libraries/backend/routes/genRoutes.mjs +1 -1
- package/dist/libraries/backend/routes/productRoutes.mjs +1 -1
- package/dist/libraries/backend/routes/referralRoutes.mjs +1 -1
- package/dist/libraries/backend/supabase.mjs +1 -1
- package/dist/libraries/backend/tanstack.mjs +1 -1
- package/dist/libraries/backend/utils/backendRes.mjs +1 -1
- package/dist/libraries/backend/utils/logBackendErrors.mjs +1 -1
- package/dist/libraries/backend/utils/secretKeyCheck.mjs +1 -1
- package/dist/libraries/backend/utils/withAuth.d.mts +1 -1
- package/dist/libraries/backend/utils/withAuth.d.ts +1 -1
- package/dist/libraries/backend/utils/withAuth.mjs +1 -1
- package/dist/libraries/react/AutumnContext.d.mts +3 -3
- package/dist/libraries/react/AutumnContext.d.ts +3 -3
- package/dist/libraries/react/AutumnContext.js +11 -7
- package/dist/libraries/react/AutumnContext.mjs +6 -6
- package/dist/libraries/react/BaseAutumnProvider.d.mts +3 -3
- package/dist/libraries/react/BaseAutumnProvider.d.ts +3 -3
- package/dist/libraries/react/BaseAutumnProvider.js +5722 -179
- package/dist/libraries/react/BaseAutumnProvider.mjs +19 -10
- package/dist/libraries/react/{ReactAutumnClient-4e3t4WTF.d.mts → ReactAutumnClient-BT7tsOG0.d.mts} +2 -2
- package/dist/libraries/react/{ReactAutumnClient-B-lWmwRW.d.ts → ReactAutumnClient-DfDXFLBI.d.ts} +2 -2
- package/dist/libraries/react/ReactAutumnProvider.d.mts +2 -1
- package/dist/libraries/react/ReactAutumnProvider.d.ts +2 -1
- package/dist/libraries/react/ReactAutumnProvider.js +5729 -182
- package/dist/libraries/react/ReactAutumnProvider.mjs +19 -11
- package/dist/libraries/react/{checkTypes-BDNI_s2B.d.ts → checkTypes-ByzZ-KO2.d.ts} +2 -0
- package/dist/libraries/react/{checkTypes-CyKIOmeF.d.mts → checkTypes-h2Fyyuh0.d.mts} +2 -0
- package/dist/libraries/react/{chunk-4PX3AQKX.mjs → chunk-27OTS3Q5.mjs} +9 -9
- package/dist/libraries/react/chunk-2DPUKL2Q.mjs +988 -0
- package/dist/libraries/react/{chunk-TBCLSIC2.mjs → chunk-3EYF7OI5.mjs} +1 -1
- package/dist/libraries/react/{chunk-CE5BBB5H.mjs → chunk-4CRZJJPY.mjs} +4 -3
- package/dist/libraries/react/{chunk-4CGZZYLG.mjs → chunk-4J6OC4ZQ.mjs} +46 -1
- package/dist/libraries/react/chunk-5FZ7IV6P.mjs +2021 -0
- package/dist/libraries/react/{chunk-LS3NB4DU.mjs → chunk-77N4ARHR.mjs} +2 -2
- package/dist/libraries/react/chunk-CMO5LYYU.mjs +241 -0
- package/dist/libraries/react/chunk-FEFGYFXQ.mjs +134 -0
- package/dist/libraries/react/chunk-FPI3PLEL.mjs +218 -0
- package/dist/libraries/react/chunk-KQT5G3HT.mjs +27 -0
- package/dist/libraries/react/{chunk-O4HHXBGR.mjs → chunk-P2O4LZFD.mjs} +30 -30
- package/dist/libraries/react/{chunk-B7HGBQCO.mjs → chunk-UMZA5GHL.mjs} +1 -1
- package/dist/libraries/react/{chunk-4KKWHG2V.mjs → chunk-V5PKOA5A.mjs} +1 -1
- package/dist/libraries/react/{chunk-Q7CK32YT.mjs → chunk-WI6WFW54.mjs} +26 -8
- package/dist/libraries/react/{chunk-7PRD7RPD.mjs → chunk-XXMAVKQ4.mjs} +2 -2
- package/dist/libraries/react/client/ReactAutumnClient.d.mts +3 -3
- package/dist/libraries/react/client/ReactAutumnClient.d.ts +3 -3
- package/dist/libraries/react/client/ReactAutumnClient.js +11 -7
- package/dist/libraries/react/client/ReactAutumnClient.mjs +5 -5
- package/dist/libraries/react/client/clientCompMethods.d.mts +3 -3
- package/dist/libraries/react/client/clientCompMethods.d.ts +3 -3
- package/dist/libraries/react/client/clientCusMethods.d.mts +3 -3
- package/dist/libraries/react/client/clientCusMethods.d.ts +3 -3
- package/dist/libraries/react/client/clientEntityMethods.d.mts +3 -3
- package/dist/libraries/react/client/clientEntityMethods.d.ts +3 -3
- package/dist/libraries/react/client/clientEntityMethods.js +9 -6
- package/dist/libraries/react/client/clientEntityMethods.mjs +2 -2
- package/dist/libraries/react/client/clientGenMethods.d.mts +3 -3
- package/dist/libraries/react/client/clientGenMethods.d.ts +3 -3
- package/dist/libraries/react/client/clientGenMethods.js +10 -7
- package/dist/libraries/react/client/clientGenMethods.mjs +2 -2
- package/dist/libraries/react/client/clientProdMethods.d.mts +3 -3
- package/dist/libraries/react/client/clientProdMethods.d.ts +3 -3
- package/dist/libraries/react/client/clientReferralMethods.d.mts +3 -3
- package/dist/libraries/react/client/clientReferralMethods.d.ts +3 -3
- package/dist/libraries/react/client/clientReferralMethods.js +9 -6
- package/dist/libraries/react/client/clientReferralMethods.mjs +2 -2
- package/dist/libraries/react/client/types/clientGenTypes.d.mts +1 -0
- package/dist/libraries/react/client/types/clientGenTypes.d.ts +1 -0
- package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.d.mts +1 -1
- package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.d.ts +1 -1
- package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.js +2594 -222
- package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.mjs +16 -22
- package/dist/libraries/react/components/attach-dialog/lib/attach-content.d.mts +1 -1
- package/dist/libraries/react/components/attach-dialog/lib/attach-content.d.ts +1 -1
- package/dist/libraries/react/components/check-dialog/check-dialog-synced.d.mts +1 -1
- package/dist/libraries/react/components/check-dialog/check-dialog-synced.d.ts +1 -1
- package/dist/libraries/react/components/check-dialog/check-dialog-synced.js +2260 -127
- package/dist/libraries/react/components/check-dialog/check-dialog-synced.mjs +6 -4
- package/dist/libraries/react/components/check-dialog/lib/check-content.d.mts +1 -1
- package/dist/libraries/react/components/check-dialog/lib/check-content.d.ts +1 -1
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.mts +2 -2
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.ts +2 -2
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.js +3083 -719
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.mjs +16 -22
- package/dist/libraries/react/components/ui/button.d.mts +6 -6
- package/dist/libraries/react/components/ui/button.d.ts +6 -6
- package/dist/libraries/react/components/ui/button.js +206 -31
- package/dist/libraries/react/components/ui/button.mjs +3 -2
- package/dist/libraries/react/components/ui/dialog.d.mts +16 -12
- package/dist/libraries/react/components/ui/dialog.d.ts +16 -12
- package/dist/libraries/react/components/ui/dialog.js +2254 -148
- package/dist/libraries/react/components/ui/dialog.mjs +5 -2
- package/dist/libraries/react/components/ui/switch.d.mts +2 -3
- package/dist/libraries/react/components/ui/switch.d.ts +2 -3
- package/dist/libraries/react/components/ui/switch.js +575 -29
- package/dist/libraries/react/components/ui/switch.mjs +5 -2
- package/dist/libraries/react/hooks/useAutumn.d.mts +3 -3
- package/dist/libraries/react/hooks/useAutumn.d.ts +3 -3
- package/dist/libraries/react/hooks/useAutumn.js +5793 -134
- package/dist/libraries/react/hooks/useAutumn.mjs +21 -9
- package/dist/libraries/react/hooks/useAutumnBase.d.mts +3 -3
- package/dist/libraries/react/hooks/useAutumnBase.d.ts +3 -3
- package/dist/libraries/react/hooks/useAutumnBase.js +5789 -130
- package/dist/libraries/react/hooks/useAutumnBase.mjs +21 -8
- package/dist/libraries/react/hooks/useCustomer.d.mts +3 -3
- package/dist/libraries/react/hooks/useCustomer.d.ts +3 -3
- package/dist/libraries/react/hooks/useCustomer.js +5718 -174
- package/dist/libraries/react/hooks/useCustomer.mjs +20 -10
- package/dist/libraries/react/hooks/useCustomerBase.d.mts +3 -3
- package/dist/libraries/react/hooks/useCustomerBase.d.ts +3 -3
- package/dist/libraries/react/hooks/useCustomerBase.js +5726 -174
- package/dist/libraries/react/hooks/useCustomerBase.mjs +20 -9
- package/dist/libraries/react/hooks/useEntity.d.mts +8 -6
- package/dist/libraries/react/hooks/useEntity.d.ts +8 -6
- package/dist/libraries/react/hooks/useEntity.js +5986 -48
- package/dist/libraries/react/hooks/useEntity.mjs +20 -8
- package/dist/libraries/react/hooks/useEntityBase.d.mts +9 -11
- package/dist/libraries/react/hooks/useEntityBase.d.ts +9 -11
- package/dist/libraries/react/hooks/useEntityBase.js +6690 -37
- package/dist/libraries/react/hooks/useEntityBase.mjs +25 -1
- package/dist/libraries/react/hooks/usePricingTable.d.mts +1 -1
- package/dist/libraries/react/hooks/usePricingTable.d.ts +1 -1
- package/dist/libraries/react/hooks/usePricingTable.js +36 -14
- package/dist/libraries/react/hooks/usePricingTable.mjs +8 -8
- package/dist/libraries/react/hooks/usePricingTableBase.d.mts +3 -3
- package/dist/libraries/react/hooks/usePricingTableBase.d.ts +3 -3
- package/dist/libraries/react/hooks/usePricingTableBase.js +36 -14
- package/dist/libraries/react/hooks/usePricingTableBase.mjs +7 -7
- package/dist/libraries/react/hooks/useProductsBase.js +11 -7
- package/dist/libraries/react/hooks/useProductsBase.mjs +6 -6
- package/dist/libraries/react/index.d.ts +9 -7
- package/dist/libraries/react/index.js +3504 -1110
- package/dist/libraries/react/index.mjs +3502 -1108
- package/dist/libraries/react/lib/utils.js +46 -1
- package/dist/libraries/react/lib/utils.mjs +1 -1
- package/dist/libraries/react/{response-ChCmaLBk.d.mts → response-B37tbVeT.d.mts} +1 -1
- package/dist/libraries/react/{response-9K8DyGXf.d.ts → response-CREh0tw3.d.ts} +1 -1
- package/dist/libraries/react/utils/toSnakeCase.d.mts +1 -1
- package/dist/libraries/react/utils/toSnakeCase.d.ts +1 -1
- package/dist/libraries/react/utils/toSnakeCase.js +9 -6
- package/dist/libraries/react/utils/toSnakeCase.mjs +1 -1
- package/dist/next/client/NextAutumnClient.d.mts +2 -2
- package/dist/next/client/NextAutumnClient.d.ts +2 -2
- package/dist/next/client/{checkTypes-BHxu_xEV.d.ts → checkTypes-BVlLFoUT.d.ts} +2 -0
- package/dist/next/client/{checkTypes-CEaWu4S3.d.mts → checkTypes-CGZpuidI.d.mts} +2 -0
- package/dist/next/client/{clientGenTypes-i3cKamAv.d.ts → clientGenTypes-CXkGuJ6W.d.ts} +2 -1
- package/dist/next/client/{clientGenTypes-BRfigzSY.d.mts → clientGenTypes-Dh9BiE0s.d.mts} +2 -1
- package/dist/next/client/hooks/useAutumn.d.mts +3 -3
- package/dist/next/client/hooks/useAutumn.d.ts +3 -3
- package/dist/next/client/hooks/useCustomer.d.mts +2 -2
- package/dist/next/client/hooks/useCustomer.d.ts +2 -2
- package/dist/next/client/hooks/useEntity.d.mts +7 -7
- package/dist/next/client/hooks/useEntity.d.ts +7 -7
- package/dist/next/client/hooks/usePricingTable.d.mts +1 -1
- package/dist/next/client/hooks/usePricingTable.d.ts +1 -1
- package/dist/next/index.d.mts +7 -6
- package/dist/next/index.d.ts +7 -6
- package/dist/next/server/cusActions.d.mts +2 -0
- package/dist/next/server/cusActions.d.ts +2 -0
- package/dist/next/server/genActions.d.mts +1 -0
- package/dist/next/server/genActions.d.ts +1 -0
- package/dist/sdk/index.d.mts +2 -0
- package/dist/sdk/index.d.ts +2 -0
- package/dist/styles/global.css +1093 -1023
- package/package.json +14 -13
- package/postcss.config.js +19 -1
- package/scripts/post-build.js +25 -0
- package/scripts/sync-registry.ts +79 -191
- package/tailwind.config.ts +96 -0
- package/tsup.config.ts +3 -4
- package/tsup.dev.config.ts +3 -4
- package/dist/libraries/react/chunk-2XYYCR4J.mjs +0 -276
- package/dist/libraries/react/chunk-FHANCAHB.mjs +0 -17
- package/dist/libraries/react/chunk-GTF7A5TG.mjs +0 -76
- package/dist/libraries/react/chunk-NEV76K4V.mjs +0 -552
- package/dist/libraries/react/chunk-QMIIDFRP.mjs +0 -85
- package/dist/libraries/react/chunk-TFGQQAVB.mjs +0 -38
- package/dist/libraries/react/chunk-X3HJKZGO.mjs +0 -58
- package/dist/libraries/react/chunk-ZKHBOCMO.mjs +0 -17
- package/dist/libraries/react/chunk-ZNPQQ2WK.mjs +0 -24
- package/dist/libraries/react/chunk-ZQ6LDLK5.mjs +0 -149
- package/dist/libraries/react/chunk-ZWO4QYXI.mjs +0 -20
- package/dist/libraries/react/chunk-ZXE5MFKL.mjs +0 -45
- package/tailwind.config.js +0 -57
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
toSnakeCase
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KQT5G3HT.mjs";
|
|
6
6
|
|
|
7
7
|
// src/libraries/react/client/clientGenMethods.ts
|
|
8
8
|
async function attachMethod(params) {
|
|
9
9
|
let { dialog, ...rest } = params;
|
|
10
|
-
let snakeParams = toSnakeCase(rest);
|
|
10
|
+
let snakeParams = toSnakeCase(rest, ["checkoutSessionparams"]);
|
|
11
11
|
const res = await this.post("/api/autumn/attach", snakeParams);
|
|
12
12
|
return res;
|
|
13
13
|
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Primitive,
|
|
5
|
+
composeEventHandlers,
|
|
6
|
+
createContextScope,
|
|
7
|
+
useControllableState,
|
|
8
|
+
useLayoutEffect2
|
|
9
|
+
} from "./chunk-FPI3PLEL.mjs";
|
|
10
|
+
import {
|
|
11
|
+
useComposedRefs
|
|
12
|
+
} from "./chunk-FEFGYFXQ.mjs";
|
|
13
|
+
import {
|
|
14
|
+
cn
|
|
15
|
+
} from "./chunk-4J6OC4ZQ.mjs";
|
|
16
|
+
|
|
17
|
+
// src/libraries/react/components/ui/switch.tsx
|
|
18
|
+
import * as React4 from "react";
|
|
19
|
+
|
|
20
|
+
// ../node_modules/.pnpm/@radix-ui+react-switch@1.2.5_@types+react-dom@18.3.5_@types+react@18.3.14__@types+react@18.3._uwbsid7oqv3j27entxmzcweyee/node_modules/@radix-ui/react-switch/dist/index.mjs
|
|
21
|
+
import * as React3 from "react";
|
|
22
|
+
|
|
23
|
+
// ../node_modules/.pnpm/@radix-ui+react-use-previous@1.1.1_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-use-previous/dist/index.mjs
|
|
24
|
+
import * as React from "react";
|
|
25
|
+
function usePrevious(value) {
|
|
26
|
+
const ref = React.useRef({ value, previous: value });
|
|
27
|
+
return React.useMemo(() => {
|
|
28
|
+
if (ref.current.value !== value) {
|
|
29
|
+
ref.current.previous = ref.current.value;
|
|
30
|
+
ref.current.value = value;
|
|
31
|
+
}
|
|
32
|
+
return ref.current.previous;
|
|
33
|
+
}, [value]);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// ../node_modules/.pnpm/@radix-ui+react-use-size@1.1.1_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-use-size/dist/index.mjs
|
|
37
|
+
import * as React2 from "react";
|
|
38
|
+
function useSize(element) {
|
|
39
|
+
const [size, setSize] = React2.useState(void 0);
|
|
40
|
+
useLayoutEffect2(() => {
|
|
41
|
+
if (element) {
|
|
42
|
+
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
43
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
44
|
+
if (!Array.isArray(entries)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (!entries.length) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const entry = entries[0];
|
|
51
|
+
let width;
|
|
52
|
+
let height;
|
|
53
|
+
if ("borderBoxSize" in entry) {
|
|
54
|
+
const borderSizeEntry = entry["borderBoxSize"];
|
|
55
|
+
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
56
|
+
width = borderSize["inlineSize"];
|
|
57
|
+
height = borderSize["blockSize"];
|
|
58
|
+
} else {
|
|
59
|
+
width = element.offsetWidth;
|
|
60
|
+
height = element.offsetHeight;
|
|
61
|
+
}
|
|
62
|
+
setSize({ width, height });
|
|
63
|
+
});
|
|
64
|
+
resizeObserver.observe(element, { box: "border-box" });
|
|
65
|
+
return () => resizeObserver.unobserve(element);
|
|
66
|
+
} else {
|
|
67
|
+
setSize(void 0);
|
|
68
|
+
}
|
|
69
|
+
}, [element]);
|
|
70
|
+
return size;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// ../node_modules/.pnpm/@radix-ui+react-switch@1.2.5_@types+react-dom@18.3.5_@types+react@18.3.14__@types+react@18.3._uwbsid7oqv3j27entxmzcweyee/node_modules/@radix-ui/react-switch/dist/index.mjs
|
|
74
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
75
|
+
var SWITCH_NAME = "Switch";
|
|
76
|
+
var [createSwitchContext, createSwitchScope] = createContextScope(SWITCH_NAME);
|
|
77
|
+
var [SwitchProvider, useSwitchContext] = createSwitchContext(SWITCH_NAME);
|
|
78
|
+
var Switch = React3.forwardRef(
|
|
79
|
+
(props, forwardedRef) => {
|
|
80
|
+
const {
|
|
81
|
+
__scopeSwitch,
|
|
82
|
+
name,
|
|
83
|
+
checked: checkedProp,
|
|
84
|
+
defaultChecked,
|
|
85
|
+
required,
|
|
86
|
+
disabled,
|
|
87
|
+
value = "on",
|
|
88
|
+
onCheckedChange,
|
|
89
|
+
form,
|
|
90
|
+
...switchProps
|
|
91
|
+
} = props;
|
|
92
|
+
const [button, setButton] = React3.useState(null);
|
|
93
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));
|
|
94
|
+
const hasConsumerStoppedPropagationRef = React3.useRef(false);
|
|
95
|
+
const isFormControl = button ? form || !!button.closest("form") : true;
|
|
96
|
+
const [checked, setChecked] = useControllableState({
|
|
97
|
+
prop: checkedProp,
|
|
98
|
+
defaultProp: defaultChecked ?? false,
|
|
99
|
+
onChange: onCheckedChange,
|
|
100
|
+
caller: SWITCH_NAME
|
|
101
|
+
});
|
|
102
|
+
return /* @__PURE__ */ jsxs(SwitchProvider, { scope: __scopeSwitch, checked, disabled, children: [
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
104
|
+
Primitive.button,
|
|
105
|
+
{
|
|
106
|
+
type: "button",
|
|
107
|
+
role: "switch",
|
|
108
|
+
"aria-checked": checked,
|
|
109
|
+
"aria-required": required,
|
|
110
|
+
"data-state": getState(checked),
|
|
111
|
+
"data-disabled": disabled ? "" : void 0,
|
|
112
|
+
disabled,
|
|
113
|
+
value,
|
|
114
|
+
...switchProps,
|
|
115
|
+
ref: composedRefs,
|
|
116
|
+
onClick: composeEventHandlers(props.onClick, (event) => {
|
|
117
|
+
setChecked((prevChecked) => !prevChecked);
|
|
118
|
+
if (isFormControl) {
|
|
119
|
+
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
120
|
+
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
isFormControl && /* @__PURE__ */ jsx(
|
|
126
|
+
SwitchBubbleInput,
|
|
127
|
+
{
|
|
128
|
+
control: button,
|
|
129
|
+
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
130
|
+
name,
|
|
131
|
+
value,
|
|
132
|
+
checked,
|
|
133
|
+
required,
|
|
134
|
+
disabled,
|
|
135
|
+
form,
|
|
136
|
+
style: { transform: "translateX(-100%)" }
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
] });
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
Switch.displayName = SWITCH_NAME;
|
|
143
|
+
var THUMB_NAME = "SwitchThumb";
|
|
144
|
+
var SwitchThumb = React3.forwardRef(
|
|
145
|
+
(props, forwardedRef) => {
|
|
146
|
+
const { __scopeSwitch, ...thumbProps } = props;
|
|
147
|
+
const context = useSwitchContext(THUMB_NAME, __scopeSwitch);
|
|
148
|
+
return /* @__PURE__ */ jsx(
|
|
149
|
+
Primitive.span,
|
|
150
|
+
{
|
|
151
|
+
"data-state": getState(context.checked),
|
|
152
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
153
|
+
...thumbProps,
|
|
154
|
+
ref: forwardedRef
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
SwitchThumb.displayName = THUMB_NAME;
|
|
160
|
+
var BUBBLE_INPUT_NAME = "SwitchBubbleInput";
|
|
161
|
+
var SwitchBubbleInput = React3.forwardRef(
|
|
162
|
+
({
|
|
163
|
+
__scopeSwitch,
|
|
164
|
+
control,
|
|
165
|
+
checked,
|
|
166
|
+
bubbles = true,
|
|
167
|
+
...props
|
|
168
|
+
}, forwardedRef) => {
|
|
169
|
+
const ref = React3.useRef(null);
|
|
170
|
+
const composedRefs = useComposedRefs(ref, forwardedRef);
|
|
171
|
+
const prevChecked = usePrevious(checked);
|
|
172
|
+
const controlSize = useSize(control);
|
|
173
|
+
React3.useEffect(() => {
|
|
174
|
+
const input = ref.current;
|
|
175
|
+
if (!input) return;
|
|
176
|
+
const inputProto = window.HTMLInputElement.prototype;
|
|
177
|
+
const descriptor = Object.getOwnPropertyDescriptor(
|
|
178
|
+
inputProto,
|
|
179
|
+
"checked"
|
|
180
|
+
);
|
|
181
|
+
const setChecked = descriptor.set;
|
|
182
|
+
if (prevChecked !== checked && setChecked) {
|
|
183
|
+
const event = new Event("click", { bubbles });
|
|
184
|
+
setChecked.call(input, checked);
|
|
185
|
+
input.dispatchEvent(event);
|
|
186
|
+
}
|
|
187
|
+
}, [prevChecked, checked, bubbles]);
|
|
188
|
+
return /* @__PURE__ */ jsx(
|
|
189
|
+
"input",
|
|
190
|
+
{
|
|
191
|
+
type: "checkbox",
|
|
192
|
+
"aria-hidden": true,
|
|
193
|
+
defaultChecked: checked,
|
|
194
|
+
...props,
|
|
195
|
+
tabIndex: -1,
|
|
196
|
+
ref: composedRefs,
|
|
197
|
+
style: {
|
|
198
|
+
...props.style,
|
|
199
|
+
...controlSize,
|
|
200
|
+
position: "absolute",
|
|
201
|
+
pointerEvents: "none",
|
|
202
|
+
opacity: 0,
|
|
203
|
+
margin: 0
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
SwitchBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
|
210
|
+
function getState(checked) {
|
|
211
|
+
return checked ? "checked" : "unchecked";
|
|
212
|
+
}
|
|
213
|
+
var Root = Switch;
|
|
214
|
+
var Thumb = SwitchThumb;
|
|
215
|
+
|
|
216
|
+
// src/libraries/react/components/ui/switch.tsx
|
|
217
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
218
|
+
var Switch2 = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
|
|
219
|
+
Root,
|
|
220
|
+
{
|
|
221
|
+
className: cn(
|
|
222
|
+
"au-peer au-inline-flex au-h-5 au-w-9 au-shrink-0 au-cursor-pointer au-items-center au-rounded-full au-border-2 au-border-transparent au-shadow-sm au-transition-colors focus-visible:au-outline-none focus-visible:au-ring-2 focus-visible:au-ring-ring focus-visible:au-ring-offset-2 focus-visible:au-ring-offset-background au-disabled:cursor-not-allowed au-disabled:opacity-50 data-[state=checked]:au-bg-primary data-[state=unchecked]:au-bg-input",
|
|
223
|
+
className
|
|
224
|
+
),
|
|
225
|
+
...props,
|
|
226
|
+
ref,
|
|
227
|
+
children: /* @__PURE__ */ jsx2(
|
|
228
|
+
Thumb,
|
|
229
|
+
{
|
|
230
|
+
className: cn(
|
|
231
|
+
"au-pointer-events-none au-block au-h-4 au-w-4 au-rounded-full au-bg-background au-shadow-lg au-ring-0 au-transition-transform data-[state=checked]:au-translate-x-4 data-[state=unchecked]:au-translate-x-0"
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
));
|
|
237
|
+
Switch2.displayName = Root.displayName;
|
|
238
|
+
|
|
239
|
+
export {
|
|
240
|
+
Switch2 as Switch
|
|
241
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// ../node_modules/.pnpm/@radix-ui+react-slot@1.2.3_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
5
|
+
import * as React2 from "react";
|
|
6
|
+
|
|
7
|
+
// ../node_modules/.pnpm/@radix-ui+react-compose-refs@1.1.2_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-compose-refs/dist/index.mjs
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
function setRef(ref, value) {
|
|
10
|
+
if (typeof ref === "function") {
|
|
11
|
+
return ref(value);
|
|
12
|
+
} else if (ref !== null && ref !== void 0) {
|
|
13
|
+
ref.current = value;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function composeRefs(...refs) {
|
|
17
|
+
return (node) => {
|
|
18
|
+
let hasCleanup = false;
|
|
19
|
+
const cleanups = refs.map((ref) => {
|
|
20
|
+
const cleanup = setRef(ref, node);
|
|
21
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
22
|
+
hasCleanup = true;
|
|
23
|
+
}
|
|
24
|
+
return cleanup;
|
|
25
|
+
});
|
|
26
|
+
if (hasCleanup) {
|
|
27
|
+
return () => {
|
|
28
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
29
|
+
const cleanup = cleanups[i];
|
|
30
|
+
if (typeof cleanup == "function") {
|
|
31
|
+
cleanup();
|
|
32
|
+
} else {
|
|
33
|
+
setRef(refs[i], null);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function useComposedRefs(...refs) {
|
|
41
|
+
return React.useCallback(composeRefs(...refs), refs);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// ../node_modules/.pnpm/@radix-ui+react-slot@1.2.3_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
45
|
+
import { Fragment as Fragment2, jsx } from "react/jsx-runtime";
|
|
46
|
+
// @__NO_SIDE_EFFECTS__
|
|
47
|
+
function createSlot(ownerName) {
|
|
48
|
+
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
49
|
+
const Slot2 = React2.forwardRef((props, forwardedRef) => {
|
|
50
|
+
const { children, ...slotProps } = props;
|
|
51
|
+
const childrenArray = React2.Children.toArray(children);
|
|
52
|
+
const slottable = childrenArray.find(isSlottable);
|
|
53
|
+
if (slottable) {
|
|
54
|
+
const newElement = slottable.props.children;
|
|
55
|
+
const newChildren = childrenArray.map((child) => {
|
|
56
|
+
if (child === slottable) {
|
|
57
|
+
if (React2.Children.count(newElement) > 1) return React2.Children.only(null);
|
|
58
|
+
return React2.isValidElement(newElement) ? newElement.props.children : null;
|
|
59
|
+
} else {
|
|
60
|
+
return child;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React2.isValidElement(newElement) ? React2.cloneElement(newElement, void 0, newChildren) : null });
|
|
64
|
+
}
|
|
65
|
+
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
66
|
+
});
|
|
67
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
68
|
+
return Slot2;
|
|
69
|
+
}
|
|
70
|
+
var Slot = /* @__PURE__ */ createSlot("Slot");
|
|
71
|
+
// @__NO_SIDE_EFFECTS__
|
|
72
|
+
function createSlotClone(ownerName) {
|
|
73
|
+
const SlotClone = React2.forwardRef((props, forwardedRef) => {
|
|
74
|
+
const { children, ...slotProps } = props;
|
|
75
|
+
if (React2.isValidElement(children)) {
|
|
76
|
+
const childrenRef = getElementRef(children);
|
|
77
|
+
const props2 = mergeProps(slotProps, children.props);
|
|
78
|
+
if (children.type !== React2.Fragment) {
|
|
79
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
80
|
+
}
|
|
81
|
+
return React2.cloneElement(children, props2);
|
|
82
|
+
}
|
|
83
|
+
return React2.Children.count(children) > 1 ? React2.Children.only(null) : null;
|
|
84
|
+
});
|
|
85
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
86
|
+
return SlotClone;
|
|
87
|
+
}
|
|
88
|
+
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
89
|
+
function isSlottable(child) {
|
|
90
|
+
return React2.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
91
|
+
}
|
|
92
|
+
function mergeProps(slotProps, childProps) {
|
|
93
|
+
const overrideProps = { ...childProps };
|
|
94
|
+
for (const propName in childProps) {
|
|
95
|
+
const slotPropValue = slotProps[propName];
|
|
96
|
+
const childPropValue = childProps[propName];
|
|
97
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
98
|
+
if (isHandler) {
|
|
99
|
+
if (slotPropValue && childPropValue) {
|
|
100
|
+
overrideProps[propName] = (...args) => {
|
|
101
|
+
const result = childPropValue(...args);
|
|
102
|
+
slotPropValue(...args);
|
|
103
|
+
return result;
|
|
104
|
+
};
|
|
105
|
+
} else if (slotPropValue) {
|
|
106
|
+
overrideProps[propName] = slotPropValue;
|
|
107
|
+
}
|
|
108
|
+
} else if (propName === "style") {
|
|
109
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
110
|
+
} else if (propName === "className") {
|
|
111
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return { ...slotProps, ...overrideProps };
|
|
115
|
+
}
|
|
116
|
+
function getElementRef(element) {
|
|
117
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
118
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
119
|
+
if (mayWarn) {
|
|
120
|
+
return element.ref;
|
|
121
|
+
}
|
|
122
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
123
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
124
|
+
if (mayWarn) {
|
|
125
|
+
return element.props.ref;
|
|
126
|
+
}
|
|
127
|
+
return element.props.ref || element.ref;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export {
|
|
131
|
+
useComposedRefs,
|
|
132
|
+
createSlot,
|
|
133
|
+
Slot
|
|
134
|
+
};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
createSlot
|
|
5
|
+
} from "./chunk-FEFGYFXQ.mjs";
|
|
6
|
+
|
|
7
|
+
// ../node_modules/.pnpm/@radix-ui+primitive@1.1.2/node_modules/@radix-ui/primitive/dist/index.mjs
|
|
8
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
9
|
+
return function handleEvent(event) {
|
|
10
|
+
originalEventHandler?.(event);
|
|
11
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
12
|
+
return ourEventHandler?.(event);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// ../node_modules/.pnpm/@radix-ui+react-context@1.1.2_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-context/dist/index.mjs
|
|
18
|
+
import * as React from "react";
|
|
19
|
+
import { jsx } from "react/jsx-runtime";
|
|
20
|
+
function createContext2(rootComponentName, defaultContext) {
|
|
21
|
+
const Context = React.createContext(defaultContext);
|
|
22
|
+
const Provider = (props) => {
|
|
23
|
+
const { children, ...context } = props;
|
|
24
|
+
const value = React.useMemo(() => context, Object.values(context));
|
|
25
|
+
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
26
|
+
};
|
|
27
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
28
|
+
function useContext2(consumerName) {
|
|
29
|
+
const context = React.useContext(Context);
|
|
30
|
+
if (context) return context;
|
|
31
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
32
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
33
|
+
}
|
|
34
|
+
return [Provider, useContext2];
|
|
35
|
+
}
|
|
36
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
37
|
+
let defaultContexts = [];
|
|
38
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
39
|
+
const BaseContext = React.createContext(defaultContext);
|
|
40
|
+
const index = defaultContexts.length;
|
|
41
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
42
|
+
const Provider = (props) => {
|
|
43
|
+
const { scope, children, ...context } = props;
|
|
44
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
45
|
+
const value = React.useMemo(() => context, Object.values(context));
|
|
46
|
+
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
47
|
+
};
|
|
48
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
49
|
+
function useContext2(consumerName, scope) {
|
|
50
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
51
|
+
const context = React.useContext(Context);
|
|
52
|
+
if (context) return context;
|
|
53
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
54
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
55
|
+
}
|
|
56
|
+
return [Provider, useContext2];
|
|
57
|
+
}
|
|
58
|
+
const createScope = () => {
|
|
59
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
60
|
+
return React.createContext(defaultContext);
|
|
61
|
+
});
|
|
62
|
+
return function useScope(scope) {
|
|
63
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
64
|
+
return React.useMemo(
|
|
65
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
66
|
+
[scope, contexts]
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
createScope.scopeName = scopeName;
|
|
71
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
72
|
+
}
|
|
73
|
+
function composeContextScopes(...scopes) {
|
|
74
|
+
const baseScope = scopes[0];
|
|
75
|
+
if (scopes.length === 1) return baseScope;
|
|
76
|
+
const createScope = () => {
|
|
77
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
78
|
+
useScope: createScope2(),
|
|
79
|
+
scopeName: createScope2.scopeName
|
|
80
|
+
}));
|
|
81
|
+
return function useComposedScopes(overrideScopes) {
|
|
82
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
83
|
+
const scopeProps = useScope(overrideScopes);
|
|
84
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
85
|
+
return { ...nextScopes2, ...currentScope };
|
|
86
|
+
}, {});
|
|
87
|
+
return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
createScope.scopeName = baseScope.scopeName;
|
|
91
|
+
return createScope;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ../node_modules/.pnpm/@radix-ui+react-use-controllable-state@1.2.2_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
95
|
+
import * as React3 from "react";
|
|
96
|
+
|
|
97
|
+
// ../node_modules/.pnpm/@radix-ui+react-use-layout-effect@1.1.1_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
|
|
98
|
+
import * as React2 from "react";
|
|
99
|
+
var useLayoutEffect2 = globalThis?.document ? React2.useLayoutEffect : () => {
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// ../node_modules/.pnpm/@radix-ui+react-use-controllable-state@1.2.2_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
103
|
+
import * as React22 from "react";
|
|
104
|
+
var useInsertionEffect = React3[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
|
|
105
|
+
function useControllableState({
|
|
106
|
+
prop,
|
|
107
|
+
defaultProp,
|
|
108
|
+
onChange = () => {
|
|
109
|
+
},
|
|
110
|
+
caller
|
|
111
|
+
}) {
|
|
112
|
+
const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
|
|
113
|
+
defaultProp,
|
|
114
|
+
onChange
|
|
115
|
+
});
|
|
116
|
+
const isControlled = prop !== void 0;
|
|
117
|
+
const value = isControlled ? prop : uncontrolledProp;
|
|
118
|
+
if (true) {
|
|
119
|
+
const isControlledRef = React3.useRef(prop !== void 0);
|
|
120
|
+
React3.useEffect(() => {
|
|
121
|
+
const wasControlled = isControlledRef.current;
|
|
122
|
+
if (wasControlled !== isControlled) {
|
|
123
|
+
const from = wasControlled ? "controlled" : "uncontrolled";
|
|
124
|
+
const to = isControlled ? "controlled" : "uncontrolled";
|
|
125
|
+
console.warn(
|
|
126
|
+
`${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
isControlledRef.current = isControlled;
|
|
130
|
+
}, [isControlled, caller]);
|
|
131
|
+
}
|
|
132
|
+
const setValue = React3.useCallback(
|
|
133
|
+
(nextValue) => {
|
|
134
|
+
if (isControlled) {
|
|
135
|
+
const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
|
|
136
|
+
if (value2 !== prop) {
|
|
137
|
+
onChangeRef.current?.(value2);
|
|
138
|
+
}
|
|
139
|
+
} else {
|
|
140
|
+
setUncontrolledProp(nextValue);
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
[isControlled, prop, setUncontrolledProp, onChangeRef]
|
|
144
|
+
);
|
|
145
|
+
return [value, setValue];
|
|
146
|
+
}
|
|
147
|
+
function useUncontrolledState({
|
|
148
|
+
defaultProp,
|
|
149
|
+
onChange
|
|
150
|
+
}) {
|
|
151
|
+
const [value, setValue] = React3.useState(defaultProp);
|
|
152
|
+
const prevValueRef = React3.useRef(value);
|
|
153
|
+
const onChangeRef = React3.useRef(onChange);
|
|
154
|
+
useInsertionEffect(() => {
|
|
155
|
+
onChangeRef.current = onChange;
|
|
156
|
+
}, [onChange]);
|
|
157
|
+
React3.useEffect(() => {
|
|
158
|
+
if (prevValueRef.current !== value) {
|
|
159
|
+
onChangeRef.current?.(value);
|
|
160
|
+
prevValueRef.current = value;
|
|
161
|
+
}
|
|
162
|
+
}, [value, prevValueRef]);
|
|
163
|
+
return [value, setValue, onChangeRef];
|
|
164
|
+
}
|
|
165
|
+
function isFunction(value) {
|
|
166
|
+
return typeof value === "function";
|
|
167
|
+
}
|
|
168
|
+
var SYNC_STATE = Symbol("RADIX:SYNC_STATE");
|
|
169
|
+
|
|
170
|
+
// ../node_modules/.pnpm/@radix-ui+react-primitive@2.1.3_@types+react-dom@18.3.5_@types+react@18.3.14__@types+react@18_t6r7cxmbmoheujv3t43yqlikou/node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
171
|
+
import * as React4 from "react";
|
|
172
|
+
import * as ReactDOM from "react-dom";
|
|
173
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
174
|
+
var NODES = [
|
|
175
|
+
"a",
|
|
176
|
+
"button",
|
|
177
|
+
"div",
|
|
178
|
+
"form",
|
|
179
|
+
"h2",
|
|
180
|
+
"h3",
|
|
181
|
+
"img",
|
|
182
|
+
"input",
|
|
183
|
+
"label",
|
|
184
|
+
"li",
|
|
185
|
+
"nav",
|
|
186
|
+
"ol",
|
|
187
|
+
"p",
|
|
188
|
+
"select",
|
|
189
|
+
"span",
|
|
190
|
+
"svg",
|
|
191
|
+
"ul"
|
|
192
|
+
];
|
|
193
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
194
|
+
const Slot = createSlot(`Primitive.${node}`);
|
|
195
|
+
const Node = React4.forwardRef((props, forwardedRef) => {
|
|
196
|
+
const { asChild, ...primitiveProps } = props;
|
|
197
|
+
const Comp = asChild ? Slot : node;
|
|
198
|
+
if (typeof window !== "undefined") {
|
|
199
|
+
window[Symbol.for("radix-ui")] = true;
|
|
200
|
+
}
|
|
201
|
+
return /* @__PURE__ */ jsx2(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
202
|
+
});
|
|
203
|
+
Node.displayName = `Primitive.${node}`;
|
|
204
|
+
return { ...primitive, [node]: Node };
|
|
205
|
+
}, {});
|
|
206
|
+
function dispatchDiscreteCustomEvent(target, event) {
|
|
207
|
+
if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export {
|
|
211
|
+
composeEventHandlers,
|
|
212
|
+
createContext2,
|
|
213
|
+
createContextScope,
|
|
214
|
+
useLayoutEffect2,
|
|
215
|
+
useControllableState,
|
|
216
|
+
Primitive,
|
|
217
|
+
dispatchDiscreteCustomEvent
|
|
218
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// src/libraries/react/utils/toSnakeCase.ts
|
|
5
|
+
function stringToSnakeCase(str) {
|
|
6
|
+
return str.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[-\s]+/g, "_").toLowerCase();
|
|
7
|
+
}
|
|
8
|
+
var toSnakeCase = (obj, excludeKeys) => {
|
|
9
|
+
if (Array.isArray(obj)) {
|
|
10
|
+
return obj.map((item) => toSnakeCase(item, excludeKeys));
|
|
11
|
+
} else if (obj !== null && typeof obj === "object") {
|
|
12
|
+
return Object.fromEntries(
|
|
13
|
+
Object.entries(obj).map(([key, value]) => {
|
|
14
|
+
const snakeKey = stringToSnakeCase(key);
|
|
15
|
+
if (excludeKeys && excludeKeys.includes(key)) {
|
|
16
|
+
return [snakeKey, value];
|
|
17
|
+
}
|
|
18
|
+
return [snakeKey, toSnakeCase(value, excludeKeys)];
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
return obj;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
toSnakeCase
|
|
27
|
+
};
|