@lglab/compose-ui 0.29.0 → 0.30.1
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/accordion.d.ts +6 -6
- package/dist/accordion.d.ts.map +1 -1
- package/dist/alert-dialog.d.ts +10 -10
- package/dist/autocomplete.d.ts +13 -13
- package/dist/autocomplete.d.ts.map +1 -1
- package/dist/avatar.d.ts +5 -5
- package/dist/avatar.d.ts.map +1 -1
- package/dist/badge.d.ts +4 -4
- package/dist/badge.js +5 -5
- package/dist/badge.js.map +1 -1
- package/dist/button.d.ts +2 -2
- package/dist/button.d.ts.map +1 -1
- package/dist/card.d.ts +8 -8
- package/dist/checkbox-group.d.ts +2 -2
- package/dist/checkbox.d.ts +3 -3
- package/dist/collapsible.d.ts +4 -4
- package/dist/collapsible.d.ts.map +1 -1
- package/dist/combobox.d.ts +25 -25
- package/dist/components/table/filters.d.ts +29 -0
- package/dist/components/table/filters.d.ts.map +1 -0
- package/dist/components/table/filters.js +47 -0
- package/dist/components/table/filters.js.map +1 -0
- package/dist/components/table/primitives.d.ts +93 -0
- package/dist/components/table/primitives.d.ts.map +1 -0
- package/dist/components/table/primitives.js +129 -0
- package/dist/components/table/primitives.js.map +1 -0
- package/dist/components/table/sort.js +17 -0
- package/dist/components/table/sort.js.map +1 -0
- package/dist/components/table/types.d.ts +101 -0
- package/dist/components/table/types.d.ts.map +1 -0
- package/dist/context-menu.d.ts +20 -20
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/dialog.d.ts +11 -11
- package/dist/drawer.d.ts +12 -12
- package/dist/field.d.ts +8 -8
- package/dist/fieldset.d.ts +3 -3
- package/dist/fieldset.d.ts.map +1 -1
- package/dist/form.d.ts +2 -2
- package/dist/index.d.ts +5 -1
- package/dist/index.js +4 -1
- package/dist/input.d.ts +2 -2
- package/dist/lib/control-variants.js +3 -2
- package/dist/lib/control-variants.js.map +1 -1
- package/dist/menu.d.ts +20 -20
- package/dist/menubar.d.ts +21 -21
- package/dist/meter.d.ts +6 -6
- package/dist/navigation-menu.d.ts +14 -14
- package/dist/navigation-menu.d.ts.map +1 -1
- package/dist/number-field.d.ts +8 -8
- package/dist/pagination.d.ts +184 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +164 -0
- package/dist/pagination.js.map +1 -0
- package/dist/popover.d.ts +12 -12
- package/dist/popover.d.ts.map +1 -1
- package/dist/preview-card.d.ts +8 -8
- package/dist/progress.d.ts +6 -6
- package/dist/radio-group.d.ts +2 -2
- package/dist/radio.d.ts +3 -3
- package/dist/scroll-area.d.ts +7 -7
- package/dist/scroll-area.d.ts.map +1 -1
- package/dist/select.d.ts +19 -19
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +1 -1
- package/dist/select.js.map +1 -1
- package/dist/separator.d.ts +2 -2
- package/dist/skeleton.d.ts +2 -2
- package/dist/slider.d.ts +7 -7
- package/dist/styles/default.css +1 -1
- package/dist/switch.d.ts +3 -3
- package/dist/table/index.d.ts +5 -0
- package/dist/table/index.js +5 -0
- package/dist/table/use-table.d.ts +9 -0
- package/dist/table/use-table.d.ts.map +1 -0
- package/dist/table/use-table.js +256 -0
- package/dist/table/use-table.js.map +1 -0
- package/dist/tabs.d.ts +6 -6
- package/dist/textarea.d.ts +2 -2
- package/dist/textarea.d.ts.map +1 -1
- package/dist/toast.d.ts +10 -10
- package/dist/toggle-group.d.ts +3 -3
- package/dist/toggle.d.ts +2 -2
- package/dist/toolbar.d.ts +7 -7
- package/dist/toolbar.js +1 -1
- package/dist/toolbar.js.map +1 -1
- package/dist/tooltip.d.ts +8 -8
- package/package.json +20 -8
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { compareValues } from "../components/table/sort.js";
|
|
3
|
+
import { useCallback, useDeferredValue, useMemo, useState } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/table/use-table.ts
|
|
6
|
+
const DEFAULT_PAGE_SIZE = 10;
|
|
7
|
+
const DEFAULT_PAGE_SIZE_OPTIONS = [
|
|
8
|
+
10,
|
|
9
|
+
25,
|
|
10
|
+
50,
|
|
11
|
+
100
|
|
12
|
+
];
|
|
13
|
+
function useTable(options) {
|
|
14
|
+
const { data, columns: columnDefs, pagination, sort, search, filters, selection: selectionConfig } = options;
|
|
15
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
16
|
+
const [pageSize, setPageSize] = useState(pagination?.pageSize ?? DEFAULT_PAGE_SIZE);
|
|
17
|
+
const [sortState, setSortState] = useState({
|
|
18
|
+
key: sort?.key ?? null,
|
|
19
|
+
direction: sort?.direction ?? "asc"
|
|
20
|
+
});
|
|
21
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
22
|
+
const [filterValues, setFilterValues] = useState(() => {
|
|
23
|
+
if (!filters) return {};
|
|
24
|
+
const initial = {};
|
|
25
|
+
for (const [id, def] of Object.entries(filters)) if (def.defaultValue !== void 0) initial[id] = def.defaultValue;
|
|
26
|
+
return initial;
|
|
27
|
+
});
|
|
28
|
+
const [internalSelectedKeys, setInternalSelectedKeys] = useState(() => new Set(selectionConfig?.defaultSelectedKeys ?? []));
|
|
29
|
+
const isControlled = selectionConfig?.selectedKeys !== void 0;
|
|
30
|
+
const selectedKeysSet = useMemo(() => isControlled ? new Set(selectionConfig?.selectedKeys) : internalSelectedKeys, [
|
|
31
|
+
isControlled,
|
|
32
|
+
selectionConfig?.selectedKeys,
|
|
33
|
+
internalSelectedKeys
|
|
34
|
+
]);
|
|
35
|
+
const sortKey = sortState.key;
|
|
36
|
+
const sortDirection = sortState.direction;
|
|
37
|
+
const debouncedSearchTerm = useDeferredValue(searchTerm);
|
|
38
|
+
const pageSizeOptions = pagination?.pageSizeOptions ?? DEFAULT_PAGE_SIZE_OPTIONS;
|
|
39
|
+
const filteredByFilters = useMemo(() => {
|
|
40
|
+
if (!filters) return data;
|
|
41
|
+
return data.filter((row) => {
|
|
42
|
+
for (const [id, def] of Object.entries(filters)) {
|
|
43
|
+
const value = filterValues[id];
|
|
44
|
+
if (value === void 0) continue;
|
|
45
|
+
if (!def.predicate(row, value)) return false;
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
});
|
|
49
|
+
}, [
|
|
50
|
+
data,
|
|
51
|
+
filters,
|
|
52
|
+
filterValues
|
|
53
|
+
]);
|
|
54
|
+
const filteredData = useMemo(() => {
|
|
55
|
+
if (!search || !debouncedSearchTerm) return filteredByFilters;
|
|
56
|
+
const term = debouncedSearchTerm.toLowerCase();
|
|
57
|
+
return filteredByFilters.filter((row) => search.keys.some((key) => String(row[key]).toLowerCase().includes(term)));
|
|
58
|
+
}, [
|
|
59
|
+
filteredByFilters,
|
|
60
|
+
debouncedSearchTerm,
|
|
61
|
+
search
|
|
62
|
+
]);
|
|
63
|
+
const sortedData = useMemo(() => {
|
|
64
|
+
if (!sortKey) return filteredData;
|
|
65
|
+
return [...filteredData].sort((a, b) => compareValues(a[sortKey], b[sortKey], sortDirection));
|
|
66
|
+
}, [
|
|
67
|
+
filteredData,
|
|
68
|
+
sortKey,
|
|
69
|
+
sortDirection
|
|
70
|
+
]);
|
|
71
|
+
const totalItems = sortedData.length;
|
|
72
|
+
const totalPages = pagination ? Math.max(1, Math.ceil(totalItems / pageSize)) : 1;
|
|
73
|
+
const effectivePage = Math.min(currentPage, totalPages);
|
|
74
|
+
const rows = useMemo(() => {
|
|
75
|
+
if (!pagination) return sortedData;
|
|
76
|
+
const start = (effectivePage - 1) * pageSize;
|
|
77
|
+
return sortedData.slice(start, start + pageSize);
|
|
78
|
+
}, [
|
|
79
|
+
sortedData,
|
|
80
|
+
effectivePage,
|
|
81
|
+
pageSize,
|
|
82
|
+
pagination
|
|
83
|
+
]);
|
|
84
|
+
const onPageChange = useCallback((page) => {
|
|
85
|
+
setCurrentPage(Math.max(1, Math.min(page, totalPages)));
|
|
86
|
+
}, [totalPages]);
|
|
87
|
+
const onPageSizeChange = useCallback((size) => {
|
|
88
|
+
setPageSize(size);
|
|
89
|
+
setCurrentPage(1);
|
|
90
|
+
}, []);
|
|
91
|
+
const onSort = useCallback((key) => {
|
|
92
|
+
setSortState((prev) => {
|
|
93
|
+
if (prev.key !== key) return {
|
|
94
|
+
key,
|
|
95
|
+
direction: "asc"
|
|
96
|
+
};
|
|
97
|
+
if (prev.direction === "asc") return {
|
|
98
|
+
key,
|
|
99
|
+
direction: "desc"
|
|
100
|
+
};
|
|
101
|
+
return {
|
|
102
|
+
key: null,
|
|
103
|
+
direction: "asc"
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
setCurrentPage(1);
|
|
107
|
+
}, []);
|
|
108
|
+
const onSearchChange = useCallback((term) => {
|
|
109
|
+
setSearchTerm(term);
|
|
110
|
+
setCurrentPage(1);
|
|
111
|
+
}, []);
|
|
112
|
+
const setFilterValue = useCallback((id, value) => {
|
|
113
|
+
setFilterValues((prev) => ({
|
|
114
|
+
...prev,
|
|
115
|
+
[id]: value
|
|
116
|
+
}));
|
|
117
|
+
setCurrentPage(1);
|
|
118
|
+
}, []);
|
|
119
|
+
const clearFilters = useCallback(() => {
|
|
120
|
+
setFilterValues({});
|
|
121
|
+
setCurrentPage(1);
|
|
122
|
+
}, []);
|
|
123
|
+
const activeFilterCount = useMemo(() => Object.values(filterValues).filter((v) => v !== void 0 && v !== null && !(Array.isArray(v) && v.length === 0) && v !== "").length, [filterValues]);
|
|
124
|
+
const currentPageRowKeys = useMemo(() => {
|
|
125
|
+
if (!selectionConfig) return [];
|
|
126
|
+
return rows.map((row) => selectionConfig.rowKey(row));
|
|
127
|
+
}, [rows, selectionConfig]);
|
|
128
|
+
const pageSelectionState = useMemo(() => {
|
|
129
|
+
if (!selectionConfig || currentPageRowKeys.length === 0) return "none";
|
|
130
|
+
const selectedOnPage = currentPageRowKeys.filter((key) => selectedKeysSet.has(key));
|
|
131
|
+
if (selectedOnPage.length === 0) return "none";
|
|
132
|
+
if (selectedOnPage.length === currentPageRowKeys.length) return "all";
|
|
133
|
+
return "some";
|
|
134
|
+
}, [
|
|
135
|
+
selectionConfig,
|
|
136
|
+
currentPageRowKeys,
|
|
137
|
+
selectedKeysSet
|
|
138
|
+
]);
|
|
139
|
+
const updateSelection = useCallback((newKeys) => {
|
|
140
|
+
if (isControlled) selectionConfig?.onSelectionChange?.(newKeys);
|
|
141
|
+
else {
|
|
142
|
+
setInternalSelectedKeys(new Set(newKeys));
|
|
143
|
+
selectionConfig?.onSelectionChange?.(newKeys);
|
|
144
|
+
}
|
|
145
|
+
}, [isControlled, selectionConfig]);
|
|
146
|
+
const isSelected = useCallback((key) => selectedKeysSet.has(key), [selectedKeysSet]);
|
|
147
|
+
const toggleRow = useCallback((key) => {
|
|
148
|
+
const newKeys = new Set(selectedKeysSet);
|
|
149
|
+
if (newKeys.has(key)) newKeys.delete(key);
|
|
150
|
+
else newKeys.add(key);
|
|
151
|
+
updateSelection(Array.from(newKeys));
|
|
152
|
+
}, [selectedKeysSet, updateSelection]);
|
|
153
|
+
const isRowSelected = useCallback((row) => {
|
|
154
|
+
if (!selectionConfig) return false;
|
|
155
|
+
return selectedKeysSet.has(selectionConfig.rowKey(row));
|
|
156
|
+
}, [selectedKeysSet, selectionConfig]);
|
|
157
|
+
const toggleRowSelection = useCallback((row) => {
|
|
158
|
+
if (!selectionConfig) return;
|
|
159
|
+
toggleRow(selectionConfig.rowKey(row));
|
|
160
|
+
}, [toggleRow, selectionConfig]);
|
|
161
|
+
const toggleAllOnPage = useCallback(() => {
|
|
162
|
+
const newKeys = new Set(selectedKeysSet);
|
|
163
|
+
if (pageSelectionState === "all") for (const key of currentPageRowKeys) newKeys.delete(key);
|
|
164
|
+
else for (const key of currentPageRowKeys) newKeys.add(key);
|
|
165
|
+
updateSelection(Array.from(newKeys));
|
|
166
|
+
}, [
|
|
167
|
+
selectedKeysSet,
|
|
168
|
+
pageSelectionState,
|
|
169
|
+
currentPageRowKeys,
|
|
170
|
+
updateSelection
|
|
171
|
+
]);
|
|
172
|
+
const clearSelection = useCallback(() => {
|
|
173
|
+
updateSelection([]);
|
|
174
|
+
}, [updateSelection]);
|
|
175
|
+
const selection = useMemo(() => {
|
|
176
|
+
if (!selectionConfig) return void 0;
|
|
177
|
+
return {
|
|
178
|
+
selectedKeys: Array.from(selectedKeysSet),
|
|
179
|
+
selectedCount: selectedKeysSet.size,
|
|
180
|
+
isSelected,
|
|
181
|
+
toggleRow,
|
|
182
|
+
isRowSelected,
|
|
183
|
+
toggleRowSelection,
|
|
184
|
+
toggleAllOnPage,
|
|
185
|
+
clearSelection,
|
|
186
|
+
pageSelectionState,
|
|
187
|
+
isIndeterminate: pageSelectionState === "some",
|
|
188
|
+
isAllOnPageSelected: pageSelectionState === "all"
|
|
189
|
+
};
|
|
190
|
+
}, [
|
|
191
|
+
selectionConfig,
|
|
192
|
+
selectedKeysSet,
|
|
193
|
+
isSelected,
|
|
194
|
+
toggleRow,
|
|
195
|
+
isRowSelected,
|
|
196
|
+
toggleRowSelection,
|
|
197
|
+
toggleAllOnPage,
|
|
198
|
+
clearSelection,
|
|
199
|
+
pageSelectionState
|
|
200
|
+
]);
|
|
201
|
+
return {
|
|
202
|
+
columns: useMemo(() => {
|
|
203
|
+
return columnDefs.map((def) => {
|
|
204
|
+
const key = def.key;
|
|
205
|
+
const sortable = def.sortable ?? false;
|
|
206
|
+
const isSorted = sortKey === key;
|
|
207
|
+
const renderCell = (row) => {
|
|
208
|
+
const value = row[key];
|
|
209
|
+
if (def.cell) return def.cell(value, row);
|
|
210
|
+
if (def.format) return def.format(value, row);
|
|
211
|
+
return value == null ? "" : String(value);
|
|
212
|
+
};
|
|
213
|
+
return {
|
|
214
|
+
key,
|
|
215
|
+
head: {
|
|
216
|
+
children: def.header,
|
|
217
|
+
className: cn(def.className, def.headerClassName) || void 0,
|
|
218
|
+
style: def.width ? { width: def.width } : void 0,
|
|
219
|
+
sortable,
|
|
220
|
+
sortDirection: isSorted ? sortDirection : void 0,
|
|
221
|
+
onSort: sortable ? () => onSort(key) : void 0
|
|
222
|
+
},
|
|
223
|
+
cell: { className: cn(def.className, def.cellClassName) || void 0 },
|
|
224
|
+
renderCell
|
|
225
|
+
};
|
|
226
|
+
});
|
|
227
|
+
}, [
|
|
228
|
+
columnDefs,
|
|
229
|
+
sortKey,
|
|
230
|
+
sortDirection,
|
|
231
|
+
onSort
|
|
232
|
+
]),
|
|
233
|
+
rows,
|
|
234
|
+
totalItems,
|
|
235
|
+
currentPage: effectivePage,
|
|
236
|
+
totalPages,
|
|
237
|
+
pageSize,
|
|
238
|
+
pageSizeOptions,
|
|
239
|
+
onPageChange,
|
|
240
|
+
onPageSizeChange,
|
|
241
|
+
sortKey,
|
|
242
|
+
sortDirection,
|
|
243
|
+
onSort,
|
|
244
|
+
searchTerm,
|
|
245
|
+
onSearchChange,
|
|
246
|
+
filterValues,
|
|
247
|
+
setFilterValue,
|
|
248
|
+
clearFilters,
|
|
249
|
+
activeFilterCount,
|
|
250
|
+
selection
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
//#endregion
|
|
255
|
+
export { useTable };
|
|
256
|
+
//# sourceMappingURL=use-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-table.js","names":[],"sources":["../../src/components/table/use-table.ts"],"sourcesContent":["import { type ReactNode, useCallback, useDeferredValue, useMemo, useState } from 'react'\n\nimport { cn } from '../../lib/utils'\nimport { compareValues } from './sort'\nimport type {\n ColumnDef,\n FilterValues,\n ProcessedColumn,\n SelectionState,\n SortDirection,\n UseTableOptions,\n UseTableReturn,\n} from './types'\n\nconst DEFAULT_PAGE_SIZE = 10\nconst DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100]\n\nexport function useTable<T>(options: UseTableOptions<T>): UseTableReturn<T> {\n const {\n data,\n columns: columnDefs,\n pagination,\n sort,\n search,\n filters,\n selection: selectionConfig,\n } = options\n\n const [currentPage, setCurrentPage] = useState(1)\n const [pageSize, setPageSize] = useState(pagination?.pageSize ?? DEFAULT_PAGE_SIZE)\n const [sortState, setSortState] = useState<{\n key: keyof T | null\n direction: SortDirection\n }>({\n key: sort?.key ?? null,\n direction: sort?.direction ?? 'asc',\n })\n const [searchTerm, setSearchTerm] = useState('')\n const [filterValues, setFilterValues] = useState<FilterValues>(() => {\n if (!filters) return {}\n const initial: FilterValues = {}\n for (const [id, def] of Object.entries(filters)) {\n if (def.defaultValue !== undefined) {\n initial[id] = def.defaultValue\n }\n }\n return initial\n })\n\n // Selection state (internal, used when uncontrolled)\n const [internalSelectedKeys, setInternalSelectedKeys] = useState<Set<string | number>>(\n () => new Set(selectionConfig?.defaultSelectedKeys ?? []),\n )\n\n // Determine if controlled or uncontrolled\n const isControlled = selectionConfig?.selectedKeys !== undefined\n const selectedKeysSet = useMemo(\n () => (isControlled ? new Set(selectionConfig?.selectedKeys) : internalSelectedKeys),\n [isControlled, selectionConfig?.selectedKeys, internalSelectedKeys],\n )\n\n const sortKey = sortState.key\n const sortDirection = sortState.direction\n const debouncedSearchTerm = useDeferredValue(searchTerm)\n\n const pageSizeOptions = pagination?.pageSizeOptions ?? DEFAULT_PAGE_SIZE_OPTIONS\n\n // Step 1: Apply filters\n const filteredByFilters = useMemo(() => {\n if (!filters) return data\n return data.filter((row) => {\n for (const [id, def] of Object.entries(filters)) {\n const value = filterValues[id]\n if (value === undefined) continue\n if (!def.predicate(row, value)) return false\n }\n return true\n })\n }, [data, filters, filterValues])\n\n // Step 2: Apply search\n const filteredData = useMemo(() => {\n if (!search || !debouncedSearchTerm) return filteredByFilters\n const term = debouncedSearchTerm.toLowerCase()\n return filteredByFilters.filter((row) =>\n search.keys.some((key) => String(row[key]).toLowerCase().includes(term)),\n )\n }, [filteredByFilters, debouncedSearchTerm, search])\n\n const sortedData = useMemo(() => {\n if (!sortKey) return filteredData\n return [...filteredData].sort((a, b) =>\n compareValues(a[sortKey], b[sortKey], sortDirection),\n )\n }, [filteredData, sortKey, sortDirection])\n\n const totalItems = sortedData.length\n const totalPages = pagination ? Math.max(1, Math.ceil(totalItems / pageSize)) : 1\n\n const effectivePage = Math.min(currentPage, totalPages)\n\n const rows = useMemo(() => {\n if (!pagination) return sortedData\n const start = (effectivePage - 1) * pageSize\n return sortedData.slice(start, start + pageSize)\n }, [sortedData, effectivePage, pageSize, pagination])\n\n const onPageChange = useCallback(\n (page: number) => {\n setCurrentPage(Math.max(1, Math.min(page, totalPages)))\n },\n [totalPages],\n )\n\n const onPageSizeChange = useCallback((size: number) => {\n setPageSize(size)\n setCurrentPage(1)\n }, [])\n\n const onSort = useCallback((key: keyof T) => {\n setSortState((prev) => {\n if (prev.key !== key) {\n return { key, direction: 'asc' }\n }\n if (prev.direction === 'asc') {\n return { key, direction: 'desc' }\n }\n return { key: null, direction: 'asc' }\n })\n setCurrentPage(1)\n }, [])\n\n const onSearchChange = useCallback((term: string) => {\n setSearchTerm(term)\n setCurrentPage(1)\n }, [])\n\n const setFilterValue = useCallback((id: string, value: unknown) => {\n setFilterValues((prev) => ({ ...prev, [id]: value }))\n setCurrentPage(1)\n }, [])\n\n const clearFilters = useCallback(() => {\n setFilterValues({})\n setCurrentPage(1)\n }, [])\n\n const activeFilterCount = useMemo(\n () =>\n Object.values(filterValues).filter(\n (v) =>\n v !== undefined &&\n v !== null &&\n !(Array.isArray(v) && v.length === 0) &&\n v !== '',\n ).length,\n [filterValues],\n )\n\n // Selection: compute current page row keys\n const currentPageRowKeys = useMemo(() => {\n if (!selectionConfig) return []\n return rows.map((row) => selectionConfig.rowKey(row))\n }, [rows, selectionConfig])\n\n // Selection: compute page selection state\n const pageSelectionState = useMemo((): 'all' | 'some' | 'none' => {\n if (!selectionConfig || currentPageRowKeys.length === 0) return 'none'\n const selectedOnPage = currentPageRowKeys.filter((key) => selectedKeysSet.has(key))\n if (selectedOnPage.length === 0) return 'none'\n if (selectedOnPage.length === currentPageRowKeys.length) return 'all'\n return 'some'\n }, [selectionConfig, currentPageRowKeys, selectedKeysSet])\n\n // Selection: helper to update selection\n const updateSelection = useCallback(\n (newKeys: (string | number)[]) => {\n if (isControlled) {\n selectionConfig?.onSelectionChange?.(newKeys)\n } else {\n setInternalSelectedKeys(new Set(newKeys))\n selectionConfig?.onSelectionChange?.(newKeys)\n }\n },\n [isControlled, selectionConfig],\n )\n\n const isSelected = useCallback(\n (key: string | number) => selectedKeysSet.has(key),\n [selectedKeysSet],\n )\n\n const toggleRow = useCallback(\n (key: string | number) => {\n const newKeys = new Set(selectedKeysSet)\n if (newKeys.has(key)) {\n newKeys.delete(key)\n } else {\n newKeys.add(key)\n }\n updateSelection(Array.from(newKeys))\n },\n [selectedKeysSet, updateSelection],\n )\n\n // Row-based convenience methods that use rowKey internally\n const isRowSelected = useCallback(\n (row: T) => {\n if (!selectionConfig) return false\n return selectedKeysSet.has(selectionConfig.rowKey(row))\n },\n [selectedKeysSet, selectionConfig],\n )\n\n const toggleRowSelection = useCallback(\n (row: T) => {\n if (!selectionConfig) return\n toggleRow(selectionConfig.rowKey(row))\n },\n [toggleRow, selectionConfig],\n )\n\n const toggleAllOnPage = useCallback(() => {\n const newKeys = new Set(selectedKeysSet)\n if (pageSelectionState === 'all') {\n // Deselect all on current page\n for (const key of currentPageRowKeys) {\n newKeys.delete(key)\n }\n } else {\n // Select all on current page\n for (const key of currentPageRowKeys) {\n newKeys.add(key)\n }\n }\n updateSelection(Array.from(newKeys))\n }, [selectedKeysSet, pageSelectionState, currentPageRowKeys, updateSelection])\n\n const clearSelection = useCallback(() => {\n updateSelection([])\n }, [updateSelection])\n\n // Build selection state object\n const selection: SelectionState<T> | undefined = useMemo(() => {\n if (!selectionConfig) return undefined\n return {\n selectedKeys: Array.from(selectedKeysSet),\n selectedCount: selectedKeysSet.size,\n isSelected,\n toggleRow,\n isRowSelected,\n toggleRowSelection,\n toggleAllOnPage,\n clearSelection,\n pageSelectionState,\n isIndeterminate: pageSelectionState === 'some',\n isAllOnPageSelected: pageSelectionState === 'all',\n }\n }, [\n selectionConfig,\n selectedKeysSet,\n isSelected,\n toggleRow,\n isRowSelected,\n toggleRowSelection,\n toggleAllOnPage,\n clearSelection,\n pageSelectionState,\n ])\n\n const columns = useMemo(() => {\n return columnDefs.map((def: ColumnDef<T, keyof T>): ProcessedColumn<T> => {\n const key = def.key\n const sortable = def.sortable ?? false\n const isSorted = sortKey === key\n\n const renderCell = (row: T): ReactNode => {\n const value = row[key]\n if (def.cell) return def.cell(value, row)\n if (def.format) return def.format(value, row)\n return value == null ? '' : String(value)\n }\n\n return {\n key,\n head: {\n children: def.header,\n className: cn(def.className, def.headerClassName) || undefined,\n style: def.width ? { width: def.width } : undefined,\n sortable,\n sortDirection: isSorted ? sortDirection : undefined,\n onSort: sortable ? () => onSort(key) : undefined,\n },\n cell: {\n className: cn(def.className, def.cellClassName) || undefined,\n },\n renderCell,\n }\n })\n }, [columnDefs, sortKey, sortDirection, onSort])\n\n return {\n columns,\n rows,\n totalItems,\n currentPage: effectivePage,\n totalPages,\n pageSize,\n pageSizeOptions,\n onPageChange,\n onPageSizeChange,\n sortKey,\n sortDirection,\n onSort,\n searchTerm,\n onSearchChange,\n filterValues,\n setFilterValue,\n clearFilters,\n activeFilterCount,\n selection,\n }\n}\n"],"mappings":";;;;;AAcA,MAAM,oBAAoB;AAC1B,MAAM,4BAA4B;CAAC;CAAI;CAAI;CAAI;CAAI;AAEnD,SAAgB,SAAY,SAAgD;CAC1E,MAAM,EACJ,MACA,SAAS,YACT,YACA,MACA,QACA,SACA,WAAW,oBACT;CAEJ,MAAM,CAAC,aAAa,kBAAkB,SAAS,EAAE;CACjD,MAAM,CAAC,UAAU,eAAe,SAAS,YAAY,YAAY,kBAAkB;CACnF,MAAM,CAAC,WAAW,gBAAgB,SAG/B;EACD,KAAK,MAAM,OAAO;EAClB,WAAW,MAAM,aAAa;EAC/B,CAAC;CACF,MAAM,CAAC,YAAY,iBAAiB,SAAS,GAAG;CAChD,MAAM,CAAC,cAAc,mBAAmB,eAA6B;AACnE,MAAI,CAAC,QAAS,QAAO,EAAE;EACvB,MAAM,UAAwB,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iBAAiB,OAAO,IAAI,GAAG;MACxC;KACD,MAAM,EACJ,WAAW,GAAG,IAAI,WAAW,IAAI,cAAc,IAAI,QACpD;KACD;KACD;KACD;KACD;GAAC;GAAY;GAAS;GAAe;GAAO,CAAC;EAI9C;EACA;EACA,aAAa;EACb;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
|
package/dist/tabs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime134 from "react/jsx-runtime";
|
|
3
3
|
import { Tabs } from "@base-ui/react/tabs";
|
|
4
4
|
|
|
5
5
|
//#region src/components/tabs.d.ts
|
|
@@ -8,7 +8,7 @@ declare const TabsRoot: {
|
|
|
8
8
|
({
|
|
9
9
|
className,
|
|
10
10
|
...props
|
|
11
|
-
}: TabsRootProps):
|
|
11
|
+
}: TabsRootProps): react_jsx_runtime134.JSX.Element;
|
|
12
12
|
displayName: string;
|
|
13
13
|
};
|
|
14
14
|
type TabsListProps = React.ComponentProps<typeof Tabs.List> & {
|
|
@@ -20,7 +20,7 @@ declare const TabsList: {
|
|
|
20
20
|
className,
|
|
21
21
|
orientation,
|
|
22
22
|
...props
|
|
23
|
-
}: TabsListProps):
|
|
23
|
+
}: TabsListProps): react_jsx_runtime134.JSX.Element;
|
|
24
24
|
displayName: string;
|
|
25
25
|
};
|
|
26
26
|
type TabsTabProps = React.ComponentProps<typeof Tabs.Tab> & {
|
|
@@ -32,7 +32,7 @@ declare const TabsTab: {
|
|
|
32
32
|
className,
|
|
33
33
|
size,
|
|
34
34
|
...props
|
|
35
|
-
}: TabsTabProps):
|
|
35
|
+
}: TabsTabProps): react_jsx_runtime134.JSX.Element;
|
|
36
36
|
displayName: string;
|
|
37
37
|
};
|
|
38
38
|
type TabsIndicatorProps = React.ComponentProps<typeof Tabs.Indicator> & {
|
|
@@ -44,7 +44,7 @@ declare const TabsIndicator: {
|
|
|
44
44
|
className,
|
|
45
45
|
orientation,
|
|
46
46
|
...props
|
|
47
|
-
}: TabsIndicatorProps):
|
|
47
|
+
}: TabsIndicatorProps): react_jsx_runtime134.JSX.Element;
|
|
48
48
|
displayName: string;
|
|
49
49
|
};
|
|
50
50
|
type TabsPanelProps = React.ComponentProps<typeof Tabs.Panel>;
|
|
@@ -52,7 +52,7 @@ declare const TabsPanel: {
|
|
|
52
52
|
({
|
|
53
53
|
className,
|
|
54
54
|
...props
|
|
55
|
-
}: TabsPanelProps):
|
|
55
|
+
}: TabsPanelProps): react_jsx_runtime134.JSX.Element;
|
|
56
56
|
displayName: string;
|
|
57
57
|
};
|
|
58
58
|
//#endregion
|
package/dist/textarea.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime58 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/textarea.d.ts
|
|
5
5
|
type TextareaProps = React.ComponentProps<'textarea'>;
|
|
@@ -7,7 +7,7 @@ declare const Textarea: {
|
|
|
7
7
|
({
|
|
8
8
|
className,
|
|
9
9
|
...props
|
|
10
|
-
}: TextareaProps):
|
|
10
|
+
}: TextareaProps): react_jsx_runtime58.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
package/dist/textarea.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.d.ts","names":[],"sources":["../src/components/textarea.tsx"],"sourcesContent":[],"mappings":";;;;KAOK,aAAA,GAAgB,KAAA,CAAM;cAErB;;;;KAAqC,gBAAa,
|
|
1
|
+
{"version":3,"file":"textarea.d.ts","names":[],"sources":["../src/components/textarea.tsx"],"sourcesContent":[],"mappings":";;;;KAOK,aAAA,GAAgB,KAAA,CAAM;cAErB;;;;KAAqC,gBAAa,mBAAA,CAAA,GAAA,CAAA;EAFnD,WAAA,EAAA,MAAa;AAAuB,CAAA"}
|
package/dist/toast.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ButtonSize, ButtonVariant } from "./lib/button-variants.js";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime206 from "react/jsx-runtime";
|
|
4
4
|
import { Toast, Toast as Toast$1 } from "@base-ui/react/toast";
|
|
5
5
|
|
|
6
6
|
//#region src/components/toast.d.ts
|
|
7
7
|
type ToastProviderProps = React.ComponentProps<typeof Toast$1.Provider>;
|
|
8
8
|
declare const ToastProvider: {
|
|
9
|
-
(props: ToastProviderProps):
|
|
9
|
+
(props: ToastProviderProps): react_jsx_runtime206.JSX.Element;
|
|
10
10
|
displayName: string;
|
|
11
11
|
};
|
|
12
12
|
type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
@@ -18,7 +18,7 @@ declare const ToastViewport: {
|
|
|
18
18
|
className,
|
|
19
19
|
position,
|
|
20
20
|
...props
|
|
21
|
-
}: ToastViewportProps):
|
|
21
|
+
}: ToastViewportProps): react_jsx_runtime206.JSX.Element;
|
|
22
22
|
displayName: string;
|
|
23
23
|
};
|
|
24
24
|
type ToastRootProps = React.ComponentProps<typeof Toast$1.Root>;
|
|
@@ -26,7 +26,7 @@ declare const ToastRoot: {
|
|
|
26
26
|
({
|
|
27
27
|
className,
|
|
28
28
|
...props
|
|
29
|
-
}: ToastRootProps):
|
|
29
|
+
}: ToastRootProps): react_jsx_runtime206.JSX.Element;
|
|
30
30
|
displayName: string;
|
|
31
31
|
};
|
|
32
32
|
type ToastContentProps = React.ComponentProps<typeof Toast$1.Content>;
|
|
@@ -34,7 +34,7 @@ declare const ToastContent: {
|
|
|
34
34
|
({
|
|
35
35
|
className,
|
|
36
36
|
...props
|
|
37
|
-
}: ToastContentProps):
|
|
37
|
+
}: ToastContentProps): react_jsx_runtime206.JSX.Element;
|
|
38
38
|
displayName: string;
|
|
39
39
|
};
|
|
40
40
|
type ToastTitleProps = React.ComponentProps<typeof Toast$1.Title>;
|
|
@@ -42,7 +42,7 @@ declare const ToastTitle: {
|
|
|
42
42
|
({
|
|
43
43
|
className,
|
|
44
44
|
...props
|
|
45
|
-
}: ToastTitleProps):
|
|
45
|
+
}: ToastTitleProps): react_jsx_runtime206.JSX.Element;
|
|
46
46
|
displayName: string;
|
|
47
47
|
};
|
|
48
48
|
type ToastDescriptionProps = React.ComponentProps<typeof Toast$1.Description>;
|
|
@@ -50,7 +50,7 @@ declare const ToastDescription: {
|
|
|
50
50
|
({
|
|
51
51
|
className,
|
|
52
52
|
...props
|
|
53
|
-
}: ToastDescriptionProps):
|
|
53
|
+
}: ToastDescriptionProps): react_jsx_runtime206.JSX.Element;
|
|
54
54
|
displayName: string;
|
|
55
55
|
};
|
|
56
56
|
type ToastActionProps = React.ComponentProps<typeof Toast$1.Action> & {
|
|
@@ -63,7 +63,7 @@ declare const ToastAction: {
|
|
|
63
63
|
variant,
|
|
64
64
|
size,
|
|
65
65
|
...props
|
|
66
|
-
}: ToastActionProps):
|
|
66
|
+
}: ToastActionProps): react_jsx_runtime206.JSX.Element;
|
|
67
67
|
displayName: string;
|
|
68
68
|
};
|
|
69
69
|
type ToastCloseProps = React.ComponentProps<typeof Toast$1.Close>;
|
|
@@ -71,7 +71,7 @@ declare const ToastClose: {
|
|
|
71
71
|
({
|
|
72
72
|
className,
|
|
73
73
|
...props
|
|
74
|
-
}: ToastCloseProps):
|
|
74
|
+
}: ToastCloseProps): react_jsx_runtime206.JSX.Element;
|
|
75
75
|
displayName: string;
|
|
76
76
|
};
|
|
77
77
|
type ToastPositionerProps = React.ComponentProps<typeof Toast$1.Positioner>;
|
|
@@ -79,7 +79,7 @@ declare const ToastPositioner: {
|
|
|
79
79
|
({
|
|
80
80
|
className,
|
|
81
81
|
...props
|
|
82
|
-
}: ToastPositionerProps):
|
|
82
|
+
}: ToastPositionerProps): react_jsx_runtime206.JSX.Element;
|
|
83
83
|
displayName: string;
|
|
84
84
|
};
|
|
85
85
|
//#endregion
|
package/dist/toggle-group.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ControlSize, ControlVariant } from "./lib/control-variants.js";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime199 from "react/jsx-runtime";
|
|
4
4
|
import { Toggle } from "@base-ui/react/toggle";
|
|
5
5
|
import { ToggleGroup } from "@base-ui/react/toggle-group";
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ declare const ToggleGroupRoot: {
|
|
|
11
11
|
className,
|
|
12
12
|
orientation,
|
|
13
13
|
...props
|
|
14
|
-
}: ToggleGroupRootProps):
|
|
14
|
+
}: ToggleGroupRootProps): react_jsx_runtime199.JSX.Element;
|
|
15
15
|
displayName: string;
|
|
16
16
|
};
|
|
17
17
|
type ToggleGroupItemProps = React.ComponentProps<typeof Toggle> & {
|
|
@@ -26,7 +26,7 @@ declare const ToggleGroupItem: {
|
|
|
26
26
|
variant,
|
|
27
27
|
size,
|
|
28
28
|
...props
|
|
29
|
-
}: ToggleGroupItemProps):
|
|
29
|
+
}: ToggleGroupItemProps): react_jsx_runtime199.JSX.Element;
|
|
30
30
|
displayName: string;
|
|
31
31
|
};
|
|
32
32
|
//#endregion
|
package/dist/toggle.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ControlSize, ControlVariant } from "./lib/control-variants.js";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime270 from "react/jsx-runtime";
|
|
4
4
|
import { Toggle as Toggle$1 } from "@base-ui/react/toggle";
|
|
5
5
|
|
|
6
6
|
//#region src/components/toggle.d.ts
|
|
@@ -16,7 +16,7 @@ declare const Toggle: {
|
|
|
16
16
|
variant,
|
|
17
17
|
size,
|
|
18
18
|
...props
|
|
19
|
-
}: ToggleProps):
|
|
19
|
+
}: ToggleProps): react_jsx_runtime270.JSX.Element;
|
|
20
20
|
displayName: string;
|
|
21
21
|
};
|
|
22
22
|
//#endregion
|
package/dist/toolbar.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ControlSize, ControlVariant } from "./lib/control-variants.js";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime264 from "react/jsx-runtime";
|
|
4
4
|
import { Toolbar } from "@base-ui/react/toolbar";
|
|
5
5
|
|
|
6
6
|
//#region src/components/toolbar.d.ts
|
|
@@ -9,7 +9,7 @@ declare const ToolbarRoot: {
|
|
|
9
9
|
({
|
|
10
10
|
className,
|
|
11
11
|
...props
|
|
12
|
-
}: ToolbarRootProps):
|
|
12
|
+
}: ToolbarRootProps): react_jsx_runtime264.JSX.Element;
|
|
13
13
|
displayName: string;
|
|
14
14
|
};
|
|
15
15
|
type ToolbarButtonProps = React.ComponentProps<typeof Toolbar.Button> & {
|
|
@@ -24,7 +24,7 @@ declare const ToolbarButton: {
|
|
|
24
24
|
variant,
|
|
25
25
|
size,
|
|
26
26
|
...props
|
|
27
|
-
}: ToolbarButtonProps):
|
|
27
|
+
}: ToolbarButtonProps): react_jsx_runtime264.JSX.Element;
|
|
28
28
|
displayName: string;
|
|
29
29
|
};
|
|
30
30
|
type ToolbarLinkProps = React.ComponentProps<typeof Toolbar.Link>;
|
|
@@ -32,7 +32,7 @@ declare const ToolbarLink: {
|
|
|
32
32
|
({
|
|
33
33
|
className,
|
|
34
34
|
...props
|
|
35
|
-
}: ToolbarLinkProps):
|
|
35
|
+
}: ToolbarLinkProps): react_jsx_runtime264.JSX.Element;
|
|
36
36
|
displayName: string;
|
|
37
37
|
};
|
|
38
38
|
type ToolbarInputProps = React.ComponentProps<typeof Toolbar.Input>;
|
|
@@ -40,7 +40,7 @@ declare const ToolbarInput: {
|
|
|
40
40
|
({
|
|
41
41
|
className,
|
|
42
42
|
...props
|
|
43
|
-
}: ToolbarInputProps):
|
|
43
|
+
}: ToolbarInputProps): react_jsx_runtime264.JSX.Element;
|
|
44
44
|
displayName: string;
|
|
45
45
|
};
|
|
46
46
|
type ToolbarGroupProps = React.ComponentProps<typeof Toolbar.Group>;
|
|
@@ -48,7 +48,7 @@ declare const ToolbarGroup: {
|
|
|
48
48
|
({
|
|
49
49
|
className,
|
|
50
50
|
...props
|
|
51
|
-
}: ToolbarGroupProps):
|
|
51
|
+
}: ToolbarGroupProps): react_jsx_runtime264.JSX.Element;
|
|
52
52
|
displayName: string;
|
|
53
53
|
};
|
|
54
54
|
type ToolbarSeparatorProps = React.ComponentProps<typeof Toolbar.Separator>;
|
|
@@ -56,7 +56,7 @@ declare const ToolbarSeparator: {
|
|
|
56
56
|
({
|
|
57
57
|
className,
|
|
58
58
|
...props
|
|
59
|
-
}: ToolbarSeparatorProps):
|
|
59
|
+
}: ToolbarSeparatorProps): react_jsx_runtime264.JSX.Element;
|
|
60
60
|
displayName: string;
|
|
61
61
|
};
|
|
62
62
|
//#endregion
|
package/dist/toolbar.js
CHANGED
|
@@ -9,7 +9,7 @@ import { Toolbar } from "@base-ui/react/toolbar";
|
|
|
9
9
|
//#region src/components/toolbar.tsx
|
|
10
10
|
const ToolbarRoot = ({ className, ...props }) => {
|
|
11
11
|
return /* @__PURE__ */ jsx(Toolbar.Root, {
|
|
12
|
-
className: cn("flex items-center gap-1 flex-wrap rounded-md border border-border
|
|
12
|
+
className: cn("flex items-center gap-1 flex-wrap rounded-md border border-border p-1", className),
|
|
13
13
|
...props
|
|
14
14
|
});
|
|
15
15
|
};
|
package/dist/toolbar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbar.js","names":["BaseToolbar"],"sources":["../src/components/toolbar.tsx"],"sourcesContent":["'use client'\n\nimport { Toolbar as BaseToolbar } from '@base-ui/react/toolbar'\nimport * as React from 'react'\n\nimport {\n type ControlSize,\n type ControlVariant,\n controlVariants,\n} from '../lib/control-variants'\nimport { cn } from '../lib/utils'\n\n// ============================================================================\n// ToolbarRoot\n// ============================================================================\n\ntype ToolbarRootProps = React.ComponentProps<typeof BaseToolbar.Root>\n\nconst ToolbarRoot = ({ className, ...props }: ToolbarRootProps) => {\n return (\n <BaseToolbar.Root\n className={cn(\n 'flex items-center gap-1 flex-wrap rounded-md border border-border
|
|
1
|
+
{"version":3,"file":"toolbar.js","names":["BaseToolbar"],"sources":["../src/components/toolbar.tsx"],"sourcesContent":["'use client'\n\nimport { Toolbar as BaseToolbar } from '@base-ui/react/toolbar'\nimport * as React from 'react'\n\nimport {\n type ControlSize,\n type ControlVariant,\n controlVariants,\n} from '../lib/control-variants'\nimport { cn } from '../lib/utils'\n\n// ============================================================================\n// ToolbarRoot\n// ============================================================================\n\ntype ToolbarRootProps = React.ComponentProps<typeof BaseToolbar.Root>\n\nconst ToolbarRoot = ({ className, ...props }: ToolbarRootProps) => {\n return (\n <BaseToolbar.Root\n className={cn(\n 'flex items-center gap-1 flex-wrap rounded-md border border-border p-1',\n className,\n )}\n {...props}\n />\n )\n}\n\nToolbarRoot.displayName = 'ToolbarRoot'\n\n// ============================================================================\n// ToolbarButton\n// ============================================================================\n\ntype ToolbarButtonProps = React.ComponentProps<typeof BaseToolbar.Button> & {\n /** Visual style of the toolbar button */\n variant?: ControlVariant\n /** Size of the toolbar button */\n size?: ControlSize\n}\n\nconst ToolbarButton = ({\n className,\n variant = 'ghost',\n size,\n ...props\n}: ToolbarButtonProps) => {\n return (\n <BaseToolbar.Button\n className={cn(controlVariants({ variant, size }), className)}\n {...props}\n />\n )\n}\n\nToolbarButton.displayName = 'ToolbarButton'\n\n// ============================================================================\n// ToolbarLink\n// ============================================================================\n\ntype ToolbarLinkProps = React.ComponentProps<typeof BaseToolbar.Link>\n\nconst ToolbarLink = ({ className, ...props }: ToolbarLinkProps) => {\n return (\n <BaseToolbar.Link\n className={cn(\n 'text-sm text-muted-foreground no-underline hover:text-foreground',\n className,\n )}\n {...props}\n />\n )\n}\n\nToolbarLink.displayName = 'ToolbarLink'\n\n// ============================================================================\n// ToolbarInput\n// ============================================================================\n\ntype ToolbarInputProps = React.ComponentProps<typeof BaseToolbar.Input>\n\nconst ToolbarInput = ({ className, ...props }: ToolbarInputProps) => {\n return (\n <BaseToolbar.Input\n className={cn(\n 'h-8 rounded-md border border-border bg-background px-2 text-sm outline-none',\n className,\n )}\n {...props}\n />\n )\n}\n\nToolbarInput.displayName = 'ToolbarInput'\n\n// ============================================================================\n// ToolbarGroup\n// ============================================================================\n\ntype ToolbarGroupProps = React.ComponentProps<typeof BaseToolbar.Group>\n\nconst ToolbarGroup = ({ className, ...props }: ToolbarGroupProps) => {\n return (\n <BaseToolbar.Group className={cn('flex items-center gap-1', className)} {...props} />\n )\n}\n\nToolbarGroup.displayName = 'ToolbarGroup'\n\n// ============================================================================\n// ToolbarSeparator\n// ============================================================================\n\ntype ToolbarSeparatorProps = React.ComponentProps<typeof BaseToolbar.Separator>\n\nconst ToolbarSeparator = ({ className, ...props }: ToolbarSeparatorProps) => {\n return (\n <BaseToolbar.Separator\n className={cn('mx-1 h-4 w-px shrink-0 bg-border', className)}\n {...props}\n />\n )\n}\n\nToolbarSeparator.displayName = 'ToolbarSeparator'\n\n// ============================================================================\n// Exports\n// ============================================================================\n\nexport {\n ToolbarRoot,\n ToolbarButton,\n ToolbarLink,\n ToolbarInput,\n ToolbarGroup,\n ToolbarSeparator,\n}\n\nexport type {\n ToolbarRootProps,\n ToolbarButtonProps,\n ToolbarLinkProps,\n ToolbarInputProps,\n ToolbarGroupProps,\n ToolbarSeparatorProps,\n}\n"],"mappings":";;;;;;;;;AAkBA,MAAM,eAAe,EAAE,WAAW,GAAG,YAA8B;AACjE,QACE,oBAACA,QAAY;EACX,WAAW,GACT,yEACA,UACD;EACD,GAAI;GACJ;;AAIN,YAAY,cAAc;AAa1B,MAAM,iBAAiB,EACrB,WACA,UAAU,SACV,MACA,GAAG,YACqB;AACxB,QACE,oBAACA,QAAY;EACX,WAAW,GAAG,gBAAgB;GAAE;GAAS;GAAM,CAAC,EAAE,UAAU;EAC5D,GAAI;GACJ;;AAIN,cAAc,cAAc;AAQ5B,MAAM,eAAe,EAAE,WAAW,GAAG,YAA8B;AACjE,QACE,oBAACA,QAAY;EACX,WAAW,GACT,oEACA,UACD;EACD,GAAI;GACJ;;AAIN,YAAY,cAAc;AAQ1B,MAAM,gBAAgB,EAAE,WAAW,GAAG,YAA+B;AACnE,QACE,oBAACA,QAAY;EACX,WAAW,GACT,+EACA,UACD;EACD,GAAI;GACJ;;AAIN,aAAa,cAAc;AAQ3B,MAAM,gBAAgB,EAAE,WAAW,GAAG,YAA+B;AACnE,QACE,oBAACA,QAAY;EAAM,WAAW,GAAG,2BAA2B,UAAU;EAAE,GAAI;GAAS;;AAIzF,aAAa,cAAc;AAQ3B,MAAM,oBAAoB,EAAE,WAAW,GAAG,YAAmC;AAC3E,QACE,oBAACA,QAAY;EACX,WAAW,GAAG,oCAAoC,UAAU;EAC5D,GAAI;GACJ;;AAIN,iBAAiB,cAAc"}
|
package/dist/tooltip.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { TooltipVariant } from "./lib/tooltip-variants.js";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime225 from "react/jsx-runtime";
|
|
4
4
|
import { Tooltip } from "@base-ui/react/tooltip";
|
|
5
5
|
|
|
6
6
|
//#region src/components/tooltip.d.ts
|
|
7
7
|
type TooltipProviderProps = React.ComponentProps<typeof Tooltip.Provider>;
|
|
8
8
|
declare const TooltipProvider: {
|
|
9
|
-
(props: TooltipProviderProps):
|
|
9
|
+
(props: TooltipProviderProps): react_jsx_runtime225.JSX.Element;
|
|
10
10
|
displayName: string;
|
|
11
11
|
};
|
|
12
12
|
type TooltipRootProps = React.ComponentProps<typeof Tooltip.Root> & {
|
|
@@ -16,7 +16,7 @@ declare const TooltipRoot: {
|
|
|
16
16
|
({
|
|
17
17
|
variant,
|
|
18
18
|
...props
|
|
19
|
-
}: TooltipRootProps):
|
|
19
|
+
}: TooltipRootProps): react_jsx_runtime225.JSX.Element;
|
|
20
20
|
displayName: string;
|
|
21
21
|
};
|
|
22
22
|
type TooltipTriggerProps = React.ComponentProps<typeof Tooltip.Trigger>;
|
|
@@ -24,12 +24,12 @@ declare const TooltipTrigger: {
|
|
|
24
24
|
({
|
|
25
25
|
className,
|
|
26
26
|
...props
|
|
27
|
-
}: TooltipTriggerProps):
|
|
27
|
+
}: TooltipTriggerProps): react_jsx_runtime225.JSX.Element;
|
|
28
28
|
displayName: string;
|
|
29
29
|
};
|
|
30
30
|
type TooltipPortalProps = React.ComponentProps<typeof Tooltip.Portal>;
|
|
31
31
|
declare const TooltipPortal: {
|
|
32
|
-
(props: TooltipPortalProps):
|
|
32
|
+
(props: TooltipPortalProps): react_jsx_runtime225.JSX.Element;
|
|
33
33
|
displayName: string;
|
|
34
34
|
};
|
|
35
35
|
type TooltipPositionerProps = React.ComponentProps<typeof Tooltip.Positioner>;
|
|
@@ -37,7 +37,7 @@ declare const TooltipPositioner: {
|
|
|
37
37
|
({
|
|
38
38
|
className,
|
|
39
39
|
...props
|
|
40
|
-
}: TooltipPositionerProps):
|
|
40
|
+
}: TooltipPositionerProps): react_jsx_runtime225.JSX.Element;
|
|
41
41
|
displayName: string;
|
|
42
42
|
};
|
|
43
43
|
type TooltipPopupProps = React.ComponentProps<typeof Tooltip.Popup> & {
|
|
@@ -48,7 +48,7 @@ declare const TooltipPopup: {
|
|
|
48
48
|
className,
|
|
49
49
|
variant,
|
|
50
50
|
...props
|
|
51
|
-
}: TooltipPopupProps):
|
|
51
|
+
}: TooltipPopupProps): react_jsx_runtime225.JSX.Element;
|
|
52
52
|
displayName: string;
|
|
53
53
|
};
|
|
54
54
|
type TooltipArrowProps = React.ComponentProps<typeof Tooltip.Arrow> & {
|
|
@@ -59,7 +59,7 @@ declare const TooltipArrow: {
|
|
|
59
59
|
className,
|
|
60
60
|
variant,
|
|
61
61
|
...props
|
|
62
|
-
}: TooltipArrowProps):
|
|
62
|
+
}: TooltipArrowProps): react_jsx_runtime225.JSX.Element;
|
|
63
63
|
displayName: string;
|
|
64
64
|
};
|
|
65
65
|
//#endregion
|