tharaday 0.8.4 → 0.8.7
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/ds.js +74 -80
- package/dist/ds.umd.cjs +1 -1
- package/dist/{components → src/components}/Accordion/Accordion.d.ts +1 -0
- package/dist/src/components/Accordion/Accordion.stories.d.ts +14 -0
- package/dist/src/components/Accordion/Accordion.types.d.ts +18 -0
- package/dist/{components → src/components}/Avatar/Avatar.d.ts +1 -0
- package/dist/src/components/Avatar/Avatar.stories.d.ts +14 -0
- package/dist/src/components/Avatar/Avatar.types.d.ts +10 -0
- package/dist/{components → src/components}/Badge/Badge.d.ts +1 -0
- package/dist/src/components/Badge/Badge.stories.d.ts +33 -0
- package/dist/src/components/Badge/Badge.types.d.ts +10 -0
- package/dist/{components → src/components}/Box/Box.d.ts +1 -0
- package/dist/src/components/Box/Box.stories.d.ts +38 -0
- package/dist/src/components/Box/Box.types.d.ts +52 -0
- package/dist/{components → src/components}/Box/helpers/getSpacingStyles.d.ts +2 -2
- package/dist/{components → src/components}/Breadcrumbs/Breadcrumbs.d.ts +1 -0
- package/dist/src/components/Breadcrumbs/Breadcrumbs.stories.d.ts +13 -0
- package/dist/src/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -0
- package/dist/{components → src/components}/Button/Button.d.ts +1 -0
- package/dist/src/components/Button/Button.stories.d.ts +22 -0
- package/dist/src/components/Button/Button.types.d.ts +12 -0
- package/dist/{components → src/components}/Card/Card.d.ts +1 -0
- package/dist/src/components/Card/Card.stories.d.ts +27 -0
- package/dist/src/components/Card/Card.types.d.ts +16 -0
- package/dist/{components → src/components}/Checkbox/Checkbox.d.ts +1 -0
- package/dist/src/components/Checkbox/Checkbox.stories.d.ts +17 -0
- package/dist/src/components/Checkbox/Checkbox.types.d.ts +7 -0
- package/dist/{components → src/components}/DatePicker/DatePicker.d.ts +1 -0
- package/dist/src/components/DatePicker/DatePicker.stories.d.ts +15 -0
- package/dist/src/components/DatePicker/DatePicker.types.d.ts +11 -0
- package/dist/{components → src/components}/Divider/Divider.d.ts +1 -0
- package/dist/src/components/Divider/Divider.stories.d.ts +15 -0
- package/dist/src/components/Divider/Divider.types.d.ts +10 -0
- package/dist/{components → src/components}/Drawer/Drawer.d.ts +2 -1
- package/dist/src/components/Drawer/Drawer.stories.d.ts +29 -0
- package/dist/src/components/Drawer/Drawer.types.d.ts +15 -0
- package/dist/{components → src/components}/Dropdown/Dropdown.d.ts +1 -0
- package/dist/src/components/Dropdown/Dropdown.stories.d.ts +12 -0
- package/dist/src/components/Dropdown/Dropdown.types.d.ts +24 -0
- package/dist/{components → src/components}/EmptyState/EmptyState.d.ts +1 -0
- package/dist/src/components/EmptyState/EmptyState.stories.d.ts +22 -0
- package/dist/src/components/EmptyState/EmptyState.types.d.ts +10 -0
- package/dist/{components → src/components}/Header/Header.d.ts +1 -0
- package/dist/src/components/Header/Header.stories.d.ts +20 -0
- package/dist/src/components/Header/Header.types.d.ts +16 -0
- package/dist/{components → src/components}/Input/Input.d.ts +1 -0
- package/dist/src/components/Input/Input.stories.d.ts +32 -0
- package/dist/src/components/Input/Input.types.d.ts +10 -0
- package/dist/{components → src/components}/List/List.d.ts +2 -2
- package/dist/src/components/List/List.stories.d.ts +25 -0
- package/dist/{components → src/components}/List/List.types.d.ts +3 -3
- package/dist/{components → src/components}/List/ListItem.d.ts +1 -1
- package/dist/{components → src/components}/List/ListItem.types.d.ts +1 -1
- package/dist/{components → src/components}/Loader/Loader.d.ts +1 -0
- package/dist/src/components/Loader/Loader.stories.d.ts +25 -0
- package/dist/src/components/Loader/Loader.types.d.ts +8 -0
- package/dist/{components → src/components}/Modal/Modal.d.ts +2 -1
- package/dist/src/components/Modal/Modal.stories.d.ts +28 -0
- package/dist/src/components/Modal/Modal.types.d.ts +12 -0
- package/dist/{components → src/components}/NavBar/NavBar.d.ts +1 -0
- package/dist/src/components/NavBar/NavBar.stories.d.ts +8 -0
- package/dist/src/components/NavBar/NavBar.types.d.ts +38 -0
- package/dist/{components → src/components}/Notification/Notification.d.ts +1 -0
- package/dist/src/components/Notification/Notification.stories.d.ts +26 -0
- package/dist/src/components/Notification/Notification.types.d.ts +9 -0
- package/dist/{components → src/components}/Pagination/Pagination.d.ts +1 -0
- package/dist/src/components/Pagination/Pagination.stories.d.ts +21 -0
- package/dist/src/components/Pagination/Pagination.types.d.ts +34 -0
- package/dist/{components → src/components}/Popover/Popover.d.ts +1 -0
- package/dist/src/components/Popover/Popover.stories.d.ts +21 -0
- package/dist/src/components/Popover/Popover.types.d.ts +11 -0
- package/dist/{components → src/components}/ProgressBar/ProgressBar.d.ts +1 -0
- package/dist/src/components/ProgressBar/ProgressBar.stories.d.ts +32 -0
- package/dist/src/components/ProgressBar/ProgressBar.types.d.ts +12 -0
- package/dist/{components → src/components}/RadioButton/RadioButton.d.ts +1 -0
- package/dist/src/components/RadioButton/RadioButton.stories.d.ts +30 -0
- package/dist/src/components/RadioButton/RadioButton.types.d.ts +9 -0
- package/dist/{components → src/components}/Select/Select.d.ts +1 -0
- package/dist/src/components/Select/Select.stories.d.ts +32 -0
- package/dist/src/components/Select/Select.types.d.ts +23 -0
- package/dist/{components → src/components}/Skeleton/Skeleton.d.ts +1 -0
- package/dist/src/components/Skeleton/Skeleton.stories.d.ts +15 -0
- package/dist/src/components/Skeleton/Skeleton.types.d.ts +9 -0
- package/dist/{components → src/components}/Slider/Slider.d.ts +1 -0
- package/dist/src/components/Slider/Slider.stories.d.ts +23 -0
- package/dist/src/components/Slider/Slider.types.d.ts +15 -0
- package/dist/{components → src/components}/Stepper/Step.d.ts +1 -0
- package/dist/src/components/Stepper/Step.types.d.ts +18 -0
- package/dist/{components → src/components}/Stepper/Stepper.d.ts +1 -0
- package/dist/src/components/Stepper/Stepper.stories.d.ts +15 -0
- package/dist/src/components/Stepper/Stepper.types.d.ts +14 -0
- package/dist/{components → src/components}/Stepper/stepper.utils.d.ts +2 -2
- package/dist/{components → src/components}/Switch/Switch.d.ts +1 -0
- package/dist/src/components/Switch/Switch.stories.d.ts +16 -0
- package/dist/src/components/Switch/Switch.types.d.ts +6 -0
- package/dist/{components → src/components}/Table/Table.d.ts +1 -0
- package/dist/src/components/Table/Table.stories.d.ts +27 -0
- package/dist/src/components/Table/Table.types.d.ts +19 -0
- package/dist/{components → src/components}/Tabs/Tabs.d.ts +1 -0
- package/dist/src/components/Tabs/Tabs.stories.d.ts +19 -0
- package/dist/src/components/Tabs/Tabs.types.d.ts +16 -0
- package/dist/{components → src/components}/Tag/Tag.d.ts +1 -0
- package/dist/src/components/Tag/Tag.stories.d.ts +27 -0
- package/dist/src/components/Tag/Tag.types.d.ts +13 -0
- package/dist/{components → src/components}/Text/Text.d.ts +1 -0
- package/dist/src/components/Text/Text.stories.d.ts +78 -0
- package/dist/src/components/Text/Text.types.d.ts +16 -0
- package/dist/{components → src/components}/Textarea/Textarea.d.ts +1 -0
- package/dist/src/components/Textarea/Textarea.stories.d.ts +32 -0
- package/dist/src/components/Textarea/Textarea.types.d.ts +11 -0
- package/dist/{components → src/components}/Tooltip/Tooltip.d.ts +1 -0
- package/dist/src/components/Tooltip/Tooltip.stories.d.ts +10 -0
- package/dist/src/components/Tooltip/Tooltip.types.d.ts +12 -0
- package/dist/{components → src/components}/Tree/Tree.d.ts +2 -2
- package/dist/src/components/Tree/Tree.stories.d.ts +27 -0
- package/dist/{components → src/components}/Tree/Tree.types.d.ts +1 -1
- package/dist/{components → src/components}/Tree/TreeItem.d.ts +1 -1
- package/dist/{components → src/components}/Tree/TreeItem.types.d.ts +1 -1
- package/dist/{hooks → src/hooks}/useClickOutside.d.ts +1 -1
- package/dist/{hooks → src/hooks}/useComponentId.d.ts +1 -1
- package/dist/{hooks → src/hooks}/useFocusTrap.d.ts +1 -1
- package/dist/{layouts → src/layouts}/AppLayout/AppLayout.d.ts +1 -0
- package/dist/src/layouts/AppLayout/AppLayout.stories.d.ts +13 -0
- package/dist/src/layouts/AppLayout/AppLayout.types.d.ts +13 -0
- package/dist/{layouts → src/layouts}/AuthLayout/AuthLayout.d.ts +1 -0
- package/dist/src/layouts/AuthLayout/AuthLayout.stories.d.ts +12 -0
- package/dist/src/layouts/AuthLayout/AuthLayout.types.d.ts +8 -0
- package/dist/{layouts → src/layouts}/DashboardLayout/DashboardLayout.d.ts +1 -0
- package/dist/src/layouts/DashboardLayout/DashboardLayout.stories.d.ts +11 -0
- package/dist/src/layouts/DashboardLayout/DashboardLayout.types.d.ts +10 -0
- package/dist/{layouts → src/layouts}/SettingsLayout/SettingsLayout.d.ts +1 -0
- package/dist/src/layouts/SettingsLayout/SettingsLayout.stories.d.ts +11 -0
- package/dist/src/layouts/SettingsLayout/SettingsLayout.types.d.ts +9 -0
- package/package.json +27 -42
- package/src/components/Box/Box.types.ts +7 -4
- package/src/components/Drawer/Drawer.types.ts +1 -1
- package/src/components/EmptyState/EmptyState.types.ts +3 -3
- package/src/components/Header/Header.types.ts +1 -1
- package/src/components/Modal/Modal.types.ts +1 -1
- package/src/components/Notification/Notification.types.ts +2 -2
- package/src/components/Slider/Slider.test.tsx +107 -1
- package/src/components/Slider/Slider.tsx +19 -16
- package/src/components/Text/Text.types.ts +3 -48
- package/vite.config.ts +1 -1
- package/dist/components/Box/Box.types.d.ts +0 -50
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ size, error, label, helperText, fullWidth, className, id, rows, ...props }: import('./Textarea.types.ts').TextareaProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
tags: string[];
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
argTypes: {
|
|
10
|
+
size: {
|
|
11
|
+
control: "select";
|
|
12
|
+
options: string[];
|
|
13
|
+
};
|
|
14
|
+
error: {
|
|
15
|
+
control: "boolean";
|
|
16
|
+
};
|
|
17
|
+
disabled: {
|
|
18
|
+
control: "boolean";
|
|
19
|
+
};
|
|
20
|
+
fullWidth: {
|
|
21
|
+
control: "boolean";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<typeof meta>;
|
|
27
|
+
export declare const Default: Story;
|
|
28
|
+
export declare const WithError: Story;
|
|
29
|
+
export declare const Disabled: Story;
|
|
30
|
+
export declare const Small: Story;
|
|
31
|
+
export declare const Large: Story;
|
|
32
|
+
export declare const Gallery: Story;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TextareaHTMLAttributes } from 'react';
|
|
2
|
+
export type TextareaSize = 'sm' | 'md' | 'lg';
|
|
3
|
+
export interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
4
|
+
className?: string;
|
|
5
|
+
size?: TextareaSize;
|
|
6
|
+
error?: boolean;
|
|
7
|
+
label?: string;
|
|
8
|
+
helperText?: string;
|
|
9
|
+
rows?: number;
|
|
10
|
+
fullWidth?: boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Tooltip } from './Tooltip.tsx';
|
|
3
|
+
declare const meta: Meta<typeof Tooltip>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Tooltip>;
|
|
6
|
+
export declare const Top: Story;
|
|
7
|
+
export declare const Bottom: Story;
|
|
8
|
+
export declare const Left: Story;
|
|
9
|
+
export declare const Right: Story;
|
|
10
|
+
export declare const LightVariant: Story;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type TooltipPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
3
|
+
export type TooltipVariant = 'dark' | 'light';
|
|
4
|
+
export interface TooltipProps {
|
|
5
|
+
id?: string;
|
|
6
|
+
content: ReactNode;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
position?: TooltipPosition;
|
|
9
|
+
variant?: TooltipVariant;
|
|
10
|
+
delay?: number;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { TreeProps } from './Tree.types';
|
|
2
2
|
export declare const Tree: {
|
|
3
3
|
({ data, className, defaultExpanded, expandIcon, collapseIcon, ...props }: TreeProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
Item: ({ data, label, defaultExpanded, expandIcon, collapseIcon, isRoot, level, setSize, posInSet, }: import(
|
|
4
|
+
Item: ({ data, label, defaultExpanded, expandIcon, collapseIcon, isRoot, level, setSize, posInSet, }: import('./TreeItem.types').TreeItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: {
|
|
5
|
+
({ data, className, defaultExpanded, expandIcon, collapseIcon, ...props }: import('./Tree.types').TreeProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Item: ({ data, label, defaultExpanded, expandIcon, collapseIcon, isRoot, level, setSize, posInSet, }: import('./TreeItem.types').TreeItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryObj<typeof meta>;
|
|
19
|
+
export declare const Simple: Story;
|
|
20
|
+
export declare const Nested: Story;
|
|
21
|
+
export declare const ArrayOnly: Story;
|
|
22
|
+
export declare const Primitive: Story;
|
|
23
|
+
export declare const NullValue: Story;
|
|
24
|
+
export declare const Collapsed: Story;
|
|
25
|
+
export declare const ExpandedByDefault: Story;
|
|
26
|
+
export declare const CustomIcons: Story;
|
|
27
|
+
export declare const EmptyStructures: Story;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { TreeItemProps } from './TreeItem.types';
|
|
2
2
|
export declare const TreeItem: ({ data, label, defaultExpanded, expandIcon, collapseIcon, isRoot, level, setSize, posInSet, }: TreeItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Generates a stable, unique component ID.
|
|
3
3
|
* Returns the provided id if given, otherwise creates one prefixed with `ds-{prefix}-`.
|
|
4
4
|
*/
|
|
5
|
-
export declare const useComponentId: (prefix: string, id?: string
|
|
5
|
+
export declare const useComponentId: (prefix: string, id?: string) => string;
|
|
@@ -13,5 +13,5 @@ interface UseFocusTrapOptions {
|
|
|
13
13
|
*
|
|
14
14
|
* Returns a ref that must be attached to the container element.
|
|
15
15
|
*/
|
|
16
|
-
export declare const useFocusTrap: <T extends HTMLElement>({ isOpen, onClose, isLoading, }: UseFocusTrapOptions) => import(
|
|
16
|
+
export declare const useFocusTrap: <T extends HTMLElement>({ isOpen, onClose, isLoading, }: UseFocusTrapOptions) => import('react').RefObject<T | null>;
|
|
17
17
|
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ header, navbar, children, className, maxWidth, }: import('./AppLayout.types.ts').AppLayoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
11
|
+
export declare const Default: Story;
|
|
12
|
+
export declare const LoggedOut: Story;
|
|
13
|
+
export declare const LongHeaderContent: Story;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface AppLayoutProps {
|
|
3
|
+
/** Additional class name for the layout root */
|
|
4
|
+
className?: string;
|
|
5
|
+
/** Max width for the main content container */
|
|
6
|
+
maxWidth?: string | number;
|
|
7
|
+
/** Header slot — render a pre-configured Header component */
|
|
8
|
+
header?: ReactNode;
|
|
9
|
+
/** NavBar slot — render a pre-configured NavBar component */
|
|
10
|
+
navbar?: ReactNode;
|
|
11
|
+
/** Main content */
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ logo, title, description, children, className }: import('./AuthLayout.types.tsx').AuthLayoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
11
|
+
export declare const Login: Story;
|
|
12
|
+
export declare const SignUp: Story;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ header, breadcrumbs, actions, stats, children, className, }: import('./DashboardLayout.types.tsx').DashboardLayoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
11
|
+
export declare const Overview: Story;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface DashboardLayoutProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
/** Header slot — render a pre-configured Header component */
|
|
5
|
+
header?: ReactNode;
|
|
6
|
+
breadcrumbs?: ReactNode;
|
|
7
|
+
actions?: ReactNode;
|
|
8
|
+
stats?: ReactNode;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ header, breadcrumbs, sidebar, children, className, }: import('./SettingsLayout.types.tsx').SettingsLayoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
11
|
+
export declare const ProfileSettings: Story;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tharaday",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.7",
|
|
4
4
|
"author": "Ania Wyroba",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
18
|
"import": "./dist/ds.js",
|
|
19
|
-
"types": "./dist/
|
|
19
|
+
"types": "./dist/index.d.ts"
|
|
20
20
|
},
|
|
21
21
|
"./styles.css": "./dist/ds.css"
|
|
22
22
|
},
|
|
@@ -75,56 +75,41 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"classnames": "^2.5.1",
|
|
78
|
-
"react": "^19.2.
|
|
79
|
-
"react-dom": "^19.2.
|
|
78
|
+
"react": "^19.2.6",
|
|
79
|
+
"react-dom": "^19.2.6"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@eslint/js": "^10.0.1",
|
|
83
|
-
"@release-it/conventional-changelog": "^
|
|
84
|
-
"@storybook/addon-a11y": "^10.
|
|
85
|
-
"@storybook/addon-docs": "^10.
|
|
86
|
-
"@storybook/addon-vitest": "^10.
|
|
87
|
-
"@storybook/react-vite": "^10.
|
|
83
|
+
"@release-it/conventional-changelog": "^11.0.0",
|
|
84
|
+
"@storybook/addon-a11y": "^10.4.1",
|
|
85
|
+
"@storybook/addon-docs": "^10.4.1",
|
|
86
|
+
"@storybook/addon-vitest": "^10.4.1",
|
|
87
|
+
"@storybook/react-vite": "^10.4.1",
|
|
88
88
|
"@testing-library/dom": "^10.4.0",
|
|
89
89
|
"@testing-library/jest-dom": "^6.6.3",
|
|
90
90
|
"@testing-library/react": "^16.3.0",
|
|
91
91
|
"@testing-library/user-event": "^14.6.1",
|
|
92
|
-
"@types/node": "^25.
|
|
93
|
-
"@types/react": "^19.2.
|
|
92
|
+
"@types/node": "^25.9.1",
|
|
93
|
+
"@types/react": "^19.2.15",
|
|
94
94
|
"@types/react-dom": "^19.2.3",
|
|
95
|
-
"@vitest/browser-playwright": "^4.1.
|
|
96
|
-
"@vitest/coverage-v8": "^4.1.
|
|
97
|
-
"eslint": "^10.
|
|
95
|
+
"@vitest/browser-playwright": "^4.1.7",
|
|
96
|
+
"@vitest/coverage-v8": "^4.1.7",
|
|
97
|
+
"eslint": "^10.4.0",
|
|
98
98
|
"eslint-config-prettier": "^10.1.8",
|
|
99
|
-
"eslint-plugin-react-hooks": "^7.
|
|
99
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
100
100
|
"eslint-plugin-react-refresh": "^0.5.2",
|
|
101
|
-
"eslint-plugin-simple-import-sort": "^
|
|
102
|
-
"globals": "^17.
|
|
101
|
+
"eslint-plugin-simple-import-sort": "^13.0.0",
|
|
102
|
+
"globals": "^17.6.0",
|
|
103
103
|
"husky": "^9.1.7",
|
|
104
|
-
"jsdom": "^29.
|
|
105
|
-
"playwright": "^1.
|
|
106
|
-
"prettier": "^3.8.
|
|
107
|
-
"release-it": "^
|
|
108
|
-
"storybook": "^10.
|
|
109
|
-
"typescript": "~6.0.
|
|
110
|
-
"typescript-eslint": "^8.
|
|
111
|
-
"vite": "
|
|
112
|
-
"vite-plugin-dts": "^
|
|
113
|
-
"vitest": "^4.1.
|
|
114
|
-
},
|
|
115
|
-
"overrides": {
|
|
116
|
-
"eslint-plugin-react-hooks": {
|
|
117
|
-
"eslint": "$eslint"
|
|
118
|
-
},
|
|
119
|
-
"typescript-eslint": {
|
|
120
|
-
"typescript": "$typescript"
|
|
121
|
-
},
|
|
122
|
-
"minimatch": "^10.2.4",
|
|
123
|
-
"@joshwooding/vite-plugin-react-docgen-typescript": {
|
|
124
|
-
"vite": "$vite"
|
|
125
|
-
},
|
|
126
|
-
"release-it": {
|
|
127
|
-
"undici": "^6.24.1"
|
|
128
|
-
}
|
|
104
|
+
"jsdom": "^29.1.1",
|
|
105
|
+
"playwright": "^1.60.0",
|
|
106
|
+
"prettier": "^3.8.3",
|
|
107
|
+
"release-it": "^20.0.1",
|
|
108
|
+
"storybook": "^10.4.1",
|
|
109
|
+
"typescript": "~6.0.3",
|
|
110
|
+
"typescript-eslint": "^8.59.4",
|
|
111
|
+
"vite": "8.0.5",
|
|
112
|
+
"vite-plugin-dts": "^5.0.1",
|
|
113
|
+
"vitest": "^4.1.7"
|
|
129
114
|
}
|
|
130
115
|
}
|
|
@@ -25,10 +25,7 @@ export type BoxBackgroundColor =
|
|
|
25
25
|
export type BoxBorderColor = 'main' | 'subtle' | 'danger' | 'warning' | 'success' | 'info';
|
|
26
26
|
export type BoxBorderRadius = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'full';
|
|
27
27
|
|
|
28
|
-
export interface
|
|
29
|
-
children?: ReactNode;
|
|
30
|
-
as?: ElementType;
|
|
31
|
-
display?: BoxDisplay;
|
|
28
|
+
export interface SpacingProps {
|
|
32
29
|
padding?: BoxPadding;
|
|
33
30
|
paddingX?: BoxPadding;
|
|
34
31
|
paddingY?: BoxPadding;
|
|
@@ -43,6 +40,12 @@ export interface BoxProps extends HTMLAttributes<HTMLElement> {
|
|
|
43
40
|
marginBottom?: BoxMargin;
|
|
44
41
|
marginLeft?: BoxMargin;
|
|
45
42
|
marginRight?: BoxMargin;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface BoxProps extends HTMLAttributes<HTMLElement>, SpacingProps {
|
|
46
|
+
children?: ReactNode;
|
|
47
|
+
as?: ElementType;
|
|
48
|
+
display?: BoxDisplay;
|
|
46
49
|
gap?: BoxGap;
|
|
47
50
|
flexDirection?: BoxFlexDirection;
|
|
48
51
|
alignItems?: BoxAlignItems;
|
|
@@ -2,9 +2,9 @@ import type { HTMLAttributes, ReactNode } from 'react';
|
|
|
2
2
|
|
|
3
3
|
export type EmptyStateSize = 'sm' | 'md' | 'lg';
|
|
4
4
|
|
|
5
|
-
export interface EmptyStateProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
title:
|
|
7
|
-
description?:
|
|
5
|
+
export interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
description?: ReactNode;
|
|
8
8
|
icon?: ReactNode;
|
|
9
9
|
action?: ReactNode;
|
|
10
10
|
size?: EmptyStateSize;
|
|
@@ -2,10 +2,10 @@ import type { HTMLAttributes, ReactNode } from 'react';
|
|
|
2
2
|
|
|
3
3
|
export type NotificationIntent = 'neutral' | 'success' | 'warning' | 'danger' | 'info';
|
|
4
4
|
|
|
5
|
-
export interface NotificationProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
export interface NotificationProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
6
6
|
className?: string;
|
|
7
7
|
intent?: NotificationIntent;
|
|
8
|
-
title?:
|
|
8
|
+
title?: ReactNode;
|
|
9
9
|
children: ReactNode;
|
|
10
10
|
onClose?: () => void;
|
|
11
11
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/react';
|
|
1
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
2
3
|
|
|
3
4
|
import { Slider } from './Slider.tsx';
|
|
4
5
|
|
|
@@ -69,4 +70,109 @@ describe('Slider', () => {
|
|
|
69
70
|
expect(start).toHaveAttribute('aria-valuetext', '10 - 90');
|
|
70
71
|
expect(end).toHaveAttribute('aria-valuetext', '10 - 90');
|
|
71
72
|
});
|
|
73
|
+
|
|
74
|
+
describe('thumb movement', () => {
|
|
75
|
+
it('allows sliding above defaultValue in non-dual mode', () => {
|
|
76
|
+
render(<Slider defaultValue={45} max={100} showValue />);
|
|
77
|
+
fireEvent.change(screen.getByRole('slider'), { target: { value: '70' } });
|
|
78
|
+
expect(screen.getByText('70')).toBeInTheDocument();
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('allows sliding below defaultValue in non-dual mode', () => {
|
|
82
|
+
render(<Slider defaultValue={45} showValue />);
|
|
83
|
+
fireEvent.change(screen.getByRole('slider'), { target: { value: '20' } });
|
|
84
|
+
expect(screen.getByText('20')).toBeInTheDocument();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('clamps start thumb to end thumb position in dual mode', () => {
|
|
88
|
+
render(<Slider defaultValue={[20, 60]} showValue />);
|
|
89
|
+
const [start] = screen.getAllByRole('slider');
|
|
90
|
+
fireEvent.change(start, { target: { value: '80' } });
|
|
91
|
+
expect(screen.getByText('60 - 60')).toBeInTheDocument();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('clamps end thumb to start thumb position in dual mode', () => {
|
|
95
|
+
render(<Slider defaultValue={[40, 80]} showValue />);
|
|
96
|
+
const [, end] = screen.getAllByRole('slider');
|
|
97
|
+
fireEvent.change(end, { target: { value: '10' } });
|
|
98
|
+
expect(screen.getByText('40 - 40')).toBeInTheDocument();
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('calls onValueChange with updated value', () => {
|
|
102
|
+
const onValueChange = vi.fn();
|
|
103
|
+
render(<Slider defaultValue={45} onValueChange={onValueChange} />);
|
|
104
|
+
fireEvent.change(screen.getByRole('slider'), { target: { value: '70' } });
|
|
105
|
+
expect(onValueChange).toHaveBeenCalledWith(70);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('calls onValueChange with a pair for dual sliders', () => {
|
|
109
|
+
const onValueChange = vi.fn();
|
|
110
|
+
render(<Slider defaultValue={[20, 60]} onValueChange={onValueChange} />);
|
|
111
|
+
const [start] = screen.getAllByRole('slider');
|
|
112
|
+
fireEvent.change(start, { target: { value: '30' } });
|
|
113
|
+
expect(onValueChange).toHaveBeenCalledWith([30, 60]);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
describe('controlled mode', () => {
|
|
118
|
+
it('uses value prop instead of internal state', () => {
|
|
119
|
+
render(<Slider value={70} onValueChange={vi.fn()} showValue />);
|
|
120
|
+
expect(screen.getByText('70')).toBeInTheDocument();
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('reflects updated value prop on re-render', () => {
|
|
124
|
+
const { rerender } = render(<Slider value={40} onValueChange={vi.fn()} showValue />);
|
|
125
|
+
rerender(<Slider value={80} onValueChange={vi.fn()} showValue />);
|
|
126
|
+
expect(screen.getByText('80')).toBeInTheDocument();
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
describe('showInputs', () => {
|
|
131
|
+
it('tracks typed value in number input while editing', async () => {
|
|
132
|
+
const user = userEvent.setup();
|
|
133
|
+
render(<Slider defaultValue={45} showInputs />);
|
|
134
|
+
const input = screen.getByRole('spinbutton');
|
|
135
|
+
await user.clear(input);
|
|
136
|
+
await user.type(input, '70');
|
|
137
|
+
expect(input).toHaveValue(70);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('commits number input value to slider on blur', async () => {
|
|
141
|
+
const user = userEvent.setup();
|
|
142
|
+
render(<Slider defaultValue={45} showInputs showValue />);
|
|
143
|
+
const input = screen.getByRole('spinbutton');
|
|
144
|
+
await user.clear(input);
|
|
145
|
+
await user.type(input, '70');
|
|
146
|
+
await user.tab();
|
|
147
|
+
expect(screen.getByText('70')).toBeInTheDocument();
|
|
148
|
+
expect(input).toHaveValue(70);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('clamps out-of-range input to max on blur', async () => {
|
|
152
|
+
const user = userEvent.setup();
|
|
153
|
+
render(<Slider defaultValue={45} max={100} showInputs showValue />);
|
|
154
|
+
const input = screen.getByRole('spinbutton');
|
|
155
|
+
await user.clear(input);
|
|
156
|
+
await user.type(input, '200');
|
|
157
|
+
await user.tab();
|
|
158
|
+
expect(screen.getByText('100')).toBeInTheDocument();
|
|
159
|
+
expect(input).toHaveValue(100);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('syncs number input with slider when slider moves while not editing', () => {
|
|
163
|
+
render(<Slider defaultValue={45} showInputs />);
|
|
164
|
+
fireEvent.change(screen.getByRole('slider'), { target: { value: '70' } });
|
|
165
|
+
expect(screen.getByRole('spinbutton')).toHaveValue(70);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('commits dual start input and updates start thumb', async () => {
|
|
169
|
+
const user = userEvent.setup();
|
|
170
|
+
render(<Slider defaultValue={[20, 80]} showInputs showValue />);
|
|
171
|
+
const input = screen.getByLabelText('Slider minimum input');
|
|
172
|
+
await user.clear(input);
|
|
173
|
+
await user.type(input, '35');
|
|
174
|
+
await user.tab();
|
|
175
|
+
expect(screen.getByText('35 - 80')).toBeInTheDocument();
|
|
176
|
+
});
|
|
177
|
+
});
|
|
72
178
|
});
|