@trsys-tech/matrix-library 0.5.3 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/combobox.es.js +32 -30
- package/dist/combobox.es.js.map +1 -1
- package/dist/components/combobox/Combobox.d.ts +5 -1
- package/dist/components/combobox/Combobox.d.ts.map +1 -1
- package/dist/components/tooltip/Tooltip.d.ts +5 -3
- package/dist/components/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/tooltip.es.js +18 -20
- package/dist/tooltip.es.js.map +1 -1
- package/package.json +1 -1
package/dist/combobox.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as l, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import a, { useRef as
|
|
3
|
-
import { XMark as
|
|
2
|
+
import a, { useRef as A, useMemo as B } from "react";
|
|
3
|
+
import { XMark as M, ChevronDown as O, Check as S } from "@trsys-tech/matrix-icons";
|
|
4
4
|
import { cn as h } from "./utils.es.js";
|
|
5
|
-
import { Button as
|
|
6
|
-
import { Popover as
|
|
7
|
-
import { Command as
|
|
8
|
-
const
|
|
5
|
+
import { Button as G } from "./button.es.js";
|
|
6
|
+
import { Popover as T, PopoverTrigger as X, PopoverContent as q } from "./popover.es.js";
|
|
7
|
+
import { Command as z, CommandInput as H, CommandList as J, CommandEmpty as Q, CommandItem as x, CommandGroup as U } from "./command.es.js";
|
|
8
|
+
const oe = ({
|
|
9
9
|
onValueChange: t,
|
|
10
10
|
options: d,
|
|
11
11
|
value: r,
|
|
@@ -21,32 +21,33 @@ const re = ({
|
|
|
21
21
|
emptyOptionsText: k = "No Items",
|
|
22
22
|
showSearchInput: m = !0,
|
|
23
23
|
modalPopover: N,
|
|
24
|
-
|
|
24
|
+
extraContent: P,
|
|
25
|
+
...L
|
|
25
26
|
}) => {
|
|
26
|
-
const [f, s] = a.useState(!1), b =
|
|
27
|
+
const [f, s] = a.useState(!1), b = A(null), D = a.useCallback(
|
|
27
28
|
(e) => {
|
|
28
29
|
e.key === "Enter" ? s(!0) : e.key === "Backspace" && !e.currentTarget.value && (t?.(r), i && s(!1));
|
|
29
30
|
},
|
|
30
31
|
[t, i, r]
|
|
31
|
-
),
|
|
32
|
+
), j = a.useCallback(
|
|
32
33
|
(e) => {
|
|
33
34
|
t?.(e), i && s(!1);
|
|
34
35
|
},
|
|
35
36
|
[t, i]
|
|
36
|
-
),
|
|
37
|
+
), E = a.useCallback(
|
|
37
38
|
(e) => {
|
|
38
39
|
e.stopPropagation(), t?.(void 0);
|
|
39
40
|
},
|
|
40
41
|
[t]
|
|
41
|
-
),
|
|
42
|
+
), I = a.useCallback((e, R, _ = [""]) => _.join("").toLocaleLowerCase().includes(R.toLocaleLowerCase()) ? 1 : 0, []), F = a.useCallback(
|
|
42
43
|
(e) => {
|
|
43
44
|
m || (e.preventDefault(), b.current?.focus());
|
|
44
45
|
},
|
|
45
46
|
[m]
|
|
46
|
-
), c = r === void 0 || r === "",
|
|
47
|
-
return /* @__PURE__ */ l(
|
|
48
|
-
/* @__PURE__ */ o(
|
|
49
|
-
|
|
47
|
+
), c = r === void 0 || r === "", K = B(() => c && n ? p : c ? u : d.find((e) => e.value === r)?.label || u, [c, r, d, u, n, p]);
|
|
48
|
+
return /* @__PURE__ */ l(T, { open: f, onOpenChange: s, modal: N, children: [
|
|
49
|
+
/* @__PURE__ */ o(X, { asChild: !0, children: /* @__PURE__ */ l(
|
|
50
|
+
G,
|
|
50
51
|
{
|
|
51
52
|
variant: "text",
|
|
52
53
|
role: "combobox",
|
|
@@ -61,50 +62,51 @@ const re = ({
|
|
|
61
62
|
loading: n,
|
|
62
63
|
disabled: v,
|
|
63
64
|
endIcon: /* @__PURE__ */ o(
|
|
64
|
-
|
|
65
|
+
O,
|
|
65
66
|
{
|
|
66
67
|
role: "button",
|
|
67
68
|
"aria-label": "Expand dropdown",
|
|
68
69
|
className: "!h-4.5 !w-4.5 cursor-pointer group-data-[state=open]:rotate-180 transition-transform ms-auto"
|
|
69
70
|
}
|
|
70
71
|
),
|
|
71
|
-
...
|
|
72
|
+
...L,
|
|
72
73
|
children: [
|
|
73
|
-
/* @__PURE__ */ o("span", { className: "text-start text-ellipsis whitespace-nowrap overflow-hidden flex-1 max-w-[calc(100%-24px)]", children:
|
|
74
|
+
/* @__PURE__ */ o("span", { className: "text-start text-ellipsis whitespace-nowrap overflow-hidden flex-1 max-w-[calc(100%-24px)]", children: K }),
|
|
74
75
|
y && r !== void 0 && r !== null ? /* @__PURE__ */ o(
|
|
75
76
|
"span",
|
|
76
77
|
{
|
|
77
|
-
onClick:
|
|
78
|
+
onClick: E,
|
|
78
79
|
className: "p-0 rounded-sm text-xs font-normal transition-colors focus-visible:outline-none disabled:pointer-events-none disabled:bg-muted disabled:text-gray-500 text-primary hover:bg-primary-50 focus:bg-transparent focus:ring active:bg-primary-50 active:text-primary-700 [&>svg]:h-4.5 [&>svg]:w-4.5",
|
|
79
80
|
role: "button",
|
|
80
81
|
"aria-label": "Clear selection",
|
|
81
|
-
children: /* @__PURE__ */ o(
|
|
82
|
+
children: /* @__PURE__ */ o(M, {})
|
|
82
83
|
}
|
|
83
84
|
) : null
|
|
84
85
|
]
|
|
85
86
|
}
|
|
86
87
|
) }),
|
|
87
|
-
/* @__PURE__ */ o(
|
|
88
|
-
|
|
88
|
+
/* @__PURE__ */ o(q, { className: "w-auto p-0", align: "start", onEscapeKeyDown: () => s(!1), onOpenAutoFocus: F, children: /* @__PURE__ */ l(
|
|
89
|
+
z,
|
|
89
90
|
{
|
|
90
91
|
className: "w-[--radix-popper-anchor-width] focus-visible:outline-none",
|
|
91
|
-
filter:
|
|
92
|
+
filter: I,
|
|
92
93
|
defaultValue: r != null ? String(r) : void 0,
|
|
93
94
|
ref: b,
|
|
94
95
|
children: [
|
|
95
|
-
m && /* @__PURE__ */ o(
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
m && /* @__PURE__ */ o(H, { placeholder: g, onKeyDown: D }),
|
|
97
|
+
P,
|
|
98
|
+
/* @__PURE__ */ l(J, { children: [
|
|
99
|
+
!n && /* @__PURE__ */ o(Q, { children: C }),
|
|
98
100
|
!n && !d.length ? /* @__PURE__ */ o(x, { value: "8fdcaeb67c8ad943c80fe54c3b1059b700d9254389a38a4a1fc39a6eee7564623", disabled: !0, children: k }) : null,
|
|
99
|
-
/* @__PURE__ */ o(
|
|
101
|
+
/* @__PURE__ */ o(U, { children: d.map((e) => /* @__PURE__ */ l(
|
|
100
102
|
x,
|
|
101
103
|
{
|
|
102
104
|
value: e.value,
|
|
103
105
|
keywords: "keyword" in e ? [e.keyword] : [e.label],
|
|
104
|
-
onSelect:
|
|
106
|
+
onSelect: j,
|
|
105
107
|
children: [
|
|
106
108
|
e.label,
|
|
107
|
-
/* @__PURE__ */ o(
|
|
109
|
+
/* @__PURE__ */ o(S, { className: h("ml-auto", r === e.value ? "opacity-100" : "opacity-0") })
|
|
108
110
|
]
|
|
109
111
|
},
|
|
110
112
|
String(e.value)
|
|
@@ -116,6 +118,6 @@ const re = ({
|
|
|
116
118
|
] });
|
|
117
119
|
};
|
|
118
120
|
export {
|
|
119
|
-
|
|
121
|
+
oe as Combobox
|
|
120
122
|
};
|
|
121
123
|
//# 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, { useMemo, useRef } from \"react\";\r\nimport { Check, ChevronDown, XMark } from \"@trsys-tech/matrix-icons\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\nimport { Button } from \"../button/Button\";\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 } | { label: React.ReactElement; value: T; keyword: string })[];\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\n * Whether to show the search input.\r\n * @default true\r\n */\r\n showSearchInput?: boolean;\r\n\r\n /**\r\n * Whether to show the clear button.\r\n * @default false\r\n */\r\n clearable?: boolean;\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 clearable = false,\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 showSearchInput = true,\r\n modalPopover,\r\n ...props\r\n}: ComboboxProps<T>) => {\r\n const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);\r\n const commandRef = useRef<HTMLDivElement>(null);\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 onValueChange?.(value!);\r\n if (closeOnSelect) setIsPopoverOpen(false);\r\n }\r\n },\r\n [onValueChange, closeOnSelect, value],\r\n );\r\n\r\n const handleSelect = React.useCallback(\r\n (currentValue: T) => {\r\n onValueChange?.(currentValue);\r\n if (closeOnSelect) setIsPopoverOpen(false);\r\n },\r\n [onValueChange, closeOnSelect],\r\n );\r\n\r\n const handleClear = React.useCallback(\r\n (e: React.MouseEvent) => {\r\n e.stopPropagation();\r\n onValueChange?.(undefined as unknown as T);\r\n },\r\n [onValueChange],\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 // when search input is not shown, we need to focus on the command manually to enable keyboard navigation\r\n const handleOpenAutoFocus = React.useCallback(\r\n (e: Event) => {\r\n if (!showSearchInput) {\r\n e.preventDefault();\r\n commandRef.current?.focus();\r\n }\r\n },\r\n [showSearchInput],\r\n );\r\n\r\n const showPlaceholder = value === undefined || value === \"\";\r\n\r\n const label = useMemo(() => {\r\n if (showPlaceholder && loading) return loadingText;\r\n if (showPlaceholder) return placeholder;\r\n return options.find(option => option.value === value)?.label || placeholder;\r\n }, [showPlaceholder, value, options, placeholder, loading, loadingText]);\r\n\r\n return (\r\n <Popover open={isPopoverOpen} onOpenChange={setIsPopoverOpen} modal={modalPopover}>\r\n <PopoverTrigger asChild>\r\n <Button\r\n variant=\"text\"\r\n role=\"combobox\"\r\n type=\"button\"\r\n aria-expanded={isPopoverOpen}\r\n className={cn(\r\n \"group flex h-8 w-full items-center justify-between whitespace-nowrap overflow-hidden rounded-sm border border-input bg-transparent px-3 py-1.5 text-xs 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 [&_svg]:disabled:text-text-300\",\r\n className,\r\n )}\r\n data-value={value}\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 <span className=\"text-start text-ellipsis whitespace-nowrap overflow-hidden flex-1 max-w-[calc(100%-24px)]\">{label}</span>\r\n {clearable && value !== undefined && value !== null ? (\r\n <span\r\n onClick={handleClear}\r\n className=\"p-0 rounded-sm text-xs font-normal transition-colors focus-visible:outline-none disabled:pointer-events-none disabled:bg-muted disabled:text-gray-500 text-primary hover:bg-primary-50 focus:bg-transparent focus:ring active:bg-primary-50 active:text-primary-700 [&>svg]:h-4.5 [&>svg]:w-4.5\"\r\n role=\"button\"\r\n aria-label=\"Clear selection\"\r\n >\r\n <XMark />\r\n </span>\r\n ) : null}\r\n </Button>\r\n </PopoverTrigger>\r\n <PopoverContent className=\"w-auto p-0\" align=\"start\" onEscapeKeyDown={() => setIsPopoverOpen(false)} onOpenAutoFocus={handleOpenAutoFocus}>\r\n <Command\r\n className=\"w-[--radix-popper-anchor-width] focus-visible:outline-none\"\r\n filter={handleFilter}\r\n defaultValue={value !== undefined && value !== null ? String(value) : undefined} // highlight selected value on open\r\n ref={commandRef}\r\n >\r\n {showSearchInput && <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={\"keyword\" in option ? [option.keyword] : [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","clearable","closeOnSelect","loading","disabled","placeholder","searchText","noResultsText","loadingText","emptyOptionsText","showSearchInput","modalPopover","props","isPopoverOpen","setIsPopoverOpen","React","commandRef","useRef","handleInputKeyDown","event","handleSelect","currentValue","handleClear","handleFilter","search","keywords","handleOpenAutoFocus","showPlaceholder","label","useMemo","option","Popover","jsx","PopoverTrigger","jsxs","Button","cn","ChevronDown","XMark","PopoverContent","Command","CommandInput","CommandList","CommandEmpty","CommandItem","CommandGroup","Check"],"mappings":";;;;;;;AAkGA,MAAMA,KAAW,CAA4B;AAAA,EAC3C,eAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,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,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,GAAA,EAAa,aAAanC,GAAY,WAAWY,GAAoB;AAAA,4BACzFwB,GAAA,EACE,UAAA;AAAA,YAAA,CAACvC,KAAW,gBAAA6B,EAACW,GAAA,EAAc,UAAApC,EAAA,CAAc;AAAA,YACzC,CAACJ,KAAW,CAACL,EAAQ,SACpB,gBAAAkC,EAACY,GAAA,EAAY,OAAM,qEAAoE,UAAQ,IAC5F,UAAAnC,EAAA,CACH,IACE;AAAA,YACJ,gBAAAuB,EAACa,GAAA,EACE,UAAA/C,EAAQ,IAAI,CAAAgC,MACX,gBAAAI;AAAA,cAACU;AAAA,cAAA;AAAA,gBAEC,OAAOd,EAAO;AAAA,gBACd,UAAU,aAAaA,IAAS,CAACA,EAAO,OAAO,IAAI,CAACA,EAAO,KAAK;AAAA,gBAChE,UAAUV;AAAA,gBAET,UAAA;AAAA,kBAAAU,EAAO;AAAA,kBACR,gBAAAE,EAACc,GAAA,EAAM,WAAWV,EAAG,WAAWrC,MAAU+B,EAAO,QAAQ,gBAAgB,WAAW,EAAA,CAAG;AAAA,gBAAA;AAAA,cAAA;AAAA,cANlF,OAAOA,EAAO,KAAK;AAAA,YAAA,CAQ3B,EAAA,CACH;AAAA,UAAA,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,EACF,CACF;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, { useMemo, useRef } from \"react\";\r\nimport { Check, ChevronDown, XMark } from \"@trsys-tech/matrix-icons\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\nimport { Button } from \"../button/Button\";\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 } | { label: React.ReactElement; value: T; keyword: string })[];\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\n * Whether to show the search input.\r\n * @default true\r\n */\r\n showSearchInput?: boolean;\r\n\r\n /**\r\n * Whether to show the clear button.\r\n * @default false\r\n */\r\n clearable?: boolean;\r\n\r\n /**\r\n * Extra content to be displayed in the combobox dropdown.\r\n */\r\n extraContent?: React.ReactNode;\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 clearable = false,\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 showSearchInput = true,\r\n modalPopover,\r\n extraContent,\r\n ...props\r\n}: ComboboxProps<T>) => {\r\n const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);\r\n const commandRef = useRef<HTMLDivElement>(null);\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 onValueChange?.(value!);\r\n if (closeOnSelect) setIsPopoverOpen(false);\r\n }\r\n },\r\n [onValueChange, closeOnSelect, value],\r\n );\r\n\r\n const handleSelect = React.useCallback(\r\n (currentValue: T) => {\r\n onValueChange?.(currentValue);\r\n if (closeOnSelect) setIsPopoverOpen(false);\r\n },\r\n [onValueChange, closeOnSelect],\r\n );\r\n\r\n const handleClear = React.useCallback(\r\n (e: React.MouseEvent) => {\r\n e.stopPropagation();\r\n onValueChange?.(undefined as unknown as T);\r\n },\r\n [onValueChange],\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 // when search input is not shown, we need to focus on the command manually to enable keyboard navigation\r\n const handleOpenAutoFocus = React.useCallback(\r\n (e: Event) => {\r\n if (!showSearchInput) {\r\n e.preventDefault();\r\n commandRef.current?.focus();\r\n }\r\n },\r\n [showSearchInput],\r\n );\r\n\r\n const showPlaceholder = value === undefined || value === \"\";\r\n\r\n const label = useMemo(() => {\r\n if (showPlaceholder && loading) return loadingText;\r\n if (showPlaceholder) return placeholder;\r\n return options.find(option => option.value === value)?.label || placeholder;\r\n }, [showPlaceholder, value, options, placeholder, loading, loadingText]);\r\n\r\n return (\r\n <Popover open={isPopoverOpen} onOpenChange={setIsPopoverOpen} modal={modalPopover}>\r\n <PopoverTrigger asChild>\r\n <Button\r\n variant=\"text\"\r\n role=\"combobox\"\r\n type=\"button\"\r\n aria-expanded={isPopoverOpen}\r\n className={cn(\r\n \"group flex h-8 w-full items-center justify-between whitespace-nowrap overflow-hidden rounded-sm border border-input bg-transparent px-3 py-1.5 text-xs 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 [&_svg]:disabled:text-text-300\",\r\n className,\r\n )}\r\n data-value={value}\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 <span className=\"text-start text-ellipsis whitespace-nowrap overflow-hidden flex-1 max-w-[calc(100%-24px)]\">{label}</span>\r\n {clearable && value !== undefined && value !== null ? (\r\n <span\r\n onClick={handleClear}\r\n className=\"p-0 rounded-sm text-xs font-normal transition-colors focus-visible:outline-none disabled:pointer-events-none disabled:bg-muted disabled:text-gray-500 text-primary hover:bg-primary-50 focus:bg-transparent focus:ring active:bg-primary-50 active:text-primary-700 [&>svg]:h-4.5 [&>svg]:w-4.5\"\r\n role=\"button\"\r\n aria-label=\"Clear selection\"\r\n >\r\n <XMark />\r\n </span>\r\n ) : null}\r\n </Button>\r\n </PopoverTrigger>\r\n <PopoverContent className=\"w-auto p-0\" align=\"start\" onEscapeKeyDown={() => setIsPopoverOpen(false)} onOpenAutoFocus={handleOpenAutoFocus}>\r\n <Command\r\n className=\"w-[--radix-popper-anchor-width] focus-visible:outline-none\"\r\n filter={handleFilter}\r\n defaultValue={value !== undefined && value !== null ? String(value) : undefined} // highlight selected value on open\r\n ref={commandRef}\r\n >\r\n {showSearchInput && <CommandInput placeholder={searchText} onKeyDown={handleInputKeyDown} />}\r\n {extraContent}\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={\"keyword\" in option ? [option.keyword] : [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","clearable","closeOnSelect","loading","disabled","placeholder","searchText","noResultsText","loadingText","emptyOptionsText","showSearchInput","modalPopover","extraContent","props","isPopoverOpen","setIsPopoverOpen","React","commandRef","useRef","handleInputKeyDown","event","handleSelect","currentValue","handleClear","handleFilter","search","keywords","handleOpenAutoFocus","showPlaceholder","label","useMemo","option","Popover","jsx","PopoverTrigger","jsxs","Button","cn","ChevronDown","XMark","PopoverContent","Command","CommandInput","CommandList","CommandEmpty","CommandItem","CommandGroup","Check"],"mappings":";;;;;;;AAuGA,MAAMA,KAAW,CAA4B;AAAA,EAC3C,eAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,eAAAC,IAAgB;AAAA,EAChB,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC,IAAc;AA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O,OAAOA,CAAK,IAAI;AAAA,QACtE,KAAKkB;AAAA,QAEJ,UAAA;AAAA,UAAAP,KAAmB,gBAAAuB,EAACS,GAAA,EAAa,aAAapC,GAAY,WAAWa,GAAoB;AAAA,UACzFP;AAAA,4BACA+B,GAAA,EACE,UAAA;AAAA,YAAA,CAACxC,KAAW,gBAAA8B,EAACW,GAAA,EAAc,UAAArC,EAAA,CAAc;AAAA,YACzC,CAACJ,KAAW,CAACL,EAAQ,SACpB,gBAAAmC,EAACY,GAAA,EAAY,OAAM,qEAAoE,UAAQ,IAC5F,UAAApC,EAAA,CACH,IACE;AAAA,YACJ,gBAAAwB,EAACa,GAAA,EACE,UAAAhD,EAAQ,IAAI,CAAAiC,MACX,gBAAAI;AAAA,cAACU;AAAA,cAAA;AAAA,gBAEC,OAAOd,EAAO;AAAA,gBACd,UAAU,aAAaA,IAAS,CAACA,EAAO,OAAO,IAAI,CAACA,EAAO,KAAK;AAAA,gBAChE,UAAUV;AAAA,gBAET,UAAA;AAAA,kBAAAU,EAAO;AAAA,kBACR,gBAAAE,EAACc,GAAA,EAAM,WAAWV,EAAG,WAAWtC,MAAUgC,EAAO,QAAQ,gBAAgB,WAAW,EAAA,CAAG;AAAA,gBAAA;AAAA,cAAA;AAAA,cANlF,OAAOA,EAAO,KAAK;AAAA,YAAA,CAQ3B,EAAA,CACH;AAAA,UAAA,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,EACF,CACF;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -79,7 +79,11 @@ type ComboboxProps<T extends string | number> = React.HTMLAttributes<HTMLButtonE
|
|
|
79
79
|
* @default false
|
|
80
80
|
*/
|
|
81
81
|
clearable?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Extra content to be displayed in the combobox dropdown.
|
|
84
|
+
*/
|
|
85
|
+
extraContent?: React.ReactNode;
|
|
82
86
|
};
|
|
83
|
-
declare const Combobox: <T extends string | number>({ onValueChange, options, value, className, clearable, closeOnSelect, loading, disabled, placeholder, searchText, noResultsText, loadingText, emptyOptionsText, showSearchInput, modalPopover, ...props }: ComboboxProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
87
|
+
declare const Combobox: <T extends string | number>({ onValueChange, options, value, className, clearable, closeOnSelect, loading, disabled, placeholder, searchText, noResultsText, loadingText, emptyOptionsText, showSearchInput, modalPopover, extraContent, ...props }: ComboboxProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
84
88
|
export { Combobox, type ComboboxProps };
|
|
85
89
|
//# 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,KAA0B,MAAM,OAAO,CAAC;AAQ/C,KAAK,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,GAAG;IACxF;;;;;OAKG;IACH,OAAO,EAAE,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,CAAC,CAAA;KAAE,GAAG;QAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC;QAAC,KAAK,EAAE,CAAC,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;IAEpG;;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;I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,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAChC,CAAC;AAEF,QAAA,MAAM,QAAQ,GAAI,CAAC,SAAS,MAAM,GAAG,MAAM,2NAkBxC,aAAa,CAAC,CAAC,CAAC,4CA+HlB,CAAC;AACF,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { TooltipProps, TooltipProviderProps, TooltipTriggerProps
|
|
1
|
+
import { Content, TooltipContentProps as ContentProps, TooltipProps, TooltipProviderProps, TooltipTriggerProps } from '@radix-ui/react-tooltip';
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
declare const TooltipProvider: React.FC<TooltipProviderProps>;
|
|
4
4
|
declare const Tooltip: React.FC<TooltipProps>;
|
|
5
5
|
declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
-
declare const TooltipContent: React.ForwardRefExoticComponent<
|
|
7
|
-
type TooltipContentProps =
|
|
6
|
+
declare const TooltipContent: React.ForwardRefExoticComponent<ContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
type TooltipContentProps = ContentProps & {
|
|
8
|
+
ref: React.Ref<React.ElementRef<typeof Content>>;
|
|
9
|
+
};
|
|
8
10
|
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, type TooltipProps, type TooltipContentProps, type TooltipTriggerProps, type TooltipProviderProps, };
|
|
9
11
|
//# sourceMappingURL=Tooltip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/Tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/Tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,OAAO,EACP,mBAAmB,IAAI,YAAY,EAEnC,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AAIjC,QAAA,MAAM,eAAe,gCAAW,CAAC;AAEjC,QAAA,MAAM,OAAO,wBAAO,CAAC;AAErB,QAAA,MAAM,cAAc,+FAAU,CAAC;AAE/B,QAAA,MAAM,cAAc,qFAelB,CAAC;AAEH,KAAK,mBAAmB,GAAG,YAAY,GAAG;IAAE,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAA;CAAE,CAAC;AAE/F,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,GAC1B,CAAC"}
|