@backstage/ui 0.9.0-next.1 → 0.9.0-next.3

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 (57) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/css/styles.css +8 -0
  3. package/dist/components/Accordion/Accordion.esm.js +109 -0
  4. package/dist/components/Accordion/Accordion.esm.js.map +1 -0
  5. package/dist/components/Accordion/Accordion.module.css.esm.js +8 -0
  6. package/dist/components/Accordion/Accordion.module.css.esm.js.map +1 -0
  7. package/dist/components/Avatar/Avatar.esm.js +39 -23
  8. package/dist/components/Avatar/Avatar.esm.js.map +1 -1
  9. package/dist/components/Avatar/Avatar.module.css.esm.js +1 -1
  10. package/dist/components/Button/Button.esm.js +28 -9
  11. package/dist/components/Button/Button.esm.js.map +1 -1
  12. package/dist/components/Button/Button.module.css.esm.js +2 -2
  13. package/dist/components/ButtonIcon/ButtonIcon.esm.js +35 -4
  14. package/dist/components/ButtonIcon/ButtonIcon.esm.js.map +1 -1
  15. package/dist/components/ButtonLink/ButtonLink.esm.js +18 -30
  16. package/dist/components/ButtonLink/ButtonLink.esm.js.map +1 -1
  17. package/dist/components/Dialog/Dialog.module.css.esm.js +1 -1
  18. package/dist/components/Header/HeaderToolbar.esm.js +3 -5
  19. package/dist/components/Header/HeaderToolbar.esm.js.map +1 -1
  20. package/dist/components/Link/Link.esm.js +11 -39
  21. package/dist/components/Link/Link.esm.js.map +1 -1
  22. package/dist/components/Link/Link.module.css.esm.js +3 -3
  23. package/dist/components/Menu/Menu.module.css.esm.js +1 -1
  24. package/dist/components/Popover/Popover.module.css.esm.js +1 -1
  25. package/dist/components/RadioGroup/RadioGroup.module.css.esm.js +1 -1
  26. package/dist/components/SearchField/SearchField.esm.js +17 -33
  27. package/dist/components/SearchField/SearchField.esm.js.map +1 -1
  28. package/dist/components/SearchField/SearchField.module.css.esm.js +3 -3
  29. package/dist/components/Select/Select.esm.js +17 -53
  30. package/dist/components/Select/Select.esm.js.map +1 -1
  31. package/dist/components/Select/Select.module.css.esm.js +2 -2
  32. package/dist/components/Select/SelectContent.esm.js +55 -0
  33. package/dist/components/Select/SelectContent.esm.js.map +1 -0
  34. package/dist/components/Select/SelectListBox.esm.js +54 -0
  35. package/dist/components/Select/SelectListBox.esm.js.map +1 -0
  36. package/dist/components/Select/SelectTrigger.esm.js +23 -0
  37. package/dist/components/Select/SelectTrigger.esm.js.map +1 -0
  38. package/dist/components/Table/Table.module.css.esm.js +2 -2
  39. package/dist/components/Table/components/CellProfile.esm.js +2 -34
  40. package/dist/components/Table/components/CellProfile.esm.js.map +1 -1
  41. package/dist/components/Table/components/Row.esm.js +2 -0
  42. package/dist/components/Table/components/Row.esm.js.map +1 -1
  43. package/dist/components/Text/Text.esm.js +3 -3
  44. package/dist/components/Text/Text.esm.js.map +1 -1
  45. package/dist/components/Text/Text.module.css.esm.js +2 -2
  46. package/dist/components/TextField/TextField.esm.js +5 -5
  47. package/dist/components/TextField/TextField.esm.js.map +1 -1
  48. package/dist/components/TextField/TextField.module.css.esm.js +2 -2
  49. package/dist/index.d.ts +124 -35
  50. package/dist/index.esm.js +1 -1
  51. package/dist/utils/componentDefinitions.esm.js +38 -15
  52. package/dist/utils/componentDefinitions.esm.js.map +1 -1
  53. package/package.json +2 -3
  54. package/dist/components/Collapsible/Collapsible.esm.js +0 -55
  55. package/dist/components/Collapsible/Collapsible.esm.js.map +0 -1
  56. package/dist/components/Collapsible/Collapsible.module.css.esm.js +0 -8
  57. package/dist/components/Collapsible/Collapsible.module.css.esm.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,100 @@
1
1
  # @backstage/ui
2
2
 
3
+ ## 0.9.0-next.3
4
+
5
+ ### Minor Changes
6
+
7
+ - 83c100e: **BREAKING**: Removed `Collapsible` component. Migrate to `Accordion` or use React Aria `Disclosure`.
8
+
9
+ ## Migration Path 1: Accordion (Opinionated Styled Component)
10
+
11
+ Accordion provides preset styling with a similar component structure.
12
+
13
+ ```diff
14
+ - import { Collapsible } from '@backstage/ui';
15
+ + import { Accordion, AccordionTrigger, AccordionPanel } from '@backstage/ui';
16
+
17
+ - <Collapsible.Root>
18
+ - <Collapsible.Trigger render={(props) => <Button {...props}>Toggle</Button>} />
19
+ - <Collapsible.Panel>Content</Collapsible.Panel>
20
+ - </Collapsible.Root>
21
+
22
+ + <Accordion>
23
+ + <AccordionTrigger title="Toggle" />
24
+ + <AccordionPanel>Content</AccordionPanel>
25
+ + </Accordion>
26
+ ```
27
+
28
+ CSS classes: `.bui-CollapsibleRoot` → `.bui-Accordion`, `.bui-CollapsibleTrigger` → `.bui-AccordionTrigger` (now on heading element), `.bui-CollapsiblePanel` → `.bui-AccordionPanel`
29
+
30
+ ## Migration Path 2: React Aria Disclosure (Full Customization)
31
+
32
+ For custom styling without preset styles:
33
+
34
+ ```tsx
35
+ import { Disclosure, Button, DisclosurePanel } from 'react-aria-components';
36
+
37
+ <Disclosure>
38
+ <Button slot="trigger">Toggle</Button>
39
+ <DisclosurePanel>Content</DisclosurePanel>
40
+ </Disclosure>;
41
+ ```
42
+
43
+ - 816af0f: **BREAKING**: The `SelectProps` interface now accepts a generic type parameter for selection mode.
44
+
45
+ Added searchable and multiple selection support to Select component. The component now accepts `searchable`, `selectionMode`, and `searchPlaceholder` props to enable filtering and multi-selection modes.
46
+
47
+ Migration: If you're using `SelectProps` type directly, update from `SelectProps` to `SelectProps<'single' | 'multiple'>`. Component usage remains backward compatible.
48
+
49
+ ### Patch Changes
50
+
51
+ - 35a3614: Fixed CSS issues in Select component including popover width constraints, focus outline behavior, and overflow handling.
52
+ - 01476f0: Improved visual consistency of PasswordField, SearchField, and MenuAutocomplete components.
53
+ - 836b0c7: Fixed dialog backdrop appearance in dark mode.
54
+ - 6d35a6b: Removed `@base-ui-components/react` dependency as all components now use React Aria Components.
55
+ - 7839e7b: Added `loading` prop to Button and ButtonIcon components for displaying spinner during async operations.
56
+ - a00fb88: Fixed Table Row component to properly support opening links in new tabs via right-click or Cmd+Click when using the href prop.
57
+
58
+ ## 0.9.0-next.2
59
+
60
+ ### Minor Changes
61
+
62
+ - 539cf26: **BREAKING**: Migrated Avatar component from Base UI to custom implementation with size changes:
63
+
64
+ - Base UI-specific props are no longer supported
65
+ - Size values have been updated:
66
+ - New `x-small` size added (1.25rem / 20px)
67
+ - `small` size unchanged (1.5rem / 24px)
68
+ - `medium` size unchanged (2rem / 32px, default)
69
+ - `large` size **changed from 3rem to 2.5rem** (40px)
70
+ - New `x-large` size added (3rem / 48px)
71
+
72
+ Migration:
73
+
74
+ ```diff
75
+ # Remove Base UI-specific props
76
+ - <Avatar src="..." name="..." render={...} />
77
+ + <Avatar src="..." name="..." />
78
+
79
+ # Update large size usage to x-large for same visual size
80
+ - <Avatar src="..." name="..." size="large" />
81
+ + <Avatar src="..." name="..." size="x-large" />
82
+ ```
83
+
84
+ Added `purpose` prop for accessibility control (`'informative'` or `'decoration'`).
85
+
86
+ - 134151f: Fixing styles on SearchField in Backstage UI after migration to CSS modules. `SearchField` has now its own set of class names. We previously used class names from `TextField` but this approach was creating some confusion so going forward in your theme you'll be able to theme `TextField` and `SearchField` separately.
87
+
88
+ ### Patch Changes
89
+
90
+ - d01de00: Fix broken external links in Backstage UI Header component.
91
+ - deaa427: Fixed Text component to prevent `truncate` prop from being spread to the underlying DOM element.
92
+ - 1059f95: Improved the Link component structure in Backstage UI.
93
+ - 6874094: Migrated CellProfile component from Base UI Avatar to Backstage UI Avatar component.
94
+ - 719d772: Avatar components in x-small and small sizes now display only one initial instead of two, improving readability at smaller dimensions.
95
+ - 3b18d80: Fixed RadioGroup radio button ellipse distortion by preventing flex shrink and grow.
96
+ - e16ece5: Set the color-scheme property depending on theme
97
+
3
98
  ## 0.9.0-next.1
4
99
 
5
100
  ### Minor Changes
package/css/styles.css CHANGED
@@ -247,6 +247,14 @@
247
247
  -webkit-font-smoothing: antialiased;
248
248
  -moz-osx-font-smoothing: grayscale;
249
249
  }
250
+
251
+ [data-theme-mode="dark"] {
252
+ color-scheme: dark;
253
+ }
254
+
255
+ [data-theme-mode="light"] {
256
+ color-scheme: light;
257
+ }
250
258
  }
251
259
 
252
260
  @layer components;
@@ -0,0 +1,109 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { forwardRef } from 'react';
3
+ import { Disclosure, Heading, Button, DisclosurePanel, DisclosureGroup } from 'react-aria-components';
4
+ import { RiArrowDownSLine } from '@remixicon/react';
5
+ import clsx from 'clsx';
6
+ import { useStyles } from '../../hooks/useStyles.esm.js';
7
+ import styles from './Accordion.module.css.esm.js';
8
+ import { Flex } from '../Flex/Flex.esm.js';
9
+
10
+ const Accordion = forwardRef(({ className, ...props }, ref) => {
11
+ const { classNames, cleanedProps } = useStyles("Accordion", props);
12
+ return /* @__PURE__ */ jsx(
13
+ Disclosure,
14
+ {
15
+ ref,
16
+ className: clsx(classNames.root, styles[classNames.root], className),
17
+ ...cleanedProps
18
+ }
19
+ );
20
+ });
21
+ Accordion.displayName = "Accordion";
22
+ const AccordionTrigger = forwardRef(({ className, title, subtitle, children, ...props }, ref) => {
23
+ const { classNames, cleanedProps } = useStyles("Accordion", props);
24
+ return /* @__PURE__ */ jsx(
25
+ Heading,
26
+ {
27
+ ref,
28
+ className: clsx(
29
+ classNames.trigger,
30
+ styles[classNames.trigger],
31
+ className
32
+ ),
33
+ ...cleanedProps,
34
+ children: /* @__PURE__ */ jsxs(
35
+ Button,
36
+ {
37
+ slot: "trigger",
38
+ className: clsx(
39
+ classNames.triggerButton,
40
+ styles[classNames.triggerButton]
41
+ ),
42
+ children: [
43
+ children ? children : /* @__PURE__ */ jsxs(Flex, { gap: "2", align: "center", children: [
44
+ /* @__PURE__ */ jsx(
45
+ "span",
46
+ {
47
+ className: clsx(
48
+ classNames.triggerTitle,
49
+ styles[classNames.triggerTitle]
50
+ ),
51
+ children: title
52
+ }
53
+ ),
54
+ subtitle && /* @__PURE__ */ jsx(
55
+ "span",
56
+ {
57
+ className: clsx(
58
+ classNames.triggerSubtitle,
59
+ styles[classNames.triggerSubtitle]
60
+ ),
61
+ children: subtitle
62
+ }
63
+ )
64
+ ] }),
65
+ /* @__PURE__ */ jsx(
66
+ RiArrowDownSLine,
67
+ {
68
+ className: clsx(
69
+ classNames.triggerIcon,
70
+ styles[classNames.triggerIcon]
71
+ ),
72
+ size: 16
73
+ }
74
+ )
75
+ ]
76
+ }
77
+ )
78
+ }
79
+ );
80
+ });
81
+ AccordionTrigger.displayName = "AccordionTrigger";
82
+ const AccordionPanel = forwardRef(({ className, ...props }, ref) => {
83
+ const { classNames, cleanedProps } = useStyles("Accordion", props);
84
+ return /* @__PURE__ */ jsx(
85
+ DisclosurePanel,
86
+ {
87
+ ref,
88
+ className: clsx(classNames.panel, styles[classNames.panel], className),
89
+ ...cleanedProps
90
+ }
91
+ );
92
+ });
93
+ AccordionPanel.displayName = "AccordionPanel";
94
+ const AccordionGroup = forwardRef(({ className, allowsMultiple = false, ...props }, ref) => {
95
+ const { classNames, cleanedProps } = useStyles("Accordion", props);
96
+ return /* @__PURE__ */ jsx(
97
+ DisclosureGroup,
98
+ {
99
+ ref,
100
+ allowsMultipleExpanded: allowsMultiple,
101
+ className: clsx(classNames.group, styles[classNames.group], className),
102
+ ...cleanedProps
103
+ }
104
+ );
105
+ });
106
+ AccordionGroup.displayName = "AccordionGroup";
107
+
108
+ export { Accordion, AccordionGroup, AccordionPanel, AccordionTrigger };
109
+ //# sourceMappingURL=Accordion.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Accordion.esm.js","sources":["../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef } from 'react';\nimport {\n Disclosure as RADisclosure,\n Button as RAButton,\n DisclosurePanel as RADisclosurePanel,\n DisclosureGroup as RADisclosureGroup,\n Heading as RAHeading,\n} from 'react-aria-components';\nimport { RiArrowDownSLine } from '@remixicon/react';\nimport clsx from 'clsx';\nimport type {\n AccordionProps,\n AccordionTriggerProps,\n AccordionPanelProps,\n AccordionGroupProps,\n} from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport styles from './Accordion.module.css';\nimport { Flex } from '../Flex';\n\n/** @public */\nexport const Accordion = forwardRef<\n React.ElementRef<typeof RADisclosure>,\n AccordionProps\n>(({ className, ...props }, ref) => {\n const { classNames, cleanedProps } = useStyles('Accordion', props);\n\n return (\n <RADisclosure\n ref={ref}\n className={clsx(classNames.root, styles[classNames.root], className)}\n {...cleanedProps}\n />\n );\n});\n\nAccordion.displayName = 'Accordion';\n\n/** @public */\nexport const AccordionTrigger = forwardRef<\n React.ElementRef<typeof RAHeading>,\n AccordionTriggerProps\n>(({ className, title, subtitle, children, ...props }, ref) => {\n const { classNames, cleanedProps } = useStyles('Accordion', props);\n\n return (\n <RAHeading\n ref={ref}\n className={clsx(\n classNames.trigger,\n styles[classNames.trigger],\n className,\n )}\n {...cleanedProps}\n >\n <RAButton\n slot=\"trigger\"\n className={clsx(\n classNames.triggerButton,\n styles[classNames.triggerButton],\n )}\n >\n {children ? (\n children\n ) : (\n <Flex gap=\"2\" align=\"center\">\n <span\n className={clsx(\n classNames.triggerTitle,\n styles[classNames.triggerTitle],\n )}\n >\n {title}\n </span>\n {subtitle && (\n <span\n className={clsx(\n classNames.triggerSubtitle,\n styles[classNames.triggerSubtitle],\n )}\n >\n {subtitle}\n </span>\n )}\n </Flex>\n )}\n\n <RiArrowDownSLine\n className={clsx(\n classNames.triggerIcon,\n styles[classNames.triggerIcon],\n )}\n size={16}\n />\n </RAButton>\n </RAHeading>\n );\n});\n\nAccordionTrigger.displayName = 'AccordionTrigger';\n\n/** @public */\nexport const AccordionPanel = forwardRef<\n React.ElementRef<typeof RADisclosurePanel>,\n AccordionPanelProps\n>(({ className, ...props }, ref) => {\n const { classNames, cleanedProps } = useStyles('Accordion', props);\n\n return (\n <RADisclosurePanel\n ref={ref}\n className={clsx(classNames.panel, styles[classNames.panel], className)}\n {...cleanedProps}\n />\n );\n});\n\nAccordionPanel.displayName = 'AccordionPanel';\n\n/** @public */\nexport const AccordionGroup = forwardRef<\n React.ElementRef<typeof RADisclosureGroup>,\n AccordionGroupProps\n>(({ className, allowsMultiple = false, ...props }, ref) => {\n const { classNames, cleanedProps } = useStyles('Accordion', props);\n\n return (\n <RADisclosureGroup\n ref={ref}\n allowsMultipleExpanded={allowsMultiple}\n className={clsx(classNames.group, styles[classNames.group], className)}\n {...cleanedProps}\n />\n );\n});\n\nAccordionGroup.displayName = 'AccordionGroup';\n"],"names":["RADisclosure","RAHeading","RAButton","RADisclosurePanel","RADisclosureGroup"],"mappings":";;;;;;;;;AAqCO,MAAM,SAAA,GAAY,WAGvB,CAAC,EAAE,WAAW,GAAG,KAAA,IAAS,GAAA,KAAQ;AAClC,EAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,SAAA,CAAU,aAAa,KAAK,CAAA;AAEjE,EAAA,uBACE,GAAA;AAAA,IAACA,UAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA,EAAW,KAAK,UAAA,CAAW,IAAA,EAAM,OAAO,UAAA,CAAW,IAAI,GAAG,SAAS,CAAA;AAAA,MAClE,GAAG;AAAA;AAAA,GACN;AAEJ,CAAC;AAED,SAAA,CAAU,WAAA,GAAc,WAAA;AAGjB,MAAM,gBAAA,GAAmB,UAAA,CAG9B,CAAC,EAAE,SAAA,EAAW,KAAA,EAAO,QAAA,EAAU,QAAA,EAAU,GAAG,KAAA,EAAM,EAAG,GAAA,KAAQ;AAC7D,EAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,SAAA,CAAU,aAAa,KAAK,CAAA;AAEjE,EAAA,uBACE,GAAA;AAAA,IAACC,OAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA,EAAW,IAAA;AAAA,QACT,UAAA,CAAW,OAAA;AAAA,QACX,MAAA,CAAO,WAAW,OAAO,CAAA;AAAA,QACzB;AAAA,OACF;AAAA,MACC,GAAG,YAAA;AAAA,MAEJ,QAAA,kBAAA,IAAA;AAAA,QAACC,MAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAK,SAAA;AAAA,UACL,SAAA,EAAW,IAAA;AAAA,YACT,UAAA,CAAW,aAAA;AAAA,YACX,MAAA,CAAO,WAAW,aAAa;AAAA,WACjC;AAAA,UAEC,QAAA,EAAA;AAAA,YAAA,QAAA,GACC,2BAEA,IAAA,CAAC,IAAA,EAAA,EAAK,GAAA,EAAI,GAAA,EAAI,OAAM,QAAA,EAClB,QAAA,EAAA;AAAA,8BAAA,GAAA;AAAA,gBAAC,MAAA;AAAA,gBAAA;AAAA,kBACC,SAAA,EAAW,IAAA;AAAA,oBACT,UAAA,CAAW,YAAA;AAAA,oBACX,MAAA,CAAO,WAAW,YAAY;AAAA,mBAChC;AAAA,kBAEC,QAAA,EAAA;AAAA;AAAA,eACH;AAAA,cACC,QAAA,oBACC,GAAA;AAAA,gBAAC,MAAA;AAAA,gBAAA;AAAA,kBACC,SAAA,EAAW,IAAA;AAAA,oBACT,UAAA,CAAW,eAAA;AAAA,oBACX,MAAA,CAAO,WAAW,eAAe;AAAA,mBACnC;AAAA,kBAEC,QAAA,EAAA;AAAA;AAAA;AACH,aAAA,EAEJ,CAAA;AAAA,4BAGF,GAAA;AAAA,cAAC,gBAAA;AAAA,cAAA;AAAA,gBACC,SAAA,EAAW,IAAA;AAAA,kBACT,UAAA,CAAW,WAAA;AAAA,kBACX,MAAA,CAAO,WAAW,WAAW;AAAA,iBAC/B;AAAA,gBACA,IAAA,EAAM;AAAA;AAAA;AACR;AAAA;AAAA;AACF;AAAA,GACF;AAEJ,CAAC;AAED,gBAAA,CAAiB,WAAA,GAAc,kBAAA;AAGxB,MAAM,cAAA,GAAiB,WAG5B,CAAC,EAAE,WAAW,GAAG,KAAA,IAAS,GAAA,KAAQ;AAClC,EAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,SAAA,CAAU,aAAa,KAAK,CAAA;AAEjE,EAAA,uBACE,GAAA;AAAA,IAACC,eAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA,EAAW,KAAK,UAAA,CAAW,KAAA,EAAO,OAAO,UAAA,CAAW,KAAK,GAAG,SAAS,CAAA;AAAA,MACpE,GAAG;AAAA;AAAA,GACN;AAEJ,CAAC;AAED,cAAA,CAAe,WAAA,GAAc,gBAAA;AAGtB,MAAM,cAAA,GAAiB,UAAA,CAG5B,CAAC,EAAE,SAAA,EAAW,iBAAiB,KAAA,EAAO,GAAG,KAAA,EAAM,EAAG,GAAA,KAAQ;AAC1D,EAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,SAAA,CAAU,aAAa,KAAK,CAAA;AAEjE,EAAA,uBACE,GAAA;AAAA,IAACC,eAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,sBAAA,EAAwB,cAAA;AAAA,MACxB,SAAA,EAAW,KAAK,UAAA,CAAW,KAAA,EAAO,OAAO,UAAA,CAAW,KAAK,GAAG,SAAS,CAAA;AAAA,MACpE,GAAG;AAAA;AAAA,GACN;AAEJ,CAAC;AAED,cAAA,CAAe,WAAA,GAAc,gBAAA;;;;"}
@@ -0,0 +1,8 @@
1
+ import styleInject from '../../node_modules_dist/style-inject/dist/style-inject.es.esm.js';
2
+
3
+ var css_248z = "/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n@layer tokens, base, components, utilities;\n\n@layer components {\n .Accordion-module_bui-Accordion__wEbQl {\n width: 100%;\n background-color: var(--bui-bg-surface-1);\n border-radius: var(--bui-radius-3);\n padding: var(--bui-space-3);\n }\n\n .Accordion-module_bui-AccordionTrigger__1fPAs {\n all: unset;\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .Accordion-module_bui-AccordionTriggerButton__3RF1r {\n all: unset;\n width: 100%;\n color: var(--bui-fg-primary);\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n text-align: left;\n\n &:focus-visible {\n outline: none;\n transition: none;\n box-shadow: inset 0 0 0 2px var(--bui-ring);\n }\n\n &[data-disabled='true'] {\n background-color: transparent;\n color: var(--bui-fg-disabled);\n cursor: not-allowed;\n }\n }\n\n .Accordion-module_bui-AccordionTriggerTitle__3DOpr {\n font-size: var(--bui-font-size-4);\n font-weight: var(--bui-font-weight-bold);\n line-height: 140%;\n }\n\n .Accordion-module_bui-AccordionTriggerSubtitle__jU446 {\n font-size: var(--bui-font-size-2);\n line-height: 140%;\n color: var(--bui-fg-secondary);\n }\n\n .Accordion-module_bui-AccordionTriggerIcon__1953s {\n transition: transform 150ms ease-out;\n flex-shrink: 0;\n width: 1rem;\n height: 1rem;\n\n [data-expanded='true'] & {\n transform: rotate(180deg);\n }\n }\n\n .Accordion-module_bui-AccordionPanel__1bJFQ {\n [data-expanded='true'] & {\n padding-top: var(--bui-space-1);\n }\n }\n\n .Accordion-module_bui-AccordionGroup__3bll0 {\n display: flex;\n flex-direction: column;\n gap: var(--bui-space-3);\n width: 100%;\n }\n}\n";
4
+ var styles = {"bui-Accordion":"Accordion-module_bui-Accordion__wEbQl","bui-AccordionTrigger":"Accordion-module_bui-AccordionTrigger__1fPAs","bui-AccordionTriggerButton":"Accordion-module_bui-AccordionTriggerButton__3RF1r","bui-AccordionTriggerTitle":"Accordion-module_bui-AccordionTriggerTitle__3DOpr","bui-AccordionTriggerSubtitle":"Accordion-module_bui-AccordionTriggerSubtitle__jU446","bui-AccordionTriggerIcon":"Accordion-module_bui-AccordionTriggerIcon__1953s","bui-AccordionPanel":"Accordion-module_bui-AccordionPanel__1bJFQ","bui-AccordionGroup":"Accordion-module_bui-AccordionGroup__3bll0"};
5
+ styleInject(css_248z);
6
+
7
+ export { styles as default };
8
+ //# sourceMappingURL=Accordion.module.css.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Accordion.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1,6 +1,5 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import { Avatar as Avatar$1 } from '@base-ui-components/react/avatar';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { forwardRef, useState, useEffect } from 'react';
4
3
  import clsx from 'clsx';
5
4
  import { useStyles } from '../../hooks/useStyles.esm.js';
6
5
  import styles from './Avatar.module.css.esm.js';
@@ -8,36 +7,53 @@ import styles from './Avatar.module.css.esm.js';
8
7
  const Avatar = forwardRef((props, ref) => {
9
8
  const { classNames, dataAttributes, cleanedProps } = useStyles("Avatar", {
10
9
  size: "medium",
10
+ purpose: "informative",
11
11
  ...props
12
12
  });
13
- const { className, src, name, ...rest } = cleanedProps;
14
- return /* @__PURE__ */ jsxs(
15
- Avatar$1.Root,
13
+ const { className, src, name, purpose, ...rest } = cleanedProps;
14
+ const [imageStatus, setImageStatus] = useState("loading");
15
+ useEffect(() => {
16
+ setImageStatus("loading");
17
+ const img = new Image();
18
+ img.onload = () => setImageStatus("loaded");
19
+ img.onerror = () => setImageStatus("error");
20
+ img.src = src;
21
+ return () => {
22
+ img.onload = null;
23
+ img.onerror = null;
24
+ };
25
+ }, [src]);
26
+ const initialsCount = ["x-small", "small"].includes(cleanedProps.size) ? 1 : 2;
27
+ const initials = name.split(" ").map((word) => word[0]).join("").toLocaleUpperCase("en-US").slice(0, initialsCount);
28
+ return /* @__PURE__ */ jsx(
29
+ "div",
16
30
  {
17
31
  ref,
32
+ role: "img",
33
+ "aria-label": purpose === "informative" ? name : void 0,
34
+ "aria-hidden": purpose === "decoration" ? true : void 0,
18
35
  className: clsx(classNames.root, styles[classNames.root], className),
19
36
  ...dataAttributes,
20
37
  ...rest,
21
- children: [
22
- /* @__PURE__ */ jsx(
23
- Avatar$1.Image,
24
- {
25
- className: clsx(classNames.image, styles[classNames.image]),
26
- src
27
- }
28
- ),
29
- /* @__PURE__ */ jsx(
30
- Avatar$1.Fallback,
31
- {
32
- className: clsx(classNames.fallback, styles[classNames.fallback]),
33
- children: (name || "").split(" ").map((word) => word[0]).join("").toLocaleUpperCase("en-US").slice(0, 2)
34
- }
35
- )
36
- ]
38
+ children: imageStatus === "loaded" ? /* @__PURE__ */ jsx(
39
+ "img",
40
+ {
41
+ src,
42
+ alt: "",
43
+ className: clsx(classNames.image, styles[classNames.image])
44
+ }
45
+ ) : /* @__PURE__ */ jsx(
46
+ "div",
47
+ {
48
+ "aria-hidden": "true",
49
+ className: clsx(classNames.fallback, styles[classNames.fallback]),
50
+ children: initials
51
+ }
52
+ )
37
53
  }
38
54
  );
39
55
  });
40
- Avatar.displayName = Avatar$1.Root.displayName;
56
+ Avatar.displayName = "Avatar";
41
57
 
42
58
  export { Avatar };
43
59
  //# sourceMappingURL=Avatar.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar.esm.js","sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef, ElementRef } from 'react';\nimport { Avatar as AvatarPrimitive } from '@base-ui-components/react/avatar';\nimport clsx from 'clsx';\nimport { AvatarProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport styles from './Avatar.module.css';\n\n/** @public */\nexport const Avatar = forwardRef<\n ElementRef<typeof AvatarPrimitive.Root>,\n AvatarProps\n>((props, ref) => {\n const { classNames, dataAttributes, cleanedProps } = useStyles('Avatar', {\n size: 'medium',\n ...props,\n });\n\n const { className, src, name, ...rest } = cleanedProps;\n\n return (\n <AvatarPrimitive.Root\n ref={ref}\n className={clsx(classNames.root, styles[classNames.root], className)}\n {...dataAttributes}\n {...rest}\n >\n <AvatarPrimitive.Image\n className={clsx(classNames.image, styles[classNames.image])}\n src={src}\n />\n <AvatarPrimitive.Fallback\n className={clsx(classNames.fallback, styles[classNames.fallback])}\n >\n {(name || '')\n .split(' ')\n .map(word => word[0])\n .join('')\n .toLocaleUpperCase('en-US')\n .slice(0, 2)}\n </AvatarPrimitive.Fallback>\n </AvatarPrimitive.Root>\n );\n});\n\nAvatar.displayName = AvatarPrimitive.Root.displayName;\n"],"names":["AvatarPrimitive"],"mappings":";;;;;;;AAwBO,MAAM,MAAA,GAAS,UAAA,CAGpB,CAAC,KAAA,EAAO,GAAA,KAAQ;AAChB,EAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,YAAA,EAAa,GAAI,UAAU,QAAA,EAAU;AAAA,IACvE,IAAA,EAAM,QAAA;AAAA,IACN,GAAG;AAAA,GACJ,CAAA;AAED,EAAA,MAAM,EAAE,SAAA,EAAW,GAAA,EAAK,IAAA,EAAM,GAAG,MAAK,GAAI,YAAA;AAE1C,EAAA,uBACE,IAAA;AAAA,IAACA,QAAA,CAAgB,IAAA;AAAA,IAAhB;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,IAAA;AAAA,MAEJ,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAACA,QAAA,CAAgB,KAAA;AAAA,UAAhB;AAAA,YACC,WAAW,IAAA,CAAK,UAAA,CAAW,OAAO,MAAA,CAAO,UAAA,CAAW,KAAK,CAAC,CAAA;AAAA,YAC1D;AAAA;AAAA,SACF;AAAA,wBACA,GAAA;AAAA,UAACA,QAAA,CAAgB,QAAA;AAAA,UAAhB;AAAA,YACC,WAAW,IAAA,CAAK,UAAA,CAAW,UAAU,MAAA,CAAO,UAAA,CAAW,QAAQ,CAAC,CAAA;AAAA,YAE9D,mBAAQ,EAAA,EACP,KAAA,CAAM,GAAG,CAAA,CACT,GAAA,CAAI,UAAQ,IAAA,CAAK,CAAC,CAAC,CAAA,CACnB,IAAA,CAAK,EAAE,CAAA,CACP,iBAAA,CAAkB,OAAO,CAAA,CACzB,KAAA,CAAM,GAAG,CAAC;AAAA;AAAA;AACf;AAAA;AAAA,GACF;AAEJ,CAAC;AAED,MAAA,CAAO,WAAA,GAAcA,SAAgB,IAAA,CAAK,WAAA;;;;"}
1
+ {"version":3,"file":"Avatar.esm.js","sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef, useState, useEffect } from 'react';\nimport clsx from 'clsx';\nimport { AvatarProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport styles from './Avatar.module.css';\n\n/** @public */\nexport const Avatar = forwardRef<HTMLDivElement, AvatarProps>((props, ref) => {\n const { classNames, dataAttributes, cleanedProps } = useStyles('Avatar', {\n size: 'medium',\n purpose: 'informative',\n ...props,\n });\n\n const { className, src, name, purpose, ...rest } = cleanedProps;\n\n const [imageStatus, setImageStatus] = useState<\n 'loading' | 'loaded' | 'error'\n >('loading');\n\n useEffect(() => {\n setImageStatus('loading');\n const img = new Image();\n img.onload = () => setImageStatus('loaded');\n img.onerror = () => setImageStatus('error');\n img.src = src;\n\n return () => {\n img.onload = null;\n img.onerror = null;\n };\n }, [src]);\n\n const initialsCount = ['x-small', 'small'].includes(cleanedProps.size)\n ? 1\n : 2;\n\n const initials = name\n .split(' ')\n .map(word => word[0])\n .join('')\n .toLocaleUpperCase('en-US')\n .slice(0, initialsCount);\n\n return (\n <div\n ref={ref}\n role=\"img\"\n aria-label={purpose === 'informative' ? name : undefined}\n aria-hidden={purpose === 'decoration' ? true : undefined}\n className={clsx(classNames.root, styles[classNames.root], className)}\n {...dataAttributes}\n {...rest}\n >\n {imageStatus === 'loaded' ? (\n <img\n src={src}\n alt=\"\"\n className={clsx(classNames.image, styles[classNames.image])}\n />\n ) : (\n <div\n aria-hidden=\"true\"\n className={clsx(classNames.fallback, styles[classNames.fallback])}\n >\n {initials}\n </div>\n )}\n </div>\n );\n});\n\nAvatar.displayName = 'Avatar';\n"],"names":[],"mappings":";;;;;;AAuBO,MAAM,MAAA,GAAS,UAAA,CAAwC,CAAC,KAAA,EAAO,GAAA,KAAQ;AAC5E,EAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,YAAA,EAAa,GAAI,UAAU,QAAA,EAAU;AAAA,IACvE,IAAA,EAAM,QAAA;AAAA,IACN,OAAA,EAAS,aAAA;AAAA,IACT,GAAG;AAAA,GACJ,CAAA;AAED,EAAA,MAAM,EAAE,SAAA,EAAW,GAAA,EAAK,MAAM,OAAA,EAAS,GAAG,MAAK,GAAI,YAAA;AAEnD,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAEpC,SAAS,CAAA;AAEX,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,cAAA,CAAe,SAAS,CAAA;AACxB,IAAA,MAAM,GAAA,GAAM,IAAI,KAAA,EAAM;AACtB,IAAA,GAAA,CAAI,MAAA,GAAS,MAAM,cAAA,CAAe,QAAQ,CAAA;AAC1C,IAAA,GAAA,CAAI,OAAA,GAAU,MAAM,cAAA,CAAe,OAAO,CAAA;AAC1C,IAAA,GAAA,CAAI,GAAA,GAAM,GAAA;AAEV,IAAA,OAAO,MAAM;AACX,MAAA,GAAA,CAAI,MAAA,GAAS,IAAA;AACb,MAAA,GAAA,CAAI,OAAA,GAAU,IAAA;AAAA,IAChB,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,GAAG,CAAC,CAAA;AAER,EAAA,MAAM,aAAA,GAAgB,CAAC,SAAA,EAAW,OAAO,EAAE,QAAA,CAAS,YAAA,CAAa,IAAI,CAAA,GACjE,CAAA,GACA,CAAA;AAEJ,EAAA,MAAM,WAAW,IAAA,CACd,KAAA,CAAM,GAAG,CAAA,CACT,GAAA,CAAI,UAAQ,IAAA,CAAK,CAAC,CAAC,CAAA,CACnB,IAAA,CAAK,EAAE,CAAA,CACP,iBAAA,CAAkB,OAAO,CAAA,CACzB,KAAA,CAAM,GAAG,aAAa,CAAA;AAEzB,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,IAAA,EAAK,KAAA;AAAA,MACL,YAAA,EAAY,OAAA,KAAY,aAAA,GAAgB,IAAA,GAAO,MAAA;AAAA,MAC/C,aAAA,EAAa,OAAA,KAAY,YAAA,GAAe,IAAA,GAAO,MAAA;AAAA,MAC/C,SAAA,EAAW,KAAK,UAAA,CAAW,IAAA,EAAM,OAAO,UAAA,CAAW,IAAI,GAAG,SAAS,CAAA;AAAA,MAClE,GAAG,cAAA;AAAA,MACH,GAAG,IAAA;AAAA,MAEH,0BAAgB,QAAA,mBACf,GAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,GAAA;AAAA,UACA,GAAA,EAAI,EAAA;AAAA,UACJ,WAAW,IAAA,CAAK,UAAA,CAAW,OAAO,MAAA,CAAO,UAAA,CAAW,KAAK,CAAC;AAAA;AAAA,OAC5D,mBAEA,GAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,aAAA,EAAY,MAAA;AAAA,UACZ,WAAW,IAAA,CAAK,UAAA,CAAW,UAAU,MAAA,CAAO,UAAA,CAAW,QAAQ,CAAC,CAAA;AAAA,UAE/D,QAAA,EAAA;AAAA;AAAA;AACH;AAAA,GAEJ;AAEJ,CAAC;AAED,MAAA,CAAO,WAAA,GAAc,QAAA;;;;"}
@@ -1,6 +1,6 @@
1
1
  import styleInject from '../../node_modules_dist/style-inject/dist/style-inject.es.esm.js';
2
2
 
3
- var css_248z = "/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n@layer tokens, base, components, utilities;\n\n@layer components {\n .Avatar-module_bui-AvatarRoot__3BSck {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n vertical-align: middle;\n border-radius: 100%;\n user-select: none;\n font-weight: 500;\n color: var(--bui-fg-primary);\n background-color: var(--bui-bg-surface-2);\n font-size: 1rem;\n line-height: 1;\n overflow: hidden;\n height: 2rem;\n width: 2rem;\n }\n\n .Avatar-module_bui-AvatarRoot__3BSck[data-size='small'] {\n height: 1.5rem;\n width: 1.5rem;\n }\n\n .Avatar-module_bui-AvatarRoot__3BSck[data-size='medium'] {\n height: 2rem;\n width: 2rem;\n }\n\n .Avatar-module_bui-AvatarRoot__3BSck[data-size='large'] {\n height: 3rem;\n width: 3rem;\n }\n\n .Avatar-module_bui-AvatarImage__2ehc- {\n object-fit: cover;\n height: 100%;\n width: 100%;\n }\n\n .Avatar-module_bui-AvatarFallback__3qnqR {\n align-items: center;\n display: flex;\n justify-content: center;\n height: 100%;\n width: 100%;\n font-size: var(--bui-font-size-3);\n font-weight: var(--bui-font-weight-regular);\n box-shadow: inset 0 0 0 1px var(--bui-border);\n border-radius: var(--bui-radius-full);\n }\n}\n";
3
+ var css_248z = "/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n@layer tokens, base, components, utilities;\n\n@layer components {\n .Avatar-module_bui-AvatarRoot__3BSck {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n vertical-align: middle;\n border-radius: 100%;\n user-select: none;\n font-weight: 500;\n color: var(--bui-fg-primary);\n background-color: var(--bui-bg-surface-2);\n font-size: 1rem;\n line-height: 1;\n overflow: hidden;\n height: 2rem;\n width: 2rem;\n }\n\n .Avatar-module_bui-AvatarRoot__3BSck[data-size='x-small'] {\n height: 1.25rem;\n width: 1.25rem;\n }\n\n .Avatar-module_bui-AvatarRoot__3BSck[data-size='small'] {\n height: 1.5rem;\n width: 1.5rem;\n }\n\n .Avatar-module_bui-AvatarRoot__3BSck[data-size='medium'] {\n height: 2rem;\n width: 2rem;\n }\n\n .Avatar-module_bui-AvatarRoot__3BSck[data-size='large'] {\n height: 2.5rem;\n width: 2.5rem;\n }\n\n .Avatar-module_bui-AvatarRoot__3BSck[data-size='x-large'] {\n height: 3rem;\n width: 3rem;\n }\n\n .Avatar-module_bui-AvatarImage__2ehc- {\n object-fit: cover;\n height: 100%;\n width: 100%;\n display: block;\n }\n\n .Avatar-module_bui-AvatarFallback__3qnqR {\n align-items: center;\n display: flex;\n justify-content: center;\n height: 100%;\n width: 100%;\n font-size: var(--bui-font-size-3);\n font-weight: var(--bui-font-weight-regular);\n box-shadow: inset 0 0 0 1px var(--bui-border);\n border-radius: var(--bui-radius-full);\n }\n}\n";
4
4
  var styles = {"bui-AvatarRoot":"Avatar-module_bui-AvatarRoot__3BSck","bui-AvatarImage":"Avatar-module_bui-AvatarImage__2ehc-","bui-AvatarFallback":"Avatar-module_bui-AvatarFallback__3qnqR"};
5
5
  styleInject(css_248z);
6
6
 
@@ -1,7 +1,8 @@
1
- import { jsxs } from 'react/jsx-runtime';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import clsx from 'clsx';
3
3
  import { forwardRef } from 'react';
4
- import { Button as Button$1 } from 'react-aria-components';
4
+ import { Button as Button$1, ProgressBar } from 'react-aria-components';
5
+ import { RiLoader4Line } from '@remixicon/react';
5
6
  import { useStyles } from '../../hooks/useStyles.esm.js';
6
7
  import stylesButton from './Button.module.css.esm.js';
7
8
 
@@ -12,19 +13,37 @@ const Button = forwardRef(
12
13
  variant: "primary",
13
14
  ...props
14
15
  });
15
- const { children, className, iconStart, iconEnd, ...rest } = cleanedProps;
16
- return /* @__PURE__ */ jsxs(
16
+ const { children, className, iconStart, iconEnd, loading, ...rest } = cleanedProps;
17
+ return /* @__PURE__ */ jsx(
17
18
  Button$1,
18
19
  {
19
20
  className: clsx(classNames.root, stylesButton[classNames.root], className),
20
21
  ref,
22
+ isPending: loading,
21
23
  ...dataAttributes,
22
24
  ...rest,
23
- children: [
24
- iconStart,
25
- children,
26
- iconEnd
27
- ]
25
+ children: ({ isPending }) => /* @__PURE__ */ jsxs(Fragment, { children: [
26
+ /* @__PURE__ */ jsxs(
27
+ "span",
28
+ {
29
+ className: clsx(classNames.content, stylesButton[classNames.content]),
30
+ children: [
31
+ iconStart,
32
+ children,
33
+ iconEnd
34
+ ]
35
+ }
36
+ ),
37
+ isPending && /* @__PURE__ */ jsx(
38
+ ProgressBar,
39
+ {
40
+ "aria-label": "Loading",
41
+ isIndeterminate: true,
42
+ className: clsx(classNames.spinner, stylesButton[classNames.spinner]),
43
+ children: /* @__PURE__ */ jsx(RiLoader4Line, { "aria-hidden": "true" })
44
+ }
45
+ )
46
+ ] })
28
47
  }
29
48
  );
30
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Button.esm.js","sources":["../../../src/components/Button/Button.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 clsx from 'clsx';\nimport { forwardRef, Ref } from 'react';\nimport { Button as RAButton } from 'react-aria-components';\nimport type { ButtonProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport styles from './Button.module.css';\n\n/** @public */\nexport const Button = forwardRef(\n (props: ButtonProps, ref: Ref<HTMLButtonElement>) => {\n const { classNames, dataAttributes, cleanedProps } = useStyles('Button', {\n size: 'small',\n variant: 'primary',\n ...props,\n });\n\n const { children, className, iconStart, iconEnd, ...rest } = cleanedProps;\n\n return (\n <RAButton\n className={clsx(classNames.root, styles[classNames.root], className)}\n ref={ref}\n {...dataAttributes}\n {...rest}\n >\n {iconStart}\n {children}\n {iconEnd}\n </RAButton>\n );\n },\n);\n\nButton.displayName = 'Button';\n"],"names":["RAButton","styles"],"mappings":";;;;;;;AAwBO,MAAM,MAAA,GAAS,UAAA;AAAA,EACpB,CAAC,OAAoB,GAAA,KAAgC;AACnD,IAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,YAAA,EAAa,GAAI,UAAU,QAAA,EAAU;AAAA,MACvE,IAAA,EAAM,OAAA;AAAA,MACN,OAAA,EAAS,SAAA;AAAA,MACT,GAAG;AAAA,KACJ,CAAA;AAED,IAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,WAAW,OAAA,EAAS,GAAG,MAAK,GAAI,YAAA;AAE7D,IAAA,uBACE,IAAA;AAAA,MAACA,QAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,KAAK,UAAA,CAAW,IAAA,EAAMC,aAAO,UAAA,CAAW,IAAI,GAAG,SAAS,CAAA;AAAA,QACnE,GAAA;AAAA,QACC,GAAG,cAAA;AAAA,QACH,GAAG,IAAA;AAAA,QAEH,QAAA,EAAA;AAAA,UAAA,SAAA;AAAA,UACA,QAAA;AAAA,UACA;AAAA;AAAA;AAAA,KACH;AAAA,EAEJ;AACF;AAEA,MAAA,CAAO,WAAA,GAAc,QAAA;;;;"}
1
+ {"version":3,"file":"Button.esm.js","sources":["../../../src/components/Button/Button.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 clsx from 'clsx';\nimport { forwardRef, Ref } from 'react';\nimport { Button as RAButton, ProgressBar } from 'react-aria-components';\nimport { RiLoader4Line } from '@remixicon/react';\nimport type { ButtonProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport styles from './Button.module.css';\n\n/** @public */\nexport const Button = forwardRef(\n (props: ButtonProps, ref: Ref<HTMLButtonElement>) => {\n const { classNames, dataAttributes, cleanedProps } = useStyles('Button', {\n size: 'small',\n variant: 'primary',\n ...props,\n });\n\n const { children, className, iconStart, iconEnd, loading, ...rest } =\n cleanedProps;\n\n return (\n <RAButton\n className={clsx(classNames.root, styles[classNames.root], className)}\n ref={ref}\n isPending={loading}\n {...dataAttributes}\n {...rest}\n >\n {({ isPending }) => (\n <>\n <span\n className={clsx(classNames.content, styles[classNames.content])}\n >\n {iconStart}\n {children}\n {iconEnd}\n </span>\n\n {isPending && (\n <ProgressBar\n aria-label=\"Loading\"\n isIndeterminate\n className={clsx(classNames.spinner, styles[classNames.spinner])}\n >\n <RiLoader4Line aria-hidden=\"true\" />\n </ProgressBar>\n )}\n </>\n )}\n </RAButton>\n );\n },\n);\n\nButton.displayName = 'Button';\n"],"names":["RAButton","styles"],"mappings":";;;;;;;;AAyBO,MAAM,MAAA,GAAS,UAAA;AAAA,EACpB,CAAC,OAAoB,GAAA,KAAgC;AACnD,IAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,YAAA,EAAa,GAAI,UAAU,QAAA,EAAU;AAAA,MACvE,IAAA,EAAM,OAAA;AAAA,MACN,OAAA,EAAS,SAAA;AAAA,MACT,GAAG;AAAA,KACJ,CAAA;AAED,IAAA,MAAM,EAAE,UAAU,SAAA,EAAW,SAAA,EAAW,SAAS,OAAA,EAAS,GAAG,MAAK,GAChE,YAAA;AAEF,IAAA,uBACE,GAAA;AAAA,MAACA,QAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,KAAK,UAAA,CAAW,IAAA,EAAMC,aAAO,UAAA,CAAW,IAAI,GAAG,SAAS,CAAA;AAAA,QACnE,GAAA;AAAA,QACA,SAAA,EAAW,OAAA;AAAA,QACV,GAAG,cAAA;AAAA,QACH,GAAG,IAAA;AAAA,QAEH,QAAA,EAAA,CAAC,EAAE,SAAA,EAAU,qBACZ,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,0BAAA,IAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,WAAW,IAAA,CAAK,UAAA,CAAW,SAASA,YAAA,CAAO,UAAA,CAAW,OAAO,CAAC,CAAA;AAAA,cAE7D,QAAA,EAAA;AAAA,gBAAA,SAAA;AAAA,gBACA,QAAA;AAAA,gBACA;AAAA;AAAA;AAAA,WACH;AAAA,UAEC,SAAA,oBACC,GAAA;AAAA,YAAC,WAAA;AAAA,YAAA;AAAA,cACC,YAAA,EAAW,SAAA;AAAA,cACX,eAAA,EAAe,IAAA;AAAA,cACf,WAAW,IAAA,CAAK,UAAA,CAAW,SAASA,YAAA,CAAO,UAAA,CAAW,OAAO,CAAC,CAAA;AAAA,cAE9D,QAAA,kBAAA,GAAA,CAAC,aAAA,EAAA,EAAc,aAAA,EAAY,MAAA,EAAO;AAAA;AAAA;AACpC,SAAA,EAEJ;AAAA;AAAA,KAEJ;AAAA,EAEJ;AACF;AAEA,MAAA,CAAO,WAAA,GAAc,QAAA;;;;"}
@@ -1,7 +1,7 @@
1
1
  import styleInject from '../../node_modules_dist/style-inject/dist/style-inject.es.esm.js';
2
2
 
3
- var css_248z = "/*\n * Copyright 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@layer tokens, base, components, utilities;\n\n@layer components {\n .Button-module_bui-Button__1BvMm {\n border: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n user-select: none;\n font-family: var(--bui-font-regular);\n font-weight: var(--bui-font-weight-bold);\n padding: 0;\n cursor: pointer;\n border-radius: var(--bui-radius-2);\n gap: var(--bui-space-1_5);\n flex-shrink: 0;\n\n &[data-disabled='true'] {\n cursor: not-allowed;\n }\n }\n\n .Button-module_bui-Button__1BvMm[data-variant='primary'] {\n background-color: var(--bui-bg-solid);\n color: var(--bui-fg-solid);\n\n &:hover {\n background-color: var(--bui-bg-solid-hover);\n transition: background-color 150ms ease;\n }\n\n &:active {\n background-color: var(--bui-bg-solid-pressed);\n }\n\n &:focus-visible {\n outline: 2px solid var(--bui-ring);\n outline-offset: 2px;\n }\n\n &[data-disabled='true'] {\n background-color: var(--bui-bg-solid-disabled);\n color: var(--bui-fg-solid-disabled);\n }\n }\n\n .Button-module_bui-Button__1BvMm[data-variant='secondary'] {\n background-color: var(--bui-bg-surface-1);\n box-shadow: inset 0 0 0 1px var(--bui-border);\n color: var(--bui-fg-primary);\n\n &:hover {\n box-shadow: inset 0 0 0 1px var(--bui-border-hover);\n transition: box-shadow 150ms ease;\n }\n\n &:active {\n box-shadow: inset 0 0 0 1px var(--bui-border-pressed);\n }\n\n &:focus-visible {\n outline: none;\n transition: none;\n box-shadow: inset 0 0 0 2px var(--bui-ring);\n }\n\n &[data-disabled='true'] {\n box-shadow: inset 0 0 0 1px var(--bui-border-disabled);\n color: var(--bui-fg-disabled);\n }\n }\n\n .Button-module_bui-Button__1BvMm[data-variant='tertiary'] {\n background-color: transparent;\n color: var(--bui-fg-primary);\n\n &:hover {\n background-color: var(--bui-bg-surface-1);\n transition: background-color 200ms ease;\n }\n\n &:active {\n background-color: var(--bui-bg-surface-2);\n }\n\n &:focus-visible {\n outline: none;\n transition: none;\n box-shadow: inset 0 0 0 2px var(--bui-ring);\n }\n\n &[data-disabled='true'] {\n background-color: transparent;\n color: var(--bui-fg-disabled);\n }\n }\n\n .Button-module_bui-Button__1BvMm[data-size='medium'] {\n font-size: var(--bui-font-size-4);\n padding: 0 var(--bui-space-3);\n height: 2.5rem;\n }\n\n .Button-module_bui-Button__1BvMm[data-size='small'] {\n font-size: var(--bui-font-size-3);\n padding: 0 var(--bui-space-2);\n height: 2rem;\n }\n\n .Button-module_bui-Button__1BvMm[data-size='small'] svg {\n width: 1rem;\n height: 1rem;\n }\n\n .Button-module_bui-Button__1BvMm[data-size='medium'] svg {\n width: 1.25rem;\n height: 1.25rem;\n }\n}\n";
4
- var stylesButton = {"bui-Button":"Button-module_bui-Button__1BvMm"};
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@layer tokens, base, components, utilities;\n\n@layer components {\n .Button-module_bui-Button__1BvMm {\n --loading-duration: 200ms;\n position: relative;\n display: inline-flex;\n border: none;\n user-select: none;\n font-family: var(--bui-font-regular);\n font-weight: var(--bui-font-weight-bold);\n padding: 0;\n cursor: pointer;\n border-radius: var(--bui-radius-2);\n flex-shrink: 0;\n transition: background-color var(--loading-duration) ease-out,\n box-shadow var(--loading-duration) ease-out;\n\n &[data-disabled='true'] {\n cursor: not-allowed;\n }\n\n &[data-loading='true'] {\n cursor: wait;\n }\n }\n\n .Button-module_bui-Button__1BvMm[data-variant='primary'] {\n background-color: var(--bui-bg-solid);\n color: var(--bui-fg-solid);\n\n &:hover {\n background-color: var(--bui-bg-solid-hover);\n transition: background-color 150ms ease;\n }\n\n &:active {\n background-color: var(--bui-bg-solid-pressed);\n }\n\n &:focus-visible {\n outline: 2px solid var(--bui-ring);\n outline-offset: 2px;\n }\n\n &[data-disabled='true'],\n &[data-loading='true'] {\n background-color: var(--bui-bg-solid-disabled);\n color: var(--bui-fg-solid-disabled);\n }\n }\n\n .Button-module_bui-Button__1BvMm[data-variant='secondary'] {\n background-color: var(--bui-bg-surface-1);\n box-shadow: inset 0 0 0 1px var(--bui-border);\n color: var(--bui-fg-primary);\n\n &:hover {\n box-shadow: inset 0 0 0 1px var(--bui-border-hover);\n transition: box-shadow 150ms ease;\n }\n\n &:active {\n box-shadow: inset 0 0 0 1px var(--bui-border-pressed);\n }\n\n &:focus-visible {\n outline: none;\n transition: none;\n box-shadow: inset 0 0 0 2px var(--bui-ring);\n }\n\n &[data-disabled='true'],\n &[data-loading='true'] {\n box-shadow: inset 0 0 0 1px var(--bui-border-disabled);\n color: var(--bui-fg-disabled);\n }\n }\n\n .Button-module_bui-Button__1BvMm[data-variant='tertiary'] {\n background-color: transparent;\n color: var(--bui-fg-primary);\n\n &:hover {\n background-color: var(--bui-bg-surface-1);\n transition: background-color 200ms ease;\n }\n\n &:active {\n background-color: var(--bui-bg-surface-2);\n }\n\n &:focus-visible {\n outline: none;\n transition: none;\n box-shadow: inset 0 0 0 2px var(--bui-ring);\n }\n\n &[data-disabled='true'],\n &[data-loading='true'] {\n background-color: transparent;\n color: var(--bui-fg-disabled);\n }\n }\n\n .Button-module_bui-Button__1BvMm[data-size='small'] {\n font-size: var(--bui-font-size-3);\n padding: 0 var(--bui-space-2);\n height: 2rem;\n\n svg {\n width: 1rem;\n height: 1rem;\n }\n }\n\n .Button-module_bui-Button__1BvMm[data-size='medium'] {\n font-size: var(--bui-font-size-4);\n padding: 0 var(--bui-space-3);\n height: 2.5rem;\n\n svg {\n width: 1.25rem;\n height: 1.25rem;\n }\n }\n\n .Button-module_bui-ButtonContent__2x-bP {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: var(--bui-space-1_5);\n height: 100%;\n width: 100%;\n transition: opacity var(--loading-duration) ease-out;\n\n .Button-module_bui-Button__1BvMm[data-loading='true'] & {\n opacity: 0;\n }\n }\n\n .Button-module_bui-ButtonSpinner__1MWbK {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n display: flex;\n opacity: 0;\n transition: opacity var(--loading-duration) ease-in;\n\n .Button-module_bui-Button__1BvMm[data-loading='true'] & {\n opacity: 1;\n }\n\n & svg {\n animation: Button-module_bui-spin__yALtH 1s linear infinite;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .Button-module_bui-Button__1BvMm {\n transition-duration: 50ms;\n }\n\n .Button-module_bui-ButtonContent__2x-bP {\n transition-duration: 50ms;\n }\n\n .Button-module_bui-ButtonSpinner__1MWbK {\n transition-duration: 50ms;\n }\n\n .Button-module_bui-ButtonSpinner__1MWbK svg {\n animation: none;\n }\n }\n\n @keyframes Button-module_bui-spin__yALtH {\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n }\n}\n";
4
+ var stylesButton = {"bui-Button":"Button-module_bui-Button__1BvMm","bui-ButtonContent":"Button-module_bui-ButtonContent__2x-bP","bui-ButtonSpinner":"Button-module_bui-ButtonSpinner__1MWbK","bui-spin":"Button-module_bui-spin__yALtH"};
5
5
  styleInject(css_248z);
6
6
 
7
7
  export { stylesButton as default };
@@ -1,7 +1,8 @@
1
- import { jsx } from 'react/jsx-runtime';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import clsx from 'clsx';
3
3
  import { forwardRef } from 'react';
4
- import { Button } from 'react-aria-components';
4
+ import { Button, ProgressBar } from 'react-aria-components';
5
+ import { RiLoader4Line } from '@remixicon/react';
5
6
  import { useStyles } from '../../hooks/useStyles.esm.js';
6
7
  import stylesButtonIcon from './ButtonIcon.module.css.esm.js';
7
8
  import stylesButton from '../Button/Button.module.css.esm.js';
@@ -14,7 +15,7 @@ const ButtonIcon = forwardRef(
14
15
  ...props
15
16
  });
16
17
  const { classNames: classNamesButtonIcon } = useStyles("ButtonIcon");
17
- const { className, icon, ...rest } = cleanedProps;
18
+ const { className, icon, loading, ...rest } = cleanedProps;
18
19
  return /* @__PURE__ */ jsx(
19
20
  Button,
20
21
  {
@@ -26,9 +27,39 @@ const ButtonIcon = forwardRef(
26
27
  className
27
28
  ),
28
29
  ref,
30
+ isPending: loading,
29
31
  ...dataAttributes,
30
32
  ...rest,
31
- children: icon
33
+ children: ({ isPending }) => /* @__PURE__ */ jsxs(Fragment, { children: [
34
+ /* @__PURE__ */ jsx(
35
+ "span",
36
+ {
37
+ className: clsx(
38
+ classNames.content,
39
+ classNamesButtonIcon.content,
40
+ stylesButton[classNames.content],
41
+ stylesButtonIcon[classNamesButtonIcon.content],
42
+ className
43
+ ),
44
+ children: icon
45
+ }
46
+ ),
47
+ isPending && /* @__PURE__ */ jsx(
48
+ ProgressBar,
49
+ {
50
+ "aria-label": "Loading",
51
+ isIndeterminate: true,
52
+ className: clsx(
53
+ classNames.spinner,
54
+ classNamesButtonIcon.spinner,
55
+ stylesButton[classNames.spinner],
56
+ stylesButtonIcon[classNamesButtonIcon.spinner],
57
+ className
58
+ ),
59
+ children: /* @__PURE__ */ jsx(RiLoader4Line, { "aria-hidden": "true" })
60
+ }
61
+ )
62
+ ] })
32
63
  }
33
64
  );
34
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonIcon.esm.js","sources":["../../../src/components/ButtonIcon/ButtonIcon.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 clsx from 'clsx';\nimport { forwardRef, Ref } from 'react';\nimport { Button as RAButton } from 'react-aria-components';\nimport type { ButtonIconProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport stylesButtonIcon from './ButtonIcon.module.css';\nimport stylesButton from '../Button/Button.module.css';\n\n/** @public */\nexport const ButtonIcon = forwardRef(\n (props: ButtonIconProps, ref: Ref<HTMLButtonElement>) => {\n const { classNames, dataAttributes, cleanedProps } = useStyles('Button', {\n size: 'small',\n variant: 'primary',\n ...props,\n });\n\n const { classNames: classNamesButtonIcon } = useStyles('ButtonIcon');\n\n const { className, icon, ...rest } = cleanedProps;\n\n return (\n <RAButton\n className={clsx(\n classNames.root,\n classNamesButtonIcon.root,\n stylesButton[classNames.root],\n stylesButtonIcon[classNamesButtonIcon.root],\n className,\n )}\n ref={ref}\n {...dataAttributes}\n {...rest}\n >\n {icon}\n </RAButton>\n );\n },\n);\n\nButtonIcon.displayName = 'ButtonIcon';\n"],"names":["RAButton"],"mappings":";;;;;;;;AAyBO,MAAM,UAAA,GAAa,UAAA;AAAA,EACxB,CAAC,OAAwB,GAAA,KAAgC;AACvD,IAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,YAAA,EAAa,GAAI,UAAU,QAAA,EAAU;AAAA,MACvE,IAAA,EAAM,OAAA;AAAA,MACN,OAAA,EAAS,SAAA;AAAA,MACT,GAAG;AAAA,KACJ,CAAA;AAED,IAAA,MAAM,EAAE,UAAA,EAAY,oBAAA,EAAqB,GAAI,UAAU,YAAY,CAAA;AAEnE,IAAA,MAAM,EAAE,SAAA,EAAW,IAAA,EAAM,GAAG,MAAK,GAAI,YAAA;AAErC,IAAA,uBACE,GAAA;AAAA,MAACA,MAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,IAAA;AAAA,UACT,UAAA,CAAW,IAAA;AAAA,UACX,oBAAA,CAAqB,IAAA;AAAA,UACrB,YAAA,CAAa,WAAW,IAAI,CAAA;AAAA,UAC5B,gBAAA,CAAiB,qBAAqB,IAAI,CAAA;AAAA,UAC1C;AAAA,SACF;AAAA,QACA,GAAA;AAAA,QACC,GAAG,cAAA;AAAA,QACH,GAAG,IAAA;AAAA,QAEH,QAAA,EAAA;AAAA;AAAA,KACH;AAAA,EAEJ;AACF;AAEA,UAAA,CAAW,WAAA,GAAc,YAAA;;;;"}
1
+ {"version":3,"file":"ButtonIcon.esm.js","sources":["../../../src/components/ButtonIcon/ButtonIcon.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 clsx from 'clsx';\nimport { forwardRef, Ref } from 'react';\nimport { Button as RAButton, ProgressBar } from 'react-aria-components';\nimport { RiLoader4Line } from '@remixicon/react';\nimport type { ButtonIconProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport stylesButtonIcon from './ButtonIcon.module.css';\nimport stylesButton from '../Button/Button.module.css';\n\n/** @public */\nexport const ButtonIcon = forwardRef(\n (props: ButtonIconProps, ref: Ref<HTMLButtonElement>) => {\n const { classNames, dataAttributes, cleanedProps } = useStyles('Button', {\n size: 'small',\n variant: 'primary',\n ...props,\n });\n\n const { classNames: classNamesButtonIcon } = useStyles('ButtonIcon');\n\n const { className, icon, loading, ...rest } = cleanedProps;\n\n return (\n <RAButton\n className={clsx(\n classNames.root,\n classNamesButtonIcon.root,\n stylesButton[classNames.root],\n stylesButtonIcon[classNamesButtonIcon.root],\n className,\n )}\n ref={ref}\n isPending={loading}\n {...dataAttributes}\n {...rest}\n >\n {({ isPending }) => (\n <>\n <span\n className={clsx(\n classNames.content,\n classNamesButtonIcon.content,\n stylesButton[classNames.content],\n stylesButtonIcon[classNamesButtonIcon.content],\n className,\n )}\n >\n {icon}\n </span>\n\n {isPending && (\n <ProgressBar\n aria-label=\"Loading\"\n isIndeterminate\n className={clsx(\n classNames.spinner,\n classNamesButtonIcon.spinner,\n stylesButton[classNames.spinner],\n stylesButtonIcon[classNamesButtonIcon.spinner],\n className,\n )}\n >\n <RiLoader4Line aria-hidden=\"true\" />\n </ProgressBar>\n )}\n </>\n )}\n </RAButton>\n );\n },\n);\n\nButtonIcon.displayName = 'ButtonIcon';\n"],"names":["RAButton"],"mappings":";;;;;;;;;AA0BO,MAAM,UAAA,GAAa,UAAA;AAAA,EACxB,CAAC,OAAwB,GAAA,KAAgC;AACvD,IAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,YAAA,EAAa,GAAI,UAAU,QAAA,EAAU;AAAA,MACvE,IAAA,EAAM,OAAA;AAAA,MACN,OAAA,EAAS,SAAA;AAAA,MACT,GAAG;AAAA,KACJ,CAAA;AAED,IAAA,MAAM,EAAE,UAAA,EAAY,oBAAA,EAAqB,GAAI,UAAU,YAAY,CAAA;AAEnE,IAAA,MAAM,EAAE,SAAA,EAAW,IAAA,EAAM,OAAA,EAAS,GAAG,MAAK,GAAI,YAAA;AAE9C,IAAA,uBACE,GAAA;AAAA,MAACA,MAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,IAAA;AAAA,UACT,UAAA,CAAW,IAAA;AAAA,UACX,oBAAA,CAAqB,IAAA;AAAA,UACrB,YAAA,CAAa,WAAW,IAAI,CAAA;AAAA,UAC5B,gBAAA,CAAiB,qBAAqB,IAAI,CAAA;AAAA,UAC1C;AAAA,SACF;AAAA,QACA,GAAA;AAAA,QACA,SAAA,EAAW,OAAA;AAAA,QACV,GAAG,cAAA;AAAA,QACH,GAAG,IAAA;AAAA,QAEH,QAAA,EAAA,CAAC,EAAE,SAAA,EAAU,qBACZ,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,SAAA,EAAW,IAAA;AAAA,gBACT,UAAA,CAAW,OAAA;AAAA,gBACX,oBAAA,CAAqB,OAAA;AAAA,gBACrB,YAAA,CAAa,WAAW,OAAO,CAAA;AAAA,gBAC/B,gBAAA,CAAiB,qBAAqB,OAAO,CAAA;AAAA,gBAC7C;AAAA,eACF;AAAA,cAEC,QAAA,EAAA;AAAA;AAAA,WACH;AAAA,UAEC,SAAA,oBACC,GAAA;AAAA,YAAC,WAAA;AAAA,YAAA;AAAA,cACC,YAAA,EAAW,SAAA;AAAA,cACX,eAAA,EAAe,IAAA;AAAA,cACf,SAAA,EAAW,IAAA;AAAA,gBACT,UAAA,CAAW,OAAA;AAAA,gBACX,oBAAA,CAAqB,OAAA;AAAA,gBACrB,YAAA,CAAa,WAAW,OAAO,CAAA;AAAA,gBAC/B,gBAAA,CAAiB,qBAAqB,OAAO,CAAA;AAAA,gBAC7C;AAAA,eACF;AAAA,cAEA,QAAA,kBAAA,GAAA,CAAC,aAAA,EAAA,EAAc,aAAA,EAAY,MAAA,EAAO;AAAA;AAAA;AACpC,SAAA,EAEJ;AAAA;AAAA,KAEJ;AAAA,EAEJ;AACF;AAEA,UAAA,CAAW,WAAA,GAAc,YAAA;;;;"}
@@ -1,4 +1,4 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import clsx from 'clsx';
3
3
  import { forwardRef } from 'react';
4
4
  import { Link, RouterProvider } from 'react-aria-components';
@@ -18,29 +18,7 @@ const ButtonLink = forwardRef(
18
18
  const { classNames: classNamesButtonLink } = useStyles("ButtonLink");
19
19
  const { children, className, iconStart, iconEnd, href, ...rest } = cleanedProps;
20
20
  const isExternal = isExternalLink(href);
21
- if (isExternal) {
22
- return /* @__PURE__ */ jsxs(
23
- Link,
24
- {
25
- className: clsx(
26
- classNames.root,
27
- classNamesButtonLink.root,
28
- stylesButton[classNames.root],
29
- className
30
- ),
31
- ref,
32
- ...dataAttributes,
33
- href,
34
- ...rest,
35
- children: [
36
- iconStart,
37
- children,
38
- iconEnd
39
- ]
40
- }
41
- );
42
- }
43
- return /* @__PURE__ */ jsx(RouterProvider, { navigate, useHref, children: /* @__PURE__ */ jsxs(
21
+ const linkButton = /* @__PURE__ */ jsx(
44
22
  Link,
45
23
  {
46
24
  className: clsx(
@@ -53,13 +31,23 @@ const ButtonLink = forwardRef(
53
31
  ...dataAttributes,
54
32
  href,
55
33
  ...rest,
56
- children: [
57
- iconStart,
58
- children,
59
- iconEnd
60
- ]
34
+ children: /* @__PURE__ */ jsxs(
35
+ "span",
36
+ {
37
+ className: clsx(classNames.content, stylesButton[classNames.content]),
38
+ children: [
39
+ iconStart,
40
+ children,
41
+ iconEnd
42
+ ]
43
+ }
44
+ )
61
45
  }
62
- ) });
46
+ );
47
+ if (isExternal) {
48
+ return linkButton;
49
+ }
50
+ return /* @__PURE__ */ jsx(RouterProvider, { navigate, useHref, children: linkButton });
63
51
  }
64
52
  );
65
53
  ButtonLink.displayName = "ButtonLink";