@backstage/ui 0.6.0 → 0.7.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/css/styles.css +92 -138
  3. package/dist/components/Avatar/Avatar.esm.js +29 -0
  4. package/dist/components/Avatar/Avatar.esm.js.map +1 -0
  5. package/dist/components/Box/Box.esm.js +34 -0
  6. package/dist/components/Box/Box.esm.js.map +1 -0
  7. package/dist/components/Box/Box.props.esm.js +7 -0
  8. package/dist/components/Box/Box.props.esm.js.map +1 -0
  9. package/dist/components/Button/Button.esm.js +41 -0
  10. package/dist/components/Button/Button.esm.js.map +1 -0
  11. package/dist/components/ButtonIcon/ButtonIcon.esm.js +37 -0
  12. package/dist/components/ButtonIcon/ButtonIcon.esm.js.map +1 -0
  13. package/dist/components/ButtonLink/ButtonLink.esm.js +42 -0
  14. package/dist/components/ButtonLink/ButtonLink.esm.js.map +1 -0
  15. package/dist/components/Card/Card.esm.js +53 -0
  16. package/dist/components/Card/Card.esm.js.map +1 -0
  17. package/dist/components/Checkbox/Checkbox.esm.js +74 -0
  18. package/dist/components/Checkbox/Checkbox.esm.js.map +1 -0
  19. package/dist/components/Collapsible/Collapsible.esm.js +50 -0
  20. package/dist/components/Collapsible/Collapsible.esm.js.map +1 -0
  21. package/dist/components/Container/Container.esm.js +35 -0
  22. package/dist/components/Container/Container.esm.js.map +1 -0
  23. package/dist/components/DataTable/DataTable.esm.js +26 -0
  24. package/dist/components/DataTable/DataTable.esm.js.map +1 -0
  25. package/dist/components/DataTable/Pagination/DataTablePagination.esm.js +84 -0
  26. package/dist/components/DataTable/Pagination/DataTablePagination.esm.js.map +1 -0
  27. package/dist/components/DataTable/Root/DataTableRoot.esm.js +24 -0
  28. package/dist/components/DataTable/Root/DataTableRoot.esm.js.map +1 -0
  29. package/dist/components/DataTable/Table/DataTableTable.esm.js +64 -0
  30. package/dist/components/DataTable/Table/DataTableTable.esm.js.map +1 -0
  31. package/dist/components/FieldError/FieldError.esm.js +22 -0
  32. package/dist/components/FieldError/FieldError.esm.js.map +1 -0
  33. package/dist/components/FieldLabel/FieldLabel.esm.js +27 -0
  34. package/dist/components/FieldLabel/FieldLabel.esm.js.map +1 -0
  35. package/dist/components/Flex/Flex.esm.js +26 -0
  36. package/dist/components/Flex/Flex.esm.js.map +1 -0
  37. package/dist/components/Flex/Flex.props.esm.js +31 -0
  38. package/dist/components/Flex/Flex.props.esm.js.map +1 -0
  39. package/dist/components/Grid/Grid.esm.js +43 -0
  40. package/dist/components/Grid/Grid.esm.js.map +1 -0
  41. package/dist/components/Grid/Grid.props.esm.js +58 -0
  42. package/dist/components/Grid/Grid.props.esm.js.map +1 -0
  43. package/dist/components/Header/Header.esm.js +46 -0
  44. package/dist/components/Header/Header.esm.js.map +1 -0
  45. package/dist/components/Header/HeaderToolbar.esm.js +132 -0
  46. package/dist/components/Header/HeaderToolbar.esm.js.map +1 -0
  47. package/dist/components/HeaderPage/HeaderPage.esm.js +57 -0
  48. package/dist/components/HeaderPage/HeaderPage.esm.js.map +1 -0
  49. package/dist/components/Icon/Icon.esm.js +29 -0
  50. package/dist/components/Icon/Icon.esm.js.map +1 -0
  51. package/dist/components/Icon/context.esm.js +10 -0
  52. package/dist/components/Icon/context.esm.js.map +1 -0
  53. package/dist/components/Icon/icons.esm.js +63 -0
  54. package/dist/components/Icon/icons.esm.js.map +1 -0
  55. package/dist/components/Icon/provider.esm.js +12 -0
  56. package/dist/components/Icon/provider.esm.js.map +1 -0
  57. package/dist/components/Link/Link.esm.js +67 -0
  58. package/dist/components/Link/Link.esm.js.map +1 -0
  59. package/dist/components/Menu/Combobox.esm.js +212 -0
  60. package/dist/components/Menu/Combobox.esm.js.map +1 -0
  61. package/dist/components/Menu/Menu.esm.js +224 -0
  62. package/dist/components/Menu/Menu.esm.js.map +1 -0
  63. package/dist/components/RadioGroup/RadioGroup.esm.js +71 -0
  64. package/dist/components/RadioGroup/RadioGroup.esm.js.map +1 -0
  65. package/dist/components/ScrollArea/ScrollArea.esm.js +63 -0
  66. package/dist/components/ScrollArea/ScrollArea.esm.js.map +1 -0
  67. package/dist/components/SearchField/SearchField.esm.js +107 -0
  68. package/dist/components/SearchField/SearchField.esm.js.map +1 -0
  69. package/dist/components/Select/Select.esm.js +89 -0
  70. package/dist/components/Select/Select.esm.js.map +1 -0
  71. package/dist/components/Select/Select.styles.css.esm.js +7 -0
  72. package/dist/components/Select/Select.styles.css.esm.js.map +1 -0
  73. package/dist/components/Skeleton/Skeleton.esm.js +22 -0
  74. package/dist/components/Skeleton/Skeleton.esm.js.map +1 -0
  75. package/dist/components/Switch/Switch.esm.js +18 -0
  76. package/dist/components/Switch/Switch.esm.js.map +1 -0
  77. package/dist/components/Table/Table.esm.js +68 -0
  78. package/dist/components/Table/Table.esm.js.map +1 -0
  79. package/dist/components/Table/TableCell/TableCell.esm.js +13 -0
  80. package/dist/components/Table/TableCell/TableCell.esm.js.map +1 -0
  81. package/dist/components/Table/TableCellLink/TableCellLink.esm.js +28 -0
  82. package/dist/components/Table/TableCellLink/TableCellLink.esm.js.map +1 -0
  83. package/dist/components/Table/TableCellProfile/TableCellProfile.esm.js +40 -0
  84. package/dist/components/Table/TableCellProfile/TableCellProfile.esm.js.map +1 -0
  85. package/dist/components/Table/TableCellText/TableCellText.esm.js +27 -0
  86. package/dist/components/Table/TableCellText/TableCellText.esm.js.map +1 -0
  87. package/dist/components/Tabs/Tabs.esm.js +139 -0
  88. package/dist/components/Tabs/Tabs.esm.js.map +1 -0
  89. package/dist/components/Tabs/TabsIndicators.esm.js +140 -0
  90. package/dist/components/Tabs/TabsIndicators.esm.js.map +1 -0
  91. package/dist/components/Text/Text.esm.js +40 -0
  92. package/dist/components/Text/Text.esm.js.map +1 -0
  93. package/dist/components/TextField/TextField.esm.js +88 -0
  94. package/dist/components/TextField/TextField.esm.js.map +1 -0
  95. package/dist/components/Tooltip/Tooltip.esm.js +34 -0
  96. package/dist/components/Tooltip/Tooltip.esm.js.map +1 -0
  97. package/dist/hooks/useBreakpoint.esm.js +43 -0
  98. package/dist/hooks/useBreakpoint.esm.js.map +1 -0
  99. package/dist/hooks/useIsomorphicLayoutEffect.esm.js +6 -0
  100. package/dist/hooks/useIsomorphicLayoutEffect.esm.js.map +1 -0
  101. package/dist/hooks/useMediaQuery.esm.js +44 -0
  102. package/dist/hooks/useMediaQuery.esm.js.map +1 -0
  103. package/dist/hooks/useStyles.esm.js +46 -0
  104. package/dist/hooks/useStyles.esm.js.map +1 -0
  105. package/dist/index.d.ts +1410 -0
  106. package/dist/index.esm.js +39 -0
  107. package/dist/index.esm.js.map +1 -0
  108. package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js +29 -0
  109. package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js.map +1 -0
  110. package/dist/props/display.props.esm.js +12 -0
  111. package/dist/props/display.props.esm.js.map +1 -0
  112. package/dist/props/gap-props.esm.js +15 -0
  113. package/dist/props/gap-props.esm.js.map +1 -0
  114. package/dist/props/height.props.esm.js +23 -0
  115. package/dist/props/height.props.esm.js.map +1 -0
  116. package/dist/props/margin.props.esm.js +54 -0
  117. package/dist/props/margin.props.esm.js.map +1 -0
  118. package/dist/props/padding.props.esm.js +54 -0
  119. package/dist/props/padding.props.esm.js.map +1 -0
  120. package/dist/props/position.props.esm.js +18 -0
  121. package/dist/props/position.props.esm.js.map +1 -0
  122. package/dist/props/prop-def.esm.js +4 -0
  123. package/dist/props/prop-def.esm.js.map +1 -0
  124. package/dist/props/spacing.props.esm.js +28 -0
  125. package/dist/props/spacing.props.esm.js.map +1 -0
  126. package/dist/props/width.props.esm.js +23 -0
  127. package/dist/props/width.props.esm.js.map +1 -0
  128. package/dist/utils/componentDefinitions.esm.js +272 -0
  129. package/dist/utils/componentDefinitions.esm.js.map +1 -0
  130. package/dist/utils/extractProps.esm.js +49 -0
  131. package/dist/utils/extractProps.esm.js.map +1 -0
  132. package/package.json +11 -3
@@ -0,0 +1,58 @@
1
+ const columnsValues = [
2
+ "1",
3
+ "2",
4
+ "3",
5
+ "4",
6
+ "5",
7
+ "6",
8
+ "7",
9
+ "8",
10
+ "9",
11
+ "10",
12
+ "11",
13
+ "12",
14
+ "auto"
15
+ ];
16
+ const gridPropDefs = {
17
+ columns: {
18
+ type: "enum | string",
19
+ className: "bui-columns",
20
+ customProperties: ["--columns"],
21
+ values: columnsValues,
22
+ responsive: true,
23
+ default: "auto"
24
+ }
25
+ };
26
+ const gridItemPropDefs = {
27
+ colSpan: {
28
+ type: "enum | string",
29
+ className: "bui-col-span",
30
+ customProperties: ["--col-span"],
31
+ values: columnsValues,
32
+ responsive: true
33
+ },
34
+ colEnd: {
35
+ type: "enum | string",
36
+ className: "bui-col-end",
37
+ customProperties: ["--col-end"],
38
+ values: columnsValues,
39
+ responsive: true
40
+ },
41
+ colStart: {
42
+ type: "enum | string",
43
+ className: "bui-col-start",
44
+ customProperties: ["--col-start"],
45
+ values: columnsValues,
46
+ responsive: true
47
+ },
48
+ rowSpan: {
49
+ type: "enum | string",
50
+ className: "bui-row-span",
51
+ customProperties: ["--row-span"],
52
+ values: columnsValues,
53
+ responsive: true
54
+ }
55
+ };
56
+
57
+ export { gridItemPropDefs, gridPropDefs };
58
+ //# sourceMappingURL=Grid.props.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Grid.props.esm.js","sources":["../../../src/components/Grid/Grid.props.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 type { PropDef, GetPropDefTypes } from '../../props/prop-def';\n\nconst columnsValues = [\n '1',\n '2',\n '3',\n '4',\n '5',\n '6',\n '7',\n '8',\n '9',\n '10',\n '11',\n '12',\n 'auto',\n] as const;\n\n/** @public */\nconst gridPropDefs = {\n columns: {\n type: 'enum | string',\n className: 'bui-columns',\n customProperties: ['--columns'],\n values: columnsValues,\n responsive: true,\n default: 'auto',\n },\n} satisfies {\n columns: PropDef<(typeof columnsValues)[number]>;\n};\n\n/** @public */\nconst gridItemPropDefs = {\n colSpan: {\n type: 'enum | string',\n className: 'bui-col-span',\n customProperties: ['--col-span'],\n values: columnsValues,\n responsive: true,\n },\n colEnd: {\n type: 'enum | string',\n className: 'bui-col-end',\n customProperties: ['--col-end'],\n values: columnsValues,\n responsive: true,\n },\n colStart: {\n type: 'enum | string',\n className: 'bui-col-start',\n customProperties: ['--col-start'],\n values: columnsValues,\n responsive: true,\n },\n rowSpan: {\n type: 'enum | string',\n className: 'bui-row-span',\n customProperties: ['--row-span'],\n values: columnsValues,\n responsive: true,\n },\n} satisfies {\n colSpan: PropDef<(typeof columnsValues)[number]>;\n colEnd: PropDef<(typeof columnsValues)[number]>;\n colStart: PropDef<(typeof columnsValues)[number]>;\n rowSpan: PropDef<(typeof columnsValues)[number]>;\n};\n\n/** @public */\ntype GridOwnProps = GetPropDefTypes<typeof gridPropDefs>;\n\n/** @public */\ntype GridItemOwnProps = GetPropDefTypes<typeof gridItemPropDefs>;\n\nexport { gridPropDefs, gridItemPropDefs };\nexport type { GridOwnProps, GridItemOwnProps };\n"],"names":[],"mappings":"AAkBA,MAAM,aAAgB,GAAA;AAAA,EACpB,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,IAAA;AAAA,EACA,IAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF,CAAA;AAGA,MAAM,YAAe,GAAA;AAAA,EACnB,OAAS,EAAA;AAAA,IACP,IAAM,EAAA,eAAA;AAAA,IACN,SAAW,EAAA,aAAA;AAAA,IACX,gBAAA,EAAkB,CAAC,WAAW,CAAA;AAAA,IAC9B,MAAQ,EAAA,aAAA;AAAA,IACR,UAAY,EAAA,IAAA;AAAA,IACZ,OAAS,EAAA;AAAA;AAEb;AAKA,MAAM,gBAAmB,GAAA;AAAA,EACvB,OAAS,EAAA;AAAA,IACP,IAAM,EAAA,eAAA;AAAA,IACN,SAAW,EAAA,cAAA;AAAA,IACX,gBAAA,EAAkB,CAAC,YAAY,CAAA;AAAA,IAC/B,MAAQ,EAAA,aAAA;AAAA,IACR,UAAY,EAAA;AAAA,GACd;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,eAAA;AAAA,IACN,SAAW,EAAA,aAAA;AAAA,IACX,gBAAA,EAAkB,CAAC,WAAW,CAAA;AAAA,IAC9B,MAAQ,EAAA,aAAA;AAAA,IACR,UAAY,EAAA;AAAA,GACd;AAAA,EACA,QAAU,EAAA;AAAA,IACR,IAAM,EAAA,eAAA;AAAA,IACN,SAAW,EAAA,eAAA;AAAA,IACX,gBAAA,EAAkB,CAAC,aAAa,CAAA;AAAA,IAChC,MAAQ,EAAA,aAAA;AAAA,IACR,UAAY,EAAA;AAAA,GACd;AAAA,EACA,OAAS,EAAA;AAAA,IACP,IAAM,EAAA,eAAA;AAAA,IACN,SAAW,EAAA,cAAA;AAAA,IACX,gBAAA,EAAkB,CAAC,YAAY,CAAA;AAAA,IAC/B,MAAQ,EAAA,aAAA;AAAA,IACR,UAAY,EAAA;AAAA;AAEhB;;;;"}
@@ -0,0 +1,46 @@
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { HeaderToolbar } from './HeaderToolbar.esm.js';
3
+ import { Tabs, TabList, Tab } from '../Tabs/Tabs.esm.js';
4
+ import { useStyles } from '../../hooks/useStyles.esm.js';
5
+
6
+ const Header = (props) => {
7
+ const {
8
+ tabs,
9
+ icon,
10
+ title,
11
+ titleLink,
12
+ menuItems,
13
+ breadcrumbs,
14
+ customActions,
15
+ onTabSelectionChange
16
+ } = props;
17
+ const { classNames } = useStyles("Header");
18
+ const hasTabs = tabs && tabs.length > 0;
19
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
20
+ /* @__PURE__ */ jsx(
21
+ HeaderToolbar,
22
+ {
23
+ icon,
24
+ title,
25
+ titleLink,
26
+ menuItems,
27
+ breadcrumbs,
28
+ customActions,
29
+ hasTabs
30
+ }
31
+ ),
32
+ tabs && /* @__PURE__ */ jsx("div", { className: classNames.tabsWrapper, children: /* @__PURE__ */ jsx(Tabs, { onSelectionChange: onTabSelectionChange, children: /* @__PURE__ */ jsx(TabList, { children: tabs?.map((tab) => /* @__PURE__ */ jsx(
33
+ Tab,
34
+ {
35
+ id: tab.id,
36
+ href: tab.href,
37
+ matchStrategy: tab.matchStrategy,
38
+ children: tab.label
39
+ },
40
+ tab.id
41
+ )) }) }) })
42
+ ] });
43
+ };
44
+
45
+ export { Header };
46
+ //# sourceMappingURL=Header.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Header.esm.js","sources":["../../../src/components/Header/Header.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 type { HeaderProps } from './types';\nimport { HeaderToolbar } from './HeaderToolbar';\nimport { Tabs, TabList, Tab } from '../Tabs';\nimport { useStyles } from '../../hooks/useStyles';\nimport { type NavigateOptions } from 'react-router-dom';\n\ndeclare module 'react-aria-components' {\n interface RouterConfig {\n routerOptions: NavigateOptions;\n }\n}\n\n/**\n * A component that renders a toolbar.\n *\n * @public\n */\nexport const Header = (props: HeaderProps) => {\n const {\n tabs,\n icon,\n title,\n titleLink,\n menuItems,\n breadcrumbs,\n customActions,\n onTabSelectionChange,\n } = props;\n\n const { classNames } = useStyles('Header');\n\n const hasTabs = tabs && tabs.length > 0;\n\n return (\n <>\n <HeaderToolbar\n icon={icon}\n title={title}\n titleLink={titleLink}\n menuItems={menuItems}\n breadcrumbs={breadcrumbs}\n customActions={customActions}\n hasTabs={hasTabs}\n />\n {tabs && (\n <div className={classNames.tabsWrapper}>\n <Tabs onSelectionChange={onTabSelectionChange}>\n <TabList>\n {tabs?.map(tab => (\n <Tab\n key={tab.id}\n id={tab.id}\n href={tab.href}\n matchStrategy={tab.matchStrategy}\n >\n {tab.label}\n </Tab>\n ))}\n </TabList>\n </Tabs>\n </div>\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;AAiCa,MAAA,MAAA,GAAS,CAAC,KAAuB,KAAA;AAC5C,EAAM,MAAA;AAAA,IACJ,IAAA;AAAA,IACA,IAAA;AAAA,IACA,KAAA;AAAA,IACA,SAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,aAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AAEJ,EAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,QAAQ,CAAA;AAEzC,EAAM,MAAA,OAAA,GAAU,IAAQ,IAAA,IAAA,CAAK,MAAS,GAAA,CAAA;AAEtC,EAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACC,IAAA;AAAA,QACA,KAAA;AAAA,QACA,SAAA;AAAA,QACA,SAAA;AAAA,QACA,WAAA;AAAA,QACA,aAAA;AAAA,QACA;AAAA;AAAA,KACF;AAAA,IACC,IACC,oBAAA,GAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,WAAW,WACzB,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,iBAAA,EAAmB,oBACvB,EAAA,QAAA,kBAAA,GAAA,CAAC,OACE,EAAA,EAAA,QAAA,EAAA,IAAA,EAAM,IAAI,CACT,GAAA,qBAAA,GAAA;AAAA,MAAC,GAAA;AAAA,MAAA;AAAA,QAEC,IAAI,GAAI,CAAA,EAAA;AAAA,QACR,MAAM,GAAI,CAAA,IAAA;AAAA,QACV,eAAe,GAAI,CAAA,aAAA;AAAA,QAElB,QAAI,EAAA,GAAA,CAAA;AAAA,OAAA;AAAA,MALA,GAAI,CAAA;AAAA,KAOZ,CACH,EAAA,CAAA,EACF,CACF,EAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,132 @@
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { RouterProvider, Link } from 'react-aria-components';
3
+ import { useStyles } from '../../hooks/useStyles.esm.js';
4
+ import { useRef, useState, useEffect } from 'react';
5
+ import { RiShapesLine, RiArrowRightSLine, RiMore2Line } from '@remixicon/react';
6
+ import { ButtonIcon } from '../ButtonIcon/ButtonIcon.esm.js';
7
+ import { Menu } from '../Menu/Menu.esm.js';
8
+ import { Text } from '../Text/Text.esm.js';
9
+ import { useScroll, useTransform, motion } from 'motion/react';
10
+ import { useNavigate, useHref } from 'react-router-dom';
11
+
12
+ const HeaderToolbar = (props) => {
13
+ const {
14
+ icon,
15
+ title,
16
+ titleLink,
17
+ menuItems,
18
+ breadcrumbs,
19
+ customActions,
20
+ hasTabs
21
+ } = props;
22
+ const { classNames } = useStyles("Header");
23
+ let navigate = useNavigate();
24
+ const { scrollY } = useScroll();
25
+ const breadcrumbOpacity = useTransform(scrollY, [80, 120], [0, 1]);
26
+ const toolbarWrapperRef = useRef(null);
27
+ const toolbarContentRef = useRef(null);
28
+ const toolbarControlsRef = useRef(null);
29
+ const [showBreadcrumbs, setShowBreadcrumbs] = useState(true);
30
+ useEffect(() => {
31
+ const wrapper = toolbarWrapperRef.current;
32
+ if (!wrapper) return;
33
+ const resizeObserver = new ResizeObserver(() => {
34
+ const wrapper2 = toolbarWrapperRef.current;
35
+ const content = toolbarContentRef.current;
36
+ const options = toolbarControlsRef.current;
37
+ if (!wrapper2 || !content) return;
38
+ const wrapperRect = wrapper2.getBoundingClientRect();
39
+ const wrapperWidth = wrapperRect.width;
40
+ const wrapperPadding = 24;
41
+ const availableWidth = wrapperWidth - wrapperPadding;
42
+ const contentRect = content.getBoundingClientRect();
43
+ const contentWidth = contentRect?.width || 0;
44
+ const optionsRect = options?.getBoundingClientRect();
45
+ const optionsWidth = optionsRect?.width || 0;
46
+ const shouldShowBreadcrumbs = contentWidth + optionsWidth + 32 <= availableWidth;
47
+ setShowBreadcrumbs(
48
+ (prev) => prev !== shouldShowBreadcrumbs ? shouldShowBreadcrumbs : prev
49
+ );
50
+ });
51
+ resizeObserver.observe(wrapper);
52
+ return () => {
53
+ resizeObserver.disconnect();
54
+ };
55
+ }, []);
56
+ const titleContent = /* @__PURE__ */ jsxs(Fragment, { children: [
57
+ /* @__PURE__ */ jsx("div", { className: classNames.toolbarIcon, children: icon || /* @__PURE__ */ jsx(RiShapesLine, {}) }),
58
+ /* @__PURE__ */ jsx(Text, { variant: "body-medium", children: title || "Your plugin" })
59
+ ] });
60
+ return /* @__PURE__ */ jsx(RouterProvider, { navigate, useHref, children: /* @__PURE__ */ jsx("div", { className: classNames.toolbar, "data-has-tabs": hasTabs, children: /* @__PURE__ */ jsxs("div", { className: classNames.toolbarWrapper, ref: toolbarWrapperRef, children: [
61
+ /* @__PURE__ */ jsxs("div", { className: classNames.toolbarContent, ref: toolbarContentRef, children: [
62
+ titleLink ? /* @__PURE__ */ jsx(Link, { className: classNames.toolbarName, href: titleLink, children: titleContent }) : /* @__PURE__ */ jsx("div", { className: classNames.toolbarName, children: titleContent }),
63
+ breadcrumbs && /* @__PURE__ */ jsxs(
64
+ motion.div,
65
+ {
66
+ className: classNames.breadcrumbs,
67
+ style: {
68
+ opacity: breadcrumbOpacity,
69
+ visibility: showBreadcrumbs ? "visible" : "hidden"
70
+ },
71
+ children: [
72
+ /* @__PURE__ */ jsx(
73
+ RiArrowRightSLine,
74
+ {
75
+ size: 16,
76
+ className: classNames.breadcrumbSeparator
77
+ }
78
+ ),
79
+ breadcrumbs.map((breadcrumb, index) => /* @__PURE__ */ jsxs("div", { className: classNames.breadcrumb, children: [
80
+ /* @__PURE__ */ jsx(
81
+ Link,
82
+ {
83
+ href: breadcrumb.href,
84
+ className: classNames.breadcrumbLink,
85
+ "data-active": index === breadcrumbs.length - 1,
86
+ children: breadcrumb.label
87
+ }
88
+ ),
89
+ index < breadcrumbs.length - 1 && /* @__PURE__ */ jsx(
90
+ RiArrowRightSLine,
91
+ {
92
+ size: 16,
93
+ className: classNames.breadcrumbSeparator
94
+ }
95
+ )
96
+ ] }, breadcrumb.label))
97
+ ]
98
+ }
99
+ )
100
+ ] }),
101
+ /* @__PURE__ */ jsxs("div", { className: classNames.toolbarControls, ref: toolbarControlsRef, children: [
102
+ customActions,
103
+ menuItems && /* @__PURE__ */ jsxs(Menu.Root, { children: [
104
+ /* @__PURE__ */ jsx(
105
+ Menu.Trigger,
106
+ {
107
+ render: (props2) => /* @__PURE__ */ jsx(
108
+ ButtonIcon,
109
+ {
110
+ size: "small",
111
+ icon: /* @__PURE__ */ jsx(RiMore2Line, {}),
112
+ variant: "tertiary",
113
+ ...props2
114
+ }
115
+ )
116
+ }
117
+ ),
118
+ /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, { sideOffset: 4, align: "end", children: /* @__PURE__ */ jsx(Menu.Popup, { children: menuItems.map((option) => /* @__PURE__ */ jsx(
119
+ Menu.Item,
120
+ {
121
+ onClick: () => option.onClick?.(),
122
+ children: option.label
123
+ },
124
+ option.value
125
+ )) }) }) })
126
+ ] })
127
+ ] })
128
+ ] }) }) });
129
+ };
130
+
131
+ export { HeaderToolbar };
132
+ //# sourceMappingURL=HeaderToolbar.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeaderToolbar.esm.js","sources":["../../../src/components/Header/HeaderToolbar.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 { Link, RouterProvider } from 'react-aria-components';\nimport { useStyles } from '../../hooks/useStyles';\nimport { useRef, useState, useEffect } from 'react';\nimport { RiArrowRightSLine, RiMore2Line, RiShapesLine } from '@remixicon/react';\nimport type { HeaderToolbarProps } from './types';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Menu } from '../Menu';\nimport { Text } from '../Text';\nimport { motion, useScroll, useTransform } from 'motion/react';\nimport { useNavigate, useHref } from 'react-router-dom';\n\n/**\n * A component that renders a toolbar.\n *\n * @internal\n */\nexport const HeaderToolbar = (props: HeaderToolbarProps) => {\n const {\n icon,\n title,\n titleLink,\n menuItems,\n breadcrumbs,\n customActions,\n hasTabs,\n } = props;\n const { classNames } = useStyles('Header');\n let navigate = useNavigate();\n const { scrollY } = useScroll();\n const breadcrumbOpacity = useTransform(scrollY, [80, 120], [0, 1]);\n\n // Refs for collision detection\n const toolbarWrapperRef = useRef<HTMLDivElement>(null);\n const toolbarContentRef = useRef<HTMLDivElement>(null);\n const toolbarControlsRef = useRef<HTMLDivElement>(null);\n\n // State for breadcrumb visibility\n const [showBreadcrumbs, setShowBreadcrumbs] = useState(true);\n\n // Set up resize observer\n useEffect(() => {\n const wrapper = toolbarWrapperRef.current;\n if (!wrapper) return;\n\n const resizeObserver = new ResizeObserver(() => {\n const wrapper = toolbarWrapperRef.current;\n const content = toolbarContentRef.current;\n const options = toolbarControlsRef.current;\n\n if (!wrapper || !content) return;\n\n // Get dimensions\n const wrapperRect = wrapper.getBoundingClientRect();\n const wrapperWidth = wrapperRect.width;\n const wrapperPadding = 24; // 12px on each side (var(--bui-space-3))\n const availableWidth = wrapperWidth - wrapperPadding;\n\n // Calculate required width for content\n const contentRect = content.getBoundingClientRect();\n const contentWidth = contentRect?.width || 0;\n\n // Calculate options width (if exists)\n const optionsRect = options?.getBoundingClientRect();\n const optionsWidth = optionsRect?.width || 0;\n\n // Check if we need to hide breadcrumbs\n const shouldShowBreadcrumbs =\n contentWidth + optionsWidth + 32 <= availableWidth;\n\n // Only update state if the value actually changed to prevent flickering\n setShowBreadcrumbs(prev =>\n prev !== shouldShowBreadcrumbs ? shouldShowBreadcrumbs : prev,\n );\n });\n\n resizeObserver.observe(wrapper);\n\n return () => {\n resizeObserver.disconnect();\n };\n }, []);\n\n const titleContent = (\n <>\n <div className={classNames.toolbarIcon}>{icon || <RiShapesLine />}</div>\n <Text variant=\"body-medium\">{title || 'Your plugin'}</Text>\n </>\n );\n\n return (\n <RouterProvider navigate={navigate} useHref={useHref}>\n <div className={classNames.toolbar} data-has-tabs={hasTabs}>\n <div className={classNames.toolbarWrapper} ref={toolbarWrapperRef}>\n <div className={classNames.toolbarContent} ref={toolbarContentRef}>\n {titleLink ? (\n <Link className={classNames.toolbarName} href={titleLink}>\n {titleContent}\n </Link>\n ) : (\n <div className={classNames.toolbarName}>{titleContent}</div>\n )}\n {breadcrumbs && (\n <motion.div\n className={classNames.breadcrumbs}\n style={{\n opacity: breadcrumbOpacity,\n visibility: showBreadcrumbs ? 'visible' : 'hidden',\n }}\n >\n <RiArrowRightSLine\n size={16}\n className={classNames.breadcrumbSeparator}\n />\n {breadcrumbs.map((breadcrumb, index) => (\n <div key={breadcrumb.label} className={classNames.breadcrumb}>\n <Link\n href={breadcrumb.href}\n className={classNames.breadcrumbLink}\n data-active={index === breadcrumbs.length - 1}\n >\n {breadcrumb.label}\n </Link>\n {index < breadcrumbs.length - 1 && (\n <RiArrowRightSLine\n size={16}\n className={classNames.breadcrumbSeparator}\n />\n )}\n </div>\n ))}\n </motion.div>\n )}\n </div>\n <div className={classNames.toolbarControls} ref={toolbarControlsRef}>\n {customActions}\n {menuItems && (\n <Menu.Root>\n <Menu.Trigger\n render={props => (\n <ButtonIcon\n size=\"small\"\n icon={<RiMore2Line />}\n variant=\"tertiary\"\n {...props}\n />\n )}\n />\n <Menu.Portal>\n <Menu.Positioner sideOffset={4} align=\"end\">\n <Menu.Popup>\n {menuItems.map(option => (\n <Menu.Item\n key={option.value}\n onClick={() => option.onClick?.()}\n >\n {option.label}\n </Menu.Item>\n ))}\n </Menu.Popup>\n </Menu.Positioner>\n </Menu.Portal>\n </Menu.Root>\n )}\n </div>\n </div>\n </div>\n </RouterProvider>\n );\n};\n"],"names":["wrapper","props"],"mappings":";;;;;;;;;;;AAgCa,MAAA,aAAA,GAAgB,CAAC,KAA8B,KAAA;AAC1D,EAAM,MAAA;AAAA,IACJ,IAAA;AAAA,IACA,KAAA;AAAA,IACA,SAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,aAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AACJ,EAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,QAAQ,CAAA;AACzC,EAAA,IAAI,WAAW,WAAY,EAAA;AAC3B,EAAM,MAAA,EAAE,OAAQ,EAAA,GAAI,SAAU,EAAA;AAC9B,EAAM,MAAA,iBAAA,GAAoB,YAAa,CAAA,OAAA,EAAS,CAAC,EAAA,EAAI,GAAG,CAAG,EAAA,CAAC,CAAG,EAAA,CAAC,CAAC,CAAA;AAGjE,EAAM,MAAA,iBAAA,GAAoB,OAAuB,IAAI,CAAA;AACrD,EAAM,MAAA,iBAAA,GAAoB,OAAuB,IAAI,CAAA;AACrD,EAAM,MAAA,kBAAA,GAAqB,OAAuB,IAAI,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Y,CAAG,EAAA,KAAA,EAAM,OACpC,QAAC,kBAAA,GAAA,CAAA,IAAA,CAAK,OAAL,EACE,QAAA,EAAA,SAAA,CAAU,IAAI,CACb,MAAA,qBAAA,GAAA;AAAA,UAAC,IAAK,CAAA,IAAA;AAAA,UAAL;AAAA,YAEC,OAAA,EAAS,MAAM,MAAA,CAAO,OAAU,IAAA;AAAA,YAE/B,QAAO,EAAA,MAAA,CAAA;AAAA,WAAA;AAAA,UAHH,MAAO,CAAA;AAAA,SAKf,CACH,EAAA,CAAA,EACF,CACF,EAAA;AAAA,OACF,EAAA;AAAA,KAEJ,EAAA;AAAA,GAAA,EACF,GACF,CACF,EAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,57 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { Menu } from '../Menu/Menu.esm.js';
3
+ import { Text } from '../Text/Text.esm.js';
4
+ import { ButtonIcon } from '../ButtonIcon/ButtonIcon.esm.js';
5
+ import { RiMore2Line } from '@remixicon/react';
6
+ import { Tabs, TabList, Tab } from '../Tabs/Tabs.esm.js';
7
+ import { useStyles } from '../../hooks/useStyles.esm.js';
8
+
9
+ const HeaderPage = (props) => {
10
+ const { title, menuItems, tabs, customActions } = props;
11
+ const { classNames } = useStyles("HeaderPage");
12
+ return /* @__PURE__ */ jsxs("div", { className: classNames.root, children: [
13
+ /* @__PURE__ */ jsxs("div", { className: classNames.content, children: [
14
+ /* @__PURE__ */ jsx(Text, { variant: "title-small", weight: "bold", children: title }),
15
+ /* @__PURE__ */ jsxs("div", { className: classNames.controls, children: [
16
+ customActions,
17
+ menuItems && /* @__PURE__ */ jsxs(Menu.Root, { children: [
18
+ /* @__PURE__ */ jsx(
19
+ Menu.Trigger,
20
+ {
21
+ render: (props2) => /* @__PURE__ */ jsx(
22
+ ButtonIcon,
23
+ {
24
+ ...props2,
25
+ size: "small",
26
+ icon: /* @__PURE__ */ jsx(RiMore2Line, {}),
27
+ variant: "tertiary"
28
+ }
29
+ )
30
+ }
31
+ ),
32
+ /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, { sideOffset: 4, align: "end", children: /* @__PURE__ */ jsx(Menu.Popup, { children: menuItems.map((menuItem) => /* @__PURE__ */ jsx(
33
+ Menu.Item,
34
+ {
35
+ onClick: () => menuItem.onClick?.(),
36
+ children: menuItem.label
37
+ },
38
+ menuItem.value
39
+ )) }) }) })
40
+ ] })
41
+ ] })
42
+ ] }),
43
+ tabs && /* @__PURE__ */ jsx("div", { className: classNames.tabsWrapper, children: /* @__PURE__ */ jsx(Tabs, { children: /* @__PURE__ */ jsx(TabList, { children: tabs.map((tab) => /* @__PURE__ */ jsx(
44
+ Tab,
45
+ {
46
+ id: tab.id,
47
+ href: tab.href,
48
+ matchStrategy: tab.matchStrategy,
49
+ children: tab.label
50
+ },
51
+ tab.id
52
+ )) }) }) })
53
+ ] });
54
+ };
55
+
56
+ export { HeaderPage };
57
+ //# sourceMappingURL=HeaderPage.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeaderPage.esm.js","sources":["../../../src/components/HeaderPage/HeaderPage.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 type { HeaderPageProps } from './types';\nimport { Menu } from '../Menu';\nimport { Text } from '../Text';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { RiMore2Line } from '@remixicon/react';\nimport { Tabs, TabList, Tab } from '../Tabs';\nimport { useStyles } from '../../hooks/useStyles';\n\n/**\n * A component that renders a header page.\n *\n * @public\n */\nexport const HeaderPage = (props: HeaderPageProps) => {\n const { title, menuItems, tabs, customActions } = props;\n const { classNames } = useStyles('HeaderPage');\n\n return (\n <div className={classNames.root}>\n <div className={classNames.content}>\n <Text variant=\"title-small\" weight=\"bold\">\n {title}\n </Text>\n <div className={classNames.controls}>\n {customActions}\n {menuItems && (\n <Menu.Root>\n <Menu.Trigger\n render={props => (\n <ButtonIcon\n {...props}\n size=\"small\"\n icon={<RiMore2Line />}\n variant=\"tertiary\"\n />\n )}\n />\n <Menu.Portal>\n <Menu.Positioner sideOffset={4} align=\"end\">\n <Menu.Popup>\n {menuItems.map(menuItem => (\n <Menu.Item\n key={menuItem.value}\n onClick={() => menuItem.onClick?.()}\n >\n {menuItem.label}\n </Menu.Item>\n ))}\n </Menu.Popup>\n </Menu.Positioner>\n </Menu.Portal>\n </Menu.Root>\n )}\n </div>\n </div>\n {tabs && (\n <div className={classNames.tabsWrapper}>\n <Tabs>\n <TabList>\n {tabs.map(tab => (\n <Tab\n key={tab.id}\n id={tab.id}\n href={tab.href}\n matchStrategy={tab.matchStrategy}\n >\n {tab.label}\n </Tab>\n ))}\n </TabList>\n </Tabs>\n </div>\n )}\n </div>\n );\n};\n"],"names":["props"],"mappings":";;;;;;;;AA6Ba,MAAA,UAAA,GAAa,CAAC,KAA2B,KAAA;AACpD,EAAA,MAAM,EAAE,KAAA,EAAO,SAAW,EAAA,IAAA,EAAM,eAAkB,GAAA,KAAA;AAClD,EAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,YAAY,CAAA;AAE7C,EAAA,uBACG,IAAA,CAAA,KAAA,EAAA,EAAI,SAAW,EAAA,UAAA,CAAW,IACzB,EAAA,QAAA,EAAA;AAAA,oBAAC,IAAA,CAAA,KAAA,EAAA,EAAI,SAAW,EAAA,UAAA,CAAW,OACzB,EAAA,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,aAAc,EAAA,MAAA,EAAO,QAChC,QACH,EAAA,KA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AAA,qBAAA,GAAA;AAAA,MAAC,GAAA;AAAA,MAAA;AAAA,QAEC,IAAI,GAAI,CAAA,EAAA;AAAA,QACR,MAAM,GAAI,CAAA,IAAA;AAAA,QACV,eAAe,GAAI,CAAA,aAAA;AAAA,QAElB,QAAI,EAAA,GAAA,CAAA;AAAA,OAAA;AAAA,MALA,GAAI,CAAA;AAAA,KAOZ,CACH,EAAA,CAAA,EACF,CACF,EAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,29 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useIcons } from './context.esm.js';
3
+ import clsx from 'clsx';
4
+ import { useStyles } from '../../hooks/useStyles.esm.js';
5
+
6
+ const Icon = (props) => {
7
+ const { name, size, className, style, ...restProps } = props;
8
+ const { icons } = useIcons();
9
+ const BckstageIcon = icons[name];
10
+ if (!BckstageIcon) {
11
+ console.error(`Icon "${name}" not found or is not a valid component.`);
12
+ return null;
13
+ }
14
+ const { classNames } = useStyles("Icon");
15
+ return /* @__PURE__ */ jsx(
16
+ BckstageIcon,
17
+ {
18
+ className: clsx(classNames.root, className),
19
+ style: {
20
+ ...size ? { width: size, height: size } : {},
21
+ ...style
22
+ },
23
+ ...restProps
24
+ }
25
+ );
26
+ };
27
+
28
+ export { Icon };
29
+ //# sourceMappingURL=Icon.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Icon.esm.js","sources":["../../../src/components/Icon/Icon.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 { ComponentType } from 'react';\nimport { useIcons } from './context';\nimport type { IconProps } from './types';\nimport clsx from 'clsx';\nimport { useStyles } from '../../hooks/useStyles';\n\n/** @public */\nexport const Icon = (props: IconProps) => {\n const { name, size, className, style, ...restProps } = props;\n const { icons } = useIcons();\n\n const BckstageIcon = icons[name] as ComponentType<Omit<IconProps, 'name'>>;\n\n if (!BckstageIcon) {\n console.error(`Icon \"${name}\" not found or is not a valid component.`);\n return null;\n }\n\n const { classNames } = useStyles('Icon');\n\n return (\n <BckstageIcon\n className={clsx(classNames.root, className)}\n style={{\n ...(size ? { width: size, height: size } : {}),\n ...style,\n }}\n {...restProps}\n />\n );\n};\n"],"names":[],"mappings":";;;;;AAuBa,MAAA,IAAA,GAAO,CAAC,KAAqB,KAAA;AACxC,EAAA,MAAM,EAAE,IAAM,EAAA,IAAA,EAAM,WAAW,KAAO,EAAA,GAAG,WAAc,GAAA,KAAA;AACvD,EAAM,MAAA,EAAE,KAAM,EAAA,GAAI,QAAS,EAAA;AAE3B,EAAM,MAAA,YAAA,GAAe,MAAM,IAAI,CAAA;AAE/B,EAAA,IAAI,CAAC,YAAc,EAAA;AACjB,IAAQ,OAAA,CAAA,KAAA,CAAM,CAAS,MAAA,EAAA,IAAI,CAA0C,wCAAA,CAAA,CAAA;AACrE,IAAO,OAAA,IAAA;AAAA;AAGT,EAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,MAAM,CAAA;AAEvC,EACE,uBAAA,GAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,IAAA,CAAK,UAAW,CAAA,IAAA,EAAM,SAAS,CAAA;AAAA,MAC1C,KAAO,EAAA;AAAA,QACL,GAAI,OAAO,EAAE,KAAA,EAAO,MAAM,MAAQ,EAAA,IAAA,KAAS,EAAC;AAAA,QAC5C,GAAG;AAAA,OACL;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;;;;"}
@@ -0,0 +1,10 @@
1
+ import { createContext, useContext } from 'react';
2
+ import { icons } from './icons.esm.js';
3
+
4
+ const IconContext = createContext({
5
+ icons
6
+ });
7
+ const useIcons = () => useContext(IconContext);
8
+
9
+ export { IconContext, useIcons };
10
+ //# sourceMappingURL=context.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.esm.js","sources":["../../../src/components/Icon/context.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 { createContext, useContext } from 'react';\nimport { icons } from './icons';\nimport type { IconContextProps } from './types';\n\n/** @public */\nexport const IconContext = createContext<IconContextProps>({\n icons,\n});\n\n/** @public */\nexport const useIcons = () => useContext(IconContext);\n"],"names":[],"mappings":";;;AAqBO,MAAM,cAAc,aAAgC,CAAA;AAAA,EACzD;AACF,CAAC;AAGY,MAAA,QAAA,GAAW,MAAM,UAAA,CAAW,WAAW;;;;"}
@@ -0,0 +1,63 @@
1
+ import { RiAccountCircleLine, RiAlertLine, RiArrowDownLine, RiArrowDownCircleLine, RiArrowDropDownLine, RiArrowDropLeftLine, RiArrowDropRightLine, RiArrowDropUpLine, RiArrowLeftLine, RiArrowLeftCircleLine, RiArrowLeftDownLine, RiArrowLeftUpLine, RiArrowRightLine, RiArrowRightCircleLine, RiArrowRightDownLine, RiArrowRightUpLine, RiArrowUpLine, RiArrowUpCircleLine, RiBracesLine, RiBracketsLine, RiBugLine, RiCheckLine, RiCheckDoubleLine, RiArrowDownSLine, RiArrowLeftSLine, RiArrowRightSLine, RiArrowUpSLine, RiCloseLine, RiCloudLine, RiCodeLine, RiDiscordLine, RiDownloadLine, RiExternalLinkLine, RiEyeLine, RiEyeOffLine, RiFilterLine, RiFlowerLine, RiGithubLine, RiGitRepositoryLine, RiGroupLine, RiHeartLine, RiMoonLine, RiAddLine, RiSearchLine, RiSidebarFoldLine, RiSidebarUnfoldLine, RiSparklingLine, RiStarLine, RiSunLine, RiTerminalLine, RiDeleteBin6Line, RiUploadLine, RiUserLine, RiYoutubeLine, RiZoomInLine, RiZoomOutLine } from '@remixicon/react';
2
+
3
+ const icons = {
4
+ "account-circle": RiAccountCircleLine,
5
+ alert: RiAlertLine,
6
+ "arrow-down": RiArrowDownLine,
7
+ "arrow-down-circle": RiArrowDownCircleLine,
8
+ "caret-down": RiArrowDropDownLine,
9
+ "caret-left": RiArrowDropLeftLine,
10
+ "caret-right": RiArrowDropRightLine,
11
+ "caret-up": RiArrowDropUpLine,
12
+ "arrow-left": RiArrowLeftLine,
13
+ "arrow-left-circle": RiArrowLeftCircleLine,
14
+ "arrow-left-down": RiArrowLeftDownLine,
15
+ "arrow-left-up": RiArrowLeftUpLine,
16
+ "arrow-right": RiArrowRightLine,
17
+ "arrow-right-circle": RiArrowRightCircleLine,
18
+ "arrow-right-down": RiArrowRightDownLine,
19
+ "arrow-right-up": RiArrowRightUpLine,
20
+ "arrow-up": RiArrowUpLine,
21
+ "arrow-up-circle": RiArrowUpCircleLine,
22
+ braces: RiBracesLine,
23
+ brackets: RiBracketsLine,
24
+ bug: RiBugLine,
25
+ check: RiCheckLine,
26
+ "check-double": RiCheckDoubleLine,
27
+ "chevron-down": RiArrowDownSLine,
28
+ "chevron-left": RiArrowLeftSLine,
29
+ "chevron-right": RiArrowRightSLine,
30
+ "chevron-up": RiArrowUpSLine,
31
+ close: RiCloseLine,
32
+ cloud: RiCloudLine,
33
+ code: RiCodeLine,
34
+ discord: RiDiscordLine,
35
+ download: RiDownloadLine,
36
+ "external-link": RiExternalLinkLine,
37
+ eye: RiEyeLine,
38
+ "eye-off": RiEyeOffLine,
39
+ filter: RiFilterLine,
40
+ flower: RiFlowerLine,
41
+ github: RiGithubLine,
42
+ "git-repository": RiGitRepositoryLine,
43
+ group: RiGroupLine,
44
+ heart: RiHeartLine,
45
+ moon: RiMoonLine,
46
+ plus: RiAddLine,
47
+ search: RiSearchLine,
48
+ "sidebar-fold": RiSidebarFoldLine,
49
+ "sidebar-unfold": RiSidebarUnfoldLine,
50
+ sparkling: RiSparklingLine,
51
+ star: RiStarLine,
52
+ sun: RiSunLine,
53
+ terminal: RiTerminalLine,
54
+ trash: RiDeleteBin6Line,
55
+ upload: RiUploadLine,
56
+ user: RiUserLine,
57
+ youtube: RiYoutubeLine,
58
+ "zoom-in": RiZoomInLine,
59
+ "zoom-out": RiZoomOutLine
60
+ };
61
+
62
+ export { icons };
63
+ //# sourceMappingURL=icons.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.esm.js","sources":["../../../src/components/Icon/icons.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\n// We can add custom icons to the list outside of Remix\n\nimport type { IconMap } from './types';\nimport {\n RiHeartLine,\n RiArrowDownLine,\n RiCloudLine,\n RiArrowLeftLine,\n RiArrowRightLine,\n RiArrowUpLine,\n RiDeleteBin6Line,\n RiAddLine,\n RiArrowDownSLine,\n RiArrowUpSLine,\n RiArrowLeftSLine,\n RiArrowRightSLine,\n RiArrowDownCircleLine,\n RiArrowLeftCircleLine,\n RiArrowRightCircleLine,\n RiArrowUpCircleLine,\n RiCheckLine,\n RiMoonLine,\n RiSunLine,\n RiExternalLinkLine,\n RiArrowLeftDownLine,\n RiArrowRightDownLine,\n RiArrowLeftUpLine,\n RiArrowRightUpLine,\n RiArrowDropDownLine,\n RiArrowDropUpLine,\n RiArrowDropLeftLine,\n RiArrowDropRightLine,\n RiSparklingLine,\n RiFlowerLine,\n RiCodeLine,\n RiTerminalLine,\n RiBracketsLine,\n RiBracesLine,\n RiBugLine,\n RiGitRepositoryLine,\n RiCheckDoubleLine,\n RiFilterLine,\n RiEyeLine,\n RiEyeOffLine,\n RiDownloadLine,\n RiUploadLine,\n RiStarLine,\n RiSidebarFoldLine,\n RiSidebarUnfoldLine,\n RiZoomInLine,\n RiZoomOutLine,\n RiAlertLine,\n RiAccountCircleLine,\n RiGroupLine,\n RiUserLine,\n RiGithubLine,\n RiDiscordLine,\n RiYoutubeLine,\n RiCloseLine,\n RiSearchLine,\n} from '@remixicon/react';\n\n/** @public */\nexport const icons: IconMap = {\n 'account-circle': RiAccountCircleLine,\n alert: RiAlertLine,\n 'arrow-down': RiArrowDownLine,\n 'arrow-down-circle': RiArrowDownCircleLine,\n 'caret-down': RiArrowDropDownLine,\n 'caret-left': RiArrowDropLeftLine,\n 'caret-right': RiArrowDropRightLine,\n 'caret-up': RiArrowDropUpLine,\n 'arrow-left': RiArrowLeftLine,\n 'arrow-left-circle': RiArrowLeftCircleLine,\n 'arrow-left-down': RiArrowLeftDownLine,\n 'arrow-left-up': RiArrowLeftUpLine,\n 'arrow-right': RiArrowRightLine,\n 'arrow-right-circle': RiArrowRightCircleLine,\n 'arrow-right-down': RiArrowRightDownLine,\n 'arrow-right-up': RiArrowRightUpLine,\n 'arrow-up': RiArrowUpLine,\n 'arrow-up-circle': RiArrowUpCircleLine,\n braces: RiBracesLine,\n brackets: RiBracketsLine,\n bug: RiBugLine,\n check: RiCheckLine,\n 'check-double': RiCheckDoubleLine,\n 'chevron-down': RiArrowDownSLine,\n 'chevron-left': RiArrowLeftSLine,\n 'chevron-right': RiArrowRightSLine,\n 'chevron-up': RiArrowUpSLine,\n close: RiCloseLine,\n cloud: RiCloudLine,\n code: RiCodeLine,\n discord: RiDiscordLine,\n download: RiDownloadLine,\n 'external-link': RiExternalLinkLine,\n eye: RiEyeLine,\n 'eye-off': RiEyeOffLine,\n filter: RiFilterLine,\n flower: RiFlowerLine,\n github: RiGithubLine,\n 'git-repository': RiGitRepositoryLine,\n group: RiGroupLine,\n heart: RiHeartLine,\n moon: RiMoonLine,\n plus: RiAddLine,\n search: RiSearchLine,\n 'sidebar-fold': RiSidebarFoldLine,\n 'sidebar-unfold': RiSidebarUnfoldLine,\n sparkling: RiSparklingLine,\n star: RiStarLine,\n sun: RiSunLine,\n terminal: RiTerminalLine,\n trash: RiDeleteBin6Line,\n upload: RiUploadLine,\n user: RiUserLine,\n youtube: RiYoutubeLine,\n 'zoom-in': RiZoomInLine,\n 'zoom-out': RiZoomOutLine,\n} as const;\n"],"names":[],"mappings":";;AA+EO,MAAM,KAAiB,GAAA;AAAA,EAC5B,gBAAkB,EAAA,mBAAA;AAAA,EAClB,KAAO,EAAA,WAAA;AAAA,EACP,YAAc,EAAA,eAAA;AAAA,EACd,mBAAqB,EAAA,qBAAA;AAAA,EACrB,YAAc,EAAA,mBAAA;AAAA,EACd,YAAc,EAAA,mBAAA;AAAA,EACd,aAAe,EAAA,oBAAA;AAAA,EACf,UAAY,EAAA,iBAAA;AAAA,EACZ,YAAc,EAAA,eAAA;AAAA,EACd,mBAAqB,EAAA,qBAAA;AAAA,EACrB,iBAAmB,EAAA,mBAAA;AAAA,EACnB,eAAiB,EAAA,iBAAA;AAAA,EACjB,aAAe,EAAA,gBAAA;AAAA,EACf,oBAAsB,EAAA,sBAAA;AAAA,EACtB,kBAAoB,EAAA,oBAAA;AAAA,EACpB,gBAAkB,EAAA,kBAAA;AAAA,EAClB,UAAY,EAAA,aAAA;AAAA,EACZ,iBAAmB,EAAA,mBAAA;AAAA,EACnB,MAAQ,EAAA,YAAA;AAAA,EACR,QAAU,EAAA,cAAA;AAAA,EACV,GAAK,EAAA,SAAA;AAAA,EACL,KAAO,EAAA,WAAA;AAAA,EACP,cAAgB,EAAA,iBAAA;AAAA,EAChB,cAAgB,EAAA,gBAAA;AAAA,EAChB,cAAgB,EAAA,gBAAA;AAAA,EAChB,eAAiB,EAAA,iBAAA;AAAA,EACjB,YAAc,EAAA,cAAA;AAAA,EACd,KAAO,EAAA,WAAA;AAAA,EACP,KAAO,EAAA,WAAA;AAAA,EACP,IAAM,EAAA,UAAA;AAAA,EACN,OAAS,EAAA,aAAA;AAAA,EACT,QAAU,EAAA,cAAA;AAAA,EACV,eAAiB,EAAA,kBAAA;AAAA,EACjB,GAAK,EAAA,SAAA;AAAA,EACL,SAAW,EAAA,YAAA;AAAA,EACX,MAAQ,EAAA,YAAA;AAAA,EACR,MAAQ,EAAA,YAAA;AAAA,EACR,MAAQ,EAAA,YAAA;AAAA,EACR,gBAAkB,EAAA,mBAAA;AAAA,EAClB,KAAO,EAAA,WAAA;AAAA,EACP,KAAO,EAAA,WAAA;AAAA,EACP,IAAM,EAAA,UAAA;AAAA,EACN,IAAM,EAAA,SAAA;AAAA,EACN,MAAQ,EAAA,YAAA;AAAA,EACR,cAAgB,EAAA,iBAAA;AAAA,EAChB,gBAAkB,EAAA,mBAAA;AAAA,EAClB,SAAW,EAAA,eAAA;AAAA,EACX,IAAM,EAAA,UAAA;AAAA,EACN,GAAK,EAAA,SAAA;AAAA,EACL,QAAU,EAAA,cAAA;AAAA,EACV,KAAO,EAAA,gBAAA;AAAA,EACP,MAAQ,EAAA,YAAA;AAAA,EACR,IAAM,EAAA,UAAA;AAAA,EACN,OAAS,EAAA,aAAA;AAAA,EACT,SAAW,EAAA,YAAA;AAAA,EACX,UAAY,EAAA;AACd;;;;"}
@@ -0,0 +1,12 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { icons } from './icons.esm.js';
3
+ import { IconContext } from './context.esm.js';
4
+
5
+ const IconProvider = (props) => {
6
+ const { children, overrides } = props;
7
+ const combinedIcons = { ...icons, ...overrides };
8
+ return /* @__PURE__ */ jsx(IconContext.Provider, { value: { icons: combinedIcons }, children });
9
+ };
10
+
11
+ export { IconProvider };
12
+ //# sourceMappingURL=provider.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.esm.js","sources":["../../../src/components/Icon/provider.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 { icons } from './icons';\nimport { IconContext } from './context';\nimport type { IconProviderProps } from './types';\n\n/** @public */\nexport const IconProvider = (props: IconProviderProps) => {\n const { children, overrides } = props;\n\n // Merge provided overrides with default icons\n const combinedIcons = { ...icons, ...overrides };\n\n return (\n <IconContext.Provider value={{ icons: combinedIcons }}>\n {children}\n </IconContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;AAqBa,MAAA,YAAA,GAAe,CAAC,KAA6B,KAAA;AACxD,EAAM,MAAA,EAAE,QAAU,EAAA,SAAA,EAAc,GAAA,KAAA;AAGhC,EAAA,MAAM,aAAgB,GAAA,EAAE,GAAG,KAAA,EAAO,GAAG,SAAU,EAAA;AAE/C,EACE,uBAAA,GAAA,CAAC,YAAY,QAAZ,EAAA,EAAqB,OAAO,EAAE,KAAA,EAAO,aAAc,EAAA,EACjD,QACH,EAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,67 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { forwardRef } from 'react';
3
+ import { Link as Link$1, RouterProvider } from 'react-aria-components';
4
+ import clsx from 'clsx';
5
+ import { useStyles } from '../../hooks/useStyles.esm.js';
6
+ import { useNavigate, useHref } from 'react-router-dom';
7
+
8
+ function isExternalLink(href) {
9
+ if (!href) return false;
10
+ if (href.startsWith("http://") || href.startsWith("https://")) {
11
+ return true;
12
+ }
13
+ if (href.startsWith("//")) {
14
+ return true;
15
+ }
16
+ if (href.startsWith("mailto:") || href.startsWith("tel:")) {
17
+ return true;
18
+ }
19
+ return false;
20
+ }
21
+ const Link = forwardRef((props, ref) => {
22
+ const navigate = useNavigate();
23
+ const {
24
+ className,
25
+ variant = "body",
26
+ weight = "regular",
27
+ color = "primary",
28
+ truncate,
29
+ href,
30
+ ...restProps
31
+ } = props;
32
+ const { classNames: linkClassNames } = useStyles("Link");
33
+ const { classNames: textClassNames, dataAttributes: textDataAttributes } = useStyles("Text", {
34
+ variant,
35
+ weight,
36
+ color
37
+ });
38
+ const isExternal = isExternalLink(href);
39
+ if (isExternal) {
40
+ return /* @__PURE__ */ jsx(
41
+ Link$1,
42
+ {
43
+ ref,
44
+ className: clsx(textClassNames.root, linkClassNames.root, className),
45
+ "data-truncate": truncate,
46
+ href,
47
+ ...textDataAttributes,
48
+ ...restProps
49
+ }
50
+ );
51
+ }
52
+ return /* @__PURE__ */ jsx(RouterProvider, { navigate, useHref, children: /* @__PURE__ */ jsx(
53
+ Link$1,
54
+ {
55
+ ref,
56
+ className: clsx(textClassNames.root, linkClassNames.root, className),
57
+ "data-truncate": truncate,
58
+ ...textDataAttributes,
59
+ href,
60
+ ...restProps
61
+ }
62
+ ) });
63
+ });
64
+ Link.displayName = "Link";
65
+
66
+ export { Link };
67
+ //# sourceMappingURL=Link.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Link.esm.js","sources":["../../../src/components/Link/Link.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 { Link as AriaLink, RouterProvider } from 'react-aria-components';\nimport clsx from 'clsx';\nimport { useStyles } from '../../hooks/useStyles';\nimport type { LinkProps } from './types';\nimport { useNavigate, useHref } from 'react-router-dom';\n\n// Helper function to determine if a link is external\nfunction isExternalLink(href?: string): boolean {\n if (!href) return false;\n\n // Check if it's an absolute URL with protocol\n if (href.startsWith('http://') || href.startsWith('https://')) {\n return true;\n }\n\n // Check if it's a protocol-relative URL\n if (href.startsWith('//')) {\n return true;\n }\n\n // Check if it's a mailto: or tel: link\n if (href.startsWith('mailto:') || href.startsWith('tel:')) {\n return true;\n }\n\n return false;\n}\n\n/** @public */\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>((props, ref) => {\n const navigate = useNavigate();\n const {\n className,\n variant = 'body',\n weight = 'regular',\n color = 'primary',\n truncate,\n href,\n ...restProps\n } = props;\n\n const { classNames: linkClassNames } = useStyles('Link');\n const { classNames: textClassNames, dataAttributes: textDataAttributes } =\n useStyles('Text', {\n variant,\n weight,\n color,\n });\n\n const isExternal = isExternalLink(href);\n\n // If it's an external link, render AriaLink without RouterProvider\n if (isExternal) {\n return (\n <AriaLink\n ref={ref}\n className={clsx(textClassNames.root, linkClassNames.root, className)}\n data-truncate={truncate}\n href={href}\n {...textDataAttributes}\n {...restProps}\n />\n );\n }\n\n // For internal links, use RouterProvider\n return (\n <RouterProvider navigate={navigate} useHref={useHref}>\n <AriaLink\n ref={ref}\n className={clsx(textClassNames.root, linkClassNames.root, className)}\n data-truncate={truncate}\n {...textDataAttributes}\n href={href}\n {...restProps}\n />\n </RouterProvider>\n );\n});\n\nLink.displayName = 'Link';\n"],"names":["AriaLink"],"mappings":";;;;;;;AAwBA,SAAS,eAAe,IAAwB,EAAA;AAC9C,EAAI,IAAA,CAAC,MAAa,OAAA,KAAA;AAGlB,EAAA,IAAI,KAAK,UAAW,CAAA,SAAS,KAAK,IAAK,C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