@backstage/ui 0.9.0-next.3 → 0.9.1-next.0
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.
- package/CHANGELOG.md +187 -0
- package/README.md +23 -0
- package/dist/components/Accordion/Accordion.esm.js +5 -4
- package/dist/components/Accordion/Accordion.esm.js.map +1 -1
- package/dist/components/Accordion/definition.esm.js +15 -0
- package/dist/components/Accordion/definition.esm.js.map +1 -0
- package/dist/components/Avatar/Avatar.esm.js +9 -5
- package/dist/components/Avatar/Avatar.esm.js.map +1 -1
- package/dist/components/Avatar/definition.esm.js +13 -0
- package/dist/components/Avatar/definition.esm.js.map +1 -0
- package/dist/components/Box/Box.esm.js +2 -1
- package/dist/components/Box/Box.esm.js.map +1 -1
- package/dist/components/Box/definition.esm.js +32 -0
- package/dist/components/Box/definition.esm.js.map +1 -0
- package/dist/components/Button/Button.esm.js +9 -5
- package/dist/components/Button/Button.esm.js.map +1 -1
- package/dist/components/Button/definition.esm.js +15 -0
- package/dist/components/Button/definition.esm.js.map +1 -0
- package/dist/components/ButtonIcon/ButtonIcon.esm.js +11 -6
- package/dist/components/ButtonIcon/ButtonIcon.esm.js.map +1 -1
- package/dist/components/ButtonIcon/definition.esm.js +10 -0
- package/dist/components/ButtonIcon/definition.esm.js.map +1 -0
- package/dist/components/ButtonLink/ButtonLink.esm.js +11 -6
- package/dist/components/ButtonLink/ButtonLink.esm.js.map +1 -1
- package/dist/components/ButtonLink/definition.esm.js +8 -0
- package/dist/components/ButtonLink/definition.esm.js.map +1 -0
- package/dist/components/Card/Card.esm.js +5 -4
- package/dist/components/Card/Card.esm.js.map +1 -1
- package/dist/components/Card/definition.esm.js +11 -0
- package/dist/components/Card/definition.esm.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.esm.js +2 -1
- package/dist/components/Checkbox/Checkbox.esm.js.map +1 -1
- package/dist/components/Checkbox/definition.esm.js +12 -0
- package/dist/components/Checkbox/definition.esm.js.map +1 -0
- package/dist/components/Container/Container.esm.js +2 -1
- package/dist/components/Container/Container.esm.js.map +1 -1
- package/dist/components/Container/definition.esm.js +9 -0
- package/dist/components/Container/definition.esm.js.map +1 -0
- package/dist/components/Dialog/Dialog.esm.js +5 -4
- package/dist/components/Dialog/Dialog.esm.js.map +1 -1
- package/dist/components/Dialog/definition.esm.js +13 -0
- package/dist/components/Dialog/definition.esm.js.map +1 -0
- package/dist/components/FieldError/FieldError.esm.js +2 -1
- package/dist/components/FieldError/FieldError.esm.js.map +1 -1
- package/dist/components/FieldError/definition.esm.js +8 -0
- package/dist/components/FieldError/definition.esm.js.map +1 -0
- package/dist/components/FieldLabel/FieldLabel.esm.js +2 -1
- package/dist/components/FieldLabel/FieldLabel.esm.js.map +1 -1
- package/dist/components/FieldLabel/definition.esm.js +11 -0
- package/dist/components/FieldLabel/definition.esm.js.map +1 -0
- package/dist/components/Flex/Flex.esm.js +2 -1
- package/dist/components/Flex/Flex.esm.js.map +1 -1
- package/dist/components/Flex/definition.esm.js +28 -0
- package/dist/components/Flex/definition.esm.js.map +1 -0
- package/dist/components/Grid/Grid.esm.js +3 -2
- package/dist/components/Grid/Grid.esm.js.map +1 -1
- package/dist/components/Grid/definition.esm.js +32 -0
- package/dist/components/Grid/definition.esm.js.map +1 -0
- package/dist/components/Header/Header.esm.js +2 -1
- package/dist/components/Header/Header.esm.js.map +1 -1
- package/dist/components/Header/HeaderToolbar.esm.js +2 -1
- package/dist/components/Header/HeaderToolbar.esm.js.map +1 -1
- package/dist/components/Header/definition.esm.js +14 -0
- package/dist/components/Header/definition.esm.js.map +1 -0
- package/dist/components/HeaderPage/HeaderPage.esm.js +2 -1
- package/dist/components/HeaderPage/HeaderPage.esm.js.map +1 -1
- package/dist/components/HeaderPage/definition.esm.js +12 -0
- package/dist/components/HeaderPage/definition.esm.js.map +1 -0
- package/dist/components/Link/Link.esm.js +10 -6
- package/dist/components/Link/Link.esm.js.map +1 -1
- package/dist/components/Link/definition.esm.js +14 -0
- package/dist/components/Link/definition.esm.js.map +1 -0
- package/dist/components/Menu/Menu.esm.js +10 -9
- package/dist/components/Menu/Menu.esm.js.map +1 -1
- package/dist/components/Menu/definition.esm.js +23 -0
- package/dist/components/Menu/definition.esm.js.map +1 -0
- package/dist/components/Popover/definition.esm.js +8 -0
- package/dist/components/Popover/definition.esm.js.map +1 -0
- package/dist/components/RadioGroup/RadioGroup.esm.js +3 -2
- package/dist/components/RadioGroup/RadioGroup.esm.js.map +1 -1
- package/dist/components/RadioGroup/definition.esm.js +10 -0
- package/dist/components/RadioGroup/definition.esm.js.map +1 -0
- package/dist/components/SearchField/SearchField.esm.js +2 -1
- package/dist/components/SearchField/SearchField.esm.js.map +1 -1
- package/dist/components/SearchField/definition.esm.js +16 -0
- package/dist/components/SearchField/definition.esm.js.map +1 -0
- package/dist/components/Select/Select.esm.js +11 -6
- package/dist/components/Select/Select.esm.js.map +1 -1
- package/dist/components/Select/SelectContent.esm.js +2 -1
- package/dist/components/Select/SelectContent.esm.js.map +1 -1
- package/dist/components/Select/SelectListBox.esm.js +3 -2
- package/dist/components/Select/SelectListBox.esm.js.map +1 -1
- package/dist/components/Select/SelectTrigger.esm.js +2 -1
- package/dist/components/Select/SelectTrigger.esm.js.map +1 -1
- package/dist/components/Select/definition.esm.js +23 -0
- package/dist/components/Select/definition.esm.js.map +1 -0
- package/dist/components/Skeleton/Skeleton.esm.js +2 -1
- package/dist/components/Skeleton/Skeleton.esm.js.map +1 -1
- package/dist/components/Skeleton/definition.esm.js +8 -0
- package/dist/components/Skeleton/definition.esm.js.map +1 -0
- package/dist/components/Switch/Switch.esm.js +2 -1
- package/dist/components/Switch/Switch.esm.js.map +1 -1
- package/dist/components/Switch/definition.esm.js +9 -0
- package/dist/components/Switch/definition.esm.js.map +1 -0
- package/dist/components/Table/components/Cell.esm.js +2 -1
- package/dist/components/Table/components/Cell.esm.js.map +1 -1
- package/dist/components/Table/components/CellProfile.esm.js +5 -7
- package/dist/components/Table/components/CellProfile.esm.js.map +1 -1
- package/dist/components/Table/components/Column.esm.js +4 -6
- package/dist/components/Table/components/Column.esm.js.map +1 -1
- package/dist/components/Table/components/Row.esm.js +3 -5
- package/dist/components/Table/components/Row.esm.js.map +1 -1
- package/dist/components/Table/components/Table.esm.js +2 -4
- package/dist/components/Table/components/Table.esm.js.map +1 -1
- package/dist/components/Table/components/TableBody.esm.js +2 -4
- package/dist/components/Table/components/TableBody.esm.js.map +1 -1
- package/dist/components/Table/components/TableHeader.esm.js +2 -4
- package/dist/components/Table/components/TableHeader.esm.js.map +1 -1
- package/dist/components/Table/definition.esm.js +24 -0
- package/dist/components/Table/definition.esm.js.map +1 -0
- package/dist/components/Table/hooks/useTable.esm.js +1 -1
- package/dist/components/Table/hooks/useTable.esm.js.map +1 -1
- package/dist/components/TablePagination/TablePagination.esm.js +2 -1
- package/dist/components/TablePagination/TablePagination.esm.js.map +1 -1
- package/dist/components/TablePagination/definition.esm.js +11 -0
- package/dist/components/TablePagination/definition.esm.js.map +1 -0
- package/dist/components/Tabs/Tabs.esm.js +5 -4
- package/dist/components/Tabs/Tabs.esm.js.map +1 -1
- package/dist/components/Tabs/TabsIndicators.esm.js +2 -1
- package/dist/components/Tabs/TabsIndicators.esm.js.map +1 -1
- package/dist/components/Tabs/definition.esm.js +14 -0
- package/dist/components/Tabs/definition.esm.js.map +1 -0
- package/dist/components/TagGroup/TagGroup.esm.js +3 -2
- package/dist/components/TagGroup/TagGroup.esm.js.map +1 -1
- package/dist/components/TagGroup/definition.esm.js +12 -0
- package/dist/components/TagGroup/definition.esm.js.map +1 -0
- package/dist/components/Text/Text.esm.js +10 -6
- package/dist/components/Text/Text.esm.js.map +1 -1
- package/dist/components/Text/definition.esm.js +14 -0
- package/dist/components/Text/definition.esm.js.map +1 -0
- package/dist/components/TextField/TextField.esm.js +2 -1
- package/dist/components/TextField/TextField.esm.js.map +1 -1
- package/dist/components/TextField/definition.esm.js +17 -0
- package/dist/components/TextField/definition.esm.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.esm.js +2 -1
- package/dist/components/Tooltip/Tooltip.esm.js.map +1 -1
- package/dist/components/Tooltip/definition.esm.js +9 -0
- package/dist/components/Tooltip/definition.esm.js.map +1 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.esm.js +5 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.esm.js.map +1 -1
- package/dist/components/VisuallyHidden/definition.esm.js +8 -0
- package/dist/components/VisuallyHidden/definition.esm.js.map +1 -0
- package/dist/hooks/useStyles.esm.js +1 -3
- package/dist/hooks/useStyles.esm.js.map +1 -1
- package/dist/index.d.ts +455 -362
- package/dist/index.esm.js +30 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/dist/utils/componentDefinitions.esm.js +0 -406
- package/dist/utils/componentDefinitions.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,192 @@
|
|
|
1
1
|
# @backstage/ui
|
|
2
2
|
|
|
3
|
+
## 0.9.1-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b3ad928: Fixed Table Row component to correctly handle cases where no `href` is provided, preventing unnecessary router provider wrapping and fixing the cursor incorrectly showing as a pointer despite the element not being a link.
|
|
8
|
+
|
|
9
|
+
Affected components: Row
|
|
10
|
+
|
|
11
|
+
- fe7c751: Fixed `useTable` hook to prioritize `providedRowCount` over data length for accurate row count in server-side pagination scenarios.
|
|
12
|
+
- c145031: Fixed Table column sorting indicator to show up arrow when no sort is active, correctly indicating that clicking will sort ascending.
|
|
13
|
+
|
|
14
|
+
Affected components: Column
|
|
15
|
+
|
|
16
|
+
## 0.9.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 539cf26: **BREAKING**: Migrated Avatar component from Base UI to custom implementation with size changes:
|
|
21
|
+
|
|
22
|
+
- Base UI-specific props are no longer supported
|
|
23
|
+
- Size values have been updated:
|
|
24
|
+
- New `x-small` size added (1.25rem / 20px)
|
|
25
|
+
- `small` size unchanged (1.5rem / 24px)
|
|
26
|
+
- `medium` size unchanged (2rem / 32px, default)
|
|
27
|
+
- `large` size **changed from 3rem to 2.5rem** (40px)
|
|
28
|
+
- New `x-large` size added (3rem / 48px)
|
|
29
|
+
|
|
30
|
+
Migration:
|
|
31
|
+
|
|
32
|
+
```diff
|
|
33
|
+
# Remove Base UI-specific props
|
|
34
|
+
- <Avatar src="..." name="..." render={...} />
|
|
35
|
+
+ <Avatar src="..." name="..." />
|
|
36
|
+
|
|
37
|
+
# Update large size usage to x-large for same visual size
|
|
38
|
+
- <Avatar src="..." name="..." size="large" />
|
|
39
|
+
+ <Avatar src="..." name="..." size="x-large" />
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Added `purpose` prop for accessibility control (`'informative'` or `'decoration'`).
|
|
43
|
+
|
|
44
|
+
- 5c614ff: **BREAKING**: Migrated Checkbox component from Base UI to React Aria Components.
|
|
45
|
+
|
|
46
|
+
API changes required:
|
|
47
|
+
|
|
48
|
+
- `checked` → `isSelected`
|
|
49
|
+
- `defaultChecked` → `defaultSelected`
|
|
50
|
+
- `disabled` → `isDisabled`
|
|
51
|
+
- `required` → `isRequired`
|
|
52
|
+
- `label` prop removed - use `children` instead
|
|
53
|
+
- CSS: `bui-CheckboxLabel` class removed
|
|
54
|
+
- Data attribute: `data-checked` → `data-selected`
|
|
55
|
+
- Use without label is no longer supported
|
|
56
|
+
|
|
57
|
+
Migration examples:
|
|
58
|
+
|
|
59
|
+
Before:
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
<Checkbox label="Accept terms" checked={agreed} onChange={setAgreed} />
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
After:
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
<Checkbox isSelected={agreed} onChange={setAgreed}>
|
|
69
|
+
Accept terms
|
|
70
|
+
</Checkbox>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Before:
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
<Checkbox label="Option" disabled />
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
After:
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
<Checkbox isDisabled>Option</Checkbox>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Before:
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
<Checkbox />
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
After:
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
<Checkbox>
|
|
95
|
+
<VisuallyHidden>Accessible label</VisuallyHidden>
|
|
96
|
+
</Checkbox>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
- 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.
|
|
100
|
+
- a67670d: **BREAKING**: Removed central `componentDefinitions` object and related type utilities (`ComponentDefinitionName`, `ComponentClassNames`).
|
|
101
|
+
|
|
102
|
+
Component definitions are primarily intended for documenting the CSS class API for theming purposes, not for programmatic use in JavaScript/TypeScript.
|
|
103
|
+
|
|
104
|
+
**Migration Guide:**
|
|
105
|
+
|
|
106
|
+
If you were using component definitions or class names to build custom components, we recommend migrating to either:
|
|
107
|
+
|
|
108
|
+
- Use Backstage UI components directly as building blocks, or
|
|
109
|
+
- Duplicate the component CSS in your own stylesheets instead of relying on internal class names
|
|
110
|
+
|
|
111
|
+
- b78fc45: **BREAKING**: Changed className prop behavior to augment default styles instead of being ignored or overriding them.
|
|
112
|
+
|
|
113
|
+
Affected components:
|
|
114
|
+
|
|
115
|
+
- Menu, MenuListBox, MenuAutocomplete, MenuAutocompleteListbox, MenuItem, MenuListBoxItem, MenuSection, MenuSeparator
|
|
116
|
+
- Switch
|
|
117
|
+
- Skeleton
|
|
118
|
+
- FieldLabel
|
|
119
|
+
- Header, HeaderToolbar
|
|
120
|
+
- HeaderPage
|
|
121
|
+
- Tabs, TabList, Tab, TabPanel
|
|
122
|
+
|
|
123
|
+
If you were passing custom className values to any of these components that relied on the previous behavior, you may need to adjust your styles to account for the default classes now being applied alongside your custom classes.
|
|
124
|
+
|
|
125
|
+
- 83c100e: **BREAKING**: Removed `Collapsible` component. Migrate to `Accordion` or use React Aria `Disclosure`.
|
|
126
|
+
|
|
127
|
+
## Migration Path 1: Accordion (Opinionated Styled Component)
|
|
128
|
+
|
|
129
|
+
Accordion provides preset styling with a similar component structure.
|
|
130
|
+
|
|
131
|
+
```diff
|
|
132
|
+
- import { Collapsible } from '@backstage/ui';
|
|
133
|
+
+ import { Accordion, AccordionTrigger, AccordionPanel } from '@backstage/ui';
|
|
134
|
+
|
|
135
|
+
- <Collapsible.Root>
|
|
136
|
+
- <Collapsible.Trigger render={(props) => <Button {...props}>Toggle</Button>} />
|
|
137
|
+
- <Collapsible.Panel>Content</Collapsible.Panel>
|
|
138
|
+
- </Collapsible.Root>
|
|
139
|
+
|
|
140
|
+
+ <Accordion>
|
|
141
|
+
+ <AccordionTrigger title="Toggle" />
|
|
142
|
+
+ <AccordionPanel>Content</AccordionPanel>
|
|
143
|
+
+ </Accordion>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
CSS classes: `.bui-CollapsibleRoot` → `.bui-Accordion`, `.bui-CollapsibleTrigger` → `.bui-AccordionTrigger` (now on heading element), `.bui-CollapsiblePanel` → `.bui-AccordionPanel`
|
|
147
|
+
|
|
148
|
+
## Migration Path 2: React Aria Disclosure (Full Customization)
|
|
149
|
+
|
|
150
|
+
For custom styling without preset styles:
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
import { Disclosure, Button, DisclosurePanel } from 'react-aria-components';
|
|
154
|
+
|
|
155
|
+
<Disclosure>
|
|
156
|
+
<Button slot="trigger">Toggle</Button>
|
|
157
|
+
<DisclosurePanel>Content</DisclosurePanel>
|
|
158
|
+
</Disclosure>;
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
- 816af0f: **BREAKING**: The `SelectProps` interface now accepts a generic type parameter for selection mode.
|
|
162
|
+
|
|
163
|
+
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.
|
|
164
|
+
|
|
165
|
+
Migration: If you're using `SelectProps` type directly, update from `SelectProps` to `SelectProps<'single' | 'multiple'>`. Component usage remains backward compatible.
|
|
166
|
+
|
|
167
|
+
### Patch Changes
|
|
168
|
+
|
|
169
|
+
- d01de00: Fix broken external links in Backstage UI Header component.
|
|
170
|
+
- 35a3614: Fixed CSS issues in Select component including popover width constraints, focus outline behavior, and overflow handling.
|
|
171
|
+
- 01476f0: Improved visual consistency of PasswordField, SearchField, and MenuAutocomplete components.
|
|
172
|
+
- 26c6a78: Fix default text color in Backstage UI
|
|
173
|
+
- deaa427: Fixed Text component to prevent `truncate` prop from being spread to the underlying DOM element.
|
|
174
|
+
- 1059f95: Improved the Link component structure in Backstage UI.
|
|
175
|
+
- 836b0c7: Fixed dialog backdrop appearance in dark mode.
|
|
176
|
+
- 6874094: Migrated CellProfile component from Base UI Avatar to Backstage UI Avatar component.
|
|
177
|
+
- 719d772: Avatar components in x-small and small sizes now display only one initial instead of two, improving readability at smaller dimensions.
|
|
178
|
+
- 6d35a6b: Removed `@base-ui-components/react` dependency as all components now use React Aria Components.
|
|
179
|
+
- dac851f: Fix the default font size in Backstage UI.
|
|
180
|
+
- 3c0ea67: Fix CSS layer ordering in Backstage UI to make sure component styles are loaded after tokens and base declarations.
|
|
181
|
+
- 3b18d80: Fixed RadioGroup radio button ellipse distortion by preventing flex shrink and grow.
|
|
182
|
+
- 4eb455c: Fix font smoothing as default in Backstage UI.
|
|
183
|
+
- ff9f0c3: Enable tree-shaking of imports other than `*.css`.
|
|
184
|
+
- 7839e7b: Added `loading` prop to Button and ButtonIcon components for displaying spinner during async operations.
|
|
185
|
+
- a00fb88: Fixed Table Row component to properly support opening links in new tabs via right-click or Cmd+Click when using the `href` prop.
|
|
186
|
+
- e16ece5: Set the color-scheme property depending on theme
|
|
187
|
+
- 1ef3ca4: Added new VisuallyHidden component for hiding content visually while keeping it accessible to screen readers.
|
|
188
|
+
- 00bfb83: Fix default font wight and font family in Backstage UI.
|
|
189
|
+
|
|
3
190
|
## 0.9.0-next.3
|
|
4
191
|
|
|
5
192
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -16,3 +16,26 @@ yarn add @backstage/ui
|
|
|
16
16
|
- [Backstage UI Documentation](https://ui.backstage.io)
|
|
17
17
|
- [Backstage Readme](https://github.com/backstage/backstage/blob/master/README.md)
|
|
18
18
|
- [Backstage Documentation](https://backstage.io/docs)
|
|
19
|
+
|
|
20
|
+
## Writing Changesets for Components
|
|
21
|
+
|
|
22
|
+
When creating changesets for component-specific changes, add component metadata to help maintain documentation:
|
|
23
|
+
|
|
24
|
+
```markdown
|
|
25
|
+
---
|
|
26
|
+
'@backstage/ui': patch
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
Fixed size prop handling for Avatar component.
|
|
30
|
+
|
|
31
|
+
Affected components: Avatar
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Guidelines:**
|
|
35
|
+
|
|
36
|
+
- **Component names**: Use PascalCase as they appear in imports (Avatar, ButtonIcon, SearchField)
|
|
37
|
+
- **Multiple components**: `Affected components: Button, ButtonLink, ButtonIcon`
|
|
38
|
+
- **General changes**: Omit the metadata line (build changes, package-level updates)
|
|
39
|
+
- **Placement**: The line can appear anywhere in the description
|
|
40
|
+
|
|
41
|
+
The changelog sync tool will parse these tags and update the documentation site automatically.
|
|
@@ -4,11 +4,12 @@ import { Disclosure, Heading, Button, DisclosurePanel, DisclosureGroup } from 'r
|
|
|
4
4
|
import { RiArrowDownSLine } from '@remixicon/react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { useStyles } from '../../hooks/useStyles.esm.js';
|
|
7
|
+
import { AccordionDefinition } from './definition.esm.js';
|
|
7
8
|
import styles from './Accordion.module.css.esm.js';
|
|
8
9
|
import { Flex } from '../Flex/Flex.esm.js';
|
|
9
10
|
|
|
10
11
|
const Accordion = forwardRef(({ className, ...props }, ref) => {
|
|
11
|
-
const { classNames, cleanedProps } = useStyles(
|
|
12
|
+
const { classNames, cleanedProps } = useStyles(AccordionDefinition, props);
|
|
12
13
|
return /* @__PURE__ */ jsx(
|
|
13
14
|
Disclosure,
|
|
14
15
|
{
|
|
@@ -20,7 +21,7 @@ const Accordion = forwardRef(({ className, ...props }, ref) => {
|
|
|
20
21
|
});
|
|
21
22
|
Accordion.displayName = "Accordion";
|
|
22
23
|
const AccordionTrigger = forwardRef(({ className, title, subtitle, children, ...props }, ref) => {
|
|
23
|
-
const { classNames, cleanedProps } = useStyles(
|
|
24
|
+
const { classNames, cleanedProps } = useStyles(AccordionDefinition, props);
|
|
24
25
|
return /* @__PURE__ */ jsx(
|
|
25
26
|
Heading,
|
|
26
27
|
{
|
|
@@ -80,7 +81,7 @@ const AccordionTrigger = forwardRef(({ className, title, subtitle, children, ...
|
|
|
80
81
|
});
|
|
81
82
|
AccordionTrigger.displayName = "AccordionTrigger";
|
|
82
83
|
const AccordionPanel = forwardRef(({ className, ...props }, ref) => {
|
|
83
|
-
const { classNames, cleanedProps } = useStyles(
|
|
84
|
+
const { classNames, cleanedProps } = useStyles(AccordionDefinition, props);
|
|
84
85
|
return /* @__PURE__ */ jsx(
|
|
85
86
|
DisclosurePanel,
|
|
86
87
|
{
|
|
@@ -92,7 +93,7 @@ const AccordionPanel = forwardRef(({ className, ...props }, ref) => {
|
|
|
92
93
|
});
|
|
93
94
|
AccordionPanel.displayName = "AccordionPanel";
|
|
94
95
|
const AccordionGroup = forwardRef(({ className, allowsMultiple = false, ...props }, ref) => {
|
|
95
|
-
const { classNames, cleanedProps } = useStyles(
|
|
96
|
+
const { classNames, cleanedProps } = useStyles(AccordionDefinition, props);
|
|
96
97
|
return /* @__PURE__ */ jsx(
|
|
97
98
|
DisclosureGroup,
|
|
98
99
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.esm.js","sources":["../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef } 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(
|
|
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 { AccordionDefinition } from './definition';\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(AccordionDefinition, 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(AccordionDefinition, 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(AccordionDefinition, 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(AccordionDefinition, 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":";;;;;;;;;;AAsCO,MAAM,SAAA,GAAY,WAGvB,CAAC,EAAE,WAAW,GAAG,KAAA,IAAS,GAAA,KAAQ;AAClC,EAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,SAAA,CAAU,qBAAqB,KAAK,CAAA;AAEzE,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,qBAAqB,KAAK,CAAA;AAEzE,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,qBAAqB,KAAK,CAAA;AAEzE,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,qBAAqB,KAAK,CAAA;AAEzE,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,15 @@
|
|
|
1
|
+
const AccordionDefinition = {
|
|
2
|
+
classNames: {
|
|
3
|
+
root: "bui-Accordion",
|
|
4
|
+
trigger: "bui-AccordionTrigger",
|
|
5
|
+
triggerButton: "bui-AccordionTriggerButton",
|
|
6
|
+
triggerTitle: "bui-AccordionTriggerTitle",
|
|
7
|
+
triggerSubtitle: "bui-AccordionTriggerSubtitle",
|
|
8
|
+
triggerIcon: "bui-AccordionTriggerIcon",
|
|
9
|
+
panel: "bui-AccordionPanel",
|
|
10
|
+
group: "bui-AccordionGroup"
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { AccordionDefinition };
|
|
15
|
+
//# sourceMappingURL=definition.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.esm.js","sources":["../../../src/components/Accordion/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ComponentDefinition } from '../../types';\n\n/**\n * Component definition for Accordion\n * @public\n */\nexport const AccordionDefinition = {\n classNames: {\n root: 'bui-Accordion',\n trigger: 'bui-AccordionTrigger',\n triggerButton: 'bui-AccordionTriggerButton',\n triggerTitle: 'bui-AccordionTriggerTitle',\n triggerSubtitle: 'bui-AccordionTriggerSubtitle',\n triggerIcon: 'bui-AccordionTriggerIcon',\n panel: 'bui-AccordionPanel',\n group: 'bui-AccordionGroup',\n },\n} as const satisfies ComponentDefinition;\n"],"names":[],"mappings":"AAsBO,MAAM,mBAAA,GAAsB;AAAA,EACjC,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,eAAA;AAAA,IACN,OAAA,EAAS,sBAAA;AAAA,IACT,aAAA,EAAe,4BAAA;AAAA,IACf,YAAA,EAAc,2BAAA;AAAA,IACd,eAAA,EAAiB,8BAAA;AAAA,IACjB,WAAA,EAAa,0BAAA;AAAA,IACb,KAAA,EAAO,oBAAA;AAAA,IACP,KAAA,EAAO;AAAA;AAEX;;;;"}
|
|
@@ -2,14 +2,18 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { forwardRef, useState, useEffect } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { useStyles } from '../../hooks/useStyles.esm.js';
|
|
5
|
+
import { AvatarDefinition } from './definition.esm.js';
|
|
5
6
|
import styles from './Avatar.module.css.esm.js';
|
|
6
7
|
|
|
7
8
|
const Avatar = forwardRef((props, ref) => {
|
|
8
|
-
const { classNames, dataAttributes, cleanedProps } = useStyles(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const { classNames, dataAttributes, cleanedProps } = useStyles(
|
|
10
|
+
AvatarDefinition,
|
|
11
|
+
{
|
|
12
|
+
size: "medium",
|
|
13
|
+
purpose: "informative",
|
|
14
|
+
...props
|
|
15
|
+
}
|
|
16
|
+
);
|
|
13
17
|
const { className, src, name, purpose, ...rest } = cleanedProps;
|
|
14
18
|
const [imageStatus, setImageStatus] = useState("loading");
|
|
15
19
|
useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.esm.js","sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef, useState, useEffect } from 'react';\nimport clsx from 'clsx';\nimport { AvatarProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport styles from './Avatar.module.css';\n\n/** @public */\nexport const Avatar = forwardRef<HTMLDivElement, AvatarProps>((props, ref) => {\n const { classNames, dataAttributes, cleanedProps } = useStyles(
|
|
1
|
+
{"version":3,"file":"Avatar.esm.js","sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef, useState, useEffect } from 'react';\nimport clsx from 'clsx';\nimport { AvatarProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport { AvatarDefinition } from './definition';\nimport styles from './Avatar.module.css';\n\n/** @public */\nexport const Avatar = forwardRef<HTMLDivElement, AvatarProps>((props, ref) => {\n const { classNames, dataAttributes, cleanedProps } = useStyles(\n AvatarDefinition,\n {\n size: 'medium',\n purpose: 'informative',\n ...props,\n },\n );\n\n const { className, src, name, purpose, ...rest } = cleanedProps;\n\n const [imageStatus, setImageStatus] = useState<\n 'loading' | 'loaded' | 'error'\n >('loading');\n\n useEffect(() => {\n setImageStatus('loading');\n const img = new Image();\n img.onload = () => setImageStatus('loaded');\n img.onerror = () => setImageStatus('error');\n img.src = src;\n\n return () => {\n img.onload = null;\n img.onerror = null;\n };\n }, [src]);\n\n const initialsCount = ['x-small', 'small'].includes(cleanedProps.size)\n ? 1\n : 2;\n\n const initials = name\n .split(' ')\n .map(word => word[0])\n .join('')\n .toLocaleUpperCase('en-US')\n .slice(0, initialsCount);\n\n return (\n <div\n ref={ref}\n role=\"img\"\n aria-label={purpose === 'informative' ? name : undefined}\n aria-hidden={purpose === 'decoration' ? true : undefined}\n className={clsx(classNames.root, styles[classNames.root], className)}\n {...dataAttributes}\n {...rest}\n >\n {imageStatus === 'loaded' ? (\n <img\n src={src}\n alt=\"\"\n className={clsx(classNames.image, styles[classNames.image])}\n />\n ) : (\n <div\n aria-hidden=\"true\"\n className={clsx(classNames.fallback, styles[classNames.fallback])}\n >\n {initials}\n </div>\n )}\n </div>\n );\n});\n\nAvatar.displayName = 'Avatar';\n"],"names":[],"mappings":";;;;;;;AAwBO,MAAM,MAAA,GAAS,UAAA,CAAwC,CAAC,KAAA,EAAO,GAAA,KAAQ;AAC5E,EAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,YAAA,EAAa,GAAI,SAAA;AAAA,IACnD,gBAAA;AAAA,IACA;AAAA,MACE,IAAA,EAAM,QAAA;AAAA,MACN,OAAA,EAAS,aAAA;AAAA,MACT,GAAG;AAAA;AACL,GACF;AAEA,EAAA,MAAM,EAAE,SAAA,EAAW,GAAA,EAAK,MAAM,OAAA,EAAS,GAAG,MAAK,GAAI,YAAA;AAEnD,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAEpC,SAAS,CAAA;AAEX,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,cAAA,CAAe,SAAS,CAAA;AACxB,IAAA,MAAM,GAAA,GAAM,IAAI,KAAA,EAAM;AACtB,IAAA,GAAA,CAAI,MAAA,GAAS,MAAM,cAAA,CAAe,QAAQ,CAAA;AAC1C,IAAA,GAAA,CAAI,OAAA,GAAU,MAAM,cAAA,CAAe,OAAO,CAAA;AAC1C,IAAA,GAAA,CAAI,GAAA,GAAM,GAAA;AAEV,IAAA,OAAO,MAAM;AACX,MAAA,GAAA,CAAI,MAAA,GAAS,IAAA;AACb,MAAA,GAAA,CAAI,OAAA,GAAU,IAAA;AAAA,IAChB,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,GAAG,CAAC,CAAA;AAER,EAAA,MAAM,aAAA,GAAgB,CAAC,SAAA,EAAW,OAAO,EAAE,QAAA,CAAS,YAAA,CAAa,IAAI,CAAA,GACjE,CAAA,GACA,CAAA;AAEJ,EAAA,MAAM,WAAW,IAAA,CACd,KAAA,CAAM,GAAG,CAAA,CACT,GAAA,CAAI,UAAQ,IAAA,CAAK,CAAC,CAAC,CAAA,CACnB,IAAA,CAAK,EAAE,CAAA,CACP,iBAAA,CAAkB,OAAO,CAAA,CACzB,KAAA,CAAM,GAAG,aAAa,CAAA;AAEzB,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,IAAA,EAAK,KAAA;AAAA,MACL,YAAA,EAAY,OAAA,KAAY,aAAA,GAAgB,IAAA,GAAO,MAAA;AAAA,MAC/C,aAAA,EAAa,OAAA,KAAY,YAAA,GAAe,IAAA,GAAO,MAAA;AAAA,MAC/C,SAAA,EAAW,KAAK,UAAA,CAAW,IAAA,EAAM,OAAO,UAAA,CAAW,IAAI,GAAG,SAAS,CAAA;AAAA,MAClE,GAAG,cAAA;AAAA,MACH,GAAG,IAAA;AAAA,MAEH,0BAAgB,QAAA,mBACf,GAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,GAAA;AAAA,UACA,GAAA,EAAI,EAAA;AAAA,UACJ,WAAW,IAAA,CAAK,UAAA,CAAW,OAAO,MAAA,CAAO,UAAA,CAAW,KAAK,CAAC;AAAA;AAAA,OAC5D,mBAEA,GAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,aAAA,EAAY,MAAA;AAAA,UACZ,WAAW,IAAA,CAAK,UAAA,CAAW,UAAU,MAAA,CAAO,UAAA,CAAW,QAAQ,CAAC,CAAA;AAAA,UAE/D,QAAA,EAAA;AAAA;AAAA;AACH;AAAA,GAEJ;AAEJ,CAAC;AAED,MAAA,CAAO,WAAA,GAAc,QAAA;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const AvatarDefinition = {
|
|
2
|
+
classNames: {
|
|
3
|
+
root: "bui-AvatarRoot",
|
|
4
|
+
image: "bui-AvatarImage",
|
|
5
|
+
fallback: "bui-AvatarFallback"
|
|
6
|
+
},
|
|
7
|
+
dataAttributes: {
|
|
8
|
+
size: ["small", "medium", "large"]
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { AvatarDefinition };
|
|
13
|
+
//# sourceMappingURL=definition.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.esm.js","sources":["../../../src/components/Avatar/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ComponentDefinition } from '../../types';\n\n/**\n * Component definition for Avatar\n * @public\n */\nexport const AvatarDefinition = {\n classNames: {\n root: 'bui-AvatarRoot',\n image: 'bui-AvatarImage',\n fallback: 'bui-AvatarFallback',\n },\n dataAttributes: {\n size: ['small', 'medium', 'large'] as const,\n },\n} as const satisfies ComponentDefinition;\n"],"names":[],"mappings":"AAsBO,MAAM,gBAAA,GAAmB;AAAA,EAC9B,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,gBAAA;AAAA,IACN,KAAA,EAAO,iBAAA;AAAA,IACP,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,IAAA,EAAM,CAAC,OAAA,EAAS,QAAA,EAAU,OAAO;AAAA;AAErC;;;;"}
|
|
@@ -2,10 +2,11 @@ import { forwardRef, createElement } from 'react';
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { useStyles } from '../../hooks/useStyles.esm.js';
|
|
4
4
|
import styles from './Box.module.css.esm.js';
|
|
5
|
+
import { BoxDefinition } from './definition.esm.js';
|
|
5
6
|
|
|
6
7
|
const Box = forwardRef((props, ref) => {
|
|
7
8
|
const { classNames, utilityClasses, style, cleanedProps } = useStyles(
|
|
8
|
-
|
|
9
|
+
BoxDefinition,
|
|
9
10
|
props
|
|
10
11
|
);
|
|
11
12
|
const { as = "div", children, className, ...rest } = cleanedProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.esm.js","sources":["../../../src/components/Box/Box.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 { createElement, forwardRef } from 'react';\nimport { BoxProps } from './types';\nimport clsx from 'clsx';\nimport { useStyles } from '../../hooks/useStyles';\nimport styles from './Box.module.css';\n\n/** @public */\nexport const Box = forwardRef<HTMLDivElement, BoxProps>((props, ref) => {\n const { classNames, utilityClasses, style, cleanedProps } = useStyles(\n
|
|
1
|
+
{"version":3,"file":"Box.esm.js","sources":["../../../src/components/Box/Box.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 { createElement, forwardRef } from 'react';\nimport { BoxProps } from './types';\nimport clsx from 'clsx';\nimport { useStyles } from '../../hooks/useStyles';\nimport styles from './Box.module.css';\nimport { BoxDefinition } from './definition';\n\n/** @public */\nexport const Box = forwardRef<HTMLDivElement, BoxProps>((props, ref) => {\n const { classNames, utilityClasses, style, cleanedProps } = useStyles(\n BoxDefinition,\n props,\n );\n\n const { as = 'div', children, className, ...rest } = cleanedProps;\n\n return createElement(\n as,\n {\n ref,\n className: clsx(\n classNames.root,\n styles[classNames.root],\n utilityClasses,\n className,\n ),\n style,\n ...rest,\n },\n children,\n );\n});\n\nBox.displayName = 'Box';\n"],"names":[],"mappings":";;;;;;AAwBO,MAAM,GAAA,GAAM,UAAA,CAAqC,CAAC,KAAA,EAAO,GAAA,KAAQ;AACtE,EAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,KAAA,EAAO,cAAa,GAAI,SAAA;AAAA,IAC1D,aAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAA,MAAM,EAAE,EAAA,GAAK,KAAA,EAAO,UAAU,SAAA,EAAW,GAAG,MAAK,GAAI,YAAA;AAErD,EAAA,OAAO,aAAA;AAAA,IACL,EAAA;AAAA,IACA;AAAA,MACE,GAAA;AAAA,MACA,SAAA,EAAW,IAAA;AAAA,QACT,UAAA,CAAW,IAAA;AAAA,QACX,MAAA,CAAO,WAAW,IAAI,CAAA;AAAA,QACtB,cAAA;AAAA,QACA;AAAA,OACF;AAAA,MACA,KAAA;AAAA,MACA,GAAG;AAAA,KACL;AAAA,IACA;AAAA,GACF;AACF,CAAC;AAED,GAAA,CAAI,WAAA,GAAc,KAAA;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const BoxDefinition = {
|
|
2
|
+
classNames: {
|
|
3
|
+
root: "bui-Box"
|
|
4
|
+
},
|
|
5
|
+
utilityProps: [
|
|
6
|
+
"m",
|
|
7
|
+
"mb",
|
|
8
|
+
"ml",
|
|
9
|
+
"mr",
|
|
10
|
+
"mt",
|
|
11
|
+
"mx",
|
|
12
|
+
"my",
|
|
13
|
+
"p",
|
|
14
|
+
"pb",
|
|
15
|
+
"pl",
|
|
16
|
+
"pr",
|
|
17
|
+
"pt",
|
|
18
|
+
"px",
|
|
19
|
+
"py",
|
|
20
|
+
"position",
|
|
21
|
+
"display",
|
|
22
|
+
"width",
|
|
23
|
+
"minWidth",
|
|
24
|
+
"maxWidth",
|
|
25
|
+
"height",
|
|
26
|
+
"minHeight",
|
|
27
|
+
"maxHeight"
|
|
28
|
+
]
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { BoxDefinition };
|
|
32
|
+
//# sourceMappingURL=definition.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.esm.js","sources":["../../../src/components/Box/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ComponentDefinition } from '../../types';\n\n/**\n * Component definition for Box\n * @public\n */\nexport const BoxDefinition = {\n classNames: {\n root: 'bui-Box',\n },\n utilityProps: [\n 'm',\n 'mb',\n 'ml',\n 'mr',\n 'mt',\n 'mx',\n 'my',\n 'p',\n 'pb',\n 'pl',\n 'pr',\n 'pt',\n 'px',\n 'py',\n 'position',\n 'display',\n 'width',\n 'minWidth',\n 'maxWidth',\n 'height',\n 'minHeight',\n 'maxHeight',\n ],\n} as const satisfies ComponentDefinition;\n"],"names":[],"mappings":"AAsBO,MAAM,aAAA,GAAgB;AAAA,EAC3B,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,GAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,GAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,UAAA;AAAA,IACA,SAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA;AAEJ;;;;"}
|
|
@@ -4,15 +4,19 @@ import { forwardRef } from 'react';
|
|
|
4
4
|
import { Button as Button$1, ProgressBar } from 'react-aria-components';
|
|
5
5
|
import { RiLoader4Line } from '@remixicon/react';
|
|
6
6
|
import { useStyles } from '../../hooks/useStyles.esm.js';
|
|
7
|
+
import { ButtonDefinition } from './definition.esm.js';
|
|
7
8
|
import stylesButton from './Button.module.css.esm.js';
|
|
8
9
|
|
|
9
10
|
const Button = forwardRef(
|
|
10
11
|
(props, ref) => {
|
|
11
|
-
const { classNames, dataAttributes, cleanedProps } = useStyles(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const { classNames, dataAttributes, cleanedProps } = useStyles(
|
|
13
|
+
ButtonDefinition,
|
|
14
|
+
{
|
|
15
|
+
size: "small",
|
|
16
|
+
variant: "primary",
|
|
17
|
+
...props
|
|
18
|
+
}
|
|
19
|
+
);
|
|
16
20
|
const { children, className, iconStart, iconEnd, loading, ...rest } = cleanedProps;
|
|
17
21
|
return /* @__PURE__ */ jsx(
|
|
18
22
|
Button$1,
|
|
@@ -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, 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(
|
|
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 { ButtonDefinition } from './definition';\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(\n ButtonDefinition,\n {\n size: 'small',\n variant: 'primary',\n ...props,\n },\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":";;;;;;;;;AA0BO,MAAM,MAAA,GAAS,UAAA;AAAA,EACpB,CAAC,OAAoB,GAAA,KAAgC;AACnD,IAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,YAAA,EAAa,GAAI,SAAA;AAAA,MACnD,gBAAA;AAAA,MACA;AAAA,QACE,IAAA,EAAM,OAAA;AAAA,QACN,OAAA,EAAS,SAAA;AAAA,QACT,GAAG;AAAA;AACL,KACF;AAEA,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;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const ButtonDefinition = {
|
|
2
|
+
classNames: {
|
|
3
|
+
root: "bui-Button",
|
|
4
|
+
content: "bui-ButtonContent",
|
|
5
|
+
spinner: "bui-ButtonSpinner"
|
|
6
|
+
},
|
|
7
|
+
dataAttributes: {
|
|
8
|
+
size: ["small", "medium", "large"],
|
|
9
|
+
variant: ["primary", "secondary", "tertiary"],
|
|
10
|
+
loading: [true, false]
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { ButtonDefinition };
|
|
15
|
+
//# sourceMappingURL=definition.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.esm.js","sources":["../../../src/components/Button/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ComponentDefinition } from '../../types';\n\n/**\n * Component definition for Button\n * @public\n */\nexport const ButtonDefinition = {\n classNames: {\n root: 'bui-Button',\n content: 'bui-ButtonContent',\n spinner: 'bui-ButtonSpinner',\n },\n dataAttributes: {\n size: ['small', 'medium', 'large'] as const,\n variant: ['primary', 'secondary', 'tertiary'] as const,\n loading: [true, false] as const,\n },\n} as const satisfies ComponentDefinition;\n"],"names":[],"mappings":"AAsBO,MAAM,gBAAA,GAAmB;AAAA,EAC9B,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,YAAA;AAAA,IACN,OAAA,EAAS,mBAAA;AAAA,IACT,OAAA,EAAS;AAAA,GACX;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,IAAA,EAAM,CAAC,OAAA,EAAS,QAAA,EAAU,OAAO,CAAA;AAAA,IACjC,OAAA,EAAS,CAAC,SAAA,EAAW,WAAA,EAAa,UAAU,CAAA;AAAA,IAC5C,OAAA,EAAS,CAAC,IAAA,EAAM,KAAK;AAAA;AAEzB;;;;"}
|
|
@@ -4,17 +4,22 @@ import { forwardRef } from 'react';
|
|
|
4
4
|
import { Button, ProgressBar } from 'react-aria-components';
|
|
5
5
|
import { RiLoader4Line } from '@remixicon/react';
|
|
6
6
|
import { useStyles } from '../../hooks/useStyles.esm.js';
|
|
7
|
+
import { ButtonDefinition } from '../Button/definition.esm.js';
|
|
8
|
+
import { ButtonIconDefinition } from './definition.esm.js';
|
|
7
9
|
import stylesButtonIcon from './ButtonIcon.module.css.esm.js';
|
|
8
10
|
import stylesButton from '../Button/Button.module.css.esm.js';
|
|
9
11
|
|
|
10
12
|
const ButtonIcon = forwardRef(
|
|
11
13
|
(props, ref) => {
|
|
12
|
-
const { classNames, dataAttributes, cleanedProps } = useStyles(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const { classNames, dataAttributes, cleanedProps } = useStyles(
|
|
15
|
+
ButtonDefinition,
|
|
16
|
+
{
|
|
17
|
+
size: "small",
|
|
18
|
+
variant: "primary",
|
|
19
|
+
...props
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
const { classNames: classNamesButtonIcon } = useStyles(ButtonIconDefinition);
|
|
18
23
|
const { className, icon, loading, ...rest } = cleanedProps;
|
|
19
24
|
return /* @__PURE__ */ jsx(
|
|
20
25
|
Button,
|
|
@@ -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, 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(
|
|
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 { ButtonDefinition } from '../Button/definition';\nimport { ButtonIconDefinition } from './definition';\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(\n ButtonDefinition,\n {\n size: 'small',\n variant: 'primary',\n ...props,\n },\n );\n\n const { classNames: classNamesButtonIcon } =\n useStyles(ButtonIconDefinition);\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":";;;;;;;;;;;AA4BO,MAAM,UAAA,GAAa,UAAA;AAAA,EACxB,CAAC,OAAwB,GAAA,KAAgC;AACvD,IAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,YAAA,EAAa,GAAI,SAAA;AAAA,MACnD,gBAAA;AAAA,MACA;AAAA,QACE,IAAA,EAAM,OAAA;AAAA,QACN,OAAA,EAAS,SAAA;AAAA,QACT,GAAG;AAAA;AACL,KACF;AAEA,IAAA,MAAM,EAAE,UAAA,EAAY,oBAAA,EAAqB,GACvC,UAAU,oBAAoB,CAAA;AAEhC,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;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.esm.js","sources":["../../../src/components/ButtonIcon/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ComponentDefinition } from '../../types';\n\n/**\n * Component definition for ButtonIcon\n * @public\n */\nexport const ButtonIconDefinition = {\n classNames: {\n root: 'bui-ButtonIcon',\n content: 'bui-ButtonIconContent',\n spinner: 'bui-ButtonIconSpinner',\n },\n} as const satisfies ComponentDefinition;\n"],"names":[],"mappings":"AAsBO,MAAM,oBAAA,GAAuB;AAAA,EAClC,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,gBAAA;AAAA,IACN,OAAA,EAAS,uBAAA;AAAA,IACT,OAAA,EAAS;AAAA;AAEb;;;;"}
|
|
@@ -4,18 +4,23 @@ import { forwardRef } from 'react';
|
|
|
4
4
|
import { Link, RouterProvider } from 'react-aria-components';
|
|
5
5
|
import { useNavigate, useHref } from 'react-router-dom';
|
|
6
6
|
import { useStyles } from '../../hooks/useStyles.esm.js';
|
|
7
|
+
import { ButtonDefinition } from '../Button/definition.esm.js';
|
|
8
|
+
import { ButtonLinkDefinition } from './definition.esm.js';
|
|
7
9
|
import { isExternalLink } from '../../utils/isExternalLink.esm.js';
|
|
8
10
|
import stylesButton from '../Button/Button.module.css.esm.js';
|
|
9
11
|
|
|
10
12
|
const ButtonLink = forwardRef(
|
|
11
13
|
(props, ref) => {
|
|
12
14
|
const navigate = useNavigate();
|
|
13
|
-
const { classNames, dataAttributes, cleanedProps } = useStyles(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const { classNames, dataAttributes, cleanedProps } = useStyles(
|
|
16
|
+
ButtonDefinition,
|
|
17
|
+
{
|
|
18
|
+
size: "small",
|
|
19
|
+
variant: "primary",
|
|
20
|
+
...props
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
const { classNames: classNamesButtonLink } = useStyles(ButtonLinkDefinition);
|
|
19
24
|
const { children, className, iconStart, iconEnd, href, ...rest } = cleanedProps;
|
|
20
25
|
const isExternal = isExternalLink(href);
|
|
21
26
|
const linkButton = /* @__PURE__ */ jsx(
|