@backstage/ui 0.0.0-nightly-20250722024836

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 (135) hide show
  1. package/CHANGELOG.md +294 -0
  2. package/README.md +18 -0
  3. package/css/styles.css +10823 -0
  4. package/dist/components/Avatar/Avatar.esm.js +29 -0
  5. package/dist/components/Avatar/Avatar.esm.js.map +1 -0
  6. package/dist/components/Box/Box.esm.js +34 -0
  7. package/dist/components/Box/Box.esm.js.map +1 -0
  8. package/dist/components/Box/Box.props.esm.js +7 -0
  9. package/dist/components/Box/Box.props.esm.js.map +1 -0
  10. package/dist/components/Button/Button.esm.js +41 -0
  11. package/dist/components/Button/Button.esm.js.map +1 -0
  12. package/dist/components/ButtonIcon/ButtonIcon.esm.js +37 -0
  13. package/dist/components/ButtonIcon/ButtonIcon.esm.js.map +1 -0
  14. package/dist/components/ButtonLink/ButtonLink.esm.js +42 -0
  15. package/dist/components/ButtonLink/ButtonLink.esm.js.map +1 -0
  16. package/dist/components/Card/Card.esm.js +53 -0
  17. package/dist/components/Card/Card.esm.js.map +1 -0
  18. package/dist/components/Checkbox/Checkbox.esm.js +74 -0
  19. package/dist/components/Checkbox/Checkbox.esm.js.map +1 -0
  20. package/dist/components/Collapsible/Collapsible.esm.js +50 -0
  21. package/dist/components/Collapsible/Collapsible.esm.js.map +1 -0
  22. package/dist/components/Container/Container.esm.js +35 -0
  23. package/dist/components/Container/Container.esm.js.map +1 -0
  24. package/dist/components/DataTable/DataTable.esm.js +26 -0
  25. package/dist/components/DataTable/DataTable.esm.js.map +1 -0
  26. package/dist/components/DataTable/Pagination/DataTablePagination.esm.js +84 -0
  27. package/dist/components/DataTable/Pagination/DataTablePagination.esm.js.map +1 -0
  28. package/dist/components/DataTable/Root/DataTableRoot.esm.js +24 -0
  29. package/dist/components/DataTable/Root/DataTableRoot.esm.js.map +1 -0
  30. package/dist/components/DataTable/Table/DataTableTable.esm.js +64 -0
  31. package/dist/components/DataTable/Table/DataTableTable.esm.js.map +1 -0
  32. package/dist/components/FieldError/FieldError.esm.js +22 -0
  33. package/dist/components/FieldError/FieldError.esm.js.map +1 -0
  34. package/dist/components/FieldLabel/FieldLabel.esm.js +27 -0
  35. package/dist/components/FieldLabel/FieldLabel.esm.js.map +1 -0
  36. package/dist/components/Flex/Flex.esm.js +26 -0
  37. package/dist/components/Flex/Flex.esm.js.map +1 -0
  38. package/dist/components/Flex/Flex.props.esm.js +31 -0
  39. package/dist/components/Flex/Flex.props.esm.js.map +1 -0
  40. package/dist/components/Grid/Grid.esm.js +43 -0
  41. package/dist/components/Grid/Grid.esm.js.map +1 -0
  42. package/dist/components/Grid/Grid.props.esm.js +58 -0
  43. package/dist/components/Grid/Grid.props.esm.js.map +1 -0
  44. package/dist/components/Header/Header.esm.js +27 -0
  45. package/dist/components/Header/Header.esm.js.map +1 -0
  46. package/dist/components/Header/HeaderToolbar.esm.js +121 -0
  47. package/dist/components/Header/HeaderToolbar.esm.js.map +1 -0
  48. package/dist/components/HeaderPage/HeaderPage.esm.js +48 -0
  49. package/dist/components/HeaderPage/HeaderPage.esm.js.map +1 -0
  50. package/dist/components/Heading/Heading.esm.js +37 -0
  51. package/dist/components/Heading/Heading.esm.js.map +1 -0
  52. package/dist/components/Icon/Icon.esm.js +29 -0
  53. package/dist/components/Icon/Icon.esm.js.map +1 -0
  54. package/dist/components/Icon/context.esm.js +10 -0
  55. package/dist/components/Icon/context.esm.js.map +1 -0
  56. package/dist/components/Icon/icons.esm.js +63 -0
  57. package/dist/components/Icon/icons.esm.js.map +1 -0
  58. package/dist/components/Icon/provider.esm.js +12 -0
  59. package/dist/components/Icon/provider.esm.js.map +1 -0
  60. package/dist/components/Link/Link.esm.js +63 -0
  61. package/dist/components/Link/Link.esm.js.map +1 -0
  62. package/dist/components/Menu/Combobox.esm.js +212 -0
  63. package/dist/components/Menu/Combobox.esm.js.map +1 -0
  64. package/dist/components/Menu/Menu.esm.js +224 -0
  65. package/dist/components/Menu/Menu.esm.js.map +1 -0
  66. package/dist/components/RadioGroup/RadioGroup.esm.js +71 -0
  67. package/dist/components/RadioGroup/RadioGroup.esm.js.map +1 -0
  68. package/dist/components/ScrollArea/ScrollArea.esm.js +63 -0
  69. package/dist/components/ScrollArea/ScrollArea.esm.js.map +1 -0
  70. package/dist/components/SearchField/SearchField.esm.js +107 -0
  71. package/dist/components/SearchField/SearchField.esm.js.map +1 -0
  72. package/dist/components/Select/Select.esm.js +89 -0
  73. package/dist/components/Select/Select.esm.js.map +1 -0
  74. package/dist/components/Select/Select.styles.css.esm.js +7 -0
  75. package/dist/components/Select/Select.styles.css.esm.js.map +1 -0
  76. package/dist/components/Skeleton/Skeleton.esm.js +22 -0
  77. package/dist/components/Skeleton/Skeleton.esm.js.map +1 -0
  78. package/dist/components/Switch/Switch.esm.js +18 -0
  79. package/dist/components/Switch/Switch.esm.js.map +1 -0
  80. package/dist/components/Table/Table.esm.js +68 -0
  81. package/dist/components/Table/Table.esm.js.map +1 -0
  82. package/dist/components/Table/TableCell/TableCell.esm.js +13 -0
  83. package/dist/components/Table/TableCell/TableCell.esm.js.map +1 -0
  84. package/dist/components/Table/TableCellLink/TableCellLink.esm.js +28 -0
  85. package/dist/components/Table/TableCellLink/TableCellLink.esm.js.map +1 -0
  86. package/dist/components/Table/TableCellProfile/TableCellProfile.esm.js +40 -0
  87. package/dist/components/Table/TableCellProfile/TableCellProfile.esm.js.map +1 -0
  88. package/dist/components/Table/TableCellText/TableCellText.esm.js +27 -0
  89. package/dist/components/Table/TableCellText/TableCellText.esm.js.map +1 -0
  90. package/dist/components/Tabs/Tabs.esm.js +127 -0
  91. package/dist/components/Tabs/Tabs.esm.js.map +1 -0
  92. package/dist/components/Tabs/TabsIndicators.esm.js +140 -0
  93. package/dist/components/Tabs/TabsIndicators.esm.js.map +1 -0
  94. package/dist/components/Text/Text.esm.js +39 -0
  95. package/dist/components/Text/Text.esm.js.map +1 -0
  96. package/dist/components/TextField/TextField.esm.js +88 -0
  97. package/dist/components/TextField/TextField.esm.js.map +1 -0
  98. package/dist/components/Tooltip/Tooltip.esm.js +31 -0
  99. package/dist/components/Tooltip/Tooltip.esm.js.map +1 -0
  100. package/dist/hooks/useBreakpoint.esm.js +43 -0
  101. package/dist/hooks/useBreakpoint.esm.js.map +1 -0
  102. package/dist/hooks/useIsomorphicLayoutEffect.esm.js +6 -0
  103. package/dist/hooks/useIsomorphicLayoutEffect.esm.js.map +1 -0
  104. package/dist/hooks/useMediaQuery.esm.js +44 -0
  105. package/dist/hooks/useMediaQuery.esm.js.map +1 -0
  106. package/dist/hooks/useStyles.esm.js +46 -0
  107. package/dist/hooks/useStyles.esm.js.map +1 -0
  108. package/dist/index.d.ts +1399 -0
  109. package/dist/index.esm.js +40 -0
  110. package/dist/index.esm.js.map +1 -0
  111. package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js +29 -0
  112. package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js.map +1 -0
  113. package/dist/props/display.props.esm.js +12 -0
  114. package/dist/props/display.props.esm.js.map +1 -0
  115. package/dist/props/gap-props.esm.js +15 -0
  116. package/dist/props/gap-props.esm.js.map +1 -0
  117. package/dist/props/height.props.esm.js +23 -0
  118. package/dist/props/height.props.esm.js.map +1 -0
  119. package/dist/props/margin.props.esm.js +54 -0
  120. package/dist/props/margin.props.esm.js.map +1 -0
  121. package/dist/props/padding.props.esm.js +54 -0
  122. package/dist/props/padding.props.esm.js.map +1 -0
  123. package/dist/props/position.props.esm.js +18 -0
  124. package/dist/props/position.props.esm.js.map +1 -0
  125. package/dist/props/prop-def.esm.js +4 -0
  126. package/dist/props/prop-def.esm.js.map +1 -0
  127. package/dist/props/spacing.props.esm.js +28 -0
  128. package/dist/props/spacing.props.esm.js.map +1 -0
  129. package/dist/props/width.props.esm.js +23 -0
  130. package/dist/props/width.props.esm.js.map +1 -0
  131. package/dist/utils/componentDefinitions.esm.js +272 -0
  132. package/dist/utils/componentDefinitions.esm.js.map +1 -0
  133. package/dist/utils/extractProps.esm.js +49 -0
  134. package/dist/utils/extractProps.esm.js.map +1 -0
  135. package/package.json +93 -0
@@ -0,0 +1,224 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { forwardRef } from 'react';
3
+ import { Menu as Menu$1 } from '@base-ui-components/react/menu';
4
+ import clsx from 'clsx';
5
+ import { Combobox } from './Combobox.esm.js';
6
+ import '@remixicon/react';
7
+ import { Icon } from '../Icon/Icon.esm.js';
8
+ import '../Icon/context.esm.js';
9
+ import { useStyles } from '../../hooks/useStyles.esm.js';
10
+
11
+ const MenuTrigger = forwardRef(({ className, ...props }, ref) => {
12
+ const { classNames } = useStyles("Menu");
13
+ return /* @__PURE__ */ jsx(
14
+ Menu$1.Trigger,
15
+ {
16
+ ref,
17
+ className: clsx(classNames.trigger, className),
18
+ ...props
19
+ }
20
+ );
21
+ });
22
+ MenuTrigger.displayName = Menu$1.Trigger.displayName;
23
+ const MenuBackdrop = forwardRef(({ className, ...props }, ref) => {
24
+ const { classNames } = useStyles("Menu");
25
+ return /* @__PURE__ */ jsx(
26
+ Menu$1.Backdrop,
27
+ {
28
+ ref,
29
+ className: clsx(classNames.backdrop, className),
30
+ ...props
31
+ }
32
+ );
33
+ });
34
+ MenuBackdrop.displayName = Menu$1.Backdrop.displayName;
35
+ const MenuPositioner = forwardRef(({ className, ...props }, ref) => {
36
+ const { classNames } = useStyles("Menu");
37
+ return /* @__PURE__ */ jsx(
38
+ Menu$1.Positioner,
39
+ {
40
+ ref,
41
+ className: clsx(classNames.positioner, className),
42
+ ...props
43
+ }
44
+ );
45
+ });
46
+ MenuPositioner.displayName = Menu$1.Positioner.displayName;
47
+ const MenuPopup = forwardRef(({ className, ...props }, ref) => {
48
+ const { classNames } = useStyles("Menu");
49
+ return /* @__PURE__ */ jsx(
50
+ Menu$1.Popup,
51
+ {
52
+ ref,
53
+ className: clsx(classNames.popup, className),
54
+ ...props
55
+ }
56
+ );
57
+ });
58
+ MenuPopup.displayName = Menu$1.Popup.displayName;
59
+ const MenuArrow = forwardRef(({ className, ...props }, ref) => {
60
+ const { classNames } = useStyles("Menu");
61
+ return /* @__PURE__ */ jsx(
62
+ Menu$1.Arrow,
63
+ {
64
+ ref,
65
+ className: clsx(classNames.arrow, className),
66
+ ...props
67
+ }
68
+ );
69
+ });
70
+ MenuArrow.displayName = Menu$1.Arrow.displayName;
71
+ const MenuItem = forwardRef(({ className, ...props }, ref) => {
72
+ const { classNames } = useStyles("Menu");
73
+ return /* @__PURE__ */ jsx(
74
+ Menu$1.Item,
75
+ {
76
+ ref,
77
+ className: clsx(classNames.item, className),
78
+ ...props
79
+ }
80
+ );
81
+ });
82
+ MenuItem.displayName = Menu$1.Item.displayName;
83
+ const MenuGroup = forwardRef(({ className, ...props }, ref) => {
84
+ const { classNames } = useStyles("Menu");
85
+ return /* @__PURE__ */ jsx(
86
+ Menu$1.Group,
87
+ {
88
+ ref,
89
+ className: clsx(classNames.group, className),
90
+ ...props
91
+ }
92
+ );
93
+ });
94
+ MenuGroup.displayName = Menu$1.Group.displayName;
95
+ const MenuGroupLabel = forwardRef(({ className, ...props }, ref) => {
96
+ const { classNames } = useStyles("Menu");
97
+ return /* @__PURE__ */ jsx(
98
+ Menu$1.GroupLabel,
99
+ {
100
+ ref,
101
+ className: clsx(classNames.groupLabel, className),
102
+ ...props
103
+ }
104
+ );
105
+ });
106
+ MenuGroupLabel.displayName = Menu$1.GroupLabel.displayName;
107
+ const MenuRadioGroup = forwardRef(({ className, ...props }, ref) => {
108
+ const { classNames } = useStyles("Menu");
109
+ return /* @__PURE__ */ jsx(
110
+ Menu$1.RadioGroup,
111
+ {
112
+ ref,
113
+ className: clsx(classNames.radioGroup, className),
114
+ ...props
115
+ }
116
+ );
117
+ });
118
+ MenuRadioGroup.displayName = Menu$1.RadioGroup.displayName;
119
+ const MenuRadioItem = forwardRef(({ className, ...props }, ref) => {
120
+ const { classNames } = useStyles("Menu");
121
+ return /* @__PURE__ */ jsx(
122
+ Menu$1.RadioItem,
123
+ {
124
+ ref,
125
+ className: clsx(classNames.radioItem, className),
126
+ ...props
127
+ }
128
+ );
129
+ });
130
+ MenuRadioItem.displayName = Menu$1.RadioItem.displayName;
131
+ const MenuRadioItemIndicator = forwardRef(({ className, ...props }, ref) => {
132
+ const { classNames } = useStyles("Menu");
133
+ return /* @__PURE__ */ jsx(
134
+ Menu$1.RadioItemIndicator,
135
+ {
136
+ ref,
137
+ className: clsx(classNames.radioItemIndicator, className),
138
+ ...props
139
+ }
140
+ );
141
+ });
142
+ MenuRadioItemIndicator.displayName = Menu$1.RadioItemIndicator.displayName;
143
+ const MenuCheckboxItem = forwardRef(({ className, ...props }, ref) => {
144
+ const { classNames } = useStyles("Menu");
145
+ return /* @__PURE__ */ jsx(
146
+ Menu$1.CheckboxItem,
147
+ {
148
+ ref,
149
+ className: clsx(classNames.checkboxItem, className),
150
+ ...props
151
+ }
152
+ );
153
+ });
154
+ MenuCheckboxItem.displayName = Menu$1.CheckboxItem.displayName;
155
+ const MenuCheckboxItemIndicator = forwardRef(({ className, ...props }, ref) => {
156
+ const { classNames } = useStyles("Menu");
157
+ return /* @__PURE__ */ jsx(
158
+ Menu$1.CheckboxItemIndicator,
159
+ {
160
+ ref,
161
+ className: clsx(classNames.checkboxItemIndicator, className),
162
+ ...props
163
+ }
164
+ );
165
+ });
166
+ MenuCheckboxItemIndicator.displayName = Menu$1.CheckboxItemIndicator.displayName;
167
+ const MenuSubmenuTrigger = forwardRef(({ className, children, ...props }, ref) => {
168
+ const { classNames } = useStyles("Menu");
169
+ return /* @__PURE__ */ jsxs(
170
+ Menu$1.SubmenuTrigger,
171
+ {
172
+ ref,
173
+ className: clsx(classNames.submenuTrigger, className),
174
+ ...props,
175
+ children: [
176
+ /* @__PURE__ */ jsx("div", { children }),
177
+ /* @__PURE__ */ jsx(
178
+ Icon,
179
+ {
180
+ "aria-label": "Submenu indicator icon",
181
+ name: "chevron-right",
182
+ size: 20
183
+ }
184
+ )
185
+ ]
186
+ }
187
+ );
188
+ });
189
+ MenuSubmenuTrigger.displayName = Menu$1.SubmenuTrigger.displayName;
190
+ const MenuSeparator = forwardRef(({ className, ...props }, ref) => {
191
+ const { classNames } = useStyles("Menu");
192
+ return /* @__PURE__ */ jsx(
193
+ Menu$1.Separator,
194
+ {
195
+ ref,
196
+ className: clsx(classNames.separator, className),
197
+ ...props
198
+ }
199
+ );
200
+ });
201
+ MenuSeparator.displayName = Menu$1.Separator.displayName;
202
+ const Menu = {
203
+ Root: Menu$1.Root,
204
+ Trigger: MenuTrigger,
205
+ Portal: Menu$1.Portal,
206
+ Backdrop: MenuBackdrop,
207
+ Positioner: MenuPositioner,
208
+ Popup: MenuPopup,
209
+ Arrow: MenuArrow,
210
+ Item: MenuItem,
211
+ Group: MenuGroup,
212
+ GroupLabel: MenuGroupLabel,
213
+ RadioGroup: MenuRadioGroup,
214
+ RadioItem: MenuRadioItem,
215
+ RadioItemIndicator: MenuRadioItemIndicator,
216
+ CheckboxItem: MenuCheckboxItem,
217
+ CheckboxItemIndicator: MenuCheckboxItemIndicator,
218
+ SubmenuTrigger: MenuSubmenuTrigger,
219
+ Separator: MenuSeparator,
220
+ Combobox
221
+ };
222
+
223
+ export { Menu };
224
+ //# sourceMappingURL=Menu.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Menu.esm.js","sources":["../../../src/components/Menu/Menu.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 { Menu as MenuPrimitive } from '@base-ui-components/react/menu';\nimport clsx from 'clsx';\nimport { MenuComponent } from './types';\nimport { Combobox } from './Combobox';\nimport { Icon } from '../Icon';\nimport { useStyles } from '../../hooks/useStyles';\n\nconst MenuTrigger = forwardRef<\n React.ElementRef<typeof MenuPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.Trigger>\n>(({ className, ...props }, ref) => {\n const { classNames } = useStyles('Menu');\n\n return (\n <MenuPrimitive.Trigger\n ref={ref}\n className={clsx(classNames.trigger, className)}\n {...props}\n />\n );\n});\nMenuTrigger.displayName = MenuPrimitive.Trigger.displayName;\n\nconst MenuBackdrop = forwardRef<\n React.ElementRef<typeof MenuPrimitive.Backdrop>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.Backdrop>\n>(({ className, ...props }, ref) => {\n const { classNames } = useStyles('Menu');\n\n return (\n <MenuPrimitive.Backdrop\n ref={ref}\n className={clsx(classNames.backdrop, className)}\n {...props}\n />\n );\n});\nMenuBackdrop.displayName = MenuPrimitive.Backdrop.displayName;\n\nconst MenuPositioner = forwardRef<\n React.ElementRef<typeof MenuPrimitive.Positioner>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.Positioner>\n>(({ className, ...props }, ref) => {\n const { classNames } = useStyles('Menu');\n\n return (\n <MenuPrimitive.Positioner\n ref={ref}\n className={clsx(classNames.positioner, className)}\n {...props}\n />\n );\n});\nMenuPositioner.displayName = MenuPrimitive.Positioner.displayName;\n\nconst MenuPopup = forwardRef<\n React.ElementRef<typeof MenuPrimitive.Popup>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.Popup>\n>(({ className, ...props }, ref) => {\n const { classNames } = useStyles('Menu');\n\n return (\n <MenuPrimitive.Popup\n ref={ref}\n className={clsx(classNames.popup, className)}\n {...props}\n />\n );\n});\nMenuPopup.displayName = MenuPrimitive.Popup.displayName;\n\nconst MenuArrow = forwardRef<\n React.ElementRef<typeof MenuPrimitive.Arrow>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.Arrow>\n>(({ className, ...props }, ref) => {\n const { classNames } = useStyles('Menu');\n\n return (\n <MenuPrimitive.Arrow\n ref={ref}\n className={clsx(classNames.arrow, className)}\n {...props}\n />\n );\n});\nMenuArrow.displayName = MenuPrimitive.Arrow.displayName;\n\nconst MenuItem = forwardRef<\n React.ElementRef<typeof MenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>\n>(({ className, ...props }, ref) => {\n const { classNames } = useStyles('Menu');\n\n return (\n <MenuPrimitive.Item\n ref={ref}\n className={clsx(classNames.item, className)}\n {...props}\n />\n );\n});\nMenuItem.displayName = MenuPrimitive.Item.displayName;\n\nconst MenuGroup = forwardRef<\n React.ElementRef<typeof MenuPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>\n>(({ className, ...props }, ref) => {\n const { classNames } = useStyles('Menu');\n\n return (\n <MenuPrimitive.Group\n ref={ref}\n className={clsx(classNames.group, className)}\n {...props}\n />\n );\n});\nMenuGroup.displayName = MenuPrimitive.Group.displayName;\n\nconst MenuGroupLabel = forwardRef<\n React.ElementRef<typeof MenuPrimitive.GroupLabel>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.GroupLabel>\n>(({ className, ...props }, ref) => {\n const { classNames } = useStyles('Menu');\n\n return (\n <MenuPrimitive.GroupLabel\n ref={ref}\n className={clsx(classNames.groupLabel, className)}\n {...props}\n />\n );\n});\nMenuGroupLabel.displayName = MenuPrimitive.GroupLabel.displayName;\n\nconst MenuRadioGroup = forwardRef<\n React.ElementRef<typeof MenuPrimitive.RadioGroup>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioGroup>\n>(({ className, ...props }, ref) => {\n const { classNames } = useStyles('Menu');\n\n return (\n <MenuPrimitive.RadioGroup\n ref={ref}\n className={clsx(classNames.radioGroup, className)}\n {...props}\n />\n );\n});\nMenuRadioGroup.displayName = MenuPrimitive.RadioGroup.displayName;\n\nconst MenuRadioItem = forwardRef<\n React.ElementRef<typeof MenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItem>\n>(({ className, ...props }, ref) => {\n const { classNames } = useStyles('Menu');\n\n return (\n <MenuPrimitive.RadioItem\n ref={ref}\n className={clsx(classNames.radioItem, className)}\n {...props}\n />\n );\n});\nMenuRadioItem.displayName = MenuPrimitive.RadioItem.displayName;\n\nconst MenuRadioItemIndicator = forwardRef<\n React.ElementRef<typeof MenuPrimitive.RadioItemIndicator>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItemIndicator>\n>(({ className, ...props }, ref) => {\n const { classNames } = useStyles('Menu');\n\n return (\n <MenuPrimitive.RadioItemIndicator\n ref={ref}\n className={clsx(classNames.radioItemIndicator, className)}\n {...props}\n />\n );\n});\nMenuRadioItemIndicator.displayName =\n MenuPrimitive.RadioItemIndicator.displayName;\n\nconst MenuCheckboxItem = forwardRef<\n React.ElementRef<typeof MenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItem>\n>(({ className, ...props }, ref) => {\n const { classNames } = useStyles('Menu');\n\n return (\n <MenuPrimitive.CheckboxItem\n ref={ref}\n className={clsx(classNames.checkboxItem, className)}\n {...props}\n />\n );\n});\nMenuCheckboxItem.displayName = MenuPrimitive.CheckboxItem.displayName;\n\nconst MenuCheckboxItemIndicator = forwardRef<\n React.ElementRef<typeof MenuPrimitive.CheckboxItemIndicator>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItemIndicator>\n>(({ className, ...props }, ref) => {\n const { classNames } = useStyles('Menu');\n\n return (\n <MenuPrimitive.CheckboxItemIndicator\n ref={ref}\n className={clsx(classNames.checkboxItemIndicator, className)}\n {...props}\n />\n );\n});\nMenuCheckboxItemIndicator.displayName =\n MenuPrimitive.CheckboxItemIndicator.displayName;\n\nconst MenuSubmenuTrigger = forwardRef<\n React.ElementRef<typeof MenuPrimitive.SubmenuTrigger>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.SubmenuTrigger>\n>(({ className, children, ...props }, ref) => {\n const { classNames } = useStyles('Menu');\n\n return (\n <MenuPrimitive.SubmenuTrigger\n ref={ref}\n className={clsx(classNames.submenuTrigger, className)}\n {...props}\n >\n <div>{children}</div>\n <Icon\n aria-label=\"Submenu indicator icon\"\n name=\"chevron-right\"\n size={20}\n />\n </MenuPrimitive.SubmenuTrigger>\n );\n});\nMenuSubmenuTrigger.displayName = MenuPrimitive.SubmenuTrigger.displayName;\n\nconst MenuSeparator = forwardRef<\n React.ElementRef<typeof MenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.Separator>\n>(({ className, ...props }, ref) => {\n const { classNames } = useStyles('Menu');\n\n return (\n <MenuPrimitive.Separator\n ref={ref}\n className={clsx(classNames.separator, className)}\n {...props}\n />\n );\n});\nMenuSeparator.displayName = MenuPrimitive.Separator.displayName;\n\n/** @public */\nexport const Menu: MenuComponent = {\n Root: MenuPrimitive.Root,\n Trigger: MenuTrigger,\n Portal: MenuPrimitive.Portal,\n Backdrop: MenuBackdrop,\n Positioner: MenuPositioner,\n Popup: MenuPopup,\n Arrow: MenuArrow,\n Item: MenuItem,\n Group: MenuGroup,\n GroupLabel: MenuGroupLabel,\n RadioGroup: MenuRadioGroup,\n RadioItem: MenuRadioItem,\n RadioItemIndicator: MenuRadioItemIndicator,\n CheckboxItem: MenuCheckboxItem,\n CheckboxItemIndicator: MenuCheckboxItemIndicator,\n SubmenuTrigger: MenuSubmenuTrigger,\n Separator: MenuSeparator,\n Combobox,\n};\n"],"names":["MenuPrimitive"],"mappings":";;;;;;;;;;AAwBA,MAAM,WAAA,GAAc,WAGlB,CAAC,EAAE,WAAW,GAAG,KAAA,IAAS,GAAQ,KAAA;AAClC,EAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,MAAM,CAAA;AAEvC,EACE,uBAAA,GAAA;AAAA,IAACA,MAAc,CAAA,OAAA;AAAA,IAAd;AAAA,MACC,GAAA;AAAA,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EJ,CAAC,CAAA;AACD,aAAc,CAAA,WAAA,GAAcA,OAAc,SAAU,CAAA,WAAA;AAG7C,MAAM,IAAsB,GAAA;AAAA,EACjC,MAAMA,MAAc,CAAA,IAAA;AAAA,EACpB,OAAS,EAAA,WAAA;AAAA,EACT,QAAQA,MAAc,CAAA,MAAA;AAAA,EACtB,QAAU,EAAA,YAAA;AAAA,EACV,UAAY,EAAA,cAAA;AAAA,EACZ,KAAO,EAAA,SAAA;AAAA,EACP,KAAO,EAAA,SAAA;AAAA,EACP,IAAM,EAAA,QAAA;AAAA,EACN,KAAO,EAAA,SAAA;AAAA,EACP,UAAY,EAAA,cAAA;AAAA,EACZ,UAAY,EAAA,cAAA;AAAA,EACZ,SAAW,EAAA,aAAA;AAAA,EACX,kBAAoB,EAAA,sBAAA;AAAA,EACpB,YAAc,EAAA,gBAAA;AAAA,EACd,qBAAuB,EAAA,yBAAA;AAAA,EACvB,cAAgB,EAAA,kBAAA;AAAA,EAChB,SAAW,EAAA,aAAA;AAAA,EACX;AACF;;;;"}
@@ -0,0 +1,71 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { forwardRef, useEffect } from 'react';
3
+ import { RadioGroup as RadioGroup$1, Radio as Radio$1 } from 'react-aria-components';
4
+ import clsx from 'clsx';
5
+ import { FieldLabel } from '../FieldLabel/FieldLabel.esm.js';
6
+ import { FieldError } from '../FieldError/FieldError.esm.js';
7
+ import { useStyles } from '../../hooks/useStyles.esm.js';
8
+
9
+ const RadioGroup = forwardRef(
10
+ (props, ref) => {
11
+ const {
12
+ className,
13
+ label,
14
+ secondaryLabel,
15
+ description,
16
+ isRequired,
17
+ "aria-label": ariaLabel,
18
+ "aria-labelledby": ariaLabelledBy,
19
+ children,
20
+ ...rest
21
+ } = props;
22
+ const { classNames } = useStyles("RadioGroup");
23
+ useEffect(() => {
24
+ if (!label && !ariaLabel && !ariaLabelledBy) {
25
+ console.warn(
26
+ "RadioGroup requires either a visible label, aria-label, or aria-labelledby for accessibility"
27
+ );
28
+ }
29
+ }, [label, ariaLabel, ariaLabelledBy]);
30
+ const secondaryLabelText = secondaryLabel || (isRequired ? "Required" : null);
31
+ return /* @__PURE__ */ jsxs(
32
+ RadioGroup$1,
33
+ {
34
+ className: clsx(classNames.root, className),
35
+ "aria-label": ariaLabel,
36
+ "aria-labelledby": ariaLabelledBy,
37
+ ...rest,
38
+ ref,
39
+ children: [
40
+ /* @__PURE__ */ jsx(
41
+ FieldLabel,
42
+ {
43
+ label,
44
+ secondaryLabel: secondaryLabelText,
45
+ description
46
+ }
47
+ ),
48
+ /* @__PURE__ */ jsx("div", { className: classNames.content, children }),
49
+ /* @__PURE__ */ jsx(FieldError, {})
50
+ ]
51
+ }
52
+ );
53
+ }
54
+ );
55
+ RadioGroup.displayName = "RadioGroup";
56
+ const Radio = forwardRef((props, ref) => {
57
+ const { className, ...rest } = props;
58
+ const { classNames } = useStyles("RadioGroup");
59
+ return /* @__PURE__ */ jsx(
60
+ Radio$1,
61
+ {
62
+ className: clsx(classNames.radio, className),
63
+ ...rest,
64
+ ref
65
+ }
66
+ );
67
+ });
68
+ RadioGroup.displayName = "RadioGroup";
69
+
70
+ export { Radio, RadioGroup };
71
+ //# sourceMappingURL=RadioGroup.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioGroup.esm.js","sources":["../../../src/components/RadioGroup/RadioGroup.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 {\n RadioGroup as AriaRadioGroup,\n Radio as AriaRadio,\n} from 'react-aria-components';\nimport clsx from 'clsx';\nimport { FieldLabel } from '../FieldLabel';\nimport { FieldError } from '../FieldError';\nimport { useStyles } from '../../hooks/useStyles';\n\nimport type { RadioGroupProps, RadioProps } from './types';\n\n/** @public */\nexport const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(\n (props, ref) => {\n const {\n className,\n label,\n secondaryLabel,\n description,\n isRequired,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n children,\n ...rest\n } = props;\n\n const { classNames } = useStyles('RadioGroup');\n\n useEffect(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn(\n 'RadioGroup requires either a visible label, aria-label, or aria-labelledby for accessibility',\n );\n }\n }, [label, ariaLabel, ariaLabelledBy]);\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 <AriaRadioGroup\n className={clsx(classNames.root, className)}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n {...rest}\n ref={ref}\n >\n <FieldLabel\n label={label}\n secondaryLabel={secondaryLabelText}\n description={description}\n />\n <div className={classNames.content}>{children}</div>\n <FieldError />\n </AriaRadioGroup>\n );\n },\n);\n\nRadioGroup.displayName = 'RadioGroup';\n\n/** @public */\nexport const Radio = forwardRef<HTMLLabelElement, RadioProps>((props, ref) => {\n const { className, ...rest } = props;\n\n const { classNames } = useStyles('RadioGroup');\n\n return (\n <AriaRadio\n className={clsx(classNames.radio, className)}\n {...rest}\n ref={ref}\n />\n );\n});\n\nRadioGroup.displayName = 'RadioGroup';\n"],"names":["AriaRadioGroup","AriaRadio"],"mappings":";;;;;;;;AA6BO,MAAM,UAAa,GAAA,UAAA;AAAA,EACxB,CAAC,OAAO,GAAQ,KAAA;AACd,IAAM,MAAA;AAAA,MACJ,SAAA;AAAA,MACA,KAAA;AAAA,MACA,cAAA;AAAA,MACA,WAAA;AAAA,MACA,UAAA;AAAA,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A,EAAe,GAAA,SAAA,CAAU,YAAY,CAAA;AAE7C,EACE,uBAAA,GAAA;AAAA,IAACC,OAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,IAAA,CAAK,UAAW,CAAA,KAAA,EAAO,SAAS,CAAA;AAAA,MAC1C,GAAG,IAAA;AAAA,MACJ;AAAA;AAAA,GACF;AAEJ,CAAC;AAED,UAAA,CAAW,WAAc,GAAA,YAAA;;;;"}
@@ -0,0 +1,63 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { forwardRef } from 'react';
3
+ import { ScrollArea as ScrollArea$1 } from '@base-ui-components/react/scroll-area';
4
+ import clsx from 'clsx';
5
+ import { useStyles } from '../../hooks/useStyles.esm.js';
6
+
7
+ const ScrollAreaRoot = forwardRef(({ className, ...props }, ref) => {
8
+ const { classNames } = useStyles("ScrollArea");
9
+ return /* @__PURE__ */ jsx(
10
+ ScrollArea$1.Root,
11
+ {
12
+ ref,
13
+ className: clsx(classNames.root, className),
14
+ ...props
15
+ }
16
+ );
17
+ });
18
+ ScrollAreaRoot.displayName = ScrollArea$1.Root.displayName;
19
+ const ScrollAreaViewport = forwardRef(({ className, ...props }, ref) => {
20
+ const { classNames } = useStyles("ScrollArea");
21
+ return /* @__PURE__ */ jsx(
22
+ ScrollArea$1.Viewport,
23
+ {
24
+ ref,
25
+ className: clsx(classNames.viewport, className),
26
+ ...props
27
+ }
28
+ );
29
+ });
30
+ ScrollAreaViewport.displayName = ScrollArea$1.Viewport.displayName;
31
+ const ScrollAreaScrollbar = forwardRef(({ className, ...props }, ref) => {
32
+ const { classNames } = useStyles("ScrollArea");
33
+ return /* @__PURE__ */ jsx(
34
+ ScrollArea$1.Scrollbar,
35
+ {
36
+ ref,
37
+ className: clsx(classNames.scrollbar, className),
38
+ ...props
39
+ }
40
+ );
41
+ });
42
+ ScrollAreaScrollbar.displayName = ScrollArea$1.Scrollbar.displayName;
43
+ const ScrollAreaThumb = forwardRef(({ className, ...props }, ref) => {
44
+ const { classNames } = useStyles("ScrollArea");
45
+ return /* @__PURE__ */ jsx(
46
+ ScrollArea$1.Thumb,
47
+ {
48
+ ref,
49
+ className: clsx(classNames.thumb, className),
50
+ ...props
51
+ }
52
+ );
53
+ });
54
+ ScrollAreaThumb.displayName = ScrollArea$1.Thumb.displayName;
55
+ const ScrollArea = {
56
+ Root: ScrollAreaRoot,
57
+ Viewport: ScrollAreaViewport,
58
+ Scrollbar: ScrollAreaScrollbar,
59
+ Thumb: ScrollAreaThumb
60
+ };
61
+
62
+ export { ScrollArea };
63
+ //# sourceMappingURL=ScrollArea.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScrollArea.esm.js","sources":["../../../src/components/ScrollArea/ScrollArea.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 { ScrollArea as ScrollAreaPrimitive } from '@base-ui-components/react/scroll-area';\nimport clsx from 'clsx';\nimport { useStyles } from '../../hooks/useStyles';\n\nconst ScrollAreaRoot = forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>\n>(({ className, ...props }, ref) => {\n const { classNames } = useStyles('ScrollArea');\n\n return (\n <ScrollAreaPrimitive.Root\n ref={ref}\n className={clsx(classNames.root, className)}\n {...props}\n />\n );\n});\nScrollAreaRoot.displayName = ScrollAreaPrimitive.Root.displayName;\n\nconst ScrollAreaViewport = forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.Viewport>,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Viewport>\n>(({ className, ...props }, ref) => {\n const { classNames } = useStyles('ScrollArea');\n\n return (\n <ScrollAreaPrimitive.Viewport\n ref={ref}\n className={clsx(classNames.viewport, className)}\n {...props}\n />\n );\n});\nScrollAreaViewport.displayName = ScrollAreaPrimitive.Viewport.displayName;\n\nconst ScrollAreaScrollbar = forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.Scrollbar>,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Scrollbar>\n>(({ className, ...props }, ref) => {\n const { classNames } = useStyles('ScrollArea');\n\n return (\n <ScrollAreaPrimitive.Scrollbar\n ref={ref}\n className={clsx(classNames.scrollbar, className)}\n {...props}\n />\n );\n});\nScrollAreaScrollbar.displayName = ScrollAreaPrimitive.Scrollbar.displayName;\n\nconst ScrollAreaThumb = forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.Thumb>,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Thumb>\n>(({ className, ...props }, ref) => {\n const { classNames } = useStyles('ScrollArea');\n\n return (\n <ScrollAreaPrimitive.Thumb\n ref={ref}\n className={clsx(classNames.thumb, className)}\n {...props}\n />\n );\n});\nScrollAreaThumb.displayName = ScrollAreaPrimitive.Thumb.displayName;\n\n/** @public */\nexport const ScrollArea = {\n Root: ScrollAreaRoot,\n Viewport: ScrollAreaViewport,\n Scrollbar: ScrollAreaScrollbar,\n Thumb: ScrollAreaThumb,\n};\n"],"names":["ScrollAreaPrimitive"],"mappings":";;;;;;AAqBA,MAAM,cAAA,GAAiB,WAGrB,CAAC,EAAE,WAAW,GAAG,KAAA,IAAS,GAAQ,KAAA;AAClC,EAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,YAAY,CAAA;AAE7C,EACE,uBAAA,GAAA;AAAA,IAACA,YAAoB,CAAA,IAAA;AAAA,IAApB;AAAA,MACC,GAAA;AAAA,MACA,SAAW,EAAA,IAAA,CAAK,UAAW,CAAA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IAAA,CAAK,UAAW,CAAA,KAAA,EAAO,SAAS,CAAA;AAAA,MAC1C,GAAG;AAAA;AAAA,GACN;AAEJ,CAAC,CAAA;AACD,eAAgB,CAAA,WAAA,GAAcA,aAAoB,KAAM,CAAA,WAAA;AAGjD,MAAM,UAAa,GAAA;AAAA,EACxB,IAAM,EAAA,cAAA;AAAA,EACN,QAAU,EAAA,kBAAA;AAAA,EACV,SAAW,EAAA,mBAAA;AAAA,EACX,KAAO,EAAA;AACT;;;;"}
@@ -0,0 +1,107 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { forwardRef, useEffect } from 'react';
3
+ import { SearchField as SearchField$1, Input, Button } from 'react-aria-components';
4
+ import clsx from 'clsx';
5
+ import { FieldLabel } from '../FieldLabel/FieldLabel.esm.js';
6
+ import { FieldError } from '../FieldError/FieldError.esm.js';
7
+ import { RiSearch2Line, RiCloseCircleLine } from '@remixicon/react';
8
+ import { useStyles } from '../../hooks/useStyles.esm.js';
9
+
10
+ const SearchField = forwardRef(
11
+ (props, ref) => {
12
+ const {
13
+ className,
14
+ icon,
15
+ size = "small",
16
+ label,
17
+ secondaryLabel,
18
+ description,
19
+ isRequired,
20
+ placeholder = "Search",
21
+ "aria-label": ariaLabel,
22
+ "aria-labelledby": ariaLabelledBy,
23
+ ...rest
24
+ } = props;
25
+ useEffect(() => {
26
+ if (!label && !ariaLabel && !ariaLabelledBy) {
27
+ console.warn(
28
+ "SearchField requires either a visible label, aria-label, or aria-labelledby for accessibility"
29
+ );
30
+ }
31
+ }, [label, ariaLabel, ariaLabelledBy]);
32
+ const { classNames: textFieldClassNames, dataAttributes } = useStyles(
33
+ "TextField",
34
+ {
35
+ size
36
+ }
37
+ );
38
+ const { classNames: searchFieldClassNames } = useStyles("SearchField", {
39
+ size
40
+ });
41
+ const secondaryLabelText = secondaryLabel || (isRequired ? "Required" : null);
42
+ return /* @__PURE__ */ jsxs(
43
+ SearchField$1,
44
+ {
45
+ className: clsx(
46
+ textFieldClassNames.root,
47
+ searchFieldClassNames.root,
48
+ className
49
+ ),
50
+ ...dataAttributes,
51
+ "aria-label": ariaLabel,
52
+ "aria-labelledby": ariaLabelledBy,
53
+ ...rest,
54
+ ref,
55
+ children: [
56
+ /* @__PURE__ */ jsx(
57
+ FieldLabel,
58
+ {
59
+ label,
60
+ secondaryLabel: secondaryLabelText,
61
+ description
62
+ }
63
+ ),
64
+ /* @__PURE__ */ jsxs(
65
+ "div",
66
+ {
67
+ className: textFieldClassNames.inputWrapper,
68
+ "data-size": dataAttributes["data-size"],
69
+ children: [
70
+ icon !== false && /* @__PURE__ */ jsx(
71
+ "div",
72
+ {
73
+ className: textFieldClassNames.inputIcon,
74
+ "data-size": dataAttributes["data-size"],
75
+ "aria-hidden": "true",
76
+ children: icon || /* @__PURE__ */ jsx(RiSearch2Line, {})
77
+ }
78
+ ),
79
+ /* @__PURE__ */ jsx(
80
+ Input,
81
+ {
82
+ className: textFieldClassNames.input,
83
+ ...icon !== false && { "data-icon": true },
84
+ placeholder
85
+ }
86
+ ),
87
+ /* @__PURE__ */ jsx(
88
+ Button,
89
+ {
90
+ className: searchFieldClassNames.clear,
91
+ "data-size": dataAttributes["data-size"],
92
+ children: /* @__PURE__ */ jsx(RiCloseCircleLine, {})
93
+ }
94
+ )
95
+ ]
96
+ }
97
+ ),
98
+ /* @__PURE__ */ jsx(FieldError, {})
99
+ ]
100
+ }
101
+ );
102
+ }
103
+ );
104
+ SearchField.displayName = "searchField";
105
+
106
+ export { SearchField };
107
+ //# sourceMappingURL=SearchField.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchField.esm.js","sources":["../../../src/components/SearchField/SearchField.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 {\n Input,\n SearchField as AriaSearchField,\n Button,\n} from 'react-aria-components';\nimport clsx from 'clsx';\nimport { FieldLabel } from '../FieldLabel';\nimport { FieldError } from '../FieldError';\nimport { RiSearch2Line, RiCloseCircleLine } from '@remixicon/react';\nimport { useStyles } from '../../hooks/useStyles';\n\nimport type { SearchFieldProps } from './types';\n\n/** @public */\nexport const SearchField = forwardRef<HTMLDivElement, SearchFieldProps>(\n (props, ref) => {\n const {\n className,\n icon,\n size = 'small',\n label,\n secondaryLabel,\n description,\n isRequired,\n placeholder = 'Search',\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...rest\n } = props;\n\n useEffect(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn(\n 'SearchField requires either a visible label, aria-label, or aria-labelledby for accessibility',\n );\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n const { classNames: textFieldClassNames, dataAttributes } = useStyles(\n 'TextField',\n {\n size,\n },\n );\n\n const { classNames: searchFieldClassNames } = useStyles('SearchField', {\n size,\n });\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 <AriaSearchField\n className={clsx(\n textFieldClassNames.root,\n searchFieldClassNames.root,\n className,\n )}\n {...dataAttributes}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n {...rest}\n ref={ref}\n >\n <FieldLabel\n label={label}\n secondaryLabel={secondaryLabelText}\n description={description}\n />\n <div\n className={textFieldClassNames.inputWrapper}\n data-size={dataAttributes['data-size']}\n >\n {icon !== false && (\n <div\n className={textFieldClassNames.inputIcon}\n data-size={dataAttributes['data-size']}\n aria-hidden=\"true\"\n >\n {icon || <RiSearch2Line />}\n </div>\n )}\n <Input\n className={textFieldClassNames.input}\n {...(icon !== false && { 'data-icon': true })}\n placeholder={placeholder}\n />\n <Button\n className={searchFieldClassNames.clear}\n data-size={dataAttributes['data-size']}\n >\n <RiCloseCircleLine />\n </Button>\n </div>\n <FieldError />\n </AriaSearchField>\n );\n },\n);\n\nSearchField.displayName = 'searchField';\n"],"names":["AriaSearchField"],"mappings":";;;;;;;;;AA+BO,MAAM,WAAc,GAAA,UAAA;AAAA,EACzB,CAAC,OAAO,GAAQ,KAAA;AACd,IAAM,MAAA;AAAA,MACJ,SAAA;AAAA,MACA,IAAA;AAAA,MACA,IAAO,GAAA,OAAA;AAAA,MACP,KAAA;AAAA,MACA,cAAA;AAAA,MACA,WAAA;AAAA,MACA,UAAA;AAAA,MACA,WAAc,GAAA,QAAA;AAAA,MACd,YAAc,EAAA,SAAA;AAAA,MACd,iBAAmB,EAAA,cAAA;AAAA,MACnB,GAAG;AAAA,KACD,GAAA,KAAA;AAEJ,IAAA,SAAA,CAAU,MAAM;AACd,MAAA,IAAI,CAAC,KAAA,IAAS,CAAC,SAAA,IAAa,CAAC,cAAgB,EAAA;AAC3C,QAAQ,OAAA,CAAA,IAAA;AAAA,UACN;AAAA,SACF;AAAA;AACF,KACC,EAAA,CAAC,KAAO,EAAA,SAAA,EAAW,cAAc,CAAC,CAAA;AAErC,IAAA,MAAM,EAAE,UAAA,EAAY,mBAAqB,EAAA,cAAA,EAAmB,GAAA,SAAA;AAAA,MAC1D,WAAA;AAAA,MACA;AAAA,QACE;AAAA;AACF,KACF;AAEA,IAAA,MAAM,EAAE,UAAA,EAAY,qBAAsB,EAAA,GAAI,UAAU,aAAe,EAAA;AAAA,MACrE;AAAA,KACD,CAAA;AAGD,IAAM,MAAA,kBAAA,GACJ,cAAmB,KAAA,UAAA,GAAa,UAAa,GAAA,IAAA,CAAA;AAE/C,IACE,uBAAA,IAAA;AAAA,MAACA,aAAA;AAAA,MAAA;AAAA,QACC,SAAW,EAAA,IAAA;AAAA,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AAAA;AAGN;AAEA,WAAA,CAAY,WAAc,GAAA,aAAA;;;;"}
@@ -0,0 +1,89 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { forwardRef, useEffect } from 'react';
3
+ import { Select as Select$1, Button, SelectValue, Popover, ListBox, ListBoxItem, Text } from 'react-aria-components';
4
+ import clsx from 'clsx';
5
+ import './Select.styles.css.esm.js';
6
+ import { useStyles } from '../../hooks/useStyles.esm.js';
7
+ import { FieldLabel } from '../FieldLabel/FieldLabel.esm.js';
8
+ import '@remixicon/react';
9
+ import { Icon } from '../Icon/Icon.esm.js';
10
+ import '../Icon/context.esm.js';
11
+ import { FieldError } from '../FieldError/FieldError.esm.js';
12
+
13
+ const Select = forwardRef((props, ref) => {
14
+ const {
15
+ className,
16
+ label,
17
+ description,
18
+ options,
19
+ placeholder = "Select an option",
20
+ size = "small",
21
+ icon,
22
+ "aria-label": ariaLabel,
23
+ "aria-labelledby": ariaLabelledBy,
24
+ isRequired,
25
+ secondaryLabel,
26
+ style,
27
+ ...rest
28
+ } = props;
29
+ const { classNames: popoverClassNames } = useStyles("Popover");
30
+ const { classNames, dataAttributes } = useStyles("Select", {
31
+ size
32
+ });
33
+ useEffect(() => {
34
+ if (!label && !ariaLabel && !ariaLabelledBy) {
35
+ console.warn(
36
+ "TextField requires either a visible label, aria-label, or aria-labelledby for accessibility"
37
+ );
38
+ }
39
+ }, [label, ariaLabel, ariaLabelledBy]);
40
+ const secondaryLabelText = secondaryLabel || (isRequired ? "Required" : null);
41
+ return /* @__PURE__ */ jsxs(
42
+ Select$1,
43
+ {
44
+ className: clsx(classNames.root, className),
45
+ ...dataAttributes,
46
+ ref,
47
+ ...rest,
48
+ children: [
49
+ /* @__PURE__ */ jsx(
50
+ FieldLabel,
51
+ {
52
+ label,
53
+ secondaryLabel: secondaryLabelText,
54
+ description
55
+ }
56
+ ),
57
+ /* @__PURE__ */ jsxs(
58
+ Button,
59
+ {
60
+ className: classNames.trigger,
61
+ "data-size": dataAttributes["data-size"],
62
+ children: [
63
+ icon,
64
+ /* @__PURE__ */ jsx(SelectValue, { className: classNames.value }),
65
+ /* @__PURE__ */ jsx(Icon, { "aria-hidden": "true", name: "chevron-down" })
66
+ ]
67
+ }
68
+ ),
69
+ /* @__PURE__ */ jsx(FieldError, {}),
70
+ /* @__PURE__ */ jsx(Popover, { className: popoverClassNames.root, children: /* @__PURE__ */ jsx(ListBox, { className: classNames.list, children: options?.map((option) => /* @__PURE__ */ jsxs(
71
+ ListBoxItem,
72
+ {
73
+ id: option.value,
74
+ className: classNames.item,
75
+ children: [
76
+ /* @__PURE__ */ jsx("div", { className: classNames.itemIndicator, children: /* @__PURE__ */ jsx(Icon, { name: "check" }) }),
77
+ /* @__PURE__ */ jsx(Text, { slot: "label", className: classNames.itemLabel, children: option.label })
78
+ ]
79
+ },
80
+ option.value
81
+ )) }) })
82
+ ]
83
+ }
84
+ );
85
+ });
86
+ Select.displayName = "Select";
87
+
88
+ export { Select };
89
+ //# sourceMappingURL=Select.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.esm.js","sources":["../../../src/components/Select/Select.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 {\n Select as AriaSelect,\n SelectValue,\n Button,\n Popover,\n ListBox,\n ListBoxItem,\n Text,\n} from 'react-aria-components';\nimport clsx from 'clsx';\nimport './Select.styles.css';\nimport { SelectProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport { FieldLabel } from '../FieldLabel';\nimport { Icon } from '../Icon';\nimport { FieldError } from '../FieldError';\n\n/** @public */\nexport const Select = forwardRef<HTMLDivElement, SelectProps>((props, ref) => {\n const {\n className,\n label,\n description,\n options,\n placeholder = 'Select an option',\n size = 'small',\n icon,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n isRequired,\n secondaryLabel,\n style,\n ...rest\n } = props;\n\n const { classNames: popoverClassNames } = useStyles('Popover');\n const { classNames, dataAttributes } = useStyles('Select', {\n size,\n });\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 // If a secondary label is provided, use it. Otherwise, use 'Required' if the field is required.\n const secondaryLabelText = secondaryLabel || (isRequired ? 'Required' : null);\n\n return (\n <AriaSelect\n className={clsx(classNames.root, className)}\n {...dataAttributes}\n ref={ref}\n {...rest}\n >\n <FieldLabel\n label={label}\n secondaryLabel={secondaryLabelText}\n description={description}\n />\n <Button\n className={classNames.trigger}\n data-size={dataAttributes['data-size']}\n >\n {icon}\n <SelectValue className={classNames.value} />\n <Icon aria-hidden=\"true\" name=\"chevron-down\" />\n </Button>\n <FieldError />\n <Popover className={popoverClassNames.root}>\n <ListBox className={classNames.list}>\n {options?.map(option => (\n <ListBoxItem\n key={option.value}\n id={option.value}\n className={classNames.item}\n >\n <div className={classNames.itemIndicator}>\n <Icon name=\"check\" />\n </div>\n <Text slot=\"label\" className={classNames.itemLabel}>\n {option.label}\n </Text>\n </ListBoxItem>\n ))}\n </ListBox>\n </Popover>\n </AriaSelect>\n );\n});\n\nSelect.displayName = 'Select';\n"],"names":["AriaSelect"],"mappings":";;;;;;;;;;;;AAmCO,MAAM,MAAS,GAAA,UAAA,CAAwC,CAAC,KAAA,EAAO,GAAQ,KAAA;AAC5E,EAAM,MAAA;AAAA,IACJ,SAAA;AAAA,IACA,KAAA;AAAA,IACA,WAAA;AAAA,IACA,OA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,8BACA,GAAA,CAAA,WAAA,EAAA,EAAY,SAAW,EAAA,UAAA,CAAW,KAAO,EAAA,CAAA;AAAA,8BACzC,GAAA,CAAA,IAAA,EAAA,EAAK,aAAY,EAAA,MAAA,EAAO,MAAK,cAAe,EAAA;AAAA;AAAA;AAAA,SAC/C;AAAA,4BACC,UAAW,EAAA,EAAA,CAAA;AAAA,wBACX,GAAA,CAAA,OAAA,EAAA,EAAQ,SAAW,EAAA,iBAAA,CAAkB,IACpC,EAAA,QAAA,kBAAA,GAAA,CAAC,OAAQ,EAAA,EAAA,SAAA,EAAW,UAAW,CAAA,IAAA,EAC5B,QAAS,EAAA,OAAA,EAAA,GAAA,CAAI,CACZ,MAAA,qBAAA,IAAA;AAAA,UAAC,WAAA;AAAA,UAAA;AAAA,YAEC,IAAI,MAAO,CAAA,KAAA;AAAA,YACX,WAAW,UAAW,CAAA,IAAA;AAAA,YAEtB,QAAA,EAAA;AAAA,8BAAC,GAAA,CAAA,KAAA,EAAA,EAAI,WAAW,UAAW,CAAA,aAAA,EACzB,8BAAC,IAAK,EAAA,EAAA,IAAA,EAAK,SAAQ,CACrB,EAAA,CAAA;AAAA,8BACA,GAAA,CAAC,QAAK,IAAK,EAAA,OAAA,EAAQ,WAAW,UAAW,CAAA,SAAA,EACtC,iBAAO,KACV,EAAA;AAAA;AAAA,WAAA;AAAA,UATK,MAAO,CAAA;AAAA,SAWf,GACH,CACF,EAAA;AAAA;AAAA;AAAA,GACF;AAEJ,CAAC;AAED,MAAA,CAAO,WAAc,GAAA,QAAA;;;;"}
@@ -0,0 +1,7 @@
1
+ import styleInject from '../../node_modules_dist/style-inject/dist/style-inject.es.esm.js';
2
+
3
+ var css_248z = "/*\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\n.bui-Select[data-invalid] {\n & .bui-SelectTrigger {\n border-color: var(--bui-fg-danger);\n }\n}\n\n.bui-SelectTrigger {\n box-sizing: border-box;\n border-radius: var(--bui-radius-3);\n border: 1px solid var(--bui-border);\n background-color: var(--bui-bg-surface-1);\n display: flex;\n justify-content: space-between;\n align-items: center;\n transition: border-color 0.2s ease-in-out, outline-color 0.2s ease-in-out;\n cursor: pointer;\n gap: var(--bui-space-2);\n max-width: 100%;\n\n & svg {\n flex-shrink: 0;\n }\n\n &[data-size='small'] {\n height: 2rem;\n padding-inline: var(--bui-space-3);\n }\n\n &[data-size='medium'] {\n height: 3rem;\n padding-inline: var(--bui-space-4);\n }\n\n &[data-size='small'] svg {\n width: 1rem;\n height: 1rem;\n }\n\n &[data-size='medium'] svg {\n width: 1.25rem;\n height: 1.25rem;\n }\n\n &::placeholder {\n color: var(--bui-fg-secondary);\n }\n\n &:hover {\n border-color: var(--bui-border-hover);\n }\n\n &:focus-visible {\n border-color: var(--bui-border-pressed);\n outline: 0;\n }\n\n &[data-invalid] {\n border-color: var(--bui-fg-danger);\n }\n &[data-invalid]:hover {\n border-width: 2px;\n }\n\n &[data-invalid]:focus-visible {\n border-width: 2px;\n }\n\n &[disabled] {\n cursor: not-allowed;\n border-color: var(--bui-border-disabled);\n color: var(--bui-fg-disabled);\n }\n\n &[disabled] .bui-SelectValue {\n color: var(--bui-fg-disabled);\n }\n\n &[data-popup-open] .bui-SelectIcon {\n transform: rotate(180deg);\n }\n}\n\n.bui-SelectValue {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n width: 100%;\n font-size: var(--bui-font-size-3);\n font-family: var(--bui-font-regular);\n font-weight: var(--bui-font-weight-regular);\n color: var(--bui-fg-primary);\n\n & .bui-SelectItemIndicator {\n display: none;\n }\n\n &[disabled] {\n color: var(--bui-fg-disabled);\n }\n}\n\n.bui-SelectItem {\n position: relative;\n width: var(--anchor-width);\n display: grid;\n grid-template-areas: 'icon text';\n grid-template-columns: 1rem 1fr;\n align-items: center;\n padding-block: var(--bui-space-2);\n padding-inline: var(--bui-space-4);\n color: var(--bui-fg-primary);\n border-radius: var(--bui-radius-3);\n cursor: pointer;\n user-select: none;\n font-size: var(--bui-font-size-3);\n gap: var(--bui-space-2);\n outline: none;\n\n &[data-focused] {\n z-index: 0;\n position: relative;\n color: var(--bui-fg-primary);\n }\n\n &[data-focused]::before {\n content: '';\n z-index: -1;\n position: absolute;\n inset-block: 0;\n inset-inline: 0.25rem;\n border-radius: 0.25rem;\n background-color: var(--bui-bg-tint-hover);\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n color: var(--bui-fg-disabled);\n }\n\n &[data-selected] .bui-SelectItemIndicator {\n opacity: 1;\n }\n}\n\n.bui-SelectItemIndicator {\n grid-area: icon;\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: 0;\n transition: opacity 0.2s ease-in-out;\n}\n\n.bui-SelectItemLabel {\n flex: 1;\n grid-area: text;\n}\n";
4
+ styleInject(css_248z);
5
+
6
+ export { css_248z as default };
7
+ //# sourceMappingURL=Select.styles.css.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.styles.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}