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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/CHANGELOG.md +142 -0
  2. package/dist/analytics/BUIProvider.esm.js +18 -0
  3. package/dist/analytics/BUIProvider.esm.js.map +1 -0
  4. package/dist/analytics/getNodeText.esm.js +21 -0
  5. package/dist/analytics/getNodeText.esm.js.map +1 -0
  6. package/dist/analytics/useAnalytics.esm.js +26 -0
  7. package/dist/analytics/useAnalytics.esm.js.map +1 -0
  8. package/dist/components/Accordion/Accordion.esm.js +1 -0
  9. package/dist/components/Accordion/Accordion.esm.js.map +1 -1
  10. package/dist/components/Accordion/definition.esm.js +3 -2
  11. package/dist/components/Accordion/definition.esm.js.map +1 -1
  12. package/dist/components/Alert/definition.esm.js +2 -1
  13. package/dist/components/Alert/definition.esm.js.map +1 -1
  14. package/dist/components/Avatar/Avatar.esm.js +8 -28
  15. package/dist/components/Avatar/Avatar.esm.js.map +1 -1
  16. package/dist/components/Avatar/definition.esm.js +18 -4
  17. package/dist/components/Avatar/definition.esm.js.map +1 -1
  18. package/dist/components/Box/definition.esm.js +2 -1
  19. package/dist/components/Box/definition.esm.js.map +1 -1
  20. package/dist/components/Button/definition.esm.js +3 -3
  21. package/dist/components/Button/definition.esm.js.map +1 -1
  22. package/dist/components/ButtonIcon/definition.esm.js +3 -3
  23. package/dist/components/ButtonIcon/definition.esm.js.map +1 -1
  24. package/dist/components/ButtonLink/ButtonLink.esm.js +10 -1
  25. package/dist/components/ButtonLink/ButtonLink.esm.js.map +1 -1
  26. package/dist/components/ButtonLink/definition.esm.js +5 -3
  27. package/dist/components/ButtonLink/definition.esm.js.map +1 -1
  28. package/dist/components/Card/Card.esm.js +67 -6
  29. package/dist/components/Card/Card.esm.js.map +1 -1
  30. package/dist/components/Card/Card.module.css.esm.js +2 -2
  31. package/dist/components/Card/definition.esm.js +11 -3
  32. package/dist/components/Card/definition.esm.js.map +1 -1
  33. package/dist/components/Checkbox/Checkbox.esm.js +10 -17
  34. package/dist/components/Checkbox/Checkbox.esm.js.map +1 -1
  35. package/dist/components/Checkbox/definition.esm.js +17 -5
  36. package/dist/components/Checkbox/definition.esm.js.map +1 -1
  37. package/dist/components/Container/Container.esm.js +8 -13
  38. package/dist/components/Container/Container.esm.js.map +1 -1
  39. package/dist/components/Container/Container.module.css.esm.js +2 -2
  40. package/dist/components/Container/definition.esm.js +17 -2
  41. package/dist/components/Container/definition.esm.js.map +1 -1
  42. package/dist/components/Dialog/Dialog.esm.js +26 -59
  43. package/dist/components/Dialog/Dialog.esm.js.map +1 -1
  44. package/dist/components/Dialog/Dialog.module.css.esm.js +2 -2
  45. package/dist/components/Dialog/definition.esm.js +53 -8
  46. package/dist/components/Dialog/definition.esm.js.map +1 -1
  47. package/dist/components/FieldError/FieldError.esm.js +4 -13
  48. package/dist/components/FieldError/FieldError.esm.js.map +1 -1
  49. package/dist/components/FieldError/definition.esm.js +15 -2
  50. package/dist/components/FieldError/definition.esm.js.map +1 -1
  51. package/dist/components/FieldLabel/FieldLabel.esm.js +14 -59
  52. package/dist/components/FieldLabel/FieldLabel.esm.js.map +1 -1
  53. package/dist/components/FieldLabel/definition.esm.js +20 -2
  54. package/dist/components/FieldLabel/definition.esm.js.map +1 -1
  55. package/dist/components/Flex/Flex.esm.js +12 -22
  56. package/dist/components/Flex/Flex.esm.js.map +1 -1
  57. package/dist/components/Flex/definition.esm.js +20 -13
  58. package/dist/components/Flex/definition.esm.js.map +1 -1
  59. package/dist/components/FullPage/FullPage.esm.js +4 -13
  60. package/dist/components/FullPage/FullPage.esm.js.map +1 -1
  61. package/dist/components/FullPage/definition.esm.js +15 -2
  62. package/dist/components/FullPage/definition.esm.js.map +1 -1
  63. package/dist/components/Grid/Grid.esm.js +21 -40
  64. package/dist/components/Grid/Grid.esm.js.map +1 -1
  65. package/dist/components/Grid/definition.esm.js +31 -26
  66. package/dist/components/Grid/definition.esm.js.map +1 -1
  67. package/dist/components/Header/Header.esm.js +55 -0
  68. package/dist/components/Header/Header.esm.js.map +1 -0
  69. package/dist/components/Header/Header.module.css.esm.js +8 -0
  70. package/dist/components/Header/Header.module.css.esm.js.map +1 -0
  71. package/dist/components/Header/definition.esm.js +30 -0
  72. package/dist/components/Header/definition.esm.js.map +1 -0
  73. package/dist/components/Link/Link.esm.js +15 -34
  74. package/dist/components/Link/Link.esm.js.map +1 -1
  75. package/dist/components/Link/definition.esm.js +23 -15
  76. package/dist/components/Link/definition.esm.js.map +1 -1
  77. package/dist/components/Menu/Menu.esm.js +180 -344
  78. package/dist/components/Menu/Menu.esm.js.map +1 -1
  79. package/dist/components/Menu/Menu.module.css.esm.js +2 -2
  80. package/dist/components/Menu/definition.esm.js +116 -17
  81. package/dist/components/Menu/definition.esm.js.map +1 -1
  82. package/dist/components/PasswordField/PasswordField.esm.js +17 -52
  83. package/dist/components/PasswordField/PasswordField.esm.js.map +1 -1
  84. package/dist/components/PasswordField/PasswordField.module.css.esm.js +2 -2
  85. package/dist/components/PasswordField/definition.esm.js +29 -11
  86. package/dist/components/PasswordField/definition.esm.js.map +1 -1
  87. package/dist/components/PluginHeader/PluginHeader.esm.js +35 -46
  88. package/dist/components/PluginHeader/PluginHeader.esm.js.map +1 -1
  89. package/dist/components/PluginHeader/PluginHeader.module.css.esm.js +2 -2
  90. package/dist/components/PluginHeader/definition.esm.js +22 -3
  91. package/dist/components/PluginHeader/definition.esm.js.map +1 -1
  92. package/dist/components/Popover/Popover.esm.js +24 -32
  93. package/dist/components/Popover/Popover.esm.js.map +1 -1
  94. package/dist/components/Popover/Popover.module.css.esm.js +2 -2
  95. package/dist/components/Popover/definition.esm.js +17 -2
  96. package/dist/components/Popover/definition.esm.js.map +1 -1
  97. package/dist/components/RadioGroup/RadioGroup.esm.js +25 -44
  98. package/dist/components/RadioGroup/RadioGroup.esm.js.map +1 -1
  99. package/dist/components/RadioGroup/definition.esm.js +31 -5
  100. package/dist/components/RadioGroup/definition.esm.js.map +1 -1
  101. package/dist/components/SearchField/SearchField.esm.js +25 -45
  102. package/dist/components/SearchField/SearchField.esm.js.map +1 -1
  103. package/dist/components/SearchField/SearchField.module.css.esm.js +2 -2
  104. package/dist/components/SearchField/definition.esm.js +22 -5
  105. package/dist/components/SearchField/definition.esm.js.map +1 -1
  106. package/dist/components/Select/Select.esm.js +14 -23
  107. package/dist/components/Select/Select.esm.js.map +1 -1
  108. package/dist/components/Select/Select.module.css.esm.js +2 -2
  109. package/dist/components/Select/SelectContent.esm.js +8 -31
  110. package/dist/components/Select/SelectContent.esm.js.map +1 -1
  111. package/dist/components/Select/SelectListBox.esm.js +21 -44
  112. package/dist/components/Select/SelectListBox.esm.js.map +1 -1
  113. package/dist/components/Select/SelectTrigger.esm.js +11 -14
  114. package/dist/components/Select/SelectTrigger.esm.js.map +1 -1
  115. package/dist/components/Select/definition.esm.js +69 -17
  116. package/dist/components/Select/definition.esm.js.map +1 -1
  117. package/dist/components/Skeleton/Skeleton.esm.js +9 -13
  118. package/dist/components/Skeleton/Skeleton.esm.js.map +1 -1
  119. package/dist/components/Skeleton/definition.esm.js +19 -2
  120. package/dist/components/Skeleton/definition.esm.js.map +1 -1
  121. package/dist/components/Switch/Switch.esm.js +7 -22
  122. package/dist/components/Switch/Switch.esm.js.map +1 -1
  123. package/dist/components/Switch/definition.esm.js +16 -2
  124. package/dist/components/Switch/definition.esm.js.map +1 -1
  125. package/dist/components/Table/Table.module.css.esm.js +2 -2
  126. package/dist/components/Table/components/Cell.esm.js +4 -17
  127. package/dist/components/Table/components/Cell.esm.js.map +1 -1
  128. package/dist/components/Table/components/CellProfile.esm.js +12 -41
  129. package/dist/components/Table/components/CellProfile.esm.js.map +1 -1
  130. package/dist/components/Table/components/CellText.esm.js +39 -73
  131. package/dist/components/Table/components/CellText.esm.js.map +1 -1
  132. package/dist/components/Table/components/Column.esm.js +8 -36
  133. package/dist/components/Table/components/Column.esm.js.map +1 -1
  134. package/dist/components/Table/components/Row.esm.js +22 -19
  135. package/dist/components/Table/components/Row.esm.js.map +1 -1
  136. package/dist/components/Table/components/Table.esm.js +8 -0
  137. package/dist/components/Table/components/Table.esm.js.map +1 -1
  138. package/dist/components/Table/components/TableBody.esm.js +4 -12
  139. package/dist/components/Table/components/TableBody.esm.js.map +1 -1
  140. package/dist/components/Table/components/TableHeader.esm.js +19 -29
  141. package/dist/components/Table/components/TableHeader.esm.js.map +1 -1
  142. package/dist/components/Table/components/TableRoot.esm.js +5 -7
  143. package/dist/components/Table/components/TableRoot.esm.js.map +1 -1
  144. package/dist/components/Table/definition.esm.js +101 -21
  145. package/dist/components/Table/definition.esm.js.map +1 -1
  146. package/dist/components/TablePagination/TablePagination.esm.js +24 -32
  147. package/dist/components/TablePagination/TablePagination.esm.js.map +1 -1
  148. package/dist/components/TablePagination/definition.esm.js +33 -2
  149. package/dist/components/TablePagination/definition.esm.js.map +1 -1
  150. package/dist/components/Tabs/Tabs.esm.js +57 -64
  151. package/dist/components/Tabs/Tabs.esm.js.map +1 -1
  152. package/dist/components/Tabs/TabsIndicators.esm.js +6 -18
  153. package/dist/components/Tabs/TabsIndicators.esm.js.map +1 -1
  154. package/dist/components/Tabs/definition.esm.js +65 -10
  155. package/dist/components/Tabs/definition.esm.js.map +1 -1
  156. package/dist/components/TagGroup/TagGroup.esm.js +49 -63
  157. package/dist/components/TagGroup/TagGroup.esm.js.map +1 -1
  158. package/dist/components/TagGroup/definition.esm.js +38 -8
  159. package/dist/components/TagGroup/definition.esm.js.map +1 -1
  160. package/dist/components/Text/Text.esm.js +6 -13
  161. package/dist/components/Text/Text.esm.js.map +1 -1
  162. package/dist/components/Text/definition.esm.js +19 -14
  163. package/dist/components/Text/definition.esm.js.map +1 -1
  164. package/dist/components/TextField/TextField.esm.js +16 -41
  165. package/dist/components/TextField/TextField.esm.js.map +1 -1
  166. package/dist/components/TextField/TextField.module.css.esm.js +2 -2
  167. package/dist/components/TextField/definition.esm.js +21 -6
  168. package/dist/components/TextField/definition.esm.js.map +1 -1
  169. package/dist/components/ToggleButton/ToggleButton.esm.js +11 -23
  170. package/dist/components/ToggleButton/ToggleButton.esm.js.map +1 -1
  171. package/dist/components/ToggleButton/definition.esm.js +18 -4
  172. package/dist/components/ToggleButton/definition.esm.js.map +1 -1
  173. package/dist/components/ToggleButtonGroup/ToggleButtonGroup.esm.js +5 -18
  174. package/dist/components/ToggleButtonGroup/ToggleButtonGroup.esm.js.map +1 -1
  175. package/dist/components/ToggleButtonGroup/definition.esm.js +15 -4
  176. package/dist/components/ToggleButtonGroup/definition.esm.js.map +1 -1
  177. package/dist/components/Tooltip/Tooltip.esm.js +24 -30
  178. package/dist/components/Tooltip/Tooltip.esm.js.map +1 -1
  179. package/dist/components/Tooltip/Tooltip.module.css.esm.js +2 -2
  180. package/dist/components/Tooltip/definition.esm.js +17 -2
  181. package/dist/components/Tooltip/definition.esm.js.map +1 -1
  182. package/dist/components/VisuallyHidden/VisuallyHidden.esm.js +4 -12
  183. package/dist/components/VisuallyHidden/VisuallyHidden.esm.js.map +1 -1
  184. package/dist/components/VisuallyHidden/definition.esm.js +15 -2
  185. package/dist/components/VisuallyHidden/definition.esm.js.map +1 -1
  186. package/dist/css/styles.css +2 -4
  187. package/dist/hooks/useBg.esm.js +11 -2
  188. package/dist/hooks/useBg.esm.js.map +1 -1
  189. package/dist/hooks/useBreakpoint.esm.js +67 -27
  190. package/dist/hooks/useBreakpoint.esm.js.map +1 -1
  191. package/dist/hooks/useDefinition/defineComponent.esm.js.map +1 -1
  192. package/dist/hooks/useDefinition/useDefinition.esm.js +10 -3
  193. package/dist/hooks/useDefinition/useDefinition.esm.js.map +1 -1
  194. package/dist/index.d.ts +1036 -282
  195. package/dist/index.esm.js +7 -4
  196. package/dist/index.esm.js.map +1 -1
  197. package/package.json +5 -3
  198. package/dist/components/HeaderPage/HeaderPage.esm.js +0 -76
  199. package/dist/components/HeaderPage/HeaderPage.esm.js.map +0 -1
  200. package/dist/components/HeaderPage/HeaderPage.module.css.esm.js +0 -8
  201. package/dist/components/HeaderPage/HeaderPage.module.css.esm.js.map +0 -1
  202. package/dist/components/HeaderPage/definition.esm.js +0 -12
  203. package/dist/components/HeaderPage/definition.esm.js.map +0 -1
  204. package/dist/components/PluginHeader/PluginHeaderToolbar.esm.js +0 -94
  205. package/dist/components/PluginHeader/PluginHeaderToolbar.esm.js.map +0 -1
  206. package/dist/hooks/useMediaQuery.esm.js +0 -47
  207. package/dist/hooks/useMediaQuery.esm.js.map +0 -1
  208. package/dist/hooks/useStyles.esm.js +0 -53
  209. package/dist/hooks/useStyles.esm.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,147 @@
1
1
  # @backstage/ui
2
2
 
3
+ ## 0.13.0-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - db92751: Added interactive support to the `Card` component. Pass `onPress` to make the entire card surface pressable, or `href` to make it navigate to a URL. A transparent overlay handles the interaction while nested buttons and links remain independently clickable.
8
+ - 12d8afe: Added analytics capabilities to the component library. Components with navigation behavior (Link, ButtonLink, Tab, MenuItem, Tag, Row) now fire analytics events on click when a `BUIProvider` is present.
9
+
10
+ New exports: `BUIProvider`, `useAnalytics`, `getNodeText`, and associated types (`AnalyticsTracker`, `UseAnalyticsFn`, `BUIProviderProps`, `AnalyticsEventAttributes`).
11
+
12
+ Components with analytics support now accept a `noTrack` prop to suppress event firing.
13
+
14
+ **Affected components:** Link, ButtonLink, Tab, MenuItem, Tag, Row
15
+
16
+ - 430d5ed: Fixed interactive cards so that CardBody can scroll when the card has a constrained height. Previously, the overlay element blocked scroll events.
17
+
18
+ **Affected components:** Card
19
+
20
+ - ad7c883: Deprecated the `HeaderPage` component name in favor of `Header`. The old `HeaderPage`, `HeaderPageProps`, `HeaderPageOwnProps`, `HeaderPageBreadcrumb`, and `HeaderPageDefinition` exports are still available as deprecated aliases.
21
+ - f42f4cc: Fixed Table column headers overflowing and wrapping when there is not enough space. Headers now truncate with ellipsis instead.
22
+
23
+ **Affected components:** Table
24
+
25
+ - fbd5c5a: Fixed Table rows showing a pointer cursor when not interactive. Rows now only show `cursor: pointer` when they have an `href`, are selectable, or are pressable.
26
+
27
+ **Affected components:** Table
28
+
29
+ - 7960d54: Added support for native HTML div attributes on the `Flex`, `Grid`, and `Grid.Item` components.
30
+
31
+ **Affected components:** Flex, Grid, Grid.Item
32
+
33
+ - 12d8afe: Fixed MenuItem `onAction` prop ordering so user-provided `onAction` handlers are chained rather than silently overwritten.
34
+ - bb66b86: The `Select` trigger now automatically adapts its background colour based on the parent background context.
35
+
36
+ **Affected components:** Select
37
+
38
+ - 934ac03: `SearchField` and `TextField` now automatically adapt their background color based on the parent bg context, stepping up one neutral level (e.g. neutral-1 → neutral-2) when placed on a neutral background. `TextField` also gains a focus ring using the `--bui-ring` token.
39
+
40
+ **Affected components:** SearchField, TextField
41
+
42
+ ## 0.13.0-next.1
43
+
44
+ ### Minor Changes
45
+
46
+ - 768f09d: **BREAKING**: Simplified the neutral background prop API for container components. The explicit `neutral-1`, `neutral-2`, `neutral-3`, and `neutral-auto` values have been removed from `ProviderBg`. They are replaced by a single `'neutral'` value that always auto-increments from the parent context, making it impossible to skip or pin to an explicit neutral level.
47
+
48
+ **Migration:**
49
+
50
+ Replace any explicit `bg="neutral-1"`, `bg="neutral-2"`, `bg="neutral-3"`, or `bg="neutral-auto"` props with `bg="neutral"`. To achieve a specific neutral level in stories or tests, use nested containers — each additional `bg="neutral"` wrapper increments by one level.
51
+
52
+ ```tsx
53
+ // Before
54
+ <Box bg="neutral-2">...</Box>
55
+
56
+ // After
57
+ <Box bg="neutral">
58
+ <Box bg="neutral">...</Box>
59
+ </Box>
60
+ ```
61
+
62
+ **Affected components:** Box, Flex, Grid, Card, Accordion, Popover, Tooltip, Dialog, Menu
63
+
64
+ - b42fcdc: **BREAKING**: Removed `--bui-bg-popover` CSS token. Popover, Tooltip, Menu, and Dialog now use `--bui-bg-app` for their outer shell and `Box bg="neutral-1"` for content areas, providing better theme consistency and eliminating a redundant token.
65
+
66
+ **Migration:**
67
+
68
+ Replace any usage of `--bui-bg-popover` with `--bui-bg-neutral-1` (for content surfaces) or `--bui-bg-app` (for outer shells):
69
+
70
+ ```diff
71
+ - background: var(--bui-bg-popover);
72
+ + background: var(--bui-bg-neutral-1);
73
+ ```
74
+
75
+ **Affected components:** Popover, Tooltip, Menu, Dialog
76
+
77
+ - bd3a76e: **BREAKING**: Data attributes rendered by components are now always lowercase. This affects CSS selectors targeting camelCase data attributes.
78
+
79
+ **Migration:**
80
+
81
+ Update any custom CSS selectors that target camelCase data attributes to use lowercase instead:
82
+
83
+ ```diff
84
+ - [data-startCollapsed='true'] { ... }
85
+ + [data-startcollapsed='true'] { ... }
86
+ ```
87
+
88
+ **Affected components:** SearchField
89
+
90
+ - 95702ab: **BREAKING**: Removed deprecated types `ComponentDefinition`, `ClassNamesMap`, `DataAttributeValues`, and `DataAttributesMap` from the public API. These were internal styling infrastructure types that have been replaced by the `defineComponent` system.
91
+
92
+ **Migration:**
93
+
94
+ Remove any direct usage of these types. Component definitions now use `defineComponent()` and their shapes are not part of the public API contract.
95
+
96
+ ```diff
97
+ - import type { ComponentDefinition, ClassNamesMap } from '@backstage/ui';
98
+ ```
99
+
100
+ If you were reading `definition.dataAttributes`, use `definition.propDefs` instead — props with `dataAttribute: true` in `propDefs` are the equivalent.
101
+
102
+ ### Patch Changes
103
+
104
+ - 58224d3: Fixed neutral-1 hover & pressed state in light mode.
105
+ - 95702ab: Migrated all components from `useStyles` to `useDefinition` hook. Exported `OwnProps` types for each component, enabling better type composition for consumers.
106
+
107
+ **Affected components:** Avatar, Checkbox, Container, Dialog, FieldError, FieldLabel, Flex, FullPage, Grid, HeaderPage, Link, Menu, PasswordField, PluginHeader, Popover, RadioGroup, SearchField, Select, Skeleton, Switch, Table, TablePagination, Tabs, TagGroup, Text, TextField, ToggleButton, ToggleButtonGroup, Tooltip, VisuallyHidden
108
+
109
+ - 4c2c350: Removed the `transition` on `Container` padding to prevent an unwanted animation when the viewport is resized.
110
+
111
+ Affected components: Container
112
+
113
+ - d4fa5b4: Fixed tab `matchStrategy` matching to ignore query parameters and hash fragments in tab `href` values. Previously, tabs with query params in their `href` (e.g., `/page?group=foo`) would never show as active since matching compared the full `href` string against `location.pathname` which never includes query params.
114
+
115
+ **Affected components:** Tabs, PluginHeader
116
+
117
+ - 36987db: Fixed handling of the `style` prop on `Button`, `ButtonIcon`, and `ButtonLink` so that it is now correctly forwarded to the underlying element instead of being silently dropped.
118
+
119
+ **Affected components:** Button, ButtonIcon, ButtonLink
120
+
121
+ - 95702ab: Fixed Link variant default from `'body'` to `'body-medium'` to match actual CSS selectors. The previous default did not correspond to a valid variant value.
122
+
123
+ **Affected components:** Link
124
+
125
+ - 9027b10: Fixed scroll overflow in Menu and Select popover content when constrained by viewport height.
126
+
127
+ **Affected components:** Menu, Select
128
+
129
+ - 4105a78: Merged the internal `PluginHeaderToolbar` component into `PluginHeader`, removing the separate component and its associated types (`PluginHeaderToolbarOwnProps`, `PluginHeaderToolbarProps`) and definition (`PluginHeaderToolbarDefinition`). This is an internal refactor with no changes to the public API of `PluginHeader`.
130
+
131
+ **Affected components:** PluginHeader
132
+
133
+ - b303857: Fixed `isRequired` prop not being passed to the underlying React Aria field components in TextField, SearchField, and PasswordField. Previously, `isRequired` was consumed locally for the secondary label text but never forwarded, which meant the input elements lacked `aria-required="true"` and React Aria's built-in required validation was not activated.
134
+
135
+ **Affected components:** TextField, SearchField, PasswordField
136
+
137
+ - cd3cb0f: Improved `useBreakpoint` performance by sharing a single set of `matchMedia` listeners across all component instances instead of creating independent listeners per hook call.
138
+ - 36987db: Extended `AlertProps`, `ContainerProps`, `DialogBodyProps`, and `FieldLabelProps` with native div element props to allow passing attributes like `aria-*` and `data-*`.
139
+
140
+ **Affected components:** Alert, Container, DialogBody, FieldLabel
141
+
142
+ - Updated dependencies
143
+ - @backstage/version-bridge@1.0.12
144
+
3
145
  ## 0.12.1-next.0
4
146
 
5
147
  ### Patch Changes
@@ -0,0 +1,18 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useMemo } from 'react';
3
+ import { createVersionedValueMap } from '@backstage/version-bridge';
4
+ import { BUIContext } from './useAnalytics.esm.js';
5
+
6
+ function BUIProvider(props) {
7
+ const { useAnalytics, children } = props;
8
+ const value = useMemo(
9
+ () => createVersionedValueMap({
10
+ 1: { useAnalytics }
11
+ }),
12
+ [useAnalytics]
13
+ );
14
+ return /* @__PURE__ */ jsx(BUIContext.Provider, { value, children });
15
+ }
16
+
17
+ export { BUIProvider };
18
+ //# sourceMappingURL=BUIProvider.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BUIProvider.esm.js","sources":["../../src/analytics/BUIProvider.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { useMemo, type ReactNode } from 'react';\nimport { createVersionedValueMap } from '@backstage/version-bridge';\nimport { BUIContext } from './useAnalytics';\nimport type { UseAnalyticsFn } from './types';\n\n/** @public */\nexport type BUIProviderProps = {\n useAnalytics?: UseAnalyticsFn;\n children: ReactNode;\n};\n\n/**\n * Provides integration capabilities to all descendant BUI components.\n *\n * @example\n * ```tsx\n * import { BUIProvider } from '@backstage/ui';\n * import { useAnalytics as useBackstageAnalytics } from '@backstage/core-plugin-api';\n *\n * function App() {\n * return (\n * <BUIProvider useAnalytics={useBackstageAnalytics}>\n * <AppContent />\n * </BUIProvider>\n * );\n * }\n * ```\n *\n * @public\n */\nexport function BUIProvider(props: BUIProviderProps) {\n const { useAnalytics, children } = props;\n const value = useMemo(\n () =>\n createVersionedValueMap({\n 1: { useAnalytics },\n }),\n [useAnalytics],\n );\n return <BUIContext.Provider value={value}>{children}</BUIContext.Provider>;\n}\n"],"names":[],"mappings":";;;;;AA8CO,SAAS,YAAY,KAAA,EAAyB;AACnD,EAAA,MAAM,EAAE,YAAA,EAAc,QAAA,EAAS,GAAI,KAAA;AACnC,EAAA,MAAM,KAAA,GAAQ,OAAA;AAAA,IACZ,MACE,uBAAA,CAAwB;AAAA,MACtB,CAAA,EAAG,EAAE,YAAA;AAAa,KACnB,CAAA;AAAA,IACH,CAAC,YAAY;AAAA,GACf;AACA,EAAA,uBAAO,GAAA,CAAC,UAAA,CAAW,QAAA,EAAX,EAAoB,OAAe,QAAA,EAAS,CAAA;AACtD;;;;"}
@@ -0,0 +1,21 @@
1
+ import { Children, isValidElement } from 'react';
2
+
3
+ function getNodeText(node) {
4
+ if (typeof node === "function") {
5
+ return void 0;
6
+ }
7
+ if (Array.isArray(node)) {
8
+ const text = Children.map(node, getNodeText)?.filter(Boolean).join(" ");
9
+ return text || void 0;
10
+ }
11
+ if (isValidElement(node)) {
12
+ return getNodeText(node.props.children);
13
+ }
14
+ if (typeof node === "string" || typeof node === "number") {
15
+ return String(node);
16
+ }
17
+ return void 0;
18
+ }
19
+
20
+ export { getNodeText };
21
+ //# sourceMappingURL=getNodeText.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNodeText.esm.js","sources":["../../src/analytics/getNodeText.ts"],"sourcesContent":["/*\n * Copyright 2026 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 ReactNode, isValidElement, Children } from 'react';\n\n/**\n * Recursively extracts text content from a React node tree.\n * Returns undefined if no text content is found (e.g. icon-only children\n * or render functions).\n *\n * @public\n */\nexport function getNodeText(\n node: ReactNode | ((...args: any[]) => ReactNode),\n): string | undefined {\n if (typeof node === 'function') {\n return undefined;\n }\n if (Array.isArray(node)) {\n const text = Children.map(node, getNodeText)?.filter(Boolean).join(' ');\n return text || undefined;\n }\n if (isValidElement(node)) {\n return getNodeText(node.props.children);\n }\n if (typeof node === 'string' || typeof node === 'number') {\n return String(node);\n }\n return undefined;\n}\n"],"names":[],"mappings":";;AAyBO,SAAS,YACd,IAAA,EACoB;AACpB,EAAA,IAAI,OAAO,SAAS,UAAA,EAAY;AAC9B,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,IAAI,CAAA,EAAG;AACvB,IAAA,MAAM,IAAA,GAAO,QAAA,CAAS,GAAA,CAAI,IAAA,EAAM,WAAW,GAAG,MAAA,CAAO,OAAO,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AACtE,IAAA,OAAO,IAAA,IAAQ,MAAA;AAAA,EACjB;AACA,EAAA,IAAI,cAAA,CAAe,IAAI,CAAA,EAAG;AACxB,IAAA,OAAO,WAAA,CAAY,IAAA,CAAK,KAAA,CAAM,QAAQ,CAAA;AAAA,EACxC;AACA,EAAA,IAAI,OAAO,IAAA,KAAS,QAAA,IAAY,OAAO,SAAS,QAAA,EAAU;AACxD,IAAA,OAAO,OAAO,IAAI,CAAA;AAAA,EACpB;AACA,EAAA,OAAO,MAAA;AACT;;;;"}
@@ -0,0 +1,26 @@
1
+ import { useRef } from 'react';
2
+ import { createVersionedContext, useVersionedContext } from '@backstage/version-bridge';
3
+
4
+ const noopTracker = {
5
+ captureEvent: () => {
6
+ }
7
+ };
8
+ const noopUseAnalytics = () => noopTracker;
9
+ const BUIContext = createVersionedContext("bui");
10
+ function useAnalytics() {
11
+ const ctx = useVersionedContext("bui")?.atVersion(1);
12
+ const impl = ctx?.useAnalytics ?? noopUseAnalytics;
13
+ if (process.env.NODE_ENV !== "production") {
14
+ const prevImpl = useRef(impl);
15
+ if (prevImpl.current === noopUseAnalytics !== (impl === noopUseAnalytics)) {
16
+ throw new Error(
17
+ "@backstage/ui: The analytics hook changed between a noop and a real implementation. Ensure <BUIProvider> wraps all BUI components from first render."
18
+ );
19
+ }
20
+ prevImpl.current = impl;
21
+ }
22
+ return impl();
23
+ }
24
+
25
+ export { BUIContext, noopTracker, useAnalytics };
26
+ //# sourceMappingURL=useAnalytics.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnalytics.esm.js","sources":["../../src/analytics/useAnalytics.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { useRef } from 'react';\nimport {\n createVersionedContext,\n useVersionedContext,\n} from '@backstage/version-bridge';\nimport type { AnalyticsTracker, UseAnalyticsFn } from './types';\n\n/** @internal */\nexport const noopTracker: AnalyticsTracker = {\n captureEvent: () => {},\n};\n\nconst noopUseAnalytics: UseAnalyticsFn = () => noopTracker;\n\n/** @internal */\nexport type BUIContextValue = {\n useAnalytics?: UseAnalyticsFn;\n};\n\n/** @internal */\nexport const BUIContext = createVersionedContext<{\n 1: BUIContextValue;\n}>('bui');\n\n/**\n * Returns an AnalyticsTracker for capturing analytics events.\n *\n * By default returns a noop tracker. When a `BUIProvider` is present\n * in the tree, returns the tracker provided by the consumer's hook.\n *\n * @public\n */\nexport function useAnalytics(): AnalyticsTracker {\n const ctx = useVersionedContext<{ 1: BUIContextValue }>('bui')?.atVersion(1);\n const impl = ctx?.useAnalytics ?? noopUseAnalytics;\n\n if (process.env.NODE_ENV !== 'production') {\n const prevImpl = useRef(impl);\n if (\n (prevImpl.current === noopUseAnalytics) !==\n (impl === noopUseAnalytics)\n ) {\n throw new Error(\n '@backstage/ui: The analytics hook changed between a noop and a real ' +\n 'implementation. Ensure <BUIProvider> wraps all BUI components from first render.',\n );\n }\n prevImpl.current = impl;\n }\n\n return impl();\n}\n"],"names":[],"mappings":";;;AAwBO,MAAM,WAAA,GAAgC;AAAA,EAC3C,cAAc,MAAM;AAAA,EAAC;AACvB;AAEA,MAAM,mBAAmC,MAAM,WAAA;AAQxC,MAAM,UAAA,GAAa,uBAEvB,KAAK;AAUD,SAAS,YAAA,GAAiC;AAC/C,EAAA,MAAM,GAAA,GAAM,mBAAA,CAA4C,KAAK,CAAA,EAAG,UAAU,CAAC,CAAA;AAC3E,EAAA,MAAM,IAAA,GAAO,KAAK,YAAA,IAAgB,gBAAA;AAElC,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,YAAA,EAAc;AACzC,IAAA,MAAM,QAAA,GAAW,OAAO,IAAI,CAAA;AAC5B,IAAA,IACG,QAAA,CAAS,OAAA,KAAY,gBAAA,MACrB,IAAA,KAAS,gBAAA,CAAA,EACV;AACA,MAAA,MAAM,IAAI,KAAA;AAAA,QACR;AAAA,OAEF;AAAA,IACF;AACA,IAAA,QAAA,CAAS,OAAA,GAAU,IAAA;AAAA,EACrB;AAEA,EAAA,OAAO,IAAA,EAAK;AACd;;;;"}
@@ -5,6 +5,7 @@ import { RiArrowDownSLine } from '@remixicon/react';
5
5
  import { useDefinition } from '../../hooks/useDefinition/useDefinition.esm.js';
6
6
  import { AccordionDefinition, AccordionTriggerDefinition, AccordionPanelDefinition, AccordionGroupDefinition } from './definition.esm.js';
7
7
  import { Flex } from '../Flex/Flex.esm.js';
8
+ import '../Flex/Flex.module.css.esm.js';
8
9
 
9
10
  const Accordion = forwardRef(
10
11
  (props, ref) => {
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.esm.js","sources":["../../../src/components/Accordion/Accordion.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 {\n Disclosure as RADisclosure,\n Button as RAButton,\n DisclosurePanel as RADisclosurePanel,\n DisclosureGroup as RADisclosureGroup,\n Heading as RAHeading,\n} from 'react-aria-components';\nimport { RiArrowDownSLine } from '@remixicon/react';\nimport type {\n AccordionProps,\n AccordionTriggerProps,\n AccordionPanelProps,\n AccordionGroupProps,\n} from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport {\n AccordionDefinition,\n AccordionTriggerDefinition,\n AccordionPanelDefinition,\n AccordionGroupDefinition,\n} from './definition';\nimport { Flex } from '../Flex';\n\n/** @public */\nexport const Accordion = forwardRef(\n (props: AccordionProps, ref: Ref<React.ElementRef<typeof RADisclosure>>) => {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n AccordionDefinition,\n props,\n );\n const { classes, childrenWithBgProvider } = ownProps;\n\n return (\n <RADisclosure\n ref={ref}\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n >\n {childrenWithBgProvider}\n </RADisclosure>\n );\n },\n);\n\nAccordion.displayName = 'Accordion';\n\n/** @public */\nexport const AccordionTrigger = forwardRef(\n (\n props: AccordionTriggerProps,\n ref: Ref<React.ElementRef<typeof RAHeading>>,\n ) => {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n AccordionTriggerDefinition,\n props,\n );\n const { classes, title, subtitle, children } = ownProps;\n\n return (\n <RAHeading\n ref={ref}\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n >\n <RAButton slot=\"trigger\" className={classes.button}>\n {children ? (\n children\n ) : (\n <Flex gap=\"2\" align=\"center\">\n <span className={classes.title}>{title}</span>\n {subtitle && <span className={classes.subtitle}>{subtitle}</span>}\n </Flex>\n )}\n\n <RiArrowDownSLine className={classes.icon} size={16} />\n </RAButton>\n </RAHeading>\n );\n },\n);\n\nAccordionTrigger.displayName = 'AccordionTrigger';\n\n/** @public */\nexport const AccordionPanel = forwardRef(\n (\n props: AccordionPanelProps,\n ref: Ref<React.ElementRef<typeof RADisclosurePanel>>,\n ) => {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n AccordionPanelDefinition,\n props,\n );\n const { classes } = ownProps;\n\n return (\n <RADisclosurePanel\n ref={ref}\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n />\n );\n },\n);\n\nAccordionPanel.displayName = 'AccordionPanel';\n\n/** @public */\nexport const AccordionGroup = forwardRef(\n (\n props: AccordionGroupProps,\n ref: Ref<React.ElementRef<typeof RADisclosureGroup>>,\n ) => {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n AccordionGroupDefinition,\n props,\n );\n const { classes, allowsMultiple } = ownProps;\n\n return (\n <RADisclosureGroup\n ref={ref}\n allowsMultipleExpanded={allowsMultiple}\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n />\n );\n },\n);\n\nAccordionGroup.displayName = 'AccordionGroup';\n"],"names":["RADisclosure","RAHeading","RAButton","RADisclosurePanel","RADisclosureGroup"],"mappings":"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"}
1
+ {"version":3,"file":"Accordion.esm.js","sources":["../../../src/components/Accordion/Accordion.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 {\n Disclosure as RADisclosure,\n Button as RAButton,\n DisclosurePanel as RADisclosurePanel,\n DisclosureGroup as RADisclosureGroup,\n Heading as RAHeading,\n} from 'react-aria-components';\nimport { RiArrowDownSLine } from '@remixicon/react';\nimport type {\n AccordionProps,\n AccordionTriggerProps,\n AccordionPanelProps,\n AccordionGroupProps,\n} from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport {\n AccordionDefinition,\n AccordionTriggerDefinition,\n AccordionPanelDefinition,\n AccordionGroupDefinition,\n} from './definition';\nimport { Flex } from '../Flex';\n\n/** @public */\nexport const Accordion = forwardRef(\n (props: AccordionProps, ref: Ref<React.ElementRef<typeof RADisclosure>>) => {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n AccordionDefinition,\n props,\n );\n const { classes, childrenWithBgProvider } = ownProps;\n\n return (\n <RADisclosure\n ref={ref}\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n >\n {childrenWithBgProvider}\n </RADisclosure>\n );\n },\n);\n\nAccordion.displayName = 'Accordion';\n\n/** @public */\nexport const AccordionTrigger = forwardRef(\n (\n props: AccordionTriggerProps,\n ref: Ref<React.ElementRef<typeof RAHeading>>,\n ) => {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n AccordionTriggerDefinition,\n props,\n );\n const { classes, title, subtitle, children } = ownProps;\n\n return (\n <RAHeading\n ref={ref}\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n >\n <RAButton slot=\"trigger\" className={classes.button}>\n {children ? (\n children\n ) : (\n <Flex gap=\"2\" align=\"center\">\n <span className={classes.title}>{title}</span>\n {subtitle && <span className={classes.subtitle}>{subtitle}</span>}\n </Flex>\n )}\n\n <RiArrowDownSLine className={classes.icon} size={16} />\n </RAButton>\n </RAHeading>\n );\n },\n);\n\nAccordionTrigger.displayName = 'AccordionTrigger';\n\n/** @public */\nexport const AccordionPanel = forwardRef(\n (\n props: AccordionPanelProps,\n ref: Ref<React.ElementRef<typeof RADisclosurePanel>>,\n ) => {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n AccordionPanelDefinition,\n props,\n );\n const { classes } = ownProps;\n\n return (\n <RADisclosurePanel\n ref={ref}\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n />\n );\n },\n);\n\nAccordionPanel.displayName = 'AccordionPanel';\n\n/** @public */\nexport const AccordionGroup = forwardRef(\n (\n props: AccordionGroupProps,\n ref: Ref<React.ElementRef<typeof RADisclosureGroup>>,\n ) => {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n AccordionGroupDefinition,\n props,\n );\n const { classes, allowsMultiple } = ownProps;\n\n return (\n <RADisclosureGroup\n ref={ref}\n allowsMultipleExpanded={allowsMultiple}\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n />\n );\n },\n);\n\nAccordionGroup.displayName = 'AccordionGroup';\n"],"names":["RADisclosure","RAHeading","RAButton","RADisclosurePanel","RADisclosureGroup"],"mappings":"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"}
@@ -1,8 +1,9 @@
1
1
  import 'react/jsx-runtime';
2
2
  import 'clsx';
3
- import 'react';
3
+ import '../../hooks/useBreakpoint.esm.js';
4
4
  import '../../hooks/useBg.esm.js';
5
5
  import '../../hooks/useDefinition/helpers.esm.js';
6
+ import '../../analytics/useAnalytics.esm.js';
6
7
  import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
7
8
  import styles from './Accordion.module.css.esm.js';
8
9
 
@@ -13,7 +14,7 @@ const AccordionDefinition = defineComponent()({
13
14
  },
14
15
  bg: "provider",
15
16
  propDefs: {
16
- bg: { dataAttribute: true, default: "neutral-auto" },
17
+ bg: { dataAttribute: true, default: "neutral" },
17
18
  children: {},
18
19
  className: {}
19
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Accordion/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type {\n AccordionOwnProps,\n AccordionTriggerOwnProps,\n AccordionPanelOwnProps,\n AccordionGroupOwnProps,\n} from './types';\nimport styles from './Accordion.module.css';\n\n/**\n * Component definition for Accordion\n * @public\n */\nexport const AccordionDefinition = defineComponent<AccordionOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Accordion',\n },\n bg: 'provider',\n propDefs: {\n bg: { dataAttribute: true, default: 'neutral-auto' },\n children: {},\n className: {},\n },\n});\n\n/**\n * Component definition for AccordionTrigger\n * @public\n */\nexport const AccordionTriggerDefinition =\n defineComponent<AccordionTriggerOwnProps>()({\n styles,\n classNames: {\n root: 'bui-AccordionTrigger',\n button: 'bui-AccordionTriggerButton',\n title: 'bui-AccordionTriggerTitle',\n subtitle: 'bui-AccordionTriggerSubtitle',\n icon: 'bui-AccordionTriggerIcon',\n },\n propDefs: {\n className: {},\n title: {},\n subtitle: {},\n children: {},\n },\n });\n\n/**\n * Component definition for AccordionPanel\n * @public\n */\nexport const AccordionPanelDefinition =\n defineComponent<AccordionPanelOwnProps>()({\n styles,\n classNames: {\n root: 'bui-AccordionPanel',\n },\n propDefs: {\n className: {},\n },\n });\n\n/**\n * Component definition for AccordionGroup\n * @public\n */\nexport const AccordionGroupDefinition =\n defineComponent<AccordionGroupOwnProps>()({\n styles,\n classNames: {\n root: 'bui-AccordionGroup',\n },\n propDefs: {\n className: {},\n allowsMultiple: { default: false },\n },\n });\n"],"names":[],"mappings":";;;;;;;;AA6BO,MAAM,mBAAA,GAAsB,iBAAmC,CAAE;AAAA,EACtE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,EAAA,EAAI,UAAA;AAAA,EACJ,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,cAAA,EAAe;AAAA,IACnD,UAAU,EAAC;AAAA,IACX,WAAW;AAAC;AAEhB,CAAC;AAMM,MAAM,0BAAA,GACX,iBAA0C,CAAE;AAAA,EAC1C,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,sBAAA;AAAA,IACN,MAAA,EAAQ,4BAAA;AAAA,IACR,KAAA,EAAO,2BAAA;AAAA,IACP,QAAA,EAAU,8BAAA;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,OAAO,EAAC;AAAA,IACR,UAAU,EAAC;AAAA,IACX,UAAU;AAAC;AAEf,CAAC;AAMI,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;AAMI,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,EAAC;AAAA,IACZ,cAAA,EAAgB,EAAE,OAAA,EAAS,KAAA;AAAM;AAErC,CAAC;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Accordion/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type {\n AccordionOwnProps,\n AccordionTriggerOwnProps,\n AccordionPanelOwnProps,\n AccordionGroupOwnProps,\n} from './types';\nimport styles from './Accordion.module.css';\n\n/**\n * Component definition for Accordion\n * @public\n */\nexport const AccordionDefinition = defineComponent<AccordionOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Accordion',\n },\n bg: 'provider',\n propDefs: {\n bg: { dataAttribute: true, default: 'neutral' },\n children: {},\n className: {},\n },\n});\n\n/**\n * Component definition for AccordionTrigger\n * @public\n */\nexport const AccordionTriggerDefinition =\n defineComponent<AccordionTriggerOwnProps>()({\n styles,\n classNames: {\n root: 'bui-AccordionTrigger',\n button: 'bui-AccordionTriggerButton',\n title: 'bui-AccordionTriggerTitle',\n subtitle: 'bui-AccordionTriggerSubtitle',\n icon: 'bui-AccordionTriggerIcon',\n },\n propDefs: {\n className: {},\n title: {},\n subtitle: {},\n children: {},\n },\n });\n\n/**\n * Component definition for AccordionPanel\n * @public\n */\nexport const AccordionPanelDefinition =\n defineComponent<AccordionPanelOwnProps>()({\n styles,\n classNames: {\n root: 'bui-AccordionPanel',\n },\n propDefs: {\n className: {},\n },\n });\n\n/**\n * Component definition for AccordionGroup\n * @public\n */\nexport const AccordionGroupDefinition =\n defineComponent<AccordionGroupOwnProps>()({\n styles,\n classNames: {\n root: 'bui-AccordionGroup',\n },\n propDefs: {\n className: {},\n allowsMultiple: { default: false },\n },\n });\n"],"names":[],"mappings":";;;;;;;;;AA6BO,MAAM,mBAAA,GAAsB,iBAAmC,CAAE;AAAA,EACtE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,EAAA,EAAI,UAAA;AAAA,EACJ,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,SAAA,EAAU;AAAA,IAC9C,UAAU,EAAC;AAAA,IACX,WAAW;AAAC;AAEhB,CAAC;AAMM,MAAM,0BAAA,GACX,iBAA0C,CAAE;AAAA,EAC1C,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,sBAAA;AAAA,IACN,MAAA,EAAQ,4BAAA;AAAA,IACR,KAAA,EAAO,2BAAA;AAAA,IACP,QAAA,EAAU,8BAAA;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,OAAO,EAAC;AAAA,IACR,UAAU,EAAC;AAAA,IACX,UAAU;AAAC;AAEf,CAAC;AAMI,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;AAMI,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,EAAC;AAAA,IACZ,cAAA,EAAgB,EAAE,OAAA,EAAS,KAAA;AAAM;AAErC,CAAC;;;;"}
@@ -1,8 +1,9 @@
1
1
  import 'react/jsx-runtime';
2
2
  import 'clsx';
3
- import 'react';
3
+ import '../../hooks/useBreakpoint.esm.js';
4
4
  import '../../hooks/useBg.esm.js';
5
5
  import '../../hooks/useDefinition/helpers.esm.js';
6
+ import '../../analytics/useAnalytics.esm.js';
6
7
  import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
7
8
  import styles from './Alert.module.css.esm.js';
8
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Alert/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 { AlertOwnProps } from './types';\nimport styles from './Alert.module.css';\n\n/**\n * Component definition for Alert\n * @public\n */\nexport const AlertDefinition = defineComponent<AlertOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Alert',\n contentWrapper: 'bui-AlertContentWrapper',\n content: 'bui-AlertContent',\n title: 'bui-AlertTitle',\n description: 'bui-AlertDescription',\n icon: 'bui-AlertIcon',\n spinner: 'bui-AlertSpinner',\n actions: 'bui-AlertActions',\n },\n propDefs: {\n status: { dataAttribute: true, default: 'info' },\n loading: { dataAttribute: true },\n icon: {},\n customActions: {},\n title: {},\n description: {},\n className: {},\n style: {},\n },\n utilityProps: ['m', 'mb', 'ml', 'mr', 'mt', 'mx', 'my'],\n});\n"],"names":[],"mappings":";;;;;;;;AAwBO,MAAM,eAAA,GAAkB,iBAA+B,CAAE;AAAA,EAC9D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,WAAA;AAAA,IACN,cAAA,EAAgB,yBAAA;AAAA,IAChB,OAAA,EAAS,kBAAA;AAAA,IACT,KAAA,EAAO,gBAAA;AAAA,IACP,WAAA,EAAa,sBAAA;AAAA,IACb,IAAA,EAAM,eAAA;AAAA,IACN,OAAA,EAAS,kBAAA;AAAA,IACT,OAAA,EAAS;AAAA,GACX;AAAA,EACA,QAAA,EAAU;AAAA,IACR,MAAA,EAAQ,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,MAAA,EAAO;AAAA,IAC/C,OAAA,EAAS,EAAE,aAAA,EAAe,IAAA,EAAK;AAAA,IAC/B,MAAM,EAAC;AAAA,IACP,eAAe,EAAC;AAAA,IAChB,OAAO,EAAC;AAAA,IACR,aAAa,EAAC;AAAA,IACd,WAAW,EAAC;AAAA,IACZ,OAAO;AAAC,GACV;AAAA,EACA,YAAA,EAAc,CAAC,GAAA,EAAK,IAAA,EAAM,MAAM,IAAA,EAAM,IAAA,EAAM,MAAM,IAAI;AACxD,CAAC;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Alert/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 { AlertOwnProps } from './types';\nimport styles from './Alert.module.css';\n\n/**\n * Component definition for Alert\n * @public\n */\nexport const AlertDefinition = defineComponent<AlertOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Alert',\n contentWrapper: 'bui-AlertContentWrapper',\n content: 'bui-AlertContent',\n title: 'bui-AlertTitle',\n description: 'bui-AlertDescription',\n icon: 'bui-AlertIcon',\n spinner: 'bui-AlertSpinner',\n actions: 'bui-AlertActions',\n },\n propDefs: {\n status: { dataAttribute: true, default: 'info' },\n loading: { dataAttribute: true },\n icon: {},\n customActions: {},\n title: {},\n description: {},\n className: {},\n style: {},\n },\n utilityProps: ['m', 'mb', 'ml', 'mr', 'mt', 'mx', 'my'],\n});\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,eAAA,GAAkB,iBAA+B,CAAE;AAAA,EAC9D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,WAAA;AAAA,IACN,cAAA,EAAgB,yBAAA;AAAA,IAChB,OAAA,EAAS,kBAAA;AAAA,IACT,KAAA,EAAO,gBAAA;AAAA,IACP,WAAA,EAAa,sBAAA;AAAA,IACb,IAAA,EAAM,eAAA;AAAA,IACN,OAAA,EAAS,kBAAA;AAAA,IACT,OAAA,EAAS;AAAA,GACX;AAAA,EACA,QAAA,EAAU;AAAA,IACR,MAAA,EAAQ,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,MAAA,EAAO;AAAA,IAC/C,OAAA,EAAS,EAAE,aAAA,EAAe,IAAA,EAAK;AAAA,IAC/B,MAAM,EAAC;AAAA,IACP,eAAe,EAAC;AAAA,IAChB,OAAO,EAAC;AAAA,IACR,aAAa,EAAC;AAAA,IACd,WAAW,EAAC;AAAA,IACZ,OAAO;AAAC,GACV;AAAA,EACA,YAAA,EAAc,CAAC,GAAA,EAAK,IAAA,EAAM,MAAM,IAAA,EAAM,IAAA,EAAM,MAAM,IAAI;AACxD,CAAC;;;;"}
@@ -1,20 +1,14 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { forwardRef, useState, useEffect } from 'react';
3
- import clsx from 'clsx';
4
- import { useStyles } from '../../hooks/useStyles.esm.js';
3
+ import { useDefinition } from '../../hooks/useDefinition/useDefinition.esm.js';
5
4
  import { AvatarDefinition } from './definition.esm.js';
6
- import styles from './Avatar.module.css.esm.js';
7
5
 
8
6
  const Avatar = forwardRef((props, ref) => {
9
- const { classNames, dataAttributes, cleanedProps } = useStyles(
7
+ const { ownProps, restProps, dataAttributes } = useDefinition(
10
8
  AvatarDefinition,
11
- {
12
- size: "medium",
13
- purpose: "informative",
14
- ...props
15
- }
9
+ props
16
10
  );
17
- const { className, src, name, purpose, ...rest } = cleanedProps;
11
+ const { classes, size, src, name, purpose } = ownProps;
18
12
  const [imageStatus, setImageStatus] = useState("loading");
19
13
  useEffect(() => {
20
14
  setImageStatus("loading");
@@ -27,7 +21,7 @@ const Avatar = forwardRef((props, ref) => {
27
21
  img.onerror = null;
28
22
  };
29
23
  }, [src]);
30
- const initialsCount = ["x-small", "small"].includes(cleanedProps.size) ? 1 : 2;
24
+ const initialsCount = ["x-small", "small"].includes(size) ? 1 : 2;
31
25
  const initials = name.split(" ").map((word) => word[0]).join("").toLocaleUpperCase("en-US").slice(0, initialsCount);
32
26
  return /* @__PURE__ */ jsx(
33
27
  "div",
@@ -36,24 +30,10 @@ const Avatar = forwardRef((props, ref) => {
36
30
  role: "img",
37
31
  "aria-label": purpose === "informative" ? name : void 0,
38
32
  "aria-hidden": purpose === "decoration" ? true : void 0,
39
- className: clsx(classNames.root, styles[classNames.root], className),
33
+ className: classes.root,
40
34
  ...dataAttributes,
41
- ...rest,
42
- children: imageStatus === "loaded" ? /* @__PURE__ */ jsx(
43
- "img",
44
- {
45
- src,
46
- alt: "",
47
- className: clsx(classNames.image, styles[classNames.image])
48
- }
49
- ) : /* @__PURE__ */ jsx(
50
- "div",
51
- {
52
- "aria-hidden": "true",
53
- className: clsx(classNames.fallback, styles[classNames.fallback]),
54
- children: initials
55
- }
56
- )
35
+ ...restProps,
36
+ children: imageStatus === "loaded" ? /* @__PURE__ */ jsx("img", { src, alt: "", className: classes.image }) : /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: classes.fallback, children: initials })
57
37
  }
58
38
  );
59
39
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar.esm.js","sources":["../../../src/components/Avatar/Avatar.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, useState, useEffect } from 'react';\nimport clsx from 'clsx';\nimport { AvatarProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport { AvatarDefinition } from './definition';\nimport styles from './Avatar.module.css';\n\n/** @public */\nexport const Avatar = forwardRef<HTMLDivElement, AvatarProps>((props, ref) => {\n const { classNames, dataAttributes, cleanedProps } = useStyles(\n AvatarDefinition,\n {\n size: 'medium',\n purpose: 'informative',\n ...props,\n },\n );\n\n const { className, src, name, purpose, ...rest } = cleanedProps;\n\n const [imageStatus, setImageStatus] = useState<\n 'loading' | 'loaded' | 'error'\n >('loading');\n\n useEffect(() => {\n setImageStatus('loading');\n const img = new Image();\n img.onload = () => setImageStatus('loaded');\n img.onerror = () => setImageStatus('error');\n img.src = src;\n\n return () => {\n img.onload = null;\n img.onerror = null;\n };\n }, [src]);\n\n const initialsCount = ['x-small', 'small'].includes(cleanedProps.size)\n ? 1\n : 2;\n\n const initials = name\n .split(' ')\n .map(word => word[0])\n .join('')\n .toLocaleUpperCase('en-US')\n .slice(0, initialsCount);\n\n return (\n <div\n ref={ref}\n role=\"img\"\n aria-label={purpose === 'informative' ? name : undefined}\n aria-hidden={purpose === 'decoration' ? true : undefined}\n className={clsx(classNames.root, styles[classNames.root], className)}\n {...dataAttributes}\n {...rest}\n >\n {imageStatus === 'loaded' ? (\n <img\n src={src}\n alt=\"\"\n className={clsx(classNames.image, styles[classNames.image])}\n />\n ) : (\n <div\n aria-hidden=\"true\"\n className={clsx(classNames.fallback, styles[classNames.fallback])}\n >\n {initials}\n </div>\n )}\n </div>\n );\n});\n\nAvatar.displayName = 'Avatar';\n"],"names":[],"mappings":";;;;;;;AAwBO,MAAM,MAAA,GAAS,UAAA,CAAwC,CAAC,KAAA,EAAO,GAAA,KAAQ;AAC5E,EAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,YAAA,EAAa,GAAI,SAAA;AAAA,IACnD,gBAAA;AAAA,IACA;AAAA,MACE,IAAA,EAAM,QAAA;AAAA,MACN,OAAA,EAAS,aAAA;AAAA,MACT,GAAG;AAAA;AACL,GACF;AAEA,EAAA,MAAM,EAAE,SAAA,EAAW,GAAA,EAAK,MAAM,OAAA,EAAS,GAAG,MAAK,GAAI,YAAA;AAEnD,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAEpC,SAAS,CAAA;AAEX,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,cAAA,CAAe,SAAS,CAAA;AACxB,IAAA,MAAM,GAAA,GAAM,IAAI,KAAA,EAAM;AACtB,IAAA,GAAA,CAAI,MAAA,GAAS,MAAM,cAAA,CAAe,QAAQ,CAAA;AAC1C,IAAA,GAAA,CAAI,OAAA,GAAU,MAAM,cAAA,CAAe,OAAO,CAAA;AAC1C,IAAA,GAAA,CAAI,GAAA,GAAM,GAAA;AAEV,IAAA,OAAO,MAAM;AACX,MAAA,GAAA,CAAI,MAAA,GAAS,IAAA;AACb,MAAA,GAAA,CAAI,OAAA,GAAU,IAAA;AAAA,IAChB,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,GAAG,CAAC,CAAA;AAER,EAAA,MAAM,aAAA,GAAgB,CAAC,SAAA,EAAW,OAAO,EAAE,QAAA,CAAS,YAAA,CAAa,IAAI,CAAA,GACjE,CAAA,GACA,CAAA;AAEJ,EAAA,MAAM,WAAW,IAAA,CACd,KAAA,CAAM,GAAG,CAAA,CACT,GAAA,CAAI,UAAQ,IAAA,CAAK,CAAC,CAAC,CAAA,CACnB,IAAA,CAAK,EAAE,CAAA,CACP,iBAAA,CAAkB,OAAO,CAAA,CACzB,KAAA,CAAM,GAAG,aAAa,CAAA;AAEzB,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,IAAA,EAAK,KAAA;AAAA,MACL,YAAA,EAAY,OAAA,KAAY,aAAA,GAAgB,IAAA,GAAO,MAAA;AAAA,MAC/C,aAAA,EAAa,OAAA,KAAY,YAAA,GAAe,IAAA,GAAO,MAAA;AAAA,MAC/C,SAAA,EAAW,KAAK,UAAA,CAAW,IAAA,EAAM,OAAO,UAAA,CAAW,IAAI,GAAG,SAAS,CAAA;AAAA,MAClE,GAAG,cAAA;AAAA,MACH,GAAG,IAAA;AAAA,MAEH,0BAAgB,QAAA,mBACf,GAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,GAAA;AAAA,UACA,GAAA,EAAI,EAAA;AAAA,UACJ,WAAW,IAAA,CAAK,UAAA,CAAW,OAAO,MAAA,CAAO,UAAA,CAAW,KAAK,CAAC;AAAA;AAAA,OAC5D,mBAEA,GAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,aAAA,EAAY,MAAA;AAAA,UACZ,WAAW,IAAA,CAAK,UAAA,CAAW,UAAU,MAAA,CAAO,UAAA,CAAW,QAAQ,CAAC,CAAA;AAAA,UAE/D,QAAA,EAAA;AAAA;AAAA;AACH;AAAA,GAEJ;AAEJ,CAAC;AAED,MAAA,CAAO,WAAA,GAAc,QAAA;;;;"}
1
+ {"version":3,"file":"Avatar.esm.js","sources":["../../../src/components/Avatar/Avatar.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, useState, useEffect } from 'react';\nimport { AvatarProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { AvatarDefinition } from './definition';\n\n/** @public */\nexport const Avatar = forwardRef<HTMLDivElement, AvatarProps>((props, ref) => {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n AvatarDefinition,\n props,\n );\n\n const { classes, size, src, name, purpose } = ownProps;\n\n const [imageStatus, setImageStatus] = useState<\n 'loading' | 'loaded' | 'error'\n >('loading');\n\n useEffect(() => {\n setImageStatus('loading');\n const img = new Image();\n img.onload = () => setImageStatus('loaded');\n img.onerror = () => setImageStatus('error');\n img.src = src;\n\n return () => {\n img.onload = null;\n img.onerror = null;\n };\n }, [src]);\n\n const initialsCount = ['x-small', 'small'].includes(size) ? 1 : 2;\n\n const initials = name\n .split(' ')\n .map(word => word[0])\n .join('')\n .toLocaleUpperCase('en-US')\n .slice(0, initialsCount);\n\n return (\n <div\n ref={ref}\n role=\"img\"\n aria-label={purpose === 'informative' ? name : undefined}\n aria-hidden={purpose === 'decoration' ? true : undefined}\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n >\n {imageStatus === 'loaded' ? (\n <img src={src} alt=\"\" className={classes.image} />\n ) : (\n <div aria-hidden=\"true\" className={classes.fallback}>\n {initials}\n </div>\n )}\n </div>\n );\n});\n\nAvatar.displayName = 'Avatar';\n"],"names":[],"mappings":";;;;;AAsBO,MAAM,MAAA,GAAS,UAAA,CAAwC,CAAC,KAAA,EAAO,GAAA,KAAQ;AAC5E,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,cAAA,EAAe,GAAI,aAAA;AAAA,IAC9C,gBAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAA,MAAM,EAAE,OAAA,EAAS,IAAA,EAAM,GAAA,EAAK,IAAA,EAAM,SAAQ,GAAI,QAAA;AAE9C,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAEpC,SAAS,CAAA;AAEX,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,cAAA,CAAe,SAAS,CAAA;AACxB,IAAA,MAAM,GAAA,GAAM,IAAI,KAAA,EAAM;AACtB,IAAA,GAAA,CAAI,MAAA,GAAS,MAAM,cAAA,CAAe,QAAQ,CAAA;AAC1C,IAAA,GAAA,CAAI,OAAA,GAAU,MAAM,cAAA,CAAe,OAAO,CAAA;AAC1C,IAAA,GAAA,CAAI,GAAA,GAAM,GAAA;AAEV,IAAA,OAAO,MAAM;AACX,MAAA,GAAA,CAAI,MAAA,GAAS,IAAA;AACb,MAAA,GAAA,CAAI,OAAA,GAAU,IAAA;AAAA,IAChB,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,GAAG,CAAC,CAAA;AAER,EAAA,MAAM,aAAA,GAAgB,CAAC,SAAA,EAAW,OAAO,EAAE,QAAA,CAAS,IAAI,IAAI,CAAA,GAAI,CAAA;AAEhE,EAAA,MAAM,WAAW,IAAA,CACd,KAAA,CAAM,GAAG,CAAA,CACT,GAAA,CAAI,UAAQ,IAAA,CAAK,CAAC,CAAC,CAAA,CACnB,IAAA,CAAK,EAAE,CAAA,CACP,iBAAA,CAAkB,OAAO,CAAA,CACzB,KAAA,CAAM,GAAG,aAAa,CAAA;AAEzB,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,IAAA,EAAK,KAAA;AAAA,MACL,YAAA,EAAY,OAAA,KAAY,aAAA,GAAgB,IAAA,GAAO,MAAA;AAAA,MAC/C,aAAA,EAAa,OAAA,KAAY,YAAA,GAAe,IAAA,GAAO,MAAA;AAAA,MAC/C,WAAW,OAAA,CAAQ,IAAA;AAAA,MAClB,GAAG,cAAA;AAAA,MACH,GAAG,SAAA;AAAA,MAEH,0BAAgB,QAAA,mBACf,GAAA,CAAC,SAAI,GAAA,EAAU,GAAA,EAAI,IAAG,SAAA,EAAW,OAAA,CAAQ,KAAA,EAAO,CAAA,uBAE/C,KAAA,EAAA,EAAI,aAAA,EAAY,QAAO,SAAA,EAAW,OAAA,CAAQ,UACxC,QAAA,EAAA,QAAA,EACH;AAAA;AAAA,GAEJ;AAEJ,CAAC;AAED,MAAA,CAAO,WAAA,GAAc,QAAA;;;;"}
@@ -1,13 +1,27 @@
1
- const AvatarDefinition = {
1
+ import 'react/jsx-runtime';
2
+ import 'clsx';
3
+ import '../../hooks/useBreakpoint.esm.js';
4
+ import '../../hooks/useBg.esm.js';
5
+ import '../../hooks/useDefinition/helpers.esm.js';
6
+ import '../../analytics/useAnalytics.esm.js';
7
+ import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
8
+ import styles from './Avatar.module.css.esm.js';
9
+
10
+ const AvatarDefinition = defineComponent()({
11
+ styles,
2
12
  classNames: {
3
13
  root: "bui-AvatarRoot",
4
14
  image: "bui-AvatarImage",
5
15
  fallback: "bui-AvatarFallback"
6
16
  },
7
- dataAttributes: {
8
- size: ["small", "medium", "large"]
17
+ propDefs: {
18
+ size: { dataAttribute: true, default: "medium" },
19
+ purpose: { default: "informative" },
20
+ src: {},
21
+ name: {},
22
+ className: {}
9
23
  }
10
- };
24
+ });
11
25
 
12
26
  export { AvatarDefinition };
13
27
  //# sourceMappingURL=definition.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Avatar/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 Avatar\n * @public\n */\nexport const AvatarDefinition = {\n classNames: {\n root: 'bui-AvatarRoot',\n image: 'bui-AvatarImage',\n fallback: 'bui-AvatarFallback',\n },\n dataAttributes: {\n size: ['small', 'medium', 'large'] as const,\n },\n} as const satisfies ComponentDefinition;\n"],"names":[],"mappings":"AAsBO,MAAM,gBAAA,GAAmB;AAAA,EAC9B,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,gBAAA;AAAA,IACN,KAAA,EAAO,iBAAA;AAAA,IACP,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,IAAA,EAAM,CAAC,OAAA,EAAS,QAAA,EAAU,OAAO;AAAA;AAErC;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Avatar/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 { AvatarOwnProps } from './types';\nimport styles from './Avatar.module.css';\n\n/**\n * Component definition for Avatar\n * @public\n */\nexport const AvatarDefinition = defineComponent<AvatarOwnProps>()({\n styles,\n classNames: {\n root: 'bui-AvatarRoot',\n image: 'bui-AvatarImage',\n fallback: 'bui-AvatarFallback',\n },\n propDefs: {\n size: { dataAttribute: true, default: 'medium' },\n purpose: { default: 'informative' },\n src: {},\n name: {},\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,gBAAA,GAAmB,iBAAgC,CAAE;AAAA,EAChE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,gBAAA;AAAA,IACN,KAAA,EAAO,iBAAA;AAAA,IACP,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,QAAA,EAAS;AAAA,IAC/C,OAAA,EAAS,EAAE,OAAA,EAAS,aAAA,EAAc;AAAA,IAClC,KAAK,EAAC;AAAA,IACN,MAAM,EAAC;AAAA,IACP,WAAW;AAAC;AAEhB,CAAC;;;;"}
@@ -1,8 +1,9 @@
1
1
  import 'react/jsx-runtime';
2
2
  import 'clsx';
3
- import 'react';
3
+ import '../../hooks/useBreakpoint.esm.js';
4
4
  import '../../hooks/useBg.esm.js';
5
5
  import '../../hooks/useDefinition/helpers.esm.js';
6
+ import '../../analytics/useAnalytics.esm.js';
6
7
  import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
7
8
  import styles from './Box.module.css.esm.js';
8
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Box/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 { BoxOwnProps } from './types';\nimport styles from './Box.module.css';\n\n/**\n * Component definition for Box\n * @public\n */\nexport const BoxDefinition = defineComponent<BoxOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Box',\n },\n bg: 'provider',\n propDefs: {\n as: { default: 'div' },\n bg: { dataAttribute: true },\n children: {},\n className: {},\n style: {},\n },\n utilityProps: [\n 'm',\n 'mb',\n 'ml',\n 'mr',\n 'mt',\n 'mx',\n 'my',\n 'p',\n 'pb',\n 'pl',\n 'pr',\n 'pt',\n 'px',\n 'py',\n 'position',\n 'display',\n 'width',\n 'minWidth',\n 'maxWidth',\n 'height',\n 'minHeight',\n 'maxHeight',\n ],\n});\n"],"names":[],"mappings":";;;;;;;;AAwBO,MAAM,aAAA,GAAgB,iBAA6B,CAAE;AAAA,EAC1D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,EAAA,EAAI,UAAA;AAAA,EACJ,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,EAAE,OAAA,EAAS,KAAA,EAAM;AAAA,IACrB,EAAA,EAAI,EAAE,aAAA,EAAe,IAAA,EAAK;AAAA,IAC1B,UAAU,EAAC;AAAA,IACX,WAAW,EAAC;AAAA,IACZ,OAAO;AAAC,GACV;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,GAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,GAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,UAAA;AAAA,IACA,SAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Box/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 { BoxOwnProps } from './types';\nimport styles from './Box.module.css';\n\n/**\n * Component definition for Box\n * @public\n */\nexport const BoxDefinition = defineComponent<BoxOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Box',\n },\n bg: 'provider',\n propDefs: {\n as: { default: 'div' },\n bg: { dataAttribute: true },\n children: {},\n className: {},\n style: {},\n },\n utilityProps: [\n 'm',\n 'mb',\n 'ml',\n 'mr',\n 'mt',\n 'mx',\n 'my',\n 'p',\n 'pb',\n 'pl',\n 'pr',\n 'pt',\n 'px',\n 'py',\n 'position',\n 'display',\n 'width',\n 'minWidth',\n 'maxWidth',\n 'height',\n 'minHeight',\n 'maxHeight',\n ],\n});\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,aAAA,GAAgB,iBAA6B,CAAE;AAAA,EAC1D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,EAAA,EAAI,UAAA;AAAA,EACJ,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,EAAE,OAAA,EAAS,KAAA,EAAM;AAAA,IACrB,EAAA,EAAI,EAAE,aAAA,EAAe,IAAA,EAAK;AAAA,IAC1B,UAAU,EAAC;AAAA,IACX,WAAW,EAAC;AAAA,IACZ,OAAO;AAAC,GACV;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,GAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,GAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,UAAA;AAAA,IACA,SAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA;AAEJ,CAAC;;;;"}
@@ -1,8 +1,9 @@
1
1
  import 'react/jsx-runtime';
2
2
  import 'clsx';
3
- import 'react';
3
+ import '../../hooks/useBreakpoint.esm.js';
4
4
  import '../../hooks/useBg.esm.js';
5
5
  import '../../hooks/useDefinition/helpers.esm.js';
6
+ import '../../analytics/useAnalytics.esm.js';
6
7
  import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
7
8
  import styles from './Button.module.css.esm.js';
8
9
 
@@ -22,8 +23,7 @@ const ButtonDefinition = defineComponent()({
22
23
  iconStart: {},
23
24
  iconEnd: {},
24
25
  children: {},
25
- className: {},
26
- style: {}
26
+ className: {}
27
27
  }
28
28
  });
29
29
 
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Button/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 { ButtonOwnProps } from './types';\nimport styles from './Button.module.css';\n\n/**\n * Component definition for Button\n * @public\n */\nexport const ButtonDefinition = defineComponent<ButtonOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Button',\n content: 'bui-ButtonContent',\n spinner: 'bui-ButtonSpinner',\n },\n bg: 'consumer',\n propDefs: {\n size: { dataAttribute: true, default: 'small' },\n variant: { dataAttribute: true, default: 'primary' },\n destructive: { dataAttribute: true },\n loading: { dataAttribute: true },\n iconStart: {},\n iconEnd: {},\n children: {},\n className: {},\n style: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;AAwBO,MAAM,gBAAA,GAAmB,iBAAgC,CAAE;AAAA,EAChE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,YAAA;AAAA,IACN,OAAA,EAAS,mBAAA;AAAA,IACT,OAAA,EAAS;AAAA,GACX;AAAA,EACA,EAAA,EAAI,UAAA;AAAA,EACJ,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,OAAA,EAAS,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,SAAA,EAAU;AAAA,IACnD,WAAA,EAAa,EAAE,aAAA,EAAe,IAAA,EAAK;AAAA,IACnC,OAAA,EAAS,EAAE,aAAA,EAAe,IAAA,EAAK;AAAA,IAC/B,WAAW,EAAC;AAAA,IACZ,SAAS,EAAC;AAAA,IACV,UAAU,EAAC;AAAA,IACX,WAAW,EAAC;AAAA,IACZ,OAAO;AAAC;AAEZ,CAAC;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Button/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 { ButtonOwnProps } from './types';\nimport styles from './Button.module.css';\n\n/**\n * Component definition for Button\n * @public\n */\nexport const ButtonDefinition = defineComponent<ButtonOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Button',\n content: 'bui-ButtonContent',\n spinner: 'bui-ButtonSpinner',\n },\n bg: 'consumer',\n propDefs: {\n size: { dataAttribute: true, default: 'small' },\n variant: { dataAttribute: true, default: 'primary' },\n destructive: { dataAttribute: true },\n loading: { dataAttribute: true },\n iconStart: {},\n iconEnd: {},\n children: {},\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,gBAAA,GAAmB,iBAAgC,CAAE;AAAA,EAChE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,YAAA;AAAA,IACN,OAAA,EAAS,mBAAA;AAAA,IACT,OAAA,EAAS;AAAA,GACX;AAAA,EACA,EAAA,EAAI,UAAA;AAAA,EACJ,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,OAAA,EAAS,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,SAAA,EAAU;AAAA,IACnD,WAAA,EAAa,EAAE,aAAA,EAAe,IAAA,EAAK;AAAA,IACnC,OAAA,EAAS,EAAE,aAAA,EAAe,IAAA,EAAK;AAAA,IAC/B,WAAW,EAAC;AAAA,IACZ,SAAS,EAAC;AAAA,IACV,UAAU,EAAC;AAAA,IACX,WAAW;AAAC;AAEhB,CAAC;;;;"}
@@ -1,8 +1,9 @@
1
1
  import 'react/jsx-runtime';
2
2
  import 'clsx';
3
- import 'react';
3
+ import '../../hooks/useBreakpoint.esm.js';
4
4
  import '../../hooks/useBg.esm.js';
5
5
  import '../../hooks/useDefinition/helpers.esm.js';
6
+ import '../../analytics/useAnalytics.esm.js';
6
7
  import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
7
8
  import styles from './ButtonIcon.module.css.esm.js';
8
9
 
@@ -19,8 +20,7 @@ const ButtonIconDefinition = defineComponent()({
19
20
  variant: { dataAttribute: true, default: "primary" },
20
21
  loading: { dataAttribute: true },
21
22
  icon: {},
22
- className: {},
23
- style: {}
23
+ className: {}
24
24
  }
25
25
  });
26
26
 
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/ButtonIcon/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 { ButtonIconOwnProps } from './types';\nimport styles from './ButtonIcon.module.css';\n\n/**\n * Component definition for ButtonIcon\n * @public\n */\nexport const ButtonIconDefinition = defineComponent<ButtonIconOwnProps>()({\n styles,\n classNames: {\n root: 'bui-ButtonIcon',\n content: 'bui-ButtonIconContent',\n spinner: 'bui-ButtonIconSpinner',\n },\n bg: 'consumer',\n propDefs: {\n size: { dataAttribute: true, default: 'small' },\n variant: { dataAttribute: true, default: 'primary' },\n loading: { dataAttribute: true },\n icon: {},\n className: {},\n style: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;AAwBO,MAAM,oBAAA,GAAuB,iBAAoC,CAAE;AAAA,EACxE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,gBAAA;AAAA,IACN,OAAA,EAAS,uBAAA;AAAA,IACT,OAAA,EAAS;AAAA,GACX;AAAA,EACA,EAAA,EAAI,UAAA;AAAA,EACJ,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,OAAA,EAAS,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,SAAA,EAAU;AAAA,IACnD,OAAA,EAAS,EAAE,aAAA,EAAe,IAAA,EAAK;AAAA,IAC/B,MAAM,EAAC;AAAA,IACP,WAAW,EAAC;AAAA,IACZ,OAAO;AAAC;AAEZ,CAAC;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/ButtonIcon/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 { ButtonIconOwnProps } from './types';\nimport styles from './ButtonIcon.module.css';\n\n/**\n * Component definition for ButtonIcon\n * @public\n */\nexport const ButtonIconDefinition = defineComponent<ButtonIconOwnProps>()({\n styles,\n classNames: {\n root: 'bui-ButtonIcon',\n content: 'bui-ButtonIconContent',\n spinner: 'bui-ButtonIconSpinner',\n },\n bg: 'consumer',\n propDefs: {\n size: { dataAttribute: true, default: 'small' },\n variant: { dataAttribute: true, default: 'primary' },\n loading: { dataAttribute: true },\n icon: {},\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,oBAAA,GAAuB,iBAAoC,CAAE;AAAA,EACxE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,gBAAA;AAAA,IACN,OAAA,EAAS,uBAAA;AAAA,IACT,OAAA,EAAS;AAAA,GACX;AAAA,EACA,EAAA,EAAI,UAAA;AAAA,EACJ,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,OAAA,EAAS,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,SAAA,EAAU;AAAA,IACnD,OAAA,EAAS,EAAE,aAAA,EAAe,IAAA,EAAK;AAAA,IAC/B,MAAM,EAAC;AAAA,IACP,WAAW;AAAC;AAEhB,CAAC;;;;"}
@@ -4,14 +4,22 @@ import { Link } from 'react-aria-components';
4
4
  import { useDefinition } from '../../hooks/useDefinition/useDefinition.esm.js';
5
5
  import { ButtonLinkDefinition } from './definition.esm.js';
6
6
  import { InternalLinkProvider } from '../InternalLinkProvider/InternalLinkProvider.esm.js';
7
+ import { getNodeText } from '../../analytics/getNodeText.esm.js';
7
8
 
8
9
  const ButtonLink = forwardRef(
9
10
  (props, ref) => {
10
- const { ownProps, restProps, dataAttributes } = useDefinition(
11
+ const { ownProps, restProps, dataAttributes, analytics } = useDefinition(
11
12
  ButtonLinkDefinition,
12
13
  props
13
14
  );
14
15
  const { classes, iconStart, iconEnd, children } = ownProps;
16
+ const handlePress = (e) => {
17
+ restProps.onPress?.(e);
18
+ const text = restProps["aria-label"] ?? getNodeText(children) ?? String(restProps.href ?? "");
19
+ analytics.captureEvent("click", text, {
20
+ attributes: { to: String(restProps.href ?? "") }
21
+ });
22
+ };
15
23
  return /* @__PURE__ */ jsx(InternalLinkProvider, { href: restProps.href, children: /* @__PURE__ */ jsx(
16
24
  Link,
17
25
  {
@@ -19,6 +27,7 @@ const ButtonLink = forwardRef(
19
27
  ref,
20
28
  ...dataAttributes,
21
29
  ...restProps,
30
+ onPress: handlePress,
22
31
  children: /* @__PURE__ */ jsxs("span", { className: classes.content, children: [
23
32
  iconStart,
24
33
  children,