@boostdev/design-system-components 1.1.2 → 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 +38 -14
- package/dist/client.cjs +85 -103
- package/dist/client.css +610 -601
- package/dist/client.d.cts +13 -16
- package/dist/client.d.ts +13 -16
- package/dist/client.js +95 -113
- package/dist/index.cjs +85 -103
- package/dist/index.css +610 -601
- package/dist/index.d.cts +13 -16
- package/dist/index.d.ts +13 -16
- package/dist/index.js +95 -113
- 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-K5CE6HSB.js → chunk-2FGATTGT.js} +79 -17
- package/dist/web-components/{chunk-O4UFI2RX.js → chunk-3REOIRDW.js} +13 -11
- package/dist/web-components/{chunk-5IPHEONG.js → chunk-6I2DBFQ7.js} +1 -0
- 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-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-CJ5ZOO42.js → chunk-OCODKRVZ.js} +68 -44
- 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.d.ts +571 -1
- package/dist/web-components/index.js +1515 -18
- 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-collapsible.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 +48 -25
- package/src/components/interaction/Drawer/Drawer.tsx +21 -17
- 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 +74 -25
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.module.css +65 -36
- 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/stories/Introduction.mdx +2 -1
- package/src/web-components/globals.ts +3 -3
- package/src/web-components/index.ts +12 -0
- package/src/web-components/interaction/BdsAccordion.mdx +103 -0
- package/src/web-components/interaction/BdsAccordion.stories.tsx +94 -0
- package/src/web-components/interaction/BdsCollapsible.mdx +116 -0
- package/src/web-components/interaction/BdsCollapsible.stories.tsx +68 -0
- package/src/web-components/interaction/BdsDialog.mdx +110 -0
- package/src/web-components/interaction/BdsDialog.stories.tsx +157 -0
- package/src/web-components/interaction/BdsDrawer.mdx +108 -0
- package/src/web-components/interaction/BdsDrawer.stories.tsx +196 -0
- 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 +90 -0
- package/src/web-components/interaction/BdsSkipLink.stories.tsx +68 -0
- package/src/web-components/interaction/BdsTabs.mdx +117 -0
- package/src/web-components/interaction/BdsTabs.stories.tsx +94 -0
- package/src/web-components/interaction/BdsTooltip.mdx +104 -0
- package/src/web-components/interaction/BdsTooltip.stories.tsx +87 -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-collapsible.ts +1 -0
- package/src/web-components/interaction/bds-dialog.ts +2 -5
- package/src/web-components/interaction/bds-drawer.ts +70 -44
- 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 +76 -0
- package/src/web-components/interaction/form/BdsCheckbox.stories.tsx +72 -0
- 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 +71 -0
- package/src/web-components/interaction/form/BdsCombobox.stories.tsx +93 -0
- package/src/web-components/interaction/form/BdsFileInput.mdx +79 -0
- package/src/web-components/interaction/form/BdsFileInput.stories.tsx +69 -0
- 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 +70 -0
- package/src/web-components/interaction/form/BdsNumberInput.stories.tsx +68 -0
- package/src/web-components/interaction/form/BdsRadio.mdx +72 -0
- package/src/web-components/interaction/form/BdsRadio.stories.tsx +58 -0
- 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 +95 -0
- package/src/web-components/interaction/form/BdsSegmentedControl.stories.tsx +102 -0
- package/src/web-components/interaction/form/BdsSelect.mdx +76 -0
- package/src/web-components/interaction/form/BdsSelect.stories.tsx +84 -0
- package/src/web-components/interaction/form/BdsSlider.mdx +77 -0
- package/src/web-components/interaction/form/BdsSlider.stories.tsx +68 -0
- package/src/web-components/interaction/form/BdsSwitch.mdx +72 -0
- package/src/web-components/interaction/form/BdsSwitch.stories.tsx +58 -0
- package/src/web-components/interaction/form/BdsTextarea.mdx +73 -0
- package/src/web-components/interaction/form/BdsTextarea.stories.tsx +70 -0
- 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-checkbox.ts +1 -3
- package/src/web-components/interaction/form/bds-combobox.ts +1 -3
- 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-number-input.ts +3 -4
- 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-radio.ts +6 -12
- package/src/web-components/interaction/form/bds-segmented-control.ts +96 -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 +76 -0
- package/src/web-components/ui/BdsAvatar.stories.tsx +48 -0
- package/src/web-components/ui/BdsBreadcrumb.mdx +66 -0
- package/src/web-components/ui/BdsBreadcrumb.stories.tsx +49 -0
- 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 +88 -0
- package/src/web-components/ui/BdsCard.stories.tsx +67 -0
- 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 +64 -0
- package/src/web-components/ui/BdsDescriptionList.stories.tsx +64 -0
- package/src/web-components/ui/BdsIconWrapper.mdx +70 -0
- package/src/web-components/ui/BdsIconWrapper.stories.tsx +81 -0
- package/src/web-components/ui/BdsLink.mdx +79 -0
- package/src/web-components/ui/BdsLink.stories.tsx +63 -0
- package/src/web-components/ui/BdsLoading.mdx +58 -0
- package/src/web-components/ui/BdsLoading.stories.tsx +35 -0
- package/src/web-components/ui/BdsNotificationBanner.mdx +85 -0
- package/src/web-components/ui/BdsNotificationBanner.stories.tsx +84 -0
- 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 +70 -0
- package/src/web-components/ui/BdsProgress.stories.tsx +96 -0
- package/src/web-components/ui/BdsProgressCircle.mdx +70 -0
- package/src/web-components/ui/BdsProgressCircle.stories.tsx +57 -0
- package/src/web-components/ui/BdsRating.mdx +61 -0
- package/src/web-components/ui/BdsRating.stories.tsx +45 -0
- package/src/web-components/ui/BdsSectionHeader.mdx +72 -0
- package/src/web-components/ui/BdsSectionHeader.stories.tsx +54 -0
- package/src/web-components/ui/BdsSeparator.mdx +77 -0
- package/src/web-components/ui/BdsSeparator.stories.tsx +55 -0
- package/src/web-components/ui/BdsSkeleton.mdx +61 -0
- package/src/web-components/ui/BdsSkeleton.stories.tsx +50 -0
- 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 +74 -0
- package/src/web-components/ui/BdsTypography.stories.tsx +52 -0
- package/src/web-components/ui/bds-alert.ts +1 -2
- 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-card.ts +1 -3
- 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-notification-banner.ts +1 -2
- 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
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsPagination.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# <bds-pagination>
|
|
7
|
+
|
|
8
|
+
Framework-agnostic Pagination navigation custom element. Renders previous/next buttons and a page number list with smart ellipsis truncation.
|
|
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
|
+
## When to use
|
|
19
|
+
|
|
20
|
+
- Below paginated lists or tables to let users navigate between pages
|
|
21
|
+
- Listen to `bds-page-change` to update your data layer when the page changes
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
### Default (page 3 of 10)
|
|
26
|
+
<Canvas of={Stories.Default} />
|
|
27
|
+
|
|
28
|
+
### First page
|
|
29
|
+
<Canvas of={Stories.FirstPage} />
|
|
30
|
+
|
|
31
|
+
### Last page
|
|
32
|
+
<Canvas of={Stories.LastPage} />
|
|
33
|
+
|
|
34
|
+
### Few pages
|
|
35
|
+
<Canvas of={Stories.FewPages} />
|
|
36
|
+
|
|
37
|
+
### Many pages (with ellipsis)
|
|
38
|
+
<Canvas of={Stories.ManyPages} />
|
|
39
|
+
|
|
40
|
+
## Props
|
|
41
|
+
|
|
42
|
+
<ArgTypes of={Stories} />
|
|
43
|
+
|
|
44
|
+
## Attributes
|
|
45
|
+
|
|
46
|
+
| Attribute | Type | Default | Description |
|
|
47
|
+
|-----------|------|---------|-------------|
|
|
48
|
+
| `current-page` | number | `1` | Active page number (1-based) |
|
|
49
|
+
| `total-pages` | number | `1` | Total number of pages |
|
|
50
|
+
|
|
51
|
+
## Events
|
|
52
|
+
|
|
53
|
+
| Event | Detail | Description |
|
|
54
|
+
|-------|--------|-------------|
|
|
55
|
+
| `bds-page-change` | `{ page: number }` | Fired when the user navigates to a different page |
|
|
56
|
+
|
|
57
|
+
## Usage in plain HTML
|
|
58
|
+
|
|
59
|
+
```html
|
|
60
|
+
<bds-pagination current-page="3" total-pages="10"></bds-pagination>
|
|
61
|
+
|
|
62
|
+
<script>
|
|
63
|
+
document.querySelector('bds-pagination')
|
|
64
|
+
.addEventListener('bds-page-change', e => {
|
|
65
|
+
console.log('Navigate to page', e.detail.page);
|
|
66
|
+
});
|
|
67
|
+
</script>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Accessibility
|
|
71
|
+
|
|
72
|
+
- Wrapped in `<nav aria-label="Pagination">` with an `<ul>` list structure
|
|
73
|
+
- Active page button carries `aria-current="page"`
|
|
74
|
+
- Previous/Next buttons have descriptive `aria-label` values and are `disabled` at the boundaries
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import '../index'; // auto-registers all custom elements
|
|
4
|
+
|
|
5
|
+
function BdsPagination({
|
|
6
|
+
currentPage = 1,
|
|
7
|
+
totalPages = 1,
|
|
8
|
+
}: {
|
|
9
|
+
currentPage?: number;
|
|
10
|
+
totalPages?: number;
|
|
11
|
+
}) {
|
|
12
|
+
return React.createElement('bds-pagination', {
|
|
13
|
+
'current-page': currentPage,
|
|
14
|
+
'total-pages': totalPages,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const meta = {
|
|
19
|
+
title: 'Web Components/UI/Pagination',
|
|
20
|
+
component: BdsPagination,
|
|
21
|
+
tags: ['!stable', 'experimental'],
|
|
22
|
+
parameters: { layout: 'centered' },
|
|
23
|
+
argTypes: {
|
|
24
|
+
currentPage: { control: { type: 'number', min: 1 } },
|
|
25
|
+
totalPages: { control: { type: 'number', min: 1 } },
|
|
26
|
+
},
|
|
27
|
+
} satisfies Meta<typeof BdsPagination>;
|
|
28
|
+
|
|
29
|
+
export default meta;
|
|
30
|
+
type Story = StoryObj<typeof meta>;
|
|
31
|
+
|
|
32
|
+
export const Default: Story = { args: { currentPage: 3, totalPages: 10 } };
|
|
33
|
+
export const FirstPage: Story = { args: { currentPage: 1, totalPages: 10 } };
|
|
34
|
+
export const LastPage: Story = { args: { currentPage: 10, totalPages: 10 } };
|
|
35
|
+
export const FewPages: Story = { args: { currentPage: 2, totalPages: 4 } };
|
|
36
|
+
export const ManyPages: Story = { args: { currentPage: 7, totalPages: 20 } };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsProgress.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# <bds-progress>
|
|
7
|
+
|
|
8
|
+
Framework-agnostic horizontal Progress bar custom element. Tracks progress toward a goal with optional label and percentage display.
|
|
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
|
+
## When to use
|
|
19
|
+
|
|
20
|
+
- File uploads, multi-step forms, or any linear task with a measurable completion percentage
|
|
21
|
+
- Add `show-label` to make progress visible without screen-reader-only text
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
### All sizes
|
|
26
|
+
<Canvas of={Stories.AllSizes} />
|
|
27
|
+
|
|
28
|
+
### Default
|
|
29
|
+
<Canvas of={Stories.Default} />
|
|
30
|
+
|
|
31
|
+
### With label
|
|
32
|
+
<Canvas of={Stories.WithLabel} />
|
|
33
|
+
|
|
34
|
+
### Small
|
|
35
|
+
<Canvas of={Stories.Small} />
|
|
36
|
+
|
|
37
|
+
### Large
|
|
38
|
+
<Canvas of={Stories.Large} />
|
|
39
|
+
|
|
40
|
+
## Props
|
|
41
|
+
|
|
42
|
+
<ArgTypes of={Stories} />
|
|
43
|
+
|
|
44
|
+
## Attributes
|
|
45
|
+
|
|
46
|
+
| Attribute | Type | Default | Description |
|
|
47
|
+
|-----------|------|---------|-------------|
|
|
48
|
+
| `value` | number | `0` | Current progress value |
|
|
49
|
+
| `max` | number | `100` | Maximum value |
|
|
50
|
+
| `label` | string | — | Accessible label; also shown above the bar when `show-label` is set |
|
|
51
|
+
| `show-label` | boolean | `false` | Displays label text and percentage above the bar |
|
|
52
|
+
| `size` | `"small" \| "medium" \| "large"` | `"medium"` | Track height |
|
|
53
|
+
|
|
54
|
+
## CSS Custom Properties
|
|
55
|
+
|
|
56
|
+
| Property | Description |
|
|
57
|
+
|----------|-------------|
|
|
58
|
+
| `--progress_color-active` | Fill colour of the progress bar |
|
|
59
|
+
|
|
60
|
+
## Usage in plain HTML
|
|
61
|
+
|
|
62
|
+
```html
|
|
63
|
+
<bds-progress value="60" label="Upload progress" show-label></bds-progress>
|
|
64
|
+
<bds-progress value="30" size="small" label="Loading"></bds-progress>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Accessibility
|
|
68
|
+
|
|
69
|
+
- Renders with `role="progressbar"`, `aria-valuenow`, `aria-valuemin`, and `aria-valuemax`
|
|
70
|
+
- Always provide a `label` to give the bar a meaningful accessible name
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import '../index'; // auto-registers all custom elements
|
|
4
|
+
|
|
5
|
+
function BdsProgress({
|
|
6
|
+
value = 0,
|
|
7
|
+
max = 100,
|
|
8
|
+
label,
|
|
9
|
+
showLabel,
|
|
10
|
+
size = 'medium',
|
|
11
|
+
}: {
|
|
12
|
+
value?: number;
|
|
13
|
+
max?: number;
|
|
14
|
+
label?: string;
|
|
15
|
+
showLabel?: boolean;
|
|
16
|
+
size?: 'small' | 'medium' | 'large';
|
|
17
|
+
}) {
|
|
18
|
+
return React.createElement('bds-progress', {
|
|
19
|
+
value,
|
|
20
|
+
max,
|
|
21
|
+
label,
|
|
22
|
+
'show-label': showLabel || undefined,
|
|
23
|
+
size,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const meta = {
|
|
28
|
+
title: 'Web Components/UI/Progress',
|
|
29
|
+
component: BdsProgress,
|
|
30
|
+
tags: ['!stable', 'experimental'],
|
|
31
|
+
parameters: { layout: 'centered' },
|
|
32
|
+
argTypes: {
|
|
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' },
|
|
38
|
+
},
|
|
39
|
+
} satisfies Meta<typeof BdsProgress>;
|
|
40
|
+
|
|
41
|
+
export default meta;
|
|
42
|
+
type Story = StoryObj<typeof meta>;
|
|
43
|
+
|
|
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
|
+
};
|
|
58
|
+
|
|
59
|
+
export const WithLabel: Story = {
|
|
60
|
+
render: () => (
|
|
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
|
+
})}
|
|
68
|
+
</div>
|
|
69
|
+
),
|
|
70
|
+
};
|
|
71
|
+
|
|
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
|
+
),
|
|
96
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsProgressCircle.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# <bds-progress-circle>
|
|
7
|
+
|
|
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
|
+
|
|
10
|
+
> **Status: experimental** — API may change before stable release.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import '@boostdev/components/web-components';
|
|
16
|
+
```
|
|
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
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
### All sizes
|
|
26
|
+
<Canvas of={Stories.AllSizes} />
|
|
27
|
+
|
|
28
|
+
### Default
|
|
29
|
+
<Canvas of={Stories.Default} />
|
|
30
|
+
|
|
31
|
+
### With centred value
|
|
32
|
+
<Canvas of={Stories.WithValue} />
|
|
33
|
+
|
|
34
|
+
### Small
|
|
35
|
+
<Canvas of={Stories.Small} />
|
|
36
|
+
|
|
37
|
+
### Large
|
|
38
|
+
<Canvas of={Stories.Large} />
|
|
39
|
+
|
|
40
|
+
## Props
|
|
41
|
+
|
|
42
|
+
<ArgTypes of={Stories} />
|
|
43
|
+
|
|
44
|
+
## Attributes
|
|
45
|
+
|
|
46
|
+
| Attribute | Type | Default | Description |
|
|
47
|
+
|-----------|------|---------|-------------|
|
|
48
|
+
| `value` | number | `0` | Current progress value |
|
|
49
|
+
| `max` | number | `100` | Maximum value |
|
|
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`) |
|
|
53
|
+
|
|
54
|
+
## CSS Custom Properties
|
|
55
|
+
|
|
56
|
+
| Property | Description |
|
|
57
|
+
|----------|-------------|
|
|
58
|
+
| `--progressCircle_color-active` | Stroke colour of the filled arc |
|
|
59
|
+
|
|
60
|
+
## Usage in plain HTML
|
|
61
|
+
|
|
62
|
+
```html
|
|
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>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Accessibility
|
|
68
|
+
|
|
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
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import '../index'; // auto-registers all custom elements
|
|
4
|
+
|
|
5
|
+
function BdsProgressCircle({
|
|
6
|
+
value = 0,
|
|
7
|
+
max = 100,
|
|
8
|
+
label,
|
|
9
|
+
showValue,
|
|
10
|
+
size = 'medium',
|
|
11
|
+
}: {
|
|
12
|
+
value?: number;
|
|
13
|
+
max?: number;
|
|
14
|
+
label?: string;
|
|
15
|
+
showValue?: boolean;
|
|
16
|
+
size?: 'small' | 'medium' | 'large';
|
|
17
|
+
}) {
|
|
18
|
+
return React.createElement('bds-progress-circle', {
|
|
19
|
+
value,
|
|
20
|
+
max,
|
|
21
|
+
label,
|
|
22
|
+
'show-value': showValue || undefined,
|
|
23
|
+
size,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const meta = {
|
|
28
|
+
title: 'Web Components/UI/ProgressCircle',
|
|
29
|
+
component: BdsProgressCircle,
|
|
30
|
+
tags: ['!stable', 'experimental'],
|
|
31
|
+
parameters: { layout: 'centered' },
|
|
32
|
+
argTypes: {
|
|
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' },
|
|
38
|
+
},
|
|
39
|
+
} satisfies Meta<typeof BdsProgressCircle>;
|
|
40
|
+
|
|
41
|
+
export default meta;
|
|
42
|
+
type Story = StoryObj<typeof meta>;
|
|
43
|
+
|
|
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' } };
|
|
48
|
+
|
|
49
|
+
export const AllSizes: Story = {
|
|
50
|
+
render: () => (
|
|
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' })}
|
|
55
|
+
</div>
|
|
56
|
+
),
|
|
57
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsRating.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# <bds-rating>
|
|
7
|
+
|
|
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
|
+
|
|
10
|
+
> **Status: experimental** — API may change before stable release.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import '@boostdev/components/web-components';
|
|
16
|
+
```
|
|
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
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
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} />
|
|
33
|
+
|
|
34
|
+
### Empty (0 of 5)
|
|
35
|
+
<Canvas of={Stories.Empty} />
|
|
36
|
+
|
|
37
|
+
### Custom max (7 of 10)
|
|
38
|
+
<Canvas of={Stories.CustomMax} />
|
|
39
|
+
|
|
40
|
+
## Props
|
|
41
|
+
|
|
42
|
+
<ArgTypes of={Stories} />
|
|
43
|
+
|
|
44
|
+
## Attributes
|
|
45
|
+
|
|
46
|
+
| Attribute | Type | Default | Description |
|
|
47
|
+
|-----------|------|---------|-------------|
|
|
48
|
+
| `value` | number | `0` | Number of filled stars |
|
|
49
|
+
| `max` | number | `5` | Total number of stars displayed |
|
|
50
|
+
|
|
51
|
+
## Usage in plain HTML
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<bds-rating value="3"></bds-rating>
|
|
55
|
+
<bds-rating value="4" max="10"></bds-rating>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Accessibility
|
|
59
|
+
|
|
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
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import '../index'; // auto-registers all custom elements
|
|
4
|
+
|
|
5
|
+
function BdsRating({
|
|
6
|
+
value = 0,
|
|
7
|
+
max = 5,
|
|
8
|
+
}: {
|
|
9
|
+
value?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
}) {
|
|
12
|
+
return React.createElement('bds-rating', { value, max });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const meta = {
|
|
16
|
+
title: 'Web Components/UI/Rating',
|
|
17
|
+
component: BdsRating,
|
|
18
|
+
tags: ['!stable', 'experimental'],
|
|
19
|
+
parameters: { layout: 'centered' },
|
|
20
|
+
argTypes: {
|
|
21
|
+
value: { control: { type: 'range', min: 0, max: 10 } },
|
|
22
|
+
max: { control: 'number' },
|
|
23
|
+
},
|
|
24
|
+
} satisfies Meta<typeof BdsRating>;
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
type Story = StoryObj<typeof meta>;
|
|
28
|
+
|
|
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 } };
|
|
33
|
+
|
|
34
|
+
export const AllValues: Story = {
|
|
35
|
+
render: () => (
|
|
36
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
|
37
|
+
{[1, 2, 3, 4, 5].map(v => (
|
|
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 })}
|
|
41
|
+
</div>
|
|
42
|
+
))}
|
|
43
|
+
</div>
|
|
44
|
+
),
|
|
45
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsSectionHeader.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# <bds-section-header>
|
|
7
|
+
|
|
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
|
+
|
|
10
|
+
> **Status: experimental** — API may change before stable release.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import '@boostdev/components/web-components';
|
|
16
|
+
```
|
|
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
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
### All sizes
|
|
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} />
|
|
37
|
+
|
|
38
|
+
### Centered
|
|
39
|
+
<Canvas of={Stories.Centered} />
|
|
40
|
+
|
|
41
|
+
### Title only
|
|
42
|
+
<Canvas of={Stories.TitleOnly} />
|
|
43
|
+
|
|
44
|
+
## Props
|
|
45
|
+
|
|
46
|
+
<ArgTypes of={Stories} />
|
|
47
|
+
|
|
48
|
+
## Attributes
|
|
49
|
+
|
|
50
|
+
| Attribute | Type | Default | Description |
|
|
51
|
+
|-----------|------|---------|-------------|
|
|
52
|
+
| `title` | string | — | Heading text (required) |
|
|
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 |
|
|
57
|
+
|
|
58
|
+
## Usage in plain HTML
|
|
59
|
+
|
|
60
|
+
```html
|
|
61
|
+
<bds-section-header
|
|
62
|
+
title="Our Products"
|
|
63
|
+
subtitle="Browse the full range"
|
|
64
|
+
size="large"
|
|
65
|
+
alignment="center">
|
|
66
|
+
</bds-section-header>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Accessibility
|
|
70
|
+
|
|
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`
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import '../index'; // auto-registers all custom elements
|
|
4
|
+
|
|
5
|
+
function BdsSectionHeader({
|
|
6
|
+
title = '',
|
|
7
|
+
subtitle,
|
|
8
|
+
alignment = 'start',
|
|
9
|
+
size = 'medium',
|
|
10
|
+
titleAs,
|
|
11
|
+
}: {
|
|
12
|
+
title?: string;
|
|
13
|
+
subtitle?: string;
|
|
14
|
+
alignment?: 'start' | 'center' | 'end';
|
|
15
|
+
size?: 'small' | 'medium' | 'large';
|
|
16
|
+
titleAs?: string;
|
|
17
|
+
}) {
|
|
18
|
+
return React.createElement('bds-section-header', { title, subtitle, alignment, size, 'title-as': titleAs });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const meta = {
|
|
22
|
+
title: 'Web Components/UI/SectionHeader',
|
|
23
|
+
component: BdsSectionHeader,
|
|
24
|
+
tags: ['!stable', 'experimental'],
|
|
25
|
+
parameters: { layout: 'padded' },
|
|
26
|
+
argTypes: {
|
|
27
|
+
alignment: { control: 'select', options: ['start', 'center', 'end'] },
|
|
28
|
+
size: { control: 'select', options: ['small', 'medium', 'large'] },
|
|
29
|
+
titleAs: { control: 'text' },
|
|
30
|
+
},
|
|
31
|
+
} satisfies Meta<typeof BdsSectionHeader>;
|
|
32
|
+
|
|
33
|
+
export default meta;
|
|
34
|
+
type Story = StoryObj<typeof meta>;
|
|
35
|
+
|
|
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' } };
|
|
45
|
+
|
|
46
|
+
export const AllSizes: Story = {
|
|
47
|
+
render: () => (
|
|
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' })}
|
|
52
|
+
</div>
|
|
53
|
+
),
|
|
54
|
+
};
|