@powerhousedao/design-system 6.2.0-dev.5 → 6.2.0-dev.50
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/{command-tFzjgzge.d.ts → command-By1kGfcI.d.ts} +15 -15
- package/dist/command-By1kGfcI.d.ts.map +1 -0
- package/dist/connect/components/toast/toast.d.ts.map +1 -1
- package/dist/connect/components/toast/toast.js +5 -5
- package/dist/connect/components/toast/toast.js.map +1 -1
- package/dist/connect/index.d.ts +49 -4
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +810 -612
- package/dist/connect/index.js.map +1 -1
- package/dist/{enum-field-CwZVs3Ux.d.ts → enum-field-Cct-i2Uz.d.ts} +3 -3
- package/dist/{enum-field-CwZVs3Ux.d.ts.map → enum-field-Cct-i2Uz.d.ts.map} +1 -1
- package/dist/id-autocomplete-list-option-CB5B07Hi.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/json-viewer-DaTgmzkS.d.ts.map +1 -1
- package/dist/{radio-group-field-wlqeiLN3.d.ts → radio-group-field-BN654-SO.d.ts} +2 -2
- package/dist/{radio-group-field-wlqeiLN3.d.ts.map → radio-group-field-BN654-SO.d.ts.map} +1 -1
- package/dist/{src-BrrPQVce.js → src-CfIIbIOi.js} +11 -11
- package/dist/src-CfIIbIOi.js.map +1 -0
- package/dist/style.css +79 -16
- package/dist/ui/components/button/button.js +1 -1
- package/dist/ui/components/button/button.js.map +1 -1
- package/dist/ui/components/character-counter/character-counter.js +6 -6
- package/dist/ui/components/character-counter/character-counter.js.map +1 -1
- package/dist/ui/components/checkbox/checkbox-base.js +1 -1
- package/dist/ui/components/checkbox/checkbox-base.js.map +1 -1
- package/dist/ui/components/checkbox/checkbox.js +1 -1
- package/dist/ui/components/checkbox/checkbox.js.map +1 -1
- package/dist/ui/components/command/command.d.ts +1 -1
- package/dist/ui/components/command/command.js +5 -5
- package/dist/ui/components/command/command.js.map +1 -1
- package/dist/ui/components/enum-field/enum-field.d.ts +1 -1
- package/dist/ui/components/form-description/form-description.js +1 -1
- package/dist/ui/components/form-description/form-description.js.map +1 -1
- package/dist/ui/components/form-label/form-label.js +3 -3
- package/dist/ui/components/form-label/form-label.js.map +1 -1
- package/dist/ui/components/form-message/form-message.js +3 -3
- package/dist/ui/components/form-message/form-message.js.map +1 -1
- package/dist/ui/components/form-message/message-list.js +3 -3
- package/dist/ui/components/form-message/message-list.js.map +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-input-container.js +3 -3
- package/dist/ui/components/id-autocomplete/id-autocomplete-input-container.js.map +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list-option.js +10 -10
- package/dist/ui/components/id-autocomplete/id-autocomplete-list-option.js.map +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list.js +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list.js.map +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete.js +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete.js.map +1 -1
- package/dist/ui/components/index.d.ts +3 -3
- package/dist/ui/components/input/input.js +1 -1
- package/dist/ui/components/input/input.js.map +1 -1
- package/dist/ui/components/input/splitted-input-diff.js +2 -2
- package/dist/ui/components/input/splitted-input-diff.js.map +1 -1
- package/dist/ui/components/input/subcomponent/input-diff.js +1 -1
- package/dist/ui/components/input/subcomponent/input-diff.js.map +1 -1
- package/dist/ui/components/input/subcomponent/text-diff.js +3 -3
- package/dist/ui/components/input/subcomponent/text-diff.js.map +1 -1
- package/dist/ui/components/json-viewer/json-viewer.js +6 -5
- package/dist/ui/components/json-viewer/json-viewer.js.map +1 -1
- package/dist/ui/components/popover/popover.js +1 -1
- package/dist/ui/components/popover/popover.js.map +1 -1
- package/dist/ui/components/radio-group-field/radio-group-field.d.ts +1 -1
- package/dist/ui/components/radio-group-field/radio.js +3 -3
- package/dist/ui/components/radio-group-field/radio.js.map +1 -1
- package/dist/ui/components/search-autocomplete/search-autocomplete.js +13 -13
- package/dist/ui/components/search-autocomplete/search-autocomplete.js.map +1 -1
- package/dist/ui/components/select-field/content.js +8 -8
- package/dist/ui/components/select-field/content.js.map +1 -1
- package/dist/ui/components/select-field/select-field.js +1 -1
- package/dist/ui/components/select-field/select-field.js.map +1 -1
- package/dist/ui/components/select-field/selected-content.js +7 -7
- package/dist/ui/components/select-field/selected-content.js.map +1 -1
- package/dist/ui/components/select-field/subcomponents/CommandItemList.d.ts.map +1 -1
- package/dist/ui/components/select-field/subcomponents/CommandItemList.js +9 -9
- package/dist/ui/components/select-field/subcomponents/CommandItemList.js.map +1 -1
- package/dist/ui/components/sidebar/sidebar.js +5 -5
- package/dist/ui/components/sidebar/sidebar.js.map +1 -1
- package/dist/ui/components/sidebar/subcomponents/sidebar-content-area.js +1 -1
- package/dist/ui/components/sidebar/subcomponents/sidebar-content-area.js.map +1 -1
- package/dist/ui/components/sidebar/subcomponents/sidebar-header.js +3 -3
- package/dist/ui/components/sidebar/subcomponents/sidebar-header.js.map +1 -1
- package/dist/ui/components/sidebar/subcomponents/sidebar-item.js +7 -7
- package/dist/ui/components/sidebar/subcomponents/sidebar-item.js.map +1 -1
- package/dist/ui/components/sidebar/subcomponents/sidebar-pinning-area.js +1 -1
- package/dist/ui/components/sidebar/subcomponents/sidebar-pinning-area.js.map +1 -1
- package/dist/ui/components/sidebar/subcomponents/sidebar-search/search-navigation-arrow.js +1 -1
- package/dist/ui/components/sidebar/subcomponents/sidebar-search/search-navigation-arrow.js.map +1 -1
- package/dist/ui/components/sidebar/subcomponents/sidebar-search/search-result-counter.js +4 -4
- package/dist/ui/components/sidebar/subcomponents/sidebar-search/search-result-counter.js.map +1 -1
- package/dist/ui/components/sidebar/subcomponents/sidebar-search/sidebar-search.js +5 -5
- package/dist/ui/components/sidebar/subcomponents/sidebar-search/sidebar-search.js.map +1 -1
- package/dist/ui/components/sidebar/subcomponents/sidebar-skeleton-item.js +2 -2
- package/dist/ui/components/sidebar/subcomponents/sidebar-skeleton-item.js.map +1 -1
- package/dist/ui/components/sidebar/subcomponents/status-icon.d.ts +1 -1
- package/dist/ui/components/sidebar/subcomponents/status-icon.d.ts.map +1 -1
- package/dist/ui/components/sidebar/subcomponents/status-icon.js +6 -6
- package/dist/ui/components/sidebar/subcomponents/status-icon.js.map +1 -1
- package/dist/ui/components/tooltip/tooltip.js +1 -1
- package/dist/ui/components/tooltip/tooltip.js.map +1 -1
- package/dist/ui/index.d.ts +3 -3
- package/package.json +23 -8
- package/theme.css +145 -17
- package/dist/command-tFzjgzge.d.ts.map +0 -1
- package/dist/src-BrrPQVce.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","names":["React","twMerge","inputBaseStyles","Input","forwardRef","className","type","props","ref","displayName"],"sources":["../../../../src/ui/components/input/input.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport type InputProps = React.InputHTMLAttributes<HTMLInputElement>;\n\nconst inputBaseStyles = twMerge(\n // Base styles\n \"flex h-9 w-full rounded-md text-sm/5 font-normal text-
|
|
1
|
+
{"version":3,"file":"input.js","names":["React","twMerge","inputBaseStyles","Input","forwardRef","className","type","props","ref","displayName"],"sources":["../../../../src/ui/components/input/input.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport type InputProps = React.InputHTMLAttributes<HTMLInputElement>;\n\nconst inputBaseStyles = twMerge(\n // Base styles\n \"flex h-9 w-full rounded-md text-sm/5 font-normal text-foreground\",\n // Border & Background\n \"border border-border bg-background\",\n // Padding\n \"px-3 py-2\",\n // Placeholder\n \"font-sans placeholder:text-muted-foreground disabled:disabled-effect\",\n // Focus styles\n \"focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-0 focus-visible:ring-offset-white focus-visible:outline-none\",\n \"focus:bg-background focus-visible:ring-offset-background\",\n // Disabled state\n \"disabled:disabled-effect\",\n \"disabled:disabled-effect\",\n);\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({ className, type, ...props }, ref) => {\n return (\n <input\n type={type}\n className={twMerge(inputBaseStyles, className)}\n ref={ref}\n {...props}\n />\n );\n },\n);\n\nInput.displayName = \"Input\";\n\nexport { Input };\n"],"mappings":";;;;AAKA,MAAME,kBAAkBD,QAEtB,oEAEA,sCAEA,aAEA,wEAEA,uIACA,4DAEA,4BACA,2BACD;AAED,MAAME,QAAQH,wBAAMI,YACjB,EAAEC,WAAWC,MAAM,GAAGC,SAASC,QAAQ;AACtC,QACE,oBAAC,SAAD;EACQF;EACN,WAAWL,QAAQC,iBAAiBG,UAAU;EACzCG;EACL,GAAID;EACJ,CAAA;EAGP;AAEDJ,MAAMM,cAAc"}
|
|
@@ -26,7 +26,7 @@ const CopyIcon = ({ value, hasCopied, setHasCopied, hasHover }) => {
|
|
|
26
26
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
27
27
|
name: "Copy",
|
|
28
28
|
size: 16,
|
|
29
|
-
className: twMerge("text-
|
|
29
|
+
className: twMerge("text-muted-foreground")
|
|
30
30
|
})
|
|
31
31
|
})
|
|
32
32
|
}) });
|
|
@@ -53,7 +53,7 @@ const SplittedInputDiff = ({ baseValue, value, viewMode, diffMode, showCopyIcon
|
|
|
53
53
|
hasHover
|
|
54
54
|
})]
|
|
55
55
|
}),
|
|
56
|
-
/* @__PURE__ */ jsx("div", { className: twMerge("mx-3 h-[34px] w-px bg-
|
|
56
|
+
/* @__PURE__ */ jsx("div", { className: twMerge("mx-3 h-[34px] w-px bg-secondary") }),
|
|
57
57
|
/* @__PURE__ */ jsxs("div", {
|
|
58
58
|
className: twMerge("flex flex-1 items-center gap-2 truncate [&>span]:truncate"),
|
|
59
59
|
children: [/* @__PURE__ */ jsx(TextDiff, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"splitted-input-diff.js","names":["Icon","twMerge","useCallback","useState","useMediaQuery","Tooltip","TooltipProvider","InputDiff","TextDiff","CopyIcon","value","hasCopied","setHasCopied","hasHover","copy","navigator","clipboard","writeText","then","setTimeout","catch","error","console","SplittedInputDiff","baseValue","viewMode","diffMode","showCopyIcon","hasCopiedLeft","setHasCopiedLeft","hasCopiedRight","setHasCopiedRight","undefined"],"sources":["../../../../src/ui/components/input/splitted-input-diff.tsx"],"sourcesContent":["import { Icon } from \"#design-system\";\nimport { twMerge } from \"tailwind-merge\";\nimport { useCallback, useState } from \"react\";\nimport { useMediaQuery } from \"usehooks-ts\";\nimport type { WithDifference } from \"../../types.js\";\nimport { Tooltip, TooltipProvider } from \"../tooltip/tooltip.js\";\nimport { InputDiff } from \"./subcomponent/input-diff.js\";\nimport { TextDiff } from \"./subcomponent/text-diff.js\";\ninterface CopyIconProps {\n value: string;\n hasCopied: boolean;\n setHasCopied: (hasCopied: boolean) => void;\n hasHover: boolean;\n}\n\nconst CopyIcon = ({\n value,\n hasCopied,\n setHasCopied,\n hasHover,\n}: CopyIconProps) => {\n const copy = useCallback(() => {\n navigator.clipboard\n .writeText(value)\n .then(() => {\n setHasCopied(true);\n setTimeout(() => setHasCopied(false), 2000);\n })\n .catch((error: unknown) => {\n console.error(\"Failed to copy value: \", error);\n });\n }, [value, setHasCopied]);\n\n return (\n <TooltipProvider>\n <Tooltip content=\"Copied!\" open={hasCopied} triggerAsChild>\n <button\n type=\"button\"\n onClick={copy}\n className={twMerge(\n \"focus-visible:outline-none [&_svg]:pointer-events-none\",\n hasHover &&\n \"opacity-0 transition-opacity duration-500 group-hover:opacity-100\",\n )}\n >\n <Icon\n name=\"Copy\"\n size={16}\n className={twMerge(\"text-
|
|
1
|
+
{"version":3,"file":"splitted-input-diff.js","names":["Icon","twMerge","useCallback","useState","useMediaQuery","Tooltip","TooltipProvider","InputDiff","TextDiff","CopyIcon","value","hasCopied","setHasCopied","hasHover","copy","navigator","clipboard","writeText","then","setTimeout","catch","error","console","SplittedInputDiff","baseValue","viewMode","diffMode","showCopyIcon","hasCopiedLeft","setHasCopiedLeft","hasCopiedRight","setHasCopiedRight","undefined"],"sources":["../../../../src/ui/components/input/splitted-input-diff.tsx"],"sourcesContent":["import { Icon } from \"#design-system\";\nimport { twMerge } from \"tailwind-merge\";\nimport { useCallback, useState } from \"react\";\nimport { useMediaQuery } from \"usehooks-ts\";\nimport type { WithDifference } from \"../../types.js\";\nimport { Tooltip, TooltipProvider } from \"../tooltip/tooltip.js\";\nimport { InputDiff } from \"./subcomponent/input-diff.js\";\nimport { TextDiff } from \"./subcomponent/text-diff.js\";\ninterface CopyIconProps {\n value: string;\n hasCopied: boolean;\n setHasCopied: (hasCopied: boolean) => void;\n hasHover: boolean;\n}\n\nconst CopyIcon = ({\n value,\n hasCopied,\n setHasCopied,\n hasHover,\n}: CopyIconProps) => {\n const copy = useCallback(() => {\n navigator.clipboard\n .writeText(value)\n .then(() => {\n setHasCopied(true);\n setTimeout(() => setHasCopied(false), 2000);\n })\n .catch((error: unknown) => {\n console.error(\"Failed to copy value: \", error);\n });\n }, [value, setHasCopied]);\n\n return (\n <TooltipProvider>\n <Tooltip content=\"Copied!\" open={hasCopied} triggerAsChild>\n <button\n type=\"button\"\n onClick={copy}\n className={twMerge(\n \"focus-visible:outline-none [&_svg]:pointer-events-none\",\n hasHover &&\n \"opacity-0 transition-opacity duration-500 group-hover:opacity-100\",\n )}\n >\n <Icon\n name=\"Copy\"\n size={16}\n className={twMerge(\"text-muted-foreground\")}\n />\n </button>\n </Tooltip>\n </TooltipProvider>\n );\n};\n\ninterface SplittedInputDiffProps extends WithDifference<string> {\n value: string;\n showCopyIcon?: boolean;\n}\n\nexport const SplittedInputDiff = ({\n baseValue,\n value,\n viewMode,\n diffMode,\n showCopyIcon = false,\n}: SplittedInputDiffProps) => {\n const [hasCopiedLeft, setHasCopiedLeft] = useState(false);\n const [hasCopiedRight, setHasCopiedRight] = useState(false);\n const hasHover = useMediaQuery(\"(hover: hover) and (pointer: fine)\");\n\n return (\n <InputDiff className={twMerge(\"group\")}>\n {viewMode === \"mixed\" ? (\n <>\n <div\n className={twMerge(\n \"flex flex-1 items-center gap-2 truncate [&>span]:truncate\",\n )}\n >\n <TextDiff\n baseValue={baseValue}\n value={value}\n viewMode=\"removal\"\n diffMode={diffMode}\n className={twMerge(\"flex-1\")}\n />\n {showCopyIcon && baseValue !== undefined && baseValue !== \"\" && (\n <CopyIcon\n value={baseValue}\n hasCopied={hasCopiedLeft}\n setHasCopied={setHasCopiedLeft}\n hasHover={hasHover}\n />\n )}\n </div>\n <div className={twMerge(\"mx-3 h-[34px] w-px bg-secondary\")} />\n <div\n className={twMerge(\n \"flex flex-1 items-center gap-2 truncate [&>span]:truncate\",\n )}\n >\n <TextDiff\n baseValue={baseValue}\n value={value}\n viewMode=\"addition\"\n diffMode={diffMode}\n className={twMerge(\"flex-1\")}\n />\n {showCopyIcon && value !== \"\" && (\n <CopyIcon\n value={value}\n hasCopied={hasCopiedRight}\n setHasCopied={setHasCopiedRight}\n hasHover={hasHover}\n />\n )}\n </div>\n </>\n ) : (\n <div\n className={twMerge(\n \"flex flex-1 items-center gap-2 truncate [&>span]:truncate\",\n )}\n >\n <TextDiff\n baseValue={baseValue}\n value={value}\n viewMode={viewMode}\n diffMode={diffMode}\n className={twMerge(\"flex-1\")}\n />\n {showCopyIcon &&\n ((viewMode === \"removal\" &&\n baseValue !== undefined &&\n baseValue !== \"\") ||\n (viewMode === \"addition\" && value !== \"\")) && (\n <CopyIcon\n value={viewMode === \"removal\" ? (baseValue ?? \"\") : value}\n hasCopied={hasCopiedLeft}\n setHasCopied={setHasCopiedLeft}\n hasHover={hasHover}\n />\n )}\n </div>\n )}\n </InputDiff>\n );\n};\n"],"mappings":";;;;;;;;;AAeA,MAAMS,YAAY,EAChBC,OACAC,WACAC,cACAC,eACmB;AAanB,QACE,oBAAC,UAAD,EAAA,UACE,oBAAC,SAAD;EAAS,SAAQ;EAAU,MAAMF;EAAW,gBAAA;YAC1C,oBAAC,UAAD;GACE,MAAK;GACL,SAjBKT,kBAAkB;AAC7Ba,cAAUC,UACPC,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qBAAC,OAAD;GACE,WAAWZ,QACT,4DACD;aAHH,CAKE,oBAAC,UAAD;IACauB;IACJd;IACGe;IACAC;IACV,WAAWzB,QAAQ,SAAS;IAAC,CAAA,EAE9B0B,iBACGF,aAAa,aACbD,cAAcQ,KAAAA,KACdR,cAAc,MACbC,aAAa,cAAcf,UAAU,OACtC,oBAAC,UAAD;IACE,OAAOe,aAAa,YAAaD,aAAa,KAAMd;IACpD,WAAWkB;IACX,cAAcC;IACJhB;IAEb,CAAA,CAEN;;EACS,CAAA"}
|
|
@@ -3,7 +3,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
//#region src/ui/components/input/subcomponent/input-diff.tsx
|
|
4
4
|
const InputDiff = ({ children, className, ellipsis = true, multiline = false, rows = 3, hasPadding = false }) => {
|
|
5
5
|
return /* @__PURE__ */ jsx("div", {
|
|
6
|
-
className: twMerge("flex w-full items-center rounded-md font-sans text-sm/5 font-normal text-
|
|
6
|
+
className: twMerge("flex w-full items-center rounded-md font-sans text-sm/5 font-normal text-foreground", "cursor-not-allowed border border-border bg-transparent px-3", !multiline && ellipsis && "truncate [&>span]:truncate", hasPadding && "items-start py-2", className),
|
|
7
7
|
style: { minHeight: multiline ? `${rows * 1.5}rem` : "2.25rem" },
|
|
8
8
|
children
|
|
9
9
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-diff.js","names":["twMerge","InputDiff","children","className","ellipsis","multiline","rows","hasPadding","minHeight"],"sources":["../../../../../src/ui/components/input/subcomponent/input-diff.tsx"],"sourcesContent":["import { twMerge } from \"tailwind-merge\";\n\ninterface InputDiffProps {\n children: React.ReactNode;\n className?: string;\n ellipsis?: boolean;\n multiline?: boolean;\n rows?: number;\n hasPadding?: boolean;\n}\n\nexport const InputDiff = ({\n children,\n className,\n ellipsis = true,\n multiline = false,\n rows = 3,\n hasPadding = false,\n}: InputDiffProps) => {\n return (\n <div\n className={twMerge(\n \"flex w-full items-center rounded-md font-sans text-sm/5 font-normal text-
|
|
1
|
+
{"version":3,"file":"input-diff.js","names":["twMerge","InputDiff","children","className","ellipsis","multiline","rows","hasPadding","minHeight"],"sources":["../../../../../src/ui/components/input/subcomponent/input-diff.tsx"],"sourcesContent":["import { twMerge } from \"tailwind-merge\";\n\ninterface InputDiffProps {\n children: React.ReactNode;\n className?: string;\n ellipsis?: boolean;\n multiline?: boolean;\n rows?: number;\n hasPadding?: boolean;\n}\n\nexport const InputDiff = ({\n children,\n className,\n ellipsis = true,\n multiline = false,\n rows = 3,\n hasPadding = false,\n}: InputDiffProps) => {\n return (\n <div\n className={twMerge(\n \"flex w-full items-center rounded-md font-sans text-sm/5 font-normal text-foreground\",\n \"cursor-not-allowed border border-border bg-transparent px-3\",\n !multiline && ellipsis && \"truncate [&>span]:truncate\",\n hasPadding && \"items-start py-2\",\n className,\n )}\n style={{\n minHeight: multiline ? `${rows * 1.5}rem` : \"2.25rem\",\n }}\n >\n {children}\n </div>\n );\n};\n"],"mappings":";;;AAWA,MAAaC,aAAa,EACxBC,UACAC,WACAC,WAAW,MACXC,YAAY,OACZC,OAAO,GACPC,aAAa,YACO;AACpB,QACE,oBAAC,OAAD;EACE,WAAWP,QACT,uFACA,+DACA,CAACK,aAAaD,YAAY,8BAC1BG,cAAc,oBACdJ,UACD;EACD,OAAO,EACLK,WAAWH,YAAY,GAAGC,OAAO,IAAG,OAAQ,WAC7C;EAEAJ;EACG,CAAA"}
|
|
@@ -15,13 +15,13 @@ const TextDiff = ({ baseValue, value, viewMode, diffMode = "words", className, c
|
|
|
15
15
|
return wordsDiff.some((word) => word.added || word.removed);
|
|
16
16
|
}, [wordsDiff]);
|
|
17
17
|
return /* @__PURE__ */ jsx("span", {
|
|
18
|
-
className: twMerge("leading-[18px] text-
|
|
18
|
+
className: twMerge("leading-[18px] text-foreground", diffMode === "sentences" && hasChanges ? viewMode === "addition" ? "bg-success/10" : viewMode === "removal" ? "bg-destructive/10" : void 0 : void 0, className),
|
|
19
19
|
children: wordsDiff.map((word, index) => {
|
|
20
20
|
return word.added ? viewMode === "addition" || viewMode === "mixed" ? /* @__PURE__ */ jsx("span", {
|
|
21
|
-
className: twMerge((diffMode === "words" || viewMode === "mixed") && "bg-
|
|
21
|
+
className: twMerge((diffMode === "words" || viewMode === "mixed") && "bg-success/10", childrenClassName),
|
|
22
22
|
children: word.value
|
|
23
23
|
}, `${word.value}-${index}`) : null : word.removed ? viewMode === "removal" || viewMode === "mixed" ? /* @__PURE__ */ jsx("span", {
|
|
24
|
-
className: twMerge((diffMode === "words" || viewMode === "mixed") && "bg-
|
|
24
|
+
className: twMerge((diffMode === "words" || viewMode === "mixed") && "bg-destructive/10", childrenClassName),
|
|
25
25
|
children: word.value
|
|
26
26
|
}, `${word.value}-${index}`) : null : /* @__PURE__ */ jsx("span", {
|
|
27
27
|
className: twMerge(childrenClassName),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-diff.js","names":["twMerge","diffSentences","diffWords","useMemo","TextDiff","baseValue","value","viewMode","diffMode","className","childrenClassName","wordsDiff","hasChanges","some","word","added","removed","bgColor","undefined","map","index"],"sources":["../../../../../src/ui/components/input/subcomponent/text-diff.tsx"],"sourcesContent":["import type { WithDifference } from \"#design-system\";\nimport { twMerge } from \"tailwind-merge\";\nimport { diffSentences, diffWords } from \"diff\";\nimport { useMemo } from \"react\";\n\ninterface TextDiffProps extends WithDifference<string> {\n value: string;\n className?: string;\n childrenClassName?: string;\n}\n\nexport const TextDiff = ({\n baseValue,\n value,\n viewMode,\n diffMode = \"words\",\n className,\n childrenClassName,\n}: TextDiffProps) => {\n const wordsDiff = useMemo(() => {\n return diffMode === \"words\"\n ? diffWords(baseValue ?? \"\", value)\n : diffSentences(baseValue ?? \"\", value);\n }, [baseValue, value, diffMode]);\n\n const hasChanges = useMemo(() => {\n return wordsDiff.some((word) => word.added || word.removed);\n }, [wordsDiff]);\n\n const bgColor =\n diffMode === \"sentences\" && hasChanges\n ? viewMode === \"addition\"\n ? \"bg-
|
|
1
|
+
{"version":3,"file":"text-diff.js","names":["twMerge","diffSentences","diffWords","useMemo","TextDiff","baseValue","value","viewMode","diffMode","className","childrenClassName","wordsDiff","hasChanges","some","word","added","removed","bgColor","undefined","map","index"],"sources":["../../../../../src/ui/components/input/subcomponent/text-diff.tsx"],"sourcesContent":["import type { WithDifference } from \"#design-system\";\nimport { twMerge } from \"tailwind-merge\";\nimport { diffSentences, diffWords } from \"diff\";\nimport { useMemo } from \"react\";\n\ninterface TextDiffProps extends WithDifference<string> {\n value: string;\n className?: string;\n childrenClassName?: string;\n}\n\nexport const TextDiff = ({\n baseValue,\n value,\n viewMode,\n diffMode = \"words\",\n className,\n childrenClassName,\n}: TextDiffProps) => {\n const wordsDiff = useMemo(() => {\n return diffMode === \"words\"\n ? diffWords(baseValue ?? \"\", value)\n : diffSentences(baseValue ?? \"\", value);\n }, [baseValue, value, diffMode]);\n\n const hasChanges = useMemo(() => {\n return wordsDiff.some((word) => word.added || word.removed);\n }, [wordsDiff]);\n\n const bgColor =\n diffMode === \"sentences\" && hasChanges\n ? viewMode === \"addition\"\n ? \"bg-success/10\"\n : viewMode === \"removal\"\n ? \"bg-destructive/10\"\n : undefined\n : undefined;\n\n return (\n <span\n className={twMerge(\"leading-[18px] text-foreground\", bgColor, className)}\n >\n {wordsDiff.map((word, index) => {\n return word.added ? (\n viewMode === \"addition\" || viewMode === \"mixed\" ? (\n <span\n className={twMerge(\n (diffMode === \"words\" || viewMode === \"mixed\") &&\n \"bg-success/10\",\n childrenClassName,\n )}\n key={`${word.value}-${index}`}\n >\n {word.value}\n </span>\n ) : null\n ) : word.removed ? (\n viewMode === \"removal\" || viewMode === \"mixed\" ? (\n <span\n className={twMerge(\n (diffMode === \"words\" || viewMode === \"mixed\") &&\n \"bg-destructive/10\",\n childrenClassName,\n )}\n key={`${word.value}-${index}`}\n >\n {word.value}\n </span>\n ) : null\n ) : (\n <span\n key={`${word.value}-${index}`}\n className={twMerge(childrenClassName)}\n >\n {word.value}\n </span>\n );\n })}\n </span>\n );\n};\n"],"mappings":";;;;;AAWA,MAAaI,YAAY,EACvBC,WACAC,OACAC,UACAC,WAAW,SACXC,WACAC,wBACmB;CACnB,MAAMC,YAAYR,cAAc;AAC9B,SAAOK,aAAa,UAChBN,UAAUG,aAAa,IAAIC,MAAM,GACjCL,cAAcI,aAAa,IAAIC,MAAM;IACxC;EAACD;EAAWC;EAAOE;EAAS,CAAC;CAEhC,MAAMI,aAAaT,cAAc;AAC/B,SAAOQ,UAAUE,MAAMC,SAASA,KAAKC,SAASD,KAAKE,QAAQ;IAC1D,CAACL,UAAU,CAAC;AAWf,QACE,oBAAC,QAAD;EACE,WAAWX,QAAQ,kCAVrBQ,aAAa,eAAeI,aACxBL,aAAa,aACX,kBACAA,aAAa,YACX,sBACAW,KAAAA,IACJA,KAAAA,GAI4DT,UAAU;YAEvEE,UAAUQ,KAAKL,MAAMM,UAAU;AAC9B,UAAON,KAAKC,QACVR,aAAa,cAAcA,aAAa,UACtC,oBAAC,QAAD;IACE,WAAWP,SACRQ,aAAa,WAAWD,aAAa,YACpC,iBACFG,kBACD;cAGAI,KAAKR;IACD,EAHA,GAAGQ,KAAKR,MAAK,GAAIc,QAGjB,GACL,OACFN,KAAKE,UACPT,aAAa,aAAaA,aAAa,UACrC,oBAAC,QAAD;IACE,WAAWP,SACRQ,aAAa,WAAWD,aAAa,YACpC,qBACFG,kBACD;cAGAI,KAAKR;IACD,EAHA,GAAGQ,KAAKR,MAAK,GAAIc,QAGjB,GACL,OAEJ,oBAAC,QAAD;IAEE,WAAWpB,QAAQU,kBAAkB;cAEpCI,KAAKR;IAET,EALQ,GAAGQ,KAAKR,MAAK,GAAIc,QAKzB;IACD;EACG,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Suspense, lazy } from "react";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
//#region src/ui/components/json-viewer/json-viewer.tsx
|
|
4
5
|
const styles = {
|
|
@@ -64,11 +65,11 @@ const _defaultStyles = {
|
|
|
64
65
|
};
|
|
65
66
|
const defaultStyles = {
|
|
66
67
|
..._defaultStyles,
|
|
67
|
-
container:
|
|
68
|
-
label:
|
|
69
|
-
punctuation:
|
|
70
|
-
collapseIcon:
|
|
71
|
-
stringValue:
|
|
68
|
+
container: twMerge(_defaultStyles.container, "bg-transparent!"),
|
|
69
|
+
label: twMerge(_defaultStyles.label, "text-muted-foreground!"),
|
|
70
|
+
punctuation: twMerge(_defaultStyles.punctuation, "font-semibold! text-foreground!"),
|
|
71
|
+
collapseIcon: twMerge(_defaultStyles.collapseIcon, "text-muted-foreground!"),
|
|
72
|
+
stringValue: twMerge(_defaultStyles.stringValue, "text-muted-foreground!")
|
|
72
73
|
};
|
|
73
74
|
const allExpanded = () => true;
|
|
74
75
|
const JsonView = /* @__PURE__ */ lazy(() => import("react-json-view-lite").then((m) => ({ default: m.JsonView })));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-viewer.js","names":["lazy","Suspense","styles","pointer","defaultAriaLables","collapseJson","expandJson","_defaultStyles","container","basicChildStyle","childFieldsContainer","label","clickableLabel","nullValue","undefinedValue","stringValue","booleanValue","numberValue","otherValue","punctuation","collapseIcon","expandIcon","collapsedContent","noQuotesForStringValues","quotesForFieldNames","ariaLables","stringifyStringValues","defaultStyles","allExpanded","JsonView","then","m","default","JsonViewer","props","shouldExpandNode","style"],"sources":["../../../../src/ui/components/json-viewer/json-viewer.tsx"],"sourcesContent":["import { lazy, Suspense } from \"react\";\nimport type { Props } from \"react-json-view-lite\";\n\n// copied from react-json-view-lite to allow lazy loading the component itself\nconst styles = {\n \"container-base\": \"_GzYRV\",\n \"punctuation-base\": \"_3eOF8\",\n pointer: \"_1MFti\",\n \"expander-base\": \"_f10Tu _1MFti\",\n \"expand-icon\": \"_1UmXx\",\n \"collapse-icon\": \"_1LId0\",\n \"collapsed-content-base\": \"_1pNG9 _1MFti\",\n \"container-light\": \"_2IvMF _GzYRV\",\n \"basic-element-style\": \"_2bkNM\",\n \"child-fields-container\": \"_1BXBN\",\n \"label-light\": \"_1MGIk\",\n \"clickable-label-light\": \"_2YKJg _1MGIk _1MFti\",\n \"punctuation-light\": \"_3uHL6 _3eOF8\",\n \"value-null-light\": \"_2T6PJ\",\n \"value-undefined-light\": \"_1Gho6\",\n \"value-string-light\": \"_vGjyY\",\n \"value-number-light\": \"_1bQdo\",\n \"value-boolean-light\": \"_3zQKs\",\n \"value-other-light\": \"_1xvuR\",\n \"collapse-icon-light\": \"_oLqym _f10Tu _1MFti _1LId0\",\n \"expand-icon-light\": \"_2AXVT _f10Tu _1MFti _1UmXx\",\n \"collapsed-content-light\": \"_2KJWg _1pNG9 _1MFti\",\n \"container-dark\": \"_11RoI _GzYRV\",\n \"expand-icon-dark\": \"_17H2C _f10Tu _1MFti _1UmXx\",\n \"collapse-icon-dark\": \"_3QHg2 _f10Tu _1MFti _1LId0\",\n \"collapsed-content-dark\": \"_3fDAz _1pNG9 _1MFti\",\n \"label-dark\": \"_2bSDX\",\n \"clickable-label-dark\": \"_1RQEj _2bSDX _1MFti\",\n \"punctuation-dark\": \"_gsbQL _3eOF8\",\n \"value-null-dark\": \"_LaAZe\",\n \"value-undefined-dark\": \"_GTKgm\",\n \"value-string-dark\": \"_Chy1W\",\n \"value-number-dark\": \"_2bveF\",\n \"value-boolean-dark\": \"_2vRm-\",\n \"value-other-dark\": \"_1prJR\",\n};\nconst defaultAriaLables = {\n collapseJson: \"collapse JSON\",\n expandJson: \"expand JSON\",\n};\nconst _defaultStyles = {\n container: styles[\"container-light\"],\n basicChildStyle: styles[\"basic-element-style\"],\n childFieldsContainer: styles[\"child-fields-container\"],\n label: styles[\"label-light\"],\n clickableLabel: styles[\"clickable-label-light\"],\n nullValue: styles[\"value-null-light\"],\n undefinedValue: styles[\"value-undefined-light\"],\n stringValue: styles[\"value-string-light\"],\n booleanValue: styles[\"value-boolean-light\"],\n numberValue: styles[\"value-number-light\"],\n otherValue: styles[\"value-other-light\"],\n punctuation: styles[\"punctuation-light\"],\n collapseIcon: styles[\"collapse-icon-light\"],\n expandIcon: styles[\"expand-icon-light\"],\n collapsedContent: styles[\"collapsed-content-light\"],\n noQuotesForStringValues: false,\n quotesForFieldNames: false,\n ariaLables: defaultAriaLables,\n stringifyStringValues: false,\n};\nconst defaultStyles = {\n ..._defaultStyles,\n container:
|
|
1
|
+
{"version":3,"file":"json-viewer.js","names":["lazy","Suspense","twMerge","styles","pointer","defaultAriaLables","collapseJson","expandJson","_defaultStyles","container","basicChildStyle","childFieldsContainer","label","clickableLabel","nullValue","undefinedValue","stringValue","booleanValue","numberValue","otherValue","punctuation","collapseIcon","expandIcon","collapsedContent","noQuotesForStringValues","quotesForFieldNames","ariaLables","stringifyStringValues","defaultStyles","allExpanded","JsonView","then","m","default","JsonViewer","props","shouldExpandNode","style"],"sources":["../../../../src/ui/components/json-viewer/json-viewer.tsx"],"sourcesContent":["import { lazy, Suspense } from \"react\";\nimport type { Props } from \"react-json-view-lite\";\nimport { twMerge } from \"tailwind-merge\";\n\n// copied from react-json-view-lite to allow lazy loading the component itself\nconst styles = {\n \"container-base\": \"_GzYRV\",\n \"punctuation-base\": \"_3eOF8\",\n pointer: \"_1MFti\",\n \"expander-base\": \"_f10Tu _1MFti\",\n \"expand-icon\": \"_1UmXx\",\n \"collapse-icon\": \"_1LId0\",\n \"collapsed-content-base\": \"_1pNG9 _1MFti\",\n \"container-light\": \"_2IvMF _GzYRV\",\n \"basic-element-style\": \"_2bkNM\",\n \"child-fields-container\": \"_1BXBN\",\n \"label-light\": \"_1MGIk\",\n \"clickable-label-light\": \"_2YKJg _1MGIk _1MFti\",\n \"punctuation-light\": \"_3uHL6 _3eOF8\",\n \"value-null-light\": \"_2T6PJ\",\n \"value-undefined-light\": \"_1Gho6\",\n \"value-string-light\": \"_vGjyY\",\n \"value-number-light\": \"_1bQdo\",\n \"value-boolean-light\": \"_3zQKs\",\n \"value-other-light\": \"_1xvuR\",\n \"collapse-icon-light\": \"_oLqym _f10Tu _1MFti _1LId0\",\n \"expand-icon-light\": \"_2AXVT _f10Tu _1MFti _1UmXx\",\n \"collapsed-content-light\": \"_2KJWg _1pNG9 _1MFti\",\n \"container-dark\": \"_11RoI _GzYRV\",\n \"expand-icon-dark\": \"_17H2C _f10Tu _1MFti _1UmXx\",\n \"collapse-icon-dark\": \"_3QHg2 _f10Tu _1MFti _1LId0\",\n \"collapsed-content-dark\": \"_3fDAz _1pNG9 _1MFti\",\n \"label-dark\": \"_2bSDX\",\n \"clickable-label-dark\": \"_1RQEj _2bSDX _1MFti\",\n \"punctuation-dark\": \"_gsbQL _3eOF8\",\n \"value-null-dark\": \"_LaAZe\",\n \"value-undefined-dark\": \"_GTKgm\",\n \"value-string-dark\": \"_Chy1W\",\n \"value-number-dark\": \"_2bveF\",\n \"value-boolean-dark\": \"_2vRm-\",\n \"value-other-dark\": \"_1prJR\",\n};\nconst defaultAriaLables = {\n collapseJson: \"collapse JSON\",\n expandJson: \"expand JSON\",\n};\nconst _defaultStyles = {\n container: styles[\"container-light\"],\n basicChildStyle: styles[\"basic-element-style\"],\n childFieldsContainer: styles[\"child-fields-container\"],\n label: styles[\"label-light\"],\n clickableLabel: styles[\"clickable-label-light\"],\n nullValue: styles[\"value-null-light\"],\n undefinedValue: styles[\"value-undefined-light\"],\n stringValue: styles[\"value-string-light\"],\n booleanValue: styles[\"value-boolean-light\"],\n numberValue: styles[\"value-number-light\"],\n otherValue: styles[\"value-other-light\"],\n punctuation: styles[\"punctuation-light\"],\n collapseIcon: styles[\"collapse-icon-light\"],\n expandIcon: styles[\"expand-icon-light\"],\n collapsedContent: styles[\"collapsed-content-light\"],\n noQuotesForStringValues: false,\n quotesForFieldNames: false,\n ariaLables: defaultAriaLables,\n stringifyStringValues: false,\n};\nconst defaultStyles = {\n ..._defaultStyles,\n container: twMerge(_defaultStyles.container, \"bg-transparent!\"),\n label: twMerge(_defaultStyles.label, \"text-muted-foreground!\"),\n punctuation: twMerge(\n _defaultStyles.punctuation,\n \"font-semibold! text-foreground!\",\n ),\n collapseIcon: twMerge(_defaultStyles.collapseIcon, \"text-muted-foreground!\"),\n stringValue: twMerge(_defaultStyles.stringValue, \"text-muted-foreground!\"),\n};\n\nconst allExpanded = () => true;\n\nconst JsonView = lazy(() =>\n import(\"react-json-view-lite\").then((m) => ({ default: m.JsonView })),\n);\n\nexport function JsonViewer(props: Props) {\n return (\n <Suspense>\n <JsonView\n {...props}\n shouldExpandNode={props.shouldExpandNode ?? allExpanded}\n style={props.style ?? defaultStyles}\n />\n </Suspense>\n );\n}\n"],"mappings":";;;;AAKA,MAAMG,SAAS;CACb,kBAAkB;CAClB,oBAAoB;CACpBC,SAAS;CACT,iBAAiB;CACjB,eAAe;CACf,iBAAiB;CACjB,0BAA0B;CAC1B,mBAAmB;CACnB,uBAAuB;CACvB,0BAA0B;CAC1B,eAAe;CACf,yBAAyB;CACzB,qBAAqB;CACrB,oBAAoB;CACpB,yBAAyB;CACzB,sBAAsB;CACtB,sBAAsB;CACtB,uBAAuB;CACvB,qBAAqB;CACrB,uBAAuB;CACvB,qBAAqB;CACrB,2BAA2B;CAC3B,kBAAkB;CAClB,oBAAoB;CACpB,sBAAsB;CACtB,0BAA0B;CAC1B,cAAc;CACd,wBAAwB;CACxB,oBAAoB;CACpB,mBAAmB;CACnB,wBAAwB;CACxB,qBAAqB;CACrB,qBAAqB;CACrB,sBAAsB;CACtB,oBAAoB;CACrB;AAKD,MAAMI,iBAAiB;CACrBC,WAAWN,OAAO;CAClBO,iBAAiBP,OAAO;CACxBQ,sBAAsBR,OAAO;CAC7BS,OAAOT,OAAO;CACdU,gBAAgBV,OAAO;CACvBW,WAAWX,OAAO;CAClBY,gBAAgBZ,OAAO;CACvBa,aAAab,OAAO;CACpBc,cAAcd,OAAO;CACrBe,aAAaf,OAAO;CACpBgB,YAAYhB,OAAO;CACnBiB,aAAajB,OAAO;CACpBkB,cAAclB,OAAO;CACrBmB,YAAYnB,OAAO;CACnBoB,kBAAkBpB,OAAO;CACzBqB,yBAAyB;CACzBC,qBAAqB;CACrBC,YAtBwB;EACxBpB,cAAc;EACdC,YAAY;EACb;CAoBCoB,uBAAuB;CACxB;AACD,MAAMC,gBAAgB;CACpB,GAAGpB;CACHC,WAAWP,QAAQM,eAAeC,WAAW,kBAAkB;CAC/DG,OAAOV,QAAQM,eAAeI,OAAO,yBAAyB;CAC9DQ,aAAalB,QACXM,eAAeY,aACf,kCACD;CACDC,cAAcnB,QAAQM,eAAea,cAAc,yBAAyB;CAC5EL,aAAad,QAAQM,eAAeQ,aAAa,yBAAwB;CAC1E;AAED,MAAMa,oBAAoB;AAE1B,MAAMC,WAAW9B,2BACf,OAAO,wBAAwB+B,MAAMC,OAAO,EAAEC,SAASD,EAAEF,UAAU,EACrE,CAAC;AAED,SAAgBI,WAAWC,OAAc;AACvC,QACE,oBAAC,UAAD,EAAA,UACE,oBAAC,UAAD;EACE,GAAIA;EACJ,kBAAkBA,MAAMC,oBAAoBP;EAC5C,OAAOM,MAAME,SAAST;EAAc,CAAA,EAE7B,CAAA"}
|
|
@@ -15,7 +15,7 @@ const PopoverContent = /* @__PURE__ */ React.forwardRef(({ align = "center", sid
|
|
|
15
15
|
"data-[side=bottom]:animate-slide-in-from-top data-[side=left]:animate-slide-in-from-right",
|
|
16
16
|
"data-[side=right]:animate-slide-in-from-left data-[side=top]:animate-slide-in-from-bottom",
|
|
17
17
|
"z-50 w-(--radix-popover-trigger-width) border p-0 outline-none",
|
|
18
|
-
"border-
|
|
18
|
+
"border-border bg-popover text-popover-foreground",
|
|
19
19
|
"rounded-md shadow-sidebar"
|
|
20
20
|
], className),
|
|
21
21
|
ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","names":["twMerge","PopoverPrimitive","React","Popover","Root","PopoverAnchor","Anchor","PopoverTrigger","Trigger","PopoverContent","forwardRef","align","sideOffset","className","props","ref"],"sources":["../../../../src/ui/components/popover/popover.tsx"],"sourcesContent":["import { twMerge } from \"tailwind-merge\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport React from \"react\";\n\nexport const Popover = PopoverPrimitive.Root;\nexport const PopoverAnchor = PopoverPrimitive.Anchor;\nexport const PopoverTrigger = PopoverPrimitive.Trigger;\n\nexport const PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ align = \"center\", sideOffset = 4, className, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n align={align}\n sideOffset={sideOffset}\n className={twMerge(\n [\n \"data-[state=closed]:animate-fade-out data-[state=open]:animate-fade-in\",\n \"data-[state=closed]:animate-zoom-out data-[state=open]:animate-zoom-in\",\n \"data-[side=bottom]:animate-slide-in-from-top data-[side=left]:animate-slide-in-from-right\",\n \"data-[side=right]:animate-slide-in-from-left data-[side=top]:animate-slide-in-from-bottom\",\n \"z-50 w-(--radix-popover-trigger-width) border p-0 outline-none\",\n \"border-
|
|
1
|
+
{"version":3,"file":"popover.js","names":["twMerge","PopoverPrimitive","React","Popover","Root","PopoverAnchor","Anchor","PopoverTrigger","Trigger","PopoverContent","forwardRef","align","sideOffset","className","props","ref"],"sources":["../../../../src/ui/components/popover/popover.tsx"],"sourcesContent":["import { twMerge } from \"tailwind-merge\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport React from \"react\";\n\nexport const Popover = PopoverPrimitive.Root;\nexport const PopoverAnchor = PopoverPrimitive.Anchor;\nexport const PopoverTrigger = PopoverPrimitive.Trigger;\n\nexport const PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ align = \"center\", sideOffset = 4, className, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n align={align}\n sideOffset={sideOffset}\n className={twMerge(\n [\n \"data-[state=closed]:animate-fade-out data-[state=open]:animate-fade-in\",\n \"data-[state=closed]:animate-zoom-out data-[state=open]:animate-zoom-in\",\n \"data-[side=bottom]:animate-slide-in-from-top data-[side=left]:animate-slide-in-from-right\",\n \"data-[side=right]:animate-slide-in-from-left data-[side=top]:animate-slide-in-from-bottom\",\n \"z-50 w-(--radix-popover-trigger-width) border p-0 outline-none\",\n \"border-border bg-popover text-popover-foreground\",\n \"rounded-md shadow-sidebar\",\n ],\n className,\n )}\n ref={ref}\n {...props}\n />\n </PopoverPrimitive.Portal>\n));\n"],"mappings":";;;;;AAIA,MAAaG,UAAUF,iBAAiBG;AACxC,MAAaC,gBAAgBJ,iBAAiBK;AAC9C,MAAaC,iBAAiBN,iBAAiBO;AAE/C,MAAaC,iBAAiBP,sBAAMQ,YAGjC,EAAEC,QAAQ,UAAUC,aAAa,GAAGC,WAAW,GAAGC,SAASC,QAC5D,oBAAC,iBAAiB,QAAlB,EAAA,UACE,oBAAC,iBAAiB,SAAlB;CACSJ;CACKC;CACZ,WAAWZ,QACT;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACD,EACDa,UACD;CACIE;CACL,GAAID;CAAM,CAAA,EAGf,CAAA,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as RadioGroupFieldProps, t as RadioGroupField } from "../../../radio-group-field-
|
|
1
|
+
import { n as RadioGroupFieldProps, t as RadioGroupField } from "../../../radio-group-field-BN654-SO.js";
|
|
2
2
|
export { RadioGroupField, RadioGroupFieldProps };
|
|
@@ -10,15 +10,15 @@ const Radio = /* @__PURE__ */ React.forwardRef(({ className, description, disabl
|
|
|
10
10
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(RadioGroupPrimitive.Item, {
|
|
11
11
|
"aria-disabled": disabled,
|
|
12
12
|
"aria-invalid": hasError,
|
|
13
|
-
className: twMerge("group peer", "aspect-square size-4 rounded-full border border-
|
|
13
|
+
className: twMerge("group peer", "aspect-square size-4 rounded-full border border-foreground", "hover:hover-effect", disabled && ["cursor-not-allowed border-border", ""], hasError && ["border-destructive", ""], className),
|
|
14
14
|
disabled,
|
|
15
15
|
id,
|
|
16
16
|
value,
|
|
17
17
|
...props,
|
|
18
18
|
ref,
|
|
19
|
-
children: /* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, { className: twMerge("relative flex size-full items-center justify-center", "after:absolute after:top-1/2 after:left-1/2 after:size-2.5", "after:-translate-1/2", "after:rounded-full after:bg-
|
|
19
|
+
children: /* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, { className: twMerge("relative flex size-full items-center justify-center", "after:absolute after:top-1/2 after:left-1/2 after:size-2.5", "after:-translate-1/2", "after:rounded-full after:bg-primary after:content-['']", "", !disabled && ["group-hover:after:hover-effect dark:group-hover:after:hover-effect", "dark:group-hover:after:hover-effect"], disabled && ["after:bg-muted-foreground", ""]) })
|
|
20
20
|
}), /* @__PURE__ */ jsx(FormLabel, {
|
|
21
|
-
className: twMerge(!disabled && !hasError && ["cursor-pointer", "peer-hover:
|
|
21
|
+
className: twMerge(!disabled && !hasError && ["cursor-pointer", "peer-hover:hover-effect dark:peer-hover:hover-effect"]),
|
|
22
22
|
description,
|
|
23
23
|
disabled,
|
|
24
24
|
hasError,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.js","names":["twMerge","RadioGroupPrimitive","React","useId","FormLabel","Radio","forwardRef","className","description","disabled","hasError","id","propId","label","value","props","ref","prefix","required"],"sources":["../../../../src/ui/components/radio-group-field/radio.tsx"],"sourcesContent":["import { twMerge } from \"tailwind-merge\";\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\";\nimport React, { useId } from \"react\";\nimport { FormLabel } from \"../form-label/form-label.js\";\n\nexport interface RadioProps extends React.ComponentPropsWithoutRef<\n typeof RadioGroupPrimitive.Item\n> {\n className?: string;\n description?: string;\n disabled?: boolean;\n hasError?: boolean;\n id?: string;\n label: string;\n value: string;\n}\n\nexport const Radio = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\n RadioProps\n>(\n (\n {\n className,\n description,\n disabled = false,\n hasError = false,\n id: propId,\n label,\n value,\n ...props\n },\n ref,\n ) => {\n const prefix = useId();\n const id = propId ?? `${prefix}-radio`;\n\n return (\n <>\n <RadioGroupPrimitive.Item\n aria-disabled={disabled}\n aria-invalid={hasError}\n className={twMerge(\n \"group peer\",\n \"aspect-square size-4 rounded-full border border-
|
|
1
|
+
{"version":3,"file":"radio.js","names":["twMerge","RadioGroupPrimitive","React","useId","FormLabel","Radio","forwardRef","className","description","disabled","hasError","id","propId","label","value","props","ref","prefix","required"],"sources":["../../../../src/ui/components/radio-group-field/radio.tsx"],"sourcesContent":["import { twMerge } from \"tailwind-merge\";\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\";\nimport React, { useId } from \"react\";\nimport { FormLabel } from \"../form-label/form-label.js\";\n\nexport interface RadioProps extends React.ComponentPropsWithoutRef<\n typeof RadioGroupPrimitive.Item\n> {\n className?: string;\n description?: string;\n disabled?: boolean;\n hasError?: boolean;\n id?: string;\n label: string;\n value: string;\n}\n\nexport const Radio = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\n RadioProps\n>(\n (\n {\n className,\n description,\n disabled = false,\n hasError = false,\n id: propId,\n label,\n value,\n ...props\n },\n ref,\n ) => {\n const prefix = useId();\n const id = propId ?? `${prefix}-radio`;\n\n return (\n <>\n <RadioGroupPrimitive.Item\n aria-disabled={disabled}\n aria-invalid={hasError}\n className={twMerge(\n \"group peer\",\n \"aspect-square size-4 rounded-full border border-foreground\",\n \"hover:hover-effect\",\n disabled && [\"cursor-not-allowed border-border\", \"\"],\n hasError && [\"border-destructive\", \"\"],\n className,\n )}\n disabled={disabled}\n id={id}\n value={value}\n {...props}\n ref={ref}\n >\n <RadioGroupPrimitive.Indicator\n className={twMerge(\n \"relative flex size-full items-center justify-center\",\n \"after:absolute after:top-1/2 after:left-1/2 after:size-2.5\",\n \"after:-translate-1/2\",\n \"after:rounded-full after:bg-primary after:content-['']\",\n \"\",\n !disabled && [\n \"group-hover:after:hover-effect dark:group-hover:after:hover-effect\",\n \"dark:group-hover:after:hover-effect\",\n ],\n disabled && [\"after:bg-muted-foreground\", \"\"],\n )}\n />\n </RadioGroupPrimitive.Item>\n <FormLabel\n className={twMerge(\n !disabled &&\n !hasError && [\n \"cursor-pointer\",\n \"peer-hover:hover-effect dark:peer-hover:hover-effect\",\n ],\n )}\n description={description}\n disabled={disabled}\n hasError={hasError}\n htmlFor={id}\n required={props.required}\n inline\n >\n {label}\n </FormLabel>\n </>\n );\n },\n);\n"],"mappings":";;;;;;AAiBA,MAAaK,QAAQH,sBAAMI,YAKvB,EACEC,WACAC,aACAC,WAAW,OACXC,WAAW,OACXC,IAAIC,QACJC,OACAC,OACA,GAAGC,SAELC,QACG;CACH,MAAMC,SAASd,OAAO;CACtB,MAAMQ,KAAKC,UAAU,GAAGK,OAAM;AAE9B,QACE,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,oBAAoB,MAArB;EACE,iBAAeR;EACf,gBAAcC;EACd,WAAWV,QACT,cACA,8DACA,sBACAS,YAAY,CAAC,oCAAoC,GAAG,EACpDC,YAAY,CAAC,sBAAsB,GAAG,EACtCH,UACD;EACSE;EACNE;EACGG;EACP,GAAIC;EACCC;YAEL,oBAAC,oBAAoB,WAArB,EACE,WAAWhB,QACT,uDACA,8DACA,wBACA,0DACA,IACA,CAACS,YAAY,CACX,sEACA,sCACD,EACDA,YAAY,CAAC,6BAA6B,GAC5C,CAAC,EAAC,CAAA;EAEoB,CAAA,EAC1B,oBAAC,WAAD;EACE,WAAWT,QACT,CAACS,YACC,CAACC,YAAY,CACX,kBACA,uDAEN,CAAC;EACYF;EACHC;EACAC;EACV,SAASC;EACT,UAAUI,MAAMG;EAChB,QAAA;YAECL;EACQ,CAAA,CACV,EAAA,CAAA;EAGR"}
|
|
@@ -51,11 +51,11 @@ const SearchAutocomplete = (props) => {
|
|
|
51
51
|
onKeyDown: handleKeyDown,
|
|
52
52
|
placeholder,
|
|
53
53
|
disabled: disabled || selectingValue !== null,
|
|
54
|
-
className: "max-w-xs text-
|
|
54
|
+
className: "max-w-xs text-foreground"
|
|
55
55
|
}), /* @__PURE__ */ jsx("button", {
|
|
56
56
|
onClick: handleSubmit,
|
|
57
57
|
disabled: disabled || !query.trim() || selectingValue !== null,
|
|
58
|
-
className: "h-9 rounded-md bg-
|
|
58
|
+
className: "h-9 rounded-md bg-primary px-4 text-sm font-semibold text-primary-foreground transition-colors hover:hover-effect disabled:disabled-effect",
|
|
59
59
|
children: selectLabel
|
|
60
60
|
})]
|
|
61
61
|
});
|
|
@@ -73,7 +73,7 @@ const SearchAutocomplete = (props) => {
|
|
|
73
73
|
onKeyDown: handleKeyDown,
|
|
74
74
|
placeholder,
|
|
75
75
|
disabled,
|
|
76
|
-
className: "max-w-xs text-
|
|
76
|
+
className: "max-w-xs text-foreground"
|
|
77
77
|
})
|
|
78
78
|
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
79
79
|
align: "start",
|
|
@@ -101,7 +101,7 @@ const SearchAutocomplete = (props) => {
|
|
|
101
101
|
})
|
|
102
102
|
}, option.value);
|
|
103
103
|
return /* @__PURE__ */ jsxs("div", {
|
|
104
|
-
className: "flex items-center justify-between gap-2 rounded-md px-2 py-1.5 hover:
|
|
104
|
+
className: "flex items-center justify-between gap-2 rounded-md px-2 py-1.5 hover:hover-effect",
|
|
105
105
|
children: [renderOption ? /* @__PURE__ */ jsx("div", {
|
|
106
106
|
className: "min-w-0 flex-1",
|
|
107
107
|
children: renderOption(option)
|
|
@@ -109,19 +109,19 @@ const SearchAutocomplete = (props) => {
|
|
|
109
109
|
className: "min-w-0 flex-1",
|
|
110
110
|
children: [
|
|
111
111
|
/* @__PURE__ */ jsx("p", {
|
|
112
|
-
className: "truncate text-sm font-medium text-
|
|
112
|
+
className: "truncate text-sm font-medium text-foreground",
|
|
113
113
|
children: option.label
|
|
114
114
|
}),
|
|
115
115
|
option.version && /* @__PURE__ */ jsxs("p", {
|
|
116
|
-
className: "truncate text-xs text-
|
|
116
|
+
className: "truncate text-xs text-muted-foreground",
|
|
117
117
|
children: ["v", option.version]
|
|
118
118
|
}),
|
|
119
119
|
option.description && /* @__PURE__ */ jsx("p", {
|
|
120
|
-
className: "truncate text-xs text-
|
|
120
|
+
className: "truncate text-xs text-muted-foreground",
|
|
121
121
|
children: option.description
|
|
122
122
|
}),
|
|
123
123
|
option.meta && /* @__PURE__ */ jsx("p", {
|
|
124
|
-
className: "truncate text-xs text-
|
|
124
|
+
className: "truncate text-xs text-muted-foreground",
|
|
125
125
|
children: option.meta
|
|
126
126
|
})
|
|
127
127
|
]
|
|
@@ -129,12 +129,12 @@ const SearchAutocomplete = (props) => {
|
|
|
129
129
|
className: "flex shrink-0 items-center justify-center",
|
|
130
130
|
children: selectingContent
|
|
131
131
|
}) : option.disabled ? /* @__PURE__ */ jsx("span", {
|
|
132
|
-
className: "shrink-0 rounded-md bg-
|
|
132
|
+
className: "shrink-0 rounded-md bg-muted px-3 py-1 text-xs font-medium text-muted-foreground",
|
|
133
133
|
children: option.disabledLabel ?? "Unavailable"
|
|
134
134
|
}) : /* @__PURE__ */ jsx("button", {
|
|
135
135
|
onClick: () => void handleSelect(option.value),
|
|
136
136
|
disabled: selectingValue === option.value,
|
|
137
|
-
className: "shrink-0 rounded-md bg-
|
|
137
|
+
className: "shrink-0 rounded-md bg-primary px-3 py-1 text-xs font-medium text-primary-foreground transition-colors hover:hover-effect disabled:disabled-effect",
|
|
138
138
|
children: selectingValue === option.value ? "..." : selectLabel
|
|
139
139
|
})]
|
|
140
140
|
}, option.value);
|
|
@@ -143,15 +143,15 @@ const SearchAutocomplete = (props) => {
|
|
|
143
143
|
})]
|
|
144
144
|
}),
|
|
145
145
|
loading && /* @__PURE__ */ jsx("p", {
|
|
146
|
-
className: "mt-1 text-xs text-
|
|
146
|
+
className: "mt-1 text-xs text-muted-foreground",
|
|
147
147
|
children: "Searching..."
|
|
148
148
|
}),
|
|
149
149
|
error && /* @__PURE__ */ jsx("p", {
|
|
150
|
-
className: "mt-1 text-xs text-
|
|
150
|
+
className: "mt-1 text-xs text-destructive",
|
|
151
151
|
children: error
|
|
152
152
|
}),
|
|
153
153
|
!loading && !error && query.trim() && results.length === 0 && !isOpen && /* @__PURE__ */ jsx("p", {
|
|
154
|
-
className: "mt-1 text-xs text-
|
|
154
|
+
className: "mt-1 text-xs text-muted-foreground",
|
|
155
155
|
children: "No results found"
|
|
156
156
|
})
|
|
157
157
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-autocomplete.js","names":["twMerge","React","useCallback","useState","Input","Popover","PopoverAnchor","PopoverContent","useSearchAutocomplete","SearchAutocomplete","props","fetchOptions","onSelect","selectLabel","selectingContent","placeholder","disabled","loading","externalLoading","className","renderOption","renderRow","keepOpenSelector","debounceMs","query","setQuery","results","isLoading","error","isOpen","setIsOpen","handleQueryChange","selectingValue","setSelectingValue","handleInputChange","e","target","value","handleSelect","handleSubmit","trim","handleKeyDown","key","preventDefault","length","closest","map","option","label","version","description","meta","disabledLabel"],"sources":["../../../../src/ui/components/search-autocomplete/search-autocomplete.tsx"],"sourcesContent":["import { twMerge } from \"tailwind-merge\";\nimport React, { useCallback, useState } from \"react\";\nimport { Input } from \"../input/input.js\";\nimport { Popover, PopoverAnchor, PopoverContent } from \"../popover/popover.js\";\nimport type { SearchAutocompleteProps } from \"./types.js\";\nimport { useSearchAutocomplete } from \"./use-search-autocomplete.js\";\n\nexport const SearchAutocomplete: React.FC<SearchAutocompleteProps> = (\n props,\n) => {\n const {\n fetchOptions,\n onSelect,\n selectLabel = \"Select\",\n selectingContent,\n placeholder = \"Search...\",\n disabled = false,\n loading: externalLoading = false,\n className,\n renderOption,\n renderRow,\n keepOpenSelector,\n debounceMs = 300,\n } = props;\n\n const {\n query,\n setQuery,\n results,\n isLoading,\n error,\n isOpen,\n setIsOpen,\n handleQueryChange,\n } = useSearchAutocomplete({ fetchOptions, debounceMs });\n\n const [selectingValue, setSelectingValue] = useState<string | null>(null);\n\n const handleInputChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n handleQueryChange(e.target.value);\n },\n [handleQueryChange],\n );\n\n const handleSelect = useCallback(\n async (value: string) => {\n setSelectingValue(value);\n try {\n await onSelect(value);\n setQuery(\"\");\n setIsOpen(false);\n } catch {\n // error handled by caller\n } finally {\n setSelectingValue(null);\n }\n },\n [onSelect, setQuery, setIsOpen],\n );\n\n const handleSubmit = useCallback(() => {\n if (query.trim()) {\n void handleSelect(query.trim());\n }\n }, [query, handleSelect]);\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n if (!fetchOptions && query.trim()) {\n handleSubmit();\n }\n }\n },\n [fetchOptions, query, handleSubmit],\n );\n\n const loading = isLoading || externalLoading;\n\n // Fallback: plain text input + submit when no fetchOptions\n if (!fetchOptions) {\n return (\n <div className={twMerge(\"flex items-center gap-2\", className)}>\n <Input\n value={query}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n disabled={disabled || selectingValue !== null}\n className=\"max-w-xs text-gray-700 dark:text-slate-200\"\n />\n <button\n onClick={handleSubmit}\n disabled={disabled || !query.trim() || selectingValue !== null}\n className=\"h-9 rounded-md bg-gray-900 px-4 text-sm font-semibold text-white transition-colors hover:bg-gray-800 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-slate-50 dark:text-slate-900 dark:hover:bg-slate-100\"\n >\n {selectLabel}\n </button>\n </div>\n );\n }\n\n return (\n <div className={twMerge(\"relative\", className)}>\n <Popover open={isOpen && results.length > 0} onOpenChange={setIsOpen}>\n <PopoverAnchor asChild>\n <Input\n value={query}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n disabled={disabled}\n className=\"max-w-xs text-gray-700 dark:text-slate-200\"\n />\n </PopoverAnchor>\n <PopoverContent\n align=\"start\"\n onOpenAutoFocus={(e) => e.preventDefault()}\n onInteractOutside={(e) => {\n if (keepOpenSelector) {\n const target = e.target as HTMLElement | null;\n if (target?.closest(keepOpenSelector)) {\n e.preventDefault();\n return;\n }\n }\n setIsOpen(false);\n }}\n className=\"max-h-80 overflow-visible p-1\"\n >\n <div className=\"max-h-80 overflow-y-auto\">\n {results.map((option) => {\n if (renderRow) {\n return (\n <div key={option.value} className=\"rounded-md\">\n {renderRow(option, {\n selectingValue,\n selectLabel,\n selectingContent,\n handleSelect: (value) => void handleSelect(value),\n })}\n </div>\n );\n }\n return (\n <div\n key={option.value}\n className=\"flex items-center justify-between gap-2 rounded-md px-2 py-1.5 hover:bg-gray-100 dark:hover:bg-slate-700\"\n >\n {renderOption ? (\n <div className=\"min-w-0 flex-1\">{renderOption(option)}</div>\n ) : (\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-medium text-gray-900 dark:text-slate-50\">\n {option.label}\n </p>\n {option.version && (\n <p className=\"truncate text-xs text-gray-500 dark:text-slate-400\">\n v{option.version}\n </p>\n )}\n {option.description && (\n <p className=\"truncate text-xs text-gray-500 dark:text-slate-400\">\n {option.description}\n </p>\n )}\n {option.meta && (\n <p className=\"truncate text-xs text-gray-400 dark:text-slate-500\">\n {option.meta}\n </p>\n )}\n </div>\n )}\n {selectingValue === option.value && selectingContent ? (\n <div className=\"flex shrink-0 items-center justify-center\">\n {selectingContent}\n </div>\n ) : option.disabled ? (\n <span className=\"shrink-0 rounded-md bg-gray-100 px-3 py-1 text-xs font-medium text-gray-500 dark:bg-slate-700 dark:text-slate-400\">\n {option.disabledLabel ?? \"Unavailable\"}\n </span>\n ) : (\n <button\n onClick={() => void handleSelect(option.value)}\n disabled={selectingValue === option.value}\n className=\"shrink-0 rounded-md bg-gray-900 px-3 py-1 text-xs font-medium text-white transition-colors hover:bg-gray-800 disabled:opacity-50 dark:bg-slate-50 dark:text-slate-900 dark:hover:bg-slate-100\"\n >\n {selectingValue === option.value ? \"...\" : selectLabel}\n </button>\n )}\n </div>\n );\n })}\n </div>\n </PopoverContent>\n </Popover>\n {loading && (\n <p className=\"mt-1 text-xs text-gray-500 dark:text-slate-400\">\n Searching...\n </p>\n )}\n {error && (\n <p className=\"mt-1 text-xs text-red-600 dark:text-red-100\">{error}</p>\n )}\n {!loading &&\n !error &&\n query.trim() &&\n results.length === 0 &&\n !isOpen && (\n <p className=\"mt-1 text-xs text-gray-500 dark:text-slate-400\">\n No results found\n </p>\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;;AAOA,MAAaS,sBACXC,UACG;CACH,MAAM,EACJC,cACAC,UACAC,cAAc,UACdC,kBACAC,cAAc,aACdC,WAAW,OACXC,SAASC,kBAAkB,OAC3BC,WACAC,cACAC,WACAC,kBACAC,aAAa,QACXb;CAEJ,MAAM,EACJc,OACAC,UACAC,SACAC,WACAC,OACAC,QACAC,WACAC,sBACEvB,sBAAsB;EAAEG;EAAcY;EAAY,CAAC;CAEvD,MAAM,CAACS,gBAAgBC,qBAAqB9B,SAAwB,KAAK;CAEzE,MAAM+B,oBAAoBhC,aACvBiC,MAA2C;AAC1CJ,oBAAkBI,EAAEC,OAAOC,MAAM;IAEnC,CAACN,kBACH,CAAC;CAED,MAAMO,eAAepC,YACnB,OAAOmC,UAAkB;AACvBJ,oBAAkBI,MAAM;AACxB,MAAI;AACF,SAAMzB,SAASyB,MAAM;AACrBZ,YAAS,GAAG;AACZK,aAAU,MAAM;UACV,WAEE;AACRG,qBAAkB,KAAK;;IAG3B;EAACrB;EAAUa;EAAUK;EACvB,CAAC;CAED,MAAMS,eAAerC,kBAAkB;AACrC,MAAIsB,MAAMgB,MAAM,CACTF,cAAad,MAAMgB,MAAM,CAAC;IAEhC,CAAChB,OAAOc,aAAa,CAAC;CAEzB,MAAMG,gBAAgBvC,aACnBiC,MAA2B;AAC1B,MAAIA,EAAEO,QAAQ,SAAS;AACrBP,KAAEQ,gBA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jB,eACC,oBAAC,OAAD;SAAK,WAAU;mBAAkBA,aAAa2B,OAAO;SAAO,CAAA,GAE5D,qBAAC,OAAD;SAAK,WAAU;mBAAf;UACE,oBAAC,KAAD;WAAG,WAAU;qBACVA,OAAOC;WACP,CAAA;UACFD,OAAOE,WACN,qBAAC,KAAD;WAAG,WAAU;qBAAb,CAAiE,KAC7DF,OAAOE,QAEZ;;UACAF,OAAOG,eACN,oBAAC,KAAD;WAAG,WAAU;qBACVH,OAAOG;WAEX,CAAA;UACAH,OAAOI,QACN,oBAAC,KAAD;WAAG,WAAU;qBACVJ,OAAOI;WAEX,CAAA;UAEJ;YACAnB,mBAAmBe,OAAOV,SAASvB,mBAClC,oBAAC,OAAD;SAAK,WAAU;mBACZA;SACG,CAAA,GACJiC,OAAO/B,WACT,oBAAC,QAAD;SAAM,WAAU;mBACb+B,OAAOK,iBAAiB;SACpB,CAAA,GAEP,oBAAC,UAAD;SACE,eAAe,KAAKd,aAAaS,OAAOV,MAAM;SAC9C,UAAUL,mBAAmBe,OAAOV;SACpC,WAAU;mBAETL,mBAAmBe,OAAOV,QAAQ,QAAQxB;SAE9C,CAAA,CACG;UA5CCkC,OAAOV,MA4CR;QAER;MACC,CAAA;KACS,CAAA,CACT;;GACRpB,WACC,oBAAC,KAAD;IAAG,WAAU;cAAgD;IAG9D,CAAA;GACAW,SACC,oBAAC,KAAD;IAAG,WAAU;cAA+CA;IAC7D,CAAA;GACA,CAACX,WACA,CAACW,SACDJ,MAAMgB,MAAM,IACZd,QAAQkB,WAAW,KACnB,CAACf,UACC,oBAAC,KAAD;IAAG,WAAU;cAAgD;IAG9D,CAAA;GACC"}
|
|
1
|
+
{"version":3,"file":"search-autocomplete.js","names":["React","useCallback","useState","twMerge","Input","Popover","PopoverAnchor","PopoverContent","useSearchAutocomplete","SearchAutocomplete","props","fetchOptions","onSelect","selectLabel","selectingContent","placeholder","disabled","loading","externalLoading","className","renderOption","renderRow","keepOpenSelector","debounceMs","query","setQuery","results","isLoading","error","isOpen","setIsOpen","handleQueryChange","selectingValue","setSelectingValue","handleInputChange","e","target","value","handleSelect","handleSubmit","trim","handleKeyDown","key","preventDefault","length","closest","map","option","label","version","description","meta","disabledLabel"],"sources":["../../../../src/ui/components/search-autocomplete/search-autocomplete.tsx"],"sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport { Input } from \"../input/input.js\";\nimport { Popover, PopoverAnchor, PopoverContent } from \"../popover/popover.js\";\nimport type { SearchAutocompleteProps } from \"./types.js\";\nimport { useSearchAutocomplete } from \"./use-search-autocomplete.js\";\n\nexport const SearchAutocomplete: React.FC<SearchAutocompleteProps> = (\n props,\n) => {\n const {\n fetchOptions,\n onSelect,\n selectLabel = \"Select\",\n selectingContent,\n placeholder = \"Search...\",\n disabled = false,\n loading: externalLoading = false,\n className,\n renderOption,\n renderRow,\n keepOpenSelector,\n debounceMs = 300,\n } = props;\n\n const {\n query,\n setQuery,\n results,\n isLoading,\n error,\n isOpen,\n setIsOpen,\n handleQueryChange,\n } = useSearchAutocomplete({ fetchOptions, debounceMs });\n\n const [selectingValue, setSelectingValue] = useState<string | null>(null);\n\n const handleInputChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n handleQueryChange(e.target.value);\n },\n [handleQueryChange],\n );\n\n const handleSelect = useCallback(\n async (value: string) => {\n setSelectingValue(value);\n try {\n await onSelect(value);\n setQuery(\"\");\n setIsOpen(false);\n } catch {\n // error handled by caller\n } finally {\n setSelectingValue(null);\n }\n },\n [onSelect, setQuery, setIsOpen],\n );\n\n const handleSubmit = useCallback(() => {\n if (query.trim()) {\n void handleSelect(query.trim());\n }\n }, [query, handleSelect]);\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n if (!fetchOptions && query.trim()) {\n handleSubmit();\n }\n }\n },\n [fetchOptions, query, handleSubmit],\n );\n\n const loading = isLoading || externalLoading;\n\n // Fallback: plain text input + submit when no fetchOptions\n if (!fetchOptions) {\n return (\n <div className={twMerge(\"flex items-center gap-2\", className)}>\n <Input\n value={query}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n disabled={disabled || selectingValue !== null}\n className=\"max-w-xs text-foreground\"\n />\n <button\n onClick={handleSubmit}\n disabled={disabled || !query.trim() || selectingValue !== null}\n className=\"h-9 rounded-md bg-primary px-4 text-sm font-semibold text-primary-foreground transition-colors hover:hover-effect disabled:disabled-effect\"\n >\n {selectLabel}\n </button>\n </div>\n );\n }\n\n return (\n <div className={twMerge(\"relative\", className)}>\n <Popover open={isOpen && results.length > 0} onOpenChange={setIsOpen}>\n <PopoverAnchor asChild>\n <Input\n value={query}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n disabled={disabled}\n className=\"max-w-xs text-foreground\"\n />\n </PopoverAnchor>\n <PopoverContent\n align=\"start\"\n onOpenAutoFocus={(e) => e.preventDefault()}\n onInteractOutside={(e) => {\n if (keepOpenSelector) {\n const target = e.target as HTMLElement | null;\n if (target?.closest(keepOpenSelector)) {\n e.preventDefault();\n return;\n }\n }\n setIsOpen(false);\n }}\n className=\"max-h-80 overflow-visible p-1\"\n >\n <div className=\"max-h-80 overflow-y-auto\">\n {results.map((option) => {\n if (renderRow) {\n return (\n <div key={option.value} className=\"rounded-md\">\n {renderRow(option, {\n selectingValue,\n selectLabel,\n selectingContent,\n handleSelect: (value) => void handleSelect(value),\n })}\n </div>\n );\n }\n return (\n <div\n key={option.value}\n className=\"flex items-center justify-between gap-2 rounded-md px-2 py-1.5 hover:hover-effect\"\n >\n {renderOption ? (\n <div className=\"min-w-0 flex-1\">{renderOption(option)}</div>\n ) : (\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-medium text-foreground\">\n {option.label}\n </p>\n {option.version && (\n <p className=\"truncate text-xs text-muted-foreground\">\n v{option.version}\n </p>\n )}\n {option.description && (\n <p className=\"truncate text-xs text-muted-foreground\">\n {option.description}\n </p>\n )}\n {option.meta && (\n <p className=\"truncate text-xs text-muted-foreground\">\n {option.meta}\n </p>\n )}\n </div>\n )}\n {selectingValue === option.value && selectingContent ? (\n <div className=\"flex shrink-0 items-center justify-center\">\n {selectingContent}\n </div>\n ) : option.disabled ? (\n <span className=\"shrink-0 rounded-md bg-muted px-3 py-1 text-xs font-medium text-muted-foreground\">\n {option.disabledLabel ?? \"Unavailable\"}\n </span>\n ) : (\n <button\n onClick={() => void handleSelect(option.value)}\n disabled={selectingValue === option.value}\n className=\"shrink-0 rounded-md bg-primary px-3 py-1 text-xs font-medium text-primary-foreground transition-colors hover:hover-effect disabled:disabled-effect\"\n >\n {selectingValue === option.value ? \"...\" : selectLabel}\n </button>\n )}\n </div>\n );\n })}\n </div>\n </PopoverContent>\n </Popover>\n {loading && (\n <p className=\"mt-1 text-xs text-muted-foreground\">Searching...</p>\n )}\n {error && <p className=\"mt-1 text-xs text-destructive\">{error}</p>}\n {!loading &&\n !error &&\n query.trim() &&\n results.length === 0 &&\n !isOpen && (\n <p className=\"mt-1 text-xs text-muted-foreground\">No results found</p>\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;;AAOA,MAAaS,sBACXC,UACG;CACH,MAAM,EACJC,cACAC,UACAC,cAAc,UACdC,kBACAC,cAAc,aACdC,WAAW,OACXC,SAASC,kBAAkB,OAC3BC,WACAC,cACAC,WACAC,kBACAC,aAAa,QACXb;CAEJ,MAAM,EACJc,OACAC,UACAC,SACAC,WACAC,OACAC,QACAC,WACAC,sBACEvB,sBAAsB;EAAEG;EAAcY;EAAY,CAAC;CAEvD,MAAM,CAACS,gBAAgBC,qBAAqB/B,SAAwB,KAAK;CAEzE,MAAMgC,oBAAoBjC,aACvBkC,MAA2C;AAC1CJ,oBAAkBI,EAAEC,OAAOC,MAAM;IAEnC,CAACN,kBACH,CAAC;CAED,MAAMO,eAAerC,YACnB,OAAOoC,UAAkB;AACvBJ,oBAAkBI,MAAM;AACxB,MAA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A;IAAU,CAAA;GACjE,CAACX,WACA,CAACW,SACDJ,MAAMgB,MAAM,IACZd,QAAQkB,WAAW,KACnB,CAACf,UACC,oBAAC,KAAD;IAAG,WAAU;cAAqC;IACnD,CAAA;GACC"}
|
|
@@ -26,13 +26,13 @@ const Content = ({ searchable, commandListRef, multiple, selectedValues, selecti
|
|
|
26
26
|
].includes(e.key) && enabledOptions.length > 0)) e.stopPropagation();
|
|
27
27
|
},
|
|
28
28
|
wrapperClassName: "rounded-t",
|
|
29
|
-
className: "text-
|
|
29
|
+
className: "text-foreground"
|
|
30
30
|
}), /* @__PURE__ */ jsxs(CommandList, {
|
|
31
31
|
ref: commandListRef,
|
|
32
32
|
tabIndex: !searchable ? 0 : void 0,
|
|
33
33
|
children: [
|
|
34
34
|
/* @__PURE__ */ jsx(CommandEmpty, {
|
|
35
|
-
className: "p-4 text-center text-sm/5 font-normal text-
|
|
35
|
+
className: "p-4 text-center text-sm/5 font-normal text-foreground",
|
|
36
36
|
children: "No results found."
|
|
37
37
|
}),
|
|
38
38
|
multiple && cmdkSearch === "" && /* @__PURE__ */ jsx(CommandGroup, {
|
|
@@ -41,14 +41,14 @@ const Content = ({ searchable, commandListRef, multiple, selectedValues, selecti
|
|
|
41
41
|
value: "select-all",
|
|
42
42
|
onSelect: toggleAll,
|
|
43
43
|
disabled: false,
|
|
44
|
-
className: twMerge("cursor-pointer", "data-[selected=true]:bg-
|
|
44
|
+
className: twMerge("cursor-pointer", "data-[selected=true]:bg-accent"),
|
|
45
45
|
role: "option",
|
|
46
46
|
"aria-selected": selectedValues.length === enabledOptions.length,
|
|
47
47
|
children: /* @__PURE__ */ jsxs("div", {
|
|
48
48
|
className: "flex w-full items-center gap-2",
|
|
49
49
|
children: [
|
|
50
50
|
selectionIcon === "auto" && /* @__PURE__ */ jsx("div", {
|
|
51
|
-
className: twMerge("flex size-4 items-center justify-center rounded-md border", "border-
|
|
51
|
+
className: twMerge("flex size-4 items-center justify-center rounded-md border", "border-foreground", selectedValues.length === enabledOptions.length && "bg-primary text-primary-foreground"),
|
|
52
52
|
children: selectedValues.length === enabledOptions.length && /* @__PURE__ */ jsx(Icon, {
|
|
53
53
|
name: "Checkmark",
|
|
54
54
|
size: 16
|
|
@@ -59,11 +59,11 @@ const Content = ({ searchable, commandListRef, multiple, selectedValues, selecti
|
|
|
59
59
|
children: selectionIconPosition === "left" && selectedValues.length === enabledOptions.length && /* @__PURE__ */ jsx(Icon, {
|
|
60
60
|
name: "Checkmark",
|
|
61
61
|
size: 16,
|
|
62
|
-
className: "text-
|
|
62
|
+
className: "text-foreground"
|
|
63
63
|
})
|
|
64
64
|
}),
|
|
65
65
|
/* @__PURE__ */ jsx("span", {
|
|
66
|
-
className: "text-sm/4 font-semibold text-
|
|
66
|
+
className: "text-sm/4 font-semibold text-foreground",
|
|
67
67
|
children: selectedValues.length === enabledOptions.length ? "Deselect All" : "Select All"
|
|
68
68
|
}),
|
|
69
69
|
selectionIcon === "checkmark" && selectionIconPosition === "right" && /* @__PURE__ */ jsx("div", {
|
|
@@ -71,7 +71,7 @@ const Content = ({ searchable, commandListRef, multiple, selectedValues, selecti
|
|
|
71
71
|
children: selectedValues.length === enabledOptions.length && /* @__PURE__ */ jsx(Icon, {
|
|
72
72
|
name: "Checkmark",
|
|
73
73
|
size: 16,
|
|
74
|
-
className: "text-
|
|
74
|
+
className: "text-foreground"
|
|
75
75
|
})
|
|
76
76
|
})
|
|
77
77
|
]
|
|
@@ -91,7 +91,7 @@ const Content = ({ searchable, commandListRef, multiple, selectedValues, selecti
|
|
|
91
91
|
toggleOption,
|
|
92
92
|
tabIndex: !searchable ? 0 : void 0
|
|
93
93
|
}),
|
|
94
|
-
favoriteOptions.length > 0 && /* @__PURE__ */ jsx("div", { className: "my-1 border-b border-
|
|
94
|
+
favoriteOptions.length > 0 && /* @__PURE__ */ jsx("div", { className: "my-1 border-b border-border" }),
|
|
95
95
|
/* @__PURE__ */ jsx(CommandItemList, {
|
|
96
96
|
options,
|
|
97
97
|
selectedValues,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.js","names":["Icon","twMerge","useCommandState","React","useEffect","CommandEmpty","CommandGroup","CommandInput","CommandItem","CommandList","CommandItemList","Content","searchable","commandListRef","multiple","selectedValues","selectionIcon","selectionIconPosition","options","toggleAll","toggleOption","favoriteOptions","enabledOptions","filter","opt","disabled","hasAnyIcon","some","icon","cmdkSearch","state","search","current","scrollTo","top","behavior","e","isOptionsRelatedKey","includes","key","length","stopPropagation","undefined"],"sources":["../../../../src/ui/components/select-field/content.tsx"],"sourcesContent":["import { Icon } from \"#design-system\";\nimport { twMerge } from \"tailwind-merge\";\nimport { useCommandState } from \"cmdk\";\nimport React, { useEffect } from \"react\";\nimport {\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n} from \"../command/command.js\";\nimport type { SelectProps } from \"../enum-field/types.js\";\nimport { CommandItemList } from \"./subcomponents/CommandItemList.js\";\ninterface ContentProps {\n searchable?: boolean;\n commandListRef: React.RefObject<HTMLDivElement | null>;\n multiple?: boolean;\n selectedValues: string[];\n selectionIcon: \"auto\" | \"checkmark\";\n selectionIconPosition: \"left\" | \"right\";\n options: SelectProps[\"options\"];\n favoriteOptions?: SelectProps[\"options\"];\n toggleAll: () => void;\n toggleOption: (value: string) => void;\n}\n\nexport const Content: React.FC<ContentProps> = ({\n searchable,\n commandListRef,\n multiple,\n selectedValues,\n selectionIcon,\n selectionIconPosition,\n options = [],\n toggleAll,\n toggleOption,\n favoriteOptions = [],\n}) => {\n const enabledOptions = options.filter((opt) => !opt.disabled);\n const hasAnyIcon = options.some((opt) => opt.icon);\n\n const cmdkSearch = useCommandState((state) => state.search);\n // scroll to top when search change\n useEffect(() => {\n commandListRef.current?.scrollTo({ top: 0, behavior: \"instant\" });\n }, [commandListRef, cmdkSearch]);\n\n return (\n <>\n {searchable && (\n <CommandInput\n placeholder=\"Search...\"\n onKeyDown={(e) => {\n const isOptionsRelatedKey = [\n \"ArrowUp\",\n \"ArrowDown\",\n \"Enter\",\n ].includes(e.key);\n if (!(isOptionsRelatedKey && enabledOptions.length > 0)) {\n e.stopPropagation();\n }\n }}\n wrapperClassName=\"rounded-t\"\n className=\"text-
|
|
1
|
+
{"version":3,"file":"content.js","names":["Icon","twMerge","useCommandState","React","useEffect","CommandEmpty","CommandGroup","CommandInput","CommandItem","CommandList","CommandItemList","Content","searchable","commandListRef","multiple","selectedValues","selectionIcon","selectionIconPosition","options","toggleAll","toggleOption","favoriteOptions","enabledOptions","filter","opt","disabled","hasAnyIcon","some","icon","cmdkSearch","state","search","current","scrollTo","top","behavior","e","isOptionsRelatedKey","includes","key","length","stopPropagation","undefined"],"sources":["../../../../src/ui/components/select-field/content.tsx"],"sourcesContent":["import { Icon } from \"#design-system\";\nimport { twMerge } from \"tailwind-merge\";\nimport { useCommandState } from \"cmdk\";\nimport React, { useEffect } from \"react\";\nimport {\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n} from \"../command/command.js\";\nimport type { SelectProps } from \"../enum-field/types.js\";\nimport { CommandItemList } from \"./subcomponents/CommandItemList.js\";\ninterface ContentProps {\n searchable?: boolean;\n commandListRef: React.RefObject<HTMLDivElement | null>;\n multiple?: boolean;\n selectedValues: string[];\n selectionIcon: \"auto\" | \"checkmark\";\n selectionIconPosition: \"left\" | \"right\";\n options: SelectProps[\"options\"];\n favoriteOptions?: SelectProps[\"options\"];\n toggleAll: () => void;\n toggleOption: (value: string) => void;\n}\n\nexport const Content: React.FC<ContentProps> = ({\n searchable,\n commandListRef,\n multiple,\n selectedValues,\n selectionIcon,\n selectionIconPosition,\n options = [],\n toggleAll,\n toggleOption,\n favoriteOptions = [],\n}) => {\n const enabledOptions = options.filter((opt) => !opt.disabled);\n const hasAnyIcon = options.some((opt) => opt.icon);\n\n const cmdkSearch = useCommandState((state) => state.search);\n // scroll to top when search change\n useEffect(() => {\n commandListRef.current?.scrollTo({ top: 0, behavior: \"instant\" });\n }, [commandListRef, cmdkSearch]);\n\n return (\n <>\n {searchable && (\n <CommandInput\n placeholder=\"Search...\"\n onKeyDown={(e) => {\n const isOptionsRelatedKey = [\n \"ArrowUp\",\n \"ArrowDown\",\n \"Enter\",\n ].includes(e.key);\n if (!(isOptionsRelatedKey && enabledOptions.length > 0)) {\n e.stopPropagation();\n }\n }}\n wrapperClassName=\"rounded-t\"\n className=\"text-foreground\"\n />\n )}\n <CommandList ref={commandListRef} tabIndex={!searchable ? 0 : undefined}>\n <CommandEmpty className=\"p-4 text-center text-sm/5 font-normal text-foreground\">\n No results found.\n </CommandEmpty>\n {multiple && cmdkSearch === \"\" && (\n <CommandGroup className=\"pb-0\">\n <CommandItem\n value=\"select-all\"\n onSelect={toggleAll}\n disabled={false}\n className={twMerge(\n \"cursor-pointer\",\n \"data-[selected=true]:bg-accent\",\n )}\n role=\"option\"\n aria-selected={selectedValues.length === enabledOptions.length}\n >\n <div className=\"flex w-full items-center gap-2\">\n {selectionIcon === \"auto\" && (\n <div\n className={twMerge(\n \"flex size-4 items-center justify-center rounded-md border\",\n \"border-foreground\",\n selectedValues.length === enabledOptions.length &&\n \"bg-primary text-primary-foreground\",\n )}\n >\n {selectedValues.length === enabledOptions.length && (\n <Icon name=\"Checkmark\" size={16} />\n )}\n </div>\n )}\n {selectionIcon === \"checkmark\" &&\n !(selectionIconPosition === \"right\" && hasAnyIcon) && (\n <div className=\"size-4\">\n {selectionIconPosition === \"left\" &&\n selectedValues.length === enabledOptions.length && (\n <Icon\n name=\"Checkmark\"\n size={16}\n className=\"text-foreground\"\n />\n )}\n </div>\n )}\n <span className=\"text-sm/4 font-semibold text-foreground\">\n {selectedValues.length === enabledOptions.length\n ? \"Deselect All\"\n : \"Select All\"}\n </span>\n {selectionIcon === \"checkmark\" &&\n selectionIconPosition === \"right\" && (\n <div className=\"ml-auto size-4\">\n {selectedValues.length === enabledOptions.length && (\n <Icon\n name=\"Checkmark\"\n size={16}\n className=\"text-foreground\"\n />\n )}\n </div>\n )}\n </div>\n </CommandItem>\n </CommandGroup>\n )}\n <CommandGroup\n className={multiple && cmdkSearch === \"\" ? \"pt-0\" : undefined}\n >\n <CommandItemList\n options={favoriteOptions}\n selectedValues={selectedValues}\n multiple={multiple}\n selectionIcon={selectionIcon}\n selectionIconPosition={selectionIconPosition}\n hasAnyIcon={hasAnyIcon}\n toggleOption={toggleOption}\n tabIndex={!searchable ? 0 : undefined}\n />\n\n {favoriteOptions.length > 0 && (\n <div className=\"my-1 border-b border-border\" />\n )}\n <CommandItemList\n options={options}\n selectedValues={selectedValues}\n multiple={multiple}\n selectionIcon={selectionIcon}\n selectionIconPosition={selectionIconPosition}\n hasAnyIcon={hasAnyIcon}\n toggleOption={toggleOption}\n tabIndex={!searchable ? 0 : undefined}\n />\n </CommandGroup>\n </CommandList>\n </>\n );\n};\n"],"mappings":";;;;;;;;AA0BA,MAAaW,WAAmC,EAC9CC,YACAC,gBACAC,UACAC,gBACAC,eACAC,uBACAC,UAAU,EAAE,EACZC,WACAC,cACAC,kBAAkB,EAAA,OACd;CACJ,MAAMC,iBAAiBJ,QAAQK,QAAQC,QAAQ,CAACA,IAAIC,SAAS;CAC7D,MAAMC,aAAaR,QAAQS,MAAMH,QAAQA,IAAII,KAAK;CAElD,MAAMC,aAAa3B,iBAAiB4B,UAAUA,MAAMC,OAAO;AAE3D3B,iBAAgB;AACdS,iBAAemB,SAASC,SAAS;GAAEC,KAAK;GAAGC,UAAU;GAAW,CAAC;IAChE,CAACtB,gBAAgBgB,WAAW,CAAC;AAEhC,QACE,qBAAA,YAAA,EAAA,UAAA,CACGjB,cACC,oBAAC,cAAD;EACE,aAAY;EACZ,YAAYwB,MAAM;AAMhB,OAAI,EALwB;IAC1B;IACA;IACA;IACD,CAACE,SAASF,EAAEG,IAAI,IACYjB,eAAekB,SAAS,GACnDJ,GAAEK,iBAAiB;;EAGvB,kBAAiB;EACjB,WAAU;EAEb,CAAA,EACD,qBAAC,aAAD;EAAa,KAAK5B;EAAgB,UAA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AAK,WAAU,+BAChB,CAAA;KACD,oBAAC,iBAAD;MACWtB;MACOH;MACND;MACKE;MACQC;MACXS;MACEN;MACd,UAAU,CAACR,aAAa,IAAI8B,KAAAA;MAAU,CAAA;KAE5B;;GACH;IACZ,EAAA,CAAA"}
|
|
@@ -58,7 +58,7 @@ const SelectFieldRaw = /* @__PURE__ */ React.forwardRef(({ options = [], favorit
|
|
|
58
58
|
"aria-label": label ? void 0 : multiple ? "Multi select" : "Select",
|
|
59
59
|
"aria-required": required,
|
|
60
60
|
"aria-expanded": isPopoverOpen,
|
|
61
|
-
className: twMerge("flex h-9 w-full items-center justify-between px-3 py-2", "rounded-md border border-
|
|
61
|
+
className: twMerge("flex h-9 w-full items-center justify-between px-3 py-2", "rounded-md border border-border bg-background", "hover:hover-effect", "hover:hover-effect", "focus:ring-1 focus:ring-ring focus:ring-offset-0 focus:outline-none", "focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-0", disabled && ["pointer-events-auto! cursor-not-allowed bg-background", "hover:hover-effect"], className),
|
|
62
62
|
...props,
|
|
63
63
|
ref,
|
|
64
64
|
children: /* @__PURE__ */ jsx(SelectedContent, {
|