@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/Tabs/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ComponentDefinition } from '../../types';\n\n/**\n * Component definition for Tabs\n * @public\n */\nexport const TabsDefinition = {\n classNames: {\n tabs: 'bui-Tabs',\n tabList: 'bui-TabList',\n tabListWrapper: 'bui-TabListWrapper',\n tab: 'bui-Tab',\n tabActive: 'bui-TabActive',\n tabHovered: 'bui-TabHovered',\n panel: 'bui-TabPanel',\n },\n} as const satisfies ComponentDefinition;\n"],"names":[],"mappings":"AAsBO,MAAM,cAAA,GAAiB;AAAA,EAC5B,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,UAAA;AAAA,IACN,OAAA,EAAS,aAAA;AAAA,IACT,cAAA,EAAgB,oBAAA;AAAA,IAChB,GAAA,EAAK,SAAA;AAAA,IACL,SAAA,EAAW,eAAA;AAAA,IACX,UAAA,EAAY,gBAAA;AAAA,IACZ,KAAA,EAAO;AAAA;AAEX;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Tabs/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type {\n TabsOwnProps,\n TabListOwnProps,\n TabOwnProps,\n TabPanelOwnProps,\n TabsIndicatorsOwnProps,\n} from './types';\nimport styles from './Tabs.module.css';\n\n/**\n * Component definition for Tabs\n * @public\n */\nexport const TabsDefinition = defineComponent<TabsOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Tabs',\n },\n propDefs: {\n className: {},\n children: {},\n },\n});\n\n/** @internal */\nexport const TabListDefinition = defineComponent<TabListOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TabListWrapper',\n tabList: 'bui-TabList',\n },\n propDefs: {\n className: {},\n children: {},\n },\n});\n\n/** @internal */\nexport const TabDefinition = defineComponent<TabOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Tab',\n },\n propDefs: {\n className: {},\n matchStrategy: {},\n href: {},\n id: {},\n },\n});\n\n/** @internal */\nexport const TabPanelDefinition = defineComponent<TabPanelOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TabPanel',\n },\n propDefs: {\n className: {},\n },\n});\n\n/** @internal */\nexport const TabsIndicatorsDefinition =\n defineComponent<TabsIndicatorsOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TabActive',\n hovered: 'bui-TabHovered',\n },\n propDefs: {\n tabRefs: {},\n tabsRef: {},\n hoveredKey: {},\n prevHoveredKey: {},\n },\n });\n"],"names":[],"mappings":";;;;;;;;AA8BO,MAAM,cAAA,GAAiB,iBAA8B,CAAE;AAAA,EAC5D,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;AAGM,MAAM,iBAAA,GAAoB,iBAAiC,CAAE;AAAA,EAClE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,oBAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,UAAU;AAAC;AAEf,CAAC;AAGM,MAAM,aAAA,GAAgB,iBAA6B,CAAE;AAAA,EAC1D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,eAAe,EAAC;AAAA,IAChB,MAAM,EAAC;AAAA,IACP,IAAI;AAAC;AAET,CAAC;AAGM,MAAM,kBAAA,GAAqB,iBAAkC,CAAE;AAAA,EACpE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW;AAAC;AAEhB,CAAC;AAGM,MAAM,wBAAA,GACX,iBAAwC,CAAE;AAAA,EACxC,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,eAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,QAAA,EAAU;AAAA,IACR,SAAS,EAAC;AAAA,IACV,SAAS,EAAC;AAAA,IACV,YAAY,EAAC;AAAA,IACb,gBAAgB;AAAC;AAErB,CAAC;;;;"}
@@ -2,76 +2,49 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { Tag as Tag$1, Button, TagGroup as TagGroup$1, TagList } from 'react-aria-components';
3
3
  import { forwardRef } from 'react';
4
4
  import { RiCloseCircleLine } from '@remixicon/react';
5
- import clsx from 'clsx';
6
- import { useStyles } from '../../hooks/useStyles.esm.js';
7
- import { TagGroupDefinition } from './definition.esm.js';
5
+ import { useDefinition } from '../../hooks/useDefinition/useDefinition.esm.js';
6
+ import { TagDefinition, TagGroupDefinition } from './definition.esm.js';
8
7
  import { createRoutingRegistration } from '../InternalLinkProvider/InternalLinkProvider.esm.js';
9
- import styles from './TagGroup.module.css.esm.js';
10
8
 
11
9
  const { RoutingProvider, useRoutingRegistrationEffect } = createRoutingRegistration();
12
10
  const TagGroup = (props) => {
13
- const { classNames, cleanedProps } = useStyles(TagGroupDefinition, props);
14
- const { items, children, renderEmptyState, ...rest } = cleanedProps;
15
- return /* @__PURE__ */ jsx(RoutingProvider, { children: /* @__PURE__ */ jsx(
16
- TagGroup$1,
11
+ const { ownProps, restProps } = useDefinition(TagGroupDefinition, props);
12
+ const { classes, items, children, renderEmptyState } = ownProps;
13
+ return /* @__PURE__ */ jsx(RoutingProvider, { children: /* @__PURE__ */ jsx(TagGroup$1, { className: classes.root, ...restProps, children: /* @__PURE__ */ jsx(
14
+ TagList,
17
15
  {
18
- className: clsx(classNames.group, styles[classNames.group]),
19
- ...rest,
20
- children: /* @__PURE__ */ jsx(
21
- TagList,
22
- {
23
- className: clsx(classNames.list, styles[classNames.list]),
24
- items,
25
- renderEmptyState,
26
- children
27
- }
28
- )
16
+ className: classes.list,
17
+ items,
18
+ renderEmptyState,
19
+ children
29
20
  }
30
- ) });
21
+ ) }) });
31
22
  };
32
- const Tag = forwardRef(
33
- (props, ref) => {
34
- const { classNames, cleanedProps } = useStyles(TagGroupDefinition, {
35
- size: "small",
36
- ...props
37
- });
38
- const { children, className, icon, size, href, ...rest } = cleanedProps;
39
- const textValue = typeof children === "string" ? children : void 0;
40
- useRoutingRegistrationEffect(href);
41
- return /* @__PURE__ */ jsx(
42
- Tag$1,
43
- {
44
- ref,
45
- textValue,
46
- className: clsx(classNames.tag, styles[classNames.tag], className),
47
- "data-size": size,
48
- href,
49
- ...rest,
50
- children: ({ allowsRemoving }) => /* @__PURE__ */ jsxs(Fragment, { children: [
51
- icon && /* @__PURE__ */ jsx(
52
- "span",
53
- {
54
- className: clsx(classNames.tagIcon, styles[classNames.tagIcon]),
55
- children: icon
56
- }
57
- ),
58
- children,
59
- allowsRemoving && /* @__PURE__ */ jsx(
60
- Button,
61
- {
62
- className: clsx(
63
- classNames.tagRemoveButton,
64
- styles[classNames.tagRemoveButton]
65
- ),
66
- slot: "remove",
67
- children: /* @__PURE__ */ jsx(RiCloseCircleLine, { size: 16 })
68
- }
69
- )
70
- ] })
71
- }
72
- );
73
- }
74
- );
23
+ const Tag = forwardRef((props, ref) => {
24
+ const { ownProps, restProps, dataAttributes } = useDefinition(
25
+ TagDefinition,
26
+ props
27
+ );
28
+ const { classes, children, icon, href } = ownProps;
29
+ const textValue = typeof children === "string" ? children : void 0;
30
+ useRoutingRegistrationEffect(href);
31
+ return /* @__PURE__ */ jsx(
32
+ Tag$1,
33
+ {
34
+ ref,
35
+ textValue,
36
+ className: classes.root,
37
+ href,
38
+ ...dataAttributes,
39
+ ...restProps,
40
+ children: ({ allowsRemoving }) => /* @__PURE__ */ jsxs(Fragment, { children: [
41
+ icon && /* @__PURE__ */ jsx("span", { className: classes.icon, children: icon }),
42
+ children,
43
+ allowsRemoving && /* @__PURE__ */ jsx(Button, { className: classes.removeButton, slot: "remove", children: /* @__PURE__ */ jsx(RiCloseCircleLine, { size: 16 }) })
44
+ ] })
45
+ }
46
+ );
47
+ });
75
48
 
76
49
  export { Tag, TagGroup };
77
50
  //# sourceMappingURL=TagGroup.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TagGroup.esm.js","sources":["../../../src/components/TagGroup/TagGroup.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { TagProps, TagGroupProps } from './types';\nimport {\n TagGroup as ReactAriaTagGroup,\n TagList as ReactAriaTagList,\n Tag as ReactAriaTag,\n Button as ReactAriaButton,\n} from 'react-aria-components';\nimport { forwardRef, type PropsWithRef, type ReactNode, type Ref } from 'react';\nimport { RiCloseCircleLine } from '@remixicon/react';\nimport clsx from 'clsx';\nimport { useStyles } from '../../hooks/useStyles';\nimport { TagGroupDefinition } from './definition';\nimport { createRoutingRegistration } from '../InternalLinkProvider';\nimport styles from './TagGroup.module.css';\n\nconst { RoutingProvider, useRoutingRegistrationEffect } =\n createRoutingRegistration();\n\n/**\n * A component that renders a list of tags.\n *\n * @public\n */\nexport const TagGroup = <T extends object>(props: TagGroupProps<T>) => {\n const { classNames, cleanedProps } = useStyles(TagGroupDefinition, props);\n const { items, children, renderEmptyState, ...rest } = cleanedProps;\n\n return (\n <RoutingProvider>\n <ReactAriaTagGroup\n className={clsx(classNames.group, styles[classNames.group])}\n {...rest}\n >\n <ReactAriaTagList\n className={clsx(classNames.list, styles[classNames.list])}\n items={items}\n renderEmptyState={renderEmptyState}\n >\n {children}\n </ReactAriaTagList>\n </ReactAriaTagGroup>\n </RoutingProvider>\n );\n};\n\n/**\n * A component that renders a tag.\n *\n * @public\n */\nexport const Tag = forwardRef(\n (props: PropsWithRef<TagProps>, ref: Ref<HTMLDivElement>) => {\n const { classNames, cleanedProps } = useStyles(TagGroupDefinition, {\n size: 'small',\n ...props,\n });\n const { children, className, icon, size, href, ...rest } = cleanedProps;\n const textValue = typeof children === 'string' ? children : undefined;\n\n useRoutingRegistrationEffect(href);\n\n return (\n <ReactAriaTag\n ref={ref}\n textValue={textValue}\n className={clsx(classNames.tag, styles[classNames.tag], className)}\n data-size={size}\n href={href}\n {...rest}\n >\n {({ allowsRemoving }) => (\n <>\n {icon && (\n <span\n className={clsx(classNames.tagIcon, styles[classNames.tagIcon])}\n >\n {icon}\n </span>\n )}\n {children as ReactNode}\n {allowsRemoving && (\n <ReactAriaButton\n className={clsx(\n classNames.tagRemoveButton,\n styles[classNames.tagRemoveButton],\n )}\n slot=\"remove\"\n >\n <RiCloseCircleLine size={16} />\n </ReactAriaButton>\n )}\n </>\n )}\n </ReactAriaTag>\n );\n },\n);\n"],"names":["ReactAriaTagGroup","ReactAriaTagList","ReactAriaTag","ReactAriaButton"],"mappings":";;;;;;;;;;AA+BA,MAAM,EAAE,eAAA,EAAiB,4BAAA,EAA6B,GACpD,yBAAA,EAA0B;AAOrB,MAAM,QAAA,GAAW,CAAmB,KAAA,KAA4B;AACrE,EAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,SAAA,CAAU,oBAAoB,KAAK,CAAA;AACxE,EAAA,MAAM,EAAE,KAAA,EAAO,QAAA,EAAU,gBAAA,EAAkB,GAAG,MAAK,GAAI,YAAA;AAEvD,EAAA,2BACG,eAAA,EAAA,EACC,QAAA,kBAAA,GAAA;AAAA,IAACA,UAAA;AAAA,IAAA;AAAA,MACC,WAAW,IAAA,CAAK,UAAA,CAAW,OAAO,MAAA,CAAO,UAAA,CAAW,KAAK,CAAC,CAAA;AAAA,MACzD,GAAG,IAAA;AAAA,MAEJ,QAAA,kBAAA,GAAA;AAAA,QAACC,OAAA;AAAA,QAAA;AAAA,UACC,WAAW,IAAA,CAAK,UAAA,CAAW,MAAM,MAAA,CAAO,UAAA,CAAW,IAAI,CAAC,CAAA;AAAA,UACxD,KAAA;AAAA,UACA,gBAAA;AAAA,UAEC;AAAA;AAAA;AACH;AAAA,GACF,EACF,CAAA;AAEJ;AAOO,MAAM,GAAA,GAAM,UAAA;AAAA,EACjB,CAAC,OAA+B,GAAA,KAA6B;AAC3D,IAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,UAAU,kBAAA,EAAoB;AAAA,MACjE,IAAA,EAAM,OAAA;AAAA,MACN,GAAG;AAAA,KACJ,CAAA;AACD,IAAA,MAAM,EAAE,UAAU,SAAA,EAAW,IAAA,EAAM,MAAM,IAAA,EAAM,GAAG,MAAK,GAAI,YAAA;AAC3D,IAAA,MAAM,SAAA,GAAY,OAAO,QAAA,KAAa,QAAA,GAAW,QAAA,GAAW,MAAA;AAE5D,IAAA,4BAAA,CAA6B,IAAI,CAAA;AAEjC,IAAA,uBACE,GAAA;AAAA,MAACC,KAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,SAAA;AAAA,QACA,SAAA,EAAW,KAAK,UAAA,CAAW,GAAA,EAAK,OAAO,UAAA,CAAW,GAAG,GAAG,SAAS,CAAA;AAAA,QACjE,WAAA,EAAW,IAAA;AAAA,QACX,IAAA;AAAA,QACC,GAAG,IAAA;AAAA,QAEH,QAAA,EAAA,CAAC,EAAE,cAAA,EAAe,qBACjB,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,UAAA,IAAA,oBACC,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,WAAW,IAAA,CAAK,UAAA,CAAW,SAAS,MAAA,CAAO,UAAA,CAAW,OAAO,CAAC,CAAA;AAAA,cAE7D,QAAA,EAAA;AAAA;AAAA,WACH;AAAA,UAED,QAAA;AAAA,UACA,cAAA,oBACC,GAAA;AAAA,YAACC,MAAA;AAAA,YAAA;AAAA,cACC,SAAA,EAAW,IAAA;AAAA,gBACT,UAAA,CAAW,eAAA;AAAA,gBACX,MAAA,CAAO,WAAW,eAAe;AAAA,eACnC;AAAA,cACA,IAAA,EAAK,QAAA;AAAA,cAEL,QAAA,kBAAA,GAAA,CAAC,iBAAA,EAAA,EAAkB,IAAA,EAAM,EAAA,EAAI;AAAA;AAAA;AAC/B,SAAA,EAEJ;AAAA;AAAA,KAEJ;AAAA,EAEJ;AACF;;;;"}
1
+ {"version":3,"file":"TagGroup.esm.js","sources":["../../../src/components/TagGroup/TagGroup.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { TagProps, TagGroupProps } from './types';\nimport {\n TagGroup as ReactAriaTagGroup,\n TagList as ReactAriaTagList,\n Tag as ReactAriaTag,\n Button as ReactAriaButton,\n} from 'react-aria-components';\nimport { forwardRef, type ReactNode } from 'react';\nimport { RiCloseCircleLine } from '@remixicon/react';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TagGroupDefinition, TagDefinition } from './definition';\nimport { createRoutingRegistration } from '../InternalLinkProvider';\n\nconst { RoutingProvider, useRoutingRegistrationEffect } =\n createRoutingRegistration();\n\n/**\n * A component that renders a list of tags.\n *\n * @public\n */\nexport const TagGroup = <T extends object>(props: TagGroupProps<T>) => {\n const { ownProps, restProps } = useDefinition(TagGroupDefinition, props);\n const { classes, items, children, renderEmptyState } = ownProps;\n\n return (\n <RoutingProvider>\n <ReactAriaTagGroup className={classes.root} {...restProps}>\n <ReactAriaTagList\n className={classes.list}\n items={items}\n renderEmptyState={renderEmptyState}\n >\n {children}\n </ReactAriaTagList>\n </ReactAriaTagGroup>\n </RoutingProvider>\n );\n};\n\n/**\n * A component that renders a tag.\n *\n * @public\n */\nexport const Tag = forwardRef<HTMLDivElement, TagProps>((props, ref) => {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n TagDefinition,\n props,\n );\n const { classes, children, icon, href } = ownProps;\n const textValue = typeof children === 'string' ? children : undefined;\n\n useRoutingRegistrationEffect(href);\n\n return (\n <ReactAriaTag\n ref={ref}\n textValue={textValue}\n className={classes.root}\n href={href}\n {...dataAttributes}\n {...restProps}\n >\n {({ allowsRemoving }) => (\n <>\n {icon && <span className={classes.icon}>{icon}</span>}\n {children as ReactNode}\n {allowsRemoving && (\n <ReactAriaButton className={classes.removeButton} slot=\"remove\">\n <RiCloseCircleLine size={16} />\n </ReactAriaButton>\n )}\n </>\n )}\n </ReactAriaTag>\n );\n});\n"],"names":["ReactAriaTagGroup","ReactAriaTagList","ReactAriaTag","ReactAriaButton"],"mappings":";;;;;;;;AA6BA,MAAM,EAAE,eAAA,EAAiB,4BAAA,EAA6B,GACpD,yBAAA,EAA0B;AAOrB,MAAM,QAAA,GAAW,CAAmB,KAAA,KAA4B;AACrE,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAU,GAAI,aAAA,CAAc,oBAAoB,KAAK,CAAA;AACvE,EAAA,MAAM,EAAE,OAAA,EAAS,KAAA,EAAO,QAAA,EAAU,kBAAiB,GAAI,QAAA;AAEvD,EAAA,uBACE,GAAA,CAAC,mBACC,QAAA,kBAAA,GAAA,CAACA,UAAA,EAAA,EAAkB,WAAW,OAAA,CAAQ,IAAA,EAAO,GAAG,SAAA,EAC9C,QAAA,kBAAA,GAAA;AAAA,IAACC,OAAA;AAAA,IAAA;AAAA,MACC,WAAW,OAAA,CAAQ,IAAA;AAAA,MACnB,KAAA;AAAA,MACA,gBAAA;AAAA,MAEC;AAAA;AAAA,KAEL,CAAA,EACF,CAAA;AAEJ;AAOO,MAAM,GAAA,GAAM,UAAA,CAAqC,CAAC,KAAA,EAAO,GAAA,KAAQ;AACtE,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,cAAA,EAAe,GAAI,aAAA;AAAA,IAC9C,aAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAU,IAAA,EAAM,MAAK,GAAI,QAAA;AAC1C,EAAA,MAAM,SAAA,GAAY,OAAO,QAAA,KAAa,QAAA,GAAW,QAAA,GAAW,MAAA;AAE5D,EAAA,4BAAA,CAA6B,IAAI,CAAA;AAEjC,EAAA,uBACE,GAAA;AAAA,IAACC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA;AAAA,MACA,WAAW,OAAA,CAAQ,IAAA;AAAA,MACnB,IAAA;AAAA,MACC,GAAG,cAAA;AAAA,MACH,GAAG,SAAA;AAAA,MAEH,QAAA,EAAA,CAAC,EAAE,cAAA,EAAe,qBACjB,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,QAAA,IAAA,oBAAQ,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAW,OAAA,CAAQ,MAAO,QAAA,EAAA,IAAA,EAAK,CAAA;AAAA,QAC7C,QAAA;AAAA,QACA,cAAA,oBACC,GAAA,CAACC,MAAA,EAAA,EAAgB,SAAA,EAAW,OAAA,CAAQ,YAAA,EAAc,IAAA,EAAK,QAAA,EACrD,QAAA,kBAAA,GAAA,CAAC,iBAAA,EAAA,EAAkB,IAAA,EAAM,EAAA,EAAI,CAAA,EAC/B;AAAA,OAAA,EAEJ;AAAA;AAAA,GAEJ;AAEJ,CAAC;;;;"}
@@ -1,12 +1,39 @@
1
- const TagGroupDefinition = {
1
+ import 'react/jsx-runtime';
2
+ import 'clsx';
3
+ import '../../hooks/useBreakpoint.esm.js';
4
+ import '../../hooks/useBg.esm.js';
5
+ import '../../hooks/useDefinition/helpers.esm.js';
6
+ import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
7
+ import styles from './TagGroup.module.css.esm.js';
8
+
9
+ const TagGroupDefinition = defineComponent()({
10
+ styles,
11
+ classNames: {
12
+ root: "bui-TagGroup",
13
+ list: "bui-TagList"
14
+ },
15
+ propDefs: {
16
+ items: {},
17
+ children: {},
18
+ renderEmptyState: {},
19
+ className: {}
20
+ }
21
+ });
22
+ const TagDefinition = defineComponent()({
23
+ styles,
2
24
  classNames: {
3
- group: "bui-TagGroup",
4
- list: "bui-TagList",
5
- tag: "bui-Tag",
6
- tagIcon: "bui-TagIcon",
7
- tagRemoveButton: "bui-TagRemoveButton"
25
+ root: "bui-Tag",
26
+ icon: "bui-TagIcon",
27
+ removeButton: "bui-TagRemoveButton"
28
+ },
29
+ propDefs: {
30
+ icon: {},
31
+ size: { dataAttribute: true, default: "small" },
32
+ href: {},
33
+ children: {},
34
+ className: {}
8
35
  }
9
- };
36
+ });
10
37
 
11
- export { TagGroupDefinition };
38
+ export { TagDefinition, TagGroupDefinition };
12
39
  //# sourceMappingURL=definition.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/TagGroup/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ComponentDefinition } from '../../types';\n\n/**\n * Component definition for TagGroup\n * @public\n */\nexport const TagGroupDefinition = {\n classNames: {\n group: 'bui-TagGroup',\n list: 'bui-TagList',\n tag: 'bui-Tag',\n tagIcon: 'bui-TagIcon',\n tagRemoveButton: 'bui-TagRemoveButton',\n },\n} as const satisfies ComponentDefinition;\n"],"names":[],"mappings":"AAsBO,MAAM,kBAAA,GAAqB;AAAA,EAChC,UAAA,EAAY;AAAA,IACV,KAAA,EAAO,cAAA;AAAA,IACP,IAAA,EAAM,aAAA;AAAA,IACN,GAAA,EAAK,SAAA;AAAA,IACL,OAAA,EAAS,aAAA;AAAA,IACT,eAAA,EAAiB;AAAA;AAErB;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/TagGroup/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { TagGroupOwnProps, TagOwnProps } from './types';\nimport styles from './TagGroup.module.css';\n\n/**\n * Component definition for TagGroup\n * @public\n */\nexport const TagGroupDefinition = defineComponent<TagGroupOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TagGroup',\n list: 'bui-TagList',\n },\n propDefs: {\n items: {},\n children: {},\n renderEmptyState: {},\n className: {},\n },\n});\n\n/** @internal */\nexport const TagDefinition = defineComponent<TagOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Tag',\n icon: 'bui-TagIcon',\n removeButton: 'bui-TagRemoveButton',\n },\n propDefs: {\n icon: {},\n size: { dataAttribute: true, default: 'small' },\n href: {},\n children: {},\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;AAwBO,MAAM,kBAAA,GAAqB,iBAAkC,CAAE;AAAA,EACpE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,cAAA;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,OAAO,EAAC;AAAA,IACR,UAAU,EAAC;AAAA,IACX,kBAAkB,EAAC;AAAA,IACnB,WAAW;AAAC;AAEhB,CAAC;AAGM,MAAM,aAAA,GAAgB,iBAA6B,CAAE;AAAA,EAC1D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM,aAAA;AAAA,IACN,YAAA,EAAc;AAAA,GAChB;AAAA,EACA,QAAA,EAAU;AAAA,IACR,MAAM,EAAC;AAAA,IACP,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,MAAM,EAAC;AAAA,IACP,UAAU,EAAC;AAAA,IACX,WAAW;AAAC;AAEhB,CAAC;;;;"}
@@ -1,27 +1,20 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { forwardRef } from 'react';
3
- import clsx from 'clsx';
4
- import { useStyles } from '../../hooks/useStyles.esm.js';
5
- import styles from './Text.module.css.esm.js';
3
+ import { useDefinition } from '../../hooks/useDefinition/useDefinition.esm.js';
6
4
  import { TextDefinition } from './definition.esm.js';
7
5
 
8
6
  function TextComponent(props, ref) {
9
- const Component = props.as || "span";
10
- const { classNames, dataAttributes, cleanedProps } = useStyles(
7
+ const { ownProps, restProps, dataAttributes } = useDefinition(
11
8
  TextDefinition,
12
- {
13
- variant: "body-medium",
14
- weight: "regular",
15
- color: "primary",
16
- ...props
17
- }
9
+ props
18
10
  );
19
- const { className, truncate, ...restProps } = cleanedProps;
11
+ const { classes, as } = ownProps;
12
+ const Component = as;
20
13
  return /* @__PURE__ */ jsx(
21
14
  Component,
22
15
  {
23
16
  ref,
24
- className: clsx(classNames.root, styles[classNames.root], className),
17
+ className: classes.root,
25
18
  ...dataAttributes,
26
19
  ...restProps
27
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Text.esm.js","sources":["../../../src/components/Text/Text.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef } from 'react';\nimport clsx from 'clsx';\nimport type { ElementType } from 'react';\nimport type { TextProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport styles from './Text.module.css';\nimport { TextDefinition } from './definition';\n\nfunction TextComponent<T extends ElementType = 'span'>(\n props: TextProps<T>,\n ref: React.Ref<any>,\n) {\n const Component = props.as || 'span';\n\n const { classNames, dataAttributes, cleanedProps } = useStyles(\n TextDefinition,\n {\n variant: 'body-medium',\n weight: 'regular',\n color: 'primary',\n ...props,\n },\n );\n\n const { className, truncate, ...restProps } = cleanedProps;\n\n return (\n <Component\n ref={ref}\n className={clsx(classNames.root, styles[classNames.root], className)}\n {...dataAttributes}\n {...restProps}\n />\n );\n}\n\nTextComponent.displayName = 'Text';\n\n/** @public */\nexport const Text = forwardRef(TextComponent) as {\n <T extends ElementType = 'p'>(\n props: TextProps<T> & { ref?: React.ComponentPropsWithRef<T>['ref'] },\n ): React.ReactElement<TextProps<T>, T>;\n displayName: string;\n};\n\nText.displayName = 'Text';\n"],"names":[],"mappings":";;;;;;;AAwBA,SAAS,aAAA,CACP,OACA,GAAA,EACA;AACA,EAAA,MAAM,SAAA,GAAY,MAAM,EAAA,IAAM,MAAA;AAE9B,EAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,YAAA,EAAa,GAAI,SAAA;AAAA,IACnD,cAAA;AAAA,IACA;AAAA,MACE,OAAA,EAAS,aAAA;AAAA,MACT,MAAA,EAAQ,SAAA;AAAA,MACR,KAAA,EAAO,SAAA;AAAA,MACP,GAAG;AAAA;AACL,GACF;AAEA,EAAA,MAAM,EAAE,SAAA,EAAW,QAAA,EAAU,GAAG,WAAU,GAAI,YAAA;AAE9C,EAAA,uBACE,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA,EAAW,KAAK,UAAA,CAAW,IAAA,EAAM,OAAO,UAAA,CAAW,IAAI,GAAG,SAAS,CAAA;AAAA,MAClE,GAAG,cAAA;AAAA,MACH,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,aAAA,CAAc,WAAA,GAAc,MAAA;AAGrB,MAAM,IAAA,GAAO,WAAW,aAAa;AAO5C,IAAA,CAAK,WAAA,GAAc,MAAA;;;;"}
1
+ {"version":3,"file":"Text.esm.js","sources":["../../../src/components/Text/Text.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef } from 'react';\nimport type { ElementType } from 'react';\nimport type { TextProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TextDefinition } from './definition';\n\nfunction TextComponent<T extends ElementType = 'span'>(\n props: TextProps<T>,\n ref: React.Ref<any>,\n) {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n TextDefinition,\n props,\n );\n const { classes, as } = ownProps;\n\n const Component = as;\n\n return (\n <Component\n ref={ref}\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n />\n );\n}\n\nTextComponent.displayName = 'Text';\n\n/** @public */\nexport const Text = forwardRef(TextComponent) as {\n <T extends ElementType = 'p'>(\n props: TextProps<T> & { ref?: React.ComponentPropsWithRef<T>['ref'] },\n ): React.ReactElement<TextProps<T>, T>;\n displayName: string;\n};\n\nText.displayName = 'Text';\n"],"names":[],"mappings":";;;;;AAsBA,SAAS,aAAA,CACP,OACA,GAAA,EACA;AACA,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,cAAA,EAAe,GAAI,aAAA;AAAA,IAC9C,cAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,MAAM,EAAE,OAAA,EAAS,EAAA,EAAG,GAAI,QAAA;AAExB,EAAA,MAAM,SAAA,GAAY,EAAA;AAElB,EAAA,uBACE,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAW,OAAA,CAAQ,IAAA;AAAA,MAClB,GAAG,cAAA;AAAA,MACH,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,aAAA,CAAc,WAAA,GAAc,MAAA;AAGrB,MAAM,IAAA,GAAO,WAAW,aAAa;AAO5C,IAAA,CAAK,WAAA,GAAc,MAAA;;;;"}
@@ -1,21 +1,25 @@
1
- const TextDefinition = {
1
+ import 'react/jsx-runtime';
2
+ import 'clsx';
3
+ import '../../hooks/useBreakpoint.esm.js';
4
+ import '../../hooks/useBg.esm.js';
5
+ import '../../hooks/useDefinition/helpers.esm.js';
6
+ import { defineComponent } from '../../hooks/useDefinition/defineComponent.esm.js';
7
+ import styles from './Text.module.css.esm.js';
8
+
9
+ const TextDefinition = defineComponent()({
10
+ styles,
2
11
  classNames: {
3
12
  root: "bui-Text"
4
13
  },
5
- dataAttributes: {
6
- variant: ["subtitle", "body", "caption", "label"],
7
- weight: ["regular", "bold"],
8
- color: [
9
- "primary",
10
- "secondary",
11
- "danger",
12
- "warning",
13
- "success",
14
- "info"
15
- ],
16
- truncate: [true, false]
14
+ propDefs: {
15
+ as: { default: "span" },
16
+ variant: { dataAttribute: true, default: "body-medium" },
17
+ weight: { dataAttribute: true, default: "regular" },
18
+ color: { dataAttribute: true, default: "primary" },
19
+ truncate: { dataAttribute: true },
20
+ className: {}
17
21
  }
18
- };
22
+ });
19
23
 
20
24
  export { TextDefinition };
21
25
  //# sourceMappingURL=definition.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Text/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ComponentDefinition } from '../../types';\n\n/**\n * Component definition for Text\n * @public\n */\nexport const TextDefinition = {\n classNames: {\n root: 'bui-Text',\n },\n dataAttributes: {\n variant: ['subtitle', 'body', 'caption', 'label'] as const,\n weight: ['regular', 'bold'] as const,\n color: [\n 'primary',\n 'secondary',\n 'danger',\n 'warning',\n 'success',\n 'info',\n ] as const,\n truncate: [true, false] as const,\n },\n} as const satisfies ComponentDefinition;\n"],"names":[],"mappings":"AAsBO,MAAM,cAAA,GAAiB;AAAA,EAC5B,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,OAAA,EAAS,CAAC,UAAA,EAAY,MAAA,EAAQ,WAAW,OAAO,CAAA;AAAA,IAChD,MAAA,EAAQ,CAAC,SAAA,EAAW,MAAM,CAAA;AAAA,IAC1B,KAAA,EAAO;AAAA,MACL,SAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAA;AAAA,MACA,SAAA;AAAA,MACA,SAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA,QAAA,EAAU,CAAC,IAAA,EAAM,KAAK;AAAA;AAE1B;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/Text/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { TextOwnProps } from './types';\nimport styles from './Text.module.css';\n\n/**\n * Component definition for Text\n * @public\n */\nexport const TextDefinition = defineComponent<TextOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Text',\n },\n propDefs: {\n as: { default: 'span' },\n variant: { dataAttribute: true, default: 'body-medium' },\n weight: { dataAttribute: true, default: 'regular' },\n color: { dataAttribute: true, default: 'primary' },\n truncate: { dataAttribute: true },\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;AAwBO,MAAM,cAAA,GAAiB,iBAA8B,CAAE;AAAA,EAC5D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,EAAE,OAAA,EAAS,MAAA,EAAO;AAAA,IACtB,OAAA,EAAS,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,aAAA,EAAc;AAAA,IACvD,MAAA,EAAQ,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,SAAA,EAAU;AAAA,IAClD,KAAA,EAAO,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,SAAA,EAAU;AAAA,IACjD,QAAA,EAAU,EAAE,aAAA,EAAe,IAAA,EAAK;AAAA,IAChC,WAAW;AAAC;AAEhB,CAAC;;;;"}
@@ -1,53 +1,34 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { forwardRef, useEffect } from 'react';
3
3
  import { TextField as TextField$1, Input } from 'react-aria-components';
4
- import clsx from 'clsx';
5
4
  import { FieldLabel } from '../FieldLabel/FieldLabel.esm.js';
5
+ import { useDefinition } from '../../hooks/useDefinition/useDefinition.esm.js';
6
+ import '../FieldLabel/FieldLabel.module.css.esm.js';
6
7
  import { FieldError } from '../FieldError/FieldError.esm.js';
7
- import { useStyles } from '../../hooks/useStyles.esm.js';
8
+ import '../FieldError/FieldError.module.css.esm.js';
8
9
  import { TextFieldDefinition } from './definition.esm.js';
9
- import styles from './TextField.module.css.esm.js';
10
10
 
11
11
  const TextField = forwardRef(
12
12
  (props, ref) => {
13
- const {
14
- label,
15
- "aria-label": ariaLabel,
16
- "aria-labelledby": ariaLabelledBy
17
- } = props;
13
+ const { ownProps, restProps, dataAttributes } = useDefinition(
14
+ TextFieldDefinition,
15
+ props
16
+ );
17
+ const { classes, label, icon, secondaryLabel, placeholder, description } = ownProps;
18
18
  useEffect(() => {
19
- if (!label && !ariaLabel && !ariaLabelledBy) {
19
+ if (!label && !restProps["aria-label"] && !restProps["aria-labelledby"]) {
20
20
  console.warn(
21
21
  "TextField requires either a visible label, aria-label, or aria-labelledby for accessibility"
22
22
  );
23
23
  }
24
- }, [label, ariaLabel, ariaLabelledBy]);
25
- const { classNames, dataAttributes, style, cleanedProps } = useStyles(
26
- TextFieldDefinition,
27
- {
28
- size: "small",
29
- ...props
30
- }
31
- );
32
- const {
33
- className,
34
- description,
35
- icon,
36
- isRequired,
37
- secondaryLabel,
38
- placeholder,
39
- ...rest
40
- } = cleanedProps;
41
- const secondaryLabelText = secondaryLabel || (isRequired ? "Required" : null);
24
+ }, [label, restProps["aria-label"], restProps["aria-labelledby"]]);
25
+ const secondaryLabelText = secondaryLabel || (restProps.isRequired ? "Required" : null);
42
26
  return /* @__PURE__ */ jsxs(
43
27
  TextField$1,
44
28
  {
45
- className: clsx(classNames.root, styles[classNames.root], className),
29
+ className: classes.root,
46
30
  ...dataAttributes,
47
- "aria-label": ariaLabel,
48
- "aria-labelledby": ariaLabelledBy,
49
- style,
50
- ...rest,
31
+ ...restProps,
51
32
  ref,
52
33
  children: [
53
34
  /* @__PURE__ */ jsx(
@@ -61,19 +42,13 @@ const TextField = forwardRef(
61
42
  /* @__PURE__ */ jsxs(
62
43
  "div",
63
44
  {
64
- className: clsx(
65
- classNames.inputWrapper,
66
- styles[classNames.inputWrapper]
67
- ),
45
+ className: classes.inputWrapper,
68
46
  "data-size": dataAttributes["data-size"],
69
47
  children: [
70
48
  icon && /* @__PURE__ */ jsx(
71
49
  "div",
72
50
  {
73
- className: clsx(
74
- classNames.inputIcon,
75
- styles[classNames.inputIcon]
76
- ),
51
+ className: classes.inputIcon,
77
52
  "data-size": dataAttributes["data-size"],
78
53
  "aria-hidden": "true",
79
54
  children: icon
@@ -82,7 +57,7 @@ const TextField = forwardRef(
82
57
  /* @__PURE__ */ jsx(
83
58
  Input,
84
59
  {
85
- className: clsx(classNames.input, styles[classNames.input]),
60
+ className: classes.input,
86
61
  ...icon && { "data-icon": true },
87
62
  placeholder
88
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.esm.js","sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef, useEffect } from 'react';\nimport { Input, TextField as AriaTextField } from 'react-aria-components';\nimport clsx from 'clsx';\nimport { FieldLabel } from '../FieldLabel';\nimport { FieldError } from '../FieldError';\nimport type { TextFieldProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport { TextFieldDefinition } from './definition';\nimport styles from './TextField.module.css';\n\n/** @public */\nexport const TextField = forwardRef<HTMLDivElement, TextFieldProps>(\n (props, ref) => {\n const {\n label,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n } = props;\n\n useEffect(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn(\n 'TextField requires either a visible label, aria-label, or aria-labelledby for accessibility',\n );\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n const { classNames, dataAttributes, style, cleanedProps } = useStyles(\n TextFieldDefinition,\n {\n size: 'small',\n ...props,\n },\n );\n\n const {\n className,\n description,\n icon,\n isRequired,\n secondaryLabel,\n placeholder,\n ...rest\n } = cleanedProps;\n\n // If a secondary label is provided, use it. Otherwise, use 'Required' if the field is required.\n const secondaryLabelText =\n secondaryLabel || (isRequired ? 'Required' : null);\n\n return (\n <AriaTextField\n className={clsx(classNames.root, styles[classNames.root], className)}\n {...dataAttributes}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n style={style}\n {...rest}\n ref={ref}\n >\n <FieldLabel\n label={label}\n secondaryLabel={secondaryLabelText}\n description={description}\n />\n <div\n className={clsx(\n classNames.inputWrapper,\n styles[classNames.inputWrapper],\n )}\n data-size={dataAttributes['data-size']}\n >\n {icon && (\n <div\n className={clsx(\n classNames.inputIcon,\n styles[classNames.inputIcon],\n )}\n data-size={dataAttributes['data-size']}\n aria-hidden=\"true\"\n >\n {icon}\n </div>\n )}\n <Input\n className={clsx(classNames.input, styles[classNames.input])}\n {...(icon && { 'data-icon': true })}\n placeholder={placeholder}\n />\n </div>\n <FieldError />\n </AriaTextField>\n );\n },\n);\n\nTextField.displayName = 'TextField';\n"],"names":["AriaTextField"],"mappings":";;;;;;;;;;AA2BO,MAAM,SAAA,GAAY,UAAA;AAAA,EACvB,CAAC,OAAO,GAAA,KAAQ;AACd,IAAA,MAAM;AAAA,MACJ,KAAA;AAAA,MACA,YAAA,EAAc,SAAA;AAAA,MACd,iBAAA,EAAmB;AAAA,KACrB,GAAI,KAAA;AAEJ,IAAA,SAAA,CAAU,MAAM;AACd,MAAA,IAAI,CAAC,KAAA,IAAS,CAAC,SAAA,IAAa,CAAC,cAAA,EAAgB;AAC3C,QAAA,OAAA,CAAQ,IAAA;AAAA,UACN;AAAA,SACF;AAAA,MACF;AAAA,IACF,CAAA,EAAG,CAAC,KAAA,EAAO,SAAA,EAAW,cAAc,CAAC,CAAA;AAErC,IAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,KAAA,EAAO,cAAa,GAAI,SAAA;AAAA,MAC1D,mBAAA;AAAA,MACA;AAAA,QACE,IAAA,EAAM,OAAA;AAAA,QACN,GAAG;AAAA;AACL,KACF;AAEA,IAAA,MAAM;AAAA,MACJ,SAAA;AAAA,MACA,WAAA;AAAA,MACA,IAAA;AAAA,MACA,UAAA;AAAA,MACA,cAAA;AAAA,MACA,WAAA;AAAA,MACA,GAAG;AAAA,KACL,GAAI,YAAA;AAGJ,IAAA,MAAM,kBAAA,GACJ,cAAA,KAAmB,UAAA,GAAa,UAAA,GAAa,IAAA,CAAA;AAE/C,IAAA,uBACE,IAAA;AAAA,MAACA,WAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,KAAK,UAAA,CAAW,IAAA,EAAM,OAAO,UAAA,CAAW,IAAI,GAAG,SAAS,CAAA;AAAA,QAClE,GAAG,cAAA;AAAA,QACJ,YAAA,EAAY,SAAA;AAAA,QACZ,iBAAA,EAAiB,cAAA;AAAA,QACjB,KAAA;AAAA,QACC,GAAG,IAAA;AAAA,QACJ,GAAA;AAAA,QAEA,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,UAAA;AAAA,YAAA;AAAA,cACC,KAAA;AAAA,cACA,cAAA,EAAgB,kBAAA;AAAA,cAChB;AAAA;AAAA,WACF;AAAA,0BACA,IAAA;AAAA,YAAC,KAAA;AAAA,YAAA;AAAA,cACC,SAAA,EAAW,IAAA;AAAA,gBACT,UAAA,CAAW,YAAA;AAAA,gBACX,MAAA,CAAO,WAAW,YAAY;AAAA,eAChC;AAAA,cACA,WAAA,EAAW,eAAe,WAAW,CAAA;AAAA,cAEpC,QAAA,EAAA;AAAA,gBAAA,IAAA,oBACC,GAAA;AAAA,kBAAC,KAAA;AAAA,kBAAA;AAAA,oBACC,SAAA,EAAW,IAAA;AAAA,sBACT,UAAA,CAAW,SAAA;AAAA,sBACX,MAAA,CAAO,WAAW,SAAS;AAAA,qBAC7B;AAAA,oBACA,WAAA,EAAW,eAAe,WAAW,CAAA;AAAA,oBACrC,aAAA,EAAY,MAAA;AAAA,oBAEX,QAAA,EAAA;AAAA;AAAA,iBACH;AAAA,gCAEF,GAAA;AAAA,kBAAC,KAAA;AAAA,kBAAA;AAAA,oBACC,WAAW,IAAA,CAAK,UAAA,CAAW,OAAO,MAAA,CAAO,UAAA,CAAW,KAAK,CAAC,CAAA;AAAA,oBACzD,GAAI,IAAA,IAAQ,EAAE,WAAA,EAAa,IAAA,EAAK;AAAA,oBACjC;AAAA;AAAA;AACF;AAAA;AAAA,WACF;AAAA,8BACC,UAAA,EAAA,EAAW;AAAA;AAAA;AAAA,KACd;AAAA,EAEJ;AACF;AAEA,SAAA,CAAU,WAAA,GAAc,WAAA;;;;"}
1
+ {"version":3,"file":"TextField.esm.js","sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef, useEffect } from 'react';\nimport { Input, TextField as AriaTextField } from 'react-aria-components';\nimport { FieldLabel } from '../FieldLabel';\nimport { FieldError } from '../FieldError';\nimport type { TextFieldProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TextFieldDefinition } from './definition';\n\n/** @public */\nexport const TextField = forwardRef<HTMLDivElement, TextFieldProps>(\n (props, ref) => {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n TextFieldDefinition,\n props,\n );\n const { classes, label, icon, secondaryLabel, placeholder, description } =\n ownProps;\n\n useEffect(() => {\n if (!label && !restProps['aria-label'] && !restProps['aria-labelledby']) {\n console.warn(\n 'TextField requires either a visible label, aria-label, or aria-labelledby for accessibility',\n );\n }\n }, [label, restProps['aria-label'], restProps['aria-labelledby']]);\n\n // If a secondary label is provided, use it. Otherwise, use 'Required' if the field is required.\n const secondaryLabelText =\n secondaryLabel || (restProps.isRequired ? 'Required' : null);\n\n return (\n <AriaTextField\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n ref={ref}\n >\n <FieldLabel\n label={label}\n secondaryLabel={secondaryLabelText}\n description={description}\n />\n <div\n className={classes.inputWrapper}\n data-size={dataAttributes['data-size']}\n >\n {icon && (\n <div\n className={classes.inputIcon}\n data-size={dataAttributes['data-size']}\n aria-hidden=\"true\"\n >\n {icon}\n </div>\n )}\n <Input\n className={classes.input}\n {...(icon && { 'data-icon': true })}\n placeholder={placeholder}\n />\n </div>\n <FieldError />\n </AriaTextField>\n );\n },\n);\n\nTextField.displayName = 'TextField';\n"],"names":["AriaTextField"],"mappings":";;;;;;;;;;AAyBO,MAAM,SAAA,GAAY,UAAA;AAAA,EACvB,CAAC,OAAO,GAAA,KAAQ;AACd,IAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,cAAA,EAAe,GAAI,aAAA;AAAA,MAC9C,mBAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,MAAM,EAAE,OAAA,EAAS,KAAA,EAAO,MAAM,cAAA,EAAgB,WAAA,EAAa,aAAY,GACrE,QAAA;AAEF,IAAA,SAAA,CAAU,MAAM;AACd,MAAA,IAAI,CAAC,SAAS,CAAC,SAAA,CAAU,YAAY,CAAA,IAAK,CAAC,SAAA,CAAU,iBAAiB,CAAA,EAAG;AACvE,QAAA,OAAA,CAAQ,IAAA;AAAA,UACN;AAAA,SACF;AAAA,MACF;AAAA,IACF,CAAA,EAAG,CAAC,KAAA,EAAO,SAAA,CAAU,YAAY,CAAA,EAAG,SAAA,CAAU,iBAAiB,CAAC,CAAC,CAAA;AAGjE,IAAA,MAAM,kBAAA,GACJ,cAAA,KAAmB,SAAA,CAAU,UAAA,GAAa,UAAA,GAAa,IAAA,CAAA;AAEzD,IAAA,uBACE,IAAA;AAAA,MAACA,WAAA;AAAA,MAAA;AAAA,QACC,WAAW,OAAA,CAAQ,IAAA;AAAA,QAClB,GAAG,cAAA;AAAA,QACH,GAAG,SAAA;AAAA,QACJ,GAAA;AAAA,QAEA,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,UAAA;AAAA,YAAA;AAAA,cACC,KAAA;AAAA,cACA,cAAA,EAAgB,kBAAA;AAAA,cAChB;AAAA;AAAA,WACF;AAAA,0BACA,IAAA;AAAA,YAAC,KAAA;AAAA,YAAA;AAAA,cACC,WAAW,OAAA,CAAQ,YAAA;AAAA,cACnB,WAAA,EAAW,eAAe,WAAW,CAAA;AAAA,cAEpC,QAAA,EAAA;AAAA,gBAAA,IAAA,oBACC,GAAA;AAAA,kBAAC,KAAA;AAAA,kBAAA;AAAA,oBACC,WAAW,OAAA,CAAQ,SAAA;AAAA,oBACnB,WAAA,EAAW,eAAe,WAAW,CAAA;AAAA,oBACrC,aAAA,EAAY,MAAA;AAAA,oBAEX,QAAA,EAAA;AAAA;AAAA,iBACH;AAAA,gCAEF,GAAA;AAAA,kBAAC,KAAA;AAAA,kBAAA;AAAA,oBACC,WAAW,OAAA,CAAQ,KAAA;AAAA,oBAClB,GAAI,IAAA,IAAQ,EAAE,WAAA,EAAa,IAAA,EAAK;AAAA,oBACjC;AAAA;AAAA;AACF;AAAA;AAAA,WACF;AAAA,8BACC,UAAA,EAAA,EAAW;AAAA;AAAA;AAAA,KACd;AAAA,EAEJ;AACF;AAEA,SAAA,CAAU,WAAA,GAAc,WAAA;;;;"}
@@ -1,4 +1,13 @@
1
- const TextFieldDefinition = {
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 './TextField.module.css.esm.js';
8
+
9
+ const TextFieldDefinition = defineComponent()({
10
+ styles,
2
11
  classNames: {
3
12
  root: "bui-TextField",
4
13
  inputWrapper: "bui-InputWrapper",
@@ -6,12 +15,16 @@ const TextFieldDefinition = {
6
15
  inputIcon: "bui-InputIcon",
7
16
  inputAction: "bui-InputAction"
8
17
  },
9
- dataAttributes: {
10
- invalid: [true, false],
11
- disabled: [true, false],
12
- size: ["small", "medium"]
18
+ propDefs: {
19
+ size: { dataAttribute: true, default: "small" },
20
+ className: {},
21
+ icon: {},
22
+ placeholder: {},
23
+ label: {},
24
+ description: {},
25
+ secondaryLabel: {}
13
26
  }
14
- };
27
+ });
15
28
 
16
29
  export { TextFieldDefinition };
17
30
  //# sourceMappingURL=definition.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.esm.js","sources":["../../../src/components/TextField/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ComponentDefinition } from '../../types';\n\n/**\n * Component definition for TextField\n * @public\n */\nexport const TextFieldDefinition = {\n classNames: {\n root: 'bui-TextField',\n inputWrapper: 'bui-InputWrapper',\n input: 'bui-Input',\n inputIcon: 'bui-InputIcon',\n inputAction: 'bui-InputAction',\n },\n dataAttributes: {\n invalid: [true, false] as const,\n disabled: [true, false] as const,\n size: ['small', 'medium'] as const,\n },\n} as const satisfies ComponentDefinition;\n"],"names":[],"mappings":"AAsBO,MAAM,mBAAA,GAAsB;AAAA,EACjC,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,eAAA;AAAA,IACN,YAAA,EAAc,kBAAA;AAAA,IACd,KAAA,EAAO,WAAA;AAAA,IACP,SAAA,EAAW,eAAA;AAAA,IACX,WAAA,EAAa;AAAA,GACf;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,OAAA,EAAS,CAAC,IAAA,EAAM,KAAK,CAAA;AAAA,IACrB,QAAA,EAAU,CAAC,IAAA,EAAM,KAAK,CAAA;AAAA,IACtB,IAAA,EAAM,CAAC,OAAA,EAAS,QAAQ;AAAA;AAE5B;;;;"}
1
+ {"version":3,"file":"definition.esm.js","sources":["../../../src/components/TextField/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { TextFieldOwnProps } from './types';\nimport styles from './TextField.module.css';\n\n/**\n * Component definition for TextField\n * @public\n */\nexport const TextFieldDefinition = defineComponent<TextFieldOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TextField',\n inputWrapper: 'bui-InputWrapper',\n input: 'bui-Input',\n inputIcon: 'bui-InputIcon',\n inputAction: 'bui-InputAction',\n },\n propDefs: {\n size: { dataAttribute: true, default: 'small' },\n className: {},\n icon: {},\n placeholder: {},\n label: {},\n description: {},\n secondaryLabel: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;AAwBO,MAAM,mBAAA,GAAsB,iBAAmC,CAAE;AAAA,EACtE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,eAAA;AAAA,IACN,YAAA,EAAc,kBAAA;AAAA,IACd,KAAA,EAAO,WAAA;AAAA,IACP,SAAA,EAAW,eAAA;AAAA,IACX,WAAA,EAAa;AAAA,GACf;AAAA,EACA,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,WAAW,EAAC;AAAA,IACZ,MAAM,EAAC;AAAA,IACP,aAAa,EAAC;AAAA,IACd,OAAO,EAAC;AAAA,IACR,aAAa,EAAC;AAAA,IACd,gBAAgB;AAAC;AAErB,CAAC;;;;"}
@@ -1,42 +1,30 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import clsx from 'clsx';
3
2
  import { forwardRef } from 'react';
4
3
  import { ToggleButton as ToggleButton$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 { ToggleButtonDefinition } from './definition.esm.js';
7
- import styles from './ToggleButton.module.css.esm.js';
8
6
 
9
7
  const ToggleButton = forwardRef(
10
8
  (props, ref) => {
11
- const { classNames, dataAttributes, cleanedProps } = useStyles(
9
+ const { ownProps, restProps, dataAttributes } = useDefinition(
12
10
  ToggleButtonDefinition,
13
- {
14
- size: "small",
15
- ...props
16
- }
11
+ props
17
12
  );
18
- const { children, className, iconStart, iconEnd, ...rest } = cleanedProps;
13
+ const { classes, children, iconStart, iconEnd } = ownProps;
19
14
  return /* @__PURE__ */ jsx(
20
15
  ToggleButton$1,
21
16
  {
22
- className: clsx(classNames.root, styles[classNames.root], className),
17
+ className: classes.root,
23
18
  ref,
24
19
  ...dataAttributes,
25
- ...rest,
20
+ ...restProps,
26
21
  children: (renderProps) => {
27
22
  const renderedChildren = typeof children === "function" ? children(renderProps) : children;
28
- return /* @__PURE__ */ jsxs(
29
- "span",
30
- {
31
- className: clsx(classNames.content, styles[classNames.content]),
32
- "data-slot": "content",
33
- children: [
34
- iconStart,
35
- renderedChildren,
36
- iconEnd
37
- ]
38
- }
39
- );
23
+ return /* @__PURE__ */ jsxs("span", { className: classes.content, "data-slot": "content", children: [
24
+ iconStart,
25
+ renderedChildren,
26
+ iconEnd
27
+ ] });
40
28
  }
41
29
  }
42
30
  );
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleButton.esm.js","sources":["../../../src/components/ToggleButton/ToggleButton.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 { ToggleButton as AriaToggleButton } from 'react-aria-components';\nimport type { ToggleButtonProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport { ToggleButtonDefinition } from './definition';\nimport styles from './ToggleButton.module.css';\n\n/** @public */\nexport const ToggleButton = forwardRef(\n (props: ToggleButtonProps, ref: Ref<HTMLButtonElement>) => {\n const { classNames, dataAttributes, cleanedProps } = useStyles(\n ToggleButtonDefinition,\n {\n size: 'small',\n ...props,\n },\n );\n\n const { children, className, iconStart, iconEnd, ...rest } = cleanedProps;\n\n return (\n <AriaToggleButton\n className={clsx(classNames.root, styles[classNames.root], className)}\n ref={ref}\n {...dataAttributes}\n {...rest}\n >\n {renderProps => {\n // If children is a function, call it with render props; otherwise use children as-is\n const renderedChildren =\n typeof children === 'function' ? children(renderProps) : children;\n\n return (\n <span\n className={clsx(classNames.content, styles[classNames.content])}\n data-slot=\"content\"\n >\n {iconStart}\n {renderedChildren}\n {iconEnd}\n </span>\n );\n }}\n </AriaToggleButton>\n );\n },\n);\n\nToggleButton.displayName = 'ToggleButton';\n"],"names":["AriaToggleButton"],"mappings":";;;;;;;;AAyBO,MAAM,YAAA,GAAe,UAAA;AAAA,EAC1B,CAAC,OAA0B,GAAA,KAAgC;AACzD,IAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,YAAA,EAAa,GAAI,SAAA;AAAA,MACnD,sBAAA;AAAA,MACA;AAAA,QACE,IAAA,EAAM,OAAA;AAAA,QACN,GAAG;AAAA;AACL,KACF;AAEA,IAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,WAAW,OAAA,EAAS,GAAG,MAAK,GAAI,YAAA;AAE7D,IAAA,uBACE,GAAA;AAAA,MAACA,cAAA;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,QAAA,EAAA,CAAA,WAAA,KAAe;AAEd,UAAA,MAAM,mBACJ,OAAO,QAAA,KAAa,UAAA,GAAa,QAAA,CAAS,WAAW,CAAA,GAAI,QAAA;AAE3D,UAAA,uBACE,IAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,WAAW,IAAA,CAAK,UAAA,CAAW,SAAS,MAAA,CAAO,UAAA,CAAW,OAAO,CAAC,CAAA;AAAA,cAC9D,WAAA,EAAU,SAAA;AAAA,cAET,QAAA,EAAA;AAAA,gBAAA,SAAA;AAAA,gBACA,gBAAA;AAAA,gBACA;AAAA;AAAA;AAAA,WACH;AAAA,QAEJ;AAAA;AAAA,KACF;AAAA,EAEJ;AACF;AAEA,YAAA,CAAa,WAAA,GAAc,cAAA;;;;"}
1
+ {"version":3,"file":"ToggleButton.esm.js","sources":["../../../src/components/ToggleButton/ToggleButton.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 { ToggleButton as AriaToggleButton } from 'react-aria-components';\nimport type { ToggleButtonProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { ToggleButtonDefinition } from './definition';\n\n/** @public */\nexport const ToggleButton = forwardRef(\n (props: ToggleButtonProps, ref: Ref<HTMLButtonElement>) => {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n ToggleButtonDefinition,\n props,\n );\n const { classes, children, iconStart, iconEnd } = ownProps;\n\n return (\n <AriaToggleButton\n className={classes.root}\n ref={ref}\n {...dataAttributes}\n {...restProps}\n >\n {renderProps => {\n // If children is a function, call it with render props; otherwise use children as-is\n const renderedChildren =\n typeof children === 'function' ? children(renderProps) : children;\n\n return (\n <span className={classes.content} data-slot=\"content\">\n {iconStart}\n {renderedChildren}\n {iconEnd}\n </span>\n );\n }}\n </AriaToggleButton>\n );\n },\n);\n\nToggleButton.displayName = 'ToggleButton';\n"],"names":["AriaToggleButton"],"mappings":";;;;;;AAuBO,MAAM,YAAA,GAAe,UAAA;AAAA,EAC1B,CAAC,OAA0B,GAAA,KAAgC;AACzD,IAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,cAAA,EAAe,GAAI,aAAA;AAAA,MAC9C,sBAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAU,SAAA,EAAW,SAAQ,GAAI,QAAA;AAElD,IAAA,uBACE,GAAA;AAAA,MAACA,cAAA;AAAA,MAAA;AAAA,QACC,WAAW,OAAA,CAAQ,IAAA;AAAA,QACnB,GAAA;AAAA,QACC,GAAG,cAAA;AAAA,QACH,GAAG,SAAA;AAAA,QAEH,QAAA,EAAA,CAAA,WAAA,KAAe;AAEd,UAAA,MAAM,mBACJ,OAAO,QAAA,KAAa,UAAA,GAAa,QAAA,CAAS,WAAW,CAAA,GAAI,QAAA;AAE3D,UAAA,4BACG,MAAA,EAAA,EAAK,SAAA,EAAW,OAAA,CAAQ,OAAA,EAAS,aAAU,SAAA,EACzC,QAAA,EAAA;AAAA,YAAA,SAAA;AAAA,YACA,gBAAA;AAAA,YACA;AAAA,WAAA,EACH,CAAA;AAAA,QAEJ;AAAA;AAAA,KACF;AAAA,EAEJ;AACF;AAEA,YAAA,CAAa,WAAA,GAAc,cAAA;;;;"}
@@ -1,12 +1,25 @@
1
- const ToggleButtonDefinition = {
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 './ToggleButton.module.css.esm.js';
8
+
9
+ const ToggleButtonDefinition = defineComponent()({
10
+ styles,
2
11
  classNames: {
3
12
  root: "bui-ToggleButton",
4
13
  content: "bui-ToggleButtonContent"
5
14
  },
6
- dataAttributes: {
7
- size: ["small", "medium"]
15
+ propDefs: {
16
+ size: { dataAttribute: true, default: "small" },
17
+ iconStart: {},
18
+ iconEnd: {},
19
+ children: {},
20
+ className: {}
8
21
  }
9
- };
22
+ });
10
23
 
11
24
  export { ToggleButtonDefinition };
12
25
  //# sourceMappingURL=definition.esm.js.map