@backstage/ui 0.0.0-nightly-20251116024311 → 0.0.0-nightly-20251118024419

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 (158) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/README.md +23 -0
  3. package/dist/components/Accordion/Accordion.esm.js +5 -4
  4. package/dist/components/Accordion/Accordion.esm.js.map +1 -1
  5. package/dist/components/Accordion/definition.esm.js +15 -0
  6. package/dist/components/Accordion/definition.esm.js.map +1 -0
  7. package/dist/components/Avatar/Avatar.esm.js +9 -5
  8. package/dist/components/Avatar/Avatar.esm.js.map +1 -1
  9. package/dist/components/Avatar/definition.esm.js +13 -0
  10. package/dist/components/Avatar/definition.esm.js.map +1 -0
  11. package/dist/components/Box/Box.esm.js +2 -1
  12. package/dist/components/Box/Box.esm.js.map +1 -1
  13. package/dist/components/Box/definition.esm.js +32 -0
  14. package/dist/components/Box/definition.esm.js.map +1 -0
  15. package/dist/components/Button/Button.esm.js +9 -5
  16. package/dist/components/Button/Button.esm.js.map +1 -1
  17. package/dist/components/Button/definition.esm.js +15 -0
  18. package/dist/components/Button/definition.esm.js.map +1 -0
  19. package/dist/components/ButtonIcon/ButtonIcon.esm.js +11 -6
  20. package/dist/components/ButtonIcon/ButtonIcon.esm.js.map +1 -1
  21. package/dist/components/ButtonIcon/definition.esm.js +10 -0
  22. package/dist/components/ButtonIcon/definition.esm.js.map +1 -0
  23. package/dist/components/ButtonLink/ButtonLink.esm.js +11 -6
  24. package/dist/components/ButtonLink/ButtonLink.esm.js.map +1 -1
  25. package/dist/components/ButtonLink/definition.esm.js +8 -0
  26. package/dist/components/ButtonLink/definition.esm.js.map +1 -0
  27. package/dist/components/Card/Card.esm.js +5 -4
  28. package/dist/components/Card/Card.esm.js.map +1 -1
  29. package/dist/components/Card/definition.esm.js +11 -0
  30. package/dist/components/Card/definition.esm.js.map +1 -0
  31. package/dist/components/Checkbox/Checkbox.esm.js +2 -1
  32. package/dist/components/Checkbox/Checkbox.esm.js.map +1 -1
  33. package/dist/components/Checkbox/definition.esm.js +12 -0
  34. package/dist/components/Checkbox/definition.esm.js.map +1 -0
  35. package/dist/components/Container/Container.esm.js +2 -1
  36. package/dist/components/Container/Container.esm.js.map +1 -1
  37. package/dist/components/Container/definition.esm.js +9 -0
  38. package/dist/components/Container/definition.esm.js.map +1 -0
  39. package/dist/components/Dialog/Dialog.esm.js +5 -4
  40. package/dist/components/Dialog/Dialog.esm.js.map +1 -1
  41. package/dist/components/Dialog/definition.esm.js +13 -0
  42. package/dist/components/Dialog/definition.esm.js.map +1 -0
  43. package/dist/components/FieldError/FieldError.esm.js +2 -1
  44. package/dist/components/FieldError/FieldError.esm.js.map +1 -1
  45. package/dist/components/FieldError/definition.esm.js +8 -0
  46. package/dist/components/FieldError/definition.esm.js.map +1 -0
  47. package/dist/components/FieldLabel/FieldLabel.esm.js +2 -1
  48. package/dist/components/FieldLabel/FieldLabel.esm.js.map +1 -1
  49. package/dist/components/FieldLabel/definition.esm.js +11 -0
  50. package/dist/components/FieldLabel/definition.esm.js.map +1 -0
  51. package/dist/components/Flex/Flex.esm.js +2 -1
  52. package/dist/components/Flex/Flex.esm.js.map +1 -1
  53. package/dist/components/Flex/definition.esm.js +28 -0
  54. package/dist/components/Flex/definition.esm.js.map +1 -0
  55. package/dist/components/Grid/Grid.esm.js +3 -2
  56. package/dist/components/Grid/Grid.esm.js.map +1 -1
  57. package/dist/components/Grid/definition.esm.js +32 -0
  58. package/dist/components/Grid/definition.esm.js.map +1 -0
  59. package/dist/components/Header/Header.esm.js +2 -1
  60. package/dist/components/Header/Header.esm.js.map +1 -1
  61. package/dist/components/Header/HeaderToolbar.esm.js +2 -1
  62. package/dist/components/Header/HeaderToolbar.esm.js.map +1 -1
  63. package/dist/components/Header/definition.esm.js +14 -0
  64. package/dist/components/Header/definition.esm.js.map +1 -0
  65. package/dist/components/HeaderPage/HeaderPage.esm.js +2 -1
  66. package/dist/components/HeaderPage/HeaderPage.esm.js.map +1 -1
  67. package/dist/components/HeaderPage/definition.esm.js +12 -0
  68. package/dist/components/HeaderPage/definition.esm.js.map +1 -0
  69. package/dist/components/Link/Link.esm.js +10 -6
  70. package/dist/components/Link/Link.esm.js.map +1 -1
  71. package/dist/components/Link/definition.esm.js +14 -0
  72. package/dist/components/Link/definition.esm.js.map +1 -0
  73. package/dist/components/Menu/Menu.esm.js +10 -9
  74. package/dist/components/Menu/Menu.esm.js.map +1 -1
  75. package/dist/components/Menu/definition.esm.js +23 -0
  76. package/dist/components/Menu/definition.esm.js.map +1 -0
  77. package/dist/components/Popover/definition.esm.js +8 -0
  78. package/dist/components/Popover/definition.esm.js.map +1 -0
  79. package/dist/components/RadioGroup/RadioGroup.esm.js +3 -2
  80. package/dist/components/RadioGroup/RadioGroup.esm.js.map +1 -1
  81. package/dist/components/RadioGroup/definition.esm.js +10 -0
  82. package/dist/components/RadioGroup/definition.esm.js.map +1 -0
  83. package/dist/components/SearchField/SearchField.esm.js +2 -1
  84. package/dist/components/SearchField/SearchField.esm.js.map +1 -1
  85. package/dist/components/SearchField/definition.esm.js +16 -0
  86. package/dist/components/SearchField/definition.esm.js.map +1 -0
  87. package/dist/components/Select/Select.esm.js +11 -6
  88. package/dist/components/Select/Select.esm.js.map +1 -1
  89. package/dist/components/Select/SelectContent.esm.js +2 -1
  90. package/dist/components/Select/SelectContent.esm.js.map +1 -1
  91. package/dist/components/Select/SelectListBox.esm.js +3 -2
  92. package/dist/components/Select/SelectListBox.esm.js.map +1 -1
  93. package/dist/components/Select/SelectTrigger.esm.js +2 -1
  94. package/dist/components/Select/SelectTrigger.esm.js.map +1 -1
  95. package/dist/components/Select/definition.esm.js +23 -0
  96. package/dist/components/Select/definition.esm.js.map +1 -0
  97. package/dist/components/Skeleton/Skeleton.esm.js +2 -1
  98. package/dist/components/Skeleton/Skeleton.esm.js.map +1 -1
  99. package/dist/components/Skeleton/definition.esm.js +8 -0
  100. package/dist/components/Skeleton/definition.esm.js.map +1 -0
  101. package/dist/components/Switch/Switch.esm.js +2 -1
  102. package/dist/components/Switch/Switch.esm.js.map +1 -1
  103. package/dist/components/Switch/definition.esm.js +9 -0
  104. package/dist/components/Switch/definition.esm.js.map +1 -0
  105. package/dist/components/Table/components/Cell.esm.js +2 -1
  106. package/dist/components/Table/components/Cell.esm.js.map +1 -1
  107. package/dist/components/Table/components/CellProfile.esm.js +5 -7
  108. package/dist/components/Table/components/CellProfile.esm.js.map +1 -1
  109. package/dist/components/Table/components/Column.esm.js +2 -4
  110. package/dist/components/Table/components/Column.esm.js.map +1 -1
  111. package/dist/components/Table/components/Row.esm.js +2 -4
  112. package/dist/components/Table/components/Row.esm.js.map +1 -1
  113. package/dist/components/Table/components/Table.esm.js +2 -4
  114. package/dist/components/Table/components/Table.esm.js.map +1 -1
  115. package/dist/components/Table/components/TableBody.esm.js +2 -4
  116. package/dist/components/Table/components/TableBody.esm.js.map +1 -1
  117. package/dist/components/Table/components/TableHeader.esm.js +2 -4
  118. package/dist/components/Table/components/TableHeader.esm.js.map +1 -1
  119. package/dist/components/Table/definition.esm.js +24 -0
  120. package/dist/components/Table/definition.esm.js.map +1 -0
  121. package/dist/components/TablePagination/TablePagination.esm.js +2 -1
  122. package/dist/components/TablePagination/TablePagination.esm.js.map +1 -1
  123. package/dist/components/TablePagination/definition.esm.js +11 -0
  124. package/dist/components/TablePagination/definition.esm.js.map +1 -0
  125. package/dist/components/Tabs/Tabs.esm.js +5 -4
  126. package/dist/components/Tabs/Tabs.esm.js.map +1 -1
  127. package/dist/components/Tabs/TabsIndicators.esm.js +2 -1
  128. package/dist/components/Tabs/TabsIndicators.esm.js.map +1 -1
  129. package/dist/components/Tabs/definition.esm.js +14 -0
  130. package/dist/components/Tabs/definition.esm.js.map +1 -0
  131. package/dist/components/TagGroup/TagGroup.esm.js +3 -2
  132. package/dist/components/TagGroup/TagGroup.esm.js.map +1 -1
  133. package/dist/components/TagGroup/definition.esm.js +12 -0
  134. package/dist/components/TagGroup/definition.esm.js.map +1 -0
  135. package/dist/components/Text/Text.esm.js +10 -6
  136. package/dist/components/Text/Text.esm.js.map +1 -1
  137. package/dist/components/Text/definition.esm.js +14 -0
  138. package/dist/components/Text/definition.esm.js.map +1 -0
  139. package/dist/components/TextField/TextField.esm.js +2 -1
  140. package/dist/components/TextField/TextField.esm.js.map +1 -1
  141. package/dist/components/TextField/definition.esm.js +17 -0
  142. package/dist/components/TextField/definition.esm.js.map +1 -0
  143. package/dist/components/Tooltip/Tooltip.esm.js +2 -1
  144. package/dist/components/Tooltip/Tooltip.esm.js.map +1 -1
  145. package/dist/components/Tooltip/definition.esm.js +9 -0
  146. package/dist/components/Tooltip/definition.esm.js.map +1 -0
  147. package/dist/components/VisuallyHidden/VisuallyHidden.esm.js +5 -1
  148. package/dist/components/VisuallyHidden/VisuallyHidden.esm.js.map +1 -1
  149. package/dist/components/VisuallyHidden/definition.esm.js +8 -0
  150. package/dist/components/VisuallyHidden/definition.esm.js.map +1 -0
  151. package/dist/hooks/useStyles.esm.js +1 -3
  152. package/dist/hooks/useStyles.esm.js.map +1 -1
  153. package/dist/index.d.ts +455 -362
  154. package/dist/index.esm.js +30 -1
  155. package/dist/index.esm.js.map +1 -1
  156. package/package.json +2 -2
  157. package/dist/utils/componentDefinitions.esm.js +0 -406
  158. package/dist/utils/componentDefinitions.esm.js.map +0 -1
@@ -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 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';\nimport { useStyles } from '../../hooks/useStyles';\nimport styles from './Tabs.module.css';\nimport clsx from 'clsx';\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 { classNames, cleanedProps } = useStyles('Tabs', props);\n const { className, children, ...rest } = cleanedProps;\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 //No route matches - check if all tabs have hrefs (pure navigation)\n const allTabsHaveHref = tabListChildren.every(\n child => isValidElement(child) && child.props.href,\n );\n\n if (allTabsHaveHref) {\n // Pure navigation tabs, no route match\n return null;\n } else {\n // Mixed tabs or pure local state\n return undefined;\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={clsx(classNames.tabs, styles[classNames.tabs], className)}\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 { classNames, cleanedProps } = useStyles('Tabs', props);\n const { className, children, ...rest } = cleanedProps;\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\n className={clsx(\n classNames.tabListWrapper,\n styles[classNames.tabListWrapper],\n className,\n )}\n >\n <AriaTabList\n className={clsx(classNames.tabList, styles[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 { classNames, cleanedProps } = useStyles('Tabs', props);\n const {\n className,\n href,\n children,\n id,\n matchStrategy: _matchStrategy,\n ...rest\n } = cleanedProps;\n const { setTabRef } = useTabsContext();\n\n return (\n <AriaTab\n id={id}\n className={clsx(classNames.tab, styles[classNames.tab], className)}\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 { classNames, cleanedProps } = useStyles('Tabs', props);\n const { className, children, ...rest } = cleanedProps;\n\n return (\n <AriaTabPanel\n className={clsx(classNames.panel, styles[classNames.panel], className)}\n {...rest}\n >\n {children}\n </AriaTabPanel>\n );\n};\n"],"names":["child","AriaTabs","AriaTabList","AriaTab","AriaTabPanel"],"mappings":";;;;;;;;;AA+CA,MAAM,WAAA,GAAc,cAA4C,MAAS,CAAA;AAEzE,MAAM,iBAAiB,MAAM;AAC3B,EAAA,MAAM,OAAA,GAAU,WAAW,WAAW,CAAA;AACtC,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,IAAI,MAAM,qDAAqD,CAAA;AAAA,EACvE;AACA,EAAA,OAAO,OAAA;AACT,CAAA;AAMA,MAAM,WAAA,GAAc,CAClB,OAAA,EACA,eAAA,EACA,aAAA,KACY;AACZ,EAAA,IAAI,kBAAkB,OAAA,EAAS;AAC7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AAA,MACC,SAAA,EAAW,KAAK,UAAA,CAAW,KAAA,EAAO,OAAO,UAAA,CAAW,KAAK,GAAG,SAAS,CAAA;AAAA,MACpE,GAAG,IAAA;AAAA,MAEH;AAAA;AAAA,GACH;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';\nimport { useStyles } from '../../hooks/useStyles';\nimport { TabsDefinition } from './definition';\nimport styles from './Tabs.module.css';\nimport clsx from 'clsx';\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 { classNames, cleanedProps } = useStyles(TabsDefinition, props);\n const { className, children, ...rest } = cleanedProps;\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 //No route matches - check if all tabs have hrefs (pure navigation)\n const allTabsHaveHref = tabListChildren.every(\n child => isValidElement(child) && child.props.href,\n );\n\n if (allTabsHaveHref) {\n // Pure navigation tabs, no route match\n return null;\n } else {\n // Mixed tabs or pure local state\n return undefined;\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={clsx(classNames.tabs, styles[classNames.tabs], className)}\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 { classNames, cleanedProps } = useStyles(TabsDefinition, props);\n const { className, children, ...rest } = cleanedProps;\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\n className={clsx(\n classNames.tabListWrapper,\n styles[classNames.tabListWrapper],\n className,\n )}\n >\n <AriaTabList\n className={clsx(classNames.tabList, styles[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 { classNames, cleanedProps } = useStyles(TabsDefinition, props);\n const {\n className,\n href,\n children,\n id,\n matchStrategy: _matchStrategy,\n ...rest\n } = cleanedProps;\n const { setTabRef } = useTabsContext();\n\n return (\n <AriaTab\n id={id}\n className={clsx(classNames.tab, styles[classNames.tab], className)}\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 { classNames, cleanedProps } = useStyles(TabsDefinition, props);\n const { className, children, ...rest } = cleanedProps;\n\n return (\n <AriaTabPanel\n className={clsx(classNames.panel, styles[classNames.panel], className)}\n {...rest}\n >\n {children}\n </AriaTabPanel>\n );\n};\n"],"names":["child","AriaTabs","AriaTabList","AriaTab","AriaTabPanel"],"mappings":";;;;;;;;;;AAgDA,MAAM,WAAA,GAAc,cAA4C,MAAS,CAAA;AAEzE,MAAM,iBAAiB,MAAM;AAC3B,EAAA,MAAM,OAAA,GAAU,WAAW,WAAW,CAAA;AACtC,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,IAAI,MAAM,qDAAqD,CAAA;AAAA,EACvE;AACA,EAAA,OAAO,OAAA;AACT,CAAA;AAMA,MAAM,WAAA,GAAc,CAClB,OAAA,EACA,eAAA,EACA,aAAA,KACY;AACZ,EAAA,IAAI,kBAAkB,OAAA,EAAS;AAC7B,IAAA,OAAO,OAAA,KAAY,eAAA;AAAA,EACrB;AAGA,EAAA,IAAI,YAAY,eAAA,EAAiB;AAC/B,IAAA,OAAO,IAAA;AAAA,EACT;AAIA,EAAA,OAAO,eAAA,CAAgB,UAAA,CAAW,CAAA,EAAG,OAAO,CAAA,CAAA,CAAG,CAAA;AACjD,CAAA;AAOO,MAAM,IAAA,GAAO,CAAC,KAAA,KAAqB;AACxC,EAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,SAAA,CAAU,gBAAgB,KAAK,CAAA;AACpE,EAAA,MAAM,EAAE,SAAA,EAAW,QAAA,EAAU,GAAG,MAAK,GAAI,YAAA;AACzC,EAAA,MAAM,OAAA,GAAU,OAAuB,IAAI,CAAA;AAC3C,EAAA,MAAM,OAAA,GAAU,MAAA,iBAAoC,IAAI,GAAA,EAAK,CAAA;AAC7D,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAwB,IAAI,CAAA;AAChE,EAAA,MAAM,cAAA,GAAiB,OAAsB,IAAI,C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EAAA,uBACE,GAAA;AAAA,IAACC,KAAA;AAAA,IAAA;AAAA,MACC,EAAA;AAAA,MACA,SAAA,EAAW,KAAK,UAAA,CAAW,GAAA,EAAK,OAAO,UAAA,CAAW,GAAG,GAAG,SAAS,CAAA;AAAA,MACjE,GAAA,EAAK,CAAA,EAAA,KAAM,SAAA,CAAU,EAAA,EAAc,EAAoB,CAAA;AAAA,MACvD,IAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEH;AAAA;AAAA,GACH;AAEJ;AAOO,MAAM,QAAA,GAAW,CAAC,KAAA,KAAyB;AAChD,EAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,SAAA,CAAU,gBAAgB,KAAK,CAAA;AACpE,EAAA,MAAM,EAAE,SAAA,EAAW,QAAA,EAAU,GAAG,MAAK,GAAI,YAAA;AAEzC,EAAA,uBACE,GAAA;AAAA,IAACC,UAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,KAAK,UAAA,CAAW,KAAA,EAAO,OAAO,UAAA,CAAW,KAAK,GAAG,SAAS,CAAA;AAAA,MACpE,GAAG,IAAA;AAAA,MAEH;AAAA;AAAA,GACH;AAEJ;;;;"}
@@ -1,13 +1,14 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import { TabListStateContext } from 'react-aria-components';
3
3
  import { useStyles } from '../../hooks/useStyles.esm.js';
4
+ import { TabsDefinition } from './definition.esm.js';
4
5
  import { useContext, useRef, useCallback, useEffect } from 'react';
5
6
  import styles from './Tabs.module.css.esm.js';
6
7
  import clsx from 'clsx';
7
8
 
8
9
  const TabsIndicators = (props) => {
9
10
  const { tabRefs, tabsRef, hoveredKey, prevHoveredKey } = props;
10
- const { classNames } = useStyles("Tabs");
11
+ const { classNames } = useStyles(TabsDefinition);
11
12
  const state = useContext(TabListStateContext);
12
13
  const prevSelectedKey = useRef(null);
13
14
  const updateCSSVariables = useCallback(() => {
@@ -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 { 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('Tabs');\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":";;;;;;;AA4BO,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,MAAM,CAAA;AACvC,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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,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 { 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,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,EAAkB;AAEpB,UAAA,OAAA,CAAQ,QAAQ,KAAA,CAAM,WAAA;AAAA,YACpB,8BAAA;AAAA,YACA;AAAA,WACF;AAEA,UAAA,qBAAA,CAAsB,MAAM;AAC1B,YAAA,IAAI,QAAQ,OAAA,EAAS;AACnB,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AAA,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;;;;"}
@@ -0,0 +1,14 @@
1
+ const TabsDefinition = {
2
+ 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"
10
+ }
11
+ };
12
+
13
+ export { TabsDefinition };
14
+ //# sourceMappingURL=definition.esm.js.map
@@ -0,0 +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;;;;"}
@@ -3,12 +3,13 @@ import { TagGroup as TagGroup$1, TagList, Tag as Tag$1, Button, RouterProvider }
3
3
  import { RiCloseCircleLine } from '@remixicon/react';
4
4
  import clsx from 'clsx';
5
5
  import { useStyles } from '../../hooks/useStyles.esm.js';
6
+ import { TagGroupDefinition } from './definition.esm.js';
6
7
  import { isExternalLink } from '../../utils/isExternalLink.esm.js';
7
8
  import { useNavigate, useHref } from 'react-router-dom';
8
9
  import styles from './TagGroup.module.css.esm.js';
9
10
 
10
11
  const TagGroup = (props) => {
11
- const { classNames, cleanedProps } = useStyles("TagGroup", props);
12
+ const { classNames, cleanedProps } = useStyles(TagGroupDefinition, props);
12
13
  const { items, children, renderEmptyState, ...rest } = cleanedProps;
13
14
  return /* @__PURE__ */ jsx(
14
15
  TagGroup$1,
@@ -28,7 +29,7 @@ const TagGroup = (props) => {
28
29
  );
29
30
  };
30
31
  const Tag = (props) => {
31
- const { classNames, cleanedProps } = useStyles("TagGroup", {
32
+ const { classNames, cleanedProps } = useStyles(TagGroupDefinition, {
32
33
  size: "small",
33
34
  ...props
34
35
  });
@@ -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 RouterProvider,\n} from 'react-aria-components';\nimport type { ReactNode } from 'react';\nimport { RiCloseCircleLine } from '@remixicon/react';\nimport clsx from 'clsx';\nimport { useStyles } from '../../hooks/useStyles';\nimport { isExternalLink } from '../../utils/isExternalLink';\nimport { useNavigate, useHref } from 'react-router-dom';\nimport styles from './TagGroup.module.css';\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('TagGroup', props);\n const { items, children, renderEmptyState, ...rest } = cleanedProps;\n\n return (\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 );\n};\n\n/**\n * A component that renders a tag.\n *\n * @public\n */\nexport const Tag = (props: TagProps) => {\n const { classNames, cleanedProps } = useStyles('TagGroup', {\n size: 'small',\n ...props,\n });\n const { children, className, icon, size, href, ...rest } = cleanedProps;\n const textValue = typeof children === 'string' ? children : undefined;\n const navigate = useNavigate();\n const isLink = href !== undefined;\n const isExternal = isExternalLink(href);\n\n const content = (\n <ReactAriaTag\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 if (isLink && !isExternal) {\n return (\n <RouterProvider navigate={navigate} useHref={useHref}>\n {content}\n </RouterProvider>\n );\n }\n\n return content;\n};\n"],"names":["ReactAriaTagGroup","ReactAriaTagList","ReactAriaTag","ReactAriaButton"],"mappings":";;;;;;;;;AAqCO,MAAM,QAAA,GAAW,CAAmB,KAAA,KAA4B;AACrE,EAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,SAAA,CAAU,YAAY,KAAK,CAAA;AAChE,EAAA,MAAM,EAAE,KAAA,EAAO,QAAA,EAAU,gBAAA,EAAkB,GAAG,MAAK,GAAI,YAAA;AAEvD,EAAA,uBACE,GAAA;AAAA,IAACA,UAAA;AAAA,IAAA;AAAA,MACC,WAAW,IAAA,CAAK,UAAA,CAAW,OAAO,MAAA,CAAO,UAAA,CAAW,KAAK,CAAC,CAAA;AAAA,MACzD,GAAG,IAAA;AAAA,MAEJ,QAAA,kBAAA,GAAA;AAAA,QAACC,OAAA;AAAA,QAAA;AAAA,UACC,WAAW,IAAA,CAAK,UAAA,CAAW,MAAM,MAAA,CAAO,UAAA,CAAW,IAAI,CAAC,CAAA;AAAA,UACxD,KAAA;AAAA,UACA,gBAAA;AAAA,UAEC;AAAA;AAAA;AACH;AAAA,GACF;AAEJ;AAOO,MAAM,GAAA,GAAM,CAAC,KAAA,KAAoB;AACtC,EAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,UAAU,UAAA,EAAY;AAAA,IACzD,IAAA,EAAM,OAAA;AAAA,IACN,GAAG;AAAA,GACJ,CAAA;AACD,EAAA,MAAM,EAAE,UAAU,SAAA,EAAW,IAAA,EAAM,MAAM,IAAA,EAAM,GAAG,MAAK,GAAI,YAAA;AAC3D,EAAA,MAAM,SAAA,GAAY,OAAO,QAAA,KAAa,QAAA,GAAW,QAAA,GAAW,MAAA;AAC5D,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM,SA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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 RouterProvider,\n} from 'react-aria-components';\nimport type { ReactNode } from 'react';\nimport { RiCloseCircleLine } from '@remixicon/react';\nimport clsx from 'clsx';\nimport { useStyles } from '../../hooks/useStyles';\nimport { TagGroupDefinition } from './definition';\nimport { isExternalLink } from '../../utils/isExternalLink';\nimport { useNavigate, useHref } from 'react-router-dom';\nimport styles from './TagGroup.module.css';\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 <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 );\n};\n\n/**\n * A component that renders a tag.\n *\n * @public\n */\nexport const Tag = (props: TagProps) => {\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 const navigate = useNavigate();\n const isLink = href !== undefined;\n const isExternal = isExternalLink(href);\n\n const content = (\n <ReactAriaTag\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 if (isLink && !isExternal) {\n return (\n <RouterProvider navigate={navigate} useHref={useHref}>\n {content}\n </RouterProvider>\n );\n }\n\n return content;\n};\n"],"names":["ReactAriaTagGroup","ReactAriaTagList","ReactAriaTag","ReactAriaButton"],"mappings":";;;;;;;;;;AAsCO,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,uBACE,GAAA;AAAA,IAACA,UAAA;AAAA,IAAA;AAAA,MACC,WAAW,IAAA,CAAK,UAAA,CAAW,OAAO,MAAA,CAAO,UAAA,CAAW,KAAK,CAAC,CAAA;AAAA,MACzD,GAAG,IAAA;AAAA,MAEJ,QAAA,kBAAA,GAAA;AAAA,QAACC,OAAA;AAAA,QAAA;AAAA,UACC,WAAW,IAAA,CAAK,UAAA,CAAW,MAAM,MAAA,CAAO,UAAA,CAAW,IAAI,CAAC,CAAA;AAAA,UACxD,KAAA;AAAA,UACA,gBAAA;AAAA,UAEC;AAAA;AAAA;AACH;AAAA,GACF;AAEJ;AAOO,MAAM,GAAA,GAAM,CAAC,KAAA,KAAoB;AACtC,EAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,UAAU,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AAA,EAEJ;AAAA;AAAA,GAEJ;AAGF,EAAA,IAAI,MAAA,IAAU,CAAC,UAAA,EAAY;AACzB,IAAA,uBACE,GAAA,CAAC,cAAA,EAAA,EAAe,QAAA,EAAoB,OAAA,EACjC,QAAA,EAAA,OAAA,EACH,CAAA;AAAA,EAEJ;AAEA,EAAA,OAAO,OAAA;AACT;;;;"}
@@ -0,0 +1,12 @@
1
+ const TagGroupDefinition = {
2
+ classNames: {
3
+ group: "bui-TagGroup",
4
+ list: "bui-TagList",
5
+ tag: "bui-Tag",
6
+ tagIcon: "bui-TagIcon",
7
+ tagRemoveButton: "bui-TagRemoveButton"
8
+ }
9
+ };
10
+
11
+ export { TagGroupDefinition };
12
+ //# sourceMappingURL=definition.esm.js.map
@@ -0,0 +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;;;;"}
@@ -3,15 +3,19 @@ import { forwardRef } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import { useStyles } from '../../hooks/useStyles.esm.js';
5
5
  import styles from './Text.module.css.esm.js';
6
+ import { TextDefinition } from './definition.esm.js';
6
7
 
7
8
  function TextComponent(props, ref) {
8
9
  const Component = props.as || "span";
9
- const { classNames, dataAttributes, cleanedProps } = useStyles("Text", {
10
- variant: "body-medium",
11
- weight: "regular",
12
- color: "primary",
13
- ...props
14
- });
10
+ const { classNames, dataAttributes, cleanedProps } = useStyles(
11
+ TextDefinition,
12
+ {
13
+ variant: "body-medium",
14
+ weight: "regular",
15
+ color: "primary",
16
+ ...props
17
+ }
18
+ );
15
19
  const { className, truncate, ...restProps } = cleanedProps;
16
20
  return /* @__PURE__ */ jsx(
17
21
  Component,
@@ -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';\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('Text', {\n variant: 'body-medium',\n weight: 'regular',\n color: 'primary',\n ...props,\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":";;;;;;AAuBA,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,UAAU,MAAA,EAAQ;AAAA,IACrE,OAAA,EAAS,aAAA;AAAA,IACT,MAAA,EAAQ,SAAA;AAAA,IACR,KAAA,EAAO,SAAA;AAAA,IACP,GAAG;AAAA,GACJ,CAAA;AAED,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 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;;;;"}
@@ -0,0 +1,14 @@
1
+ const TextDefinition = {
2
+ classNames: {
3
+ root: "bui-Text"
4
+ },
5
+ dataAttributes: {
6
+ variant: ["subtitle", "body", "caption", "label"],
7
+ weight: ["regular", "bold"],
8
+ color: ["primary", "secondary", "danger", "warning", "success"],
9
+ truncate: [true, false]
10
+ }
11
+ };
12
+
13
+ export { TextDefinition };
14
+ //# sourceMappingURL=definition.esm.js.map
@@ -0,0 +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: ['primary', 'secondary', 'danger', 'warning', 'success'] 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,OAAO,CAAC,SAAA,EAAW,WAAA,EAAa,QAAA,EAAU,WAAW,SAAS,CAAA;AAAA,IAC9D,QAAA,EAAU,CAAC,IAAA,EAAM,KAAK;AAAA;AAE1B;;;;"}
@@ -5,6 +5,7 @@ import clsx from 'clsx';
5
5
  import { FieldLabel } from '../FieldLabel/FieldLabel.esm.js';
6
6
  import { FieldError } from '../FieldError/FieldError.esm.js';
7
7
  import { useStyles } from '../../hooks/useStyles.esm.js';
8
+ import { TextFieldDefinition } from './definition.esm.js';
8
9
  import styles from './TextField.module.css.esm.js';
9
10
 
10
11
  const TextField = forwardRef(
@@ -22,7 +23,7 @@ const TextField = forwardRef(
22
23
  }
23
24
  }, [label, ariaLabel, ariaLabelledBy]);
24
25
  const { classNames, dataAttributes, style, cleanedProps } = useStyles(
25
- "TextField",
26
+ TextFieldDefinition,
26
27
  {
27
28
  size: "small",
28
29
  ...props
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.esm.js","sources":["../../../src/components/TextField/TextField.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, useEffect } from 'react';\nimport { Input, TextField as AriaTextField } from 'react-aria-components';\nimport clsx from 'clsx';\nimport { FieldLabel } from '../FieldLabel';\nimport { FieldError } from '../FieldError';\nimport type { TextFieldProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport styles from './TextField.module.css';\n\n/** @public */\nexport const TextField = forwardRef<HTMLDivElement, TextFieldProps>(\n (props, ref) => {\n const {\n label,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n } = props;\n\n useEffect(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn(\n 'TextField requires either a visible label, aria-label, or aria-labelledby for accessibility',\n );\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n const { classNames, dataAttributes, style, cleanedProps } = useStyles(\n 'TextField',\n {\n size: 'small',\n ...props,\n },\n );\n\n const {\n className,\n description,\n icon,\n isRequired,\n secondaryLabel,\n placeholder,\n ...rest\n } = cleanedProps;\n\n // If a secondary label is provided, use it. Otherwise, use 'Required' if the field is required.\n const secondaryLabelText =\n secondaryLabel || (isRequired ? 'Required' : null);\n\n return (\n <AriaTextField\n className={clsx(classNames.root, styles[classNames.root], className)}\n {...dataAttributes}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n style={style}\n {...rest}\n ref={ref}\n >\n <FieldLabel\n label={label}\n secondaryLabel={secondaryLabelText}\n description={description}\n />\n <div\n className={clsx(\n classNames.inputWrapper,\n styles[classNames.inputWrapper],\n )}\n data-size={dataAttributes['data-size']}\n >\n {icon && (\n <div\n className={clsx(\n classNames.inputIcon,\n styles[classNames.inputIcon],\n )}\n data-size={dataAttributes['data-size']}\n aria-hidden=\"true\"\n >\n {icon}\n </div>\n )}\n <Input\n className={clsx(classNames.input, styles[classNames.input])}\n {...(icon && { 'data-icon': true })}\n placeholder={placeholder}\n />\n </div>\n <FieldError />\n </AriaTextField>\n );\n },\n);\n\nTextField.displayName = 'TextField';\n"],"names":["AriaTextField"],"mappings":";;;;;;;;;AA0BO,MAAM,SAAA,GAAY,UAAA;AAAA,EACvB,CAAC,OAAO,GAAA,KAAQ;AACd,IAAA,M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AA;AAAA,YAAA;AAAA,cACC,SAAA,EAAW,IAAA;AAAA,gBACT,UAAA,CAAW,YAAA;AAAA,gBACX,MAAA,CAAO,WAAW,YAAY;AAAA,eAChC;AAAA,cACA,WAAA,EAAW,eAAe,WAAW,CAAA;AAAA,cAEpC,QAAA,EAAA;AAAA,gBAAA,IAAA,oBACC,GAAA;AAAA,kBAAC,KAAA;AAAA,kBAAA;AAAA,oBACC,SAAA,EAAW,IAAA;AAAA,sBACT,UAAA,CAAW,SAAA;AAAA,sBACX,MAAA,CAAO,WAAW,SAAS;AAAA,qBAC7B;AAAA,oBACA,WAAA,EAAW,eAAe,WAAW,CAAA;AAAA,oBACrC,aAAA,EAAY,MAAA;AAAA,oBAEX,QAAA,EAAA;AAAA;AAAA,iBACH;AAAA,gCAEF,GAAA;AAAA,kBAAC,KAAA;AAAA,kBAAA;AAAA,oBACC,WAAW,IAAA,CAAK,UAAA,CAAW,OAAO,MAAA,CAAO,UAAA,CAAW,KAAK,CAAC,CAAA;AAAA,oBACzD,GAAI,IAAA,IAAQ,EAAE,WAAA,EAAa,IAAA,EAAK;AAAA,oBACjC;AAAA;AAAA;AACF;AAAA;AAAA,WACF;AAAA,8BACC,UAAA,EAAA,EAAW;AAAA;AAAA;AAAA,KACd;AAAA,EAEJ;AACF;AAEA,SAAA,CAAU,WAAA,GAAc,WAAA;;;;"}
1
+ {"version":3,"file":"TextField.esm.js","sources":["../../../src/components/TextField/TextField.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, useEffect } from 'react';\nimport { Input, TextField as AriaTextField } from 'react-aria-components';\nimport clsx from 'clsx';\nimport { FieldLabel } from '../FieldLabel';\nimport { FieldError } from '../FieldError';\nimport type { TextFieldProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport { TextFieldDefinition } from './definition';\nimport styles from './TextField.module.css';\n\n/** @public */\nexport const TextField = forwardRef<HTMLDivElement, TextFieldProps>(\n (props, ref) => {\n const {\n label,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n } = props;\n\n useEffect(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn(\n 'TextField requires either a visible label, aria-label, or aria-labelledby for accessibility',\n );\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n const { classNames, dataAttributes, style, cleanedProps } = useStyles(\n TextFieldDefinition,\n {\n size: 'small',\n ...props,\n },\n );\n\n const {\n className,\n description,\n icon,\n isRequired,\n secondaryLabel,\n placeholder,\n ...rest\n } = cleanedProps;\n\n // If a secondary label is provided, use it. Otherwise, use 'Required' if the field is required.\n const secondaryLabelText =\n secondaryLabel || (isRequired ? 'Required' : null);\n\n return (\n <AriaTextField\n className={clsx(classNames.root, styles[classNames.root], className)}\n {...dataAttributes}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n style={style}\n {...rest}\n ref={ref}\n >\n <FieldLabel\n label={label}\n secondaryLabel={secondaryLabelText}\n description={description}\n />\n <div\n className={clsx(\n classNames.inputWrapper,\n styles[classNames.inputWrapper],\n )}\n data-size={dataAttributes['data-size']}\n >\n {icon && (\n <div\n className={clsx(\n classNames.inputIcon,\n styles[classNames.inputIcon],\n )}\n data-size={dataAttributes['data-size']}\n aria-hidden=\"true\"\n >\n {icon}\n </div>\n )}\n <Input\n className={clsx(classNames.input, styles[classNames.input])}\n {...(icon && { 'data-icon': true })}\n placeholder={placeholder}\n />\n </div>\n <FieldError />\n </AriaTextField>\n );\n },\n);\n\nTextField.displayName = 'TextField';\n"],"names":["AriaTextField"],"mappings":";;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AAA,cACA,cAAA,EAAgB,kBAAA;AAAA,cAChB;AAAA;AAAA,WACF;AAAA,0BACA,IAAA;AAAA,YAAC,KAAA;AAAA,YAAA;AAAA,cACC,SAAA,EAAW,IAAA;AAAA,gBACT,UAAA,CAAW,YAAA;AAAA,gBACX,MAAA,CAAO,WAAW,YAAY;AAAA,eAChC;AAAA,cACA,WAAA,EAAW,eAAe,WAAW,CAAA;AAAA,cAEpC,QAAA,EAAA;AAAA,gBAAA,IAAA,oBACC,GAAA;AAAA,kBAAC,KAAA;AAAA,kBAAA;AAAA,oBACC,SAAA,EAAW,IAAA;AAAA,sBACT,UAAA,CAAW,SAAA;AAAA,sBACX,MAAA,CAAO,WAAW,SAAS;AAAA,qBAC7B;AAAA,oBACA,WAAA,EAAW,eAAe,WAAW,CAAA;AAAA,oBACrC,aAAA,EAAY,MAAA;AAAA,oBAEX,QAAA,EAAA;AAAA;AAAA,iBACH;AAAA,gCAEF,GAAA;AAAA,kBAAC,KAAA;AAAA,kBAAA;AAAA,oBACC,WAAW,IAAA,CAAK,UAAA,CAAW,OAAO,MAAA,CAAO,UAAA,CAAW,KAAK,CAAC,CAAA;AAAA,oBACzD,GAAI,IAAA,IAAQ,EAAE,WAAA,EAAa,IAAA,EAAK;AAAA,oBACjC;AAAA;AAAA;AACF;AAAA;AAAA,WACF;AAAA,8BACC,UAAA,EAAA,EAAW;AAAA;AAAA;AAAA,KACd;AAAA,EAEJ;AACF;AAEA,SAAA,CAAU,WAAA,GAAc,WAAA;;;;"}
@@ -0,0 +1,17 @@
1
+ const TextFieldDefinition = {
2
+ classNames: {
3
+ root: "bui-TextField",
4
+ inputWrapper: "bui-InputWrapper",
5
+ input: "bui-Input",
6
+ inputIcon: "bui-InputIcon",
7
+ inputAction: "bui-InputAction"
8
+ },
9
+ dataAttributes: {
10
+ invalid: [true, false],
11
+ disabled: [true, false],
12
+ size: ["small", "medium"]
13
+ }
14
+ };
15
+
16
+ export { TextFieldDefinition };
17
+ //# sourceMappingURL=definition.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/TextField/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ComponentDefinition } from '../../types';\n\n/**\n * Component definition for TextField\n * @public\n */\nexport const TextFieldDefinition = {\n classNames: {\n root: 'bui-TextField',\n inputWrapper: 'bui-InputWrapper',\n input: 'bui-Input',\n inputIcon: 'bui-InputIcon',\n inputAction: 'bui-InputAction',\n },\n dataAttributes: {\n invalid: [true, false] as const,\n disabled: [true, false] as const,\n size: ['small', 'medium'] as const,\n },\n} as const satisfies ComponentDefinition;\n"],"names":[],"mappings":"AAsBO,MAAM,mBAAA,GAAsB;AAAA,EACjC,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,eAAA;AAAA,IACN,YAAA,EAAc,kBAAA;AAAA,IACd,KAAA,EAAO,WAAA;AAAA,IACP,SAAA,EAAW,eAAA;AAAA,IACX,WAAA,EAAa;AAAA,GACf;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,OAAA,EAAS,CAAC,IAAA,EAAM,KAAK,CAAA;AAAA,IACrB,QAAA,EAAU,CAAC,IAAA,EAAM,KAAK,CAAA;AAAA,IACtB,IAAA,EAAM,CAAC,OAAA,EAAS,QAAQ;AAAA;AAE5B;;;;"}
@@ -3,6 +3,7 @@ import { forwardRef } from 'react';
3
3
  import { Tooltip as Tooltip$1, OverlayArrow, TooltipTrigger as TooltipTrigger$1 } from 'react-aria-components';
4
4
  import clsx from 'clsx';
5
5
  import { useStyles } from '../../hooks/useStyles.esm.js';
6
+ import { TooltipDefinition } from './definition.esm.js';
6
7
  import styles from './Tooltip.module.css.esm.js';
7
8
 
8
9
  const TooltipTrigger = (props) => {
@@ -11,7 +12,7 @@ const TooltipTrigger = (props) => {
11
12
  };
12
13
  const Tooltip = forwardRef(
13
14
  (props, ref) => {
14
- const { classNames, cleanedProps } = useStyles("Tooltip", props);
15
+ const { classNames, cleanedProps } = useStyles(TooltipDefinition, props);
15
16
  const { className, children, ...rest } = cleanedProps;
16
17
  return /* @__PURE__ */ jsxs(
17
18
  Tooltip$1,
@@ -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';\nimport styles from './Tooltip.module.css';\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 (props, ref) => {\n const { classNames, cleanedProps } = useStyles('Tooltip', props);\n const { className, children, ...rest } = cleanedProps;\n\n return (\n <AriaTooltip\n className={clsx(\n classNames.tooltip,\n styles[classNames.tooltip],\n className,\n )}\n {...rest}\n ref={ref}\n >\n <OverlayArrow\n className={clsx(classNames.arrow, styles[classNames.arrow])}\n >\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":";;;;;;;AA6BO,MAAM,cAAA,GAAiB,CAAC,KAAA,KAAwC;AACrE,EAAA,MAAM,EAAE,KAAA,GAAQ,GAAA,EAAI,GAAI,KAAA;AAExB,EAAA,uBAAO,GAAA,CAACA,gBAAA,EAAA,EAAmB,KAAA,EAAe,GAAG,KAAA,EAAO,CAAA;AACtD;AAGO,MAAM,OAAA,GAAU,UAAA;AAAA,EACrB,CAAC,OAAO,GAAA,KAAQ;AACd,IAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,SAAA,CAAU,WAAW,KAAK,CAAA;AAC/D,IAAA,MAAM,EAAE,SAAA,EAAW,QAAA,EAAU,GAAG,MAAK,GAAI,YAAA;AAEzC,IAAA,uBACE,IAAA;AAAA,MAACC,SAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,IAAA;AAAA,UACT,UAAA,CAAW,OAAA;AAAA,UACX,MAAA,CAAO,WAAW,OAAO,CAAA;AAAA,UACzB;AAAA,SACF;AAAA,QACC,GAAG,IAAA;AAAA,QACJ,GAAA;AAAA,QAEA,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,YAAA;AAAA,YAAA;AAAA,cACC,WAAW,IAAA,CAAK,UAAA,CAAW,OAAO,MAAA,CAAO,UAAA,CAAW,KAAK,CAAC,CAAA;AAAA,cAE1D,QAAA,kBAAA,IAAA,CAAC,SAAI,KAAA,EAAM,IAAA,EAAK,QAAO,IAAA,EAAK,OAAA,EAAQ,WAAA,EAAY,IAAA,EAAK,MAAA,EACnD,QAAA,EAAA;AAAA,gCAAA,GAAA,CAAC,MAAA,EAAA,EAAK,GAAE,8NAAA,EAA+N,CAAA;AAAA,gCACvO,GAAA,CAAC,MAAA,EAAA,EAAK,CAAA,EAAE,qSAAA,EAAsS;AAAA,eAAA,EAChT;AAAA;AAAA,WACF;AAAA,UACC;AAAA;AAAA;AAAA,KACH;AAAA,EAEJ;AACF;AAEA,OAAA,CAAQ,WAAA,GAAc,SAAA;;;;"}
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';\nimport { TooltipDefinition } from './definition';\nimport styles from './Tooltip.module.css';\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 (props, ref) => {\n const { classNames, cleanedProps } = useStyles(TooltipDefinition, props);\n const { className, children, ...rest } = cleanedProps;\n\n return (\n <AriaTooltip\n className={clsx(\n classNames.tooltip,\n styles[classNames.tooltip],\n className,\n )}\n {...rest}\n ref={ref}\n >\n <OverlayArrow\n className={clsx(classNames.arrow, styles[classNames.arrow])}\n >\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":";;;;;;;;AA8BO,MAAM,cAAA,GAAiB,CAAC,KAAA,KAAwC;AACrE,EAAA,MAAM,EAAE,KAAA,GAAQ,GAAA,EAAI,GAAI,KAAA;AAExB,EAAA,uBAAO,GAAA,CAACA,gBAAA,EAAA,EAAmB,KAAA,EAAe,GAAG,KAAA,EAAO,CAAA;AACtD;AAGO,MAAM,OAAA,GAAU,UAAA;AAAA,EACrB,CAAC,OAAO,GAAA,KAAQ;AACd,IAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,SAAA,CAAU,mBAAmB,KAAK,CAAA;AACvE,IAAA,MAAM,EAAE,SAAA,EAAW,QAAA,EAAU,GAAG,MAAK,GAAI,YAAA;AAEzC,IAAA,uBACE,IAAA;AAAA,MAACC,SAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,IAAA;AAAA,UACT,UAAA,CAAW,OAAA;AAAA,UACX,MAAA,CAAO,WAAW,OAAO,CAAA;AAAA,UACzB;AAAA,SACF;AAAA,QACC,GAAG,IAAA;AAAA,QACJ,GAAA;AAAA,QAEA,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,YAAA;AAAA,YAAA;AAAA,cACC,WAAW,IAAA,CAAK,UAAA,CAAW,OAAO,MAAA,CAAO,UAAA,CAAW,KAAK,CAAC,CAAA;AAAA,cAE1D,QAAA,kBAAA,IAAA,CAAC,SAAI,KAAA,EAAM,IAAA,EAAK,QAAO,IAAA,EAAK,OAAA,EAAQ,WAAA,EAAY,IAAA,EAAK,MAAA,EACnD,QAAA,EAAA;AAAA,gCAAA,GAAA,CAAC,MAAA,EAAA,EAAK,GAAE,8NAAA,EAA+N,CAAA;AAAA,gCACvO,GAAA,CAAC,MAAA,EAAA,EAAK,CAAA,EAAE,qSAAA,EAAsS;AAAA,eAAA,EAChT;AAAA;AAAA,WACF;AAAA,UACC;AAAA;AAAA;AAAA,KACH;AAAA,EAEJ;AACF;AAEA,OAAA,CAAQ,WAAA,GAAc,SAAA;;;;"}
@@ -0,0 +1,9 @@
1
+ const TooltipDefinition = {
2
+ classNames: {
3
+ tooltip: "bui-Tooltip",
4
+ arrow: "bui-TooltipArrow"
5
+ }
6
+ };
7
+
8
+ export { TooltipDefinition };
9
+ //# sourceMappingURL=definition.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Tooltip/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ComponentDefinition } from '../../types';\n\n/**\n * Component definition for Tooltip\n * @public\n */\nexport const TooltipDefinition = {\n classNames: {\n tooltip: 'bui-Tooltip',\n arrow: 'bui-TooltipArrow',\n },\n} as const satisfies ComponentDefinition;\n"],"names":[],"mappings":"AAsBO,MAAM,iBAAA,GAAoB;AAAA,EAC/B,UAAA,EAAY;AAAA,IACV,OAAA,EAAS,aAAA;AAAA,IACT,KAAA,EAAO;AAAA;AAEX;;;;"}
@@ -1,10 +1,14 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { useStyles } from '../../hooks/useStyles.esm.js';
3
+ import { VisuallyHiddenDefinition } from './definition.esm.js';
3
4
  import styles from './VisuallyHidden.module.css.esm.js';
4
5
  import clsx from 'clsx';
5
6
 
6
7
  const VisuallyHidden = (props) => {
7
- const { classNames, cleanedProps } = useStyles("VisuallyHidden", props);
8
+ const { classNames, cleanedProps } = useStyles(
9
+ VisuallyHiddenDefinition,
10
+ props
11
+ );
8
12
  const { className, ...rest } = cleanedProps;
9
13
  return /* @__PURE__ */ jsx(
10
14
  "div",
@@ -1 +1 @@
1
- {"version":3,"file":"VisuallyHidden.esm.js","sources":["../../../src/components/VisuallyHidden/VisuallyHidden.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 { useStyles } from '../../hooks/useStyles';\nimport { VisuallyHiddenProps } from './types';\nimport styles from './VisuallyHidden.module.css';\nimport clsx from 'clsx';\n\n/**\n * Visually hides content while keeping it accessible to screen readers.\n * Useful for descriptive labels and other screen-reader-only content.\n *\n * Note: This component is for content that should ALWAYS remain visually hidden.\n * For skip links that become visible on focus, use a different approach.\n *\n * @public\n */\nexport const VisuallyHidden = (props: VisuallyHiddenProps) => {\n const { classNames, cleanedProps } = useStyles('VisuallyHidden', props);\n const { className, ...rest } = cleanedProps;\n\n return (\n <div\n className={clsx(classNames.root, styles[classNames.root], className)}\n {...rest}\n />\n );\n};\n"],"names":[],"mappings":";;;;;AA8BO,MAAM,cAAA,GAAiB,CAAC,KAAA,KAA+B;AAC5D,EAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,SAAA,CAAU,kBAAkB,KAAK,CAAA;AACtE,EAAA,MAAM,EAAE,SAAA,EAAW,GAAG,IAAA,EAAK,GAAI,YAAA;AAE/B,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,KAAK,UAAA,CAAW,IAAA,EAAM,OAAO,UAAA,CAAW,IAAI,GAAG,SAAS,CAAA;AAAA,MAClE,GAAG;AAAA;AAAA,GACN;AAEJ;;;;"}
1
+ {"version":3,"file":"VisuallyHidden.esm.js","sources":["../../../src/components/VisuallyHidden/VisuallyHidden.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 { useStyles } from '../../hooks/useStyles';\nimport { VisuallyHiddenDefinition } from './definition';\nimport { VisuallyHiddenProps } from './types';\nimport styles from './VisuallyHidden.module.css';\nimport clsx from 'clsx';\n\n/**\n * Visually hides content while keeping it accessible to screen readers.\n * Useful for descriptive labels and other screen-reader-only content.\n *\n * Note: This component is for content that should ALWAYS remain visually hidden.\n * For skip links that become visible on focus, use a different approach.\n *\n * @public\n */\nexport const VisuallyHidden = (props: VisuallyHiddenProps) => {\n const { classNames, cleanedProps } = useStyles(\n VisuallyHiddenDefinition,\n props,\n );\n const { className, ...rest } = cleanedProps;\n\n return (\n <div\n className={clsx(classNames.root, styles[classNames.root], className)}\n {...rest}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AA+BO,MAAM,cAAA,GAAiB,CAAC,KAAA,KAA+B;AAC5D,EAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,SAAA;AAAA,IACnC,wBAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,MAAM,EAAE,SAAA,EAAW,GAAG,IAAA,EAAK,GAAI,YAAA;AAE/B,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,KAAK,UAAA,CAAW,IAAA,EAAM,OAAO,UAAA,CAAW,IAAI,GAAG,SAAS,CAAA;AAAA,MAClE,GAAG;AAAA;AAAA,GACN;AAEJ;;;;"}
@@ -0,0 +1,8 @@
1
+ const VisuallyHiddenDefinition = {
2
+ classNames: {
3
+ root: "bui-VisuallyHidden"
4
+ }
5
+ };
6
+
7
+ export { VisuallyHiddenDefinition };
8
+ //# sourceMappingURL=definition.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/VisuallyHidden/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ComponentDefinition } from '../../types';\n\n/**\n * Component definition for VisuallyHidden\n * @public\n */\nexport const VisuallyHiddenDefinition = {\n classNames: {\n root: 'bui-VisuallyHidden',\n },\n} as const satisfies ComponentDefinition;\n"],"names":[],"mappings":"AAsBO,MAAM,wBAAA,GAA2B;AAAA,EACtC,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA;AAEV;;;;"}
@@ -1,5 +1,4 @@
1
1
  import { useBreakpoint, breakpoints } from './useBreakpoint.esm.js';
2
- import { componentDefinitions } from '../utils/componentDefinitions.esm.js';
3
2
  import { utilityClassMap } from '../utils/utilityClassMap.esm.js';
4
3
 
5
4
  function resolveResponsiveValue(value, breakpoint) {
@@ -21,9 +20,8 @@ function resolveResponsiveValue(value, breakpoint) {
21
20
  }
22
21
  return void 0;
23
22
  }
24
- function useStyles(componentName, props = {}) {
23
+ function useStyles(componentDefinition, props = {}) {
25
24
  const { breakpoint } = useBreakpoint();
26
- const componentDefinition = componentDefinitions[componentName];
27
25
  const classNames = componentDefinition.classNames;
28
26
  const utilityPropNames = ("utilityProps" in componentDefinition ? componentDefinition.utilityProps : []) || [];
29
27
  const dataAttributeNames = "dataAttributes" in componentDefinition ? Object.keys(componentDefinition.dataAttributes || {}) : [];
@@ -1 +1 @@
1
- {"version":3,"file":"useStyles.esm.js","sources":["../../src/hooks/useStyles.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useBreakpoint, breakpoints } from './useBreakpoint';\nimport { componentDefinitions } from '../utils/componentDefinitions';\nimport type { ComponentDefinitionName, ComponentClassNames } from '../types';\nimport { utilityClassMap } from '../utils/utilityClassMap';\n\n/**\n * Resolve a responsive value based on the current breakpoint\n * @param value - The responsive value (string or object with breakpoint keys)\n * @param breakpoint - The current breakpoint\n * @returns The resolved value for the current breakpoint\n */\nfunction resolveResponsiveValue(\n value: string | Record<string, string>,\n breakpoint: string,\n): string | undefined {\n if (typeof value === 'string') {\n return value;\n }\n\n if (typeof value === 'object' && value !== null) {\n const index = breakpoints.findIndex(b => b.id === breakpoint);\n\n // Look for value at current breakpoint or smaller\n for (let i = index; i >= 0; i--) {\n if (value[breakpoints[i].id]) {\n return value[breakpoints[i].id];\n }\n }\n\n // If no value found, check from smallest breakpoint up\n for (let i = 0; i < breakpoints.length; i++) {\n if (value[breakpoints[i].id]) {\n return value[breakpoints[i].id];\n }\n }\n }\n\n return undefined;\n}\n\n/**\n * React hook to get class names and data attributes for a component with responsive support\n * @param componentName - The name of the component\n * @param props - All component props\n * @returns Object with classNames, dataAttributes, utilityClasses, style, and cleanedProps\n */\nexport function useStyles<\n T extends ComponentDefinitionName,\n P extends Record<string, any> = Record<string, any>,\n>(\n componentName: T,\n props: P = {} as P,\n): {\n classNames: ComponentClassNames<T>;\n dataAttributes: Record<string, string>;\n utilityClasses: string;\n style: React.CSSProperties;\n cleanedProps: P;\n} {\n const { breakpoint } = useBreakpoint();\n const componentDefinition = componentDefinitions[componentName];\n const classNames = componentDefinition.classNames as ComponentClassNames<T>;\n const utilityPropNames =\n ('utilityProps' in componentDefinition\n ? componentDefinition.utilityProps\n : []) || [];\n\n // Extract data attribute names from component definition\n const dataAttributeNames =\n 'dataAttributes' in componentDefinition\n ? Object.keys(componentDefinition.dataAttributes || {})\n : [];\n\n // Extract existing style from props\n const incomingStyle = props.style || {};\n\n // Generate data attributes from component definition\n const dataAttributes: Record<string, string> = {};\n for (const key of dataAttributeNames) {\n const value = props[key];\n if (value !== undefined && value !== null) {\n // Handle boolean and number values directly\n if (typeof value === 'boolean' || typeof value === 'number') {\n dataAttributes[`data-${key}`] = String(value);\n } else {\n const resolvedValue = resolveResponsiveValue(value, breakpoint);\n if (resolvedValue !== undefined) {\n dataAttributes[`data-${key}`] = resolvedValue;\n }\n }\n }\n }\n\n // Generate utility classes and custom styles from component's allowed utility props\n const utilityClassList: string[] = [];\n const generatedStyle: React.CSSProperties = {};\n\n const handleUtilityValue = (\n key: string,\n val: unknown,\n prefix: string = '',\n ) => {\n // Get utility class configuration for this key\n const utilityConfig = utilityClassMap[key as keyof typeof utilityClassMap];\n\n if (!utilityConfig) {\n // Skip if no config found for this key\n return;\n }\n\n // Check if value is in the list of valid values for this utility\n if (\n utilityConfig.values.length > 0 &&\n utilityConfig.values.includes(val as string | number)\n ) {\n // Generate utility class with value suffix and optional breakpoint prefix\n const className = prefix\n ? `${prefix}${utilityConfig.class}-${val}`\n : `${utilityConfig.class}-${val}`;\n utilityClassList.push(className);\n } else if (utilityConfig.cssVar) {\n // Custom value - add CSS custom property AND utility class name\n // Only if cssVar is defined (properties with fixed values don't have cssVar)\n const cssVarKey = prefix\n ? `${utilityConfig.cssVar}-${prefix.slice(0, -1)}`\n : utilityConfig.cssVar;\n // CSS custom properties need to be set on the style object as strings\n (generatedStyle as Record<string, unknown>)[cssVarKey] = val;\n\n // Add utility class name (without value suffix) with optional breakpoint prefix\n const className = prefix\n ? `${prefix}${utilityConfig.class}`\n : utilityConfig.class;\n utilityClassList.push(className);\n }\n // If no cssVar and value is not in valid values, skip (invalid value for fixed-value property)\n };\n\n for (const key of utilityPropNames) {\n const value = props[key];\n if (value === undefined || value === null) {\n continue;\n }\n\n // Check if value is a responsive object\n if (typeof value === 'object' && value !== null) {\n const breakpointValues = value as { [key: string]: unknown };\n // Handle responsive object values\n for (const bp in breakpointValues) {\n const prefix = bp === 'initial' ? '' : `${bp}:`;\n handleUtilityValue(key, breakpointValues[bp], prefix);\n }\n } else {\n // Handle simple value\n handleUtilityValue(key, value);\n }\n }\n\n // Create cleaned props by excluding only utility props\n // All other props (including data attributes, style, children, etc.) remain\n const utilityPropsSet = new Set<string>(utilityPropNames);\n\n const cleanedPropsBase = Object.keys(props).reduce((acc, key) => {\n if (!utilityPropsSet.has(key)) {\n acc[key] = props[key];\n }\n return acc;\n }, {} as any);\n\n // Merge incoming style with generated styles (incoming styles take precedence)\n const mergedStyle = {\n ...generatedStyle,\n ...incomingStyle,\n };\n\n // Add merged style to cleanedProps\n const cleanedProps = {\n ...cleanedPropsBase,\n style: mergedStyle,\n } as P;\n\n return {\n classNames,\n dataAttributes,\n utilityClasses: utilityClassList.join(' '),\n style: mergedStyle,\n cleanedProps,\n };\n}\n"],"names":[],"mappings":";;;;AA0BA,SAAS,sBAAA,CACP,OACA,UAAA,EACoB;AACpB,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,IAAA,EAAM;AAC/C,IAAA,MAAM,QAAQ,WAAA,CAAY,SAAA,CAAU,CAAA,CAAA,KAAK,CAAA,CAAE,OAAO,UAAU,CAAA;AAG5D,IAAA,KAAA,IAAS,CAAA,GAAI,KAAA,EAAO,CAAA,IAAK,CAAA,EAAG,CAAA,EAAA,EAAK;AAC/B,MAAA,IAAI,KAAA,CAAM,WAAA,CAAY,CAAC,CAAA,CAAE,EAAE,CAAA,EAAG;AAC5B,QAAA,OAAO,KAAA,CAAM,WAAA,CAAY,CAAC,CAAA,CAAE,EAAE,CAAA;AAAA,MAChC;AAAA,IACF;AAGA,IAAA,KAAA,I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AA,CAAK,GAAG,CAAA;AAAA,IACzC,KAAA,EAAO,WAAA;AAAA,IACP;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useStyles.esm.js","sources":["../../src/hooks/useStyles.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useBreakpoint, breakpoints } from './useBreakpoint';\nimport type { ComponentDefinition } from '../types';\nimport { utilityClassMap } from '../utils/utilityClassMap';\n\n/**\n * Resolve a responsive value based on the current breakpoint\n * @param value - The responsive value (string or object with breakpoint keys)\n * @param breakpoint - The current breakpoint\n * @returns The resolved value for the current breakpoint\n */\nfunction resolveResponsiveValue(\n value: string | Record<string, string>,\n breakpoint: string,\n): string | undefined {\n if (typeof value === 'string') {\n return value;\n }\n\n if (typeof value === 'object' && value !== null) {\n const index = breakpoints.findIndex(b => b.id === breakpoint);\n\n // Look for value at current breakpoint or smaller\n for (let i = index; i >= 0; i--) {\n if (value[breakpoints[i].id]) {\n return value[breakpoints[i].id];\n }\n }\n\n // If no value found, check from smallest breakpoint up\n for (let i = 0; i < breakpoints.length; i++) {\n if (value[breakpoints[i].id]) {\n return value[breakpoints[i].id];\n }\n }\n }\n\n return undefined;\n}\n\n/**\n * React hook to get class names and data attributes for a component with responsive support\n * @param componentDefinition - The component's definition object\n * @param props - All component props\n * @returns Object with classNames, dataAttributes, utilityClasses, style, and cleanedProps\n */\nexport function useStyles<\n T extends ComponentDefinition,\n P extends Record<string, any> = Record<string, any>,\n>(\n componentDefinition: T,\n props: P = {} as P,\n): {\n classNames: T['classNames'];\n dataAttributes: Record<string, string>;\n utilityClasses: string;\n style: React.CSSProperties;\n cleanedProps: P;\n} {\n const { breakpoint } = useBreakpoint();\n const classNames = componentDefinition.classNames;\n const utilityPropNames =\n ('utilityProps' in componentDefinition\n ? componentDefinition.utilityProps\n : []) || [];\n\n // Extract data attribute names from component definition\n const dataAttributeNames =\n 'dataAttributes' in componentDefinition\n ? Object.keys(componentDefinition.dataAttributes || {})\n : [];\n\n // Extract existing style from props\n const incomingStyle = props.style || {};\n\n // Generate data attributes from component definition\n const dataAttributes: Record<string, string> = {};\n for (const key of dataAttributeNames) {\n const value = props[key];\n if (value !== undefined && value !== null) {\n // Handle boolean and number values directly\n if (typeof value === 'boolean' || typeof value === 'number') {\n dataAttributes[`data-${key}`] = String(value);\n } else {\n const resolvedValue = resolveResponsiveValue(value, breakpoint);\n if (resolvedValue !== undefined) {\n dataAttributes[`data-${key}`] = resolvedValue;\n }\n }\n }\n }\n\n // Generate utility classes and custom styles from component's allowed utility props\n const utilityClassList: string[] = [];\n const generatedStyle: React.CSSProperties = {};\n\n const handleUtilityValue = (\n key: string,\n val: unknown,\n prefix: string = '',\n ) => {\n // Get utility class configuration for this key\n const utilityConfig = utilityClassMap[key as keyof typeof utilityClassMap];\n\n if (!utilityConfig) {\n // Skip if no config found for this key\n return;\n }\n\n // Check if value is in the list of valid values for this utility\n if (\n utilityConfig.values.length > 0 &&\n utilityConfig.values.includes(val as string | number)\n ) {\n // Generate utility class with value suffix and optional breakpoint prefix\n const className = prefix\n ? `${prefix}${utilityConfig.class}-${val}`\n : `${utilityConfig.class}-${val}`;\n utilityClassList.push(className);\n } else if (utilityConfig.cssVar) {\n // Custom value - add CSS custom property AND utility class name\n // Only if cssVar is defined (properties with fixed values don't have cssVar)\n const cssVarKey = prefix\n ? `${utilityConfig.cssVar}-${prefix.slice(0, -1)}`\n : utilityConfig.cssVar;\n // CSS custom properties need to be set on the style object as strings\n (generatedStyle as Record<string, unknown>)[cssVarKey] = val;\n\n // Add utility class name (without value suffix) with optional breakpoint prefix\n const className = prefix\n ? `${prefix}${utilityConfig.class}`\n : utilityConfig.class;\n utilityClassList.push(className);\n }\n // If no cssVar and value is not in valid values, skip (invalid value for fixed-value property)\n };\n\n for (const key of utilityPropNames) {\n const value = props[key];\n if (value === undefined || value === null) {\n continue;\n }\n\n // Check if value is a responsive object\n if (typeof value === 'object' && value !== null) {\n const breakpointValues = value as { [key: string]: unknown };\n // Handle responsive object values\n for (const bp in breakpointValues) {\n const prefix = bp === 'initial' ? '' : `${bp}:`;\n handleUtilityValue(key, breakpointValues[bp], prefix);\n }\n } else {\n // Handle simple value\n handleUtilityValue(key, value);\n }\n }\n\n // Create cleaned props by excluding only utility props\n // All other props (including data attributes, style, children, etc.) remain\n const utilityPropsSet = new Set<string>(utilityPropNames);\n\n const cleanedPropsBase = Object.keys(props).reduce((acc, key) => {\n if (!utilityPropsSet.has(key)) {\n acc[key] = props[key];\n }\n return acc;\n }, {} as any);\n\n // Merge incoming style with generated styles (incoming styles take precedence)\n const mergedStyle = {\n ...generatedStyle,\n ...incomingStyle,\n };\n\n // Add merged style to cleanedProps\n const cleanedProps = {\n ...cleanedPropsBase,\n style: mergedStyle,\n } as P;\n\n return {\n classNames,\n dataAttributes,\n utilityClasses: utilityClassList.join(' '),\n style: mergedStyle,\n cleanedProps,\n };\n}\n"],"names":[],"mappings":";;;AAyBA,SAAS,sBAAA,CACP,OACA,UAAA,EACoB;AACpB,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,IAAA,EAAM;AAC/C,IAAA,MAAM,QAAQ,WAAA,CAAY,SAAA,CAAU,CAAA,CAAA,KAAK,CAAA,CAAE,OAAO,UAAU,CAAA;AAG5D,IAAA,KAAA,IAAS,CAAA,GAAI,KAAA,EAAO,CAAA,IAAK,CAAA,EAAG,CAAA,EAAA,EAAK;AAC/B,MAAA,IAAI,K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