@performant-software/semantic-components 1.0.18-beta.0 → 1.0.18-beta.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@performant-software/semantic-components",
3
- "version": "1.0.18-beta.0",
3
+ "version": "1.0.18-beta.2",
4
4
  "description": "A package of shared components based on the Semantic UI Framework.",
5
5
  "license": "MIT",
6
6
  "main": "./build/index.js",
@@ -12,7 +12,7 @@
12
12
  "build": "webpack --mode production && flow-copy-source -v src types"
13
13
  },
14
14
  "dependencies": {
15
- "@performant-software/shared-components": "^1.0.18-beta.0",
15
+ "@performant-software/shared-components": "^1.0.18-beta.2",
16
16
  "@react-google-maps/api": "^2.8.1",
17
17
  "axios": "^0.26.1",
18
18
  "i18next": "^19.4.4",
@@ -90,6 +90,15 @@ const FacetList = ({ useRefinementList, ...props }: Props) => {
90
90
  */
91
91
  const onSearch = useCallback(() => searchForItems(query), [query, searchForItems]);
92
92
 
93
+ /**
94
+ * Toggles the "and" / "or" list operator.
95
+ *
96
+ * @type {function(): void}
97
+ */
98
+ const onToggleOperator = useCallback(() => (
99
+ setOperator((prevOperator) => (prevOperator === OPERATOR_OR ? OPERATOR_AND : OPERATOR_OR))
100
+ ), []);
101
+
93
102
  /**
94
103
  * Sets the default value if provided.
95
104
  */
@@ -184,7 +193,7 @@ const FacetList = ({ useRefinementList, ...props }: Props) => {
184
193
  label={operator === OPERATOR_OR
185
194
  ? i18n.t('FacetList.labels.matchAny')
186
195
  : i18n.t('FacetList.labels.matchAll')}
187
- onClick={() => setOperator((prevOperator) => (prevOperator === OPERATOR_OR ? OPERATOR_AND : OPERATOR_OR))}
196
+ onChange={onToggleOperator}
188
197
  toggle
189
198
  />
190
199
  )}
@@ -90,6 +90,15 @@ const FacetList = ({ useRefinementList, ...props }: Props) => {
90
90
  */
91
91
  const onSearch = useCallback(() => searchForItems(query), [query, searchForItems]);
92
92
 
93
+ /**
94
+ * Toggles the "and" / "or" list operator.
95
+ *
96
+ * @type {function(): void}
97
+ */
98
+ const onToggleOperator = useCallback(() => (
99
+ setOperator((prevOperator) => (prevOperator === OPERATOR_OR ? OPERATOR_AND : OPERATOR_OR))
100
+ ), []);
101
+
93
102
  /**
94
103
  * Sets the default value if provided.
95
104
  */
@@ -184,7 +193,7 @@ const FacetList = ({ useRefinementList, ...props }: Props) => {
184
193
  label={operator === OPERATOR_OR
185
194
  ? i18n.t('FacetList.labels.matchAny')
186
195
  : i18n.t('FacetList.labels.matchAll')}
187
- onClick={() => setOperator((prevOperator) => (prevOperator === OPERATOR_OR ? OPERATOR_AND : OPERATOR_OR))}
196
+ onChange={onToggleOperator}
188
197
  toggle
189
198
  />
190
199
  )}