@boostdev/design-system-components 1.0.3 → 1.1.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 +51 -10
- package/dist/client.cjs +350 -174
- package/dist/client.css +751 -647
- package/dist/client.d.cts +62 -97
- package/dist/client.d.ts +62 -97
- package/dist/client.js +377 -211
- package/dist/index.cjs +350 -174
- package/dist/index.css +751 -647
- package/dist/index.d.cts +62 -97
- package/dist/index.d.ts +62 -97
- package/dist/index.js +377 -211
- package/dist/native/index.cjs +991 -0
- package/dist/native/index.d.cts +208 -0
- package/dist/native/index.d.ts +208 -0
- package/dist/native/index.js +968 -0
- package/dist/web-components.d.ts +304 -0
- package/dist/web-components.js +1978 -0
- package/package.json +27 -5
- package/src/components/interaction/Button/Button.module.css +11 -8
- package/src/components/interaction/Button/Button.native.mdx +72 -0
- package/src/components/interaction/Button/Button.native.spec.tsx +35 -0
- package/src/components/interaction/Button/Button.native.stories.tsx +42 -0
- package/src/components/interaction/Button/Button.native.tsx +95 -0
- package/src/components/interaction/Button/Button.stories.tsx +1 -1
- package/src/components/interaction/Button/Button.tsx +2 -2
- package/src/components/interaction/Command/Command.mdx +16 -0
- package/src/components/interaction/Command/Command.module.css +7 -7
- package/src/components/interaction/Command/Command.spec.tsx +37 -0
- package/src/components/interaction/Command/Command.stories.tsx +1 -1
- package/src/components/interaction/Command/Command.tsx +39 -4
- package/src/components/interaction/Dialog/Dialog.module.css +10 -13
- package/src/components/interaction/Dialog/Dialog.spec.tsx +53 -1
- package/src/components/interaction/Dialog/Dialog.stories.tsx +18 -1
- package/src/components/interaction/Dialog/Dialog.tsx +52 -18
- package/src/components/interaction/Drawer/Drawer.mdx +14 -0
- package/src/components/interaction/Drawer/Drawer.module.css +11 -11
- package/src/components/interaction/Drawer/Drawer.spec.tsx +48 -1
- package/src/components/interaction/Drawer/Drawer.stories.tsx +1 -1
- package/src/components/interaction/Drawer/Drawer.tsx +40 -6
- package/src/components/interaction/DropdownMenu/DropdownMenu.module.css +6 -6
- package/src/components/interaction/DropdownMenu/DropdownMenu.stories.tsx +1 -1
- package/src/components/interaction/DropdownMenu/DropdownMenu.tsx +2 -2
- package/src/components/interaction/Popover/Popover.mdx +17 -0
- package/src/components/interaction/Popover/Popover.module.css +132 -16
- package/src/components/interaction/Popover/Popover.spec.tsx +119 -20
- package/src/components/interaction/Popover/Popover.stories.tsx +1 -1
- package/src/components/interaction/Popover/Popover.tsx +69 -29
- package/src/components/interaction/Rating/Rating.stories.tsx +1 -1
- package/src/components/interaction/Rating/Rating.tsx +2 -2
- package/src/components/interaction/Toast/Toast.module.css +13 -8
- package/src/components/interaction/Toast/Toast.spec.tsx +21 -0
- package/src/components/interaction/Toast/Toast.stories.tsx +1 -1
- package/src/components/interaction/Toast/Toast.tsx +22 -2
- package/src/components/interaction/form/Checkbox/Checkbox.mdx +2 -2
- package/src/components/interaction/form/Checkbox/Checkbox.module.css +9 -9
- package/src/components/interaction/form/Checkbox/Checkbox.native.mdx +74 -0
- package/src/components/interaction/form/Checkbox/Checkbox.native.spec.tsx +42 -0
- package/src/components/interaction/form/Checkbox/Checkbox.native.stories.tsx +36 -0
- package/src/components/interaction/form/Checkbox/Checkbox.native.tsx +80 -0
- package/src/components/interaction/form/Checkbox/Checkbox.stories.tsx +1 -1
- package/src/components/interaction/form/Checkbox/Checkbox.tsx +2 -2
- package/src/components/interaction/form/CheckboxGroup/CheckboxGroup.mdx +44 -0
- package/src/components/interaction/form/CheckboxGroup/CheckboxGroup.stories.tsx +1 -1
- package/src/components/interaction/form/CheckboxGroup/CheckboxGroup.tsx +2 -2
- package/src/components/interaction/form/Combobox/Combobox.mdx +21 -0
- package/src/components/interaction/form/Combobox/Combobox.module.css +8 -9
- package/src/components/interaction/form/Combobox/Combobox.stories.tsx +1 -1
- package/src/components/interaction/form/Combobox/Combobox.tsx +2 -2
- package/src/components/interaction/form/FileInput/FileInput.mdx +14 -0
- package/src/components/interaction/form/FileInput/FileInput.module.css +5 -5
- package/src/components/interaction/form/FileInput/FileInput.stories.tsx +1 -1
- package/src/components/interaction/form/FileInput/FileInput.tsx +2 -2
- package/src/components/interaction/form/FormInput/FormInput.stories.tsx +1 -1
- package/src/components/interaction/form/FormInput/FormInput.tsx +2 -2
- package/src/components/interaction/form/NumberInput/NumberInput.mdx +16 -0
- package/src/components/interaction/form/NumberInput/NumberInput.module.css +1 -1
- package/src/components/interaction/form/NumberInput/NumberInput.stories.tsx +1 -1
- package/src/components/interaction/form/NumberInput/NumberInput.tsx +2 -2
- package/src/components/interaction/form/Radio/Radio.mdx +3 -3
- package/src/components/interaction/form/Radio/Radio.module.css +9 -9
- package/src/components/interaction/form/Radio/Radio.native.stories.tsx +46 -0
- package/src/components/interaction/form/Radio/Radio.native.tsx +79 -0
- package/src/components/interaction/form/Radio/Radio.stories.tsx +1 -1
- package/src/components/interaction/form/Radio/Radio.tsx +2 -2
- package/src/components/interaction/form/RadioGroup/RadioGroup.mdx +45 -0
- package/src/components/interaction/form/RadioGroup/RadioGroup.stories.tsx +1 -1
- package/src/components/interaction/form/RadioGroup/RadioGroup.tsx +2 -2
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.module.css +5 -6
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.stories.tsx +1 -1
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.tsx +2 -2
- package/src/components/interaction/form/Select/Select.module.css +3 -3
- package/src/components/interaction/form/Select/Select.stories.tsx +1 -1
- package/src/components/interaction/form/Select/Select.tsx +2 -2
- package/src/components/interaction/form/Slider/Slider.mdx +1 -1
- package/src/components/interaction/form/Slider/Slider.module.css +10 -10
- package/src/components/interaction/form/Slider/Slider.stories.tsx +1 -1
- package/src/components/interaction/form/Slider/Slider.tsx +2 -2
- package/src/components/interaction/form/Switch/Switch.mdx +4 -4
- package/src/components/interaction/form/Switch/Switch.module.css +11 -11
- package/src/components/interaction/form/Switch/Switch.native.spec.tsx +60 -0
- package/src/components/interaction/form/Switch/Switch.native.stories.tsx +35 -0
- package/src/components/interaction/form/Switch/Switch.native.tsx +59 -0
- package/src/components/interaction/form/Switch/Switch.stories.tsx +1 -1
- package/src/components/interaction/form/Switch/Switch.tsx +2 -2
- package/src/components/interaction/form/Textarea/Textarea.mdx +17 -0
- package/src/components/interaction/form/Textarea/Textarea.module.css +1 -1
- package/src/components/interaction/form/Textarea/Textarea.stories.tsx +1 -1
- package/src/components/interaction/form/Textarea/Textarea.tsx +2 -2
- package/src/components/interaction/form/atoms/InputContainer.tsx +2 -1
- package/src/components/interaction/form/atoms/Label.native.stories.tsx +18 -0
- package/src/components/interaction/form/atoms/Label.native.tsx +29 -0
- package/src/components/interaction/form/atoms/Label.tsx +5 -3
- package/src/components/interaction/form/atoms/Message.native.spec.tsx +30 -0
- package/src/components/interaction/form/atoms/Message.native.stories.tsx +22 -0
- package/src/components/interaction/form/atoms/Message.native.tsx +34 -0
- package/src/components/interaction/form/atoms/Message.tsx +5 -3
- package/src/components/layout/ButtonGroup/ButtonGroup.native.stories.tsx +50 -0
- package/src/components/layout/ButtonGroup/ButtonGroup.native.tsx +34 -0
- package/src/components/layout/ButtonGroup/ButtonGroup.stories.tsx +1 -1
- package/src/components/layout/ButtonGroup/ButtonGroup.tsx +2 -2
- package/src/components/layout/Card/Card.native.stories.tsx +53 -0
- package/src/components/layout/Card/Card.native.tsx +89 -0
- package/src/components/layout/Card/Card.stories.tsx +1 -1
- package/src/components/layout/Card/Card.tsx +2 -2
- package/src/components/layout/IconWrapper/IconWrapper.mdx +2 -2
- package/src/components/layout/IconWrapper/IconWrapper.module.css +2 -2
- package/src/components/layout/IconWrapper/IconWrapper.native.spec.tsx +39 -0
- package/src/components/layout/IconWrapper/IconWrapper.native.stories.tsx +41 -0
- package/src/components/layout/IconWrapper/IconWrapper.native.tsx +20 -0
- package/src/components/layout/IconWrapper/IconWrapper.stories.tsx +1 -1
- package/src/components/layout/IconWrapper/IconWrapper.tsx +2 -2
- package/src/components/layout/SectionHeader/SectionHeader.mdx +13 -0
- package/src/components/layout/SectionHeader/SectionHeader.native.stories.tsx +38 -0
- package/src/components/layout/SectionHeader/SectionHeader.native.tsx +79 -0
- package/src/components/layout/SectionHeader/SectionHeader.stories.tsx +1 -1
- package/src/components/layout/SectionHeader/SectionHeader.tsx +2 -2
- package/src/components/ui/Accordion/Accordion.mdx +14 -0
- package/src/components/ui/Accordion/Accordion.module.css +5 -5
- package/src/components/ui/Accordion/Accordion.stories.tsx +1 -1
- package/src/components/ui/Accordion/Accordion.tsx +2 -2
- package/src/components/ui/Alert/Alert.native.mdx +62 -0
- package/src/components/ui/Alert/Alert.native.stories.tsx +43 -0
- package/src/components/ui/Alert/Alert.native.tsx +94 -0
- package/src/components/ui/Alert/Alert.stories.tsx +1 -1
- package/src/components/ui/Alert/Alert.tsx +2 -2
- package/src/components/ui/Avatar/Avatar.native.mdx +50 -0
- package/src/components/ui/Avatar/Avatar.native.spec.tsx +47 -0
- package/src/components/ui/Avatar/Avatar.native.stories.tsx +34 -0
- package/src/components/ui/Avatar/Avatar.native.tsx +85 -0
- package/src/components/ui/Avatar/Avatar.stories.tsx +1 -1
- package/src/components/ui/Avatar/Avatar.tsx +2 -2
- package/src/components/ui/Badge/Badge.mdx +2 -2
- package/src/components/ui/Badge/Badge.native.mdx +54 -0
- package/src/components/ui/Badge/Badge.native.stories.tsx +36 -0
- package/src/components/ui/Badge/Badge.native.tsx +50 -0
- package/src/components/ui/Badge/Badge.stories.tsx +1 -1
- package/src/components/ui/Badge/Badge.tsx +2 -2
- package/src/components/ui/Breadcrumb/Breadcrumb.stories.tsx +1 -1
- package/src/components/ui/Breadcrumb/Breadcrumb.tsx +2 -2
- package/src/components/ui/Calendar/Calendar.mdx +16 -0
- package/src/components/ui/Calendar/Calendar.module.css +7 -7
- package/src/components/ui/Calendar/Calendar.stories.tsx +1 -1
- package/src/components/ui/Calendar/Calendar.tsx +2 -2
- package/src/components/ui/Carousel/Carousel.module.css +5 -5
- package/src/components/ui/Carousel/Carousel.stories.tsx +1 -1
- package/src/components/ui/Carousel/Carousel.tsx +2 -2
- package/src/components/ui/Collapsible/Collapsible.module.css +4 -4
- package/src/components/ui/Collapsible/Collapsible.stories.tsx +1 -1
- package/src/components/ui/Collapsible/Collapsible.tsx +2 -2
- package/src/components/ui/DescriptionList/DescriptionList.stories.tsx +1 -1
- package/src/components/ui/DescriptionList/DescriptionList.tsx +2 -2
- package/src/components/ui/Link/Link.mdx +14 -0
- package/src/components/ui/Link/Link.module.css +2 -2
- package/src/components/ui/Link/Link.stories.tsx +1 -1
- package/src/components/ui/Link/Link.tsx +2 -2
- package/src/components/ui/Loading/Loading.module.css +7 -7
- package/src/components/ui/Loading/Loading.native.spec.tsx +24 -0
- package/src/components/ui/Loading/Loading.native.stories.tsx +33 -0
- package/src/components/ui/Loading/Loading.native.tsx +29 -0
- package/src/components/ui/Loading/Loading.stories.tsx +1 -1
- package/src/components/ui/Loading/Loading.tsx +2 -2
- package/src/components/ui/NotificationBanner/NotificationBanner.module.css +3 -3
- package/src/components/ui/NotificationBanner/NotificationBanner.native.stories.tsx +39 -0
- package/src/components/ui/NotificationBanner/NotificationBanner.native.tsx +76 -0
- package/src/components/ui/NotificationBanner/NotificationBanner.stories.tsx +1 -1
- package/src/components/ui/NotificationBanner/NotificationBanner.tsx +2 -2
- package/src/components/ui/Pagination/Pagination.module.css +7 -7
- package/src/components/ui/Pagination/Pagination.stories.tsx +1 -1
- package/src/components/ui/Pagination/Pagination.tsx +2 -2
- package/src/components/ui/Progress/Progress.mdx +1 -1
- package/src/components/ui/Progress/Progress.module.css +6 -6
- package/src/components/ui/Progress/Progress.native.stories.tsx +34 -0
- package/src/components/ui/Progress/Progress.native.tsx +84 -0
- package/src/components/ui/Progress/Progress.stories.tsx +1 -1
- package/src/components/ui/Progress/Progress.tsx +2 -2
- package/src/components/ui/ProgressCircle/ProgressCircle.module.css +1 -1
- package/src/components/ui/ProgressCircle/ProgressCircle.stories.tsx +1 -1
- package/src/components/ui/ProgressCircle/ProgressCircle.tsx +2 -2
- package/src/components/ui/Separator/Separator.mdx +14 -0
- package/src/components/ui/Separator/Separator.module.css +3 -3
- package/src/components/ui/Separator/Separator.native.stories.tsx +42 -0
- package/src/components/ui/Separator/Separator.native.tsx +32 -0
- package/src/components/ui/Separator/Separator.stories.tsx +1 -1
- package/src/components/ui/Separator/Separator.tsx +2 -2
- package/src/components/ui/Skeleton/Skeleton.module.css +1 -1
- package/src/components/ui/Skeleton/Skeleton.native.stories.tsx +33 -0
- package/src/components/ui/Skeleton/Skeleton.native.tsx +41 -0
- package/src/components/ui/Skeleton/Skeleton.stories.tsx +1 -1
- package/src/components/ui/Skeleton/Skeleton.tsx +2 -3
- package/src/components/ui/SkipLink/SkipLink.stories.tsx +1 -1
- package/src/components/ui/SkipLink/SkipLink.tsx +5 -3
- package/src/components/ui/Table/Table.mdx +14 -0
- package/src/components/ui/Table/Table.module.css +9 -9
- package/src/components/ui/Table/Table.stories.tsx +1 -1
- package/src/components/ui/Table/Table.tsx +2 -2
- package/src/components/ui/Tabs/Tabs.module.css +3 -3
- package/src/components/ui/Tabs/Tabs.stories.tsx +1 -1
- package/src/components/ui/Tabs/Tabs.tsx +2 -2
- package/src/components/ui/Tooltip/Tooltip.mdx +14 -0
- package/src/components/ui/Tooltip/Tooltip.module.css +8 -8
- package/src/components/ui/Tooltip/Tooltip.stories.tsx +1 -1
- package/src/components/ui/Tooltip/Tooltip.tsx +2 -2
- package/src/components/ui/Typography/Typography.mdx +13 -0
- package/src/components/ui/Typography/Typography.native.mdx +56 -0
- package/src/components/ui/Typography/Typography.native.stories.tsx +38 -0
- package/src/components/ui/Typography/Typography.native.tsx +65 -0
- package/src/components/ui/Typography/Typography.stories.tsx +1 -1
- package/src/components/ui/Typography/Typography.tsx +2 -2
- package/src/css/bdc.css +8 -0
- package/src/index.ts +1 -0
- package/src/native/ThemeContext.tsx +28 -0
- package/src/native/tokens.ts +13 -0
- package/src/native.ts +39 -0
- package/src/polyfill-invoker-commands.ts +68 -0
- package/src/react-augment.d.ts +32 -0
- package/src/stories/DesignSystem/DarkMode.mdx +130 -0
- package/src/stories/ReactNative.mdx +121 -0
- package/src/types.ts +2 -0
- package/src/typings.d.ts +3 -0
- package/src/web-components/globals.ts +61 -0
- package/src/web-components/index.ts +12 -0
- package/src/web-components/interaction/BdsButton.mdx +106 -0
- package/src/web-components/interaction/BdsButton.stories.tsx +60 -0
- package/src/web-components/interaction/BdsPopover.mdx +120 -0
- package/src/web-components/interaction/BdsPopover.stories.tsx +70 -0
- package/src/web-components/interaction/BdsToastProvider.mdx +94 -0
- package/src/web-components/interaction/BdsToastProvider.stories.tsx +73 -0
- package/src/web-components/interaction/bds-button.spec.ts +95 -0
- package/src/web-components/interaction/bds-button.ts +293 -0
- package/src/web-components/interaction/bds-popover.spec.ts +174 -0
- package/src/web-components/interaction/bds-popover.ts +229 -0
- package/src/web-components/interaction/bds-toast-provider.spec.ts +122 -0
- package/src/web-components/interaction/bds-toast-provider.ts +211 -0
- package/src/web-components/test/helpers.ts +22 -0
- package/src/web-components/ui/BdsAlert.mdx +90 -0
- package/src/web-components/ui/BdsAlert.stories.tsx +60 -0
- package/src/web-components/ui/BdsBadge.mdx +74 -0
- package/src/web-components/ui/BdsBadge.stories.tsx +37 -0
- package/src/web-components/ui/bds-alert.spec.ts +109 -0
- package/src/web-components/ui/bds-alert.ts +209 -0
- package/src/web-components/ui/bds-badge.spec.ts +51 -0
- package/src/web-components/ui/bds-badge.ts +88 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { ThemeProvider } from '../../../native/ThemeContext';
|
|
4
|
+
import { Progress } from './Progress.native';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
tags: ['!stable', 'alpha'],
|
|
8
|
+
title: 'React Native/UI/Progress',
|
|
9
|
+
component: Progress,
|
|
10
|
+
decorators: [
|
|
11
|
+
(Story) => (
|
|
12
|
+
<ThemeProvider>
|
|
13
|
+
<div style={{ width: 300 }}>
|
|
14
|
+
<Story />
|
|
15
|
+
</div>
|
|
16
|
+
</ThemeProvider>
|
|
17
|
+
),
|
|
18
|
+
],
|
|
19
|
+
parameters: { layout: 'padded' },
|
|
20
|
+
argTypes: {
|
|
21
|
+
size: { control: 'select', options: ['small', 'medium', 'large'] },
|
|
22
|
+
value: { control: { type: 'range', min: 0, max: 100, step: 1 } },
|
|
23
|
+
},
|
|
24
|
+
} satisfies Meta<typeof Progress>;
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
type Story = StoryObj<typeof meta>;
|
|
28
|
+
|
|
29
|
+
export const Default: Story = { args: { value: 60, label: 'Progress' } };
|
|
30
|
+
export const WithLabel: Story = { args: { value: 40, label: 'Loading', showLabel: true } };
|
|
31
|
+
export const Small: Story = { args: { value: 70, label: 'Small progress', size: 'small' } };
|
|
32
|
+
export const Large: Story = { args: { value: 50, label: 'Large progress', size: 'large', showLabel: true } };
|
|
33
|
+
export const Complete: Story = { args: { value: 100, label: 'Complete', showLabel: true } };
|
|
34
|
+
export const Empty: Story = { args: { value: 0, label: 'Not started', showLabel: true } };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { StyleSheet, View, Text, StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import { spacing, font, border, lineHeight } from '../../../native/tokens';
|
|
3
|
+
import { useTheme } from '../../../native/ThemeContext';
|
|
4
|
+
|
|
5
|
+
type ProgressSize = 'small' | 'medium' | 'large';
|
|
6
|
+
|
|
7
|
+
interface ProgressProps {
|
|
8
|
+
value: number;
|
|
9
|
+
max?: number;
|
|
10
|
+
label: string;
|
|
11
|
+
showLabel?: boolean;
|
|
12
|
+
size?: ProgressSize;
|
|
13
|
+
style?: StyleProp<ViewStyle>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const trackHeight: Record<ProgressSize, number> = {
|
|
17
|
+
small: 4,
|
|
18
|
+
medium: 8,
|
|
19
|
+
large: 12,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const styles = StyleSheet.create({
|
|
23
|
+
container: {
|
|
24
|
+
width: '100%',
|
|
25
|
+
},
|
|
26
|
+
labelRow: {
|
|
27
|
+
flexDirection: 'row',
|
|
28
|
+
justifyContent: 'space-between',
|
|
29
|
+
marginBottom: spacing.xxs,
|
|
30
|
+
},
|
|
31
|
+
labelText: {
|
|
32
|
+
fontSize: font.size.bodyS,
|
|
33
|
+
fontFamily: font.family.body,
|
|
34
|
+
lineHeight: lineHeight.bodyS,
|
|
35
|
+
},
|
|
36
|
+
track: {
|
|
37
|
+
width: '100%',
|
|
38
|
+
borderRadius: border.radius.xs,
|
|
39
|
+
overflow: 'hidden',
|
|
40
|
+
},
|
|
41
|
+
fill: {
|
|
42
|
+
height: '100%',
|
|
43
|
+
borderRadius: border.radius.xs,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export function Progress({
|
|
48
|
+
value,
|
|
49
|
+
max = 100,
|
|
50
|
+
label,
|
|
51
|
+
showLabel = false,
|
|
52
|
+
size = 'medium',
|
|
53
|
+
style,
|
|
54
|
+
}: Readonly<ProgressProps>) {
|
|
55
|
+
const { colors } = useTheme();
|
|
56
|
+
const percentage = Math.min(100, Math.max(0, (value / max) * 100));
|
|
57
|
+
const height = trackHeight[size];
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<View style={[styles.container, style]}>
|
|
61
|
+
{showLabel && (
|
|
62
|
+
<View style={styles.labelRow}>
|
|
63
|
+
<Text style={[styles.labelText, { color: colors.colorOnBg }]}>{label}</Text>
|
|
64
|
+
<Text style={[styles.labelText, { color: colors.colorOnBgSubtle }]}>
|
|
65
|
+
{Math.round(percentage)}%
|
|
66
|
+
</Text>
|
|
67
|
+
</View>
|
|
68
|
+
)}
|
|
69
|
+
<View
|
|
70
|
+
style={[styles.track, { height, backgroundColor: colors.colorBgSubtle }]}
|
|
71
|
+
accessibilityRole="progressbar"
|
|
72
|
+
accessibilityLabel={label}
|
|
73
|
+
accessibilityValue={{ min: 0, max, now: value }}
|
|
74
|
+
>
|
|
75
|
+
<View
|
|
76
|
+
style={[
|
|
77
|
+
styles.fill,
|
|
78
|
+
{ width: `${percentage}%`, backgroundColor: colors.colorInteractive },
|
|
79
|
+
]}
|
|
80
|
+
/>
|
|
81
|
+
</View>
|
|
82
|
+
</View>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react';
|
|
|
2
2
|
import { Progress } from './Progress';
|
|
3
3
|
|
|
4
4
|
const meta = {
|
|
5
|
-
title: 'UI/Progress',
|
|
5
|
+
title: 'React/UI/Progress',
|
|
6
6
|
component: Progress,
|
|
7
7
|
argTypes: {
|
|
8
8
|
size: { control: 'radio', options: ['small', 'medium', 'large'] },
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import css from './Progress.module.css';
|
|
2
2
|
import { cn } from '@boostdev/design-system-foundation';
|
|
3
|
+
import type { WithClassName } from '../../../types';
|
|
3
4
|
|
|
4
|
-
interface ProgressProps {
|
|
5
|
+
interface ProgressProps extends WithClassName {
|
|
5
6
|
value: number;
|
|
6
7
|
max?: number;
|
|
7
8
|
label: string;
|
|
8
9
|
showLabel?: boolean;
|
|
9
10
|
size?: 'small' | 'medium' | 'large';
|
|
10
|
-
className?: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export function Progress({
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.fill {
|
|
18
|
-
stroke: var(--progressCircle_color-active, var(--
|
|
18
|
+
stroke: var(--progressCircle_color-active, var(--bdc-color_active));
|
|
19
19
|
transition: stroke-dashoffset var(--bds-animation_transition-duration) var(--bds-animation_easing);
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import css from './ProgressCircle.module.css';
|
|
2
2
|
import { cn } from '@boostdev/design-system-foundation';
|
|
3
|
+
import type { WithClassName } from '../../../types';
|
|
3
4
|
|
|
4
|
-
interface ProgressCircleProps {
|
|
5
|
+
interface ProgressCircleProps extends WithClassName {
|
|
5
6
|
value: number;
|
|
6
7
|
max?: number;
|
|
7
8
|
label: string;
|
|
8
9
|
showValue?: boolean;
|
|
9
10
|
size?: 'small' | 'medium' | 'large';
|
|
10
|
-
className?: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const SIZE_PX = { small: 40, medium: 64, large: 96 };
|
|
@@ -23,6 +23,20 @@ Visual divider between content sections. Renders a semantic `<hr>` (horizontal)
|
|
|
23
23
|
|
|
24
24
|
<ArgTypes of={Stories} />
|
|
25
25
|
|
|
26
|
+
## CSS variables
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
<table>
|
|
30
|
+
<thead>
|
|
31
|
+
<tr><th>Variable</th><th>Default</th><th>Description</th></tr>
|
|
32
|
+
</thead>
|
|
33
|
+
<tbody>
|
|
34
|
+
<tr><td>`--separator_color`</td><td>`var(--bds-color_on-bg)`</td><td>Line colour</td></tr>
|
|
35
|
+
<tr><td>`--separator_thickness`</td><td>`1px`</td><td>Line thickness (height for horizontal, width for vertical)</td></tr>
|
|
36
|
+
</tbody>
|
|
37
|
+
</table>
|
|
38
|
+
|
|
39
|
+
|
|
26
40
|
## Accessibility
|
|
27
41
|
|
|
28
42
|
- Horizontal variant uses `<hr>` — natively announces a thematic break to screen readers
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
.separator.--horizontal {
|
|
8
8
|
display: block;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
inline-size: 100%;
|
|
10
|
+
block-size: var(--separator_thickness, 1px);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
.separator.--vertical {
|
|
14
14
|
display: inline-block;
|
|
15
|
-
|
|
15
|
+
inline-size: var(--separator_thickness, 1px);
|
|
16
16
|
align-self: stretch;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { ThemeProvider } from '../../../native/ThemeContext';
|
|
4
|
+
import { Separator } from './Separator.native';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
tags: ['!stable', 'alpha'],
|
|
8
|
+
title: 'React Native/UI/Separator',
|
|
9
|
+
component: Separator,
|
|
10
|
+
decorators: [(Story) => <ThemeProvider><Story /></ThemeProvider>],
|
|
11
|
+
parameters: { layout: 'padded' },
|
|
12
|
+
argTypes: {
|
|
13
|
+
orientation: { control: 'select', options: ['horizontal', 'vertical'] },
|
|
14
|
+
},
|
|
15
|
+
} satisfies Meta<typeof Separator>;
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryObj<typeof meta>;
|
|
19
|
+
|
|
20
|
+
export const Horizontal: Story = {
|
|
21
|
+
render: (args) => (
|
|
22
|
+
<ThemeProvider>
|
|
23
|
+
<div style={{ width: 300 }}>
|
|
24
|
+
<Separator {...args} orientation="horizontal" />
|
|
25
|
+
</div>
|
|
26
|
+
</ThemeProvider>
|
|
27
|
+
),
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Vertical: Story = {
|
|
31
|
+
render: (args) => (
|
|
32
|
+
<ThemeProvider>
|
|
33
|
+
<div style={{ display: 'flex', height: 60, alignItems: 'stretch' }}>
|
|
34
|
+
<span>Left</span>
|
|
35
|
+
<div style={{ display: 'flex', margin: '0 8px' }}>
|
|
36
|
+
<Separator {...args} orientation="vertical" />
|
|
37
|
+
</div>
|
|
38
|
+
<span>Right</span>
|
|
39
|
+
</div>
|
|
40
|
+
</ThemeProvider>
|
|
41
|
+
),
|
|
42
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { StyleSheet, View, StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import { useTheme } from '../../../native/ThemeContext';
|
|
3
|
+
|
|
4
|
+
interface SeparatorProps {
|
|
5
|
+
orientation?: 'horizontal' | 'vertical';
|
|
6
|
+
style?: StyleProp<ViewStyle>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const styles = StyleSheet.create({
|
|
10
|
+
horizontal: {
|
|
11
|
+
height: StyleSheet.hairlineWidth,
|
|
12
|
+
width: '100%',
|
|
13
|
+
},
|
|
14
|
+
vertical: {
|
|
15
|
+
width: StyleSheet.hairlineWidth,
|
|
16
|
+
alignSelf: 'stretch',
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export function Separator({ orientation = 'horizontal', style }: Readonly<SeparatorProps>) {
|
|
21
|
+
const { colors } = useTheme();
|
|
22
|
+
return (
|
|
23
|
+
<View
|
|
24
|
+
accessibilityRole="none"
|
|
25
|
+
style={[
|
|
26
|
+
orientation === 'vertical' ? styles.vertical : styles.horizontal,
|
|
27
|
+
{ backgroundColor: colors.colorBgSubtle },
|
|
28
|
+
style,
|
|
29
|
+
]}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react';
|
|
|
2
2
|
import { Separator } from './Separator';
|
|
3
3
|
|
|
4
4
|
const meta = {
|
|
5
|
-
title: 'UI/Separator',
|
|
5
|
+
title: 'React/UI/Separator',
|
|
6
6
|
component: Separator,
|
|
7
7
|
argTypes: {
|
|
8
8
|
orientation: { control: 'radio', options: ['horizontal', 'vertical'] },
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import css from './Separator.module.css';
|
|
2
2
|
import { cn } from '@boostdev/design-system-foundation';
|
|
3
|
+
import type { WithClassName } from '../../../types';
|
|
3
4
|
|
|
4
|
-
interface SeparatorProps {
|
|
5
|
+
interface SeparatorProps extends WithClassName {
|
|
5
6
|
orientation?: 'horizontal' | 'vertical';
|
|
6
|
-
className?: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export function Separator({ orientation = 'horizontal', className }: Readonly<SeparatorProps>) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { ThemeProvider } from '../../../native/ThemeContext';
|
|
4
|
+
import { Skeleton } from './Skeleton.native';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
tags: ['!stable', 'alpha'],
|
|
8
|
+
title: 'React Native/UI/Skeleton',
|
|
9
|
+
component: Skeleton,
|
|
10
|
+
decorators: [(Story) => <ThemeProvider><Story /></ThemeProvider>],
|
|
11
|
+
parameters: { layout: 'padded' },
|
|
12
|
+
} satisfies Meta<typeof Skeleton>;
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
|
|
17
|
+
export const Text: Story = {
|
|
18
|
+
render: (args) => <Skeleton {...args} style={{ width: 200, height: 16 }} />,
|
|
19
|
+
};
|
|
20
|
+
export const Avatar: Story = {
|
|
21
|
+
render: (args) => <Skeleton {...args} style={{ width: 48, height: 48, borderRadius: 999 }} />,
|
|
22
|
+
};
|
|
23
|
+
export const Card: Story = {
|
|
24
|
+
render: () => (
|
|
25
|
+
<ThemeProvider>
|
|
26
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '8px', width: 280 }}>
|
|
27
|
+
<Skeleton style={{ width: 280, height: 160 }} />
|
|
28
|
+
<Skeleton style={{ width: 200, height: 16 }} />
|
|
29
|
+
<Skeleton style={{ width: 140, height: 14 }} />
|
|
30
|
+
</div>
|
|
31
|
+
</ThemeProvider>
|
|
32
|
+
),
|
|
33
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { Animated, StyleSheet, StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { useTheme } from '../../../native/ThemeContext';
|
|
4
|
+
|
|
5
|
+
interface SkeletonProps {
|
|
6
|
+
style?: StyleProp<ViewStyle>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const styles = StyleSheet.create({
|
|
10
|
+
skeleton: {
|
|
11
|
+
borderRadius: 4,
|
|
12
|
+
overflow: 'hidden',
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export function Skeleton({ style }: SkeletonProps) {
|
|
17
|
+
const { colors } = useTheme();
|
|
18
|
+
const opacity = useRef(new Animated.Value(1)).current;
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const anim = Animated.loop(
|
|
22
|
+
Animated.sequence([
|
|
23
|
+
Animated.timing(opacity, { toValue: 0.4, duration: 700, useNativeDriver: true }),
|
|
24
|
+
Animated.timing(opacity, { toValue: 1, duration: 700, useNativeDriver: true }),
|
|
25
|
+
]),
|
|
26
|
+
);
|
|
27
|
+
anim.start();
|
|
28
|
+
return () => anim.stop();
|
|
29
|
+
}, [opacity]);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Animated.View
|
|
33
|
+
importantForAccessibility="no-hide-descendants"
|
|
34
|
+
style={[
|
|
35
|
+
styles.skeleton,
|
|
36
|
+
{ backgroundColor: colors.colorBgSubtle, opacity },
|
|
37
|
+
style,
|
|
38
|
+
]}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { cn } from '@boostdev/design-system-foundation';
|
|
2
2
|
import css from './Skeleton.module.css';
|
|
3
|
+
import type { WithClassName } from '../../../types';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
className?: string;
|
|
6
|
-
}
|
|
5
|
+
type SkeletonProps = WithClassName;
|
|
7
6
|
|
|
8
7
|
export function Skeleton({ className }: SkeletonProps) {
|
|
9
8
|
return (
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import css from './SkipLink.module.css';
|
|
2
|
+
import { cn } from '@boostdev/design-system-foundation';
|
|
3
|
+
import type { WithClassName } from '../../../types';
|
|
2
4
|
|
|
3
|
-
interface SkipLinkProps {
|
|
5
|
+
interface SkipLinkProps extends WithClassName {
|
|
4
6
|
href?: string;
|
|
5
7
|
children?: string;
|
|
6
8
|
}
|
|
7
9
|
|
|
8
|
-
export function SkipLink({ href = '#main', children = 'Skip to main content' }: SkipLinkProps) {
|
|
10
|
+
export function SkipLink({ href = '#main', children = 'Skip to main content', className }: SkipLinkProps) {
|
|
9
11
|
return (
|
|
10
|
-
<a href={href} className={css.skipLink}>
|
|
12
|
+
<a href={href} className={cn(css.skipLink, className)}>
|
|
11
13
|
{children}
|
|
12
14
|
</a>
|
|
13
15
|
);
|
|
@@ -30,6 +30,20 @@ Data table with optional sortable columns and caption.
|
|
|
30
30
|
|
|
31
31
|
<ArgTypes of={Stories} />
|
|
32
32
|
|
|
33
|
+
## CSS variables
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
<table>
|
|
37
|
+
<thead>
|
|
38
|
+
<tr><th>Variable</th><th>Default</th><th>Description</th></tr>
|
|
39
|
+
</thead>
|
|
40
|
+
<tbody>
|
|
41
|
+
<tr><td>`--table_border`</td><td>`none`</td><td>Container border</td></tr>
|
|
42
|
+
<tr><td>`--table_radius`</td><td>`var(--bdc-outline_radius)`</td><td>Container corner radius</td></tr>
|
|
43
|
+
</tbody>
|
|
44
|
+
</table>
|
|
45
|
+
|
|
46
|
+
|
|
33
47
|
## Accessibility
|
|
34
48
|
|
|
35
49
|
- Wraps in `<table>` with `<thead>` and `<tbody>`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@layer component {
|
|
2
2
|
.wrapper {
|
|
3
|
-
|
|
4
|
-
overflow-
|
|
3
|
+
inline-size: 100%;
|
|
4
|
+
overflow-inline: auto;
|
|
5
5
|
border: var(--table_border, none);
|
|
6
6
|
--bdc_color: var(--bds-color_bg--subtle);
|
|
7
7
|
--bdc-outline_radius: var(--bds-border_radius--s);
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
.table {
|
|
15
|
-
|
|
15
|
+
inline-size: 100%;
|
|
16
16
|
border-collapse: collapse;
|
|
17
17
|
font-size: var(--bds-font_size--body);
|
|
18
18
|
font-family: var(--bds-font_family--body);
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
font-size: var(--bds-font_size--body--s);
|
|
38
38
|
color: var(--bds-color_on-bg--subtle);
|
|
39
39
|
white-space: nowrap;
|
|
40
|
-
border-
|
|
40
|
+
border-block-end: 1px solid var(--bds-color_bg--subtle);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.th.--sortable {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
align-items: center;
|
|
51
51
|
gap: var(--bds-space_xxs);
|
|
52
52
|
padding: var(--bds-space_s) var(--bds-space_m);
|
|
53
|
-
|
|
53
|
+
inline-size: 100%;
|
|
54
54
|
cursor: pointer;
|
|
55
55
|
color: var(--bds-color_on-bg--subtle);
|
|
56
56
|
font-weight: var(--bds-font_weight--semibold);
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
.sortIcon {
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
inline-size: 1rem;
|
|
75
|
+
block-size: 1rem;
|
|
76
76
|
opacity: 0.4;
|
|
77
77
|
transition: transform var(--bds-animation_transition-duration) var(--bds-animation_easing),
|
|
78
78
|
opacity var(--bds-animation_transition-duration) var(--bds-animation_easing);
|
|
@@ -88,12 +88,12 @@
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
.tbody .tr {
|
|
91
|
-
border-
|
|
91
|
+
border-block-end: 1px solid var(--bds-color_bg--subtle);
|
|
92
92
|
transition: var(--bds-animation_transition);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
.tbody .tr:last-child {
|
|
96
|
-
border-
|
|
96
|
+
border-block-end: none;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
@media (hover: hover) and (pointer: fine) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import css from './Table.module.css';
|
|
3
3
|
import { cn } from '@boostdev/design-system-foundation';
|
|
4
|
+
import type { WithClassName } from '../../../types';
|
|
4
5
|
|
|
5
6
|
export interface TableColumn<Row> {
|
|
6
7
|
key: string;
|
|
@@ -9,14 +10,13 @@ export interface TableColumn<Row> {
|
|
|
9
10
|
render?: (row: Row) => ReactNode;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
interface TableProps<Row extends Record<string, unknown>> {
|
|
13
|
+
interface TableProps<Row extends Record<string, unknown>> extends WithClassName {
|
|
13
14
|
columns: TableColumn<Row>[];
|
|
14
15
|
rows: Row[];
|
|
15
16
|
caption?: string;
|
|
16
17
|
sortKey?: string;
|
|
17
18
|
sortDirection?: 'asc' | 'desc';
|
|
18
19
|
onSort?: (key: string, direction: 'asc' | 'desc') => void;
|
|
19
|
-
className?: string;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export function Table<Row extends Record<string, unknown>>({
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
.tabList {
|
|
8
8
|
display: flex;
|
|
9
|
-
border-
|
|
9
|
+
border-block-end: 1px solid var(--bds-color_bg--subtle);
|
|
10
10
|
gap: var(--bds-space_xxs);
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
font-size: var(--bds-font_size--body);
|
|
20
20
|
font-weight: var(--bds-font_weight--semibold);
|
|
21
21
|
color: var(--tab_color, var(--bds-color_on-bg));
|
|
22
|
-
border-
|
|
23
|
-
margin-
|
|
22
|
+
border-block-end: 2px solid var(--tab_border-color, transparent);
|
|
23
|
+
margin-block-end: -1px;
|
|
24
24
|
cursor: pointer;
|
|
25
25
|
transition: var(--bds-animation_transition);
|
|
26
26
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KeyboardEvent, ReactNode, useId, useRef, useState } from 'react';
|
|
2
2
|
import css from './Tabs.module.css';
|
|
3
3
|
import { cn } from '@boostdev/design-system-foundation';
|
|
4
|
+
import type { WithClassName } from '../../../types';
|
|
4
5
|
|
|
5
6
|
export interface TabItem {
|
|
6
7
|
id: string;
|
|
@@ -9,10 +10,9 @@ export interface TabItem {
|
|
|
9
10
|
disabled?: boolean;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
interface TabsProps {
|
|
13
|
+
interface TabsProps extends WithClassName {
|
|
13
14
|
tabs: TabItem[];
|
|
14
15
|
defaultTab?: string;
|
|
15
|
-
className?: string;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export function Tabs({ tabs, defaultTab, className }: Readonly<TabsProps>) {
|
|
@@ -36,6 +36,20 @@ Short contextual label that appears on hover or focus. Use to supplement icon bu
|
|
|
36
36
|
|
|
37
37
|
<ArgTypes of={Stories} />
|
|
38
38
|
|
|
39
|
+
## CSS variables
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<table>
|
|
43
|
+
<thead>
|
|
44
|
+
<tr><th>Variable</th><th>Default</th><th>Description</th></tr>
|
|
45
|
+
</thead>
|
|
46
|
+
<tbody>
|
|
47
|
+
<tr><td>`--tooltip_bg`</td><td>`var(--bds-color_on-bg)`</td><td>Tooltip background colour</td></tr>
|
|
48
|
+
<tr><td>`--tooltip_text`</td><td>`var(--bds-color_bg)`</td><td>Tooltip text colour</td></tr>
|
|
49
|
+
</tbody>
|
|
50
|
+
</table>
|
|
51
|
+
|
|
52
|
+
|
|
39
53
|
## Accessibility
|
|
40
54
|
|
|
41
55
|
- Tooltip content is linked via `aria-describedby` on the trigger element
|