@boostdev/design-system-components 1.2.7 → 1.2.8
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/AGENTS.md +2 -2
- package/dist/client.cjs +54 -51
- package/dist/client.css +474 -473
- package/dist/client.d.cts +11 -3
- package/dist/client.d.ts +11 -3
- package/dist/client.js +53 -51
- package/dist/index.cjs +54 -51
- package/dist/index.css +474 -473
- package/dist/index.d.cts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.js +53 -51
- package/dist/native/index.cjs +3 -1
- package/dist/native/index.d.cts +11 -3
- package/dist/native/index.d.ts +11 -3
- package/dist/native/index.js +3 -1
- package/package.json +1 -1
- package/src/components/interaction/Button/Button.mdx +1 -1
- package/src/components/layout/ButtonGroup/ButtonGroup.mdx +5 -3
- package/src/components/layout/ButtonGroup/ButtonGroup.module.css +1 -0
- package/src/components/layout/ButtonGroup/ButtonGroup.native.tsx +12 -2
- package/src/components/layout/ButtonGroup/ButtonGroup.spec.tsx +14 -5
- package/src/components/layout/ButtonGroup/ButtonGroup.stories.tsx +10 -10
- package/src/components/layout/ButtonGroup/ButtonGroup.tsx +12 -2
- package/src/components/layout/ButtonGroup/index.ts +2 -2
- package/src/index.ts +2 -2
- package/src/native.ts +2 -2
package/dist/native/index.d.ts
CHANGED
|
@@ -268,13 +268,21 @@ interface IconWrapperProps {
|
|
|
268
268
|
}
|
|
269
269
|
declare function IconWrapper({ children, style, accessibilityElementsHidden }: IconWrapperProps): react_jsx_runtime.JSX.Element;
|
|
270
270
|
|
|
271
|
-
interface
|
|
271
|
+
interface ButtonContainerProps {
|
|
272
272
|
children: ReactNode;
|
|
273
273
|
variant?: 'flow' | 'card' | 'modal' | 'content';
|
|
274
274
|
accessibilityLabel?: string;
|
|
275
275
|
style?: StyleProp<ViewStyle>;
|
|
276
276
|
}
|
|
277
|
-
declare function
|
|
277
|
+
declare function ButtonContainer({ children, variant, accessibilityLabel, style }: ButtonContainerProps): react_jsx_runtime.JSX.Element;
|
|
278
|
+
/**
|
|
279
|
+
* @deprecated Use `ButtonContainer` instead. `ButtonGroup` will be removed in the next major version.
|
|
280
|
+
*/
|
|
281
|
+
declare const ButtonGroup: typeof ButtonContainer;
|
|
282
|
+
/**
|
|
283
|
+
* @deprecated Use `ButtonContainerProps` instead. `ButtonGroupProps` will be removed in the next major version.
|
|
284
|
+
*/
|
|
285
|
+
type ButtonGroupProps = ButtonContainerProps;
|
|
278
286
|
|
|
279
287
|
type ButtonVariant = 'default' | 'outline' | 'ghost';
|
|
280
288
|
type ButtonSize = 'small' | 'medium' | 'large';
|
|
@@ -561,4 +569,4 @@ interface MessageProps {
|
|
|
561
569
|
}
|
|
562
570
|
declare function Message({ message, type, style }: MessageProps): react_jsx_runtime.JSX.Element | null;
|
|
563
571
|
|
|
564
|
-
export { Accordion, type AccordionItem, Alert, Avatar, Badge, Breadcrumb, type BreadcrumbItem, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, Calendar, Card, Carousel, Checkbox, CheckboxGroup, Collapsible, type CollapsibleProps, Combobox, type ComboboxOption, type DescriptionItem, DescriptionList, Dialog, Drawer, DropdownMenu, type DropdownMenuItem, FileInput, FormInput, IconWrapper, type IconWrapperProps, Label, Link, Loading, Message, NotificationBanner, NumberInput, Pagination, Popover, Progress, ProgressCircle, Radio, RadioGroup, Rating, SectionHeader, SegmentedControl, Select, type SelectOption, Separator, Skeleton, Slider, Switch, type TabItem, Table, type TableColumn, Tabs, Textarea, ThemeProvider, ToastProvider, Tooltip, Typography, lineHeight, useTheme, useToast };
|
|
572
|
+
export { Accordion, type AccordionItem, Alert, Avatar, Badge, Breadcrumb, type BreadcrumbItem, Button, ButtonContainer, type ButtonContainerProps, ButtonGroup, type ButtonGroupProps, type ButtonProps, Calendar, Card, Carousel, Checkbox, CheckboxGroup, Collapsible, type CollapsibleProps, Combobox, type ComboboxOption, type DescriptionItem, DescriptionList, Dialog, Drawer, DropdownMenu, type DropdownMenuItem, FileInput, FormInput, IconWrapper, type IconWrapperProps, Label, Link, Loading, Message, NotificationBanner, NumberInput, Pagination, Popover, Progress, ProgressCircle, Radio, RadioGroup, Rating, SectionHeader, SegmentedControl, Select, type SelectOption, Separator, Skeleton, Slider, Switch, type TabItem, Table, type TableColumn, Tabs, Textarea, ThemeProvider, ToastProvider, Tooltip, Typography, lineHeight, useTheme, useToast };
|
package/dist/native/index.js
CHANGED
|
@@ -2045,7 +2045,7 @@ var styles23 = StyleSheet23.create({
|
|
|
2045
2045
|
gap: spacing.xs
|
|
2046
2046
|
}
|
|
2047
2047
|
});
|
|
2048
|
-
function
|
|
2048
|
+
function ButtonContainer({ children, variant, accessibilityLabel, style }) {
|
|
2049
2049
|
const isColumn = variant === "card" || variant === "modal";
|
|
2050
2050
|
return /* @__PURE__ */ jsx26(
|
|
2051
2051
|
View21,
|
|
@@ -2056,6 +2056,7 @@ function ButtonGroup({ children, variant, accessibilityLabel, style }) {
|
|
|
2056
2056
|
}
|
|
2057
2057
|
);
|
|
2058
2058
|
}
|
|
2059
|
+
var ButtonGroup = ButtonContainer;
|
|
2059
2060
|
|
|
2060
2061
|
// src/components/interaction/Button/Button.native.tsx
|
|
2061
2062
|
import { StyleSheet as StyleSheet24, Pressable as Pressable14, Text as Text20, View as View22 } from "react-native";
|
|
@@ -4362,6 +4363,7 @@ export {
|
|
|
4362
4363
|
Badge,
|
|
4363
4364
|
Breadcrumb,
|
|
4364
4365
|
Button,
|
|
4366
|
+
ButtonContainer,
|
|
4365
4367
|
ButtonGroup,
|
|
4366
4368
|
Calendar,
|
|
4367
4369
|
Card,
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ Primary interactive element for triggering actions. Renders as `<button>` or `<a
|
|
|
12
12
|
- Secondary or ghost actions (`ghost`)
|
|
13
13
|
- Navigation that should look like an action (`href` → renders as `<a>`)
|
|
14
14
|
|
|
15
|
-
> **Form actions:** When using buttons in a form (submit, reset, cancel), always wrap them in a `
|
|
15
|
+
> **Form actions:** When using buttons in a form (submit, reset, cancel), always wrap them in a `ButtonContainer` component. This provides consistent spacing, alignment, and responsive layout for form actions. Use `variant="flow"` for step navigation or `variant="card"` for single-form submissions.
|
|
16
16
|
|
|
17
17
|
## When not to use
|
|
18
18
|
- Navigation to another page when it reads naturally as a link — use `Link` instead
|
|
@@ -3,11 +3,13 @@ import * as Stories from './ButtonGroup.stories';
|
|
|
3
3
|
|
|
4
4
|
<Meta of={Stories} />
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# ButtonContainer
|
|
7
7
|
|
|
8
|
-
Layout wrapper that arranges `Button` children according to a contextual variant. Handles spacing, alignment, and direction.
|
|
8
|
+
Layout wrapper that arranges `Button` children according to a contextual variant. Handles spacing, alignment, and direction. Takes the full width of its parent container.
|
|
9
9
|
|
|
10
|
-
> **Recommended:** Always wrap buttons in a `
|
|
10
|
+
> **Recommended:** Always wrap buttons in a `ButtonContainer` when they appear inside a form. This ensures consistent spacing and alignment for form actions like submit, cancel, and navigation.
|
|
11
|
+
|
|
12
|
+
> **Migration:** `ButtonGroup` is deprecated in favour of `ButtonContainer`. Both names work — `ButtonGroup` is an alias that will be removed in the next major version.
|
|
11
13
|
|
|
12
14
|
## Variants
|
|
13
15
|
|
|
@@ -2,7 +2,7 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { StyleSheet, View, StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import { spacing } from '../../../native/tokens';
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface ButtonContainerProps {
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
variant?: 'flow' | 'card' | 'modal' | 'content';
|
|
8
8
|
accessibilityLabel?: string;
|
|
@@ -21,7 +21,7 @@ const styles = StyleSheet.create({
|
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
export function
|
|
24
|
+
export function ButtonContainer({ children, variant, accessibilityLabel, style }: ButtonContainerProps) {
|
|
25
25
|
const isColumn = variant === 'card' || variant === 'modal';
|
|
26
26
|
return (
|
|
27
27
|
<View
|
|
@@ -32,3 +32,13 @@ export function ButtonGroup({ children, variant, accessibilityLabel, style }: Bu
|
|
|
32
32
|
</View>
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Use `ButtonContainer` instead. `ButtonGroup` will be removed in the next major version.
|
|
38
|
+
*/
|
|
39
|
+
export const ButtonGroup = ButtonContainer;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Use `ButtonContainerProps` instead. `ButtonGroupProps` will be removed in the next major version.
|
|
43
|
+
*/
|
|
44
|
+
export type ButtonGroupProps = ButtonContainerProps;
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react';
|
|
2
|
-
import { ButtonGroup } from './ButtonGroup';
|
|
2
|
+
import { ButtonContainer, ButtonGroup } from './ButtonGroup';
|
|
3
3
|
|
|
4
|
-
describe('
|
|
4
|
+
describe('ButtonContainer', () => {
|
|
5
5
|
it('renders children', () => {
|
|
6
6
|
render(
|
|
7
|
-
<
|
|
7
|
+
<ButtonContainer>
|
|
8
8
|
<button>A</button>
|
|
9
9
|
<button>B</button>
|
|
10
|
-
</
|
|
10
|
+
</ButtonContainer>,
|
|
11
11
|
);
|
|
12
12
|
expect(screen.getByText('A')).toBeInTheDocument();
|
|
13
13
|
expect(screen.getByText('B')).toBeInTheDocument();
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
it('accepts a custom className', () => {
|
|
17
|
-
const { container } = render(<
|
|
17
|
+
const { container } = render(<ButtonContainer className="custom"><button>X</button></ButtonContainer>);
|
|
18
18
|
expect(container.firstChild).toHaveClass('custom');
|
|
19
19
|
});
|
|
20
|
+
|
|
21
|
+
it('fills the full width of its parent', () => {
|
|
22
|
+
const { container } = render(<ButtonContainer><button>X</button></ButtonContainer>);
|
|
23
|
+
expect(container.firstChild).toHaveClass('buttonGroup');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('exports ButtonGroup as a deprecated alias', () => {
|
|
27
|
+
expect(ButtonGroup).toBe(ButtonContainer);
|
|
28
|
+
});
|
|
20
29
|
});
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import {
|
|
2
|
+
import { ButtonContainer } from './ButtonGroup';
|
|
3
3
|
import { Button } from '../../interaction/Button';
|
|
4
4
|
|
|
5
5
|
const meta = {
|
|
6
|
-
title: 'React/Layout/
|
|
7
|
-
component:
|
|
6
|
+
title: 'React/Layout/ButtonContainer',
|
|
7
|
+
component: ButtonContainer,
|
|
8
8
|
argTypes: {
|
|
9
9
|
variant: { control: 'select', options: ['flow', 'card', 'modal', 'content', undefined] },
|
|
10
10
|
},
|
|
11
|
-
} satisfies Meta<typeof
|
|
11
|
+
} satisfies Meta<typeof ButtonContainer>;
|
|
12
12
|
|
|
13
13
|
export default meta;
|
|
14
14
|
type Story = StoryObj<typeof meta>;
|
|
15
15
|
|
|
16
16
|
const TwoButtons = () => (
|
|
17
17
|
<>
|
|
18
|
-
<Button variant="
|
|
18
|
+
<Button variant="outline">Cancel</Button>
|
|
19
19
|
<Button variant="default">Confirm</Button>
|
|
20
20
|
</>
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
export const Default: Story = { render: () => <
|
|
24
|
-
export const Flow: Story = { render: () => <
|
|
25
|
-
export const Card: Story = { render: () => <
|
|
26
|
-
export const Modal: Story = { render: () => <
|
|
27
|
-
export const Content: Story = { render: () => <
|
|
23
|
+
export const Default: Story = { render: () => <ButtonContainer><TwoButtons /></ButtonContainer> };
|
|
24
|
+
export const Flow: Story = { render: () => <ButtonContainer variant="flow"><TwoButtons /></ButtonContainer> };
|
|
25
|
+
export const Card: Story = { render: () => <ButtonContainer variant="card"><TwoButtons /></ButtonContainer> };
|
|
26
|
+
export const Modal: Story = { render: () => <ButtonContainer variant="modal"><TwoButtons /></ButtonContainer> };
|
|
27
|
+
export const Content: Story = { render: () => <ButtonContainer variant="content"><TwoButtons /></ButtonContainer> };
|
|
@@ -3,11 +3,11 @@ import css from './ButtonGroup.module.css';
|
|
|
3
3
|
import { cn } from '@boostdev/design-system-foundation';
|
|
4
4
|
import type { WithClassName } from '../../../types';
|
|
5
5
|
|
|
6
|
-
export interface
|
|
6
|
+
export interface ButtonContainerProps extends WithClassName, HTMLAttributes<HTMLDivElement> {
|
|
7
7
|
variant?: 'flow' | 'card' | 'modal' | 'content';
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export function
|
|
10
|
+
export function ButtonContainer({ children, className, variant, ...rest }: ButtonContainerProps) {
|
|
11
11
|
return (
|
|
12
12
|
<div
|
|
13
13
|
{...rest}
|
|
@@ -18,3 +18,13 @@ export function ButtonGroup({ children, className, variant, ...rest }: ButtonGro
|
|
|
18
18
|
</div>
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use `ButtonContainer` instead. `ButtonGroup` will be removed in the next major version.
|
|
24
|
+
*/
|
|
25
|
+
export const ButtonGroup = ButtonContainer;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Use `ButtonContainerProps` instead. `ButtonGroupProps` will be removed in the next major version.
|
|
29
|
+
*/
|
|
30
|
+
export type ButtonGroupProps = ButtonContainerProps;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ButtonGroup } from './ButtonGroup';
|
|
2
|
-
export type { ButtonGroupProps } from './ButtonGroup';
|
|
1
|
+
export { ButtonContainer, ButtonGroup } from './ButtonGroup';
|
|
2
|
+
export type { ButtonContainerProps, ButtonGroupProps } from './ButtonGroup';
|
package/src/index.ts
CHANGED
|
@@ -64,8 +64,8 @@ export { Switch } from './components/interaction/form/Switch';
|
|
|
64
64
|
export { Textarea } from './components/interaction/form/Textarea';
|
|
65
65
|
|
|
66
66
|
// Layout
|
|
67
|
-
export { ButtonGroup } from './components/layout/ButtonGroup';
|
|
68
|
-
export type { ButtonGroupProps } from './components/layout/ButtonGroup';
|
|
67
|
+
export { ButtonContainer, ButtonGroup } from './components/layout/ButtonGroup';
|
|
68
|
+
export type { ButtonContainerProps, ButtonGroupProps } from './components/layout/ButtonGroup';
|
|
69
69
|
export { Card } from './components/layout/Card';
|
|
70
70
|
export { SectionHeader } from './components/layout/SectionHeader';
|
|
71
71
|
export { IconWrapper } from './components/layout/IconWrapper';
|
package/src/native.ts
CHANGED
|
@@ -39,8 +39,8 @@ export { Card } from './components/layout/Card/Card.native';
|
|
|
39
39
|
export { SectionHeader } from './components/layout/SectionHeader/SectionHeader.native';
|
|
40
40
|
export { IconWrapper } from './components/layout/IconWrapper/IconWrapper.native';
|
|
41
41
|
export type { IconWrapperProps } from './components/layout/IconWrapper/IconWrapper.native';
|
|
42
|
-
export { ButtonGroup } from './components/layout/ButtonGroup/ButtonGroup.native';
|
|
43
|
-
export type { ButtonGroupProps } from './components/layout/ButtonGroup/ButtonGroup.native';
|
|
42
|
+
export { ButtonContainer, ButtonGroup } from './components/layout/ButtonGroup/ButtonGroup.native';
|
|
43
|
+
export type { ButtonContainerProps, ButtonGroupProps } from './components/layout/ButtonGroup/ButtonGroup.native';
|
|
44
44
|
|
|
45
45
|
// Interaction
|
|
46
46
|
export { Button } from './components/interaction/Button/Button.native';
|