maquinaweb-ui 2.36.1 → 2.36.2
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/{container-animation.d.mts → container-animation.d.ts} +1 -1
- package/dist/container-animation.d.ts.map +1 -0
- package/dist/{container-animation.mjs → container-animation.js} +4 -3
- package/dist/container-animation.js.map +1 -0
- package/dist/{input-B9ebQkfm.mjs → input-Cp3f1KmR.js} +4 -4
- package/dist/input-Cp3f1KmR.js.map +1 -0
- package/dist/{input-help-BO1s6Ca6.mjs → input-help-etTqPzYc.js} +9 -9
- package/dist/input-help-etTqPzYc.js.map +1 -0
- package/dist/{input-suggest.d.mts → input-suggest.d.ts} +4 -4
- package/dist/input-suggest.d.ts.map +1 -0
- package/dist/{input-suggest.mjs → input-suggest.js} +10 -7
- package/dist/input-suggest.js.map +1 -0
- package/dist/{label-ofBNlnV2.mjs → label-BqtcCyMj.js} +4 -4
- package/dist/label-BqtcCyMj.js.map +1 -0
- package/dist/{page-header.d.mts → page-header.d.ts} +3 -3
- package/dist/page-header.d.ts.map +1 -0
- package/dist/{page-header.mjs → page-header.js} +5 -2
- package/dist/page-header.js.map +1 -0
- package/dist/{remote-selector.d.mts → remote-selector.d.ts} +4 -4
- package/dist/remote-selector.d.ts.map +1 -0
- package/dist/{remote-selector.mjs → remote-selector.js} +21 -17
- package/dist/remote-selector.js.map +1 -0
- package/dist/{scroll-area-erZKDarE.mjs → scroll-area-C2WadzN5.js} +5 -5
- package/dist/scroll-area-C2WadzN5.js.map +1 -0
- package/dist/{split-text-poor.d.mts → split-text-poor.d.ts} +1 -1
- package/dist/split-text-poor.d.ts.map +1 -0
- package/dist/{split-text-poor.mjs → split-text-poor.js} +3 -2
- package/dist/split-text-poor.js.map +1 -0
- package/dist/{text-field.d.mts → text-field.d.ts} +7 -7
- package/dist/text-field.d.ts.map +1 -0
- package/dist/{text-field.mjs → text-field.js} +14 -11
- package/dist/text-field.js.map +1 -0
- package/dist/{toggle-field.d.mts → toggle-field.d.ts} +3 -3
- package/dist/toggle-field.d.ts.map +1 -0
- package/dist/{toggle-field.mjs → toggle-field.js} +7 -6
- package/dist/toggle-field.js.map +1 -0
- package/dist/{utils-CG5oGEBQ.mjs → utils-C0f9Ma6r.js} +2 -2
- package/dist/utils-C0f9Ma6r.js.map +1 -0
- package/dist/{with-mask-110DD-Lg.d.mts → with-mask-DnMiJlek.d.ts} +2 -2
- package/dist/with-mask-DnMiJlek.d.ts.map +1 -0
- package/package.json +40 -12
- package/dist/container-animation.d.mts.map +0 -1
- package/dist/container-animation.mjs.map +0 -1
- package/dist/input-B9ebQkfm.mjs.map +0 -1
- package/dist/input-help-BO1s6Ca6.mjs.map +0 -1
- package/dist/input-suggest.d.mts.map +0 -1
- package/dist/input-suggest.mjs.map +0 -1
- package/dist/label-ofBNlnV2.mjs.map +0 -1
- package/dist/page-header.d.mts.map +0 -1
- package/dist/page-header.mjs.map +0 -1
- package/dist/remote-selector.d.mts.map +0 -1
- package/dist/remote-selector.mjs.map +0 -1
- package/dist/scroll-area-erZKDarE.mjs.map +0 -1
- package/dist/split-text-poor.d.mts.map +0 -1
- package/dist/split-text-poor.mjs.map +0 -1
- package/dist/text-field.d.mts.map +0 -1
- package/dist/text-field.mjs.map +0 -1
- package/dist/toggle-field.d.mts.map +0 -1
- package/dist/toggle-field.mjs.map +0 -1
- package/dist/utils-CG5oGEBQ.mjs.map +0 -1
- package/dist/with-mask-110DD-Lg.d.mts.map +0 -1
|
@@ -26,4 +26,4 @@ declare const ContainerAnimation: <T extends ElementType = "div">({
|
|
|
26
26
|
}: ContainerAnimationProps<T>) => react_jsx_runtime3.JSX.Element;
|
|
27
27
|
//#endregion
|
|
28
28
|
export { ContainerAnimation, type ContainerAnimationProps };
|
|
29
|
-
//# sourceMappingURL=container-animation.d.
|
|
29
|
+
//# sourceMappingURL=container-animation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-animation.d.ts","names":[],"sources":["../src/components/container-animation/container-animation.tsx"],"sourcesContent":[],"mappings":";;;;KAiDY,kCAAkC,uBAC5C,wBACE,eAAe;;;EAFP,KAAA,CAAA,EAAA,MAAA;EAAuB,QAAA,CAAA,EAAA,MAAA;UAAW,CAAA,EAAA,CAAA,MAAA,EAAA,MAAA,CAAA;eAC5C,CAAA,EAAA,OAAA;KACiB,EAOR,CAPQ,GAAA,MAAA;WAAf,CAAA,EAAA,MAAA;;cAWE,kBAJM,EAAA,CAAA,UAI0B,WAJ1B,GAAA,KAAA,CAAA,CAAA;EAAA,SAAA;EAAA,QAAA;EAAA,QAAA;EAAA,KAAA;EAAA,KAAA;EAAA,QAAA;EAAA,EAAA,EAI+C,EAJ/C;EAAA,QAAA;EAAA,aAAA;EAAA,GAAA;AAAA,CAAA,EAeT,uBAfS,CAee,CAff,CAAA,EAAA,GAeiB,kBAAA,CAAA,GAAA,CAAA,OAfjB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import { cn } from "./utils-C0f9Ma6r.js";
|
|
4
5
|
import { useEffect, useRef, useState } from "react";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
6
7
|
import * as motion from "motion/react-m";
|
|
@@ -106,7 +107,7 @@ const getVariants = (position, space, delay) => {
|
|
|
106
107
|
}
|
|
107
108
|
};
|
|
108
109
|
};
|
|
109
|
-
const ContainerAnimation = ({ className, children, position = "top", delay = 0, space = 20, duration = .8, as: As = "div", distance = [95, 5], hideNotInView = false
|
|
110
|
+
const ContainerAnimation = ({ className, children, position = "top", delay = 0, space = 20, duration = .8, as: As = "div", distance = [95, 5], hideNotInView = false,...props }) => {
|
|
110
111
|
const ref = useRef(null);
|
|
111
112
|
const isInView = useInView(ref, {
|
|
112
113
|
once: true,
|
|
@@ -127,4 +128,4 @@ const ContainerAnimation = ({ className, children, position = "top", delay = 0,
|
|
|
127
128
|
|
|
128
129
|
//#endregion
|
|
129
130
|
export { ContainerAnimation };
|
|
130
|
-
//# sourceMappingURL=container-animation.
|
|
131
|
+
//# sourceMappingURL=container-animation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-animation.js","names":[],"sources":["../node_modules/motion-dom/dist/es/utils/resolve-elements.mjs","../node_modules/framer-motion/dist/es/render/dom/viewport/index.mjs","../node_modules/framer-motion/dist/es/utils/use-in-view.mjs","../src/components/container-animation/container-animation.tsx"],"sourcesContent":["function resolveElements(elementOrSelector, scope, selectorCache) {\n if (elementOrSelector instanceof EventTarget) {\n return [elementOrSelector];\n }\n else if (typeof elementOrSelector === \"string\") {\n let root = document;\n if (scope) {\n root = scope.current;\n }\n const elements = selectorCache?.[elementOrSelector] ??\n root.querySelectorAll(elementOrSelector);\n return elements ? Array.from(elements) : [];\n }\n return Array.from(elementOrSelector);\n}\n\nexport { resolveElements };\n","import { resolveElements } from 'motion-dom';\n\nconst thresholds = {\n some: 0,\n all: 1,\n};\nfunction inView(elementOrSelector, onStart, { root, margin: rootMargin, amount = \"some\" } = {}) {\n const elements = resolveElements(elementOrSelector);\n const activeIntersections = new WeakMap();\n const onIntersectionChange = (entries) => {\n entries.forEach((entry) => {\n const onEnd = activeIntersections.get(entry.target);\n /**\n * If there's no change to the intersection, we don't need to\n * do anything here.\n */\n if (entry.isIntersecting === Boolean(onEnd))\n return;\n if (entry.isIntersecting) {\n const newOnEnd = onStart(entry.target, entry);\n if (typeof newOnEnd === \"function\") {\n activeIntersections.set(entry.target, newOnEnd);\n }\n else {\n observer.unobserve(entry.target);\n }\n }\n else if (typeof onEnd === \"function\") {\n onEnd(entry);\n activeIntersections.delete(entry.target);\n }\n });\n };\n const observer = new IntersectionObserver(onIntersectionChange, {\n root,\n rootMargin,\n threshold: typeof amount === \"number\" ? amount : thresholds[amount],\n });\n elements.forEach((element) => observer.observe(element));\n return () => observer.disconnect();\n}\n\nexport { inView };\n","\"use client\";\nimport { useState, useEffect } from 'react';\nimport { inView } from '../render/dom/viewport/index.mjs';\n\nfunction useInView(ref, { root, margin, amount, once = false, initial = false, } = {}) {\n const [isInView, setInView] = useState(initial);\n useEffect(() => {\n if (!ref.current || (once && isInView))\n return;\n const onEnter = () => {\n setInView(true);\n return once ? undefined : () => setInView(false);\n };\n const options = {\n root: (root && root.current) || undefined,\n margin,\n amount,\n };\n return inView(ref.current, onEnter, options);\n }, [root, ref, margin, once, amount]);\n return isInView;\n}\n\nexport { useInView };\n","'use client';\n\nimport { type ComponentProps, type ElementType, useRef } from 'react';\n\nimport { cn } from '@/lib/utils';\nimport { useInView } from 'motion/react';\nimport * as motion from 'motion/react-m';\n\nconst getVariants = (\n position: 'top' | 'bottom' | 'left' | 'right',\n space: number,\n delay: number\n) => {\n const directions = {\n top: {\n transform: `translateY(${space}px)`,\n },\n bottom: {\n transform: `translateY(-${space}px)`,\n },\n left: {\n transform: `translateX(${space}px)`,\n },\n right: {\n transform: `translateX(-${space}px)`,\n },\n };\n\n const dir = directions[position] || directions.top;\n\n return {\n hidden: {\n opacity: 0,\n filter: 'blur(6px)',\n ...dir,\n },\n visible: {\n opacity: 1,\n filter: 'blur(0px)',\n transform: 'translateY(0px) translateX(0px)',\n transition: {\n delay,\n duration: 0.5,\n staggerChildren: 0.1,\n },\n },\n };\n};\n\nexport type ContainerAnimationProps<T extends ElementType = 'div'> =\n ComponentProps<'div'> &\n ComponentProps<T> & {\n position?: 'top' | 'bottom' | 'left' | 'right';\n delay?: number;\n space?: number;\n duration?: number;\n distance?: [number, number];\n hideNotInView?: boolean;\n as?: T | string;\n className?: string;\n };\n\nconst ContainerAnimation = <T extends ElementType = 'div'>({\n className,\n children,\n position = 'top',\n delay = 0,\n space = 20,\n duration = 0.8,\n as: As = 'div',\n distance = [95, 5],\n hideNotInView = false,\n ...props\n}: ContainerAnimationProps<T>) => {\n const ref = useRef<HTMLElement>(null);\n const isInView = useInView(ref, {\n once: true,\n margin:\n `-${100 - (distance[0] || 0)}% 0% -${(distance[1] as number) || 0}% 0%` as any,\n });\n\n const variants = getVariants(position, space, delay);\n\n return (\n <motion.div\n animate={isInView ? 'visible' : 'hidden'}\n className={cn('initial-opacity', className)}\n initial=\"hidden\"\n transition={{ duration }}\n variants={variants}\n {...props}\n ref={ref}\n >\n {(!hideNotInView || isInView) && children}\n </motion.div>\n );\n};\n\nexport { ContainerAnimation };\n"],"x_google_ignoreList":[0,1,2],"mappings":";;;;;;;;;AAAA,SAAS,gBAAgB,mBAAmB,OAAO,eAAe;AAC9D,KAAI,6BAA6B,YAC7B,QAAO,CAAC,kBAAkB;UAErB,OAAO,sBAAsB,UAAU;EAC5C,IAAI,OAAO;AACX,MAAI,MACA,QAAO,MAAM;EAEjB,MAAM,WAAW,gBAAgB,sBAC7B,KAAK,iBAAiB,kBAAkB;AAC5C,SAAO,WAAW,MAAM,KAAK,SAAS,GAAG,EAAE;;AAE/C,QAAO,MAAM,KAAK,kBAAkB;;;;;ACXxC,MAAM,aAAa;CACf,MAAM;CACN,KAAK;CACR;AACD,SAAS,OAAO,mBAAmB,SAAS,EAAE,MAAM,QAAQ,YAAY,SAAS,WAAW,EAAE,EAAE;CAC5F,MAAM,WAAW,gBAAgB,kBAAkB;CACnD,MAAM,sCAAsB,IAAI,SAAS;CACzC,MAAM,wBAAwB,YAAY;AACtC,UAAQ,SAAS,UAAU;GACvB,MAAM,QAAQ,oBAAoB,IAAI,MAAM,OAAO;;;;;AAKnD,OAAI,MAAM,mBAAmB,QAAQ,MAAM,CACvC;AACJ,OAAI,MAAM,gBAAgB;IACtB,MAAM,WAAW,QAAQ,MAAM,QAAQ,MAAM;AAC7C,QAAI,OAAO,aAAa,WACpB,qBAAoB,IAAI,MAAM,QAAQ,SAAS;QAG/C,UAAS,UAAU,MAAM,OAAO;cAG/B,OAAO,UAAU,YAAY;AAClC,UAAM,MAAM;AACZ,wBAAoB,OAAO,MAAM,OAAO;;IAE9C;;CAEN,MAAM,WAAW,IAAI,qBAAqB,sBAAsB;EAC5D;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,SAAS,MAAM,GAAG,QAAS,SAAS,MAAiB,EAAE;EACrE,CAAC;CAEF,MAAM,WAAW,YAAY,UAAU,OAAO,MAAM;AAEpD,QACE,oBAAC,OAAO;EACN,SAAS,WAAW,YAAY;EAChC,WAAW,GAAG,mBAAmB,UAAU;EAC3C,SAAQ;EACR,YAAY,EAAE,UAAU;EACd;EACV,GAAI;EACC;aAEH,CAAC,iBAAiB,aAAa;GACtB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from "./utils-C0f9Ma6r.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import inputmask from "inputmask";
|
|
4
4
|
|
|
@@ -119,7 +119,7 @@ function withMask(mask, options) {
|
|
|
119
119
|
|
|
120
120
|
//#endregion
|
|
121
121
|
//#region src/components/ui/input.tsx
|
|
122
|
-
function Input({ className, type
|
|
122
|
+
function Input({ className, type,...props }) {
|
|
123
123
|
return /* @__PURE__ */ jsx("input", {
|
|
124
124
|
className: cn("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "focus-visible:border-ring focus-visible:ring-ring/75 focus-visible:ring-[2px]", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive ring-offset-[2px] transition-all duration-300", className),
|
|
125
125
|
"data-slot": "input",
|
|
@@ -129,5 +129,5 @@ function Input({ className, type, ...props }) {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
//#endregion
|
|
132
|
-
export {
|
|
133
|
-
//# sourceMappingURL=input-
|
|
132
|
+
export { Input, withMask };
|
|
133
|
+
//# sourceMappingURL=input-Cp3f1KmR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-Cp3f1KmR.js","names":["options: Options","masks: Record<string, Inputmask.Options>","isServer"],"sources":["../src/hooks/get-mask-options.ts","../src/hooks/is-server.ts","../src/hooks/module-interop.ts","../src/hooks/with-mask.ts","../src/components/ui/input.tsx"],"sourcesContent":["import type { Mask, Options } from './with-mask';\n\nexport default function getMaskOptions(\n mask?: Mask,\n _options?: Options\n): Options {\n const options: Options = {\n jitMasking: false,\n ..._options,\n };\n if (!mask) return options;\n\n const masks: Record<string, Inputmask.Options> = {\n datetime: {\n alias: 'datetime',\n ...options,\n },\n email: {\n alias: 'email',\n placeholder: '',\n ...options,\n },\n numeric: {\n alias: 'numeric',\n placeholder: '',\n ...options,\n },\n currency: {\n alias: 'currency',\n prefix: '$ ',\n placeholder: '',\n ...options,\n },\n decimal: {\n alias: 'decimal',\n placeholder: '',\n ...options,\n },\n integer: {\n alias: 'integer',\n placeholder: '',\n ...options,\n },\n percentage: {\n alias: 'percentage',\n placeholder: ' %',\n suffix: ' %',\n ...options,\n },\n url: {\n alias: 'url',\n placeholder: 'https://',\n ...options,\n },\n ip: {\n alias: 'ip',\n ...options,\n },\n mac: {\n alias: 'mac',\n ...options,\n },\n ssn: {\n alias: 'ssn',\n ...options,\n },\n\n // alias for brazilians <3\n // ty <3\n 'brl-currency': {\n alias: 'currency',\n prefix: 'R$ ',\n placeholder: '0,00',\n displayFormat: 'currency',\n radixPoint: ',',\n autoUnmask: true,\n ...options,\n },\n cpf: {\n mask: '999.999.999-99',\n placeholder: '___.___.___-__',\n ...options,\n },\n cnpj: {\n mask: '99.999.999/9999-99',\n placeholder: '__.___.___/____-__',\n ...options,\n },\n };\n\n if (typeof mask === 'string' && masks[mask]) return masks[mask];\n\n return {\n mask,\n ...options,\n };\n}\n","const isServer = !(\n typeof window !== 'undefined' && window.document?.createElement\n);\n\nexport default isServer;\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * Synchronously resolve the default value of a module.\n */\nexport default function interopDefaultSync<T = any>(module: T): T {\n if (typeof module === 'object' && module !== null) {\n if ('default' in module) {\n return module.default as T;\n }\n return module;\n }\n return module;\n}\n","import inputmask from 'inputmask';\nimport Inputmask from 'inputmask';\nimport getMaskOptions from './get-mask-options';\nimport isServer from './is-server';\nimport interopDefaultSync from './module-interop';\n\nexport type { UseFormRegister, UseFormRegisterReturn } from 'react-hook-form';\n\nexport type Mask =\n | 'datetime'\n | 'email'\n | 'numeric'\n | 'currency'\n | 'decimal'\n | 'integer'\n | 'percentage'\n | 'url'\n | 'ip'\n | 'mac'\n | 'ssn'\n | 'brl-currency'\n | 'cpf'\n | 'cnpj'\n | (string & {})\n | (string[] & {})\n | null;\nexport type Options = Inputmask.Options;\nexport type Input = HTMLInputElement | HTMLTextAreaElement | HTMLElement;\n\nexport default function withMask(mask: Mask, options?: Options) {\n return (input: Input | null): void => {\n if (isServer || mask === null || !input) return;\n\n const maskInput = interopDefaultSync(inputmask)(\n getMaskOptions(mask, options)\n );\n\n maskInput.mask(input);\n };\n}\n","import type * as React from 'react';\n\nimport { cn } from '@/lib/utils';\n\nfunction Input({ className, type, ...props }: React.ComponentProps<'input'>) {\n return (\n <input\n className={cn(\n 'file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n 'focus-visible:border-ring focus-visible:ring-ring/75 focus-visible:ring-[2px]',\n 'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive ring-offset-[2px] transition-all duration-300',\n className\n )}\n data-slot=\"input\"\n type={type}\n {...props}\n />\n );\n}\n\nexport { Input };\n"],"mappings":";;;;;AAEA,SAAwB,eACtB,MACA,UACS;C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AMzC,EAJkB,mBAAmB,UAAU,CAC7C,eAAe,MAAM,QAAQ,CAC9B,CAES,KAAK,MAAM;;;;;;ACjCzB,SAAS,MAAM,EAAE,WAAW,KAAM,GAAG,SAAwC;AAC3E,QACE,oBAAC;EACC,WAAW,GACT,mcACA,iFACA,wJACA,UACD;EACD,aAAU;EACJ;EACN,GAAI;GACJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { cn } from "./utils-C0f9Ma6r.js";
|
|
2
|
+
import { Label } from "./label-BqtcCyMj.js";
|
|
3
3
|
import { useFormContext, useFormState } from "react-hook-form";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -34,7 +34,7 @@ const useFormField = () => {
|
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
const FormItemContext = React.createContext({});
|
|
37
|
-
function FormItem({ className
|
|
37
|
+
function FormItem({ className,...props }) {
|
|
38
38
|
const id = React.useId();
|
|
39
39
|
return /* @__PURE__ */ jsx(FormItemContext.Provider, {
|
|
40
40
|
value: { id },
|
|
@@ -45,7 +45,7 @@ function FormItem({ className, ...props }) {
|
|
|
45
45
|
})
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
function FormLabel({ className
|
|
48
|
+
function FormLabel({ className,...props }) {
|
|
49
49
|
const { error, formItemId } = useFormField();
|
|
50
50
|
return /* @__PURE__ */ jsx(Label, {
|
|
51
51
|
className: cn("data-[error=true]:text-destructive", className),
|
|
@@ -55,7 +55,7 @@ function FormLabel({ className, ...props }) {
|
|
|
55
55
|
...props
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
function FormMessage({ className
|
|
58
|
+
function FormMessage({ className,...props }) {
|
|
59
59
|
const { error, formMessageId } = useFormField();
|
|
60
60
|
const body = error ? String(error?.message ?? "") : props.children;
|
|
61
61
|
if (!body) return null;
|
|
@@ -70,7 +70,7 @@ function FormMessage({ className, ...props }) {
|
|
|
70
70
|
|
|
71
71
|
//#endregion
|
|
72
72
|
//#region src/components/ui/tooltip.tsx
|
|
73
|
-
function TooltipProvider({ delayDuration = 0
|
|
73
|
+
function TooltipProvider({ delayDuration = 0,...props }) {
|
|
74
74
|
return /* @__PURE__ */ jsx(TooltipPrimitive.Provider, {
|
|
75
75
|
"data-slot": "tooltip-provider",
|
|
76
76
|
delayDuration,
|
|
@@ -89,7 +89,7 @@ function TooltipTrigger({ ...props }) {
|
|
|
89
89
|
...props
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
-
function TooltipContent({ className, sideOffset = 0, children
|
|
92
|
+
function TooltipContent({ className, sideOffset = 0, children,...props }) {
|
|
93
93
|
return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(TooltipPrimitive.Content, {
|
|
94
94
|
className: cn("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance", className),
|
|
95
95
|
"data-slot": "tooltip-content",
|
|
@@ -136,5 +136,5 @@ const InputHelp = ({ help, name, className }) => {
|
|
|
136
136
|
};
|
|
137
137
|
|
|
138
138
|
//#endregion
|
|
139
|
-
export {
|
|
140
|
-
//# sourceMappingURL=input-help-
|
|
139
|
+
export { FormItem, FormLabel, FormMessage, InputHelp };
|
|
140
|
+
//# sourceMappingURL=input-help-etTqPzYc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-help-etTqPzYc.js","names":["ContentHelp: React.FC<{\n children: React.ReactNode;\n help?: React.ReactNode | string;\n className?: string;\n side?: 'top' | 'right' | 'bottom' | 'left';\n sideOffset?: number;\n}>","TooltipPortal","InputHelp: React.FC<{\n help?: string;\n name?: string;\n className?: string;\n}>"],"sources":["../src/components/ui/form.tsx","../src/components/ui/tooltip.tsx","../src/components/ui/content-help.tsx","../src/components/ui/input-help.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport {\n Controller,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n FormProvider,\n useFormContext,\n useFormState,\n} from 'react-hook-form';\n\nimport type * as LabelPrimitive from '@radix-ui/react-label';\nimport { Slot } from '@radix-ui/react-slot';\nimport { Label } from '@/components/ui/label';\n\nimport { cn } from '@/lib/utils';\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName;\n};\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>(\n {} as FormFieldContextValue\n);\n\nconst FormContext = React.createContext<{\n onSubmit?: (data?: FieldValues) => void;\n helper?: Record<string, string>;\n}>({});\n\nexport const useFormContextSubmit = () => {\n const context = React.useContext(FormContext);\n if (!context) {\n return {};\n }\n return context;\n};\n\nconst Form: React.FC<\n React.ComponentProps<typeof FormProvider<FieldValues>> & {\n onSubmit?: (data?: FieldValues) => void;\n helper?: Record<string, string>;\n }\n> = ({ onSubmit, helper, ...props }) => {\n return (\n <FormContext.Provider value={{ onSubmit, helper }}>\n <FormProvider {...props} />\n </FormContext.Provider>\n );\n};\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext);\n const itemContext = React.useContext(FormItemContext);\n const { getFieldState } = useFormContext();\n const formState = useFormState({ name: fieldContext.name });\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = React.createContext<FormItemContextValue>(\n {} as FormItemContextValue\n);\n\nfunction FormItem({ className, ...props }: React.ComponentProps<'div'>) {\n const id = React.useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div\n className={cn('flex flex-col gap-1', className)}\n data-slot=\"form-item\"\n {...props}\n />\n </FormItemContext.Provider>\n );\n}\n\nfunction FormLabel({\n className,\n ...props\n}: React.ComponentProps<typeof LabelPrimitive.Root>) {\n const { error, formItemId } = useFormField();\n\n return (\n <Label\n className={cn('data-[error=true]:text-destructive', className)}\n data-error={!!error}\n data-slot=\"form-label\"\n htmlFor={formItemId}\n {...props}\n />\n );\n}\n\nfunction FormControl({ ...props }: React.ComponentProps<typeof Slot>) {\n const { error, formItemId, formDescriptionId, formMessageId } =\n useFormField();\n\n return (\n <Slot\n aria-describedby={\n !error\n ? `${formDescriptionId}`\n : `${formDescriptionId} ${formMessageId}`\n }\n aria-invalid={!!error}\n data-slot=\"form-control\"\n id={formItemId}\n {...props}\n />\n );\n}\n\nfunction FormDescription({ className, ...props }: React.ComponentProps<'p'>) {\n const { formDescriptionId } = useFormField();\n\n return (\n <p\n className={cn('text-muted-foreground text-sm', className)}\n data-slot=\"form-description\"\n id={formDescriptionId}\n {...props}\n />\n );\n}\n\nfunction FormMessage({ className, ...props }: React.ComponentProps<'p'>) {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error?.message ?? '') : props.children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p\n className={cn('text-destructive text-xs', className)}\n data-slot=\"form-message\"\n id={formMessageId}\n {...props}\n >\n {body}\n </p>\n );\n}\n\nexport {\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField,\n};\n","'use client';\n\nimport * as React from 'react';\n\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\n\nimport { cn } from '@/lib/utils';\n\nfunction TooltipProvider({\n delayDuration = 0,\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {\n return (\n <TooltipPrimitive.Provider\n data-slot=\"tooltip-provider\"\n delayDuration={delayDuration}\n {...props}\n />\n );\n}\n\nfunction Tooltip({\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Root>) {\n return (\n <TooltipProvider>\n <TooltipPrimitive.Root data-slot=\"tooltip\" {...props} />\n </TooltipProvider>\n );\n}\n\nfunction TooltipTrigger({\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {\n return <TooltipPrimitive.Trigger data-slot=\"tooltip-trigger\" {...props} />;\n}\n\nfunction TooltipContent({\n className,\n sideOffset = 0,\n children,\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Content>) {\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n className={cn(\n 'bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance',\n className\n )}\n data-slot=\"tooltip-content\"\n sideOffset={sideOffset}\n {...props}\n >\n {children}\n <TooltipPrimitive.Arrow className=\"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]\" />\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n );\n}\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };\n","import { Portal as TooltipPortal } from '@radix-ui/react-tooltip';\n\nimport { cn } from '@/lib/utils';\nimport { Tooltip, TooltipContent, TooltipTrigger } from './tooltip';\n\nconst ContentHelp: React.FC<{\n children: React.ReactNode;\n help?: React.ReactNode | string;\n className?: string;\n side?: 'top' | 'right' | 'bottom' | 'left';\n sideOffset?: number;\n}> = ({ children, help, className, side = 'top', sideOffset = 10 }) => {\n return help ? (\n <Tooltip delayDuration={250}>\n <TooltipTrigger asChild>{children as any}</TooltipTrigger>\n <TooltipPortal>\n <TooltipContent\n className={cn('flex items-center px-2 leading-none', className)}\n side={side}\n sideOffset={10}\n >\n <p className=\"w-full text-wrap whitespace-break-spaces\">{help}</p>\n </TooltipContent>\n </TooltipPortal>\n </Tooltip>\n ) : (\n children\n );\n};\n\nexport { ContentHelp };\n","'use client';\n\nimport { ContentHelp } from '@/components/ui/content-help';\n\nimport { Info } from 'lucide-react';\n\nimport { cn } from '@/lib/utils';\nimport { useFormContextSubmit } from './form';\n\nconst InputHelp: React.FC<{\n help?: string;\n name?: string;\n className?: string;\n}> = ({ help, name, className }) => {\n const { helper } = useFormContextSubmit();\n const helpText = (name && helper?.[name]) || help;\n\n return (\n helpText && (\n <ContentHelp\n className={cn(\n 'whitespace-pre-line leading-relaxed max-w-96 text-[13px]'\n )}\n help={helpText}\n >\n <button\n className={cn('mb-0.5 size-fit hover:bg-muted rounded-sm', className)}\n type=\"button\"\n >\n <Info className=\"size-3.5\" />\n </button>\n </ContentHelp>\n )\n );\n};\nexport { InputHelp };\n"],"mappings":";;;;;;;;;;;AA2BA,MAAM,mBAAmB,MAAM,cAC7B,EAAE,CACH;AAED,MAAM,cAAc,MAAM,cAGvB,EAAE,CAAC;AAEN,MAAa,6BAA6B;CACxC,MAAM,UAAU,MAAM,WAAW,YAAY;AAC7C,KAAI,CAAC,QACH,QAAO,EAAE;AAEX,QAAO;;AA6BT,MAAM,qBAAqB;CACzB,MAAM,eAAe,MAAM,WAAW,iBAAiB;CACvD,MAAM,cAAc,MAAM,WAAW,gBAAgB;CACrD,MAA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AiB;EAAK,aAAU;EAAU,GAAI;GAAS,GACxC;;AAItB,SAAS,eAAe,EACtB,GAAG,SACqD;AACxD,QAAO,oBAAC,iBAAiB;EAAQ,aAAU;EAAkB,GAAI;GAAS;;AAG5E,SAAS,eAAe,EACtB,WACA,aAAa,GACb,SACA,GAAG,SACqD;AACxD,QACE,oBAAC,iBAAiB,oBAChB,qBAAC,iBAAiB;EAChB,WAAW,GACT,qaACA,UACD;EACD,aAAU;EACE;EACZ,GAAI;aAEH,UACD,oBAAC,iBAAiB,SAAM,WAAU,uGAAuG;GAChH,GACH;;;;;ACpD9B,MAAMA,eAMA,EAAE,UAAU,MAAM,WAAW,OAAO,OAAO,aAAa,SAAS;AACrE,QAAO,OACL,qBAAC;EAAQ,eAAe;aACtB,oBAAC;GAAe;GAAS;IAAiC,EAC1D,oBAACC,oBACC,oBAAC;GACC,WAAW,GAAG,uCAAuC,UAAU;GACzD;GACN,YAAY;aAEZ,oBAAC;IAAE,WAAU;cAA4C;KAAS;IACnD,GACH;GACR,GAEV;;;;;ACjBJ,MAAMC,aAIA,EAAE,MAAM,MAAM,gBAAgB;CAClC,MAAM,EAAE,WAAW,sBAAsB;CACzC,MAAM,WAAY,QAAQ,SAAS,SAAU;AAE7C,QACE,YACE,oBAAC;EACC,WAAW,GACT,2DACD;EACD,MAAM;YAEN,oBAAC;GACC,WAAW,GAAG,6CAA6C,UAAU;GACrE,MAAK;aAEL,oBAAC,QAAK,WAAU,aAAa;IACtB;GACG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mask, Options } from "./with-mask-DnMiJlek.js";
|
|
2
2
|
import { FieldPath, FieldValues, UseControllerProps } from "react-hook-form";
|
|
3
3
|
import { Dispatch, SetStateAction } from "react";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
5
5
|
import { PopoverProps } from "@radix-ui/react-popover";
|
|
6
6
|
|
|
7
7
|
//#region src/components/input-suggest/input-suggest.d.ts
|
|
@@ -71,7 +71,7 @@ declare function InputSuggest<TFieldValues extends FieldValues = FieldValues, TF
|
|
|
71
71
|
debounceTime,
|
|
72
72
|
maxWait,
|
|
73
73
|
...props
|
|
74
|
-
}: InputSuggestProps<TFieldValues, TFieldName> & PopoverProps):
|
|
74
|
+
}: InputSuggestProps<TFieldValues, TFieldName> & PopoverProps): react_jsx_runtime7.JSX.Element;
|
|
75
75
|
//#endregion
|
|
76
76
|
export { InputSuggest, type InputSuggestProps };
|
|
77
|
-
//# sourceMappingURL=input-suggest.d.
|
|
77
|
+
//# sourceMappingURL=input-suggest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-suggest.d.ts","names":[],"sources":["../src/components/input-suggest/input-suggest.tsx"],"sourcesContent":[],"mappings":";;;;;;;UAmCiB,uCACM,cAAc,gCAChB,UAAU,gBAAgB,UAAU,uBAC/C,mBAAmB,cAAc;;;EAH1B,QAAA,CAAA,EAAA,CAAA,MAAA,EAAiB,MAAA,EAAA,GAAA,IAAA;EAAA,QAAA,CAAA,EAOrB,QAPqB,CAOZ,cAPY,CAAA,MAAA,CAAA,CAAA;OACX,CAAA,EAAA,MAAA;aAAc,CAAA,EAAA,MAAA;WACN,CAAA,EAAA,MAAA;SAAV,EAAA,CAAA,MAAA,CAAA,EAAA,MAAA,EAAA,aAAA,CAAA,EAWD,MAXC,EAAA,GAAA;IAAoC,IAAA,CAAA,EAAA;MAAV,EAAA,EAAA,MAAA,GAAA,MAAA;MAClB,CAAA,GAAA,EAAA,MAAA,CAAA,EAAA,GAAA;IAAc,CAAA,EAAA;IAIrB,OAAA,CAAA,EAAA,GAAA;;UAMF,CAAA,EAAA,OAAA;OAqBX,CAAA,EAAA,MAAA;oBACO,CAAA,EAAA,OAAA;cACE,CAAA,EAAA,GAAA,GAAA,IAAA;YAjCR,CAAA,EAAA,OAAA;EAAkB,OAAA,CAAA,EAAA,MAAA;EAuCnB,IAAA,CAA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Input, withMask } from "./input-Cp3f1KmR.js";
|
|
7
|
+
import { FormItem, FormLabel, FormMessage, InputHelp } from "./input-help-etTqPzYc.js";
|
|
8
|
+
import { Popover, PopoverContent, PopoverTrigger, ScrollBar } from "./scroll-area-C2WadzN5.js";
|
|
7
9
|
import { useController, useFormContext } from "react-hook-form";
|
|
8
10
|
import { useCallback, useEffect, useState } from "react";
|
|
9
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -12,11 +14,12 @@ import { useDebounce } from "use-debounce";
|
|
|
12
14
|
import { ScrollArea, ScrollAreaViewport } from "@radix-ui/react-scroll-area";
|
|
13
15
|
|
|
14
16
|
//#region src/components/input-suggest/input-suggest.tsx
|
|
15
|
-
function InputSuggest({ name, nameSearch, onSearch, fieldValue = "name", label, className, placeholder, useData, setValue, required, disabled, updateSearchOnBlur = true, value, extra, extraOnClick, withPortal = false, counter, help, prefix, refineValue, refineSuggest, limit = 10, mask, maskOptions, children, onClear, initialParams, debounceTime = 100, maxWait = 200
|
|
17
|
+
function InputSuggest({ name, nameSearch, onSearch, fieldValue = "name", label, className, placeholder, useData, setValue, required, disabled, updateSearchOnBlur = true, value, extra, extraOnClick, withPortal = false, counter, help, prefix, refineValue, refineSuggest, limit = 10, mask, maskOptions, children, onClear, initialParams, debounceTime = 100, maxWait = 200,...props }) {
|
|
16
18
|
const form = useFormContext();
|
|
17
19
|
const inputName = prefix ? `${prefix}.${name}` : name;
|
|
20
|
+
const searchName = prefix ? `${prefix}.${nameSearch}` : nameSearch;
|
|
18
21
|
const { field: searchField } = useController({
|
|
19
|
-
name:
|
|
22
|
+
name: searchName,
|
|
20
23
|
control: form.control
|
|
21
24
|
});
|
|
22
25
|
const { field, fieldState } = useController({
|
|
@@ -180,4 +183,4 @@ function InputSuggest({ name, nameSearch, onSearch, fieldValue = "name", label,
|
|
|
180
183
|
|
|
181
184
|
//#endregion
|
|
182
185
|
export { InputSuggest };
|
|
183
|
-
//# sourceMappingURL=input-suggest.
|
|
186
|
+
//# sourceMappingURL=input-suggest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-suggest.js","names":["item"],"sources":["../src/components/input-suggest/input-suggest.tsx"],"sourcesContent":["'use client';\n\nimport {\n Dispatch,\n SetStateAction,\n useCallback,\n useEffect,\n useState,\n} from 'react';\n\nimport {\n FieldPath,\n FieldValues,\n UseControllerProps,\n useController,\n useFormContext,\n} from 'react-hook-form';\nimport { useDebounce } from 'use-debounce';\nimport withMask, {\n type Mask,\n type Options as MaskOptions,\n} from '@/hooks/with-mask';\n\nimport type { PopoverProps } from '@radix-ui/react-popover';\nimport { ScrollArea, ScrollAreaViewport } from '@radix-ui/react-scroll-area';\nimport { Input } from '@/components/ui/input';\nimport { FormItem, FormLabel, FormMessage } from '@/ui/form';\nimport { InputHelp } from '@/ui/input-help';\nimport { Popover, PopoverContent, PopoverTrigger } from '@/ui/popover';\nimport { ScrollBar } from '../ui/scroll-area';\n\nimport { Check } from 'lucide-react';\n\nimport { cn } from '@/lib/utils';\n\nexport interface InputSuggestProps<\n TFieldValues extends FieldValues = FieldValues,\n TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> extends UseControllerProps<TFieldValues, TFieldName> {\n label: string;\n search?: string;\n onSearch?: (search: string) => void;\n setValue?: Dispatch<SetStateAction<string>>;\n value?: string;\n placeholder?: string;\n className?: string;\n useData: (\n search?: string,\n initialParams?: Object\n ) => {\n data?: {\n id: string | number;\n [key: string]: any;\n }[];\n refresh?: any;\n };\n required?: boolean;\n extra?: string;\n updateSearchOnBlur?: boolean;\n extraOnClick?: () => void;\n withPortal?: boolean;\n counter?: number;\n help?: string;\n nameSearch: string;\n prefix?: string;\n refineValue?: (value: any) => any;\n refineSuggest?: (suggest: any) => any;\n limit?: number;\n fieldValue?: string;\n mask?: Mask;\n maskOptions?: MaskOptions;\n initialParams?: Object;\n onClear?: () => void;\n debounceTime?: number;\n maxWait?: number;\n}\n\nfunction InputSuggest<\n TFieldValues extends FieldValues = FieldValues,\n TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n name,\n nameSearch,\n onSearch,\n fieldValue = 'name',\n label,\n className,\n placeholder,\n useData,\n setValue,\n required,\n disabled,\n updateSearchOnBlur = true,\n value,\n extra,\n extraOnClick,\n withPortal = false,\n counter,\n help,\n prefix,\n refineValue,\n refineSuggest,\n limit = 10,\n mask,\n maskOptions,\n children,\n onClear,\n initialParams,\n debounceTime = 100,\n maxWait = 200,\n ...props\n}: InputSuggestProps<TFieldValues, TFieldName> & PopoverProps) {\n const form = useFormContext();\n const inputName = prefix ? `${prefix}.${name}` : name;\n const searchName = prefix ? `${prefix}.${nameSearch}` : nameSearch;\n\n const { field: searchField } = useController({\n name: searchName,\n control: form.control,\n });\n const { field, fieldState } = useController({\n name: inputName,\n control: form.control,\n });\n\n const [ariaSelected, setAriaSelected] = useState(-1);\n\n const [open, setOpen] = useState(false);\n\n const [searchDebounced] = useDebounce(searchField.value, debounceTime, {\n maxWait: maxWait,\n });\n const { data } = useData?.(searchDebounced, initialParams);\n\n const onChange = useCallback(\n (item: any) => {\n const searchValue = item?.[fieldValue as keyof typeof item];\n searchField.onChange(searchValue);\n onSearch?.(searchValue);\n field.onChange(refineValue?.(item) || item);\n setOpen(false);\n },\n [field.value, refineValue, fieldValue]\n );\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (e.target.value === '') {\n searchField.onChange('');\n field.onChange(null);\n onClear?.();\n onSearch?.('');\n return;\n }\n searchField.onChange(e.target.value);\n onSearch?.(e.target.value);\n setOpen(true);\n const item = data?.find((item) => item[fieldValue] === e.target.value);\n if (item) {\n onChange(item);\n setOpen(false);\n }\n },\n [field, searchField, onClear, onSearch]\n );\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n e.stopPropagation();\n ariaSelected < (data?.length ?? 0) - 1 &&\n setAriaSelected((prev) => prev + 1);\n }\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n e.stopPropagation();\n ariaSelected > 0 && setAriaSelected((prev) => prev - 1);\n }\n if (e.key === 'Enter' && data && data[ariaSelected]) {\n e.preventDefault();\n e.stopPropagation();\n onChange(data[ariaSelected]);\n }\n },\n [data, ariaSelected, onChange]\n );\n\n useEffect(() => {\n const searchValue = field?.value?.[fieldValue as keyof typeof field.value];\n if (searchValue !== searchField.value && updateSearchOnBlur) {\n searchField.onChange(searchValue);\n onSearch?.(searchValue);\n }\n }, [field.value]);\n\n return (\n <FormItem\n className={cn('w-full flex flex-col', className)}\n id={`input-suggest-${inputName}`}\n >\n <div className=\"flex items-end gap-1.5\">\n <FormLabel htmlFor={inputName}>\n {label}:\n {required && (\n <span className=\"text-red-500 text-lg leading-[1px]\">*</span>\n )}\n </FormLabel>\n\n <InputHelp help={help} name={inputName} />\n </div>\n <Popover onOpenChange={setOpen} open={open} {...props}>\n <PopoverTrigger className=\"outline-hidden w-full relative\">\n <Input\n autoComplete=\"off\"\n className={cn(fieldState.error && 'border-destructive')}\n disabled={disabled}\n name={name}\n onInput={handleChange}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n ref={\n mask\n ? withMask(mask, { autoUnmask: true, ...maskOptions })\n : (undefined as any)\n }\n value={searchField.value}\n />\n {children}\n </PopoverTrigger>\n {fieldState.error && <FormMessage />}\n <PopoverContent\n className={cn(\n 'mt-1 w-(--radix-popover-trigger-width) max-w-2xl p-0 z-50',\n data?.length === 0 && 'hidden'\n )}\n onOpenAutoFocus={(e) => e.preventDefault()}\n >\n <ScrollArea className=\"h-fit max-h-[300px]\" id=\"scroll\">\n <ScrollAreaViewport className=\"w-full h-fit max-h-[300px]\">\n <ul className=\"p-1\">\n {data?.slice(0, limit)?.map((item) => (\n <li\n aria-selected={data[ariaSelected]?.id === item.id}\n className={cn(\n 'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden aria-selected:bg-accent/50 aria-selected:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 transition-all hover:bg-accent/50 hover:text-accent-foreground',\n field?.value?.id === item.id &&\n 'bg-accent! text-accent-foreground'\n )}\n key={item.id}\n onMouseDown={(e) => {\n onChange(item);\n e.preventDefault();\n }}\n >\n <span className=\"line-clamp-1 flex-1\">\n {refineSuggest\n ? refineSuggest(item)\n : item?.[fieldValue as keyof typeof item]}\n </span>\n {field?.value?.id == item.id && (\n <Check className=\"ml-auto h-4 w-4 shrink-0\" />\n )}\n </li>\n ))}\n\n {extra && (\n <li\n className={cn(\n 'flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden aria-selected:bg-accent/50 aria-selected:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 transition-all hover:text-accent-foreground sticky bottom-0.5 bg-white hover:bg-accent'\n )}\n onMouseDown={(e) => {\n e.preventDefault();\n extraOnClick?.();\n }}\n >\n <span className=\"line-clamp-1\">{extra}</span>\n </li>\n )}\n\n {(data?.length === 0 || !data) && !extra && (\n <p className=\"text-sm text-center text-accent-foreground/50 py-2\">\n Nenhum resultado encontrado.\n </p>\n )}\n </ul>\n </ScrollAreaViewport>\n <ScrollBar />\n </ScrollArea>\n </PopoverContent>\n </Popover>\n </FormItem>\n );\n}\n\nexport { InputSuggest };\n"],"mappings":";;;;;;;;;;;;;;;;AA6EA,SAAS,aAGP,EACA,MACA,YACA,UACA,aAAa,QACb,OACA,WACA,aACA,SACA,UACA,UACA,UACA,qBAAqB,MACrB,OACA,OACA,cACA,aAAa,OACb,SACA,MACA,QACA,aACA,eACA,QAAQ,IACR,MACA,aACA,UACA,SACA,eACA,eAAe,KACf,UAAU,IACV,GAAG,SAC0D;CAC7D,MAAM,OAAO,gBAAgB;CAC7B,MAAM,YAAY,SAAS,GAAG,OAAO,GAAG,SAAS;CACjD,MAAM,aAAa,SAAS,GAAG,OAAO,GAAG,eAAe;CAExD,MAAM,EAAE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AK;AACd,aAAE,gBAAgB;;qBAGpB,oBAAC;WAAK,WAAU;qBACb,gBACG,cAAc,KAAK,GACnB,OAAO;YACN,EACN,OAAO,OAAO,MAAM,KAAK,MACxB,oBAAC,SAAM,WAAU,6BAA6B;YAZ3C,KAAK,GAcP,CACL;SAED,SACC,oBAAC;UACC,WAAW,GACT,6TACD;UACD,cAAc,MAAM;AAClB,aAAE,gBAAgB;AAClB,2BAAgB;;oBAGlB,oBAAC;WAAK,WAAU;qBAAgB;YAAa;WAC1C;UAGL,MAAM,WAAW,KAAK,CAAC,SAAS,CAAC,SACjC,oBAAC;UAAE,WAAU;oBAAqD;WAE9D;;SAEH;QACc,EACrB,oBAAC,cAAY;OACF;MACE;;IACT;GACD"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from "./utils-C0f9Ma6r.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/components/ui/label.tsx
|
|
7
|
-
function Label({ className
|
|
7
|
+
function Label({ className,...props }) {
|
|
8
8
|
return /* @__PURE__ */ jsx(LabelPrimitive.Root, {
|
|
9
9
|
className: cn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
|
|
10
10
|
"data-slot": "label",
|
|
@@ -13,5 +13,5 @@ function Label({ className, ...props }) {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
//#endregion
|
|
16
|
-
export { Label
|
|
17
|
-
//# sourceMappingURL=label-
|
|
16
|
+
export { Label };
|
|
17
|
+
//# sourceMappingURL=label-BqtcCyMj.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label-BqtcCyMj.js","names":[],"sources":["../src/components/ui/label.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport * as LabelPrimitive from '@radix-ui/react-label';\n\nimport { cn } from '@/lib/utils';\n\nfunction Label({\n className,\n ...props\n}: React.ComponentProps<typeof LabelPrimitive.Root>) {\n return (\n <LabelPrimitive.Root\n className={cn(\n 'flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',\n className\n )}\n data-slot=\"label\"\n {...props}\n />\n );\n}\n\nexport { Label };\n"],"mappings":";;;;;;AAQA,SAAS,MAAM,EACb,UACA,GAAG,SACgD;AACnD,QACE,oBAAC,eAAe;EACd,WAAW,GACT,uNACA,UACD;EACD,aAAU;EACV,GAAI;GACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/components/page-header/page-header.d.ts
|
|
4
4
|
interface PageHeaderProps {
|
|
@@ -10,7 +10,7 @@ declare function PageHeader({
|
|
|
10
10
|
title,
|
|
11
11
|
help,
|
|
12
12
|
description
|
|
13
|
-
}: PageHeaderProps):
|
|
13
|
+
}: PageHeaderProps): react_jsx_runtime4.JSX.Element;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { PageHeader, type PageHeaderProps };
|
|
16
|
-
//# sourceMappingURL=page-header.d.
|
|
16
|
+
//# sourceMappingURL=page-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-header.d.ts","names":[],"sources":["../src/components/page-header/page-header.tsx"],"sourcesContent":[],"mappings":";;;UAEiB,eAAA;;;EAAA,WAAA,CAAA,EAAA,MAAe;AAI/B;iBAEQ,UAAA,CAAU;EAAA,KAAA;EAAA,IAAA;EAAA;AAAA,CAAA,EAIhB,eAJgB,CAAA,EAID,kBAAA,CAAA,GAAA,CAAA,OAJC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import "./utils-C0f9Ma6r.js";
|
|
5
|
+
import "./label-BqtcCyMj.js";
|
|
6
|
+
import { InputHelp } from "./input-help-etTqPzYc.js";
|
|
4
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
8
|
|
|
6
9
|
//#region src/components/page-header/page-header.tsx
|
|
@@ -22,4 +25,4 @@ function PageHeader({ title, help, description }) {
|
|
|
22
25
|
|
|
23
26
|
//#endregion
|
|
24
27
|
export { PageHeader };
|
|
25
|
-
//# sourceMappingURL=page-header.
|
|
28
|
+
//# sourceMappingURL=page-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-header.js","names":[],"sources":["../src/components/page-header/page-header.tsx"],"sourcesContent":["import { InputHelp } from \"../ui/input-help\";\n\nexport interface PageHeaderProps {\n title: string;\n help?: string;\n description?: string;\n}\n\nfunction PageHeader({\n title,\n help,\n description,\n}: PageHeaderProps) {\n return (\n <div className=\"flex flex-col mb-10\">\n <div className=\"flex items-start gap-2\">\n <h1 className=\"text-2xl font-bold\">{title}</h1>\n {help && <InputHelp help={help} />}\n </div>\n {description && (\n <p className=\"text-sm text-muted-foreground\">{description}</p>\n )}\n </div>\n );\n}\n\nexport { PageHeader };\n"],"mappings":";;;;;;;;;AAQA,SAAS,WAAW,EAClB,OACA,MACA,eACkB;AAClB,QACE,qBAAC;EAAI,WAAU;aACb,qBAAC;GAAI,WAAU;cACb,oBAAC;IAAG,WAAU;cAAsB;KAAW,EAC9C,QAAQ,oBAAC,aAAgB,OAAQ;IAC9B,EACL,eACC,oBAAC;GAAE,WAAU;aAAiC;IAAgB;GAE5D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FieldPath, FieldPathValue, FieldValues, UseControllerProps } from "react-hook-form";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
3
3
|
import { Options } from "nuqs";
|
|
4
4
|
import { PopoverProps } from "@radix-ui/react-popover";
|
|
5
5
|
|
|
@@ -63,7 +63,7 @@ declare function RemoteSelectorField<T, TFieldValues extends FieldValues = Field
|
|
|
63
63
|
initialRequest,
|
|
64
64
|
forceToggle,
|
|
65
65
|
...props
|
|
66
|
-
}: RemoteSelectorFieldProps<TFieldValues, TFieldName> & BaseRemoteSelectorProps<T>):
|
|
66
|
+
}: RemoteSelectorFieldProps<TFieldValues, TFieldName> & BaseRemoteSelectorProps<T>): react_jsx_runtime5.JSX.Element;
|
|
67
67
|
interface RemoteSelectorQueryProps<T> extends BaseRemoteSelectorProps<T> {
|
|
68
68
|
name: string;
|
|
69
69
|
defaultValue?: string;
|
|
@@ -83,7 +83,7 @@ declare function RemoteSelectorQuery<T>({
|
|
|
83
83
|
fieldLabel,
|
|
84
84
|
type,
|
|
85
85
|
...props
|
|
86
|
-
}: RemoteSelectorQueryProps<T>):
|
|
86
|
+
}: RemoteSelectorQueryProps<T>): react_jsx_runtime5.JSX.Element;
|
|
87
87
|
//#endregion
|
|
88
88
|
export { type BaseRemoteSelectorProps, RemoteSelectorField as RemoteSelector, RemoteSelectorField, type RemoteSelectorFieldProps, RemoteSelectorQuery, type RemoteSelectorQueryProps, type TUseData };
|
|
89
|
-
//# sourceMappingURL=remote-selector.d.
|
|
89
|
+
//# sourceMappingURL=remote-selector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-selector.d.ts","names":[],"sources":["../src/components/ui/selector.tsx","../src/components/remote-selector/remote-selector.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAgCyB,KAAb,aAAa,CAAA,CAAA,CAAA,GAAA;MAEf,CAAA,EAAA,QAAA,GAAA,UAAA;OAAI,CAAA,EAAJ,CAAI,GAAA,CAAA,EAAA;UACM,CAAA,EAAA,CAAA,IAAA,EAAA,CAAA,GAAI,CAAJ,EAAA,GAAA,SAAA,GAAA,IAAA,EAAA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|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
3
|
+
|
|
4
|
+
import { cn } from "./utils-C0f9Ma6r.js";
|
|
5
|
+
import "./label-BqtcCyMj.js";
|
|
6
|
+
import { FormItem, FormMessage, InputHelp } from "./input-help-etTqPzYc.js";
|
|
7
|
+
import { Popover, PopoverContent, PopoverTrigger, ScrollBar } from "./scroll-area-C2WadzN5.js";
|
|
6
8
|
import { useController, useFormContext } from "react-hook-form";
|
|
7
9
|
import * as React from "react";
|
|
8
10
|
import { createElement, useEffect, useId, useMemo, useState } from "react";
|
|
@@ -28,7 +30,7 @@ const badgeVariants = cva("inline-flex items-center rounded-full border px-2.5 p
|
|
|
28
30
|
} },
|
|
29
31
|
defaultVariants: { variant: "default" }
|
|
30
32
|
});
|
|
31
|
-
function Badge({ className, variant
|
|
33
|
+
function Badge({ className, variant,...props }) {
|
|
32
34
|
return /* @__PURE__ */ jsx("div", {
|
|
33
35
|
className: cn(badgeVariants({ variant }), className),
|
|
34
36
|
...props
|
|
@@ -59,7 +61,7 @@ const buttonVariants = cva("inline-flex items-center justify-center gap-2 whites
|
|
|
59
61
|
size: "default"
|
|
60
62
|
}
|
|
61
63
|
});
|
|
62
|
-
function Button({ className, variant, size, asChild = false
|
|
64
|
+
function Button({ className, variant, size, asChild = false,...props }) {
|
|
63
65
|
return /* @__PURE__ */ jsx(asChild ? Slot : "button", {
|
|
64
66
|
className: cn(buttonVariants({
|
|
65
67
|
variant,
|
|
@@ -73,7 +75,7 @@ function Button({ className, variant, size, asChild = false, ...props }) {
|
|
|
73
75
|
|
|
74
76
|
//#endregion
|
|
75
77
|
//#region src/components/ui/checkbox.tsx
|
|
76
|
-
function Checkbox$1({ className, onCheckedChange
|
|
78
|
+
function Checkbox$1({ className, onCheckedChange,...props }) {
|
|
77
79
|
const [isChecked, setIsChecked] = React.useState(props?.checked ?? props?.defaultChecked ?? false);
|
|
78
80
|
React.useEffect(() => {
|
|
79
81
|
if (props?.checked !== void 0) setIsChecked(props.checked);
|
|
@@ -133,14 +135,14 @@ function Checkbox$1({ className, onCheckedChange, ...props }) {
|
|
|
133
135
|
|
|
134
136
|
//#endregion
|
|
135
137
|
//#region src/components/ui/command.tsx
|
|
136
|
-
function Command$1({ className
|
|
138
|
+
function Command$1({ className,...props }) {
|
|
137
139
|
return /* @__PURE__ */ jsx(Command, {
|
|
138
140
|
className: cn("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md", className),
|
|
139
141
|
"data-slot": "command",
|
|
140
142
|
...props
|
|
141
143
|
});
|
|
142
144
|
}
|
|
143
|
-
function CommandInput({ className
|
|
145
|
+
function CommandInput({ className,...props }) {
|
|
144
146
|
return /* @__PURE__ */ jsxs("div", {
|
|
145
147
|
className: "flex h-9 items-center gap-2 border-b px-3",
|
|
146
148
|
"data-slot": "command-input-wrapper",
|
|
@@ -151,7 +153,7 @@ function CommandInput({ className, ...props }) {
|
|
|
151
153
|
})]
|
|
152
154
|
});
|
|
153
155
|
}
|
|
154
|
-
function CommandList({ className
|
|
156
|
+
function CommandList({ className,...props }) {
|
|
155
157
|
return /* @__PURE__ */ jsx(Command.List, {
|
|
156
158
|
className: cn("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", className),
|
|
157
159
|
"data-slot": "command-list",
|
|
@@ -165,14 +167,14 @@ function CommandEmpty({ ...props }) {
|
|
|
165
167
|
...props
|
|
166
168
|
});
|
|
167
169
|
}
|
|
168
|
-
function CommandGroup({ className
|
|
170
|
+
function CommandGroup({ className,...props }) {
|
|
169
171
|
return /* @__PURE__ */ jsx(Command.Group, {
|
|
170
172
|
className: cn("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium", className),
|
|
171
173
|
"data-slot": "command-group",
|
|
172
174
|
...props
|
|
173
175
|
});
|
|
174
176
|
}
|
|
175
|
-
function CommandItem({ className
|
|
177
|
+
function CommandItem({ className,...props }) {
|
|
176
178
|
return /* @__PURE__ */ jsx(Command.Item, {
|
|
177
179
|
className: cn("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
178
180
|
"data-slot": "command-item",
|
|
@@ -182,7 +184,7 @@ function CommandItem({ className, ...props }) {
|
|
|
182
184
|
|
|
183
185
|
//#endregion
|
|
184
186
|
//#region src/components/ui/selector.tsx
|
|
185
|
-
function Selector({ type = "single", value, onChange, search, onSearch, items, label, placeholder, fieldLabel, fieldKey, groupBy, searchPlaceholder, name, empty = "Nenhuma opção encontrada...", disabled = false, className, required, error, selectFirstIsOne, help, extra, extraOnClick, open, setOpen, maxVisibleBadges = 3, id
|
|
187
|
+
function Selector({ type = "single", value, onChange, search, onSearch, items, label, placeholder, fieldLabel, fieldKey, groupBy, searchPlaceholder, name, empty = "Nenhuma opção encontrada...", disabled = false, className, required, error, selectFirstIsOne, help, extra, extraOnClick, open, setOpen, maxVisibleBadges = 3, id,...props }) {
|
|
186
188
|
const itemKey = fieldKey || fieldLabel;
|
|
187
189
|
const isMultiple = type === "multiple";
|
|
188
190
|
const selectedItems = isMultiple && Array.isArray(value) ? value : [];
|
|
@@ -208,9 +210,10 @@ function Selector({ type = "single", value, onChange, search, onSearch, items, l
|
|
|
208
210
|
selectedGroups: [],
|
|
209
211
|
unselectedGroups: buildGroups(items, groupBy)
|
|
210
212
|
};
|
|
213
|
+
const unselectedItems = items.filter((item) => !isItemSelected(item));
|
|
211
214
|
return {
|
|
212
215
|
selectedGroups: selectedItems,
|
|
213
|
-
unselectedGroups: buildGroups(
|
|
216
|
+
unselectedGroups: buildGroups(unselectedItems, groupBy)
|
|
214
217
|
};
|
|
215
218
|
}, [
|
|
216
219
|
groupBy,
|
|
@@ -367,7 +370,7 @@ const buildGroups = (items, groupBy) => {
|
|
|
367
370
|
|
|
368
371
|
//#endregion
|
|
369
372
|
//#region src/components/remote-selector/remote-selector.tsx
|
|
370
|
-
function RemoteSelectorField({ name, nameValue, className, required, defaultValue, onChange: onChangeCallback, useData, initialParams, initialRequest = false, forceToggle = false
|
|
373
|
+
function RemoteSelectorField({ name, nameValue, className, required, defaultValue, onChange: onChangeCallback, useData, initialParams, initialRequest = false, forceToggle = false,...props }) {
|
|
371
374
|
const { control, setValue } = useFormContext();
|
|
372
375
|
const { field, fieldState } = useController({
|
|
373
376
|
control,
|
|
@@ -408,7 +411,7 @@ function RemoteSelectorField({ name, nameValue, className, required, defaultValu
|
|
|
408
411
|
})
|
|
409
412
|
});
|
|
410
413
|
}
|
|
411
|
-
function RemoteSelectorQuery({ name, defaultValue, options, useData, initialParams, initialRequest = false, forceToggle = false, onChange: onChangeCallback, fieldKey, fieldLabel, type = "single"
|
|
414
|
+
function RemoteSelectorQuery({ name, defaultValue, options, useData, initialParams, initialRequest = false, forceToggle = false, onChange: onChangeCallback, fieldKey, fieldLabel, type = "single",...props }) {
|
|
412
415
|
const id = useId();
|
|
413
416
|
const [open, setOpen] = useState(false);
|
|
414
417
|
const [search, setSearch] = useState("");
|
|
@@ -419,7 +422,8 @@ function RemoteSelectorQuery({ name, defaultValue, options, useData, initialPara
|
|
|
419
422
|
}, [forceToggle]);
|
|
420
423
|
const itemKey = fieldKey || fieldLabel;
|
|
421
424
|
const isMultiple = type === "multiple";
|
|
422
|
-
const
|
|
425
|
+
const parser = isMultiple ? parseAsArrayOf(parseAsString).withDefault([]) : parseAsString.withDefault(defaultValue ?? "");
|
|
426
|
+
const [queryIds, setQueryIds] = useQueryState(name, parser.withOptions({
|
|
423
427
|
clearOnDefault: true,
|
|
424
428
|
shallow: false,
|
|
425
429
|
...options
|
|
@@ -450,4 +454,4 @@ function RemoteSelectorQuery({ name, defaultValue, options, useData, initialPara
|
|
|
450
454
|
|
|
451
455
|
//#endregion
|
|
452
456
|
export { RemoteSelectorField as RemoteSelector, RemoteSelectorField, RemoteSelectorQuery };
|
|
453
|
-
//# sourceMappingURL=remote-selector.
|
|
457
|
+
//# sourceMappingURL=remote-selector.js.map
|