@raystack/apsara 0.20.2 → 0.20.4

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/index.css CHANGED
@@ -53,6 +53,24 @@
53
53
  --fs-500: 0.938rem;
54
54
  --fs-600: 1rem;
55
55
 
56
+ --space-1: 2px;
57
+ --space-2: 4px;
58
+ --space-3: 8px;
59
+ --space-4: 12px;
60
+ --space-5: 16px;
61
+ --space-6: 20px;
62
+ --space-7: 24px;
63
+ --space-8: 28px;
64
+ --space-9: 32px;
65
+ --space-10: 40px;
66
+ --space-11: 48px;
67
+ --space-12: 56px;
68
+ --space-13: 64px;
69
+ --space-14: 72px;
70
+ --space-15: 80px;
71
+ --space-16: 96px;
72
+ --space-17: 120px;
73
+
56
74
  --pd-2: 2px;
57
75
  --pd-4: 4px;
58
76
  --pd-6: 6px;
package/dist/index.js CHANGED
@@ -28208,7 +28208,7 @@ function DatePicker({ side = "top", dateFormat = "DD/MM/YYYY", placeholder = "DD
28208
28208
  }
28209
28209
  else {
28210
28210
  registerEventListeners();
28211
- setTimeout(() => textFieldRef.current?.focus());
28211
+ setTimeout(() => textFieldRef.current?.select());
28212
28212
  }
28213
28213
  }
28214
28214
  function handleKeyUp(event) {
@@ -28220,7 +28220,9 @@ function DatePicker({ side = "top", dateFormat = "DD/MM/YYYY", placeholder = "DD
28220
28220
  function handleInputChange(event) {
28221
28221
  const { value } = event.target;
28222
28222
  const format = value.includes("/") ? "DD/MM/YYYY" : value.includes("-") ? "DD-MM-YYYY" : undefined;
28223
- const date = dayjs(value, format);
28223
+ const date = dayjs(value.replace(/(\d{1,2})\/(\d{1,2})\/(\d{4})/, (_, day, month, year) => {
28224
+ return `${day.padStart(2, '0')}/${month.padStart(2, '0')}/${year}`; // Replaces [8/8/2024] to [08/08/2024]
28225
+ }), format);
28224
28226
  const isValidDate = date.isValid();
28225
28227
  const isAfter = calendarProps?.startMonth !== undefined ? dayjs(date).isSameOrAfter(calendarProps.startMonth) : true;
28226
28228
  const isBefore = calendarProps?.endMonth !== undefined ? dayjs(date).isSameOrBefore(calendarProps.endMonth) : true;
@@ -32227,7 +32229,7 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
32227
32229
  }, { threshold: 0.1 });
32228
32230
  observerRef.current = observer;
32229
32231
  return () => observer.disconnect();
32230
- }, [onLoadMore]);
32232
+ }, [onLoadMore, isLoading]);
32231
32233
  useEffect(() => {
32232
32234
  const observer = observerRef.current;
32233
32235
  const lastRow = lastRowRef.current;
@@ -32242,19 +32244,26 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
32242
32244
  };
32243
32245
  }, [isLoading]);
32244
32246
  const getLoader = (loaderRow, columns) => ([...new Array(loaderRow)].map((_, rowIndex) => (jsxRuntimeExports.jsx(Table.Row, { children: columns.map((_, colIndex) => (jsxRuntimeExports.jsx(Table.Cell, { children: jsxRuntimeExports.jsx(Skeleton, { containerClassName: styles$4.flex1, highlightColor: "var(--background-base)", baseColor: "var(--background-base-hover)" }) }, `col_${colIndex}`))) }, `row_${rowIndex}`))));
32247
+ const tableData = onLoadMore ? data : (isLoading
32248
+ ? [...new Array(loaderRow)].map((_, i) => ({ id: i }))
32249
+ : data);
32245
32250
  const { filteredColumns, addFilterColumn, removeFilterColumn, resetColumns } = useTableColumn();
32246
32251
  const columnWithCustomFilter = useMemo(() => columns.map((col) => {
32247
32252
  const colId = col.id || col?.accessorKey;
32248
32253
  const filterFn = colId && tableCustomFilter.hasOwnProperty(colId)
32249
32254
  ? tableCustomFilter[colId]
32250
32255
  : undefined;
32251
- const { cell } = col;
32256
+ const cell = onLoadMore
32257
+ ? col.cell
32258
+ : (isLoading
32259
+ ? () => (jsxRuntimeExports.jsx(Skeleton, { containerClassName: styles$4.flex1, highlightColor: "var(--background-base)", baseColor: "var(--background-base-hover)" }))
32260
+ : col.cell);
32252
32261
  return {
32253
32262
  ...col,
32254
32263
  cell,
32255
32264
  filterFn,
32256
32265
  };
32257
- }), [isLoading, columns, tableCustomFilter]);
32266
+ }), [isLoading, columns, tableCustomFilter, onLoadMore]);
32258
32267
  useEffect(() => {
32259
32268
  if (onStateChange) {
32260
32269
  onStateChange(tableState);
@@ -32264,7 +32273,7 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
32264
32273
  setTableCustomFilter((old) => ({ ...old, [id]: filterFn }));
32265
32274
  };
32266
32275
  const table = useReactTable({
32267
- data,
32276
+ data: tableData,
32268
32277
  columns: columnWithCustomFilter,
32269
32278
  globalFilterFn: "auto",
32270
32279
  enableRowSelection: true,
@@ -32314,12 +32323,12 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
32314
32323
  }) }, headerGroup.id)))
32315
32324
  : null }), jsxRuntimeExports.jsxs(Table.Body, { children: [table.getRowModel().rows?.length ? (table.getRowModel().rows.map((row, rowIndex) => (jsxRuntimeExports.jsx(Table.Row, { "data-state": row.getIsSelected() && "selected", onClick: () => onRowClick?.(row.original), className: isLoading
32316
32325
  ? ""
32317
- : `${styles$4.tRow} ${onRowClick ? styles$4.tRowClick : ""}`, ref: rowIndex === table.getRowModel().rows.length - 1
32326
+ : `${styles$4.tRow} ${onRowClick ? styles$4.tRowClick : ""}`, ref: onLoadMore && rowIndex === table.getRowModel().rows.length - 1
32318
32327
  ? lastRowRef
32319
32328
  : null, children: row.getVisibleCells().map((cell, index) => (jsxRuntimeExports.jsx(Table.Cell, { style: {
32320
32329
  ...(cell.column.columnDef?.meta?.style ?? {}),
32321
32330
  }, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, `${cell.id}_${index}`))) }, row.id)))) : (!isLoading ?
32322
- jsxRuntimeExports.jsx(Table.Row, { children: jsxRuntimeExports.jsx(Table.Cell, { colSpan: columns.length, children: emptyState || "No results." }) }) : jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {})), isLoading && getLoader(loaderRow, columns)] })] }), detail] })] }), footer] }) }));
32331
+ jsxRuntimeExports.jsx(Table.Row, { children: jsxRuntimeExports.jsx(Table.Cell, { colSpan: columns.length, children: emptyState || "No results." }) }) : jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {})), isLoading && onLoadMore && getLoader(loaderRow, columns)] })] }), detail] })] }), footer] }) }));
32323
32332
  }
32324
32333
  const DataTable = Object.assign(DataTableRoot, {
32325
32334
  Toolbar: DataTableToolbar,