@backstage/plugin-search-react 1.11.4-next.0 → 1.11.4-next.1
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
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @backstage/plugin-search-react
|
|
2
2
|
|
|
3
|
+
## 1.11.4-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e9b78e9: Removed the `uuid` dependency and replaced usage with the built-in `crypto.randomUUID()`.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/frontend-plugin-api@0.17.0-next.1
|
|
10
|
+
- @backstage/core-plugin-api@1.12.6-next.1
|
|
11
|
+
|
|
3
12
|
## 1.11.4-next.0
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useRef } from 'react';
|
|
3
3
|
import { capitalize } from 'lodash';
|
|
4
|
-
import { v4 } from 'uuid';
|
|
5
4
|
import FormControl from '@material-ui/core/FormControl';
|
|
6
5
|
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
|
7
6
|
import Checkbox from '@material-ui/core/Checkbox';
|
|
@@ -115,7 +114,7 @@ const SelectFilter = (props) => {
|
|
|
115
114
|
defaultValues,
|
|
116
115
|
valuesDebounceMs
|
|
117
116
|
);
|
|
118
|
-
const allOptionValue = useRef(
|
|
117
|
+
const allOptionValue = useRef(globalThis.crypto.randomUUID());
|
|
119
118
|
const allOption = {
|
|
120
119
|
value: allOptionValue.current,
|
|
121
120
|
label: t("searchFilter.allOptionTitle")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchFilter.esm.js","sources":["../../../src/components/SearchFilter/SearchFilter.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactElement, ChangeEvent, useRef } from 'react';\nimport { capitalize } from 'lodash';\nimport { v4 as uuid } from 'uuid';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport FormLabel from '@material-ui/core/FormLabel';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Select, SelectedItems } from '@backstage/core-components';\n\nimport { useSearch } from '../../context';\nimport {\n AutocompleteFilter,\n SearchAutocompleteFilterProps,\n} from './SearchFilter.Autocomplete';\nimport { useAsyncFilterValues, useDefaultFilterValue } from './hooks';\nimport { ensureFilterValueWithLabel, FilterValue } from './types';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { searchReactTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles({\n label: {\n textTransform: 'capitalize',\n },\n checkboxWrapper: {\n display: 'flex',\n alignItems: 'center',\n width: '100%',\n },\n textWrapper: {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n },\n});\n\n/**\n * @public\n */\nexport type SearchFilterComponentProps = {\n className?: string;\n name: string;\n label?: string;\n /**\n * Either an array of values directly, or an async function to return a list\n * of values to be used in the filter. In the autocomplete filter, the last\n * input value is provided as an input to allow values to be filtered. This\n * function is debounced and values cached.\n */\n values?: FilterValue[] | ((partial: string) => Promise<FilterValue[]>);\n defaultValue?: string[] | string | null;\n /**\n * Debounce time in milliseconds, used when values is an async callback.\n * Defaults to 250ms.\n */\n valuesDebounceMs?: number;\n};\n\n/**\n * @public\n */\nexport type SearchFilterWrapperProps = SearchFilterComponentProps & {\n component: (props: SearchFilterComponentProps) => ReactElement;\n debug?: boolean;\n};\n\n/**\n * @public\n */\nexport const CheckboxFilter = (props: SearchFilterComponentProps) => {\n const {\n className,\n defaultValue,\n label: formLabel,\n name,\n values: givenValues = [],\n valuesDebounceMs,\n } = props;\n const classes = useStyles();\n const { filters, setFilters } = useSearch();\n useDefaultFilterValue(name, defaultValue);\n const asyncValues =\n typeof givenValues === 'function' ? givenValues : undefined;\n const defaultValues =\n typeof givenValues === 'function'\n ? undefined\n : givenValues.map(v => ensureFilterValueWithLabel(v));\n const { value: values = [], loading } = useAsyncFilterValues(\n asyncValues,\n '',\n defaultValues,\n valuesDebounceMs,\n );\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n const {\n target: { value, checked },\n } = e;\n\n setFilters(prevFilters => {\n const { [name]: filter, ...others } = prevFilters;\n const rest = ((filter as string[]) || []).filter(i => i !== value);\n const items = checked ? [...rest, value] : rest;\n return items.length ? { ...others, [name]: items } : others;\n });\n };\n\n return (\n <FormControl\n className={className}\n disabled={loading}\n fullWidth\n data-testid=\"search-checkboxfilter-next\"\n >\n {!!formLabel && (\n <FormLabel className={classes.label}>{formLabel}</FormLabel>\n )}\n {values.map(({ value, label }) => (\n <FormControlLabel\n key={value}\n classes={{\n root: classes.checkboxWrapper,\n label: classes.textWrapper,\n }}\n label={label}\n control={\n <Checkbox\n color=\"primary\"\n inputProps={{ 'aria-labelledby': label }}\n value={value}\n name={label}\n onChange={handleChange}\n checked={((filters[name] as string[]) ?? []).includes(value)}\n />\n }\n />\n ))}\n </FormControl>\n );\n};\n\n/**\n * @public\n */\nexport const SelectFilter = (props: SearchFilterComponentProps) => {\n const {\n className,\n defaultValue,\n label,\n name,\n values: givenValues,\n valuesDebounceMs,\n } = props;\n const { t } = useTranslationRef(searchReactTranslationRef);\n useDefaultFilterValue(name, defaultValue);\n const asyncValues =\n typeof givenValues === 'function' ? givenValues : undefined;\n const defaultValues =\n typeof givenValues === 'function'\n ? undefined\n : givenValues?.map(v => ensureFilterValueWithLabel(v));\n const { value: values = [], loading } = useAsyncFilterValues(\n asyncValues,\n '',\n defaultValues,\n valuesDebounceMs,\n );\n const allOptionValue = useRef(uuid());\n const allOption = {\n value: allOptionValue.current,\n label: t('searchFilter.allOptionTitle'),\n };\n const { filters, setFilters } = useSearch();\n\n const handleChange = (value: SelectedItems) => {\n setFilters(prevFilters => {\n const { [name]: filter, ...others } = prevFilters;\n return value !== allOptionValue.current\n ? { ...others, [name]: value as string }\n : others;\n });\n };\n\n const items = [allOption, ...values];\n\n return (\n <FormControl\n disabled={loading}\n className={className}\n variant=\"filled\"\n fullWidth\n data-testid=\"search-selectfilter-next\"\n >\n <Select\n label={label ?? capitalize(name)}\n selected={(filters[name] || allOptionValue.current) as string}\n onChange={handleChange}\n items={items}\n />\n </FormControl>\n );\n};\n\n/**\n * @public\n */\nconst SearchFilter = (props: SearchFilterWrapperProps) => {\n const { component: Element, ...elementProps } = props;\n return <Element {...elementProps} />;\n};\n\nSearchFilter.Checkbox = (\n props: Omit<SearchFilterWrapperProps, 'component'> &\n SearchFilterComponentProps,\n) => <SearchFilter {...props} component={CheckboxFilter} />;\n\nSearchFilter.Select = (\n props: Omit<SearchFilterWrapperProps, 'component'> &\n SearchFilterComponentProps,\n) => <SearchFilter {...props} component={SelectFilter} />;\n\n/**\n * A control surface for a given filter field name, rendered as an autocomplete\n * textfield. A hard-coded list of values may be provided, or an async function\n * which returns values may be provided instead.\n *\n * @public\n */\nSearchFilter.Autocomplete = (props: SearchAutocompleteFilterProps) => (\n <SearchFilter {...props} component={AutocompleteFilter} />\n);\n\nexport { SearchFilter };\n"],"names":["uuid"],"mappings":";;;;;;;;;;;;;;;;;AAoCA,MAAM,YAAY,UAAA,CAAW;AAAA,EAC3B,KAAA,EAAO;AAAA,IACL,aAAA,EAAe;AAAA,GACjB;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,OAAA,EAAS,MAAA;AAAA,IACT,UAAA,EAAY,QAAA;AAAA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M,CAAA;AAEnC,EAAA,uBACE,GAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,QAAA,EAAU,OAAA;AAAA,MACV,SAAA;AAAA,MACA,OAAA,EAAQ,QAAA;AAAA,MACR,SAAA,EAAS,IAAA;AAAA,MACT,aAAA,EAAY,0BAAA;AAAA,MAEZ,QAAA,kBAAA,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO,KAAA,IAAS,UAAA,CAAW,IAAI,CAAA;AAAA,UAC/B,QAAA,EAAW,OAAA,CAAQ,IAAI,CAAA,IAAK,cAAA,CAAe,OAAA;AAAA,UAC3C,QAAA,EAAU,YAAA;AAAA,UACV;AAAA;AAAA;AACF;AAAA,GACF;AAEJ;AAKA,MAAM,YAAA,GAAe,CAAC,KAAA,KAAoC;AACxD,EAAA,MAAM,EAAE,SAAA,EAAW,OAAA,EAAS,GAAG,cAAa,GAAI,KAAA;AAChD,EAAA,uBAAO,GAAA,CAAC,OAAA,EAAA,EAAS,GAAG,YAAA,EAAc,CAAA;AACpC;AAEA,YAAA,CAAa,QAAA,GAAW,CACtB,KAAA,qBAEG,GAAA,CAAC,gBAAc,GAAG,KAAA,EAAO,WAAW,cAAA,EAAgB,CAAA;AAEzD,YAAA,CAAa,MAAA,GAAS,CACpB,KAAA,qBAEG,GAAA,CAAC,gBAAc,GAAG,KAAA,EAAO,WAAW,YAAA,EAAc,CAAA;AASvD,YAAA,CAAa,YAAA,GAAe,CAAC,KAAA,qBAC3B,GAAA,CAAC,gBAAc,GAAG,KAAA,EAAO,WAAW,kBAAA,EAAoB,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"SearchFilter.esm.js","sources":["../../../src/components/SearchFilter/SearchFilter.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactElement, ChangeEvent, useRef } from 'react';\nimport { capitalize } from 'lodash';\n\nimport FormControl from '@material-ui/core/FormControl';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport FormLabel from '@material-ui/core/FormLabel';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Select, SelectedItems } from '@backstage/core-components';\n\nimport { useSearch } from '../../context';\nimport {\n AutocompleteFilter,\n SearchAutocompleteFilterProps,\n} from './SearchFilter.Autocomplete';\nimport { useAsyncFilterValues, useDefaultFilterValue } from './hooks';\nimport { ensureFilterValueWithLabel, FilterValue } from './types';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { searchReactTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles({\n label: {\n textTransform: 'capitalize',\n },\n checkboxWrapper: {\n display: 'flex',\n alignItems: 'center',\n width: '100%',\n },\n textWrapper: {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n },\n});\n\n/**\n * @public\n */\nexport type SearchFilterComponentProps = {\n className?: string;\n name: string;\n label?: string;\n /**\n * Either an array of values directly, or an async function to return a list\n * of values to be used in the filter. In the autocomplete filter, the last\n * input value is provided as an input to allow values to be filtered. This\n * function is debounced and values cached.\n */\n values?: FilterValue[] | ((partial: string) => Promise<FilterValue[]>);\n defaultValue?: string[] | string | null;\n /**\n * Debounce time in milliseconds, used when values is an async callback.\n * Defaults to 250ms.\n */\n valuesDebounceMs?: number;\n};\n\n/**\n * @public\n */\nexport type SearchFilterWrapperProps = SearchFilterComponentProps & {\n component: (props: SearchFilterComponentProps) => ReactElement;\n debug?: boolean;\n};\n\n/**\n * @public\n */\nexport const CheckboxFilter = (props: SearchFilterComponentProps) => {\n const {\n className,\n defaultValue,\n label: formLabel,\n name,\n values: givenValues = [],\n valuesDebounceMs,\n } = props;\n const classes = useStyles();\n const { filters, setFilters } = useSearch();\n useDefaultFilterValue(name, defaultValue);\n const asyncValues =\n typeof givenValues === 'function' ? givenValues : undefined;\n const defaultValues =\n typeof givenValues === 'function'\n ? undefined\n : givenValues.map(v => ensureFilterValueWithLabel(v));\n const { value: values = [], loading } = useAsyncFilterValues(\n asyncValues,\n '',\n defaultValues,\n valuesDebounceMs,\n );\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n const {\n target: { value, checked },\n } = e;\n\n setFilters(prevFilters => {\n const { [name]: filter, ...others } = prevFilters;\n const rest = ((filter as string[]) || []).filter(i => i !== value);\n const items = checked ? [...rest, value] : rest;\n return items.length ? { ...others, [name]: items } : others;\n });\n };\n\n return (\n <FormControl\n className={className}\n disabled={loading}\n fullWidth\n data-testid=\"search-checkboxfilter-next\"\n >\n {!!formLabel && (\n <FormLabel className={classes.label}>{formLabel}</FormLabel>\n )}\n {values.map(({ value, label }) => (\n <FormControlLabel\n key={value}\n classes={{\n root: classes.checkboxWrapper,\n label: classes.textWrapper,\n }}\n label={label}\n control={\n <Checkbox\n color=\"primary\"\n inputProps={{ 'aria-labelledby': label }}\n value={value}\n name={label}\n onChange={handleChange}\n checked={((filters[name] as string[]) ?? []).includes(value)}\n />\n }\n />\n ))}\n </FormControl>\n );\n};\n\n/**\n * @public\n */\nexport const SelectFilter = (props: SearchFilterComponentProps) => {\n const {\n className,\n defaultValue,\n label,\n name,\n values: givenValues,\n valuesDebounceMs,\n } = props;\n const { t } = useTranslationRef(searchReactTranslationRef);\n useDefaultFilterValue(name, defaultValue);\n const asyncValues =\n typeof givenValues === 'function' ? givenValues : undefined;\n const defaultValues =\n typeof givenValues === 'function'\n ? undefined\n : givenValues?.map(v => ensureFilterValueWithLabel(v));\n const { value: values = [], loading } = useAsyncFilterValues(\n asyncValues,\n '',\n defaultValues,\n valuesDebounceMs,\n );\n const allOptionValue = useRef(globalThis.crypto.randomUUID());\n const allOption = {\n value: allOptionValue.current,\n label: t('searchFilter.allOptionTitle'),\n };\n const { filters, setFilters } = useSearch();\n\n const handleChange = (value: SelectedItems) => {\n setFilters(prevFilters => {\n const { [name]: filter, ...others } = prevFilters;\n return value !== allOptionValue.current\n ? { ...others, [name]: value as string }\n : others;\n });\n };\n\n const items = [allOption, ...values];\n\n return (\n <FormControl\n disabled={loading}\n className={className}\n variant=\"filled\"\n fullWidth\n data-testid=\"search-selectfilter-next\"\n >\n <Select\n label={label ?? capitalize(name)}\n selected={(filters[name] || allOptionValue.current) as string}\n onChange={handleChange}\n items={items}\n />\n </FormControl>\n );\n};\n\n/**\n * @public\n */\nconst SearchFilter = (props: SearchFilterWrapperProps) => {\n const { component: Element, ...elementProps } = props;\n return <Element {...elementProps} />;\n};\n\nSearchFilter.Checkbox = (\n props: Omit<SearchFilterWrapperProps, 'component'> &\n SearchFilterComponentProps,\n) => <SearchFilter {...props} component={CheckboxFilter} />;\n\nSearchFilter.Select = (\n props: Omit<SearchFilterWrapperProps, 'component'> &\n SearchFilterComponentProps,\n) => <SearchFilter {...props} component={SelectFilter} />;\n\n/**\n * A control surface for a given filter field name, rendered as an autocomplete\n * textfield. A hard-coded list of values may be provided, or an async function\n * which returns values may be provided instead.\n *\n * @public\n */\nSearchFilter.Autocomplete = (props: SearchAutocompleteFilterProps) => (\n <SearchFilter {...props} component={AutocompleteFilter} />\n);\n\nexport { SearchFilter };\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAoCA,MAAM,YAAY,UAAA,CAAW;AAAA,EAC3B,KAAA,EAAO;AAAA,IACL,aAAA,EAAe;AAAA,GACjB;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,OAAA,EAAS,MAAA;AAAA,IACT,UAAA,EAAY,QAAA;AAAA,IACZ,KAAA,EAAO;AAAA,GACT;AAAA,EACA,WAAA,EAAa;AAAA,IACX,QAAA,EAAU,QAAA;AAAA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,MACC,QAAA,EAAU,OAAA;AAAA,MACV,SAAA;AAAA,MACA,OAAA,EAAQ,QAAA;AAAA,MACR,SAAA,EAAS,IAAA;AAAA,MACT,aAAA,EAAY,0BAAA;AAAA,MAEZ,QAAA,kBAAA,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO,KAAA,IAAS,UAAA,CAAW,IAAI,CAAA;AAAA,UAC/B,QAAA,EAAW,OAAA,CAAQ,IAAI,CAAA,IAAK,cAAA,CAAe,OAAA;AAAA,UAC3C,QAAA,EAAU,YAAA;AAAA,UACV;AAAA;AAAA;AACF;AAAA,GACF;AAEJ;AAKA,MAAM,YAAA,GAAe,CAAC,KAAA,KAAoC;AACxD,EAAA,MAAM,EAAE,SAAA,EAAW,OAAA,EAAS,GAAG,cAAa,GAAI,KAAA;AAChD,EAAA,uBAAO,GAAA,CAAC,OAAA,EAAA,EAAS,GAAG,YAAA,EAAc,CAAA;AACpC;AAEA,YAAA,CAAa,QAAA,GAAW,CACtB,KAAA,qBAEG,GAAA,CAAC,gBAAc,GAAG,KAAA,EAAO,WAAW,cAAA,EAAgB,CAAA;AAEzD,YAAA,CAAa,MAAA,GAAS,CACpB,KAAA,qBAEG,GAAA,CAAC,gBAAc,GAAG,KAAA,EAAO,WAAW,YAAA,EAAc,CAAA;AASvD,YAAA,CAAa,YAAA,GAAe,CAAC,KAAA,qBAC3B,GAAA,CAAC,gBAAc,GAAG,KAAA,EAAO,WAAW,kBAAA,EAAoB,CAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-search-react",
|
|
3
|
-
"version": "1.11.4-next.
|
|
3
|
+
"version": "1.11.4-next.1",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "web-library",
|
|
6
6
|
"pluginId": "search",
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@backstage/core-components": "0.18.10-next.0",
|
|
68
|
-
"@backstage/core-plugin-api": "1.12.6-next.
|
|
69
|
-
"@backstage/frontend-plugin-api": "0.17.0-next.
|
|
68
|
+
"@backstage/core-plugin-api": "1.12.6-next.1",
|
|
69
|
+
"@backstage/frontend-plugin-api": "0.17.0-next.1",
|
|
70
70
|
"@backstage/plugin-search-common": "1.2.24-next.0",
|
|
71
71
|
"@backstage/theme": "0.7.3",
|
|
72
72
|
"@backstage/types": "1.2.2",
|
|
@@ -77,14 +77,13 @@
|
|
|
77
77
|
"lodash": "^4.17.21",
|
|
78
78
|
"qs": "^6.9.4",
|
|
79
79
|
"react-use": "^17.3.2",
|
|
80
|
-
"uuid": "^11.0.2",
|
|
81
80
|
"zod": "^4.0.0"
|
|
82
81
|
},
|
|
83
82
|
"devDependencies": {
|
|
84
|
-
"@backstage/cli": "0.36.2-next.
|
|
83
|
+
"@backstage/cli": "0.36.2-next.1",
|
|
85
84
|
"@backstage/core-app-api": "1.20.1-next.0",
|
|
86
|
-
"@backstage/frontend-app-api": "0.16.3-next.
|
|
87
|
-
"@backstage/frontend-test-utils": "0.5.3-next.
|
|
85
|
+
"@backstage/frontend-app-api": "0.16.3-next.1",
|
|
86
|
+
"@backstage/frontend-test-utils": "0.5.3-next.1",
|
|
88
87
|
"@backstage/test-utils": "1.7.18-next.0",
|
|
89
88
|
"@testing-library/dom": "^10.0.0",
|
|
90
89
|
"@testing-library/jest-dom": "^6.0.0",
|