@commercetools-uikit/filters 19.15.0 → 19.16.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.
@@ -20,6 +20,10 @@ export type TFilterMenuProps = {
20
20
  * the input in which the user can select which operator should be used for this filter
21
21
  */
22
22
  renderOperatorsInput?: () => ReactNode;
23
+ /**
24
+ * formatted message to display the selected operator value
25
+ */
26
+ operatorLabel?: ReactNode;
23
27
  /**
24
28
  * the values applied to this filter by the user
25
29
  */
@@ -35,7 +39,7 @@ export type TFilterMenuProps = {
35
39
  /**
36
40
  * controls whether `x` in Trigger Button is displayed - required if `isPersistent` is `false`
37
41
  */
38
- onRemoveRequest?: (event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
42
+ onRemoveRequest?: (event?: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
39
43
  /**
40
44
  * optional button that allows the user to apply selected filter values
41
45
  */
@@ -54,5 +58,6 @@ export type TFilterMenuProps = {
54
58
  defaultOpen?: boolean;
55
59
  };
56
60
  export declare const menuStyles: import("@emotion/react").SerializedStyles;
61
+ export declare const menuBodyStyle: import("@emotion/react").SerializedStyles;
57
62
  declare function FilterMenu(props: TFilterMenuProps): import("@emotion/react/jsx-runtime").JSX.Element;
58
63
  export default FilterMenu;
@@ -0,0 +1 @@
1
+ export { default, type TAppliedFilterValue, menuStyles, menuBodyStyle, } from "./filter-menu.js";
@@ -1,7 +1,5 @@
1
- import { ReactElement, ReactNode } from 'react';
2
- import { type TAppliedFilterValue } from "./filter-menu/filter-menu.js";
3
- import { type TPrimaryButtonProps } from '@commercetools-uikit/primary-button';
4
- import { type TSelectInputProps } from '@commercetools-uikit/select-input';
1
+ import { type ReactNode, type MouseEvent, type KeyboardEvent } from 'react';
2
+ import { type TAppliedFilterValue } from "./filter-menu/index.js";
5
3
  type TAppliedFilter = {
6
4
  /**
7
5
  * unique identifier for the filter
@@ -12,7 +10,19 @@ type TAppliedFilter = {
12
10
  */
13
11
  values: TAppliedFilterValue[];
14
12
  };
15
- type TFilterConfiguration = {
13
+ export type TFilterConfiguration = {
14
+ /**
15
+ * unique identifier for the filter
16
+ */
17
+ key: string;
18
+ /**
19
+ * formatted message to display the filter name
20
+ */
21
+ label: ReactNode;
22
+ /**
23
+ * formatted message to display the selected operator value
24
+ */
25
+ operatorLabel?: ReactNode;
16
26
  /**
17
27
  * configuration object for the filter menu.
18
28
  */
@@ -24,19 +34,19 @@ type TFilterConfiguration = {
24
34
  /**
25
35
  * the input in which the user can select which operator should be used for this filter
26
36
  */
27
- renderOperatorsInput?: () => ReactElement<TSelectInputProps>;
37
+ renderOperatorsInput?: () => ReactNode;
28
38
  /**
29
39
  * optional button that allows the user to apply selected filter values
30
40
  */
31
- renderApplyButton?: () => ReactElement<TPrimaryButtonProps>;
41
+ renderApplyButton?: () => ReactNode;
32
42
  /**
33
43
  * controls whether `clear` button in Menu Body Footer is displayed
34
44
  */
35
- onClearRequest: Function;
45
+ onClearRequest: (event?: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
36
46
  /**
37
47
  * controls whether `sort` button in Menu Body Header is displayed
38
48
  */
39
- onSortRequest?: Function;
49
+ onSortRequest?: (event?: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
40
50
  };
41
51
  /**
42
52
  * optional key to group filters together.
@@ -47,17 +57,9 @@ type TFilterConfiguration = {
47
57
  */
48
58
  isPersistent?: boolean;
49
59
  /**
50
- * whether or not the filter is disabled
60
+ * indicates whether the filter is disabled
51
61
  */
52
62
  isDisabled?: boolean;
53
- /**
54
- * unique identifier for the filter
55
- */
56
- key: string;
57
- /**
58
- * formatted message to display the filter name
59
- */
60
- label: ReactNode;
61
63
  };
62
64
  type TFilterGroupConfiguration = {
63
65
  /**
@@ -76,26 +78,32 @@ export type TFiltersProps = {
76
78
  appliedFilters: TAppliedFilter[];
77
79
  /**
78
80
  * configuration for the available filters.
81
+ *
79
82
  */
80
83
  filters: TFilterConfiguration[];
81
84
  /**
82
85
  * optional configuration for filter groups.
86
+ *
83
87
  */
84
88
  filterGroups?: TFilterGroupConfiguration[];
85
89
  /**
86
- * controls the `clear all` (added filters) button from the menu list
90
+ * controls the `clear all` (added filters) button from the menu list, meant to clear the parent application's filter state
87
91
  */
88
- onClearAllRequest: () => void;
92
+ onClearAllRequest: (event?: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
89
93
  /**
90
- * optional callback trigger to add a new filter.
94
+ * optional callback when the add filter button is clicked
91
95
  */
92
- onAddFilterRequest?: Function;
96
+ onAddFilterRequest?: (event?: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
93
97
  /**
94
98
  * function to render a search input, selectable from applicable UI Kit components.
95
99
  */
96
- renderSearchComponent: () => ReactNode;
100
+ renderSearchComponent: ReactNode;
101
+ /**
102
+ * controls whether the filters list is initially open
103
+ */
104
+ defaultOpen?: boolean;
97
105
  };
98
- declare function Filters(props: TFiltersProps): import("@emotion/react/jsx-runtime").JSX.Element;
106
+ declare function Filters({ appliedFilters, filters, filterGroups, onClearAllRequest, onAddFilterRequest, renderSearchComponent, defaultOpen, }: TFiltersProps): import("@emotion/react/jsx-runtime").JSX.Element;
99
107
  declare namespace Filters {
100
108
  var displayName: string;
101
109
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/filters",
3
3
  "description": "The `Filters` component displays filter controls.",
4
- "version": "19.15.0",
4
+ "version": "19.16.0",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,16 +21,15 @@
21
21
  "dependencies": {
22
22
  "@babel/runtime": "^7.20.13",
23
23
  "@babel/runtime-corejs3": "^7.20.13",
24
- "@commercetools-uikit/collapsible-motion": "workspace:^",
25
- "@commercetools-uikit/design-system": "workspace:^",
26
- "@commercetools-uikit/dropdown-menu": "workspace:^",
27
- "@commercetools-uikit/flat-button": "workspace:^",
28
- "@commercetools-uikit/icon-button": "workspace:^",
29
- "@commercetools-uikit/icons": "workspace:^",
30
- "@commercetools-uikit/secondary-icon-button": "workspace:^",
31
- "@commercetools-uikit/select-input": "workspace:^",
32
- "@commercetools-uikit/spacings": "workspace:^",
33
- "@commercetools-uikit/utils": "workspace:^",
24
+ "@commercetools-uikit/collapsible-motion": "19.16.0",
25
+ "@commercetools-uikit/design-system": "19.16.0",
26
+ "@commercetools-uikit/flat-button": "19.16.0",
27
+ "@commercetools-uikit/icon-button": "19.16.0",
28
+ "@commercetools-uikit/icons": "19.16.0",
29
+ "@commercetools-uikit/secondary-icon-button": "19.16.0",
30
+ "@commercetools-uikit/select-input": "19.16.0",
31
+ "@commercetools-uikit/spacings": "19.16.0",
32
+ "@commercetools-uikit/utils": "19.16.0",
34
33
  "@emotion/react": "^11.10.5",
35
34
  "@emotion/styled": "^11.10.5",
36
35
  "@radix-ui/react-popover": "^1.1.2",
@@ -38,6 +37,10 @@
38
37
  "react-intl": "^6.3.2"
39
38
  },
40
39
  "devDependencies": {
40
+ "@commercetools-uikit/primary-button": "workspace:^",
41
+ "@commercetools-uikit/radio-input": "workspace:^",
42
+ "@commercetools-uikit/search-text-input": "workspace:^",
43
+ "@commercetools-uikit/text-input": "workspace:^",
41
44
  "react": "17.0.2"
42
45
  },
43
46
  "peerDependencies": {