@boostdev/design-system-components 1.2.2 → 1.2.4
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 +5 -0
- package/README.md +50 -5
- package/dist/client.cjs +50 -50
- package/dist/client.css +506 -503
- package/dist/client.js +50 -50
- package/dist/index.cjs +50 -50
- package/dist/index.css +506 -503
- package/dist/index.js +50 -50
- package/dist/native/index.cjs +3692 -352
- package/dist/native/index.d.cts +359 -3
- package/dist/native/index.d.ts +359 -3
- package/dist/native/index.js +3811 -364
- package/package.json +3 -3
- package/src/components/interaction/Button/Button.module.css +1 -4
- package/src/components/interaction/Button/Button.native.stories.tsx +10 -12
- package/src/components/interaction/Button/Button.native.tsx +3 -3
- package/src/components/interaction/Dialog/Dialog.module.css +1 -1
- package/src/components/interaction/Dialog/Dialog.native.mdx +61 -0
- package/src/components/interaction/Dialog/Dialog.native.spec.tsx +73 -0
- package/src/components/interaction/Dialog/Dialog.native.stories.tsx +53 -0
- package/src/components/interaction/Dialog/Dialog.native.tsx +128 -0
- package/src/components/interaction/Drawer/Drawer.module.css +1 -1
- package/src/components/interaction/Drawer/Drawer.native.mdx +58 -0
- package/src/components/interaction/Drawer/Drawer.native.spec.tsx +81 -0
- package/src/components/interaction/Drawer/Drawer.native.stories.tsx +33 -0
- package/src/components/interaction/Drawer/Drawer.native.tsx +175 -0
- package/src/components/interaction/DropdownMenu/DropdownMenu.module.css +4 -0
- package/src/components/interaction/DropdownMenu/DropdownMenu.native.mdx +74 -0
- package/src/components/interaction/DropdownMenu/DropdownMenu.native.spec.tsx +78 -0
- package/src/components/interaction/DropdownMenu/DropdownMenu.native.stories.tsx +51 -0
- package/src/components/interaction/DropdownMenu/DropdownMenu.native.tsx +254 -0
- package/src/components/interaction/DropdownMenu/DropdownMenu.stories.tsx +4 -4
- package/src/components/interaction/Popover/Popover.native.mdx +61 -0
- package/src/components/interaction/Popover/Popover.native.spec.tsx +73 -0
- package/src/components/interaction/Popover/Popover.native.stories.tsx +44 -0
- package/src/components/interaction/Popover/Popover.native.tsx +87 -0
- package/src/components/interaction/Rating/Rating.native.mdx +55 -0
- package/src/components/interaction/Rating/Rating.native.spec.tsx +38 -0
- package/src/components/interaction/Rating/Rating.native.stories.tsx +37 -0
- package/src/components/interaction/Rating/Rating.native.tsx +50 -0
- package/src/components/interaction/Toast/Toast.native.mdx +81 -0
- package/src/components/interaction/Toast/Toast.native.spec.tsx +80 -0
- package/src/components/interaction/Toast/Toast.native.stories.tsx +47 -0
- package/src/components/interaction/Toast/Toast.native.tsx +202 -0
- package/src/components/interaction/form/Checkbox/Checkbox.native.stories.tsx +2 -4
- package/src/components/interaction/form/Checkbox/Checkbox.native.tsx +1 -1
- package/src/components/interaction/form/CheckboxGroup/CheckboxGroup.native.mdx +78 -0
- package/src/components/interaction/form/CheckboxGroup/CheckboxGroup.native.spec.tsx +57 -0
- package/src/components/interaction/form/CheckboxGroup/CheckboxGroup.native.stories.tsx +96 -0
- package/src/components/interaction/form/CheckboxGroup/CheckboxGroup.native.tsx +61 -0
- package/src/components/interaction/form/Combobox/Combobox.module.css +1 -1
- package/src/components/interaction/form/Combobox/Combobox.native.mdx +86 -0
- package/src/components/interaction/form/Combobox/Combobox.native.spec.tsx +60 -0
- package/src/components/interaction/form/Combobox/Combobox.native.stories.tsx +99 -0
- package/src/components/interaction/form/Combobox/Combobox.native.tsx +211 -0
- package/src/components/interaction/form/FileInput/FileInput.native.mdx +86 -0
- package/src/components/interaction/form/FileInput/FileInput.native.spec.tsx +73 -0
- package/src/components/interaction/form/FileInput/FileInput.native.stories.tsx +69 -0
- package/src/components/interaction/form/FileInput/FileInput.native.tsx +129 -0
- package/src/components/interaction/form/FormInput/FormInput.module.css +1 -1
- package/src/components/interaction/form/FormInput/FormInput.native.mdx +81 -0
- package/src/components/interaction/form/FormInput/FormInput.native.spec.tsx +51 -0
- package/src/components/interaction/form/FormInput/FormInput.native.stories.tsx +54 -0
- package/src/components/interaction/form/FormInput/FormInput.native.tsx +122 -0
- package/src/components/interaction/form/NumberInput/NumberInput.module.css +1 -1
- package/src/components/interaction/form/NumberInput/NumberInput.native.mdx +87 -0
- package/src/components/interaction/form/NumberInput/NumberInput.native.spec.tsx +63 -0
- package/src/components/interaction/form/NumberInput/NumberInput.native.stories.tsx +63 -0
- package/src/components/interaction/form/NumberInput/NumberInput.native.tsx +198 -0
- package/src/components/interaction/form/Radio/Radio.native.spec.tsx +79 -0
- package/src/components/interaction/form/Radio/Radio.native.stories.tsx +12 -14
- package/src/components/interaction/form/Radio/Radio.native.tsx +1 -1
- package/src/components/interaction/form/RadioGroup/RadioGroup.native.mdx +79 -0
- package/src/components/interaction/form/RadioGroup/RadioGroup.native.spec.tsx +66 -0
- package/src/components/interaction/form/RadioGroup/RadioGroup.native.stories.tsx +96 -0
- package/src/components/interaction/form/RadioGroup/RadioGroup.native.tsx +61 -0
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.module.css +5 -5
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.native.mdx +78 -0
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.native.spec.tsx +82 -0
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.native.stories.tsx +99 -0
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.native.tsx +121 -0
- package/src/components/interaction/form/Select/Select.module.css +1 -1
- package/src/components/interaction/form/Select/Select.native.mdx +85 -0
- package/src/components/interaction/form/Select/Select.native.spec.tsx +64 -0
- package/src/components/interaction/form/Select/Select.native.stories.tsx +75 -0
- package/src/components/interaction/form/Select/Select.native.tsx +252 -0
- package/src/components/interaction/form/Slider/Slider.module.css +4 -4
- package/src/components/interaction/form/Slider/Slider.native.mdx +83 -0
- package/src/components/interaction/form/Slider/Slider.native.spec.tsx +51 -0
- package/src/components/interaction/form/Slider/Slider.native.stories.tsx +58 -0
- package/src/components/interaction/form/Slider/Slider.native.tsx +188 -0
- package/src/components/interaction/form/Switch/Switch.module.css +3 -3
- package/src/components/interaction/form/Switch/Switch.native.stories.tsx +2 -4
- package/src/components/interaction/form/Textarea/Textarea.native.mdx +76 -0
- package/src/components/interaction/form/Textarea/Textarea.native.spec.tsx +50 -0
- package/src/components/interaction/form/Textarea/Textarea.native.stories.tsx +50 -0
- package/src/components/interaction/form/Textarea/Textarea.native.tsx +108 -0
- package/src/components/interaction/form/atoms/Label.native.spec.tsx +39 -0
- package/src/components/interaction/form/atoms/Label.native.stories.tsx +1 -1
- package/src/components/interaction/form/atoms/Message.native.stories.tsx +1 -1
- package/src/components/layout/ButtonGroup/ButtonGroup.native.spec.tsx +83 -0
- package/src/components/layout/ButtonGroup/ButtonGroup.native.stories.tsx +13 -19
- package/src/components/layout/Card/Card.native.spec.tsx +102 -0
- package/src/components/layout/Card/Card.native.stories.tsx +9 -11
- package/src/components/layout/Card/Card.native.tsx +1 -1
- package/src/components/layout/IconWrapper/IconWrapper.module.css +1 -1
- package/src/components/layout/IconWrapper/IconWrapper.native.stories.tsx +7 -11
- package/src/components/layout/SectionHeader/SectionHeader.native.spec.tsx +51 -0
- package/src/components/layout/SectionHeader/SectionHeader.native.stories.tsx +6 -8
- package/src/components/ui/Accordion/Accordion.native.mdx +65 -0
- package/src/components/ui/Accordion/Accordion.native.spec.tsx +69 -0
- package/src/components/ui/Accordion/Accordion.native.stories.tsx +52 -0
- package/src/components/ui/Accordion/Accordion.native.tsx +141 -0
- package/src/components/ui/Alert/Alert.module.css +1 -1
- package/src/components/ui/Alert/Alert.native.spec.tsx +76 -0
- package/src/components/ui/Alert/Alert.native.stories.tsx +8 -10
- package/src/components/ui/Alert/Alert.native.tsx +7 -7
- package/src/components/ui/Avatar/Avatar.module.css +1 -1
- package/src/components/ui/Avatar/Avatar.native.stories.tsx +6 -8
- package/src/components/ui/Avatar/Avatar.native.tsx +2 -2
- package/src/components/ui/Badge/Badge.module.css +1 -1
- package/src/components/ui/Badge/Badge.native.spec.tsx +45 -0
- package/src/components/ui/Badge/Badge.native.stories.tsx +6 -8
- package/src/components/ui/Badge/Badge.native.tsx +2 -2
- package/src/components/ui/Breadcrumb/Breadcrumb.native.mdx +52 -0
- package/src/components/ui/Breadcrumb/Breadcrumb.native.spec.tsx +49 -0
- package/src/components/ui/Breadcrumb/Breadcrumb.native.stories.tsx +46 -0
- package/src/components/ui/Breadcrumb/Breadcrumb.native.tsx +83 -0
- package/src/components/ui/Calendar/Calendar.module.css +2 -2
- package/src/components/ui/Calendar/Calendar.native.mdx +58 -0
- package/src/components/ui/Calendar/Calendar.native.spec.tsx +92 -0
- package/src/components/ui/Calendar/Calendar.native.stories.tsx +45 -0
- package/src/components/ui/Calendar/Calendar.native.tsx +294 -0
- package/src/components/ui/Carousel/Carousel.module.css +1 -1
- package/src/components/ui/Carousel/Carousel.native.mdx +55 -0
- package/src/components/ui/Carousel/Carousel.native.spec.tsx +55 -0
- package/src/components/ui/Carousel/Carousel.native.stories.tsx +59 -0
- package/src/components/ui/Carousel/Carousel.native.tsx +184 -0
- package/src/components/ui/Collapsible/Collapsible.native.mdx +53 -0
- package/src/components/ui/Collapsible/Collapsible.native.spec.tsx +68 -0
- package/src/components/ui/Collapsible/Collapsible.native.stories.tsx +48 -0
- package/src/components/ui/Collapsible/Collapsible.native.tsx +139 -0
- package/src/components/ui/DescriptionList/DescriptionList.native.mdx +50 -0
- package/src/components/ui/DescriptionList/DescriptionList.native.spec.tsx +37 -0
- package/src/components/ui/DescriptionList/DescriptionList.native.stories.tsx +48 -0
- package/src/components/ui/DescriptionList/DescriptionList.native.tsx +54 -0
- package/src/components/ui/Link/Link.native.mdx +53 -0
- package/src/components/ui/Link/Link.native.spec.tsx +35 -0
- package/src/components/ui/Link/Link.native.stories.tsx +46 -0
- package/src/components/ui/Link/Link.native.tsx +48 -0
- package/src/components/ui/Loading/Loading.module.css +1 -1
- package/src/components/ui/Loading/Loading.native.stories.tsx +6 -8
- package/src/components/ui/NotificationBanner/NotificationBanner.module.css +1 -1
- package/src/components/ui/NotificationBanner/NotificationBanner.native.spec.tsx +85 -0
- package/src/components/ui/NotificationBanner/NotificationBanner.native.stories.tsx +8 -10
- package/src/components/ui/NotificationBanner/NotificationBanner.native.tsx +7 -7
- package/src/components/ui/Pagination/Pagination.module.css +5 -1
- package/src/components/ui/Pagination/Pagination.native.mdx +62 -0
- package/src/components/ui/Pagination/Pagination.native.spec.tsx +86 -0
- package/src/components/ui/Pagination/Pagination.native.stories.tsx +47 -0
- package/src/components/ui/Pagination/Pagination.native.tsx +157 -0
- package/src/components/ui/Progress/Progress.module.css +2 -2
- package/src/components/ui/Progress/Progress.native.spec.tsx +56 -0
- package/src/components/ui/Progress/Progress.native.stories.tsx +1 -1
- package/src/components/ui/Progress/Progress.native.tsx +2 -2
- package/src/components/ui/ProgressCircle/ProgressCircle.native.mdx +63 -0
- package/src/components/ui/ProgressCircle/ProgressCircle.native.spec.tsx +39 -0
- package/src/components/ui/ProgressCircle/ProgressCircle.native.stories.tsx +36 -0
- package/src/components/ui/ProgressCircle/ProgressCircle.native.tsx +176 -0
- package/src/components/ui/Separator/Separator.native.spec.tsx +39 -0
- package/src/components/ui/Separator/Separator.native.stories.tsx +10 -14
- package/src/components/ui/Skeleton/Skeleton.native.spec.tsx +39 -0
- package/src/components/ui/Skeleton/Skeleton.native.stories.tsx +6 -8
- package/src/components/ui/Skeleton/Skeleton.native.tsx +2 -1
- package/src/components/ui/Table/Table.native.mdx +72 -0
- package/src/components/ui/Table/Table.native.spec.tsx +83 -0
- package/src/components/ui/Table/Table.native.stories.tsx +55 -0
- package/src/components/ui/Table/Table.native.tsx +196 -0
- package/src/components/ui/Tabs/Tabs.native.mdx +65 -0
- package/src/components/ui/Tabs/Tabs.native.spec.tsx +65 -0
- package/src/components/ui/Tabs/Tabs.native.stories.tsx +57 -0
- package/src/components/ui/Tabs/Tabs.native.tsx +133 -0
- package/src/components/ui/Tooltip/Tooltip.module.css +1 -1
- package/src/components/ui/Tooltip/Tooltip.native.mdx +47 -0
- package/src/components/ui/Tooltip/Tooltip.native.spec.tsx +37 -0
- package/src/components/ui/Tooltip/Tooltip.native.stories.tsx +38 -0
- package/src/components/ui/Tooltip/Tooltip.native.tsx +57 -0
- package/src/components/ui/Typography/Typography.native.spec.tsx +49 -0
- package/src/components/ui/Typography/Typography.native.stories.tsx +8 -10
- package/src/native/ThemeContext.tsx +3 -3
- package/src/native.ts +37 -0
- package/src/stories/ReactNative.mdx +48 -13
- package/src/web-components/interaction/BdsAccordion.stories.tsx +1 -1
- package/src/web-components/interaction/BdsCollapsible.stories.tsx +1 -1
- package/src/web-components/interaction/BdsSkipLink.stories.tsx +1 -1
- package/src/web-components/interaction/BdsTabs.stories.tsx +1 -1
- package/src/web-components/interaction/BdsTooltip.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsCheckbox.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsCheckboxGroup.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsCombobox.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsFileInput.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsFormInput.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsNumberInput.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsRadio.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsRadioGroup.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsSegmentedControl.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsSelect.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsSlider.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsSwitch.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsTextarea.stories.tsx +1 -1
- package/src/web-components/ui/BdsButtonGroup.stories.tsx +1 -1
- package/src/web-components/ui/BdsCard.stories.tsx +1 -1
- package/src/web-components/ui/BdsIconWrapper.stories.tsx +1 -1
- package/src/web-components/ui/BdsRating.stories.tsx +1 -1
- package/src/web-components/ui/BdsSectionHeader.stories.tsx +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
|
+
import { ThemeProvider } from '../../../native/ThemeContext';
|
|
5
|
+
import { Tooltip } from './Tooltip.native';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
tags: ['!stable', 'alpha'],
|
|
9
|
+
title: 'React Native/UI/Tooltip',
|
|
10
|
+
component: Tooltip,
|
|
11
|
+
decorators: [
|
|
12
|
+
(Story) => (
|
|
13
|
+
<ThemeProvider colorScheme="light">
|
|
14
|
+
<div style={{ padding: '60px 20px 20px' }}>
|
|
15
|
+
<Story />
|
|
16
|
+
</div>
|
|
17
|
+
</ThemeProvider>
|
|
18
|
+
),
|
|
19
|
+
],
|
|
20
|
+
parameters: { layout: 'padded' },
|
|
21
|
+
} satisfies Meta<typeof Tooltip>;
|
|
22
|
+
|
|
23
|
+
export default meta;
|
|
24
|
+
type Story = StoryObj<typeof meta>;
|
|
25
|
+
|
|
26
|
+
export const Default: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
content: 'Helpful tooltip text',
|
|
29
|
+
children: <Text>Long press me</Text>,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const LongContent: Story = {
|
|
34
|
+
args: {
|
|
35
|
+
content: 'This is a longer tooltip that provides more detailed information about the element.',
|
|
36
|
+
children: <Text>Long press for details</Text>,
|
|
37
|
+
},
|
|
38
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ReactNode, useState } from 'react';
|
|
2
|
+
import { StyleSheet, View, Text, Pressable, StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { spacing, font, border } from '../../../native/tokens';
|
|
4
|
+
import { useTheme } from '../../../native/ThemeContext';
|
|
5
|
+
|
|
6
|
+
interface TooltipProps {
|
|
7
|
+
content: string;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
style?: StyleProp<ViewStyle>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const styles = StyleSheet.create({
|
|
13
|
+
wrapper: {
|
|
14
|
+
position: 'relative',
|
|
15
|
+
},
|
|
16
|
+
tooltip: {
|
|
17
|
+
position: 'absolute',
|
|
18
|
+
bottom: '100%',
|
|
19
|
+
start: 0,
|
|
20
|
+
marginBottom: spacing.xxs,
|
|
21
|
+
paddingVertical: spacing.xxs,
|
|
22
|
+
paddingHorizontal: spacing.xs,
|
|
23
|
+
borderRadius: border.radius.full,
|
|
24
|
+
zIndex: 10,
|
|
25
|
+
alignSelf: 'flex-start',
|
|
26
|
+
},
|
|
27
|
+
text: {
|
|
28
|
+
fontSize: font.size.bodyS,
|
|
29
|
+
fontFamily: font.family.body,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export function Tooltip({ content, children, style }: Readonly<TooltipProps>) {
|
|
34
|
+
const { colors } = useTheme();
|
|
35
|
+
const [visible, setVisible] = useState(false);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<View style={[styles.wrapper, style]}>
|
|
39
|
+
<Pressable
|
|
40
|
+
onLongPress={() => setVisible(true)}
|
|
41
|
+
onPressOut={() => setVisible(false)}
|
|
42
|
+
accessibilityHint={content}
|
|
43
|
+
>
|
|
44
|
+
{children}
|
|
45
|
+
</Pressable>
|
|
46
|
+
{visible && (
|
|
47
|
+
<View
|
|
48
|
+
style={[styles.tooltip, { backgroundColor: colors.colorOnBg }]}
|
|
49
|
+
accessibilityRole="text"
|
|
50
|
+
accessibilityLabel={content}
|
|
51
|
+
>
|
|
52
|
+
<Text style={[styles.text, { color: colors.colorBg }]}>{content}</Text>
|
|
53
|
+
</View>
|
|
54
|
+
)}
|
|
55
|
+
</View>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { ThemeProvider } from '../../../native/ThemeContext';
|
|
3
|
+
import { Typography } from './Typography.native';
|
|
4
|
+
|
|
5
|
+
function renderWithTheme(ui: React.ReactElement) {
|
|
6
|
+
return render(<ThemeProvider>{ui}</ThemeProvider>);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
describe('Typography (native)', () => {
|
|
10
|
+
it('renders children text', () => {
|
|
11
|
+
renderWithTheme(<Typography>Hello world</Typography>);
|
|
12
|
+
expect(screen.getByText('Hello world')).toBeInTheDocument();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('defaults to body variant without heading role', () => {
|
|
16
|
+
renderWithTheme(<Typography>Body text</Typography>);
|
|
17
|
+
expect(screen.getByText('Body text')).toBeInTheDocument();
|
|
18
|
+
expect(screen.queryByRole('heading')).not.toBeInTheDocument();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('has heading role for h1 variant', () => {
|
|
22
|
+
renderWithTheme(<Typography variant="h1">Heading 1</Typography>);
|
|
23
|
+
expect(screen.getByRole('heading')).toBeInTheDocument();
|
|
24
|
+
expect(screen.getByText('Heading 1')).toBeInTheDocument();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('has heading role for h2 variant', () => {
|
|
28
|
+
renderWithTheme(<Typography variant="h2">Heading 2</Typography>);
|
|
29
|
+
expect(screen.getByRole('heading')).toBeInTheDocument();
|
|
30
|
+
expect(screen.getByText('Heading 2')).toBeInTheDocument();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('has heading role for h3 variant', () => {
|
|
34
|
+
renderWithTheme(<Typography variant="h3">Heading 3</Typography>);
|
|
35
|
+
expect(screen.getByRole('heading')).toBeInTheDocument();
|
|
36
|
+
expect(screen.getByText('Heading 3')).toBeInTheDocument();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('does not have heading role for body_s variant', () => {
|
|
40
|
+
renderWithTheme(<Typography variant="body_s">Small body</Typography>);
|
|
41
|
+
expect(screen.getByText('Small body')).toBeInTheDocument();
|
|
42
|
+
expect(screen.queryByRole('heading')).not.toBeInTheDocument();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('accepts custom style', () => {
|
|
46
|
+
renderWithTheme(<Typography style={{ marginTop: 10 }}>Styled</Typography>);
|
|
47
|
+
expect(screen.getByText('Styled')).toBeInTheDocument();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -7,7 +7,7 @@ const meta = {
|
|
|
7
7
|
tags: ['!stable', 'alpha'],
|
|
8
8
|
title: 'React Native/UI/Typography',
|
|
9
9
|
component: Typography,
|
|
10
|
-
decorators: [(Story) => <ThemeProvider><Story /></ThemeProvider>],
|
|
10
|
+
decorators: [(Story) => <ThemeProvider colorScheme="light"><Story /></ThemeProvider>],
|
|
11
11
|
parameters: { layout: 'padded' },
|
|
12
12
|
argTypes: {
|
|
13
13
|
variant: { control: 'select', options: ['h1', 'h2', 'h3', 'body', 'body_s'] },
|
|
@@ -25,14 +25,12 @@ export const BodySmall: Story = { args: { children: 'The quick brown fox jumps o
|
|
|
25
25
|
export const AllVariants: Story = {
|
|
26
26
|
args: { children: '' },
|
|
27
27
|
render: () => (
|
|
28
|
-
<
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
</div>
|
|
36
|
-
</ThemeProvider>
|
|
28
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
|
29
|
+
<Typography variant="h1">Heading 1</Typography>
|
|
30
|
+
<Typography variant="h2">Heading 2</Typography>
|
|
31
|
+
<Typography variant="h3">Heading 3</Typography>
|
|
32
|
+
<Typography variant="body">Body — The quick brown fox jumps over the lazy dog.</Typography>
|
|
33
|
+
<Typography variant="body_s">Body Small — The quick brown fox jumps over the lazy dog.</Typography>
|
|
34
|
+
</div>
|
|
37
35
|
),
|
|
38
36
|
};
|
|
@@ -11,9 +11,9 @@ interface ThemeContextValue {
|
|
|
11
11
|
|
|
12
12
|
const ThemeContext = createContext<ThemeContextValue | null>(null);
|
|
13
13
|
|
|
14
|
-
export function ThemeProvider({ children }: { children: ReactNode }) {
|
|
15
|
-
const
|
|
16
|
-
const isDark =
|
|
14
|
+
export function ThemeProvider({ children, colorScheme }: { children: ReactNode; colorScheme?: 'light' | 'dark' }) {
|
|
15
|
+
const systemScheme = useColorScheme();
|
|
16
|
+
const isDark = (colorScheme ?? systemScheme) === 'dark';
|
|
17
17
|
const value = useMemo<ThemeContextValue>(
|
|
18
18
|
() => ({ colors: isDark ? colors.dark : colors.light, isDark }),
|
|
19
19
|
[isDark],
|
package/src/native.ts
CHANGED
|
@@ -15,6 +15,24 @@ export { Progress } from './components/ui/Progress/Progress.native';
|
|
|
15
15
|
export { Skeleton } from './components/ui/Skeleton/Skeleton.native';
|
|
16
16
|
export { Alert } from './components/ui/Alert/Alert.native';
|
|
17
17
|
export { NotificationBanner } from './components/ui/NotificationBanner/NotificationBanner.native';
|
|
18
|
+
export { Link } from './components/ui/Link/Link.native';
|
|
19
|
+
export { DescriptionList } from './components/ui/DescriptionList/DescriptionList.native';
|
|
20
|
+
export type { DescriptionItem } from './components/ui/DescriptionList/DescriptionList.native';
|
|
21
|
+
export { Breadcrumb } from './components/ui/Breadcrumb/Breadcrumb.native';
|
|
22
|
+
export type { BreadcrumbItem } from './components/ui/Breadcrumb/Breadcrumb.native';
|
|
23
|
+
export { ProgressCircle } from './components/ui/ProgressCircle/ProgressCircle.native';
|
|
24
|
+
export { Tooltip } from './components/ui/Tooltip/Tooltip.native';
|
|
25
|
+
export { Pagination } from './components/ui/Pagination/Pagination.native';
|
|
26
|
+
export { Collapsible } from './components/ui/Collapsible/Collapsible.native';
|
|
27
|
+
export type { CollapsibleProps } from './components/ui/Collapsible/Collapsible.native';
|
|
28
|
+
export { Accordion } from './components/ui/Accordion/Accordion.native';
|
|
29
|
+
export type { AccordionItem } from './components/ui/Accordion/Accordion.native';
|
|
30
|
+
export { Tabs } from './components/ui/Tabs/Tabs.native';
|
|
31
|
+
export type { TabItem } from './components/ui/Tabs/Tabs.native';
|
|
32
|
+
export { Table } from './components/ui/Table/Table.native';
|
|
33
|
+
export type { TableColumn } from './components/ui/Table/Table.native';
|
|
34
|
+
export { Calendar } from './components/ui/Calendar/Calendar.native';
|
|
35
|
+
export { Carousel } from './components/ui/Carousel/Carousel.native';
|
|
18
36
|
|
|
19
37
|
// Layout
|
|
20
38
|
export { Card } from './components/layout/Card/Card.native';
|
|
@@ -26,10 +44,29 @@ export type { ButtonGroupProps } from './components/layout/ButtonGroup/ButtonGro
|
|
|
26
44
|
|
|
27
45
|
// Interaction
|
|
28
46
|
export { Button } from './components/interaction/Button/Button.native';
|
|
47
|
+
export { Rating } from './components/interaction/Rating/Rating.native';
|
|
29
48
|
export type { ButtonProps } from './components/interaction/Button/Button.native';
|
|
30
49
|
export { Switch } from './components/interaction/form/Switch/Switch.native';
|
|
31
50
|
export { Checkbox } from './components/interaction/form/Checkbox/Checkbox.native';
|
|
51
|
+
export { CheckboxGroup } from './components/interaction/form/CheckboxGroup/CheckboxGroup.native';
|
|
32
52
|
export { Radio } from './components/interaction/form/Radio/Radio.native';
|
|
53
|
+
export { RadioGroup } from './components/interaction/form/RadioGroup/RadioGroup.native';
|
|
54
|
+
export { FileInput } from './components/interaction/form/FileInput/FileInput.native';
|
|
55
|
+
export { Combobox } from './components/interaction/form/Combobox/Combobox.native';
|
|
56
|
+
export type { ComboboxOption } from './components/interaction/form/Combobox/Combobox.native';
|
|
57
|
+
export { SegmentedControl } from './components/interaction/form/SegmentedControl/SegmentedControl.native';
|
|
58
|
+
export { FormInput } from './components/interaction/form/FormInput/FormInput.native';
|
|
59
|
+
export { Textarea } from './components/interaction/form/Textarea/Textarea.native';
|
|
60
|
+
export { Select } from './components/interaction/form/Select/Select.native';
|
|
61
|
+
export type { SelectOption } from './components/interaction/form/Select/Select.native';
|
|
62
|
+
export { Slider } from './components/interaction/form/Slider/Slider.native';
|
|
63
|
+
export { NumberInput } from './components/interaction/form/NumberInput/NumberInput.native';
|
|
64
|
+
export { Dialog } from './components/interaction/Dialog/Dialog.native';
|
|
65
|
+
export { Drawer } from './components/interaction/Drawer/Drawer.native';
|
|
66
|
+
export { ToastProvider, useToast } from './components/interaction/Toast/Toast.native';
|
|
67
|
+
export { DropdownMenu } from './components/interaction/DropdownMenu/DropdownMenu.native';
|
|
68
|
+
export type { DropdownMenuItem } from './components/interaction/DropdownMenu/DropdownMenu.native';
|
|
69
|
+
export { Popover } from './components/interaction/Popover/Popover.native';
|
|
33
70
|
|
|
34
71
|
// Atoms
|
|
35
72
|
export { Label } from './components/interaction/form/atoms/Label.native';
|
|
@@ -6,7 +6,7 @@ import { Meta } from '@storybook/blocks';
|
|
|
6
6
|
|
|
7
7
|
> **Status: alpha** — components and APIs may change before stable release.
|
|
8
8
|
|
|
9
|
-
`@boostdev/components` ships native implementations for
|
|
9
|
+
`@boostdev/components` ships native implementations for 47 components — near-complete parity with the React web library. These use React Native primitives (`View`, `Text`, `Pressable`, `StyleSheet`, `Modal`, `Animated`) rather than HTML elements, and consume a dedicated token layer instead of CSS custom properties.
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -65,47 +65,82 @@ function MyComponent() {
|
|
|
65
65
|
}
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
## Available Components
|
|
68
|
+
## Available Components (47)
|
|
69
69
|
|
|
70
|
-
### UI
|
|
70
|
+
### UI (22)
|
|
71
71
|
|
|
72
72
|
| Component | Description |
|
|
73
73
|
|-----------|-------------|
|
|
74
|
-
| `
|
|
75
|
-
| `Badge` | Short status label with 5 semantic variants |
|
|
76
|
-
| `Avatar` | Initials-based avatar with 3 sizes |
|
|
74
|
+
| `Accordion` | Expandable sections, exclusive or multi-open mode |
|
|
77
75
|
| `Alert` | Inline status message with optional title and dismiss |
|
|
76
|
+
| `Avatar` | Initials-based avatar with 3 sizes |
|
|
77
|
+
| `Badge` | Short status label with 5 semantic variants |
|
|
78
|
+
| `Breadcrumb` | Navigation trail with pressable items |
|
|
79
|
+
| `Calendar` | Month grid date picker with min/max constraints |
|
|
80
|
+
| `Carousel` | Horizontal paging scroll with dot indicators |
|
|
81
|
+
| `Collapsible` | Animated expand/collapse section |
|
|
82
|
+
| `DescriptionList` | Key-value pair display |
|
|
83
|
+
| `Link` | Pressable text that opens URLs via `Linking` |
|
|
84
|
+
| `Loading` | Animated loading spinner |
|
|
78
85
|
| `NotificationBanner` | Full-width banner notification |
|
|
86
|
+
| `Pagination` | Page navigation with prev/next and page buttons |
|
|
79
87
|
| `Progress` | Linear progress bar |
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
88
|
+
| `ProgressCircle` | Circular progress indicator |
|
|
89
|
+
| `Rating` | Read-only star rating display |
|
|
82
90
|
| `Separator` | Visual divider |
|
|
91
|
+
| `Skeleton` | Loading placeholder |
|
|
92
|
+
| `Table` | Scrollable data table with sortable columns |
|
|
93
|
+
| `Tabs` | Tabbed interface with pressable tab headers |
|
|
94
|
+
| `Tooltip` | Long-press tooltip overlay |
|
|
95
|
+
| `Typography` | Text with semantic variants: `h1`, `h2`, `h3`, `body`, `body_s` |
|
|
83
96
|
|
|
84
|
-
### Layout
|
|
97
|
+
### Layout (4)
|
|
85
98
|
|
|
86
99
|
| Component | Description |
|
|
87
100
|
|-----------|-------------|
|
|
88
|
-
| `Card` | Elevated content container |
|
|
89
|
-
| `SectionHeader` | Section heading with optional action |
|
|
90
101
|
| `ButtonGroup` | Horizontal or vertical button row |
|
|
102
|
+
| `Card` | Elevated content container |
|
|
91
103
|
| `IconWrapper` | Consistent icon sizing wrapper |
|
|
104
|
+
| `SectionHeader` | Section heading with optional action |
|
|
92
105
|
|
|
93
|
-
### Interaction
|
|
106
|
+
### Interaction (8)
|
|
94
107
|
|
|
95
108
|
| Component | Description |
|
|
96
109
|
|-----------|-------------|
|
|
97
110
|
| `Button` | Primary action element with `onPress` |
|
|
111
|
+
| `Dialog` | Modal dialog with backdrop and close button |
|
|
112
|
+
| `Drawer` | Sliding side panel with animated transitions |
|
|
113
|
+
| `DropdownMenu` | Bottom-sheet menu with pressable items |
|
|
114
|
+
| `Popover` | Modal-based popover overlay |
|
|
115
|
+
| `ToastProvider` / `useToast` | Toast notification system with auto-dismiss |
|
|
98
116
|
|
|
99
|
-
### Form
|
|
117
|
+
### Form (13)
|
|
100
118
|
|
|
101
119
|
| Component | Description |
|
|
102
120
|
|-----------|-------------|
|
|
103
121
|
| `Checkbox` | Controlled checkbox with label, hint, and error |
|
|
122
|
+
| `CheckboxGroup` | Group wrapper with legend for multiple checkboxes |
|
|
123
|
+
| `Combobox` | Text input with filtered dropdown options |
|
|
124
|
+
| `FileInput` | File selection button with file name display |
|
|
125
|
+
| `FormInput` | Labeled text input with hint/error support |
|
|
126
|
+
| `NumberInput` | Numeric input with stepper buttons |
|
|
104
127
|
| `Radio` | Controlled radio button |
|
|
128
|
+
| `RadioGroup` | Group wrapper with legend for radio buttons |
|
|
129
|
+
| `SegmentedControl` | Horizontal segmented button group |
|
|
130
|
+
| `Select` | Bottom-sheet option picker |
|
|
131
|
+
| `Slider` | Draggable range input with value display |
|
|
105
132
|
| `Switch` | Toggle switch |
|
|
133
|
+
| `Textarea` | Multiline text input |
|
|
106
134
|
| `Label` | Form field label atom |
|
|
107
135
|
| `Message` | Form field hint/error atom |
|
|
108
136
|
|
|
137
|
+
### Not available (deferred)
|
|
138
|
+
|
|
139
|
+
| Component | Reason |
|
|
140
|
+
|-----------|--------|
|
|
141
|
+
| `Command` | Depends on cmdk library (browser-only) |
|
|
142
|
+
| `SkipLink` | Browser-only accessibility pattern |
|
|
143
|
+
|
|
109
144
|
## Key differences from the web components
|
|
110
145
|
|
|
111
146
|
| Web | React Native |
|
|
@@ -31,7 +31,7 @@ function BdsCheckboxGroup({
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
const meta = {
|
|
34
|
-
title: 'Web Components/
|
|
34
|
+
title: 'Web Components/Form/CheckboxGroup',
|
|
35
35
|
component: BdsCheckboxGroup,
|
|
36
36
|
tags: ['!stable', 'experimental'],
|
|
37
37
|
parameters: { layout: 'centered' },
|
|
@@ -28,7 +28,7 @@ function BdsNumberInput({
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
const meta = {
|
|
31
|
-
title: 'Web Components/
|
|
31
|
+
title: 'Web Components/Form/NumberInput',
|
|
32
32
|
component: BdsNumberInput,
|
|
33
33
|
tags: ['!stable', 'experimental'],
|
|
34
34
|
parameters: { layout: 'centered' },
|
|
@@ -43,7 +43,7 @@ function BdsSegmentedControl({
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
const meta = {
|
|
46
|
-
title: 'Web Components/
|
|
46
|
+
title: 'Web Components/Form/SegmentedControl',
|
|
47
47
|
component: BdsSegmentedControl,
|
|
48
48
|
tags: ['!stable', 'experimental'],
|
|
49
49
|
parameters: { layout: 'centered' },
|