@jobber/components 4.46.4-ensure-pat.1 → 4.46.5

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.
@@ -117,7 +117,15 @@ export interface DataListSearchProps {
117
117
  * prepended by "Search" or just falls back to "Search".
118
118
  */
119
119
  readonly placeholder?: string;
120
- readonly onSearch: (search: string) => void;
120
+ /**
121
+ * The initial value of the search input.
122
+ *
123
+ * Updating this prop after the component has mounted will rerender the
124
+ * component with the new value. Only update the value of this when you
125
+ * absolutely have to.
126
+ */
127
+ readonly initialValue?: string;
128
+ readonly onSearch: (value: string) => void;
121
129
  }
122
130
  export interface DataListFiltersProps {
123
131
  readonly children: ReactElement | ReactElement[];
@@ -3,6 +3,6 @@ import { DataListSearchProps } from "../../DataList.types";
3
3
  export declare const DATA_LIST_SEARCH_TEST_ID = "ATL-DataList-Search-input-wrapper";
4
4
  export declare function DataListSearch(_: DataListSearchProps): null;
5
5
  /**
6
- * Renders the DataList.Search component
6
+ * Renders the DataList.Search component.
7
7
  */
8
8
  export declare function InternalDataListSearch(): JSX.Element | null;
@@ -811,7 +811,7 @@ function DataListSearch(_) {
811
811
  return null;
812
812
  }
813
813
  /**
814
- * Renders the DataList.Search component
814
+ * Renders the DataList.Search component.
815
815
  */
816
816
  function InternalDataListSearch() {
817
817
  const inputRef = React.useRef(null);
@@ -820,14 +820,18 @@ function InternalDataListSearch() {
820
820
  const debouncedSearch = React.useCallback(debounce__default["default"]((value) => { var _a; return (_a = searchComponent === null || searchComponent === void 0 ? void 0 : searchComponent.props) === null || _a === void 0 ? void 0 : _a.onSearch(value); }, SEARCH_DEBOUNCE_DELAY), [searchComponent === null || searchComponent === void 0 ? void 0 : searchComponent.props.onSearch]);
821
821
  if (!searchComponent)
822
822
  return null;
823
- const { placeholder } = searchComponent.props;
823
+ const { placeholder, initialValue } = searchComponent.props;
824
824
  return (React__default["default"].createElement("div", { className: classnames__default["default"]({
825
825
  [styles$4.withNoFilters]: !filterComponent && !sorting,
826
826
  }) },
827
827
  React__default["default"].createElement("div", { "data-testid": DATA_LIST_SEARCH_TEST_ID, className: classnames__default["default"](styles$4.searchInput, {
828
828
  [styles$4.searchInputVisible]: visible,
829
829
  }) },
830
- React__default["default"].createElement(InputText.InputText, { ref: inputRef, placeholder: getPlaceholder(), onChange: debouncedSearch, prefix: { icon: "search" }, size: "small" })),
830
+ React__default["default"].createElement(InputText.InputText
831
+ // If the initial value changes, reset the input.
832
+ , {
833
+ // If the initial value changes, reset the input.
834
+ key: initialValue, defaultValue: initialValue, ref: inputRef, placeholder: getPlaceholder(), onChange: debouncedSearch, prefix: { icon: "search" }, size: "small" })),
831
835
  React__default["default"].createElement("div", { className: styles$4.searchButton },
832
836
  React__default["default"].createElement(AnimatedSwitcher.AnimatedSwitcher, { switched: visible, initialChild: React__default["default"].createElement(Button.Button, { variation: "subtle", icon: "search", ariaLabel: "Search", onClick: toggleSearch }), switchTo: React__default["default"].createElement(Button.Button, { variation: "subtle", icon: "remove", ariaLabel: "Close search bar", onClick: toggleSearch }) }))));
833
837
  function getPlaceholder() {
@@ -1054,6 +1058,9 @@ DataList.EmptyState = DataListEmptyState;
1054
1058
  DataList.Filters = DataListFilters;
1055
1059
  /**
1056
1060
  * Enables the search functionality of the DataList.
1061
+ *
1062
+ * Since the debounce is implemented within the component, it can only be an
1063
+ * uncontrolled component. Thus the lack of a `value` prop.
1057
1064
  */
1058
1065
  DataList.Search = DataListSearch;
1059
1066
  /**
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "4.46.4-ensure-pat.1+71f55e88",
3
+ "version": "4.46.5",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "build": "rollup --config",
9
9
  "bootstrap": "npm run clean; npm run build",
10
- "clean": "rm -rf dist/* tsconfig.rollup.tsbuildinfo",
10
+ "clean": "rm -rf dist/* tsconfig.tsbuildinfo",
11
11
  "entryPoints:build": "ts-node --project ../../tsconfig.bin.json ../../scripts/entryPoints.ts",
12
12
  "entryPoints:clean": "npm run entryPoints:build clean",
13
13
  "prepack": "npm run entryPoints:build",
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "dependencies": {
22
22
  "@jobber/design": "^0.46.0",
23
- "@jobber/formatters": "^0.2.2",
23
+ "@jobber/formatters": "*",
24
24
  "@jobber/hooks": "^2.5.0",
25
25
  "@popperjs/core": "^2.0.6",
26
26
  "@std-proposal/temporal": "0.0.1",
@@ -84,5 +84,5 @@
84
84
  "> 1%",
85
85
  "IE 10"
86
86
  ],
87
- "gitHead": "71f55e88492b59d647f7897c1a9fb1d527f6c2b9"
87
+ "gitHead": "d7aa0a27fea6da695c890f558b1f468593dddd56"
88
88
  }
package/rollup.config.js CHANGED
@@ -9,7 +9,6 @@ export default {
9
9
  plugins: [
10
10
  multiInput(),
11
11
  typescript({
12
- tsconfig: "./tsconfig.rollup.json",
13
12
  declarationDir: "dist",
14
13
  noEmitOnError: true,
15
14
  }),