@natoora-libs/core 0.2.20-dev-doug-2 → 0.2.20-dev-doug-3

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.
@@ -880,13 +880,17 @@ interface SearchAndFilterHeaderForTableProps {
880
880
  declare const _default$7: React.MemoExoticComponent<(props: SearchAndFilterHeaderForTableProps) => react_jsx_runtime.JSX.Element>;
881
881
 
882
882
  type SearchFieldDebouncedProps = {
883
- onSearch: (value: string) => void;
883
+ onSearch?: (value: string) => void;
884
+ value?: string;
885
+ onChange?: (e: React__default.ChangeEvent<HTMLInputElement>) => void;
886
+ onKeyDown?: (e: React__default.KeyboardEvent<HTMLInputElement>) => void;
884
887
  variant?: 'outlined' | 'filled' | 'standard';
885
888
  hideSearchIcon?: boolean;
886
889
  initialValue?: string;
887
890
  debounceDelay?: number;
888
891
  minCharacters?: number;
889
892
  sx?: SxProps<Theme>;
893
+ width?: number;
890
894
  inputProps?: {
891
895
  sx: SxProps<Theme>;
892
896
  };
@@ -895,10 +899,15 @@ declare const SearchFieldDebounced: React__default.FC<SearchFieldDebouncedProps>
895
899
 
896
900
  type SearchHeaderProps = {
897
901
  renderButton?: ReactNode;
902
+ renderExtraAction?: ReactNode;
898
903
  children?: ReactNode;
899
- onSearch: (value: string) => void;
904
+ onSearch?: (value: string) => void;
905
+ value?: string;
906
+ onChange?: (e: React__default.ChangeEvent<HTMLInputElement>) => void;
907
+ onKeyDown?: (e: React__default.KeyboardEvent<HTMLInputElement>) => void;
908
+ width?: number;
900
909
  };
901
- declare const SearchHeader: React.MemoExoticComponent<({ renderButton, children, onSearch }: SearchHeaderProps) => react_jsx_runtime.JSX.Element>;
910
+ declare const SearchHeader: ({ renderButton, renderExtraAction, children, onSearch, value, onChange, onKeyDown, width, }: SearchHeaderProps) => react_jsx_runtime.JSX.Element;
902
911
 
903
912
  interface ISearchWithFiltersProps {
904
913
  enterPressedInSearch?: () => void;
@@ -880,13 +880,17 @@ interface SearchAndFilterHeaderForTableProps {
880
880
  declare const _default$7: React.MemoExoticComponent<(props: SearchAndFilterHeaderForTableProps) => react_jsx_runtime.JSX.Element>;
881
881
 
882
882
  type SearchFieldDebouncedProps = {
883
- onSearch: (value: string) => void;
883
+ onSearch?: (value: string) => void;
884
+ value?: string;
885
+ onChange?: (e: React__default.ChangeEvent<HTMLInputElement>) => void;
886
+ onKeyDown?: (e: React__default.KeyboardEvent<HTMLInputElement>) => void;
884
887
  variant?: 'outlined' | 'filled' | 'standard';
885
888
  hideSearchIcon?: boolean;
886
889
  initialValue?: string;
887
890
  debounceDelay?: number;
888
891
  minCharacters?: number;
889
892
  sx?: SxProps<Theme>;
893
+ width?: number;
890
894
  inputProps?: {
891
895
  sx: SxProps<Theme>;
892
896
  };
@@ -895,10 +899,15 @@ declare const SearchFieldDebounced: React__default.FC<SearchFieldDebouncedProps>
895
899
 
896
900
  type SearchHeaderProps = {
897
901
  renderButton?: ReactNode;
902
+ renderExtraAction?: ReactNode;
898
903
  children?: ReactNode;
899
- onSearch: (value: string) => void;
904
+ onSearch?: (value: string) => void;
905
+ value?: string;
906
+ onChange?: (e: React__default.ChangeEvent<HTMLInputElement>) => void;
907
+ onKeyDown?: (e: React__default.KeyboardEvent<HTMLInputElement>) => void;
908
+ width?: number;
900
909
  };
901
- declare const SearchHeader: React.MemoExoticComponent<({ renderButton, children, onSearch }: SearchHeaderProps) => react_jsx_runtime.JSX.Element>;
910
+ declare const SearchHeader: ({ renderButton, renderExtraAction, children, onSearch, value, onChange, onKeyDown, width, }: SearchHeaderProps) => react_jsx_runtime.JSX.Element;
902
911
 
903
912
  interface ISearchWithFiltersProps {
904
913
  enterPressedInSearch?: () => void;
@@ -1649,29 +1649,41 @@ import { TextField as TextField3, InputAdornment, Box as Box12 } from "@mui/mate
1649
1649
  import { jsx as jsx16 } from "react/jsx-runtime";
1650
1650
  var SearchFieldDebounced = ({
1651
1651
  onSearch,
1652
+ value: controlledValue,
1653
+ onChange: onChangeControlled,
1654
+ onKeyDown,
1652
1655
  variant = "outlined",
1653
1656
  hideSearchIcon = false,
1654
1657
  initialValue = "",
1655
1658
  debounceDelay = 500,
1656
1659
  minCharacters = 0,
1657
1660
  sx,
1661
+ width = 285,
1658
1662
  inputProps
1659
1663
  }) => {
1660
- const [value, setValue] = useState2(initialValue);
1664
+ const [internalValue, setInternalValue] = useState2(initialValue);
1661
1665
  const debounceRef = useRef3(null);
1662
1666
  const inputSx = inputProps?.sx;
1667
+ const isControlled = controlledValue !== void 0;
1668
+ const value = isControlled ? controlledValue : internalValue;
1669
+ const executeSearch = (inputValue) => {
1670
+ const trimmedInput = inputValue.trim();
1671
+ if (trimmedInput.length > 0 && trimmedInput.length < minCharacters) {
1672
+ return;
1673
+ }
1674
+ onSearch?.(trimmedInput);
1675
+ };
1663
1676
  const handleChange = (e) => {
1664
1677
  const input = e.target.value;
1665
- setValue(input);
1678
+ if (!isControlled) {
1679
+ setInternalValue(input);
1680
+ }
1681
+ onChangeControlled?.(e);
1666
1682
  if (debounceRef.current) {
1667
1683
  clearTimeout(debounceRef.current);
1668
1684
  }
1669
1685
  debounceRef.current = window.setTimeout(() => {
1670
- const trimmedInput = input.trim();
1671
- if (trimmedInput.length < minCharacters) {
1672
- return;
1673
- }
1674
- onSearch(trimmedInput);
1686
+ executeSearch(input);
1675
1687
  }, debounceDelay);
1676
1688
  };
1677
1689
  useEffect3(() => {
@@ -1682,7 +1694,7 @@ var SearchFieldDebounced = ({
1682
1694
  clearTimeout(debounceRef.current);
1683
1695
  };
1684
1696
  }, []);
1685
- return /* @__PURE__ */ jsx16(Box12, { width: 285, children: /* @__PURE__ */ jsx16(
1697
+ return /* @__PURE__ */ jsx16(Box12, { sx: { width }, children: /* @__PURE__ */ jsx16(
1686
1698
  TextField3,
1687
1699
  {
1688
1700
  fullWidth: true,
@@ -1690,6 +1702,7 @@ var SearchFieldDebounced = ({
1690
1702
  placeholder: "Search",
1691
1703
  value,
1692
1704
  onChange: handleChange,
1705
+ onKeyDown,
1693
1706
  sx,
1694
1707
  slotProps: {
1695
1708
  input: {
@@ -7690,40 +7703,58 @@ var SearchAndFilterHeaderForTable = (props) => {
7690
7703
  var SearchAndFilterHeaderForTable_default = React7.memo(SearchAndFilterHeaderForTable);
7691
7704
 
7692
7705
  // src/components/SearchHeader/SearchHeader.tsx
7693
- import { memo as memo18 } from "react";
7694
7706
  import { Box as Box37, Paper as Paper10 } from "@mui/material";
7695
7707
  import { jsx as jsx116, jsxs as jsxs80 } from "react/jsx-runtime";
7696
- var SearchHeader = memo18(
7697
- ({ renderButton, children, onSearch }) => {
7698
- return /* @__PURE__ */ jsxs80(
7699
- Paper10,
7700
- {
7701
- sx: {
7702
- display: "flex",
7703
- flexDirection: "column",
7704
- padding: 2
7705
- },
7706
- children: [
7707
- /* @__PURE__ */ jsxs80(
7708
- Box37,
7709
- {
7710
- sx: {
7711
- display: "flex",
7712
- justifyContent: "space-between",
7713
- alignItems: "center"
7714
- },
7715
- children: [
7716
- /* @__PURE__ */ jsx116(Box37, { sx: { width: 285 }, children: /* @__PURE__ */ jsx116(SearchFieldDebounced, { onSearch }) }),
7717
- renderButton
7718
- ]
7719
- }
7720
- ),
7721
- children
7722
- ]
7723
- }
7724
- );
7725
- }
7726
- );
7708
+ var SearchHeader = ({
7709
+ renderButton,
7710
+ renderExtraAction,
7711
+ children,
7712
+ onSearch,
7713
+ value,
7714
+ onChange,
7715
+ onKeyDown,
7716
+ width
7717
+ }) => {
7718
+ return /* @__PURE__ */ jsxs80(
7719
+ Paper10,
7720
+ {
7721
+ sx: {
7722
+ display: "flex",
7723
+ flexDirection: "column",
7724
+ padding: 2
7725
+ },
7726
+ children: [
7727
+ /* @__PURE__ */ jsxs80(
7728
+ Box37,
7729
+ {
7730
+ sx: {
7731
+ display: "flex",
7732
+ justifyContent: "space-between",
7733
+ alignItems: "center"
7734
+ },
7735
+ children: [
7736
+ /* @__PURE__ */ jsxs80(Box37, { sx: { display: "flex", gap: 1, alignItems: "center" }, children: [
7737
+ /* @__PURE__ */ jsx116(
7738
+ SearchFieldDebounced,
7739
+ {
7740
+ width,
7741
+ onSearch,
7742
+ value,
7743
+ onChange,
7744
+ onKeyDown
7745
+ }
7746
+ ),
7747
+ renderExtraAction
7748
+ ] }),
7749
+ renderButton
7750
+ ]
7751
+ }
7752
+ ),
7753
+ children
7754
+ ]
7755
+ }
7756
+ );
7757
+ };
7727
7758
 
7728
7759
  // src/components/SectionName/SectionName.tsx
7729
7760
  import HistoryIcon from "@mui/icons-material/History";
@@ -7946,7 +7977,7 @@ var SmartMultipleSelect = ({
7946
7977
  };
7947
7978
 
7948
7979
  // src/components/SquareLabel/SquareLabel.tsx
7949
- import { memo as memo19 } from "react";
7980
+ import { memo as memo18 } from "react";
7950
7981
  import { Typography as Typography30 } from "@mui/material";
7951
7982
  import { red as red2 } from "@mui/material/colors";
7952
7983
  import { makeStyles as makeStyles43 } from "tss-react/mui";
@@ -7967,10 +7998,10 @@ var SquareLabel = ({ color, copy }) => {
7967
7998
  const { classes } = useStyles43();
7968
7999
  return /* @__PURE__ */ jsx119(Typography30, { className: classes[color], children: copy });
7969
8000
  };
7970
- var SquareLabel_default = memo19(SquareLabel);
8001
+ var SquareLabel_default = memo18(SquareLabel);
7971
8002
 
7972
8003
  // src/components/Switch/Switch.tsx
7973
- import { memo as memo20 } from "react";
8004
+ import { memo as memo19 } from "react";
7974
8005
  import { Grid as Grid2, Switch } from "@mui/material";
7975
8006
  import { withStyles as withStyles6 } from "tss-react/mui";
7976
8007
  import { jsx as jsx120, jsxs as jsxs83 } from "react/jsx-runtime";
@@ -8023,7 +8054,7 @@ var LabelledSwitch = withStyles6(LSwitch, (theme) => ({
8023
8054
  fontSize: "1rem"
8024
8055
  }
8025
8056
  }));
8026
- var Switch_default = memo20(LabelledSwitch);
8057
+ var Switch_default = memo19(LabelledSwitch);
8027
8058
 
8028
8059
  // src/components/SmartTableHeaderFilterMenu/SmartTableHeaderFilterMenu.tsx
8029
8060
  import { useState as useState16, useEffect as useEffect11 } from "react";
@@ -8168,7 +8199,7 @@ var SmartTableHeaderFilterMenu = ({
8168
8199
  };
8169
8200
 
8170
8201
  // src/components/SmartTableHeader/SmartTableHeader.tsx
8171
- import { memo as memo21 } from "react";
8202
+ import { memo as memo20 } from "react";
8172
8203
  import {
8173
8204
  Box as Box40,
8174
8205
  Checkbox as Checkbox8,
@@ -8180,7 +8211,7 @@ import {
8180
8211
  Typography as Typography31
8181
8212
  } from "@mui/material";
8182
8213
  import { jsx as jsx122, jsxs as jsxs85 } from "react/jsx-runtime";
8183
- var SmartTableHeader = memo21(
8214
+ var SmartTableHeader = memo20(
8184
8215
  ({
8185
8216
  order,
8186
8217
  orderBy,
@@ -9848,7 +9879,7 @@ var TableDesktopToolbar = ({
9848
9879
  };
9849
9880
 
9850
9881
  // src/components/TableHeader/TableHeader.tsx
9851
- import { memo as memo22, useEffect as useEffect15, useState as useState24 } from "react";
9882
+ import { memo as memo21, useEffect as useEffect15, useState as useState24 } from "react";
9852
9883
  import { ImportExport as ImportExportIcon } from "@mui/icons-material";
9853
9884
  import { TableCell as TableCell7, TableHead as TableHead3, TableRow as TableRow6, TableSortLabel as TableSortLabel3 } from "@mui/material";
9854
9885
  import { makeStyles as makeStyles46 } from "tss-react/mui";
@@ -9908,7 +9939,7 @@ var TableHeader = ({ cells, onSort = null }) => {
9908
9939
  }
9909
9940
  ) : cell.label }, cell.label || key)) }) });
9910
9941
  };
9911
- var TableHeader_default = memo22(TableHeader);
9942
+ var TableHeader_default = memo21(TableHeader);
9912
9943
 
9913
9944
  // src/components/TextDivider/TextDivider.tsx
9914
9945
  import { Box as Box47, Typography as Typography37, Divider as Divider12, Button as Button20 } from "@mui/material";
@@ -10085,7 +10116,7 @@ var ThemedDateRangePicker = ({
10085
10116
  var ThemedDateRangePicker_default = ThemedDateRangePicker;
10086
10117
 
10087
10118
  // src/components/TheToolbar/TheToolbar.tsx
10088
- import { memo as memo23 } from "react";
10119
+ import { memo as memo22 } from "react";
10089
10120
  import { AppBar, Box as Box48, Toolbar } from "@mui/material";
10090
10121
  import { makeStyles as makeStyles49 } from "tss-react/mui";
10091
10122
  import { jsx as jsx141, jsxs as jsxs96 } from "react/jsx-runtime";
@@ -10135,7 +10166,7 @@ var TheToolbar = ({
10135
10166
  LeftDrawer
10136
10167
  ] });
10137
10168
  };
10138
- var TheToolbar_default = memo23(TheToolbar);
10169
+ var TheToolbar_default = memo22(TheToolbar);
10139
10170
 
10140
10171
  // src/components/ToastMessage/ToastMessage.tsx
10141
10172
  import { Alert as MuiAlert, Snackbar } from "@mui/material";
@@ -10286,7 +10317,7 @@ var TwoButtonDialog = ({
10286
10317
  var TwoButtonDialog_default = TwoButtonDialog;
10287
10318
 
10288
10319
  // src/components/UserBust/UserBust.tsx
10289
- import { memo as memo24 } from "react";
10320
+ import { memo as memo23 } from "react";
10290
10321
  import { Avatar as Avatar2, Typography as Typography39 } from "@mui/material";
10291
10322
  import { jsx as jsx144, jsxs as jsxs98 } from "react/jsx-runtime";
10292
10323
  var UserBust = ({ user, avatarProps, typographyProps }) => /* @__PURE__ */ jsxs98("div", { children: [
@@ -10303,7 +10334,7 @@ var UserBust = ({ user, avatarProps, typographyProps }) => /* @__PURE__ */ jsxs9
10303
10334
  /* @__PURE__ */ jsx144(Typography39, { ...typographyProps.username, children: user.username })
10304
10335
  ] })
10305
10336
  ] });
10306
- var UserBust_default = memo24(UserBust);
10337
+ var UserBust_default = memo23(UserBust);
10307
10338
 
10308
10339
  // src/components/icons/IconChart.tsx
10309
10340
  import { jsx as jsx145 } from "react/jsx-runtime";