@boostdev/design-system-components 1.1.2 → 1.2.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/AGENTS.md +13 -10
- package/dist/client.cjs +77 -99
- package/dist/client.css +611 -580
- package/dist/client.d.cts +13 -16
- package/dist/client.d.ts +13 -16
- package/dist/client.js +87 -109
- package/dist/index.cjs +77 -99
- package/dist/index.css +611 -580
- package/dist/index.d.cts +13 -16
- package/dist/index.d.ts +13 -16
- package/dist/index.js +87 -109
- package/dist/native/index.cjs +9 -8
- package/dist/native/index.d.cts +1 -1
- package/dist/native/index.d.ts +1 -1
- package/dist/native/index.js +9 -8
- package/dist/web-components/{chunk-O4UFI2RX.js → chunk-3REOIRDW.js} +13 -11
- package/dist/web-components/{chunk-K5CE6HSB.js → chunk-6MH5UWUD.js} +74 -17
- package/dist/web-components/{chunk-VM3YHGQ2.js → chunk-AJSXNDAP.js} +1 -2
- package/dist/web-components/{chunk-LSC4N56Q.js → chunk-BX3IPVOB.js} +1 -2
- package/dist/web-components/{chunk-CJ5ZOO42.js → chunk-DI46Q2EA.js} +50 -1
- package/dist/web-components/{chunk-CAPI25CU.js → chunk-DZRSJGPB.js} +3 -3
- package/dist/web-components/{chunk-VSS5ITNE.js → chunk-EBJM3VD4.js} +1 -3
- package/dist/web-components/{chunk-O7I63SQX.js → chunk-HHHRF2PS.js} +6 -12
- package/dist/web-components/{chunk-OTX4COSV.js → chunk-JUKB3BUP.js} +3 -4
- package/dist/web-components/{chunk-IQGLIQSO.js → chunk-N6IMUOY4.js} +2 -5
- package/dist/web-components/{chunk-QDRH46TF.js → chunk-QLZ2362S.js} +1 -3
- package/dist/web-components/{chunk-IK3PTFZ4.js → chunk-T6AETZRP.js} +1 -3
- package/dist/web-components/{chunk-4BX6AWXX.js → chunk-X3FKVHLK.js} +2 -4
- package/dist/web-components/{chunk-A67LCT7C.js → chunk-XNA6WTXG.js} +3 -4
- package/dist/web-components/{chunk-XIENXR7H.js → chunk-YRXCVKHV.js} +1 -3
- package/dist/web-components/{chunk-6T3RKUKG.js → chunk-ZTC6GRP7.js} +1 -2
- package/dist/web-components/globals.js +1 -1
- package/dist/web-components/index.js +16 -16
- package/dist/web-components/interaction/bds-accordion.js +1 -1
- package/dist/web-components/interaction/bds-button.d.ts +2 -2
- package/dist/web-components/interaction/bds-button.js +1 -1
- package/dist/web-components/interaction/bds-dialog.js +1 -1
- package/dist/web-components/interaction/bds-drawer.js +1 -1
- package/dist/web-components/interaction/form/bds-checkbox.js +1 -1
- package/dist/web-components/interaction/form/bds-combobox.js +1 -1
- package/dist/web-components/interaction/form/bds-number-input.js +1 -1
- package/dist/web-components/interaction/form/bds-radio.js +1 -1
- package/dist/web-components/interaction/form/bds-segmented-control.d.ts +20 -3
- package/dist/web-components/interaction/form/bds-segmented-control.js +1 -1
- package/dist/web-components/interaction/form/bds-select.js +1 -1
- package/dist/web-components/interaction/form/bds-switch.js +1 -1
- package/dist/web-components/interaction/form/bds-textarea.js +1 -1
- package/dist/web-components/ui/bds-alert.js +1 -1
- package/dist/web-components/ui/bds-card.js +1 -1
- package/dist/web-components/ui/bds-notification-banner.js +1 -1
- package/package.json +2 -2
- package/src/components/interaction/Button/Button.module.css +12 -11
- package/src/components/interaction/Button/Button.native.tsx +10 -9
- package/src/components/interaction/Button/Button.tsx +1 -1
- package/src/components/interaction/Command/Command.module.css +3 -7
- package/src/components/interaction/Dialog/Dialog.module.css +7 -5
- package/src/components/interaction/Drawer/Drawer.module.css +49 -1
- package/src/components/interaction/DropdownMenu/DropdownMenu.module.css +1 -3
- package/src/components/interaction/Popover/Popover.module.css +1 -3
- package/src/components/interaction/form/Checkbox/Checkbox.module.css +1 -3
- package/src/components/interaction/form/Combobox/Combobox.module.css +2 -6
- package/src/components/interaction/form/FormInput/FormInput.module.css +1 -3
- package/src/components/interaction/form/NumberInput/NumberInput.module.css +16 -4
- package/src/components/interaction/form/Radio/Radio.module.css +6 -16
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.mdx +70 -25
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.module.css +55 -33
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.spec.tsx +127 -56
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.stories.tsx +89 -72
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.tsx +40 -62
- package/src/components/interaction/form/SegmentedControl/index.ts +1 -1
- package/src/components/interaction/form/Select/Select.module.css +2 -4
- package/src/components/interaction/form/Switch/Switch.module.css +5 -7
- package/src/components/interaction/form/Switch/Switch.native.spec.tsx +9 -9
- package/src/components/interaction/form/Switch/Switch.native.tsx +2 -2
- package/src/components/interaction/form/Textarea/Textarea.module.css +1 -3
- package/src/components/interaction/form/atoms/InputContainer.stories.tsx +64 -0
- package/src/components/interaction/form/atoms/Label.stories.tsx +33 -0
- package/src/components/interaction/form/atoms/Message.stories.tsx +33 -0
- package/src/components/layout/Card/Card.module.css +1 -3
- package/src/components/ui/Accordion/Accordion.module.css +1 -2
- package/src/components/ui/Alert/Alert.module.css +1 -2
- package/src/components/ui/Calendar/Calendar.module.css +2 -5
- package/src/components/ui/Carousel/Carousel.module.css +1 -3
- package/src/components/ui/NotificationBanner/NotificationBanner.module.css +1 -2
- package/src/components/ui/Pagination/Pagination.module.css +1 -2
- package/src/components/ui/SkipLink/SkipLink.module.css +1 -2
- package/src/components/ui/Table/Table.module.css +1 -2
- package/src/css/bdc.css +16 -11
- package/src/index.ts +1 -1
- package/src/web-components/globals.ts +3 -3
- package/src/web-components/interaction/BdsAccordion.mdx +51 -0
- package/src/web-components/interaction/BdsAccordion.stories.tsx +85 -0
- package/src/web-components/interaction/BdsCollapsible.mdx +46 -0
- package/src/web-components/interaction/BdsCollapsible.stories.tsx +87 -0
- package/src/web-components/interaction/BdsDialog.mdx +49 -0
- package/src/web-components/interaction/BdsDialog.stories.tsx +75 -0
- package/src/web-components/interaction/BdsDrawer.mdx +50 -0
- package/src/web-components/interaction/BdsDrawer.stories.tsx +66 -0
- package/src/web-components/interaction/BdsSkipLink.mdx +34 -0
- package/src/web-components/interaction/BdsSkipLink.stories.tsx +55 -0
- package/src/web-components/interaction/BdsTabs.mdx +47 -0
- package/src/web-components/interaction/BdsTabs.stories.tsx +80 -0
- package/src/web-components/interaction/BdsTooltip.mdx +38 -0
- package/src/web-components/interaction/BdsTooltip.stories.tsx +68 -0
- package/src/web-components/interaction/bds-accordion.ts +1 -2
- package/src/web-components/interaction/bds-button.ts +15 -13
- package/src/web-components/interaction/bds-dialog.ts +2 -5
- package/src/web-components/interaction/bds-drawer.ts +50 -1
- package/src/web-components/interaction/form/BdsCheckbox.mdx +39 -0
- package/src/web-components/interaction/form/BdsCheckbox.stories.tsx +73 -0
- package/src/web-components/interaction/form/BdsCombobox.mdx +52 -0
- package/src/web-components/interaction/form/BdsCombobox.stories.tsx +91 -0
- package/src/web-components/interaction/form/BdsFileInput.mdx +44 -0
- package/src/web-components/interaction/form/BdsFileInput.stories.tsx +84 -0
- package/src/web-components/interaction/form/BdsNumberInput.mdx +41 -0
- package/src/web-components/interaction/form/BdsNumberInput.stories.tsx +90 -0
- package/src/web-components/interaction/form/BdsRadio.mdx +41 -0
- package/src/web-components/interaction/form/BdsRadio.stories.tsx +90 -0
- package/src/web-components/interaction/form/BdsSegmentedControl.mdx +42 -0
- package/src/web-components/interaction/form/BdsSegmentedControl.stories.tsx +92 -0
- package/src/web-components/interaction/form/BdsSelect.mdx +38 -0
- package/src/web-components/interaction/form/BdsSelect.stories.tsx +93 -0
- package/src/web-components/interaction/form/BdsSlider.mdx +49 -0
- package/src/web-components/interaction/form/BdsSlider.stories.tsx +89 -0
- package/src/web-components/interaction/form/BdsSwitch.mdx +39 -0
- package/src/web-components/interaction/form/BdsSwitch.stories.tsx +73 -0
- package/src/web-components/interaction/form/BdsTextarea.mdx +41 -0
- package/src/web-components/interaction/form/BdsTextarea.stories.tsx +79 -0
- package/src/web-components/interaction/form/bds-checkbox.ts +1 -3
- package/src/web-components/interaction/form/bds-combobox.ts +1 -3
- package/src/web-components/interaction/form/bds-number-input.ts +3 -4
- package/src/web-components/interaction/form/bds-radio.ts +6 -12
- package/src/web-components/interaction/form/bds-segmented-control.ts +91 -20
- package/src/web-components/interaction/form/bds-select.ts +2 -4
- package/src/web-components/interaction/form/bds-switch.ts +3 -4
- package/src/web-components/interaction/form/bds-textarea.ts +1 -3
- package/src/web-components/ui/BdsAvatar.mdx +67 -0
- package/src/web-components/ui/BdsAvatar.stories.tsx +62 -0
- package/src/web-components/ui/BdsBreadcrumb.mdx +63 -0
- package/src/web-components/ui/BdsBreadcrumb.stories.tsx +59 -0
- package/src/web-components/ui/BdsCard.mdx +83 -0
- package/src/web-components/ui/BdsCard.stories.tsx +90 -0
- package/src/web-components/ui/BdsDescriptionList.mdx +67 -0
- package/src/web-components/ui/BdsDescriptionList.stories.tsx +79 -0
- package/src/web-components/ui/BdsIconWrapper.mdx +70 -0
- package/src/web-components/ui/BdsIconWrapper.stories.tsx +76 -0
- package/src/web-components/ui/BdsLink.mdx +75 -0
- package/src/web-components/ui/BdsLink.stories.tsx +64 -0
- package/src/web-components/ui/BdsLoading.mdx +62 -0
- package/src/web-components/ui/BdsLoading.stories.tsx +37 -0
- package/src/web-components/ui/BdsNotificationBanner.mdx +90 -0
- package/src/web-components/ui/BdsNotificationBanner.stories.tsx +93 -0
- package/src/web-components/ui/BdsProgress.mdx +63 -0
- package/src/web-components/ui/BdsProgress.stories.tsx +70 -0
- package/src/web-components/ui/BdsProgressCircle.mdx +64 -0
- package/src/web-components/ui/BdsProgressCircle.stories.tsx +69 -0
- package/src/web-components/ui/BdsRating.mdx +61 -0
- package/src/web-components/ui/BdsRating.stories.tsx +39 -0
- package/src/web-components/ui/BdsSectionHeader.mdx +69 -0
- package/src/web-components/ui/BdsSectionHeader.stories.tsx +56 -0
- package/src/web-components/ui/BdsSeparator.mdx +63 -0
- package/src/web-components/ui/BdsSeparator.stories.tsx +47 -0
- package/src/web-components/ui/BdsSkeleton.mdx +67 -0
- package/src/web-components/ui/BdsSkeleton.stories.tsx +50 -0
- package/src/web-components/ui/BdsTypography.mdx +83 -0
- package/src/web-components/ui/BdsTypography.stories.tsx +51 -0
- package/src/web-components/ui/bds-alert.ts +1 -2
- package/src/web-components/ui/bds-card.ts +1 -3
- package/src/web-components/ui/bds-notification-banner.ts +1 -2
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsSeparator.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# <bds-separator>
|
|
7
|
+
|
|
8
|
+
Framework-agnostic Separator custom element. Renders a horizontal or vertical visual divider.
|
|
9
|
+
|
|
10
|
+
> **Status: experimental** — API may change before stable release.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import '@boostdev/components/web-components';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Examples
|
|
19
|
+
|
|
20
|
+
### All variants
|
|
21
|
+
<Canvas of={Stories.AllVariants} />
|
|
22
|
+
|
|
23
|
+
### Horizontal
|
|
24
|
+
<Canvas of={Stories.Horizontal} />
|
|
25
|
+
|
|
26
|
+
### Vertical
|
|
27
|
+
<Canvas of={Stories.Vertical} />
|
|
28
|
+
|
|
29
|
+
## Props
|
|
30
|
+
|
|
31
|
+
<ArgTypes of={Stories} />
|
|
32
|
+
|
|
33
|
+
## Attributes
|
|
34
|
+
|
|
35
|
+
| Attribute | Type | Default | Description |
|
|
36
|
+
|-----------|------|---------|-------------|
|
|
37
|
+
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | Direction of the separator line |
|
|
38
|
+
|
|
39
|
+
## CSS Custom Properties
|
|
40
|
+
|
|
41
|
+
| Property | Description |
|
|
42
|
+
|----------|-------------|
|
|
43
|
+
| `--separator_color` | Line colour (defaults to `--bds-color_on-bg`) |
|
|
44
|
+
| `--separator_thickness` | Line thickness (default: `1px`) |
|
|
45
|
+
|
|
46
|
+
## Usage in plain HTML
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<!-- Horizontal (default) -->
|
|
50
|
+
<bds-separator></bds-separator>
|
|
51
|
+
|
|
52
|
+
<!-- Vertical — needs a height context -->
|
|
53
|
+
<div style="display: flex; align-items: center; height: 40px; gap: 16px;">
|
|
54
|
+
<span>Left</span>
|
|
55
|
+
<bds-separator orientation="vertical"></bds-separator>
|
|
56
|
+
<span>Right</span>
|
|
57
|
+
</div>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Accessibility
|
|
61
|
+
|
|
62
|
+
- Renders as `role="separator"` with `aria-orientation` set automatically
|
|
63
|
+
- Purely decorative — screen readers announce it as a separator landmark
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import '../index';
|
|
4
|
+
|
|
5
|
+
function BdsSeparator({ orientation }: { orientation?: 'horizontal' | 'vertical' }) {
|
|
6
|
+
return React.createElement('bds-separator', { orientation });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const meta = {
|
|
10
|
+
title: 'Web Components/UI/Separator',
|
|
11
|
+
component: BdsSeparator,
|
|
12
|
+
tags: ['!stable', 'experimental'],
|
|
13
|
+
parameters: { layout: 'centered' },
|
|
14
|
+
argTypes: {
|
|
15
|
+
orientation: { control: 'select', options: ['horizontal', 'vertical'] },
|
|
16
|
+
},
|
|
17
|
+
} satisfies Meta<typeof BdsSeparator>;
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
|
|
22
|
+
export const Horizontal: Story = { args: { orientation: 'horizontal' } };
|
|
23
|
+
|
|
24
|
+
export const Vertical: Story = {
|
|
25
|
+
render: () => (
|
|
26
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '16px', height: '40px' }}>
|
|
27
|
+
<span>Left</span>
|
|
28
|
+
<BdsSeparator orientation="vertical" />
|
|
29
|
+
<span>Right</span>
|
|
30
|
+
</div>
|
|
31
|
+
),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const AllVariants: Story = {
|
|
35
|
+
render: () => (
|
|
36
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px', width: '300px' }}>
|
|
37
|
+
<p style={{ margin: 0 }}>Content above horizontal separator</p>
|
|
38
|
+
<BdsSeparator orientation="horizontal" />
|
|
39
|
+
<p style={{ margin: 0 }}>Content below</p>
|
|
40
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '16px', height: '40px' }}>
|
|
41
|
+
<span>Left</span>
|
|
42
|
+
<BdsSeparator orientation="vertical" />
|
|
43
|
+
<span>Right</span>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
),
|
|
47
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsSkeleton.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# <bds-skeleton>
|
|
7
|
+
|
|
8
|
+
Framework-agnostic Skeleton loading placeholder. Shows a shimmer animation while content is loading. Size is set via inline `style` or container CSS — the element inherits its dimensions from the surrounding layout.
|
|
9
|
+
|
|
10
|
+
> **Status: experimental** — API may change before stable release.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import '@boostdev/components/web-components';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Examples
|
|
19
|
+
|
|
20
|
+
### Card layout skeleton
|
|
21
|
+
<Canvas of={Stories.AllVariants} />
|
|
22
|
+
|
|
23
|
+
### Text line
|
|
24
|
+
<Canvas of={Stories.TextLine} />
|
|
25
|
+
|
|
26
|
+
### Avatar placeholder
|
|
27
|
+
<Canvas of={Stories.Avatar} />
|
|
28
|
+
|
|
29
|
+
### Card placeholder
|
|
30
|
+
<Canvas of={Stories.Card} />
|
|
31
|
+
|
|
32
|
+
## Props
|
|
33
|
+
|
|
34
|
+
<ArgTypes of={Stories} />
|
|
35
|
+
|
|
36
|
+
## Attributes
|
|
37
|
+
|
|
38
|
+
This element has no attributes. Control dimensions via `style` or a CSS class on the host.
|
|
39
|
+
|
|
40
|
+
## CSS Custom Properties
|
|
41
|
+
|
|
42
|
+
The shimmer animation uses design tokens directly:
|
|
43
|
+
|
|
44
|
+
| Token | Description |
|
|
45
|
+
|-------|-------------|
|
|
46
|
+
| `--bds-color_grey--subtle` | Shimmer base colour |
|
|
47
|
+
| `--bds-color_bg` | Shimmer highlight colour |
|
|
48
|
+
| `--bds-border_radius--xs` | Default corner radius |
|
|
49
|
+
|
|
50
|
+
## Usage in plain HTML
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<!-- Text line -->
|
|
54
|
+
<bds-skeleton style="width: 200px; height: 1rem;"></bds-skeleton>
|
|
55
|
+
|
|
56
|
+
<!-- Avatar -->
|
|
57
|
+
<bds-skeleton style="width: 3rem; height: 3rem; border-radius: 50%;"></bds-skeleton>
|
|
58
|
+
|
|
59
|
+
<!-- Card block -->
|
|
60
|
+
<bds-skeleton style="width: 280px; height: 160px;"></bds-skeleton>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Accessibility
|
|
64
|
+
|
|
65
|
+
- Hidden from assistive technology via `aria-hidden="true"` — it is a purely visual placeholder
|
|
66
|
+
- Pair with a live region or announce loading state through other means if necessary
|
|
67
|
+
- Respects `prefers-reduced-motion`: shimmer animation is disabled for users who prefer reduced motion
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import '../index';
|
|
4
|
+
|
|
5
|
+
function BdsSkeleton({ style }: { style?: React.CSSProperties }) {
|
|
6
|
+
return React.createElement('bds-skeleton', { style });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const meta = {
|
|
10
|
+
title: 'Web Components/UI/Skeleton',
|
|
11
|
+
component: BdsSkeleton,
|
|
12
|
+
tags: ['!stable', 'experimental'],
|
|
13
|
+
parameters: { layout: 'centered' },
|
|
14
|
+
} satisfies Meta<typeof BdsSkeleton>;
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
17
|
+
type Story = StoryObj<typeof meta>;
|
|
18
|
+
|
|
19
|
+
export const TextLine: Story = {
|
|
20
|
+
render: () => <BdsSkeleton style={{ width: '200px', height: '1rem' }} />,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Heading: Story = {
|
|
24
|
+
render: () => <BdsSkeleton style={{ width: '300px', height: '1.75rem' }} />,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Avatar: Story = {
|
|
28
|
+
render: () => <BdsSkeleton style={{ width: '3rem', height: '3rem', borderRadius: '50%' }} />,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const Card: Story = {
|
|
32
|
+
render: () => <BdsSkeleton style={{ width: '280px', height: '160px' }} />,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const AllVariants: Story = {
|
|
36
|
+
render: () => (
|
|
37
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px', width: '280px' }}>
|
|
38
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
|
|
39
|
+
<BdsSkeleton style={{ width: '3rem', height: '3rem', borderRadius: '50%', flexShrink: 0 }} />
|
|
40
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '8px', flex: 1 }}>
|
|
41
|
+
<BdsSkeleton style={{ width: '100%', height: '1rem' }} />
|
|
42
|
+
<BdsSkeleton style={{ width: '60%', height: '0.75rem' }} />
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
<BdsSkeleton style={{ width: '100%', height: '120px' }} />
|
|
46
|
+
<BdsSkeleton style={{ width: '80%', height: '0.875rem' }} />
|
|
47
|
+
<BdsSkeleton style={{ width: '60%', height: '0.875rem' }} />
|
|
48
|
+
</div>
|
|
49
|
+
),
|
|
50
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsTypography.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# <bds-typography>
|
|
7
|
+
|
|
8
|
+
Framework-agnostic Typography custom element. Renders slotted content inside the appropriate semantic HTML element with the correct typographic styles.
|
|
9
|
+
|
|
10
|
+
> **Status: experimental** — API may change before stable release.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import '@boostdev/components/web-components';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Examples
|
|
19
|
+
|
|
20
|
+
### All variants
|
|
21
|
+
<Canvas of={Stories.AllVariants} />
|
|
22
|
+
|
|
23
|
+
### Heading 1
|
|
24
|
+
<Canvas of={Stories.H1} />
|
|
25
|
+
|
|
26
|
+
### Body
|
|
27
|
+
<Canvas of={Stories.Body} />
|
|
28
|
+
|
|
29
|
+
### Body small
|
|
30
|
+
<Canvas of={Stories.BodySmall} />
|
|
31
|
+
|
|
32
|
+
## Props
|
|
33
|
+
|
|
34
|
+
<ArgTypes of={Stories} />
|
|
35
|
+
|
|
36
|
+
## Attributes
|
|
37
|
+
|
|
38
|
+
| Attribute | Type | Default | Description |
|
|
39
|
+
|-----------|------|---------|-------------|
|
|
40
|
+
| `variant` | `"h1" \| "h2" \| "h3" \| "body" \| "body_s"` | `"body"` | Typographic style and semantic element |
|
|
41
|
+
| `component` | string | — | Override the rendered HTML tag (e.g. `"span"`, `"label"`) |
|
|
42
|
+
|
|
43
|
+
## Slots
|
|
44
|
+
|
|
45
|
+
| Slot | Description |
|
|
46
|
+
|------|-------------|
|
|
47
|
+
| `(default)` | Text content |
|
|
48
|
+
|
|
49
|
+
## Default tag mapping
|
|
50
|
+
|
|
51
|
+
| Variant | Rendered tag |
|
|
52
|
+
|---------|-------------|
|
|
53
|
+
| `h1` | `<h1>` |
|
|
54
|
+
| `h2` | `<h2>` |
|
|
55
|
+
| `h3` | `<h3>` |
|
|
56
|
+
| `body` | `<p>` |
|
|
57
|
+
| `body_s` | `<p>` |
|
|
58
|
+
|
|
59
|
+
## CSS Custom Properties
|
|
60
|
+
|
|
61
|
+
| Property | Description |
|
|
62
|
+
|----------|-------------|
|
|
63
|
+
| `--typography_color` | Text colour (defaults to `--bds-color_on-bg`) |
|
|
64
|
+
|
|
65
|
+
## Usage in plain HTML
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<bds-typography variant="h1">Page title</bds-typography>
|
|
69
|
+
|
|
70
|
+
<bds-typography variant="body">
|
|
71
|
+
A paragraph of body text.
|
|
72
|
+
</bds-typography>
|
|
73
|
+
|
|
74
|
+
<!-- Override tag while keeping style -->
|
|
75
|
+
<bds-typography variant="body_s" component="span">
|
|
76
|
+
Inline small text
|
|
77
|
+
</bds-typography>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Accessibility
|
|
81
|
+
|
|
82
|
+
- Uses the correct semantic HTML element by default — always prefer semantic variants over overriding `component`
|
|
83
|
+
- Use `component` only when the semantic element must differ from the visual style (e.g. a `<span>` styled as `body_s` inside a heading)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import type { TypographyVariant } from './bds-typography';
|
|
4
|
+
import '../index';
|
|
5
|
+
|
|
6
|
+
function BdsTypography({
|
|
7
|
+
variant,
|
|
8
|
+
component,
|
|
9
|
+
children,
|
|
10
|
+
}: {
|
|
11
|
+
variant?: TypographyVariant;
|
|
12
|
+
component?: string;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
}) {
|
|
15
|
+
return React.createElement('bds-typography', { variant, component }, children);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const meta = {
|
|
19
|
+
title: 'Web Components/UI/Typography',
|
|
20
|
+
component: BdsTypography,
|
|
21
|
+
tags: ['!stable', 'experimental'],
|
|
22
|
+
parameters: { layout: 'padded' },
|
|
23
|
+
argTypes: {
|
|
24
|
+
variant: { control: 'select', options: ['h1', 'h2', 'h3', 'body', 'body_s'] },
|
|
25
|
+
},
|
|
26
|
+
} satisfies Meta<typeof BdsTypography>;
|
|
27
|
+
|
|
28
|
+
export default meta;
|
|
29
|
+
type Story = StoryObj<typeof meta>;
|
|
30
|
+
|
|
31
|
+
export const H1: Story = { args: { variant: 'h1', children: 'Heading level 1' } };
|
|
32
|
+
export const H2: Story = { args: { variant: 'h2', children: 'Heading level 2' } };
|
|
33
|
+
export const H3: Story = { args: { variant: 'h3', children: 'Heading level 3' } };
|
|
34
|
+
export const Body: Story = { args: { variant: 'body', children: 'Body text — the default paragraph style for reading comfort.' } };
|
|
35
|
+
export const BodySmall: Story = { args: { variant: 'body_s', children: 'Small body text — useful for captions and helper text.' } };
|
|
36
|
+
|
|
37
|
+
export const AllVariants: Story = {
|
|
38
|
+
render: () => (
|
|
39
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
|
|
40
|
+
{(['h1', 'h2', 'h3', 'body', 'body_s'] as const).map(v => (
|
|
41
|
+
<BdsTypography key={v} variant={v}>
|
|
42
|
+
{v === 'h1' && 'Heading level 1'}
|
|
43
|
+
{v === 'h2' && 'Heading level 2'}
|
|
44
|
+
{v === 'h3' && 'Heading level 3'}
|
|
45
|
+
{v === 'body' && 'Body text — comfortable reading size for paragraphs.'}
|
|
46
|
+
{v === 'body_s' && 'Small body — captions, labels, and secondary text.'}
|
|
47
|
+
</BdsTypography>
|
|
48
|
+
))}
|
|
49
|
+
</div>
|
|
50
|
+
),
|
|
51
|
+
};
|
|
@@ -110,8 +110,7 @@ export class BdsAlert extends LitElement {
|
|
|
110
110
|
transition: var(--bds-animation_transition);
|
|
111
111
|
border-radius: 50%;
|
|
112
112
|
--bdc_color: currentcolor;
|
|
113
|
-
|
|
114
|
-
outline-offset: var(--bdc-outline_offset);
|
|
113
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color);
|
|
115
114
|
}
|
|
116
115
|
|
|
117
116
|
.dismiss svg {
|
|
@@ -53,9 +53,7 @@ export class BdsCard extends LitElement {
|
|
|
53
53
|
|
|
54
54
|
.card.--outlined {
|
|
55
55
|
--bdc_color: currentcolor;
|
|
56
|
-
|
|
57
|
-
outline-offset: var(--bdc-outline_offset);
|
|
58
|
-
box-shadow: var(--bds-shadow_s);
|
|
56
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color), var(--bds-shadow_s);
|
|
59
57
|
}
|
|
60
58
|
|
|
61
59
|
.card.--padding-none { padding: 0; }
|
|
@@ -91,8 +91,7 @@ export class BdsNotificationBanner extends LitElement {
|
|
|
91
91
|
border-radius: 50%;
|
|
92
92
|
transition: var(--bds-animation_transition);
|
|
93
93
|
--bdc_color: currentcolor;
|
|
94
|
-
|
|
95
|
-
outline-offset: var(--bdc-outline_offset);
|
|
94
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color);
|
|
96
95
|
}
|
|
97
96
|
|
|
98
97
|
.dismiss svg {
|