jaci-ui 0.4.0 → 0.6.0
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/CHANGELOG.md +14 -0
- package/README.md +68 -0
- package/dist/components/command/command.cjs +55 -34
- package/dist/components/command/command.cjs.map +1 -1
- package/dist/components/command/command.d.cts +1 -0
- package/dist/components/command/command.d.ts +1 -0
- package/dist/components/command/command.js +55 -34
- package/dist/components/command/command.js.map +1 -1
- package/dist/components/data-toolbar/data-toolbar.cjs +141 -0
- package/dist/components/data-toolbar/data-toolbar.cjs.map +1 -0
- package/dist/components/data-toolbar/data-toolbar.d.cts +50 -0
- package/dist/components/data-toolbar/data-toolbar.d.ts +50 -0
- package/dist/components/data-toolbar/data-toolbar.js +132 -0
- package/dist/components/data-toolbar/data-toolbar.js.map +1 -0
- package/dist/components/data-toolbar/index.d.cts +2 -0
- package/dist/components/data-toolbar/index.d.ts +2 -0
- package/dist/components/data-view/data-view.cjs +33 -1
- package/dist/components/data-view/data-view.cjs.map +1 -1
- package/dist/components/data-view/data-view.d.cts +12 -1
- package/dist/components/data-view/data-view.d.ts +12 -1
- package/dist/components/data-view/data-view.js +31 -2
- package/dist/components/data-view/data-view.js.map +1 -1
- package/dist/components/data-view/index.d.cts +2 -2
- package/dist/components/data-view/index.d.ts +2 -2
- package/dist/components/list/list.cjs +3 -1
- package/dist/components/list/list.cjs.map +1 -1
- package/dist/components/list/list.d.cts +3 -1
- package/dist/components/list/list.d.ts +3 -1
- package/dist/components/list/list.js +3 -1
- package/dist/components/list/list.js.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.cjs +3 -3
- package/dist/components/navigation-menu/navigation-menu.cjs.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.js +3 -3
- package/dist/components/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/pagination/index.d.cts +2 -2
- package/dist/components/pagination/index.d.ts +2 -2
- package/dist/components/pagination/pagination.cjs +122 -21
- package/dist/components/pagination/pagination.cjs.map +1 -1
- package/dist/components/pagination/pagination.d.cts +25 -13
- package/dist/components/pagination/pagination.d.ts +25 -13
- package/dist/components/pagination/pagination.js +122 -23
- package/dist/components/pagination/pagination.js.map +1 -1
- package/dist/components/sidebar/sidebar.cjs +59 -11
- package/dist/components/sidebar/sidebar.cjs.map +1 -1
- package/dist/components/sidebar/sidebar.d.cts +13 -0
- package/dist/components/sidebar/sidebar.d.ts +13 -0
- package/dist/components/sidebar/sidebar.js +59 -13
- package/dist/components/sidebar/sidebar.js.map +1 -1
- package/dist/components/stepper/index.d.cts +2 -0
- package/dist/components/stepper/index.d.ts +2 -0
- package/dist/components/stepper/stepper.cjs +341 -0
- package/dist/components/stepper/stepper.cjs.map +1 -0
- package/dist/components/stepper/stepper.d.cts +52 -0
- package/dist/components/stepper/stepper.d.ts +52 -0
- package/dist/components/stepper/stepper.js +330 -0
- package/dist/components/stepper/stepper.js.map +1 -0
- package/dist/components/table/index.d.cts +2 -2
- package/dist/components/table/index.d.ts +2 -2
- package/dist/components/table/table.cjs +265 -46
- package/dist/components/table/table.cjs.map +1 -1
- package/dist/components/table/table.d.cts +41 -8
- package/dist/components/table/table.d.ts +41 -8
- package/dist/components/table/table.js +264 -48
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/toast/toast.cjs +3 -1
- package/dist/components/toast/toast.cjs.map +1 -1
- package/dist/components/toast/toast.js +3 -1
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/components/tree-view/index.d.cts +2 -2
- package/dist/components/tree-view/index.d.ts +2 -2
- package/dist/components/tree-view/tree-view.cjs +60 -3
- package/dist/components/tree-view/tree-view.cjs.map +1 -1
- package/dist/components/tree-view/tree-view.d.cts +12 -1
- package/dist/components/tree-view/tree-view.d.ts +12 -1
- package/dist/components/tree-view/tree-view.js +58 -4
- package/dist/components/tree-view/tree-view.js.map +1 -1
- package/dist/index.cjs +35 -0
- package/dist/index.d.cts +9 -5
- package/dist/index.d.ts +9 -5
- package/dist/index.js +7 -5
- package/dist/styled-system/recipes/data-toolbar.cjs +40 -0
- package/dist/styled-system/recipes/data-toolbar.cjs.map +1 -0
- package/dist/styled-system/recipes/data-toolbar.js +40 -0
- package/dist/styled-system/recipes/data-toolbar.js.map +1 -0
- package/dist/styled-system/recipes/data-view.cjs +3 -0
- package/dist/styled-system/recipes/data-view.cjs.map +1 -1
- package/dist/styled-system/recipes/data-view.js +3 -0
- package/dist/styled-system/recipes/data-view.js.map +1 -1
- package/dist/styled-system/recipes/list.cjs +7 -1
- package/dist/styled-system/recipes/list.cjs.map +1 -1
- package/dist/styled-system/recipes/list.js +7 -1
- package/dist/styled-system/recipes/list.js.map +1 -1
- package/dist/styled-system/recipes/pagination.cjs +9 -1
- package/dist/styled-system/recipes/pagination.cjs.map +1 -1
- package/dist/styled-system/recipes/pagination.js +9 -1
- package/dist/styled-system/recipes/pagination.js.map +1 -1
- package/dist/styled-system/recipes/sidebar.cjs +3 -0
- package/dist/styled-system/recipes/sidebar.cjs.map +1 -1
- package/dist/styled-system/recipes/sidebar.js +3 -0
- package/dist/styled-system/recipes/sidebar.js.map +1 -1
- package/dist/styled-system/recipes/stepper.cjs +53 -0
- package/dist/styled-system/recipes/stepper.cjs.map +1 -0
- package/dist/styled-system/recipes/stepper.js +53 -0
- package/dist/styled-system/recipes/stepper.js.map +1 -0
- package/dist/styled-system/recipes/table.cjs +15 -2
- package/dist/styled-system/recipes/table.cjs.map +1 -1
- package/dist/styled-system/recipes/table.js +15 -2
- package/dist/styled-system/recipes/table.js.map +1 -1
- package/dist/styled-system/recipes/tree-view.cjs +4 -1
- package/dist/styled-system/recipes/tree-view.cjs.map +1 -1
- package/dist/styled-system/recipes/tree-view.js +4 -1
- package/dist/styled-system/recipes/tree-view.js.map +1 -1
- package/dist/styles.css +602 -18
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ function defaultFilter(value, search, keywords) {
|
|
|
17
17
|
if (!query) return true;
|
|
18
18
|
return [value, ...keywords].some((candidate) => candidate.toLocaleLowerCase().includes(query));
|
|
19
19
|
}
|
|
20
|
-
const CommandRoot = forwardRef(function CommandRoot({ children, className, defaultSearch = "", filter = defaultFilter, loading = false, onKeyDown, onSearchChange, search: controlledSearch, shouldFilter = true, loopFocus = true, ...props }, ref) {
|
|
20
|
+
const CommandRoot = forwardRef(function CommandRoot({ children, className, defaultSearch = "", disabled = false, filter = defaultFilter, loading = false, onKeyDown, onSearchChange, search: controlledSearch, shouldFilter = true, loopFocus = true, ...props }, ref) {
|
|
21
21
|
const [uncontrolledSearch, setUncontrolledSearch] = useState(defaultSearch);
|
|
22
22
|
const [highlighted, setHighlighted] = useState(null);
|
|
23
23
|
const [, setVersion] = useState(0);
|
|
@@ -35,7 +35,7 @@ const CommandRoot = forwardRef(function CommandRoot({ children, className, defau
|
|
|
35
35
|
search,
|
|
36
36
|
shouldFilter
|
|
37
37
|
]);
|
|
38
|
-
const visibleItems = items.filter((item) => !item.disabled && matches(item));
|
|
38
|
+
const visibleItems = useMemo(() => items.filter((item) => !item.disabled && matches(item)), [items, matches]);
|
|
39
39
|
const registerItem = useCallback((item) => {
|
|
40
40
|
itemsRef.current.set(item.id, item);
|
|
41
41
|
setVersion((current) => current + 1);
|
|
@@ -48,33 +48,43 @@ const CommandRoot = forwardRef(function CommandRoot({ children, className, defau
|
|
|
48
48
|
const item = itemsRef.current.get(id);
|
|
49
49
|
if (item) item.element = element;
|
|
50
50
|
}, []);
|
|
51
|
-
const selectItem = useCallback((
|
|
52
|
-
const item = itemsRef.current.get(
|
|
51
|
+
const selectItem = useCallback((id) => {
|
|
52
|
+
const item = itemsRef.current.get(id);
|
|
53
53
|
if (item && !item.disabled && matches(item)) item.onSelect?.(item.value);
|
|
54
54
|
}, [matches]);
|
|
55
55
|
useEffect(() => {
|
|
56
|
-
if (!visibleItems.some((item) => item.
|
|
56
|
+
if (!visibleItems.some((item) => item.id === highlighted)) setHighlighted(visibleItems[0]?.id ?? null);
|
|
57
57
|
}, [highlighted, visibleItems]);
|
|
58
|
-
const handleKeyDown = (event) => {
|
|
58
|
+
const handleKeyDown = useCallback((event) => {
|
|
59
59
|
onKeyDown?.(event);
|
|
60
60
|
if (event.defaultPrevented) return;
|
|
61
|
-
|
|
61
|
+
if (disabled) return;
|
|
62
|
+
const currentIndex = visibleItems.findIndex((item) => item.id === highlighted);
|
|
62
63
|
if ((event.key === "ArrowDown" || event.key === "ArrowUp") && visibleItems.length > 0) {
|
|
63
64
|
event.preventDefault();
|
|
64
65
|
let nextIndex = currentIndex + (event.key === "ArrowDown" ? 1 : -1);
|
|
65
66
|
if (loopFocus) nextIndex = (nextIndex + visibleItems.length) % visibleItems.length;
|
|
66
|
-
if (nextIndex >= 0 && nextIndex < visibleItems.length) setHighlighted(visibleItems[nextIndex]?.
|
|
67
|
+
if (nextIndex >= 0 && nextIndex < visibleItems.length) setHighlighted(visibleItems[nextIndex]?.id ?? null);
|
|
67
68
|
} else if (event.key === "Home" || event.key === "End") {
|
|
68
69
|
event.preventDefault();
|
|
69
|
-
setHighlighted((event.key === "Home" ? visibleItems[0] : visibleItems.at(-1))?.
|
|
70
|
+
setHighlighted((event.key === "Home" ? visibleItems[0] : visibleItems.at(-1))?.id ?? null);
|
|
70
71
|
} else if (event.key === "Enter" && highlighted) {
|
|
71
72
|
event.preventDefault();
|
|
72
73
|
selectItem(highlighted);
|
|
73
74
|
} else if (event.key === "Escape") event.preventDefault();
|
|
74
|
-
}
|
|
75
|
+
}, [
|
|
76
|
+
disabled,
|
|
77
|
+
highlighted,
|
|
78
|
+
loopFocus,
|
|
79
|
+
onKeyDown,
|
|
80
|
+
selectItem,
|
|
81
|
+
visibleItems
|
|
82
|
+
]);
|
|
75
83
|
const context = useMemo(() => ({
|
|
76
84
|
search,
|
|
77
85
|
setSearch,
|
|
86
|
+
disabled,
|
|
87
|
+
handleKeyDown,
|
|
78
88
|
loading,
|
|
79
89
|
shouldFilter,
|
|
80
90
|
items,
|
|
@@ -87,6 +97,8 @@ const CommandRoot = forwardRef(function CommandRoot({ children, className, defau
|
|
|
87
97
|
selectItem
|
|
88
98
|
}), [
|
|
89
99
|
highlighted,
|
|
100
|
+
disabled,
|
|
101
|
+
handleKeyDown,
|
|
90
102
|
items,
|
|
91
103
|
listId,
|
|
92
104
|
loading,
|
|
@@ -107,17 +119,16 @@ const CommandRoot = forwardRef(function CommandRoot({ children, className, defau
|
|
|
107
119
|
else if (ref) ref.current = node;
|
|
108
120
|
},
|
|
109
121
|
className: cx(styles.root, className),
|
|
110
|
-
"data-disabled":
|
|
122
|
+
"data-disabled": disabled || void 0,
|
|
111
123
|
"data-jaci-component": "command",
|
|
112
124
|
"data-slot": "command",
|
|
113
|
-
|
|
114
|
-
role: "application",
|
|
125
|
+
"aria-disabled": disabled || void 0,
|
|
115
126
|
children
|
|
116
127
|
})
|
|
117
128
|
});
|
|
118
129
|
});
|
|
119
|
-
const CommandInput = forwardRef(function CommandInput({ className, onChange, ...props }, ref) {
|
|
120
|
-
const { highlighted, listId, search, setHighlighted, setSearch } = useCommandContext();
|
|
130
|
+
const CommandInput = forwardRef(function CommandInput({ className, onChange, onKeyDown, ...props }, ref) {
|
|
131
|
+
const { disabled, handleKeyDown, highlighted, listId, search, setHighlighted, setSearch } = useCommandContext();
|
|
121
132
|
const handleChange = (event) => {
|
|
122
133
|
onChange?.(event);
|
|
123
134
|
const next = event.target.value;
|
|
@@ -127,43 +138,48 @@ const CommandInput = forwardRef(function CommandInput({ className, onChange, ...
|
|
|
127
138
|
return /* @__PURE__ */ jsx("input", {
|
|
128
139
|
...props,
|
|
129
140
|
ref,
|
|
130
|
-
"aria-activedescendant": highlighted
|
|
141
|
+
"aria-activedescendant": highlighted ?? void 0,
|
|
131
142
|
"aria-controls": listId,
|
|
143
|
+
role: "combobox",
|
|
132
144
|
"aria-haspopup": "listbox",
|
|
145
|
+
"aria-expanded": "true",
|
|
133
146
|
className: cx(command().input, className),
|
|
134
147
|
"data-slot": "command-input",
|
|
148
|
+
disabled: disabled || props.disabled,
|
|
135
149
|
onChange: (event) => {
|
|
136
150
|
handleChange(event);
|
|
137
151
|
},
|
|
152
|
+
onKeyDown: (event) => {
|
|
153
|
+
onKeyDown?.(event);
|
|
154
|
+
handleKeyDown(event);
|
|
155
|
+
},
|
|
138
156
|
value: search
|
|
139
157
|
});
|
|
140
158
|
});
|
|
141
159
|
const CommandList = forwardRef(function CommandList({ className, id, ...props }, ref) {
|
|
142
|
-
const {
|
|
143
|
-
const hasVisibleItems = items.some((item) => !item.disabled && matches(item));
|
|
160
|
+
const { listId } = useCommandContext();
|
|
144
161
|
return /* @__PURE__ */ jsx("div", {
|
|
145
162
|
...props,
|
|
146
163
|
ref,
|
|
147
164
|
id: id ?? listId,
|
|
148
165
|
className: cx(command().list, className),
|
|
149
166
|
"data-slot": "command-list",
|
|
150
|
-
role:
|
|
167
|
+
role: "listbox"
|
|
151
168
|
});
|
|
152
169
|
});
|
|
153
170
|
const CommandGroup = forwardRef(function CommandGroup({ children, className, heading, ...props }, ref) {
|
|
154
171
|
const context = useCommandContext();
|
|
155
172
|
const groupId = useId();
|
|
156
|
-
const
|
|
157
|
-
const hasVisibleItems = context.items.some((item) => item.groupId === groupId && context.matches(item));
|
|
173
|
+
const hasVisibleItems = context.items.some((item) => item.groupId === groupId && !item.disabled && context.matches(item));
|
|
158
174
|
return /* @__PURE__ */ jsx(CommandGroupContext.Provider, {
|
|
159
175
|
value: groupId,
|
|
160
176
|
children: /* @__PURE__ */ jsxs("div", {
|
|
161
177
|
...props,
|
|
162
178
|
ref,
|
|
163
|
-
"aria-hidden":
|
|
179
|
+
"aria-hidden": !hasVisibleItems || void 0,
|
|
164
180
|
className: cx(command().group, className),
|
|
165
181
|
"data-slot": "command-group",
|
|
166
|
-
hidden:
|
|
182
|
+
hidden: !hasVisibleItems,
|
|
167
183
|
children: [heading ? /* @__PURE__ */ jsx("div", {
|
|
168
184
|
className: command().groupHeading,
|
|
169
185
|
"data-slot": "command-group-heading",
|
|
@@ -175,14 +191,14 @@ const CommandGroup = forwardRef(function CommandGroup({ children, className, hea
|
|
|
175
191
|
const CommandItem = forwardRef(function CommandItem({ children, className, disabled = false, keywords: itemKeywords, onClick, onMouseEnter, onSelect, value, ...props }, ref) {
|
|
176
192
|
const context = useCommandContext();
|
|
177
193
|
const groupId = useContext(CommandGroupContext);
|
|
178
|
-
const id = `command-item-${
|
|
194
|
+
const id = `command-item-${useId().replace(/:/g, "")}`;
|
|
179
195
|
const keywords = itemKeywords ?? EMPTY_KEYWORDS;
|
|
180
196
|
const visible = context.matches({
|
|
181
197
|
value,
|
|
182
198
|
keywords
|
|
183
199
|
});
|
|
184
200
|
useEffect(() => context.registerItem({
|
|
185
|
-
id
|
|
201
|
+
id,
|
|
186
202
|
value,
|
|
187
203
|
keywords,
|
|
188
204
|
disabled,
|
|
@@ -193,6 +209,7 @@ const CommandItem = forwardRef(function CommandItem({ children, className, disab
|
|
|
193
209
|
context.registerItem,
|
|
194
210
|
disabled,
|
|
195
211
|
groupId,
|
|
212
|
+
id,
|
|
196
213
|
keywords,
|
|
197
214
|
onSelect,
|
|
198
215
|
value
|
|
@@ -206,29 +223,29 @@ const CommandItem = forwardRef(function CommandItem({ children, className, disab
|
|
|
206
223
|
return /* @__PURE__ */ jsx("div", {
|
|
207
224
|
...props,
|
|
208
225
|
ref: (node) => {
|
|
209
|
-
context.setItemElement(
|
|
226
|
+
context.setItemElement(id, node);
|
|
210
227
|
if (typeof ref === "function") ref(node);
|
|
211
228
|
else if (ref) ref.current = node;
|
|
212
229
|
},
|
|
213
230
|
"aria-disabled": disabled || void 0,
|
|
214
|
-
"aria-selected": context.highlighted ===
|
|
231
|
+
"aria-selected": context.highlighted === id,
|
|
215
232
|
className: cx(command().item, className),
|
|
216
233
|
"data-disabled": disabled || void 0,
|
|
217
|
-
"data-highlighted": context.highlighted ===
|
|
234
|
+
"data-highlighted": context.highlighted === id || void 0,
|
|
218
235
|
"data-slot": "command-item",
|
|
219
236
|
id,
|
|
220
237
|
onClick: (event) => {
|
|
221
238
|
onClick?.(event);
|
|
222
|
-
if (!event.defaultPrevented && !disabled) context.selectItem(
|
|
239
|
+
if (!event.defaultPrevented && !disabled) context.selectItem(id);
|
|
223
240
|
},
|
|
224
241
|
onMouseEnter: (event) => {
|
|
225
242
|
onMouseEnter?.(event);
|
|
226
|
-
if (!disabled) context.setHighlighted(
|
|
243
|
+
if (!disabled) context.setHighlighted(id);
|
|
227
244
|
},
|
|
228
245
|
onKeyDown: (event) => {
|
|
229
246
|
if ((event.key === "Enter" || event.key === " ") && !disabled) {
|
|
230
247
|
event.preventDefault();
|
|
231
|
-
context.selectItem(
|
|
248
|
+
context.selectItem(id);
|
|
232
249
|
}
|
|
233
250
|
},
|
|
234
251
|
role: "option",
|
|
@@ -247,14 +264,16 @@ const CommandItemIndicator = forwardRef(function CommandItemIndicator({ children
|
|
|
247
264
|
});
|
|
248
265
|
const CommandEmpty = forwardRef(function CommandEmpty({ className, ...props }, ref) {
|
|
249
266
|
const context = useCommandContext();
|
|
250
|
-
if (context.loading || context.items.
|
|
267
|
+
if (context.loading || context.items.some((item) => !item.disabled && context.matches(item))) return null;
|
|
251
268
|
return /* @__PURE__ */ jsx("div", {
|
|
252
269
|
...props,
|
|
253
270
|
ref,
|
|
254
271
|
className: cx(command().empty, className),
|
|
255
272
|
"aria-live": "polite",
|
|
273
|
+
"aria-disabled": "true",
|
|
256
274
|
"data-slot": "command-empty",
|
|
257
|
-
role: "
|
|
275
|
+
role: "option",
|
|
276
|
+
tabIndex: -1
|
|
258
277
|
});
|
|
259
278
|
});
|
|
260
279
|
const CommandLoading = forwardRef(function CommandLoading({ className, ...props }, ref) {
|
|
@@ -264,8 +283,10 @@ const CommandLoading = forwardRef(function CommandLoading({ className, ...props
|
|
|
264
283
|
ref,
|
|
265
284
|
className: cx(command().loading, className),
|
|
266
285
|
"aria-live": "polite",
|
|
286
|
+
"aria-disabled": "true",
|
|
267
287
|
"data-slot": "command-loading",
|
|
268
|
-
role: "
|
|
288
|
+
role: "option",
|
|
289
|
+
tabIndex: -1
|
|
269
290
|
});
|
|
270
291
|
});
|
|
271
292
|
const CommandSeparator = forwardRef(function CommandSeparator({ className, ...props }, ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","names":[],"sources":["../../../src/components/command/command.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ChangeEvent, ComponentPropsWithoutRef, KeyboardEvent, ReactNode } from \"react\";\n\nimport { command } from \"../../styled-system/recipes\";\nimport { cx } from \"../../styled-system/css\";\n\nexport type CommandFilter = (value: string, search: string, keywords: readonly string[]) => boolean;\n\ninterface CommandItemRecord {\n id: string;\n value: string;\n keywords: readonly string[];\n disabled: boolean;\n groupId: string | undefined;\n onSelect: ((value: string) => void) | undefined;\n element: HTMLDivElement | null;\n}\n\ninterface CommandContextValue {\n search: string;\n setSearch: (search: string) => void;\n loading: boolean;\n shouldFilter: boolean;\n items: readonly CommandItemRecord[];\n highlighted: string | null;\n listId: string;\n matches: (item: Pick<CommandItemRecord, \"value\" | \"keywords\">) => boolean;\n registerItem: (item: CommandItemRecord) => () => void;\n setItemElement: (id: string, element: HTMLDivElement | null) => void;\n setHighlighted: (value: string | null) => void;\n selectItem: (value: string) => void;\n}\n\nconst CommandContext = createContext<CommandContextValue | null>(null);\nconst CommandGroupContext = createContext<string | undefined>(undefined);\nconst EMPTY_KEYWORDS: readonly string[] = [];\n\nfunction useCommandContext() {\n const context = useContext(CommandContext);\n if (!context) throw new Error(\"Command parts must be rendered inside Command.Root.\");\n return context;\n}\n\nfunction defaultFilter(value: string, search: string, keywords: readonly string[]) {\n const query = search.trim().toLocaleLowerCase();\n if (!query) return true;\n return [value, ...keywords].some((candidate) => candidate.toLocaleLowerCase().includes(query));\n}\n\nexport interface CommandRootProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n search?: string;\n defaultSearch?: string;\n onSearchChange?: (search: string) => void;\n filter?: CommandFilter;\n shouldFilter?: boolean;\n loopFocus?: boolean;\n loading?: boolean;\n children?: ReactNode;\n}\n\nexport const CommandRoot = forwardRef<HTMLDivElement, CommandRootProps>(function CommandRoot(\n {\n children,\n className,\n defaultSearch = \"\",\n filter = defaultFilter,\n loading = false,\n onKeyDown,\n onSearchChange,\n search: controlledSearch,\n shouldFilter = true,\n loopFocus = true,\n ...props\n },\n ref,\n) {\n const [uncontrolledSearch, setUncontrolledSearch] = useState(defaultSearch);\n const [highlighted, setHighlighted] = useState<string | null>(null);\n const [, setVersion] = useState(0);\n const itemsRef = useRef(new Map<string, CommandItemRecord>());\n const listId = useId();\n const search = controlledSearch ?? uncontrolledSearch;\n const styles = command();\n\n const items = Array.from(itemsRef.current.values());\n const setSearch = useCallback(\n (next: string) => {\n if (controlledSearch === undefined) setUncontrolledSearch(next);\n onSearchChange?.(next);\n },\n [controlledSearch, onSearchChange],\n );\n const matches = useCallback(\n (item: Pick<CommandItemRecord, \"value\" | \"keywords\">) =>\n !shouldFilter || filter(item.value, search, item.keywords),\n [filter, search, shouldFilter],\n );\n const visibleItems = items.filter((item) => !item.disabled && matches(item));\n\n const registerItem = useCallback((item: CommandItemRecord) => {\n itemsRef.current.set(item.id, item);\n setVersion((current) => current + 1);\n return () => {\n itemsRef.current.delete(item.id);\n setVersion((current) => current + 1);\n };\n }, []);\n\n const setItemElement = useCallback((id: string, element: HTMLDivElement | null) => {\n const item = itemsRef.current.get(id);\n if (item) item.element = element;\n }, []);\n\n const selectItem = useCallback(\n (value: string) => {\n const item = itemsRef.current.get(value);\n if (item && !item.disabled && matches(item)) item.onSelect?.(item.value);\n },\n [matches],\n );\n\n useEffect(() => {\n if (!visibleItems.some((item) => item.value === highlighted)) {\n setHighlighted(visibleItems[0]?.value ?? null);\n }\n }, [highlighted, visibleItems]);\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n const currentIndex = visibleItems.findIndex((item) => item.value === highlighted);\n if ((event.key === \"ArrowDown\" || event.key === \"ArrowUp\") && visibleItems.length > 0) {\n event.preventDefault();\n const direction = event.key === \"ArrowDown\" ? 1 : -1;\n let nextIndex = currentIndex + direction;\n if (loopFocus) nextIndex = (nextIndex + visibleItems.length) % visibleItems.length;\n if (nextIndex >= 0 && nextIndex < visibleItems.length) {\n setHighlighted(visibleItems[nextIndex]?.value ?? null);\n }\n } else if (event.key === \"Home\" || event.key === \"End\") {\n event.preventDefault();\n setHighlighted((event.key === \"Home\" ? visibleItems[0] : visibleItems.at(-1))?.value ?? null);\n } else if (event.key === \"Enter\" && highlighted) {\n event.preventDefault();\n selectItem(highlighted);\n } else if (event.key === \"Escape\") {\n event.preventDefault();\n }\n };\n\n const context = useMemo<CommandContextValue>(\n () => ({\n search,\n setSearch,\n loading,\n shouldFilter,\n items,\n highlighted,\n listId,\n matches,\n registerItem,\n setItemElement,\n setHighlighted,\n selectItem,\n }),\n [\n highlighted,\n items,\n listId,\n loading,\n matches,\n registerItem,\n search,\n selectItem,\n setItemElement,\n setSearch,\n shouldFilter,\n ],\n );\n\n return (\n <CommandContext.Provider value={context}>\n <div\n {...props}\n ref={(node) => {\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n className={cx(styles.root, className)}\n data-disabled={props[\"aria-disabled\"] || undefined}\n data-jaci-component=\"command\"\n data-slot=\"command\"\n onKeyDown={handleKeyDown}\n role=\"application\"\n >\n {children}\n </div>\n </CommandContext.Provider>\n );\n});\n\nexport type CommandInputProps = ComponentPropsWithoutRef<\"input\">;\nexport const CommandInput = forwardRef<HTMLInputElement, CommandInputProps>(function CommandInput(\n { className, onChange, ...props },\n ref,\n) {\n const { highlighted, listId, search, setHighlighted, setSearch } = useCommandContext();\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n const next = event.target.value;\n setHighlighted(null);\n setSearch(next);\n };\n\n return (\n <input\n {...props}\n ref={ref}\n aria-activedescendant={highlighted ? `command-item-${highlighted}` : undefined}\n aria-controls={listId}\n aria-haspopup=\"listbox\"\n className={cx(command().input, className)}\n data-slot=\"command-input\"\n onChange={(event) => {\n handleChange(event);\n }}\n value={search}\n />\n );\n});\n\nexport type CommandListProps = ComponentPropsWithoutRef<\"div\">;\nexport const CommandList = forwardRef<HTMLDivElement, CommandListProps>(function CommandList(\n { className, id, ...props },\n ref,\n) {\n const { items, listId, matches } = useCommandContext();\n const hasVisibleItems = items.some((item) => !item.disabled && matches(item));\n return (\n <div\n {...props}\n ref={ref}\n id={id ?? listId}\n className={cx(command().list, className)}\n data-slot=\"command-list\"\n role={hasVisibleItems ? \"listbox\" : undefined}\n />\n );\n});\n\nexport interface CommandGroupProps extends ComponentPropsWithoutRef<\"div\"> {\n heading?: ReactNode;\n}\nexport const CommandGroup = forwardRef<HTMLDivElement, CommandGroupProps>(function CommandGroup(\n { children, className, heading, ...props },\n ref,\n) {\n const context = useCommandContext();\n const groupId = useId();\n const hasRegisteredItems = context.items.some((item) => item.groupId === groupId);\n const hasVisibleItems = context.items.some(\n (item) => item.groupId === groupId && context.matches(item),\n );\n return (\n <CommandGroupContext.Provider value={groupId}>\n <div\n {...props}\n ref={ref}\n aria-hidden={hasRegisteredItems && !hasVisibleItems ? true : undefined}\n className={cx(command().group, className)}\n data-slot=\"command-group\"\n hidden={hasRegisteredItems && !hasVisibleItems}\n >\n {heading ? (\n <div className={command().groupHeading} data-slot=\"command-group-heading\">\n {heading}\n </div>\n ) : null}\n {children}\n </div>\n </CommandGroupContext.Provider>\n );\n});\n\nexport interface CommandItemProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"onSelect\"> {\n value: string;\n keywords?: readonly string[];\n disabled?: boolean;\n onSelect?: (value: string) => void;\n}\nexport const CommandItem = forwardRef<HTMLDivElement, CommandItemProps>(function CommandItem(\n {\n children,\n className,\n disabled = false,\n keywords: itemKeywords,\n onClick,\n onMouseEnter,\n onSelect,\n value,\n ...props\n },\n ref,\n) {\n const context = useCommandContext();\n const groupId = useContext(CommandGroupContext);\n const id = `command-item-${value}`;\n const keywords = itemKeywords ?? EMPTY_KEYWORDS;\n const visible = context.matches({ value, keywords });\n\n useEffect(\n () =>\n context.registerItem({\n id: value,\n value,\n keywords,\n disabled,\n groupId,\n onSelect,\n element: null,\n }),\n [context.registerItem, disabled, groupId, keywords, onSelect, value],\n );\n\n if (!visible) {\n return <div aria-hidden=\"true\" hidden ref={ref} data-slot=\"command-item\" />;\n }\n\n return (\n <div\n {...props}\n ref={(node) => {\n context.setItemElement(value, node);\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n aria-disabled={disabled || undefined}\n aria-selected={context.highlighted === value}\n className={cx(command().item, className)}\n data-disabled={disabled || undefined}\n data-highlighted={context.highlighted === value || undefined}\n data-slot=\"command-item\"\n id={id}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented && !disabled) context.selectItem(value);\n }}\n onMouseEnter={(event) => {\n onMouseEnter?.(event);\n if (!disabled) context.setHighlighted(value);\n }}\n onKeyDown={(event) => {\n if ((event.key === \"Enter\" || event.key === \" \") && !disabled) {\n event.preventDefault();\n context.selectItem(value);\n }\n }}\n role=\"option\"\n tabIndex={-1}\n >\n {children}\n </div>\n );\n});\n\nexport type CommandItemIndicatorProps = ComponentPropsWithoutRef<\"span\">;\nexport const CommandItemIndicator = forwardRef<HTMLSpanElement, CommandItemIndicatorProps>(\n function CommandItemIndicator({ children = \"✓\", className, ...props }, ref) {\n return (\n <span\n {...props}\n ref={ref}\n className={cx(command().itemIndicator, className)}\n data-slot=\"command-item-indicator\"\n >\n {children}\n </span>\n );\n },\n);\n\nexport type CommandEmptyProps = ComponentPropsWithoutRef<\"div\">;\nexport const CommandEmpty = forwardRef<HTMLDivElement, CommandEmptyProps>(function CommandEmpty(\n { className, ...props },\n ref,\n) {\n const context = useCommandContext();\n if (\n context.loading ||\n context.items.length === 0 ||\n context.items.some((item) => context.matches(item))\n )\n return null;\n return (\n <div\n {...props}\n ref={ref}\n className={cx(command().empty, className)}\n aria-live=\"polite\"\n data-slot=\"command-empty\"\n role=\"presentation\"\n />\n );\n});\n\nexport type CommandLoadingProps = ComponentPropsWithoutRef<\"div\">;\nexport const CommandLoading = forwardRef<HTMLDivElement, CommandLoadingProps>(\n function CommandLoading({ className, ...props }, ref) {\n const context = useCommandContext();\n if (!context.loading) return null;\n return (\n <div\n {...props}\n ref={ref}\n className={cx(command().loading, className)}\n aria-live=\"polite\"\n data-slot=\"command-loading\"\n role=\"presentation\"\n />\n );\n },\n);\n\nexport type CommandSeparatorProps = ComponentPropsWithoutRef<\"hr\">;\nexport const CommandSeparator = forwardRef<HTMLHRElement, CommandSeparatorProps>(\n function CommandSeparator({ className, ...props }, ref) {\n return (\n <hr\n {...props}\n ref={ref}\n role=\"presentation\"\n className={cx(command().separator, className)}\n data-slot=\"command-separator\"\n />\n );\n },\n);\n\nexport const Command = {\n Root: CommandRoot,\n Input: CommandInput,\n List: CommandList,\n Group: CommandGroup,\n Item: CommandItem,\n ItemIndicator: CommandItemIndicator,\n Empty: CommandEmpty,\n Loading: CommandLoading,\n Separator: CommandSeparator,\n};\n"],"mappings":";;;;;;AA6CA,MAAM,iBAAiB,cAA0C,IAAI;AACrE,MAAM,sBAAsB,cAAkC,KAAA,CAAS;AACvE,MAAM,iBAAoC,CAAC;AAE3C,SAAS,oBAAoB;CAC3B,MAAM,UAAU,WAAW,cAAc;CACzC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,qDAAqD;CACnF,OAAO;AACT;AAEA,SAAS,cAAc,OAAe,QAAgB,UAA6B;CACjF,MAAM,QAAQ,OAAO,KAAK,CAAC,CAAC,kBAAkB;CAC9C,IAAI,CAAC,OAAO,OAAO;CACnB,OAAO,CAAC,OAAO,GAAG,QAAQ,CAAC,CAAC,MAAM,cAAc,UAAU,kBAAkB,CAAC,CAAC,SAAS,KAAK,CAAC;AAC/F;AAaA,MAAa,cAAc,WAA6C,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AU;EACV,MAAK;CACN,CAAA;AAEL,CACF;AAGA,MAAa,mBAAmB,WAC9B,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAS,KAAK;CACtD,OACE,oBAAC,MAAD;EACE,GAAI;EACC;EACL,MAAK;EACL,WAAW,GAAG,QAAQ,CAAC,CAAC,WAAW,SAAS;EAC5C,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAa,UAAU;CACrB,MAAM;CACN,OAAO;CACP,MAAM;CACN,OAAO;CACP,MAAM;CACN,eAAe;CACf,OAAO;CACP,SAAS;CACT,WAAW;AACb"}
|
|
1
|
+
{"version":3,"file":"command.js","names":[],"sources":["../../../src/components/command/command.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ChangeEvent, ComponentPropsWithoutRef, KeyboardEvent, ReactNode } from \"react\";\n\nimport { command } from \"../../styled-system/recipes\";\nimport { cx } from \"../../styled-system/css\";\n\nexport type CommandFilter = (value: string, search: string, keywords: readonly string[]) => boolean;\n\ninterface CommandItemRecord {\n id: string;\n value: string;\n keywords: readonly string[];\n disabled: boolean;\n groupId: string | undefined;\n onSelect: ((value: string) => void) | undefined;\n element: HTMLDivElement | null;\n}\n\ninterface CommandContextValue {\n search: string;\n setSearch: (search: string) => void;\n loading: boolean;\n shouldFilter: boolean;\n items: readonly CommandItemRecord[];\n highlighted: string | null;\n listId: string;\n matches: (item: Pick<CommandItemRecord, \"value\" | \"keywords\">) => boolean;\n handleKeyDown: (event: KeyboardEvent<HTMLElement>) => void;\n registerItem: (item: CommandItemRecord) => () => void;\n setItemElement: (id: string, element: HTMLDivElement | null) => void;\n setHighlighted: (value: string | null) => void;\n selectItem: (id: string) => void;\n disabled: boolean;\n}\n\nconst CommandContext = createContext<CommandContextValue | null>(null);\nconst CommandGroupContext = createContext<string | undefined>(undefined);\nconst EMPTY_KEYWORDS: readonly string[] = [];\n\nfunction useCommandContext() {\n const context = useContext(CommandContext);\n if (!context) throw new Error(\"Command parts must be rendered inside Command.Root.\");\n return context;\n}\n\nfunction defaultFilter(value: string, search: string, keywords: readonly string[]) {\n const query = search.trim().toLocaleLowerCase();\n if (!query) return true;\n return [value, ...keywords].some((candidate) => candidate.toLocaleLowerCase().includes(query));\n}\n\nexport interface CommandRootProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n search?: string;\n defaultSearch?: string;\n onSearchChange?: (search: string) => void;\n filter?: CommandFilter;\n shouldFilter?: boolean;\n loopFocus?: boolean;\n disabled?: boolean;\n loading?: boolean;\n children?: ReactNode;\n}\n\nexport const CommandRoot = forwardRef<HTMLDivElement, CommandRootProps>(function CommandRoot(\n {\n children,\n className,\n defaultSearch = \"\",\n disabled = false,\n filter = defaultFilter,\n loading = false,\n onKeyDown,\n onSearchChange,\n search: controlledSearch,\n shouldFilter = true,\n loopFocus = true,\n ...props\n },\n ref,\n) {\n const [uncontrolledSearch, setUncontrolledSearch] = useState(defaultSearch);\n const [highlighted, setHighlighted] = useState<string | null>(null);\n const [, setVersion] = useState(0);\n const itemsRef = useRef(new Map<string, CommandItemRecord>());\n const listId = useId();\n const search = controlledSearch ?? uncontrolledSearch;\n const styles = command();\n\n const items = Array.from(itemsRef.current.values());\n const setSearch = useCallback(\n (next: string) => {\n if (controlledSearch === undefined) setUncontrolledSearch(next);\n onSearchChange?.(next);\n },\n [controlledSearch, onSearchChange],\n );\n const matches = useCallback(\n (item: Pick<CommandItemRecord, \"value\" | \"keywords\">) =>\n !shouldFilter || filter(item.value, search, item.keywords),\n [filter, search, shouldFilter],\n );\n const visibleItems = useMemo(\n () => items.filter((item) => !item.disabled && matches(item)),\n [items, matches],\n );\n\n const registerItem = useCallback((item: CommandItemRecord) => {\n itemsRef.current.set(item.id, item);\n setVersion((current) => current + 1);\n return () => {\n itemsRef.current.delete(item.id);\n setVersion((current) => current + 1);\n };\n }, []);\n\n const setItemElement = useCallback((id: string, element: HTMLDivElement | null) => {\n const item = itemsRef.current.get(id);\n if (item) item.element = element;\n }, []);\n\n const selectItem = useCallback(\n (id: string) => {\n const item = itemsRef.current.get(id);\n if (item && !item.disabled && matches(item)) item.onSelect?.(item.value);\n },\n [matches],\n );\n\n useEffect(() => {\n if (!visibleItems.some((item) => item.id === highlighted)) {\n setHighlighted(visibleItems[0]?.id ?? null);\n }\n }, [highlighted, visibleItems]);\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLElement>) => {\n onKeyDown?.(event as KeyboardEvent<HTMLDivElement>);\n if (event.defaultPrevented) return;\n if (disabled) return;\n const currentIndex = visibleItems.findIndex((item) => item.id === highlighted);\n if ((event.key === \"ArrowDown\" || event.key === \"ArrowUp\") && visibleItems.length > 0) {\n event.preventDefault();\n const direction = event.key === \"ArrowDown\" ? 1 : -1;\n let nextIndex = currentIndex + direction;\n if (loopFocus) nextIndex = (nextIndex + visibleItems.length) % visibleItems.length;\n if (nextIndex >= 0 && nextIndex < visibleItems.length) {\n setHighlighted(visibleItems[nextIndex]?.id ?? null);\n }\n } else if (event.key === \"Home\" || event.key === \"End\") {\n event.preventDefault();\n setHighlighted((event.key === \"Home\" ? visibleItems[0] : visibleItems.at(-1))?.id ?? null);\n } else if (event.key === \"Enter\" && highlighted) {\n event.preventDefault();\n selectItem(highlighted);\n } else if (event.key === \"Escape\") {\n event.preventDefault();\n }\n },\n [disabled, highlighted, loopFocus, onKeyDown, selectItem, visibleItems],\n );\n\n const context = useMemo<CommandContextValue>(\n () => ({\n search,\n setSearch,\n disabled,\n handleKeyDown,\n loading,\n shouldFilter,\n items,\n highlighted,\n listId,\n matches,\n registerItem,\n setItemElement,\n setHighlighted,\n selectItem,\n }),\n [\n highlighted,\n disabled,\n handleKeyDown,\n items,\n listId,\n loading,\n matches,\n registerItem,\n search,\n selectItem,\n setItemElement,\n setSearch,\n shouldFilter,\n ],\n );\n\n return (\n <CommandContext.Provider value={context}>\n <div\n {...props}\n ref={(node) => {\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n className={cx(styles.root, className)}\n data-disabled={disabled || undefined}\n data-jaci-component=\"command\"\n data-slot=\"command\"\n aria-disabled={disabled || undefined}\n >\n {children}\n </div>\n </CommandContext.Provider>\n );\n});\n\nexport type CommandInputProps = ComponentPropsWithoutRef<\"input\">;\nexport const CommandInput = forwardRef<HTMLInputElement, CommandInputProps>(function CommandInput(\n { className, onChange, onKeyDown, ...props },\n ref,\n) {\n const { disabled, handleKeyDown, highlighted, listId, search, setHighlighted, setSearch } =\n useCommandContext();\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n const next = event.target.value;\n setHighlighted(null);\n setSearch(next);\n };\n\n return (\n <input\n {...props}\n ref={ref}\n aria-activedescendant={highlighted ?? undefined}\n aria-controls={listId}\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded=\"true\"\n className={cx(command().input, className)}\n data-slot=\"command-input\"\n disabled={disabled || props.disabled}\n onChange={(event) => {\n handleChange(event);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n handleKeyDown(event);\n }}\n value={search}\n />\n );\n});\n\nexport type CommandListProps = ComponentPropsWithoutRef<\"div\">;\nexport const CommandList = forwardRef<HTMLDivElement, CommandListProps>(function CommandList(\n { className, id, ...props },\n ref,\n) {\n const { listId } = useCommandContext();\n return (\n <div\n {...props}\n ref={ref}\n id={id ?? listId}\n className={cx(command().list, className)}\n data-slot=\"command-list\"\n role=\"listbox\"\n />\n );\n});\n\nexport interface CommandGroupProps extends ComponentPropsWithoutRef<\"div\"> {\n heading?: ReactNode;\n}\nexport const CommandGroup = forwardRef<HTMLDivElement, CommandGroupProps>(function CommandGroup(\n { children, className, heading, ...props },\n ref,\n) {\n const context = useCommandContext();\n const groupId = useId();\n const hasVisibleItems = context.items.some(\n (item) => item.groupId === groupId && !item.disabled && context.matches(item),\n );\n return (\n <CommandGroupContext.Provider value={groupId}>\n <div\n {...props}\n ref={ref}\n aria-hidden={!hasVisibleItems || undefined}\n className={cx(command().group, className)}\n data-slot=\"command-group\"\n hidden={!hasVisibleItems}\n >\n {heading ? (\n <div className={command().groupHeading} data-slot=\"command-group-heading\">\n {heading}\n </div>\n ) : null}\n {children}\n </div>\n </CommandGroupContext.Provider>\n );\n});\n\nexport interface CommandItemProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"onSelect\"> {\n value: string;\n keywords?: readonly string[];\n disabled?: boolean;\n onSelect?: (value: string) => void;\n}\nexport const CommandItem = forwardRef<HTMLDivElement, CommandItemProps>(function CommandItem(\n {\n children,\n className,\n disabled = false,\n keywords: itemKeywords,\n onClick,\n onMouseEnter,\n onSelect,\n value,\n ...props\n },\n ref,\n) {\n const context = useCommandContext();\n const groupId = useContext(CommandGroupContext);\n const id = `command-item-${useId().replace(/:/g, \"\")}`;\n const keywords = itemKeywords ?? EMPTY_KEYWORDS;\n const visible = context.matches({ value, keywords });\n\n useEffect(\n () =>\n context.registerItem({\n id,\n value,\n keywords,\n disabled,\n groupId,\n onSelect,\n element: null,\n }),\n [context.registerItem, disabled, groupId, id, keywords, onSelect, value],\n );\n\n if (!visible) {\n return <div aria-hidden=\"true\" hidden ref={ref} data-slot=\"command-item\" />;\n }\n\n return (\n <div\n {...props}\n ref={(node) => {\n context.setItemElement(id, node);\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n aria-disabled={disabled || undefined}\n aria-selected={context.highlighted === id}\n className={cx(command().item, className)}\n data-disabled={disabled || undefined}\n data-highlighted={context.highlighted === id || undefined}\n data-slot=\"command-item\"\n id={id}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented && !disabled) context.selectItem(id);\n }}\n onMouseEnter={(event) => {\n onMouseEnter?.(event);\n if (!disabled) context.setHighlighted(id);\n }}\n onKeyDown={(event) => {\n if ((event.key === \"Enter\" || event.key === \" \") && !disabled) {\n event.preventDefault();\n context.selectItem(id);\n }\n }}\n role=\"option\"\n tabIndex={-1}\n >\n {children}\n </div>\n );\n});\n\nexport type CommandItemIndicatorProps = ComponentPropsWithoutRef<\"span\">;\nexport const CommandItemIndicator = forwardRef<HTMLSpanElement, CommandItemIndicatorProps>(\n function CommandItemIndicator({ children = \"✓\", className, ...props }, ref) {\n return (\n <span\n {...props}\n ref={ref}\n className={cx(command().itemIndicator, className)}\n data-slot=\"command-item-indicator\"\n >\n {children}\n </span>\n );\n },\n);\n\nexport type CommandEmptyProps = ComponentPropsWithoutRef<\"div\">;\nexport const CommandEmpty = forwardRef<HTMLDivElement, CommandEmptyProps>(function CommandEmpty(\n { className, ...props },\n ref,\n) {\n const context = useCommandContext();\n if (context.loading || context.items.some((item) => !item.disabled && context.matches(item)))\n return null;\n return (\n <div\n {...props}\n ref={ref}\n className={cx(command().empty, className)}\n aria-live=\"polite\"\n aria-disabled=\"true\"\n data-slot=\"command-empty\"\n role=\"option\"\n tabIndex={-1}\n />\n );\n});\n\nexport type CommandLoadingProps = ComponentPropsWithoutRef<\"div\">;\nexport const CommandLoading = forwardRef<HTMLDivElement, CommandLoadingProps>(\n function CommandLoading({ className, ...props }, ref) {\n const context = useCommandContext();\n if (!context.loading) return null;\n return (\n <div\n {...props}\n ref={ref}\n className={cx(command().loading, className)}\n aria-live=\"polite\"\n aria-disabled=\"true\"\n data-slot=\"command-loading\"\n role=\"option\"\n tabIndex={-1}\n />\n );\n },\n);\n\nexport type CommandSeparatorProps = ComponentPropsWithoutRef<\"hr\">;\nexport const CommandSeparator = forwardRef<HTMLHRElement, CommandSeparatorProps>(\n function CommandSeparator({ className, ...props }, ref) {\n return (\n <hr\n {...props}\n ref={ref}\n role=\"presentation\"\n className={cx(command().separator, className)}\n data-slot=\"command-separator\"\n />\n );\n },\n);\n\nexport const Command = {\n Root: CommandRoot,\n Input: CommandInput,\n List: CommandList,\n Group: CommandGroup,\n Item: CommandItem,\n ItemIndicator: CommandItemIndicator,\n Empty: CommandEmpty,\n Loading: CommandLoading,\n Separator: CommandSeparator,\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;CACG,CAAA;AAEV,CACF;AAGA,MAAa,eAAe,WAA8C,SAAS,aACjF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,MAAM,UAAU,kBAAkB;CAClC,IAAI,QAAQ,WAAW,QAAQ,MAAM,MAAM,SAAS,CAAC,KAAK,YAAY,QAAQ,QAAQ,IAAI,CAAC,GACzF,OAAO;CACT,OACE,oBAAC,OAAD;EACE,GAAI;EACC;EACL,WAAW,GAAG,QAAQ,CAAC,CAAC,OAAO,SAAS;EACxC,aAAU;EACV,iBAAc;EACd,aAAU;EACV,MAAK;EACL,UAAU;CACX,CAAA;AAEL,CAAC;AAGD,MAAa,iBAAiB,WAC5B,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CAEpD,IAAI,CADY,kBACL,CAAC,CAAC,SAAS,OAAO;CAC7B,OACE,oBAAC,OAAD;EACE,GAAI;EACC;EACL,WAAW,GAAG,QAAQ,CAAC,CAAC,SAAS,SAAS;EAC1C,aAAU;EACV,iBAAc;EACd,aAAU;EACV,MAAK;EACL,UAAU;CACX,CAAA;AAEL,CACF;AAGA,MAAa,mBAAmB,WAC9B,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAS,KAAK;CACtD,OACE,oBAAC,MAAD;EACE,GAAI;EACC;EACL,MAAK;EACL,WAAW,GAAG,QAAQ,CAAC,CAAC,WAAW,SAAS;EAC5C,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAa,UAAU;CACrB,MAAM;CACN,OAAO;CACP,MAAM;CACN,OAAO;CACP,MAAM;CACN,eAAe;CACf,OAAO;CACP,SAAS;CACT,WAAW;AACb"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_cx = require("../../styled-system/css/cx.cjs");
|
|
3
|
+
const require_data_toolbar = require("../../styled-system/recipes/data-toolbar.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
//#region src/components/data-toolbar/data-toolbar.tsx
|
|
7
|
+
const SelectionContext = (0, react.createContext)(null);
|
|
8
|
+
const DataToolbarRoot = (0, react.forwardRef)(function DataToolbarRoot({ className, role, ...props }, ref) {
|
|
9
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
10
|
+
...props,
|
|
11
|
+
ref,
|
|
12
|
+
className: require_cx.cx(require_data_toolbar.dataToolbar().root, className),
|
|
13
|
+
"data-jaci-component": "data-toolbar",
|
|
14
|
+
"data-slot": "data-toolbar",
|
|
15
|
+
role: role ?? "toolbar"
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
const DataToolbarSearch = (0, react.forwardRef)(function DataToolbarSearch({ className, defaultValue = "", onValueChange, value: controlledValue, ...props }, ref) {
|
|
19
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, react.useState)(defaultValue);
|
|
20
|
+
const value = controlledValue ?? uncontrolledValue;
|
|
21
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
22
|
+
...props,
|
|
23
|
+
ref,
|
|
24
|
+
className: require_cx.cx(require_data_toolbar.dataToolbar().search, className),
|
|
25
|
+
"data-slot": "data-toolbar-search",
|
|
26
|
+
onChange: (event) => {
|
|
27
|
+
if (controlledValue === void 0) setUncontrolledValue(event.currentTarget.value);
|
|
28
|
+
onValueChange?.(event.currentTarget.value);
|
|
29
|
+
props.onChange?.(event);
|
|
30
|
+
},
|
|
31
|
+
type: props.type ?? "search",
|
|
32
|
+
value
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
const DataToolbarFilters = (0, react.forwardRef)(function DataToolbarFilters({ className, ...props }, ref) {
|
|
36
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
37
|
+
...props,
|
|
38
|
+
ref,
|
|
39
|
+
className: require_cx.cx(require_data_toolbar.dataToolbar().filters, className),
|
|
40
|
+
"data-slot": "data-toolbar-filters"
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
const DataToolbarSort = (0, react.forwardRef)(function DataToolbarSort({ className, defaultValue = "", onValueChange, value: controlledValue, ...props }, ref) {
|
|
44
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, react.useState)(defaultValue);
|
|
45
|
+
const value = controlledValue ?? uncontrolledValue;
|
|
46
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
47
|
+
...props,
|
|
48
|
+
ref,
|
|
49
|
+
className: require_cx.cx(require_data_toolbar.dataToolbar().sort, className),
|
|
50
|
+
"data-slot": "data-toolbar-sort",
|
|
51
|
+
onChange: (event) => {
|
|
52
|
+
if (controlledValue === void 0) setUncontrolledValue(event.currentTarget.value);
|
|
53
|
+
onValueChange?.(event.currentTarget.value);
|
|
54
|
+
props.onChange?.(event);
|
|
55
|
+
},
|
|
56
|
+
value
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
const DataToolbarSelection = (0, react.forwardRef)(function DataToolbarSelection({ children, className, count, label = "selected", onClear, ...props }, ref) {
|
|
60
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectionContext.Provider, {
|
|
61
|
+
value: {
|
|
62
|
+
count,
|
|
63
|
+
onClear
|
|
64
|
+
},
|
|
65
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
66
|
+
...props,
|
|
67
|
+
ref,
|
|
68
|
+
"aria-live": "polite",
|
|
69
|
+
className: require_cx.cx(require_data_toolbar.dataToolbar().selection, className),
|
|
70
|
+
"data-count": count,
|
|
71
|
+
"data-slot": "data-toolbar-selection",
|
|
72
|
+
children: children ?? `${count} ${label}`
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
const DataToolbarClearSelection = (0, react.forwardRef)(function DataToolbarClearSelection({ children = "Clear selection", className, onClick, ...props }, ref) {
|
|
77
|
+
const context = (0, react.useContext)(SelectionContext);
|
|
78
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
79
|
+
...props,
|
|
80
|
+
ref,
|
|
81
|
+
className: require_cx.cx(require_data_toolbar.dataToolbar().clearSelection, className),
|
|
82
|
+
"data-slot": "data-toolbar-clear-selection",
|
|
83
|
+
onClick: (event) => {
|
|
84
|
+
context?.onClear?.();
|
|
85
|
+
onClick?.(event);
|
|
86
|
+
},
|
|
87
|
+
type: "button",
|
|
88
|
+
children
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
const DataToolbarActions = (0, react.forwardRef)(function DataToolbarActions({ className, ...props }, ref) {
|
|
92
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
93
|
+
...props,
|
|
94
|
+
ref,
|
|
95
|
+
className: require_cx.cx(require_data_toolbar.dataToolbar().actions, className),
|
|
96
|
+
"data-slot": "data-toolbar-actions"
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
const DataToolbarClear = (0, react.forwardRef)(function DataToolbarClear({ children = "Clear filters", className, ...props }, ref) {
|
|
100
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
101
|
+
...props,
|
|
102
|
+
ref,
|
|
103
|
+
className: require_cx.cx(require_data_toolbar.dataToolbar().clear, className),
|
|
104
|
+
"data-slot": "data-toolbar-clear",
|
|
105
|
+
type: "button",
|
|
106
|
+
children
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
const DataToolbarSeparator = (0, react.forwardRef)(function DataToolbarSeparator({ className, ...props }, ref) {
|
|
110
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
111
|
+
...props,
|
|
112
|
+
ref,
|
|
113
|
+
"aria-hidden": "true",
|
|
114
|
+
className: require_cx.cx(require_data_toolbar.dataToolbar().separator, className),
|
|
115
|
+
"data-slot": "data-toolbar-separator"
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
const DataToolbar = {
|
|
119
|
+
Root: DataToolbarRoot,
|
|
120
|
+
Search: DataToolbarSearch,
|
|
121
|
+
Filters: DataToolbarFilters,
|
|
122
|
+
Sort: DataToolbarSort,
|
|
123
|
+
Selection: DataToolbarSelection,
|
|
124
|
+
ClearSelection: DataToolbarClearSelection,
|
|
125
|
+
Actions: DataToolbarActions,
|
|
126
|
+
Clear: DataToolbarClear,
|
|
127
|
+
Separator: DataToolbarSeparator
|
|
128
|
+
};
|
|
129
|
+
//#endregion
|
|
130
|
+
exports.DataToolbar = DataToolbar;
|
|
131
|
+
exports.DataToolbarActions = DataToolbarActions;
|
|
132
|
+
exports.DataToolbarClear = DataToolbarClear;
|
|
133
|
+
exports.DataToolbarClearSelection = DataToolbarClearSelection;
|
|
134
|
+
exports.DataToolbarFilters = DataToolbarFilters;
|
|
135
|
+
exports.DataToolbarRoot = DataToolbarRoot;
|
|
136
|
+
exports.DataToolbarSearch = DataToolbarSearch;
|
|
137
|
+
exports.DataToolbarSelection = DataToolbarSelection;
|
|
138
|
+
exports.DataToolbarSeparator = DataToolbarSeparator;
|
|
139
|
+
exports.DataToolbarSort = DataToolbarSort;
|
|
140
|
+
|
|
141
|
+
//# sourceMappingURL=data-toolbar.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-toolbar.cjs","names":["cx","dataToolbar"],"sources":["../../../src/components/data-toolbar/data-toolbar.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, forwardRef, useContext, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { dataToolbar } from \"../../styled-system/recipes\";\n\ninterface SelectionContextValue {\n count: number;\n onClear: (() => void) | undefined;\n}\n\nconst SelectionContext = createContext<SelectionContextValue | null>(null);\n\nexport type DataToolbarRootProps = ComponentPropsWithoutRef<\"div\">;\nexport const DataToolbarRoot = forwardRef<HTMLDivElement, DataToolbarRootProps>(\n function DataToolbarRoot({ className, role, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(dataToolbar().root, className)}\n data-jaci-component=\"data-toolbar\"\n data-slot=\"data-toolbar\"\n role={role ?? \"toolbar\"}\n />\n );\n },\n);\n\nexport interface DataToolbarSearchProps\n extends Omit<ComponentPropsWithoutRef<\"input\">, \"defaultValue\" | \"onChange\" | \"value\"> {\n defaultValue?: string;\n onChange?: ComponentPropsWithoutRef<\"input\">[\"onChange\"];\n onValueChange?: (value: string) => void;\n value?: string;\n}\n\nexport const DataToolbarSearch = forwardRef<HTMLInputElement, DataToolbarSearchProps>(\n function DataToolbarSearch(\n { className, defaultValue = \"\", onValueChange, value: controlledValue, ...props },\n ref,\n ) {\n const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);\n const value = controlledValue ?? uncontrolledValue;\n return (\n <input\n {...props}\n ref={ref}\n className={cx(dataToolbar().search, className)}\n data-slot=\"data-toolbar-search\"\n onChange={(event) => {\n if (controlledValue === undefined) setUncontrolledValue(event.currentTarget.value);\n onValueChange?.(event.currentTarget.value);\n props.onChange?.(event);\n }}\n type={props.type ?? \"search\"}\n value={value}\n />\n );\n },\n);\n\nexport type DataToolbarFiltersProps = ComponentPropsWithoutRef<\"div\">;\nexport const DataToolbarFilters = forwardRef<HTMLDivElement, DataToolbarFiltersProps>(\n function DataToolbarFilters({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(dataToolbar().filters, className)}\n data-slot=\"data-toolbar-filters\"\n />\n );\n },\n);\n\nexport interface DataToolbarSortProps\n extends Omit<ComponentPropsWithoutRef<\"select\">, \"defaultValue\" | \"onChange\" | \"value\"> {\n defaultValue?: string;\n onChange?: ComponentPropsWithoutRef<\"select\">[\"onChange\"];\n onValueChange?: (value: string) => void;\n value?: string;\n}\n\nexport const DataToolbarSort = forwardRef<HTMLSelectElement, DataToolbarSortProps>(\n function DataToolbarSort(\n { className, defaultValue = \"\", onValueChange, value: controlledValue, ...props },\n ref,\n ) {\n const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);\n const value = controlledValue ?? uncontrolledValue;\n return (\n <select\n {...props}\n ref={ref}\n className={cx(dataToolbar().sort, className)}\n data-slot=\"data-toolbar-sort\"\n onChange={(event) => {\n if (controlledValue === undefined) setUncontrolledValue(event.currentTarget.value);\n onValueChange?.(event.currentTarget.value);\n props.onChange?.(event);\n }}\n value={value}\n />\n );\n },\n);\n\nexport interface DataToolbarSelectionProps extends ComponentPropsWithoutRef<\"div\"> {\n count: number;\n label?: ReactNode;\n onClear?: () => void;\n}\nexport const DataToolbarSelection = forwardRef<HTMLDivElement, DataToolbarSelectionProps>(\n function DataToolbarSelection(\n { children, className, count, label = \"selected\", onClear, ...props },\n ref,\n ) {\n return (\n <SelectionContext.Provider value={{ count, onClear }}>\n <div\n {...props}\n ref={ref}\n aria-live=\"polite\"\n className={cx(dataToolbar().selection, className)}\n data-count={count}\n data-slot=\"data-toolbar-selection\"\n >\n {children ?? `${count} ${label}`}\n </div>\n </SelectionContext.Provider>\n );\n },\n);\n\nexport interface DataToolbarClearSelectionProps extends ComponentPropsWithoutRef<\"button\"> {\n children?: ReactNode;\n}\nexport const DataToolbarClearSelection = forwardRef<\n HTMLButtonElement,\n DataToolbarClearSelectionProps\n>(function DataToolbarClearSelection(\n { children = \"Clear selection\", className, onClick, ...props },\n ref,\n) {\n const context = useContext(SelectionContext);\n return (\n <button\n {...props}\n ref={ref}\n className={cx(dataToolbar().clearSelection, className)}\n data-slot=\"data-toolbar-clear-selection\"\n onClick={(event) => {\n context?.onClear?.();\n onClick?.(event);\n }}\n type=\"button\"\n >\n {children}\n </button>\n );\n});\n\nexport type DataToolbarActionsProps = ComponentPropsWithoutRef<\"div\">;\nexport const DataToolbarActions = forwardRef<HTMLDivElement, DataToolbarActionsProps>(\n function DataToolbarActions({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(dataToolbar().actions, className)}\n data-slot=\"data-toolbar-actions\"\n />\n );\n },\n);\n\nexport type DataToolbarClearProps = ComponentPropsWithoutRef<\"button\">;\nexport const DataToolbarClear = forwardRef<HTMLButtonElement, DataToolbarClearProps>(\n function DataToolbarClear({ children = \"Clear filters\", className, ...props }, ref) {\n return (\n <button\n {...props}\n ref={ref}\n className={cx(dataToolbar().clear, className)}\n data-slot=\"data-toolbar-clear\"\n type=\"button\"\n >\n {children}\n </button>\n );\n },\n);\n\nexport type DataToolbarSeparatorProps = ComponentPropsWithoutRef<\"div\">;\nexport const DataToolbarSeparator = forwardRef<HTMLDivElement, DataToolbarSeparatorProps>(\n function DataToolbarSeparator({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n aria-hidden=\"true\"\n className={cx(dataToolbar().separator, className)}\n data-slot=\"data-toolbar-separator\"\n />\n );\n },\n);\n\nexport const DataToolbar = {\n Root: DataToolbarRoot,\n Search: DataToolbarSearch,\n Filters: DataToolbarFilters,\n Sort: DataToolbarSort,\n Selection: DataToolbarSelection,\n ClearSelection: DataToolbarClearSelection,\n Actions: DataToolbarActions,\n Clear: DataToolbarClear,\n Separator: DataToolbarSeparator,\n};\n"],"mappings":";;;;;;AAaA,MAAM,oBAAA,GAAA,MAAA,cAAA,CAA+D,IAAI;AAGzE,MAAa,mBAAA,GAAA,MAAA,WAAA,CACX,SAAS,gBAAgB,EAAE,WAAW,MAAM,GAAG,SAAS,KAAK;CAC3D,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,GAAI;EACC;EACL,WAAWA,WAAAA,GAAGC,qBAAAA,YAAY,CAAC,CAAC,MAAM,SAAS;EAC3C,uBAAoB;EACpB,aAAU;EACV,MAAM,QAAQ;CACf,CAAA;AAEL,CACF;AAUA,MAAa,qBAAA,GAAA,MAAA,WAAA,CACX,SAAS,kBACP,EAAE,WAAW,eAAe,IAAI,eAAe,OAAO,iBAAiB,GAAG,SAC1E,KACA;CACA,MAAM,CAAC,mBAAmB,yBAAA,GAAA,MAAA,SAAA,CAAiC,YAAY;CACvE,MAAM,QAAQ,mBAAmB;CACjC,OACE,iBAAA,GAAA,kBAAA,IAAA,CA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AA,CACX,SAAS,qBAAqB,EAAE,WAAW,GAAG,SAAS,KAAK;CAC1D,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,GAAI;EACC;EACL,eAAY;EACZ,WAAWD,WAAAA,GAAGC,qBAAAA,YAAY,CAAC,CAAC,WAAW,SAAS;EAChD,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAa,cAAc;CACzB,MAAM;CACN,QAAQ;CACR,SAAS;CACT,MAAM;CACN,WAAW;CACX,gBAAgB;CAChB,SAAS;CACT,OAAO;CACP,WAAW;AACb"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
//#region src/components/data-toolbar/data-toolbar.d.ts
|
|
3
|
+
type DataToolbarRootProps = ComponentPropsWithoutRef<"div">;
|
|
4
|
+
declare const DataToolbarRoot: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
|
+
interface DataToolbarSearchProps extends Omit<ComponentPropsWithoutRef<"input">, "defaultValue" | "onChange" | "value"> {
|
|
6
|
+
defaultValue?: string;
|
|
7
|
+
onChange?: ComponentPropsWithoutRef<"input">["onChange"];
|
|
8
|
+
onValueChange?: (value: string) => void;
|
|
9
|
+
value?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const DataToolbarSearch: import("react").ForwardRefExoticComponent<DataToolbarSearchProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
12
|
+
type DataToolbarFiltersProps = ComponentPropsWithoutRef<"div">;
|
|
13
|
+
declare const DataToolbarFilters: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
|
+
interface DataToolbarSortProps extends Omit<ComponentPropsWithoutRef<"select">, "defaultValue" | "onChange" | "value"> {
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
onChange?: ComponentPropsWithoutRef<"select">["onChange"];
|
|
17
|
+
onValueChange?: (value: string) => void;
|
|
18
|
+
value?: string;
|
|
19
|
+
}
|
|
20
|
+
declare const DataToolbarSort: import("react").ForwardRefExoticComponent<DataToolbarSortProps & import("react").RefAttributes<HTMLSelectElement>>;
|
|
21
|
+
interface DataToolbarSelectionProps extends ComponentPropsWithoutRef<"div"> {
|
|
22
|
+
count: number;
|
|
23
|
+
label?: ReactNode;
|
|
24
|
+
onClear?: () => void;
|
|
25
|
+
}
|
|
26
|
+
declare const DataToolbarSelection: import("react").ForwardRefExoticComponent<DataToolbarSelectionProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
27
|
+
interface DataToolbarClearSelectionProps extends ComponentPropsWithoutRef<"button"> {
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
}
|
|
30
|
+
declare const DataToolbarClearSelection: import("react").ForwardRefExoticComponent<DataToolbarClearSelectionProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
31
|
+
type DataToolbarActionsProps = ComponentPropsWithoutRef<"div">;
|
|
32
|
+
declare const DataToolbarActions: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
33
|
+
type DataToolbarClearProps = ComponentPropsWithoutRef<"button">;
|
|
34
|
+
declare const DataToolbarClear: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
35
|
+
type DataToolbarSeparatorProps = ComponentPropsWithoutRef<"div">;
|
|
36
|
+
declare const DataToolbarSeparator: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
37
|
+
declare const DataToolbar: {
|
|
38
|
+
Root: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
39
|
+
Search: import("react").ForwardRefExoticComponent<DataToolbarSearchProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
40
|
+
Filters: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
41
|
+
Sort: import("react").ForwardRefExoticComponent<DataToolbarSortProps & import("react").RefAttributes<HTMLSelectElement>>;
|
|
42
|
+
Selection: import("react").ForwardRefExoticComponent<DataToolbarSelectionProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
43
|
+
ClearSelection: import("react").ForwardRefExoticComponent<DataToolbarClearSelectionProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
44
|
+
Actions: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
45
|
+
Clear: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
46
|
+
Separator: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
47
|
+
};
|
|
48
|
+
//#endregion
|
|
49
|
+
export { DataToolbar, DataToolbarActions, DataToolbarActionsProps, DataToolbarClear, DataToolbarClearProps, DataToolbarClearSelection, DataToolbarClearSelectionProps, DataToolbarFilters, DataToolbarFiltersProps, DataToolbarRoot, DataToolbarRootProps, DataToolbarSearch, DataToolbarSearchProps, DataToolbarSelection, DataToolbarSelectionProps, DataToolbarSeparator, DataToolbarSeparatorProps, DataToolbarSort, DataToolbarSortProps };
|
|
50
|
+
//# sourceMappingURL=data-toolbar.d.cts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
//#region src/components/data-toolbar/data-toolbar.d.ts
|
|
3
|
+
type DataToolbarRootProps = ComponentPropsWithoutRef<"div">;
|
|
4
|
+
declare const DataToolbarRoot: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
|
+
interface DataToolbarSearchProps extends Omit<ComponentPropsWithoutRef<"input">, "defaultValue" | "onChange" | "value"> {
|
|
6
|
+
defaultValue?: string;
|
|
7
|
+
onChange?: ComponentPropsWithoutRef<"input">["onChange"];
|
|
8
|
+
onValueChange?: (value: string) => void;
|
|
9
|
+
value?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const DataToolbarSearch: import("react").ForwardRefExoticComponent<DataToolbarSearchProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
12
|
+
type DataToolbarFiltersProps = ComponentPropsWithoutRef<"div">;
|
|
13
|
+
declare const DataToolbarFilters: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
|
+
interface DataToolbarSortProps extends Omit<ComponentPropsWithoutRef<"select">, "defaultValue" | "onChange" | "value"> {
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
onChange?: ComponentPropsWithoutRef<"select">["onChange"];
|
|
17
|
+
onValueChange?: (value: string) => void;
|
|
18
|
+
value?: string;
|
|
19
|
+
}
|
|
20
|
+
declare const DataToolbarSort: import("react").ForwardRefExoticComponent<DataToolbarSortProps & import("react").RefAttributes<HTMLSelectElement>>;
|
|
21
|
+
interface DataToolbarSelectionProps extends ComponentPropsWithoutRef<"div"> {
|
|
22
|
+
count: number;
|
|
23
|
+
label?: ReactNode;
|
|
24
|
+
onClear?: () => void;
|
|
25
|
+
}
|
|
26
|
+
declare const DataToolbarSelection: import("react").ForwardRefExoticComponent<DataToolbarSelectionProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
27
|
+
interface DataToolbarClearSelectionProps extends ComponentPropsWithoutRef<"button"> {
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
}
|
|
30
|
+
declare const DataToolbarClearSelection: import("react").ForwardRefExoticComponent<DataToolbarClearSelectionProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
31
|
+
type DataToolbarActionsProps = ComponentPropsWithoutRef<"div">;
|
|
32
|
+
declare const DataToolbarActions: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
33
|
+
type DataToolbarClearProps = ComponentPropsWithoutRef<"button">;
|
|
34
|
+
declare const DataToolbarClear: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
35
|
+
type DataToolbarSeparatorProps = ComponentPropsWithoutRef<"div">;
|
|
36
|
+
declare const DataToolbarSeparator: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
37
|
+
declare const DataToolbar: {
|
|
38
|
+
Root: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
39
|
+
Search: import("react").ForwardRefExoticComponent<DataToolbarSearchProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
40
|
+
Filters: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
41
|
+
Sort: import("react").ForwardRefExoticComponent<DataToolbarSortProps & import("react").RefAttributes<HTMLSelectElement>>;
|
|
42
|
+
Selection: import("react").ForwardRefExoticComponent<DataToolbarSelectionProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
43
|
+
ClearSelection: import("react").ForwardRefExoticComponent<DataToolbarClearSelectionProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
44
|
+
Actions: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
45
|
+
Clear: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
46
|
+
Separator: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
47
|
+
};
|
|
48
|
+
//#endregion
|
|
49
|
+
export { DataToolbar, DataToolbarActions, DataToolbarActionsProps, DataToolbarClear, DataToolbarClearProps, DataToolbarClearSelection, DataToolbarClearSelectionProps, DataToolbarFilters, DataToolbarFiltersProps, DataToolbarRoot, DataToolbarRootProps, DataToolbarSearch, DataToolbarSearchProps, DataToolbarSelection, DataToolbarSelectionProps, DataToolbarSeparator, DataToolbarSeparatorProps, DataToolbarSort, DataToolbarSortProps };
|
|
50
|
+
//# sourceMappingURL=data-toolbar.d.ts.map
|