@trsys-tech/matrix-library 0.3.7 → 0.3.9
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/badge.es.js +22 -17
- package/dist/badge.es.js.map +1 -1
- package/dist/combobox.es.js +36 -32
- package/dist/combobox.es.js.map +1 -1
- package/dist/components/badge/Badge.d.ts +37 -2
- package/dist/components/badge/Badge.d.ts.map +1 -1
- package/dist/components/combobox/Combobox.d.ts +2 -2
- package/dist/components/combobox/Combobox.d.ts.map +1 -1
- package/dist/formcombobox.es.js +16 -16
- package/dist/formcombobox.es.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/badge.es.js
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { tv as
|
|
3
|
-
import { cn as
|
|
4
|
-
const
|
|
5
|
-
base: "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
2
|
+
import { tv as t } from "tailwind-variants";
|
|
3
|
+
import { cn as g } from "./utils.es.js";
|
|
4
|
+
const a = t({
|
|
5
|
+
base: "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent",
|
|
6
6
|
variants: {
|
|
7
7
|
variant: {
|
|
8
|
-
primary: "
|
|
9
|
-
secondary: "
|
|
8
|
+
primary: "bg-primary text-primary-foreground hover:bg-primary-600",
|
|
9
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary-600",
|
|
10
10
|
outline: "border border-primary text-primary hover:bg-primary-50",
|
|
11
|
-
danger: "
|
|
12
|
-
success: "
|
|
13
|
-
warning: "
|
|
14
|
-
info: "
|
|
15
|
-
primaryInverse: "
|
|
16
|
-
successInverse: "
|
|
17
|
-
dangerInverse: "
|
|
18
|
-
warningInverse: "
|
|
19
|
-
infoInverse: "
|
|
11
|
+
danger: "bg-danger text-danger-foreground hover:bg-danger-600",
|
|
12
|
+
success: "bg-success text-success-foreground hover:bg-success-600",
|
|
13
|
+
warning: "bg-warning text-warning-foreground hover:bg-warning-600",
|
|
14
|
+
info: "bg-info text-info-foreground hover:bg-info-600",
|
|
15
|
+
primaryInverse: "bg-primary-100 text-primary-700 hover:bg-primary-50",
|
|
16
|
+
successInverse: "bg-success-300 text-success-700 hover:bg-success-200",
|
|
17
|
+
dangerInverse: "bg-danger-300 text-danger-600 hover:bg-danger-200",
|
|
18
|
+
warningInverse: "bg-warning-300 text-warning-800 hover:bg-warning-200",
|
|
19
|
+
infoInverse: "bg-info-300 text-info-700 hover:bg-info-200",
|
|
20
|
+
purpleInverce: "bg-purple-200 text-purple-500 hover:bg-purple-100",
|
|
21
|
+
coralInverce: "bg-coral-300 text-coral-600 hover:bg-coral-200",
|
|
22
|
+
turquoiseInverce: "bg-turquoise-200 text-turquoise-600 hover:bg-turquoise-100",
|
|
23
|
+
limeInverce: "bg-lime-300 text-lime-700 hover:bg-lime-200",
|
|
24
|
+
grayInverce: "bg-gray-300 text-text-500 hover:bg-gray-200"
|
|
20
25
|
}
|
|
21
26
|
},
|
|
22
27
|
defaultVariants: {
|
|
23
28
|
variant: "primary"
|
|
24
29
|
}
|
|
25
|
-
}),
|
|
30
|
+
}), c = ({ className: r, variant: e, ...n }) => /* @__PURE__ */ o("div", { className: g(a({ variant: e }), r), ...n });
|
|
26
31
|
export {
|
|
27
|
-
|
|
32
|
+
c as Badge
|
|
28
33
|
};
|
|
29
34
|
//# sourceMappingURL=badge.es.js.map
|
package/dist/badge.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.es.js","sources":["../src/components/badge/Badge.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { tv, type VariantProps } from \"tailwind-variants\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\n\r\nconst badgeVariants = tv({\r\n base: \"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2\",\r\n variants: {\r\n variant: {\r\n primary: \"
|
|
1
|
+
{"version":3,"file":"badge.es.js","sources":["../src/components/badge/Badge.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { tv, type VariantProps } from \"tailwind-variants\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\n\r\nconst badgeVariants = tv({\r\n base: \"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent\",\r\n variants: {\r\n variant: {\r\n primary: \"bg-primary text-primary-foreground hover:bg-primary-600\",\r\n secondary: \"bg-secondary text-secondary-foreground hover:bg-secondary-600\",\r\n outline: \"border border-primary text-primary hover:bg-primary-50\",\r\n danger: \"bg-danger text-danger-foreground hover:bg-danger-600\",\r\n success: \"bg-success text-success-foreground hover:bg-success-600\",\r\n warning: \"bg-warning text-warning-foreground hover:bg-warning-600\",\r\n info: \"bg-info text-info-foreground hover:bg-info-600\",\r\n primaryInverse: \"bg-primary-100 text-primary-700 hover:bg-primary-50\",\r\n successInverse: \"bg-success-300 text-success-700 hover:bg-success-200\",\r\n dangerInverse: \"bg-danger-300 text-danger-600 hover:bg-danger-200\",\r\n warningInverse: \"bg-warning-300 text-warning-800 hover:bg-warning-200\",\r\n infoInverse: \"bg-info-300 text-info-700 hover:bg-info-200\",\r\n purpleInverce: \"bg-purple-200 text-purple-500 hover:bg-purple-100\",\r\n coralInverce: \"bg-coral-300 text-coral-600 hover:bg-coral-200\",\r\n turquoiseInverce: \"bg-turquoise-200 text-turquoise-600 hover:bg-turquoise-100\",\r\n limeInverce: \"bg-lime-300 text-lime-700 hover:bg-lime-200\",\r\n grayInverce: \"bg-gray-300 text-text-500 hover:bg-gray-200\",\r\n },\r\n },\r\n defaultVariants: {\r\n variant: \"primary\",\r\n },\r\n});\r\n\r\nexport type BadgeVariant = VariantProps<typeof badgeVariants>[\"variant\"];\r\n\r\ninterface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {\r\n variant?: BadgeVariant;\r\n}\r\n\r\nconst Badge: React.FC<BadgeProps> = ({ className, variant, ...props }) => {\r\n return <div className={cn(badgeVariants({ variant }), className)} {...props} />;\r\n};\r\n\r\nexport { Badge, type BadgeProps };\r\n"],"names":["badgeVariants","tv","Badge","className","variant","props","jsx","cn"],"mappings":";;;AAOA,MAAMA,IAAgBC,EAAG;AAAA,EACvB,MAAM;AAAA,EACN,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAAS;AAAA,MACT,WAAW;AAAA,MACX,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,SAAS;AAAA,MACT,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,gBAAgB;AAAA,MAChB,eAAe;AAAA,MACf,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,eAAe;AAAA,MACf,cAAc;AAAA,MACd,kBAAkB;AAAA,MAClB,aAAa;AAAA,MACb,aAAa;AAAA,IAAA;AAAA,EAEjB;AAAA,EACA,iBAAiB;AAAA,IACf,SAAS;AAAA,EAAA;AAEb,CAAC,GAQKC,IAA8B,CAAC,EAAE,WAAAC,GAAW,SAAAC,GAAS,GAAGC,QACpD,gBAAAC,EAAA,OAAA,EAAI,WAAWC,EAAGP,EAAc,EAAE,SAAAI,EAAS,CAAA,GAAGD,CAAS,GAAI,GAAGE,EAAO,CAAA;"}
|
package/dist/combobox.es.js
CHANGED
|
@@ -1,38 +1,42 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import t from "react";
|
|
1
|
+
import { jsxs as c, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import t, { useEffect as E } from "react";
|
|
3
3
|
import { cn as f } from "./utils.es.js";
|
|
4
4
|
import { Button as j } from "./button.es.js";
|
|
5
|
-
import { ChevronDown as D, Check as
|
|
6
|
-
import { Popover as
|
|
7
|
-
import { Command as
|
|
8
|
-
const
|
|
9
|
-
onValueChange:
|
|
10
|
-
options:
|
|
11
|
-
|
|
5
|
+
import { ChevronDown as D, Check as K } from "@trsys-tech/matrix-icons";
|
|
6
|
+
import { Popover as _, PopoverTrigger as B, PopoverContent as T } from "./popover.es.js";
|
|
7
|
+
import { Command as F, CommandInput as G, CommandList as R, CommandEmpty as q, CommandItem as b, CommandGroup as z } from "./command.es.js";
|
|
8
|
+
const W = ({
|
|
9
|
+
onValueChange: n,
|
|
10
|
+
options: i,
|
|
11
|
+
value: l,
|
|
12
12
|
className: h,
|
|
13
|
-
closeOnSelect:
|
|
14
|
-
loading:
|
|
15
|
-
disabled:
|
|
16
|
-
placeholder:
|
|
13
|
+
closeOnSelect: d = !0,
|
|
14
|
+
loading: s,
|
|
15
|
+
disabled: w,
|
|
16
|
+
placeholder: v = "Select an option",
|
|
17
17
|
searchText: x = "Search...",
|
|
18
18
|
noResultsText: y = "No results found",
|
|
19
19
|
loadingText: g = "Loading...",
|
|
20
20
|
emptyOptionsText: C = "No Items",
|
|
21
21
|
...k
|
|
22
22
|
}) => {
|
|
23
|
-
const [u, o] = t.useState(!1), [a, m] = t.useState(
|
|
23
|
+
const [u, o] = t.useState(!1), [a, m] = t.useState(l), N = t.useCallback(
|
|
24
24
|
(e) => {
|
|
25
|
-
e.key === "Enter" ? o(!0) : e.key === "Backspace" && !e.currentTarget.value && (m(a),
|
|
25
|
+
e.key === "Enter" ? o(!0) : e.key === "Backspace" && !e.currentTarget.value && (m(a), n?.(a), d && o(!1));
|
|
26
26
|
},
|
|
27
|
-
[a,
|
|
27
|
+
[a, n, d]
|
|
28
28
|
), I = t.useCallback(
|
|
29
29
|
(e) => {
|
|
30
|
-
m(e),
|
|
30
|
+
m(e), n?.(e), d && o(!1);
|
|
31
31
|
},
|
|
32
|
-
[
|
|
33
|
-
), L = t.useCallback((e, P, S = [""]) => S.join("").toLocaleLowerCase().includes(P.toLocaleLowerCase()) ? 1 : 0, [])
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
[n, d]
|
|
33
|
+
), L = t.useCallback((e, P, S = [""]) => S.join("").toLocaleLowerCase().includes(P.toLocaleLowerCase()) ? 1 : 0, []);
|
|
34
|
+
E(() => {
|
|
35
|
+
m(l);
|
|
36
|
+
}, [l]);
|
|
37
|
+
const p = a === void 0 || a === "";
|
|
38
|
+
return /* @__PURE__ */ c(_, { open: u, onOpenChange: o, children: [
|
|
39
|
+
/* @__PURE__ */ r(B, { asChild: !0, children: /* @__PURE__ */ r(
|
|
36
40
|
j,
|
|
37
41
|
{
|
|
38
42
|
variant: "text",
|
|
@@ -45,8 +49,8 @@ const U = ({
|
|
|
45
49
|
),
|
|
46
50
|
"data-value": a,
|
|
47
51
|
"data-placeholder": p ? "" : void 0,
|
|
48
|
-
loading:
|
|
49
|
-
disabled:
|
|
52
|
+
loading: s,
|
|
53
|
+
disabled: w,
|
|
50
54
|
endIcon: /* @__PURE__ */ r(
|
|
51
55
|
D,
|
|
52
56
|
{
|
|
@@ -56,15 +60,15 @@ const U = ({
|
|
|
56
60
|
}
|
|
57
61
|
),
|
|
58
62
|
...k,
|
|
59
|
-
children: p ?
|
|
63
|
+
children: p ? s ? g : v : i.find((e) => e.value === a)?.label
|
|
60
64
|
}
|
|
61
65
|
) }),
|
|
62
|
-
/* @__PURE__ */ r(
|
|
63
|
-
/* @__PURE__ */ r(
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
!
|
|
66
|
-
!
|
|
67
|
-
/* @__PURE__ */ r(
|
|
66
|
+
/* @__PURE__ */ r(T, { className: "w-auto p-0", align: "start", onEscapeKeyDown: () => o(!1), children: /* @__PURE__ */ c(F, { className: "w-[--radix-popper-anchor-width]", filter: L, children: [
|
|
67
|
+
/* @__PURE__ */ r(G, { placeholder: x, onKeyDown: N }),
|
|
68
|
+
/* @__PURE__ */ c(R, { children: [
|
|
69
|
+
!s && /* @__PURE__ */ r(q, { children: y }),
|
|
70
|
+
!s && !i.length ? /* @__PURE__ */ r(b, { value: "8fdcaeb67c8ad943c80fe54c3b1059b700d9254389a38a4a1fc39a6eee7564623", disabled: !0, children: C }) : null,
|
|
71
|
+
/* @__PURE__ */ r(z, { children: i.map((e) => /* @__PURE__ */ c(
|
|
68
72
|
b,
|
|
69
73
|
{
|
|
70
74
|
value: e.value,
|
|
@@ -72,7 +76,7 @@ const U = ({
|
|
|
72
76
|
onSelect: I,
|
|
73
77
|
children: [
|
|
74
78
|
e.label,
|
|
75
|
-
/* @__PURE__ */ r(
|
|
79
|
+
/* @__PURE__ */ r(K, { className: f("ml-auto", l === e.value ? "opacity-100" : "opacity-0") })
|
|
76
80
|
]
|
|
77
81
|
},
|
|
78
82
|
String(e.value)
|
|
@@ -82,6 +86,6 @@ const U = ({
|
|
|
82
86
|
] });
|
|
83
87
|
};
|
|
84
88
|
export {
|
|
85
|
-
|
|
89
|
+
W as Combobox
|
|
86
90
|
};
|
|
87
91
|
//# sourceMappingURL=combobox.es.js.map
|
package/dist/combobox.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.es.js","sources":["../src/components/combobox/Combobox.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport React from \"react\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\nimport { Button } from \"../button/Button\";\r\nimport { Check, ChevronDown } from \"@trsys-tech/matrix-icons\";\r\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover/Popover\";\r\nimport { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from \"../command/Command\";\r\n\r\ntype ComboboxProps<T extends string | number> = React.HTMLAttributes<HTMLButtonElement> & {\r\n /**\r\n * The options to display in the combobox.\r\n * Each option should have a label and a value.\r\n * The label is what is displayed in the combobox.\r\n * The value is what is returned when the option is selected.\r\n */\r\n options: { label: string; value: T }[];\r\n\r\n /**\r\n * The value of the combobox.\r\n */\r\n selectedValue?: T;\r\n\r\n /**\r\n * A function that is called when the value of the combobox changes.\r\n */\r\n onValueChange?: (value: T) => void;\r\n\r\n /**\r\n * Placeholder text to be displayed when no values are selected.\r\n * @default \"Select an option\"\r\n */\r\n placeholder?: string;\r\n\r\n /**\r\n * The modality of the popover. When set to true, interaction with outside elements\r\n * will be disabled and only popover content will be visible to screen readers.\r\n * Optional\r\n * @default false\r\n */\r\n modalPopover?: boolean;\r\n\r\n /**\r\n * The text to display in the search input.\r\n * @default \"Search...\"\r\n */\r\n searchText?: string;\r\n\r\n /**\r\n * The text to display when no results are found.\r\n * @default \"No results found\"\r\n */\r\n noResultsText?: string;\r\n\r\n /**\r\n * Whether the popover should close when an option is selected.\r\n * @default true\r\n */\r\n closeOnSelect?: boolean;\r\n\r\n /**\r\n * Whether the combobox is loading.\r\n * @default false\r\n */\r\n loading?: boolean;\r\n\r\n /**\r\n * Whether the combobox is disabled.\r\n * @default false\r\n */\r\n disabled?: boolean;\r\n\r\n /**\r\n * The text to display when the combobox is loading.\r\n * @default \"Loading...\"\r\n */\r\n loadingText?: string;\r\n\r\n /**\r\n * The text to display when there are no options.\r\n * @default \"No Items\"\r\n */\r\n emptyOptionsText?: string;\r\n};\r\n\r\nconst Combobox = <T extends string | number>({\r\n onValueChange,\r\n options,\r\n selectedValue,\r\n className,\r\n closeOnSelect = true,\r\n loading,\r\n disabled,\r\n placeholder = \"Select an option\",\r\n searchText = \"Search...\",\r\n noResultsText = \"No results found\",\r\n loadingText = \"Loading...\",\r\n emptyOptionsText = \"No Items\",\r\n ...props\r\n}: ComboboxProps<T>) => {\r\n const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);\r\n\r\n const [currentSelectedValue, setCurrentSelectedValue] = React.useState<T | undefined>(selectedValue);\r\n\r\n const handleInputKeyDown = React.useCallback(\r\n (event: React.KeyboardEvent<HTMLInputElement>) => {\r\n if (event.key === \"Enter\") {\r\n setIsPopoverOpen(true);\r\n } else if (event.key === \"Backspace\" && !event.currentTarget.value) {\r\n setCurrentSelectedValue(currentSelectedValue);\r\n onValueChange?.(currentSelectedValue!);\r\n if (closeOnSelect) setIsPopoverOpen(false);\r\n }\r\n },\r\n [currentSelectedValue, onValueChange, closeOnSelect],\r\n );\r\n\r\n const handleSelect = React.useCallback(\r\n (currentValue: T) => {\r\n setCurrentSelectedValue(currentValue);\r\n onValueChange?.(currentValue);\r\n if (closeOnSelect) setIsPopoverOpen(false);\r\n },\r\n [onValueChange, closeOnSelect],\r\n );\r\n\r\n const handleFilter = React.useCallback((value: string, search: string, keywords: string[] = [\"\"]) => {\r\n return keywords.join(\"\").toLocaleLowerCase().includes(search.toLocaleLowerCase()) ? 1 : 0;\r\n }, []);\r\n\r\n const showPlaceholder = currentSelectedValue === undefined || currentSelectedValue === \"\";\r\n\r\n return (\r\n <Popover open={isPopoverOpen} onOpenChange={setIsPopoverOpen}>\r\n <PopoverTrigger asChild>\r\n <Button\r\n variant=\"text\"\r\n role=\"combobox\"\r\n aria-expanded={isPopoverOpen}\r\n className={cn(\r\n \"group flex h-8 w-full items-center justify-between whitespace-nowrap rounded-sm border border-input bg-transparent px-3 py-1.5 text-sm ring-offset-background data-[placeholder]:text-muted-foreground hover:border hover:border-primary hover:bg-transparent focus:border focus:border-primary focus:outline-none focus:ring focus:ring-primary-100 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-text-300 disabled:border-gray-100 [&>span]:line-clamp-1 [&_svg]:disabled:text-text-300\",\r\n // showPlaceholder ? \"text-muted-foreground\" : \"\",\r\n className,\r\n )}\r\n data-value={currentSelectedValue}\r\n data-placeholder={showPlaceholder ? \"\" : undefined}\r\n loading={loading}\r\n disabled={disabled}\r\n endIcon={\r\n <ChevronDown\r\n role=\"button\"\r\n aria-label=\"Expand dropdown\"\r\n className=\"!h-4.5 !w-4.5 cursor-pointer group-data-[state=open]:rotate-180 transition-transform ms-auto\"\r\n />\r\n }\r\n {...props}\r\n >\r\n {!showPlaceholder ? options.find(option => option.value === currentSelectedValue)?.label : loading ? loadingText : placeholder}\r\n </Button>\r\n </PopoverTrigger>\r\n <PopoverContent className=\"w-auto p-0\" align=\"start\" onEscapeKeyDown={() => setIsPopoverOpen(false)}>\r\n <Command className=\"w-[--radix-popper-anchor-width]\" filter={handleFilter}>\r\n <CommandInput placeholder={searchText} onKeyDown={handleInputKeyDown} />\r\n <CommandList>\r\n {!loading && <CommandEmpty>{noResultsText}</CommandEmpty>}\r\n {!loading && !options.length ? (\r\n <CommandItem value=\"8fdcaeb67c8ad943c80fe54c3b1059b700d9254389a38a4a1fc39a6eee7564623\" disabled>\r\n {emptyOptionsText}\r\n </CommandItem>\r\n ) : null}\r\n <CommandGroup>\r\n {options.map(option => (\r\n <CommandItem\r\n key={String(option.value)}\r\n value={option.value}\r\n keywords={[option.label]}\r\n onSelect={handleSelect as React.ComponentProps<typeof CommandItem>[\"onSelect\"]}\r\n >\r\n {option.label}\r\n <Check className={cn(\"ml-auto\", selectedValue === option.value ? \"opacity-100\" : \"opacity-0\")} />\r\n </CommandItem>\r\n ))}\r\n </CommandGroup>\r\n </CommandList>\r\n </Command>\r\n </PopoverContent>\r\n </Popover>\r\n );\r\n};\r\nexport { Combobox, type ComboboxProps };\r\n"],"names":["Combobox","onValueChange","options","selectedValue","className","closeOnSelect","loading","disabled","placeholder","searchText","noResultsText","loadingText","emptyOptionsText","props","isPopoverOpen","setIsPopoverOpen","React","currentSelectedValue","setCurrentSelectedValue","handleInputKeyDown","event","handleSelect","currentValue","handleFilter","value","search","keywords","showPlaceholder","jsxs","Popover","jsx","PopoverTrigger","Button","cn","ChevronDown","option","PopoverContent","Command","CommandInput","CommandList","CommandEmpty","CommandItem","CommandGroup","Check"],"mappings":";;;;;;;AAsFA,MAAMA,IAAW,CAA4B;AAAA,EAC3C,eAAAC;AAAA,EACA,SAAAC;AAAA,EACA,eAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA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A;AAAA,IAAA,EAAA,CACF,EACF,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"combobox.es.js","sources":["../src/components/combobox/Combobox.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport React, { useEffect } from \"react\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\nimport { Button } from \"../button/Button\";\r\nimport { Check, ChevronDown } from \"@trsys-tech/matrix-icons\";\r\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover/Popover\";\r\nimport { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from \"../command/Command\";\r\n\r\ntype ComboboxProps<T extends string | number> = React.HTMLAttributes<HTMLButtonElement> & {\r\n /**\r\n * The options to display in the combobox.\r\n * Each option should have a label and a value.\r\n * The label is what is displayed in the combobox.\r\n * The value is what is returned when the option is selected.\r\n */\r\n options: { label: string; value: T }[];\r\n\r\n /**\r\n * The value of the combobox.\r\n */\r\n value?: T;\r\n\r\n /**\r\n * A function that is called when the value of the combobox changes.\r\n */\r\n onValueChange?: (value: T) => void;\r\n\r\n /**\r\n * Placeholder text to be displayed when no values are selected.\r\n * @default \"Select an option\"\r\n */\r\n placeholder?: string;\r\n\r\n /**\r\n * The modality of the popover. When set to true, interaction with outside elements\r\n * will be disabled and only popover content will be visible to screen readers.\r\n * Optional\r\n * @default false\r\n */\r\n modalPopover?: boolean;\r\n\r\n /**\r\n * The text to display in the search input.\r\n * @default \"Search...\"\r\n */\r\n searchText?: string;\r\n\r\n /**\r\n * The text to display when no results are found.\r\n * @default \"No results found\"\r\n */\r\n noResultsText?: string;\r\n\r\n /**\r\n * Whether the popover should close when an option is selected.\r\n * @default true\r\n */\r\n closeOnSelect?: boolean;\r\n\r\n /**\r\n * Whether the combobox is loading.\r\n * @default false\r\n */\r\n loading?: boolean;\r\n\r\n /**\r\n * Whether the combobox is disabled.\r\n * @default false\r\n */\r\n disabled?: boolean;\r\n\r\n /**\r\n * The text to display when the combobox is loading.\r\n * @default \"Loading...\"\r\n */\r\n loadingText?: string;\r\n\r\n /**\r\n * The text to display when there are no options.\r\n * @default \"No Items\"\r\n */\r\n emptyOptionsText?: string;\r\n};\r\n\r\nconst Combobox = <T extends string | number>({\r\n onValueChange,\r\n options,\r\n value,\r\n className,\r\n closeOnSelect = true,\r\n loading,\r\n disabled,\r\n placeholder = \"Select an option\",\r\n searchText = \"Search...\",\r\n noResultsText = \"No results found\",\r\n loadingText = \"Loading...\",\r\n emptyOptionsText = \"No Items\",\r\n ...props\r\n}: ComboboxProps<T>) => {\r\n const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);\r\n\r\n const [currentSelectedValue, setCurrentSelectedValue] = React.useState<T | undefined>(value);\r\n\r\n const handleInputKeyDown = React.useCallback(\r\n (event: React.KeyboardEvent<HTMLInputElement>) => {\r\n if (event.key === \"Enter\") {\r\n setIsPopoverOpen(true);\r\n } else if (event.key === \"Backspace\" && !event.currentTarget.value) {\r\n setCurrentSelectedValue(currentSelectedValue);\r\n onValueChange?.(currentSelectedValue!);\r\n if (closeOnSelect) setIsPopoverOpen(false);\r\n }\r\n },\r\n [currentSelectedValue, onValueChange, closeOnSelect],\r\n );\r\n\r\n const handleSelect = React.useCallback(\r\n (currentValue: T) => {\r\n setCurrentSelectedValue(currentValue);\r\n onValueChange?.(currentValue);\r\n if (closeOnSelect) setIsPopoverOpen(false);\r\n },\r\n [onValueChange, closeOnSelect],\r\n );\r\n\r\n const handleFilter = React.useCallback((value: string, search: string, keywords: string[] = [\"\"]) => {\r\n return keywords.join(\"\").toLocaleLowerCase().includes(search.toLocaleLowerCase()) ? 1 : 0;\r\n }, []);\r\n\r\n useEffect(() => {\r\n setCurrentSelectedValue(value);\r\n }, [value]);\r\n\r\n const showPlaceholder = currentSelectedValue === undefined || currentSelectedValue === \"\";\r\n\r\n return (\r\n <Popover open={isPopoverOpen} onOpenChange={setIsPopoverOpen}>\r\n <PopoverTrigger asChild>\r\n <Button\r\n variant=\"text\"\r\n role=\"combobox\"\r\n aria-expanded={isPopoverOpen}\r\n className={cn(\r\n \"group flex h-8 w-full items-center justify-between whitespace-nowrap rounded-sm border border-input bg-transparent px-3 py-1.5 text-sm ring-offset-background data-[placeholder]:text-muted-foreground hover:border hover:border-primary hover:bg-transparent focus:border focus:border-primary focus:outline-none focus:ring focus:ring-primary-100 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-text-300 disabled:border-gray-100 [&>span]:line-clamp-1 [&_svg]:disabled:text-text-300\",\r\n // showPlaceholder ? \"text-muted-foreground\" : \"\",\r\n className,\r\n )}\r\n data-value={currentSelectedValue}\r\n data-placeholder={showPlaceholder ? \"\" : undefined}\r\n loading={loading}\r\n disabled={disabled}\r\n endIcon={\r\n <ChevronDown\r\n role=\"button\"\r\n aria-label=\"Expand dropdown\"\r\n className=\"!h-4.5 !w-4.5 cursor-pointer group-data-[state=open]:rotate-180 transition-transform ms-auto\"\r\n />\r\n }\r\n {...props}\r\n >\r\n {!showPlaceholder ? options.find(option => option.value === currentSelectedValue)?.label : loading ? loadingText : placeholder}\r\n </Button>\r\n </PopoverTrigger>\r\n <PopoverContent className=\"w-auto p-0\" align=\"start\" onEscapeKeyDown={() => setIsPopoverOpen(false)}>\r\n <Command className=\"w-[--radix-popper-anchor-width]\" filter={handleFilter}>\r\n <CommandInput placeholder={searchText} onKeyDown={handleInputKeyDown} />\r\n <CommandList>\r\n {!loading && <CommandEmpty>{noResultsText}</CommandEmpty>}\r\n {!loading && !options.length ? (\r\n <CommandItem value=\"8fdcaeb67c8ad943c80fe54c3b1059b700d9254389a38a4a1fc39a6eee7564623\" disabled>\r\n {emptyOptionsText}\r\n </CommandItem>\r\n ) : null}\r\n <CommandGroup>\r\n {options.map(option => (\r\n <CommandItem\r\n key={String(option.value)}\r\n value={option.value}\r\n keywords={[option.label]}\r\n onSelect={handleSelect as React.ComponentProps<typeof CommandItem>[\"onSelect\"]}\r\n >\r\n {option.label}\r\n <Check className={cn(\"ml-auto\", value === option.value ? \"opacity-100\" : \"opacity-0\")} />\r\n </CommandItem>\r\n ))}\r\n </CommandGroup>\r\n </CommandList>\r\n </Command>\r\n </PopoverContent>\r\n </Popover>\r\n );\r\n};\r\nexport { Combobox, type ComboboxProps };\r\n"],"names":["Combobox","onValueChange","options","value","className","closeOnSelect","loading","disabled","placeholder","searchText","noResultsText","loadingText","emptyOptionsText","props","isPopoverOpen","setIsPopoverOpen","React","currentSelectedValue","setCurrentSelectedValue","handleInputKeyDown","event","handleSelect","currentValue","handleFilter","search","keywords","useEffect","showPlaceholder","jsxs","Popover","jsx","PopoverTrigger","Button","cn","ChevronDown","option","PopoverContent","Command","CommandInput","CommandList","CommandEmpty","CommandItem","CommandGroup","Check"],"mappings":";;;;;;;AAsFA,MAAMA,IAAW,CAA4B;AAAA,EAC3C,eAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,YAAAC,IAAa;AAAA,EACb,eAAAC,IAAgB;AAAA,EAChB,aAAAC,IAAc;AAAA,EACd,kBAAAC,IAAmB;AAAA,EACnB,GAAGC;AACL,MAAwB;AACtB,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAM,SAAS,EAAK,GAExD,CAACC,GAAsBC,CAAuB,IAAIF,EAAM,SAAwBb,CAAK,GAErFgB,IAAqBH,EAAM;AAAA,IAC/B,CAACI,MAAiD;AAC5C,MAAAA,EAAM,QAAQ,UAChBL,EAAiB,EAAI,IACZK,EAAM,QAAQ,eAAe,CAACA,EAAM,cAAc,UAC3DF,EAAwBD,CAAoB,GAC5ChB,IAAgBgB,CAAqB,GACjCZ,OAAgC,EAAK;AAAA,IAE7C;AAAA,IACA,CAACY,GAAsBhB,GAAeI,CAAa;AAAA,EACrD,GAEMgB,IAAeL,EAAM;AAAA,IACzB,CAACM,MAAoB;AACnB,MAAAJ,EAAwBI,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AO,EAACQ,GAAa,EAAA,aAAa7B,GAAY,WAAWU,GAAoB;AAAA,wBACrEoB,GACE,EAAA,UAAA;AAAA,QAAC,CAAAjC,KAAY,gBAAAwB,EAAAU,GAAA,EAAc,UAAc9B,EAAA,CAAA;AAAA,QACzC,CAACJ,KAAW,CAACJ,EAAQ,SACpB,gBAAA4B,EAACW,GAAY,EAAA,OAAM,qEAAoE,UAAQ,IAC5F,UAAA7B,EAAA,CACH,IACE;AAAA,QACH,gBAAAkB,EAAAY,GAAA,EACE,UAAQxC,EAAA,IAAI,CACXiC,MAAA,gBAAAP;AAAA,UAACa;AAAA,UAAA;AAAA,YAEC,OAAON,EAAO;AAAA,YACd,UAAU,CAACA,EAAO,KAAK;AAAA,YACvB,UAAUd;AAAA,YAET,UAAA;AAAA,cAAOc,EAAA;AAAA,cACR,gBAAAL,EAACa,GAAM,EAAA,WAAWV,EAAG,WAAW9B,MAAUgC,EAAO,QAAQ,gBAAgB,WAAW,EAAG,CAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UANlF,OAAOA,EAAO,KAAK;AAAA,QAAA,CAQ3B,EACH,CAAA;AAAA,MAAA,EACF,CAAA;AAAA,IAAA,EAAA,CACF,EACF,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -15,8 +15,13 @@ declare const badgeVariants: TVReturnType<{
|
|
|
15
15
|
dangerInverse: string;
|
|
16
16
|
warningInverse: string;
|
|
17
17
|
infoInverse: string;
|
|
18
|
+
purpleInverce: string;
|
|
19
|
+
coralInverce: string;
|
|
20
|
+
turquoiseInverce: string;
|
|
21
|
+
limeInverce: string;
|
|
22
|
+
grayInverce: string;
|
|
18
23
|
};
|
|
19
|
-
}, undefined, "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", TVConfig<{
|
|
24
|
+
}, undefined, "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent", TVConfig<{
|
|
20
25
|
variant: {
|
|
21
26
|
primary: string;
|
|
22
27
|
secondary: string;
|
|
@@ -30,6 +35,11 @@ declare const badgeVariants: TVReturnType<{
|
|
|
30
35
|
dangerInverse: string;
|
|
31
36
|
warningInverse: string;
|
|
32
37
|
infoInverse: string;
|
|
38
|
+
purpleInverce: string;
|
|
39
|
+
coralInverce: string;
|
|
40
|
+
turquoiseInverce: string;
|
|
41
|
+
limeInverce: string;
|
|
42
|
+
grayInverce: string;
|
|
33
43
|
};
|
|
34
44
|
}, {
|
|
35
45
|
variant: {
|
|
@@ -45,6 +55,11 @@ declare const badgeVariants: TVReturnType<{
|
|
|
45
55
|
dangerInverse: string;
|
|
46
56
|
warningInverse: string;
|
|
47
57
|
infoInverse: string;
|
|
58
|
+
purpleInverce: string;
|
|
59
|
+
coralInverce: string;
|
|
60
|
+
turquoiseInverce: string;
|
|
61
|
+
limeInverce: string;
|
|
62
|
+
grayInverce: string;
|
|
48
63
|
};
|
|
49
64
|
}>, {
|
|
50
65
|
variant: {
|
|
@@ -60,6 +75,11 @@ declare const badgeVariants: TVReturnType<{
|
|
|
60
75
|
dangerInverse: string;
|
|
61
76
|
warningInverse: string;
|
|
62
77
|
infoInverse: string;
|
|
78
|
+
purpleInverce: string;
|
|
79
|
+
coralInverce: string;
|
|
80
|
+
turquoiseInverce: string;
|
|
81
|
+
limeInverce: string;
|
|
82
|
+
grayInverce: string;
|
|
63
83
|
};
|
|
64
84
|
}, undefined, TVReturnType<{
|
|
65
85
|
variant: {
|
|
@@ -75,8 +95,13 @@ declare const badgeVariants: TVReturnType<{
|
|
|
75
95
|
dangerInverse: string;
|
|
76
96
|
warningInverse: string;
|
|
77
97
|
infoInverse: string;
|
|
98
|
+
purpleInverce: string;
|
|
99
|
+
coralInverce: string;
|
|
100
|
+
turquoiseInverce: string;
|
|
101
|
+
limeInverce: string;
|
|
102
|
+
grayInverce: string;
|
|
78
103
|
};
|
|
79
|
-
}, undefined, "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", TVConfig<{
|
|
104
|
+
}, undefined, "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent", TVConfig<{
|
|
80
105
|
variant: {
|
|
81
106
|
primary: string;
|
|
82
107
|
secondary: string;
|
|
@@ -90,6 +115,11 @@ declare const badgeVariants: TVReturnType<{
|
|
|
90
115
|
dangerInverse: string;
|
|
91
116
|
warningInverse: string;
|
|
92
117
|
infoInverse: string;
|
|
118
|
+
purpleInverce: string;
|
|
119
|
+
coralInverce: string;
|
|
120
|
+
turquoiseInverce: string;
|
|
121
|
+
limeInverce: string;
|
|
122
|
+
grayInverce: string;
|
|
93
123
|
};
|
|
94
124
|
}, {
|
|
95
125
|
variant: {
|
|
@@ -105,6 +135,11 @@ declare const badgeVariants: TVReturnType<{
|
|
|
105
135
|
dangerInverse: string;
|
|
106
136
|
warningInverse: string;
|
|
107
137
|
infoInverse: string;
|
|
138
|
+
purpleInverce: string;
|
|
139
|
+
coralInverce: string;
|
|
140
|
+
turquoiseInverce: string;
|
|
141
|
+
limeInverce: string;
|
|
142
|
+
grayInverce: string;
|
|
108
143
|
};
|
|
109
144
|
}>, unknown, unknown, undefined>>;
|
|
110
145
|
export type BadgeVariant = VariantProps<typeof badgeVariants>["variant"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/components/badge/Badge.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAI1D,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/components/badge/Badge.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAI1D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCA0BjB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC;AAEzE,UAAU,UAAW,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC/D,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB;AAED,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAE/B,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,CAAC"}
|
|
@@ -13,7 +13,7 @@ type ComboboxProps<T extends string | number> = React.HTMLAttributes<HTMLButtonE
|
|
|
13
13
|
/**
|
|
14
14
|
* The value of the combobox.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
value?: T;
|
|
17
17
|
/**
|
|
18
18
|
* A function that is called when the value of the combobox changes.
|
|
19
19
|
*/
|
|
@@ -66,6 +66,6 @@ type ComboboxProps<T extends string | number> = React.HTMLAttributes<HTMLButtonE
|
|
|
66
66
|
*/
|
|
67
67
|
emptyOptionsText?: string;
|
|
68
68
|
};
|
|
69
|
-
declare const Combobox: <T extends string | number>({ onValueChange, options,
|
|
69
|
+
declare const Combobox: <T extends string | number>({ onValueChange, options, value, className, closeOnSelect, loading, disabled, placeholder, searchText, noResultsText, loadingText, emptyOptionsText, ...props }: ComboboxProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
70
70
|
export { Combobox, type ComboboxProps };
|
|
71
71
|
//# sourceMappingURL=Combobox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../../src/components/combobox/Combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../../src/components/combobox/Combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAQzC,KAAK,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,GAAG;IACxF;;;;;OAKG;IACH,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,CAAC,CAAA;KAAE,EAAE,CAAC;IAEvC;;OAEG;IACH,KAAK,CAAC,EAAE,CAAC,CAAC;IAEV;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAEnC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,QAAA,MAAM,QAAQ,GAAI,CAAC,SAAS,MAAM,GAAG,MAAM,mKAcxC,aAAa,CAAC,CAAC,CAAC,4CA6FlB,CAAC;AACF,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,CAAC"}
|
package/dist/formcombobox.es.js
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { FormField as f, FormItem as C, FormLabel as P, FormControl as
|
|
1
|
+
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { FormField as f, FormItem as C, FormLabel as P, FormControl as j, FormMessage as v } from "./form.es.js";
|
|
3
3
|
import { Combobox as I } from "./combobox.es.js";
|
|
4
|
-
const
|
|
4
|
+
const V = (s) => {
|
|
5
5
|
const {
|
|
6
|
-
name:
|
|
6
|
+
name: t,
|
|
7
7
|
control: m,
|
|
8
8
|
defaultValue: a,
|
|
9
9
|
disabled: o,
|
|
10
10
|
rules: d,
|
|
11
11
|
shouldUnregister: i,
|
|
12
12
|
label: p,
|
|
13
|
-
options:
|
|
14
|
-
loading:
|
|
13
|
+
options: u,
|
|
14
|
+
loading: c,
|
|
15
15
|
loadingText: g,
|
|
16
16
|
emptyOptionsText: x,
|
|
17
17
|
placeholder: b,
|
|
18
18
|
slotProps: r,
|
|
19
19
|
required: h,
|
|
20
20
|
...F
|
|
21
|
-
} =
|
|
21
|
+
} = s;
|
|
22
22
|
return /* @__PURE__ */ e(
|
|
23
23
|
f,
|
|
24
24
|
{
|
|
25
25
|
control: m,
|
|
26
|
-
name:
|
|
26
|
+
name: t,
|
|
27
27
|
defaultValue: a,
|
|
28
28
|
disabled: o,
|
|
29
29
|
rules: d,
|
|
30
30
|
shouldUnregister: i,
|
|
31
|
-
render: ({ field: l }) => /* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
31
|
+
render: ({ field: l }) => /* @__PURE__ */ n(C, { ...F, children: [
|
|
32
|
+
/* @__PURE__ */ n(P, { ...r?.formLabelProps ?? {}, children: [
|
|
33
33
|
p,
|
|
34
34
|
h && /* @__PURE__ */ e("span", { className: "text-danger text-sm leading-4", children: "*" })
|
|
35
35
|
] }),
|
|
36
|
-
/* @__PURE__ */ e(
|
|
36
|
+
/* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(
|
|
37
37
|
I,
|
|
38
38
|
{
|
|
39
|
-
options:
|
|
40
|
-
|
|
39
|
+
options: u,
|
|
40
|
+
value: l.value,
|
|
41
41
|
onValueChange: l.onChange,
|
|
42
|
-
loading:
|
|
42
|
+
loading: c,
|
|
43
43
|
loadingText: g,
|
|
44
44
|
emptyOptionsText: x,
|
|
45
45
|
placeholder: b,
|
|
46
46
|
disabled: o
|
|
47
47
|
}
|
|
48
48
|
) }),
|
|
49
|
-
/* @__PURE__ */ e(
|
|
49
|
+
/* @__PURE__ */ e(v, { ...r?.formMessageProps ?? {} })
|
|
50
50
|
] })
|
|
51
51
|
}
|
|
52
52
|
);
|
|
53
53
|
};
|
|
54
54
|
export {
|
|
55
|
-
|
|
55
|
+
V as FormCombobox
|
|
56
56
|
};
|
|
57
57
|
//# sourceMappingURL=formcombobox.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formcombobox.es.js","sources":["../src/components/form-combobox/FormCombobox.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport { ControllerProps, FieldPath, FieldValues } from \"react-hook-form\";\r\n\r\nimport { FormControl, FormField, FormItem, FormLabel, FormMessage } from \"../form/Form\";\r\nimport { Combobox } from \"../combobox/Combobox\";\r\n\r\ntype FormComboboxProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = Omit<\r\n ControllerProps<TFieldValues, TName>,\r\n \"render\"\r\n> &\r\n React.ComponentProps<typeof FormItem> & {\r\n label: string;\r\n options: { value: string | number; label: string }[];\r\n loading?: boolean;\r\n loadingText?: string;\r\n emptyOptionsText?: string;\r\n placeholder?: string;\r\n required?: boolean;\r\n slotProps?: {\r\n formLabelProps?: React.HTMLAttributes<HTMLLabelElement> & React.RefAttributes<HTMLLabelElement>;\r\n formMessageProps?: React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>;\r\n comboboxProps?: React.ComponentProps<typeof Combobox>;\r\n };\r\n };\r\n\r\nconst FormCombobox = <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(\r\n props: FormComboboxProps<TFieldValues, TName>,\r\n) => {\r\n const {\r\n name,\r\n control,\r\n defaultValue,\r\n disabled,\r\n rules,\r\n shouldUnregister,\r\n label,\r\n options,\r\n loading,\r\n loadingText,\r\n emptyOptionsText,\r\n placeholder,\r\n slotProps,\r\n required,\r\n ...formItemProps\r\n } = props;\r\n\r\n return (\r\n <FormField\r\n control={control}\r\n name={name}\r\n defaultValue={defaultValue}\r\n disabled={disabled}\r\n rules={rules}\r\n shouldUnregister={shouldUnregister}\r\n render={({ field }) => {\r\n return (\r\n <FormItem {...formItemProps}>\r\n <FormLabel {...(slotProps?.formLabelProps ?? {})}>\r\n {label}\r\n {required && <span className=\"text-danger text-sm leading-4\">*</span>}\r\n </FormLabel>\r\n <FormControl>\r\n <Combobox\r\n options={options}\r\n
|
|
1
|
+
{"version":3,"file":"formcombobox.es.js","sources":["../src/components/form-combobox/FormCombobox.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport { ControllerProps, FieldPath, FieldValues } from \"react-hook-form\";\r\n\r\nimport { FormControl, FormField, FormItem, FormLabel, FormMessage } from \"../form/Form\";\r\nimport { Combobox } from \"../combobox/Combobox\";\r\n\r\ntype FormComboboxProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = Omit<\r\n ControllerProps<TFieldValues, TName>,\r\n \"render\"\r\n> &\r\n React.ComponentProps<typeof FormItem> & {\r\n label: string;\r\n options: { value: string | number; label: string }[];\r\n loading?: boolean;\r\n loadingText?: string;\r\n emptyOptionsText?: string;\r\n placeholder?: string;\r\n required?: boolean;\r\n slotProps?: {\r\n formLabelProps?: React.HTMLAttributes<HTMLLabelElement> & React.RefAttributes<HTMLLabelElement>;\r\n formMessageProps?: React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>;\r\n comboboxProps?: React.ComponentProps<typeof Combobox>;\r\n };\r\n };\r\n\r\nconst FormCombobox = <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(\r\n props: FormComboboxProps<TFieldValues, TName>,\r\n) => {\r\n const {\r\n name,\r\n control,\r\n defaultValue,\r\n disabled,\r\n rules,\r\n shouldUnregister,\r\n label,\r\n options,\r\n loading,\r\n loadingText,\r\n emptyOptionsText,\r\n placeholder,\r\n slotProps,\r\n required,\r\n ...formItemProps\r\n } = props;\r\n\r\n return (\r\n <FormField\r\n control={control}\r\n name={name}\r\n defaultValue={defaultValue}\r\n disabled={disabled}\r\n rules={rules}\r\n shouldUnregister={shouldUnregister}\r\n render={({ field }) => {\r\n return (\r\n <FormItem {...formItemProps}>\r\n <FormLabel {...(slotProps?.formLabelProps ?? {})}>\r\n {label}\r\n {required && <span className=\"text-danger text-sm leading-4\">*</span>}\r\n </FormLabel>\r\n <FormControl>\r\n <Combobox\r\n options={options}\r\n value={field.value}\r\n onValueChange={field.onChange}\r\n loading={loading}\r\n loadingText={loadingText}\r\n emptyOptionsText={emptyOptionsText}\r\n placeholder={placeholder}\r\n disabled={disabled}\r\n />\r\n </FormControl>\r\n\r\n <FormMessage {...(slotProps?.formMessageProps ?? {})} />\r\n </FormItem>\r\n );\r\n }}\r\n />\r\n );\r\n};\r\nexport { FormCombobox, type FormComboboxProps };\r\n"],"names":["FormCombobox","props","name","control","defaultValue","disabled","rules","shouldUnregister","label","options","loading","loadingText","emptyOptionsText","placeholder","slotProps","required","formItemProps","jsx","FormField","field","jsxs","FormItem","FormLabel","FormControl","Combobox","FormMessage"],"mappings":";;;AA0BM,MAAAA,IAAe,CACnBC,MACG;AACG,QAAA;AAAA,IACJ,MAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,OAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,OAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,aAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDf;AAGF,SAAA,gBAAAgB;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAAf;AAAA,MACA,MAAAD;AAAA,MACA,cAAAE;AAAA,MACA,UAAAC;AAAA,MACA,OAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,QAAQ,CAAC,EAAE,OAAAY,QAEP,gBAAAC,EAACC,GAAU,EAAA,GAAGL,GACZ,UAAA;AAAA,QAAA,gBAAAI,EAACE,GAAW,EAAA,GAAIR,GAAW,kBAAkB,CAC1C,GAAA,UAAA;AAAA,UAAAN;AAAA,UACAO,KAAY,gBAAAE,EAAC,QAAK,EAAA,WAAU,iCAAgC,UAAC,IAAA,CAAA;AAAA,QAAA,GAChE;AAAA,0BACCM,GACC,EAAA,UAAA,gBAAAN;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,SAAAf;AAAA,YACA,OAAOU,EAAM;AAAA,YACb,eAAeA,EAAM;AAAA,YACrB,SAAAT;AAAA,YACA,aAAAC;AAAA,YACA,kBAAAC;AAAA,YACA,aAAAC;AAAA,YACA,UAAAR;AAAA,UAAA;AAAA,QAAA,GAEJ;AAAA,0BAECoB,GAAa,EAAA,GAAIX,GAAW,oBAAoB,CAAA,EAAK,CAAA;AAAA,MAAA,GACxD;AAAA,IAEJ;AAAA,EACF;AAEJ;"}
|