@satoshibits/react-json-schema-builder 1.1.4 → 1.1.5
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/dist/index.cjs.js +1 -1
- package/dist/index.cjs10.js +1 -1
- package/dist/index.cjs10.js.map +1 -1
- package/dist/index.cjs11.js +1 -1
- package/dist/index.cjs11.js.map +1 -1
- package/dist/index.cjs12.js +1 -1
- package/dist/index.cjs12.js.map +1 -1
- package/dist/index.cjs13.js +1 -1
- package/dist/index.cjs13.js.map +1 -1
- package/dist/index.cjs14.js +1 -1
- package/dist/index.cjs14.js.map +1 -1
- package/dist/index.cjs15.js +6 -1
- package/dist/index.cjs15.js.map +1 -1
- package/dist/index.cjs16.js +1 -1
- package/dist/index.cjs16.js.map +1 -1
- package/dist/index.cjs17.js +1 -1
- package/dist/index.cjs17.js.map +1 -1
- package/dist/index.cjs18.js +1 -1
- package/dist/index.cjs18.js.map +1 -1
- package/dist/index.cjs19.js +1 -1
- package/dist/index.cjs19.js.map +1 -1
- package/dist/index.cjs2.js +1 -1
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs20.js +1 -1
- package/dist/index.cjs20.js.map +1 -1
- package/dist/index.cjs21.js +1 -1
- package/dist/index.cjs21.js.map +1 -1
- package/dist/index.cjs22.js +1 -1
- package/dist/index.cjs22.js.map +1 -1
- package/dist/index.cjs23.js +1 -6
- package/dist/index.cjs23.js.map +1 -1
- package/dist/index.cjs24.js +1 -6
- package/dist/index.cjs24.js.map +1 -1
- package/dist/index.cjs25.js +1 -6
- package/dist/index.cjs25.js.map +1 -1
- package/dist/index.cjs26.js +1 -1
- package/dist/index.cjs26.js.map +1 -1
- package/dist/index.cjs27.js +1 -1
- package/dist/index.cjs27.js.map +1 -1
- package/dist/index.cjs28.js +6 -1
- package/dist/index.cjs28.js.map +1 -1
- package/dist/index.cjs29.js +6 -1
- package/dist/index.cjs29.js.map +1 -1
- package/dist/index.cjs3.js +1 -1
- package/dist/index.cjs3.js.map +1 -1
- package/dist/index.cjs30.js +1 -1
- package/dist/index.cjs30.js.map +1 -1
- package/dist/index.cjs31.js +1 -1
- package/dist/index.cjs34.js +1 -1
- package/dist/index.cjs36.js +1 -1
- package/dist/index.cjs37.js +1 -1
- package/dist/index.cjs37.js.map +1 -1
- package/dist/index.cjs38.js +1 -6
- package/dist/index.cjs38.js.map +1 -1
- package/dist/index.cjs39.js +1 -6
- package/dist/index.cjs39.js.map +1 -1
- package/dist/index.cjs4.js +1 -1
- package/dist/index.cjs4.js.map +1 -1
- package/dist/index.cjs40.js +1 -6
- package/dist/index.cjs40.js.map +1 -1
- package/dist/index.cjs41.js +1 -1
- package/dist/index.cjs41.js.map +1 -1
- package/dist/index.cjs42.js +1 -1
- package/dist/index.cjs42.js.map +1 -1
- package/dist/index.cjs43.js +1 -1
- package/dist/index.cjs43.js.map +1 -1
- package/dist/index.cjs44.js +6 -1
- package/dist/index.cjs44.js.map +1 -1
- package/dist/index.cjs45.js +6 -1
- package/dist/index.cjs45.js.map +1 -1
- package/dist/index.cjs46.js +6 -1
- package/dist/index.cjs46.js.map +1 -1
- package/dist/index.cjs47.js +1 -1
- package/dist/index.cjs5.js +1 -1
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs55.js +1 -5
- package/dist/index.cjs55.js.map +1 -1
- package/dist/index.cjs56.js +1 -1
- package/dist/index.cjs56.js.map +1 -1
- package/dist/index.cjs58.js +1 -1
- package/dist/index.cjs58.js.map +1 -1
- package/dist/index.cjs59.js +1 -1
- package/dist/index.cjs59.js.map +1 -1
- package/dist/index.cjs6.js +1 -1
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs60.js +1 -1
- package/dist/index.cjs60.js.map +1 -1
- package/dist/index.cjs61.js +1 -1
- package/dist/index.cjs61.js.map +1 -1
- package/dist/index.cjs62.js +5 -1
- package/dist/index.cjs62.js.map +1 -1
- package/dist/index.cjs63.js +1 -1
- package/dist/index.cjs63.js.map +1 -1
- package/dist/index.cjs65.js +1 -1
- package/dist/index.cjs67.js +1 -1
- package/dist/index.cjs69.js +1 -1
- package/dist/index.cjs7.js +1 -1
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.cjs71.js +1 -1
- package/dist/index.cjs72.js +1 -1
- package/dist/index.cjs75.js +1 -1
- package/dist/index.cjs78.js +1 -1
- package/dist/index.cjs78.js.map +1 -1
- package/dist/index.cjs79.js +1 -1
- package/dist/index.cjs79.js.map +1 -1
- package/dist/index.cjs8.js +1 -1
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.cjs80.js +1 -1
- package/dist/index.cjs80.js.map +1 -1
- package/dist/index.cjs81.js +1 -1
- package/dist/index.cjs81.js.map +1 -1
- package/dist/index.cjs82.js +1 -1
- package/dist/index.cjs82.js.map +1 -1
- package/dist/index.cjs9.js +1 -1
- package/dist/index.cjs9.js.map +1 -1
- package/dist/index.d.mts +5 -4
- package/dist/index.d.mts.map +1 -1
- package/dist/index.es.js +18 -28
- package/dist/index.es10.js +22 -22
- package/dist/index.es10.js.map +1 -1
- package/dist/index.es11.js +14 -42
- package/dist/index.es11.js.map +1 -1
- package/dist/index.es12.js +5 -65
- package/dist/index.es12.js.map +1 -1
- package/dist/index.es13.js +43 -24
- package/dist/index.es13.js.map +1 -1
- package/dist/index.es14.js +21 -126
- package/dist/index.es14.js.map +1 -1
- package/dist/index.es15.js +13 -20
- package/dist/index.es15.js.map +1 -1
- package/dist/index.es16.js +129 -130
- package/dist/index.es16.js.map +1 -1
- package/dist/index.es17.js +3 -137
- package/dist/index.es17.js.map +1 -1
- package/dist/index.es18.js +20 -61
- package/dist/index.es18.js.map +1 -1
- package/dist/index.es19.js +65 -10
- package/dist/index.es19.js.map +1 -1
- package/dist/index.es2.js +156 -115
- package/dist/index.es2.js.map +1 -1
- package/dist/index.es20.js +134 -22
- package/dist/index.es20.js.map +1 -1
- package/dist/index.es21.js +131 -421
- package/dist/index.es21.js.map +1 -1
- package/dist/index.es22.js +63 -5
- package/dist/index.es22.js.map +1 -1
- package/dist/index.es23.js +11 -13
- package/dist/index.es23.js.map +1 -1
- package/dist/index.es24.js +23 -16
- package/dist/index.es24.js.map +1 -1
- package/dist/index.es25.js +428 -13
- package/dist/index.es25.js.map +1 -1
- package/dist/index.es26.js +7 -13
- package/dist/index.es26.js.map +1 -1
- package/dist/index.es27.js +9 -3
- package/dist/index.es27.js.map +1 -1
- package/dist/index.es28.js +13 -19
- package/dist/index.es28.js.map +1 -1
- package/dist/index.es29.js +19 -23
- package/dist/index.es29.js.map +1 -1
- package/dist/index.es3.js +129 -340
- package/dist/index.es3.js.map +1 -1
- package/dist/index.es30.js +4 -7
- package/dist/index.es30.js.map +1 -1
- package/dist/index.es31.js +1 -1
- package/dist/index.es34.js +1 -1
- package/dist/index.es36.js +6 -6
- package/dist/index.es37.js +97 -815
- package/dist/index.es37.js.map +1 -1
- package/dist/index.es38.js +56 -10
- package/dist/index.es38.js.map +1 -1
- package/dist/index.es39.js +24 -10
- package/dist/index.es39.js.map +1 -1
- package/dist/index.es4.js +92 -70
- package/dist/index.es4.js.map +1 -1
- package/dist/index.es40.js +45 -10
- package/dist/index.es40.js.map +1 -1
- package/dist/index.es41.js +71 -99
- package/dist/index.es41.js.map +1 -1
- package/dist/index.es42.js +56 -52
- package/dist/index.es42.js.map +1 -1
- package/dist/index.es43.js +827 -19
- package/dist/index.es43.js.map +1 -1
- package/dist/index.es44.js +10 -45
- package/dist/index.es44.js.map +1 -1
- package/dist/index.es45.js +10 -86
- package/dist/index.es45.js.map +1 -1
- package/dist/index.es46.js +10 -60
- package/dist/index.es46.js.map +1 -1
- package/dist/index.es47.js +3 -3
- package/dist/index.es5.js +225 -79
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es55.js +30 -252
- package/dist/index.es55.js.map +1 -1
- package/dist/index.es56.js +26 -21
- package/dist/index.es56.js.map +1 -1
- package/dist/index.es58.js +62 -23
- package/dist/index.es58.js.map +1 -1
- package/dist/index.es59.js +27 -63
- package/dist/index.es59.js.map +1 -1
- package/dist/index.es6.js +117 -57
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es60.js +5 -29
- package/dist/index.es60.js.map +1 -1
- package/dist/index.es61.js +24 -5
- package/dist/index.es61.js.map +1 -1
- package/dist/index.es62.js +254 -24
- package/dist/index.es62.js.map +1 -1
- package/dist/index.es63.js +21 -32
- package/dist/index.es63.js.map +1 -1
- package/dist/index.es65.js +2 -2
- package/dist/index.es67.js +3 -3
- package/dist/index.es69.js +2 -2
- package/dist/index.es7.js +345 -48
- package/dist/index.es7.js.map +1 -1
- package/dist/index.es71.js +7 -7
- package/dist/index.es72.js +1 -1
- package/dist/index.es75.js +1 -1
- package/dist/index.es78.js +67 -11
- package/dist/index.es78.js.map +1 -1
- package/dist/index.es79.js +10 -203
- package/dist/index.es79.js.map +1 -1
- package/dist/index.es8.js +73 -163
- package/dist/index.es8.js.map +1 -1
- package/dist/index.es80.js +203 -20
- package/dist/index.es80.js.map +1 -1
- package/dist/index.es81.js +21 -392
- package/dist/index.es81.js.map +1 -1
- package/dist/index.es82.js +386 -61
- package/dist/index.es82.js.map +1 -1
- package/dist/index.es9.js +18 -3
- package/dist/index.es9.js.map +1 -1
- package/dist/packages/builder/add-dialog.d.ts +5 -5
- package/package.json +1 -1
package/dist/index.cjs62.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs62.js","sources":["../../../node_modules/.pnpm/@radix-ui+react-use-size@1.1.0_@types+react@18.3.18_react@18.3.1/node_modules/@radix-ui/react-use-size/dist/index.mjs"],"sourcesContent":["// packages/react/use-size/src/useSize.tsx\nimport * as React from \"react\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\nfunction useSize(element) {\n const [size, setSize] = React.useState(void 0);\n useLayoutEffect(() => {\n if (element) {\n setSize({ width: element.offsetWidth, height: element.offsetHeight });\n const resizeObserver = new ResizeObserver((entries) => {\n if (!Array.isArray(entries)) {\n return;\n }\n if (!entries.length) {\n return;\n }\n const entry = entries[0];\n let width;\n let height;\n if (\"borderBoxSize\" in entry) {\n const borderSizeEntry = entry[\"borderBoxSize\"];\n const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;\n width = borderSize[\"inlineSize\"];\n height = borderSize[\"blockSize\"];\n } else {\n width = element.offsetWidth;\n height = element.offsetHeight;\n }\n setSize({ width, height });\n });\n resizeObserver.observe(element, { box: \"border-box\" });\n return () => resizeObserver.unobserve(element);\n } else {\n setSize(void 0);\n }\n }, [element]);\n return size;\n}\nexport {\n useSize\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["useSize","element","size","setSize","React","useLayoutEffect","resizeObserver","entries","entry","width","height","borderSizeEntry","borderSize"],"mappings":"iaAGA,SAASA,EAAQC,EAAS,CACxB,KAAM,CAACC,EAAMC,CAAO,EAAIC,EAAM,SAAS,MAAM,EAC7CC,OAAAA,EAAAA,gBAAgB,IAAM,CACpB,GAAIJ,EAAS,CACXE,EAAQ,CAAE,MAAOF,EAAQ,YAAa,OAAQA,EAAQ,aAAc,EACpE,MAAMK,EAAiB,IAAI,eAAgBC,GAAY,CAIrD,GAHI,CAAC,MAAM,QAAQA,CAAO,GAGtB,CAACA,EAAQ,OACX,OAEF,MAAMC,EAAQD,EAAQ,CAAC,EACvB,IAAIE,EACAC,EACJ,GAAI,kBAAmBF,EAAO,CAC5B,MAAMG,EAAkBH,EAAM,cACxBI,EAAa,MAAM,QAAQD,CAAe,EAAIA,EAAgB,CAAC,EAAIA,EACzEF,EAAQG,EAAW,WACnBF,EAASE,EAAW,SAC9B,MACUH,EAAQR,EAAQ,YAChBS,EAAST,EAAQ,aAEnBE,EAAQ,CAAE,MAAAM,EAAO,OAAAC,EAAQ,CACjC,CAAO,EACD,OAAAJ,EAAe,QAAQL,EAAS,CAAE,IAAK,YAAY,CAAE,EAC9C,IAAMK,EAAe,UAAUL,CAAO,CACnD,MACME,EAAQ,MAAM,CAEpB,EAAK,CAACF,CAAO,CAAC,EACLC,CACT","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.cjs62.js","sources":["../../../node_modules/.pnpm/@radix-ui+react-dialog@1.1.6_@types+react-dom@18.3.5_@types+react@18.3.18__@types+react_963ba7435ac590a8053d1db2d26ca164/node_modules/@radix-ui/react-dialog/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// packages/react/dialog/src/dialog.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContext, createContextScope } from \"@radix-ui/react-context\";\nimport { useId } from \"@radix-ui/react-id\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { DismissableLayer } from \"@radix-ui/react-dismissable-layer\";\nimport { FocusScope } from \"@radix-ui/react-focus-scope\";\nimport { Portal as PortalPrimitive } from \"@radix-ui/react-portal\";\nimport { Presence } from \"@radix-ui/react-presence\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useFocusGuards } from \"@radix-ui/react-focus-guards\";\nimport { RemoveScroll } from \"react-remove-scroll\";\nimport { hideOthers } from \"aria-hidden\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nvar DIALOG_NAME = \"Dialog\";\nvar [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);\nvar [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);\nvar Dialog = (props) => {\n const {\n __scopeDialog,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = true\n } = props;\n const triggerRef = React.useRef(null);\n const contentRef = React.useRef(null);\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange\n });\n return /* @__PURE__ */ jsx(\n DialogProvider,\n {\n scope: __scopeDialog,\n triggerRef,\n contentRef,\n contentId: useId(),\n titleId: useId(),\n descriptionId: useId(),\n open,\n onOpenChange: setOpen,\n onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),\n modal,\n children\n }\n );\n};\nDialog.displayName = DIALOG_NAME;\nvar TRIGGER_NAME = \"DialogTrigger\";\nvar DialogTrigger = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDialog, ...triggerProps } = props;\n const context = useDialogContext(TRIGGER_NAME, __scopeDialog);\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);\n return /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": context.open,\n \"aria-controls\": context.contentId,\n \"data-state\": getState(context.open),\n ...triggerProps,\n ref: composedTriggerRef,\n onClick: composeEventHandlers(props.onClick, context.onOpenToggle)\n }\n );\n }\n);\nDialogTrigger.displayName = TRIGGER_NAME;\nvar PORTAL_NAME = \"DialogPortal\";\nvar [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {\n forceMount: void 0\n});\nvar DialogPortal = (props) => {\n const { __scopeDialog, forceMount, children, container } = props;\n const context = useDialogContext(PORTAL_NAME, __scopeDialog);\n return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopeDialog, forceMount, children: React.Children.map(children, (child) => /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(PortalPrimitive, { asChild: true, container, children: child }) })) });\n};\nDialogPortal.displayName = PORTAL_NAME;\nvar OVERLAY_NAME = \"DialogOverlay\";\nvar DialogOverlay = React.forwardRef(\n (props, forwardedRef) => {\n const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);\n const { forceMount = portalContext.forceMount, ...overlayProps } = props;\n const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);\n return context.modal ? /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;\n }\n);\nDialogOverlay.displayName = OVERLAY_NAME;\nvar DialogOverlayImpl = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDialog, ...overlayProps } = props;\n const context = useDialogContext(OVERLAY_NAME, __scopeDialog);\n return (\n // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`\n // ie. when `Overlay` and `Content` are siblings\n /* @__PURE__ */ jsx(RemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n \"data-state\": getState(context.open),\n ...overlayProps,\n ref: forwardedRef,\n style: { pointerEvents: \"auto\", ...overlayProps.style }\n }\n ) })\n );\n }\n);\nvar CONTENT_NAME = \"DialogContent\";\nvar DialogContent = React.forwardRef(\n (props, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });\n }\n);\nDialogContent.displayName = CONTENT_NAME;\nvar DialogContentModal = React.forwardRef(\n (props, forwardedRef) => {\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n const contentRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);\n React.useEffect(() => {\n const content = contentRef.current;\n if (content) return hideOthers(content);\n }, []);\n return /* @__PURE__ */ jsx(\n DialogContentImpl,\n {\n ...props,\n ref: composedRefs,\n trapFocus: context.open,\n disableOutsidePointerEvents: true,\n onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault();\n context.triggerRef.current?.focus();\n }),\n onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {\n const originalEvent = event.detail.originalEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n if (isRightClick) event.preventDefault();\n }),\n onFocusOutside: composeEventHandlers(\n props.onFocusOutside,\n (event) => event.preventDefault()\n )\n }\n );\n }\n);\nvar DialogContentNonModal = React.forwardRef(\n (props, forwardedRef) => {\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n const hasInteractedOutsideRef = React.useRef(false);\n const hasPointerDownOutsideRef = React.useRef(false);\n return /* @__PURE__ */ jsx(\n DialogContentImpl,\n {\n ...props,\n ref: forwardedRef,\n trapFocus: false,\n disableOutsidePointerEvents: false,\n onCloseAutoFocus: (event) => {\n props.onCloseAutoFocus?.(event);\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n event.preventDefault();\n }\n hasInteractedOutsideRef.current = false;\n hasPointerDownOutsideRef.current = false;\n },\n onInteractOutside: (event) => {\n props.onInteractOutside?.(event);\n if (!event.defaultPrevented) {\n hasInteractedOutsideRef.current = true;\n if (event.detail.originalEvent.type === \"pointerdown\") {\n hasPointerDownOutsideRef.current = true;\n }\n }\n const target = event.target;\n const targetIsTrigger = context.triggerRef.current?.contains(target);\n if (targetIsTrigger) event.preventDefault();\n if (event.detail.originalEvent.type === \"focusin\" && hasPointerDownOutsideRef.current) {\n event.preventDefault();\n }\n }\n }\n );\n }\n);\nvar DialogContentImpl = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;\n const context = useDialogContext(CONTENT_NAME, __scopeDialog);\n const contentRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n useFocusGuards();\n return /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(\n FocusScope,\n {\n asChild: true,\n loop: true,\n trapped: trapFocus,\n onMountAutoFocus: onOpenAutoFocus,\n onUnmountAutoFocus: onCloseAutoFocus,\n children: /* @__PURE__ */ jsx(\n DismissableLayer,\n {\n role: \"dialog\",\n id: context.contentId,\n \"aria-describedby\": context.descriptionId,\n \"aria-labelledby\": context.titleId,\n \"data-state\": getState(context.open),\n ...contentProps,\n ref: composedRefs,\n onDismiss: () => context.onOpenChange(false)\n }\n )\n }\n ),\n /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(TitleWarning, { titleId: context.titleId }),\n /* @__PURE__ */ jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })\n ] })\n ] });\n }\n);\nvar TITLE_NAME = \"DialogTitle\";\nvar DialogTitle = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDialog, ...titleProps } = props;\n const context = useDialogContext(TITLE_NAME, __scopeDialog);\n return /* @__PURE__ */ jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });\n }\n);\nDialogTitle.displayName = TITLE_NAME;\nvar DESCRIPTION_NAME = \"DialogDescription\";\nvar DialogDescription = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDialog, ...descriptionProps } = props;\n const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);\n return /* @__PURE__ */ jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });\n }\n);\nDialogDescription.displayName = DESCRIPTION_NAME;\nvar CLOSE_NAME = \"DialogClose\";\nvar DialogClose = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDialog, ...closeProps } = props;\n const context = useDialogContext(CLOSE_NAME, __scopeDialog);\n return /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n ...closeProps,\n ref: forwardedRef,\n onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))\n }\n );\n }\n);\nDialogClose.displayName = CLOSE_NAME;\nfunction getState(open) {\n return open ? \"open\" : \"closed\";\n}\nvar TITLE_WARNING_NAME = \"DialogTitleWarning\";\nvar [WarningProvider, useWarningContext] = createContext(TITLE_WARNING_NAME, {\n contentName: CONTENT_NAME,\n titleName: TITLE_NAME,\n docsSlug: \"dialog\"\n});\nvar TitleWarning = ({ titleId }) => {\n const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);\n const MESSAGE = `\\`${titleWarningContext.contentName}\\` requires a \\`${titleWarningContext.titleName}\\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \\`${titleWarningContext.titleName}\\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;\n React.useEffect(() => {\n if (titleId) {\n const hasTitle = document.getElementById(titleId);\n if (!hasTitle) console.error(MESSAGE);\n }\n }, [MESSAGE, titleId]);\n return null;\n};\nvar DESCRIPTION_WARNING_NAME = \"DialogDescriptionWarning\";\nvar DescriptionWarning = ({ contentRef, descriptionId }) => {\n const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);\n const MESSAGE = `Warning: Missing \\`Description\\` or \\`aria-describedby={undefined}\\` for {${descriptionWarningContext.contentName}}.`;\n React.useEffect(() => {\n const describedById = contentRef.current?.getAttribute(\"aria-describedby\");\n if (descriptionId && describedById) {\n const hasDescription = document.getElementById(descriptionId);\n if (!hasDescription) console.warn(MESSAGE);\n }\n }, [MESSAGE, contentRef, descriptionId]);\n return null;\n};\nvar Root = Dialog;\nvar Trigger = DialogTrigger;\nvar Portal = DialogPortal;\nvar Overlay = DialogOverlay;\nvar Content = DialogContent;\nvar Title = DialogTitle;\nvar Description = DialogDescription;\nvar Close = DialogClose;\nexport {\n Close,\n Content,\n Description,\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n Overlay,\n Portal,\n Root,\n Title,\n Trigger,\n WarningProvider,\n createDialogScope\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["DIALOG_NAME","createDialogContext","createDialogScope","createContextScope","DialogProvider","useDialogContext","Dialog","props","__scopeDialog","children","openProp","defaultOpen","onOpenChange","modal","triggerRef","React","contentRef","open","setOpen","useControllableState","jsx","useId","prevOpen","TRIGGER_NAME","DialogTrigger","forwardedRef","triggerProps","context","composedTriggerRef","useComposedRefs","Primitive","getState","composeEventHandlers","PORTAL_NAME","PortalProvider","usePortalContext","DialogPortal","forceMount","container","child","Presence","PortalPrimitive","OVERLAY_NAME","DialogOverlay","portalContext","overlayProps","DialogOverlayImpl","RemoveScroll","Slot","CONTENT_NAME","DialogContent","contentProps","DialogContentModal","DialogContentNonModal","composedRefs","content","hideOthers","DialogContentImpl","event","originalEvent","ctrlLeftClick","hasInteractedOutsideRef","hasPointerDownOutsideRef","target","trapFocus","onOpenAutoFocus","onCloseAutoFocus","useFocusGuards","jsxs","Fragment","FocusScope","DismissableLayer","TitleWarning","DescriptionWarning","TITLE_NAME","DialogTitle","titleProps","DESCRIPTION_NAME","DialogDescription","descriptionProps","CLOSE_NAME","DialogClose","closeProps","TITLE_WARNING_NAME","WarningProvider","useWarningContext","createContext","titleId","titleWarningContext","MESSAGE","DESCRIPTION_WARNING_NAME","descriptionId","describedById","Root","Trigger","Portal","Overlay","Content","Title","Description","Close"],"mappings":"s0BAmBA,IAAIA,EAAc,SACd,CAACC,EAAqBC,CAAiB,EAAIC,EAAAA,mBAAmBH,CAAW,EACzE,CAACI,GAAgBC,CAAgB,EAAIJ,EAAoBD,CAAW,EACpEM,EAAUC,GAAU,CACtB,KAAM,CACJ,cAAAC,EACA,SAAAC,EACA,KAAMC,EACN,YAAAC,EACA,aAAAC,EACA,MAAAC,EAAQ,EACZ,EAAMN,EACEO,EAAaC,EAAM,OAAO,IAAI,EAC9BC,EAAaD,EAAM,OAAO,IAAI,EAC9B,CAACE,EAAO,GAAOC,CAAO,EAAIC,EAAAA,qBAAqB,CACnD,KAAMT,EACN,YAAaC,EACb,SAAUC,CACd,CAAG,EACD,OAAuBQ,EAAG,IACxBhB,GACA,CACE,MAAOI,EACP,WAAAM,EACA,WAAAE,EACA,UAAWK,EAAAA,MAAO,EAClB,QAASA,EAAAA,MAAO,EAChB,cAAeA,EAAAA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,EAAAA,cAAcH,EAAoB,CAC3E,YAAalC,EACb,UAAWyB,EACX,SAAU,QACZ,CAAC,EACGF,GAAe,CAAC,CAAE,QAAAe,KAAc,CAClC,MAAMC,EAAsBH,EAAkBF,CAAkB,EAC1DM,EAAU,KAAKD,EAAoB,WAAW,mBAAmBA,EAAoB,SAAS;AAAA;AAAA,4BAE1EA,EAAoB,SAAS;AAAA;AAAA,4EAEmBA,EAAoB,QAAQ,GACtGzE,OAAAA,EAAM,UAAU,IAAM,CAChBwE,IACe,SAAS,eAAeA,CAAO,GACjC,QAAQ,MAAME,CAAO,EAE1C,EAAK,CAACA,EAASF,CAAO,CAAC,EACd,IACT,EACIG,GAA2B,2BAC3BjB,GAAqB,CAAC,CAAE,WAAAzD,EAAY,cAAA2E,KAAoB,CAE1D,MAAMF,EAAU,6EADkBJ,EAAkBK,EAAwB,EAC2C,WAAW,KAClI3E,OAAAA,EAAM,UAAU,IAAM,CACpB,MAAM6E,EAAgB5E,EAAW,SAAS,aAAa,kBAAkB,EACrE2E,GAAiBC,IACI,SAAS,eAAeD,CAAa,GACvC,QAAQ,KAAKF,CAAO,EAE5C,EAAE,CAACA,EAASzE,EAAY2E,CAAa,CAAC,EAChC,IACT,EACIE,GAAOvF,EACPwF,GAAUtE,EACVuE,GAAS3D,EACT4D,GAAUrD,EACVsD,GAAU/C,EACVgD,GAAQvB,EACRwB,GAAcrB,EACdsB,GAAQnB","x_google_ignoreList":[0]}
|
package/dist/index.cjs63.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),u=require("./index.cjs55.js"),d=require("react/jsx-runtime");function p(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,o.get?o:{enumerable:!0,get:()=>t[e]})}}return r.default=t,Object.freeze(r)}const f=p(l);var v="Separator",i="horizontal",O=["horizontal","vertical"],n=f.forwardRef((t,r)=>{const{decorative:e,orientation:o=i,...c}=t,a=m(o)?o:i,s=e?{role:"none"}:{"aria-orientation":a==="vertical"?a:void 0,role:"separator"};return d.jsx(u.Primitive.div,{"data-orientation":a,...s,...c,ref:r})});n.displayName=v;function m(t){return O.includes(t)}var b=n;exports.Root=b;exports.Separator=n;
|
|
2
2
|
//# sourceMappingURL=index.cjs63.js.map
|
package/dist/index.cjs63.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs63.js","sources":["../../../node_modules/.pnpm/@radix-ui+react-
|
|
1
|
+
{"version":3,"file":"index.cjs63.js","sources":["../../../node_modules/.pnpm/@radix-ui+react-separator@1.1.2_@types+react-dom@18.3.5_@types+react@18.3.18__@types+re_e069430f4793534a3e5922dcc5ebc25b/node_modules/@radix-ui/react-separator/dist/index.mjs"],"sourcesContent":["// packages/react/separator/src/separator.tsx\nimport * as React from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { jsx } from \"react/jsx-runtime\";\nvar NAME = \"Separator\";\nvar DEFAULT_ORIENTATION = \"horizontal\";\nvar ORIENTATIONS = [\"horizontal\", \"vertical\"];\nvar Separator = React.forwardRef((props, forwardedRef) => {\n const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props;\n const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;\n const ariaOrientation = orientation === \"vertical\" ? orientation : void 0;\n const semanticProps = decorative ? { role: \"none\" } : { \"aria-orientation\": ariaOrientation, role: \"separator\" };\n return /* @__PURE__ */ jsx(\n Primitive.div,\n {\n \"data-orientation\": orientation,\n ...semanticProps,\n ...domProps,\n ref: forwardedRef\n }\n );\n});\nSeparator.displayName = NAME;\nfunction isValidOrientation(orientation) {\n return ORIENTATIONS.includes(orientation);\n}\nvar Root = Separator;\nexport {\n Root,\n Separator\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["NAME","DEFAULT_ORIENTATION","ORIENTATIONS","Separator","React","props","forwardedRef","decorative","orientationProp","domProps","orientation","isValidOrientation","semanticProps","jsx","Primitive","Root"],"mappings":"gcAIA,IAAIA,EAAO,YACPC,EAAsB,aACtBC,EAAe,CAAC,aAAc,UAAU,EACxCC,EAAYC,EAAM,WAAW,CAACC,EAAOC,IAAiB,CACxD,KAAM,CAAE,WAAAC,EAAY,YAAaC,EAAkBP,EAAqB,GAAGQ,CAAQ,EAAKJ,EAClFK,EAAcC,EAAmBH,CAAe,EAAIA,EAAkBP,EAEtEW,EAAgBL,EAAa,CAAE,KAAM,QAAW,CAAE,mBADhCG,IAAgB,WAAaA,EAAc,OAC0B,KAAM,WAAa,EAChH,OAAuBG,EAAG,IACxBC,EAAAA,UAAU,IACV,CACE,mBAAoBJ,EACpB,GAAGE,EACH,GAAGH,EACH,IAAKH,CACX,CACG,CACH,CAAC,EACDH,EAAU,YAAcH,EACxB,SAASW,EAAmBD,EAAa,CACvC,OAAOR,EAAa,SAASQ,CAAW,CAC1C,CACG,IAACK,EAAOZ","x_google_ignoreList":[0]}
|
package/dist/index.cjs65.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),O=require("./index.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),O=require("./index.cjs58.js"),M=require("./index.cjs56.js"),I=require("./index.cjs34.js"),f=require("react/jsx-runtime");function v(s){const u=s+"CollectionProvider",[A,N]=O.createContextScope(u),[T,d]=A(u,{collectionRef:{current:null},itemMap:new Map}),a=c=>{const{scope:e,children:l}=c,t=r.useRef(null),o=r.useRef(new Map).current;return f.jsx(T,{scope:e,itemMap:o,collectionRef:t,children:l})};a.displayName=u;const m=s+"CollectionSlot",C=r.forwardRef((c,e)=>{const{scope:l,children:t}=c,o=d(m,l),n=M.useComposedRefs(e,o.collectionRef);return f.jsx(I.Slot,{ref:n,children:t})});C.displayName=m;const p=s+"CollectionItemSlot",R="data-radix-collection-item",x=r.forwardRef((c,e)=>{const{scope:l,children:t,...o}=c,n=r.useRef(null),S=M.useComposedRefs(e,n),i=d(p,l);return r.useEffect(()=>(i.itemMap.set(n,{ref:n,...o}),()=>void i.itemMap.delete(n))),f.jsx(I.Slot,{[R]:"",ref:S,children:t})});x.displayName=p;function y(c){const e=d(s+"CollectionConsumer",c);return r.useCallback(()=>{const t=e.collectionRef.current;if(!t)return[];const o=Array.from(t.querySelectorAll(`[${R}]`));return Array.from(e.itemMap.values()).sort((i,E)=>o.indexOf(i.ref.current)-o.indexOf(E.ref.current))},[e.collectionRef,e.itemMap])}return[{Provider:a,Slot:C,ItemSlot:x},y,N]}exports.createCollection=v;
|
|
2
2
|
//# sourceMappingURL=index.cjs65.js.map
|
package/dist/index.cjs67.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react"),b=require("./index.cjs57.js"),m=require("./index.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react"),b=require("./index.cjs57.js"),m=require("./index.cjs55.js"),R=require("./index.cjs56.js"),w=require("./index.cjs73.js"),H=require("./index.cjs79.js"),x=require("react/jsx-runtime");function U(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const i=U(q);var z="DismissableLayer",h="dismissableLayer.update",M="dismissableLayer.pointerDownOutside",$="dismissableLayer.focusOutside",L,T=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),S=i.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:c,onInteractOutside:f,onDismiss:d,...v}=e,a=i.useContext(T),[u,I]=i.useState(null),l=u?.ownerDocument??globalThis?.document,[,N]=i.useState({}),W=R.useComposedRefs(t,s=>I(s)),p=Array.from(a.layers),[_]=[...a.layersWithOutsidePointerEventsDisabled].slice(-1),A=p.indexOf(_),D=u?p.indexOf(u):-1,j=a.layersWithOutsidePointerEventsDisabled.size>0,O=D>=A,k=X(s=>{const E=s.target,C=[...a.branches].some(y=>y.contains(E));!O||C||(o?.(s),f?.(s),s.defaultPrevented||d?.())},l),P=Y(s=>{const E=s.target;[...a.branches].some(y=>y.contains(E))||(c?.(s),f?.(s),s.defaultPrevented||d?.())},l);return H.useEscapeKeydown(s=>{D===a.layers.size-1&&(r?.(s),!s.defaultPrevented&&d&&(s.preventDefault(),d()))},l),i.useEffect(()=>{if(u)return n&&(a.layersWithOutsidePointerEventsDisabled.size===0&&(L=l.body.style.pointerEvents,l.body.style.pointerEvents="none"),a.layersWithOutsidePointerEventsDisabled.add(u)),a.layers.add(u),g(),()=>{n&&a.layersWithOutsidePointerEventsDisabled.size===1&&(l.body.style.pointerEvents=L)}},[u,l,n,a]),i.useEffect(()=>()=>{u&&(a.layers.delete(u),a.layersWithOutsidePointerEventsDisabled.delete(u),g())},[u,a]),i.useEffect(()=>{const s=()=>N({});return document.addEventListener(h,s),()=>document.removeEventListener(h,s)},[]),x.jsx(m.Primitive.div,{...v,ref:W,style:{pointerEvents:j?O?"auto":"none":void 0,...e.style},onFocusCapture:b.composeEventHandlers(e.onFocusCapture,P.onFocusCapture),onBlurCapture:b.composeEventHandlers(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:b.composeEventHandlers(e.onPointerDownCapture,k.onPointerDownCapture)})});S.displayName=z;var K="DismissableLayerBranch",B=i.forwardRef((e,t)=>{const n=i.useContext(T),r=i.useRef(null),o=R.useComposedRefs(t,r);return i.useEffect(()=>{const c=r.current;if(c)return n.branches.add(c),()=>{n.branches.delete(c)}},[n.branches]),x.jsx(m.Primitive.div,{...e,ref:o})});B.displayName=K;function X(e,t=globalThis?.document){const n=w.useCallbackRef(e),r=i.useRef(!1),o=i.useRef(()=>{});return i.useEffect(()=>{const c=d=>{if(d.target&&!r.current){let v=function(){F(M,n,a,{discrete:!0})};const a={originalEvent:d};d.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=v,t.addEventListener("click",o.current,{once:!0})):v()}else t.removeEventListener("click",o.current);r.current=!1},f=window.setTimeout(()=>{t.addEventListener("pointerdown",c)},0);return()=>{window.clearTimeout(f),t.removeEventListener("pointerdown",c),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Y(e,t=globalThis?.document){const n=w.useCallbackRef(e),r=i.useRef(!1);return i.useEffect(()=>{const o=c=>{c.target&&!r.current&&F($,n,{originalEvent:c},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function g(){const e=new CustomEvent(h);document.dispatchEvent(e)}function F(e,t,n,{discrete:r}){const o=n.originalEvent.target,c=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?m.dispatchDiscreteCustomEvent(o,c):o.dispatchEvent(c)}exports.DismissableLayer=S;exports.DismissableLayerBranch=B;
|
|
2
2
|
//# sourceMappingURL=index.cjs67.js.map
|
package/dist/index.cjs69.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("react"),A=require("./index.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("react"),A=require("./index.cjs56.js"),k=require("./index.cjs55.js"),T=require("./index.cjs73.js"),w=require("react/jsx-runtime");function x(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const f=x(U);var F="focusScope.autoFocusOnMount",y="focusScope.autoFocusOnUnmount",O={bubbles:!1,cancelable:!0},K="FocusScope",C=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:p,onUnmountAutoFocus:L,...P}=e,[s,R]=f.useState(null),v=T.useCallbackRef(p),E=T.useCallbackRef(L),b=f.useRef(null),_=A.useComposedRefs(t,u=>R(u)),a=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(o){let u=function(i){if(a.paused||!s)return;const c=i.target;s.contains(c)?b.current=c:d(b.current,{select:!0})},l=function(i){if(a.paused||!s)return;const c=i.relatedTarget;c!==null&&(s.contains(c)||d(b.current,{select:!0}))},r=function(i){if(document.activeElement===document.body)for(const S of i)S.removedNodes.length>0&&d(s)};document.addEventListener("focusin",u),document.addEventListener("focusout",l);const m=new MutationObserver(r);return s&&m.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",u),document.removeEventListener("focusout",l),m.disconnect()}}},[o,s,a.paused]),f.useEffect(()=>{if(s){N.add(a);const u=document.activeElement;if(!s.contains(u)){const r=new CustomEvent(F,O);s.addEventListener(F,v),s.dispatchEvent(r),r.defaultPrevented||(j(W(I(s)),{select:!0}),document.activeElement===u&&d(s))}return()=>{s.removeEventListener(F,v),setTimeout(()=>{const r=new CustomEvent(y,O);s.addEventListener(y,E),s.dispatchEvent(r),r.defaultPrevented||d(u??document.body,{select:!0}),s.removeEventListener(y,E),N.remove(a)},0)}}},[s,v,E,a]);const M=f.useCallback(u=>{if(!n&&!o||a.paused)return;const l=u.key==="Tab"&&!u.altKey&&!u.ctrlKey&&!u.metaKey,r=document.activeElement;if(l&&r){const m=u.currentTarget,[i,c]=D(m);i&&c?!u.shiftKey&&r===c?(u.preventDefault(),n&&d(i,{select:!0})):u.shiftKey&&r===i&&(u.preventDefault(),n&&d(c,{select:!0})):r===m&&u.preventDefault()}},[n,o,a.paused]);return w.jsx(k.Primitive.div,{tabIndex:-1,...P,ref:_,onKeyDown:M})});C.displayName=K;function j(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(d(o,{select:t}),document.activeElement!==n)return}function D(e){const t=I(e),n=h(t,e),o=h(t.reverse(),e);return[n,o]}function I(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const p=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||p?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function h(e,t){for(const n of e)if(!q(n,{upTo:t}))return n}function q(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function H(e){return e instanceof HTMLInputElement&&"select"in e}function d(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&H(e)&&t&&e.select()}}var N=V();function V(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=g(e,t),e.unshift(t)},remove(t){e=g(e,t),e[0]?.resume()}}}function g(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function W(e){return e.filter(t=>t.tagName!=="A")}exports.FocusScope=C;
|
|
2
2
|
//# sourceMappingURL=index.cjs69.js.map
|
package/dist/index.cjs7.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("./index.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),ie=require("./index.cjs6.js"),u=require("./index.cjs13.js"),d=require("./index.cjs19.js"),se=require("./index.cjs14.js"),r=require("./index.cjs16.js"),$=require("./index.cjs11.js"),ae=require("./index.cjs18.js"),L=require("./index.cjs8.js"),oe=require("./index.cjs20.js"),a=require("./index.cjs21.js"),S=require("./index.cjs22.js"),ce=require("./index.cjs23.js"),de=require("ajv"),p=require("./index.cjs24.js"),ue=require("./index.cjs25.js"),C=require("./index.cjs12.js"),he=require("./index.cjs26.js"),me=require("./index.cjs27.js"),je=require("./index.cjs28.js"),xe=require("./index.cjs29.js"),ge=require("./index.cjs30.js"),be=i=>{const[O,m]=s.useState(!1),[k,b]=s.useState(!1),[F,j]=s.useState(!1),[x,f]=s.useState(),[D,A]=s.useState(),[P,N]=s.useState(),[q,g]=s.useState(null);L.usePluginSystem(i.plugins??[]);const{getCurrentSchema:U,setPath:h,path:o,handleAddProperty:Q,handlePropertyChange:c,handleKeyChange:B,handleDeleteProperty:H,setSchema:M,isPropertyRequired:I,handleDuplicateProperty:_}=ie.useSchema({onSchemaChange:i.onSchemaChange}),{getConstraintDefinitionsForType:G}=L.useConstraints();s.useEffect(()=>{if(i.initialSchema)try{ce.validateSchema(i.initialSchema),M(ae.a(i.initialSchema)),g(null)}catch(t){t instanceof Error?g(t.message):t instanceof de.ValidationError?g(`Schema validation error: ${t.message}`):g("Unknown schema validation error")}},[i.initialSchema]);const J=U(),E=t=>{h([...o,t])},w=()=>{h(o.slice(0,-1))},W=(t,n)=>{A(t),N(n),b(!0)},T=t=>{f(t),j(!0)},X=()=>{x&&(H(x),f(void 0)),j(!1)},Y=()=>{f(void 0),j(!1)},R=t=>{const n=_(t);n?.status==="error"?i.onPropertyAddError?.(n):n?.status==="success"&&i.onPropertyAddSuccess?.(n)},Z=(...t)=>{const n=Q(...t);n.status==="error"?i.onPropertyAddError?.(n):n.status==="success"&&i.onPropertyAddSuccess?.(n),m(!1)},z=i.propertyComponent,ee=(t,n)=>z?e.jsx(z,{property:{key:t,schema:n,isRequired:I(t)},onPropertyChange:c,onKeyChange:B,onDelete:T,onDuplicate:R,onNavigate:n.type==="object"||n.type==="array"&&typeof n.items=="object"&&n.items.type==="object"?E:void 0},t):e.jsxs("div",{className:"flex flex-col md:grid grid-cols-(--my-autofit-grid) gap-4 md:items-center border p-2 rounded-md mb-2",children:[e.jsx("div",{className:"",children:e.jsx(p.DebouncedInput,{value:t,onDebounce:l=>B(t,l),placeholder:"Property Key","aria-label":`Property key for ${t}`,delay:500})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se.Switch,{checked:I(t),onCheckedChange:l=>c(t,{isRequired:l}),"aria-label":"Required"}),e.jsx($.Label,{htmlFor:`required-${t}`,children:"Required"})]}),e.jsx("div",{className:"",children:e.jsxs(r.Select,{value:typeof n=="object"&&!Array.isArray(n.type)?n.type:void 0,onValueChange:l=>c(t,{type:l}),"aria-label":"Type",children:[e.jsx(r.SelectTrigger,{className:"w-full","aria-label":"Select type",children:e.jsx(r.SelectValue,{})}),e.jsxs(r.SelectContent,{children:[e.jsx(r.SelectItem,{value:"string",children:"string"}),e.jsx(r.SelectItem,{value:"number",children:"number"}),e.jsx(r.SelectItem,{value:"integer",children:"integer"}),e.jsx(r.SelectItem,{value:"boolean",children:"boolean"}),e.jsx(r.SelectItem,{value:"object",children:"object"}),e.jsx(r.SelectItem,{value:"array",children:"array"}),e.jsx(r.SelectItem,{value:"null",children:"null"}),e.jsx(r.SelectItem,{value:"enum",children:"enum"})]})]})}),e.jsx("div",{className:"",children:e.jsx(p.DebouncedInput,{value:typeof n=="object"?n.title:void 0,onDebounce:l=>c(t,{title:l}),placeholder:"Title"})}),e.jsx("div",{className:"",children:e.jsx(p.DebouncedInput,{value:typeof n=="object"?n.description:void 0,onDebounce:l=>c(t,{description:l}),placeholder:"Description"})}),e.jsxs("div",{className:"order-last md:order-none flex gap-2",children:[e.jsx(u.Button,{variant:"outline",size:"sm",onClick:()=>T(t),"aria-label":"Delete",className:"block!",children:e.jsx(me.default,{size:16,className:"text-destructive"})}),e.jsx(u.Button,{variant:"outline",size:"sm",onClick:()=>R(t),"aria-label":"Duplicate",className:"block!",children:e.jsx(je.default,{size:16})}),ne(t,n),K(t,n)]}),te(t,n)]},t),te=(t,n)=>{if(typeof n!="object"||n.type!=="array")return null;const l=n.items,v=!Array.isArray(l)&&typeof l=="object"&&typeof l.type=="string"?l?.type:"string";return e.jsxs("div",{className:"col-span-full flex items-center gap-4 pl-8 mt-2 bg-gray-50 p-2 rounded-md",children:[e.jsx($.Label,{children:"Items of type:"}),e.jsxs(r.Select,{value:v,onValueChange:V=>{const y={...typeof l=="object"?l:{},type:V};V==="object"&&(y.properties=y.properties??{}),c(t,{items:y})},children:[e.jsx(r.SelectTrigger,{className:"w-[200px]","aria-label":"Select items of type",children:e.jsx(r.SelectValue,{})}),e.jsxs(r.SelectContent,{children:[e.jsx(r.SelectItem,{value:"string",children:"string"}),e.jsx(r.SelectItem,{value:"number",children:"number"}),e.jsx(r.SelectItem,{value:"integer",children:"integer"}),e.jsx(r.SelectItem,{value:"boolean",children:"boolean"}),e.jsx(r.SelectItem,{value:"object",children:"object"}),e.jsx(r.SelectItem,{value:"array",children:"array"}),e.jsx(r.SelectItem,{value:"null",children:"null"})]})]}),K(t,l)]})},ne=(t,n)=>{if(typeof n!="object")return null;const l=G(typeof n.type=="string"?n.type:""),v=Array.isArray(n?.enum);return l.length||v?e.jsx(u.Button,{variant:"outline",size:"sm",onClick:()=>W(t,n),"aria-label":"Edit constraints",children:e.jsx(xe.default,{size:16})}):null},K=(t,n)=>!Array.isArray(n)&&typeof n=="object"&&n?.type==="object"?e.jsxs(u.Button,{variant:"outline",size:"sm",onClick:()=>E(t),"aria-label":"Navigate",children:[e.jsx("span",{className:"sr-only",children:"Navigate"}),e.jsx(ge.default,{size:16})]}):null,re=()=>{const t=i.navigationComponent;return t?e.jsx(t,{currentPath:o,onNavigateUp:w,onNavigateTo:h,isRootPath:o.length===0}):e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(u.Button,{variant:"outline",size:"sm",onClick:w,disabled:o.length===0,className:C.cn(i.backButtonClassName),children:"Back"}),e.jsx(d.Breadcrumb,{children:e.jsxs(d.BreadcrumbList,{children:[e.jsx(d.BreadcrumbItem,{children:e.jsx(d.BreadcrumbLink,{href:"#",onClick:()=>h([]),children:"Root"})}),o.map((n,l)=>e.jsxs(s.Fragment,{children:[e.jsx(d.BreadcrumbSeparator,{}),e.jsx(d.BreadcrumbItem,{children:e.jsx(d.BreadcrumbLink,{href:"#",onClick:()=>h(o.slice(0,l+1)),children:n})})]},`path-${l}`))]})})]})},le=()=>{const t=i.addPropertyButtonComponent;return t?e.jsx(t,{onClick:()=>m(!0)}):e.jsxs(u.Button,{type:"button",className:C.cn("self-center",i.addPropertyButtonClassName),onClick:()=>{m(!0)},children:[e.jsx(he.default,{className:"h-4 w-4 mr-2"}),"Add Property"]})};return e.jsxs("div",{children:[q&&e.jsxs(S.Alert,{variant:"destructive",children:[e.jsx(S.AlertTitle,{children:"Schema Error"}),e.jsx(S.AlertDescription,{children:q})]}),re(),e.jsx("div",{className:C.cn("mt-6 overflow-x-hidden",i.propertiesListClassName),children:Object.entries(J.properties??{}).map(([t,n])=>typeof n=="boolean"?null:ee(t,n))}),le(),e.jsx(ue.AddPropertyDialog,{open:O,onOpenChange:m,onSubmit:Z}),D&&P&&e.jsx(oe.EditPropertyDialog,{propertyKey:D,property:P,open:k,onOpenChange:b,onSubmit:t=>{c(...t),A(void 0),N(void 0),b(!1)}}),e.jsx(a.AlertDialog,{open:F,onOpenChange:j,children:e.jsxs(a.AlertDialogContent,{children:[e.jsxs(a.AlertDialogHeader,{children:[e.jsx(a.AlertDialogTitle,{children:"Are you sure?"}),e.jsxs(a.AlertDialogDescription,{children:["This action cannot be undone. This will permanently delete the property",x?` "${x}"`:""," from the schema."]})]}),e.jsxs(a.AlertDialogFooter,{children:[e.jsx(a.AlertDialogCancel,{onClick:Y,children:"Cancel"}),e.jsx(a.AlertDialogAction,{onClick:X,children:"Delete"})]})]})})]})};exports.SchemaBuilder=be;
|
|
2
2
|
//# sourceMappingURL=index.cjs7.js.map
|
package/dist/index.cjs7.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs7.js","sources":["../src/packages/plugins/object.tsx"],"sourcesContent":["import { Input } from \"@/components/ui/input\";\nimport { InputErrorWrapper } from \"@/components/input-error\";\nimport { Label } from \"@/components/ui/label\";\nimport { cn } from \"@/lib/utils\";\nimport {\n BaseJSONSchemaPlugin,\n ConstraintRendererProps,\n useConstraints,\n} from \"@/packages/constraints/context\";\nimport { Button } from \"@/components/ui/button\";\nimport { X } from \"lucide-react\";\n\n// Number constraint renderer for minProperties and maxProperties\nconst ObjectNumberConstraintRenderer = ({\n constraintName,\n value,\n onConstraintChange,\n disabled,\n error,\n onRemoveConstraint,\n}: ConstraintRendererProps<number> & { disabled?: boolean }) => {\n const { getConstraintDefinition } = useConstraints();\n const constraintDef = getConstraintDefinition(constraintName);\n\n if (!constraintDef) {\n return null;\n }\n\n return (\n <InputErrorWrapper\n errorCode={error?.code}\n errorDescription={error?.message}\n showError={!!error}\n >\n <div>\n <Label className=\"mb-2\" htmlFor={constraintDef.name}>\n {constraintDef.name}\n </Label>\n <div className=\"flex items-center gap-2\">\n <Input\n id={constraintDef.name}\n type=\"number\"\n value={value}\n onChange={(e) => onConstraintChange(Number(e.target.value))}\n disabled={disabled}\n min={0}\n className={cn({ \"border-destructive\": error })}\n />\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => onRemoveConstraint()}\n >\n <X className=\"size-4\" />\n </Button>\n </div>\n {constraintDef.description && (\n <div className=\"mt-2 text-sm text-gray-500\">\n {constraintDef.description}\n </div>\n )}\n </div>\n </InputErrorWrapper>\n );\n};\n\n// Export the renderers\nexport const ObjectMinPropertiesRenderer = ObjectNumberConstraintRenderer;\nexport const ObjectMaxPropertiesRenderer = ObjectNumberConstraintRenderer;\n\nconst plugin: BaseJSONSchemaPlugin = {\n id: \"object-constraints\",\n hooks: {\n registerConstraints() {\n return [\n {\n name: \"minProperties\",\n label: \"Min Properties\",\n appliesTo: [\"object\"],\n schema: {\n type: \"integer\",\n title: \"Minimum Properties Constraint\",\n description:\n \"The minimum number of properties the object must have\",\n examples: [1, 2, 5],\n minimum: 0,\n },\n description:\n \"Specifies the minimum number of properties in the object\",\n defaultValue: 0,\n },\n {\n name: \"maxProperties\",\n label: \"Max Properties\",\n appliesTo: [\"object\"],\n schema: {\n type: \"integer\",\n title: \"Maximum Properties Constraint\",\n description: \"The maximum number of properties the object can have\",\n examples: [5, 10, 20],\n minimum: 0,\n },\n description:\n \"Specifies the maximum number of properties in the object\",\n defaultValue: 10,\n },\n ];\n },\n registerRenderers() {\n return {\n minProperties: ObjectMinPropertiesRenderer,\n maxProperties: ObjectMaxPropertiesRenderer,\n };\n },\n },\n};\n\nexport default plugin;\n"],"names":["ObjectNumberConstraintRenderer","constraintName","value","onConstraintChange","disabled","error","onRemoveConstraint","getConstraintDefinition","useConstraints","constraintDef","jsx","InputErrorWrapper","Label","jsxs","Input","e","cn","Button","X","ObjectMinPropertiesRenderer","ObjectMaxPropertiesRenderer"],"mappings":"sUAaMA,EAAiC,CAAC,CACtC,eAAAC,EACA,MAAAC,EACA,mBAAAC,EACA,SAAAC,EACA,MAAAC,EACA,mBAAAC,CACF,IAAgE,CACxD,KAAA,CAAE,wBAAAC,CAAwB,EAAIC,iBAAe,EAC7CC,EAAgBF,EAAwBN,CAAc,EAE5D,OAAKQ,EAKHC,EAAA,IAACC,EAAA,kBAAA,CACC,UAAWN,GAAO,KAClB,iBAAkBA,GAAO,QACzB,UAAW,CAAC,CAACA,EAEb,gBAAC,MACC,CAAA,SAAA,CAAAK,EAAAA,IAACE,SAAM,UAAU,OAAO,QAASH,EAAc,KAC5C,WAAc,IACjB,CAAA,EACAI,EAAAA,KAAC,MAAI,CAAA,UAAU,0BACb,SAAA,CAAAH,EAAA,IAACI,EAAA,MAAA,CACC,GAAIL,EAAc,KAClB,KAAK,SACL,MAAAP,EACA,SAAWa,GAAMZ,EAAmB,OAAOY,EAAE,OAAO,KAAK,CAAC,EAC1D,SAAAX,EACA,IAAK,EACL,UAAWY,EAAA,GAAG,CAAE,qBAAsBX,CAAO,CAAA,CAAA,CAC/C,EACAK,EAAA,IAACO,EAAA,OAAA,CACC,KAAK,SACL,QAAQ,QACR,KAAK,OACL,QAAS,IAAMX,EAAmB,EAElC,SAAAI,EAAAA,IAACQ,EAAAA,QAAE,CAAA,UAAU,QAAS,CAAA,CAAA,CAAA,CACxB,EACF,EACCT,EAAc,aACbC,EAAA,IAAC,OAAI,UAAU,6BACZ,WAAc,WACjB,CAAA,CAAA,CAEJ,CAAA,CAAA,CACF,EAtCO,IAwCX,EAGaS,EAA8BnB,EAC9BoB,EAA8BpB"}
|
|
1
|
+
{"version":3,"file":"index.cjs7.js","sources":["../src/packages/builder/schema-builder.tsx"],"sourcesContent":["import { useEffect, useState, Fragment } from \"react\";\nimport { PropertyAddError, PropertyAddSuccess, useSchema } from \"./context\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbSeparator,\n} from \"@/components/ui/breadcrumb\";\nimport { Switch } from \"@/components/ui/switch\";\nimport { Bolt, ChevronRight, Copy, Plus, Trash2 } from \"lucide-react\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/components/ui/select\";\nimport { Label } from \"@/components/ui/label\";\nimport type { JSONSchema7 } from \"json-schema\";\nimport { clone } from \"remeda\";\nimport {\n BaseJSONSchemaPlugin,\n useConstraints,\n usePluginSystem,\n} from \"@/packages/constraints/context\";\nimport { EditPropertyDialog } from \"./edit-dialog\";\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from \"@/components/ui/alert-dialog\";\nimport { Alert, AlertDescription, AlertTitle } from \"@/components/ui/alert\";\nimport { validateSchema } from \"./utils\";\nimport Ajv from \"ajv\";\nimport { DebouncedInput } from \"@/components/depounced-input\";\nimport { AddPropertyDialog, type AddPropertyDialogProps } from \"./add-dialog\";\nimport { cn } from \"@/lib/utils\";\n\n// PropertyComponent type definition for custom property components\nexport interface PropertyComponentProps {\n property: {\n key: string;\n schema: JSONSchema7;\n isRequired: boolean;\n };\n onPropertyChange: (key: string, changes: Partial<JSONSchema7>) => void;\n onKeyChange: (oldKey: string, newKey: string) => void;\n onDelete: (key: string) => void;\n onDuplicate?: (key: string) => void;\n onNavigate?: (key: string) => void;\n}\n\n// NavigationProps for custom navigation component\nexport interface NavigationProps {\n currentPath: string[];\n onNavigateUp: () => void;\n onNavigateTo: (newPath: string[]) => void;\n isRootPath: boolean;\n}\n\n// AddPropertyButtonProps for custom add property button\nexport interface AddPropertyButtonProps {\n onClick: () => void;\n}\n\ninterface SchemaBuilderProps {\n /** The schema to edit */\n initialSchema?: JSONSchema7;\n /** Constraint plugins to use */\n plugins?: BaseJSONSchemaPlugin[];\n /** Custom component to render properties */\n propertyComponent?: React.ComponentType<PropertyComponentProps>;\n /** Called when the schema changes */\n onSchemaChange?: (schema: JSONSchema7) => void;\n /** Called when a property is successfully added */\n onPropertyAddSuccess?: (props: PropertyAddSuccess) => void;\n /** Called when there's an error adding a property */\n onPropertyAddError?: (props: PropertyAddError) => void;\n /** Called when there's an error changing a property */\n onPropertyChangeError?: (prop: Error) => void;\n /** Called when a property is successfully changed */\n onPropertyChangeSuccess?: () => void;\n /** Class name for the navigation bar back button */\n backButtonClassName?: string;\n /** Class name for the properties list container */\n propertiesListClassName?: string;\n /** Class name for the add property button */\n addPropertyButtonClassName?: string;\n /** Custom navigation component */\n navigationComponent?: React.ComponentType<NavigationProps>;\n /** Custom add property button component */\n addPropertyButtonComponent?: React.ComponentType<AddPropertyButtonProps>;\n}\n\nexport const SchemaBuilder = (props: SchemaBuilderProps) => {\n // State\n const [showPropertyDialog, setShowPropertyDialog] = useState(false);\n const [showEditDialog, setShowEditDialog] = useState(false);\n const [showDeleteDialog, setShowDeleteDialog] = useState(false);\n const [deleteKey, setDeleteKey] = useState<string | undefined>();\n const [editingKey, setEditingKey] = useState<string | undefined>();\n const [editingProperty, setEditingProperty] = useState<\n JSONSchema7 | undefined\n >();\n const [schemaValidationError, setSchemaValidationError] = useState<\n string | null\n >(null);\n\n // Initialize the plugin system\n usePluginSystem(props.plugins ?? []);\n\n // Get schema context\n const {\n getCurrentSchema,\n setPath,\n path,\n handleAddProperty,\n handlePropertyChange,\n handleKeyChange,\n handleDeleteProperty,\n setSchema,\n isPropertyRequired,\n handleDuplicateProperty,\n } = useSchema({ onSchemaChange: props.onSchemaChange });\n\n // Get constraints context\n const { getConstraintDefinitionsForType } = useConstraints();\n\n // Set schema from props\n useEffect(() => {\n if (props.initialSchema) {\n try {\n // Validate the schema before setting it\n validateSchema(props.initialSchema);\n setSchema(clone(props.initialSchema));\n setSchemaValidationError(null);\n } catch (error) {\n if (error instanceof Error) {\n setSchemaValidationError(error.message);\n } else if (error instanceof Ajv.ValidationError) {\n setSchemaValidationError(`Schema validation error: ${error.message}`);\n } else {\n setSchemaValidationError(\"Unknown schema validation error\");\n }\n }\n }\n }, [props.initialSchema]);\n\n const currentSchema = getCurrentSchema();\n\n // Navigation handlers\n const handleNavigateToProperty = (name: string) => {\n setPath([...path, name]);\n };\n\n const handleNavigateUp = () => {\n setPath(path.slice(0, -1));\n };\n\n // Property management handlers\n const handleEditProperty = (key: string, property: JSONSchema7) => {\n setEditingKey(key);\n setEditingProperty(property);\n setShowEditDialog(true);\n };\n\n const handleInitiateDelete = (key: string) => {\n setDeleteKey(key);\n setShowDeleteDialog(true);\n };\n\n const handleConfirmDelete = () => {\n if (deleteKey) {\n handleDeleteProperty(deleteKey);\n setDeleteKey(undefined);\n }\n setShowDeleteDialog(false);\n };\n\n const handleCancelDelete = () => {\n setDeleteKey(undefined);\n setShowDeleteDialog(false);\n };\n\n const handleDuplicate = (key: string) => {\n const result = handleDuplicateProperty(key);\n\n // Notify if needed\n if (result?.status === \"error\") {\n props.onPropertyAddError?.(result);\n } else if (result?.status === \"success\") {\n props.onPropertyAddSuccess?.(result);\n }\n };\n\n const onAddProperty: AddPropertyDialogProps[\"onSubmit\"] = (...vals) => {\n const result = handleAddProperty(...vals);\n\n if (result.status === \"error\") {\n props.onPropertyAddError?.(result);\n } else if (result.status === \"success\") {\n props.onPropertyAddSuccess?.(result);\n }\n setShowPropertyDialog(false);\n };\n\n // Custom property component or default renderer\n const PropertyComponent = props.propertyComponent;\n\n const renderProperty = (key: string, property: JSONSchema7) => {\n if (PropertyComponent) {\n return (\n <PropertyComponent\n key={key}\n property={{\n key,\n schema: property,\n isRequired: isPropertyRequired(key),\n }}\n onPropertyChange={handlePropertyChange}\n onKeyChange={handleKeyChange}\n onDelete={handleInitiateDelete}\n onDuplicate={handleDuplicate}\n onNavigate={\n property.type === \"object\" ||\n (property.type === \"array\" &&\n typeof property.items === \"object\" &&\n (property.items as JSONSchema7).type === \"object\")\n ? handleNavigateToProperty\n : undefined\n }\n />\n );\n }\n\n // Default property renderer\n return (\n <div\n key={key}\n className=\"flex flex-col md:grid grid-cols-(--my-autofit-grid) gap-4 md:items-center border p-2 rounded-md mb-2\"\n >\n <div className=\"\">\n <DebouncedInput\n value={key}\n onDebounce={(newVal) => handleKeyChange(key, newVal)}\n placeholder=\"Property Key\"\n aria-label={`Property key for ${key}`}\n delay={500}\n />\n </div>\n\n <div className=\"flex items-center gap-2\">\n <Switch\n checked={isPropertyRequired(key)}\n onCheckedChange={(checked) =>\n handlePropertyChange(key, { isRequired: checked })\n }\n aria-label=\"Required\"\n />\n <Label htmlFor={`required-${key}`}>Required</Label>\n </div>\n\n <div className=\"\">\n <Select\n value={\n typeof property === \"object\" && !Array.isArray(property.type)\n ? property.type\n : undefined\n }\n onValueChange={(value) =>\n handlePropertyChange(key, {\n type: value as JSONSchema7[\"type\"],\n })\n }\n aria-label=\"Type\"\n >\n <SelectTrigger className=\"w-full\" aria-label=\"Select type\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value={\"string\" satisfies JSONSchema7[\"type\"]}>\n string\n </SelectItem>\n <SelectItem value={\"number\" satisfies JSONSchema7[\"type\"]}>\n number\n </SelectItem>\n <SelectItem value={\"integer\" satisfies JSONSchema7[\"type\"]}>\n integer\n </SelectItem>\n <SelectItem value={\"boolean\" satisfies JSONSchema7[\"type\"]}>\n boolean\n </SelectItem>\n <SelectItem value={\"object\" satisfies JSONSchema7[\"type\"]}>\n object\n </SelectItem>\n <SelectItem value={\"array\" satisfies JSONSchema7[\"type\"]}>\n array\n </SelectItem>\n <SelectItem value={\"null\" satisfies JSONSchema7[\"type\"]}>\n null\n </SelectItem>\n <SelectItem value={\"enum\"}>enum</SelectItem>\n </SelectContent>\n </Select>\n </div>\n\n <div className=\"\">\n <DebouncedInput\n value={typeof property === \"object\" ? property.title : undefined}\n onDebounce={(newVal) =>\n handlePropertyChange(key, { title: newVal })\n }\n placeholder=\"Title\"\n />\n </div>\n\n <div className=\"\">\n <DebouncedInput\n value={\n typeof property === \"object\" ? property.description : undefined\n }\n onDebounce={(newVal) =>\n handlePropertyChange(key, { description: newVal })\n }\n placeholder=\"Description\"\n />\n </div>\n\n <div className=\"order-last md:order-none flex gap-2\">\n {/* Delete button */}\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => handleInitiateDelete(key)}\n aria-label=\"Delete\"\n className=\"block!\"\n >\n <Trash2 size={16} className=\"text-destructive\" />\n </Button>\n\n {/* Duplicate button */}\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => handleDuplicate(key)}\n aria-label=\"Duplicate\"\n className=\"block!\"\n >\n <Copy size={16} />\n </Button>\n\n {/* Edit button if applicable */}\n {renderEditButton(key, property)}\n\n {/* Navigate button for objects/array items */}\n {renderNavigateButton(key, property)}\n </div>\n\n {/* Render array items configuration if needed */}\n {renderArrayItemsConfig(key, property)}\n </div>\n );\n };\n\n // Helper to render array items configuration\n const renderArrayItemsConfig = (key: string, property: JSONSchema7) => {\n if (typeof property !== \"object\" || property.type !== \"array\") {\n return null;\n }\n\n const items = property.items;\n const itemType =\n !Array.isArray(items) &&\n typeof items === \"object\" &&\n typeof items.type === \"string\"\n ? items?.type\n : \"string\";\n\n return (\n <div className=\"col-span-full flex items-center gap-4 pl-8 mt-2 bg-gray-50 p-2 rounded-md\">\n <Label>Items of type:</Label>\n <Select\n value={itemType as string}\n onValueChange={(value) => {\n const newItems: JSONSchema7 = {\n ...(typeof items === \"object\" ? items : {}),\n type: value as JSONSchema7[\"type\"],\n };\n\n if (value === \"object\") {\n // Initialize empty properties for object type\n newItems.properties = newItems.properties ?? {};\n }\n\n handlePropertyChange(key, { items: newItems });\n }}\n >\n <SelectTrigger\n className=\"w-[200px]\"\n aria-label=\"Select items of type\"\n >\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value={\"string\" satisfies JSONSchema7[\"type\"]}>\n string\n </SelectItem>\n <SelectItem value={\"number\" satisfies JSONSchema7[\"type\"]}>\n number\n </SelectItem>\n <SelectItem value={\"integer\" satisfies JSONSchema7[\"type\"]}>\n integer\n </SelectItem>\n <SelectItem value={\"boolean\" satisfies JSONSchema7[\"type\"]}>\n boolean\n </SelectItem>\n <SelectItem value={\"object\" satisfies JSONSchema7[\"type\"]}>\n object\n </SelectItem>\n <SelectItem value={\"array\" satisfies JSONSchema7[\"type\"]}>\n array\n </SelectItem>\n <SelectItem value={\"null\" satisfies JSONSchema7[\"type\"]}>\n null\n </SelectItem>\n </SelectContent>\n </Select>\n\n {/* Configure object button for array items of type object */}\n {renderNavigateButton(key, items)}\n </div>\n );\n };\n\n // Helper to render the edit constraint button when needed\n const renderEditButton = (key: string, property: JSONSchema7) => {\n if (typeof property !== \"object\") return null;\n\n // Check for constraints\n const availableConstraints = getConstraintDefinitionsForType(\n typeof property.type === \"string\" ? property.type : \"\",\n );\n\n // Check for enum\n const hasEnum = Array.isArray(property?.enum);\n\n if (availableConstraints.length || hasEnum) {\n return (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => handleEditProperty(key, property)}\n aria-label=\"Edit constraints\"\n >\n <Bolt size={16} />\n </Button>\n );\n }\n\n return null;\n };\n\n const renderNavigateButton = (key: string, items: JSONSchema7[\"items\"]) => {\n if (\n !Array.isArray(items) &&\n typeof items === \"object\" &&\n items?.type === \"object\"\n ) {\n return (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => handleNavigateToProperty(key)}\n aria-label=\"Navigate\"\n >\n <span className=\"sr-only\">Navigate</span>\n <ChevronRight size={16} />\n </Button>\n );\n }\n\n return null;\n };\n\n // Render navigation component\n const renderNavigation = () => {\n const NavigationComponent = props.navigationComponent;\n\n if (NavigationComponent) {\n return (\n <NavigationComponent\n currentPath={path}\n onNavigateUp={handleNavigateUp}\n onNavigateTo={setPath}\n isRootPath={path.length === 0}\n />\n );\n }\n\n return (\n <div className=\"flex items-center space-x-4\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={handleNavigateUp}\n disabled={path.length === 0}\n className={cn(props.backButtonClassName)}\n >\n Back\n </Button>\n <Breadcrumb>\n <BreadcrumbList>\n <BreadcrumbItem>\n <BreadcrumbLink href=\"#\" onClick={() => setPath([])}>\n Root\n </BreadcrumbLink>\n </BreadcrumbItem>\n {path.map((item, index) => (\n <Fragment key={`path-${index}`}>\n <BreadcrumbSeparator />\n <BreadcrumbItem>\n <BreadcrumbLink\n href=\"#\"\n onClick={() => setPath(path.slice(0, index + 1))}\n >\n {item}\n </BreadcrumbLink>\n </BreadcrumbItem>\n </Fragment>\n ))}\n </BreadcrumbList>\n </Breadcrumb>\n </div>\n );\n };\n\n // Render add property button\n const renderAddPropertyButton = () => {\n const AddPropertyButtonComponent = props.addPropertyButtonComponent;\n\n if (AddPropertyButtonComponent) {\n return (\n <AddPropertyButtonComponent\n onClick={() => setShowPropertyDialog(true)}\n />\n );\n }\n\n return (\n <Button\n type=\"button\"\n className={cn(\"self-center\", props.addPropertyButtonClassName)}\n onClick={() => {\n setShowPropertyDialog(true);\n }}\n >\n <Plus className=\"h-4 w-4 mr-2\" />\n Add Property\n </Button>\n );\n };\n\n return (\n <div>\n {/* Schema validation error */}\n {schemaValidationError && (\n <Alert variant=\"destructive\">\n <AlertTitle>Schema Error</AlertTitle>\n <AlertDescription>{schemaValidationError}</AlertDescription>\n </Alert>\n )}\n\n {/* Navigation bar */}\n {renderNavigation()}\n\n {/* Properties list */}\n <div\n className={cn(\"mt-6 overflow-x-hidden\", props.propertiesListClassName)}\n >\n {Object.entries(currentSchema.properties ?? {}).map(\n ([key, property]) => {\n if (typeof property === \"boolean\") {\n // We don't support editing boolean properties\n return null;\n }\n\n return renderProperty(key, property);\n },\n )}\n </div>\n\n {/* Add property button */}\n {renderAddPropertyButton()}\n\n {/* Add property dialog */}\n <AddPropertyDialog\n open={showPropertyDialog}\n onOpenChange={setShowPropertyDialog}\n onSubmit={onAddProperty}\n />\n\n {/* Edit property dialog */}\n {editingKey && editingProperty && (\n <EditPropertyDialog\n propertyKey={editingKey}\n property={editingProperty}\n open={showEditDialog}\n onOpenChange={setShowEditDialog}\n onSubmit={(params) => {\n handlePropertyChange(...params);\n setEditingKey(undefined);\n setEditingProperty(undefined);\n setShowEditDialog(false);\n }}\n />\n )}\n\n {/* Delete confirmation dialog */}\n <AlertDialog open={showDeleteDialog} onOpenChange={setShowDeleteDialog}>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Are you sure?</AlertDialogTitle>\n <AlertDialogDescription>\n This action cannot be undone. This will permanently delete the\n property\n {deleteKey ? ` \"${deleteKey}\"` : \"\"} from the schema.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel onClick={handleCancelDelete}>\n Cancel\n </AlertDialogCancel>\n <AlertDialogAction onClick={handleConfirmDelete}>\n Delete\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </div>\n );\n};\n"],"names":["SchemaBuilder","props","showPropertyDialog","setShowPropertyDialog","useState","showEditDialog","setShowEditDialog","showDeleteDialog","setShowDeleteDialog","deleteKey","setDeleteKey","editingKey","setEditingKey","editingProperty","setEditingProperty","schemaValidationError","setSchemaValidationError","usePluginSystem","getCurrentSchema","setPath","path","handleAddProperty","handlePropertyChange","handleKeyChange","handleDeleteProperty","setSchema","isPropertyRequired","handleDuplicateProperty","useSchema","getConstraintDefinitionsForType","useConstraints","useEffect","validateSchema","clone","error","Ajv","currentSchema","handleNavigateToProperty","name","handleNavigateUp","handleEditProperty","key","property","handleInitiateDelete","handleConfirmDelete","handleCancelDelete","handleDuplicate","result","onAddProperty","vals","PropertyComponent","renderProperty","jsx","jsxs","DebouncedInput","newVal","Switch","checked","Label","Select","value","SelectTrigger","SelectValue","SelectContent","SelectItem","Button","Trash2","Copy","renderEditButton","renderNavigateButton","renderArrayItemsConfig","items","itemType","newItems","availableConstraints","hasEnum","Bolt","ChevronRight","renderNavigation","NavigationComponent","cn","Breadcrumb","BreadcrumbList","BreadcrumbItem","BreadcrumbLink","item","index","Fragment","BreadcrumbSeparator","renderAddPropertyButton","AddPropertyButtonComponent","Plus","Alert","AlertTitle","AlertDescription","AddPropertyDialog","EditPropertyDialog","params","AlertDialog","AlertDialogContent","AlertDialogHeader","AlertDialogTitle","AlertDialogDescription","AlertDialogFooter","AlertDialogCancel","AlertDialogAction"],"mappings":"2vBAqGaA,GAAiBC,GAA8B,CAE1D,KAAM,CAACC,EAAoBC,CAAqB,EAAIC,EAAAA,SAAS,EAAK,EAC5D,CAACC,EAAgBC,CAAiB,EAAIF,EAAAA,SAAS,EAAK,EACpD,CAACG,EAAkBC,CAAmB,EAAIJ,EAAAA,SAAS,EAAK,EACxD,CAACK,EAAWC,CAAY,EAAIN,WAA6B,EACzD,CAACO,EAAYC,CAAa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MAAS,EAC5BR,EAAkB,EAAK,CAAA,CACzB,CACF,QAID4F,EAAY,YAAA,CAAA,KAAM3F,EAAkB,aAAcC,EACjD,gBAAC2F,EACC,mBAAA,CAAA,SAAA,CAAA9C,OAAC+C,EAAAA,kBACC,CAAA,SAAA,CAAAhD,EAAAA,IAACiD,oBAAiB,SAAa,eAAA,CAAA,SAC9BC,EAAAA,uBAAuB,CAAA,SAAA,CAAA,0EAGrB7F,EAAY,KAAKA,CAAS,IAAM,GAAG,mBAAA,CACtC,CAAA,CAAA,EACF,SACC8F,EAAAA,kBACC,CAAA,SAAA,CAACnD,EAAA,IAAAoD,EAAA,kBAAA,CAAkB,QAAS3D,EAAoB,SAEhD,SAAA,EACCO,EAAA,IAAAqD,EAAA,kBAAA,CAAkB,QAAS7D,EAAqB,SAEjD,QAAA,CAAA,CAAA,CACF,CAAA,CAAA,CAAA,CACF,CACF,CAAA,CAAA,EACF,CAEJ"}
|
package/dist/index.cjs71.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ue=require("react"),l=require("./index.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ue=require("react"),l=require("./index.cjs80.js"),he=require("./index.cjs81.js"),Y=require("./index.cjs56.js"),ge=require("./index.cjs58.js"),T=require("./index.cjs55.js"),me=require("./index.cjs73.js"),I=require("./index.cjs74.js"),we=require("./index.cjs61.js"),u=require("react/jsx-runtime"),xe=require("./index.cjs82.js");function Pe(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const s=Pe(ue);var O="Popper",[X,ye]=ge.createContextScope(O),[Ae,k]=X(O),R=e=>{const{__scopePopper:r,children:t}=e,[o,a]=s.useState(null);return u.jsx(Ae,{scope:r,anchor:o,onAnchorChange:a,children:t})};R.displayName=O;var F="PopperAnchor",_=s.forwardRef((e,r)=>{const{__scopePopper:t,virtualRef:o,...a}=e,n=k(F,t),i=s.useRef(null),m=Y.useComposedRefs(r,i);return s.useEffect(()=>{n.onAnchorChange(o?.current||i.current)}),o?null:u.jsx(T.Primitive.div,{...a,ref:m})});_.displayName=F;var $="PopperContent",[ve,Ce]=X($),j=s.forwardRef((e,r)=>{const{__scopePopper:t,side:o="bottom",sideOffset:a=0,align:n="center",alignOffset:i=0,arrowPadding:m=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:w=0,sticky:h="partial",hideWhenDetached:P=!1,updatePositionStrategy:y="optimized",onPlaced:f,...p}=e,L=k($,t),[S,Z]=s.useState(null),G=Y.useComposedRefs(r,x=>Z(x)),[b,J]=s.useState(null),N=we.useSize(b),K=N?.width??0,q=N?.height??0,Q=o+(n!=="center"?"-"+n:""),V=typeof w=="number"?w:{top:0,right:0,bottom:0,left:0,...w},H=Array.isArray(d)?d:[d],ee=H.length>0,A={padding:V,boundary:H.filter(be),altBoundary:ee},{refs:te,floatingStyles:z,placement:re,isPositioned:v,middlewareData:g}=l.useFloating({strategy:"fixed",placement:Q,whileElementsMounted:(...x)=>xe.autoUpdate(...x,{animationFrame:y==="always"}),elements:{reference:L.anchor},middleware:[l.offset({mainAxis:a+q,alignmentAxis:i}),c&&l.shift({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?l.limitShift():void 0,...A}),c&&l.flip({...A}),l.size({...A,apply:({elements:x,rects:W,availableWidth:de,availableHeight:pe})=>{const{width:le,height:fe}=W.reference,C=x.floating.style;C.setProperty("--radix-popper-available-width",`${de}px`),C.setProperty("--radix-popper-available-height",`${pe}px`),C.setProperty("--radix-popper-anchor-width",`${le}px`),C.setProperty("--radix-popper-anchor-height",`${fe}px`)}}),b&&l.arrow({element:b,padding:m}),Oe({arrowWidth:K,arrowHeight:q}),P&&l.hide({strategy:"referenceHidden",...A})]}),[D,oe]=U(re),M=me.useCallbackRef(f);I.useLayoutEffect(()=>{v&&M?.()},[v,M]);const ne=g.arrow?.x,ie=g.arrow?.y,ae=g.arrow?.centerOffset!==0,[se,ce]=s.useState();return I.useLayoutEffect(()=>{S&&ce(window.getComputedStyle(S).zIndex)},[S]),u.jsx("div",{ref:te.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:v?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:se,"--radix-popper-transform-origin":[g.transformOrigin?.x,g.transformOrigin?.y].join(" "),...g.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(ve,{scope:t,placedSide:D,onArrowChange:J,arrowX:ne,arrowY:ie,shouldHideArrow:ae,children:u.jsx(T.Primitive.div,{"data-side":D,"data-align":oe,...p,ref:G,style:{...p.style,animation:v?void 0:"none"}})})})});j.displayName=$;var B="PopperArrow",Se={top:"bottom",right:"left",bottom:"top",left:"right"},E=s.forwardRef(function(r,t){const{__scopePopper:o,...a}=r,n=Ce(B,o),i=Se[n.placedSide];return u.jsx("span",{ref:n.onArrowChange,style:{position:"absolute",left:n.arrowX,top:n.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[n.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[n.placedSide],visibility:n.shouldHideArrow?"hidden":void 0},children:u.jsx(he.Root,{...a,ref:t,style:{...a.style,display:"block"}})})});E.displayName=B;function be(e){return e!==null}var Oe=e=>({name:"transformOrigin",options:e,fn(r){const{placement:t,rects:o,middlewareData:a}=r,i=a.arrow?.centerOffset!==0,m=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,w]=U(t),h={start:"0%",center:"50%",end:"100%"}[w],P=(a.arrow?.x??0)+m/2,y=(a.arrow?.y??0)+c/2;let f="",p="";return d==="bottom"?(f=i?h:`${P}px`,p=`${-c}px`):d==="top"?(f=i?h:`${P}px`,p=`${o.floating.height+c}px`):d==="right"?(f=`${-c}px`,p=i?h:`${y}px`):d==="left"&&(f=`${o.floating.width+c}px`,p=i?h:`${y}px`),{data:{x:f,y:p}}}});function U(e){const[r,t="center"]=e.split("-");return[r,t]}var Re=R,_e=_,$e=j,je=E;exports.Anchor=_e;exports.Arrow=je;exports.Content=$e;exports.Popper=R;exports.PopperAnchor=_;exports.PopperArrow=E;exports.PopperContent=j;exports.Root=Re;exports.createPopperScope=ye;
|
|
2
2
|
//# sourceMappingURL=index.cjs71.js.map
|
package/dist/index.cjs72.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),l=require("react-dom"),d=require("./index.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),l=require("react-dom"),d=require("./index.cjs55.js"),f=require("./index.cjs74.js"),p=require("react/jsx-runtime");function P(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const a=P(s);var b="Portal",c=a.forwardRef((e,r)=>{const{container:t,...o}=e,[i,u]=a.useState(!1);f.useLayoutEffect(()=>u(!0),[]);const n=t||i&&globalThis?.document?.body;return n?l.createPortal(p.jsx(d.Primitive.div,{...o,ref:r}),n):null});c.displayName=b;exports.Portal=c;
|
|
2
2
|
//# sourceMappingURL=index.cjs72.js.map
|
package/dist/index.cjs75.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),o=require("./index.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),o=require("./index.cjs55.js"),l=require("react/jsx-runtime");function c(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const d=c(a);var s="VisuallyHidden",n=d.forwardRef((e,t)=>l.jsx(o.Primitive.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));n.displayName=s;exports.VisuallyHidden=n;
|
|
2
2
|
//# sourceMappingURL=index.cjs75.js.map
|
package/dist/index.cjs78.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react"),P=require("./index.cjs56.js"),g=require("./index.cjs74.js");function E(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const i=E(T);function R(n,e){return i.useReducer((t,r)=>e[t][r]??t,n)}var O=n=>{const{present:e,children:t}=n,r=v(e),a=typeof t=="function"?t({present:r.isPresent}):i.Children.only(t),u=P.useComposedRefs(r.ref,S(a));return typeof t=="function"||r.isPresent?i.cloneElement(a,{ref:u}):null};O.displayName="Presence";function v(n){const[e,t]=i.useState(),r=i.useRef({}),a=i.useRef(n),u=i.useRef("none"),p=n?"mounted":"unmounted",[N,s]=R(p,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const o=l(r.current);u.current=N==="mounted"?o:"none"},[N]),g.useLayoutEffect(()=>{const o=r.current,d=a.current;if(d!==n){const f=u.current,c=l(o);n?s("MOUNT"):c==="none"||o?.display==="none"?s("UNMOUNT"):s(d&&f!==c?"ANIMATION_OUT":"UNMOUNT"),a.current=n}},[n,s]),g.useLayoutEffect(()=>{if(e){let o;const d=e.ownerDocument.defaultView??window,m=c=>{const A=l(r.current).includes(c.animationName);if(c.target===e&&A&&(s("ANIMATION_END"),!a.current)){const M=e.style.animationFillMode;e.style.animationFillMode="forwards",o=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=M)})}},f=c=>{c.target===e&&(u.current=l(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{d.clearTimeout(o),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else s("ANIMATION_END")},[e,s]),{isPresent:["mounted","unmountSuspended"].includes(N),ref:i.useCallback(o=>{o&&(r.current=getComputedStyle(o)),t(o)},[])}}function l(n){return n?.animationName||"none"}function S(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}exports.Presence=O;
|
|
2
2
|
//# sourceMappingURL=index.cjs78.js.map
|
package/dist/index.cjs78.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs78.js","sources":["../../../node_modules/.pnpm/@radix-ui+react-
|
|
1
|
+
{"version":3,"file":"index.cjs78.js","sources":["../../../node_modules/.pnpm/@radix-ui+react-presence@1.1.2_@types+react-dom@18.3.5_@types+react@18.3.18__@types+rea_f6427c6d64d2d542f3fe67e5d488b7cd/node_modules/@radix-ui/react-presence/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// packages/react/presence/src/Presence.tsx\nimport * as React2 from \"react\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\n\n// packages/react/presence/src/useStateMachine.tsx\nimport * as React from \"react\";\nfunction useStateMachine(initialState, machine) {\n return React.useReducer((state, event) => {\n const nextState = machine[state][event];\n return nextState ?? state;\n }, initialState);\n}\n\n// packages/react/presence/src/Presence.tsx\nvar Presence = (props) => {\n const { present, children } = props;\n const presence = usePresence(present);\n const child = typeof children === \"function\" ? children({ present: presence.isPresent }) : React2.Children.only(children);\n const ref = useComposedRefs(presence.ref, getElementRef(child));\n const forceMount = typeof children === \"function\";\n return forceMount || presence.isPresent ? React2.cloneElement(child, { ref }) : null;\n};\nPresence.displayName = \"Presence\";\nfunction usePresence(present) {\n const [node, setNode] = React2.useState();\n const stylesRef = React2.useRef({});\n const prevPresentRef = React2.useRef(present);\n const prevAnimationNameRef = React2.useRef(\"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 React2.useEffect(() => {\n const currentAnimationName = getAnimationName(stylesRef.current);\n prevAnimationNameRef.current = state === \"mounted\" ? currentAnimationName : \"none\";\n }, [state]);\n useLayoutEffect(() => {\n const styles = stylesRef.current;\n const wasPresent = prevPresentRef.current;\n const hasPresentChanged = wasPresent !== present;\n if (hasPresentChanged) {\n const prevAnimationName = prevAnimationNameRef.current;\n const currentAnimationName = getAnimationName(styles);\n if (present) {\n send(\"MOUNT\");\n } else if (currentAnimationName === \"none\" || styles?.display === \"none\") {\n send(\"UNMOUNT\");\n } else {\n const isAnimating = prevAnimationName !== currentAnimationName;\n if (wasPresent && isAnimating) {\n send(\"ANIMATION_OUT\");\n } else {\n send(\"UNMOUNT\");\n }\n }\n prevPresentRef.current = present;\n }\n }, [present, send]);\n useLayoutEffect(() => {\n if (node) {\n let timeoutId;\n const ownerWindow = node.ownerDocument.defaultView ?? window;\n const handleAnimationEnd = (event) => {\n const currentAnimationName = getAnimationName(stylesRef.current);\n const isCurrentAnimation = currentAnimationName.includes(event.animationName);\n if (event.target === node && isCurrentAnimation) {\n send(\"ANIMATION_END\");\n if (!prevPresentRef.current) {\n const currentFillMode = node.style.animationFillMode;\n node.style.animationFillMode = \"forwards\";\n timeoutId = ownerWindow.setTimeout(() => {\n if (node.style.animationFillMode === \"forwards\") {\n node.style.animationFillMode = currentFillMode;\n }\n });\n }\n }\n };\n const handleAnimationStart = (event) => {\n if (event.target === node) {\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 send(\"ANIMATION_END\");\n }\n }, [node, send]);\n return {\n isPresent: [\"mounted\", \"unmountSuspended\"].includes(state),\n ref: React2.useCallback((node2) => {\n if (node2) stylesRef.current = getComputedStyle(node2);\n setNode(node2);\n }, [])\n };\n}\nfunction getAnimationName(styles) {\n return styles?.animationName || \"none\";\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\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 return element.props.ref || element.ref;\n}\nexport {\n Presence\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["useStateMachine","initialState","machine","React","state","event","Presence","props","present","children","presence","usePresence","child","React2","ref","useComposedRefs","getElementRef","node","setNode","stylesRef","prevPresentRef","prevAnimationNameRef","send","currentAnimationName","getAnimationName","useLayoutEffect","styles","wasPresent","prevAnimationName","timeoutId","ownerWindow","handleAnimationEnd","isCurrentAnimation","currentFillMode","handleAnimationStart","node2","element","getter","mayWarn"],"mappings":"+bASA,SAASA,EAAgBC,EAAcC,EAAS,CAC9C,OAAOC,EAAM,WAAW,CAACC,EAAOC,IACZH,EAAQE,CAAK,EAAEC,CAAK,GAClBD,EACnBH,CAAY,CACjB,CAGG,IAACK,EAAYC,GAAU,CACxB,KAAM,CAAE,QAAAC,EAAS,SAAAC,CAAQ,EAAKF,EACxBG,EAAWC,EAAYH,CAAO,EAC9BI,EAAQ,OAAOH,GAAa,WAAaA,EAAS,CAAE,QAASC,EAAS,SAAW,CAAA,EAAIG,EAAO,SAAS,KAAKJ,CAAQ,EAClHK,EAAMC,EAAAA,gBAAgBL,EAAS,IAAKM,EAAcJ,CAAK,CAAC,EAE9D,OADmB,OAAOH,GAAa,YAClBC,EAAS,UAAYG,EAAO,aAAaD,EAAO,CAAE,IAAAE,CAAK,CAAA,EAAI,IAClF,EACAR,EAAS,YAAc,WACvB,SAASK,EAAYH,EAAS,CAC5B,KAAM,CAACS,EAAMC,CAAO,EAAIL,EAAO,SAAU,EACnCM,EAAYN,EAAO,OAAO,EAAE,EAC5BO,EAAiBP,EAAO,OAAOL,CAAO,EACtCa,EAAuBR,EAAO,OAAO,MAAM,EAC3CZ,EAAeO,EAAU,UAAY,YACrC,CAACJ,EAAOkB,CAAI,EAAItB,EAAgBC,EAAc,CAClD,QAAS,CACP,QAAS,YACT,cAAe,kBAChB,EACD,iBAAkB,CAChB,MAAO,UACP,cAAe,WAChB,EACD,UAAW,CACT,MAAO,SACb,CACA,CAAG,EACDY,OAAAA,EAAO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,EAC/DjB,EAAK,oBAAoB,kBAAmBc,CAAkB,EAC9Dd,EAAK,oBAAoB,eAAgBc,CAAkB,CAC5D,CACP,MACMT,EAAK,eAAe,CAE1B,EAAK,CAACL,EAAMK,CAAI,CAAC,EACR,CACL,UAAW,CAAC,UAAW,kBAAkB,EAAE,SAASlB,CAAK,EACzD,IAAKS,EAAO,YAAasB,GAAU,CAC7BA,IAAOhB,EAAU,QAAU,iBAAiBgB,CAAK,GACrDjB,EAAQiB,CAAK,CACnB,EAAO,CAAE,CAAA,CACN,CACH,CACA,SAASX,EAAiBE,EAAQ,CAChC,OAAOA,GAAQ,eAAiB,MAClC,CACA,SAASV,EAAcoB,EAAS,CAC9B,IAAIC,EAAS,OAAO,yBAAyBD,EAAQ,MAAO,KAAK,GAAG,IAChEE,EAAUD,GAAU,mBAAoBA,GAAUA,EAAO,eAC7D,OAAIC,EACKF,EAAQ,KAEjBC,EAAS,OAAO,yBAAyBD,EAAS,KAAK,GAAG,IAC1DE,EAAUD,GAAU,mBAAoBA,GAAUA,EAAO,eACrDC,EACKF,EAAQ,MAAM,IAEhBA,EAAQ,MAAM,KAAOA,EAAQ,IACtC","x_google_ignoreList":[0]}
|
package/dist/index.cjs79.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),a=require("./index.cjs73.js");function s(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const u=s(o);function i(e,t=globalThis?.document){const n=a.useCallbackRef(e);u.useEffect(()=>{const r=c=>{c.key==="Escape"&&n(c)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}exports.useEscapeKeydown=i;
|
|
2
2
|
//# sourceMappingURL=index.cjs79.js.map
|
package/dist/index.cjs79.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs79.js","sources":["../../../node_modules/.pnpm/@floating-ui+react-dom@2.1.2_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs"],"sourcesContent":["import { computePosition, arrow as arrow$2, offset as offset$1, shift as shift$1, limitShift as limitShift$1, flip as flip$1, size as size$1, autoPlacement as autoPlacement$1, hide as hide$1, inline as inline$1 } from '@floating-ui/dom';\nexport { autoUpdate, computePosition, detectOverflow, getOverflowAncestors, platform } from '@floating-ui/dom';\nimport * as React from 'react';\nimport { useLayoutEffect, useEffect } from 'react';\nimport * as ReactDOM from 'react-dom';\n\nvar index = typeof document !== 'undefined' ? useLayoutEffect : useEffect;\n\n// Fork of `fast-deep-equal` that only does the comparisons we need and compares\n// functions\nfunction deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n if (typeof a !== typeof b) {\n return false;\n }\n if (typeof a === 'function' && a.toString() === b.toString()) {\n return true;\n }\n let length;\n let i;\n let keys;\n if (a && b && typeof a === 'object') {\n if (Array.isArray(a)) {\n length = a.length;\n if (length !== b.length) return false;\n for (i = length; i-- !== 0;) {\n if (!deepEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) {\n return false;\n }\n for (i = length; i-- !== 0;) {\n if (!{}.hasOwnProperty.call(b, keys[i])) {\n return false;\n }\n }\n for (i = length; i-- !== 0;) {\n const key = keys[i];\n if (key === '_owner' && a.$$typeof) {\n continue;\n }\n if (!deepEqual(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n return a !== a && b !== b;\n}\n\nfunction getDPR(element) {\n if (typeof window === 'undefined') {\n return 1;\n }\n const win = element.ownerDocument.defaultView || window;\n return win.devicePixelRatio || 1;\n}\n\nfunction roundByDPR(element, value) {\n const dpr = getDPR(element);\n return Math.round(value * dpr) / dpr;\n}\n\nfunction useLatestRef(value) {\n const ref = React.useRef(value);\n index(() => {\n ref.current = value;\n });\n return ref;\n}\n\n/**\n * Provides data to position a floating element.\n * @see https://floating-ui.com/docs/useFloating\n */\nfunction useFloating(options) {\n if (options === void 0) {\n options = {};\n }\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform,\n elements: {\n reference: externalReference,\n floating: externalFloating\n } = {},\n transform = true,\n whileElementsMounted,\n open\n } = options;\n const [data, setData] = React.useState({\n x: 0,\n y: 0,\n strategy,\n placement,\n middlewareData: {},\n isPositioned: false\n });\n const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);\n if (!deepEqual(latestMiddleware, middleware)) {\n setLatestMiddleware(middleware);\n }\n const [_reference, _setReference] = React.useState(null);\n const [_floating, _setFloating] = React.useState(null);\n const setReference = React.useCallback(node => {\n if (node !== referenceRef.current) {\n referenceRef.current = node;\n _setReference(node);\n }\n }, []);\n const setFloating = React.useCallback(node => {\n if (node !== floatingRef.current) {\n floatingRef.current = node;\n _setFloating(node);\n }\n }, []);\n const referenceEl = externalReference || _reference;\n const floatingEl = externalFloating || _floating;\n const referenceRef = React.useRef(null);\n const floatingRef = React.useRef(null);\n const dataRef = React.useRef(data);\n const hasWhileElementsMounted = whileElementsMounted != null;\n const whileElementsMountedRef = useLatestRef(whileElementsMounted);\n const platformRef = useLatestRef(platform);\n const openRef = useLatestRef(open);\n const update = React.useCallback(() => {\n if (!referenceRef.current || !floatingRef.current) {\n return;\n }\n const config = {\n placement,\n strategy,\n middleware: latestMiddleware\n };\n if (platformRef.current) {\n config.platform = platformRef.current;\n }\n computePosition(referenceRef.current, floatingRef.current, config).then(data => {\n const fullData = {\n ...data,\n // The floating element's position may be recomputed while it's closed\n // but still mounted (such as when transitioning out). To ensure\n // `isPositioned` will be `false` initially on the next open, avoid\n // setting it to `true` when `open === false` (must be specified).\n isPositioned: openRef.current !== false\n };\n if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {\n dataRef.current = fullData;\n ReactDOM.flushSync(() => {\n setData(fullData);\n });\n }\n });\n }, [latestMiddleware, placement, strategy, platformRef, openRef]);\n index(() => {\n if (open === false && dataRef.current.isPositioned) {\n dataRef.current.isPositioned = false;\n setData(data => ({\n ...data,\n isPositioned: false\n }));\n }\n }, [open]);\n const isMountedRef = React.useRef(false);\n index(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n };\n }, []);\n index(() => {\n if (referenceEl) referenceRef.current = referenceEl;\n if (floatingEl) floatingRef.current = floatingEl;\n if (referenceEl && floatingEl) {\n if (whileElementsMountedRef.current) {\n return whileElementsMountedRef.current(referenceEl, floatingEl, update);\n }\n update();\n }\n }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);\n const refs = React.useMemo(() => ({\n reference: referenceRef,\n floating: floatingRef,\n setReference,\n setFloating\n }), [setReference, setFloating]);\n const elements = React.useMemo(() => ({\n reference: referenceEl,\n floating: floatingEl\n }), [referenceEl, floatingEl]);\n const floatingStyles = React.useMemo(() => {\n const initialStyles = {\n position: strategy,\n left: 0,\n top: 0\n };\n if (!elements.floating) {\n return initialStyles;\n }\n const x = roundByDPR(elements.floating, data.x);\n const y = roundByDPR(elements.floating, data.y);\n if (transform) {\n return {\n ...initialStyles,\n transform: \"translate(\" + x + \"px, \" + y + \"px)\",\n ...(getDPR(elements.floating) >= 1.5 && {\n willChange: 'transform'\n })\n };\n }\n return {\n position: strategy,\n left: x,\n top: y\n };\n }, [strategy, transform, elements.floating, data.x, data.y]);\n return React.useMemo(() => ({\n ...data,\n update,\n refs,\n elements,\n floatingStyles\n }), [data, update, refs, elements, floatingStyles]);\n}\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow$1 = options => {\n function isRef(value) {\n return {}.hasOwnProperty.call(value, 'current');\n }\n return {\n name: 'arrow',\n options,\n fn(state) {\n const {\n element,\n padding\n } = typeof options === 'function' ? options(state) : options;\n if (element && isRef(element)) {\n if (element.current != null) {\n return arrow$2({\n element: element.current,\n padding\n }).fn(state);\n }\n return {};\n }\n if (element) {\n return arrow$2({\n element,\n padding\n }).fn(state);\n }\n return {};\n }\n };\n};\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = (options, deps) => ({\n ...offset$1(options),\n options: [options, deps]\n});\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = (options, deps) => ({\n ...shift$1(options),\n options: [options, deps]\n});\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = (options, deps) => ({\n ...limitShift$1(options),\n options: [options, deps]\n});\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = (options, deps) => ({\n ...flip$1(options),\n options: [options, deps]\n});\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = (options, deps) => ({\n ...size$1(options),\n options: [options, deps]\n});\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = (options, deps) => ({\n ...autoPlacement$1(options),\n options: [options, deps]\n});\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = (options, deps) => ({\n ...hide$1(options),\n options: [options, deps]\n});\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = (options, deps) => ({\n ...inline$1(options),\n options: [options, deps]\n});\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = (options, deps) => ({\n ...arrow$1(options),\n options: [options, deps]\n});\n\nexport { arrow, autoPlacement, flip, hide, inline, limitShift, offset, shift, size, useFloating };\n"],"names":["index","useLayoutEffect","useEffect","deepEqual","a","b","length","i","keys","key","getDPR","element","roundByDPR","value","dpr","useLatestRef","ref","React","useFloating","options","placement","strategy","middleware","platform","externalReference","externalFloating","transform","whileElementsMounted","open","data","setData","latestMiddleware","setLatestMiddleware","_reference","_setReference","_floating","_setFloating","setReference","node","referenceRef","setFloating","floatingRef","referenceEl","floatingEl","dataRef","hasWhileElementsMounted","whileElementsMountedRef","platformRef","openRef","update","config","computePosition","fullData","isMountedRef","ReactDOM","refs","elements","floatingStyles","initialStyles","x","y","arrow$1","isRef","state","padding","arrow$2","offset","deps","offset$1","shift","shift$1","limitShift","limitShift$1","flip","flip$1","size","size$1","hide","hide$1","arrow"],"mappings":"+bAMA,IAAIA,EAAQ,OAAO,SAAa,IAAcC,EAAe,gBAAGC,EAAS,UAIzE,SAASC,EAAUC,EAAGC,EAAG,CACvB,GAAID,IAAMC,EACR,MAAO,GAET,GAAI,OAAOD,GAAM,OAAOC,EACtB,MAAO,GAET,GAAI,OAAOD,GAAM,YAAcA,EAAE,aAAeC,EAAE,WAChD,MAAO,GAET,IAAIC,EACAC,EACAC,EACJ,GAAIJ,GAAKC,GAAK,OAAOD,GAAM,SAAU,CACnC,GAAI,MAAM,QAAQA,CAAC,EAAG,CAEpB,GADAE,EAASF,EAAE,OACPE,IAAWD,EA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AAU,CAC/B,GAAGO,EAAAA,KAAOvD,CAAO,EACjB,QAAS,CAACA,EAASgD,CAAI,CACzB,GAQMQ,GAAO,CAACxD,EAASgD,KAAU,CAC/B,GAAGS,EAAAA,KAAOzD,CAAO,EACjB,QAAS,CAACA,EAASgD,CAAI,CACzB,GAkBMU,GAAO,CAAC1D,EAASgD,KAAU,CAC/B,GAAGW,EAAAA,KAAO3D,CAAO,EACjB,QAAS,CAACA,EAASgD,CAAI,CACzB,GAkBMY,GAAQ,CAAC5D,EAASgD,KAAU,CAChC,GAAGN,EAAQ1C,CAAO,EAClB,QAAS,CAACA,EAASgD,CAAI,CACzB","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.cjs79.js","sources":["../../../node_modules/.pnpm/@radix-ui+react-use-escape-keydown@1.1.0_@types+react@18.3.18_react@18.3.1/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs"],"sourcesContent":["// packages/react/use-escape-keydown/src/useEscapeKeydown.tsx\nimport * as React from \"react\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nfunction useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {\n const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);\n React.useEffect(() => {\n const handleKeyDown = (event) => {\n if (event.key === \"Escape\") {\n onEscapeKeyDown(event);\n }\n };\n ownerDocument.addEventListener(\"keydown\", handleKeyDown, { capture: true });\n return () => ownerDocument.removeEventListener(\"keydown\", handleKeyDown, { capture: true });\n }, [onEscapeKeyDown, ownerDocument]);\n}\nexport {\n useEscapeKeydown\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["useEscapeKeydown","onEscapeKeyDownProp","ownerDocument","onEscapeKeyDown","useCallbackRef","React","handleKeyDown","event"],"mappings":"iaAGA,SAASA,EAAiBC,EAAqBC,EAAgB,YAAY,SAAU,CACnF,MAAMC,EAAkBC,EAAc,eAACH,CAAmB,EAC1DI,EAAM,UAAU,IAAM,CACpB,MAAMC,EAAiBC,GAAU,CAC3BA,EAAM,MAAQ,UAChBJ,EAAgBI,CAAK,CAExB,EACD,OAAAL,EAAc,iBAAiB,UAAWI,EAAe,CAAE,QAAS,GAAM,EACnE,IAAMJ,EAAc,oBAAoB,UAAWI,EAAe,CAAE,QAAS,GAAM,CAC9F,EAAK,CAACH,EAAiBD,CAAa,CAAC,CACrC","x_google_ignoreList":[0]}
|
package/dist/index.cjs8.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),o=require("react"),C=require("./index.cjs23.js"),d=o.createContext(void 0),P=({children:t})=>{const s=o.useRef(new Map),i=o.useRef(new Map);return v.jsx(d.Provider,{value:{constraintDefinitionsMap:s.current,constraintRenderersMap:i.current},children:t})};function h(t){const s=o.useContext(d);if(!s)throw new Error("usePluginSystem must be used within a PluginsProvider");const{constraintDefinitionsMap:i,constraintRenderersMap:c}=s;return o.useMemo(()=>(t.forEach(e=>{if(e.hooks.registerConstraints&&e.hooks.registerConstraints().forEach(a=>{i.set(a.name,a)}),e.hooks.registerRenderers){const r=e.hooks.registerRenderers();Object.entries(r).forEach(([a,n])=>{c.set(a,n)})}}),{hasPlugin(e){return t.some(r=>r.id===e)},getPlugin(e){return t.find(r=>r.id===e)}}),[t])}const R=()=>{const t=o.useContext(d);if(!t)throw new Error("useConstraints must be used within a ConstraintsProvider");const{constraintDefinitionsMap:s,constraintRenderersMap:i}=t,c=()=>Array.from(s.values()),f=n=>c().filter(u=>u.appliesTo.includes(n)),e=n=>s.get(n);return{getConstraintDefinitionsForType:f,getAllDefinitions:c,getRendererForConstraint:n=>i.get(n),getConstraintDefinition:e,validateConstraintValue:(n,l)=>{const u=e(n);if(u){const m=u.schema,g=C.ajv.compile(m);return g(l)?{status:"success"}:{status:"error",code:"invalid",message:"Invalid value",error:g.errors}}return{status:"error",code:"constraint-def-missing",message:"Constraint not found"}}}};exports.PluginsProvider=P;exports.useConstraints=R;exports.usePluginSystem=h;
|
|
2
2
|
//# sourceMappingURL=index.cjs8.js.map
|
package/dist/index.cjs8.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs8.js","sources":["../src/packages/plugins/string.tsx"],"sourcesContent":["import { Input } from \"@/components/ui/input\";\nimport { InputErrorWrapper } from \"@/components/input-error\";\nimport { Label } from \"@/components/ui/label\";\nimport { cn } from \"@/lib/utils\";\nimport {\n BaseJSONSchemaPlugin,\n ConstraintRendererProps,\n useConstraints,\n} from \"@/packages/constraints/context\";\nimport { Button } from \"@/components/ui/button\";\nimport { X } from \"lucide-react\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/components/ui/select\";\n\n// Generic string constraint renderer for number-based constraints (minLength, maxLength)\nconst StringNumberConstraintRenderer = ({\n constraintName,\n value,\n onConstraintChange,\n disabled,\n error,\n onRemoveConstraint,\n}: ConstraintRendererProps<number> & { disabled?: boolean }) => {\n const { getConstraintDefinition } = useConstraints();\n const constraintDef = getConstraintDefinition(constraintName);\n\n if (!constraintDef) {\n return null;\n }\n\n return (\n <InputErrorWrapper\n errorCode={error?.code}\n errorDescription={error?.message}\n showError={!!error}\n >\n <div>\n <Label className=\"mb-2\" htmlFor={constraintDef.name}>\n {constraintDef.name}\n </Label>\n <div className=\"flex items-center gap-2\">\n <Input\n id={constraintDef.name}\n type=\"number\"\n value={value}\n onChange={(e) => onConstraintChange(Number(e.target.value))}\n disabled={disabled}\n min={0}\n className={cn({ \"border-destructive\": error })}\n />\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => onRemoveConstraint()}\n >\n <X className=\"size-4\" />\n </Button>\n </div>\n {constraintDef.description && (\n <div className=\"mt-2 text-sm text-gray-500\">\n {constraintDef.description}\n </div>\n )}\n </div>\n </InputErrorWrapper>\n );\n};\n\n// Pattern constraint renderer for regex input\nconst PatternConstraintRenderer = ({\n constraintName,\n value,\n onConstraintChange,\n disabled,\n error,\n onRemoveConstraint,\n}: ConstraintRendererProps<string> & { disabled?: boolean }) => {\n const { getConstraintDefinition } = useConstraints();\n const constraintDef = getConstraintDefinition(constraintName);\n\n if (!constraintDef) {\n return null;\n }\n\n return (\n <InputErrorWrapper\n errorCode={error?.code}\n errorDescription={error?.message}\n showError={!!error}\n >\n <div>\n <Label className=\"mb-2\" htmlFor={constraintDef.name}>\n {constraintDef.name}\n </Label>\n <div className=\"flex items-center gap-2\">\n <Input\n id={constraintDef.name}\n type=\"text\"\n value={value}\n onChange={(e) => onConstraintChange(e.target.value)}\n disabled={disabled}\n placeholder=\"Regular expression pattern\"\n className={cn({ \"border-destructive\": error })}\n />\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => onRemoveConstraint()}\n >\n <X className=\"size-4\" />\n </Button>\n </div>\n {constraintDef.description && (\n <div className=\"mt-2 text-sm text-gray-500\">\n {constraintDef.description}\n </div>\n )}\n </div>\n </InputErrorWrapper>\n );\n};\n\n// Format constraint renderer with predefined format options\nconst FormatConstraintRenderer = ({\n constraintName,\n value,\n onConstraintChange,\n disabled,\n error,\n onRemoveConstraint,\n}: ConstraintRendererProps<string> & { disabled?: boolean }) => {\n const { getConstraintDefinition } = useConstraints();\n const constraintDef = getConstraintDefinition(constraintName);\n\n const formatOptions = [\n { value: \"email\", label: \"Email\" },\n { value: \"uri\", label: \"URI\" },\n { value: \"url\", label: \"URL\" },\n { value: \"date\", label: \"Date\" },\n { value: \"date-time\", label: \"Date-Time\" },\n { value: \"uuid\", label: \"UUID\" },\n { value: \"hostname\", label: \"Hostname\" },\n { value: \"ipv4\", label: \"IPv4\" },\n { value: \"ipv6\", label: \"IPv6\" },\n { value: \"phone\", label: \"Phone\" },\n ];\n\n if (!constraintDef) {\n return null;\n }\n\n return (\n <InputErrorWrapper\n errorCode={error?.code}\n errorDescription={error?.message}\n showError={!!error}\n >\n <div>\n <Label className=\"mb-2\" htmlFor={constraintDef.name}>\n {constraintDef.name}\n </Label>\n <div className=\"flex items-center gap-2\">\n <Select\n value={value}\n onValueChange={(newValue) => onConstraintChange(newValue)}\n disabled={disabled}\n >\n <SelectTrigger\n id={constraintDef.name}\n className={cn(\"flex-1\", { \"border-destructive\": error })}\n >\n <SelectValue placeholder=\"Select format\" />\n </SelectTrigger>\n <SelectContent>\n {formatOptions.map((option) => (\n <SelectItem key={option.value} value={option.value}>\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => onRemoveConstraint()}\n >\n <X className=\"size-4\" />\n </Button>\n </div>\n {constraintDef.description && (\n <div className=\"mt-2 text-sm text-gray-500\">\n {constraintDef.description}\n </div>\n )}\n </div>\n </InputErrorWrapper>\n );\n};\n\n// Export the renderers\nexport const StringMinLengthRenderer = StringNumberConstraintRenderer;\nexport const StringMaxLengthRenderer = StringNumberConstraintRenderer;\nexport const StringPatternRenderer = PatternConstraintRenderer;\nexport const StringFormatRenderer = FormatConstraintRenderer;\n\nconst plugin: BaseJSONSchemaPlugin = {\n id: \"string-constraints\",\n hooks: {\n registerConstraints() {\n return [\n {\n name: \"minLength\",\n label: \"Min Length\",\n appliesTo: [\"string\"],\n schema: {\n type: \"integer\",\n title: \"Minimum Length Constraint\",\n description: \"The minimum length of the string\",\n examples: [1, 5, 10],\n minimum: 0,\n },\n description: \"Constrains a string to a minimum length\",\n defaultValue: 0,\n },\n {\n name: \"maxLength\",\n label: \"Max Length\",\n appliesTo: [\"string\"],\n schema: {\n type: \"integer\",\n title: \"Maximum Length Constraint\",\n description: \"The maximum length of the string\",\n examples: [50, 100, 255],\n minimum: 0,\n },\n description: \"Constrains a string to a maximum length\",\n defaultValue: 100,\n },\n {\n name: \"pattern\",\n label: \"Pattern\",\n appliesTo: [\"string\"],\n schema: {\n type: \"string\",\n title: \"Pattern Constraint\",\n description: \"Regular expression pattern the string must match\",\n examples: [\"^[a-zA-Z0-9]+$\", \"\\\\d{3}-\\\\d{2}-\\\\d{4}\"],\n },\n description: \"Regular expression that the string must match\",\n defaultValue: \"\",\n },\n {\n name: \"format\",\n label: \"Format\",\n appliesTo: [\"string\"],\n schema: {\n type: \"string\",\n title: \"Format Constraint\",\n description: \"Predefined format the string must follow\",\n enum: [\n \"email\",\n \"uri\",\n \"url\",\n \"date\",\n \"date-time\",\n \"uuid\",\n \"hostname\",\n \"ipv4\",\n \"ipv6\",\n \"phone\",\n ],\n },\n description: \"Predefined format validation for the string\",\n defaultValue: \"email\",\n },\n ];\n },\n registerRenderers() {\n return {\n minLength: StringMinLengthRenderer,\n maxLength: StringMaxLengthRenderer,\n pattern: StringPatternRenderer,\n format: StringFormatRenderer,\n };\n },\n },\n};\n\nexport default plugin;\n"],"names":["StringNumberConstraintRenderer","constraintName","value","onConstraintChange","disabled","error","onRemoveConstraint","getConstraintDefinition","useConstraints","constraintDef","jsx","InputErrorWrapper","Label","jsxs","Input","e","cn","Button","X","PatternConstraintRenderer","FormatConstraintRenderer","formatOptions","Select","newValue","SelectTrigger","SelectValue","SelectContent","option","SelectItem","StringMinLengthRenderer","StringMaxLengthRenderer","StringPatternRenderer","StringFormatRenderer"],"mappings":"oWAoBMA,EAAiC,CAAC,CACtC,eAAAC,EACA,MAAAC,EACA,mBAAAC,EACA,SAAAC,EACA,MAAAC,EACA,mBAAAC,CACF,IAAgE,CACxD,KAAA,CAAE,wBAAAC,CAAwB,EAAIC,iBAAe,EAC7CC,EAAgBF,EAAwBN,CAAc,EAE5D,OAAKQ,EAKHC,EAAA,IAACC,EAAA,kBAAA,CACC,UAAWN,GAAO,KAClB,iBAAkBA,GAAO,QACzB,UAAW,CAAC,CAACA,EAEb,gBAAC,MACC,CAAA,SAAA,CAAAK,EAAAA,IAACE,SAAM,UAAU,OAAO,QAASH,EAAc,KAC5C,WAAc,IACjB,CAAA,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B,EAEA,SAAA,CAAAM,EAAA,IAACc,EAAA,cAAA,CACC,GAAIf,EAAc,KAClB,UAAWO,EAAAA,GAAG,SAAU,CAAE,qBAAsBX,EAAO,EAEvD,SAAAK,EAAAA,IAACe,EAAAA,YAAY,CAAA,YAAY,eAAgB,CAAA,CAAA,CAC3C,QACCC,EAAAA,cACE,CAAA,SAAAL,EAAc,IAAKM,GACjBjB,EAAAA,IAAAkB,EAAA,WAAA,CAA8B,MAAOD,EAAO,MAC1C,SAAOA,EAAA,OADOA,EAAO,KAExB,CACD,CACH,CAAA,CAAA,CAAA,CACF,EACAjB,EAAA,IAACO,EAAA,OAAA,CACC,KAAK,SACL,QAAQ,QACR,KAAK,OACL,QAAS,IAAMX,EAAmB,EAElC,SAAAI,EAAAA,IAACQ,EAAAA,QAAE,CAAA,UAAU,QAAS,CAAA,CAAA,CAAA,CACxB,EACF,EACCT,EAAc,aACbC,EAAA,IAAC,OAAI,UAAU,6BACZ,WAAc,WACjB,CAAA,CAAA,CAEJ,CAAA,CAAA,CACF,EAhDO,IAkDX,EAGamB,EAA0B7B,EAC1B8B,EAA0B9B,EAC1B+B,EAAwBZ,EACxBa,EAAuBZ"}
|
|
1
|
+
{"version":3,"file":"index.cjs8.js","sources":["../src/packages/constraints/context.tsx"],"sourcesContent":["import { createContext, useContext, useMemo, useRef } from \"react\";\nimport type { PropsWithChildren, ComponentType } from \"react\";\n\nimport type { JSONSchema7 } from \"json-schema\";\nimport { ajv } from \"@/packages/builder/utils\";\nimport type { OperationError } from \"../builder/shared-types\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ConstraintRendererProps<T = any> {\n value: T;\n onConstraintChange: (newValue: T) => void;\n onRemoveConstraint: () => void;\n constraintName: string;\n // Is this constraint disabled/readonly\n disabled?: boolean;\n error?: OperationError;\n}\n\nexport interface ConstraintDefinition {\n /**\n * The unique identifier for the constraint\n */\n name: keyof JSONSchema7;\n label: string;\n /**\n * Types this constraint applies to.\n */\n appliesTo: string[];\n /**\n * Apply JSON schema principles to the constraint.\n */\n schema: JSONSchema7;\n description?: string;\n defaultValue: unknown;\n}\n\nexport interface Constraint {\n name: ConstraintDefinition[\"name\"];\n value: unknown;\n}\n\nexport interface BaseJSONSchemaPlugin {\n id: string;\n hooks: {\n registerConstraints?: () => ConstraintDefinition[];\n registerRenderers?: () => Record<\n string,\n ComponentType<ConstraintRendererProps>\n >;\n };\n}\n\ninterface ContextState {\n constraintDefinitionsMap: Map<string, ConstraintDefinition>;\n constraintRenderersMap: Map<string, ComponentType<ConstraintRendererProps>>;\n}\n\nconst PluginsContext = createContext<ContextState | undefined>(undefined);\n\nexport const PluginsProvider = ({ children }: PropsWithChildren) => {\n // Store references. If you need to trigger a re-render,\n //use the methods in usePluginSystem hook instead\n const constraintDefinitionsRef = useRef<Map<string, ConstraintDefinition>>(\n new Map(),\n );\n const constraintRenderersRef = useRef<\n Map<string, ComponentType<ConstraintRendererProps>>\n >(new Map());\n\n return (\n <PluginsContext.Provider\n value={{\n constraintDefinitionsMap: constraintDefinitionsRef.current,\n constraintRenderersMap: constraintRenderersRef.current,\n }}\n >\n {children}\n </PluginsContext.Provider>\n );\n};\n\n// The main plugin system hook\nexport function usePluginSystem<TPlugin extends BaseJSONSchemaPlugin>(\n plugins: TPlugin[],\n) {\n const context = useContext(PluginsContext);\n if (!context) {\n throw new Error(\"usePluginSystem must be used within a PluginsProvider\");\n }\n\n const { constraintDefinitionsMap, constraintRenderersMap } = context;\n\n const memoizedPluginValues = useMemo(() => {\n // Register all plugins\n plugins.forEach((plugin) => {\n // Register constraints\n if (plugin.hooks.registerConstraints) {\n const constraints = plugin.hooks.registerConstraints();\n constraints.forEach((constraint) => {\n constraintDefinitionsMap.set(constraint.name, constraint);\n });\n }\n\n // Register renderers\n if (plugin.hooks.registerRenderers) {\n const renderers = plugin.hooks.registerRenderers();\n Object.entries(renderers).forEach(([name, component]) => {\n constraintRenderersMap.set(name, component);\n });\n }\n });\n\n return {\n // Check if a plugin with given ID exists\n hasPlugin(id: string): boolean {\n return plugins.some((plugin) => plugin.id === id);\n },\n\n // Get a plugin by ID\n getPlugin(id: string): BaseJSONSchemaPlugin | undefined {\n return plugins.find((plugin) => plugin.id === id);\n },\n };\n }, [plugins]);\n\n return memoizedPluginValues;\n}\n\nexport const useConstraints = () => {\n const context = useContext(PluginsContext);\n if (!context) {\n throw new Error(\"useConstraints must be used within a ConstraintsProvider\");\n }\n\n const { constraintDefinitionsMap, constraintRenderersMap } = context;\n\n const getAllDefinitions = (): ConstraintDefinition[] => {\n return Array.from(constraintDefinitionsMap.values());\n };\n\n const getConstraintDefinitionsForType = (\n type: string,\n ): ConstraintDefinition[] => {\n const definitions = getAllDefinitions();\n return definitions.filter((definition) =>\n definition.appliesTo.includes(type),\n );\n };\n\n const getConstraintDefinition = (constraintName: string) => {\n return constraintDefinitionsMap.get(constraintName);\n };\n\n const getRendererForConstraint = (constraintName: string) => {\n return constraintRenderersMap.get(constraintName);\n };\n\n const validateConstraintValue = (constraintName: string, value: unknown) => {\n const constraintDefinition = getConstraintDefinition(constraintName);\n\n if (constraintDefinition) {\n const schema = constraintDefinition.schema;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const validate = ajv.compile<any>(schema);\n const valid = validate(value);\n\n if (valid) {\n return { status: \"success\" as const };\n }\n\n const obj = {\n status: \"error\" as const,\n code: \"invalid\" as const,\n message: \"Invalid value\",\n error: validate.errors,\n };\n\n return obj satisfies OperationError;\n }\n\n const obj = {\n status: \"error\" as const,\n code: \"constraint-def-missing\" as const,\n message: \"Constraint not found\",\n };\n\n return obj satisfies OperationError;\n };\n\n return {\n getConstraintDefinitionsForType,\n getAllDefinitions,\n getRendererForConstraint,\n getConstraintDefinition,\n validateConstraintValue,\n };\n};\n"],"names":["PluginsContext","createContext","PluginsProvider","children","constraintDefinitionsRef","useRef","constraintRenderersRef","jsx","usePluginSystem","plugins","context","useContext","constraintDefinitionsMap","constraintRenderersMap","useMemo","plugin","constraint","renderers","name","component","id","useConstraints","getAllDefinitions","getConstraintDefinitionsForType","type","definition","getConstraintDefinition","constraintName","value","constraintDefinition","schema","validate","ajv"],"mappings":"sKAyDMA,EAAiBC,gBAAwC,MAAS,EAE3DC,EAAkB,CAAC,CAAE,SAAAC,KAAkC,CAGlE,MAAMC,EAA2BC,EAAA,WAC3B,GACN,EACMC,EAAyBD,EAAAA,OAEzB,IAAA,GAAK,EAGT,OAAAE,EAAA,IAACP,EAAe,SAAf,CACC,MAAO,CACL,yBAA0BI,EAAyB,QACnD,uBAAwBE,EAAuB,OACjD,EAEC,SAAAH,CAAA,CACH,CAEJ,EAGO,SAASK,EACdC,EACA,CACM,MAAAC,EAAUC,aAAWX,CAAc,EACzC,GAAI,CAACU,EACG,MAAA,IAAI,MAAM,uDAAuD,EAGnE,KAAA,CAAE,yBAAAE,EAA0B,uBAAAC,CAAA,EAA2BH,EAmCtD,OAjCsBI,EAAAA,QAAQ,KAE3BL,EAAA,QAASM,GAAW,CAUtB,GARAA,EAAO,MAAM,qBACKA,EAAO,MAAM,oBAAoB,EACzC,QAASC,GAAe,CACTJ,EAAA,IAAII,EAAW,KAAMA,CAAU,CAAA,CACzD,EAICD,EAAO,MAAM,kBAAmB,CAC5B,MAAAE,EAAYF,EAAO,MAAM,kBAAkB,EAC1C,OAAA,QAAQE,CAAS,EAAE,QAAQ,CAAC,CAACC,EAAMC,CAAS,IAAM,CAChCN,EAAA,IAAIK,EAAMC,CAAS,CAAA,CAC3C,CAAA,CACH,CACD,EAEM,CAEL,UAAUC,EAAqB,CAC7B,OAAOX,EAAQ,KAAMM,GAAWA,EAAO,KAAOK,CAAE,CAClD,EAGA,UAAUA,EAA8C,CACtD,OAAOX,EAAQ,KAAMM,GAAWA,EAAO,KAAOK,CAAE,CAAA,CAEpD,GACC,CAACX,CAAO,CAAC,CAGd,CAEO,MAAMY,EAAiB,IAAM,CAC5B,MAAAX,EAAUC,aAAWX,CAAc,EACzC,GAAI,CAACU,EACG,MAAA,IAAI,MAAM,0DAA0D,EAGtE,KAAA,CAAE,yBAAAE,EAA0B,uBAAAC,CAAA,EAA2BH,EAEvDY,EAAoB,IACjB,MAAM,KAAKV,EAAyB,OAAA,CAAQ,EAG/CW,EACJC,GAEoBF,EAAkB,EACnB,OAAQG,GACzBA,EAAW,UAAU,SAASD,CAAI,CACpC,EAGIE,EAA2BC,GACxBf,EAAyB,IAAIe,CAAc,EAuC7C,MAAA,CACL,gCAAAJ,EACA,kBAAAD,EACA,yBAvCgCK,GACzBd,EAAuB,IAAIc,CAAc,EAuChD,wBAAAD,EACA,wBArC8B,CAACC,EAAwBC,IAAmB,CACpE,MAAAC,EAAuBH,EAAwBC,CAAc,EAEnE,GAAIE,EAAsB,CACxB,MAAMC,EAASD,EAAqB,OAE9BE,EAAWC,EAAAA,IAAI,QAAaF,CAAM,EAGxC,OAFcC,EAASH,CAAK,EAGnB,CAAE,OAAQ,SAAmB,EAG1B,CACV,OAAQ,QACR,KAAM,UACN,QAAS,gBACT,MAAOG,EAAS,MAClB,CAEO,CASF,MANK,CACV,OAAQ,QACR,KAAM,yBACN,QAAS,sBACX,CAGF,CAQA,CACF"}
|
package/dist/index.cjs80.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index.cjs82.js"),j=require("react"),H=require("react-dom");function U(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const o=U(j),I=U(H);var R=typeof document<"u"?j.useLayoutEffect:j.useEffect;function P(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!P(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const g=s[r];if(!(g==="_owner"&&e.$$typeof)&&!P(e[g],t[g]))return!1}return!0}return e!==e&&t!==t}function $(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function L(e,t){const n=$(e);return Math.round(t*n)/n}function D(e){const t=o.useRef(e);return R(()=>{t.current=e}),t}function J(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:g,floating:A}={},transform:k=!0,whileElementsMounted:E,open:S}=e,[u,b]=o.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[M,T]=o.useState(r);P(M,r)||T(r);const[B,N]=o.useState(null),[V,W]=o.useState(null),F=o.useCallback(f=>{f!==d.current&&(d.current=f,N(f))},[]),q=o.useCallback(f=>{f!==m.current&&(m.current=f,W(f))},[]),c=g||B,l=A||V,d=o.useRef(null),m=o.useRef(null),w=o.useRef(u),G=E!=null,O=D(E),_=D(s),v=D(S),y=o.useCallback(()=>{if(!d.current||!m.current)return;const f={placement:t,strategy:n,middleware:M};_.current&&(f.platform=_.current),i.computePosition(d.current,m.current,f).then(h=>{const p={...h,isPositioned:v.current!==!1};x.current&&!P(w.current,p)&&(w.current=p,I.flushSync(()=>{b(p)}))})},[M,t,n,_,v]);R(()=>{S===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,b(f=>({...f,isPositioned:!1})))},[S]);const x=o.useRef(!1);R(()=>(x.current=!0,()=>{x.current=!1}),[]),R(()=>{if(c&&(d.current=c),l&&(m.current=l),c&&l){if(O.current)return O.current(c,l,y);y()}},[c,l,y,O,G]);const z=o.useMemo(()=>({reference:d,floating:m,setReference:F,setFloating:q}),[F,q]),a=o.useMemo(()=>({reference:c,floating:l}),[c,l]),C=o.useMemo(()=>{const f={position:n,left:0,top:0};if(!a.floating)return f;const h=L(a.floating,u.x),p=L(a.floating,u.y);return k?{...f,transform:"translate("+h+"px, "+p+"px)",...$(a.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:h,top:p}},[n,k,a.floating,u.x,u.y]);return o.useMemo(()=>({...u,update:y,refs:z,elements:a,floatingStyles:C}),[u,y,z,a,C])}const K=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?i.arrow({element:r.current,padding:s}).fn(n):{}:r?i.arrow({element:r,padding:s}).fn(n):{}}}},Q=(e,t)=>({...i.offset(e),options:[e,t]}),X=(e,t)=>({...i.shift(e),options:[e,t]}),Y=(e,t)=>({...i.limitShift(e),options:[e,t]}),Z=(e,t)=>({...i.flip(e),options:[e,t]}),ee=(e,t)=>({...i.size(e),options:[e,t]}),te=(e,t)=>({...i.hide(e),options:[e,t]}),ne=(e,t)=>({...K(e),options:[e,t]});exports.autoUpdate=i.autoUpdate;exports.computePosition=i.computePosition;exports.platform=i.platform;exports.arrow=ne;exports.flip=Z;exports.hide=te;exports.limitShift=Y;exports.offset=Q;exports.shift=X;exports.size=ee;exports.useFloating=J;
|
|
2
2
|
//# sourceMappingURL=index.cjs80.js.map
|