@raystack/apsara 0.14.3 → 0.14.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.js CHANGED
@@ -31730,7 +31730,7 @@ function DataTableClearFilter({ children, ...props }) {
31730
31730
  return (jsxRuntimeExports$1.jsx(Button$1, { variant: "ghost", onClick: () => {
31731
31731
  table.resetColumnFilters();
31732
31732
  resetColumns();
31733
- }, style: { width: "100%" }, ...props, children: children || (jsxRuntimeExports$1.jsxs(Flex, { gap: "small", align: "center", justify: "center", children: ["Clear filters ", jsxRuntimeExports$1.jsx(Cross2Icon, { width: 12, height: "12" })] })) }));
31733
+ }, ...props, children: children || (jsxRuntimeExports$1.jsxs(Flex, { gap: "small", align: "center", justify: "center", style: { textWrap: "nowrap" }, children: ["Clear filters ", jsxRuntimeExports$1.jsx(Cross2Icon, { width: 12, height: "12" })] })) }));
31734
31734
  }
31735
31735
 
31736
31736
  function DataTableFilterOptions({ children, ...props }) {
@@ -31946,15 +31946,14 @@ const getFilterValueType = ({ filterOperation, columnType, }) => {
31946
31946
  return filterValueTypeMap.text;
31947
31947
  }
31948
31948
  };
31949
- const FilterValues = ({ columnType = filterValueTypeMap.text, options = [], onValueChange, filterOperation, ...props }) => {
31950
- const [value, setValue] = useState({
31951
- value: "",
31952
- date: new Date(),
31953
- dateRange: {
31954
- to: new Date(),
31955
- from: new Date(),
31956
- },
31957
- });
31949
+ const FilterValues = ({ column, columnType = filterValueTypeMap.text, options = [], onValueChange, filterOperation, ...props }) => {
31950
+ const [value, setValue] = useState(column?.columnDef?.meta?.defaultValue
31951
+ ? { value: (column?.columnDef.meta).defaultValue }
31952
+ : {
31953
+ value: "",
31954
+ date: new Date(),
31955
+ dateRange: { to: new Date(), from: new Date() },
31956
+ });
31958
31957
  const valueType = getFilterValueType({ filterOperation, columnType });
31959
31958
  useEffect(() => {
31960
31959
  if (onValueChange) {
@@ -32008,7 +32007,7 @@ const FilteredChip = ({ column, updateColumnCustomFilter, }) => {
32008
32007
  setFilterOperation(undefined);
32009
32008
  setFilterValue({});
32010
32009
  }
32011
- return (jsxRuntimeExports$1.jsxs(Box, { className: styles$4.chip, children: [jsxRuntimeExports$1.jsx(Text, { className: styles$4.filterText, children: columnName }), jsxRuntimeExports$1.jsx(Operation, { columnType: filterVariant, onOperationSelect: setFilterOperation }), filterOperation?.hideValueField ? null : (jsxRuntimeExports$1.jsx(FilterValues, { columnType: filterVariant, options: options, onValueChange: setFilterValue, filterOperation: filterOperation })), jsxRuntimeExports$1.jsx(Flex, { children: jsxRuntimeExports$1.jsx(Cross1Icon, { height: "12", width: "12", onClick: removeFilter }) })] }));
32010
+ return (jsxRuntimeExports$1.jsxs(Box, { className: styles$4.chip, children: [jsxRuntimeExports$1.jsx(Text, { className: styles$4.filterText, children: columnName }), jsxRuntimeExports$1.jsx(Operation, { columnType: filterVariant, onOperationSelect: setFilterOperation }), filterOperation?.hideValueField ? null : (jsxRuntimeExports$1.jsx(FilterValues, { column: column, columnType: filterVariant, options: options, onValueChange: setFilterValue, filterOperation: filterOperation })), jsxRuntimeExports$1.jsx(Flex, { children: jsxRuntimeExports$1.jsx(Cross1Icon, { height: "12", width: "12", onClick: removeFilter }) })] }));
32012
32011
  };
32013
32012
 
32014
32013
  function DataTableFilterChips(props) {