From 2f2d4b1ff8ef9eeae05f77715082a2718f67eade Mon Sep 17 00:00:00 2001 From: dleadbetter Date: Tue, 26 Nov 2024 20:40:37 -0500 Subject: [PATCH 1/4] BASIRA #254 - Updating visibility logic on FacetSlider component --- packages/semantic-ui/src/components/FacetSlider.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/semantic-ui/src/components/FacetSlider.js b/packages/semantic-ui/src/components/FacetSlider.js index 57fac68e..2c51d981 100644 --- a/packages/semantic-ui/src/components/FacetSlider.js +++ b/packages/semantic-ui/src/components/FacetSlider.js @@ -25,14 +25,14 @@ const FacetSlider = forwardRef(({ useRangeSlider, ...props }: Props, ref: HTMLEl refine, } = useRangeSlider(props); - const [valueView, setValueView] = useState < Array < number >> ([range.min, range.max]); + const [valueView, setValueView] = useState>([range.min, range.max]); /** * Sets the visibility variable based on the range min and max. * * @type {unknown} */ - const visible = useMemo(() => range.min !== 0 && range.max !== 0, [range.min, range.max]); + const visible = useMemo(() => range.min !== range.max, [range.min, range.max]); /** * Resets the value and valueView when the current refinement is cleared. From b5be2d2b9136e9c869278c7bbcfafd5e6d0c1bc6 Mon Sep 17 00:00:00 2001 From: dleadbetter Date: Wed, 27 Nov 2024 06:45:50 -0500 Subject: [PATCH 2/4] BASIRA #254 - Refactoring FacetSlider component --- .../semantic-ui/src/components/FacetSlider.js | 38 ++++++------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/packages/semantic-ui/src/components/FacetSlider.js b/packages/semantic-ui/src/components/FacetSlider.js index 2c51d981..c1f27fc3 100644 --- a/packages/semantic-ui/src/components/FacetSlider.js +++ b/packages/semantic-ui/src/components/FacetSlider.js @@ -4,7 +4,6 @@ import Slider from 'rc-slider'; import React, { forwardRef, useEffect, - useMemo, useState } from 'react'; import { Grid } from 'semantic-ui-react'; @@ -19,29 +18,17 @@ type Props = FacetProps & RangeSliderProps; * This component can be used with the `useRange` hook from Instant Search Hooks. */ const FacetSlider = forwardRef(({ useRangeSlider, ...props }: Props, ref: HTMLElement) => { - const { - start, - range, - refine, - } = useRangeSlider(props); + const { start, range, refine } = useRangeSlider(props); + const { min, max } = range; - const [valueView, setValueView] = useState>([range.min, range.max]); + const [value, setValue] = useState([min, max]); - /** - * Sets the visibility variable based on the range min and max. - * - * @type {unknown} - */ - const visible = useMemo(() => range.min !== range.max, [range.min, range.max]); + const from = Math.max(min, Number.isFinite(start[0]) ? start[0] : min); + const to = Math.min(max, Number.isFinite(start[1]) ? start[1] : max); - /** - * Resets the value and valueView when the current refinement is cleared. - */ useEffect(() => { - if (start[0] <= range.min && start[1] >= range.max) { - setValueView([range.min, range.max]); - } - }, [range, start]); + setValue([from, to]); + }, [from, to]); return (
refine(v)} - onChange={(v) => setValueView(v)} + onChangeComplete={(v) => refine(v)} + onChange={(v) => setValue(v)} range - value={valueView} + value={value} />
- {valueView[0]} + { value[0] } - {valueView[1]} + { value[1] } From 6165fa74aeefc04646e2cc9381232267206f683b Mon Sep 17 00:00:00 2001 From: dleadbetter Date: Wed, 27 Nov 2024 06:59:11 -0500 Subject: [PATCH 3/4] BASIRA #254 - Adding disabled state to FacetSlider --- packages/semantic-ui/src/components/FacetSlider.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/semantic-ui/src/components/FacetSlider.js b/packages/semantic-ui/src/components/FacetSlider.js index c1f27fc3..7064b857 100644 --- a/packages/semantic-ui/src/components/FacetSlider.js +++ b/packages/semantic-ui/src/components/FacetSlider.js @@ -18,7 +18,13 @@ type Props = FacetProps & RangeSliderProps; * This component can be used with the `useRange` hook from Instant Search Hooks. */ const FacetSlider = forwardRef(({ useRangeSlider, ...props }: Props, ref: HTMLElement) => { - const { start, range, refine } = useRangeSlider(props); + const { + start, + range, + canRefine = true, + refine + } = useRangeSlider(props); + const { min, max } = range; const [value, setValue] = useState([min, max]); @@ -36,6 +42,7 @@ const FacetSlider = forwardRef(({ useRangeSlider, ...props }: Props, ref: HTMLEl divided={props.divided} innerRef={ref} title={props.title} + visible={props.visible} >
refine(v)} From e4be564f5e70c4c6e94a76ee1a89e2e5e4da8d97 Mon Sep 17 00:00:00 2001 From: dleadbetter Date: Wed, 27 Nov 2024 11:13:25 -0500 Subject: [PATCH 4/4] BASIRA #254 - Publishing v2.2.17 --- packages/controlled-vocabulary/package.json | 6 +++--- packages/core-data/package.json | 6 +++--- packages/geospatial/package.json | 2 +- packages/semantic-ui/package.json | 4 ++-- packages/shared/package.json | 2 +- packages/user-defined-fields/package.json | 6 +++--- packages/visualize/package.json | 2 +- react-components.json | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/controlled-vocabulary/package.json b/packages/controlled-vocabulary/package.json index dfbe4d2c..d6bb858e 100644 --- a/packages/controlled-vocabulary/package.json +++ b/packages/controlled-vocabulary/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/controlled-vocabulary", - "version": "2.2.16", + "version": "2.2.17", "description": "A package of components to allow user to configure dropdown elements. Use with the \"controlled_vocabulary\" gem.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -23,8 +23,8 @@ "underscore": "^1.13.2" }, "peerDependencies": { - "@performant-software/semantic-components": "^2.2.16", - "@performant-software/shared-components": "^2.2.16", + "@performant-software/semantic-components": "^2.2.17", + "@performant-software/shared-components": "^2.2.17", "react": ">= 16.13.1 < 19.0.0", "react-dom": ">= 16.13.1 < 19.0.0" }, diff --git a/packages/core-data/package.json b/packages/core-data/package.json index 7dc40827..ca39604d 100644 --- a/packages/core-data/package.json +++ b/packages/core-data/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/core-data", - "version": "2.2.16", + "version": "2.2.17", "description": "A package of components used with the Core Data platform.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -40,8 +40,8 @@ "underscore": "^1.13.2" }, "peerDependencies": { - "@performant-software/geospatial": "^2.2.16", - "@performant-software/shared-components": "^2.2.16", + "@performant-software/geospatial": "^2.2.17", + "@performant-software/shared-components": "^2.2.17", "@peripleo/maplibre": "^0.5.2", "@peripleo/peripleo": "^0.5.2", "react": ">= 16.13.1 < 19.0.0", diff --git a/packages/geospatial/package.json b/packages/geospatial/package.json index 38ebd6bb..987236b2 100644 --- a/packages/geospatial/package.json +++ b/packages/geospatial/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/geospatial", - "version": "2.2.16", + "version": "2.2.17", "description": "A package of components for all things map-related.", "license": "MIT", "main": "./dist/index.cjs.js", diff --git a/packages/semantic-ui/package.json b/packages/semantic-ui/package.json index d31ab007..01ce6129 100644 --- a/packages/semantic-ui/package.json +++ b/packages/semantic-ui/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/semantic-components", - "version": "2.2.16", + "version": "2.2.17", "description": "A package of shared components based on the Semantic UI Framework.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -35,7 +35,7 @@ "zotero-translation-client": "^5.0.1" }, "peerDependencies": { - "@performant-software/shared-components": "^2.2.16", + "@performant-software/shared-components": "^2.2.17", "@samvera/clover-iiif": "^2.3.2", "react": ">= 16.13.1 < 19.0.0", "react-dnd": "^11.1.3", diff --git a/packages/shared/package.json b/packages/shared/package.json index e44e7f62..2646dfc7 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/shared-components", - "version": "2.2.16", + "version": "2.2.17", "description": "A package of shared, framework agnostic, components.", "license": "MIT", "main": "./dist/index.cjs.js", diff --git a/packages/user-defined-fields/package.json b/packages/user-defined-fields/package.json index 70ad9c53..af305de4 100644 --- a/packages/user-defined-fields/package.json +++ b/packages/user-defined-fields/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/user-defined-fields", - "version": "2.2.16", + "version": "2.2.17", "description": "A package of components used for allowing end users to define fields on models. Use with the \"user_defined_fields\" gem.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -23,8 +23,8 @@ "underscore": "^1.13.2" }, "peerDependencies": { - "@performant-software/semantic-components": "^2.2.16", - "@performant-software/shared-components": "^2.2.16", + "@performant-software/semantic-components": "^2.2.17", + "@performant-software/shared-components": "^2.2.17", "react": ">= 16.13.1 < 19.0.0", "react-dom": ">= 16.13.1 < 19.0.0" }, diff --git a/packages/visualize/package.json b/packages/visualize/package.json index ab1e7e12..d3183f4d 100644 --- a/packages/visualize/package.json +++ b/packages/visualize/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/visualize", - "version": "2.2.16", + "version": "2.2.17", "description": "A package of components used for data visualization", "license": "MIT", "main": "./dist/index.cjs.js", diff --git a/react-components.json b/react-components.json index 4c2bb7b3..31e95c88 100644 --- a/react-components.json +++ b/react-components.json @@ -8,5 +8,5 @@ "packages/user-defined-fields", "packages/visualize" ], - "version": "2.2.16" + "version": "2.2.17" }