@usereactify/search 5.56.3 → 5.56.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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [5.56.4](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.56.3...release-v5.56.4) (2025-01-06)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * clamp values of slider filters to whole numbers ([ddf745d](https://bitbucket.org/usereactify/reactify-search-ui/commit/ddf745d67a359a54dd91d012bbc166b87dae2bbe))
11
+
5
12
  ### [5.56.3](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.56.2...release-v5.56.3) (2025-01-01)
6
13
 
7
14
 
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@usereactify/search",
3
3
  "description": "React UI library for Reactify Search",
4
- "version": "5.56.3",
4
+ "version": "5.56.4",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",
@@ -14,19 +14,21 @@ const useFilterSliderProps = (filter) => {
14
14
  const urlSearchParam = new URLSearchParams(typeof window === "undefined" ? context.options.query : window.location.search);
15
15
  const [filterValue, setFilterValue] = react_1.default.useState(JSON.parse((_a = urlSearchParam.get(filter.handle)) !== null && _a !== void 0 ? _a : "[]"));
16
16
  const handleChange = react_1.default.useCallback((value) => {
17
- utility_1.debug.log("useFilterSliderProps", "handleChange[value]", value);
18
- setFilterValue([parseInt(`${value[0]}`), parseInt(`${value[1]}`)]);
17
+ const valueFormatted = [parseInt(parseInt(`${value[0]}`).toFixed(0)), parseInt(parseInt(`${value[1]}`).toFixed(0))];
18
+ utility_1.debug.log("useFilterSliderProps", "handleChange[value]", valueFormatted);
19
+ setFilterValue(valueFormatted);
19
20
  track({
20
21
  eventName: "filterChange",
21
22
  payload: {
22
23
  name: filter.name,
23
- value: `${value[0]}:${value[1]}`,
24
+ value: `${valueFormatted[0]}:${valueFormatted[1]}`,
24
25
  },
25
26
  });
26
27
  }, [filter]);
27
28
  react_1.default.useEffect(() => {
28
29
  const handler = (event) => {
29
- setFilterValue(event.detail.value);
30
+ const valueFormatted = [parseInt(event.detail.value[0].toFixed(0)), parseInt(event.detail.value[0].toFixed(0))];
31
+ setFilterValue(valueFormatted);
30
32
  };
31
33
  window.addEventListener(`@usereactify/search:${context.options.mode}:filter:${filter.handle}:update`, handler);
32
34
  return () => window.removeEventListener(`@usereactify/search:${context.options.mode}:filter:${filter.handle}:update`, handler);
@@ -1 +1 @@
1
- {"version":3,"file":"useFilterSliderProps.js","sourceRoot":"","sources":["../../../src/hooks/useFilterSliderProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,oCAAkE;AAClE,wCAAmC;AAE5B,MAAM,oBAAoB,GAAG,CAClC,MAAyB,EAKzB,EAAE;;IACF,MAAM,OAAO,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAC3C,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IAEjC,MAAM,cAAc,GAAG,IAAI,eAAe,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3H,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,eAAK,CAAC,QAAQ,CAClD,IAAI,CAAC,KAAK,CAAC,MAAA,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,mCAAI,IAAI,CAAC,CACtD,CAAC;IAEF,MAAM,YAAY,GAAG,eAAK,CAAC,WAAW,CACpC,CAAC,KAAyC,EAAE,EAAE;QAC5C,eAAK,CAAC,GAAG,CAAC,sBAAsB,EAAE,qBAAqB,EAA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esContent":["import React from \"react\";\nimport { ConfigFilterFacet } from \"../types/config\";\nimport { useAnalytics, useReactifySearchContext } from \"../hooks\";\nimport { debug } from \"../utility\";\n\nexport const useFilterSliderProps = (\n filter: ConfigFilterFacet\n): {\n filter: ConfigFilterFacet;\n value: [number, number];\n handleChange: (value: [number | string, number | string]) => void;\n} => {\n const context = useReactifySearchContext();\n const { track } = useAnalytics();\n\n const urlSearchParam = new URLSearchParams(typeof window === \"undefined\" ? context.options.query : window.location.search);\n const [filterValue, setFilterValue] = React.useState<[number, number]>(\n JSON.parse(urlSearchParam.get(filter.handle) ?? \"[]\")\n );\n\n const handleChange = React.useCallback(\n (value: [number | string, number | string]) => {\n debug.log(\"useFilterSliderProps\", \"handleChange[value]\", value);\n\n setFilterValue([parseInt(`${value[0]}`), parseInt(`${value[1]}`)]);\n\n track({\n eventName: \"filterChange\",\n payload: {\n name: filter.name,\n value: `${value[0]}:${value[1]}`,\n },\n });\n },\n [filter]\n );\n\n React.useEffect(() => {\n const handler = (\n event: CustomEvent<{ handle: string; value: [number, number] }>\n ) => {\n setFilterValue(event.detail.value);\n };\n window.addEventListener(\n `@usereactify/search:${context.options.mode}:filter:${filter.handle}:update`,\n handler as EventListener\n );\n\n return () =>\n window.removeEventListener(\n `@usereactify/search:${context.options.mode}:filter:${filter.handle}:update`,\n handler as EventListener\n );\n }, [context.options.mode]);\n\n const filterSliderProps = React.useMemo(() => {\n return {\n handleChange,\n filter,\n value: filterValue,\n };\n }, [\n handleChange,\n filter,\n filterValue,\n ]);\n\n return filterSliderProps;\n};\n"]}
1
+ {"version":3,"file":"useFilterSliderProps.js","sourceRoot":"","sources":["../../../src/hooks/useFilterSliderProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,oCAAkE;AAClE,wCAAmC;AAE5B,MAAM,oBAAoB,GAAG,CAClC,MAAyB,EAKzB,EAAE;;IACF,MAAM,OAAO,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAC3C,MAAM,EAA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,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAClI,cAAc,CAAC,cAAc,CAAC,CAAC;QACjC,CAAC,CAAC;QACF,MAAM,CAAC,gBAAgB,CACrB,uBAAuB,OAAO,CAAC,OAAO,CAAC,IAAI,WAAW,MAAM,CAAC,MAAM,SAAS,EAC5E,OAAwB,CACzB,CAAC;QAEF,OAAO,GAAG,EAAE,CACV,MAAM,CAAC,mBAAmB,CACxB,uBAAuB,OAAO,CAAC,OAAO,CAAC,IAAI,WAAW,MAAM,CAAC,MAAM,SAAS,EAC5E,OAAwB,CACzB,CAAC;IACN,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAE3B,MAAM,iBAAiB,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QAC3C,OAAO;YACL,YAAY;YACZ,MAAM;YACN,KAAK,EAAE,WAAW;SACnB,CAAC;IACJ,CAAC,EAAE;QACD,YAAY;QACZ,MAAM;QACN,WAAW;KACZ,CAAC,CAAC;IAEH,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAlEW,QAAA,oBAAoB,wBAkE/B","sourcesContent":["import React from \"react\";\nimport { ConfigFilterFacet } from \"../types/config\";\nimport { useAnalytics, useReactifySearchContext } from \"../hooks\";\nimport { debug } from \"../utility\";\n\nexport const useFilterSliderProps = (\n filter: ConfigFilterFacet\n): {\n filter: ConfigFilterFacet;\n value: [number, number];\n handleChange: (value: [number | string, number | string]) => void;\n} => {\n const context = useReactifySearchContext();\n const { track } = useAnalytics();\n\n const urlSearchParam = new URLSearchParams(typeof window === \"undefined\" ? context.options.query : window.location.search);\n const [filterValue, setFilterValue] = React.useState<[number, number]>(\n JSON.parse(urlSearchParam.get(filter.handle) ?? \"[]\")\n );\n\n const handleChange = React.useCallback(\n (value: [number | string, number | string]) => {\n const valueFormatted: [number, number] = [parseInt(parseInt(`${value[0]}`).toFixed(0)), parseInt(parseInt(`${value[1]}`).toFixed(0))];\n \n debug.log(\"useFilterSliderProps\", \"handleChange[value]\", valueFormatted);\n\n setFilterValue(valueFormatted);\n\n track({\n eventName: \"filterChange\",\n payload: {\n name: filter.name,\n value: `${valueFormatted[0]}:${valueFormatted[1]}`,\n },\n });\n },\n [filter]\n );\n\n React.useEffect(() => {\n const handler = (\n event: CustomEvent<{ handle: string; value: [number, number] }>\n ) => {\n const valueFormatted: [number, number] = [parseInt(event.detail.value[0].toFixed(0)), parseInt(event.detail.value[0].toFixed(0))];\n setFilterValue(valueFormatted);\n };\n window.addEventListener(\n `@usereactify/search:${context.options.mode}:filter:${filter.handle}:update`,\n handler as EventListener\n );\n\n return () =>\n window.removeEventListener(\n `@usereactify/search:${context.options.mode}:filter:${filter.handle}:update`,\n handler as EventListener\n );\n }, [context.options.mode]);\n\n const filterSliderProps = React.useMemo(() => {\n return {\n handleChange,\n filter,\n value: filterValue,\n };\n }, [\n handleChange,\n filter,\n filterValue,\n ]);\n\n return filterSliderProps;\n};\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@usereactify/search",
3
3
  "description": "React UI library for Reactify Search",
4
- "version": "5.56.3",
4
+ "version": "5.56.4",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",