@backstage/ui 0.12.1-next.0 → 0.13.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/CHANGELOG.md +142 -0
  2. package/dist/analytics/BUIProvider.esm.js +18 -0
  3. package/dist/analytics/BUIProvider.esm.js.map +1 -0
  4. package/dist/analytics/getNodeText.esm.js +21 -0
  5. package/dist/analytics/getNodeText.esm.js.map +1 -0
  6. package/dist/analytics/useAnalytics.esm.js +26 -0
  7. package/dist/analytics/useAnalytics.esm.js.map +1 -0
  8. package/dist/components/Accordion/Accordion.esm.js +1 -0
  9. package/dist/components/Accordion/Accordion.esm.js.map +1 -1
  10. package/dist/components/Accordion/definition.esm.js +3 -2
  11. package/dist/components/Accordion/definition.esm.js.map +1 -1
  12. package/dist/components/Alert/definition.esm.js +2 -1
  13. package/dist/components/Alert/definition.esm.js.map +1 -1
  14. package/dist/components/Avatar/Avatar.esm.js +8 -28
  15. package/dist/components/Avatar/Avatar.esm.js.map +1 -1
  16. package/dist/components/Avatar/definition.esm.js +18 -4
  17. package/dist/components/Avatar/definition.esm.js.map +1 -1
  18. package/dist/components/Box/definition.esm.js +2 -1
  19. package/dist/components/Box/definition.esm.js.map +1 -1
  20. package/dist/components/Button/definition.esm.js +3 -3
  21. package/dist/components/Button/definition.esm.js.map +1 -1
  22. package/dist/components/ButtonIcon/definition.esm.js +3 -3
  23. package/dist/components/ButtonIcon/definition.esm.js.map +1 -1
  24. package/dist/components/ButtonLink/ButtonLink.esm.js +10 -1
  25. package/dist/components/ButtonLink/ButtonLink.esm.js.map +1 -1
  26. package/dist/components/ButtonLink/definition.esm.js +5 -3
  27. package/dist/components/ButtonLink/definition.esm.js.map +1 -1
  28. package/dist/components/Card/Card.esm.js +67 -6
  29. package/dist/components/Card/Card.esm.js.map +1 -1
  30. package/dist/components/Card/Card.module.css.esm.js +2 -2
  31. package/dist/components/Card/definition.esm.js +11 -3
  32. package/dist/components/Card/definition.esm.js.map +1 -1
  33. package/dist/components/Checkbox/Checkbox.esm.js +10 -17
  34. package/dist/components/Checkbox/Checkbox.esm.js.map +1 -1
  35. package/dist/components/Checkbox/definition.esm.js +17 -5
  36. package/dist/components/Checkbox/definition.esm.js.map +1 -1
  37. package/dist/components/Container/Container.esm.js +8 -13
  38. package/dist/components/Container/Container.esm.js.map +1 -1
  39. package/dist/components/Container/Container.module.css.esm.js +2 -2
  40. package/dist/components/Container/definition.esm.js +17 -2
  41. package/dist/components/Container/definition.esm.js.map +1 -1
  42. package/dist/components/Dialog/Dialog.esm.js +26 -59
  43. package/dist/components/Dialog/Dialog.esm.js.map +1 -1
  44. package/dist/components/Dialog/Dialog.module.css.esm.js +2 -2
  45. package/dist/components/Dialog/definition.esm.js +53 -8
  46. package/dist/components/Dialog/definition.esm.js.map +1 -1
  47. package/dist/components/FieldError/FieldError.esm.js +4 -13
  48. package/dist/components/FieldError/FieldError.esm.js.map +1 -1
  49. package/dist/components/FieldError/definition.esm.js +15 -2
  50. package/dist/components/FieldError/definition.esm.js.map +1 -1
  51. package/dist/components/FieldLabel/FieldLabel.esm.js +14 -59
  52. package/dist/components/FieldLabel/FieldLabel.esm.js.map +1 -1
  53. package/dist/components/FieldLabel/definition.esm.js +20 -2
  54. package/dist/components/FieldLabel/definition.esm.js.map +1 -1
  55. package/dist/components/Flex/Flex.esm.js +12 -22
  56. package/dist/components/Flex/Flex.esm.js.map +1 -1
  57. package/dist/components/Flex/definition.esm.js +20 -13
  58. package/dist/components/Flex/definition.esm.js.map +1 -1
  59. package/dist/components/FullPage/FullPage.esm.js +4 -13
  60. package/dist/components/FullPage/FullPage.esm.js.map +1 -1
  61. package/dist/components/FullPage/definition.esm.js +15 -2
  62. package/dist/components/FullPage/definition.esm.js.map +1 -1
  63. package/dist/components/Grid/Grid.esm.js +21 -40
  64. package/dist/components/Grid/Grid.esm.js.map +1 -1
  65. package/dist/components/Grid/definition.esm.js +31 -26
  66. package/dist/components/Grid/definition.esm.js.map +1 -1
  67. package/dist/components/Header/Header.esm.js +55 -0
  68. package/dist/components/Header/Header.esm.js.map +1 -0
  69. package/dist/components/Header/Header.module.css.esm.js +8 -0
  70. package/dist/components/Header/Header.module.css.esm.js.map +1 -0
  71. package/dist/components/Header/definition.esm.js +30 -0
  72. package/dist/components/Header/definition.esm.js.map +1 -0
  73. package/dist/components/Link/Link.esm.js +15 -34
  74. package/dist/components/Link/Link.esm.js.map +1 -1
  75. package/dist/components/Link/definition.esm.js +23 -15
  76. package/dist/components/Link/definition.esm.js.map +1 -1
  77. package/dist/components/Menu/Menu.esm.js +180 -344
  78. package/dist/components/Menu/Menu.esm.js.map +1 -1
  79. package/dist/components/Menu/Menu.module.css.esm.js +2 -2
  80. package/dist/components/Menu/definition.esm.js +116 -17
  81. package/dist/components/Menu/definition.esm.js.map +1 -1
  82. package/dist/components/PasswordField/PasswordField.esm.js +17 -52
  83. package/dist/components/PasswordField/PasswordField.esm.js.map +1 -1
  84. package/dist/components/PasswordField/PasswordField.module.css.esm.js +2 -2
  85. package/dist/components/PasswordField/definition.esm.js +29 -11
  86. package/dist/components/PasswordField/definition.esm.js.map +1 -1
  87. package/dist/components/PluginHeader/PluginHeader.esm.js +35 -46
  88. package/dist/components/PluginHeader/PluginHeader.esm.js.map +1 -1
  89. package/dist/components/PluginHeader/PluginHeader.module.css.esm.js +2 -2
  90. package/dist/components/PluginHeader/definition.esm.js +22 -3
  91. package/dist/components/PluginHeader/definition.esm.js.map +1 -1
  92. package/dist/components/Popover/Popover.esm.js +24 -32
  93. package/dist/components/Popover/Popover.esm.js.map +1 -1
  94. package/dist/components/Popover/Popover.module.css.esm.js +2 -2
  95. package/dist/components/Popover/definition.esm.js +17 -2
  96. package/dist/components/Popover/definition.esm.js.map +1 -1
  97. package/dist/components/RadioGroup/RadioGroup.esm.js +25 -44
  98. package/dist/components/RadioGroup/RadioGroup.esm.js.map +1 -1
  99. package/dist/components/RadioGroup/definition.esm.js +31 -5
  100. package/dist/components/RadioGroup/definition.esm.js.map +1 -1
  101. package/dist/components/SearchField/SearchField.esm.js +25 -45
  102. package/dist/components/SearchField/SearchField.esm.js.map +1 -1
  103. package/dist/components/SearchField/SearchField.module.css.esm.js +2 -2
  104. package/dist/components/SearchField/definition.esm.js +22 -5
  105. package/dist/components/SearchField/definition.esm.js.map +1 -1
  106. package/dist/components/Select/Select.esm.js +14 -23
  107. package/dist/components/Select/Select.esm.js.map +1 -1
  108. package/dist/components/Select/Select.module.css.esm.js +2 -2
  109. package/dist/components/Select/SelectContent.esm.js +8 -31
  110. package/dist/components/Select/SelectContent.esm.js.map +1 -1
  111. package/dist/components/Select/SelectListBox.esm.js +21 -44
  112. package/dist/components/Select/SelectListBox.esm.js.map +1 -1
  113. package/dist/components/Select/SelectTrigger.esm.js +11 -14
  114. package/dist/components/Select/SelectTrigger.esm.js.map +1 -1
  115. package/dist/components/Select/definition.esm.js +69 -17
  116. package/dist/components/Select/definition.esm.js.map +1 -1
  117. package/dist/components/Skeleton/Skeleton.esm.js +9 -13
  118. package/dist/components/Skeleton/Skeleton.esm.js.map +1 -1
  119. package/dist/components/Skeleton/definition.esm.js +19 -2
  120. package/dist/components/Skeleton/definition.esm.js.map +1 -1
  121. package/dist/components/Switch/Switch.esm.js +7 -22
  122. package/dist/components/Switch/Switch.esm.js.map +1 -1
  123. package/dist/components/Switch/definition.esm.js +16 -2
  124. package/dist/components/Switch/definition.esm.js.map +1 -1
  125. package/dist/components/Table/Table.module.css.esm.js +2 -2
  126. package/dist/components/Table/components/Cell.esm.js +4 -17
  127. package/dist/components/Table/components/Cell.esm.js.map +1 -1
  128. package/dist/components/Table/components/CellProfile.esm.js +12 -41
  129. package/dist/components/Table/components/CellProfile.esm.js.map +1 -1
  130. package/dist/components/Table/components/CellText.esm.js +39 -73
  131. package/dist/components/Table/components/CellText.esm.js.map +1 -1
  132. package/dist/components/Table/components/Column.esm.js +8 -36
  133. package/dist/components/Table/components/Column.esm.js.map +1 -1
  134. package/dist/components/Table/components/Row.esm.js +22 -19
  135. package/dist/components/Table/components/Row.esm.js.map +1 -1
  136. package/dist/components/Table/components/Table.esm.js +8 -0
  137. package/dist/components/Table/components/Table.esm.js.map +1 -1
  138. package/dist/components/Table/components/TableBody.esm.js +4 -12
  139. package/dist/components/Table/components/TableBody.esm.js.map +1 -1
  140. package/dist/components/Table/components/TableHeader.esm.js +19 -29
  141. package/dist/components/Table/components/TableHeader.esm.js.map +1 -1
  142. package/dist/components/Table/components/TableRoot.esm.js +5 -7
  143. package/dist/components/Table/components/TableRoot.esm.js.map +1 -1
  144. package/dist/components/Table/definition.esm.js +101 -21
  145. package/dist/components/Table/definition.esm.js.map +1 -1
  146. package/dist/components/TablePagination/TablePagination.esm.js +24 -32
  147. package/dist/components/TablePagination/TablePagination.esm.js.map +1 -1
  148. package/dist/components/TablePagination/definition.esm.js +33 -2
  149. package/dist/components/TablePagination/definition.esm.js.map +1 -1
  150. package/dist/components/Tabs/Tabs.esm.js +57 -64
  151. package/dist/components/Tabs/Tabs.esm.js.map +1 -1
  152. package/dist/components/Tabs/TabsIndicators.esm.js +6 -18
  153. package/dist/components/Tabs/TabsIndicators.esm.js.map +1 -1
  154. package/dist/components/Tabs/definition.esm.js +65 -10
  155. package/dist/components/Tabs/definition.esm.js.map +1 -1
  156. package/dist/components/TagGroup/TagGroup.esm.js +49 -63
  157. package/dist/components/TagGroup/TagGroup.esm.js.map +1 -1
  158. package/dist/components/TagGroup/definition.esm.js +38 -8
  159. package/dist/components/TagGroup/definition.esm.js.map +1 -1
  160. package/dist/components/Text/Text.esm.js +6 -13
  161. package/dist/components/Text/Text.esm.js.map +1 -1
  162. package/dist/components/Text/definition.esm.js +19 -14
  163. package/dist/components/Text/definition.esm.js.map +1 -1
  164. package/dist/components/TextField/TextField.esm.js +16 -41
  165. package/dist/components/TextField/TextField.esm.js.map +1 -1
  166. package/dist/components/TextField/TextField.module.css.esm.js +2 -2
  167. package/dist/components/TextField/definition.esm.js +21 -6
  168. package/dist/components/TextField/definition.esm.js.map +1 -1
  169. package/dist/components/ToggleButton/ToggleButton.esm.js +11 -23
  170. package/dist/components/ToggleButton/ToggleButton.esm.js.map +1 -1
  171. package/dist/components/ToggleButton/definition.esm.js +18 -4
  172. package/dist/components/ToggleButton/definition.esm.js.map +1 -1
  173. package/dist/components/ToggleButtonGroup/ToggleButtonGroup.esm.js +5 -18
  174. package/dist/components/ToggleButtonGroup/ToggleButtonGroup.esm.js.map +1 -1
  175. package/dist/components/ToggleButtonGroup/definition.esm.js +15 -4
  176. package/dist/components/ToggleButtonGroup/definition.esm.js.map +1 -1
  177. package/dist/components/Tooltip/Tooltip.esm.js +24 -30
  178. package/dist/components/Tooltip/Tooltip.esm.js.map +1 -1
  179. package/dist/components/Tooltip/Tooltip.module.css.esm.js +2 -2
  180. package/dist/components/Tooltip/definition.esm.js +17 -2
  181. package/dist/components/Tooltip/definition.esm.js.map +1 -1
  182. package/dist/components/VisuallyHidden/VisuallyHidden.esm.js +4 -12
  183. package/dist/components/VisuallyHidden/VisuallyHidden.esm.js.map +1 -1
  184. package/dist/components/VisuallyHidden/definition.esm.js +15 -2
  185. package/dist/components/VisuallyHidden/definition.esm.js.map +1 -1
  186. package/dist/css/styles.css +2 -4
  187. package/dist/hooks/useBg.esm.js +11 -2
  188. package/dist/hooks/useBg.esm.js.map +1 -1
  189. package/dist/hooks/useBreakpoint.esm.js +67 -27
  190. package/dist/hooks/useBreakpoint.esm.js.map +1 -1
  191. package/dist/hooks/useDefinition/defineComponent.esm.js.map +1 -1
  192. package/dist/hooks/useDefinition/useDefinition.esm.js +10 -3
  193. package/dist/hooks/useDefinition/useDefinition.esm.js.map +1 -1
  194. package/dist/index.d.ts +1036 -282
  195. package/dist/index.esm.js +7 -4
  196. package/dist/index.esm.js.map +1 -1
  197. package/package.json +5 -3
  198. package/dist/components/HeaderPage/HeaderPage.esm.js +0 -76
  199. package/dist/components/HeaderPage/HeaderPage.esm.js.map +0 -1
  200. package/dist/components/HeaderPage/HeaderPage.module.css.esm.js +0 -8
  201. package/dist/components/HeaderPage/HeaderPage.module.css.esm.js.map +0 -1
  202. package/dist/components/HeaderPage/definition.esm.js +0 -12
  203. package/dist/components/HeaderPage/definition.esm.js.map +0 -1
  204. package/dist/components/PluginHeader/PluginHeaderToolbar.esm.js +0 -94
  205. package/dist/components/PluginHeader/PluginHeaderToolbar.esm.js.map +0 -1
  206. package/dist/hooks/useMediaQuery.esm.js +0 -47
  207. package/dist/hooks/useMediaQuery.esm.js.map +0 -1
  208. package/dist/hooks/useStyles.esm.js +0 -53
  209. package/dist/hooks/useStyles.esm.js.map +0 -1
@@ -1,14 +1,12 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import { TabListStateContext } from 'react-aria-components';
3
- import { useStyles } from '../../hooks/useStyles.esm.js';
4
- import { TabsDefinition } from './definition.esm.js';
3
+ import { useDefinition } from '../../hooks/useDefinition/useDefinition.esm.js';
4
+ import { TabsIndicatorsDefinition } from './definition.esm.js';
5
5
  import { useContext, useRef, useCallback, useEffect } from 'react';
6
- import styles from './Tabs.module.css.esm.js';
7
- import clsx from 'clsx';
8
6
 
9
7
  const TabsIndicators = (props) => {
10
- const { tabRefs, tabsRef, hoveredKey, prevHoveredKey } = props;
11
- const { classNames } = useStyles(TabsDefinition);
8
+ const { ownProps } = useDefinition(TabsIndicatorsDefinition, props);
9
+ const { classes, tabRefs, tabsRef, hoveredKey, prevHoveredKey } = ownProps;
12
10
  const state = useContext(TabListStateContext);
13
11
  const prevSelectedKey = useRef(null);
14
12
  const updateCSSVariables = useCallback(() => {
@@ -134,18 +132,8 @@ const TabsIndicators = (props) => {
134
132
  return () => window.removeEventListener("resize", handleResize);
135
133
  }, [updateCSSVariables]);
136
134
  return /* @__PURE__ */ jsxs(Fragment, { children: [
137
- /* @__PURE__ */ jsx(
138
- "div",
139
- {
140
- className: clsx(classNames.tabActive, styles[classNames.tabActive])
141
- }
142
- ),
143
- /* @__PURE__ */ jsx(
144
- "div",
145
- {
146
- className: clsx(classNames.tabHovered, styles[classNames.tabHovered])
147
- }
148
- )
135
+ /* @__PURE__ */ jsx("div", { className: classes.root }),
136
+ /* @__PURE__ */ jsx("div", { className: classes.hovered })
149
137
  ] });
150
138
  };
151
139
 
@@ -1 +1 @@
1
- {"version":3,"file":"TabsIndicators.esm.js","sources":["../../../src/components/Tabs/TabsIndicators.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 { TabListStateContext } from 'react-aria-components';\nimport { useStyles } from '../../hooks/useStyles';\nimport { TabsDefinition } from './definition';\nimport { useContext, useEffect, useCallback, useRef } from 'react';\nimport type { TabsIndicatorsProps } from './types';\nimport styles from './Tabs.module.css';\nimport clsx from 'clsx';\n\n/**\n * A component that renders the indicators for the toolbar.\n *\n * @internal\n */\nexport const TabsIndicators = (props: TabsIndicatorsProps) => {\n const { tabRefs, tabsRef, hoveredKey, prevHoveredKey } = props;\n const { classNames } = useStyles(TabsDefinition);\n const state = useContext(TabListStateContext);\n const prevSelectedKey = useRef<string | null>(null);\n\n const updateCSSVariables = useCallback(() => {\n if (!tabsRef.current) return;\n\n const tabsRect = tabsRef.current.getBoundingClientRect();\n\n // Set active tab variables\n if (state?.selectedKey) {\n const activeTab = tabRefs.current.get(state.selectedKey.toString());\n\n if (activeTab) {\n const activeRect = activeTab.getBoundingClientRect();\n const relativeLeft = activeRect.left - tabsRect.left;\n const relativeTop = activeRect.top - tabsRect.top;\n\n // Control transition timing based on whether this is the first time setting active tab\n const isFirstActiveTab = prevSelectedKey.current === null;\n\n if (isFirstActiveTab) {\n // First time setting active tab: no transitions for position\n tabsRef.current.style.setProperty(\n '--active-transition-duration',\n '0s',\n );\n // Enable transitions on next frame for future tab switches\n requestAnimationFrame(() => {\n if (tabsRef.current) {\n tabsRef.current.style.setProperty(\n '--active-transition-duration',\n '0.25s',\n );\n }\n });\n } else {\n // Switching between tabs: full transitions\n tabsRef.current.style.setProperty(\n '--active-transition-duration',\n '0.25s',\n );\n }\n\n // Update previous selected key for next time\n prevSelectedKey.current = state.selectedKey.toString();\n\n tabsRef.current.style.setProperty(\n '--active-tab-left',\n `${relativeLeft}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-right',\n `${relativeLeft + activeRect.width}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-top',\n `${relativeTop}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-bottom',\n `${relativeTop + activeRect.height}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-width',\n `${activeRect.width}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-height',\n `${activeRect.height}px`,\n );\n }\n }\n\n // Set hovered tab variables\n if (hoveredKey) {\n const hoveredTab = tabRefs.current.get(hoveredKey);\n if (hoveredTab) {\n const hoveredRect = hoveredTab.getBoundingClientRect();\n const relativeLeft = hoveredRect.left - tabsRect.left;\n const relativeTop = hoveredRect.top - tabsRect.top;\n\n tabsRef.current.style.setProperty(\n '--hovered-tab-left',\n `${relativeLeft}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-right',\n `${relativeLeft + hoveredRect.width}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-top',\n `${relativeTop}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-bottom',\n `${relativeTop + hoveredRect.height}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-width',\n `${hoveredRect.width}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-height',\n `${hoveredRect.height}px`,\n );\n // Control transition timing based on whether this is a new hover session\n const isNewHoverSession = prevHoveredKey.current === null;\n\n if (isNewHoverSession) {\n // Starting new hover session: no transitions for position\n tabsRef.current.style.setProperty(\n '--hovered-transition-duration',\n '0s',\n );\n // Enable transitions on next frame for future tab switches\n requestAnimationFrame(() => {\n if (tabsRef.current) {\n tabsRef.current.style.setProperty(\n '--hovered-transition-duration',\n '0.2s',\n );\n }\n });\n } else {\n // Moving between tabs in same session: full transitions\n tabsRef.current.style.setProperty(\n '--hovered-transition-duration',\n '0.2s',\n );\n }\n\n // Update previous hover key for next time\n prevHoveredKey.current = hoveredKey;\n\n tabsRef.current.style.setProperty('--hovered-tab-opacity', '1');\n }\n } else {\n // When not hovering, hide with opacity and reset for next hover session\n tabsRef.current.style.setProperty('--hovered-tab-opacity', '0');\n\n // Reset previous hover key so next hover is treated as new session\n prevHoveredKey.current = null;\n }\n }, [state?.selectedKey, hoveredKey, tabRefs.current]);\n\n useEffect(() => {\n updateCSSVariables();\n }, [updateCSSVariables, tabRefs.current.size]);\n\n useEffect(() => {\n const handleResize = () => updateCSSVariables();\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, [updateCSSVariables]);\n\n return (\n <>\n <div\n className={clsx(classNames.tabActive, styles[classNames.tabActive])}\n />\n <div\n className={clsx(classNames.tabHovered, styles[classNames.tabHovered])}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA6BO,MAAM,cAAA,GAAiB,CAAC,KAAA,KAA+B;AAC5D,EAAA,MAAM,EAAE,OAAA,EAAS,OAAA,EAAS,UAAA,EAAY,gBAAe,GAAI,KAAA;AACzD,EAAA,MAAM,EAAE,UAAA,EAAW,GAAI,SAAA,CAAU,cAAc,CAAA;AAC/C,EAAA,MAAM,KAAA,GAAQ,WAAW,mBAAmB,CAAA;AAC5C,EAAA,MAAM,eAAA,GAAkB,OAAsB,IAAI,CAAA;AAElD,EAAA,MAAM,kBAAA,GAAqB,YAAY,MAAM;AAC3C,IAAA,IAAI,CAAC,QAAQ,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G9D,MAAA,cAAA,CAAe,OAAA,GAAU,IAAA;AAAA,IAC3B;AAAA,EACF,GAAG,CAAC,KAAA,EAAO,aAAa,UAAA,EAAY,OAAA,CAAQ,OAAO,CAAC,CAAA;AAEpD,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,kBAAA,EAAmB;AAAA,EACrB,GAAG,CAAC,kBAAA,EAAoB,OAAA,CAAQ,OAAA,CAAQ,IAAI,CAAC,CAAA;AAE7C,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,YAAA,GAAe,MAAM,kBAAA,EAAmB;AAC9C,IAAA,MAAA,CAAO,gBAAA,CAAiB,UAAU,YAAY,CAAA;AAC9C,IAAA,OAAO,MAAM,MAAA,CAAO,mBAAA,CAAoB,QAAA,EAAU,YAAY,CAAA;AAAA,EAChE,CAAA,EAAG,CAAC,kBAAkB,CAAC,CAAA;AAEvB,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,WAAW,IAAA,CAAK,UAAA,CAAW,WAAW,MAAA,CAAO,UAAA,CAAW,SAAS,CAAC;AAAA;AAAA,KACpE;AAAA,oBACA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,WAAW,IAAA,CAAK,UAAA,CAAW,YAAY,MAAA,CAAO,UAAA,CAAW,UAAU,CAAC;AAAA;AAAA;AACtE,GAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TabsIndicators.esm.js","sources":["../../../src/components/Tabs/TabsIndicators.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 { TabListStateContext } from 'react-aria-components';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TabsIndicatorsDefinition } from './definition';\nimport { useContext, useEffect, useCallback, useRef } from 'react';\nimport type { TabsIndicatorsProps } from './types';\n\n/**\n * A component that renders the indicators for the toolbar.\n *\n * @internal\n */\nexport const TabsIndicators = (props: TabsIndicatorsProps) => {\n const { ownProps } = useDefinition(TabsIndicatorsDefinition, props);\n const { classes, tabRefs, tabsRef, hoveredKey, prevHoveredKey } = ownProps;\n const state = useContext(TabListStateContext);\n const prevSelectedKey = useRef<string | null>(null);\n\n const updateCSSVariables = useCallback(() => {\n if (!tabsRef.current) return;\n\n const tabsRect = tabsRef.current.getBoundingClientRect();\n\n // Set active tab variables\n if (state?.selectedKey) {\n const activeTab = tabRefs.current.get(state.selectedKey.toString());\n\n if (activeTab) {\n const activeRect = activeTab.getBoundingClientRect();\n const relativeLeft = activeRect.left - tabsRect.left;\n const relativeTop = activeRect.top - tabsRect.top;\n\n // Control transition timing based on whether this is the first time setting active tab\n const isFirstActiveTab = prevSelectedKey.current === null;\n\n if (isFirstActiveTab) {\n // First time setting active tab: no transitions for position\n tabsRef.current.style.setProperty(\n '--active-transition-duration',\n '0s',\n );\n // Enable transitions on next frame for future tab switches\n requestAnimationFrame(() => {\n if (tabsRef.current) {\n tabsRef.current.style.setProperty(\n '--active-transition-duration',\n '0.25s',\n );\n }\n });\n } else {\n // Switching between tabs: full transitions\n tabsRef.current.style.setProperty(\n '--active-transition-duration',\n '0.25s',\n );\n }\n\n // Update previous selected key for next time\n prevSelectedKey.current = state.selectedKey.toString();\n\n tabsRef.current.style.setProperty(\n '--active-tab-left',\n `${relativeLeft}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-right',\n `${relativeLeft + activeRect.width}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-top',\n `${relativeTop}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-bottom',\n `${relativeTop + activeRect.height}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-width',\n `${activeRect.width}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-height',\n `${activeRect.height}px`,\n );\n }\n }\n\n // Set hovered tab variables\n if (hoveredKey) {\n const hoveredTab = tabRefs.current.get(hoveredKey);\n if (hoveredTab) {\n const hoveredRect = hoveredTab.getBoundingClientRect();\n const relativeLeft = hoveredRect.left - tabsRect.left;\n const relativeTop = hoveredRect.top - tabsRect.top;\n\n tabsRef.current.style.setProperty(\n '--hovered-tab-left',\n `${relativeLeft}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-right',\n `${relativeLeft + hoveredRect.width}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-top',\n `${relativeTop}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-bottom',\n `${relativeTop + hoveredRect.height}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-width',\n `${hoveredRect.width}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-height',\n `${hoveredRect.height}px`,\n );\n // Control transition timing based on whether this is a new hover session\n const isNewHoverSession = prevHoveredKey.current === null;\n\n if (isNewHoverSession) {\n // Starting new hover session: no transitions for position\n tabsRef.current.style.setProperty(\n '--hovered-transition-duration',\n '0s',\n );\n // Enable transitions on next frame for future tab switches\n requestAnimationFrame(() => {\n if (tabsRef.current) {\n tabsRef.current.style.setProperty(\n '--hovered-transition-duration',\n '0.2s',\n );\n }\n });\n } else {\n // Moving between tabs in same session: full transitions\n tabsRef.current.style.setProperty(\n '--hovered-transition-duration',\n '0.2s',\n );\n }\n\n // Update previous hover key for next time\n prevHoveredKey.current = hoveredKey;\n\n tabsRef.current.style.setProperty('--hovered-tab-opacity', '1');\n }\n } else {\n // When not hovering, hide with opacity and reset for next hover session\n tabsRef.current.style.setProperty('--hovered-tab-opacity', '0');\n\n // Reset previous hover key so next hover is treated as new session\n prevHoveredKey.current = null;\n }\n }, [state?.selectedKey, hoveredKey, tabRefs.current]);\n\n useEffect(() => {\n updateCSSVariables();\n }, [updateCSSVariables, tabRefs.current.size]);\n\n useEffect(() => {\n const handleResize = () => updateCSSVariables();\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, [updateCSSVariables]);\n\n return (\n <>\n <div className={classes.root} />\n <div className={classes.hovered} />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;AA2BO,MAAM,cAAA,GAAiB,CAAC,KAAA,KAA+B;AAC5D,EAAA,MAAM,EAAE,QAAA,EAAS,GAAI,aAAA,CAAc,0BAA0B,KAAK,CAAA;AAClE,EAAA,MAAM,EAAE,OAAA,EAAS,OAAA,EAAS,OAAA,EAAS,UAAA,EAAY,gBAAe,GAAI,QAAA;AAClE,EAAA,MAAM,KAAA,GAAQ,WAAW,mBAAmB,CAAA;AAC5C,EAAA,MAAM,eAAA,GAAkB,OAAsB,IAAI,CAAA;AAElD,EAAA,MAAM,kBAAA,GAAqB,YAAY,MAAM;AAC3C,IAAA,IAAI,CAAC,QAAQ,OAAA,EAAS;AAEtB,IAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,OAAA,CAAQ,qBAAA,EAAsB;AAGvD,IAAA,IAAI,OAAO,WAAA,EAAa;AACtB,MAAA,MAAM,YAAY,OAAA,CAAQ,OAAA,CAAQ,IAAI,KAAA,CAAM,WAAA,CAAY,UAAU,CAAA;AAElE,MAAA,IAAI,SAAA,EAAW;AACb,QAAA,MAAM,UAAA,GAAa,UAAU,qBAAA,EAAsB;AACnD,QAAA,MAAM,YAAA,GAAe,UAAA,CAAW,IAAA,GAAO,QAAA,CAAS,IAAA;AAChD,QAAA,MAAM,WAAA,GAAc,UAAA,CAAW,GAAA,GAAM,QAAA,CAAS,GAAA;AAG9C,QAAA,MAAM,gBAAA,GAAmB,gBAAgB,OAAA,KAAY,IAAA;AAErD,QAAA,IAAI,gBAAA,EAA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kB,CAAC,CAAA;AAEvB,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAA,CAAQ,IAAA,EAAM,CAAA;AAAA,oBAC9B,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAA,CAAQ,OAAA,EAAS;AAAA,GAAA,EACnC,CAAA;AAEJ;;;;"}
@@ -1,14 +1,69 @@
1
- const TabsDefinition = {
1
+ import 'react/jsx-runtime';
2
+ import 'clsx';
3
+ import '../../hooks/useBreakpoint.esm.js';
4
+ import '../../hooks/useBg.esm.js';
5
+ import '../../hooks/useDefinition/helpers.esm.js';
6
+ import '../../analytics/useAnalytics.esm.js';
7
+ import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
8
+ import styles from './Tabs.module.css.esm.js';
9
+
10
+ const TabsDefinition = defineComponent()({
11
+ styles,
12
+ classNames: {
13
+ root: "bui-Tabs"
14
+ },
15
+ propDefs: {
16
+ className: {},
17
+ children: {}
18
+ }
19
+ });
20
+ const TabListDefinition = defineComponent()({
21
+ styles,
22
+ classNames: {
23
+ root: "bui-TabListWrapper",
24
+ tabList: "bui-TabList"
25
+ },
26
+ propDefs: {
27
+ className: {},
28
+ children: {}
29
+ }
30
+ });
31
+ const TabDefinition = defineComponent()({
32
+ styles,
33
+ classNames: {
34
+ root: "bui-Tab"
35
+ },
36
+ analytics: true,
37
+ propDefs: {
38
+ className: {},
39
+ matchStrategy: {},
40
+ href: {},
41
+ id: {},
42
+ noTrack: {}
43
+ }
44
+ });
45
+ const TabPanelDefinition = defineComponent()({
46
+ styles,
47
+ classNames: {
48
+ root: "bui-TabPanel"
49
+ },
50
+ propDefs: {
51
+ className: {}
52
+ }
53
+ });
54
+ const TabsIndicatorsDefinition = defineComponent()({
55
+ styles,
2
56
  classNames: {
3
- tabs: "bui-Tabs",
4
- tabList: "bui-TabList",
5
- tabListWrapper: "bui-TabListWrapper",
6
- tab: "bui-Tab",
7
- tabActive: "bui-TabActive",
8
- tabHovered: "bui-TabHovered",
9
- panel: "bui-TabPanel"
57
+ root: "bui-TabActive",
58
+ hovered: "bui-TabHovered"
59
+ },
60
+ propDefs: {
61
+ tabRefs: {},
62
+ tabsRef: {},
63
+ hoveredKey: {},
64
+ prevHoveredKey: {}
10
65
  }
11
- };
66
+ });
12
67
 
13
- export { TabsDefinition };
68
+ export { TabDefinition, TabListDefinition, TabPanelDefinition, TabsDefinition, TabsIndicatorsDefinition };
14
69
  //# sourceMappingURL=definition.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Tabs/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ComponentDefinition } from '../../types';\n\n/**\n * Component definition for Tabs\n * @public\n */\nexport const TabsDefinition = {\n classNames: {\n tabs: 'bui-Tabs',\n tabList: 'bui-TabList',\n tabListWrapper: 'bui-TabListWrapper',\n tab: 'bui-Tab',\n tabActive: 'bui-TabActive',\n tabHovered: 'bui-TabHovered',\n panel: 'bui-TabPanel',\n },\n} as const satisfies ComponentDefinition;\n"],"names":[],"mappings":"AAsBO,MAAM,cAAA,GAAiB;AAAA,EAC5B,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,UAAA;AAAA,IACN,OAAA,EAAS,aAAA;AAAA,IACT,cAAA,EAAgB,oBAAA;AAAA,IAChB,GAAA,EAAK,SAAA;AAAA,IACL,SAAA,EAAW,eAAA;AAAA,IACX,UAAA,EAAY,gBAAA;AAAA,IACZ,KAAA,EAAO;AAAA;AAEX;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Tabs/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type {\n TabsOwnProps,\n TabListOwnProps,\n TabOwnProps,\n TabPanelOwnProps,\n TabsIndicatorsOwnProps,\n} from './types';\nimport styles from './Tabs.module.css';\n\n/**\n * Component definition for Tabs\n * @public\n */\nexport const TabsDefinition = defineComponent<TabsOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Tabs',\n },\n propDefs: {\n className: {},\n children: {},\n },\n});\n\n/** @internal */\nexport const TabListDefinition = defineComponent<TabListOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TabListWrapper',\n tabList: 'bui-TabList',\n },\n propDefs: {\n className: {},\n children: {},\n },\n});\n\n/** @internal */\nexport const TabDefinition = defineComponent<TabOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Tab',\n },\n analytics: true,\n propDefs: {\n className: {},\n matchStrategy: {},\n href: {},\n id: {},\n noTrack: {},\n },\n});\n\n/** @internal */\nexport const TabPanelDefinition = defineComponent<TabPanelOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TabPanel',\n },\n propDefs: {\n className: {},\n },\n});\n\n/** @internal */\nexport const TabsIndicatorsDefinition =\n defineComponent<TabsIndicatorsOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TabActive',\n hovered: 'bui-TabHovered',\n },\n propDefs: {\n tabRefs: {},\n tabsRef: {},\n hoveredKey: {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,76 +2,62 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { Tag as Tag$1, Button, TagGroup as TagGroup$1, TagList } from 'react-aria-components';
3
3
  import { forwardRef } from 'react';
4
4
  import { RiCloseCircleLine } from '@remixicon/react';
5
- import clsx from 'clsx';
6
- import { useStyles } from '../../hooks/useStyles.esm.js';
7
- import { TagGroupDefinition } from './definition.esm.js';
5
+ import { useDefinition } from '../../hooks/useDefinition/useDefinition.esm.js';
6
+ import { TagDefinition, TagGroupDefinition } from './definition.esm.js';
8
7
  import { createRoutingRegistration } from '../InternalLinkProvider/InternalLinkProvider.esm.js';
9
- import styles from './TagGroup.module.css.esm.js';
8
+ import { getNodeText } from '../../analytics/getNodeText.esm.js';
10
9
 
11
10
  const { RoutingProvider, useRoutingRegistrationEffect } = createRoutingRegistration();
12
11
  const TagGroup = (props) => {
13
- const { classNames, cleanedProps } = useStyles(TagGroupDefinition, props);
14
- const { items, children, renderEmptyState, ...rest } = cleanedProps;
15
- return /* @__PURE__ */ jsx(RoutingProvider, { children: /* @__PURE__ */ jsx(
16
- TagGroup$1,
12
+ const { ownProps, restProps } = useDefinition(TagGroupDefinition, props);
13
+ const { classes, items, children, renderEmptyState } = ownProps;
14
+ return /* @__PURE__ */ jsx(RoutingProvider, { children: /* @__PURE__ */ jsx(TagGroup$1, { className: classes.root, ...restProps, children: /* @__PURE__ */ jsx(
15
+ TagList,
17
16
  {
18
- className: clsx(classNames.group, styles[classNames.group]),
19
- ...rest,
20
- children: /* @__PURE__ */ jsx(
21
- TagList,
22
- {
23
- className: clsx(classNames.list, styles[classNames.list]),
24
- items,
25
- renderEmptyState,
26
- children
27
- }
28
- )
17
+ className: classes.list,
18
+ items,
19
+ renderEmptyState,
20
+ children
29
21
  }
30
- ) });
22
+ ) }) });
31
23
  };
32
- const Tag = forwardRef(
33
- (props, ref) => {
34
- const { classNames, cleanedProps } = useStyles(TagGroupDefinition, {
35
- size: "small",
36
- ...props
37
- });
38
- const { children, className, icon, size, href, ...rest } = cleanedProps;
39
- const textValue = typeof children === "string" ? children : void 0;
40
- useRoutingRegistrationEffect(href);
41
- return /* @__PURE__ */ jsx(
42
- Tag$1,
43
- {
44
- ref,
45
- textValue,
46
- className: clsx(classNames.tag, styles[classNames.tag], className),
47
- "data-size": size,
48
- href,
49
- ...rest,
50
- children: ({ allowsRemoving }) => /* @__PURE__ */ jsxs(Fragment, { children: [
51
- icon && /* @__PURE__ */ jsx(
52
- "span",
53
- {
54
- className: clsx(classNames.tagIcon, styles[classNames.tagIcon]),
55
- children: icon
56
- }
57
- ),
58
- children,
59
- allowsRemoving && /* @__PURE__ */ jsx(
60
- Button,
61
- {
62
- className: clsx(
63
- classNames.tagRemoveButton,
64
- styles[classNames.tagRemoveButton]
65
- ),
66
- slot: "remove",
67
- children: /* @__PURE__ */ jsx(RiCloseCircleLine, { size: 16 })
68
- }
69
- )
70
- ] })
71
- }
72
- );
73
- }
74
- );
24
+ const Tag = forwardRef((props, ref) => {
25
+ const { ownProps, restProps, dataAttributes, analytics } = useDefinition(
26
+ TagDefinition,
27
+ props
28
+ );
29
+ const { classes, children, icon, href } = ownProps;
30
+ const textValue = typeof children === "string" ? children : void 0;
31
+ useRoutingRegistrationEffect(href);
32
+ const handlePress = () => {
33
+ if (href) {
34
+ const text = props["aria-label"] ?? textValue ?? getNodeText(children) ?? String(href);
35
+ analytics.captureEvent("click", text, {
36
+ attributes: { to: String(href) }
37
+ });
38
+ }
39
+ };
40
+ return /* @__PURE__ */ jsx(
41
+ Tag$1,
42
+ {
43
+ ref,
44
+ textValue,
45
+ className: classes.root,
46
+ href,
47
+ ...dataAttributes,
48
+ ...restProps,
49
+ onPress: (e) => {
50
+ restProps.onPress?.(e);
51
+ handlePress();
52
+ },
53
+ children: ({ allowsRemoving }) => /* @__PURE__ */ jsxs(Fragment, { children: [
54
+ icon && /* @__PURE__ */ jsx("span", { className: classes.icon, children: icon }),
55
+ children,
56
+ allowsRemoving && /* @__PURE__ */ jsx(Button, { className: classes.removeButton, slot: "remove", children: /* @__PURE__ */ jsx(RiCloseCircleLine, { size: 16 }) })
57
+ ] })
58
+ }
59
+ );
60
+ });
75
61
 
76
62
  export { Tag, TagGroup };
77
63
  //# sourceMappingURL=TagGroup.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TagGroup.esm.js","sources":["../../../src/components/TagGroup/TagGroup.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 { TagProps, TagGroupProps } from './types';\nimport {\n TagGroup as ReactAriaTagGroup,\n TagList as ReactAriaTagList,\n Tag as ReactAriaTag,\n Button as ReactAriaButton,\n} from 'react-aria-components';\nimport { forwardRef, type PropsWithRef, type ReactNode, type Ref } from 'react';\nimport { RiCloseCircleLine } from '@remixicon/react';\nimport clsx from 'clsx';\nimport { useStyles } from '../../hooks/useStyles';\nimport { TagGroupDefinition } from './definition';\nimport { createRoutingRegistration } from '../InternalLinkProvider';\nimport styles from './TagGroup.module.css';\n\nconst { RoutingProvider, useRoutingRegistrationEffect } =\n createRoutingRegistration();\n\n/**\n * A component that renders a list of tags.\n *\n * @public\n */\nexport const TagGroup = <T extends object>(props: TagGroupProps<T>) => {\n const { classNames, cleanedProps } = useStyles(TagGroupDefinition, props);\n const { items, children, renderEmptyState, ...rest } = cleanedProps;\n\n return (\n <RoutingProvider>\n <ReactAriaTagGroup\n className={clsx(classNames.group, styles[classNames.group])}\n {...rest}\n >\n <ReactAriaTagList\n className={clsx(classNames.list, styles[classNames.list])}\n items={items}\n renderEmptyState={renderEmptyState}\n >\n {children}\n </ReactAriaTagList>\n </ReactAriaTagGroup>\n </RoutingProvider>\n );\n};\n\n/**\n * A component that renders a tag.\n *\n * @public\n */\nexport const Tag = forwardRef(\n (props: PropsWithRef<TagProps>, ref: Ref<HTMLDivElement>) => {\n const { classNames, cleanedProps } = useStyles(TagGroupDefinition, {\n size: 'small',\n ...props,\n });\n const { children, className, icon, size, href, ...rest } = cleanedProps;\n const textValue = typeof children === 'string' ? children : undefined;\n\n useRoutingRegistrationEffect(href);\n\n return (\n <ReactAriaTag\n ref={ref}\n textValue={textValue}\n className={clsx(classNames.tag, styles[classNames.tag], className)}\n data-size={size}\n href={href}\n {...rest}\n >\n {({ allowsRemoving }) => (\n <>\n {icon && (\n <span\n className={clsx(classNames.tagIcon, styles[classNames.tagIcon])}\n >\n {icon}\n </span>\n )}\n {children as ReactNode}\n {allowsRemoving && (\n <ReactAriaButton\n className={clsx(\n classNames.tagRemoveButton,\n styles[classNames.tagRemoveButton],\n )}\n slot=\"remove\"\n >\n <RiCloseCircleLine size={16} />\n </ReactAriaButton>\n )}\n </>\n )}\n </ReactAriaTag>\n );\n },\n);\n"],"names":["ReactAriaTagGroup","ReactAriaTagList","ReactAriaTag","ReactAriaButton"],"mappings":";;;;;;;;;;AA+BA,MAAM,EAAE,eAAA,EAAiB,4BAAA,EAA6B,GACpD,yBAAA,EAA0B;AAOrB,MAAM,QAAA,GAAW,CAAmB,KAAA,KAA4B;AACrE,EAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,SAAA,CAAU,oBAAoB,KAAK,CAAA;AACxE,EAAA,MAAM,EAAE,KAAA,EAAO,QAAA,EAAU,gBAAA,EAAkB,GAAG,MAAK,GAAI,YAAA;AAEvD,EAAA,2BACG,eAAA,EAAA,EACC,QAAA,kBAAA,GAAA;AAAA,IAACA,UAAA;AAAA,IAAA;AAAA,MACC,WAAW,IAAA,CAAK,UAAA,CAAW,OAAO,MAAA,CAAO,UAAA,CAAW,KAAK,CAAC,CAAA;AAAA,MACzD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ED,QAAA;AAAA,UACA,cAAA,oBACC,GAAA;AAAA,YAACC,MAAA;AAAA,YAAA;AAAA,cACC,SAAA,EAAW,IAAA;AAAA,gBACT,UAAA,CAAW,eAAA;AAAA,gBACX,MAAA,CAAO,WAAW,eAAe;AAAA,eACnC;AAAA,cACA,IAAA,EAAK,QAAA;AAAA,cAEL,QAAA,kBAAA,GAAA,CAAC,iBAAA,EAAA,EAAkB,IAAA,EAAM,EAAA,EAAI;AAAA;AAAA;AAC/B,SAAA,EAEJ;AAAA;AAAA,KAEJ;AAAA,EAEJ;AACF;;;;"}
1
+ {"version":3,"file":"TagGroup.esm.js","sources":["../../../src/components/TagGroup/TagGroup.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 { TagProps, TagGroupProps } from './types';\nimport {\n TagGroup as ReactAriaTagGroup,\n TagList as ReactAriaTagList,\n Tag as ReactAriaTag,\n Button as ReactAriaButton,\n} from 'react-aria-components';\nimport { forwardRef, type ReactNode } from 'react';\nimport { RiCloseCircleLine } from '@remixicon/react';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TagGroupDefinition, TagDefinition } from './definition';\nimport { createRoutingRegistration } from '../InternalLinkProvider';\nimport { getNodeText } from '../../analytics/getNodeText';\n\nconst { RoutingProvider, useRoutingRegistrationEffect } =\n createRoutingRegistration();\n\n/**\n * A component that renders a list of tags.\n *\n * @public\n */\nexport const TagGroup = <T extends object>(props: TagGroupProps<T>) => {\n const { ownProps, restProps } = useDefinition(TagGroupDefinition, props);\n const { classes, items, children, renderEmptyState } = ownProps;\n\n return (\n <RoutingProvider>\n <ReactAriaTagGroup className={classes.root} {...restProps}>\n <ReactAriaTagList\n className={classes.list}\n items={items}\n renderEmptyState={renderEmptyState}\n >\n {children}\n </ReactAriaTagList>\n </ReactAriaTagGroup>\n </RoutingProvider>\n );\n};\n\n/**\n * A component that renders a tag.\n *\n * @public\n */\nexport const Tag = forwardRef<HTMLDivElement, TagProps>((props, ref) => {\n const { ownProps, restProps, dataAttributes, analytics } = useDefinition(\n TagDefinition,\n props,\n );\n const { classes, children, icon, href } = ownProps;\n const textValue = typeof children === 'string' ? children : undefined;\n\n useRoutingRegistrationEffect(href);\n\n const handlePress = () => {\n if (href) {\n const text =\n (props as React.AriaAttributes)['aria-label'] ??\n textValue ??\n getNodeText(children) ??\n String(href);\n analytics.captureEvent('click', text, {\n attributes: { to: String(href) },\n });\n }\n };\n\n return (\n <ReactAriaTag\n ref={ref}\n textValue={textValue}\n className={classes.root}\n href={href}\n {...dataAttributes}\n {...restProps}\n onPress={e => {\n restProps.onPress?.(e);\n handlePress();\n }}\n >\n {({ allowsRemoving }) => (\n <>\n {icon && <span className={classes.icon}>{icon}</span>}\n {children as ReactNode}\n {allowsRemoving && (\n <ReactAriaButton className={classes.removeButton} slot=\"remove\">\n <RiCloseCircleLine size={16} />\n </ReactAriaButton>\n )}\n </>\n )}\n </ReactAriaTag>\n );\n});\n"],"names":["ReactAriaTagGroup","ReactAriaTagList","ReactAriaTag","ReactAriaButton"],"mappings":";;;;;;;;;AA8BA,MAAM,EAAE,eAAA,EAAiB,4BAAA,EAA6B,GACpD,yBAAA,EAA0B;AAOrB,MAAM,QAAA,GAAW,CAAmB,KAAA,KAA4B;AACrE,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAU,GAAI,aAAA,CAAc,oBAAoB,KAAK,CAAA;AACvE,EAAA,MAAM,EAAE,OAAA,EAAS,KAAA,EAAO,QAAA,EAAU,kBAAiB,GAAI,QAAA;AAEvD,EAAA,uBACE,GAAA,CAAC,mBACC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SAAA,CAAU,UAAU,CAAC,CAAA;AACrB,QAAA,WAAA,EAAY;AAAA,MACd,CAAA;AAAA,MAEC,QAAA,EAAA,CAAC,EAAE,cAAA,EAAe,qBACjB,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,QAAA,IAAA,oBAAQ,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAW,OAAA,CAAQ,MAAO,QAAA,EAAA,IAAA,EAAK,CAAA;AAAA,QAC7C,QAAA;AAAA,QACA,cAAA,oBACC,GAAA,CAACC,MAAA,EAAA,EAAgB,SAAA,EAAW,OAAA,CAAQ,YAAA,EAAc,IAAA,EAAK,QAAA,EACrD,QAAA,kBAAA,GAAA,CAAC,iBAAA,EAAA,EAAkB,IAAA,EAAM,EAAA,EAAI,CAAA,EAC/B;AAAA,OAAA,EAEJ;AAAA;AAAA,GAEJ;AAEJ,CAAC;;;;"}
@@ -1,12 +1,42 @@
1
- const TagGroupDefinition = {
1
+ import 'react/jsx-runtime';
2
+ import 'clsx';
3
+ import '../../hooks/useBreakpoint.esm.js';
4
+ import '../../hooks/useBg.esm.js';
5
+ import '../../hooks/useDefinition/helpers.esm.js';
6
+ import '../../analytics/useAnalytics.esm.js';
7
+ import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
8
+ import styles from './TagGroup.module.css.esm.js';
9
+
10
+ const TagGroupDefinition = defineComponent()({
11
+ styles,
12
+ classNames: {
13
+ root: "bui-TagGroup",
14
+ list: "bui-TagList"
15
+ },
16
+ propDefs: {
17
+ items: {},
18
+ children: {},
19
+ renderEmptyState: {},
20
+ className: {}
21
+ }
22
+ });
23
+ const TagDefinition = defineComponent()({
24
+ styles,
2
25
  classNames: {
3
- group: "bui-TagGroup",
4
- list: "bui-TagList",
5
- tag: "bui-Tag",
6
- tagIcon: "bui-TagIcon",
7
- tagRemoveButton: "bui-TagRemoveButton"
26
+ root: "bui-Tag",
27
+ icon: "bui-TagIcon",
28
+ removeButton: "bui-TagRemoveButton"
29
+ },
30
+ analytics: true,
31
+ propDefs: {
32
+ noTrack: {},
33
+ icon: {},
34
+ size: { dataAttribute: true, default: "small" },
35
+ href: {},
36
+ children: {},
37
+ className: {}
8
38
  }
9
- };
39
+ });
10
40
 
11
- export { TagGroupDefinition };
41
+ export { TagDefinition, TagGroupDefinition };
12
42
  //# sourceMappingURL=definition.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/TagGroup/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ComponentDefinition } from '../../types';\n\n/**\n * Component definition for TagGroup\n * @public\n */\nexport const TagGroupDefinition = {\n classNames: {\n group: 'bui-TagGroup',\n list: 'bui-TagList',\n tag: 'bui-Tag',\n tagIcon: 'bui-TagIcon',\n tagRemoveButton: 'bui-TagRemoveButton',\n },\n} as const satisfies ComponentDefinition;\n"],"names":[],"mappings":"AAsBO,MAAM,kBAAA,GAAqB;AAAA,EAChC,UAAA,EAAY;AAAA,IACV,KAAA,EAAO,cAAA;AAAA,IACP,IAAA,EAAM,aAAA;AAAA,IACN,GAAA,EAAK,SAAA;AAAA,IACL,OAAA,EAAS,aAAA;AAAA,IACT,eAAA,EAAiB;AAAA;AAErB;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/TagGroup/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { TagGroupOwnProps, TagOwnProps } from './types';\nimport styles from './TagGroup.module.css';\n\n/**\n * Component definition for TagGroup\n * @public\n */\nexport const TagGroupDefinition = defineComponent<TagGroupOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TagGroup',\n list: 'bui-TagList',\n },\n propDefs: {\n items: {},\n children: {},\n renderEmptyState: {},\n className: {},\n },\n});\n\n/** @internal */\nexport const TagDefinition = defineComponent<TagOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Tag',\n icon: 'bui-TagIcon',\n removeButton: 'bui-TagRemoveButton',\n },\n analytics: true,\n propDefs: {\n noTrack: {},\n icon: {},\n size: { dataAttribute: true, default: 'small' },\n href: {},\n children: {},\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,kBAAA,GAAqB,iBAAkC,CAAE;AAAA,EACpE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,cAAA;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,OAAO,EAAC;AAAA,IACR,UAAU,EAAC;AAAA,IACX,kBAAkB,EAAC;AAAA,IACnB,WAAW;AAAC;AAEhB,CAAC;AAGM,MAAM,aAAA,GAAgB,iBAA6B,CAAE;AAAA,EAC1D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM,aAAA;AAAA,IACN,YAAA,EAAc;AAAA,GAChB;AAAA,EACA,SAAA,EAAW,IAAA;AAAA,EACX,QAAA,EAAU;AAAA,IACR,SAAS,EAAC;AAAA,IACV,MAAM,EAAC;AAAA,IACP,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,MAAM,EAAC;AAAA,IACP,UAAU,EAAC;AAAA,IACX,WAAW;AAAC;AAEhB,CAAC;;;;"}
@@ -1,27 +1,20 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { forwardRef } from 'react';
3
- import clsx from 'clsx';
4
- import { useStyles } from '../../hooks/useStyles.esm.js';
5
- import styles from './Text.module.css.esm.js';
3
+ import { useDefinition } from '../../hooks/useDefinition/useDefinition.esm.js';
6
4
  import { TextDefinition } from './definition.esm.js';
7
5
 
8
6
  function TextComponent(props, ref) {
9
- const Component = props.as || "span";
10
- const { classNames, dataAttributes, cleanedProps } = useStyles(
7
+ const { ownProps, restProps, dataAttributes } = useDefinition(
11
8
  TextDefinition,
12
- {
13
- variant: "body-medium",
14
- weight: "regular",
15
- color: "primary",
16
- ...props
17
- }
9
+ props
18
10
  );
19
- const { className, truncate, ...restProps } = cleanedProps;
11
+ const { classes, as } = ownProps;
12
+ const Component = as;
20
13
  return /* @__PURE__ */ jsx(
21
14
  Component,
22
15
  {
23
16
  ref,
24
- className: clsx(classNames.root, styles[classNames.root], className),
17
+ className: classes.root,
25
18
  ...dataAttributes,
26
19
  ...restProps
27
20
  }
@@ -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';\nimport styles from './Text.module.css';\nimport { TextDefinition } from './definition';\n\nfunction TextComponent<T extends ElementType = 'span'>(\n props: TextProps<T>,\n ref: React.Ref<any>,\n) {\n const Component = props.as || 'span';\n\n const { classNames, dataAttributes, cleanedProps } = useStyles(\n TextDefinition,\n {\n variant: 'body-medium',\n weight: 'regular',\n color: 'primary',\n ...props,\n },\n );\n\n const { className, truncate, ...restProps } = cleanedProps;\n\n return (\n <Component\n ref={ref}\n className={clsx(classNames.root, styles[classNames.root], className)}\n {...dataAttributes}\n {...restProps}\n />\n );\n}\n\nTextComponent.displayName = 'Text';\n\n/** @public */\nexport const Text = forwardRef(TextComponent) as {\n <T extends ElementType = 'p'>(\n props: TextProps<T> & { ref?: React.ComponentPropsWithRef<T>['ref'] },\n ): React.ReactElement<TextProps<T>, T>;\n displayName: string;\n};\n\nText.displayName = 'Text';\n"],"names":[],"mappings":";;;;;;;AAwBA,SAAS,aAAA,CACP,OACA,GAAA,EACA;AACA,EAAA,MAAM,SAAA,GAAY,MAAM,EAAA,IAAM,MAAA;AAE9B,EAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,YAAA,EAAa,GAAI,SAAA;AAAA,IACnD,cAAA;AAAA,IACA;AAAA,MACE,OAAA,EAAS,aAAA;AAAA,MACT,MAAA,EAAQ,SAAA;AAAA,MACR,KAAA,EAAO,SAAA;AAAA,MACP,GAAG;AAAA;AACL,GACF;AAEA,EAAA,MAAM,EAAE,SAAA,EAAW,QAAA,EAAU,GAAG,WAAU,GAAI,YAAA;AAE9C,EAAA,uBACE,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA,EAAW,KAAK,UAAA,CAAW,IAAA,EAAM,OAAO,UAAA,CAAW,IAAI,GAAG,SAAS,CAAA;AAAA,MAClE,GAAG,cAAA;AAAA,MACH,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,aAAA,CAAc,WAAA,GAAc,MAAA;AAGrB,MAAM,IAAA,GAAO,WAAW,aAAa;AAO5C,IAAA,CAAK,WAAA,GAAc,MAAA;;;;"}
1
+ {"version":3,"file":"Text.esm.js","sources":["../../../src/components/Text/Text.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef } from 'react';\nimport type { ElementType } from 'react';\nimport type { TextProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TextDefinition } from './definition';\n\nfunction TextComponent<T extends ElementType = 'span'>(\n props: TextProps<T>,\n ref: React.Ref<any>,\n) {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n TextDefinition,\n props,\n );\n const { classes, as } = ownProps;\n\n const Component = as;\n\n return (\n <Component\n ref={ref}\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n />\n );\n}\n\nTextComponent.displayName = 'Text';\n\n/** @public */\nexport const Text = forwardRef(TextComponent) as {\n <T extends ElementType = 'p'>(\n props: TextProps<T> & { ref?: React.ComponentPropsWithRef<T>['ref'] },\n ): React.ReactElement<TextProps<T>, T>;\n displayName: string;\n};\n\nText.displayName = 'Text';\n"],"names":[],"mappings":";;;;;AAsBA,SAAS,aAAA,CACP,OACA,GAAA,EACA;AACA,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,cAAA,EAAe,GAAI,aAAA;AAAA,IAC9C,cAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,MAAM,EAAE,OAAA,EAAS,EAAA,EAAG,GAAI,QAAA;AAExB,EAAA,MAAM,SAAA,GAAY,EAAA;AAElB,EAAA,uBACE,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAW,OAAA,CAAQ,IAAA;AAAA,MAClB,GAAG,cAAA;AAAA,MACH,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,aAAA,CAAc,WAAA,GAAc,MAAA;AAGrB,MAAM,IAAA,GAAO,WAAW,aAAa;AAO5C,IAAA,CAAK,WAAA,GAAc,MAAA;;;;"}
@@ -1,21 +1,26 @@
1
- const TextDefinition = {
1
+ import 'react/jsx-runtime';
2
+ import 'clsx';
3
+ import '../../hooks/useBreakpoint.esm.js';
4
+ import '../../hooks/useBg.esm.js';
5
+ import '../../hooks/useDefinition/helpers.esm.js';
6
+ import '../../analytics/useAnalytics.esm.js';
7
+ import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
8
+ import styles from './Text.module.css.esm.js';
9
+
10
+ const TextDefinition = defineComponent()({
11
+ styles,
2
12
  classNames: {
3
13
  root: "bui-Text"
4
14
  },
5
- dataAttributes: {
6
- variant: ["subtitle", "body", "caption", "label"],
7
- weight: ["regular", "bold"],
8
- color: [
9
- "primary",
10
- "secondary",
11
- "danger",
12
- "warning",
13
- "success",
14
- "info"
15
- ],
16
- truncate: [true, false]
15
+ propDefs: {
16
+ as: { default: "span" },
17
+ variant: { dataAttribute: true, default: "body-medium" },
18
+ weight: { dataAttribute: true, default: "regular" },
19
+ color: { dataAttribute: true, default: "primary" },
20
+ truncate: { dataAttribute: true },
21
+ className: {}
17
22
  }
18
- };
23
+ });
19
24
 
20
25
  export { TextDefinition };
21
26
  //# sourceMappingURL=definition.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Text/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ComponentDefinition } from '../../types';\n\n/**\n * Component definition for Text\n * @public\n */\nexport const TextDefinition = {\n classNames: {\n root: 'bui-Text',\n },\n dataAttributes: {\n variant: ['subtitle', 'body', 'caption', 'label'] as const,\n weight: ['regular', 'bold'] as const,\n color: [\n 'primary',\n 'secondary',\n 'danger',\n 'warning',\n 'success',\n 'info',\n ] as const,\n truncate: [true, false] as const,\n },\n} as const satisfies ComponentDefinition;\n"],"names":[],"mappings":"AAsBO,MAAM,cAAA,GAAiB;AAAA,EAC5B,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,OAAA,EAAS,CAAC,UAAA,EAAY,MAAA,EAAQ,WAAW,OAAO,CAAA;AAAA,IAChD,MAAA,EAAQ,CAAC,SAAA,EAAW,MAAM,CAAA;AAAA,IAC1B,KAAA,EAAO;AAAA,MACL,SAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAA;AAAA,MACA,SAAA;AAAA,MACA,SAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA,QAAA,EAAU,CAAC,IAAA,EAAM,KAAK;AAAA;AAE1B;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Text/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { TextOwnProps } from './types';\nimport styles from './Text.module.css';\n\n/**\n * Component definition for Text\n * @public\n */\nexport const TextDefinition = defineComponent<TextOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Text',\n },\n propDefs: {\n as: { default: 'span' },\n variant: { dataAttribute: true, default: 'body-medium' },\n weight: { dataAttribute: true, default: 'regular' },\n color: { dataAttribute: true, default: 'primary' },\n truncate: { dataAttribute: true },\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,cAAA,GAAiB,iBAA8B,CAAE;AAAA,EAC5D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,EAAE,OAAA,EAAS,MAAA,EAAO;AAAA,IACtB,OAAA,EAAS,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,aAAA,EAAc;AAAA,IACvD,MAAA,EAAQ,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,SAAA,EAAU;AAAA,IAClD,KAAA,EAAO,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,SAAA,EAAU;AAAA,IACjD,QAAA,EAAU,EAAE,aAAA,EAAe,IAAA,EAAK;AAAA,IAChC,WAAW;AAAC;AAEhB,CAAC;;;;"}
@@ -1,53 +1,34 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { forwardRef, useEffect } from 'react';
3
3
  import { TextField as TextField$1, Input } from 'react-aria-components';
4
- import clsx from 'clsx';
5
4
  import { FieldLabel } from '../FieldLabel/FieldLabel.esm.js';
5
+ import { useDefinition } from '../../hooks/useDefinition/useDefinition.esm.js';
6
+ import '../FieldLabel/FieldLabel.module.css.esm.js';
6
7
  import { FieldError } from '../FieldError/FieldError.esm.js';
7
- import { useStyles } from '../../hooks/useStyles.esm.js';
8
+ import '../FieldError/FieldError.module.css.esm.js';
8
9
  import { TextFieldDefinition } from './definition.esm.js';
9
- import styles from './TextField.module.css.esm.js';
10
10
 
11
11
  const TextField = forwardRef(
12
12
  (props, ref) => {
13
- const {
14
- label,
15
- "aria-label": ariaLabel,
16
- "aria-labelledby": ariaLabelledBy
17
- } = props;
13
+ const { ownProps, restProps, dataAttributes } = useDefinition(
14
+ TextFieldDefinition,
15
+ props
16
+ );
17
+ const { classes, label, icon, secondaryLabel, placeholder, description } = ownProps;
18
18
  useEffect(() => {
19
- if (!label && !ariaLabel && !ariaLabelledBy) {
19
+ if (!label && !restProps["aria-label"] && !restProps["aria-labelledby"]) {
20
20
  console.warn(
21
21
  "TextField requires either a visible label, aria-label, or aria-labelledby for accessibility"
22
22
  );
23
23
  }
24
- }, [label, ariaLabel, ariaLabelledBy]);
25
- const { classNames, dataAttributes, style, cleanedProps } = useStyles(
26
- TextFieldDefinition,
27
- {
28
- size: "small",
29
- ...props
30
- }
31
- );
32
- const {
33
- className,
34
- description,
35
- icon,
36
- isRequired,
37
- secondaryLabel,
38
- placeholder,
39
- ...rest
40
- } = cleanedProps;
41
- const secondaryLabelText = secondaryLabel || (isRequired ? "Required" : null);
24
+ }, [label, restProps["aria-label"], restProps["aria-labelledby"]]);
25
+ const secondaryLabelText = secondaryLabel || (restProps.isRequired ? "Required" : null);
42
26
  return /* @__PURE__ */ jsxs(
43
27
  TextField$1,
44
28
  {
45
- className: clsx(classNames.root, styles[classNames.root], className),
29
+ className: classes.root,
46
30
  ...dataAttributes,
47
- "aria-label": ariaLabel,
48
- "aria-labelledby": ariaLabelledBy,
49
- style,
50
- ...rest,
31
+ ...restProps,
51
32
  ref,
52
33
  children: [
53
34
  /* @__PURE__ */ jsx(
@@ -61,19 +42,13 @@ const TextField = forwardRef(
61
42
  /* @__PURE__ */ jsxs(
62
43
  "div",
63
44
  {
64
- className: clsx(
65
- classNames.inputWrapper,
66
- styles[classNames.inputWrapper]
67
- ),
45
+ className: classes.inputWrapper,
68
46
  "data-size": dataAttributes["data-size"],
69
47
  children: [
70
48
  icon && /* @__PURE__ */ jsx(
71
49
  "div",
72
50
  {
73
- className: clsx(
74
- classNames.inputIcon,
75
- styles[classNames.inputIcon]
76
- ),
51
+ className: classes.inputIcon,
77
52
  "data-size": dataAttributes["data-size"],
78
53
  "aria-hidden": "true",
79
54
  children: icon
@@ -82,7 +57,7 @@ const TextField = forwardRef(
82
57
  /* @__PURE__ */ jsx(
83
58
  Input,
84
59
  {
85
- className: clsx(classNames.input, styles[classNames.input]),
60
+ className: classes.input,
86
61
  ...icon && { "data-icon": true },
87
62
  placeholder
88
63
  }