@backstage/plugin-search-react 1.8.7 → 1.8.8-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.
Files changed (33) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/alpha/blueprints/SearchResultListItemBlueprint.esm.js +7 -6
  3. package/dist/alpha/blueprints/SearchResultListItemBlueprint.esm.js.map +1 -1
  4. package/dist/components/DefaultResultListItem/DefaultResultListItem.esm.js +42 -38
  5. package/dist/components/DefaultResultListItem/DefaultResultListItem.esm.js.map +1 -1
  6. package/dist/components/HighlightedSearchResultText/HighlightedSearchResultText.esm.js +5 -4
  7. package/dist/components/HighlightedSearchResultText/HighlightedSearchResultText.esm.js.map +1 -1
  8. package/dist/components/SearchAutocomplete/SearchAutocomplete.esm.js +7 -6
  9. package/dist/components/SearchAutocomplete/SearchAutocomplete.esm.js.map +1 -1
  10. package/dist/components/SearchAutocomplete/SearchAutocompleteDefaultOption.esm.js +14 -11
  11. package/dist/components/SearchAutocomplete/SearchAutocompleteDefaultOption.esm.js.map +1 -1
  12. package/dist/components/SearchBar/SearchBar.esm.js +23 -22
  13. package/dist/components/SearchBar/SearchBar.esm.js.map +1 -1
  14. package/dist/components/SearchFilter/SearchFilter.Autocomplete.esm.js +5 -4
  15. package/dist/components/SearchFilter/SearchFilter.Autocomplete.esm.js.map +1 -1
  16. package/dist/components/SearchFilter/SearchFilter.esm.js +45 -42
  17. package/dist/components/SearchFilter/SearchFilter.esm.js.map +1 -1
  18. package/dist/components/SearchPagination/SearchPagination.esm.js +4 -3
  19. package/dist/components/SearchPagination/SearchPagination.esm.js.map +1 -1
  20. package/dist/components/SearchResult/SearchResult.esm.js +12 -12
  21. package/dist/components/SearchResult/SearchResult.esm.js.map +1 -1
  22. package/dist/components/SearchResultGroup/SearchResultGroup.esm.js +99 -79
  23. package/dist/components/SearchResultGroup/SearchResultGroup.esm.js.map +1 -1
  24. package/dist/components/SearchResultList/SearchResultList.esm.js +22 -22
  25. package/dist/components/SearchResultList/SearchResultList.esm.js.map +1 -1
  26. package/dist/components/SearchResultPager/SearchResultPager.esm.js +24 -21
  27. package/dist/components/SearchResultPager/SearchResultPager.esm.js.map +1 -1
  28. package/dist/context/SearchContext.esm.js +7 -6
  29. package/dist/context/SearchContext.esm.js.map +1 -1
  30. package/dist/extensions.esm.js +23 -22
  31. package/dist/extensions.esm.js.map +1 -1
  32. package/dist/index.d.ts +39 -37
  33. package/package.json +16 -16
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @backstage/plugin-search-react
2
2
 
3
+ ## 1.8.8-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
8
+
9
+ <https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
10
+
11
+ - Updated dependencies
12
+ - @backstage/frontend-plugin-api@0.10.1-next.1
13
+ - @backstage/core-components@0.17.1-next.1
14
+ - @backstage/core-plugin-api@1.10.6-next.0
15
+ - @backstage/theme@0.6.5-next.0
16
+ - @backstage/types@1.2.1
17
+ - @backstage/version-bridge@1.0.11
18
+ - @backstage/plugin-search-common@1.2.17
19
+
20
+ ## 1.8.8-next.0
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies
25
+ - @backstage/core-components@0.17.1-next.0
26
+ - @backstage/frontend-plugin-api@0.10.1-next.0
27
+ - @backstage/core-plugin-api@1.10.5
28
+ - @backstage/theme@0.6.4
29
+ - @backstage/types@1.2.1
30
+ - @backstage/version-bridge@1.0.11
31
+ - @backstage/plugin-search-common@1.2.17
32
+
3
33
  ## 1.8.7
4
34
 
5
35
  ### Patch Changes
@@ -1,4 +1,5 @@
1
- import React, { lazy } from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { lazy } from 'react';
2
3
  import { createExtensionBlueprint, ExtensionBoundary } from '@backstage/frontend-plugin-api';
3
4
  import { searchResultListItemDataRef } from './types.esm.js';
4
5
  import { SearchResultListItemExtension } from '../../extensions.esm.js';
@@ -24,15 +25,15 @@ const SearchResultListItemBlueprint = createExtensionBlueprint({
24
25
  );
25
26
  yield searchResultListItemDataRef({
26
27
  predicate: params.predicate,
27
- component: (props) => /* @__PURE__ */ React.createElement(ExtensionBoundary, { node }, /* @__PURE__ */ React.createElement(
28
+ component: (props) => /* @__PURE__ */ jsx(ExtensionBoundary, { node, children: /* @__PURE__ */ jsx(
28
29
  SearchResultListItemExtension,
29
30
  {
30
31
  rank: props.rank,
31
32
  result: props.result,
32
- noTrack: config.noTrack
33
- },
34
- /* @__PURE__ */ React.createElement(ExtensionComponent, { ...props })
35
- ))
33
+ noTrack: config.noTrack,
34
+ children: /* @__PURE__ */ jsx(ExtensionComponent, { ...props })
35
+ }
36
+ ) })
36
37
  });
37
38
  }
38
39
  });
@@ -1 +1 @@
1
- {"version":3,"file":"SearchResultListItemBlueprint.esm.js","sources":["../../../src/alpha/blueprints/SearchResultListItemBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 React, { lazy } from 'react';\nimport {\n createExtensionBlueprint,\n ExtensionBoundary,\n} from '@backstage/frontend-plugin-api';\nimport {\n SearchResultItemExtensionComponent,\n SearchResultItemExtensionPredicate,\n searchResultListItemDataRef,\n} from './types';\nimport {\n SearchResultListItemExtension,\n SearchResultListItemExtensionProps,\n} from '../../extensions';\n\n/** @alpha */\nexport interface SearchResultListItemBlueprintParams {\n /**\n * The extension component.\n */\n component: (options: {\n config: { noTrack?: boolean };\n }) => Promise<SearchResultItemExtensionComponent>;\n /**\n * When an extension defines a predicate, it returns true if the result should be rendered by that extension.\n * Defaults to a predicate that returns true, which means it renders all sorts of results.\n */\n predicate?: SearchResultItemExtensionPredicate;\n}\n\n/**\n * @alpha\n * Creates SearchResultListItem extensions\n */\nexport const SearchResultListItemBlueprint = createExtensionBlueprint({\n kind: 'search-result-list-item',\n attachTo: {\n id: 'page:search',\n input: 'items',\n },\n config: {\n schema: {\n noTrack: z => z.boolean().default(false),\n },\n },\n output: [searchResultListItemDataRef],\n dataRefs: {\n item: searchResultListItemDataRef,\n },\n *factory(params: SearchResultListItemBlueprintParams, { config, node }) {\n const ExtensionComponent = lazy(() =>\n params.component({ config }).then(component => ({ default: component })),\n );\n\n yield searchResultListItemDataRef({\n predicate: params.predicate,\n component: (props: SearchResultListItemExtensionProps) => (\n <ExtensionBoundary node={node}>\n <SearchResultListItemExtension\n rank={props.rank}\n result={props.result}\n noTrack={config.noTrack}\n >\n <ExtensionComponent {...props} />\n </SearchResultListItemExtension>\n </ExtensionBoundary>\n ),\n });\n },\n});\n"],"names":[],"mappings":";;;;;AAkDO,MAAM,gCAAgC,wBAAyB,CAAA;AAAA,EACpE,IAAM,EAAA,yBAAA;AAAA,EACN,QAAU,EAAA;AAAA,IACR,EAAI,EAAA,aAAA;AAAA,IACJ,KAAO,EAAA;AAAA,GACT;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,SAAS,CAAK,CAAA,KAAA,CAAA,CAAE,OAAQ,EAAA,CAAE,QAAQ,KAAK;AAAA;AACzC,GACF;AAAA,EACA,MAAA,EAAQ,CAAC,2BAA2B,CAAA;AAAA,EACpC,QAAU,EAAA;AAAA,IACR,IAAM,EAAA;AAAA,GACR;AAAA,EACA,CAAC,OAAQ,CAAA,MAAA,EAA6C,EAAE,MAAA,EAAQ,MAAQ,EAAA;AACtE,IAAA,MAAM,kBAAqB,GAAA,IAAA;AAAA,MAAK,MAC9B,MAAA,CAAO,SAAU,CAAA,EAAE,MAAO,EAAC,CAAE,CAAA,IAAA,CAAK,CAAc,SAAA,MAAA,EAAE,OAAS,EAAA,SAAA,EAAY,CAAA;AAAA,KACzE;AAEA,IAAA,MAAM,2BAA4B,CAAA;AAAA,MAChC,WAAW,MAAO,CAAA,SAAA;AAAA,MAClB,SAAW,EAAA,CAAC,KACV,qBAAA,KAAA,CAAA,aAAA,CAAC,qBAAkB,IACjB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,6BAAA;AAAA,QAAA;AAAA,UACC,MAAM,KAAM,CAAA,IAAA;AAAA,UACZ,QAAQ,KAAM,CAAA,MAAA;AAAA,UACd,SAAS,MAAO,CAAA;AAAA,SAAA;AAAA,wBAEhB,KAAA,CAAA,aAAA,CAAC,kBAAoB,EAAA,EAAA,GAAG,KAAO,EAAA;AAAA,OAEnC;AAAA,KAEH,CAAA;AAAA;AAEL,CAAC;;;;"}
1
+ {"version":3,"file":"SearchResultListItemBlueprint.esm.js","sources":["../../../src/alpha/blueprints/SearchResultListItemBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { lazy } from 'react';\nimport {\n createExtensionBlueprint,\n ExtensionBoundary,\n} from '@backstage/frontend-plugin-api';\nimport {\n SearchResultItemExtensionComponent,\n SearchResultItemExtensionPredicate,\n searchResultListItemDataRef,\n} from './types';\nimport {\n SearchResultListItemExtension,\n SearchResultListItemExtensionProps,\n} from '../../extensions';\n\n/** @alpha */\nexport interface SearchResultListItemBlueprintParams {\n /**\n * The extension component.\n */\n component: (options: {\n config: { noTrack?: boolean };\n }) => Promise<SearchResultItemExtensionComponent>;\n /**\n * When an extension defines a predicate, it returns true if the result should be rendered by that extension.\n * Defaults to a predicate that returns true, which means it renders all sorts of results.\n */\n predicate?: SearchResultItemExtensionPredicate;\n}\n\n/**\n * @alpha\n * Creates SearchResultListItem extensions\n */\nexport const SearchResultListItemBlueprint = createExtensionBlueprint({\n kind: 'search-result-list-item',\n attachTo: {\n id: 'page:search',\n input: 'items',\n },\n config: {\n schema: {\n noTrack: z => z.boolean().default(false),\n },\n },\n output: [searchResultListItemDataRef],\n dataRefs: {\n item: searchResultListItemDataRef,\n },\n *factory(params: SearchResultListItemBlueprintParams, { config, node }) {\n const ExtensionComponent = lazy(() =>\n params.component({ config }).then(component => ({ default: component })),\n );\n\n yield searchResultListItemDataRef({\n predicate: params.predicate,\n component: (props: SearchResultListItemExtensionProps) => (\n <ExtensionBoundary node={node}>\n <SearchResultListItemExtension\n rank={props.rank}\n result={props.result}\n noTrack={config.noTrack}\n >\n <ExtensionComponent {...props} />\n </SearchResultListItemExtension>\n </ExtensionBoundary>\n ),\n });\n },\n});\n"],"names":[],"mappings":";;;;;;AAkDO,MAAM,gCAAgC,wBAAyB,CAAA;AAAA,EACpE,IAAM,EAAA,yBAAA;AAAA,EACN,QAAU,EAAA;AAAA,IACR,EAAI,EAAA,aAAA;AAAA,IACJ,KAAO,EAAA;AAAA,GACT;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,SAAS,CAAK,CAAA,KAAA,CAAA,CAAE,OAAQ,EAAA,CAAE,QAAQ,KAAK;AAAA;AACzC,GACF;AAAA,EACA,MAAA,EAAQ,CAAC,2BAA2B,CAAA;AAAA,EACpC,QAAU,EAAA;AAAA,IACR,IAAM,EAAA;AAAA,GACR;AAAA,EACA,CAAC,OAAQ,CAAA,MAAA,EAA6C,EAAE,MAAA,EAAQ,MAAQ,EAAA;AACtE,IAAA,MAAM,kBAAqB,GAAA,IAAA;AAAA,MAAK,MAC9B,MAAA,CAAO,SAAU,CAAA,EAAE,MAAO,EAAC,CAAE,CAAA,IAAA,CAAK,CAAc,SAAA,MAAA,EAAE,OAAS,EAAA,SAAA,EAAY,CAAA;AAAA,KACzE;AAEA,IAAA,MAAM,2BAA4B,CAAA;AAAA,MAChC,WAAW,MAAO,CAAA,SAAA;AAAA,MAClB,SAAW,EAAA,CAAC,KACV,qBAAA,GAAA,CAAC,qBAAkB,IACjB,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,6BAAA;AAAA,QAAA;AAAA,UACC,MAAM,KAAM,CAAA,IAAA;AAAA,UACZ,QAAQ,KAAM,CAAA,MAAA;AAAA,UACd,SAAS,MAAO,CAAA,OAAA;AAAA,UAEhB,QAAA,kBAAA,GAAA,CAAC,kBAAoB,EAAA,EAAA,GAAG,KAAO,EAAA;AAAA;AAAA,OAEnC,EAAA;AAAA,KAEH,CAAA;AAAA;AAEL,CAAC;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { AnalyticsContext } from '@backstage/core-plugin-api';
3
3
  import { HighlightedSearchResultText } from '../HighlightedSearchResultText/HighlightedSearchResultText.esm.js';
4
4
  import ListItemIcon from '@material-ui/core/ListItemIcon';
@@ -15,53 +15,57 @@ const DefaultResultListItemComponent = ({
15
15
  lineClamp = 5
16
16
  }) => {
17
17
  if (!result) return null;
18
- return /* @__PURE__ */ React.createElement(React.Fragment, null, icon && /* @__PURE__ */ React.createElement(ListItemIcon, null, icon), /* @__PURE__ */ React.createElement(
19
- ListItemText,
20
- {
21
- primaryTypographyProps: { variant: "h6" },
22
- primary: /* @__PURE__ */ React.createElement(Link, { noTrack: true, to: result.location }, highlight?.fields.title ? /* @__PURE__ */ React.createElement(
23
- HighlightedSearchResultText,
24
- {
25
- text: highlight?.fields.title || "",
26
- preTag: highlight?.preTag || "",
27
- postTag: highlight?.postTag || ""
28
- }
29
- ) : result.title),
30
- secondary: /* @__PURE__ */ React.createElement(
31
- Typography,
32
- {
33
- component: "span",
34
- style: {
35
- display: "-webkit-box",
36
- WebkitBoxOrient: "vertical",
37
- WebkitLineClamp: lineClamp,
38
- overflow: "hidden"
39
- },
40
- color: "textSecondary",
41
- variant: "body2"
42
- },
43
- highlight?.fields.text ? /* @__PURE__ */ React.createElement(
18
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
19
+ icon && /* @__PURE__ */ jsx(ListItemIcon, { children: icon }),
20
+ /* @__PURE__ */ jsx(
21
+ ListItemText,
22
+ {
23
+ primaryTypographyProps: { variant: "h6" },
24
+ primary: /* @__PURE__ */ jsx(Link, { noTrack: true, to: result.location, children: highlight?.fields.title ? /* @__PURE__ */ jsx(
44
25
  HighlightedSearchResultText,
45
26
  {
46
- text: highlight.fields.text,
47
- preTag: highlight.preTag,
48
- postTag: highlight.postTag
27
+ text: highlight?.fields.title || "",
28
+ preTag: highlight?.preTag || "",
29
+ postTag: highlight?.postTag || ""
49
30
  }
50
- ) : result.text
51
- )
52
- }
53
- ), secondaryAction && /* @__PURE__ */ React.createElement(Box, { alignItems: "flex-end" }, secondaryAction));
31
+ ) : result.title }),
32
+ secondary: /* @__PURE__ */ jsx(
33
+ Typography,
34
+ {
35
+ component: "span",
36
+ style: {
37
+ display: "-webkit-box",
38
+ WebkitBoxOrient: "vertical",
39
+ WebkitLineClamp: lineClamp,
40
+ overflow: "hidden"
41
+ },
42
+ color: "textSecondary",
43
+ variant: "body2",
44
+ children: highlight?.fields.text ? /* @__PURE__ */ jsx(
45
+ HighlightedSearchResultText,
46
+ {
47
+ text: highlight.fields.text,
48
+ preTag: highlight.preTag,
49
+ postTag: highlight.postTag
50
+ }
51
+ ) : result.text
52
+ }
53
+ )
54
+ }
55
+ ),
56
+ secondaryAction && /* @__PURE__ */ jsx(Box, { alignItems: "flex-end", children: secondaryAction })
57
+ ] });
54
58
  };
55
59
  const HigherOrderDefaultResultListItem = (props) => {
56
- return /* @__PURE__ */ React.createElement(
60
+ return /* @__PURE__ */ jsx(
57
61
  AnalyticsContext,
58
62
  {
59
63
  attributes: {
60
64
  pluginId: "search",
61
65
  extension: "DefaultResultListItem"
62
- }
63
- },
64
- /* @__PURE__ */ React.createElement(DefaultResultListItemComponent, { ...props })
66
+ },
67
+ children: /* @__PURE__ */ jsx(DefaultResultListItemComponent, { ...props })
68
+ }
65
69
  );
66
70
  };
67
71
 
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultResultListItem.esm.js","sources":["../../../src/components/DefaultResultListItem/DefaultResultListItem.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 React, { ReactNode } from 'react';\nimport { AnalyticsContext } from '@backstage/core-plugin-api';\nimport {\n ResultHighlight,\n SearchDocument,\n} from '@backstage/plugin-search-common';\nimport { HighlightedSearchResultText } from '../HighlightedSearchResultText';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Box from '@material-ui/core/Box';\nimport Typography from '@material-ui/core/Typography';\nimport { Link } from '@backstage/core-components';\n\n/**\n * Props for {@link DefaultResultListItem}\n *\n * @public\n */\nexport type DefaultResultListItemProps = {\n icon?: ReactNode;\n secondaryAction?: ReactNode;\n result?: SearchDocument;\n highlight?: ResultHighlight;\n rank?: number;\n lineClamp?: number;\n toggleModal?: () => void;\n};\n\n/**\n * A default result list item.\n *\n * @public\n */\nexport const DefaultResultListItemComponent = ({\n result,\n highlight,\n icon,\n secondaryAction,\n lineClamp = 5,\n}: DefaultResultListItemProps) => {\n if (!result) return null;\n\n return (\n <>\n {icon && <ListItemIcon>{icon}</ListItemIcon>}\n <ListItemText\n primaryTypographyProps={{ variant: 'h6' }}\n primary={\n <Link noTrack to={result.location}>\n {highlight?.fields.title ? (\n <HighlightedSearchResultText\n text={highlight?.fields.title || ''}\n preTag={highlight?.preTag || ''}\n postTag={highlight?.postTag || ''}\n />\n ) : (\n result.title\n )}\n </Link>\n }\n secondary={\n <Typography\n component=\"span\"\n style={{\n display: '-webkit-box',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: lineClamp,\n overflow: 'hidden',\n }}\n color=\"textSecondary\"\n variant=\"body2\"\n >\n {highlight?.fields.text ? (\n <HighlightedSearchResultText\n text={highlight.fields.text}\n preTag={highlight.preTag}\n postTag={highlight.postTag}\n />\n ) : (\n result.text\n )}\n </Typography>\n }\n />\n {secondaryAction && <Box alignItems=\"flex-end\">{secondaryAction}</Box>}\n </>\n );\n};\n\n/**\n * @public\n */\nconst HigherOrderDefaultResultListItem = (\n props: DefaultResultListItemProps,\n) => {\n return (\n <AnalyticsContext\n attributes={{\n pluginId: 'search',\n extension: 'DefaultResultListItem',\n }}\n >\n <DefaultResultListItemComponent {...props} />\n </AnalyticsContext>\n );\n};\n\nexport { HigherOrderDefaultResultListItem as DefaultResultListItem };\n"],"names":[],"mappings":";;;;;;;;;AAiDO,MAAM,iCAAiC,CAAC;AAAA,EAC7C,MAAA;AAAA,EACA,SAAA;AAAA,EACA,IAAA;AAAA,EACA,eAAA;AAAA,EACA,SAAY,GAAA;AACd,CAAkC,KAAA;AAChC,EAAI,IAAA,CAAC,QAAe,OAAA,IAAA;AAEpB,EAAA,uBAEK,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAA,IAAA,oBAAS,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,IAAA,EAAc,IAAK,CAC7B,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,sBAAA,EAAwB,EAAE,O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C,UAAY,EAAA;AAAA,QACV,QAAU,EAAA,QAAA;AAAA,QACV,SAAW,EAAA;AAAA;AACb,KAAA;AAAA,oBAEA,KAAA,CAAA,aAAA,CAAC,8BAAgC,EAAA,EAAA,GAAG,KAAO,EAAA;AAAA,GAC7C;AAEJ;;;;"}
1
+ {"version":3,"file":"DefaultResultListItem.esm.js","sources":["../../../src/components/DefaultResultListItem/DefaultResultListItem.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 { ReactNode } from 'react';\nimport { AnalyticsContext } from '@backstage/core-plugin-api';\nimport {\n ResultHighlight,\n SearchDocument,\n} from '@backstage/plugin-search-common';\nimport { HighlightedSearchResultText } from '../HighlightedSearchResultText';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Box from '@material-ui/core/Box';\nimport Typography from '@material-ui/core/Typography';\nimport { Link } from '@backstage/core-components';\n\n/**\n * Props for {@link DefaultResultListItem}\n *\n * @public\n */\nexport type DefaultResultListItemProps = {\n icon?: ReactNode;\n secondaryAction?: ReactNode;\n result?: SearchDocument;\n highlight?: ResultHighlight;\n rank?: number;\n lineClamp?: number;\n toggleModal?: () => void;\n};\n\n/**\n * A default result list item.\n *\n * @public\n */\nexport const DefaultResultListItemComponent = ({\n result,\n highlight,\n icon,\n secondaryAction,\n lineClamp = 5,\n}: DefaultResultListItemProps) => {\n if (!result) return null;\n\n return (\n <>\n {icon && <ListItemIcon>{icon}</ListItemIcon>}\n <ListItemText\n primaryTypographyProps={{ variant: 'h6' }}\n primary={\n <Link noTrack to={result.location}>\n {highlight?.fields.title ? (\n <HighlightedSearchResultText\n text={highlight?.fields.title || ''}\n preTag={highlight?.preTag || ''}\n postTag={highlight?.postTag || ''}\n />\n ) : (\n result.title\n )}\n </Link>\n }\n secondary={\n <Typography\n component=\"span\"\n style={{\n display: '-webkit-box',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: lineClamp,\n overflow: 'hidden',\n }}\n color=\"textSecondary\"\n variant=\"body2\"\n >\n {highlight?.fields.text ? (\n <HighlightedSearchResultText\n text={highlight.fields.text}\n preTag={highlight.preTag}\n postTag={highlight.postTag}\n />\n ) : (\n result.text\n )}\n </Typography>\n }\n />\n {secondaryAction && <Box alignItems=\"flex-end\">{secondaryAction}</Box>}\n </>\n );\n};\n\n/**\n * @public\n */\nconst HigherOrderDefaultResultListItem = (\n props: DefaultResultListItemProps,\n) => {\n return (\n <AnalyticsContext\n attributes={{\n pluginId: 'search',\n extension: 'DefaultResultListItem',\n }}\n >\n <DefaultResultListItemComponent {...props} />\n </AnalyticsContext>\n );\n};\n\nexport { HigherOrderDefaultResultListItem as DefaultResultListItem };\n"],"names":[],"mappings":";;;;;;;;;AAiDO,MAAM,iCAAiC,CAAC;AAAA,EAC7C,MAAA;AAAA,EACA,SAAA;AAAA,EACA,IAAA;AAAA,EACA,eAAA;AAAA,EACA,SAAY,GAAA;AACd,CAAkC,KAAA;AAChC,EAAI,IAAA,CAAC,QAAe,OAAA,IAAA;AAEpB,EAAA,uBAEK,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,IAAQ,IAAA,oBAAA,GAAA,CAAC,gBAAc,QAAK,EAAA,IAAA,EAAA,CAAA;AAAA,oBAC7B,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,sBAAA,EAAwB,EAAE,OAAA,EAAS,IAAK,EAAA;AAAA,QACxC,OAAA,kBACG,GAAA,CAAA,IAAA,EAAA,EAAK,OAAO,EAAA,IAAA,EAAC,IA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AA,CAAC,8BAAgC,EAAA,EAAA,GAAG,KAAO,EAAA;AAAA;AAAA,GAC7C;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { useMemo } from 'react';
1
+ import { jsx, Fragment } from 'react/jsx-runtime';
2
+ import { useMemo } from 'react';
2
3
  import { makeStyles } from '@material-ui/core/styles';
3
4
 
4
5
  const useStyles = makeStyles(
@@ -14,9 +15,9 @@ const HighlightedSearchResultText = (props) => {
14
15
  () => text.split(new RegExp(`(${preTag}.+?${postTag})`)),
15
16
  [postTag, preTag, text]
16
17
  );
17
- return /* @__PURE__ */ React.createElement(React.Fragment, null, terms.map(
18
- (t, idx) => t.includes(preTag) ? /* @__PURE__ */ React.createElement("mark", { className: classes.highlight, key: idx }, t.replace(new RegExp(`${preTag}|${postTag}`, "g"), "")) : t
19
- ));
18
+ return /* @__PURE__ */ jsx(Fragment, { children: terms.map(
19
+ (t, idx) => t.includes(preTag) ? /* @__PURE__ */ jsx("mark", { className: classes.highlight, children: t.replace(new RegExp(`${preTag}|${postTag}`, "g"), "") }, idx) : t
20
+ ) });
20
21
  };
21
22
 
22
23
  export { HighlightedSearchResultText };
@@ -1 +1 @@
1
- {"version":3,"file":"HighlightedSearchResultText.esm.js","sources":["../../../src/components/HighlightedSearchResultText/HighlightedSearchResultText.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 React, { useMemo } from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\n\n/** @public */\nexport type HighlightedSearchResultTextClassKey = 'highlight';\n\nconst useStyles = makeStyles(\n () => ({\n highlight: {},\n }),\n { name: 'BackstageHighlightedSearchResultText' },\n);\n\n/**\n * Props for {@link HighlightedSearchResultText}.\n *\n * @public\n */\nexport type HighlightedSearchResultTextProps = {\n text: string;\n preTag: string;\n postTag: string;\n};\n\n/**\n * @public\n */\nexport const HighlightedSearchResultText = (\n props: HighlightedSearchResultTextProps,\n) => {\n const { text, preTag, postTag } = props;\n\n const classes = useStyles();\n const terms = useMemo(\n () => text.split(new RegExp(`(${preTag}.+?${postTag})`)),\n [postTag, preTag, text],\n );\n\n return (\n <>\n {terms.map((t, idx) =>\n t.includes(preTag) ? (\n <mark className={classes.highlight} key={idx}>\n {t.replace(new RegExp(`${preTag}|${postTag}`, 'g'), '')}\n </mark>\n ) : (\n t\n ),\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;AAsBA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,OAAO;AAAA,IACL,WAAW;AAAC,GACd,CAAA;AAAA,EACA,EAAE,MAAM,sCAAuC;AACjD,CAAA;AAgBa,MAAA,2BAAA,GAA8B,CACzC,KACG,KAAA;AACH,EAAA,MAAM,EAAE,IAAA,EAAM,MAAQ,EAAA,OAAA,EAAY,GAAA,KAAA;AAElC,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,KAAQ,GAAA,OAAA;AAAA,IACZ,MAAM,IAAK,CAAA,KAAA,CAAM,IAAI,MAAA,CAAO,IAAI,MAAM,CAAA,GAAA,EAAM,OAAO,CAAA,CAAA,CAAG,CAAC,CAAA;AAAA,IACvD,CAAC,OAAS,EAAA,MAAA,EAAQ,IAAI;AAAA,GACxB;AAEA,EAAA,iEAEK,KAAM,CAAA,GAAA;AAAA,IAAI,CAAC,CAAG,EAAA,GAAA,KACb,CAAE,CAAA,QAAA,CAAS,MAAM,CAAA,mBACd,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAK,SAAW,EAAA,OAAA,CAAQ,SAAW,EAAA,GAAA,EAAK,GACtC,EAAA,EAAA,CAAA,CAAE,OAAQ,CAAA,IAAI,MAAO,CAAA,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,OAAO,CAAA,CAAA,EAAI,GAAG,CAAA,EAAG,EAAE,CACxD,CAEA,GAAA;AAAA,GAGN,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"HighlightedSearchResultText.esm.js","sources":["../../../src/components/HighlightedSearchResultText/HighlightedSearchResultText.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 { useMemo } from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\n\n/** @public */\nexport type HighlightedSearchResultTextClassKey = 'highlight';\n\nconst useStyles = makeStyles(\n () => ({\n highlight: {},\n }),\n { name: 'BackstageHighlightedSearchResultText' },\n);\n\n/**\n * Props for {@link HighlightedSearchResultText}.\n *\n * @public\n */\nexport type HighlightedSearchResultTextProps = {\n text: string;\n preTag: string;\n postTag: string;\n};\n\n/**\n * @public\n */\nexport const HighlightedSearchResultText = (\n props: HighlightedSearchResultTextProps,\n) => {\n const { text, preTag, postTag } = props;\n\n const classes = useStyles();\n const terms = useMemo(\n () => text.split(new RegExp(`(${preTag}.+?${postTag})`)),\n [postTag, preTag, text],\n );\n\n return (\n <>\n {terms.map((t, idx) =>\n t.includes(preTag) ? (\n <mark className={classes.highlight} key={idx}>\n {t.replace(new RegExp(`${preTag}|${postTag}`, 'g'), '')}\n </mark>\n ) : (\n t\n ),\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;;AAsBA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,OAAO;AAAA,IACL,WAAW;AAAC,GACd,CAAA;AAAA,EACA,EAAE,MAAM,sCAAuC;AACjD,CAAA;AAgBa,MAAA,2BAAA,GAA8B,CACzC,KACG,KAAA;AACH,EAAA,MAAM,EAAE,IAAA,EAAM,MAAQ,EAAA,OAAA,EAAY,GAAA,KAAA;AAElC,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,KAAQ,GAAA,OAAA;AAAA,IACZ,MAAM,IAAK,CAAA,KAAA,CAAM,IAAI,MAAA,CAAO,IAAI,MAAM,CAAA,GAAA,EAAM,OAAO,CAAA,CAAA,CAAG,CAAC,CAAA;AAAA,IACvD,CAAC,OAAS,EAAA,MAAA,EAAQ,IAAI;AAAA,GACxB;AAEA,EAAA,uCAEK,QAAM,EAAA,KAAA,CAAA,GAAA;AAAA,IAAI,CAAC,CAAG,EAAA,GAAA,KACb,CAAE,CAAA,QAAA,CAAS,MAAM,CAAA,mBACd,GAAA,CAAA,MAAA,EAAA,EAAK,SAAW,EAAA,OAAA,CAAQ,SACtB,EAAA,QAAA,EAAA,CAAA,CAAE,QAAQ,IAAI,MAAA,CAAO,CAAG,EAAA,MAAM,CAAI,CAAA,EAAA,OAAO,CAAI,CAAA,EAAA,GAAG,CAAG,EAAA,EAAE,CADf,EAAA,EAAA,GAEzC,CAEA,GAAA;AAAA,GAGN,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { useCallback, useMemo } from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useCallback, useMemo } from 'react';
2
3
  import CircularProgress from '@material-ui/core/CircularProgress';
3
4
  import { makeStyles } from '@material-ui/core/styles';
4
5
  import Autocomplete from '@material-ui/lab/Autocomplete';
@@ -12,11 +13,11 @@ const useStyles = makeStyles((theme) => ({
12
13
  }
13
14
  }));
14
15
  const withContext = (Component) => {
15
- return (props) => /* @__PURE__ */ React.createElement(SearchContextProvider, { inheritParentContextIfAvailable: true }, /* @__PURE__ */ React.createElement(Component, { ...props }));
16
+ return (props) => /* @__PURE__ */ jsx(SearchContextProvider, { inheritParentContextIfAvailable: true, children: /* @__PURE__ */ jsx(Component, { ...props }) });
16
17
  };
17
18
  const SearchAutocompleteLoadingAdornment = () => {
18
19
  const classes = useStyles();
19
- return /* @__PURE__ */ React.createElement(
20
+ return /* @__PURE__ */ jsx(
20
21
  CircularProgress,
21
22
  {
22
23
  className: classes.loading,
@@ -68,7 +69,7 @@ const SearchAutocomplete = withContext(
68
69
  InputProps: { ref, className, endAdornment },
69
70
  InputLabelProps,
70
71
  ...params
71
- }) => /* @__PURE__ */ React.createElement(
72
+ }) => /* @__PURE__ */ jsx(
72
73
  SearchBar,
73
74
  {
74
75
  ...params,
@@ -77,13 +78,13 @@ const SearchAutocomplete = withContext(
77
78
  value: inputValue,
78
79
  placeholder: inputPlaceholder,
79
80
  debounceTime: inputDebounceTime,
80
- endAdornment: loading ? /* @__PURE__ */ React.createElement(SearchAutocompleteLoadingAdornment, null) : endAdornment,
81
+ endAdornment: loading ? /* @__PURE__ */ jsx(SearchAutocompleteLoadingAdornment, {}) : endAdornment,
81
82
  InputProps: { className }
82
83
  }
83
84
  ),
84
85
  [loading, inputValue, inputPlaceholder, inputDebounceTime]
85
86
  );
86
- return /* @__PURE__ */ React.createElement(
87
+ return /* @__PURE__ */ jsx(
87
88
  Autocomplete,
88
89
  {
89
90
  ...rest,
@@ -1 +1 @@
1
- {"version":3,"file":"SearchAutocomplete.esm.js","sources":["../../../src/components/SearchAutocomplete/SearchAutocomplete.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 React, { ChangeEvent, useCallback, useMemo } from 'react';\n\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Autocomplete, {\n AutocompleteProps,\n AutocompleteRenderInputParams,\n} from '@material-ui/lab/Autocomplete';\nimport {\n AutocompleteChangeDetails,\n AutocompleteChangeReason,\n} from '@material-ui/lab/useAutocomplete';\n\nimport { SearchContextProvider, useSearch } from '../../context';\nimport { SearchBar, SearchBarProps } from '../SearchBar';\n\nconst useStyles = makeStyles(theme => ({\n loading: {\n right: theme.spacing(1),\n position: 'absolute',\n },\n}));\n\n/**\n * Props for {@link SearchAutocomplete}.\n *\n * @public\n */\nexport type SearchAutocompleteProps<Option> = Omit<\n AutocompleteProps<Option, undefined, undefined, boolean>,\n 'renderInput' | 'disableClearable' | 'multiple'\n> & {\n 'data-testid'?: string;\n inputPlaceholder?: SearchBarProps['placeholder'];\n inputDebounceTime?: SearchBarProps['debounceTime'];\n};\n\n/**\n * Type for {@link SearchAutocomplete}.\n *\n * @public\n */\nexport type SearchAutocompleteComponent = <Option>(\n props: SearchAutocompleteProps<Option>,\n) => JSX.Element;\n\nconst withContext = (\n Component: SearchAutocompleteComponent,\n): SearchAutocompleteComponent => {\n return props => (\n <SearchContextProvider inheritParentContextIfAvailable>\n <Component {...props} />\n </SearchContextProvider>\n );\n};\n\nconst SearchAutocompleteLoadingAdornment = () => {\n const classes = useStyles();\n return (\n <CircularProgress\n className={classes.loading}\n data-testid=\"search-autocomplete-progressbar\"\n color=\"inherit\"\n size={20}\n />\n );\n};\n\n/**\n * Recommended search autocomplete when you use the Search Provider or Search Context.\n *\n * @public\n */\nexport const SearchAutocomplete = withContext(\n function SearchAutocompleteComponent<Option>(\n props: SearchAutocompleteProps<Option>,\n ) {\n const {\n loading,\n value,\n onChange = () => {},\n options = [],\n getOptionLabel = (option: Option) => String(option),\n inputPlaceholder,\n inputDebounceTime,\n freeSolo = true,\n fullWidth = true,\n clearOnBlur = false,\n 'data-testid': dataTestId = 'search-autocomplete',\n ...rest\n } = props;\n\n const { setTerm } = useSearch();\n\n const getInputValue = useCallback(\n (option?: null | string | Option) => {\n if (!option) return '';\n if (typeof option === 'string') return option;\n return getOptionLabel(option);\n },\n [getOptionLabel],\n );\n\n const inputValue = useMemo(\n () => getInputValue(value),\n [value, getInputValue],\n );\n\n const handleChange = useCallback(\n (\n event: ChangeEvent<{}>,\n option: null | string | Option,\n reason: AutocompleteChangeReason,\n details?: AutocompleteChangeDetails<Option>,\n ) => {\n setTerm(getInputValue(option));\n onChange(event, option, reason, details);\n },\n [getInputValue, setTerm, onChange],\n );\n\n const renderInput = useCallback(\n ({\n InputProps: { ref, className, endAdornment },\n InputLabelProps,\n ...params\n }: AutocompleteRenderInputParams) => (\n <SearchBar\n {...params}\n ref={ref}\n clearButton={false}\n value={inputValue}\n placeholder={inputPlaceholder}\n debounceTime={inputDebounceTime}\n endAdornment={\n loading ? <SearchAutocompleteLoadingAdornment /> : endAdornment\n }\n InputProps={{ className }}\n />\n ),\n [loading, inputValue, inputPlaceholder, inputDebounceTime],\n );\n\n return (\n <Autocomplete\n {...rest}\n data-testid={dataTestId}\n value={value}\n onChange={handleChange}\n options={options}\n getOptionLabel={getOptionLabel}\n renderInput={renderInput}\n freeSolo={freeSolo}\n fullWidth={fullWidth}\n clearOnBlur={clearOnBlur}\n />\n );\n },\n);\n"],"names":[],"mappings":";;;;;;;AAgCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,OAAS,EAAA;AAAA,IACP,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACtB,QAAU,EAAA;AAAA;AAEd,CAAE,CAAA,CAAA;AAyBF,MAAM,WAAA,GAAc,CAClB,SACgC,KAAA;AAChC,EAAO,OAAA,CAAA,KAAA,yCACJ,qBAAsB,EAAA,EAAA,+BAAA,EAA+B,wBACnD,KAAA,CAAA,aAAA,CAAA,SAAA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../../src/components/SearchAutocomplete/SearchAutocomplete.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 { ChangeEvent, useCallback, useMemo } from 'react';\n\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Autocomplete, {\n AutocompleteProps,\n AutocompleteRenderInputParams,\n} from '@material-ui/lab/Autocomplete';\nimport {\n AutocompleteChangeDetails,\n AutocompleteChangeReason,\n} from '@material-ui/lab/useAutocomplete';\n\nimport { SearchContextProvider, useSearch } from '../../context';\nimport { SearchBar, SearchBarProps } from '../SearchBar';\n\nconst useStyles = makeStyles(theme => ({\n loading: {\n right: theme.spacing(1),\n position: 'absolute',\n },\n}));\n\n/**\n * Props for {@link SearchAutocomplete}.\n *\n * @public\n */\nexport type SearchAutocompleteProps<Option> = Omit<\n AutocompleteProps<Option, undefined, undefined, boolean>,\n 'renderInput' | 'disableClearable' | 'multiple'\n> & {\n 'data-testid'?: string;\n inputPlaceholder?: SearchBarProps['placeholder'];\n inputDebounceTime?: SearchBarProps['debounceTime'];\n};\n\n/**\n * Type for {@link SearchAutocomplete}.\n *\n * @public\n */\nexport type SearchAutocompleteComponent = <Option>(\n props: SearchAutocompleteProps<Option>,\n) => JSX.Element;\n\nconst withContext = (\n Component: SearchAutocompleteComponent,\n): SearchAutocompleteComponent => {\n return props => (\n <SearchContextProvider inheritParentContextIfAvailable>\n <Component {...props} />\n </SearchContextProvider>\n );\n};\n\nconst SearchAutocompleteLoadingAdornment = () => {\n const classes = useStyles();\n return (\n <CircularProgress\n className={classes.loading}\n data-testid=\"search-autocomplete-progressbar\"\n color=\"inherit\"\n size={20}\n />\n );\n};\n\n/**\n * Recommended search autocomplete when you use the Search Provider or Search Context.\n *\n * @public\n */\nexport const SearchAutocomplete = withContext(\n function SearchAutocompleteComponent<Option>(\n props: SearchAutocompleteProps<Option>,\n ) {\n const {\n loading,\n value,\n onChange = () => {},\n options = [],\n getOptionLabel = (option: Option) => String(option),\n inputPlaceholder,\n inputDebounceTime,\n freeSolo = true,\n fullWidth = true,\n clearOnBlur = false,\n 'data-testid': dataTestId = 'search-autocomplete',\n ...rest\n } = props;\n\n const { setTerm } = useSearch();\n\n const getInputValue = useCallback(\n (option?: null | string | Option) => {\n if (!option) return '';\n if (typeof option === 'string') return option;\n return getOptionLabel(option);\n },\n [getOptionLabel],\n );\n\n const inputValue = useMemo(\n () => getInputValue(value),\n [value, getInputValue],\n );\n\n const handleChange = useCallback(\n (\n event: ChangeEvent<{}>,\n option: null | string | Option,\n reason: AutocompleteChangeReason,\n details?: AutocompleteChangeDetails<Option>,\n ) => {\n setTerm(getInputValue(option));\n onChange(event, option, reason, details);\n },\n [getInputValue, setTerm, onChange],\n );\n\n const renderInput = useCallback(\n ({\n InputProps: { ref, className, endAdornment },\n InputLabelProps,\n ...params\n }: AutocompleteRenderInputParams) => (\n <SearchBar\n {...params}\n ref={ref}\n clearButton={false}\n value={inputValue}\n placeholder={inputPlaceholder}\n debounceTime={inputDebounceTime}\n endAdornment={\n loading ? <SearchAutocompleteLoadingAdornment /> : endAdornment\n }\n InputProps={{ className }}\n />\n ),\n [loading, inputValue, inputPlaceholder, inputDebounceTime],\n );\n\n return (\n <Autocomplete\n {...rest}\n data-testid={dataTestId}\n value={value}\n onChange={handleChange}\n options={options}\n getOptionLabel={getOptionLabel}\n renderInput={renderInput}\n freeSolo={freeSolo}\n fullWidth={fullWidth}\n clearOnBlur={clearOnBlur}\n />\n );\n },\n);\n"],"names":[],"mappings":";;;;;;;;AAgCA,MAAM,SAAA,GAA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AA;AAAA,QACE,GAAG,IAAA;AAAA,QACJ,aAAa,EAAA,UAAA;AAAA,QACb,KAAA;AAAA,QACA,QAAU,EAAA,YAAA;AAAA,QACV,OAAA;AAAA,QACA,cAAA;AAAA,QACA,WAAA;AAAA,QACA,QAAA;AAAA,QACA,SAAA;AAAA,QACA;AAAA;AAAA,KACF;AAAA;AAGN;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import ListItemIcon from '@material-ui/core/ListItemIcon';
3
3
  import ListItemText from '@material-ui/core/ListItemText';
4
4
 
@@ -11,16 +11,19 @@ const SearchAutocompleteDefaultOption = (props) => {
11
11
  secondaryTextTypographyProps,
12
12
  disableTextTypography
13
13
  } = props;
14
- return /* @__PURE__ */ React.createElement(React.Fragment, null, icon ? /* @__PURE__ */ React.createElement(ListItemIcon, null, icon) : null, /* @__PURE__ */ React.createElement(
15
- ListItemText,
16
- {
17
- primary: primaryText,
18
- primaryTypographyProps: primaryTextTypographyProps,
19
- secondary: secondaryText,
20
- secondaryTypographyProps: secondaryTextTypographyProps,
21
- disableTypography: disableTextTypography
22
- }
23
- ));
14
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
15
+ icon ? /* @__PURE__ */ jsx(ListItemIcon, { children: icon }) : null,
16
+ /* @__PURE__ */ jsx(
17
+ ListItemText,
18
+ {
19
+ primary: primaryText,
20
+ primaryTypographyProps: primaryTextTypographyProps,
21
+ secondary: secondaryText,
22
+ secondaryTypographyProps: secondaryTextTypographyProps,
23
+ disableTypography: disableTextTypography
24
+ }
25
+ )
26
+ ] });
24
27
  };
25
28
 
26
29
  export { SearchAutocompleteDefaultOption };
@@ -1 +1 @@
1
- {"version":3,"file":"SearchAutocompleteDefaultOption.esm.js","sources":["../../../src/components/SearchAutocomplete/SearchAutocompleteDefaultOption.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 React, { ReactNode } from 'react';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText, {\n ListItemTextProps,\n} from '@material-ui/core/ListItemText';\n\n/**\n * Props for {@link SearchAutocompleteDefaultOption}.\n *\n * @public\n */\nexport type SearchAutocompleteDefaultOptionProps = {\n icon?: ReactNode;\n primaryText: ListItemTextProps['primary'];\n primaryTextTypographyProps?: ListItemTextProps['primaryTypographyProps'];\n secondaryText?: ListItemTextProps['secondary'];\n secondaryTextTypographyProps?: ListItemTextProps['secondaryTypographyProps'];\n disableTextTypography?: ListItemTextProps['disableTypography'];\n};\n\n/**\n * A default search autocomplete option component.\n *\n * @public\n */\nexport const SearchAutocompleteDefaultOption = (\n props: SearchAutocompleteDefaultOptionProps,\n) => {\n const {\n icon,\n primaryText,\n primaryTextTypographyProps,\n secondaryText,\n secondaryTextTypographyProps,\n disableTextTypography,\n } = props;\n\n return (\n <>\n {icon ? <ListItemIcon>{icon}</ListItemIcon> : null}\n <ListItemText\n primary={primaryText}\n primaryTypographyProps={primaryTextTypographyProps}\n secondary={secondaryText}\n secondaryTypographyProps={secondaryTextTypographyProps}\n disableTypography={disableTextTypography}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;AAyCa,MAAA,+BAAA,GAAkC,CAC7C,KACG,KAAA;AACH,EAAM,MAAA;AAAA,IACJ,IAAA;AAAA,IACA,WAAA;AAAA,IACA,0BAAA;AAAA,IACA,aAAA;AAAA,IACA,4BAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AAEJ,EAAA,iEAEK,IAAO,mBAAA,KAAA,CAAA,aAAA,CAAC,YAAc,EAAA,IAAA,EAAA,IAAK,IAAkB,IAC9C,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA,WAAA;AAAA,MACT,sBAAwB,EAAA,0BAAA;AAAA,MACxB,SAAW,EAAA,aAAA;AAAA,MACX,wBAA0B,EAAA,4BAAA;AAAA,MAC1B,iBAAmB,EAAA;AAAA;AAAA,GAEvB,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"SearchAutocompleteDefaultOption.esm.js","sources":["../../../src/components/SearchAutocomplete/SearchAutocompleteDefaultOption.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 { ReactNode } from 'react';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText, {\n ListItemTextProps,\n} from '@material-ui/core/ListItemText';\n\n/**\n * Props for {@link SearchAutocompleteDefaultOption}.\n *\n * @public\n */\nexport type SearchAutocompleteDefaultOptionProps = {\n icon?: ReactNode;\n primaryText: ListItemTextProps['primary'];\n primaryTextTypographyProps?: ListItemTextProps['primaryTypographyProps'];\n secondaryText?: ListItemTextProps['secondary'];\n secondaryTextTypographyProps?: ListItemTextProps['secondaryTypographyProps'];\n disableTextTypography?: ListItemTextProps['disableTypography'];\n};\n\n/**\n * A default search autocomplete option component.\n *\n * @public\n */\nexport const SearchAutocompleteDefaultOption = (\n props: SearchAutocompleteDefaultOptionProps,\n) => {\n const {\n icon,\n primaryText,\n primaryTextTypographyProps,\n secondaryText,\n secondaryTextTypographyProps,\n disableTextTypography,\n } = props;\n\n return (\n <>\n {icon ? <ListItemIcon>{icon}</ListItemIcon> : null}\n <ListItemText\n primary={primaryText}\n primaryTypographyProps={primaryTextTypographyProps}\n secondary={secondaryText}\n secondaryTypographyProps={secondaryTextTypographyProps}\n disableTypography={disableTextTypography}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;AAyCa,MAAA,+BAAA,GAAkC,CAC7C,KACG,KAAA;AACH,EAAM,MAAA;AAAA,IACJ,IAAA;AAAA,IACA,WAAA;AAAA,IACA,0BAAA;AAAA,IACA,aAAA;AAAA,IACA,4BAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AAEJ,EAAA,uBAEK,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,IAAO,IAAA,mBAAA,GAAA,CAAC,YAAc,EAAA,EAAA,QAAA,EAAA,IAAA,EAAK,CAAkB,GAAA,IAAA;AAAA,oBAC9C,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,OAAS,EAAA,WAAA;AAAA,QACT,sBAAwB,EAAA,0BAAA;AAAA,QACxB,SAAW,EAAA,aAAA;AAAA,QACX,wBAA0B,EAAA,4BAAA;AAAA,QAC1B,iBAAmB,EAAA;AAAA;AAAA;AACrB,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,10 +1,11 @@
1
+ import { jsx } from 'react/jsx-runtime';
1
2
  import { useApi, configApiRef, useApp, AnalyticsContext } from '@backstage/core-plugin-api';
2
3
  import IconButton from '@material-ui/core/IconButton';
3
4
  import InputAdornment from '@material-ui/core/InputAdornment';
4
5
  import TextField from '@material-ui/core/TextField';
5
6
  import Button from '@material-ui/core/Button';
6
7
  import DefaultSearchIcon from '@material-ui/icons/Search';
7
- import React, { forwardRef, useState, useRef, useEffect, useCallback } from 'react';
8
+ import { forwardRef, useState, useRef, useEffect, useCallback } from 'react';
8
9
  import useDebounce from 'react-use/esm/useDebounce';
9
10
  import { SearchContextProvider, useSearch } from '../../context/SearchContext.esm.js';
10
11
 
@@ -73,8 +74,8 @@ const SearchBarBase = forwardRef((props, ref) => {
73
74
  const ariaLabel = label ? void 0 : "Search";
74
75
  const inputPlaceholder = placeholder ?? `Search in ${configApi.getOptionalString("app.title") || "Backstage"}`;
75
76
  const SearchIcon = useApp().getSystemIcon("search") || DefaultSearchIcon;
76
- const startAdornment = /* @__PURE__ */ React.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React.createElement(IconButton, { "aria-label": "Query", size: "small", disabled: true }, /* @__PURE__ */ React.createElement(SearchIcon, null)));
77
- const clearButtonEndAdornment = /* @__PURE__ */ React.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React.createElement(
77
+ const startAdornment = /* @__PURE__ */ jsx(InputAdornment, { position: "start", children: /* @__PURE__ */ jsx(IconButton, { "aria-label": "Query", size: "small", disabled: true, children: /* @__PURE__ */ jsx(SearchIcon, {}) }) });
78
+ const clearButtonEndAdornment = /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(
78
79
  Button,
79
80
  {
80
81
  "aria-label": "Clear",
@@ -84,11 +85,11 @@ const SearchBarBase = forwardRef((props, ref) => {
84
85
  if (event.key === "Enter") {
85
86
  event.stopPropagation();
86
87
  }
87
- }
88
- },
89
- "Clear"
90
- ));
91
- return /* @__PURE__ */ React.createElement(SearchContextProvider, { inheritParentContextIfAvailable: true }, /* @__PURE__ */ React.createElement(
88
+ },
89
+ children: "Clear"
90
+ }
91
+ ) });
92
+ return /* @__PURE__ */ jsx(SearchContextProvider, { inheritParentContextIfAvailable: true, children: /* @__PURE__ */ jsx(
92
93
  TextField,
93
94
  {
94
95
  id: "search-bar-text-field",
@@ -113,7 +114,7 @@ const SearchBarBase = forwardRef((props, ref) => {
113
114
  onKeyDown: handleKeyDown,
114
115
  ...rest
115
116
  }
116
- ));
117
+ ) });
117
118
  });
118
119
  const SearchBar = forwardRef((props, ref) => {
119
120
  const { value: initialValue = "", onChange, ...rest } = props;
@@ -133,21 +134,21 @@ const SearchBar = forwardRef((props, ref) => {
133
134
  },
134
135
  [onChange, setTerm]
135
136
  );
136
- return /* @__PURE__ */ React.createElement(SearchContextProvider, { inheritParentContextIfAvailable: true }, /* @__PURE__ */ React.createElement(
137
+ return /* @__PURE__ */ jsx(SearchContextProvider, { inheritParentContextIfAvailable: true, children: /* @__PURE__ */ jsx(
137
138
  AnalyticsContext,
138
139
  {
139
- attributes: { pluginId: "search", extension: "SearchBar" }
140
- },
141
- /* @__PURE__ */ React.createElement(
142
- SearchBarBase,
143
- {
144
- ...rest,
145
- ref,
146
- value: term,
147
- onChange: handleChange
148
- }
149
- )
150
- ));
140
+ attributes: { pluginId: "search", extension: "SearchBar" },
141
+ children: /* @__PURE__ */ jsx(
142
+ SearchBarBase,
143
+ {
144
+ ...rest,
145
+ ref,
146
+ value: term,
147
+ onChange: handleChange
148
+ }
149
+ )
150
+ }
151
+ ) });
151
152
  });
152
153
 
153
154
  export { SearchBar, SearchBarBase };
@@ -1 +1 @@
1
- {"version":3,"file":"SearchBar.esm.js","sources":["../../../src/components/SearchBar/SearchBar.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 {\n AnalyticsContext,\n configApiRef,\n useApi,\n useApp,\n} from '@backstage/core-plugin-api';\nimport IconButton from '@material-ui/core/IconButton';\nimport InputAdornment from '@material-ui/core/InputAdornment';\nimport TextField from '@material-ui/core/TextField';\nimport Button from '@material-ui/core/Button';\nimport { TextFieldProps } from '@material-ui/core/TextField';\nimport DefaultSearchIcon from '@material-ui/icons/Search';\nimport React, {\n ChangeEvent,\n forwardRef,\n KeyboardEvent,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport { SearchContextProvider, useSearch } from '../../context';\n\n/**\n * Props for {@link SearchBarBase}.\n *\n * @public\n */\nexport type SearchBarBaseProps = Omit<TextFieldProps, 'onChange'> & {\n debounceTime?: number;\n clearButton?: boolean;\n onClear?: () => void;\n onSubmit?: () => void;\n onChange: (value: string) => void;\n endAdornment?: React.ReactNode;\n};\n\n/**\n * All search boxes exported by the search plugin are based on the <SearchBarBase />,\n * and this one is based on the <InputBase /> component from Material UI.\n * Recommended if you don't use Search Provider or Search Context.\n *\n * @public\n */\nexport const SearchBarBase = forwardRef((props: SearchBarBaseProps, ref) => {\n const {\n onChange,\n onKeyDown = () => {},\n onClear = () => {},\n onSubmit = () => {},\n debounceTime = 200,\n clearButton = true,\n fullWidth = true,\n value: defaultValue,\n label,\n placeholder,\n inputProps = {},\n InputProps = {},\n endAdornment,\n ...rest\n } = props;\n\n const configApi = useApi(configApiRef);\n const [value, setValue] = useState<string>('');\n const forwardedValueRef = useRef<string>('');\n\n useEffect(() => {\n setValue(prevValue => {\n // We only update the value if our current value is the same as it was\n // for the most recent onChange call. Otherwise it means that the users\n // has continued typing and we should not replace their input.\n if (prevValue === forwardedValueRef.current) {\n return String(defaultValue);\n }\n return prevValue;\n });\n }, [defaultValue, forwardedValueRef]);\n\n useDebounce(\n () => {\n forwardedValueRef.current = value;\n onChange(value);\n },\n debounceTime,\n [value],\n );\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n setValue(e.target.value);\n },\n [setValue],\n );\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (onKeyDown) onKeyDown(e);\n if (onSubmit && e.key === 'Enter') {\n onSubmit();\n }\n },\n [onKeyDown, onSubmit],\n );\n\n const handleClear = useCallback(() => {\n forwardedValueRef.current = '';\n onChange('');\n setValue('');\n if (onClear) {\n onClear();\n }\n }, [onChange, onClear]);\n\n const ariaLabel: string | undefined = label ? undefined : 'Search';\n\n const inputPlaceholder =\n placeholder ??\n `Search in ${configApi.getOptionalString('app.title') || 'Backstage'}`;\n\n const SearchIcon = useApp().getSystemIcon('search') || DefaultSearchIcon;\n\n const startAdornment = (\n <InputAdornment position=\"start\">\n <IconButton aria-label=\"Query\" size=\"small\" disabled>\n <SearchIcon />\n </IconButton>\n </InputAdornment>\n );\n\n const clearButtonEndAdornment = (\n <InputAdornment position=\"end\">\n <Button\n aria-label=\"Clear\"\n size=\"small\"\n onClick={handleClear}\n onKeyDown={event => {\n if (event.key === 'Enter') {\n // write your functionality here\n event.stopPropagation();\n }\n }}\n >\n Clear\n </Button>\n </InputAdornment>\n );\n\n return (\n <SearchContextProvider inheritParentContextIfAvailable>\n <TextField\n id=\"search-bar-text-field\"\n data-testid=\"search-bar-next\"\n variant=\"outlined\"\n margin=\"normal\"\n inputRef={ref}\n value={value}\n label={label}\n placeholder={inputPlaceholder}\n InputProps={{\n startAdornment,\n endAdornment: clearButton ? clearButtonEndAdornment : endAdornment,\n ...InputProps,\n }}\n inputProps={{\n 'aria-label': ariaLabel,\n ...inputProps,\n }}\n fullWidth={fullWidth}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n {...rest}\n />\n </SearchContextProvider>\n );\n});\n\n/**\n * Props for {@link SearchBar}.\n *\n * @public\n */\nexport type SearchBarProps = Partial<SearchBarBaseProps>;\n\n/**\n * Recommended search bar when you use the Search Provider or Search Context.\n *\n * @public\n */\nexport const SearchBar = forwardRef((props: SearchBarProps, ref) => {\n const { value: initialValue = '', onChange, ...rest } = props;\n\n const { term, setTerm } = useSearch();\n\n useEffect(() => {\n if (initialValue) {\n setTerm(String(initialValue));\n }\n }, [initialValue, setTerm]);\n\n const handleChange = useCallback(\n (newValue: string) => {\n if (onChange) {\n onChange(newValue);\n } else {\n setTerm(newValue);\n }\n },\n [onChange, setTerm],\n );\n\n return (\n <SearchContextProvider inheritParentContextIfAvailable>\n <AnalyticsContext\n attributes={{ pluginId: 'search', extension: 'SearchBar' }}\n >\n <SearchBarBase\n {...rest}\n ref={ref}\n value={term}\n onChange={handleChange}\n />\n </AnalyticsContext>\n </SearchContextProvider>\n );\n});\n"],"names":[],"mappings":";;;;;;;;;;AA6DO,MAAM,aAAgB,GAAA,UAAA,CAAW,CAAC,KAAA,EAA2B,GAAQ,KAAA;AAC1E,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,YAAY,MAAM;AAAA,KAAC;AAAA,IACnB,UAAU,MAAM;AAAA,KAAC;AAAA,IACjB,WAAW,MAAM;AAAA,KAAC;AAAA,IAClB,YAAe,GAAA,GAAA;AAAA,IACf,WAAc,GAAA,IAAA;AAAA,IACd,SAAY,GAAA,IAAA;AAAA,IACZ,KAAO,EAAA,YAAA;AAAA,IACP,KAAA;AAAA,IACA,WAAA;AAAA,IACA,aAAa,EAAC;AAAA,IACd,aAAa,EAAC;AAAA,IACd,YAAA;AAAA,IACA,GAAG;AAAA,GACD,GAAA,KAAA;AAEJ,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AACrC,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAiB,EAAE,CAAA;AAC7C,EAAM,MAAA,iBAAA,GAAoB,OAAe,EAAE,CAAA;AAE3C,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,QAAA,CAAS,CAAa,SAAA,KAAA;AAIpB,MAAI,IAAA,SAAA,KAAc,kBAAkB,OAAS,EAAA;AAC3C,QAAA,OAAO,OAAO,YAAY,CAAA;AAAA;AAE5B,MAAO,OAAA,SAAA;AAAA,KACR,CAAA;AAAA,GACA,EAAA,CAAC,YAAc,EAAA,iBAAiB,CAAC,CAAA;AAEpC,EAAA,WAAA;AAAA,IACE,MAAM;AACJ,MAAA,iBAAA,CAAkB,OAAU,GAAA,KAAA;AAC5B,MAAA,QAAA,CAAS,KAAK,CAAA;AAAA,KAChB;AAAA,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Ae,IAAI,QAAU,EAAA,GAAG,MAAS,GAAA,KAAA;AAExD,EAAA,MAAM,EAAE,IAAA,EAAM,OAAQ,EAAA,GAAI,SAAU,EAAA;AAEpC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,YAAc,EAAA;AAChB,MAAQ,OAAA,CAAA,MAAA,CAAO,YAAY,CAAC,CAAA;AAAA;AAC9B,GACC,EAAA,CAAC,YAAc,EAAA,OAAO,CAAC,CAAA;AAE1B,EAAA,MAAM,YAAe,GAAA,WAAA;AAAA,IACnB,CAAC,QAAqB,KAAA;AACpB,MAAA,IAAI,QAAU,EAAA;AACZ,QAAA,QAAA,CAAS,QAAQ,CAAA;AAAA,OACZ,MAAA;AACL,QAAA,OAAA,CAAQ,QAAQ,CAAA;AAAA;AAClB,KACF;AAAA,IACA,CAAC,UAAU,OAAO;AAAA,GACpB;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,qBAAsB,EAAA,EAAA,+BAAA,EAA+B,IACpD,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,UAAY,EAAA,EAAE,QAAU,EAAA,QAAA,EAAU,WAAW,WAAY;AAAA,KAAA;AAAA,oBAEzD,KAAA,CAAA,aAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACE,GAAG,IAAA;AAAA,QACJ,GAAA;AAAA,QACA,KAAO,EAAA,IAAA;AAAA,QACP,QAAU,EAAA;AAAA;AAAA;AACZ,GAEJ,CAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"SearchBar.esm.js","sources":["../../../src/components/SearchBar/SearchBar.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 {\n AnalyticsContext,\n configApiRef,\n useApi,\n useApp,\n} from '@backstage/core-plugin-api';\nimport IconButton from '@material-ui/core/IconButton';\nimport InputAdornment from '@material-ui/core/InputAdornment';\nimport TextField from '@material-ui/core/TextField';\nimport Button from '@material-ui/core/Button';\nimport { TextFieldProps } from '@material-ui/core/TextField';\nimport DefaultSearchIcon from '@material-ui/icons/Search';\nimport {\n ReactNode,\n ChangeEvent,\n forwardRef,\n KeyboardEvent,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport { SearchContextProvider, useSearch } from '../../context';\n\n/**\n * Props for {@link SearchBarBase}.\n *\n * @public\n */\nexport type SearchBarBaseProps = Omit<TextFieldProps, 'onChange'> & {\n debounceTime?: number;\n clearButton?: boolean;\n onClear?: () => void;\n onSubmit?: () => void;\n onChange: (value: string) => void;\n endAdornment?: ReactNode;\n};\n\n/**\n * All search boxes exported by the search plugin are based on the <SearchBarBase />,\n * and this one is based on the <InputBase /> component from Material UI.\n * Recommended if you don't use Search Provider or Search Context.\n *\n * @public\n */\nexport const SearchBarBase = forwardRef((props: SearchBarBaseProps, ref) => {\n const {\n onChange,\n onKeyDown = () => {},\n onClear = () => {},\n onSubmit = () => {},\n debounceTime = 200,\n clearButton = true,\n fullWidth = true,\n value: defaultValue,\n label,\n placeholder,\n inputProps = {},\n InputProps = {},\n endAdornment,\n ...rest\n } = props;\n\n const configApi = useApi(configApiRef);\n const [value, setValue] = useState<string>('');\n const forwardedValueRef = useRef<string>('');\n\n useEffect(() => {\n setValue(prevValue => {\n // We only update the value if our current value is the same as it was\n // for the most recent onChange call. Otherwise it means that the users\n // has continued typing and we should not replace their input.\n if (prevValue === forwardedValueRef.current) {\n return String(defaultValue);\n }\n return prevValue;\n });\n }, [defaultValue, forwardedValueRef]);\n\n useDebounce(\n () => {\n forwardedValueRef.current = value;\n onChange(value);\n },\n debounceTime,\n [value],\n );\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n setValue(e.target.value);\n },\n [setValue],\n );\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (onKeyDown) onKeyDown(e);\n if (onSubmit && e.key === 'Enter') {\n onSubmit();\n }\n },\n [onKeyDown, onSubmit],\n );\n\n const handleClear = useCallback(() => {\n forwardedValueRef.current = '';\n onChange('');\n setValue('');\n if (onClear) {\n onClear();\n }\n }, [onChange, onClear]);\n\n const ariaLabel: string | undefined = label ? undefined : 'Search';\n\n const inputPlaceholder =\n placeholder ??\n `Search in ${configApi.getOptionalString('app.title') || 'Backstage'}`;\n\n const SearchIcon = useApp().getSystemIcon('search') || DefaultSearchIcon;\n\n const startAdornment = (\n <InputAdornment position=\"start\">\n <IconButton aria-label=\"Query\" size=\"small\" disabled>\n <SearchIcon />\n </IconButton>\n </InputAdornment>\n );\n\n const clearButtonEndAdornment = (\n <InputAdornment position=\"end\">\n <Button\n aria-label=\"Clear\"\n size=\"small\"\n onClick={handleClear}\n onKeyDown={event => {\n if (event.key === 'Enter') {\n // write your functionality here\n event.stopPropagation();\n }\n }}\n >\n Clear\n </Button>\n </InputAdornment>\n );\n\n return (\n <SearchContextProvider inheritParentContextIfAvailable>\n <TextField\n id=\"search-bar-text-field\"\n data-testid=\"search-bar-next\"\n variant=\"outlined\"\n margin=\"normal\"\n inputRef={ref}\n value={value}\n label={label}\n placeholder={inputPlaceholder}\n InputProps={{\n startAdornment,\n endAdornment: clearButton ? clearButtonEndAdornment : endAdornment,\n ...InputProps,\n }}\n inputProps={{\n 'aria-label': ariaLabel,\n ...inputProps,\n }}\n fullWidth={fullWidth}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n {...rest}\n />\n </SearchContextProvider>\n );\n});\n\n/**\n * Props for {@link SearchBar}.\n *\n * @public\n */\nexport type SearchBarProps = Partial<SearchBarBaseProps>;\n\n/**\n * Recommended search bar when you use the Search Provider or Search Context.\n *\n * @public\n */\nexport const SearchBar = forwardRef((props: SearchBarProps, ref) => {\n const { value: initialValue = '', onChange, ...rest } = props;\n\n const { term, setTerm } = useSearch();\n\n useEffect(() => {\n if (initialValue) {\n setTerm(String(initialValue));\n }\n }, [initialValue, setTerm]);\n\n const handleChange = useCallback(\n (newValue: string) => {\n if (onChange) {\n onChange(newValue);\n } else {\n setTerm(newValue);\n }\n },\n [onChange, setTerm],\n );\n\n return (\n <SearchContextProvider inheritParentContextIfAvailable>\n <AnalyticsContext\n attributes={{ pluginId: 'search', extension: 'SearchBar' }}\n >\n <SearchBarBase\n {...rest}\n ref={ref}\n value={term}\n onChange={handleChange}\n />\n </AnalyticsContext>\n </SearchContextProvider>\n );\n});\n"],"names":[],"mappings":";;;;;;;;;;;AA8DO,MAAM,aAAgB,GAAA,UAAA,CAAW,CAAC,KAAA,EAA2B,GAAQ,KAAA;AAC1E,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,YAAY,MAAM;AAAA,KAAC;AAAA,IACnB,UAAU,MAAM;AAAA,KAAC;AAAA,IACjB,WAAW,MAAM;AAAA,KAAC;AAAA,IAClB,YAAe,GAAA,GAAA;AAAA,IACf,WAAc,GAAA,IAAA;AAAA,IACd,SAAY,GAAA,IAAA;AAAA,IACZ,KAAO,EAAA,YAAA;AAAA,IACP,KAAA;AAAA,IACA,WAAA;AAAA,IACA,aAAa,EAAC;AAAA,IACd,aAAa,EAAC;AAAA,IACd,YAAA;AAAA,IACA,GAAG;AAAA,GACD,GAAA,KAAA;AAEJ,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AACrC,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAiB,EAAE,CAAA;AAC7C,EAAM,MAAA,iBAAA,GAAoB,OAAe,EAAE,CAAA;AAE3C,EAAA,SAAA,CAAU,MAAM;AACd,IAAA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;AAAA;AACZ;AAAA,GAEJ,EAAA,CAAA;AAEJ,CAAC;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { useState } from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useState } from 'react';
2
3
  import Chip from '@material-ui/core/Chip';
3
4
  import TextField from '@material-ui/core/TextField';
4
5
  import Autocomplete from '@material-ui/lab/Autocomplete';
@@ -38,7 +39,7 @@ const AutocompleteFilter = (props) => {
38
39
  return { ...others };
39
40
  });
40
41
  };
41
- const renderInput = (params) => /* @__PURE__ */ React.createElement(
42
+ const renderInput = (params) => /* @__PURE__ */ jsx(
42
43
  TextField,
43
44
  {
44
45
  ...params,
@@ -48,8 +49,8 @@ const AutocompleteFilter = (props) => {
48
49
  fullWidth: true
49
50
  }
50
51
  );
51
- const renderTags = (tagValue, getTagProps) => tagValue.map((option, index) => /* @__PURE__ */ React.createElement(Chip, { label: option, color: "primary", ...getTagProps({ index }) }));
52
- return /* @__PURE__ */ React.createElement(
52
+ const renderTags = (tagValue, getTagProps) => tagValue.map((option, index) => /* @__PURE__ */ jsx(Chip, { label: option, color: "primary", ...getTagProps({ index }) }));
53
+ return /* @__PURE__ */ jsx(
53
54
  Autocomplete,
54
55
  {
55
56
  filterSelectedOptions,
@@ -1 +1 @@
1
- {"version":3,"file":"SearchFilter.Autocomplete.esm.js","sources":["../../../src/components/SearchFilter/SearchFilter.Autocomplete.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 React, { ChangeEvent, useState } from 'react';\nimport Chip from '@material-ui/core/Chip';\nimport TextField from '@material-ui/core/TextField';\nimport Autocomplete, {\n AutocompleteGetTagProps,\n AutocompleteRenderInputParams,\n} from '@material-ui/lab/Autocomplete';\n\nimport { useSearch } from '../../context';\nimport { useAsyncFilterValues, useDefaultFilterValue } from './hooks';\nimport { SearchFilterComponentProps } from './SearchFilter';\n\n/**\n * @public\n */\nexport type SearchAutocompleteFilterProps = SearchFilterComponentProps & {\n filterSelectedOptions?: boolean;\n limitTags?: number;\n multiple?: boolean;\n};\n\n/**\n * @public\n */\nexport const AutocompleteFilter = (props: SearchAutocompleteFilterProps) => {\n const {\n className,\n defaultValue,\n name,\n values: givenValues,\n valuesDebounceMs,\n label,\n filterSelectedOptions,\n limitTags,\n multiple,\n } = props;\n const [inputValue, setInputValue] = useState<string>('');\n useDefaultFilterValue(name, defaultValue);\n const asyncValues =\n typeof givenValues === 'function' ? givenValues : undefined;\n const defaultValues =\n typeof givenValues === 'function' ? undefined : givenValues;\n const { value: values, loading } = useAsyncFilterValues(\n asyncValues,\n inputValue,\n defaultValues,\n valuesDebounceMs,\n );\n const { filters, setFilters } = useSearch();\n const filterValue =\n (filters[name] as string | string[] | undefined) || (multiple ? [] : null);\n\n // Set new filter values on input change.\n const handleChange = (\n _: ChangeEvent<{}>,\n newValue: string | string[] | null,\n ) => {\n setFilters(prevState => {\n const { [name]: filter, ...others } = prevState;\n\n if (newValue) {\n return { ...others, [name]: newValue };\n }\n return { ...others };\n });\n };\n\n // Provide the input field.\n const renderInput = (params: AutocompleteRenderInputParams) => (\n <TextField\n {...params}\n name=\"search\"\n variant=\"outlined\"\n label={label}\n fullWidth\n />\n );\n\n // Render tags as primary-colored chips.\n const renderTags = (\n tagValue: string[],\n getTagProps: AutocompleteGetTagProps,\n ) =>\n tagValue.map((option: string, index: number) => (\n <Chip label={option} color=\"primary\" {...getTagProps({ index })} />\n ));\n\n return (\n <Autocomplete\n filterSelectedOptions={filterSelectedOptions}\n limitTags={limitTags}\n multiple={multiple}\n className={className}\n id={`${multiple ? 'multi-' : ''}select-filter-${name}--select`}\n options={values || []}\n loading={loading}\n value={filterValue}\n onChange={handleChange}\n onInputChange={(_, newValue) => setInputValue(newValue)}\n renderInput={renderInput}\n renderTags={renderTags}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AAwCa,MAAA,kBAAA,GAAqB,CAAC,KAAyC,KAAA;AAC1E,EAAM,MAAA;AAAA,IACJ,SAAA;AAAA,IACA,YAAA;AAAA,IACA,IAAA;AAAA,IACA,MAAQ,EAAA,WAAA;AAAA,IACR,gBAAA;AAAA,IACA,KAAA;AAAA,IACA,qBAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AACJ,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAiB,EAAE,CAAA;AACvD,EAAA,qBAAA,CAAsB,MAAM,YAAY,CAAA;AACxC,EAAA,MAAM,WACJ,GAAA,OAAO,WAAgB,KAAA,UAAA,GAAa,WAAc,GAAA,KAAA,CAAA;AACpD,EAAA,MAAM,aACJ,GAAA,OAAO,WAAgB,KAAA,UAAA,GAAa,KAAY,CAAA,GAAA,WAAA;AAClD,EAAA,MAAM,EAAE,KAAA,EAAO,MAAQ,EAAA,OAAA,EAAY,GAAA,oBAAA;AAAA,IACjC,WAAA;AAAA,IACA,UAAA;AAAA,IACA,aAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,MAAM,EAAE,OAAA,EAAS,UAAW,EAAA,GAAI,SAAU,EAAA;AAC1C,EAAA,MAAM,cACH,OAAQ,CAAA,IAAI,CAAwC,KAAA,QAAA,GAAW,EAAK,GAAA,IAAA,CAAA;AAGvE,EAAM,MAAA,YAAA,GAAe,CACnB,CAAA,EACA,QACG,KAAA;AACH,IAAA,UAAA,CAAW,CAAa,SAAA,KAAA;AACtB,MAAA,MAAM,EAAE,CAAC,IAAI,GAAG,MAAQ,EAAA,GAAG,QAAW,GAAA,SAAA;AAEtC,MAAA,IAAI,QAAU,EAAA;AACZ,QAAA,OAAO,EAAE,GAAG,MAAA,EAAQ,CAAC,IAAI,GAAG,QAAS,EAAA;AAAA;AAEvC,MAAO,OAAA,EAAE,GAAG,MAAO,EAAA;AAAA,KACpB,CAAA;AAAA,GACH;AAGA,EAAM,MAAA,WAAA,GAAc,CAAC,MACnB,qBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACE,GAAG,MAAA;AAAA,MACJ,IAAK,EAAA,QAAA;AAAA,MACL,OAAQ,EAAA,UAAA;AAAA,MACR,KAAA;AAAA,MACA,SAAS,EAAA;AAAA;AAAA,GACX;AAIF,EAAM,MAAA,UAAA,GAAa,CACjB,QACA,EAAA,WAAA,KAEA,SAAS,GAAI,CAAA,CAAC,QAAgB,KAC5B,qBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,KAAO,EAAA,MAAA,EAAQ,OAAM,SAAW,EAAA,GAAG,YAAY,EAAE,KAAA,EAAO,CAAA,EAAG,CAClE,CAAA;AAEH,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,qBAAA;AAAA,MACA,SAAA;AAAA,MACA,QAAA;AAAA,MACA,SAAA;AAAA,MACA,IAAI,CAAG,EAAA,QAAA,GAAW,QAAW,GAAA,EAAE,iBAAiB,IAAI,CAAA,QAAA,CAAA;AAAA,MACpD,OAAA,EAAS,UAAU,EAAC;AAAA,MACpB,OAAA;AAAA,MACA,KAAO,EAAA,WAAA;AAAA,MACP,QAAU,EAAA,YAAA;AAAA,MACV,aAAe,EAAA,CAAC,CAAG,EAAA,QAAA,KAAa,cAAc,QAAQ,CAAA;AAAA,MACtD,WAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"SearchFilter.Autocomplete.esm.js","sources":["../../../src/components/SearchFilter/SearchFilter.Autocomplete.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 { ChangeEvent, useState } from 'react';\nimport Chip from '@material-ui/core/Chip';\nimport TextField from '@material-ui/core/TextField';\nimport Autocomplete, {\n AutocompleteGetTagProps,\n AutocompleteRenderInputParams,\n} from '@material-ui/lab/Autocomplete';\n\nimport { useSearch } from '../../context';\nimport { useAsyncFilterValues, useDefaultFilterValue } from './hooks';\nimport { SearchFilterComponentProps } from './SearchFilter';\n\n/**\n * @public\n */\nexport type SearchAutocompleteFilterProps = SearchFilterComponentProps & {\n filterSelectedOptions?: boolean;\n limitTags?: number;\n multiple?: boolean;\n};\n\n/**\n * @public\n */\nexport const AutocompleteFilter = (props: SearchAutocompleteFilterProps) => {\n const {\n className,\n defaultValue,\n name,\n values: givenValues,\n valuesDebounceMs,\n label,\n filterSelectedOptions,\n limitTags,\n multiple,\n } = props;\n const [inputValue, setInputValue] = useState<string>('');\n useDefaultFilterValue(name, defaultValue);\n const asyncValues =\n typeof givenValues === 'function' ? givenValues : undefined;\n const defaultValues =\n typeof givenValues === 'function' ? undefined : givenValues;\n const { value: values, loading } = useAsyncFilterValues(\n asyncValues,\n inputValue,\n defaultValues,\n valuesDebounceMs,\n );\n const { filters, setFilters } = useSearch();\n const filterValue =\n (filters[name] as string | string[] | undefined) || (multiple ? [] : null);\n\n // Set new filter values on input change.\n const handleChange = (\n _: ChangeEvent<{}>,\n newValue: string | string[] | null,\n ) => {\n setFilters(prevState => {\n const { [name]: filter, ...others } = prevState;\n\n if (newValue) {\n return { ...others, [name]: newValue };\n }\n return { ...others };\n });\n };\n\n // Provide the input field.\n const renderInput = (params: AutocompleteRenderInputParams) => (\n <TextField\n {...params}\n name=\"search\"\n variant=\"outlined\"\n label={label}\n fullWidth\n />\n );\n\n // Render tags as primary-colored chips.\n const renderTags = (\n tagValue: string[],\n getTagProps: AutocompleteGetTagProps,\n ) =>\n tagValue.map((option: string, index: number) => (\n <Chip label={option} color=\"primary\" {...getTagProps({ index })} />\n ));\n\n return (\n <Autocomplete\n filterSelectedOptions={filterSelectedOptions}\n limitTags={limitTags}\n multiple={multiple}\n className={className}\n id={`${multiple ? 'multi-' : ''}select-filter-${name}--select`}\n options={values || []}\n loading={loading}\n value={filterValue}\n onChange={handleChange}\n onInputChange={(_, newValue) => setInputValue(newValue)}\n renderInput={renderInput}\n renderTags={renderTags}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAwCa,MAAA,kBAAA,GAAqB,CAAC,KAAyC,KAAA;AAC1E,EAAM,MAAA;AAAA,IACJ,SAAA;AAAA,IACA,YAAA;AAAA,IACA,IAAA;AAAA,IACA,MAAQ,EAAA,WAAA;AAAA,IACR,gBAAA;AAAA,IACA,KAAA;AAAA,IACA,qBAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AACJ,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAiB,EAAE,CAAA;AACvD,EAAA,qBAAA,CAAsB,MAAM,YAAY,CAAA;AACxC,EAAA,MAAM,WACJ,GAAA,OAAO,WAAgB,KAAA,UAAA,GAAa,WAAc,GAAA,KAAA,CAAA;AACpD,EAAA,MAAM,aACJ,GAAA,OAAO,WAAgB,KAAA,UAAA,GAAa,KAAY,CAAA,GAAA,WAAA;AAClD,EAAA,MAAM,EAAE,KAAA,EAAO,MAAQ,EAAA,OAAA,EAAY,GAAA,oBAAA;AAAA,IACjC,WAAA;AAAA,IACA,UAAA;AAAA,IACA,aAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,MAAM,EAAE,OAAA,EAAS,UAAW,EAAA,GAAI,SAAU,EAAA;AAC1C,EAAA,MAAM,cACH,OAAQ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