@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.
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../calendar/date-picker.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAOlE,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,aAAa,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,IAAI,CAAC;CACd;AAED,wBAAgB,UAAU,CAAC,EACzB,IAAY,EACZ,UAAyB,EACzB,WAA0B,EAC1B,cAAc,EACd,aAAa,EACb,KAAkB,EAClB,QAAmB,GACpB,EAAE,eAAe,2CAyIjB"}
1
+ {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../calendar/date-picker.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAOlE,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,aAAa,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,IAAI,CAAC;CACd;AAED,wBAAgB,UAAU,CAAC,EACzB,IAAY,EACZ,UAAyB,EACzB,WAA0B,EAC1B,cAAc,EACd,aAAa,EACb,KAAkB,EAClB,QAAmB,GACpB,EAAE,eAAe,2CA2IjB"}
package/dist/index.cjs CHANGED
@@ -28228,7 +28228,7 @@ function DatePicker({ side = "top", dateFormat = "DD/MM/YYYY", placeholder = "DD
28228
28228
  }
28229
28229
  else {
28230
28230
  registerEventListeners();
28231
- setTimeout(() => textFieldRef.current?.focus());
28231
+ setTimeout(() => textFieldRef.current?.select());
28232
28232
  }
28233
28233
  }
28234
28234
  function handleKeyUp(event) {
@@ -28240,7 +28240,9 @@ function DatePicker({ side = "top", dateFormat = "DD/MM/YYYY", placeholder = "DD
28240
28240
  function handleInputChange(event) {
28241
28241
  const { value } = event.target;
28242
28242
  const format = value.includes("/") ? "DD/MM/YYYY" : value.includes("-") ? "DD-MM-YYYY" : undefined;
28243
- const date = dayjs(value, format);
28243
+ const date = dayjs(value.replace(/(\d{1,2})\/(\d{1,2})\/(\d{4})/, (_, day, month, year) => {
28244
+ return `${day.padStart(2, '0')}/${month.padStart(2, '0')}/${year}`; // Replaces [8/8/2024] to [08/08/2024]
28245
+ }), format);
28244
28246
  const isValidDate = date.isValid();
28245
28247
  const isAfter = calendarProps?.startMonth !== undefined ? dayjs(date).isSameOrAfter(calendarProps.startMonth) : true;
28246
28248
  const isBefore = calendarProps?.endMonth !== undefined ? dayjs(date).isSameOrBefore(calendarProps.endMonth) : true;
@@ -32247,7 +32249,7 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
32247
32249
  }, { threshold: 0.1 });
32248
32250
  observerRef.current = observer;
32249
32251
  return () => observer.disconnect();
32250
- }, [onLoadMore]);
32252
+ }, [onLoadMore, isLoading]);
32251
32253
  React.useEffect(() => {
32252
32254
  const observer = observerRef.current;
32253
32255
  const lastRow = lastRowRef.current;
@@ -32262,19 +32264,26 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
32262
32264
  };
32263
32265
  }, [isLoading]);
32264
32266
  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}`))));
32267
+ const tableData = onLoadMore ? data : (isLoading
32268
+ ? [...new Array(loaderRow)].map((_, i) => ({ id: i }))
32269
+ : data);
32265
32270
  const { filteredColumns, addFilterColumn, removeFilterColumn, resetColumns } = useTableColumn();
32266
32271
  const columnWithCustomFilter = React.useMemo(() => columns.map((col) => {
32267
32272
  const colId = col.id || col?.accessorKey;
32268
32273
  const filterFn = colId && tableCustomFilter.hasOwnProperty(colId)
32269
32274
  ? tableCustomFilter[colId]
32270
32275
  : undefined;
32271
- const { cell } = col;
32276
+ const cell = onLoadMore
32277
+ ? col.cell
32278
+ : (isLoading
32279
+ ? () => (jsxRuntimeExports.jsx(Skeleton, { containerClassName: styles$4.flex1, highlightColor: "var(--background-base)", baseColor: "var(--background-base-hover)" }))
32280
+ : col.cell);
32272
32281
  return {
32273
32282
  ...col,
32274
32283
  cell,
32275
32284
  filterFn,
32276
32285
  };
32277
- }), [isLoading, columns, tableCustomFilter]);
32286
+ }), [isLoading, columns, tableCustomFilter, onLoadMore]);
32278
32287
  React.useEffect(() => {
32279
32288
  if (onStateChange) {
32280
32289
  onStateChange(tableState);
@@ -32284,7 +32293,7 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
32284
32293
  setTableCustomFilter((old) => ({ ...old, [id]: filterFn }));
32285
32294
  };
32286
32295
  const table = useReactTable({
32287
- data,
32296
+ data: tableData,
32288
32297
  columns: columnWithCustomFilter,
32289
32298
  globalFilterFn: "auto",
32290
32299
  enableRowSelection: true,
@@ -32334,12 +32343,12 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
32334
32343
  }) }, headerGroup.id)))
32335
32344
  : 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
32336
32345
  ? ""
32337
- : `${styles$4.tRow} ${onRowClick ? styles$4.tRowClick : ""}`, ref: rowIndex === table.getRowModel().rows.length - 1
32346
+ : `${styles$4.tRow} ${onRowClick ? styles$4.tRowClick : ""}`, ref: onLoadMore && rowIndex === table.getRowModel().rows.length - 1
32338
32347
  ? lastRowRef
32339
32348
  : null, children: row.getVisibleCells().map((cell, index) => (jsxRuntimeExports.jsx(Table.Cell, { style: {
32340
32349
  ...(cell.column.columnDef?.meta?.style ?? {}),
32341
32350
  }, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, `${cell.id}_${index}`))) }, row.id)))) : (!isLoading ?
32342
- 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] }) }));
32351
+ 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] }) }));
32343
32352
  }
32344
32353
  const DataTable = Object.assign(DataTableRoot, {
32345
32354
  Toolbar: DataTableToolbar,