@raystack/apsara 0.16.1 → 0.17.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/dist/index.cjs CHANGED
@@ -20093,10 +20093,20 @@ function Text({ children, className, size, weight, ...props }) {
20093
20093
  return (jsxRuntimeExports$1.jsx("span", { className: text$1({ size, className, weight }), ...props, children: children }));
20094
20094
  }
20095
20095
 
20096
- var styles$d = {"content":"select-module_content__X0QJ-","menuitem":"select-module_menuitem__DfVEU","separator":"select-module_separator__2UBNd","menugroup":"select-module_menugroup__zJbzr","trigger":"select-module_trigger__1tSaG","triggerIcon":"select-module_triggerIcon__iaoZ3"};
20096
+ var styles$d = {"content":"select-module_content__X0QJ-","menuitem":"select-module_menuitem__DfVEU","separator":"select-module_separator__2UBNd","menugroup":"select-module_menugroup__zJbzr","trigger":"select-module_trigger__1tSaG","trigger-sm":"select-module_trigger-sm__rcLow","trigger-md":"select-module_trigger-md__iDsne","triggerIcon":"select-module_triggerIcon__iaoZ3"};
20097
20097
 
20098
- const trigger$1 = cva(styles$d.trigger);
20099
- const SelectTrigger = React__namespace.forwardRef(({ className, children, ...props }, ref) => (jsxRuntimeExports$1.jsxs($cc7e05a45900e73f$export$41fb9f06171c75f4, { ref: ref, className: trigger$1({ className }), ...props, children: [children, jsxRuntimeExports$1.jsx($cc7e05a45900e73f$export$f04a61298a47a40f, { asChild: true, children: jsxRuntimeExports$1.jsx(ChevronDownIcon, { className: styles$d.triggerIcon }) })] })));
20098
+ const trigger$1 = cva(styles$d.trigger, {
20099
+ variants: {
20100
+ size: {
20101
+ small: styles$d["trigger-sm"],
20102
+ medium: styles$d["trigger-md"],
20103
+ },
20104
+ },
20105
+ defaultVariants: {
20106
+ size: "medium",
20107
+ },
20108
+ });
20109
+ const SelectTrigger = React__namespace.forwardRef(({ size, className, children, ...props }, ref) => (jsxRuntimeExports$1.jsxs($cc7e05a45900e73f$export$41fb9f06171c75f4, { ref: ref, className: trigger$1({ size, className }), ...props, children: [children, jsxRuntimeExports$1.jsx($cc7e05a45900e73f$export$f04a61298a47a40f, { asChild: true, children: jsxRuntimeExports$1.jsx(ChevronDownIcon, { className: styles$d.triggerIcon }) })] })));
20100
20110
  SelectTrigger.displayName = $cc7e05a45900e73f$export$41fb9f06171c75f4.displayName;
20101
20111
  const content$1 = cva(styles$d.content);
20102
20112
  const SelectContent = React__namespace.forwardRef(({ className, children, position = "popper", ...props }, ref) => (jsxRuntimeExports$1.jsx($cc7e05a45900e73f$export$602eac185826482c, { children: jsxRuntimeExports$1.jsx($cc7e05a45900e73f$export$7c6e2c02157bb7d2, { ref: ref, className: content$1({ className }), position: position, ...props, children: children }) })));
@@ -31725,21 +31735,21 @@ function DataTableClearFilter({ children, ...props }) {
31725
31735
  }
31726
31736
 
31727
31737
  function DataTableFilterOptions({ children, ...props }) {
31728
- const { table, filteredColumns, addFilterColumn } = useTable();
31738
+ const { table, filteredColumns, addFilterColumn, isLoading } = useTable();
31729
31739
  const availableColumns = table
31730
31740
  .getAllColumns()
31731
31741
  .filter((column) => typeof column.accessorFn !== "undefined" &&
31732
31742
  column.getCanHide() &&
31733
31743
  column.getCanFilter())
31734
31744
  .filter((column) => !filteredColumns.includes(column.id));
31735
- return (jsxRuntimeExports$1.jsxs(DropdownMenu, { children: [jsxRuntimeExports$1.jsx(DropdownMenu.Trigger, { asChild: true, children: jsxRuntimeExports$1.jsx(Button$1, { variant: "ghost", ...props, children: children || (jsxRuntimeExports$1.jsxs(Flex, { gap: "small", align: "center", justify: "center", children: [jsxRuntimeExports$1.jsx(PlusIcon, { width: 12, height: "12" }), " Filter"] })) }) }), availableColumns.length ? (jsxRuntimeExports$1.jsxs(DropdownMenu.Content, { align: "end", className: "w-[150px]", children: [jsxRuntimeExports$1.jsx(DropdownMenu.Label, { children: "Filter column" }), jsxRuntimeExports$1.jsx(DropdownMenu.Separator, {}), availableColumns.map((column) => {
31745
+ return (jsxRuntimeExports$1.jsxs(DropdownMenu, { children: [jsxRuntimeExports$1.jsx(DropdownMenu.Trigger, { asChild: true, disabled: isLoading, children: jsxRuntimeExports$1.jsx(Button$1, { variant: "ghost", ...props, children: children || (jsxRuntimeExports$1.jsxs(Flex, { gap: "small", align: "center", justify: "center", children: [jsxRuntimeExports$1.jsx(PlusIcon, { width: 12, height: "12" }), " Filter"] })) }) }), availableColumns.length ? (jsxRuntimeExports$1.jsxs(DropdownMenu.Content, { align: "end", className: "w-[150px]", children: [jsxRuntimeExports$1.jsx(DropdownMenu.Label, { children: "Filter column" }), jsxRuntimeExports$1.jsx(DropdownMenu.Separator, {}), availableColumns.map((column) => {
31736
31746
  const columnHeader = column?.columnDef?.header;
31737
31747
  const columnName = (typeof columnHeader === "string" && columnHeader) || column.id;
31738
31748
  return (jsxRuntimeExports$1.jsx(DropdownMenu.Item, { onSelect: () => addFilterColumn(column.id), children: columnName }, column.id));
31739
31749
  })] })) : null] }));
31740
31750
  }
31741
31751
 
31742
- var styles$4 = {"wrapper":"datatable-module_wrapper__Sxg2d","datatable":"datatable-module_datatable__z-Th2","table":"datatable-module_table__x2IkY","head":"datatable-module_head__zCfCW","toolbar":"datatable-module_toolbar__lO-aI","chip":"datatable-module_chip__IiwTD","chipWrapper":"datatable-module_chipWrapper__iz69x","filterOperator":"datatable-module_filterOperator__qtDsH","filterText":"datatable-module_filterText__w00L8","flex1":"datatable-module_flex1__fA-kQ","tRow":"datatable-module_tRow__GrMHh","tRowClick":"datatable-module_tRowClick__7wzkh"};
31752
+ var styles$4 = {"wrapper":"datatable-module_wrapper__Sxg2d","datatable":"datatable-module_datatable__z-Th2","table":"datatable-module_table__x2IkY","head":"datatable-module_head__zCfCW","header":"datatable-module_header__7-CAd","toolbar":"datatable-module_toolbar__lO-aI","chip":"datatable-module_chip__IiwTD","chipWrapper":"datatable-module_chipWrapper__iz69x","filterOperator":"datatable-module_filterOperator__qtDsH","filterText":"datatable-module_filterText__w00L8","flex1":"datatable-module_flex1__fA-kQ","tRow":"datatable-module_tRow__GrMHh","tRowClick":"datatable-module_tRowClick__7wzkh"};
31743
31753
 
31744
31754
  const columnTypesMap = {
31745
31755
  select: "select",
@@ -32197,7 +32207,7 @@ function Skeleton({ count = 1, wrapper: Wrapper, className: customClassName, con
32197
32207
  : elements));
32198
32208
  }
32199
32209
 
32200
- function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoading = false, ShouldShowHeader = true, initialState, loaderRow = 5, onRowClick, ...props }) {
32210
+ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoading = false, ShouldShowHeader = true, initialState, loaderRow = 5, onRowClick, onStateChange = () => { }, ...props }) {
32201
32211
  const [tableCustomFilter, setTableCustomFilter] = React.useState({});
32202
32212
  const convertedChildren = React.Children.toArray(children);
32203
32213
  const header = convertedChildren.find((child) => child.type === DataTableToolbar) || null;
@@ -32220,6 +32230,11 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
32220
32230
  : col.cell;
32221
32231
  return col;
32222
32232
  });
32233
+ React.useEffect(() => {
32234
+ if (onStateChange) {
32235
+ onStateChange(tableState);
32236
+ }
32237
+ }, [tableState]);
32223
32238
  const updateColumnCustomFilter = (id, filterFn) => {
32224
32239
  setTableCustomFilter((old) => ({ ...old, [id]: filterFn }));
32225
32240
  };
@@ -32257,7 +32272,8 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
32257
32272
  onChange: () => ({}),
32258
32273
  tableCustomFilter,
32259
32274
  updateColumnCustomFilter,
32260
- }, children: [jsxRuntimeExports$1.jsxs(Flex, { direction: "column", className: styles$4.datatable, children: [header, jsxRuntimeExports$1.jsxs(Flex, { className: styles$4.tableContainer, style: parentStyle, children: [jsxRuntimeExports$1.jsxs(Table, { ...props, style: tableStyle, children: [jsxRuntimeExports$1.jsx(Table.Header, { children: ShouldShowHeader
32275
+ isLoading,
32276
+ }, children: [jsxRuntimeExports$1.jsxs(Flex, { direction: "column", className: styles$4.datatable, children: [header, jsxRuntimeExports$1.jsxs(Flex, { className: styles$4.tableContainer, style: parentStyle, children: [jsxRuntimeExports$1.jsxs(Table, { ...props, style: tableStyle, children: [jsxRuntimeExports$1.jsx(Table.Header, { className: styles$4.header, children: ShouldShowHeader
32261
32277
  ? table.getHeaderGroups().map((headerGroup) => (jsxRuntimeExports$1.jsx(Table.Row, { children: headerGroup.headers.map((header, index) => {
32262
32278
  return (jsxRuntimeExports$1.jsx(Table.Head, { style: {
32263
32279
  cursor: "pointer",