@pathscale/ui 1.1.12 → 1.1.14

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.
Files changed (37) hide show
  1. package/dist/components/pagination/Pagination.css +121 -0
  2. package/dist/components/pagination/Pagination.d.ts +8 -2
  3. package/dist/components/pagination/Pagination.js +113 -7
  4. package/dist/components/select/Select.css +244 -0
  5. package/dist/components/select/Select.d.ts +44 -13
  6. package/dist/components/select/Select.js +618 -41
  7. package/dist/components/select/index.d.ts +2 -1
  8. package/dist/components/streaming-table/StreamingTable.js +39 -92
  9. package/dist/components/table/EnhancedTable.d.ts +1 -1
  10. package/dist/components/table/EnhancedTable.js +131 -195
  11. package/dist/components/table/{table.css → Table.css} +138 -0
  12. package/dist/components/table/Table.d.ts +69 -7
  13. package/dist/components/table/Table.js +302 -28
  14. package/dist/components/table/hooks/helpers.d.ts +7 -0
  15. package/dist/components/table/hooks/helpers.js +26 -0
  16. package/dist/components/table/hooks/index.d.ts +9 -0
  17. package/dist/components/table/hooks/index.js +18 -0
  18. package/dist/components/table/hooks/useAnchoredOverlayPosition.d.ts +16 -0
  19. package/dist/components/table/hooks/useAnchoredOverlayPosition.js +61 -0
  20. package/dist/components/table/hooks/useTableExpansion.d.ts +13 -0
  21. package/dist/components/table/hooks/useTableExpansion.js +17 -0
  22. package/dist/components/table/hooks/useTableFiltering.d.ts +30 -0
  23. package/dist/components/table/hooks/useTableFiltering.js +67 -0
  24. package/dist/components/table/hooks/useTableModel.d.ts +27 -0
  25. package/dist/components/table/hooks/useTableModel.js +56 -0
  26. package/dist/components/table/hooks/useTablePagination.d.ts +20 -0
  27. package/dist/components/table/hooks/useTablePagination.js +48 -0
  28. package/dist/components/table/hooks/useTableSelection.d.ts +14 -0
  29. package/dist/components/table/hooks/useTableSelection.js +17 -0
  30. package/dist/components/table/hooks/useTableSorting.d.ts +19 -0
  31. package/dist/components/table/hooks/useTableSorting.js +21 -0
  32. package/dist/components/table/index.d.ts +4 -1
  33. package/dist/components/table/index.js +26 -1
  34. package/dist/index.d.ts +3 -1
  35. package/dist/index.js +10 -1
  36. package/package.json +1 -1
  37. package/dist/components/select/select.css +0 -351
@@ -1 +1,2 @@
1
- export { default, type SelectProps } from "./Select";
1
+ export { default } from "./Select";
2
+ export type { SelectProps, SelectRootProps, SelectValueType, SelectVariant, SelectSelectionMode, SelectTriggerProps, SelectValueProps, SelectIndicatorProps, SelectPopoverProps, SelectListboxProps, SelectOptionProps, } from "./Select";
@@ -2,11 +2,10 @@ import * as __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__ from "solid-js/web
2
2
  import * as __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__ from "solid-js";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__ from "tailwind-merge";
4
4
  import * as __WEBPACK_EXTERNAL_MODULE__table_index_js_3c329fbb__ from "../table/index.js";
5
- import * as __WEBPACK_EXTERNAL_MODULE__button_index_js_557db1f7__ from "../button/index.js";
6
5
  import * as __WEBPACK_EXTERNAL_MODULE__icon_index_js_1f7a158c__ from "../icon/index.js";
7
6
  import * as __WEBPACK_EXTERNAL_MODULE__pagination_index_js_4cbbf7e7__ from "../pagination/index.js";
8
7
  import * as __WEBPACK_EXTERNAL_MODULE__createStreamingTableStore_js_f1f78960__ from "./createStreamingTableStore.js";
9
- var _tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)('<div class="flex justify-center items-center gap-2 mt-4"><span class="text-sm ml-2">Page <!> of '), _tmpl$2 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<div>"), _tmpl$3 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<div><span>");
8
+ var _tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<div class=mt-4>"), _tmpl$2 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<div>"), _tmpl$3 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<div><span>");
10
9
  const StreamingTable = (props)=>{
11
10
  const [local, tableProps] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.splitProps)(props, [
12
11
  "data",
@@ -88,18 +87,18 @@ const StreamingTable = (props)=>{
88
87
  });
89
88
  });
90
89
  const getColumnId = (col, index)=>col.id ?? col.accessorKey ?? `column-${index}`;
91
- const handleSort = (col, index)=>{
92
- if (!local.enableSorting || false === col.enableSorting) return;
93
- const columnId = getColumnId(col, index);
94
- const current = sortingState();
95
- let newDirection = "asc";
96
- if (current.columnId === columnId) {
97
- if ("asc" === current.direction) newDirection = "desc";
98
- else if ("desc" === current.direction) newDirection = null;
99
- }
90
+ const sortDescriptor = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
91
+ const sorting = sortingState();
92
+ if (!sorting.columnId || !sorting.direction) return;
93
+ return {
94
+ column: sorting.columnId,
95
+ direction: "asc" === sorting.direction ? "ascending" : "descending"
96
+ };
97
+ });
98
+ const handleSortChange = (descriptor)=>{
100
99
  setSortingState({
101
- columnId: null === newDirection ? null : columnId,
102
- direction: newDirection
100
+ columnId: descriptor.column,
101
+ direction: "ascending" === descriptor.direction ? "asc" : "desc"
103
102
  });
104
103
  };
105
104
  const getSortValue = (row, col)=>{
@@ -140,17 +139,15 @@ const StreamingTable = (props)=>{
140
139
  });
141
140
  return sorted;
142
141
  });
143
- const renderSortIndicator = (col, index)=>{
144
- if (!local.enableSorting || false === col.enableSorting) return null;
145
- const columnId = getColumnId(col, index);
146
- const sorting = sortingState();
147
- if (sorting.columnId !== columnId || !sorting.direction) return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__icon_index_js_1f7a158c__["default"], {
142
+ const renderSortIndicator = (sortDirection)=>{
143
+ if (!local.enableSorting) return null;
144
+ if (!sortDirection) return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__icon_index_js_1f7a158c__["default"], {
148
145
  name: "icon-[mdi-light--unfold-more-horizontal]",
149
146
  width: 16,
150
147
  height: 16,
151
148
  class: "opacity-30"
152
149
  });
153
- return "asc" === sorting.direction ? (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__icon_index_js_1f7a158c__["default"], {
150
+ return "ascending" === sortDirection ? (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__icon_index_js_1f7a158c__["default"], {
154
151
  name: "icon-[mdi-light--chevron-up]",
155
152
  width: 16,
156
153
  height: 16
@@ -186,22 +183,6 @@ const StreamingTable = (props)=>{
186
183
  const maxPage = totalPages() - 1;
187
184
  if (page >= 0 && page <= maxPage) setCurrentPage(page);
188
185
  };
189
- const nextPage = ()=>goToPage(currentPage() + 1);
190
- const prevPage = ()=>goToPage(currentPage() - 1);
191
- const visiblePageNumbers = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
192
- const total = totalPages();
193
- const current = currentPage();
194
- const pages = [];
195
- if (total <= 5) for(let i = 0; i < total; i++)pages.push(i);
196
- else {
197
- let start = Math.max(0, current - 2);
198
- let end = Math.min(total - 1, current + 2);
199
- if (current < 2) end = Math.min(total - 1, 4);
200
- else if (current > total - 3) start = Math.max(0, total - 5);
201
- for(let i = start; i <= end; i++)pages.push(i);
202
- }
203
- return pages;
204
- });
205
186
  return (()=>{
206
187
  var _el$ = _tmpl$2();
207
188
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__table_index_js_3c329fbb__["default"], (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.mergeProps)(tableProps, {
@@ -209,6 +190,10 @@ const StreamingTable = (props)=>{
209
190
  return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__table_index_js_3c329fbb__["default"].ScrollContainer, {
210
191
  get children () {
211
192
  return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__table_index_js_3c329fbb__["default"].Content, {
193
+ get sortDescriptor () {
194
+ return sortDescriptor();
195
+ },
196
+ onSortChange: handleSortChange,
212
197
  get children () {
213
198
  return [
214
199
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__table_index_js_3c329fbb__["default"].Header, {
@@ -220,16 +205,18 @@ const StreamingTable = (props)=>{
220
205
  return local.columns;
221
206
  },
222
207
  children: (col, index)=>{
208
+ const columnId = getColumnId(col, index());
223
209
  const isSortable = local.enableSorting && false !== col.enableSorting;
224
210
  return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__table_index_js_3c329fbb__["default"].Column, {
225
- get children () {
226
- var _el$7 = _tmpl$3(), _el$8 = _el$7.firstChild;
227
- _el$7.$$click = ()=>isSortable && handleSort(col, index());
228
- (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.className)(_el$7, isSortable ? "flex items-center gap-2 cursor-pointer select-none" : "");
229
- (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$8, ()=>col.header);
230
- (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$7, ()=>renderSortIndicator(col, index()), null);
231
- return _el$7;
232
- }
211
+ id: columnId,
212
+ allowsSorting: isSortable,
213
+ children: ({ sortDirection })=>(()=>{
214
+ var _el$3 = _tmpl$3(), _el$4 = _el$3.firstChild;
215
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.className)(_el$3, isSortable ? "flex items-center gap-2 cursor-pointer select-none" : "");
216
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$4, ()=>col.header);
217
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$3, ()=>renderSortIndicator(isSortable ? sortDirection : void 0), null);
218
+ return _el$3;
219
+ })()
233
220
  });
234
221
  }
235
222
  });
@@ -296,53 +283,16 @@ const StreamingTable = (props)=>{
296
283
  return enablePagination && totalPages() > 0;
297
284
  },
298
285
  get children () {
299
- var _el$2 = _tmpl$(), _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild, _el$6 = _el$4.nextSibling;
300
- _el$6.nextSibling;
286
+ var _el$2 = _tmpl$();
301
287
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$2, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__pagination_index_js_4cbbf7e7__["default"], {
302
- get children () {
303
- return [
304
- (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__button_index_js_557db1f7__["default"], {
305
- class: "join-item",
306
- onClick: prevPage,
307
- get isDisabled () {
308
- return 0 === currentPage();
309
- },
310
- size: "sm",
311
- variant: "ghost",
312
- children: "\xAB"
313
- }),
314
- (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.For, {
315
- get each () {
316
- return visiblePageNumbers();
317
- },
318
- children: (pageNum)=>{
319
- const isActive = ()=>pageNum === currentPage();
320
- return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__button_index_js_557db1f7__["default"], {
321
- class: "join-item",
322
- onClick: ()=>goToPage(pageNum),
323
- size: "sm",
324
- get variant () {
325
- return isActive() ? "primary" : "ghost";
326
- },
327
- children: pageNum + 1
328
- });
329
- }
330
- }),
331
- (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__button_index_js_557db1f7__["default"], {
332
- class: "join-item",
333
- onClick: nextPage,
334
- get isDisabled () {
335
- return currentPage() === totalPages() - 1;
336
- },
337
- size: "sm",
338
- variant: "ghost",
339
- children: "\xBB"
340
- })
341
- ];
342
- }
343
- }), _el$3);
344
- (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$3, ()=>currentPage() + 1, _el$6);
345
- (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$3, totalPages, null);
288
+ get page () {
289
+ return currentPage() + 1;
290
+ },
291
+ get total () {
292
+ return totalPages();
293
+ },
294
+ onChange: (page)=>goToPage(page - 1)
295
+ }));
346
296
  return _el$2;
347
297
  }
348
298
  }), null);
@@ -351,7 +301,4 @@ const StreamingTable = (props)=>{
351
301
  })();
352
302
  };
353
303
  const streaming_table_StreamingTable = StreamingTable;
354
- (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.delegateEvents)([
355
- "click"
356
- ]);
357
304
  export { streaming_table_StreamingTable as default };
@@ -1,4 +1,4 @@
1
- import "./table.css";
1
+ import "./Table.css";
2
2
  import { type Accessor, type JSX } from "solid-js";
3
3
  import { type ColumnDef, type SortingState, type ColumnFiltersState, type PaginationState, type OnChangeFn, type ExpandedState } from "@tanstack/solid-table";
4
4
  import { type TableRootProps } from "./Table";