@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.css CHANGED
@@ -731,7 +731,7 @@ html[data-theme="dark"] {
731
731
  .dialog-module_overlay__t-jUE {
732
732
  position: fixed;
733
733
  inset: 0;
734
-
734
+ z-index: 49;
735
735
  background-color: rgba(0, 0, 0, 0.15);
736
736
  }
737
737
 
@@ -1449,9 +1449,9 @@ html[data-theme="dark"] {
1449
1449
  border: none;
1450
1450
 
1451
1451
  color: var(--foreground-base);
1452
- padding: var(--pd-8);
1453
1452
  background-color: var(--background-base);
1454
1453
  font-size: 12px;
1454
+
1455
1455
  line-height: 16px;
1456
1456
  border-radius: var(--br-4);
1457
1457
  outline: 0.5px solid var(--border-base);
@@ -1461,6 +1461,14 @@ html[data-theme="dark"] {
1461
1461
  user-select: none;
1462
1462
  }
1463
1463
 
1464
+ .select-module_trigger-sm__rcLow {
1465
+ padding: var(--pd-4);
1466
+ }
1467
+
1468
+ .select-module_trigger-md__iDsne {
1469
+ padding: var(--pd-8);
1470
+ }
1471
+
1464
1472
  .select-module_trigger__1tSaG:hover {
1465
1473
  cursor: pointer;
1466
1474
  }
@@ -2011,6 +2019,10 @@ html[data-theme="dark"] {
2011
2019
  gap: var(--pd-2);
2012
2020
  }
2013
2021
 
2022
+ .datatable-module_header__7-CAd {
2023
+ z-index: 1;
2024
+ }
2025
+
2014
2026
  .datatable-module_toolbar__lO-aI {
2015
2027
  width: 100%;
2016
2028
  padding: 0 !important;
package/dist/index.js CHANGED
@@ -20073,10 +20073,20 @@ function Text({ children, className, size, weight, ...props }) {
20073
20073
  return (jsxRuntimeExports$1.jsx("span", { className: text$1({ size, className, weight }), ...props, children: children }));
20074
20074
  }
20075
20075
 
20076
- 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"};
20076
+ 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"};
20077
20077
 
20078
- const trigger$1 = cva(styles$d.trigger);
20079
- const SelectTrigger = React.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 }) })] })));
20078
+ const trigger$1 = cva(styles$d.trigger, {
20079
+ variants: {
20080
+ size: {
20081
+ small: styles$d["trigger-sm"],
20082
+ medium: styles$d["trigger-md"],
20083
+ },
20084
+ },
20085
+ defaultVariants: {
20086
+ size: "medium",
20087
+ },
20088
+ });
20089
+ const SelectTrigger = React.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 }) })] })));
20080
20090
  SelectTrigger.displayName = $cc7e05a45900e73f$export$41fb9f06171c75f4.displayName;
20081
20091
  const content$1 = cva(styles$d.content);
20082
20092
  const SelectContent = React.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 }) })));
@@ -31705,21 +31715,21 @@ function DataTableClearFilter({ children, ...props }) {
31705
31715
  }
31706
31716
 
31707
31717
  function DataTableFilterOptions({ children, ...props }) {
31708
- const { table, filteredColumns, addFilterColumn } = useTable();
31718
+ const { table, filteredColumns, addFilterColumn, isLoading } = useTable();
31709
31719
  const availableColumns = table
31710
31720
  .getAllColumns()
31711
31721
  .filter((column) => typeof column.accessorFn !== "undefined" &&
31712
31722
  column.getCanHide() &&
31713
31723
  column.getCanFilter())
31714
31724
  .filter((column) => !filteredColumns.includes(column.id));
31715
- 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) => {
31725
+ 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) => {
31716
31726
  const columnHeader = column?.columnDef?.header;
31717
31727
  const columnName = (typeof columnHeader === "string" && columnHeader) || column.id;
31718
31728
  return (jsxRuntimeExports$1.jsx(DropdownMenu.Item, { onSelect: () => addFilterColumn(column.id), children: columnName }, column.id));
31719
31729
  })] })) : null] }));
31720
31730
  }
31721
31731
 
31722
- 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"};
31732
+ 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"};
31723
31733
 
31724
31734
  const columnTypesMap = {
31725
31735
  select: "select",
@@ -32177,7 +32187,7 @@ function Skeleton({ count = 1, wrapper: Wrapper, className: customClassName, con
32177
32187
  : elements));
32178
32188
  }
32179
32189
 
32180
- function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoading = false, ShouldShowHeader = true, initialState, loaderRow = 5, onRowClick, ...props }) {
32190
+ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoading = false, ShouldShowHeader = true, initialState, loaderRow = 5, onRowClick, onStateChange = () => { }, ...props }) {
32181
32191
  const [tableCustomFilter, setTableCustomFilter] = useState({});
32182
32192
  const convertedChildren = Children.toArray(children);
32183
32193
  const header = convertedChildren.find((child) => child.type === DataTableToolbar) || null;
@@ -32200,6 +32210,11 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
32200
32210
  : col.cell;
32201
32211
  return col;
32202
32212
  });
32213
+ useEffect(() => {
32214
+ if (onStateChange) {
32215
+ onStateChange(tableState);
32216
+ }
32217
+ }, [tableState]);
32203
32218
  const updateColumnCustomFilter = (id, filterFn) => {
32204
32219
  setTableCustomFilter((old) => ({ ...old, [id]: filterFn }));
32205
32220
  };
@@ -32237,7 +32252,8 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
32237
32252
  onChange: () => ({}),
32238
32253
  tableCustomFilter,
32239
32254
  updateColumnCustomFilter,
32240
- }, 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
32255
+ isLoading,
32256
+ }, 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
32241
32257
  ? table.getHeaderGroups().map((headerGroup) => (jsxRuntimeExports$1.jsx(Table.Row, { children: headerGroup.headers.map((header, index) => {
32242
32258
  return (jsxRuntimeExports$1.jsx(Table.Head, { style: {
32243
32259
  cursor: "pointer",