@backstage/ui 0.6.1 → 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 (32) hide show
  1. package/CHANGELOG.md +7 -2
  2. package/css/styles.css +92 -138
  3. package/dist/components/Checkbox/Checkbox.esm.js +2 -2
  4. package/dist/components/DataTable/Pagination/DataTablePagination.esm.js +1 -1
  5. package/dist/components/DataTable/Pagination/DataTablePagination.esm.js.map +1 -1
  6. package/dist/components/Header/Header.esm.js +21 -2
  7. package/dist/components/Header/Header.esm.js.map +1 -1
  8. package/dist/components/Header/HeaderToolbar.esm.js +20 -9
  9. package/dist/components/Header/HeaderToolbar.esm.js.map +1 -1
  10. package/dist/components/HeaderPage/HeaderPage.esm.js +12 -3
  11. package/dist/components/HeaderPage/HeaderPage.esm.js.map +1 -1
  12. package/dist/components/Link/Link.esm.js +9 -5
  13. package/dist/components/Link/Link.esm.js.map +1 -1
  14. package/dist/components/Menu/Combobox.esm.js +2 -2
  15. package/dist/components/Table/TableCellLink/TableCellLink.esm.js +1 -1
  16. package/dist/components/Table/TableCellLink/TableCellLink.esm.js.map +1 -1
  17. package/dist/components/Table/TableCellProfile/TableCellProfile.esm.js +1 -1
  18. package/dist/components/Table/TableCellProfile/TableCellProfile.esm.js.map +1 -1
  19. package/dist/components/Table/TableCellText/TableCellText.esm.js +2 -2
  20. package/dist/components/Table/TableCellText/TableCellText.esm.js.map +1 -1
  21. package/dist/components/Tabs/Tabs.esm.js +15 -3
  22. package/dist/components/Tabs/Tabs.esm.js.map +1 -1
  23. package/dist/components/Text/Text.esm.js +3 -2
  24. package/dist/components/Text/Text.esm.js.map +1 -1
  25. package/dist/components/Tooltip/Tooltip.esm.js +5 -2
  26. package/dist/components/Tooltip/Tooltip.esm.js.map +1 -1
  27. package/dist/index.d.ts +106 -94
  28. package/dist/index.esm.js +1 -2
  29. package/dist/index.esm.js.map +1 -1
  30. package/package.json +2 -2
  31. package/dist/components/Heading/Heading.esm.js +0 -37
  32. package/dist/components/Heading/Heading.esm.js.map +0 -1
@@ -25,10 +25,12 @@ const Link = forwardRef((props, ref) => {
25
25
  variant = "body",
26
26
  weight = "regular",
27
27
  color = "primary",
28
+ truncate,
28
29
  href,
29
30
  ...restProps
30
31
  } = props;
31
- const { classNames, dataAttributes } = useStyles("Link", {
32
+ const { classNames: linkClassNames } = useStyles("Link");
33
+ const { classNames: textClassNames, dataAttributes: textDataAttributes } = useStyles("Text", {
32
34
  variant,
33
35
  weight,
34
36
  color
@@ -39,9 +41,10 @@ const Link = forwardRef((props, ref) => {
39
41
  Link$1,
40
42
  {
41
43
  ref,
42
- className: clsx(classNames.root, className),
44
+ className: clsx(textClassNames.root, linkClassNames.root, className),
45
+ "data-truncate": truncate,
43
46
  href,
44
- ...dataAttributes,
47
+ ...textDataAttributes,
45
48
  ...restProps
46
49
  }
47
50
  );
@@ -50,9 +53,10 @@ const Link = forwardRef((props, ref) => {
50
53
  Link$1,
51
54
  {
52
55
  ref,
53
- className: clsx(classNames.root, className),
56
+ className: clsx(textClassNames.root, linkClassNames.root, className),
57
+ "data-truncate": truncate,
58
+ ...textDataAttributes,
54
59
  href,
55
- ...dataAttributes,
56
60
  ...restProps
57
61
  }
58
62
  ) });
@@ -1 +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 href,\n ...restProps\n } = props;\n\n const { classNames, dataAttributes } = useStyles('Link', {\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(classNames.root, className)}\n href={href}\n {...dataAttributes}\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(classNames.root, className)}\n href={href}\n {...dataAttributes}\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,CAAA,UAAA,CAAW,UAAU,CAAG,EAAA;AAC7D,IAAO,OAAA,IAAA;AAAA;AAIT,EAAI,IAAA,IAAA,CAAK,UAAW,CAAA,IAAI,CAAG,EAAA;AACzB,IAAO,OAAA,IAAA;AAAA;AAIT,EAAA,IAAI,KAAK,UAAW,CAAA,SAAS,KAAK,IAAK,CAAA,UAAA,CAAW,MAAM,CAA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age 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 {...textDataAtt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AAW,IAAK,CAAA,cAAA,CAAe,IAAM,EAAA,cAAA,CAAe,MAAM,SAAS,CAAA;AAAA,QACnE,eAAe,EAAA,QAAA;AAAA,QACf,IAAA;AAAA,QACC,GAAG,kBAAA;AAAA,QACH,GAAG;AAAA;AAAA,KACN;AAAA;AAKJ,EACE,uBAAA,GAAA,CAAC,cAAe,EAAA,EAAA,QAAA,EAAoB,OAClC,EAAA,QAAA,kBAAA,GAAA;AAAA,IAACA,MAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAW,IAAK,CAAA,cAAA,CAAe,IAAM,EAAA,cAAA,CAAe,MAAM,SAAS,CAAA;AAAA,MACnE,eAAe,EAAA,QAAA;AAAA,MACd,GAAG,kBAAA;AAAA,MACJ,IAAA;AAAA,MACC,GAAG;AAAA;AAAA,GAER,EAAA,CAAA;AAEJ,CAAC;AAED,IAAA,CAAK,WAAc,GAAA,MAAA;;;;"}
@@ -6,8 +6,6 @@ import '../Box/Box.esm.js';
6
6
  import '../Grid/Grid.esm.js';
7
7
  import '../Flex/Flex.esm.js';
8
8
  import '../Container/Container.esm.js';
9
- import '../Text/Text.esm.js';
10
- import '../Heading/Heading.esm.js';
11
9
  import '../Avatar/Avatar.esm.js';
12
10
  import '../Button/Button.esm.js';
13
11
  import '../Card/Card.esm.js';
@@ -18,7 +16,9 @@ import 'react-aria-components';
18
16
  import '@remixicon/react';
19
17
  import '../ButtonIcon/ButtonIcon.esm.js';
20
18
  import './Menu.esm.js';
19
+ import '../Text/Text.esm.js';
21
20
  import 'motion/react';
21
+ import 'react-router-dom';
22
22
  import '../Tabs/Tabs.esm.js';
23
23
  import { Icon } from '../Icon/Icon.esm.js';
24
24
  import '../ButtonLink/ButtonLink.esm.js';
@@ -16,7 +16,7 @@ const TableCellLink = forwardRef(
16
16
  ...props,
17
17
  children: [
18
18
  title && /* @__PURE__ */ jsx(Link, { href, children: title }),
19
- description && /* @__PURE__ */ jsx(Text, { variant: "body", color: "secondary", children: description })
19
+ description && /* @__PURE__ */ jsx(Text, { variant: "body-medium", color: "secondary", children: description })
20
20
  ]
21
21
  }
22
22
  );
@@ -1 +1 @@
1
- {"version":3,"file":"TableCellLink.esm.js","sources":["../../../../src/components/Table/TableCellLink/TableCellLink.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 clsx from 'clsx';\nimport { TableCellLinkProps } from './types';\nimport { Text } from '../../Text/Text';\nimport { Link } from '../../Link/Link';\nimport { useStyles } from '../../../hooks/useStyles';\n\n/** @public */\nconst TableCellLink = forwardRef<HTMLDivElement, TableCellLinkProps>(\n ({ className, title, description, href, render, ...props }, ref) => {\n const { classNames } = useStyles('Table');\n\n return (\n <div\n ref={ref}\n className={clsx(classNames.cellLink, className)}\n {...props}\n >\n {title && <Link href={href}>{title}</Link>}\n {description && (\n <Text variant=\"body\" color=\"secondary\">\n {description}\n </Text>\n )}\n </div>\n );\n },\n);\nTableCellLink.displayName = 'TableCellLink';\n\nexport { TableCellLink };\n"],"names":[],"mappings":";;;;;;;AAwBA,MAAM,aAAgB,GAAA,UAAA;AAAA,EACpB,CAAC,EAAE,SAAA,EAAW,KAAO,EAAA,WAAA,EAAa,MAAM,MAAQ,EAAA,GAAG,KAAM,EAAA,EAAG,GAAQ,KAAA;AAClE,IAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,OAAO,CAAA;AAExC,IACE,uBAAA,IAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,SAAW,EAAA,IAAA,CAAK,UAAW,CAAA,QAAA,EAAU,SAAS,CAAA;AAAA,QAC7C,GAAG,KAAA;AAAA,QAEH,QAAA,EAAA;AAAA,UAAS,KAAA,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAa,QAAM,EAAA,KAAA,EAAA,CAAA;AAAA,UAClC,+BACE,GAAA,CAAA,IAAA,EAAA,EAAK,SAAQ,MAAO,EAAA,KAAA,EAAM,aACxB,QACH,EAAA,WAAA,EAAA;AAAA;AAAA;AAAA,KAEJ;AAAA;AAGN;AACA,aAAA,CAAc,WAAc,GAAA,eAAA;;;;"}
1
+ {"version":3,"file":"TableCellLink.esm.js","sources":["../../../../src/components/Table/TableCellLink/TableCellLink.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 clsx from 'clsx';\nimport { TableCellLinkProps } from './types';\nimport { Text } from '../../Text/Text';\nimport { Link } from '../../Link/Link';\nimport { useStyles } from '../../../hooks/useStyles';\n\n/** @public */\nconst TableCellLink = forwardRef<HTMLDivElement, TableCellLinkProps>(\n ({ className, title, description, href, render, ...props }, ref) => {\n const { classNames } = useStyles('Table');\n\n return (\n <div\n ref={ref}\n className={clsx(classNames.cellLink, className)}\n {...props}\n >\n {title && <Link href={href}>{title}</Link>}\n {description && (\n <Text variant=\"body-medium\" color=\"secondary\">\n {description}\n </Text>\n )}\n </div>\n );\n },\n);\nTableCellLink.displayName = 'TableCellLink';\n\nexport { TableCellLink };\n"],"names":[],"mappings":";;;;;;;AAwBA,MAAM,aAAgB,GAAA,UAAA;AAAA,EACpB,CAAC,EAAE,SAAA,EAAW,KAAO,EAAA,WAAA,EAAa,MAAM,MAAQ,EAAA,GAAG,KAAM,EAAA,EAAG,GAAQ,KAAA;AAClE,IAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,OAAO,CAAA;AAExC,IACE,uBAAA,IAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,SAAW,EAAA,IAAA,CAAK,UAAW,CAAA,QAAA,EAAU,SAAS,CAAA;AAAA,QAC7C,GAAG,KAAA;AAAA,QAEH,QAAA,EAAA;AAAA,UAAS,KAAA,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAa,QAAM,EAAA,KAAA,EAAA,CAAA;AAAA,UAClC,+BACE,GAAA,CAAA,IAAA,EAAA,EAAK,SAAQ,aAAc,EAAA,KAAA,EAAM,aAC/B,QACH,EAAA,WAAA,EAAA;AAAA;AAAA;AAAA,KAEJ;AAAA;AAGN;AACA,aAAA,CAAc,WAAc,GAAA,eAAA;;;;"}
@@ -28,7 +28,7 @@ const TableCellProfile = forwardRef(
28
28
  ),
29
29
  /* @__PURE__ */ jsx(Avatar.Fallback, { className: classNames.cellProfileAvatarFallback, children: (name || "").split(" ").map((word) => word[0]).join("").toLocaleUpperCase("en-US").slice(0, 1) })
30
30
  ] }),
31
- name && to ? /* @__PURE__ */ jsx(Link, { href: to, children: name }) : /* @__PURE__ */ jsx(Text, { variant: "body", children: name })
31
+ name && to ? /* @__PURE__ */ jsx(Link, { href: to, children: name }) : /* @__PURE__ */ jsx(Text, { variant: "body-medium", children: name })
32
32
  ]
33
33
  }
34
34
  );
@@ -1 +1 @@
1
- {"version":3,"file":"TableCellProfile.esm.js","sources":["../../../../src/components/Table/TableCellProfile/TableCellProfile.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 clsx from 'clsx';\nimport { TableCellProfileProps } from './types';\nimport { Text } from '../../Text/Text';\nimport { Link } from '../../Link/Link';\nimport { Avatar } from '@base-ui-components/react/avatar';\nimport { useStyles } from '../../../hooks/useStyles';\n\n/** @public */\nconst TableCellProfile = forwardRef<HTMLDivElement, TableCellProfileProps>(\n ({ className, src, name, to, withImage = true, ...rest }, ref) => {\n const { classNames } = useStyles('Table');\n\n return (\n <div\n ref={ref}\n className={clsx(classNames.cellProfile, className)}\n {...rest}\n >\n {withImage && (\n <Avatar.Root className={classNames.cellProfileAvatar}>\n <Avatar.Image\n src={src}\n width=\"20\"\n height=\"20\"\n className={classNames.cellProfileAvatarImage}\n />\n <Avatar.Fallback className={classNames.cellProfileAvatarFallback}>\n {(name || '')\n .split(' ')\n .map(word => word[0])\n .join('')\n .toLocaleUpperCase('en-US')\n .slice(0, 1)}\n </Avatar.Fallback>\n </Avatar.Root>\n )}\n {name && to ? (\n <Link href={to}>{name}</Link>\n ) : (\n <Text variant=\"body\">{name}</Text>\n )}\n </div>\n );\n },\n);\nTableCellProfile.displayName = 'TableCellProfile';\n\nexport { TableCellProfile };\n"],"names":[],"mappings":";;;;;;;;AAyBA,MAAM,gBAAmB,GAAA,UAAA;AAAA,EACvB,CAAC,EAAE,SAAA,EAAW,GAAK,EAAA,IAAA,EAAM,EAAI,EAAA,SAAA,GAAY,IAAM,EAAA,GAAG,IAAK,EAAA,EAAG,GAAQ,KAAA;AAChE,IAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,OAAO,CAAA;AAExC,IACE,uBAAA,IAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,SAAW,EAAA,IAAA,CAAK,UAAW,CAAA,WAAA,EAAa,SAAS,CAAA;AAAA,QAChD,GAAG,IAAA;AAAA,QAEH,QAAA,EAAA;AAAA,UAAA,SAAA,yBACE,MAAO,CAAA,IAAA,EAAP,EAAY,SAAA,EAAW,WAAW,iBACjC,EAAA,QAAA,EAAA;AAAA,4BAAA,GAAA;AAAA,cAAC,MAAO,CAAA,KAAA;AAAA,cAAP;AAAA,gBACC,GAAA;AAAA,gBACA,KAAM,EAAA,IAAA;AAAA,gBACN,MAAO,EAAA,IAAA;AAAA,gBACP,WAAW,UAAW,CAAA;AAAA;AAAA,aACxB;AAAA,4BACA,GAAA,CAAC,MAAO,CAAA,QAAA,EAAP,EAAgB,SAAA,EAAW,UAAW,CAAA,yBAAA,EACnC,QAAQ,EAAA,CAAA,IAAA,IAAA,EAAA,EACP,KAAM,CAAA,GAAG,CACT,CAAA,GAAA,CAAI,CAAQ,IAAA,KAAA,IAAA,CAAK,CAAC,CAAC,CACnB,CAAA,IAAA,CAAK,EAAE,CAAA,CACP,iBAAkB,CAAA,OAAO,CACzB,CAAA,KAAA,CAAM,CAAG,EAAA,CAAC,CACf,EAAA;AAAA,WACF,EAAA,CAAA;AAAA,UAED,IAAQ,IAAA,EAAA,mBACN,GAAA,CAAA,IAAA,EAAA,EAAK,IAAM,EAAA,EAAA,EAAK,QAAK,EAAA,IAAA,EAAA,CAAA,mBAErB,GAAA,CAAA,IAAA,EAAA,EAAK,OAAQ,EAAA,MAAA,EAAQ,QAAK,EAAA,IAAA,EAAA;AAAA;AAAA;AAAA,KAE/B;AAAA;AAGN;AACA,gBAAA,CAAiB,WAAc,GAAA,kBAAA;;;;"}
1
+ {"version":3,"file":"TableCellProfile.esm.js","sources":["../../../../src/components/Table/TableCellProfile/TableCellProfile.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 clsx from 'clsx';\nimport { TableCellProfileProps } from './types';\nimport { Text } from '../../Text/Text';\nimport { Link } from '../../Link/Link';\nimport { Avatar } from '@base-ui-components/react/avatar';\nimport { useStyles } from '../../../hooks/useStyles';\n\n/** @public */\nconst TableCellProfile = forwardRef<HTMLDivElement, TableCellProfileProps>(\n ({ className, src, name, to, withImage = true, ...rest }, ref) => {\n const { classNames } = useStyles('Table');\n\n return (\n <div\n ref={ref}\n className={clsx(classNames.cellProfile, className)}\n {...rest}\n >\n {withImage && (\n <Avatar.Root className={classNames.cellProfileAvatar}>\n <Avatar.Image\n src={src}\n width=\"20\"\n height=\"20\"\n className={classNames.cellProfileAvatarImage}\n />\n <Avatar.Fallback className={classNames.cellProfileAvatarFallback}>\n {(name || '')\n .split(' ')\n .map(word => word[0])\n .join('')\n .toLocaleUpperCase('en-US')\n .slice(0, 1)}\n </Avatar.Fallback>\n </Avatar.Root>\n )}\n {name && to ? (\n <Link href={to}>{name}</Link>\n ) : (\n <Text variant=\"body-medium\">{name}</Text>\n )}\n </div>\n );\n },\n);\nTableCellProfile.displayName = 'TableCellProfile';\n\nexport { TableCellProfile };\n"],"names":[],"mappings":";;;;;;;;AAyBA,MAAM,gBAAmB,GAAA,UAAA;AAAA,EACvB,CAAC,EAAE,SAAA,EAAW,GAAK,EAAA,IAAA,EAAM,EAAI,EAAA,SAAA,GAAY,IAAM,EAAA,GAAG,IAAK,EAAA,EAAG,GAAQ,KAAA;AAChE,IAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,OAAO,CAAA;AAExC,IACE,uBAAA,IAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,SAAW,EAAA,IAAA,CAAK,UAAW,CAAA,WAAA,EAAa,SAAS,CAAA;AAAA,QAChD,GAAG,IAAA;AAAA,QAEH,QAAA,EAAA;AAAA,UAAA,SAAA,yBACE,MAAO,CAAA,IAAA,EAAP,EAAY,SAAA,EAAW,WAAW,iBACjC,EAAA,QAAA,EAAA;AAAA,4BAAA,GAAA;AAAA,cAAC,MAAO,CAAA,KAAA;AAAA,cAAP;AAAA,gBACC,GAAA;AAAA,gBACA,KAAM,EAAA,IAAA;AAAA,gBACN,MAAO,EAAA,IAAA;AAAA,gBACP,WAAW,UAAW,CAAA;AAAA;AAAA,aACxB;AAAA,4BACA,GAAA,CAAC,MAAO,CAAA,QAAA,EAAP,EAAgB,SAAA,EAAW,UAAW,CAAA,yBAAA,EACnC,QAAQ,EAAA,CAAA,IAAA,IAAA,EAAA,EACP,KAAM,CAAA,GAAG,CACT,CAAA,GAAA,CAAI,CAAQ,IAAA,KAAA,IAAA,CAAK,CAAC,CAAC,CACnB,CAAA,IAAA,CAAK,EAAE,CAAA,CACP,iBAAkB,CAAA,OAAO,CACzB,CAAA,KAAA,CAAM,CAAG,EAAA,CAAC,CACf,EAAA;AAAA,WACF,EAAA,CAAA;AAAA,UAED,IAAQ,IAAA,EAAA,mBACN,GAAA,CAAA,IAAA,EAAA,EAAK,IAAM,EAAA,EAAA,EAAK,QAAK,EAAA,IAAA,EAAA,CAAA,mBAErB,GAAA,CAAA,IAAA,EAAA,EAAK,OAAQ,EAAA,aAAA,EAAe,QAAK,EAAA,IAAA,EAAA;AAAA;AAAA;AAAA,KAEtC;AAAA;AAGN;AACA,gBAAA,CAAiB,WAAc,GAAA,kBAAA;;;;"}
@@ -14,8 +14,8 @@ const TableCellText = forwardRef(
14
14
  className: clsx(classNames.cellText, className),
15
15
  ...props,
16
16
  children: [
17
- title && /* @__PURE__ */ jsx(Text, { variant: "body", children: title }),
18
- description && /* @__PURE__ */ jsx(Text, { variant: "body", color: "secondary", children: description })
17
+ title && /* @__PURE__ */ jsx(Text, { variant: "body-medium", children: title }),
18
+ description && /* @__PURE__ */ jsx(Text, { variant: "body-medium", color: "secondary", children: description })
19
19
  ]
20
20
  }
21
21
  );
@@ -1 +1 @@
1
- {"version":3,"file":"TableCellText.esm.js","sources":["../../../../src/components/Table/TableCellText/TableCellText.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 clsx from 'clsx';\nimport { TableCellTextProps } from './types';\nimport { Text } from '../../Text/Text';\nimport { useStyles } from '../../../hooks/useStyles';\n\n/** @public */\nconst TableCellText = forwardRef<HTMLDivElement, TableCellTextProps>(\n ({ className, title, description, ...props }, ref) => {\n const { classNames } = useStyles('Table');\n\n return (\n <div\n ref={ref}\n className={clsx(classNames.cellText, className)}\n {...props}\n >\n {title && <Text variant=\"body\">{title}</Text>}\n {description && (\n <Text variant=\"body\" color=\"secondary\">\n {description}\n </Text>\n )}\n </div>\n );\n },\n);\nTableCellText.displayName = 'TableCellText';\n\nexport { TableCellText };\n"],"names":[],"mappings":";;;;;;AAuBA,MAAM,aAAgB,GAAA,UAAA;AAAA,EACpB,CAAC,EAAE,SAAW,EAAA,KAAA,EAAO,aAAa,GAAG,KAAA,IAAS,GAAQ,KAAA;AACpD,IAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,OAAO,CAAA;AAExC,IACE,uBAAA,IAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,SAAW,EAAA,IAAA,CAAK,UAAW,CAAA,QAAA,EAAU,SAAS,CAAA;AAAA,QAC7C,GAAG,KAAA;AAAA,QAEH,QAAA,EAAA;AAAA,UAAA,KAAA,oBAAU,GAAA,CAAA,IAAA,EAAA,EAAK,OAAQ,EAAA,MAAA,EAAQ,QAAM,EAAA,KAAA,EAAA,CAAA;AAAA,UACrC,+BACE,GAAA,CAAA,IAAA,EAAA,EAAK,SAAQ,MAAO,EAAA,KAAA,EAAM,aACxB,QACH,EAAA,WAAA,EAAA;AAAA;AAAA;AAAA,KAEJ;AAAA;AAGN;AACA,aAAA,CAAc,WAAc,GAAA,eAAA;;;;"}
1
+ {"version":3,"file":"TableCellText.esm.js","sources":["../../../../src/components/Table/TableCellText/TableCellText.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 clsx from 'clsx';\nimport { TableCellTextProps } from './types';\nimport { Text } from '../../Text/Text';\nimport { useStyles } from '../../../hooks/useStyles';\n\n/** @public */\nconst TableCellText = forwardRef<HTMLDivElement, TableCellTextProps>(\n ({ className, title, description, ...props }, ref) => {\n const { classNames } = useStyles('Table');\n\n return (\n <div\n ref={ref}\n className={clsx(classNames.cellText, className)}\n {...props}\n >\n {title && <Text variant=\"body-medium\">{title}</Text>}\n {description && (\n <Text variant=\"body-medium\" color=\"secondary\">\n {description}\n </Text>\n )}\n </div>\n );\n },\n);\nTableCellText.displayName = 'TableCellText';\n\nexport { TableCellText };\n"],"names":[],"mappings":";;;;;;AAuBA,MAAM,aAAgB,GAAA,UAAA;AAAA,EACpB,CAAC,EAAE,SAAW,EAAA,KAAA,EAAO,aAAa,GAAG,KAAA,IAAS,GAAQ,KAAA;AACpD,IAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,OAAO,CAAA;AAExC,IACE,uBAAA,IAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,SAAW,EAAA,IAAA,CAAK,UAAW,CAAA,QAAA,EAAU,SAAS,CAAA;AAAA,QAC7C,GAAG,KAAA;AAAA,QAEH,QAAA,EAAA;AAAA,UAAA,KAAA,oBAAU,GAAA,CAAA,IAAA,EAAA,EAAK,OAAQ,EAAA,aAAA,EAAe,QAAM,EAAA,KAAA,EAAA,CAAA;AAAA,UAC5C,+BACE,GAAA,CAAA,IAAA,EAAA,EAAK,SAAQ,aAAc,EAAA,KAAA,EAAM,aAC/B,QACH,EAAA,WAAA,EAAA;AAAA;AAAA;AAAA,KAEJ;AAAA;AAGN;AACA,aAAA,CAAc,WAAc,GAAA,eAAA;;;;"}
@@ -13,6 +13,15 @@ const useTabsContext = () => {
13
13
  }
14
14
  return context;
15
15
  };
16
+ const isTabActive = (tabHref, currentPathname, matchStrategy) => {
17
+ if (matchStrategy === "exact") {
18
+ return tabHref === currentPathname;
19
+ }
20
+ if (tabHref === currentPathname) {
21
+ return true;
22
+ }
23
+ return currentPathname.startsWith(`${tabHref}/`);
24
+ };
16
25
  const Tabs = (props) => {
17
26
  const { children, ...rest } = props;
18
27
  const { classNames } = useStyles("Tabs");
@@ -35,8 +44,11 @@ const Tabs = (props) => {
35
44
  if (isValidElement(child) && child.type === TabList) {
36
45
  const tabListChildren = Children.toArray(child.props.children);
37
46
  for (const tabChild of tabListChildren) {
38
- if (isValidElement(tabChild) && tabChild.props.href === location.pathname) {
39
- return tabChild.props.id;
47
+ if (isValidElement(tabChild) && tabChild.props.href) {
48
+ const strategy = tabChild.props.matchStrategy || "exact";
49
+ if (isTabActive(tabChild.props.href, location.pathname, strategy)) {
50
+ return tabChild.props.id;
51
+ }
40
52
  }
41
53
  }
42
54
  }
@@ -102,7 +114,7 @@ const TabList = (props) => {
102
114
  ] });
103
115
  };
104
116
  const Tab = (props) => {
105
- const { href, children, id, ...rest } = props;
117
+ const { href, children, id, matchStrategy: _matchStrategy, ...rest } = props;
106
118
  const { classNames } = useStyles("Tabs");
107
119
  const { setTabRef } = useTabsContext();
108
120
  return /* @__PURE__ */ jsx(
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.esm.js","sources":["../../../src/components/Tabs/Tabs.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 {\n useRef,\n useState,\n Children,\n cloneElement,\n isValidElement,\n ReactNode,\n createContext,\n useContext,\n} from 'react';\nimport type {\n TabsProps,\n TabListProps,\n TabPanelProps,\n TabsContextValue,\n} from './types';\nimport { useLocation, useNavigate, useHref } from 'react-router-dom';\nimport { TabsIndicators } from './TabsIndicators';\nimport {\n Tabs as AriaTabs,\n TabList as AriaTabList,\n Tab as AriaTab,\n TabPanel as AriaTabPanel,\n RouterProvider,\n TabProps as AriaTabProps,\n} from 'react-aria-components';\n\nimport { useStyles } from '../../hooks/useStyles';\n\nconst TabsContext = createContext<TabsContextValue | undefined>(undefined);\n\nconst useTabsContext = () => {\n const context = useContext(TabsContext);\n if (!context) {\n throw new Error('Tab components must be used within a Tabs component');\n }\n return context;\n};\n\n/**\n * A component that renders a list of tabs.\n *\n * @public\n */\nexport const Tabs = (props: TabsProps) => {\n const { children, ...rest } = props;\n const { classNames } = useStyles('Tabs');\n const tabsRef = useRef<HTMLDivElement>(null);\n const tabRefs = useRef<Map<string, HTMLDivElement>>(new Map());\n const [hoveredKey, setHoveredKey] = useState<string | null>(null);\n const prevHoveredKey = useRef<string | null>(null);\n let navigate = useNavigate();\n const location = useLocation();\n\n const setTabRef = (key: string, element: HTMLDivElement | null) => {\n if (element) {\n tabRefs.current.set(key, element);\n } else {\n tabRefs.current.delete(key);\n }\n };\n\n // If selectedKey is not provided, try to determine it from the current route\n const computedSelectedKey = (() => {\n const childrenArray = Children.toArray(children as ReactNode);\n for (const child of childrenArray) {\n if (isValidElement(child) && child.type === TabList) {\n const tabListChildren = Children.toArray(child.props.children);\n for (const tabChild of tabListChildren) {\n if (\n isValidElement(tabChild) &&\n tabChild.props.href === location.pathname\n ) {\n return tabChild.props.id;\n }\n }\n }\n }\n return undefined;\n })();\n\n if (!children) return null;\n\n const contextValue: TabsContextValue = {\n tabsRef,\n tabRefs,\n hoveredKey,\n prevHoveredKey,\n setHoveredKey,\n setTabRef,\n };\n\n return (\n <TabsContext.Provider value={contextValue}>\n <RouterProvider navigate={navigate} useHref={useHref}>\n <AriaTabs\n className={classNames.tabs}\n keyboardActivation=\"manual\"\n selectedKey={computedSelectedKey}\n ref={tabsRef}\n {...rest}\n >\n {children as ReactNode}\n </AriaTabs>\n </RouterProvider>\n </TabsContext.Provider>\n );\n};\n\n/**\n * A component that renders a list of tabs.\n *\n * @public\n */\nexport const TabList = (props: TabListProps) => {\n const { children, ...rest } = props;\n const { classNames } = useStyles('Tabs');\n const { setHoveredKey, tabRefs, tabsRef, hoveredKey, prevHoveredKey } =\n useTabsContext();\n\n const handleHover = (key: string | null) => {\n setHoveredKey(key);\n };\n\n // Clone children with additional props for hover and ref management\n const enhancedChildren = Children.map(children as ReactNode, child => {\n if (isValidElement(child)) {\n return cloneElement(child, {\n onHoverStart: () => handleHover(child.props.id as string),\n onHoverEnd: () => handleHover(null),\n } as Partial<AriaTabProps>);\n }\n return child;\n });\n\n return (\n <div className={classNames.tabListWrapper}>\n <AriaTabList\n className={classNames.tabList}\n aria-label=\"Toolbar tabs\"\n {...rest}\n >\n {enhancedChildren}\n </AriaTabList>\n <TabsIndicators\n tabRefs={tabRefs}\n tabsRef={tabsRef}\n hoveredKey={hoveredKey}\n prevHoveredKey={prevHoveredKey}\n />\n </div>\n );\n};\n\n/**\n * A component that renders a tab.\n *\n * @public\n */\nexport const Tab = (props: AriaTabProps) => {\n const { href, children, id, ...rest } = props;\n const { classNames } = useStyles('Tabs');\n const { setTabRef } = useTabsContext();\n\n return (\n <AriaTab\n id={id}\n className={classNames.tab}\n ref={el => setTabRef(id as string, el as HTMLDivElement)}\n href={href}\n {...rest}\n >\n {children}\n </AriaTab>\n );\n};\n\n/**\n * A component that renders the content of a tab.\n *\n * @public\n */\nexport const TabPanel = (props: TabPanelProps) => {\n const { children, ...rest } = props;\n const { classNames } = useStyles('Tabs');\n\n return (\n <AriaTabPanel className={classNames.panel} {...rest}>\n {children}\n </AriaTabPanel>\n );\n};\n"],"names":["AriaTabs","AriaTabList","AriaTab","AriaTabPanel"],"mappings":";;;;;;;AA6CA,MAAM,WAAA,GAAc,cAA4C,KAAS,CAAA,CAAA;AAEzE,MAAM,iBAAiB,MAAM;AAC3B,EAAM,MAAA,OAAA,GAAU,WAAW,WAAW,CAAA;AACtC,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAM,MAAA,IAAI,MAAM,qDAAqD,CAAA;AAAA;AAEvE,EAAO,OAAA,OAAA;AACT,CAAA;AAOa,MAAA,IAAA,GAAO,CAAC,KAAqB,KAAA;AACxC,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,IAAA,EAAS,GAAA,KAAA;AAC9B,EAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,MAAM,CAAA;AACvC,EAAM,MAAA,OAAA,GAAU,OAAuB,IAAI,CAAA;AAC3C,EAAA,MAAM,OAAU,GAAA,MAAA,iBAAwC,IAAA,GAAA,EAAK,CAAA;AAC7D,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QACC,WAAW,UAAW,CAAA,OAAA;AAAA,QACtB,YAAW,EAAA,cAAA;AAAA,QACV,GAAG,IAAA;AAAA,QAEH,QAAA,EAAA;AAAA;AAAA,KACH;AAAA,oBACA,GAAA;AAAA,MAAC,cAAA;AAAA,MAAA;AAAA,QACC,OAAA;AAAA,QACA,OAAA;AAAA,QACA,UAAA;AAAA,QACA;AAAA;AAAA;AACF,GACF,EAAA,CAAA;AAEJ;AAOa,MAAA,GAAA,GAAM,CAAC,KAAwB,KAAA;AAC1C,EAAA,MAAM,EAAE,IAAM,EAAA,QAAA,EAAU,EAAI,EAAA,GAAG,MAAS,GAAA,KAAA;AACxC,EAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,MAAM,CAAA;AACvC,EAAM,MAAA,EAAE,SAAU,EAAA,GAAI,cAAe,EAAA;AAErC,EACE,uBAAA,GAAA;AAAA,IAACC,KAAA;AAAA,IAAA;AAAA,MACC,EAAA;AAAA,MACA,WAAW,UAAW,CAAA,GAAA;AAAA,MACtB,GAAK,EAAA,CAAA,EAAA,KAAM,SAAU,CAAA,EAAA,EAAc,EAAoB,CAAA;AAAA,MACvD,IAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEH;AAAA;AAAA,GACH;AAEJ;AAOa,MAAA,QAAA,GAAW,CAAC,KAAyB,KAAA;AAChD,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,IAAA,EAAS,GAAA,KAAA;AAC9B,EAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,MAAM,CAAA;AAEvC,EAAA,2BACGC,UAAa,EAAA,EAAA,SAAA,EAAW,WAAW,KAAQ,EAAA,GAAG,MAC5C,QACH,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"Tabs.esm.js","sources":["../../../src/components/Tabs/Tabs.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 {\n useRef,\n useState,\n Children,\n cloneElement,\n isValidElement,\n ReactNode,\n createContext,\n useContext,\n} from 'react';\nimport type {\n TabsProps,\n TabListProps,\n TabPanelProps,\n TabsContextValue,\n TabProps,\n} from './types';\nimport { useLocation, useNavigate, useHref } from 'react-router-dom';\nimport { TabsIndicators } from './TabsIndicators';\nimport {\n Tabs as AriaTabs,\n TabList as AriaTabList,\n Tab as AriaTab,\n TabPanel as AriaTabPanel,\n RouterProvider,\n TabProps as AriaTabProps,\n} from 'react-aria-components';\n\nimport { useStyles } from '../../hooks/useStyles';\n\nconst TabsContext = createContext<TabsContextValue | undefined>(undefined);\n\nconst useTabsContext = () => {\n const context = useContext(TabsContext);\n if (!context) {\n throw new Error('Tab components must be used within a Tabs component');\n }\n return context;\n};\n\n/**\n * Utility function to determine if a tab should be active based on the matching strategy.\n * This follows the pattern used in WorkaroundNavLink from the sidebar.\n */\nconst isTabActive = (\n tabHref: string,\n currentPathname: string,\n matchStrategy: 'exact' | 'prefix',\n): boolean => {\n if (matchStrategy === 'exact') {\n return tabHref === currentPathname;\n }\n\n // Prefix matching - similar to WorkaroundNavLink behavior\n if (tabHref === currentPathname) {\n return true;\n }\n\n // Check if current path starts with tab href followed by a slash\n // This prevents /foo matching /foobar\n return currentPathname.startsWith(`${tabHref}/`);\n};\n\n/**\n * A component that renders a list of tabs.\n *\n * @public\n */\nexport const Tabs = (props: TabsProps) => {\n const { children, ...rest } = props;\n const { classNames } = useStyles('Tabs');\n const tabsRef = useRef<HTMLDivElement>(null);\n const tabRefs = useRef<Map<string, HTMLDivElement>>(new Map());\n const [hoveredKey, setHoveredKey] = useState<string | null>(null);\n const prevHoveredKey = useRef<string | null>(null);\n let navigate = useNavigate();\n const location = useLocation();\n\n const setTabRef = (key: string, element: HTMLDivElement | null) => {\n if (element) {\n tabRefs.current.set(key, element);\n } else {\n tabRefs.current.delete(key);\n }\n };\n\n // If selectedKey is not provided, try to determine it from the current route\n const computedSelectedKey = (() => {\n const childrenArray = Children.toArray(children as ReactNode);\n for (const child of childrenArray) {\n if (isValidElement(child) && child.type === TabList) {\n const tabListChildren = Children.toArray(child.props.children);\n for (const tabChild of tabListChildren) {\n if (isValidElement(tabChild) && tabChild.props.href) {\n // Use tab-specific strategy, defaulting to 'exact'\n const strategy = tabChild.props.matchStrategy || 'exact';\n if (isTabActive(tabChild.props.href, location.pathname, strategy)) {\n return tabChild.props.id;\n }\n }\n }\n }\n }\n return undefined;\n })();\n\n if (!children) return null;\n\n const contextValue: TabsContextValue = {\n tabsRef,\n tabRefs,\n hoveredKey,\n prevHoveredKey,\n setHoveredKey,\n setTabRef,\n };\n\n return (\n <TabsContext.Provider value={contextValue}>\n <RouterProvider navigate={navigate} useHref={useHref}>\n <AriaTabs\n className={classNames.tabs}\n keyboardActivation=\"manual\"\n selectedKey={computedSelectedKey}\n ref={tabsRef}\n {...rest}\n >\n {children as ReactNode}\n </AriaTabs>\n </RouterProvider>\n </TabsContext.Provider>\n );\n};\n\n/**\n * A component that renders a list of tabs.\n *\n * @public\n */\nexport const TabList = (props: TabListProps) => {\n const { children, ...rest } = props;\n const { classNames } = useStyles('Tabs');\n const { setHoveredKey, tabRefs, tabsRef, hoveredKey, prevHoveredKey } =\n useTabsContext();\n\n const handleHover = (key: string | null) => {\n setHoveredKey(key);\n };\n\n // Clone children with additional props for hover and ref management\n const enhancedChildren = Children.map(children as ReactNode, child => {\n if (isValidElement(child)) {\n return cloneElement(child, {\n onHoverStart: () => handleHover(child.props.id as string),\n onHoverEnd: () => handleHover(null),\n } as Partial<AriaTabProps>);\n }\n return child;\n });\n\n return (\n <div className={classNames.tabListWrapper}>\n <AriaTabList\n className={classNames.tabList}\n aria-label=\"Toolbar tabs\"\n {...rest}\n >\n {enhancedChildren}\n </AriaTabList>\n <TabsIndicators\n tabRefs={tabRefs}\n tabsRef={tabsRef}\n hoveredKey={hoveredKey}\n prevHoveredKey={prevHoveredKey}\n />\n </div>\n );\n};\n\n/**\n * A component that renders a tab.\n *\n * @public\n */\nexport const Tab = (props: TabProps) => {\n const { href, children, id, matchStrategy: _matchStrategy, ...rest } = props;\n const { classNames } = useStyles('Tabs');\n const { setTabRef } = useTabsContext();\n\n return (\n <AriaTab\n id={id}\n className={classNames.tab}\n ref={el => setTabRef(id as string, el as HTMLDivElement)}\n href={href}\n {...rest}\n >\n {children}\n </AriaTab>\n );\n};\n\n/**\n * A component that renders the content of a tab.\n *\n * @public\n */\nexport const TabPanel = (props: TabPanelProps) => {\n const { children, ...rest } = props;\n const { classNames } = useStyles('Tabs');\n\n return (\n <AriaTabPanel className={classNames.panel} {...rest}>\n {children}\n </AriaTabPanel>\n );\n};\n"],"names":["AriaTabs","AriaTabList","AriaTab","AriaTabPanel"],"mappings":";;;;;;;AA8CA,MAAM,WAAA,GAAc,cAA4C,KAAS,CAAA,CAAA;AAEzE,MAAM,iBAAiB,MAAM;AAC3B,EAAM,MAAA,OAAA,GAAU,WAAW,WAAW,CAAA;AACtC,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAM,MAAA,IAAI,MAAM,qDAAqD,CAAA;AAAA;AAEvE,EAAO,OAAA,OAAA;AACT,CAAA;AAMA,MAAM,WAAc,GAAA,CAClB,OACA,EAAA,eAAA,EACA,aACY,KAAA;AACZ,EAAA,IAAI,kBAAkB,OAAS,EAAA;AAC7B,IAAA,OAAO,OAAY,KAAA,eAAA;AAAA;AAIrB,EAAA,IAAI,YAAY,eAAiB,EAAA;AAC/B,IAAO,OAAA,IAAA;AAAA;AAKT,EAAA,OAAO,eAAgB,CAAA,UAAA,CAAW,CAAG,EAAA,OAAO,CAAG,CAAA,CAAA,CAAA;AACjD,CAAA;AAOa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MAEH;AAAA;AAAA,GACH;AAEJ;AAOa,MAAA,QAAA,GAAW,CAAC,KAAyB,KAAA;AAChD,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,IAAA,EAAS,GAAA,KAAA;AAC9B,EAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,MAAM,CAAA;AAEvC,EAAA,2BACGC,UAAa,EAAA,EAAA,SAAA,EAAW,WAAW,KAAQ,EAAA,GAAG,MAC5C,QACH,EAAA,CAAA;AAEJ;;;;"}
@@ -5,7 +5,7 @@ import { useStyles } from '../../hooks/useStyles.esm.js';
5
5
 
6
6
  function TextComponent({
7
7
  as,
8
- variant = "body",
8
+ variant = "body-medium",
9
9
  weight = "regular",
10
10
  color = "primary",
11
11
  className,
@@ -13,7 +13,7 @@ function TextComponent({
13
13
  style,
14
14
  ...restProps
15
15
  }, ref) {
16
- const Component = as || "p";
16
+ const Component = as || "span";
17
17
  const { classNames, dataAttributes } = useStyles("Text", {
18
18
  variant,
19
19
  weight,
@@ -25,6 +25,7 @@ function TextComponent({
25
25
  ref,
26
26
  className: clsx(classNames.root, className),
27
27
  "data-truncate": truncate,
28
+ "data-as": as,
28
29
  ...dataAttributes,
29
30
  style,
30
31
  ...restProps
@@ -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 clsx from 'clsx';\nimport type { ElementType } from 'react';\nimport type { TextProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\n\nfunction TextComponent<T extends ElementType = 'p'>(\n {\n as,\n variant = 'body',\n weight = 'regular',\n color = 'primary',\n className,\n truncate,\n style,\n ...restProps\n }: TextProps<T>,\n ref: React.Ref<any>,\n) {\n const Component = as || 'p';\n\n const { classNames, dataAttributes } = useStyles('Text', {\n variant,\n weight,\n color,\n });\n\n return (\n <Component\n ref={ref}\n className={clsx(classNames.root, className)}\n data-truncate={truncate}\n {...dataAttributes}\n style={style}\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,aACP,CAAA;AAAA,EACE,EAAA;AAAA,EACA,OAAU,GAAA,MAAA;AAAA,EACV,MAAS,GAAA,SAAA;AAAA,EACT,KAAQ,GAAA,SAAA;AAAA,EACR,SAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,GAAG;AACL,CAAA,EACA,GACA,EAAA;AACA,EAAA,MAAM,YAAY,EAAM,IAAA,GAAA;AAExB,EAAA,MAAM,EAAE,UAAA,EAAY,cAAe,EAAA,GAAI,UAAU,MAAQ,EAAA;AAAA,IACvD,OAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EACE,uBAAA,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAW,EAAA,IAAA,CAAK,UAAW,CAAA,IAAA,EAAM,SAAS,CAAA;AAAA,MAC1C,eAAe,EAAA,QAAA;AAAA,MACd,GAAG,cAAA;AAAA,MACJ,KAAA;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,aAAA,CAAc,WAAc,GAAA,MAAA;AAGf,MAAA,IAAA,GAAO,WAAW,aAAa;AAO5C,IAAA,CAAK,WAAc,GAAA,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 clsx from 'clsx';\nimport type { ElementType } from 'react';\nimport type { TextProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\n\nfunction TextComponent<T extends ElementType = 'span'>(\n {\n as,\n variant = 'body-medium',\n weight = 'regular',\n color = 'primary',\n className,\n truncate,\n style,\n ...restProps\n }: TextProps<T>,\n ref: React.Ref<any>,\n) {\n const Component = as || 'span';\n\n const { classNames, dataAttributes } = useStyles('Text', {\n variant,\n weight,\n color,\n });\n\n return (\n <Component\n ref={ref}\n className={clsx(classNames.root, className)}\n data-truncate={truncate}\n data-as={as}\n {...dataAttributes}\n style={style}\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,aACP,CAAA;AAAA,EACE,EAAA;AAAA,EACA,OAAU,GAAA,aAAA;AAAA,EACV,MAAS,GAAA,SAAA;AAAA,EACT,KAAQ,GAAA,SAAA;AAAA,EACR,SAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,GAAG;AACL,CAAA,EACA,GACA,EAAA;AACA,EAAA,MAAM,YAAY,EAAM,IAAA,MAAA;AAExB,EAAA,MAAM,EAAE,UAAA,EAAY,cAAe,EAAA,GAAI,UAAU,MAAQ,EAAA;AAAA,IACvD,OAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EACE,uBAAA,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAW,EAAA,IAAA,CAAK,UAAW,CAAA,IAAA,EAAM,SAAS,CAAA;AAAA,MAC1C,eAAe,EAAA,QAAA;AAAA,MACf,SAAS,EAAA,EAAA;AAAA,MACR,GAAG,cAAA;AAAA,MACJ,KAAA;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,aAAA,CAAc,WAAc,GAAA,MAAA;AAGf,MAAA,IAAA,GAAO,WAAW,aAAa;AAO5C,IAAA,CAAK,WAAc,GAAA,MAAA;;;;"}
@@ -18,14 +18,17 @@ const Tooltip = forwardRef(
18
18
  ...rest,
19
19
  ref,
20
20
  children: [
21
- /* @__PURE__ */ jsx(OverlayArrow, { className: classNames.arrow, children: /* @__PURE__ */ jsx("svg", { width: 8, height: 8, viewBox: "0 0 8 8", children: /* @__PURE__ */ jsx("path", { d: "M0 0 L4 4 L8 0" }) }) }),
21
+ /* @__PURE__ */ jsx(OverlayArrow, { className: classNames.arrow, children: /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
22
+ /* @__PURE__ */ jsx("path", { d: "M10.3356 7.39793L15.1924 3.02682C15.9269 2.36577 16.8801 2 17.8683 2H20V7.94781e-07L1.74846e-07 -9.53674e-07L0 2L1.4651 2C2.4532 2 3.4064 2.36577 4.1409 3.02682L8.9977 7.39793C9.378 7.7402 9.9553 7.74021 10.3356 7.39793Z" }),
23
+ /* @__PURE__ */ jsx("path", { d: "M11.0046 8.14124C10.2439 8.82575 9.08939 8.82578 8.32869 8.14122L3.47189 3.77011C2.92109 3.27432 2.20619 2.99999 1.46509 2.99999L4.10999 3L8.99769 7.39793C9.37799 7.7402 9.95529 7.7402 10.3356 7.39793L15.2226 3L17.8683 2.99999C17.1271 2.99999 16.4122 3.27432 15.8614 3.77011L11.0046 8.14124Z" })
24
+ ] }) }),
22
25
  children
23
26
  ]
24
27
  }
25
28
  );
26
29
  }
27
30
  );
28
- Tooltip.displayName = Tooltip.displayName;
31
+ Tooltip.displayName = "Tooltip";
29
32
 
30
33
  export { Tooltip, TooltipTrigger };
31
34
  //# sourceMappingURL=Tooltip.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.esm.js","sources":["../../../src/components/Tooltip/Tooltip.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 {\n OverlayArrow,\n Tooltip as AriaTooltip,\n TooltipTrigger as AriaTooltipTrigger,\n TooltipTriggerComponentProps,\n} from 'react-aria-components';\nimport clsx from 'clsx';\nimport { TooltipProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\n\n/** @public */\nexport const TooltipTrigger = (props: TooltipTriggerComponentProps) => {\n const { delay = 600 } = props;\n\n return <AriaTooltipTrigger delay={delay} {...props} />;\n};\n\n/** @public */\nexport const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(\n ({ className, children, ...rest }, ref) => {\n const { classNames } = useStyles('Tooltip');\n\n return (\n <AriaTooltip\n className={clsx(classNames.tooltip, className)}\n {...rest}\n ref={ref}\n >\n <OverlayArrow className={classNames.arrow}>\n <svg width={8} height={8} viewBox=\"0 0 8 8\">\n <path d=\"M0 0 L4 4 L8 0\" />\n </svg>\n </OverlayArrow>\n {children}\n </AriaTooltip>\n );\n },\n);\n\nTooltip.displayName = Tooltip.displayName;\n"],"names":["AriaTooltipTrigger","AriaTooltip"],"mappings":";;;;;;AA4Ba,MAAA,cAAA,GAAiB,CAAC,KAAwC,KAAA;AACrE,EAAM,MAAA,EAAE,KAAQ,GAAA,GAAA,EAAQ,GAAA,KAAA;AAExB,EAAA,uBAAQ,GAAA,CAAAA,gBAAA,EAAA,EAAmB,KAAe,EAAA,GAAG,KAAO,EAAA,CAAA;AACtD;AAGO,MAAM,OAAU,GAAA,UAAA;AAAA,EACrB,CAAC,EAAE,SAAA,EAAW,UAAU,GAAG,IAAA,IAAQ,GAAQ,KAAA;AACzC,IAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,SAAS,CAAA;AAE1C,IACE,uBAAA,IAAA;AAAA,MAACC,SAAA;AAAA,MAAA;AAAA,QACC,SAAW,EAAA,IAAA,CAAK,UAAW,CAAA,OAAA,EAAS,SAAS,CAAA;AAAA,QAC5C,GAAG,IAAA;AAAA,QACJ,GAAA;AAAA,QAEA,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,gBAAa,SAAW,EAAA,UAAA,CAAW,KAClC,EAAA,QAAA,kBAAA,GAAA,CAAC,SAAI,KAAO,EAAA,CAAA,EAAG,MAAQ,EAAA,CAAA,EAAG,SAAQ,SAChC,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAK,CAAE,EAAA,gBAAA,EAAiB,GAC3B,CACF,EAAA,CAAA;AAAA,UACC;AAAA;AAAA;AAAA,KACH;AAAA;AAGN;AAEA,OAAA,CAAQ,cAAc,OAAQ,CAAA,WAAA;;;;"}
1
+ {"version":3,"file":"Tooltip.esm.js","sources":["../../../src/components/Tooltip/Tooltip.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 {\n OverlayArrow,\n Tooltip as AriaTooltip,\n TooltipTrigger as AriaTooltipTrigger,\n TooltipTriggerComponentProps,\n} from 'react-aria-components';\nimport clsx from 'clsx';\nimport { TooltipProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\n\n/** @public */\nexport const TooltipTrigger = (props: TooltipTriggerComponentProps) => {\n const { delay = 600 } = props;\n\n return <AriaTooltipTrigger delay={delay} {...props} />;\n};\n\n/** @public */\nexport const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(\n ({ className, children, ...rest }, ref) => {\n const { classNames } = useStyles('Tooltip');\n\n return (\n <AriaTooltip\n className={clsx(classNames.tooltip, className)}\n {...rest}\n ref={ref}\n >\n <OverlayArrow className={classNames.arrow}>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\">\n <path d=\"M10.3356 7.39793L15.1924 3.02682C15.9269 2.36577 16.8801 2 17.8683 2H20V7.94781e-07L1.74846e-07 -9.53674e-07L0 2L1.4651 2C2.4532 2 3.4064 2.36577 4.1409 3.02682L8.9977 7.39793C9.378 7.7402 9.9553 7.74021 10.3356 7.39793Z\" />\n <path d=\"M11.0046 8.14124C10.2439 8.82575 9.08939 8.82578 8.32869 8.14122L3.47189 3.77011C2.92109 3.27432 2.20619 2.99999 1.46509 2.99999L4.10999 3L8.99769 7.39793C9.37799 7.7402 9.95529 7.7402 10.3356 7.39793L15.2226 3L17.8683 2.99999C17.1271 2.99999 16.4122 3.27432 15.8614 3.77011L11.0046 8.14124Z\" />\n </svg>\n </OverlayArrow>\n {children}\n </AriaTooltip>\n );\n },\n);\n\nTooltip.displayName = 'Tooltip';\n"],"names":["AriaTooltipTrigger","AriaTooltip"],"mappings":";;;;;;AA4Ba,MAAA,cAAA,GAAiB,CAAC,KAAwC,KAAA;AACrE,EAAM,MAAA,EAAE,KAAQ,GAAA,GAAA,EAAQ,GAAA,KAAA;AAExB,EAAA,uBAAQ,GAAA,CAAAA,gBAAA,EAAA,EAAmB,KAAe,EAAA,GAAG,KAAO,EAAA,CAAA;AACtD;AAGO,MAAM,OAAU,GAAA,UAAA;AAAA,EACrB,CAAC,EAAE,SAAA,EAAW,UAAU,GAAG,IAAA,IAAQ,GAAQ,KAAA;AACzC,IAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,SAAS,CAAA;AAE1C,IACE,uBAAA,IAAA;AAAA,MAACC,SAAA;AAAA,MAAA;AAAA,QACC,SAAW,EAAA,IAAA,CAAK,UAAW,CAAA,OAAA,EAAS,SAAS,CAAA;AAAA,QAC5C,GAAG,IAAA;AAAA,QACJ,GAAA;AAAA,QAEA,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,YAAa,EAAA,EAAA,SAAA,EAAW,UAAW,CAAA,KAAA,EAClC,QAAC,kBAAA,IAAA,CAAA,KAAA,EAAA,EAAI,KAAM,EAAA,IAAA,EAAK,MAAO,EAAA,IAAA,EAAK,OAAQ,EAAA,WAAA,EAAY,MAAK,MACnD,EAAA,QAAA,EAAA;AAAA,4BAAC,GAAA,CAAA,MAAA,EAAA,EAAK,GAAE,8NAA+N,EAAA,CAAA;AAAA,4BACvO,GAAA,CAAC,MAAK,EAAA,EAAA,CAAA,EAAE,qSAAsS,EAAA;AAAA,WAAA,EAChT,CACF,EAAA,CAAA;AAAA,UACC;AAAA;AAAA;AAAA,KACH;AAAA;AAGN;AAEA,OAAA,CAAQ,WAAc,GAAA,SAAA;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
- import { ReactNode, ElementType, ComponentPropsWithRef, ReactElement, ComponentProps, ForwardRefExoticComponent, RefAttributes } from 'react';
2
+ import { ReactNode, ReactElement, ElementType, ComponentPropsWithRef, ComponentProps, ForwardRefExoticComponent, RefAttributes } from 'react';
3
3
  import { RemixiconComponentType } from '@remixicon/react';
4
4
  import { Avatar as Avatar$1 } from '@base-ui-components/react/avatar';
5
- import { ButtonProps as ButtonProps$1, LinkProps as LinkProps$1, RadioGroupProps as RadioGroupProps$1, RadioProps as RadioProps$1, TabsProps as TabsProps$1, TabListProps as TabListProps$1, TabPanelProps as TabPanelProps$1, TabProps, TextFieldProps as TextFieldProps$1, TooltipProps as TooltipProps$1, TooltipTriggerComponentProps, SearchFieldProps as SearchFieldProps$1, SelectProps as SelectProps$1, SwitchProps as SwitchProps$1 } from 'react-aria-components';
5
+ import { ButtonProps as ButtonProps$1, TabsProps as TabsProps$1, TabListProps as TabListProps$1, TabProps as TabProps$1, TabPanelProps as TabPanelProps$1, LinkProps as LinkProps$1, RadioGroupProps as RadioGroupProps$1, RadioProps as RadioProps$1, TextFieldProps as TextFieldProps$1, TooltipProps as TooltipProps$1, TooltipTriggerComponentProps, SearchFieldProps as SearchFieldProps$1, SelectProps as SelectProps$1, SwitchProps as SwitchProps$1 } from 'react-aria-components';
6
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
7
7
  import { NavigateOptions } from 'react-router-dom';
8
8
  import { Collapsible as Collapsible$1 } from '@base-ui-components/react/collapsible';
@@ -311,8 +311,6 @@ declare const componentDefinitions: {
311
311
  };
312
312
  };
313
313
 
314
- /** @public */
315
- type AsProps = 'div' | 'span' | 'p' | 'article' | 'section' | 'main' | 'nav' | 'aside' | 'ul' | 'ol' | 'li' | 'details' | 'summary' | 'dd' | 'dl' | 'dt';
316
314
  /** @public */
317
315
  type Breakpoint = 'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
318
316
  /** @public */
@@ -353,6 +351,14 @@ interface SpaceProps {
353
351
  py?: Responsive<Space>;
354
352
  }
355
353
  /** @public */
354
+ type TextVariants = 'title-large' | 'title-medium' | 'title-small' | 'title-x-small' | 'body-large' | 'body-medium' | 'body-small' | 'body-x-small';
355
+ /** @public */
356
+ type TextColors = 'primary' | 'secondary';
357
+ /** @public */
358
+ type TextColorStatus = 'danger' | 'warning' | 'success';
359
+ /** @public */
360
+ type TextWeights = 'regular' | 'bold';
361
+ /** @public */
356
362
  interface UtilityProps extends SpaceProps {
357
363
  alignItems?: Responsive<AlignItems>;
358
364
  border?: Responsive<Border>;
@@ -711,47 +717,6 @@ interface ContainerProps {
711
717
  /** @public */
712
718
  declare const Container: react.ForwardRefExoticComponent<ContainerProps & react.RefAttributes<HTMLDivElement>>;
713
719
 
714
- /** @public */
715
- type TextOwnProps = {
716
- as?: 'p' | 'span' | 'label';
717
- variant?: 'subtitle' | 'body' | 'caption' | 'label' | Partial<Record<Breakpoint, 'subtitle' | 'body' | 'caption' | 'label'>>;
718
- weight?: 'regular' | 'bold' | Partial<Record<Breakpoint, 'regular' | 'bold'>>;
719
- color?: 'primary' | 'secondary' | 'danger' | 'warning' | 'success' | Partial<Record<Breakpoint, 'primary' | 'secondary' | 'danger' | 'warning' | 'success'>>;
720
- truncate?: boolean;
721
- className?: string;
722
- style?: React.CSSProperties;
723
- };
724
- /** @public */
725
- type TextProps<T extends ElementType = 'p'> = TextOwnProps & Omit<ComponentPropsWithRef<T>, keyof TextOwnProps>;
726
-
727
- /** @public */
728
- declare const Text: {
729
- <T extends ElementType = "p">(props: TextProps<T> & {
730
- ref?: React.ComponentPropsWithRef<T>["ref"];
731
- }): React.ReactElement<TextProps<T>, T>;
732
- displayName: string;
733
- };
734
-
735
- /** @public */
736
- type HeadingOwnProps = {
737
- as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
738
- variant?: 'display' | 'title1' | 'title2' | 'title3' | 'title4' | 'title5' | Partial<Record<Breakpoint, 'display' | 'title1' | 'title2' | 'title3' | 'title4' | 'title5'>>;
739
- color?: 'primary' | 'secondary' | Partial<Record<Breakpoint, 'primary' | 'secondary'>>;
740
- truncate?: boolean;
741
- className?: string;
742
- style?: React.CSSProperties;
743
- };
744
- /** @public */
745
- type HeadingProps<T extends ElementType = 'h1'> = HeadingOwnProps & Omit<ComponentPropsWithRef<T>, keyof HeadingOwnProps>;
746
-
747
- /** @public */
748
- declare const Heading: {
749
- <T extends ElementType = "h1">(props: HeadingProps<T> & {
750
- ref?: React.ComponentPropsWithRef<T>["ref"];
751
- }): React.ReactElement<HeadingProps<T>, T>;
752
- displayName: string;
753
- };
754
-
755
720
  /** @public */
756
721
  interface AvatarProps extends React.ComponentPropsWithoutRef<typeof Avatar$1.Root> {
757
722
  src: string;
@@ -933,6 +898,72 @@ interface FieldLabelProps {
933
898
  /** @public */
934
899
  declare const FieldLabel: react.ForwardRefExoticComponent<FieldLabelProps & react.RefAttributes<HTMLDivElement>>;
935
900
 
901
+ /**
902
+ * Strategies for matching the current route to determine which tab should be active.
903
+ *
904
+ * @public
905
+ */
906
+ type TabMatchStrategy = 'exact' | 'prefix';
907
+ /**
908
+ * Props for the Tabs component.
909
+ *
910
+ * @public
911
+ */
912
+ interface TabsProps extends TabsProps$1 {
913
+ }
914
+ /**
915
+ * Props for the TabList component.
916
+ *
917
+ * @public
918
+ */
919
+ interface TabListProps extends Omit<TabListProps$1<object>, 'items'> {
920
+ }
921
+ /**
922
+ * Props for the Tab component.
923
+ *
924
+ * @public
925
+ */
926
+ interface TabProps extends TabProps$1 {
927
+ /**
928
+ * Strategy for matching the current route to determine if this tab should be active.
929
+ * - 'exact': Tab href must exactly match the current pathname (default)
930
+ * - 'prefix': Tab is active if current pathname starts with tab href
931
+ */
932
+ matchStrategy?: 'exact' | 'prefix';
933
+ }
934
+ /**
935
+ * Props for the TabPanel component.
936
+ *
937
+ * @public
938
+ */
939
+ interface TabPanelProps extends TabPanelProps$1 {
940
+ }
941
+
942
+ /**
943
+ * A component that renders a list of tabs.
944
+ *
945
+ * @public
946
+ */
947
+ declare const Tabs: (props: TabsProps) => react_jsx_runtime.JSX.Element | null;
948
+ /**
949
+ * A component that renders a list of tabs.
950
+ *
951
+ * @public
952
+ */
953
+ declare const TabList: (props: TabListProps) => react_jsx_runtime.JSX.Element;
954
+ /**
955
+ * A component that renders a tab.
956
+ *
957
+ * @public
958
+ */
959
+ declare const Tab: (props: TabProps) => react_jsx_runtime.JSX.Element;
960
+ /**
961
+ * A component that renders the content of a tab.
962
+ *
963
+ * @public
964
+ */
965
+ declare const TabPanel: (props: TabPanelProps) => react_jsx_runtime.JSX.Element;
966
+
936
967
  /**
937
968
  * Props for the main Header component.
938
969
  *
@@ -941,10 +972,12 @@ declare const FieldLabel: react.ForwardRefExoticComponent<FieldLabelProps & reac
941
972
  interface HeaderProps {
942
973
  icon?: React.ReactNode;
943
974
  title?: string;
975
+ titleLink?: string;
944
976
  breadcrumbs?: HeaderBreadcrumb[];
945
977
  customActions?: React.ReactNode;
946
978
  menuItems?: HeaderMenuItem[];
947
979
  tabs?: HeaderTab[];
980
+ onTabSelectionChange?: TabsProps$1['onSelectionChange'];
948
981
  }
949
982
  /**
950
983
  * Represents a tab item in the header navigation.
@@ -955,6 +988,12 @@ interface HeaderTab {
955
988
  id: string;
956
989
  label: string;
957
990
  href?: string;
991
+ /**
992
+ * Strategy for matching the current route to determine if this tab should be active.
993
+ * - 'exact': Tab href must exactly match the current pathname (default)
994
+ * - 'prefix': Tab is active if current pathname starts with tab href
995
+ */
996
+ matchStrategy?: TabMatchStrategy;
958
997
  }
959
998
  /**
960
999
  * Represents an option item in the header dropdown menu.
@@ -1076,52 +1115,24 @@ declare const RadioGroup: react.ForwardRefExoticComponent<RadioGroupProps & reac
1076
1115
  /** @public */
1077
1116
  declare const Radio: react.ForwardRefExoticComponent<RadioProps & react.RefAttributes<HTMLLabelElement>>;
1078
1117
 
1079
- /**
1080
- * Props for the Tabs component.
1081
- *
1082
- * @public
1083
- */
1084
- interface TabsProps extends TabsProps$1 {
1085
- }
1086
- /**
1087
- * Props for the TabList component.
1088
- *
1089
- * @public
1090
- */
1091
- interface TabListProps extends Omit<TabListProps$1<object>, 'items'> {
1092
- }
1093
- /**
1094
- * Props for the TabPanel component.
1095
- *
1096
- * @public
1097
- */
1098
- interface TabPanelProps extends TabPanelProps$1 {
1099
- }
1118
+ /** @public */
1119
+ type TextOwnProps = {
1120
+ as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'label' | 'div' | 'strong' | 'em' | 'small' | 'legend';
1121
+ variant?: TextVariants | Partial<Record<Breakpoint, TextVariants>>;
1122
+ weight?: TextWeights | Partial<Record<Breakpoint, TextWeights>>;
1123
+ color?: TextColors | TextColorStatus | Partial<Record<Breakpoint, TextColors | TextColorStatus>>;
1124
+ truncate?: boolean;
1125
+ };
1126
+ /** @public */
1127
+ type TextProps<T extends ElementType = 'span'> = TextOwnProps & Omit<ComponentPropsWithRef<T>, keyof TextOwnProps>;
1100
1128
 
1101
- /**
1102
- * A component that renders a list of tabs.
1103
- *
1104
- * @public
1105
- */
1106
- declare const Tabs: (props: TabsProps) => react_jsx_runtime.JSX.Element | null;
1107
- /**
1108
- * A component that renders a list of tabs.
1109
- *
1110
- * @public
1111
- */
1112
- declare const TabList: (props: TabListProps) => react_jsx_runtime.JSX.Element;
1113
- /**
1114
- * A component that renders a tab.
1115
- *
1116
- * @public
1117
- */
1118
- declare const Tab: (props: TabProps) => react_jsx_runtime.JSX.Element;
1119
- /**
1120
- * A component that renders the content of a tab.
1121
- *
1122
- * @public
1123
- */
1124
- declare const TabPanel: (props: TabPanelProps) => react_jsx_runtime.JSX.Element;
1129
+ /** @public */
1130
+ declare const Text: {
1131
+ <T extends ElementType = "p">(props: TextProps<T> & {
1132
+ ref?: React.ComponentPropsWithRef<T>["ref"];
1133
+ }): React.ReactElement<TextProps<T>, T>;
1134
+ displayName: string;
1135
+ };
1125
1136
 
1126
1137
  /** @public */
1127
1138
  interface TextFieldProps extends TextFieldProps$1, Omit<FieldLabelProps, 'htmlFor' | 'id'> {
@@ -1222,9 +1233,10 @@ declare const SearchField: react.ForwardRefExoticComponent<SearchFieldProps & re
1222
1233
 
1223
1234
  /** @public */
1224
1235
  interface LinkProps extends LinkProps$1 {
1225
- variant?: 'title-large' | 'title-medium' | 'title-small' | 'title-x-small' | 'body-large' | 'body-medium' | 'body-small' | 'body-x-small' | Partial<Record<Breakpoint, 'title-large' | 'title-medium' | 'title-small' | 'title-x-small' | 'body-large' | 'body-medium' | 'body-small' | 'body-x-small'>>;
1226
- weight?: 'regular' | 'bold' | Partial<Record<Breakpoint, 'regular' | 'bold'>>;
1227
- color?: 'primary' | 'secondary' | Partial<Record<Breakpoint, 'primary' | 'secondary'>>;
1236
+ variant?: TextVariants | Partial<Record<Breakpoint, TextVariants>>;
1237
+ weight?: TextWeights | Partial<Record<Breakpoint, TextWeights>>;
1238
+ color?: TextColors | TextColorStatus | Partial<Record<Breakpoint, TextColors | TextColorStatus>>;
1239
+ truncate?: boolean;
1228
1240
  }
1229
1241
 
1230
1242
  /** @public */
@@ -1395,4 +1407,4 @@ declare const useBreakpoint: () => {
1395
1407
  down: (key: Breakpoint) => boolean;
1396
1408
  };
1397
1409
 
1398
- export { type AlignItems, type ArbitraryStylingPropDef, type AsProps, Avatar, type AvatarProps, type BooleanPropDef, type Border, type BorderRadius, Box, type BoxOwnProps, type BoxProps, type Breakpoint, Button, ButtonIcon, type ButtonIconProps, ButtonLink, type ButtonLinkProps, type ButtonProps, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardProps, Checkbox, type CheckboxProps, type ClassNamesMap, Collapsible, type Columns, type ComponentClassNames, type ComponentDefinition, type ComponentDefinitionName, Container, type ContainerProps, type DataAttributeValues, type DataAttributesMap, DataTable, type DataTablePaginationProps, type DataTableRootProps, type DataTableTableProps, type Display, type DisplayProps, type EnumOrStringPropDef, type EnumPropDef, FieldLabel, type FieldLabelProps, Flex, type FlexDirection, type FlexOwnProps, type FlexProps, type FlexWrap, type GapProps, type GetPropDefType, type GetPropDefTypes, Grid, type GridItemOwnProps, type GridItemProps, type GridOwnProps, type GridProps, Header, type HeaderBreadcrumb, type HeaderMenuItem, HeaderPage, type HeaderPageProps, type HeaderProps, type HeaderTab, Heading, type HeadingOwnProps, type HeadingProps, type HeightProps, Icon, IconContext, type IconContextProps, type IconMap, type IconNames, type IconProps, IconProvider, type IconProviderProps, type JustifyContent, Link, type LinkProps, type MarginProps, Menu, type MenuComboboxOption, type MenuComboboxProps, type MenuComponent, type NonStylingPropDef, type PaddingProps, type PositionProps, type PropDef, Radio, RadioGroup, type RadioGroupProps, type RadioProps, type ReactNodePropDef, type RegularPropDef, type Responsive, type ResponsivePropDef, ScrollArea, SearchField, type SearchFieldProps, Select, type SelectProps, Skeleton, type SkeletonProps, type Space, type SpaceProps, type StringPropDef, type StylingPropDef, Switch, type SwitchProps, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, Table, type TableCellLinkProps, type TableCellProfileProps, type TableCellTextProps, Tabs, type TabsProps, Text, TextField, type TextFieldProps, type TextOwnProps, type TextProps, Tooltip, type TooltipProps, TooltipTrigger, type UtilityProps, type WidthProps, boxPropDefs, breakpoints, componentDefinitions, displayPropDefs, flexPropDefs, gapPropDefs, gridItemPropDefs, gridPropDefs, heightPropDefs, icons, marginPropDefs, paddingPropDefs, positionPropDefs, useBreakpoint, useIcons, widthPropDefs };
1410
+ export { type AlignItems, type ArbitraryStylingPropDef, Avatar, type AvatarProps, type BooleanPropDef, type Border, type BorderRadius, Box, type BoxOwnProps, type BoxProps, type Breakpoint, Button, ButtonIcon, type ButtonIconProps, ButtonLink, type ButtonLinkProps, type ButtonProps, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardProps, Checkbox, type CheckboxProps, type ClassNamesMap, Collapsible, type Columns, type ComponentClassNames, type ComponentDefinition, type ComponentDefinitionName, Container, type ContainerProps, type DataAttributeValues, type DataAttributesMap, DataTable, type DataTablePaginationProps, type DataTableRootProps, type DataTableTableProps, type Display, type DisplayProps, type EnumOrStringPropDef, type EnumPropDef, FieldLabel, type FieldLabelProps, Flex, type FlexDirection, type FlexOwnProps, type FlexProps, type FlexWrap, type GapProps, type GetPropDefType, type GetPropDefTypes, Grid, type GridItemOwnProps, type GridItemProps, type GridOwnProps, type GridProps, Header, type HeaderBreadcrumb, type HeaderMenuItem, HeaderPage, type HeaderPageProps, type HeaderProps, type HeaderTab, type HeightProps, Icon, IconContext, type IconContextProps, type IconMap, type IconNames, type IconProps, IconProvider, type IconProviderProps, type JustifyContent, Link, type LinkProps, type MarginProps, Menu, type MenuComboboxOption, type MenuComboboxProps, type MenuComponent, type NonStylingPropDef, type PaddingProps, type PositionProps, type PropDef, Radio, RadioGroup, type RadioGroupProps, type RadioProps, type ReactNodePropDef, type RegularPropDef, type Responsive, type ResponsivePropDef, ScrollArea, SearchField, type SearchFieldProps, Select, type SelectProps, Skeleton, type SkeletonProps, type Space, type SpaceProps, type StringPropDef, type StylingPropDef, Switch, type SwitchProps, Tab, TabList, type TabListProps, type TabMatchStrategy, TabPanel, type TabPanelProps, type TabProps, Table, type TableCellLinkProps, type TableCellProfileProps, type TableCellTextProps, Tabs, type TabsProps, Text, type TextColorStatus, type TextColors, TextField, type TextFieldProps, type TextOwnProps, type TextProps, type TextVariants, type TextWeights, Tooltip, type TooltipProps, TooltipTrigger, type UtilityProps, type WidthProps, boxPropDefs, breakpoints, componentDefinitions, displayPropDefs, flexPropDefs, gapPropDefs, gridItemPropDefs, gridPropDefs, heightPropDefs, icons, marginPropDefs, paddingPropDefs, positionPropDefs, useBreakpoint, useIcons, widthPropDefs };