@jordan-mace/chaser-design-system 1.2.3 → 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/dist/components/Accordion/Accordion.d.ts +16 -0
- package/dist/components/Accordion/Accordion.js +43 -0
- package/dist/components/Accordion/index.d.ts +1 -0
- package/dist/components/Accordion/index.js +1 -0
- package/dist/components/Accordion/styles.css.d.ts +7 -0
- package/dist/components/Accordion/styles.css.js +65 -0
- package/dist/components/Alert/Alert.d.ts +9 -0
- package/dist/components/Alert/Alert.js +8 -0
- package/dist/components/Alert/index.d.ts +1 -0
- package/dist/components/Alert/index.js +1 -0
- package/dist/components/Alert/styles.css.d.ts +4 -0
- package/dist/components/Alert/styles.css.js +54 -0
- package/dist/components/AspectRatio/AspectRatio.d.ts +9 -0
- package/dist/components/AspectRatio/AspectRatio.js +12 -0
- package/dist/components/AspectRatio/index.d.ts +2 -0
- package/dist/components/AspectRatio/index.js +1 -0
- package/dist/components/Avatar/Avatar.d.ts +11 -0
- package/dist/components/Avatar/Avatar.js +13 -0
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Avatar/index.js +1 -0
- package/dist/components/Avatar/styles.css.d.ts +4 -0
- package/dist/components/Avatar/styles.css.js +151 -0
- package/dist/components/Badge/Badge.d.ts +11 -0
- package/dist/components/Badge/Badge.js +8 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Badge/index.js +1 -0
- package/dist/components/Badge/styles.css.d.ts +5 -0
- package/dist/components/Badge/styles.css.js +77 -0
- package/dist/components/Box/Box.d.ts +11 -0
- package/dist/components/Box/Box.js +54 -0
- package/dist/components/Box/index.d.ts +2 -0
- package/dist/components/Box/index.js +1 -0
- package/dist/components/Box/reset.css.d.ts +1 -0
- package/dist/components/Box/reset.css.js +15 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +12 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +8 -0
- package/dist/components/Breadcrumb/index.d.ts +1 -0
- package/dist/components/Breadcrumb/index.js +1 -0
- package/dist/components/Breadcrumb/styles.css.d.ts +6 -0
- package/dist/components/Breadcrumb/styles.css.js +50 -0
- package/dist/components/Button/Button.d.ts +9 -0
- package/dist/components/Button/Button.js +8 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Button/index.js +1 -0
- package/dist/components/Button/styles.css.d.ts +2 -0
- package/dist/components/Button/styles.css.js +30 -0
- package/dist/components/Card/Card.d.ts +8 -0
- package/dist/components/Card/Card.js +8 -0
- package/dist/components/Card/index.d.ts +1 -0
- package/dist/components/Card/index.js +1 -0
- package/dist/components/Card/styles.css.d.ts +2 -0
- package/dist/components/Card/styles.css.js +25 -0
- package/dist/components/Checkbox/Checkbox.d.ts +6 -0
- package/dist/components/Checkbox/Checkbox.js +25 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Checkbox/index.js +1 -0
- package/dist/components/Checkbox/styles.css.d.ts +3 -0
- package/dist/components/Checkbox/styles.css.js +31 -0
- package/dist/components/Collapse/Collapse.d.ts +12 -0
- package/dist/components/Collapse/Collapse.js +56 -0
- package/dist/components/Collapse/index.d.ts +2 -0
- package/dist/components/Collapse/index.js +1 -0
- package/dist/components/Collapse/styles.css.d.ts +3 -0
- package/dist/components/Collapse/styles.css.js +36 -0
- package/dist/components/Combobox/Combobox.d.ts +23 -0
- package/dist/components/Combobox/Combobox.js +104 -0
- package/dist/components/Combobox/index.d.ts +2 -0
- package/dist/components/Combobox/index.js +1 -0
- package/dist/components/Combobox/styles.css.d.ts +13 -0
- package/dist/components/Combobox/styles.css.js +142 -0
- package/dist/components/Container/Container.d.ts +11 -0
- package/dist/components/Container/Container.js +21 -0
- package/dist/components/Container/index.d.ts +2 -0
- package/dist/components/Container/index.js +1 -0
- package/dist/components/Divider/Divider.d.ts +9 -0
- package/dist/components/Divider/Divider.js +8 -0
- package/dist/components/Divider/index.d.ts +2 -0
- package/dist/components/Divider/index.js +1 -0
- package/dist/components/Divider/styles.css.d.ts +4 -0
- package/dist/components/Divider/styles.css.js +41 -0
- package/dist/components/Drawer/Drawer.d.ts +16 -0
- package/dist/components/Drawer/Drawer.js +65 -0
- package/dist/components/Drawer/index.d.ts +2 -0
- package/dist/components/Drawer/index.js +1 -0
- package/dist/components/Drawer/styles.css.d.ts +8 -0
- package/dist/components/Drawer/styles.css.js +125 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +23 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +43 -0
- package/dist/components/DropdownMenu/index.d.ts +2 -0
- package/dist/components/DropdownMenu/index.js +1 -0
- package/dist/components/DropdownMenu/styles.css.d.ts +9 -0
- package/dist/components/DropdownMenu/styles.css.js +93 -0
- package/dist/components/EmptyState/EmptyState.d.ts +10 -0
- package/dist/components/EmptyState/EmptyState.js +8 -0
- package/dist/components/EmptyState/index.d.ts +2 -0
- package/dist/components/EmptyState/index.js +1 -0
- package/dist/components/EmptyState/styles.css.d.ts +5 -0
- package/dist/components/EmptyState/styles.css.js +30 -0
- package/dist/components/FileUpload/FileUpload.d.ts +27 -0
- package/dist/components/FileUpload/FileUpload.js +102 -0
- package/dist/components/FileUpload/index.d.ts +2 -0
- package/dist/components/FileUpload/index.js +1 -0
- package/dist/components/FileUpload/styles.css.d.ts +19 -0
- package/dist/components/FileUpload/styles.css.js +145 -0
- package/dist/components/Form/Form.d.ts +7 -0
- package/dist/components/Form/Form.js +8 -0
- package/dist/components/Form/FormInput.d.ts +5 -0
- package/dist/components/Form/FormInput.js +9 -0
- package/dist/components/Form/index.d.ts +2 -0
- package/dist/components/Form/index.js +2 -0
- package/dist/components/Form/styles.css.d.ts +2 -0
- package/dist/components/Form/styles.css.js +11 -0
- package/dist/components/Grid/Grid.d.ts +13 -0
- package/dist/components/Grid/Grid.js +25 -0
- package/dist/components/Grid/index.d.ts +2 -0
- package/dist/components/Grid/index.js +1 -0
- package/dist/components/Icon/Icon.d.ts +12 -0
- package/dist/components/Icon/Icon.js +21 -0
- package/dist/components/Icon/index.d.ts +1 -0
- package/dist/components/Icon/index.js +1 -0
- package/dist/components/Icon/styles.css.d.ts +1 -0
- package/dist/components/Icon/styles.css.js +9 -0
- package/dist/components/Input/Input.d.ts +7 -0
- package/dist/components/Input/Input.js +9 -0
- package/dist/components/Input/index.d.ts +1 -0
- package/dist/components/Input/index.js +1 -0
- package/dist/components/Input/styles.css.d.ts +2 -0
- package/dist/components/Input/styles.css.js +8 -0
- package/dist/components/Kbd/Kbd.d.ts +7 -0
- package/dist/components/Kbd/Kbd.js +6 -0
- package/dist/components/Kbd/index.d.ts +2 -0
- package/dist/components/Kbd/index.js +1 -0
- package/dist/components/Kbd/styles.css.d.ts +1 -0
- package/dist/components/Kbd/styles.css.js +16 -0
- package/dist/components/List/List.d.ts +5 -0
- package/dist/components/List/List.js +7 -0
- package/dist/components/List/ListItem.d.ts +5 -0
- package/dist/components/List/ListItem.js +7 -0
- package/dist/components/List/index.d.ts +2 -0
- package/dist/components/List/index.js +2 -0
- package/dist/components/List/styles.css.d.ts +2 -0
- package/dist/components/List/styles.css.js +11 -0
- package/dist/components/Modal/Modal.d.ts +13 -0
- package/dist/components/Modal/Modal.js +35 -0
- package/dist/components/Modal/index.d.ts +2 -0
- package/dist/components/Modal/index.js +1 -0
- package/dist/components/Modal/styles.css.d.ts +7 -0
- package/dist/components/Modal/styles.css.js +92 -0
- package/dist/components/Navbar/Navbar.d.ts +6 -0
- package/dist/components/Navbar/Navbar.js +8 -0
- package/dist/components/Navbar/NavbarItem.d.ts +6 -0
- package/dist/components/Navbar/NavbarItem.js +8 -0
- package/dist/components/Navbar/index.d.ts +2 -0
- package/dist/components/Navbar/index.js +2 -0
- package/dist/components/Navbar/styles.css.d.ts +2 -0
- package/dist/components/Navbar/styles.css.js +3 -0
- package/dist/components/NumberInput/NumberInput.d.ts +20 -0
- package/dist/components/NumberInput/NumberInput.js +39 -0
- package/dist/components/NumberInput/index.d.ts +2 -0
- package/dist/components/NumberInput/index.js +1 -0
- package/dist/components/NumberInput/styles.css.d.ts +10 -0
- package/dist/components/NumberInput/styles.css.js +117 -0
- package/dist/components/Pagination/Pagination.d.ts +10 -0
- package/dist/components/Pagination/Pagination.js +47 -0
- package/dist/components/Pagination/index.d.ts +2 -0
- package/dist/components/Pagination/index.js +1 -0
- package/dist/components/Pagination/styles.css.d.ts +4 -0
- package/dist/components/Pagination/styles.css.js +44 -0
- package/dist/components/Popover/Popover.d.ts +18 -0
- package/dist/components/Popover/Popover.js +55 -0
- package/dist/components/Popover/index.d.ts +2 -0
- package/dist/components/Popover/index.js +1 -0
- package/dist/components/Popover/styles.css.d.ts +11 -0
- package/dist/components/Popover/styles.css.js +185 -0
- package/dist/components/Progress/Progress.d.ts +10 -0
- package/dist/components/Progress/Progress.js +9 -0
- package/dist/components/Progress/index.d.ts +1 -0
- package/dist/components/Progress/index.js +1 -0
- package/dist/components/Progress/styles.css.d.ts +4 -0
- package/dist/components/Progress/styles.css.js +71 -0
- package/dist/components/Radio/Radio.d.ts +16 -0
- package/dist/components/Radio/Radio.js +25 -0
- package/dist/components/Radio/index.d.ts +1 -0
- package/dist/components/Radio/index.js +1 -0
- package/dist/components/Radio/styles.css.d.ts +5 -0
- package/dist/components/Radio/styles.css.js +42 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts +11 -0
- package/dist/components/ScrollArea/ScrollArea.js +12 -0
- package/dist/components/ScrollArea/index.d.ts +2 -0
- package/dist/components/ScrollArea/index.js +1 -0
- package/dist/components/ScrollArea/styles.css.d.ts +3 -0
- package/dist/components/ScrollArea/styles.css.js +25 -0
- package/dist/components/Select/Select.d.ts +13 -0
- package/dist/components/Select/Select.js +10 -0
- package/dist/components/Select/index.d.ts +1 -0
- package/dist/components/Select/index.js +1 -0
- package/dist/components/Select/styles.css.d.ts +4 -0
- package/dist/components/Select/styles.css.js +82 -0
- package/dist/components/Separator/Separator.d.ts +8 -0
- package/dist/components/Separator/Separator.js +8 -0
- package/dist/components/Separator/index.d.ts +2 -0
- package/dist/components/Separator/index.js +1 -0
- package/dist/components/Separator/styles.css.d.ts +4 -0
- package/dist/components/Separator/styles.css.js +28 -0
- package/dist/components/Skeleton/Skeleton.d.ts +14 -0
- package/dist/components/Skeleton/Skeleton.js +13 -0
- package/dist/components/Skeleton/index.d.ts +2 -0
- package/dist/components/Skeleton/index.js +1 -0
- package/dist/components/Skeleton/styles.css.d.ts +4 -0
- package/dist/components/Skeleton/styles.css.js +56 -0
- package/dist/components/Spinner/Spinner.d.ts +10 -0
- package/dist/components/Spinner/Spinner.js +8 -0
- package/dist/components/Spinner/index.d.ts +2 -0
- package/dist/components/Spinner/index.js +1 -0
- package/dist/components/Spinner/styles.css.d.ts +4 -0
- package/dist/components/Spinner/styles.css.js +55 -0
- package/dist/components/Stack/Stack.d.ts +16 -0
- package/dist/components/Stack/Stack.js +24 -0
- package/dist/components/Stack/index.d.ts +2 -0
- package/dist/components/Stack/index.js +1 -0
- package/dist/components/Stepper/Stepper.d.ts +18 -0
- package/dist/components/Stepper/Stepper.js +25 -0
- package/dist/components/Stepper/index.d.ts +2 -0
- package/dist/components/Stepper/index.js +1 -0
- package/dist/components/Stepper/styles.css.d.ts +14 -0
- package/dist/components/Stepper/styles.css.js +104 -0
- package/dist/components/Table/Table.d.ts +42 -0
- package/dist/components/Table/Table.js +39 -0
- package/dist/components/Table/index.d.ts +1 -0
- package/dist/components/Table/index.js +1 -0
- package/dist/components/Table/styles.css.d.ts +8 -0
- package/dist/components/Table/styles.css.js +49 -0
- package/dist/components/Tabs/Tabs.d.ts +29 -0
- package/dist/components/Tabs/Tabs.js +52 -0
- package/dist/components/Tabs/index.d.ts +1 -0
- package/dist/components/Tabs/index.js +1 -0
- package/dist/components/Tabs/styles.css.d.ts +6 -0
- package/dist/components/Tabs/styles.css.js +100 -0
- package/dist/components/Tag/Tag.d.ts +16 -0
- package/dist/components/Tag/Tag.js +18 -0
- package/dist/components/Tag/index.d.ts +1 -0
- package/dist/components/Tag/index.js +1 -0
- package/dist/components/Tag/styles.css.d.ts +3 -0
- package/dist/components/Tag/styles.css.js +93 -0
- package/dist/components/Text/Header.d.ts +8 -0
- package/dist/components/Text/Header.js +8 -0
- package/dist/components/Text/P.d.ts +7 -0
- package/dist/components/Text/P.js +8 -0
- package/dist/components/Text/index.d.ts +2 -0
- package/dist/components/Text/index.js +2 -0
- package/dist/components/Text/styles.css.d.ts +2 -0
- package/dist/components/Text/styles.css.js +13 -0
- package/dist/components/TextArea/TextArea.d.ts +7 -0
- package/dist/components/TextArea/TextArea.js +9 -0
- package/dist/components/TextArea/index.d.ts +2 -0
- package/dist/components/TextArea/index.js +1 -0
- package/dist/components/TextArea/styles.css.d.ts +2 -0
- package/dist/components/TextArea/styles.css.js +10 -0
- package/dist/components/Toast/Toast.d.ts +34 -0
- package/dist/components/Toast/Toast.js +177 -0
- package/dist/components/Toast/index.d.ts +1 -0
- package/dist/components/Toast/index.js +1 -0
- package/dist/components/Toast/styles.css.d.ts +21 -0
- package/dist/components/Toast/styles.css.js +192 -0
- package/dist/components/Toggle/Toggle.d.ts +10 -0
- package/dist/components/Toggle/Toggle.js +17 -0
- package/dist/components/Toggle/index.d.ts +2 -0
- package/dist/components/Toggle/index.js +1 -0
- package/dist/components/Toggle/styles.css.d.ts +12 -0
- package/dist/components/Toggle/styles.css.js +118 -0
- package/dist/components/Tooltip/Tooltip.d.ts +10 -0
- package/dist/components/Tooltip/Tooltip.js +16 -0
- package/dist/components/Tooltip/index.d.ts +2 -0
- package/dist/components/Tooltip/index.js +1 -0
- package/dist/components/Tooltip/styles.css.d.ts +8 -0
- package/dist/components/Tooltip/styles.css.js +86 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +8 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +9 -0
- package/dist/components/VisuallyHidden/index.d.ts +2 -0
- package/dist/components/VisuallyHidden/index.js +1 -0
- package/dist/components/VisuallyHidden/styles.css.d.ts +1 -0
- package/dist/components/VisuallyHidden/styles.css.js +12 -0
- package/dist/components/index.d.ts +68 -0
- package/dist/components/index.js +47 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/styles/layers.css.d.ts +3 -0
- package/dist/styles/layers.css.js +3 -0
- package/dist/styles/sprinkles.css.d.ts +241 -0
- package/dist/styles/sprinkles.css.js +165 -0
- package/dist/styles/theme.css.d.ts +38 -0
- package/dist/styles/theme.css.js +51 -0
- package/dist/styles/utils.d.ts +2 -0
- package/dist/styles/utils.js +7 -0
- package/package.json +9 -18
- package/dist/index.cjs +0 -4894
- package/dist/index.d.cts +0 -1111
- package/dist/index.d.mts +0 -1111
- package/dist/index.mjs +0 -4812
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type SkeletonVariant = 'text' | 'circle' | 'rectangle';
|
|
3
|
+
export type SkeletonSize = 'small' | 'medium' | 'large';
|
|
4
|
+
export type SkeletonAnimation = 'shimmer' | 'pulse' | 'none';
|
|
5
|
+
export interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
variant?: SkeletonVariant;
|
|
7
|
+
size?: SkeletonSize;
|
|
8
|
+
animation?: SkeletonAnimation;
|
|
9
|
+
width?: string | number;
|
|
10
|
+
height?: string | number;
|
|
11
|
+
count?: number;
|
|
12
|
+
}
|
|
13
|
+
declare const Skeleton: ({ variant, size, animation, width, height, count, className, ...props }: SkeletonProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export default Skeleton;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { skeleton, skeletonVariants, skeletonSizes, skeletonAnimation, } from './styles.css';
|
|
4
|
+
import Box from '../Box';
|
|
5
|
+
const Skeleton = ({ variant = 'text', size = 'medium', animation = 'shimmer', width, height, count = 1, className, ...props }) => {
|
|
6
|
+
const style = {
|
|
7
|
+
width: width,
|
|
8
|
+
height: height,
|
|
9
|
+
};
|
|
10
|
+
const skeletons = Array.from({ length: count }, (_, index) => (_jsx(Box, { as: "span", className: clsx(skeleton, skeletonVariants[variant], skeletonSizes[size], skeletonAnimation[animation], className), style: style, "aria-hidden": "true", ...props }, index)));
|
|
11
|
+
return (_jsx(Box, { display: "flex", flexDirection: "column", gap: "small", children: skeletons }));
|
|
12
|
+
};
|
|
13
|
+
export default Skeleton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Skeleton } from './Skeleton';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const skeletonVariants: Record<"text" | "circle" | "rectangle", string>;
|
|
2
|
+
export declare const skeletonSizes: Record<"medium" | "large" | "small", string>;
|
|
3
|
+
export declare const skeletonAnimation: Record<"none" | "shimmer" | "pulse", string>;
|
|
4
|
+
export declare const skeleton: string;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { styleVariants, keyframes } from '@vanilla-extract/css';
|
|
2
|
+
import { vars } from '../../styles/theme.css';
|
|
3
|
+
import { styleWithLayer } from '../../styles/utils';
|
|
4
|
+
const shimmer = keyframes({
|
|
5
|
+
'0%': { backgroundPosition: '-200% 0' },
|
|
6
|
+
'100%': { backgroundPosition: '200% 0' },
|
|
7
|
+
});
|
|
8
|
+
const pulse = keyframes({
|
|
9
|
+
'0%, 100%': { opacity: 1 },
|
|
10
|
+
'50%': { opacity: 0.5 },
|
|
11
|
+
});
|
|
12
|
+
export const skeletonVariants = styleVariants({
|
|
13
|
+
text: {
|
|
14
|
+
borderRadius: '0.25rem',
|
|
15
|
+
},
|
|
16
|
+
circle: {
|
|
17
|
+
borderRadius: '50%',
|
|
18
|
+
},
|
|
19
|
+
rectangle: {
|
|
20
|
+
borderRadius: '0.5rem',
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
export const skeletonSizes = styleVariants({
|
|
24
|
+
small: {
|
|
25
|
+
height: '1rem',
|
|
26
|
+
},
|
|
27
|
+
medium: {
|
|
28
|
+
height: '1.5rem',
|
|
29
|
+
},
|
|
30
|
+
large: {
|
|
31
|
+
height: '2rem',
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
export const skeletonAnimation = styleVariants({
|
|
35
|
+
shimmer: {
|
|
36
|
+
background: `linear-gradient(
|
|
37
|
+
90deg,
|
|
38
|
+
${vars.colors.borderMuted} 25%,
|
|
39
|
+
${vars.colors.borderDefault} 50%,
|
|
40
|
+
${vars.colors.borderMuted} 75%
|
|
41
|
+
)`,
|
|
42
|
+
backgroundSize: '200% 100%',
|
|
43
|
+
animation: `${shimmer} 1.5s ease-in-out infinite`,
|
|
44
|
+
},
|
|
45
|
+
pulse: {
|
|
46
|
+
backgroundColor: vars.colors.borderMuted,
|
|
47
|
+
animation: `${pulse} 2s ease-in-out infinite`,
|
|
48
|
+
},
|
|
49
|
+
none: {
|
|
50
|
+
backgroundColor: vars.colors.borderMuted,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
export const skeleton = styleWithLayer({
|
|
54
|
+
width: '100%',
|
|
55
|
+
display: 'inline-block',
|
|
56
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type SpinnerColor = 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info';
|
|
3
|
+
export type SpinnerSize = 'small' | 'medium' | 'large';
|
|
4
|
+
export interface SpinnerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
color?: SpinnerColor;
|
|
6
|
+
size?: SpinnerSize;
|
|
7
|
+
role?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const Spinner: ({ color, size, role, ...props }: SpinnerProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default Spinner;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { spinner, spinnerColors, spinnerSizes, } from './styles.css';
|
|
4
|
+
import Box from '../Box';
|
|
5
|
+
const Spinner = ({ color = 'primary', size = 'medium', role = 'status', ...props }) => {
|
|
6
|
+
return (_jsx(Box, { as: "div", className: clsx(spinner, spinnerColors[color], spinnerSizes[size], props.className), role: role, "aria-label": "Loading", ...props }));
|
|
7
|
+
};
|
|
8
|
+
export default Spinner;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Spinner } from './Spinner';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const spin: string;
|
|
2
|
+
export declare const spinnerColors: Record<"primary" | "secondary" | "success" | "warning" | "error" | "info", string>;
|
|
3
|
+
export declare const spinnerSizes: Record<"medium" | "large" | "small", string>;
|
|
4
|
+
export declare const spinner: string;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { style, styleVariants, keyframes } from '@vanilla-extract/css';
|
|
2
|
+
import { vars } from '../../styles/theme.css';
|
|
3
|
+
export const spin = keyframes({
|
|
4
|
+
'0%': { transform: 'rotate(0deg)' },
|
|
5
|
+
'100%': { transform: 'rotate(360deg)' },
|
|
6
|
+
});
|
|
7
|
+
export const spinnerColors = styleVariants({
|
|
8
|
+
primary: {
|
|
9
|
+
borderColor: vars.colors.borderDefault,
|
|
10
|
+
borderTopColor: vars.colors.buttonBackgroundPrimary,
|
|
11
|
+
},
|
|
12
|
+
secondary: {
|
|
13
|
+
borderColor: vars.colors.borderDefault,
|
|
14
|
+
borderTopColor: vars.colors.buttonBackgroundSecondary,
|
|
15
|
+
},
|
|
16
|
+
success: {
|
|
17
|
+
borderColor: vars.colors.borderDefault,
|
|
18
|
+
borderTopColor: vars.colors.alertSuccessBorder,
|
|
19
|
+
},
|
|
20
|
+
warning: {
|
|
21
|
+
borderColor: vars.colors.borderDefault,
|
|
22
|
+
borderTopColor: vars.colors.alertWarningBorder,
|
|
23
|
+
},
|
|
24
|
+
error: {
|
|
25
|
+
borderColor: vars.colors.borderDefault,
|
|
26
|
+
borderTopColor: vars.colors.alertErrorBorder,
|
|
27
|
+
},
|
|
28
|
+
info: {
|
|
29
|
+
borderColor: vars.colors.borderDefault,
|
|
30
|
+
borderTopColor: vars.colors.alertInfoBorder,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
export const spinnerSizes = styleVariants({
|
|
34
|
+
small: {
|
|
35
|
+
width: '1rem',
|
|
36
|
+
height: '1rem',
|
|
37
|
+
borderWidth: '2px',
|
|
38
|
+
},
|
|
39
|
+
medium: {
|
|
40
|
+
width: '1.5rem',
|
|
41
|
+
height: '1.5rem',
|
|
42
|
+
borderWidth: '3px',
|
|
43
|
+
},
|
|
44
|
+
large: {
|
|
45
|
+
width: '2rem',
|
|
46
|
+
height: '2rem',
|
|
47
|
+
borderWidth: '4px',
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
export const spinner = style({
|
|
51
|
+
borderRadius: '50%',
|
|
52
|
+
borderStyle: 'solid',
|
|
53
|
+
animation: `${spin} 1s linear infinite`,
|
|
54
|
+
display: 'inline-block',
|
|
55
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type StackDirection = 'row' | 'column';
|
|
3
|
+
export type StackAlign = 'start' | 'center' | 'end' | 'stretch';
|
|
4
|
+
export type StackJustify = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
|
|
5
|
+
export interface StackProps {
|
|
6
|
+
direction?: StackDirection;
|
|
7
|
+
align?: StackAlign;
|
|
8
|
+
justify?: StackJustify;
|
|
9
|
+
gap?: 'none' | 'small' | 'medium' | 'large';
|
|
10
|
+
wrap?: boolean;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
style?: React.CSSProperties;
|
|
14
|
+
}
|
|
15
|
+
declare const Stack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<HTMLElement>>;
|
|
16
|
+
export default Stack;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import Box from '../Box';
|
|
4
|
+
const alignMap = {
|
|
5
|
+
start: 'flex-start',
|
|
6
|
+
center: 'center',
|
|
7
|
+
end: 'flex-end',
|
|
8
|
+
stretch: 'stretch',
|
|
9
|
+
};
|
|
10
|
+
const justifyMap = {
|
|
11
|
+
start: 'flex-start',
|
|
12
|
+
center: 'center',
|
|
13
|
+
end: 'flex-end',
|
|
14
|
+
between: 'space-between',
|
|
15
|
+
around: 'space-around',
|
|
16
|
+
evenly: 'space-evenly',
|
|
17
|
+
};
|
|
18
|
+
const Stack = forwardRef(({ direction = 'column', align, justify, gap, wrap, children, className, style, ...rest }, ref) => {
|
|
19
|
+
const alignItems = align ? alignMap[align] : undefined;
|
|
20
|
+
const justifyContent = justify ? justifyMap[justify] : undefined;
|
|
21
|
+
return (_jsx(Box, { ref: ref, display: "flex", flexDirection: direction, alignItems: alignItems, justifyContent: justifyContent, gap: gap, className: className, style: { flexWrap: wrap ? 'wrap' : undefined, ...style }, ...rest, children: children }));
|
|
22
|
+
});
|
|
23
|
+
Stack.displayName = 'Stack';
|
|
24
|
+
export default Stack;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Stack } from './Stack';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type StepperOrientation = 'horizontal' | 'vertical';
|
|
3
|
+
export type StepStatus = 'pending' | 'current' | 'completed';
|
|
4
|
+
export interface Step {
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
status?: StepStatus;
|
|
8
|
+
}
|
|
9
|
+
export interface StepperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
steps: Step[];
|
|
11
|
+
currentStep?: number;
|
|
12
|
+
orientation?: StepperOrientation;
|
|
13
|
+
showConnectors?: boolean;
|
|
14
|
+
onStepClick?: (stepIndex: number) => void;
|
|
15
|
+
clickable?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare const Stepper: ({ steps, currentStep, orientation, showConnectors, onStepClick, clickable, className, ...props }: StepperProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export default Stepper;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { stepperContainer, stepperHorizontal, stepperVertical, step, stepVertical, stepIndicator, stepIndicatorVariants, stepContent, stepContentVertical, stepTitle, stepDescription, stepConnector, stepConnectorCompleted, stepConnectorVertical, } from './styles.css';
|
|
4
|
+
import Box from '../Box';
|
|
5
|
+
const Stepper = ({ steps, currentStep = 0, orientation = 'horizontal', showConnectors = true, onStepClick, clickable = false, className, ...props }) => {
|
|
6
|
+
const getStepStatus = (index) => {
|
|
7
|
+
if (index < currentStep)
|
|
8
|
+
return 'completed';
|
|
9
|
+
if (index === currentStep)
|
|
10
|
+
return 'current';
|
|
11
|
+
return 'pending';
|
|
12
|
+
};
|
|
13
|
+
const handleStepClick = (index) => {
|
|
14
|
+
if (clickable && onStepClick) {
|
|
15
|
+
onStepClick(index);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
return (_jsx(Box, { className: clsx(stepperContainer, orientation === 'horizontal' ? stepperHorizontal : stepperVertical, className), role: "list", "aria-label": "Step progress", ...props, children: steps.map((stepItem, index) => {
|
|
19
|
+
const status = stepItem.status || getStepStatus(index);
|
|
20
|
+
const isLast = index === steps.length - 1;
|
|
21
|
+
const isCompleted = status === 'completed';
|
|
22
|
+
return (_jsxs(Box, { className: clsx(step, orientation === 'vertical' && stepVertical), role: "listitem", "aria-current": status === 'current' ? 'step' : undefined, children: [showConnectors && !isLast && orientation === 'horizontal' && (_jsx(Box, { className: clsx(stepConnector, isCompleted && stepConnectorCompleted), "aria-hidden": "true" })), showConnectors && !isLast && orientation === 'vertical' && (_jsx(Box, { className: stepConnectorVertical, style: { backgroundColor: isCompleted ? undefined : undefined }, "aria-hidden": "true" })), _jsx(Box, { className: clsx(stepIndicator, stepIndicatorVariants[status]), onClick: () => handleStepClick(index), style: { cursor: clickable ? 'pointer' : 'default' }, "aria-label": `Step ${index + 1}: ${stepItem.title}`, children: status === 'completed' ? '✓' : index + 1 }), _jsxs(Box, { className: clsx(stepContent, orientation === 'vertical' && stepContentVertical), children: [_jsx(Box, { as: "h4", className: stepTitle, children: stepItem.title }), stepItem.description && (_jsx(Box, { as: "p", className: stepDescription, children: stepItem.description }))] })] }, index));
|
|
23
|
+
}) }));
|
|
24
|
+
};
|
|
25
|
+
export default Stepper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Stepper } from './Stepper';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const stepperContainer: string;
|
|
2
|
+
export declare const stepperHorizontal: string;
|
|
3
|
+
export declare const stepperVertical: string;
|
|
4
|
+
export declare const step: string;
|
|
5
|
+
export declare const stepVertical: string;
|
|
6
|
+
export declare const stepIndicator: string;
|
|
7
|
+
export declare const stepIndicatorVariants: Record<"current" | "pending" | "completed", string>;
|
|
8
|
+
export declare const stepContent: string;
|
|
9
|
+
export declare const stepContentVertical: string;
|
|
10
|
+
export declare const stepTitle: string;
|
|
11
|
+
export declare const stepDescription: string;
|
|
12
|
+
export declare const stepConnector: string;
|
|
13
|
+
export declare const stepConnectorCompleted: string;
|
|
14
|
+
export declare const stepConnectorVertical: string;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { styleVariants } from '@vanilla-extract/css';
|
|
2
|
+
import { vars } from '../../styles/theme.css';
|
|
3
|
+
import { styleWithLayer } from '../../styles/utils';
|
|
4
|
+
export const stepperContainer = styleWithLayer({
|
|
5
|
+
display: 'flex',
|
|
6
|
+
alignItems: 'flex-start',
|
|
7
|
+
width: '100%',
|
|
8
|
+
});
|
|
9
|
+
export const stepperHorizontal = styleWithLayer({
|
|
10
|
+
flexDirection: 'row',
|
|
11
|
+
justifyContent: 'space-between',
|
|
12
|
+
});
|
|
13
|
+
export const stepperVertical = styleWithLayer({
|
|
14
|
+
flexDirection: 'column',
|
|
15
|
+
gap: '1rem',
|
|
16
|
+
});
|
|
17
|
+
export const step = styleWithLayer({
|
|
18
|
+
display: 'flex',
|
|
19
|
+
flexDirection: 'column',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
position: 'relative',
|
|
22
|
+
flex: 1,
|
|
23
|
+
});
|
|
24
|
+
export const stepVertical = styleWithLayer({
|
|
25
|
+
flexDirection: 'row',
|
|
26
|
+
alignItems: 'flex-start',
|
|
27
|
+
gap: '1rem',
|
|
28
|
+
});
|
|
29
|
+
export const stepIndicator = styleWithLayer({
|
|
30
|
+
width: '2.5rem',
|
|
31
|
+
height: '2.5rem',
|
|
32
|
+
borderRadius: '50%',
|
|
33
|
+
display: 'flex',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
justifyContent: 'center',
|
|
36
|
+
fontWeight: '600',
|
|
37
|
+
fontSize: '14px',
|
|
38
|
+
transition: 'all 0.3s ease',
|
|
39
|
+
zIndex: 1,
|
|
40
|
+
});
|
|
41
|
+
export const stepIndicatorVariants = styleVariants({
|
|
42
|
+
pending: {
|
|
43
|
+
backgroundColor: vars.colors.borderMuted,
|
|
44
|
+
color: vars.colors.textSecondary,
|
|
45
|
+
border: `2px solid ${vars.colors.borderMuted}`,
|
|
46
|
+
},
|
|
47
|
+
current: {
|
|
48
|
+
backgroundColor: vars.colors.buttonBackgroundPrimary,
|
|
49
|
+
color: vars.colors.buttonTextPrimary,
|
|
50
|
+
border: `2px solid ${vars.colors.buttonBackgroundPrimary}`,
|
|
51
|
+
boxShadow: `0 0 0 4px ${vars.colors.alertInfoBackground}`,
|
|
52
|
+
},
|
|
53
|
+
completed: {
|
|
54
|
+
backgroundColor: vars.colors.alertSuccessBorder,
|
|
55
|
+
color: vars.colors.buttonTextPrimary,
|
|
56
|
+
border: `2px solid ${vars.colors.alertSuccessBorder}`,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
export const stepContent = styleWithLayer({
|
|
60
|
+
display: 'flex',
|
|
61
|
+
flexDirection: 'column',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
marginTop: '0.5rem',
|
|
64
|
+
textAlign: 'center',
|
|
65
|
+
});
|
|
66
|
+
export const stepContentVertical = styleWithLayer({
|
|
67
|
+
alignItems: 'flex-start',
|
|
68
|
+
marginTop: 0,
|
|
69
|
+
textAlign: 'left',
|
|
70
|
+
});
|
|
71
|
+
export const stepTitle = styleWithLayer({
|
|
72
|
+
fontFamily: vars.fontFamily.heading,
|
|
73
|
+
fontSize: '14px',
|
|
74
|
+
fontWeight: '600',
|
|
75
|
+
color: vars.colors.textPrimary,
|
|
76
|
+
margin: 0,
|
|
77
|
+
});
|
|
78
|
+
export const stepDescription = styleWithLayer({
|
|
79
|
+
fontSize: '12px',
|
|
80
|
+
color: vars.colors.textSecondary,
|
|
81
|
+
marginTop: '0.25rem',
|
|
82
|
+
maxWidth: '200px',
|
|
83
|
+
});
|
|
84
|
+
export const stepConnector = styleWithLayer({
|
|
85
|
+
position: 'absolute',
|
|
86
|
+
top: '1.25rem',
|
|
87
|
+
left: 'calc(50% + 1.5rem)',
|
|
88
|
+
right: 'calc(-50% + 1.5rem)',
|
|
89
|
+
height: '2px',
|
|
90
|
+
backgroundColor: vars.colors.borderMuted,
|
|
91
|
+
zIndex: 0,
|
|
92
|
+
});
|
|
93
|
+
export const stepConnectorCompleted = styleWithLayer({
|
|
94
|
+
backgroundColor: vars.colors.alertSuccessBorder,
|
|
95
|
+
});
|
|
96
|
+
export const stepConnectorVertical = styleWithLayer({
|
|
97
|
+
position: 'absolute',
|
|
98
|
+
top: '2.5rem',
|
|
99
|
+
left: '1.25rem',
|
|
100
|
+
width: '2px',
|
|
101
|
+
height: 'calc(100% + 1rem)',
|
|
102
|
+
backgroundColor: vars.colors.borderMuted,
|
|
103
|
+
zIndex: 0,
|
|
104
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type TableProps = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
striped?: boolean;
|
|
6
|
+
containerClassName?: string;
|
|
7
|
+
};
|
|
8
|
+
type TheadProps = {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
type TbodyProps = {
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
className?: string;
|
|
15
|
+
};
|
|
16
|
+
type TfootProps = {
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
};
|
|
20
|
+
type TrProps = {
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
className?: string;
|
|
23
|
+
};
|
|
24
|
+
type ThProps = {
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
className?: string;
|
|
27
|
+
};
|
|
28
|
+
type TdProps = {
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
className?: string;
|
|
31
|
+
colSpan?: number;
|
|
32
|
+
rowSpan?: number;
|
|
33
|
+
};
|
|
34
|
+
declare const Table: (({ children, className, striped, containerClassName, }: TableProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
35
|
+
Thead: ({ children, className }: TheadProps) => import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
Tbody: ({ children, className }: TbodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
Tfoot: ({ children, className }: TfootProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
Tr: ({ children, className }: TrProps) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
Th: ({ children, className }: ThProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
Td: ({ children, className, colSpan, rowSpan }: TdProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
};
|
|
42
|
+
export default Table;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
import { table, thead, tbody, tfoot, tr, th, td, tableContainer, } from './styles.css';
|
|
5
|
+
import Box from '../Box';
|
|
6
|
+
// Context to pass striping info to rows
|
|
7
|
+
const TableContext = createContext({});
|
|
8
|
+
const TableComponent = ({ children, className, striped = false, containerClassName, }) => {
|
|
9
|
+
return (_jsx(TableContext.Provider, { value: { striped }, children: _jsx(Box, { className: clsx(tableContainer, containerClassName), width: "100%", children: _jsx(Box, { as: "table", className: clsx(table, className), children: children }) }) }));
|
|
10
|
+
};
|
|
11
|
+
const Thead = ({ children, className }) => {
|
|
12
|
+
return _jsx(Box, { as: "thead", className: clsx(thead, className), children: children });
|
|
13
|
+
};
|
|
14
|
+
const Tbody = ({ children, className }) => {
|
|
15
|
+
return _jsx(Box, { as: "tbody", className: clsx(tbody, className), children: children });
|
|
16
|
+
};
|
|
17
|
+
const Tfoot = ({ children, className }) => {
|
|
18
|
+
return _jsx(Box, { as: "tfoot", className: clsx(tfoot, className), children: children });
|
|
19
|
+
};
|
|
20
|
+
const Tr = ({ children, className }) => {
|
|
21
|
+
const { striped } = useContext(TableContext);
|
|
22
|
+
return (_jsx(Box, { as: "tr", className: clsx(tr[striped ? 'striped' : 'default'], className), children: children }));
|
|
23
|
+
};
|
|
24
|
+
const Th = ({ children, className }) => {
|
|
25
|
+
return _jsx(Box, { as: "th", className: clsx(th, className), children: children });
|
|
26
|
+
};
|
|
27
|
+
const Td = ({ children, className, colSpan, rowSpan }) => {
|
|
28
|
+
return (_jsx(Box, { as: "td", className: clsx(td, className), colSpan: colSpan, rowSpan: rowSpan, children: children }));
|
|
29
|
+
};
|
|
30
|
+
// Attach sub-components
|
|
31
|
+
const Table = Object.assign(TableComponent, {
|
|
32
|
+
Thead,
|
|
33
|
+
Tbody,
|
|
34
|
+
Tfoot,
|
|
35
|
+
Tr,
|
|
36
|
+
Th,
|
|
37
|
+
Td,
|
|
38
|
+
});
|
|
39
|
+
export default Table;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Table } from './Table';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Table } from './Table';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const table: string;
|
|
2
|
+
export declare const thead: string;
|
|
3
|
+
export declare const tbody: string;
|
|
4
|
+
export declare const tfoot: string;
|
|
5
|
+
export declare const tr: Record<"default" | "striped", string>;
|
|
6
|
+
export declare const th: string;
|
|
7
|
+
export declare const td: string;
|
|
8
|
+
export declare const tableContainer: string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { styleVariants } from '@vanilla-extract/css';
|
|
2
|
+
import { vars } from '../../styles/theme.css';
|
|
3
|
+
import { styleWithLayer } from '../../styles/utils';
|
|
4
|
+
export const table = styleWithLayer({
|
|
5
|
+
width: '100%',
|
|
6
|
+
borderCollapse: 'collapse',
|
|
7
|
+
borderSpacing: 0,
|
|
8
|
+
fontFamily: vars.fontFamily.body,
|
|
9
|
+
});
|
|
10
|
+
export const thead = styleWithLayer({
|
|
11
|
+
backgroundColor: vars.colors.backgroundDefault,
|
|
12
|
+
borderBottom: `2px solid ${vars.colors.borderDefault}`,
|
|
13
|
+
});
|
|
14
|
+
export const tbody = styleWithLayer({
|
|
15
|
+
backgroundColor: 'transparent',
|
|
16
|
+
});
|
|
17
|
+
export const tfoot = styleWithLayer({
|
|
18
|
+
backgroundColor: vars.colors.backgroundMuted,
|
|
19
|
+
borderTop: `2px solid ${vars.colors.borderDefault}`,
|
|
20
|
+
fontWeight: 'bold',
|
|
21
|
+
});
|
|
22
|
+
export const tr = styleVariants({
|
|
23
|
+
default: {
|
|
24
|
+
borderBottom: `1px solid ${vars.colors.borderMuted}`,
|
|
25
|
+
':hover': {
|
|
26
|
+
backgroundColor: vars.colors.backgroundMuted,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
striped: {
|
|
30
|
+
borderBottom: `1px solid ${vars.colors.borderMuted}`,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
export const th = styleWithLayer({
|
|
34
|
+
padding: '12px 16px',
|
|
35
|
+
textAlign: 'left',
|
|
36
|
+
fontWeight: '600',
|
|
37
|
+
color: vars.colors.textPrimary,
|
|
38
|
+
whiteSpace: 'nowrap',
|
|
39
|
+
});
|
|
40
|
+
export const td = styleWithLayer({
|
|
41
|
+
padding: '12px 16px',
|
|
42
|
+
color: vars.colors.textPrimary,
|
|
43
|
+
borderBottom: `1px solid ${vars.colors.borderMuted}`,
|
|
44
|
+
});
|
|
45
|
+
export const tableContainer = styleWithLayer({
|
|
46
|
+
overflowX: 'auto',
|
|
47
|
+
border: `1px solid ${vars.colors.borderDefault}`,
|
|
48
|
+
borderRadius: '8px',
|
|
49
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type TabsProps = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
defaultValue?: string;
|
|
5
|
+
orientation?: 'horizontal' | 'vertical';
|
|
6
|
+
className?: string;
|
|
7
|
+
onChange?: (value: string) => void;
|
|
8
|
+
};
|
|
9
|
+
type TabListProps = {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
type TabProps = {
|
|
14
|
+
value: string;
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
type TabPanelProps = {
|
|
20
|
+
value: string;
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
className?: string;
|
|
23
|
+
};
|
|
24
|
+
declare const TabsComponent: (({ children, defaultValue, orientation, className, onChange, }: TabsProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
25
|
+
List: ({ children, className }: TabListProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
Tab: ({ value, children, disabled, className }: TabProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
Panel: ({ value, children, className }: TabPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
};
|
|
29
|
+
export default TabsComponent;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { createContext, useContext, useState } from 'react';
|
|
4
|
+
import { tabsContainer, tabsList, tabsListHorizontal, tabsListVertical, tabItem, tabContent, } from './styles.css';
|
|
5
|
+
import Box from '../Box';
|
|
6
|
+
const TabsContext = createContext({
|
|
7
|
+
activeTab: '',
|
|
8
|
+
setActiveTab: () => { },
|
|
9
|
+
});
|
|
10
|
+
const Tabs = ({ children, defaultValue = '', orientation = 'horizontal', className, onChange, }) => {
|
|
11
|
+
const [activeTab, setActiveTab] = useState(defaultValue);
|
|
12
|
+
const handleTabChange = (value) => {
|
|
13
|
+
setActiveTab(value);
|
|
14
|
+
if (onChange) {
|
|
15
|
+
onChange(value);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
return (_jsx(TabsContext.Provider, { value: { activeTab, setActiveTab: handleTabChange, orientation }, children: _jsx(Box, { className: clsx(tabsContainer, className), width: "100%", children: children }) }));
|
|
19
|
+
};
|
|
20
|
+
const TabList = ({ children, className }) => {
|
|
21
|
+
const { orientation } = useContext(TabsContext);
|
|
22
|
+
return (_jsx(Box, { as: "div", role: "tablist", className: clsx(tabsList, orientation === 'vertical' ? tabsListVertical : tabsListHorizontal, className), children: children }));
|
|
23
|
+
};
|
|
24
|
+
const Tab = ({ value, children, disabled = false, className }) => {
|
|
25
|
+
const { activeTab, setActiveTab, orientation } = useContext(TabsContext);
|
|
26
|
+
const isActive = activeTab === value;
|
|
27
|
+
const handleClick = () => {
|
|
28
|
+
if (!disabled) {
|
|
29
|
+
setActiveTab(value);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return (_jsx(Box, { as: "button", role: "tab", "aria-selected": isActive, disabled: disabled, onClick: handleClick, className: clsx(tabItem[orientation === 'vertical'
|
|
33
|
+
? isActive
|
|
34
|
+
? 'verticalActive'
|
|
35
|
+
: 'base'
|
|
36
|
+
: isActive
|
|
37
|
+
? 'active'
|
|
38
|
+
: 'base'], className), children: children }));
|
|
39
|
+
};
|
|
40
|
+
const TabPanel = ({ value, children, className }) => {
|
|
41
|
+
const { activeTab } = useContext(TabsContext);
|
|
42
|
+
const isActive = activeTab === value;
|
|
43
|
+
if (!isActive)
|
|
44
|
+
return null;
|
|
45
|
+
return (_jsx(Box, { as: "div", role: "tabpanel", className: clsx(tabContent, className), children: children }));
|
|
46
|
+
};
|
|
47
|
+
const TabsComponent = Object.assign(Tabs, {
|
|
48
|
+
List: TabList,
|
|
49
|
+
Tab,
|
|
50
|
+
Panel: TabPanel,
|
|
51
|
+
});
|
|
52
|
+
export default TabsComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Tabs } from './Tabs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Tabs } from './Tabs';
|