@boostdev/design-system-components 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +25 -4
- package/dist/client.cjs +58 -54
- package/dist/client.css +503 -525
- package/dist/client.js +58 -54
- package/dist/index.cjs +58 -54
- package/dist/index.css +503 -525
- package/dist/index.js +58 -54
- package/dist/web-components/{chunk-6MH5UWUD.js → chunk-2FGATTGT.js} +5 -0
- package/dist/web-components/{chunk-5IPHEONG.js → chunk-6I2DBFQ7.js} +1 -0
- package/dist/web-components/{chunk-DI46Q2EA.js → chunk-OCODKRVZ.js} +57 -82
- package/dist/web-components/index.d.ts +571 -1
- package/dist/web-components/index.js +1501 -4
- package/dist/web-components/interaction/bds-collapsible.js +1 -1
- package/dist/web-components/interaction/bds-drawer.js +1 -1
- package/dist/web-components/interaction/form/bds-segmented-control.js +1 -1
- package/package.json +1 -1
- package/src/components/interaction/Drawer/Drawer.module.css +37 -62
- package/src/components/interaction/Drawer/Drawer.tsx +21 -17
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.mdx +8 -4
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.module.css +13 -6
- package/src/stories/Introduction.mdx +2 -1
- package/src/web-components/index.ts +12 -0
- package/src/web-components/interaction/BdsAccordion.mdx +80 -28
- package/src/web-components/interaction/BdsAccordion.stories.tsx +67 -58
- package/src/web-components/interaction/BdsCollapsible.mdx +93 -23
- package/src/web-components/interaction/BdsCollapsible.stories.tsx +29 -48
- package/src/web-components/interaction/BdsDialog.mdx +88 -27
- package/src/web-components/interaction/BdsDialog.stories.tsx +129 -47
- package/src/web-components/interaction/BdsDrawer.mdx +85 -27
- package/src/web-components/interaction/BdsDrawer.stories.tsx +161 -31
- package/src/web-components/interaction/BdsDropdownMenu.mdx +108 -0
- package/src/web-components/interaction/BdsDropdownMenu.stories.tsx +91 -0
- package/src/web-components/interaction/BdsSkipLink.mdx +72 -16
- package/src/web-components/interaction/BdsSkipLink.stories.tsx +47 -34
- package/src/web-components/interaction/BdsTabs.mdx +97 -27
- package/src/web-components/interaction/BdsTabs.stories.tsx +69 -55
- package/src/web-components/interaction/BdsTooltip.mdx +84 -18
- package/src/web-components/interaction/BdsTooltip.stories.tsx +49 -30
- package/src/web-components/interaction/bds-collapsible.ts +1 -0
- package/src/web-components/interaction/bds-drawer.ts +59 -82
- package/src/web-components/interaction/bds-dropdown-menu-item.ts +124 -0
- package/src/web-components/interaction/bds-dropdown-menu.spec.ts +102 -0
- package/src/web-components/interaction/bds-dropdown-menu.ts +200 -0
- package/src/web-components/interaction/form/BdsCheckbox.mdx +57 -20
- package/src/web-components/interaction/form/BdsCheckbox.stories.tsx +35 -36
- package/src/web-components/interaction/form/BdsCheckboxGroup.mdx +70 -0
- package/src/web-components/interaction/form/BdsCheckboxGroup.stories.tsx +81 -0
- package/src/web-components/interaction/form/BdsCombobox.mdx +52 -33
- package/src/web-components/interaction/form/BdsCombobox.stories.tsx +55 -53
- package/src/web-components/interaction/form/BdsFileInput.mdx +59 -24
- package/src/web-components/interaction/form/BdsFileInput.stories.tsx +38 -53
- package/src/web-components/interaction/form/BdsFormInput.mdx +98 -0
- package/src/web-components/interaction/form/BdsFormInput.stories.tsx +139 -0
- package/src/web-components/interaction/form/BdsNumberInput.mdx +51 -22
- package/src/web-components/interaction/form/BdsNumberInput.stories.tsx +24 -46
- package/src/web-components/interaction/form/BdsRadio.mdx +53 -22
- package/src/web-components/interaction/form/BdsRadio.stories.tsx +19 -51
- package/src/web-components/interaction/form/BdsRadioGroup.mdx +73 -0
- package/src/web-components/interaction/form/BdsRadioGroup.stories.tsx +88 -0
- package/src/web-components/interaction/form/BdsSegmentedControl.mdx +76 -23
- package/src/web-components/interaction/form/BdsSegmentedControl.stories.tsx +64 -54
- package/src/web-components/interaction/form/BdsSelect.mdx +59 -21
- package/src/web-components/interaction/form/BdsSelect.stories.tsx +47 -56
- package/src/web-components/interaction/form/BdsSlider.mdx +55 -27
- package/src/web-components/interaction/form/BdsSlider.stories.tsx +23 -44
- package/src/web-components/interaction/form/BdsSwitch.mdx +53 -20
- package/src/web-components/interaction/form/BdsSwitch.stories.tsx +22 -37
- package/src/web-components/interaction/form/BdsTextarea.mdx +54 -22
- package/src/web-components/interaction/form/BdsTextarea.stories.tsx +35 -44
- package/src/web-components/interaction/form/bds-checkbox-group.spec.ts +55 -0
- package/src/web-components/interaction/form/bds-checkbox-group.ts +117 -0
- package/src/web-components/interaction/form/bds-form-input.spec.ts +83 -0
- package/src/web-components/interaction/form/bds-form-input.ts +268 -0
- package/src/web-components/interaction/form/bds-radio-group.spec.ts +62 -0
- package/src/web-components/interaction/form/bds-radio-group.ts +142 -0
- package/src/web-components/interaction/form/bds-segmented-control.ts +5 -0
- package/src/web-components/ui/BdsAvatar.mdx +29 -20
- package/src/web-components/ui/BdsAvatar.stories.tsx +14 -28
- package/src/web-components/ui/BdsBreadcrumb.mdx +22 -19
- package/src/web-components/ui/BdsBreadcrumb.stories.tsx +11 -21
- package/src/web-components/ui/BdsButtonGroup.mdx +69 -0
- package/src/web-components/ui/BdsButtonGroup.stories.tsx +66 -0
- package/src/web-components/ui/BdsCalendar.mdx +93 -0
- package/src/web-components/ui/BdsCalendar.stories.tsx +63 -0
- package/src/web-components/ui/BdsCard.mdx +30 -25
- package/src/web-components/ui/BdsCard.stories.tsx +19 -42
- package/src/web-components/ui/BdsCarousel.mdx +83 -0
- package/src/web-components/ui/BdsCarousel.stories.tsx +96 -0
- package/src/web-components/ui/BdsDescriptionList.mdx +13 -16
- package/src/web-components/ui/BdsDescriptionList.stories.tsx +34 -49
- package/src/web-components/ui/BdsIconWrapper.mdx +20 -20
- package/src/web-components/ui/BdsIconWrapper.stories.tsx +46 -41
- package/src/web-components/ui/BdsLink.mdx +21 -17
- package/src/web-components/ui/BdsLink.stories.tsx +19 -20
- package/src/web-components/ui/BdsLoading.mdx +9 -13
- package/src/web-components/ui/BdsLoading.stories.tsx +8 -10
- package/src/web-components/ui/BdsNotificationBanner.mdx +32 -37
- package/src/web-components/ui/BdsNotificationBanner.stories.tsx +38 -47
- package/src/web-components/ui/BdsPagination.mdx +74 -0
- package/src/web-components/ui/BdsPagination.stories.tsx +36 -0
- package/src/web-components/ui/BdsProgress.mdx +24 -17
- package/src/web-components/ui/BdsProgress.stories.tsx +55 -29
- package/src/web-components/ui/BdsProgressCircle.mdx +24 -18
- package/src/web-components/ui/BdsProgressCircle.stories.tsx +17 -29
- package/src/web-components/ui/BdsRating.mdx +22 -22
- package/src/web-components/ui/BdsRating.stories.tsx +19 -13
- package/src/web-components/ui/BdsSectionHeader.mdx +31 -28
- package/src/web-components/ui/BdsSectionHeader.stories.tsx +21 -23
- package/src/web-components/ui/BdsSeparator.mdx +22 -8
- package/src/web-components/ui/BdsSeparator.stories.tsx +27 -19
- package/src/web-components/ui/BdsSkeleton.mdx +20 -26
- package/src/web-components/ui/BdsSkeleton.stories.tsx +23 -23
- package/src/web-components/ui/BdsTable.mdx +81 -0
- package/src/web-components/ui/BdsTable.stories.tsx +83 -0
- package/src/web-components/ui/BdsTypography.mdx +20 -29
- package/src/web-components/ui/BdsTypography.stories.tsx +19 -18
- package/src/web-components/ui/bds-button-group.spec.ts +40 -0
- package/src/web-components/ui/bds-button-group.ts +78 -0
- package/src/web-components/ui/bds-calendar.spec.ts +91 -0
- package/src/web-components/ui/bds-calendar.ts +427 -0
- package/src/web-components/ui/bds-carousel.spec.ts +64 -0
- package/src/web-components/ui/bds-carousel.ts +296 -0
- package/src/web-components/ui/bds-pagination.spec.ts +67 -0
- package/src/web-components/ui/bds-pagination.ts +197 -0
- package/src/web-components/ui/bds-table.spec.ts +45 -0
- package/src/web-components/ui/bds-table.ts +96 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
import '../index';
|
|
3
|
+
import '../index'; // auto-registers all custom elements
|
|
4
4
|
|
|
5
5
|
function BdsProgress({
|
|
6
6
|
value = 0,
|
|
7
|
-
max,
|
|
7
|
+
max = 100,
|
|
8
8
|
label,
|
|
9
9
|
showLabel,
|
|
10
|
-
size,
|
|
10
|
+
size = 'medium',
|
|
11
11
|
}: {
|
|
12
12
|
value?: number;
|
|
13
13
|
max?: number;
|
|
@@ -28,43 +28,69 @@ const meta = {
|
|
|
28
28
|
title: 'Web Components/UI/Progress',
|
|
29
29
|
component: BdsProgress,
|
|
30
30
|
tags: ['!stable', 'experimental'],
|
|
31
|
-
parameters: { layout: '
|
|
31
|
+
parameters: { layout: 'centered' },
|
|
32
32
|
argTypes: {
|
|
33
|
-
|
|
33
|
+
value: { control: { type: 'range', min: 0, max: 100 } },
|
|
34
|
+
max: { control: 'number' },
|
|
35
|
+
size: { control: 'select', options: ['small', 'medium', 'large'] },
|
|
36
|
+
showLabel: { control: 'boolean' },
|
|
37
|
+
label: { control: 'text' },
|
|
34
38
|
},
|
|
35
39
|
} satisfies Meta<typeof BdsProgress>;
|
|
36
40
|
|
|
37
41
|
export default meta;
|
|
38
42
|
type Story = StoryObj<typeof meta>;
|
|
39
43
|
|
|
40
|
-
export const Default: Story = {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
export const Default: Story = {
|
|
45
|
+
args: { value: 60, label: 'Progress', size: 'medium' },
|
|
46
|
+
render: ({ value, max, label, showLabel, size }) => (
|
|
47
|
+
<div style={{ width: 400 }}>
|
|
48
|
+
{React.createElement('bds-progress', {
|
|
49
|
+
value,
|
|
50
|
+
max,
|
|
51
|
+
label,
|
|
52
|
+
'show-label': showLabel || undefined,
|
|
53
|
+
size,
|
|
54
|
+
})}
|
|
55
|
+
</div>
|
|
56
|
+
),
|
|
57
|
+
};
|
|
46
58
|
|
|
47
|
-
export const
|
|
59
|
+
export const WithLabel: Story = {
|
|
48
60
|
render: () => (
|
|
49
|
-
<div style={{
|
|
50
|
-
{
|
|
51
|
-
|
|
52
|
-
|
|
61
|
+
<div style={{ width: 400 }}>
|
|
62
|
+
{React.createElement('bds-progress', {
|
|
63
|
+
value: 60,
|
|
64
|
+
label: 'Upload progress',
|
|
65
|
+
'show-label': true,
|
|
66
|
+
size: 'medium',
|
|
67
|
+
})}
|
|
53
68
|
</div>
|
|
54
69
|
),
|
|
55
70
|
};
|
|
56
71
|
|
|
57
|
-
export const
|
|
58
|
-
render: () =>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
export const Small: Story = {
|
|
73
|
+
render: () => (
|
|
74
|
+
<div style={{ width: 400 }}>
|
|
75
|
+
{React.createElement('bds-progress', { value: 40, label: 'Loading', size: 'small' })}
|
|
76
|
+
</div>
|
|
77
|
+
),
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const Large: Story = {
|
|
81
|
+
render: () => (
|
|
82
|
+
<div style={{ width: 400 }}>
|
|
83
|
+
{React.createElement('bds-progress', { value: 80, label: 'Loading', size: 'large' })}
|
|
84
|
+
</div>
|
|
85
|
+
),
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const AllSizes: Story = {
|
|
89
|
+
render: () => (
|
|
90
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 16, width: 400 }}>
|
|
91
|
+
{React.createElement('bds-progress', { value: 60, label: 'Small', 'show-label': true, size: 'small' })}
|
|
92
|
+
{React.createElement('bds-progress', { value: 60, label: 'Medium', 'show-label': true, size: 'medium' })}
|
|
93
|
+
{React.createElement('bds-progress', { value: 60, label: 'Large', 'show-label': true, size: 'large' })}
|
|
94
|
+
</div>
|
|
95
|
+
),
|
|
70
96
|
};
|
|
@@ -5,7 +5,7 @@ import * as Stories from './BdsProgressCircle.stories';
|
|
|
5
5
|
|
|
6
6
|
# <bds-progress-circle>
|
|
7
7
|
|
|
8
|
-
Framework-agnostic circular Progress
|
|
8
|
+
Framework-agnostic circular Progress custom element. Renders an SVG ring that fills proportionally to the `value` attribute, with an optional centred percentage label.
|
|
9
9
|
|
|
10
10
|
> **Status: experimental** — API may change before stable release.
|
|
11
11
|
|
|
@@ -15,16 +15,27 @@ Framework-agnostic circular Progress indicator. Uses SVG to render a smooth arc
|
|
|
15
15
|
import '@boostdev/components/web-components';
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
## When to use
|
|
19
|
+
|
|
20
|
+
- Compact progress indicators in dashboards, stat cards, or alongside a loading spinner
|
|
21
|
+
- Use `show-value` to display the numeric percentage inside the ring
|
|
22
|
+
|
|
18
23
|
## Examples
|
|
19
24
|
|
|
20
25
|
### All sizes
|
|
21
|
-
<Canvas of={Stories.
|
|
26
|
+
<Canvas of={Stories.AllSizes} />
|
|
27
|
+
|
|
28
|
+
### Default
|
|
29
|
+
<Canvas of={Stories.Default} />
|
|
22
30
|
|
|
23
|
-
### With value
|
|
31
|
+
### With centred value
|
|
24
32
|
<Canvas of={Stories.WithValue} />
|
|
25
33
|
|
|
26
|
-
###
|
|
27
|
-
<Canvas of={Stories.
|
|
34
|
+
### Small
|
|
35
|
+
<Canvas of={Stories.Small} />
|
|
36
|
+
|
|
37
|
+
### Large
|
|
38
|
+
<Canvas of={Stories.Large} />
|
|
28
39
|
|
|
29
40
|
## Props
|
|
30
41
|
|
|
@@ -36,29 +47,24 @@ import '@boostdev/components/web-components';
|
|
|
36
47
|
|-----------|------|---------|-------------|
|
|
37
48
|
| `value` | number | `0` | Current progress value |
|
|
38
49
|
| `max` | number | `100` | Maximum value |
|
|
39
|
-
| `label` | string | — | Accessible label
|
|
40
|
-
| `show-value` | boolean | `false` | Displays the percentage in the centre |
|
|
41
|
-
| `size` | `"small" \| "medium" \| "large"` | `"medium"` |
|
|
50
|
+
| `label` | string | — | Accessible label for the progress bar |
|
|
51
|
+
| `show-value` | boolean | `false` | Displays the rounded percentage in the centre of the ring |
|
|
52
|
+
| `size` | `"small" \| "medium" \| "large"` | `"medium"` | Diameter (`40px` / `64px` / `96px`) |
|
|
42
53
|
|
|
43
54
|
## CSS Custom Properties
|
|
44
55
|
|
|
45
56
|
| Property | Description |
|
|
46
57
|
|----------|-------------|
|
|
47
|
-
| `--progressCircle_color-active` |
|
|
58
|
+
| `--progressCircle_color-active` | Stroke colour of the filled arc |
|
|
48
59
|
|
|
49
60
|
## Usage in plain HTML
|
|
50
61
|
|
|
51
62
|
```html
|
|
52
|
-
<bds-progress-circle value="75" label="
|
|
53
|
-
|
|
54
|
-
<bds-progress-circle value="65" label="Upload" show-value></bds-progress-circle>
|
|
55
|
-
|
|
56
|
-
<bds-progress-circle value="80" size="large" label="Progress" show-value></bds-progress-circle>
|
|
63
|
+
<bds-progress-circle value="75" label="Upload progress" show-value></bds-progress-circle>
|
|
64
|
+
<bds-progress-circle value="30" size="small" label="Loading"></bds-progress-circle>
|
|
57
65
|
```
|
|
58
66
|
|
|
59
67
|
## Accessibility
|
|
60
68
|
|
|
61
|
-
- Renders `role="progressbar"
|
|
62
|
-
- Always provide a
|
|
63
|
-
- SVG is hidden from assistive technology (`aria-hidden="true"`) — ARIA attributes are on the container
|
|
64
|
-
- Stroke transition respects `prefers-reduced-motion`
|
|
69
|
+
- Renders with `role="progressbar"`, `aria-valuenow`, `aria-valuemin`, and `aria-valuemax`
|
|
70
|
+
- Always provide a `label` to give the indicator a meaningful accessible name
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
import '../index';
|
|
3
|
+
import '../index'; // auto-registers all custom elements
|
|
4
4
|
|
|
5
5
|
function BdsProgressCircle({
|
|
6
6
|
value = 0,
|
|
7
|
-
max,
|
|
7
|
+
max = 100,
|
|
8
8
|
label,
|
|
9
9
|
showValue,
|
|
10
|
-
size,
|
|
10
|
+
size = 'medium',
|
|
11
11
|
}: {
|
|
12
12
|
value?: number;
|
|
13
13
|
max?: number;
|
|
@@ -30,40 +30,28 @@ const meta = {
|
|
|
30
30
|
tags: ['!stable', 'experimental'],
|
|
31
31
|
parameters: { layout: 'centered' },
|
|
32
32
|
argTypes: {
|
|
33
|
-
|
|
33
|
+
value: { control: { type: 'range', min: 0, max: 100 } },
|
|
34
|
+
max: { control: 'number' },
|
|
35
|
+
size: { control: 'select', options: ['small', 'medium', 'large'] },
|
|
36
|
+
showValue: { control: 'boolean' },
|
|
37
|
+
label: { control: 'text' },
|
|
34
38
|
},
|
|
35
39
|
} satisfies Meta<typeof BdsProgressCircle>;
|
|
36
40
|
|
|
37
41
|
export default meta;
|
|
38
42
|
type Story = StoryObj<typeof meta>;
|
|
39
43
|
|
|
40
|
-
export const Default: Story = { args: { value: 75 } };
|
|
41
|
-
export const WithValue: Story = { args: { value:
|
|
42
|
-
export const
|
|
43
|
-
export const
|
|
44
|
-
export const Medium: Story = { args: { value: 60, size: 'medium', showValue: true } };
|
|
45
|
-
export const Large: Story = { args: { value: 60, size: 'large', showValue: true } };
|
|
44
|
+
export const Default: Story = { args: { value: 75, label: 'Progress', size: 'medium' } };
|
|
45
|
+
export const WithValue: Story = { args: { value: 75, label: 'Progress', showValue: true, size: 'medium' } };
|
|
46
|
+
export const Small: Story = { args: { value: 50, label: 'Loading', size: 'small' } };
|
|
47
|
+
export const Large: Story = { args: { value: 50, label: 'Loading', showValue: true, size: 'large' } };
|
|
46
48
|
|
|
47
|
-
export const
|
|
49
|
+
export const AllSizes: Story = {
|
|
48
50
|
render: () => (
|
|
49
|
-
<div style={{ display: 'flex',
|
|
50
|
-
{(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<span style={{ fontSize: '0.75rem', color: '#888' }}>{s}</span>
|
|
54
|
-
</div>
|
|
55
|
-
))}
|
|
51
|
+
<div style={{ display: 'flex', gap: 24, alignItems: 'center' }}>
|
|
52
|
+
{React.createElement('bds-progress-circle', { value: 60, label: 'Small', 'show-value': true, size: 'small' })}
|
|
53
|
+
{React.createElement('bds-progress-circle', { value: 60, label: 'Medium', 'show-value': true, size: 'medium' })}
|
|
54
|
+
{React.createElement('bds-progress-circle', { value: 60, label: 'Large', 'show-value': true, size: 'large' })}
|
|
56
55
|
</div>
|
|
57
56
|
),
|
|
58
57
|
};
|
|
59
|
-
|
|
60
|
-
export const Interactive: Story = {
|
|
61
|
-
render: () => {
|
|
62
|
-
const [value, setValue] = React.useState(0);
|
|
63
|
-
React.useEffect(() => {
|
|
64
|
-
const id = setInterval(() => setValue(v => (v >= 100 ? 0 : v + 2)), 100);
|
|
65
|
-
return () => clearInterval(id);
|
|
66
|
-
}, []);
|
|
67
|
-
return <BdsProgressCircle value={value} showValue label="Loading" size="large" />;
|
|
68
|
-
},
|
|
69
|
-
};
|
|
@@ -5,7 +5,7 @@ import * as Stories from './BdsRating.stories';
|
|
|
5
5
|
|
|
6
6
|
# <bds-rating>
|
|
7
7
|
|
|
8
|
-
Framework-agnostic read-only star Rating
|
|
8
|
+
Framework-agnostic read-only star Rating custom element. Renders a row of SVG stars with filled/empty states based on `value` and `max`.
|
|
9
9
|
|
|
10
10
|
> **Status: experimental** — API may change before stable release.
|
|
11
11
|
|
|
@@ -15,16 +15,27 @@ Framework-agnostic read-only star Rating display. Use to show a score or user ra
|
|
|
15
15
|
import '@boostdev/components/web-components';
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
## When to use
|
|
19
|
+
|
|
20
|
+
- Displaying product or review ratings in cards or lists
|
|
21
|
+
- Read-only — for interactive star selection, use a form input instead
|
|
22
|
+
|
|
18
23
|
## Examples
|
|
19
24
|
|
|
20
|
-
### All
|
|
21
|
-
<Canvas of={Stories.
|
|
25
|
+
### All values
|
|
26
|
+
<Canvas of={Stories.AllValues} />
|
|
27
|
+
|
|
28
|
+
### Default (3 of 5)
|
|
29
|
+
<Canvas of={Stories.Default} />
|
|
30
|
+
|
|
31
|
+
### Full (5 of 5)
|
|
32
|
+
<Canvas of={Stories.Full} />
|
|
22
33
|
|
|
23
|
-
### 5
|
|
24
|
-
<Canvas of={Stories.
|
|
34
|
+
### Empty (0 of 5)
|
|
35
|
+
<Canvas of={Stories.Empty} />
|
|
25
36
|
|
|
26
|
-
### Custom max
|
|
27
|
-
<Canvas of={Stories.
|
|
37
|
+
### Custom max (7 of 10)
|
|
38
|
+
<Canvas of={Stories.CustomMax} />
|
|
28
39
|
|
|
29
40
|
## Props
|
|
30
41
|
|
|
@@ -35,27 +46,16 @@ import '@boostdev/components/web-components';
|
|
|
35
46
|
| Attribute | Type | Default | Description |
|
|
36
47
|
|-----------|------|---------|-------------|
|
|
37
48
|
| `value` | number | `0` | Number of filled stars |
|
|
38
|
-
| `max` | number | `5` | Total number of stars |
|
|
39
|
-
|
|
40
|
-
## CSS Custom Properties
|
|
41
|
-
|
|
42
|
-
| Property | Description |
|
|
43
|
-
|----------|-------------|
|
|
44
|
-
| `--bds-color_warning` | Filled star colour (foundation token) |
|
|
49
|
+
| `max` | number | `5` | Total number of stars displayed |
|
|
45
50
|
|
|
46
51
|
## Usage in plain HTML
|
|
47
52
|
|
|
48
53
|
```html
|
|
49
54
|
<bds-rating value="3"></bds-rating>
|
|
50
|
-
|
|
51
|
-
<bds-rating value="4" max="5"></bds-rating>
|
|
52
|
-
|
|
53
|
-
<!-- Custom scale -->
|
|
54
|
-
<bds-rating value="7" max="10"></bds-rating>
|
|
55
|
+
<bds-rating value="4" max="10"></bds-rating>
|
|
55
56
|
```
|
|
56
57
|
|
|
57
58
|
## Accessibility
|
|
58
59
|
|
|
59
|
-
- Renders `role="img"` with `aria-label
|
|
60
|
-
-
|
|
61
|
-
- This is a read-only display — for interactive ratings, use a radio group pattern
|
|
60
|
+
- Renders `role="img"` with `aria-label` set to `"{value} out of {max} stars"`
|
|
61
|
+
- All star SVGs carry `aria-hidden="true"` to avoid duplicate announcements
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
import '../index';
|
|
3
|
+
import '../index'; // auto-registers all custom elements
|
|
4
4
|
|
|
5
|
-
function BdsRating({
|
|
5
|
+
function BdsRating({
|
|
6
|
+
value = 0,
|
|
7
|
+
max = 5,
|
|
8
|
+
}: {
|
|
9
|
+
value?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
}) {
|
|
6
12
|
return React.createElement('bds-rating', { value, max });
|
|
7
13
|
}
|
|
8
14
|
|
|
@@ -12,26 +18,26 @@ const meta = {
|
|
|
12
18
|
tags: ['!stable', 'experimental'],
|
|
13
19
|
parameters: { layout: 'centered' },
|
|
14
20
|
argTypes: {
|
|
15
|
-
value: { control: { type: '
|
|
16
|
-
max:
|
|
21
|
+
value: { control: { type: 'range', min: 0, max: 10 } },
|
|
22
|
+
max: { control: 'number' },
|
|
17
23
|
},
|
|
18
24
|
} satisfies Meta<typeof BdsRating>;
|
|
19
25
|
|
|
20
26
|
export default meta;
|
|
21
27
|
type Story = StoryObj<typeof meta>;
|
|
22
28
|
|
|
23
|
-
export const
|
|
24
|
-
export const
|
|
25
|
-
export const
|
|
26
|
-
export const
|
|
29
|
+
export const Default: Story = { args: { value: 3, max: 5 } };
|
|
30
|
+
export const Full: Story = { args: { value: 5, max: 5 } };
|
|
31
|
+
export const Empty: Story = { args: { value: 0, max: 5 } };
|
|
32
|
+
export const CustomMax: Story = { args: { value: 7, max: 10 } };
|
|
27
33
|
|
|
28
|
-
export const
|
|
34
|
+
export const AllValues: Story = {
|
|
29
35
|
render: () => (
|
|
30
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap:
|
|
36
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
|
31
37
|
{[1, 2, 3, 4, 5].map(v => (
|
|
32
|
-
<div key={v} style={{ display: 'flex', alignItems: 'center', gap:
|
|
33
|
-
<
|
|
34
|
-
|
|
38
|
+
<div key={v} style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
|
39
|
+
<span style={{ width: 8 }}>{v}</span>
|
|
40
|
+
{React.createElement('bds-rating', { value: v, max: 5 })}
|
|
35
41
|
</div>
|
|
36
42
|
))}
|
|
37
43
|
</div>
|
|
@@ -5,7 +5,7 @@ import * as Stories from './BdsSectionHeader.stories';
|
|
|
5
5
|
|
|
6
6
|
# <bds-section-header>
|
|
7
7
|
|
|
8
|
-
Framework-agnostic Section Header custom element.
|
|
8
|
+
Framework-agnostic Section Header custom element. Combines a title and optional subtitle into a consistently styled page or section heading with size and alignment variants.
|
|
9
9
|
|
|
10
10
|
> **Status: experimental** — API may change before stable release.
|
|
11
11
|
|
|
@@ -15,16 +15,31 @@ Framework-agnostic Section Header custom element. Use to introduce page sections
|
|
|
15
15
|
import '@boostdev/components/web-components';
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
## When to use
|
|
19
|
+
|
|
20
|
+
- At the top of page sections to introduce content areas
|
|
21
|
+
- Use `alignment="center"` for marketing/hero sections
|
|
22
|
+
- Override the semantic tag with `title-as` when the heading hierarchy requires a different level
|
|
23
|
+
|
|
18
24
|
## Examples
|
|
19
25
|
|
|
20
26
|
### All sizes
|
|
21
|
-
<Canvas of={Stories.
|
|
27
|
+
<Canvas of={Stories.AllSizes} />
|
|
28
|
+
|
|
29
|
+
### Default
|
|
30
|
+
<Canvas of={Stories.Default} />
|
|
31
|
+
|
|
32
|
+
### Small
|
|
33
|
+
<Canvas of={Stories.Small} />
|
|
34
|
+
|
|
35
|
+
### Large
|
|
36
|
+
<Canvas of={Stories.Large} />
|
|
22
37
|
|
|
23
|
-
###
|
|
24
|
-
<Canvas of={Stories.
|
|
38
|
+
### Centered
|
|
39
|
+
<Canvas of={Stories.Centered} />
|
|
25
40
|
|
|
26
|
-
###
|
|
27
|
-
<Canvas of={Stories.
|
|
41
|
+
### Title only
|
|
42
|
+
<Canvas of={Stories.TitleOnly} />
|
|
28
43
|
|
|
29
44
|
## Props
|
|
30
45
|
|
|
@@ -35,35 +50,23 @@ import '@boostdev/components/web-components';
|
|
|
35
50
|
| Attribute | Type | Default | Description |
|
|
36
51
|
|-----------|------|---------|-------------|
|
|
37
52
|
| `title` | string | — | Heading text (required) |
|
|
38
|
-
| `subtitle` | string | — | Optional subheading |
|
|
39
|
-
| `alignment` | `"start" \| "center" \| "end"` | `"start"` | Text alignment |
|
|
40
|
-
| `size` | `"small" \| "medium" \| "large"` | `"medium"` |
|
|
41
|
-
| `title-as` | string | `"h2"` | HTML
|
|
42
|
-
|
|
43
|
-
## CSS Custom Properties
|
|
44
|
-
|
|
45
|
-
| Property | Description |
|
|
46
|
-
|----------|-------------|
|
|
47
|
-
| `--sectionHeader-title-color` | Title text colour |
|
|
48
|
-
| `--sectionHeader_subtitle-color` | Subtitle text colour |
|
|
53
|
+
| `subtitle` | string | — | Optional subheading text |
|
|
54
|
+
| `alignment` | `"start" \| "center" \| "end"` | `"start"` | Text and flex alignment |
|
|
55
|
+
| `size` | `"small" \| "medium" \| "large"` | `"medium"` | Font size scale for title and subtitle |
|
|
56
|
+
| `title-as` | string | `"h2"` | Override the HTML element rendered for the title |
|
|
49
57
|
|
|
50
58
|
## Usage in plain HTML
|
|
51
59
|
|
|
52
60
|
```html
|
|
53
|
-
<bds-section-header title="Our Products"></bds-section-header>
|
|
54
|
-
|
|
55
61
|
<bds-section-header
|
|
56
|
-
title="
|
|
57
|
-
subtitle="
|
|
58
|
-
alignment="center"
|
|
62
|
+
title="Our Products"
|
|
63
|
+
subtitle="Browse the full range"
|
|
59
64
|
size="large"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
<!-- Use h3 when nested inside another section -->
|
|
63
|
-
<bds-section-header title="Subsection" title-as="h3"></bds-section-header>
|
|
65
|
+
alignment="center">
|
|
66
|
+
</bds-section-header>
|
|
64
67
|
```
|
|
65
68
|
|
|
66
69
|
## Accessibility
|
|
67
70
|
|
|
68
|
-
-
|
|
69
|
-
-
|
|
71
|
+
- The title renders as `h2` by default; use `title-as` to match the page heading hierarchy
|
|
72
|
+
- Avoid skipping heading levels when changing `title-as`
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
import '../index';
|
|
3
|
+
import '../index'; // auto-registers all custom elements
|
|
4
4
|
|
|
5
5
|
function BdsSectionHeader({
|
|
6
|
-
title,
|
|
6
|
+
title = '',
|
|
7
7
|
subtitle,
|
|
8
|
-
alignment,
|
|
9
|
-
size,
|
|
8
|
+
alignment = 'start',
|
|
9
|
+
size = 'medium',
|
|
10
10
|
titleAs,
|
|
11
11
|
}: {
|
|
12
12
|
title?: string;
|
|
@@ -15,13 +15,7 @@ function BdsSectionHeader({
|
|
|
15
15
|
size?: 'small' | 'medium' | 'large';
|
|
16
16
|
titleAs?: string;
|
|
17
17
|
}) {
|
|
18
|
-
return React.createElement('bds-section-header', {
|
|
19
|
-
title,
|
|
20
|
-
subtitle,
|
|
21
|
-
alignment,
|
|
22
|
-
size,
|
|
23
|
-
'title-as': titleAs,
|
|
24
|
-
});
|
|
18
|
+
return React.createElement('bds-section-header', { title, subtitle, alignment, size, 'title-as': titleAs });
|
|
25
19
|
}
|
|
26
20
|
|
|
27
21
|
const meta = {
|
|
@@ -31,26 +25,30 @@ const meta = {
|
|
|
31
25
|
parameters: { layout: 'padded' },
|
|
32
26
|
argTypes: {
|
|
33
27
|
alignment: { control: 'select', options: ['start', 'center', 'end'] },
|
|
34
|
-
size:
|
|
28
|
+
size: { control: 'select', options: ['small', 'medium', 'large'] },
|
|
29
|
+
titleAs: { control: 'text' },
|
|
35
30
|
},
|
|
36
31
|
} satisfies Meta<typeof BdsSectionHeader>;
|
|
37
32
|
|
|
38
33
|
export default meta;
|
|
39
34
|
type Story = StoryObj<typeof meta>;
|
|
40
35
|
|
|
41
|
-
export const Default: Story = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
export const
|
|
45
|
-
export const
|
|
46
|
-
export const
|
|
36
|
+
export const Default: Story = {
|
|
37
|
+
args: { title: 'Our Products', subtitle: 'Browse the full range', size: 'medium', alignment: 'start' },
|
|
38
|
+
};
|
|
39
|
+
export const Small: Story = { args: { title: 'Recent Activity', subtitle: 'Last 30 days', size: 'small' } };
|
|
40
|
+
export const Large: Story = { args: { title: 'Welcome Back', subtitle: 'Here is what happened today', size: 'large' } };
|
|
41
|
+
export const Centered: Story = {
|
|
42
|
+
args: { title: 'Our Mission', subtitle: 'We are building something great', alignment: 'center' },
|
|
43
|
+
};
|
|
44
|
+
export const TitleOnly: Story = { args: { title: 'Settings', size: 'small' } };
|
|
47
45
|
|
|
48
|
-
export const
|
|
46
|
+
export const AllSizes: Story = {
|
|
49
47
|
render: () => (
|
|
50
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap:
|
|
51
|
-
{(
|
|
52
|
-
|
|
53
|
-
)
|
|
48
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 32 }}>
|
|
49
|
+
{React.createElement('bds-section-header', { title: 'Small Heading', subtitle: 'Subtitle text', size: 'small' })}
|
|
50
|
+
{React.createElement('bds-section-header', { title: 'Medium Heading', subtitle: 'Subtitle text', size: 'medium' })}
|
|
51
|
+
{React.createElement('bds-section-header', { title: 'Large Heading', subtitle: 'Subtitle text', size: 'large' })}
|
|
54
52
|
</div>
|
|
55
53
|
),
|
|
56
54
|
};
|
|
@@ -5,20 +5,34 @@ import * as Stories from './BdsSeparator.stories';
|
|
|
5
5
|
|
|
6
6
|
# <bds-separator>
|
|
7
7
|
|
|
8
|
-
Framework-agnostic Separator custom element. Renders a horizontal
|
|
8
|
+
Framework-agnostic Separator custom element. Renders a thin decorative line to visually divide content. Supports both horizontal and vertical orientations.
|
|
9
9
|
|
|
10
10
|
> **Status: experimental** — API may change before stable release.
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
14
|
```js
|
|
15
|
+
// Register all web components at once
|
|
15
16
|
import '@boostdev/components/web-components';
|
|
16
17
|
```
|
|
17
18
|
|
|
19
|
+
Or in HTML without a bundler:
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<script type="module">
|
|
23
|
+
import '@boostdev/components/web-components';
|
|
24
|
+
</script>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## When to use
|
|
28
|
+
|
|
29
|
+
- To visually separate groups of related content (e.g. sections in a form or list)
|
|
30
|
+
- As a vertical divider between inline elements such as navigation links
|
|
31
|
+
|
|
18
32
|
## Examples
|
|
19
33
|
|
|
20
|
-
###
|
|
21
|
-
<Canvas of={Stories.
|
|
34
|
+
### Default (horizontal)
|
|
35
|
+
<Canvas of={Stories.Default} />
|
|
22
36
|
|
|
23
37
|
### Horizontal
|
|
24
38
|
<Canvas of={Stories.Horizontal} />
|
|
@@ -46,11 +60,12 @@ import '@boostdev/components/web-components';
|
|
|
46
60
|
## Usage in plain HTML
|
|
47
61
|
|
|
48
62
|
```html
|
|
49
|
-
|
|
63
|
+
<p>Above</p>
|
|
50
64
|
<bds-separator></bds-separator>
|
|
65
|
+
<p>Below</p>
|
|
51
66
|
|
|
52
|
-
<!-- Vertical
|
|
53
|
-
<div style="display: flex; align-items: center;
|
|
67
|
+
<!-- Vertical -->
|
|
68
|
+
<div style="display: flex; align-items: center; gap: 8px; height: 40px;">
|
|
54
69
|
<span>Left</span>
|
|
55
70
|
<bds-separator orientation="vertical"></bds-separator>
|
|
56
71
|
<span>Right</span>
|
|
@@ -59,5 +74,4 @@ import '@boostdev/components/web-components';
|
|
|
59
74
|
|
|
60
75
|
## Accessibility
|
|
61
76
|
|
|
62
|
-
- Renders
|
|
63
|
-
- Purely decorative — screen readers announce it as a separator landmark
|
|
77
|
+
- Renders a `<div role="separator">` with `aria-orientation` set automatically
|