@backstage/ui 0.12.0 → 0.13.0-next.1

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 (189) hide show
  1. package/CHANGELOG.md +120 -0
  2. package/dist/components/Accordion/Accordion.esm.js +4 -2
  3. package/dist/components/Accordion/Accordion.esm.js.map +1 -1
  4. package/dist/components/Accordion/Accordion.module.css.esm.js +2 -2
  5. package/dist/components/Accordion/definition.esm.js +4 -2
  6. package/dist/components/Accordion/definition.esm.js.map +1 -1
  7. package/dist/components/Alert/definition.esm.js +1 -1
  8. package/dist/components/Avatar/Avatar.esm.js +8 -28
  9. package/dist/components/Avatar/Avatar.esm.js.map +1 -1
  10. package/dist/components/Avatar/definition.esm.js +17 -4
  11. package/dist/components/Avatar/definition.esm.js.map +1 -1
  12. package/dist/components/Box/definition.esm.js +1 -1
  13. package/dist/components/Button/definition.esm.js +2 -3
  14. package/dist/components/Button/definition.esm.js.map +1 -1
  15. package/dist/components/ButtonIcon/definition.esm.js +2 -3
  16. package/dist/components/ButtonIcon/definition.esm.js.map +1 -1
  17. package/dist/components/ButtonLink/definition.esm.js +2 -3
  18. package/dist/components/ButtonLink/definition.esm.js.map +1 -1
  19. package/dist/components/Card/Card.esm.js +1 -1
  20. package/dist/components/Card/Card.esm.js.map +1 -1
  21. package/dist/components/Card/definition.esm.js +1 -1
  22. package/dist/components/Checkbox/Checkbox.esm.js +10 -17
  23. package/dist/components/Checkbox/Checkbox.esm.js.map +1 -1
  24. package/dist/components/Checkbox/definition.esm.js +16 -5
  25. package/dist/components/Checkbox/definition.esm.js.map +1 -1
  26. package/dist/components/Container/Container.esm.js +8 -13
  27. package/dist/components/Container/Container.esm.js.map +1 -1
  28. package/dist/components/Container/Container.module.css.esm.js +2 -2
  29. package/dist/components/Container/definition.esm.js +16 -2
  30. package/dist/components/Container/definition.esm.js.map +1 -1
  31. package/dist/components/Dialog/Dialog.esm.js +26 -59
  32. package/dist/components/Dialog/Dialog.esm.js.map +1 -1
  33. package/dist/components/Dialog/Dialog.module.css.esm.js +2 -2
  34. package/dist/components/Dialog/definition.esm.js +52 -8
  35. package/dist/components/Dialog/definition.esm.js.map +1 -1
  36. package/dist/components/FieldError/FieldError.esm.js +4 -13
  37. package/dist/components/FieldError/FieldError.esm.js.map +1 -1
  38. package/dist/components/FieldError/definition.esm.js +14 -2
  39. package/dist/components/FieldError/definition.esm.js.map +1 -1
  40. package/dist/components/FieldLabel/FieldLabel.esm.js +14 -59
  41. package/dist/components/FieldLabel/FieldLabel.esm.js.map +1 -1
  42. package/dist/components/FieldLabel/definition.esm.js +19 -2
  43. package/dist/components/FieldLabel/definition.esm.js.map +1 -1
  44. package/dist/components/Flex/Flex.esm.js +11 -22
  45. package/dist/components/Flex/Flex.esm.js.map +1 -1
  46. package/dist/components/Flex/definition.esm.js +19 -13
  47. package/dist/components/Flex/definition.esm.js.map +1 -1
  48. package/dist/components/FullPage/FullPage.esm.js +4 -13
  49. package/dist/components/FullPage/FullPage.esm.js.map +1 -1
  50. package/dist/components/FullPage/definition.esm.js +14 -2
  51. package/dist/components/FullPage/definition.esm.js.map +1 -1
  52. package/dist/components/Grid/Grid.esm.js +19 -40
  53. package/dist/components/Grid/Grid.esm.js.map +1 -1
  54. package/dist/components/Grid/definition.esm.js +30 -26
  55. package/dist/components/Grid/definition.esm.js.map +1 -1
  56. package/dist/components/HeaderPage/HeaderPage.esm.js +38 -60
  57. package/dist/components/HeaderPage/HeaderPage.esm.js.map +1 -1
  58. package/dist/components/HeaderPage/definition.esm.js +18 -2
  59. package/dist/components/HeaderPage/definition.esm.js.map +1 -1
  60. package/dist/components/Link/Link.esm.js +6 -34
  61. package/dist/components/Link/Link.esm.js.map +1 -1
  62. package/dist/components/Link/definition.esm.js +20 -15
  63. package/dist/components/Link/definition.esm.js.map +1 -1
  64. package/dist/components/Menu/Menu.esm.js +162 -343
  65. package/dist/components/Menu/Menu.esm.js.map +1 -1
  66. package/dist/components/Menu/Menu.module.css.esm.js +2 -2
  67. package/dist/components/Menu/definition.esm.js +113 -17
  68. package/dist/components/Menu/definition.esm.js.map +1 -1
  69. package/dist/components/PasswordField/PasswordField.esm.js +17 -52
  70. package/dist/components/PasswordField/PasswordField.esm.js.map +1 -1
  71. package/dist/components/PasswordField/PasswordField.module.css.esm.js +2 -2
  72. package/dist/components/PasswordField/definition.esm.js +28 -11
  73. package/dist/components/PasswordField/definition.esm.js.map +1 -1
  74. package/dist/components/PluginHeader/PluginHeader.esm.js +33 -46
  75. package/dist/components/PluginHeader/PluginHeader.esm.js.map +1 -1
  76. package/dist/components/PluginHeader/PluginHeader.module.css.esm.js +2 -2
  77. package/dist/components/PluginHeader/definition.esm.js +21 -3
  78. package/dist/components/PluginHeader/definition.esm.js.map +1 -1
  79. package/dist/components/Popover/Popover.esm.js +24 -32
  80. package/dist/components/Popover/Popover.esm.js.map +1 -1
  81. package/dist/components/Popover/Popover.module.css.esm.js +2 -2
  82. package/dist/components/Popover/definition.esm.js +16 -2
  83. package/dist/components/Popover/definition.esm.js.map +1 -1
  84. package/dist/components/RadioGroup/RadioGroup.esm.js +25 -44
  85. package/dist/components/RadioGroup/RadioGroup.esm.js.map +1 -1
  86. package/dist/components/RadioGroup/RadioGroup.module.css.esm.js +2 -2
  87. package/dist/components/RadioGroup/definition.esm.js +30 -5
  88. package/dist/components/RadioGroup/definition.esm.js.map +1 -1
  89. package/dist/components/SearchField/SearchField.esm.js +25 -45
  90. package/dist/components/SearchField/SearchField.esm.js.map +1 -1
  91. package/dist/components/SearchField/SearchField.module.css.esm.js +2 -2
  92. package/dist/components/SearchField/definition.esm.js +20 -5
  93. package/dist/components/SearchField/definition.esm.js.map +1 -1
  94. package/dist/components/Select/Select.esm.js +14 -23
  95. package/dist/components/Select/Select.esm.js.map +1 -1
  96. package/dist/components/Select/Select.module.css.esm.js +2 -2
  97. package/dist/components/Select/SelectContent.esm.js +8 -31
  98. package/dist/components/Select/SelectContent.esm.js.map +1 -1
  99. package/dist/components/Select/SelectListBox.esm.js +21 -44
  100. package/dist/components/Select/SelectListBox.esm.js.map +1 -1
  101. package/dist/components/Select/SelectTrigger.esm.js +8 -14
  102. package/dist/components/Select/SelectTrigger.esm.js.map +1 -1
  103. package/dist/components/Select/definition.esm.js +67 -17
  104. package/dist/components/Select/definition.esm.js.map +1 -1
  105. package/dist/components/Skeleton/Skeleton.esm.js +9 -13
  106. package/dist/components/Skeleton/Skeleton.esm.js.map +1 -1
  107. package/dist/components/Skeleton/definition.esm.js +18 -2
  108. package/dist/components/Skeleton/definition.esm.js.map +1 -1
  109. package/dist/components/Switch/Switch.esm.js +7 -22
  110. package/dist/components/Switch/Switch.esm.js.map +1 -1
  111. package/dist/components/Switch/definition.esm.js +15 -2
  112. package/dist/components/Switch/definition.esm.js.map +1 -1
  113. package/dist/components/Table/components/Cell.esm.js +4 -17
  114. package/dist/components/Table/components/Cell.esm.js.map +1 -1
  115. package/dist/components/Table/components/CellProfile.esm.js +12 -41
  116. package/dist/components/Table/components/CellProfile.esm.js.map +1 -1
  117. package/dist/components/Table/components/CellText.esm.js +39 -73
  118. package/dist/components/Table/components/CellText.esm.js.map +1 -1
  119. package/dist/components/Table/components/Column.esm.js +8 -36
  120. package/dist/components/Table/components/Column.esm.js.map +1 -1
  121. package/dist/components/Table/components/Row.esm.js +9 -19
  122. package/dist/components/Table/components/Row.esm.js.map +1 -1
  123. package/dist/components/Table/components/Table.esm.js +7 -0
  124. package/dist/components/Table/components/Table.esm.js.map +1 -1
  125. package/dist/components/Table/components/TableBody.esm.js +4 -12
  126. package/dist/components/Table/components/TableBody.esm.js.map +1 -1
  127. package/dist/components/Table/components/TableHeader.esm.js +19 -29
  128. package/dist/components/Table/components/TableHeader.esm.js.map +1 -1
  129. package/dist/components/Table/components/TableRoot.esm.js +5 -7
  130. package/dist/components/Table/components/TableRoot.esm.js.map +1 -1
  131. package/dist/components/Table/definition.esm.js +97 -21
  132. package/dist/components/Table/definition.esm.js.map +1 -1
  133. package/dist/components/TablePagination/TablePagination.esm.js +24 -32
  134. package/dist/components/TablePagination/TablePagination.esm.js.map +1 -1
  135. package/dist/components/TablePagination/definition.esm.js +32 -2
  136. package/dist/components/TablePagination/definition.esm.js.map +1 -1
  137. package/dist/components/Tabs/Tabs.esm.js +40 -63
  138. package/dist/components/Tabs/Tabs.esm.js.map +1 -1
  139. package/dist/components/Tabs/TabsIndicators.esm.js +6 -18
  140. package/dist/components/Tabs/TabsIndicators.esm.js.map +1 -1
  141. package/dist/components/Tabs/definition.esm.js +62 -10
  142. package/dist/components/Tabs/definition.esm.js.map +1 -1
  143. package/dist/components/TagGroup/TagGroup.esm.js +36 -63
  144. package/dist/components/TagGroup/TagGroup.esm.js.map +1 -1
  145. package/dist/components/TagGroup/definition.esm.js +35 -8
  146. package/dist/components/TagGroup/definition.esm.js.map +1 -1
  147. package/dist/components/Text/Text.esm.js +6 -13
  148. package/dist/components/Text/Text.esm.js.map +1 -1
  149. package/dist/components/Text/definition.esm.js +18 -14
  150. package/dist/components/Text/definition.esm.js.map +1 -1
  151. package/dist/components/TextField/TextField.esm.js +16 -41
  152. package/dist/components/TextField/TextField.esm.js.map +1 -1
  153. package/dist/components/TextField/definition.esm.js +19 -6
  154. package/dist/components/TextField/definition.esm.js.map +1 -1
  155. package/dist/components/ToggleButton/ToggleButton.esm.js +11 -23
  156. package/dist/components/ToggleButton/ToggleButton.esm.js.map +1 -1
  157. package/dist/components/ToggleButton/definition.esm.js +17 -4
  158. package/dist/components/ToggleButton/definition.esm.js.map +1 -1
  159. package/dist/components/ToggleButtonGroup/ToggleButtonGroup.esm.js +5 -18
  160. package/dist/components/ToggleButtonGroup/ToggleButtonGroup.esm.js.map +1 -1
  161. package/dist/components/ToggleButtonGroup/definition.esm.js +14 -4
  162. package/dist/components/ToggleButtonGroup/definition.esm.js.map +1 -1
  163. package/dist/components/Tooltip/Tooltip.esm.js +24 -30
  164. package/dist/components/Tooltip/Tooltip.esm.js.map +1 -1
  165. package/dist/components/Tooltip/Tooltip.module.css.esm.js +2 -2
  166. package/dist/components/Tooltip/definition.esm.js +16 -2
  167. package/dist/components/Tooltip/definition.esm.js.map +1 -1
  168. package/dist/components/VisuallyHidden/VisuallyHidden.esm.js +4 -12
  169. package/dist/components/VisuallyHidden/VisuallyHidden.esm.js.map +1 -1
  170. package/dist/components/VisuallyHidden/definition.esm.js +14 -2
  171. package/dist/components/VisuallyHidden/definition.esm.js.map +1 -1
  172. package/dist/css/styles.css +2 -4
  173. package/dist/hooks/useBg.esm.js +11 -2
  174. package/dist/hooks/useBg.esm.js.map +1 -1
  175. package/dist/hooks/useBreakpoint.esm.js +67 -27
  176. package/dist/hooks/useBreakpoint.esm.js.map +1 -1
  177. package/dist/hooks/useDefinition/helpers.esm.js +24 -1
  178. package/dist/hooks/useDefinition/helpers.esm.js.map +1 -1
  179. package/dist/hooks/useDefinition/useDefinition.esm.js +12 -22
  180. package/dist/hooks/useDefinition/useDefinition.esm.js.map +1 -1
  181. package/dist/index.d.ts +860 -273
  182. package/dist/index.esm.js +2 -2
  183. package/package.json +6 -4
  184. package/dist/components/PluginHeader/PluginHeaderToolbar.esm.js +0 -94
  185. package/dist/components/PluginHeader/PluginHeaderToolbar.esm.js.map +0 -1
  186. package/dist/hooks/useMediaQuery.esm.js +0 -47
  187. package/dist/hooks/useMediaQuery.esm.js.map +0 -1
  188. package/dist/hooks/useStyles.esm.js +0 -53
  189. package/dist/hooks/useStyles.esm.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/ToggleButton/definition.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ComponentDefinition } from '../../types';\n\n/**\n * Component definition for ToggleButton\n * @public\n */\nexport const ToggleButtonDefinition = {\n classNames: {\n root: 'bui-ToggleButton',\n content: 'bui-ToggleButtonContent',\n },\n dataAttributes: {\n size: ['small', 'medium'] as const,\n },\n} as const satisfies ComponentDefinition;\n"],"names":[],"mappings":"AAsBO,MAAM,sBAAA,GAAyB;AAAA,EACpC,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,kBAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,IAAA,EAAM,CAAC,OAAA,EAAS,QAAQ;AAAA;AAE5B;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/ToggleButton/definition.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { ToggleButtonOwnProps } from './types';\nimport styles from './ToggleButton.module.css';\n\n/**\n * Component definition for ToggleButton\n * @public\n */\nexport const ToggleButtonDefinition = defineComponent<ToggleButtonOwnProps>()({\n styles,\n classNames: {\n root: 'bui-ToggleButton',\n content: 'bui-ToggleButtonContent',\n },\n propDefs: {\n size: { dataAttribute: true, default: 'small' },\n iconStart: {},\n iconEnd: {},\n children: {},\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;AAwBO,MAAM,sBAAA,GAAyB,iBAAsC,CAAE;AAAA,EAC5E,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,kBAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,WAAW,EAAC;AAAA,IACZ,SAAS,EAAC;AAAA,IACV,UAAU,EAAC;AAAA,IACX,WAAW;AAAC;AAEhB,CAAC;;;;"}
@@ -1,30 +1,17 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import clsx from 'clsx';
3
2
  import { forwardRef } from 'react';
4
3
  import { ToggleButtonGroup as ToggleButtonGroup$1 } from 'react-aria-components';
5
- import { useStyles } from '../../hooks/useStyles.esm.js';
4
+ import { useDefinition } from '../../hooks/useDefinition/useDefinition.esm.js';
6
5
  import { ToggleButtonGroupDefinition } from './definition.esm.js';
7
- import styles from './ToggleButtonGroup.module.css.esm.js';
8
6
 
9
7
  const ToggleButtonGroup = forwardRef(
10
8
  (props, ref) => {
11
- const { classNames, dataAttributes, cleanedProps } = useStyles(
9
+ const { ownProps, restProps } = useDefinition(
12
10
  ToggleButtonGroupDefinition,
13
- {
14
- ...props
15
- }
16
- );
17
- const { className, children, ...rest } = cleanedProps;
18
- return /* @__PURE__ */ jsx(
19
- ToggleButtonGroup$1,
20
- {
21
- className: clsx(classNames.root, styles[classNames.root], className),
22
- ref,
23
- ...dataAttributes,
24
- ...rest,
25
- children
26
- }
11
+ props
27
12
  );
13
+ const { classes, children } = ownProps;
14
+ return /* @__PURE__ */ jsx(ToggleButtonGroup$1, { className: classes.root, ref, ...restProps, children });
28
15
  }
29
16
  );
30
17
  ToggleButtonGroup.displayName = "ToggleButtonGroup";
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleButtonGroup.esm.js","sources":["../../../src/components/ToggleButtonGroup/ToggleButtonGroup.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 clsx from 'clsx';\nimport { forwardRef, Ref } from 'react';\nimport { ToggleButtonGroup as AriaToggleButtonGroup } from 'react-aria-components';\nimport type { ToggleButtonGroupProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport { ToggleButtonGroupDefinition } from './definition';\nimport styles from './ToggleButtonGroup.module.css';\n\n/** @public */\nexport const ToggleButtonGroup = forwardRef(\n (props: ToggleButtonGroupProps, ref: Ref<HTMLDivElement>) => {\n const { classNames, dataAttributes, cleanedProps } = useStyles(\n ToggleButtonGroupDefinition,\n {\n ...props,\n },\n );\n\n const { className, children, ...rest } = cleanedProps;\n\n return (\n <AriaToggleButtonGroup\n className={clsx(classNames.root, styles[classNames.root], className)}\n ref={ref}\n {...dataAttributes}\n {...rest}\n >\n {children}\n </AriaToggleButtonGroup>\n );\n },\n);\n\nToggleButtonGroup.displayName = 'ToggleButtonGroup';\n"],"names":["AriaToggleButtonGroup"],"mappings":";;;;;;;;AAyBO,MAAM,iBAAA,GAAoB,UAAA;AAAA,EAC/B,CAAC,OAA+B,GAAA,KAA6B;AAC3D,IAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,YAAA,EAAa,GAAI,SAAA;AAAA,MACnD,2BAAA;AAAA,MACA;AAAA,QACE,GAAG;AAAA;AACL,KACF;AAEA,IAAA,MAAM,EAAE,SAAA,EAAW,QAAA,EAAU,GAAG,MAAK,GAAI,YAAA;AAEzC,IAAA,uBACE,GAAA;AAAA,MAACA,mBAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,KAAK,UAAA,CAAW,IAAA,EAAM,OAAO,UAAA,CAAW,IAAI,GAAG,SAAS,CAAA;AAAA,QACnE,GAAA;AAAA,QACC,GAAG,cAAA;AAAA,QACH,GAAG,IAAA;AAAA,QAEH;AAAA;AAAA,KACH;AAAA,EAEJ;AACF;AAEA,iBAAA,CAAkB,WAAA,GAAc,mBAAA;;;;"}
1
+ {"version":3,"file":"ToggleButtonGroup.esm.js","sources":["../../../src/components/ToggleButtonGroup/ToggleButtonGroup.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 { forwardRef, Ref } from 'react';\nimport { ToggleButtonGroup as AriaToggleButtonGroup } from 'react-aria-components';\nimport type { ToggleButtonGroupProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { ToggleButtonGroupDefinition } from './definition';\n\n/** @public */\nexport const ToggleButtonGroup = forwardRef(\n (props: ToggleButtonGroupProps, ref: Ref<HTMLDivElement>) => {\n const { ownProps, restProps } = useDefinition(\n ToggleButtonGroupDefinition,\n props,\n );\n const { classes, children } = ownProps;\n\n return (\n <AriaToggleButtonGroup className={classes.root} ref={ref} {...restProps}>\n {children}\n </AriaToggleButtonGroup>\n );\n },\n);\n\nToggleButtonGroup.displayName = 'ToggleButtonGroup';\n"],"names":["AriaToggleButtonGroup"],"mappings":";;;;;;AAuBO,MAAM,iBAAA,GAAoB,UAAA;AAAA,EAC/B,CAAC,OAA+B,GAAA,KAA6B;AAC3D,IAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAU,GAAI,aAAA;AAAA,MAC9B,2BAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAS,GAAI,QAAA;AAE9B,IAAA,uBACE,GAAA,CAACA,uBAAsB,SAAA,EAAW,OAAA,CAAQ,MAAM,GAAA,EAAW,GAAG,WAC3D,QAAA,EACH,CAAA;AAAA,EAEJ;AACF;AAEA,iBAAA,CAAkB,WAAA,GAAc,mBAAA;;;;"}
@@ -1,11 +1,21 @@
1
- const ToggleButtonGroupDefinition = {
1
+ import 'react/jsx-runtime';
2
+ import 'clsx';
3
+ import '../../hooks/useBreakpoint.esm.js';
4
+ import '../../hooks/useBg.esm.js';
5
+ import '../../hooks/useDefinition/helpers.esm.js';
6
+ import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
7
+ import styles from './ToggleButtonGroup.module.css.esm.js';
8
+
9
+ const ToggleButtonGroupDefinition = defineComponent()({
10
+ styles,
2
11
  classNames: {
3
12
  root: "bui-ToggleButtonGroup"
4
13
  },
5
- dataAttributes: {
6
- orientation: ["horizontal", "vertical"]
14
+ propDefs: {
15
+ className: {},
16
+ children: {}
7
17
  }
8
- };
18
+ });
9
19
 
10
20
  export { ToggleButtonGroupDefinition };
11
21
  //# sourceMappingURL=definition.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/ToggleButtonGroup/definition.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ComponentDefinition } from '../../types';\n\n/**\n * Component definition for ToggleButtonGroup\n * @public\n */\nexport const ToggleButtonGroupDefinition = {\n classNames: {\n root: 'bui-ToggleButtonGroup',\n },\n dataAttributes: {\n orientation: ['horizontal', 'vertical'] as const,\n },\n} as const satisfies ComponentDefinition;\n"],"names":[],"mappings":"AAsBO,MAAM,2BAAA,GAA8B;AAAA,EACzC,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,WAAA,EAAa,CAAC,YAAA,EAAc,UAAU;AAAA;AAE1C;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/ToggleButtonGroup/definition.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { ToggleButtonGroupOwnProps } from './types';\nimport styles from './ToggleButtonGroup.module.css';\n\n/**\n * Component definition for ToggleButtonGroup\n * @public\n */\nexport const ToggleButtonGroupDefinition =\n defineComponent<ToggleButtonGroupOwnProps>()({\n styles,\n classNames: {\n root: 'bui-ToggleButtonGroup',\n },\n propDefs: {\n className: {},\n children: {},\n },\n });\n"],"names":[],"mappings":";;;;;;;;AAwBO,MAAM,2BAAA,GACX,iBAA2C,CAAE;AAAA,EAC3C,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,UAAU;AAAC;AAEf,CAAC;;;;"}
@@ -1,10 +1,12 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { forwardRef } from 'react';
3
+ import { useId } from 'react-aria';
3
4
  import { Tooltip as Tooltip$1, OverlayArrow, TooltipTrigger as TooltipTrigger$1 } from 'react-aria-components';
4
- import clsx from 'clsx';
5
- import { useStyles } from '../../hooks/useStyles.esm.js';
5
+ import { useDefinition } from '../../hooks/useDefinition/useDefinition.esm.js';
6
6
  import { TooltipDefinition } from './definition.esm.js';
7
- import styles from './Tooltip.module.css.esm.js';
7
+ import { Box } from '../Box/Box.esm.js';
8
+ import '../Box/Box.module.css.esm.js';
9
+ import { BgReset } from '../../hooks/useBg.esm.js';
8
10
 
9
11
  const TooltipTrigger = (props) => {
10
12
  const { delay = 600 } = props;
@@ -12,33 +14,25 @@ const TooltipTrigger = (props) => {
12
14
  };
13
15
  const Tooltip = forwardRef(
14
16
  (props, ref) => {
15
- const { classNames, cleanedProps } = useStyles(TooltipDefinition, props);
16
- const { className, children, ...rest } = cleanedProps;
17
- return /* @__PURE__ */ jsxs(
18
- Tooltip$1,
19
- {
20
- className: clsx(
21
- classNames.tooltip,
22
- styles[classNames.tooltip],
23
- className
24
- ),
25
- ...rest,
26
- ref,
27
- children: [
28
- /* @__PURE__ */ jsx(
29
- OverlayArrow,
30
- {
31
- className: clsx(classNames.arrow, styles[classNames.arrow]),
32
- children: /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
33
- /* @__PURE__ */ jsx("path", { d: "M10.3356 7.39793L15.1924 3.02682C15.9269 2.36577 16.8801 2 17.8683 2H20V7.94781e-07L1.74846e-07 -9.53674e-07L0 2L1.4651 2C2.4532 2 3.4064 2.36577 4.1409 3.02682L8.9977 7.39793C9.378 7.7402 9.9553 7.74021 10.3356 7.39793Z" }),
34
- /* @__PURE__ */ jsx("path", { d: "M11.0046 8.14124C10.2439 8.82575 9.08939 8.82578 8.32869 8.14122L3.47189 3.77011C2.92109 3.27432 2.20619 2.99999 1.46509 2.99999L4.10999 3L8.99769 7.39793C9.37799 7.7402 9.95529 7.7402 10.3356 7.39793L15.2226 3L17.8683 2.99999C17.1271 2.99999 16.4122 3.27432 15.8614 3.77011L11.0046 8.14124Z" })
35
- ] })
36
- }
37
- ),
38
- children
39
- ]
40
- }
41
- );
17
+ const { ownProps, restProps } = useDefinition(TooltipDefinition, props);
18
+ const { classes, children } = ownProps;
19
+ const svgPathId = useId();
20
+ return /* @__PURE__ */ jsxs(Tooltip$1, { className: classes.tooltip, ...restProps, ref, children: [
21
+ /* @__PURE__ */ jsx(OverlayArrow, { className: classes.arrow, children: /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
22
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx(
23
+ "path",
24
+ {
25
+ id: svgPathId,
26
+ fillRule: "evenodd",
27
+ 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 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"
28
+ }
29
+ ) }),
30
+ /* @__PURE__ */ jsx("use", { href: `#${svgPathId}` }),
31
+ /* @__PURE__ */ jsx("use", { href: `#${svgPathId}` }),
32
+ /* @__PURE__ */ jsx("path", { d: "M11.0046 8.14124C10.2439 8.82575 9.08939 8.82578 8.32869 8.14122L3.47189 3.77011C2.92109 3.27432 2.20619 2.99999 1.46509 2.99999L4.10999 3L8.99769 7.39793C9.37799 7.7402 9.95529 7.7402 10.3356 7.39793L15.2226 3L17.8683 2.99999C17.1271 2.99999 16.4122 3.27432 15.8614 3.77011L11.0046 8.14124Z" })
33
+ ] }) }),
34
+ /* @__PURE__ */ jsx(BgReset, { children: /* @__PURE__ */ jsx(Box, { bg: "neutral", className: classes.content, children }) })
35
+ ] });
42
36
  }
43
37
  );
44
38
  Tooltip.displayName = "Tooltip";
@@ -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 { 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;;;;"}
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 { useId } from 'react-aria';\nimport {\n OverlayArrow,\n Tooltip as AriaTooltip,\n TooltipTrigger as AriaTooltipTrigger,\n TooltipTriggerComponentProps,\n} from 'react-aria-components';\nimport type { TooltipProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TooltipDefinition } from './definition';\nimport { Box } from '../Box';\nimport { BgReset } from '../../hooks/useBg';\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 { ownProps, restProps } = useDefinition(TooltipDefinition, props);\n const { classes, children } = ownProps;\n const svgPathId = useId();\n\n return (\n <AriaTooltip className={classes.tooltip} {...restProps} ref={ref}>\n <OverlayArrow className={classes.arrow}>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\">\n <defs>\n <path\n id={svgPathId}\n fillRule=\"evenodd\"\n 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 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 />\n </defs>\n\n <use href={`#${svgPathId}`} />\n <use href={`#${svgPathId}`} />\n\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 <BgReset>\n <Box bg=\"neutral\" className={classes.content}>\n {children}\n </Box>\n </BgReset>\n </AriaTooltip>\n );\n },\n);\n\nTooltip.displayName = 'Tooltip';\n"],"names":["AriaTooltipTrigger","AriaTooltip"],"mappings":";;;;;;;;;;AA+BO,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,QAAA,EAAU,SAAA,EAAU,GAAI,aAAA,CAAc,mBAAmB,KAAK,CAAA;AACtE,IAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAS,GAAI,QAAA;AAC9B,IAAA,MAAM,YAAY,KAAA,EAAM;AAExB,IAAA,4BACGC,SAAA,EAAA,EAAY,SAAA,EAAW,QAAQ,OAAA,EAAU,GAAG,WAAW,GAAA,EACtD,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,YAAA,EAAA,EAAa,SAAA,EAAW,OAAA,CAAQ,KAAA,EAC/B,QAAA,kBAAA,IAAA,CAAC,KAAA,EAAA,EAAI,KAAA,EAAM,IAAA,EAAK,MAAA,EAAO,IAAA,EAAK,OAAA,EAAQ,WAAA,EAAY,MAAK,MAAA,EACnD,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,MAAA,EAAA,EACC,QAAA,kBAAA,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,EAAA,EAAI,SAAA;AAAA,YACJ,QAAA,EAAS,SAAA;AAAA,YACT,CAAA,EAAE;AAAA;AAAA,SACJ,EACF,CAAA;AAAA,wBAEA,GAAA,CAAC,KAAA,EAAA,EAAI,IAAA,EAAM,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA,EAAI,CAAA;AAAA,wBAC5B,GAAA,CAAC,KAAA,EAAA,EAAI,IAAA,EAAM,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA,EAAI,CAAA;AAAA,wBAE5B,GAAA,CAAC,MAAA,EAAA,EAAK,CAAA,EAAE,qSAAA,EAAsS;AAAA,OAAA,EAChT,CAAA,EACF,CAAA;AAAA,sBACA,GAAA,CAAC,OAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAI,EAAA,EAAG,WAAU,SAAA,EAAW,OAAA,CAAQ,OAAA,EAClC,QAAA,EACH,CAAA,EACF;AAAA,KAAA,EACF,CAAA;AAAA,EAEJ;AACF;AAEA,OAAA,CAAQ,WAAA,GAAc,SAAA;;;;"}
@@ -1,7 +1,7 @@
1
1
  import styleInject from '../../node_modules_dist/style-inject/dist/style-inject.es.esm.js';
2
2
 
3
- var css_248z = "/*\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\n@layer tokens, base, components, utilities;\n\n@layer components {\n .Tooltip_bui-Tooltip__fd7a4c2f9a {\n box-shadow: var(--bui-shadow);\n border-radius: 4px;\n background: var(--bui-bg-popover);\n border: 1px solid var(--bui-border-1);\n forced-color-adjust: none;\n outline: none;\n padding: var(--bui-space-2) var(--bui-space-3);\n max-width: 240px;\n /* fixes FF gap */\n transform: translate3d(0, 0, 0);\n transition: transform 200ms, opacity 200ms;\n font-size: var(--bui-font-size-3);\n font-family: var(--bui-font-regular);\n color: var(--bui-fg-primary);\n\n &[data-entering],\n &[data-exiting] {\n transform: var(--origin);\n opacity: 0;\n }\n\n --tooltip-offset: var(--bui-space-3);\n\n &[data-placement='top'] {\n margin-bottom: var(--tooltip-offset);\n --origin: translateY(4px);\n }\n\n &[data-placement='right'] {\n margin-left: var(--tooltip-offset);\n --origin: translateX(-4px);\n }\n\n &[data-placement='bottom'] {\n margin-top: var(--tooltip-offset);\n --origin: translateY(-4px);\n }\n\n &[data-placement='left'] {\n margin-right: var(--tooltip-offset);\n --origin: translateX(4px);\n }\n }\n\n .Tooltip_bui-TooltipArrow__fd7a4c2f9a {\n & svg {\n display: block;\n\n /* The tooltip is rendered overlaying the main\n tooltip element by 1px. This causes the borders\n to overlap, which causes minor visual artifacts\n with transparent border colors. To mitigate this,\n we split the stroke and fill across separate\n elements in order to guarantee that the stroke is\n always overlaying a consistent color. */\n path:nth-child(1) {\n fill: var(--bui-bg-popover);\n }\n\n path:nth-child(2) {\n fill: var(--bui-border-1);\n }\n\n /* The arrow svg overlaps the tooltip by 2px, so we\n need to adjust the margins accordingly. */\n --tooltip-arrow-overlap: -2px;\n }\n\n &[data-placement='top'] svg {\n margin-top: var(--tooltip-arrow-overlap);\n }\n\n &[data-placement='bottom'] svg {\n margin-bottom: var(--tooltip-arrow-overlap);\n transform: rotate(180deg);\n }\n\n &[data-placement='right'] svg {\n margin-right: var(--tooltip-arrow-overlap);\n transform: rotate(90deg);\n }\n\n &[data-placement='left'] svg {\n margin-left: var(--tooltip-arrow-overlap);\n transform: rotate(-90deg);\n }\n }\n}\n";
4
- var styles = {"bui-Tooltip":"Tooltip_bui-Tooltip__fd7a4c2f9a","bui-TooltipArrow":"Tooltip_bui-TooltipArrow__fd7a4c2f9a"};
3
+ var css_248z = "/*\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\n@layer tokens, base, components, utilities;\n\n@layer components {\n .Tooltip_bui-Tooltip__9a58b614bf {\n --tooltip-border-radius: 4px;\n box-shadow: var(--bui-shadow);\n border-radius: var(--tooltip-border-radius);\n background: var(--bui-bg-app);\n border: 1px solid var(--bui-border-1);\n forced-color-adjust: none;\n outline: none;\n max-width: 240px;\n /* fixes FF gap */\n transform: translate3d(0, 0, 0);\n transition: transform 200ms, opacity 200ms;\n font-size: var(--bui-font-size-3);\n font-family: var(--bui-font-regular);\n color: var(--bui-fg-primary);\n\n &[data-entering],\n &[data-exiting] {\n transform: var(--origin);\n opacity: 0;\n }\n\n --tooltip-offset: var(--bui-space-3);\n\n &[data-placement='top'] {\n margin-bottom: var(--tooltip-offset);\n --origin: translateY(4px);\n }\n\n &[data-placement='right'] {\n margin-left: var(--tooltip-offset);\n --origin: translateX(-4px);\n }\n\n &[data-placement='bottom'] {\n margin-top: var(--tooltip-offset);\n --origin: translateY(-4px);\n }\n\n &[data-placement='left'] {\n margin-right: var(--tooltip-offset);\n --origin: translateX(4px);\n }\n }\n\n .Tooltip_bui-TooltipContent__9a58b614bf {\n padding: var(--bui-space-2) var(--bui-space-3);\n border-radius: var(--tooltip-border-radius);\n }\n\n .Tooltip_bui-TooltipArrow__9a58b614bf {\n & svg {\n display: block;\n\n /* The tooltip is rendered overlaying the main\n tooltip element by 1px. This causes the borders\n to overlap, which causes minor visual artifacts\n with transparent border colors. To mitigate this,\n we split the stroke and fill across separate\n elements in order to guarantee that the stroke is\n always overlaying a consistent color. */\n use:nth-of-type(1) {\n fill: var(--bui-bg-app);\n }\n use:nth-of-type(2) {\n fill: var(--bui-bg-neutral-1);\n }\n\n path {\n fill: var(--bui-border-1);\n }\n\n /* The arrow svg overlaps the tooltip by 2px, so we\n need to adjust the margins accordingly. */\n --tooltip-arrow-overlap: -2px;\n }\n\n &[data-placement='top'] svg {\n margin-top: var(--tooltip-arrow-overlap);\n }\n\n &[data-placement='bottom'] svg {\n margin-bottom: var(--tooltip-arrow-overlap);\n transform: rotate(180deg);\n }\n\n &[data-placement='right'] svg {\n margin-right: var(--tooltip-arrow-overlap);\n transform: rotate(90deg);\n }\n\n &[data-placement='left'] svg {\n margin-left: var(--tooltip-arrow-overlap);\n transform: rotate(-90deg);\n }\n }\n}\n";
4
+ var styles = {"bui-Tooltip":"Tooltip_bui-Tooltip__9a58b614bf","bui-TooltipContent":"Tooltip_bui-TooltipContent__9a58b614bf","bui-TooltipArrow":"Tooltip_bui-TooltipArrow__9a58b614bf"};
5
5
  styleInject(css_248z);
6
6
 
7
7
  export { styles as default };
@@ -1,9 +1,23 @@
1
- const TooltipDefinition = {
1
+ import 'react/jsx-runtime';
2
+ import 'clsx';
3
+ import '../../hooks/useBreakpoint.esm.js';
4
+ import '../../hooks/useBg.esm.js';
5
+ import '../../hooks/useDefinition/helpers.esm.js';
6
+ import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
7
+ import styles from './Tooltip.module.css.esm.js';
8
+
9
+ const TooltipDefinition = defineComponent()({
10
+ styles,
2
11
  classNames: {
3
12
  tooltip: "bui-Tooltip",
13
+ content: "bui-TooltipContent",
4
14
  arrow: "bui-TooltipArrow"
15
+ },
16
+ propDefs: {
17
+ children: {},
18
+ className: {}
5
19
  }
6
- };
20
+ });
7
21
 
8
22
  export { TooltipDefinition };
9
23
  //# sourceMappingURL=definition.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Tooltip/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport 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
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Tooltip/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { TooltipOwnProps } from './types';\nimport styles from './Tooltip.module.css';\n\n/**\n * Component definition for Tooltip\n * @public\n */\nexport const TooltipDefinition = defineComponent<TooltipOwnProps>()({\n styles,\n classNames: {\n tooltip: 'bui-Tooltip',\n content: 'bui-TooltipContent',\n arrow: 'bui-TooltipArrow',\n },\n propDefs: {\n children: {},\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;AAwBO,MAAM,iBAAA,GAAoB,iBAAiC,CAAE;AAAA,EAClE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,OAAA,EAAS,aAAA;AAAA,IACT,OAAA,EAAS,oBAAA;AAAA,IACT,KAAA,EAAO;AAAA,GACT;AAAA,EACA,QAAA,EAAU;AAAA,IACR,UAAU,EAAC;AAAA,IACX,WAAW;AAAC;AAEhB,CAAC;;;;"}
@@ -1,22 +1,14 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { useStyles } from '../../hooks/useStyles.esm.js';
2
+ import { useDefinition } from '../../hooks/useDefinition/useDefinition.esm.js';
3
3
  import { VisuallyHiddenDefinition } from './definition.esm.js';
4
- import styles from './VisuallyHidden.module.css.esm.js';
5
- import clsx from 'clsx';
6
4
 
7
5
  const VisuallyHidden = (props) => {
8
- const { classNames, cleanedProps } = useStyles(
6
+ const { ownProps, restProps } = useDefinition(
9
7
  VisuallyHiddenDefinition,
10
8
  props
11
9
  );
12
- const { className, ...rest } = cleanedProps;
13
- return /* @__PURE__ */ jsx(
14
- "div",
15
- {
16
- className: clsx(classNames.root, styles[classNames.root], className),
17
- ...rest
18
- }
19
- );
10
+ const { classes } = ownProps;
11
+ return /* @__PURE__ */ jsx("div", { className: classes.root, ...restProps });
20
12
  };
21
13
 
22
14
  export { VisuallyHidden };
@@ -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 { 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;;;;"}
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 { useDefinition } from '../../hooks/useDefinition';\nimport { VisuallyHiddenDefinition } from './definition';\nimport { VisuallyHiddenProps } from './types';\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 { ownProps, restProps } = useDefinition(\n VisuallyHiddenDefinition,\n props,\n );\n const { classes } = ownProps;\n\n return <div className={classes.root} {...restProps} />;\n};\n"],"names":[],"mappings":";;;;AA6BO,MAAM,cAAA,GAAiB,CAAC,KAAA,KAA+B;AAC5D,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAU,GAAI,aAAA;AAAA,IAC9B,wBAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,MAAM,EAAE,SAAQ,GAAI,QAAA;AAEpB,EAAA,2BAAQ,KAAA,EAAA,EAAI,SAAA,EAAW,OAAA,CAAQ,IAAA,EAAO,GAAG,SAAA,EAAW,CAAA;AACtD;;;;"}
@@ -1,8 +1,20 @@
1
- const VisuallyHiddenDefinition = {
1
+ import 'react/jsx-runtime';
2
+ import 'clsx';
3
+ import '../../hooks/useBreakpoint.esm.js';
4
+ import '../../hooks/useBg.esm.js';
5
+ import '../../hooks/useDefinition/helpers.esm.js';
6
+ import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
7
+ import styles from './VisuallyHidden.module.css.esm.js';
8
+
9
+ const VisuallyHiddenDefinition = defineComponent()({
10
+ styles,
2
11
  classNames: {
3
12
  root: "bui-VisuallyHidden"
13
+ },
14
+ propDefs: {
15
+ className: {}
4
16
  }
5
- };
17
+ });
6
18
 
7
19
  export { VisuallyHiddenDefinition };
8
20
  //# sourceMappingURL=definition.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/VisuallyHidden/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport 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
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/VisuallyHidden/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { VisuallyHiddenOwnProps } from './types';\nimport styles from './VisuallyHidden.module.css';\n\n/**\n * Component definition for VisuallyHidden\n * @public\n */\nexport const VisuallyHiddenDefinition =\n defineComponent<VisuallyHiddenOwnProps>()({\n styles,\n classNames: {\n root: 'bui-VisuallyHidden',\n },\n propDefs: {\n className: {},\n },\n });\n"],"names":[],"mappings":";;;;;;;;AAwBO,MAAM,wBAAA,GACX,iBAAwC,CAAE;AAAA,EACxC,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW;AAAC;AAEhB,CAAC;;;;"}
@@ -96,11 +96,10 @@
96
96
 
97
97
  /* Neutral background colors */
98
98
  --bui-bg-app: #f8f8f8;
99
- --bui-bg-popover: #ffffff;
100
99
 
101
100
  --bui-bg-neutral-1: #fff;
102
- --bui-bg-neutral-1-hover: oklch(0% 0 0 / 12%);
103
- --bui-bg-neutral-1-pressed: oklch(0% 0 0 / 16%);
101
+ --bui-bg-neutral-1-hover: oklch(0% 0 0 / 6%);
102
+ --bui-bg-neutral-1-pressed: oklch(0% 0 0 / 12%);
104
103
  --bui-bg-neutral-1-disabled: oklch(0% 0 0 / 6%);
105
104
 
106
105
  --bui-bg-neutral-2: oklch(0% 0 0 / 6%);
@@ -171,7 +170,6 @@
171
170
 
172
171
  /* Neutral background colors */
173
172
  --bui-bg-app: #333333;
174
- --bui-bg-popover: #1a1a1a;
175
173
 
176
174
  --bui-bg-neutral-1: oklch(100% 0 0 / 10%);
177
175
  --bui-bg-neutral-1-hover: oklch(100% 0 0 / 14%);
@@ -15,6 +15,15 @@ function incrementNeutralBg(bg) {
15
15
  const BgProvider = ({ bg, children }) => {
16
16
  return /* @__PURE__ */ jsx(BgContext.Provider, { value: createVersionedValueMap({ 1: { bg } }), children });
17
17
  };
18
+ const BgReset = ({ children }) => {
19
+ return /* @__PURE__ */ jsx(
20
+ BgContext.Provider,
21
+ {
22
+ value: createVersionedValueMap({ 1: { bg: void 0 } }),
23
+ children
24
+ }
25
+ );
26
+ };
18
27
  function useBgConsumer() {
19
28
  const value = useContext(BgContext)?.atVersion(1);
20
29
  return value ?? { bg: void 0 };
@@ -26,11 +35,11 @@ function useBgProvider(bg) {
26
35
  return { bg: void 0 };
27
36
  }
28
37
  const resolved = resolveResponsiveValue(bg, breakpoint);
29
- if (resolved === "neutral-auto") {
38
+ if (resolved === "neutral") {
30
39
  return { bg: incrementNeutralBg(context.bg) };
31
40
  }
32
41
  return { bg: resolved };
33
42
  }
34
43
 
35
- export { BgProvider, useBgConsumer, useBgProvider };
44
+ export { BgProvider, BgReset, useBgConsumer, useBgProvider };
36
45
  //# sourceMappingURL=useBg.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useBg.esm.js","sources":["../../src/hooks/useBg.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 { useContext, ReactNode } from 'react';\nimport {\n createVersionedContext,\n createVersionedValueMap,\n} from '@backstage/version-bridge';\nimport { ContainerBg, ProviderBg, Responsive } from '../types';\nimport { useBreakpoint } from './useBreakpoint';\nimport { resolveResponsiveValue } from './useDefinition/helpers';\n\n/** @public */\nexport interface BgContextValue {\n bg: ContainerBg | undefined;\n}\n\n/** @public */\nexport interface BgProviderProps {\n bg: ContainerBg;\n children: ReactNode;\n}\n\nconst BgContext = createVersionedContext<{\n 1: BgContextValue;\n}>('bg-context');\n\n/**\n * Increments a neutral bg level by one, capping at 'neutral-3'.\n * Intent backgrounds (danger, warning, success) pass through unchanged.\n *\n * The 'neutral-4' level is reserved for consumer component CSS and is\n * never set on providers.\n *\n * @internal\n */\nfunction incrementNeutralBg(bg: ContainerBg | undefined): ContainerBg {\n if (!bg) return 'neutral-1';\n if (bg === 'neutral-1') return 'neutral-2';\n if (bg === 'neutral-2') return 'neutral-3';\n if (bg === 'neutral-3') return 'neutral-3'; // capped at neutral-3\n // Intent values pass through unchanged\n return bg;\n}\n\n/**\n * Provider component that establishes the bg context for child components.\n *\n * @public\n */\nexport const BgProvider = ({ bg, children }: BgProviderProps) => {\n return (\n <BgContext.Provider value={createVersionedValueMap({ 1: { bg } })}>\n {children}\n </BgContext.Provider>\n );\n};\n\n/**\n * Hook for consumer components (e.g. Button) to read the parent bg context.\n *\n * Returns the parent container's bg unchanged. The consumer component's CSS\n * handles the visual step-up (e.g. on a neutral-1 surface, the consumer\n * uses neutral-2 tokens via `data-on-bg`).\n *\n * @public\n */\nexport function useBgConsumer(): BgContextValue {\n const value = useContext(BgContext)?.atVersion(1);\n return value ?? { bg: undefined };\n}\n\n/**\n * Hook for provider components (e.g. Box, Card) to resolve and provide bg context.\n *\n * **Resolution rules:**\n *\n * - `bg` is `undefined` -- transparent, no context change, returns `{ bg: undefined }`.\n * This is the default for Box, Flex, and Grid (they do **not** auto-increment).\n * - `bg` is a `ContainerBg` value -- uses that value directly (e.g. `'neutral-1'`).\n * - `bg` is `'neutral-auto'` -- increments the neutral level from the parent context,\n * capping at `neutral-3`. Only components that explicitly pass `'neutral-auto'`\n * (e.g. Card) will auto-increment; it is never implicit.\n *\n * **Capping:**\n *\n * Provider components cap at `neutral-3`. The `neutral-4` level is **not** a valid\n * prop value -- it exists only in consumer component CSS (e.g. a Button on a\n * `neutral-3` surface renders with `neutral-4` tokens via `data-on-bg`).\n *\n * The caller is responsible for wrapping children with `BgProvider` when the\n * resolved bg is defined.\n *\n * @public\n */\nexport function useBgProvider(bg?: Responsive<ProviderBg>): BgContextValue {\n const { breakpoint } = useBreakpoint();\n const context = useBgConsumer();\n\n if (bg === undefined) {\n return { bg: undefined };\n }\n\n const resolved = resolveResponsiveValue(bg, breakpoint);\n\n if (resolved === 'neutral-auto') {\n return { bg: incrementNeutralBg(context.bg) };\n }\n\n return { bg: resolved };\n}\n"],"names":[],"mappings":";;;;;;AAoCA,MAAM,SAAA,GAAY,uBAEf,YAAY,CAAA;AAWf,SAAS,mBAAmB,EAAA,EAA0C;AACpE,EAAA,IAAI,CAAC,IAAI,OAAO,WAAA;AAChB,EAAA,IAAI,EAAA,KAAO,aAAa,OAAO,WAAA;AAC/B,EAAA,IAAI,EAAA,KAAO,aAAa,OAAO,WAAA;AAC/B,EAAA,IAAI,EAAA,KAAO,aAAa,OAAO,WAAA;AAE/B,EAAA,OAAO,EAAA;AACT;AAOO,MAAM,UAAA,GAAa,CAAC,EAAE,EAAA,EAAI,UAAS,KAAuB;AAC/D,EAAA,uBACE,GAAA,CAAC,SAAA,CAAU,QAAA,EAAV,EAAmB,KAAA,EAAO,uBAAA,CAAwB,EAAE,CAAA,EAAG,EAAE,EAAA,EAAG,EAAG,GAC7D,QAAA,EACH,CAAA;AAEJ;AAWO,SAAS,aAAA,GAAgC;AAC9C,EAAA,MAAM,KAAA,GAAQ,UAAA,CAAW,SAAS,CAAA,EAAG,UAAU,CAAC,CAAA;AAChD,EAAA,OAAO,KAAA,IAAS,EAAE,EAAA,EAAI,MAAA,EAAU;AAClC;AAyBO,SAAS,cAAc,EAAA,EAA6C;AACzE,EAAA,MAAM,EAAE,UAAA,EAAW,GAAI,aAAA,EAAc;AACrC,EAAA,MAAM,UAAU,aAAA,EAAc;AAE9B,EAAA,IAAI,OAAO,MAAA,EAAW;AACpB,IAAA,OAAO,EAAE,IAAI,MAAA,EAAU;AAAA,EACzB;AAEA,EAAA,MAAM,QAAA,GAAW,sBAAA,CAAuB,EAAA,EAAI,UAAU,CAAA;AAEtD,EAAA,IAAI,aAAa,cAAA,EAAgB;AAC/B,IAAA,OAAO,EAAE,EAAA,EAAI,kBAAA,CAAmB,OAAA,CAAQ,EAAE,CAAA,EAAE;AAAA,EAC9C;AAEA,EAAA,OAAO,EAAE,IAAI,QAAA,EAAS;AACxB;;;;"}
1
+ {"version":3,"file":"useBg.esm.js","sources":["../../src/hooks/useBg.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 { useContext, ReactNode } from 'react';\nimport {\n createVersionedContext,\n createVersionedValueMap,\n} from '@backstage/version-bridge';\nimport { ContainerBg, ProviderBg, Responsive } from '../types';\nimport { useBreakpoint } from './useBreakpoint';\nimport { resolveResponsiveValue } from './useDefinition/helpers';\n\n/** @public */\nexport interface BgContextValue {\n bg: ContainerBg | undefined;\n}\n\n/** @public */\nexport interface BgProviderProps {\n bg: ContainerBg;\n children: ReactNode;\n}\n\nconst BgContext = createVersionedContext<{\n 1: BgContextValue;\n}>('bg-context');\n\n/**\n * Increments a neutral bg level by one, capping at 'neutral-3'.\n * Intent backgrounds (danger, warning, success) pass through unchanged.\n *\n * The 'neutral-4' level is reserved for consumer component CSS and is\n * never set on providers.\n *\n * @internal\n */\nfunction incrementNeutralBg(bg: ContainerBg | undefined): ContainerBg {\n if (!bg) return 'neutral-1';\n if (bg === 'neutral-1') return 'neutral-2';\n if (bg === 'neutral-2') return 'neutral-3';\n if (bg === 'neutral-3') return 'neutral-3'; // capped at neutral-3\n // Intent values pass through unchanged\n return bg;\n}\n\n/**\n * Provider component that establishes the bg context for child components.\n *\n * @public\n */\nexport const BgProvider = ({ bg, children }: BgProviderProps) => {\n return (\n <BgContext.Provider value={createVersionedValueMap({ 1: { bg } })}>\n {children}\n </BgContext.Provider>\n );\n};\n\n/**\n * Resets the bg context to undefined, cutting any inherited neutral chain.\n * Use this inside overlay components (Popover, Tooltip, Dialog, Menu) so\n * their content always starts from neutral-1 regardless of where the trigger\n * is placed in the tree.\n *\n * @internal\n */\nexport const BgReset = ({ children }: { children: ReactNode }) => {\n return (\n <BgContext.Provider\n value={createVersionedValueMap({ 1: { bg: undefined } })}\n >\n {children}\n </BgContext.Provider>\n );\n};\n\n/**\n * Hook for consumer components (e.g. Button) to read the parent bg context.\n *\n * Returns the parent container's bg unchanged. The consumer component's CSS\n * handles the visual step-up (e.g. on a neutral-1 surface, the consumer\n * uses neutral-2 tokens via `data-on-bg`).\n *\n * @public\n */\nexport function useBgConsumer(): BgContextValue {\n const value = useContext(BgContext)?.atVersion(1);\n return value ?? { bg: undefined };\n}\n\n/**\n * Hook for provider components (e.g. Box, Card) to resolve and provide bg context.\n *\n * **Resolution rules:**\n *\n * - `bg` is `undefined` -- transparent, no context change, returns `{ bg: undefined }`.\n * This is the default for Box, Flex, and Grid (they do **not** auto-increment).\n * - `bg` is `'neutral'` -- when the parent bg is neutral, increments the neutral\n * level from the parent context, capping at `neutral-3`. When the parent bg is\n * an intent (`'danger'` | `'warning'` | `'success'`), the intent passes through\n * unchanged (i.e. `bg: 'neutral'` does not override the parent intent). The\n * increment is always relative to the parent; it is not possible to pin a\n * container to an explicit neutral level.\n * - `bg` is `'danger'` | `'warning'` | `'success'` -- sets the bg to that intent\n * explicitly, regardless of the parent value.\n *\n * **Capping:**\n *\n * Provider components cap at `neutral-3`. The `neutral-4` level is **not** a valid\n * prop value -- it exists only in consumer component CSS (e.g. a Button on a\n * `neutral-3` surface renders with `neutral-4` tokens via `data-on-bg`).\n *\n * The caller is responsible for wrapping children with `BgProvider` when the\n * resolved bg is defined.\n *\n * @public\n */\nexport function useBgProvider(bg?: Responsive<ProviderBg>): BgContextValue {\n const { breakpoint } = useBreakpoint();\n const context = useBgConsumer();\n\n if (bg === undefined) {\n return { bg: undefined };\n }\n\n const resolved = resolveResponsiveValue(bg, breakpoint);\n\n if (resolved === 'neutral') {\n return { bg: incrementNeutralBg(context.bg) };\n }\n\n return { bg: resolved };\n}\n"],"names":[],"mappings":";;;;;;AAoCA,MAAM,SAAA,GAAY,uBAEf,YAAY,CAAA;AAWf,SAAS,mBAAmB,EAAA,EAA0C;AACpE,EAAA,IAAI,CAAC,IAAI,OAAO,WAAA;AAChB,EAAA,IAAI,EAAA,KAAO,aAAa,OAAO,WAAA;AAC/B,EAAA,IAAI,EAAA,KAAO,aAAa,OAAO,WAAA;AAC/B,EAAA,IAAI,EAAA,KAAO,aAAa,OAAO,WAAA;AAE/B,EAAA,OAAO,EAAA;AACT;AAOO,MAAM,UAAA,GAAa,CAAC,EAAE,EAAA,EAAI,UAAS,KAAuB;AAC/D,EAAA,uBACE,GAAA,CAAC,SAAA,CAAU,QAAA,EAAV,EAAmB,KAAA,EAAO,uBAAA,CAAwB,EAAE,CAAA,EAAG,EAAE,EAAA,EAAG,EAAG,GAC7D,QAAA,EACH,CAAA;AAEJ;AAUO,MAAM,OAAA,GAAU,CAAC,EAAE,QAAA,EAAS,KAA+B;AAChE,EAAA,uBACE,GAAA;AAAA,IAAC,SAAA,CAAU,QAAA;AAAA,IAAV;AAAA,MACC,KAAA,EAAO,wBAAwB,EAAE,CAAA,EAAG,EAAE,EAAA,EAAI,MAAA,IAAa,CAAA;AAAA,MAEtD;AAAA;AAAA,GACH;AAEJ;AAWO,SAAS,aAAA,GAAgC;AAC9C,EAAA,MAAM,KAAA,GAAQ,UAAA,CAAW,SAAS,CAAA,EAAG,UAAU,CAAC,CAAA;AAChD,EAAA,OAAO,KAAA,IAAS,EAAE,EAAA,EAAI,MAAA,EAAU;AAClC;AA6BO,SAAS,cAAc,EAAA,EAA6C;AACzE,EAAA,MAAM,EAAE,UAAA,EAAW,GAAI,aAAA,EAAc;AACrC,EAAA,MAAM,UAAU,aAAA,EAAc;AAE9B,EAAA,IAAI,OAAO,MAAA,EAAW;AACpB,IAAA,OAAO,EAAE,IAAI,MAAA,EAAU;AAAA,EACzB;AAEA,EAAA,MAAM,QAAA,GAAW,sBAAA,CAAuB,EAAA,EAAI,UAAU,CAAA;AAEtD,EAAA,IAAI,aAAa,SAAA,EAAW;AAC1B,IAAA,OAAO,EAAE,EAAA,EAAI,kBAAA,CAAmB,OAAA,CAAQ,EAAE,CAAA,EAAE;AAAA,EAC9C;AAEA,EAAA,OAAO,EAAE,IAAI,QAAA,EAAS;AACxB;;;;"}
@@ -1,4 +1,5 @@
1
- import { useMediaQuery } from './useMediaQuery.esm.js';
1
+ import { useMemo } from 'react';
2
+ import { useSyncExternalStore } from 'use-sync-external-store/shim';
2
3
 
3
4
  const breakpoints = [
4
5
  { name: "Initial", id: "initial", value: 0 },
@@ -8,35 +9,74 @@ const breakpoints = [
8
9
  { name: "Large", id: "lg", value: 1280 },
9
10
  { name: "Extra Large", id: "xl", value: 1536 }
10
11
  ];
11
- const useBreakpoint = () => {
12
- const matches = breakpoints.map((breakpoint2) => {
13
- return useMediaQuery(`(min-width: ${breakpoint2.value}px)`);
14
- });
15
- const upMatches = new Map(
16
- breakpoints.map((bp) => [bp.id, useMediaQuery(`(min-width: ${bp.value}px)`)])
17
- );
18
- const downMatches = new Map(
19
- breakpoints.map((bp) => [
20
- bp.id,
21
- useMediaQuery(`(max-width: ${bp.value - 1}px)`)
22
- ])
23
- );
24
- let breakpoint = breakpoints[0].id;
25
- for (let i = matches.length - 1; i >= 0; i--) {
26
- if (matches[i]) {
27
- breakpoint = breakpoints[i].id;
28
- break;
29
- }
12
+ const breakpointIndex = new Map(
13
+ breakpoints.map((bp, i) => [bp.id, i])
14
+ );
15
+ function bpIndex(key) {
16
+ return breakpointIndex.get(key) ?? 0;
17
+ }
18
+ const IS_SERVER = typeof window === "undefined" || typeof window.matchMedia === "undefined";
19
+ function computeBreakpoint() {
20
+ if (IS_SERVER) {
21
+ return "initial";
30
22
  }
31
- return {
32
- breakpoint,
33
- up: (key) => {
34
- return upMatches.get(key) ?? false;
35
- },
36
- down: (key) => {
37
- return downMatches.get(key) ?? false;
23
+ for (let i = breakpoints.length - 1; i >= 0; i--) {
24
+ if (window.matchMedia(`(min-width: ${breakpoints[i].value}px)`).matches) {
25
+ return breakpoints[i].id;
38
26
  }
27
+ }
28
+ return "initial";
29
+ }
30
+ let current;
31
+ const listeners = /* @__PURE__ */ new Set();
32
+ let initialized = false;
33
+ function ensureInitialized() {
34
+ if (initialized || IS_SERVER) {
35
+ return;
36
+ }
37
+ initialized = true;
38
+ current = computeBreakpoint();
39
+ for (const bp of breakpoints) {
40
+ const mql = window.matchMedia(`(min-width: ${bp.value}px)`);
41
+ mql.addEventListener("change", () => {
42
+ const next = computeBreakpoint();
43
+ if (next !== current) {
44
+ current = next;
45
+ for (const cb of listeners) {
46
+ cb();
47
+ }
48
+ }
49
+ });
50
+ }
51
+ }
52
+ function subscribe(callback) {
53
+ ensureInitialized();
54
+ listeners.add(callback);
55
+ return () => {
56
+ listeners.delete(callback);
39
57
  };
58
+ }
59
+ function getSnapshot() {
60
+ ensureInitialized();
61
+ return current ?? "initial";
62
+ }
63
+ function getServerSnapshot() {
64
+ return "initial";
65
+ }
66
+ const useBreakpoint = () => {
67
+ const breakpoint = useSyncExternalStore(
68
+ subscribe,
69
+ getSnapshot,
70
+ getServerSnapshot
71
+ );
72
+ return useMemo(
73
+ () => ({
74
+ breakpoint,
75
+ up: (key) => bpIndex(breakpoint) >= bpIndex(key),
76
+ down: (key) => bpIndex(breakpoint) < bpIndex(key)
77
+ }),
78
+ [breakpoint]
79
+ );
40
80
  };
41
81
 
42
82
  export { breakpoints, useBreakpoint };
@@ -1 +1 @@
1
- {"version":3,"file":"useBreakpoint.esm.js","sources":["../../src/hooks/useBreakpoint.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 { useMediaQuery } from './useMediaQuery';\nimport type { Breakpoint } from '../types';\n\nexport const breakpoints: { name: string; id: Breakpoint; value: number }[] = [\n { name: 'Initial', id: 'initial', value: 0 },\n { name: 'Extra Small', id: 'xs', value: 640 },\n { name: 'Small', id: 'sm', value: 768 },\n { name: 'Medium', id: 'md', value: 1024 },\n { name: 'Large', id: 'lg', value: 1280 },\n { name: 'Extra Large', id: 'xl', value: 1536 },\n];\n\n/** @public */\nexport const useBreakpoint = () => {\n // Call all media queries at the top level\n const matches = breakpoints.map(breakpoint => {\n return useMediaQuery(`(min-width: ${breakpoint.value}px)`);\n });\n\n // Pre-calculate all the up/down values we need\n const upMatches = new Map(\n breakpoints.map(bp => [bp.id, useMediaQuery(`(min-width: ${bp.value}px)`)]),\n );\n\n const downMatches = new Map(\n breakpoints.map(bp => [\n bp.id,\n useMediaQuery(`(max-width: ${bp.value - 1}px)`),\n ]),\n );\n\n let breakpoint: Breakpoint = breakpoints[0].id;\n for (let i = matches.length - 1; i >= 0; i--) {\n if (matches[i]) {\n breakpoint = breakpoints[i].id;\n break;\n }\n }\n\n return {\n breakpoint,\n up: (key: Breakpoint): boolean => {\n return upMatches.get(key) ?? false;\n },\n down: (key: Breakpoint): boolean => {\n return downMatches.get(key) ?? false;\n },\n };\n};\n"],"names":["breakpoint"],"mappings":";;AAkBO,MAAM,WAAA,GAAiE;AAAA,EAC5E,EAAE,IAAA,EAAM,SAAA,EAAW,EAAA,EAAI,SAAA,EAAW,OAAO,CAAA,EAAE;AAAA,EAC3C,EAAE,IAAA,EAAM,aAAA,EAAe,EAAA,EAAI,IAAA,EAAM,OAAO,GAAA,EAAI;AAAA,EAC5C,EAAE,IAAA,EAAM,OAAA,EAAS,EAAA,EAAI,IAAA,EAAM,OAAO,GAAA,EAAI;AAAA,EACtC,EAAE,IAAA,EAAM,QAAA,EAAU,EAAA,EAAI,IAAA,EAAM,OAAO,IAAA,EAAK;AAAA,EACxC,EAAE,IAAA,EAAM,OAAA,EAAS,EAAA,EAAI,IAAA,EAAM,OAAO,IAAA,EAAK;AAAA,EACvC,EAAE,IAAA,EAAM,aAAA,EAAe,EAAA,EAAI,IAAA,EAAM,OAAO,IAAA;AAC1C;AAGO,MAAM,gBAAgB,MAAM;AAEjC,EAAA,MAAM,OAAA,GAAU,WAAA,CAAY,GAAA,CAAI,CAAAA,WAAAA,KAAc;AAC5C,IAAA,OAAO,aAAA,CAAc,CAAA,YAAA,EAAeA,WAAAA,CAAW,KAAK,CAAA,GAAA,CAAK,CAAA;AAAA,EAC3D,CAAC,CAAA;AAGD,EAAA,MAAM,YAAY,IAAI,GAAA;AAAA,IACpB,WAAA,CAAY,GAAA,CAAI,CAAA,EAAA,KAAM,CAAC,EAAA,CAAG,EAAA,EAAI,aAAA,CAAc,CAAA,YAAA,EAAe,EAAA,CAAG,KAAK,CAAA,GAAA,CAAK,CAAC,CAAC;AAAA,GAC5E;AAEA,EAAA,MAAM,cAAc,IAAI,GAAA;AAAA,IACtB,WAAA,CAAY,IAAI,CAAA,EAAA,KAAM;AAAA,MACpB,EAAA,CAAG,EAAA;AAAA,MACH,aAAA,CAAc,CAAA,YAAA,EAAe,EAAA,CAAG,KAAA,GAAQ,CAAC,CAAA,GAAA,CAAK;AAAA,KAC/C;AAAA,GACH;AAEA,EAAA,IAAI,UAAA,GAAyB,WAAA,CAAY,CAAC,CAAA,CAAE,EAAA;AAC5C,EAAA,KAAA,IAAS,IAAI,OAAA,CAAQ,MAAA,GAAS,CAAA,EAAG,CAAA,IAAK,GAAG,CAAA,EAAA,EAAK;AAC5C,IAAA,IAAI,OAAA,CAAQ,CAAC,CAAA,EAAG;AACd,MAAA,UAAA,GAAa,WAAA,CAAY,CAAC,CAAA,CAAE,EAAA;AAC5B,MAAA;AAAA,IACF;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,UAAA;AAAA,IACA,EAAA,EAAI,CAAC,GAAA,KAA6B;AAChC,MAAA,OAAO,SAAA,CAAU,GAAA,CAAI,GAAG,CAAA,IAAK,KAAA;AAAA,IAC/B,CAAA;AAAA,IACA,IAAA,EAAM,CAAC,GAAA,KAA6B;AAClC,MAAA,OAAO,WAAA,CAAY,GAAA,CAAI,GAAG,CAAA,IAAK,KAAA;AAAA,IACjC;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useBreakpoint.esm.js","sources":["../../src/hooks/useBreakpoint.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useMemo } from 'react';\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport type { Breakpoint } from '../types';\n\nexport const breakpoints: { name: string; id: Breakpoint; value: number }[] = [\n { name: 'Initial', id: 'initial', value: 0 },\n { name: 'Extra Small', id: 'xs', value: 640 },\n { name: 'Small', id: 'sm', value: 768 },\n { name: 'Medium', id: 'md', value: 1024 },\n { name: 'Large', id: 'lg', value: 1280 },\n { name: 'Extra Large', id: 'xl', value: 1536 },\n];\n\nconst breakpointIndex = new Map<Breakpoint, number>(\n breakpoints.map((bp, i) => [bp.id, i]),\n);\n\nfunction bpIndex(key: Breakpoint): number {\n return breakpointIndex.get(key) ?? 0;\n}\n\nconst IS_SERVER =\n typeof window === 'undefined' || typeof window.matchMedia === 'undefined';\n\nfunction computeBreakpoint(): Breakpoint {\n if (IS_SERVER) {\n return 'initial';\n }\n for (let i = breakpoints.length - 1; i >= 0; i--) {\n if (window.matchMedia(`(min-width: ${breakpoints[i].value}px)`).matches) {\n return breakpoints[i].id;\n }\n }\n return 'initial';\n}\n\n// --- Module-scoped singleton store ---\n// This is intentionally not a global singleton. Multiple copies of this module\n// (e.g. different package versions or module federation remotes) each get their\n// own store. This avoids cross-version coupling at the cost of a few extra\n// listeners, which is a fine trade-off.\n// `current` is initialized lazily on first client-side access.\n\nlet current: Breakpoint | undefined;\nconst listeners = new Set<() => void>();\nlet initialized = false;\n\nfunction ensureInitialized(): void {\n if (initialized || IS_SERVER) {\n return;\n }\n initialized = true;\n current = computeBreakpoint();\n\n // Register one listener per breakpoint. When any query fires, re-evaluate\n // all breakpoints to find the new active one. Notify subscribers only if\n // the active breakpoint actually changed.\n for (const bp of breakpoints) {\n const mql = window.matchMedia(`(min-width: ${bp.value}px)`);\n mql.addEventListener('change', () => {\n const next = computeBreakpoint();\n if (next !== current) {\n current = next;\n for (const cb of listeners) {\n cb();\n }\n }\n });\n }\n}\n\nfunction subscribe(callback: () => void): () => void {\n ensureInitialized();\n listeners.add(callback);\n return () => {\n listeners.delete(callback);\n };\n}\n\nfunction getSnapshot(): Breakpoint {\n ensureInitialized();\n return current ?? 'initial';\n}\n\nfunction getServerSnapshot(): Breakpoint {\n return 'initial';\n}\n\n/** @public */\nexport const useBreakpoint = () => {\n const breakpoint = useSyncExternalStore(\n subscribe,\n getSnapshot,\n getServerSnapshot,\n );\n\n return useMemo(\n () => ({\n breakpoint,\n up: (key: Breakpoint): boolean => bpIndex(breakpoint) >= bpIndex(key),\n down: (key: Breakpoint): boolean => bpIndex(breakpoint) < bpIndex(key),\n }),\n [breakpoint],\n );\n};\n"],"names":[],"mappings":";;;AAmBO,MAAM,WAAA,GAAiE;AAAA,EAC5E,EAAE,IAAA,EAAM,SAAA,EAAW,EAAA,EAAI,SAAA,EAAW,OAAO,CAAA,EAAE;AAAA,EAC3C,EAAE,IAAA,EAAM,aAAA,EAAe,EAAA,EAAI,IAAA,EAAM,OAAO,GAAA,EAAI;AAAA,EAC5C,EAAE,IAAA,EAAM,OAAA,EAAS,EAAA,EAAI,IAAA,EAAM,OAAO,GAAA,EAAI;AAAA,EACtC,EAAE,IAAA,EAAM,QAAA,EAAU,EAAA,EAAI,IAAA,EAAM,OAAO,IAAA,EAAK;AAAA,EACxC,EAAE,IAAA,EAAM,OAAA,EAAS,EAAA,EAAI,IAAA,EAAM,OAAO,IAAA,EAAK;AAAA,EACvC,EAAE,IAAA,EAAM,aAAA,EAAe,EAAA,EAAI,IAAA,EAAM,OAAO,IAAA;AAC1C;AAEA,MAAM,kBAAkB,IAAI,GAAA;AAAA,EAC1B,WAAA,CAAY,IAAI,CAAC,EAAA,EAAI,MAAM,CAAC,EAAA,CAAG,EAAA,EAAI,CAAC,CAAC;AACvC,CAAA;AAEA,SAAS,QAAQ,GAAA,EAAyB;AACxC,EAAA,OAAO,eAAA,CAAgB,GAAA,CAAI,GAAG,CAAA,IAAK,CAAA;AACrC;AAEA,MAAM,YACJ,OAAO,MAAA,KAAW,WAAA,IAAe,OAAO,OAAO,UAAA,KAAe,WAAA;AAEhE,SAAS,iBAAA,GAAgC;AACvC,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,OAAO,SAAA;AAAA,EACT;AACA,EAAA,KAAA,IAAS,IAAI,WAAA,CAAY,MAAA,GAAS,CAAA,EAAG,CAAA,IAAK,GAAG,CAAA,EAAA,EAAK;AAChD,IAAA,IAAI,MAAA,CAAO,WAAW,CAAA,YAAA,EAAe,WAAA,CAAY,CAAC,CAAA,CAAE,KAAK,CAAA,GAAA,CAAK,CAAA,CAAE,OAAA,EAAS;AACvE,MAAA,OAAO,WAAA,CAAY,CAAC,CAAA,CAAE,EAAA;AAAA,IACxB;AAAA,EACF;AACA,EAAA,OAAO,SAAA;AACT;AASA,IAAI,OAAA;AACJ,MAAM,SAAA,uBAAgB,GAAA,EAAgB;AACtC,IAAI,WAAA,GAAc,KAAA;AAElB,SAAS,iBAAA,GAA0B;AACjC,EAAA,IAAI,eAAe,SAAA,EAAW;AAC5B,IAAA;AAAA,EACF;AACA,EAAA,WAAA,GAAc,IAAA;AACd,EAAA,OAAA,GAAU,iBAAA,EAAkB;AAK5B,EAAA,KAAA,MAAW,MAAM,WAAA,EAAa;AAC5B,IAAA,MAAM,MAAM,MAAA,CAAO,UAAA,CAAW,CAAA,YAAA,EAAe,EAAA,CAAG,KAAK,CAAA,GAAA,CAAK,CAAA;AAC1D,IAAA,GAAA,CAAI,gBAAA,CAAiB,UAAU,MAAM;AACnC,MAAA,MAAM,OAAO,iBAAA,EAAkB;AAC/B,MAAA,IAAI,SAAS,OAAA,EAAS;AACpB,QAAA,OAAA,GAAU,IAAA;AACV,QAAA,KAAA,MAAW,MAAM,SAAA,EAAW;AAC1B,UAAA,EAAA,EAAG;AAAA,QACL;AAAA,MACF;AAAA,IACF,CAAC,CAAA;AAAA,EACH;AACF;AAEA,SAAS,UAAU,QAAA,EAAkC;AACnD,EAAA,iBAAA,EAAkB;AAClB,EAAA,SAAA,CAAU,IAAI,QAAQ,CAAA;AACtB,EAAA,OAAO,MAAM;AACX,IAAA,SAAA,CAAU,OAAO,QAAQ,CAAA;AAAA,EAC3B,CAAA;AACF;AAEA,SAAS,WAAA,GAA0B;AACjC,EAAA,iBAAA,EAAkB;AAClB,EAAA,OAAO,OAAA,IAAW,SAAA;AACpB;AAEA,SAAS,iBAAA,GAAgC;AACvC,EAAA,OAAO,SAAA;AACT;AAGO,MAAM,gBAAgB,MAAM;AACjC,EAAA,MAAM,UAAA,GAAa,oBAAA;AAAA,IACjB,SAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAA,OAAO,OAAA;AAAA,IACL,OAAO;AAAA,MACL,UAAA;AAAA,MACA,IAAI,CAAC,GAAA,KAA6B,QAAQ,UAAU,CAAA,IAAK,QAAQ,GAAG,CAAA;AAAA,MACpE,MAAM,CAAC,GAAA,KAA6B,QAAQ,UAAU,CAAA,GAAI,QAAQ,GAAG;AAAA,KACvE,CAAA;AAAA,IACA,CAAC,UAAU;AAAA,GACb;AACF;;;;"}
@@ -24,6 +24,29 @@ function resolveResponsiveValue(value, breakpoint) {
24
24
  }
25
25
  return value;
26
26
  }
27
+ function resolveDefinitionProps(definition, props, breakpoint) {
28
+ const ownPropKeys = new Set(Object.keys(definition.propDefs));
29
+ const utilityPropKeys = new Set(definition.utilityProps ?? []);
30
+ const ownPropsRaw = {};
31
+ const restProps = {};
32
+ for (const [key, value] of Object.entries(props)) {
33
+ if (ownPropKeys.has(key)) {
34
+ ownPropsRaw[key] = value;
35
+ } else if (!utilityPropKeys.has(key)) {
36
+ restProps[key] = value;
37
+ }
38
+ }
39
+ const ownPropsResolved = {};
40
+ for (const [key, config] of Object.entries(definition.propDefs)) {
41
+ const rawValue = ownPropsRaw[key];
42
+ const resolvedValue = resolveResponsiveValue(rawValue, breakpoint);
43
+ const finalValue = resolvedValue ?? config.default;
44
+ if (finalValue !== void 0) {
45
+ ownPropsResolved[key] = finalValue;
46
+ }
47
+ }
48
+ return { ownPropsResolved, restProps };
49
+ }
27
50
  function processUtilityProps(props, utilityPropKeys) {
28
51
  const utilityClassList = [];
29
52
  const generatedStyle = {};
@@ -65,5 +88,5 @@ function processUtilityProps(props, utilityPropKeys) {
65
88
  };
66
89
  }
67
90
 
68
- export { processUtilityProps, resolveResponsiveValue };
91
+ export { processUtilityProps, resolveDefinitionProps, resolveResponsiveValue };
69
92
  //# sourceMappingURL=helpers.esm.js.map