@backstage/ui 0.15.1-next.0 → 0.16.0

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 (52) hide show
  1. package/CHANGELOG.md +167 -0
  2. package/dist/components/Combobox/Combobox.esm.js +150 -52
  3. package/dist/components/Combobox/Combobox.esm.js.map +1 -1
  4. package/dist/components/Combobox/Combobox.module.css.esm.js +2 -2
  5. package/dist/components/Combobox/ComboboxItem.esm.js +76 -0
  6. package/dist/components/Combobox/ComboboxItem.esm.js.map +1 -0
  7. package/dist/components/Combobox/ComboboxListBox.esm.js +215 -17
  8. package/dist/components/Combobox/ComboboxListBox.esm.js.map +1 -1
  9. package/dist/components/Combobox/definition.esm.js +62 -3
  10. package/dist/components/Combobox/definition.esm.js.map +1 -1
  11. package/dist/components/Combobox/useAsyncComboboxState.esm.js +133 -0
  12. package/dist/components/Combobox/useAsyncComboboxState.esm.js.map +1 -0
  13. package/dist/components/Header/HeaderNav.esm.js +0 -1
  14. package/dist/components/Header/HeaderNav.esm.js.map +1 -1
  15. package/dist/components/Select/Select.esm.js +87 -19
  16. package/dist/components/Select/Select.esm.js.map +1 -1
  17. package/dist/components/Select/Select.module.css.esm.js +2 -2
  18. package/dist/components/Select/SelectContent.esm.js +70 -18
  19. package/dist/components/Select/SelectContent.esm.js.map +1 -1
  20. package/dist/components/Select/SelectItem.esm.js +76 -0
  21. package/dist/components/Select/SelectItem.esm.js.map +1 -0
  22. package/dist/components/Select/SelectListBox.esm.js +175 -19
  23. package/dist/components/Select/SelectListBox.esm.js.map +1 -1
  24. package/dist/components/Select/SelectTrigger.esm.js +1 -1
  25. package/dist/components/Select/SelectTrigger.esm.js.map +1 -1
  26. package/dist/components/Select/definition.esm.js +72 -9
  27. package/dist/components/Select/definition.esm.js.map +1 -1
  28. package/dist/components/Skeleton/Skeleton.module.css.esm.js +2 -2
  29. package/dist/components/Skeleton/definition.esm.js +1 -0
  30. package/dist/components/Skeleton/definition.esm.js.map +1 -1
  31. package/dist/components/Table/Table.module.css.esm.js +2 -2
  32. package/dist/components/Table/components/Table.esm.js +60 -57
  33. package/dist/components/Table/components/Table.esm.js.map +1 -1
  34. package/dist/components/Table/definition.esm.js +2 -1
  35. package/dist/components/Table/definition.esm.js.map +1 -1
  36. package/dist/components/TablePagination/TablePagination.esm.js +4 -1
  37. package/dist/components/TablePagination/TablePagination.esm.js.map +1 -1
  38. package/dist/components/Tabs/TabsIndicators.esm.js +155 -108
  39. package/dist/components/Tabs/TabsIndicators.esm.js.map +1 -1
  40. package/dist/css/styles.css +4 -4
  41. package/dist/hooks/useCollectionAdapter.esm.js +67 -0
  42. package/dist/hooks/useCollectionAdapter.esm.js.map +1 -0
  43. package/dist/hooks/useDelayedVisibility.esm.js +17 -0
  44. package/dist/hooks/useDelayedVisibility.esm.js.map +1 -0
  45. package/dist/hooks/useTrackedSelectionKeys.esm.js +23 -0
  46. package/dist/hooks/useTrackedSelectionKeys.esm.js.map +1 -0
  47. package/dist/index.d.ts +742 -77
  48. package/dist/index.esm.js +5 -2
  49. package/dist/index.esm.js.map +1 -1
  50. package/dist/utils/selectableCollection.esm.js +75 -0
  51. package/dist/utils/selectableCollection.esm.js.map +1 -0
  52. package/package.json +4 -4
package/dist/index.esm.js CHANGED
@@ -44,7 +44,8 @@ export { CheckboxDefinition } from './components/Checkbox/definition.esm.js';
44
44
  export { CheckboxGroup } from './components/CheckboxGroup/CheckboxGroup.esm.js';
45
45
  export { CheckboxGroupDefinition } from './components/CheckboxGroup/definition.esm.js';
46
46
  export { Combobox } from './components/Combobox/Combobox.esm.js';
47
- export { ComboboxDefinition, ComboboxInputDefinition, ComboboxListBoxDefinition, ComboboxListBoxItemDefinition, ComboboxSectionDefinition } from './components/Combobox/definition.esm.js';
47
+ export { ComboboxItem, ComboboxItemProfile, ComboboxItemText } from './components/Combobox/ComboboxItem.esm.js';
48
+ export { ComboboxDefinition, ComboboxInputDefinition, ComboboxItemDefinition, ComboboxItemProfileDefinition, ComboboxItemTextDefinition, ComboboxListBoxDefinition, ComboboxListBoxItemDefinition, ComboboxSectionDefinition } from './components/Combobox/definition.esm.js';
48
49
  export { Radio, RadioGroup } from './components/RadioGroup/RadioGroup.esm.js';
49
50
  export { RadioDefinition, RadioGroupDefinition } from './components/RadioGroup/definition.esm.js';
50
51
  export { Slider } from './components/Slider/Slider.esm.js';
@@ -90,7 +91,8 @@ export { LinkDefinition } from './components/Link/definition.esm.js';
90
91
  export { List, ListRow } from './components/List/List.esm.js';
91
92
  export { ListDefinition, ListRowDefinition } from './components/List/definition.esm.js';
92
93
  export { Select } from './components/Select/Select.esm.js';
93
- export { SelectDefinition } from './components/Select/definition.esm.js';
94
+ export { SelectItem, SelectItemProfile, SelectItemText } from './components/Select/SelectItem.esm.js';
95
+ export { SelectContentDefinition, SelectDefinition, SelectItemDefinition, SelectItemProfileDefinition, SelectItemTextDefinition, SelectListBoxDefinition, SelectListBoxItemDefinition, SelectSectionDefinition, SelectTriggerDefinition } from './components/Select/definition.esm.js';
94
96
  export { Skeleton } from './components/Skeleton/Skeleton.esm.js';
95
97
  export { SkeletonDefinition } from './components/Skeleton/definition.esm.js';
96
98
  export { Switch } from './components/Switch/Switch.esm.js';
@@ -103,6 +105,7 @@ export { VisuallyHidden } from './components/VisuallyHidden/VisuallyHidden.esm.j
103
105
  export { VisuallyHiddenDefinition } from './components/VisuallyHidden/definition.esm.js';
104
106
  export { useBreakpoint } from './hooks/useBreakpoint.esm.js';
105
107
  export { BgProvider, useBgConsumer, useBgProvider } from './hooks/useBg.esm.js';
108
+ export { useAsyncList } from 'react-stately/useAsyncList';
106
109
  export { BUIProvider } from './provider/BUIProvider.esm.js';
107
110
  export { useAnalytics } from './analytics/useAnalytics.esm.js';
108
111
  export { getNodeText } from './analytics/getNodeText.esm.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,75 @@
1
+ function normalizeOption(option) {
2
+ if (option.id !== void 0) {
3
+ return option;
4
+ }
5
+ return {
6
+ id: option.value,
7
+ label: option.label,
8
+ disabled: option.disabled
9
+ };
10
+ }
11
+ function normalizeOptions(options) {
12
+ return options.map((option) => {
13
+ if ("options" in option) {
14
+ return {
15
+ title: option.title,
16
+ options: option.options.map(normalizeOption)
17
+ };
18
+ }
19
+ return normalizeOption(option);
20
+ });
21
+ }
22
+ function isAsyncListSource(source) {
23
+ return typeof source === "object" && source !== null && "items" in source && "filterText" in source && "setFilterText" in source && "loadingState" in source && "loadMore" in source;
24
+ }
25
+ function flattenOptions(options) {
26
+ return options.flatMap((option) => {
27
+ if ("options" in option) {
28
+ return option.options;
29
+ }
30
+ return option;
31
+ });
32
+ }
33
+ function getItemKeys(items) {
34
+ return new Set(Array.from(items, (item) => item.id));
35
+ }
36
+ function resolveCollectionSource({
37
+ options,
38
+ items
39
+ }) {
40
+ const plainOptions = Array.isArray(options) ? options : void 0;
41
+ const normalizedOptions = plainOptions ? normalizeOptions(plainOptions) : void 0;
42
+ const flatOptions = normalizedOptions ? flattenOptions(normalizedOptions) : void 0;
43
+ const asyncOptions = options && !Array.isArray(options) ? options : void 0;
44
+ if (items !== void 0) {
45
+ return {
46
+ options: plainOptions,
47
+ flatOptions,
48
+ source: items,
49
+ rendersItems: true
50
+ };
51
+ }
52
+ if (asyncOptions !== void 0) {
53
+ return {
54
+ options: plainOptions,
55
+ flatOptions,
56
+ source: asyncOptions,
57
+ rendersItems: true
58
+ };
59
+ }
60
+ return {
61
+ options: plainOptions,
62
+ flatOptions,
63
+ source: flatOptions ?? [],
64
+ rendersItems: false
65
+ };
66
+ }
67
+ function toSelection(value) {
68
+ if (value == null) {
69
+ return /* @__PURE__ */ new Set();
70
+ }
71
+ return new Set(Array.isArray(value) ? value : [value]);
72
+ }
73
+
74
+ export { flattenOptions, getItemKeys, isAsyncListSource, normalizeOption, normalizeOptions, resolveCollectionSource, toSelection };
75
+ //# sourceMappingURL=selectableCollection.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectableCollection.esm.js","sources":["../../src/utils/selectableCollection.ts"],"sourcesContent":["/*\n * Copyright 2026 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 type {\n AsyncListSource,\n CollectionItem,\n IdentifiedOption,\n NormalizedOption,\n NormalizedOptionSection,\n Option,\n OptionSection,\n} from '../types/selectableCollection';\nimport type { Key, Selection } from 'react-aria-components';\n\n/** @internal */\nexport function normalizeOption(option: Option): NormalizedOption {\n if (option.id !== undefined) {\n return option;\n }\n\n return {\n id: option.value,\n label: option.label,\n disabled: option.disabled,\n };\n}\n\n/** @internal */\nexport function normalizeOptions(\n options: ReadonlyArray<Option | OptionSection>,\n): Array<NormalizedOption | NormalizedOptionSection> {\n return options.map(option => {\n if ('options' in option) {\n return {\n title: option.title,\n options: option.options.map(normalizeOption),\n };\n }\n\n return normalizeOption(option);\n });\n}\n\n/** @internal */\nexport function isAsyncListSource<T>(\n source: Iterable<T> | AsyncListSource<T>,\n): source is AsyncListSource<T> {\n return (\n typeof source === 'object' &&\n source !== null &&\n 'items' in source &&\n 'filterText' in source &&\n 'setFilterText' in source &&\n 'loadingState' in source &&\n 'loadMore' in source\n );\n}\n\n/** @internal */\nexport function flattenOptions(\n options: ReadonlyArray<NormalizedOption | NormalizedOptionSection>,\n): NormalizedOption[] {\n return options.flatMap(option => {\n if ('options' in option) {\n return option.options;\n }\n\n return option;\n });\n}\n\n/** @internal */\nexport function getItemKeys(items: Iterable<CollectionItem>) {\n return new Set(Array.from(items, item => item.id));\n}\n\n/** @internal */\nexport function resolveCollectionSource<T extends CollectionItem>({\n options,\n items,\n}: {\n options?:\n | ReadonlyArray<Option | OptionSection>\n | AsyncListSource<IdentifiedOption>;\n items?: Iterable<T> | AsyncListSource<T>;\n}) {\n const plainOptions = Array.isArray(options) ? options : undefined;\n const normalizedOptions = plainOptions\n ? normalizeOptions(plainOptions)\n : undefined;\n const flatOptions = normalizedOptions\n ? flattenOptions(normalizedOptions)\n : undefined;\n const asyncOptions = options && !Array.isArray(options) ? options : undefined;\n\n if (items !== undefined) {\n return {\n options: plainOptions,\n flatOptions,\n source: items,\n rendersItems: true,\n };\n }\n\n if (asyncOptions !== undefined) {\n return {\n options: plainOptions,\n flatOptions,\n source: asyncOptions as unknown as AsyncListSource<T>,\n rendersItems: true,\n };\n }\n\n return {\n options: plainOptions,\n flatOptions,\n source: (flatOptions as T[] | undefined) ?? [],\n rendersItems: false,\n };\n}\n\n/** @internal */\nexport function toSelection(\n value: Key | ReadonlyArray<Key> | null | undefined,\n): Selection {\n if (value == null) {\n return new Set();\n }\n\n return new Set(Array.isArray(value) ? value : [value]);\n}\n\n/** @internal */\nexport function filterOptionSections(\n options: ReadonlyArray<NormalizedOption | NormalizedOptionSection>,\n query: string,\n filter: (option: NormalizedOption, query: string) => boolean,\n): Array<NormalizedOption | NormalizedOptionSection> {\n return options.flatMap(option => {\n if (!('options' in option)) {\n return filter(option, query) ? option : [];\n }\n\n const filteredOptions = option.options.filter(item => filter(item, query));\n if (filteredOptions.length === 0) {\n return [];\n }\n\n return { title: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4
4
  "backstage": {
5
5
  "role": "web-library"
6
6
  },
@@ -50,7 +50,7 @@
50
50
  "test": "backstage-cli package test"
51
51
  },
52
52
  "dependencies": {
53
- "@backstage/version-bridge": "1.0.12",
53
+ "@backstage/version-bridge": "^1.0.12",
54
54
  "@braintree/sanitize-url": "^7.1.2",
55
55
  "@internationalized/date": "^3.12.0",
56
56
  "@remixicon/react": ">=4.6.0 <4.9.0",
@@ -63,8 +63,8 @@
63
63
  "use-sync-external-store": "^1.4.0"
64
64
  },
65
65
  "devDependencies": {
66
- "@backstage/cli": "0.36.3-next.1",
67
- "@backstage/core-components": "0.18.11-next.1",
66
+ "@backstage/cli": "^0.36.3",
67
+ "@backstage/core-components": "^0.18.11",
68
68
  "@storybook/react-vite": "^10.4.0",
69
69
  "@testing-library/jest-dom": "^6.0.0",
70
70
  "@testing-library/react": "^16.0.0",