@backstage/ui 0.13.0 → 0.13.2

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 (99) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/components/Accordion/definition.esm.js +1 -0
  3. package/dist/components/Accordion/definition.esm.js.map +1 -1
  4. package/dist/components/Alert/definition.esm.js +1 -0
  5. package/dist/components/Alert/definition.esm.js.map +1 -1
  6. package/dist/components/Avatar/definition.esm.js +1 -0
  7. package/dist/components/Avatar/definition.esm.js.map +1 -1
  8. package/dist/components/Box/definition.esm.js +1 -0
  9. package/dist/components/Box/definition.esm.js.map +1 -1
  10. package/dist/components/Button/definition.esm.js +1 -0
  11. package/dist/components/Button/definition.esm.js.map +1 -1
  12. package/dist/components/ButtonIcon/definition.esm.js +1 -0
  13. package/dist/components/ButtonIcon/definition.esm.js.map +1 -1
  14. package/dist/components/ButtonLink/definition.esm.js +2 -0
  15. package/dist/components/ButtonLink/definition.esm.js.map +1 -1
  16. package/dist/components/Card/definition.esm.js +2 -0
  17. package/dist/components/Card/definition.esm.js.map +1 -1
  18. package/dist/components/Checkbox/definition.esm.js +1 -0
  19. package/dist/components/Checkbox/definition.esm.js.map +1 -1
  20. package/dist/components/Container/definition.esm.js +1 -0
  21. package/dist/components/Container/definition.esm.js.map +1 -1
  22. package/dist/components/Dialog/definition.esm.js +1 -0
  23. package/dist/components/Dialog/definition.esm.js.map +1 -1
  24. package/dist/components/FieldError/definition.esm.js +1 -0
  25. package/dist/components/FieldError/definition.esm.js.map +1 -1
  26. package/dist/components/FieldLabel/definition.esm.js +1 -0
  27. package/dist/components/FieldLabel/definition.esm.js.map +1 -1
  28. package/dist/components/Flex/definition.esm.js +1 -0
  29. package/dist/components/Flex/definition.esm.js.map +1 -1
  30. package/dist/components/FullPage/definition.esm.js +1 -0
  31. package/dist/components/FullPage/definition.esm.js.map +1 -1
  32. package/dist/components/Grid/definition.esm.js +1 -0
  33. package/dist/components/Grid/definition.esm.js.map +1 -1
  34. package/dist/components/Header/definition.esm.js +1 -0
  35. package/dist/components/Header/definition.esm.js.map +1 -1
  36. package/dist/components/Link/definition.esm.js +2 -0
  37. package/dist/components/Link/definition.esm.js.map +1 -1
  38. package/dist/components/List/definition.esm.js +2 -0
  39. package/dist/components/List/definition.esm.js.map +1 -1
  40. package/dist/components/Menu/definition.esm.js +3 -0
  41. package/dist/components/Menu/definition.esm.js.map +1 -1
  42. package/dist/components/PasswordField/definition.esm.js +1 -0
  43. package/dist/components/PasswordField/definition.esm.js.map +1 -1
  44. package/dist/components/PluginHeader/PluginHeader.esm.js +1 -1
  45. package/dist/components/PluginHeader/PluginHeader.esm.js.map +1 -1
  46. package/dist/components/PluginHeader/definition.esm.js +1 -0
  47. package/dist/components/PluginHeader/definition.esm.js.map +1 -1
  48. package/dist/components/Popover/definition.esm.js +1 -0
  49. package/dist/components/Popover/definition.esm.js.map +1 -1
  50. package/dist/components/RadioGroup/definition.esm.js +1 -0
  51. package/dist/components/RadioGroup/definition.esm.js.map +1 -1
  52. package/dist/components/SearchAutocomplete/SearchAutocomplete.esm.js +1 -1
  53. package/dist/components/SearchAutocomplete/SearchAutocomplete.esm.js.map +1 -1
  54. package/dist/components/SearchAutocomplete/SearchAutocomplete.module.css.esm.js +2 -2
  55. package/dist/components/SearchAutocomplete/definition.esm.js +3 -0
  56. package/dist/components/SearchAutocomplete/definition.esm.js.map +1 -1
  57. package/dist/components/SearchField/definition.esm.js +1 -0
  58. package/dist/components/SearchField/definition.esm.js.map +1 -1
  59. package/dist/components/Select/definition.esm.js +1 -0
  60. package/dist/components/Select/definition.esm.js.map +1 -1
  61. package/dist/components/Skeleton/definition.esm.js +1 -0
  62. package/dist/components/Skeleton/definition.esm.js.map +1 -1
  63. package/dist/components/Switch/definition.esm.js +1 -0
  64. package/dist/components/Switch/definition.esm.js.map +1 -1
  65. package/dist/components/Table/components/Table.esm.js +2 -1
  66. package/dist/components/Table/components/Table.esm.js.map +1 -1
  67. package/dist/components/Table/components/TableBodySkeleton.esm.js +1 -0
  68. package/dist/components/Table/components/TableBodySkeleton.esm.js.map +1 -1
  69. package/dist/components/Table/definition.esm.js +4 -0
  70. package/dist/components/Table/definition.esm.js.map +1 -1
  71. package/dist/components/Table/hooks/useCompletePagination.esm.js +10 -5
  72. package/dist/components/Table/hooks/useCompletePagination.esm.js.map +1 -1
  73. package/dist/components/Table/hooks/useTable.esm.js +28 -22
  74. package/dist/components/Table/hooks/useTable.esm.js.map +1 -1
  75. package/dist/components/TablePagination/TablePagination.esm.js +6 -4
  76. package/dist/components/TablePagination/TablePagination.esm.js.map +1 -1
  77. package/dist/components/TablePagination/definition.esm.js +3 -1
  78. package/dist/components/TablePagination/definition.esm.js.map +1 -1
  79. package/dist/components/Tabs/definition.esm.js +2 -0
  80. package/dist/components/Tabs/definition.esm.js.map +1 -1
  81. package/dist/components/TagGroup/definition.esm.js +2 -0
  82. package/dist/components/TagGroup/definition.esm.js.map +1 -1
  83. package/dist/components/Text/Text.esm.js.map +1 -1
  84. package/dist/components/Text/definition.esm.js +1 -0
  85. package/dist/components/Text/definition.esm.js.map +1 -1
  86. package/dist/components/TextField/definition.esm.js +1 -0
  87. package/dist/components/TextField/definition.esm.js.map +1 -1
  88. package/dist/components/ToggleButton/definition.esm.js +1 -0
  89. package/dist/components/ToggleButton/definition.esm.js.map +1 -1
  90. package/dist/components/ToggleButtonGroup/definition.esm.js +1 -0
  91. package/dist/components/ToggleButtonGroup/definition.esm.js.map +1 -1
  92. package/dist/components/Tooltip/definition.esm.js +1 -0
  93. package/dist/components/Tooltip/definition.esm.js.map +1 -1
  94. package/dist/components/VisuallyHidden/definition.esm.js +1 -0
  95. package/dist/components/VisuallyHidden/definition.esm.js.map +1 -1
  96. package/dist/hooks/useDefinition/useDefinition.esm.js +12 -1
  97. package/dist/hooks/useDefinition/useDefinition.esm.js.map +1 -1
  98. package/dist/index.d.ts +21 -4
  99. package/package.json +1 -1
@@ -12,8 +12,9 @@ function useCompletePagination(options, query) {
12
12
  searchFn
13
13
  } = options;
14
14
  const hasGetData = "getData" in options;
15
+ const noPagination = paginationOptions.type === "none";
15
16
  const { initialOffset = 0 } = paginationOptions;
16
- const defaultPageSize = getEffectivePageSize(paginationOptions);
17
+ const defaultPageSize = noPagination ? Infinity : getEffectivePageSize(paginationOptions);
17
18
  const getData = useStableCallback(getDataProp);
18
19
  const { sort, filter, search } = query;
19
20
  const [items, setItems] = useState(void 0);
@@ -22,6 +23,10 @@ function useCompletePagination(options, query) {
22
23
  const [loadCount, setLoadCount] = useState(0);
23
24
  const [offset, setOffset] = useState(initialOffset);
24
25
  const [pageSize, setPageSize] = useState(defaultPageSize);
26
+ useEffect(() => {
27
+ setPageSize(defaultPageSize);
28
+ setOffset(0);
29
+ }, [defaultPageSize]);
25
30
  useEffect(() => {
26
31
  if (data) {
27
32
  setIsLoading(false);
@@ -78,11 +83,11 @@ function useCompletePagination(options, query) {
78
83
  }, [resolvedItems, sort, filter, search, filterFn, searchFn, sortFn]);
79
84
  const totalCount = processedData?.length ?? 0;
80
85
  const paginatedData = useMemo(
81
- () => processedData?.slice(offset, offset + pageSize),
82
- [processedData, offset, pageSize]
86
+ () => noPagination ? processedData : processedData?.slice(offset, offset + pageSize),
87
+ [processedData, offset, pageSize, noPagination]
83
88
  );
84
- const hasNextPage = offset + pageSize < totalCount;
85
- const hasPreviousPage = offset > 0;
89
+ const hasNextPage = !noPagination && offset + pageSize < totalCount;
90
+ const hasPreviousPage = !noPagination && offset > 0;
86
91
  const onNextPage = useCallback(() => {
87
92
  if (offset + pageSize < totalCount) {
88
93
  setOffset(offset + pageSize);
@@ -1 +1 @@
1
- {"version":3,"file":"useCompletePagination.esm.js","sources":["../../../../src/components/Table/hooks/useCompletePagination.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { useState, useCallback, useMemo, useEffect, useRef } from 'react';\nimport type { TableItem } from '../types';\nimport type {\n PaginationResult,\n QueryState,\n UseTableCompleteOptions,\n} from './types';\nimport { useStableCallback } from './useStableCallback';\nimport { getEffectivePageSize } from './getEffectivePageSize';\n\n/** @internal */\nexport function useCompletePagination<T extends TableItem, TFilter>(\n options: UseTableCompleteOptions<T, TFilter>,\n query: QueryState<TFilter>,\n): PaginationResult<T> & { reload: () => void } {\n const {\n data,\n getData: getDataProp = () => [],\n paginationOptions = {},\n sortFn,\n filterFn,\n searchFn,\n } = options;\n const hasGetData = 'getData' in options;\n const { initialOffset = 0 } = paginationOptions;\n const defaultPageSize = getEffectivePageSize(paginationOptions);\n\n const getData = useStableCallback(getDataProp);\n const { sort, filter, search } = query;\n\n const [items, setItems] = useState<T[] | undefined>(undefined);\n const [isLoading, setIsLoading] = useState(!data);\n const [error, setError] = useState<Error | undefined>(undefined);\n const [loadCount, setLoadCount] = useState(0);\n\n const [offset, setOffset] = useState(initialOffset);\n const [pageSize, setPageSize] = useState(defaultPageSize);\n\n // Load data on mount and when loadCount changes (reload trigger)\n useEffect(() => {\n if (data) {\n setIsLoading(false);\n return;\n }\n\n if (!hasGetData) {\n return;\n }\n\n let cancelled = false;\n setIsLoading(true);\n setError(undefined);\n\n (async () => {\n try {\n const result = getData();\n const resolvedData = result instanceof Promise ? await result : result;\n if (!cancelled) {\n setItems(resolvedData);\n setIsLoading(false);\n }\n } catch (err) {\n if (!cancelled) {\n setError(err instanceof Error ? err : new Error(String(err)));\n setIsLoading(false);\n }\n }\n })();\n\n return () => {\n cancelled = true;\n };\n }, [data, getData, hasGetData, loadCount]);\n\n // Reset offset when query changes (query object is memoized)\n const prevQueryRef = useRef(query);\n useEffect(() => {\n if (prevQueryRef.current !== query) {\n prevQueryRef.current = query;\n setOffset(0);\n }\n }, [query]);\n\n const resolvedItems = useMemo(() => data ?? items, [data, items]);\n\n // Process data client-side (filter, search, sort)\n const processedData = useMemo(() => {\n if (!resolvedItems) {\n return undefined;\n }\n let result = [...resolvedItems];\n if (filter !== undefined && filterFn) {\n result = filterFn(result, filter);\n }\n if (search && searchFn) {\n result = searchFn(result, search);\n }\n if (sort && sortFn) {\n result = sortFn(result, sort);\n }\n return result;\n }, [resolvedItems, sort, filter, search, filterFn, searchFn, sortFn]);\n\n const totalCount = processedData?.length ?? 0;\n\n // Paginate the processed data\n const paginatedData = useMemo(\n () => processedData?.slice(offset, offset + pageSize),\n [processedData, offset, pageSize],\n );\n\n const hasNextPage = offset + pageSize < totalCount;\n const hasPreviousPage = offset > 0;\n\n const onNextPage = useCallback(() => {\n if (offset + pageSize < totalCount) {\n setOffset(offset + pageSize);\n }\n }, [offset, pageSize, totalCount]);\n\n const onPreviousPage = useCallback(() => {\n if (offset > 0) {\n setOffset(Math.max(0, offset - pageSize));\n }\n }, [offset, pageSize]);\n\n const onPageSizeChange = useCallback((newSize: number) => {\n setPageSize(newSize);\n setOffset(0);\n }, []);\n\n const reload = useCallback(() => {\n setOffset(0);\n setLoadCount(c => c + 1);\n }, []);\n\n return {\n data: paginatedData,\n loading: isLoading,\n error,\n totalCount,\n offset,\n pageSize,\n hasNextPage,\n hasPreviousPage,\n onNextPage,\n onPreviousPage,\n onPageSizeChange,\n reload,\n };\n}\n"],"names":[],"mappings":";;;;AA2BO,SAAS,qBAAA,CACd,SACA,KAAA,EAC8C;AAC9C,EAAA,MAAM;AAAA,IACJ,IAAA;AAAA,IACA,OAAA,EAAS,WAAA,GAAc,MAAM,EAAC;AAAA,IAC9B,oBAAoB,EAAC;AAAA,IACrB,MAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACF,GAAI,OAAA;AACJ,EAAA,MAAM,aAAa,SAAA,IAAa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C,CAAA;AACX,IAAA,YAAA,CAAa,CAAA,CAAA,KAAK,IAAI,CAAC,CAAA;AAAA,EACzB,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,aAAA;AAAA,IACN,OAAA,EAAS,SAAA;AAAA,IACT,KAAA;AAAA,IACA,UAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,UAAA;AAAA,IACA,cAAA;AAAA,IACA,gBAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useCompletePagination.esm.js","sources":["../../../../src/components/Table/hooks/useCompletePagination.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { useState, useCallback, useMemo, useEffect, useRef } from 'react';\nimport type { TableItem } from '../types';\nimport type {\n PaginationResult,\n QueryState,\n UseTableCompleteOptions,\n} from './types';\nimport { useStableCallback } from './useStableCallback';\nimport { getEffectivePageSize } from './getEffectivePageSize';\n\n/** @internal */\nexport function useCompletePagination<T extends TableItem, TFilter>(\n options: UseTableCompleteOptions<T, TFilter>,\n query: QueryState<TFilter>,\n): PaginationResult<T> & { reload: () => void } {\n const {\n data,\n getData: getDataProp = () => [],\n paginationOptions = {},\n sortFn,\n filterFn,\n searchFn,\n } = options;\n const hasGetData = 'getData' in options;\n const noPagination = paginationOptions.type === 'none';\n const { initialOffset = 0 } = paginationOptions;\n const defaultPageSize = noPagination\n ? Infinity\n : getEffectivePageSize(paginationOptions);\n\n const getData = useStableCallback(getDataProp);\n const { sort, filter, search } = query;\n\n const [items, setItems] = useState<T[] | undefined>(undefined);\n const [isLoading, setIsLoading] = useState(!data);\n const [error, setError] = useState<Error | undefined>(undefined);\n const [loadCount, setLoadCount] = useState(0);\n\n const [offset, setOffset] = useState(initialOffset);\n const [pageSize, setPageSize] = useState(defaultPageSize);\n\n // Sync pageSize when the caller changes paginationOptions.pageSize\n useEffect(() => {\n setPageSize(defaultPageSize);\n setOffset(0);\n }, [defaultPageSize]);\n\n // Load data on mount and when loadCount changes (reload trigger)\n useEffect(() => {\n if (data) {\n setIsLoading(false);\n return;\n }\n\n if (!hasGetData) {\n return;\n }\n\n let cancelled = false;\n setIsLoading(true);\n setError(undefined);\n\n (async () => {\n try {\n const result = getData();\n const resolvedData = result instanceof Promise ? await result : result;\n if (!cancelled) {\n setItems(resolvedData);\n setIsLoading(false);\n }\n } catch (err) {\n if (!cancelled) {\n setError(err instanceof Error ? err : new Error(String(err)));\n setIsLoading(false);\n }\n }\n })();\n\n return () => {\n cancelled = true;\n };\n }, [data, getData, hasGetData, loadCount]);\n\n // Reset offset when query changes (query object is memoized)\n const prevQueryRef = useRef(query);\n useEffect(() => {\n if (prevQueryRef.current !== query) {\n prevQueryRef.current = query;\n setOffset(0);\n }\n }, [query]);\n\n const resolvedItems = useMemo(() => data ?? items, [data, items]);\n\n // Process data client-side (filter, search, sort)\n const processedData = useMemo(() => {\n if (!resolvedItems) {\n return undefined;\n }\n let result = [...resolvedItems];\n if (filter !== undefined && filterFn) {\n result = filterFn(result, filter);\n }\n if (search && searchFn) {\n result = searchFn(result, search);\n }\n if (sort && sortFn) {\n result = sortFn(result, sort);\n }\n return result;\n }, [resolvedItems, sort, filter, search, filterFn, searchFn, sortFn]);\n\n const totalCount = processedData?.length ?? 0;\n\n // Paginate the processed data\n const paginatedData = useMemo(\n () =>\n noPagination\n ? processedData\n : processedData?.slice(offset, offset + pageSize),\n [processedData, offset, pageSize, noPagination],\n );\n\n const hasNextPage = !noPagination && offset + pageSize < totalCount;\n const hasPreviousPage = !noPagination && offset > 0;\n\n const onNextPage = useCallback(() => {\n if (offset + pageSize < totalCount) {\n setOffset(offset + pageSize);\n }\n }, [offset, pageSize, totalCount]);\n\n const onPreviousPage = useCallback(() => {\n if (offset > 0) {\n setOffset(Math.max(0, offset - pageSize));\n }\n }, [offset, pageSize]);\n\n const onPageSizeChange = useCallback((newSize: number) => {\n setPageSize(newSize);\n setOffset(0);\n }, []);\n\n const reload = useCallback(() => {\n setOffset(0);\n setLoadCount(c => c + 1);\n }, []);\n\n return {\n data: paginatedData,\n loading: isLoading,\n error,\n totalCount,\n offset,\n pageSize,\n hasNextPage,\n hasPreviousPage,\n onNextPage,\n onPreviousPage,\n onPageSizeChange,\n reload,\n };\n}\n"],"names":[],"mappings":";;;;AA2BO,SAAS,qBAAA,CACd,SACA,KAAA,EAC8C;AAC9C,EAAA,MAAM;AAAA,IACJ,IAAA;AAAA,IACA,OAAA,EAAS,WAAA,GAAc,MAAM,EAAC;AAAA,IAC9B,oBAAoB,EAAC;AAAA,IACrB,MAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACF,GAAI,OAAA;AACJ,EAAA,MAAM,aAAa,SAAA,IAAa,OAAA;AAChC,EAAA,MAAM,YAAA,GAAe,kBAAkB,IAAA,KAAS,MAAA;AAChD,EAAA,MAAM,EAAE,aAAA,GAAgB,CAAA,EAAE,GAAI,iBAAA;AAC9B,EAAA,MAAM,eAAA,GAAkB,YAAA,GACpB,QAAA,GACA,oBAAA,CAAqB,iBAAiB,CAAA;AAE1C,EAAA,MAAM,OAAA,GAAU,kBAAkB,WAAW,CAAA;AAC7C,EAAA,MAAM,EAAE,IAAA,EAAM,MAAA,EAAQ,MAAA,EAAO,GAAI,KAAA;AAEjC,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAA0B,MAAS,CAAA;AAC7D,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,QAAA,CAAS,CA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SAAA;AAAA,IACT,KAAA;AAAA,IACA,UAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,UAAA;AAAA,IACA,cAAA;AAAA,IACA,gBAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
@@ -11,7 +11,8 @@ function useTableProps(paginationResult, sortState, paginationOptions = {}) {
11
11
  onPageSizeChange: onPageSizeChangeCallback,
12
12
  onNextPage: onNextPageCallback,
13
13
  onPreviousPage: onPreviousPageCallback,
14
- getLabel
14
+ getLabel,
15
+ showPaginationLabel
15
16
  } = paginationOptions;
16
17
  const previousDataRef = useRef(paginationResult.data);
17
18
  if (paginationResult.data) {
@@ -19,8 +20,11 @@ function useTableProps(paginationResult, sortState, paginationOptions = {}) {
19
20
  }
20
21
  const displayData = paginationResult.data ?? previousDataRef.current;
21
22
  const isStale = paginationResult.loading && displayData !== void 0;
22
- const pagination = useMemo(
23
- () => ({
23
+ const pagination = useMemo(() => {
24
+ if (paginationOptions.type === "none") {
25
+ return { type: "none" };
26
+ }
27
+ return {
24
28
  type: "page",
25
29
  pageSize: paginationResult.pageSize,
26
30
  pageSizeOptions,
@@ -41,23 +45,27 @@ function useTableProps(paginationResult, sortState, paginationOptions = {}) {
41
45
  onPageSizeChangeCallback?.(size);
42
46
  },
43
47
  showPageSizeOptions,
44
- getLabel
45
- }),
46
- [
47
- paginationResult.pageSize,
48
- pageSizeOptions,
49
- paginationResult.offset,
50
- paginationResult.totalCount,
51
- paginationResult.hasNextPage,
52
- paginationResult.hasPreviousPage,
53
- paginationResult.onNextPage,
54
- paginationResult.onPreviousPage,
55
- paginationResult.onPageSizeChange,
56
- onNextPageCallback,
57
- onPreviousPageCallback,
58
- onPageSizeChangeCallback
59
- ]
60
- );
48
+ getLabel,
49
+ showPaginationLabel
50
+ };
51
+ }, [
52
+ paginationOptions.type,
53
+ paginationResult.pageSize,
54
+ pageSizeOptions,
55
+ paginationResult.offset,
56
+ paginationResult.totalCount,
57
+ paginationResult.hasNextPage,
58
+ paginationResult.hasPreviousPage,
59
+ paginationResult.onNextPage,
60
+ paginationResult.onPreviousPage,
61
+ paginationResult.onPageSizeChange,
62
+ onNextPageCallback,
63
+ onPreviousPageCallback,
64
+ onPageSizeChangeCallback,
65
+ showPageSizeOptions,
66
+ getLabel,
67
+ showPaginationLabel
68
+ ]);
61
69
  return useMemo(
62
70
  () => ({
63
71
  data: displayData,
@@ -73,8 +81,6 @@ function useTableProps(paginationResult, sortState, paginationOptions = {}) {
73
81
  isStale,
74
82
  paginationResult.error,
75
83
  pagination,
76
- showPageSizeOptions,
77
- getLabel,
78
84
  sortState
79
85
  ]
80
86
  );
@@ -1 +1 @@
1
- {"version":3,"file":"useTable.esm.js","sources":["../../../../src/components/Table/hooks/useTable.ts"],"sourcesContent":["/*\n * Copyright 2025 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 */\nimport { useMemo, useRef } from 'react';\nimport type { SortState, TableItem, TableProps } from '../types';\nimport type {\n PaginationOptions,\n PaginationResult,\n UseTableOptions,\n UseTableResult,\n} from './types';\nimport { useQueryState } from './useQueryState';\nimport { useCompletePagination } from './useCompletePagination';\nimport { useCursorPagination } from './useCursorPagination';\nimport { useOffsetPagination } from './useOffsetPagination';\n\nfunction useTableProps<T extends TableItem>(\n paginationResult: PaginationResult<T>,\n sortState: SortState,\n paginationOptions: PaginationOptions = {},\n): Omit<\n TableProps<T>,\n 'columnConfig' | 'rowConfig' | 'selection' | 'emptyState'\n> {\n const {\n showPageSizeOptions = true,\n pageSizeOptions,\n onPageSizeChange: onPageSizeChangeCallback,\n onNextPage: onNextPageCallback,\n onPreviousPage: onPreviousPageCallback,\n getLabel,\n } = paginationOptions;\n\n const previousDataRef = useRef(paginationResult.data);\n if (paginationResult.data) {\n previousDataRef.current = paginationResult.data;\n }\n\n const displayData = paginationResult.data ?? previousDataRef.current;\n const isStale = paginationResult.loading && displayData !== undefined;\n\n const pagination = useMemo(\n () => ({\n type: 'page' as const,\n pageSize: paginationResult.pageSize,\n pageSizeOptions,\n offset: paginationResult.offset,\n totalCount: paginationResult.totalCount,\n hasNextPage: paginationResult.hasNextPage,\n hasPreviousPage: paginationResult.hasPreviousPage,\n onNextPage: () => {\n paginationResult.onNextPage();\n onNextPageCallback?.();\n },\n onPreviousPage: () => {\n paginationResult.onPreviousPage();\n onPreviousPageCallback?.();\n },\n onPageSizeChange: (size: number) => {\n paginationResult.onPageSizeChange(size);\n onPageSizeChangeCallback?.(size);\n },\n showPageSizeOptions,\n getLabel,\n }),\n [\n paginationResult.pageSize,\n pageSizeOptions,\n paginationResult.offset,\n paginationResult.totalCount,\n paginationResult.hasNextPage,\n paginationResult.hasPreviousPage,\n paginationResult.onNextPage,\n paginationResult.onPreviousPage,\n paginationResult.onPageSizeChange,\n onNextPageCallback,\n onPreviousPageCallback,\n onPageSizeChangeCallback,\n ],\n );\n\n return useMemo(\n () => ({\n data: displayData,\n loading: paginationResult.loading,\n isStale,\n error: paginationResult.error,\n pagination,\n sort: sortState,\n }),\n [\n displayData,\n paginationResult.loading,\n isStale,\n paginationResult.error,\n pagination,\n showPageSizeOptions,\n getLabel,\n sortState,\n ],\n );\n}\n\n/** @public */\nexport function useTable<T extends TableItem, TFilter = unknown>(\n options: UseTableOptions<T, TFilter>,\n): UseTableResult<T, TFilter> {\n const query = useQueryState<TFilter>(options);\n\n const initialModeRef = useRef(options.mode);\n if (initialModeRef.current !== options.mode) {\n throw new Error(\n `useTable mode cannot change from '${initialModeRef.current}' to '${options.mode}'. ` +\n `The mode must remain stable for the lifetime of the component.`,\n );\n }\n\n let pagination: PaginationResult<T> & { reload: () => void };\n\n if (options.mode === 'complete') {\n pagination = useCompletePagination(options, query);\n } else if (options.mode === 'offset') {\n pagination = useOffsetPagination(options, query);\n } else if (options.mode === 'cursor') {\n pagination = useCursorPagination(options, query);\n } else {\n throw new Error('Invalid mode');\n }\n\n const sortState: SortState = useMemo(\n () => ({ descriptor: query.sort, onSortChange: query.setSort }),\n [query.sort, query.setSort],\n );\n\n const tableProps = useTableProps(\n pagination,\n sortState,\n options.paginationOptions ?? {},\n );\n\n return {\n tableProps,\n reload: pagination.reload,\n filter: { value: query.filter, onChange: query.setFilter },\n search: { value: query.search, onChange: query.setSearch },\n };\n}\n"],"names":[],"mappings":";;;;;;AA4BA,SAAS,aAAA,CACP,gBAAA,EACA,SAAA,EACA,iBAAA,GAAuC,EAAC,EAIxC;AACA,EAAA,MAAM;AAAA,IACJ,mBAAA,GAAsB,IAAA;AAAA,IACtB,eAAA;AAAA,IACA,gBAAA,EAAkB,wBAAA;AAAA,IAClB,UAAA,EAAY,kBAAA;AAAA,IACZ,cAAA,EAAgB,sBAAA;AAAA,IAChB;AAAA,GACF,GAAI,iBAAA;AAEJ,EAAA,MAAM,eAAA,GAAkB,MAAA,CAAO,gBAAA,CAAiB,IAAI,CAAA;AACpD,EAAA,IAAI,iBAAiB,IAAA,EAAM;AACzB,IAAA,eAAA,CAAgB,UAAU,gBAAA,CAAiB,IAAA;AAAA,EAC7C;AAEA,EAAA,MAAM,WAAA,GAAc,gBAAA,CAAiB,IAAA,IAAQ,eAAA,CAAgB,OAAA;AAC7D,EAAA,MAAM,OAAA,GAAU,gBAAA,CAAiB,OAAA,IAAW,WAAA,KAAgB,MAAA;AAE5D,EAAA,MAAM,UAAA,GAAa,OAAA;AAAA,IACjB,OAAO;AAAA,MACL,IAAA,EAAM,MAAA;AAAA,MACN,UAAU,gBAAA,CAAiB,QAAA;AAAA,MAC3B,eAAA;AAAA,MACA,QAAQ,gBAAA,CAAiB,MAAA;AAAA,MACzB,YAAY,gB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ACA,QAAQ,UAAA,CAAW,MAAA;AAAA,IACnB,QAAQ,EAAE,KAAA,EAAO,MAAM,MAAA,EAAQ,QAAA,EAAU,MAAM,SAAA,EAAU;AAAA,IACzD,QAAQ,EAAE,KAAA,EAAO,MAAM,MAAA,EAAQ,QAAA,EAAU,MAAM,SAAA;AAAU,GAC3D;AACF;;;;"}
1
+ {"version":3,"file":"useTable.esm.js","sources":["../../../../src/components/Table/hooks/useTable.ts"],"sourcesContent":["/*\n * Copyright 2025 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 */\nimport { useMemo, useRef } from 'react';\nimport type { SortState, TableItem, TableProps } from '../types';\nimport type {\n PaginationResult,\n UseTableCompleteOptions,\n UseTableCursorOptions,\n UseTableOffsetOptions,\n UseTableOptions,\n UseTableResult,\n} from './types';\nimport { useQueryState } from './useQueryState';\nimport { useCompletePagination } from './useCompletePagination';\nimport { useCursorPagination } from './useCursorPagination';\nimport { useOffsetPagination } from './useOffsetPagination';\n\nfunction useTableProps<T extends TableItem>(\n paginationResult: PaginationResult<T>,\n sortState: SortState,\n paginationOptions: UseTableCompleteOptions<T>['paginationOptions'] = {},\n): Omit<\n TableProps<T>,\n 'columnConfig' | 'rowConfig' | 'selection' | 'emptyState'\n> {\n const {\n showPageSizeOptions = true,\n pageSizeOptions,\n onPageSizeChange: onPageSizeChangeCallback,\n onNextPage: onNextPageCallback,\n onPreviousPage: onPreviousPageCallback,\n getLabel,\n showPaginationLabel,\n } = paginationOptions;\n\n const previousDataRef = useRef(paginationResult.data);\n if (paginationResult.data) {\n previousDataRef.current = paginationResult.data;\n }\n\n const displayData = paginationResult.data ?? previousDataRef.current;\n const isStale = paginationResult.loading && displayData !== undefined;\n\n const pagination = useMemo(() => {\n if (paginationOptions.type === 'none') {\n return { type: 'none' as const };\n }\n return {\n type: 'page' as const,\n pageSize: paginationResult.pageSize,\n pageSizeOptions,\n offset: paginationResult.offset,\n totalCount: paginationResult.totalCount,\n hasNextPage: paginationResult.hasNextPage,\n hasPreviousPage: paginationResult.hasPreviousPage,\n onNextPage: () => {\n paginationResult.onNextPage();\n onNextPageCallback?.();\n },\n onPreviousPage: () => {\n paginationResult.onPreviousPage();\n onPreviousPageCallback?.();\n },\n onPageSizeChange: (size: number) => {\n paginationResult.onPageSizeChange(size);\n onPageSizeChangeCallback?.(size);\n },\n showPageSizeOptions,\n getLabel,\n showPaginationLabel,\n };\n }, [\n paginationOptions.type,\n paginationResult.pageSize,\n pageSizeOptions,\n paginationResult.offset,\n paginationResult.totalCount,\n paginationResult.hasNextPage,\n paginationResult.hasPreviousPage,\n paginationResult.onNextPage,\n paginationResult.onPreviousPage,\n paginationResult.onPageSizeChange,\n onNextPageCallback,\n onPreviousPageCallback,\n onPageSizeChangeCallback,\n showPageSizeOptions,\n getLabel,\n showPaginationLabel,\n ]);\n\n return useMemo(\n () => ({\n data: displayData,\n loading: paginationResult.loading,\n isStale,\n error: paginationResult.error,\n pagination,\n sort: sortState,\n }),\n [\n displayData,\n paginationResult.loading,\n isStale,\n paginationResult.error,\n pagination,\n sortState,\n ],\n );\n}\n\n/** @public */\nexport function useTable<T extends TableItem, TFilter = unknown>(\n options: UseTableCompleteOptions<T, TFilter>,\n): UseTableResult<T, TFilter>;\n/** @public */\nexport function useTable<T extends TableItem, TFilter = unknown>(\n options: UseTableOffsetOptions<T, TFilter>,\n): UseTableResult<T, TFilter>;\n/** @public */\nexport function useTable<T extends TableItem, TFilter = unknown>(\n options: UseTableCursorOptions<T, TFilter>,\n): UseTableResult<T, TFilter>;\nexport function useTable<T extends TableItem, TFilter = unknown>(\n options: UseTableOptions<T, TFilter>,\n): UseTableResult<T, TFilter> {\n const query = useQueryState<TFilter>(options);\n\n const initialModeRef = useRef(options.mode);\n if (initialModeRef.current !== options.mode) {\n throw new Error(\n `useTable mode cannot change from '${initialModeRef.current}' to '${options.mode}'. ` +\n `The mode must remain stable for the lifetime of the component.`,\n );\n }\n\n let pagination: PaginationResult<T> & { reload: () => void };\n\n if (options.mode === 'complete') {\n pagination = useCompletePagination(options, query);\n } else if (options.mode === 'offset') {\n pagination = useOffsetPagination(options, query);\n } else if (options.mode === 'cursor') {\n pagination = useCursorPagination(options, query);\n } else {\n throw new Error('Invalid mode');\n }\n\n const sortState: SortState = useMemo(\n () => ({ descriptor: query.sort, onSortChange: query.setSort }),\n [query.sort, query.setSort],\n );\n\n const tableProps = useTableProps(\n pagination,\n sortState,\n options.paginationOptions ?? {},\n );\n\n return {\n tableProps,\n reload: pagination.reload,\n filter: { value: query.filter, onChange: query.setFilter },\n search: { value: query.search, onChange: query.setSearch },\n };\n}\n"],"names":[],"mappings":";;;;;;AA8BA,SAAS,aAAA,CACP,gBAAA,EACA,SAAA,EACA,iBAAA,GAAqE,EAAC,EAItE;AACA,EAAA,MAAM;AAAA,IACJ,mBAAA,GAAsB,IAAA;AAAA,IACtB,eAAA;AAAA,IACA,gBAAA,EAAkB,wBAAA;AAAA,IAClB,UAAA,EAAY,kBAAA;AAAA,IACZ,cAAA,EAAgB,sBAAA;AAAA,IAChB,QAAA;AAAA,IACA;AAAA,GACF,GAAI,iBAAA;AAEJ,EAAA,MAAM,eAAA,GAAkB,MAAA,CAAO,gBAAA,CAAiB,IAAI,CAAA;AACpD,EAAA,IAAI,iBAAiB,IAAA,EAAM;AACzB,IAAA,eAAA,CAAgB,UAAU,gBAAA,CAAiB,IAAA;AAAA,EAC7C;AAEA,EAAA,MAAM,WAAA,GAAc,gBAAA,CAAiB,IAAA,IAAQ,eAAA,CAAgB,OAAA;AAC7D,EAAA,MAAM,OAAA,GAAU,gBAAA,CAAiB,OAAA,IAAW,WAAA,KAAg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AI,MAAM,cAAc,CAAA;AAAA,EAChC;AAEA,EAAA,MAAM,SAAA,GAAuB,OAAA;AAAA,IAC3B,OAAO,EAAE,UAAA,EAAY,MAAM,IAAA,EAAM,YAAA,EAAc,MAAM,OAAA,EAAQ,CAAA;AAAA,IAC7D,CAAC,KAAA,CAAM,IAAA,EAAM,KAAA,CAAM,OAAO;AAAA,GAC5B;AAEA,EAAA,MAAM,UAAA,GAAa,aAAA;AAAA,IACjB,UAAA;AAAA,IACA,SAAA;AAAA,IACA,OAAA,CAAQ,qBAAqB;AAAC,GAChC;AAEA,EAAA,OAAO;AAAA,IACL,UAAA;AAAA,IACA,QAAQ,UAAA,CAAW,MAAA;AAAA,IACnB,QAAQ,EAAE,KAAA,EAAO,MAAM,MAAA,EAAQ,QAAA,EAAU,MAAM,SAAA,EAAU;AAAA,IACzD,QAAQ,EAAE,KAAA,EAAO,MAAM,MAAA,EAAQ,QAAA,EAAU,MAAM,SAAA;AAAU,GAC3D;AACF;;;;"}
@@ -40,7 +40,8 @@ function TablePagination(props) {
40
40
  onPreviousPage,
41
41
  onPageSizeChange,
42
42
  showPageSizeOptions,
43
- getLabel
43
+ getLabel,
44
+ showPaginationLabel
44
45
  } = ownProps;
45
46
  const labelId = useId();
46
47
  const normalizedOptions = useMemo(
@@ -61,6 +62,7 @@ function TablePagination(props) {
61
62
  return firstValue;
62
63
  }, [pageSize, pageSizeOptions]);
63
64
  const hasItems = totalCount !== void 0 && totalCount !== 0;
65
+ const showLabel = hasItems && showPaginationLabel !== false;
64
66
  let label = `${totalCount} items`;
65
67
  if (getLabel) {
66
68
  label = getLabel({ pageSize: effectivePageSize, offset, totalCount });
@@ -89,7 +91,7 @@ function TablePagination(props) {
89
91
  }
90
92
  ) }),
91
93
  /* @__PURE__ */ jsxs("div", { className: classes.right, children: [
92
- hasItems && /* @__PURE__ */ jsx(Text, { as: "p", variant: "body-medium", id: labelId, children: label }),
94
+ showLabel && /* @__PURE__ */ jsx(Text, { as: "p", variant: "body-medium", id: labelId, children: label }),
93
95
  /* @__PURE__ */ jsx(
94
96
  ButtonIcon,
95
97
  {
@@ -99,7 +101,7 @@ function TablePagination(props) {
99
101
  isDisabled: !hasPreviousPage,
100
102
  icon: /* @__PURE__ */ jsx(RiArrowLeftSLine, {}),
101
103
  "aria-label": "Previous table page",
102
- "aria-describedby": hasItems ? labelId : void 0
104
+ "aria-describedby": showLabel ? labelId : void 0
103
105
  }
104
106
  ),
105
107
  /* @__PURE__ */ jsx(
@@ -111,7 +113,7 @@ function TablePagination(props) {
111
113
  isDisabled: !hasNextPage,
112
114
  icon: /* @__PURE__ */ jsx(RiArrowRightSLine, {}),
113
115
  "aria-label": "Next table page",
114
- "aria-describedby": hasItems ? labelId : void 0
116
+ "aria-describedby": showLabel ? labelId : void 0
115
117
  }
116
118
  )
117
119
  ] })
@@ -1 +1 @@
1
- {"version":3,"file":"TablePagination.esm.js","sources":["../../../src/components/TablePagination/TablePagination.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 { useId } from 'react-aria';\nimport { Text } from '../Text';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Select } from '../Select';\nimport type { TablePaginationProps, PageSizeOption } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TablePaginationDefinition } from './definition';\nimport { RiArrowLeftSLine, RiArrowRightSLine } from '@remixicon/react';\nimport { useMemo } from 'react';\n\nfunction getOptionValue(option: number | PageSizeOption): number {\n return typeof option === 'number' ? option : option.value;\n}\n\nfunction isNumberArray(\n options: number[] | PageSizeOption[],\n): options is number[] {\n return options.length > 0 && typeof options[0] === 'number';\n}\n\nfunction normalizePageSizeOptions(\n options: number[] | PageSizeOption[],\n): PageSizeOption[] {\n if (isNumberArray(options)) {\n return options.map(value => ({\n label: `Show ${value} results`,\n value,\n }));\n }\n return options;\n}\n\n/**\n * Pagination controls for Table components with page navigation and size selection.\n *\n * @public\n */\nexport function TablePagination(props: TablePaginationProps) {\n const { ownProps } = useDefinition(TablePaginationDefinition, props);\n const {\n classes,\n pageSize,\n pageSizeOptions,\n offset,\n totalCount,\n hasNextPage,\n hasPreviousPage,\n onNextPage,\n onPreviousPage,\n onPageSizeChange,\n showPageSizeOptions,\n getLabel,\n } = ownProps;\n\n const labelId = useId();\n const normalizedOptions = useMemo(\n () => normalizePageSizeOptions(pageSizeOptions),\n [pageSizeOptions],\n );\n\n const effectivePageSize = useMemo(() => {\n const isValid = pageSizeOptions.some(\n opt => getOptionValue(opt) === pageSize,\n );\n if (isValid) {\n return pageSize;\n }\n const firstValue = getOptionValue(pageSizeOptions[0]);\n console.warn(\n `TablePagination: pageSize ${pageSize} is not in pageSizeOptions, using ${firstValue} instead`,\n );\n return firstValue;\n }, [pageSize, pageSizeOptions]);\n\n const hasItems = totalCount !== undefined && totalCount !== 0;\n\n let label = `${totalCount} items`;\n if (getLabel) {\n label = getLabel({ pageSize: effectivePageSize, offset, totalCount });\n } else if (offset !== undefined) {\n const fromCount = offset + 1;\n const toCount = Math.min(offset + effectivePageSize, totalCount ?? 0);\n label = `${fromCount} - ${toCount} of ${totalCount}`;\n }\n\n return (\n <div className={classes.root}>\n <div className={classes.left}>\n {showPageSizeOptions && (\n <Select\n name=\"pageSize\"\n size=\"small\"\n aria-label=\"Select table page size\"\n options={normalizedOptions.map(opt => ({\n label: opt.label,\n value: String(opt.value),\n }))}\n defaultValue={effectivePageSize.toString()}\n onChange={value => {\n const newPageSize = Number(value);\n onPageSizeChange?.(newPageSize);\n }}\n className={classes.select}\n />\n )}\n </div>\n <div className={classes.right}>\n {hasItems && (\n <Text as=\"p\" variant=\"body-medium\" id={labelId}>\n {label}\n </Text>\n )}\n <ButtonIcon\n variant=\"secondary\"\n size=\"small\"\n onClick={onPreviousPage}\n isDisabled={!hasPreviousPage}\n icon={<RiArrowLeftSLine />}\n aria-label=\"Previous table page\"\n aria-describedby={hasItems ? labelId : undefined}\n />\n <ButtonIcon\n variant=\"secondary\"\n size=\"small\"\n onClick={onNextPage}\n isDisabled={!hasNextPage}\n icon={<RiArrowRightSLine />}\n aria-label=\"Next table page\"\n aria-describedby={hasItems ? labelId : undefined}\n />\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AA0BA,SAAS,eAAe,MAAA,EAAyC;AAC/D,EAAA,OAAO,OAAO,MAAA,KAAW,QAAA,GAAW,MAAA,GAAS,MAAA,CAAO,KAAA;AACtD;AAEA,SAAS,cACP,OAAA,EACqB;AACrB,EAAA,OAAO,QAAQ,MAAA,GAAS,CAAA,IAAK,OAAO,OAAA,CAAQ,CAAC,CAAA,KAAM,QAAA;AACrD;AAEA,SAAS,yBACP,OAAA,EACkB;AAClB,EAAA,IAAI,aAAA,CAAc,OAAO,CAAA,EAAG;AAC1B,IAAA,OAAO,OAAA,CAAQ,IAAI,CAAA,KAAA,MAAU;AAAA,MAC3B,KAAA,EAAO,QAAQ,KAAK,CAAA,QAAA,CAAA;AAAA,MACpB;AAAA,KACF,CAAE,CAAA;AAAA,EACJ;AACA,EAAA,OAAO,OAAA;AACT;AAOO,SAAS,gBAAgB,KAAA,EAA6B;AAC3D,EAAA,MAAM,EAAE,QAAA,EAAS,GAAI,aAAA,CAAc,2BAA2B,KAAK,CAAA;AACnE,EAAA,MAAM;AAAA,IACJ,OAAA;AAAA,IACA,QAAA;AAAA,IACA,eAAA;AAAA,IACA,MAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,UAAA;AAAA,IACA,cAAA;AAAA,IACA,gBAAA;AAAA,IACA,mBAAA;AAAA,IACA;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AkB,WAAW,OAAA,GAAU;AAAA;AAAA,OACzC;AAAA,sBACA,GAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,OAAA,EAAQ,WAAA;AAAA,UACR,IAAA,EAAK,OAAA;AAAA,UACL,OAAA,EAAS,UAAA;AAAA,UACT,YAAY,CAAC,WAAA;AAAA,UACb,IAAA,sBAAO,iBAAA,EAAA,EAAkB,CAAA;AAAA,UACzB,YAAA,EAAW,iBAAA;AAAA,UACX,kBAAA,EAAkB,WAAW,OAAA,GAAU;AAAA;AAAA;AACzC,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TablePagination.esm.js","sources":["../../../src/components/TablePagination/TablePagination.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 { useId } from 'react-aria';\nimport { Text } from '../Text';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Select } from '../Select';\nimport type { TablePaginationProps, PageSizeOption } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TablePaginationDefinition } from './definition';\nimport { RiArrowLeftSLine, RiArrowRightSLine } from '@remixicon/react';\nimport { useMemo } from 'react';\n\nfunction getOptionValue(option: number | PageSizeOption): number {\n return typeof option === 'number' ? option : option.value;\n}\n\nfunction isNumberArray(\n options: number[] | PageSizeOption[],\n): options is number[] {\n return options.length > 0 && typeof options[0] === 'number';\n}\n\nfunction normalizePageSizeOptions(\n options: number[] | PageSizeOption[],\n): PageSizeOption[] {\n if (isNumberArray(options)) {\n return options.map(value => ({\n label: `Show ${value} results`,\n value,\n }));\n }\n return options;\n}\n\n/**\n * Pagination controls for Table components with page navigation and size selection.\n *\n * @public\n */\nexport function TablePagination(props: TablePaginationProps) {\n const { ownProps } = useDefinition(TablePaginationDefinition, props);\n const {\n classes,\n pageSize,\n pageSizeOptions,\n offset,\n totalCount,\n hasNextPage,\n hasPreviousPage,\n onNextPage,\n onPreviousPage,\n onPageSizeChange,\n showPageSizeOptions,\n getLabel,\n showPaginationLabel,\n } = ownProps;\n\n const labelId = useId();\n const normalizedOptions = useMemo(\n () => normalizePageSizeOptions(pageSizeOptions),\n [pageSizeOptions],\n );\n\n const effectivePageSize = useMemo(() => {\n const isValid = pageSizeOptions.some(\n opt => getOptionValue(opt) === pageSize,\n );\n if (isValid) {\n return pageSize;\n }\n const firstValue = getOptionValue(pageSizeOptions[0]);\n console.warn(\n `TablePagination: pageSize ${pageSize} is not in pageSizeOptions, using ${firstValue} instead`,\n );\n return firstValue;\n }, [pageSize, pageSizeOptions]);\n\n const hasItems = totalCount !== undefined && totalCount !== 0;\n\n const showLabel = hasItems && showPaginationLabel !== false;\n\n let label = `${totalCount} items`;\n if (getLabel) {\n label = getLabel({ pageSize: effectivePageSize, offset, totalCount });\n } else if (offset !== undefined) {\n const fromCount = offset + 1;\n const toCount = Math.min(offset + effectivePageSize, totalCount ?? 0);\n label = `${fromCount} - ${toCount} of ${totalCount}`;\n }\n\n return (\n <div className={classes.root}>\n <div className={classes.left}>\n {showPageSizeOptions && (\n <Select\n name=\"pageSize\"\n size=\"small\"\n aria-label=\"Select table page size\"\n options={normalizedOptions.map(opt => ({\n label: opt.label,\n value: String(opt.value),\n }))}\n defaultValue={effectivePageSize.toString()}\n onChange={value => {\n const newPageSize = Number(value);\n onPageSizeChange?.(newPageSize);\n }}\n className={classes.select}\n />\n )}\n </div>\n <div className={classes.right}>\n {showLabel && (\n <Text as=\"p\" variant=\"body-medium\" id={labelId}>\n {label}\n </Text>\n )}\n <ButtonIcon\n variant=\"secondary\"\n size=\"small\"\n onClick={onPreviousPage}\n isDisabled={!hasPreviousPage}\n icon={<RiArrowLeftSLine />}\n aria-label=\"Previous table page\"\n aria-describedby={showLabel ? labelId : undefined}\n />\n <ButtonIcon\n variant=\"secondary\"\n size=\"small\"\n onClick={onNextPage}\n isDisabled={!hasNextPage}\n icon={<RiArrowRightSLine />}\n aria-label=\"Next table page\"\n aria-describedby={showLabel ? labelId : undefined}\n />\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AA0BA,SAAS,eAAe,MAAA,EAAyC;AAC/D,EAAA,OAAO,OAAO,MAAA,KAAW,QAAA,GAAW,MAAA,GAAS,MAAA,CAAO,KAAA;AACtD;AAEA,SAAS,cACP,OAAA,EACqB;AACrB,EAAA,OAAO,QAAQ,MAAA,GAAS,CAAA,IAAK,OAAO,OAAA,CAAQ,CAAC,CAAA,KAAM,QAAA;AACrD;AAEA,SAAS,yBACP,OAAA,EACkB;AAClB,EAAA,IAAI,aAAA,CAAc,OAAO,CAAA,EAAG;AAC1B,IAAA,OAAO,OAAA,CAAQ,IAAI,CAAA,KAAA,MAAU;AAAA,MAC3B,KAAA,EAAO,QAAQ,KAAK,CAAA,QAAA,CAAA;AAAA,MACpB;AAAA,KACF,CAAE,CAAA;AAAA,EACJ;AACA,EAAA,OAAO,OAAA;AACT;AAOO,SAAS,gBAAgB,KAAA,EAA6B;AAC3D,EAAA,MAAM,EAAE,QAAA,EAAS,GAAI,aAAA,CAAc,2BAA2B,KAAK,CAAA;AACnE,EAAA,MAAM;AAAA,IACJ,OAAA;AAAA,IACA,QAAA;AAAA,IACA,eAAA;AAAA,IACA,MAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,UAAA;AAAA,IACA,cAAA;AAAA,IACA,gBAAA;AAAA,IACA,mBAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACF,GAAI,QAAA;AAEJ,EAAA,MAAM,UAAU,KAAA,EAAM;AACtB,EAA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AAA,GAAU;AAAA;AAAA,OAC1C;AAAA,sBACA,GAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,OAAA,EAAQ,WAAA;AAAA,UACR,IAAA,EAAK,OAAA;AAAA,UACL,OAAA,EAAS,UAAA;AAAA,UACT,YAAY,CAAC,WAAA;AAAA,UACb,IAAA,sBAAO,iBAAA,EAAA,EAAkB,CAAA;AAAA,UACzB,YAAA,EAAW,iBAAA;AAAA,UACX,kBAAA,EAAkB,YAAY,OAAA,GAAU;AAAA;AAAA;AAC1C,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
@@ -4,6 +4,7 @@ import '../../hooks/useBreakpoint.esm.js';
4
4
  import '../../hooks/useBg.esm.js';
5
5
  import '../../hooks/useDefinition/helpers.esm.js';
6
6
  import '../../analytics/useAnalytics.esm.js';
7
+ import 'react-router-dom';
7
8
  import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
8
9
  import styles from './TablePagination.module.css.esm.js';
9
10
 
@@ -34,7 +35,8 @@ const TablePaginationDefinition = defineComponent()({
34
35
  onPreviousPage: {},
35
36
  onPageSizeChange: {},
36
37
  showPageSizeOptions: { default: true },
37
- getLabel: {}
38
+ getLabel: {},
39
+ showPaginationLabel: { default: true }
38
40
  }
39
41
  });
40
42
 
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/TablePagination/definition.ts"],"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 { defineComponent } from '../../hooks/useDefinition';\nimport type { TablePaginationOwnProps, PageSizeOption } from './types';\nimport styles from './TablePagination.module.css';\n\nconst DEFAULT_PAGE_SIZE_OPTIONS: PageSizeOption[] = [\n { label: 'Show 5 results', value: 5 },\n { label: 'Show 10 results', value: 10 },\n { label: 'Show 20 results', value: 20 },\n { label: 'Show 30 results', value: 30 },\n { label: 'Show 40 results', value: 40 },\n { label: 'Show 50 results', value: 50 },\n];\n\n/**\n * Component definition for TablePagination\n * @public\n */\nexport const TablePaginationDefinition =\n defineComponent<TablePaginationOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TablePagination',\n left: 'bui-TablePaginationLeft',\n right: 'bui-TablePaginationRight',\n select: 'bui-TablePaginationSelect',\n },\n propDefs: {\n pageSize: {},\n pageSizeOptions: { default: DEFAULT_PAGE_SIZE_OPTIONS },\n offset: {},\n totalCount: {},\n hasNextPage: {},\n hasPreviousPage: {},\n onNextPage: {},\n onPreviousPage: {},\n onPageSizeChange: {},\n showPageSizeOptions: { default: true },\n getLabel: {},\n },\n });\n"],"names":[],"mappings":";;;;;;;;;AAoBA,MAAM,yBAAA,GAA8C;AAAA,EAClD,EAAE,KAAA,EAAO,gBAAA,EAAkB,KAAA,EAAO,CAAA,EAAE;AAAA,EACpC,EAAE,KAAA,EAAO,iBAAA,EAAmB,KAAA,EAAO,EAAA,EAAG;AAAA,EACtC,EAAE,KAAA,EAAO,iBAAA,EAAmB,KAAA,EAAO,EAAA,EAAG;AAAA,EACtC,EAAE,KAAA,EAAO,iBAAA,EAAmB,KAAA,EAAO,EAAA,EAAG;AAAA,EACtC,EAAE,KAAA,EAAO,iBAAA,EAAmB,KAAA,EAAO,EAAA,EAAG;AAAA,EACtC,EAAE,KAAA,EAAO,iBAAA,EAAmB,KAAA,EAAO,EAAA;AACrC,CAAA;AAMO,MAAM,yBAAA,GACX,iBAAyC,CAAE;AAAA,EACzC,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,qBAAA;AAAA,IACN,IAAA,EAAM,yBAAA;AAAA,IACN,KAAA,EAAO,0BAAA;AAAA,IACP,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,QAAA,EAAU;AAAA,IACR,UAAU,EAAC;AAAA,IACX,eAAA,EAAiB,EAAE,OAAA,EAAS,yBAAA,EAA0B;AAAA,IACtD,QAAQ,EAAC;AAAA,IACT,YAAY,EAAC;AAAA,IACb,aAAa,EAAC;AAAA,IACd,iBAAiB,EAAC;AAAA,IAClB,YAAY,EAAC;AAAA,IACb,gBAAgB,EAAC;AAAA,IACjB,kBAAkB,EAAC;AAAA,IACnB,mBAAA,EAAqB,EAAE,OAAA,EAAS,IAAA,EAAK;AAAA,IACrC,UAAU;AAAC;AAEf,CAAC;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/TablePagination/definition.ts"],"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 { defineComponent } from '../../hooks/useDefinition';\nimport type { TablePaginationOwnProps, PageSizeOption } from './types';\nimport styles from './TablePagination.module.css';\n\nconst DEFAULT_PAGE_SIZE_OPTIONS: PageSizeOption[] = [\n { label: 'Show 5 results', value: 5 },\n { label: 'Show 10 results', value: 10 },\n { label: 'Show 20 results', value: 20 },\n { label: 'Show 30 results', value: 30 },\n { label: 'Show 40 results', value: 40 },\n { label: 'Show 50 results', value: 50 },\n];\n\n/**\n * Component definition for TablePagination\n * @public\n */\nexport const TablePaginationDefinition =\n defineComponent<TablePaginationOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TablePagination',\n left: 'bui-TablePaginationLeft',\n right: 'bui-TablePaginationRight',\n select: 'bui-TablePaginationSelect',\n },\n propDefs: {\n pageSize: {},\n pageSizeOptions: { default: DEFAULT_PAGE_SIZE_OPTIONS },\n offset: {},\n totalCount: {},\n hasNextPage: {},\n hasPreviousPage: {},\n onNextPage: {},\n onPreviousPage: {},\n onPageSizeChange: {},\n showPageSizeOptions: { default: true },\n getLabel: {},\n showPaginationLabel: { default: true },\n },\n });\n"],"names":[],"mappings":";;;;;;;;;;AAoBA,MAAM,yBAAA,GAA8C;AAAA,EAClD,EAAE,KAAA,EAAO,gBAAA,EAAkB,KAAA,EAAO,CAAA,EAAE;AAAA,EACpC,EAAE,KAAA,EAAO,iBAAA,EAAmB,KAAA,EAAO,EAAA,EAAG;AAAA,EACtC,EAAE,KAAA,EAAO,iBAAA,EAAmB,KAAA,EAAO,EAAA,EAAG;AAAA,EACtC,EAAE,KAAA,EAAO,iBAAA,EAAmB,KAAA,EAAO,EAAA,EAAG;AAAA,EACtC,EAAE,KAAA,EAAO,iBAAA,EAAmB,KAAA,EAAO,EAAA,EAAG;AAAA,EACtC,EAAE,KAAA,EAAO,iBAAA,EAAmB,KAAA,EAAO,EAAA;AACrC,CAAA;AAMO,MAAM,yBAAA,GACX,iBAAyC,CAAE;AAAA,EACzC,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,qBAAA;AAAA,IACN,IAAA,EAAM,yBAAA;AAAA,IACN,KAAA,EAAO,0BAAA;AAAA,IACP,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,QAAA,EAAU;AAAA,IACR,UAAU,EAAC;AAAA,IACX,eAAA,EAAiB,EAAE,OAAA,EAAS,yBAAA,EAA0B;AAAA,IACtD,QAAQ,EAAC;AAAA,IACT,YAAY,EAAC;AAAA,IACb,aAAa,EAAC;AAAA,IACd,iBAAiB,EAAC;AAAA,IAClB,YAAY,EAAC;AAAA,IACb,gBAAgB,EAAC;AAAA,IACjB,kBAAkB,EAAC;AAAA,IACnB,mBAAA,EAAqB,EAAE,OAAA,EAAS,IAAA,EAAK;AAAA,IACrC,UAAU,EAAC;AAAA,IACX,mBAAA,EAAqB,EAAE,OAAA,EAAS,IAAA;AAAK;AAEzC,CAAC;;;;"}
@@ -4,6 +4,7 @@ import '../../hooks/useBreakpoint.esm.js';
4
4
  import '../../hooks/useBg.esm.js';
5
5
  import '../../hooks/useDefinition/helpers.esm.js';
6
6
  import '../../analytics/useAnalytics.esm.js';
7
+ import 'react-router-dom';
7
8
  import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
8
9
  import styles from './Tabs.module.css.esm.js';
9
10
 
@@ -30,6 +31,7 @@ const TabListDefinition = defineComponent()({
30
31
  });
31
32
  const TabDefinition = defineComponent()({
32
33
  styles,
34
+ resolveHref: true,
33
35
  classNames: {
34
36
  root: "bui-Tab"
35
37
  },
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Tabs/definition.ts"],"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 { defineComponent } from '../../hooks/useDefinition';\nimport type {\n TabsOwnProps,\n TabListOwnProps,\n TabOwnProps,\n TabPanelOwnProps,\n TabsIndicatorsOwnProps,\n} from './types';\nimport styles from './Tabs.module.css';\n\n/**\n * Component definition for Tabs\n * @public\n */\nexport const TabsDefinition = defineComponent<TabsOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Tabs',\n },\n propDefs: {\n className: {},\n children: {},\n },\n});\n\n/** @internal */\nexport const TabListDefinition = defineComponent<TabListOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TabListWrapper',\n tabList: 'bui-TabList',\n },\n propDefs: {\n className: {},\n children: {},\n },\n});\n\n/** @internal */\nexport const TabDefinition = defineComponent<TabOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Tab',\n },\n analytics: true,\n propDefs: {\n className: {},\n matchStrategy: {},\n href: {},\n id: {},\n noTrack: {},\n },\n});\n\n/** @internal */\nexport const TabPanelDefinition = defineComponent<TabPanelOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TabPanel',\n },\n propDefs: {\n className: {},\n },\n});\n\n/** @internal */\nexport const TabsIndicatorsDefinition =\n defineComponent<TabsIndicatorsOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TabActive',\n hovered: 'bui-TabHovered',\n },\n propDefs: {\n tabRefs: {},\n tabsRef: {},\n hoveredKey: {},\n prevHoveredKey: {},\n },\n });\n"],"names":[],"mappings":";;;;;;;;;AA8BO,MAAM,cAAA,GAAiB,iBAA8B,CAAE;AAAA,EAC5D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,UAAU;AAAC;AAEf,CAAC;AAGM,MAAM,iBAAA,GAAoB,iBAAiC,CAAE;AAAA,EAClE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,oBAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,UAAU;AAAC;AAEf,CAAC;AAGM,MAAM,aAAA,GAAgB,iBAA6B,CAAE;AAAA,EAC1D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,SAAA,EAAW,IAAA;AAAA,EACX,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,eAAe,EAAC;AAAA,IAChB,MAAM,EAAC;AAAA,IACP,IAAI,EAAC;AAAA,IACL,SAAS;AAAC;AAEd,CAAC;AAGM,MAAM,kBAAA,GAAqB,iBAAkC,CAAE;AAAA,EACpE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW;AAAC;AAEhB,CAAC;AAGM,MAAM,wBAAA,GACX,iBAAwC,CAAE;AAAA,EACxC,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,eAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,QAAA,EAAU;AAAA,IACR,SAAS,EAAC;AAAA,IACV,SAAS,EAAC;AAAA,IACV,YAAY,EAAC;AAAA,IACb,gBAAgB;AAAC;AAErB,CAAC;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Tabs/definition.ts"],"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 { defineComponent } from '../../hooks/useDefinition';\nimport type {\n TabsOwnProps,\n TabListOwnProps,\n TabOwnProps,\n TabPanelOwnProps,\n TabsIndicatorsOwnProps,\n} from './types';\nimport styles from './Tabs.module.css';\n\n/**\n * Component definition for Tabs\n * @public\n */\nexport const TabsDefinition = defineComponent<TabsOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Tabs',\n },\n propDefs: {\n className: {},\n children: {},\n },\n});\n\n/** @internal */\nexport const TabListDefinition = defineComponent<TabListOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TabListWrapper',\n tabList: 'bui-TabList',\n },\n propDefs: {\n className: {},\n children: {},\n },\n});\n\n/** @internal */\nexport const TabDefinition = defineComponent<TabOwnProps>()({\n styles,\n resolveHref: true,\n classNames: {\n root: 'bui-Tab',\n },\n analytics: true,\n propDefs: {\n className: {},\n matchStrategy: {},\n href: {},\n id: {},\n noTrack: {},\n },\n});\n\n/** @internal */\nexport const TabPanelDefinition = defineComponent<TabPanelOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TabPanel',\n },\n propDefs: {\n className: {},\n },\n});\n\n/** @internal */\nexport const TabsIndicatorsDefinition =\n defineComponent<TabsIndicatorsOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TabActive',\n hovered: 'bui-TabHovered',\n },\n propDefs: {\n tabRefs: {},\n tabsRef: {},\n hoveredKey: {},\n prevHoveredKey: {},\n },\n });\n"],"names":[],"mappings":";;;;;;;;;;AA8BO,MAAM,cAAA,GAAiB,iBAA8B,CAAE;AAAA,EAC5D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,UAAU;AAAC;AAEf,CAAC;AAGM,MAAM,iBAAA,GAAoB,iBAAiC,CAAE;AAAA,EAClE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,oBAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,UAAU;AAAC;AAEf,CAAC;AAGM,MAAM,aAAA,GAAgB,iBAA6B,CAAE;AAAA,EAC1D,MAAA;AAAA,EACA,WAAA,EAAa,IAAA;AAAA,EACb,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,SAAA,EAAW,IAAA;AAAA,EACX,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,eAAe,EAAC;AAAA,IAChB,MAAM,EAAC;AAAA,IACP,IAAI,EAAC;AAAA,IACL,SAAS;AAAC;AAEd,CAAC;AAGM,MAAM,kBAAA,GAAqB,iBAAkC,CAAE;AAAA,EACpE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW;AAAC;AAEhB,CAAC;AAGM,MAAM,wBAAA,GACX,iBAAwC,CAAE;AAAA,EACxC,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,eAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,QAAA,EAAU;AAAA,IACR,SAAS,EAAC;AAAA,IACV,SAAS,EAAC;AAAA,IACV,YAAY,EAAC;AAAA,IACb,gBAAgB;AAAC;AAErB,CAAC;;;;"}
@@ -4,6 +4,7 @@ import '../../hooks/useBreakpoint.esm.js';
4
4
  import '../../hooks/useBg.esm.js';
5
5
  import '../../hooks/useDefinition/helpers.esm.js';
6
6
  import '../../analytics/useAnalytics.esm.js';
7
+ import 'react-router-dom';
7
8
  import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
8
9
  import styles from './TagGroup.module.css.esm.js';
9
10
 
@@ -22,6 +23,7 @@ const TagGroupDefinition = defineComponent()({
22
23
  });
23
24
  const TagDefinition = defineComponent()({
24
25
  styles,
26
+ resolveHref: true,
25
27
  classNames: {
26
28
  root: "bui-Tag",
27
29
  icon: "bui-TagIcon",
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/TagGroup/definition.ts"],"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 { defineComponent } from '../../hooks/useDefinition';\nimport type { TagGroupOwnProps, TagOwnProps } from './types';\nimport styles from './TagGroup.module.css';\n\n/**\n * Component definition for TagGroup\n * @public\n */\nexport const TagGroupDefinition = defineComponent<TagGroupOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TagGroup',\n list: 'bui-TagList',\n },\n propDefs: {\n items: {},\n children: {},\n renderEmptyState: {},\n className: {},\n },\n});\n\n/** @internal */\nexport const TagDefinition = defineComponent<TagOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Tag',\n icon: 'bui-TagIcon',\n removeButton: 'bui-TagRemoveButton',\n },\n analytics: true,\n propDefs: {\n noTrack: {},\n icon: {},\n size: { dataAttribute: true, default: 'small' },\n href: {},\n children: {},\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,kBAAA,GAAqB,iBAAkC,CAAE;AAAA,EACpE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,cAAA;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,OAAO,EAAC;AAAA,IACR,UAAU,EAAC;AAAA,IACX,kBAAkB,EAAC;AAAA,IACnB,WAAW;AAAC;AAEhB,CAAC;AAGM,MAAM,aAAA,GAAgB,iBAA6B,CAAE;AAAA,EAC1D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM,aAAA;AAAA,IACN,YAAA,EAAc;AAAA,GAChB;AAAA,EACA,SAAA,EAAW,IAAA;AAAA,EACX,QAAA,EAAU;AAAA,IACR,SAAS,EAAC;AAAA,IACV,MAAM,EAAC;AAAA,IACP,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,MAAM,EAAC;AAAA,IACP,UAAU,EAAC;AAAA,IACX,WAAW;AAAC;AAEhB,CAAC;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/TagGroup/definition.ts"],"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 { defineComponent } from '../../hooks/useDefinition';\nimport type { TagGroupOwnProps, TagOwnProps } from './types';\nimport styles from './TagGroup.module.css';\n\n/**\n * Component definition for TagGroup\n * @public\n */\nexport const TagGroupDefinition = defineComponent<TagGroupOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TagGroup',\n list: 'bui-TagList',\n },\n propDefs: {\n items: {},\n children: {},\n renderEmptyState: {},\n className: {},\n },\n});\n\n/** @internal */\nexport const TagDefinition = defineComponent<TagOwnProps>()({\n styles,\n resolveHref: true,\n classNames: {\n root: 'bui-Tag',\n icon: 'bui-TagIcon',\n removeButton: 'bui-TagRemoveButton',\n },\n analytics: true,\n propDefs: {\n noTrack: {},\n icon: {},\n size: { dataAttribute: true, default: 'small' },\n href: {},\n children: {},\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;AAwBO,MAAM,kBAAA,GAAqB,iBAAkC,CAAE;AAAA,EACpE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,cAAA;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,OAAO,EAAC;AAAA,IACR,UAAU,EAAC;AAAA,IACX,kBAAkB,EAAC;AAAA,IACnB,WAAW;AAAC;AAEhB,CAAC;AAGM,MAAM,aAAA,GAAgB,iBAA6B,CAAE;AAAA,EAC1D,MAAA;AAAA,EACA,WAAA,EAAa,IAAA;AAAA,EACb,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM,aAAA;AAAA,IACN,YAAA,EAAc;AAAA,GAChB;AAAA,EACA,SAAA,EAAW,IAAA;AAAA,EACX,QAAA,EAAU;AAAA,IACR,SAAS,EAAC;AAAA,IACV,MAAM,EAAC;AAAA,IACP,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,MAAM,EAAC;AAAA,IACP,UAAU,EAAC;AAAA,IACX,WAAW;AAAC;AAEhB,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Text.esm.js","sources":["../../../src/components/Text/Text.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 { forwardRef } from 'react';\nimport type { ElementType } from 'react';\nimport type { TextProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TextDefinition } from './definition';\n\nfunction TextComponent<T extends ElementType = 'span'>(\n props: TextProps<T>,\n ref: React.Ref<any>,\n) {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n TextDefinition,\n props,\n );\n const { classes, as } = ownProps;\n\n const Component = as;\n\n return (\n <Component\n ref={ref}\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n />\n );\n}\n\nTextComponent.displayName = 'Text';\n\n/** @public */\nexport const Text = forwardRef(TextComponent) as {\n <T extends ElementType = 'p'>(\n props: TextProps<T> & { ref?: React.ComponentPropsWithRef<T>['ref'] },\n ): React.ReactElement<TextProps<T>, T>;\n displayName: string;\n};\n\nText.displayName = 'Text';\n"],"names":[],"mappings":";;;;;AAsBA,SAAS,aAAA,CACP,OACA,GAAA,EACA;AACA,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,cAAA,EAAe,GAAI,aAAA;AAAA,IAC9C,cAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,MAAM,EAAE,OAAA,EAAS,EAAA,EAAG,GAAI,QAAA;AAExB,EAAA,MAAM,SAAA,GAAY,EAAA;AAElB,EAAA,uBACE,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAW,OAAA,CAAQ,IAAA;AAAA,MAClB,GAAG,cAAA;AAAA,MACH,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,aAAA,CAAc,WAAA,GAAc,MAAA;AAGrB,MAAM,IAAA,GAAO,WAAW,aAAa;AAO5C,IAAA,CAAK,WAAA,GAAc,MAAA;;;;"}
1
+ {"version":3,"file":"Text.esm.js","sources":["../../../src/components/Text/Text.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 { forwardRef } from 'react';\nimport type { ElementType } from 'react';\nimport type { TextProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TextDefinition } from './definition';\n\nfunction TextComponent<T extends ElementType = 'span'>(\n props: TextProps<T>,\n ref: React.Ref<any>,\n) {\n // Cast to default TextProps so TypeScript can evaluate the\n // ResolveHrefConstraint. The generic ElementType is only used for\n // the `as` prop which doesn't include 'a', so href is never present.\n const { ownProps, restProps, dataAttributes } = useDefinition(\n TextDefinition,\n props as TextProps,\n );\n const { classes, as } = ownProps;\n\n const Component = as;\n\n return (\n <Component\n ref={ref}\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n />\n );\n}\n\nTextComponent.displayName = 'Text';\n\n/** @public */\nexport const Text = forwardRef(TextComponent) as {\n <T extends ElementType = 'p'>(\n props: TextProps<T> & { ref?: React.ComponentPropsWithRef<T>['ref'] },\n ): React.ReactElement<TextProps<T>, T>;\n displayName: string;\n};\n\nText.displayName = 'Text';\n"],"names":[],"mappings":";;;;;AAsBA,SAAS,aAAA,CACP,OACA,GAAA,EACA;AAIA,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,cAAA,EAAe,GAAI,aAAA;AAAA,IAC9C,cAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,MAAM,EAAE,OAAA,EAAS,EAAA,EAAG,GAAI,QAAA;AAExB,EAAA,MAAM,SAAA,GAAY,EAAA;AAElB,EAAA,uBACE,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAW,OAAA,CAAQ,IAAA;AAAA,MAClB,GAAG,cAAA;AAAA,MACH,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,aAAA,CAAc,WAAA,GAAc,MAAA;AAGrB,MAAM,IAAA,GAAO,WAAW,aAAa;AAO5C,IAAA,CAAK,WAAA,GAAc,MAAA;;;;"}
@@ -4,6 +4,7 @@ import '../../hooks/useBreakpoint.esm.js';
4
4
  import '../../hooks/useBg.esm.js';
5
5
  import '../../hooks/useDefinition/helpers.esm.js';
6
6
  import '../../analytics/useAnalytics.esm.js';
7
+ import 'react-router-dom';
7
8
  import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
8
9
  import styles from './Text.module.css.esm.js';
9
10
 
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Text/definition.ts"],"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 { defineComponent } from '../../hooks/useDefinition';\nimport type { TextOwnProps } from './types';\nimport styles from './Text.module.css';\n\n/**\n * Component definition for Text\n * @public\n */\nexport const TextDefinition = defineComponent<TextOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Text',\n },\n propDefs: {\n as: { default: 'span' },\n variant: { dataAttribute: true, default: 'body-medium' },\n weight: { dataAttribute: true, default: 'regular' },\n color: { dataAttribute: true, default: 'primary' },\n truncate: { dataAttribute: true },\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,cAAA,GAAiB,iBAA8B,CAAE;AAAA,EAC5D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,EAAE,OAAA,EAAS,MAAA,EAAO;AAAA,IACtB,OAAA,EAAS,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,aAAA,EAAc;AAAA,IACvD,MAAA,EAAQ,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,SAAA,EAAU;AAAA,IAClD,KAAA,EAAO,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,SAAA,EAAU;AAAA,IACjD,QAAA,EAAU,EAAE,aAAA,EAAe,IAAA,EAAK;AAAA,IAChC,WAAW;AAAC;AAEhB,CAAC;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Text/definition.ts"],"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 { defineComponent } from '../../hooks/useDefinition';\nimport type { TextOwnProps } from './types';\nimport styles from './Text.module.css';\n\n/**\n * Component definition for Text\n * @public\n */\nexport const TextDefinition = defineComponent<TextOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Text',\n },\n propDefs: {\n as: { default: 'span' },\n variant: { dataAttribute: true, default: 'body-medium' },\n weight: { dataAttribute: true, default: 'regular' },\n color: { dataAttribute: true, default: 'primary' },\n truncate: { dataAttribute: true },\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;AAwBO,MAAM,cAAA,GAAiB,iBAA8B,CAAE;AAAA,EAC5D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,EAAE,OAAA,EAAS,MAAA,EAAO;AAAA,IACtB,OAAA,EAAS,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,aAAA,EAAc;AAAA,IACvD,MAAA,EAAQ,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,SAAA,EAAU;AAAA,IAClD,KAAA,EAAO,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,SAAA,EAAU;AAAA,IACjD,QAAA,EAAU,EAAE,aAAA,EAAe,IAAA,EAAK;AAAA,IAChC,WAAW;AAAC;AAEhB,CAAC;;;;"}
@@ -4,6 +4,7 @@ import '../../hooks/useBreakpoint.esm.js';
4
4
  import '../../hooks/useBg.esm.js';
5
5
  import '../../hooks/useDefinition/helpers.esm.js';
6
6
  import '../../analytics/useAnalytics.esm.js';
7
+ import 'react-router-dom';
7
8
  import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
8
9
  import styles from './TextField.module.css.esm.js';
9
10
 
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/TextField/definition.ts"],"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 { defineComponent } from '../../hooks/useDefinition';\nimport type { TextFieldOwnProps } from './types';\nimport styles from './TextField.module.css';\n\n/**\n * Component definition for TextField\n * @public\n */\nexport const TextFieldDefinition = defineComponent<TextFieldOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TextField',\n inputWrapper: 'bui-InputWrapper',\n input: 'bui-Input',\n inputIcon: 'bui-InputIcon',\n inputAction: 'bui-InputAction',\n },\n bg: 'consumer',\n propDefs: {\n size: { dataAttribute: true, default: 'small' },\n className: {},\n icon: {},\n placeholder: {},\n label: {},\n description: {},\n secondaryLabel: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,mBAAA,GAAsB,iBAAmC,CAAE;AAAA,EACtE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,eAAA;AAAA,IACN,YAAA,EAAc,kBAAA;AAAA,IACd,KAAA,EAAO,WAAA;AAAA,IACP,SAAA,EAAW,eAAA;AAAA,IACX,WAAA,EAAa;AAAA,GACf;AAAA,EACA,EAAA,EAAI,UAAA;AAAA,EACJ,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,WAAW,EAAC;AAAA,IACZ,MAAM,EAAC;AAAA,IACP,aAAa,EAAC;AAAA,IACd,OAAO,EAAC;AAAA,IACR,aAAa,EAAC;AAAA,IACd,gBAAgB;AAAC;AAErB,CAAC;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/TextField/definition.ts"],"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 { defineComponent } from '../../hooks/useDefinition';\nimport type { TextFieldOwnProps } from './types';\nimport styles from './TextField.module.css';\n\n/**\n * Component definition for TextField\n * @public\n */\nexport const TextFieldDefinition = defineComponent<TextFieldOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TextField',\n inputWrapper: 'bui-InputWrapper',\n input: 'bui-Input',\n inputIcon: 'bui-InputIcon',\n inputAction: 'bui-InputAction',\n },\n bg: 'consumer',\n propDefs: {\n size: { dataAttribute: true, default: 'small' },\n className: {},\n icon: {},\n placeholder: {},\n label: {},\n description: {},\n secondaryLabel: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;AAwBO,MAAM,mBAAA,GAAsB,iBAAmC,CAAE;AAAA,EACtE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,eAAA;AAAA,IACN,YAAA,EAAc,kBAAA;AAAA,IACd,KAAA,EAAO,WAAA;AAAA,IACP,SAAA,EAAW,eAAA;AAAA,IACX,WAAA,EAAa;AAAA,GACf;AAAA,EACA,EAAA,EAAI,UAAA;AAAA,EACJ,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,WAAW,EAAC;AAAA,IACZ,MAAM,EAAC;AAAA,IACP,aAAa,EAAC;AAAA,IACd,OAAO,EAAC;AAAA,IACR,aAAa,EAAC;AAAA,IACd,gBAAgB;AAAC;AAErB,CAAC;;;;"}
@@ -4,6 +4,7 @@ import '../../hooks/useBreakpoint.esm.js';
4
4
  import '../../hooks/useBg.esm.js';
5
5
  import '../../hooks/useDefinition/helpers.esm.js';
6
6
  import '../../analytics/useAnalytics.esm.js';
7
+ import 'react-router-dom';
7
8
  import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
8
9
  import styles from './ToggleButton.module.css.esm.js';
9
10
 
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/ToggleButton/definition.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { defineComponent } from '../../hooks/useDefinition';\nimport type { ToggleButtonOwnProps } from './types';\nimport styles from './ToggleButton.module.css';\n\n/**\n * Component definition for ToggleButton\n * @public\n */\nexport const ToggleButtonDefinition = defineComponent<ToggleButtonOwnProps>()({\n styles,\n classNames: {\n root: 'bui-ToggleButton',\n content: 'bui-ToggleButtonContent',\n },\n propDefs: {\n size: { dataAttribute: true, default: 'small' },\n iconStart: {},\n iconEnd: {},\n children: {},\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,sBAAA,GAAyB,iBAAsC,CAAE;AAAA,EAC5E,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,kBAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,WAAW,EAAC;AAAA,IACZ,SAAS,EAAC;AAAA,IACV,UAAU,EAAC;AAAA,IACX,WAAW;AAAC;AAEhB,CAAC;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/ToggleButton/definition.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { defineComponent } from '../../hooks/useDefinition';\nimport type { ToggleButtonOwnProps } from './types';\nimport styles from './ToggleButton.module.css';\n\n/**\n * Component definition for ToggleButton\n * @public\n */\nexport const ToggleButtonDefinition = defineComponent<ToggleButtonOwnProps>()({\n styles,\n classNames: {\n root: 'bui-ToggleButton',\n content: 'bui-ToggleButtonContent',\n },\n propDefs: {\n size: { dataAttribute: true, default: 'small' },\n iconStart: {},\n iconEnd: {},\n children: {},\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;AAwBO,MAAM,sBAAA,GAAyB,iBAAsC,CAAE;AAAA,EAC5E,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,kBAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,WAAW,EAAC;AAAA,IACZ,SAAS,EAAC;AAAA,IACV,UAAU,EAAC;AAAA,IACX,WAAW;AAAC;AAEhB,CAAC;;;;"}
@@ -4,6 +4,7 @@ import '../../hooks/useBreakpoint.esm.js';
4
4
  import '../../hooks/useBg.esm.js';
5
5
  import '../../hooks/useDefinition/helpers.esm.js';
6
6
  import '../../analytics/useAnalytics.esm.js';
7
+ import 'react-router-dom';
7
8
  import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
8
9
  import styles from './ToggleButtonGroup.module.css.esm.js';
9
10
 
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/ToggleButtonGroup/definition.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { defineComponent } from '../../hooks/useDefinition';\nimport type { ToggleButtonGroupOwnProps } from './types';\nimport styles from './ToggleButtonGroup.module.css';\n\n/**\n * Component definition for ToggleButtonGroup\n * @public\n */\nexport const ToggleButtonGroupDefinition =\n defineComponent<ToggleButtonGroupOwnProps>()({\n styles,\n classNames: {\n root: 'bui-ToggleButtonGroup',\n },\n propDefs: {\n className: {},\n children: {},\n },\n });\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,2BAAA,GACX,iBAA2C,CAAE;AAAA,EAC3C,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,UAAU;AAAC;AAEf,CAAC;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/ToggleButtonGroup/definition.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { defineComponent } from '../../hooks/useDefinition';\nimport type { ToggleButtonGroupOwnProps } from './types';\nimport styles from './ToggleButtonGroup.module.css';\n\n/**\n * Component definition for ToggleButtonGroup\n * @public\n */\nexport const ToggleButtonGroupDefinition =\n defineComponent<ToggleButtonGroupOwnProps>()({\n styles,\n classNames: {\n root: 'bui-ToggleButtonGroup',\n },\n propDefs: {\n className: {},\n children: {},\n },\n });\n"],"names":[],"mappings":";;;;;;;;;;AAwBO,MAAM,2BAAA,GACX,iBAA2C,CAAE;AAAA,EAC3C,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,UAAU;AAAC;AAEf,CAAC;;;;"}
@@ -4,6 +4,7 @@ import '../../hooks/useBreakpoint.esm.js';
4
4
  import '../../hooks/useBg.esm.js';
5
5
  import '../../hooks/useDefinition/helpers.esm.js';
6
6
  import '../../analytics/useAnalytics.esm.js';
7
+ import 'react-router-dom';
7
8
  import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
8
9
  import styles from './Tooltip.module.css.esm.js';
9
10
 
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Tooltip/definition.ts"],"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 { defineComponent } from '../../hooks/useDefinition';\nimport type { TooltipOwnProps } from './types';\nimport styles from './Tooltip.module.css';\n\n/**\n * Component definition for Tooltip\n * @public\n */\nexport const TooltipDefinition = defineComponent<TooltipOwnProps>()({\n styles,\n classNames: {\n tooltip: 'bui-Tooltip',\n content: 'bui-TooltipContent',\n arrow: 'bui-TooltipArrow',\n },\n propDefs: {\n children: {},\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,iBAAA,GAAoB,iBAAiC,CAAE;AAAA,EAClE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,OAAA,EAAS,aAAA;AAAA,IACT,OAAA,EAAS,oBAAA;AAAA,IACT,KAAA,EAAO;AAAA,GACT;AAAA,EACA,QAAA,EAAU;AAAA,IACR,UAAU,EAAC;AAAA,IACX,WAAW;AAAC;AAEhB,CAAC;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Tooltip/definition.ts"],"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 { defineComponent } from '../../hooks/useDefinition';\nimport type { TooltipOwnProps } from './types';\nimport styles from './Tooltip.module.css';\n\n/**\n * Component definition for Tooltip\n * @public\n */\nexport const TooltipDefinition = defineComponent<TooltipOwnProps>()({\n styles,\n classNames: {\n tooltip: 'bui-Tooltip',\n content: 'bui-TooltipContent',\n arrow: 'bui-TooltipArrow',\n },\n propDefs: {\n children: {},\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;AAwBO,MAAM,iBAAA,GAAoB,iBAAiC,CAAE;AAAA,EAClE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,OAAA,EAAS,aAAA;AAAA,IACT,OAAA,EAAS,oBAAA;AAAA,IACT,KAAA,EAAO;AAAA,GACT;AAAA,EACA,QAAA,EAAU;AAAA,IACR,UAAU,EAAC;AAAA,IACX,WAAW;AAAC;AAEhB,CAAC;;;;"}
@@ -4,6 +4,7 @@ import '../../hooks/useBreakpoint.esm.js';
4
4
  import '../../hooks/useBg.esm.js';
5
5
  import '../../hooks/useDefinition/helpers.esm.js';
6
6
  import '../../analytics/useAnalytics.esm.js';
7
+ import 'react-router-dom';
7
8
  import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
8
9
  import styles from './VisuallyHidden.module.css.esm.js';
9
10
 
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/VisuallyHidden/definition.ts"],"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 { defineComponent } from '../../hooks/useDefinition';\nimport type { VisuallyHiddenOwnProps } from './types';\nimport styles from './VisuallyHidden.module.css';\n\n/**\n * Component definition for VisuallyHidden\n * @public\n */\nexport const VisuallyHiddenDefinition =\n defineComponent<VisuallyHiddenOwnProps>()({\n styles,\n classNames: {\n root: 'bui-VisuallyHidden',\n },\n propDefs: {\n className: {},\n },\n });\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,wBAAA,GACX,iBAAwC,CAAE;AAAA,EACxC,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW;AAAC;AAEhB,CAAC;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/VisuallyHidden/definition.ts"],"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 { defineComponent } from '../../hooks/useDefinition';\nimport type { VisuallyHiddenOwnProps } from './types';\nimport styles from './VisuallyHidden.module.css';\n\n/**\n * Component definition for VisuallyHidden\n * @public\n */\nexport const VisuallyHiddenDefinition =\n defineComponent<VisuallyHiddenOwnProps>()({\n styles,\n classNames: {\n root: 'bui-VisuallyHidden',\n },\n propDefs: {\n className: {},\n },\n });\n"],"names":[],"mappings":";;;;;;;;;;AAwBO,MAAM,wBAAA,GACX,iBAAwC,CAAE;AAAA,EACxC,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW;AAAC;AAEhB,CAAC;;;;"}
@@ -4,12 +4,23 @@ import { useBreakpoint } from '../useBreakpoint.esm.js';
4
4
  import { useBgProvider, useBgConsumer, BgProvider } from '../useBg.esm.js';
5
5
  import { resolveDefinitionProps, processUtilityProps } from './helpers.esm.js';
6
6
  import { useAnalytics, noopTracker } from '../../analytics/useAnalytics.esm.js';
7
+ import { useInRouterContext, useHref } from 'react-router-dom';
7
8
 
8
9
  function useDefinition(definition, props, options) {
9
10
  const { breakpoint } = useBreakpoint();
11
+ let hrefResolvedProps = props;
12
+ if (definition.resolveHref) {
13
+ const hasRouter = useInRouterContext();
14
+ if (hasRouter) {
15
+ const absoluteHref = useHref(props.href ?? "");
16
+ if (props.href !== void 0) {
17
+ hrefResolvedProps = { ...props, href: absoluteHref };
18
+ }
19
+ }
20
+ }
10
21
  const { ownPropsResolved, restProps } = resolveDefinitionProps(
11
22
  definition,
12
- props,
23
+ hrefResolvedProps,
13
24
  breakpoint
14
25
  );
15
26
  const dataAttributes = {};