tharaday 0.8.3 → 0.8.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/.gitignore +3 -0
- package/.storybook/preview.ts +2 -2
- package/dist/components/Box/Box.types.d.ts +1 -1
- package/dist/components/List/List.types.d.ts +2 -2
- package/dist/components/List/ListItem.types.d.ts +1 -1
- package/dist/ds.css +1 -1
- package/dist/ds.js +685 -685
- package/dist/ds.umd.cjs +1 -1
- package/dist/index.d.ts +32 -32
- package/eslint.config.js +15 -0
- package/package.json +3 -2
- package/src/components/Accordion/Accordion.stories.tsx +1 -1
- package/src/components/Accordion/Accordion.tsx +1 -1
- package/src/components/Avatar/Avatar.stories.tsx +1 -1
- package/src/components/Avatar/Avatar.test.tsx +1 -1
- package/src/components/Badge/Badge.stories.tsx +1 -1
- package/src/components/Box/Box.types.ts +1 -1
- package/src/components/Box/helpers/getSpacingStyles.ts +1 -0
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +1 -1
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +1 -1
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +1 -1
- package/src/components/Breadcrumbs/Breadcrumbs.types.ts +1 -1
- package/src/components/Button/Button.stories.tsx +1 -1
- package/src/components/Card/Card.stories.tsx +1 -1
- package/src/components/Card/Card.test.tsx +1 -1
- package/src/components/Card/Card.tsx +2 -2
- package/src/components/Checkbox/Checkbox.stories.tsx +1 -1
- package/src/components/Checkbox/Checkbox.tsx +1 -1
- package/src/components/DatePicker/DatePicker.stories.tsx +3 -0
- package/src/components/DatePicker/DatePicker.tsx +2 -0
- package/src/components/Divider/Divider.stories.tsx +1 -1
- package/src/components/Drawer/Drawer.stories.tsx +1 -0
- package/src/components/Dropdown/Dropdown.tsx +7 -3
- package/src/components/Header/Header.tsx +2 -2
- package/src/components/Input/Input.stories.tsx +1 -1
- package/src/components/Input/Input.tsx +1 -1
- package/src/components/List/List.stories.tsx +1 -0
- package/src/components/List/List.tsx +1 -1
- package/src/components/List/List.types.ts +3 -2
- package/src/components/List/ListItem.tsx +2 -1
- package/src/components/List/ListItem.types.ts +1 -1
- package/src/components/Loader/Loader.stories.tsx +1 -1
- package/src/components/Modal/Modal.stories.tsx +1 -1
- package/src/components/Modal/Modal.tsx +2 -3
- package/src/components/NavBar/NavBar.stories.tsx +1 -1
- package/src/components/Notification/Notification.stories.tsx +1 -1
- package/src/components/Notification/Notification.tsx +1 -1
- package/src/components/Pagination/Pagination.tsx +2 -2
- package/src/components/Popover/Popover.tsx +1 -1
- package/src/components/ProgressBar/ProgressBar.stories.tsx +1 -1
- package/src/components/ProgressBar/ProgressBar.tsx +1 -1
- package/src/components/RadioButton/RadioButton.stories.tsx +1 -1
- package/src/components/RadioButton/RadioButton.tsx +1 -1
- package/src/components/Select/Select.stories.tsx +1 -1
- package/src/components/Select/Select.tsx +1 -1
- package/src/components/Select/Select.types.ts +1 -1
- package/src/components/Skeleton/Skeleton.stories.tsx +1 -1
- package/src/components/Skeleton/Skeleton.tsx +1 -1
- package/src/components/Slider/Slider.tsx +4 -1
- package/src/components/Stepper/Stepper.stories.tsx +1 -1
- package/src/components/Stepper/Stepper.tsx +1 -1
- package/src/components/Stepper/stepper.utils.ts +4 -1
- package/src/components/Switch/Switch.stories.tsx +1 -1
- package/src/components/Switch/Switch.tsx +1 -1
- package/src/components/Table/Table.stories.tsx +1 -1
- package/src/components/Table/Table.test.tsx +3 -3
- package/src/components/Table/Table.tsx +4 -4
- package/src/components/Tabs/Tabs.tsx +2 -2
- package/src/components/Text/Text.stories.tsx +1 -1
- package/src/components/Text/Text.types.ts +3 -3
- package/src/components/Textarea/Textarea.stories.tsx +1 -1
- package/src/components/Textarea/Textarea.tsx +1 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +1 -1
- package/src/components/Tooltip/Tooltip.tsx +4 -3
- package/src/components/Tree/Tree.stories.tsx +1 -0
- package/src/components/Tree/Tree.tsx +3 -2
- package/src/components/Tree/TreeItem.tsx +5 -2
- package/src/hooks/useClickOutside.test.tsx +1 -0
- package/src/hooks/useClickOutside.ts +2 -1
- package/src/hooks/useComponentId.ts +1 -0
- package/src/hooks/useFocusTrap.test.tsx +2 -0
- package/src/hooks/useFocusTrap.ts +1 -0
- package/src/index.ts +38 -38
- package/src/layouts/AppLayout/AppLayout.stories.tsx +2 -2
- package/src/layouts/AppLayout/AppLayout.tsx +1 -1
- package/src/layouts/AuthLayout/AuthLayout.stories.tsx +1 -1
- package/src/layouts/AuthLayout/AuthLayout.tsx +2 -2
- package/src/layouts/AuthLayout/AuthLayout.types.tsx +2 -2
- package/src/layouts/DashboardLayout/DashboardLayout.stories.tsx +3 -3
- package/src/layouts/SettingsLayout/SettingsLayout.stories.tsx +3 -3
- package/src/styles/themes.browser.test.ts +1 -0
- package/vite.config.ts +1 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
|
|
3
|
-
import { Card, CardHeader, CardContent, CardFooter } from './Card.tsx';
|
|
4
3
|
import { Button } from '../Button/Button.tsx';
|
|
5
4
|
import { Text } from '../Text/Text.tsx';
|
|
5
|
+
import { Card, CardContent, CardFooter, CardHeader } from './Card.tsx';
|
|
6
6
|
|
|
7
7
|
const meta = {
|
|
8
8
|
title: 'Components/Card',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react';
|
|
2
2
|
|
|
3
|
-
import { Card,
|
|
3
|
+
import { Card, CardContent, CardFooter, CardHeader } from './Card.tsx';
|
|
4
4
|
|
|
5
5
|
describe('Card', () => {
|
|
6
6
|
it('renders children', () => {
|
|
@@ -2,10 +2,10 @@ import classnames from 'classnames';
|
|
|
2
2
|
|
|
3
3
|
import styles from './Card.module.css';
|
|
4
4
|
import type {
|
|
5
|
-
CardProps,
|
|
6
|
-
CardHeaderProps,
|
|
7
5
|
CardContentProps,
|
|
8
6
|
CardFooterProps,
|
|
7
|
+
CardHeaderProps,
|
|
8
|
+
CardProps,
|
|
9
9
|
} from './Card.types.ts';
|
|
10
10
|
|
|
11
11
|
export const Card = ({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import classnames from 'classnames';
|
|
2
|
-
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
3
2
|
|
|
3
|
+
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
4
4
|
import styles from './Checkbox.module.css';
|
|
5
5
|
import type { CheckboxProps } from './Checkbox.types.ts';
|
|
6
6
|
|
|
@@ -15,16 +15,19 @@ type Story = StoryObj<typeof meta>;
|
|
|
15
15
|
|
|
16
16
|
const Controlled = (args: React.ComponentProps<typeof DatePicker>) => {
|
|
17
17
|
const [value, setValue] = useState<Date | null>(null);
|
|
18
|
+
|
|
18
19
|
return <DatePicker {...args} value={value} onChange={setValue} />;
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
const Preselected = (args: React.ComponentProps<typeof DatePicker>) => {
|
|
22
23
|
const [value, setValue] = useState<Date | null>(new Date(2026, 0, 15));
|
|
24
|
+
|
|
23
25
|
return <DatePicker {...args} value={value} onChange={setValue} />;
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
const WithMinMaxDemo = (args: React.ComponentProps<typeof DatePicker>) => {
|
|
27
29
|
const [value, setValue] = useState<Date | null>(null);
|
|
30
|
+
|
|
28
31
|
return <DatePicker {...args} value={value} onChange={setValue} />;
|
|
29
32
|
};
|
|
30
33
|
|
|
@@ -102,6 +102,7 @@ export const DatePicker = ({
|
|
|
102
102
|
return true;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
+
|
|
105
106
|
return false;
|
|
106
107
|
};
|
|
107
108
|
|
|
@@ -221,6 +222,7 @@ export const DatePicker = ({
|
|
|
221
222
|
const selected = value ? isSameDay(date, value) : false;
|
|
222
223
|
const todayFlag = isToday(date);
|
|
223
224
|
const disabledFlag = isDisabledDate(date);
|
|
225
|
+
|
|
224
226
|
return (
|
|
225
227
|
<button
|
|
226
228
|
key={date.toISOString()}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
|
|
3
|
-
import { Divider } from './Divider.tsx';
|
|
4
3
|
import { Box } from '../Box/Box.tsx';
|
|
5
4
|
import { Text } from '../Text/Text.tsx';
|
|
5
|
+
import { Divider } from './Divider.tsx';
|
|
6
6
|
|
|
7
7
|
const meta = {
|
|
8
8
|
title: 'Components/Divider',
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import classnames from 'classnames';
|
|
2
|
-
import {
|
|
2
|
+
import { type KeyboardEvent, useEffect, useRef, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
5
|
-
|
|
6
5
|
import styles from './Dropdown.module.css';
|
|
7
|
-
import type {
|
|
6
|
+
import type { DropdownOption, DropdownProps } from './Dropdown.types.ts';
|
|
8
7
|
|
|
9
8
|
export const Dropdown = ({
|
|
10
9
|
options,
|
|
@@ -74,11 +73,13 @@ export const Dropdown = ({
|
|
|
74
73
|
}
|
|
75
74
|
idx += direction;
|
|
76
75
|
}
|
|
76
|
+
|
|
77
77
|
return from;
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
const firstEnabled = () => {
|
|
81
81
|
const idx = options.findIndex((opt) => !opt.disabled);
|
|
82
|
+
|
|
82
83
|
return idx >= 0 ? idx : 0;
|
|
83
84
|
};
|
|
84
85
|
|
|
@@ -87,6 +88,7 @@ export const Dropdown = ({
|
|
|
87
88
|
while (idx >= 0 && options[idx].disabled) {
|
|
88
89
|
idx -= 1;
|
|
89
90
|
}
|
|
91
|
+
|
|
90
92
|
return idx >= 0 ? idx : options.length - 1;
|
|
91
93
|
};
|
|
92
94
|
|
|
@@ -173,6 +175,7 @@ export const Dropdown = ({
|
|
|
173
175
|
};
|
|
174
176
|
|
|
175
177
|
document.addEventListener('mousedown', handleClickOutside);
|
|
178
|
+
|
|
176
179
|
return () => {
|
|
177
180
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
178
181
|
};
|
|
@@ -242,6 +245,7 @@ export const Dropdown = ({
|
|
|
242
245
|
{options.map((option, index) => {
|
|
243
246
|
const isSelected = option.value === currentValue;
|
|
244
247
|
const isFocused = index === focusedIndex;
|
|
248
|
+
|
|
245
249
|
return (
|
|
246
250
|
<li
|
|
247
251
|
key={option.value}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import classnames from 'classnames';
|
|
2
2
|
|
|
3
|
-
import styles from './Header.module.css';
|
|
4
|
-
import type { HeaderProps } from './Header.types.ts';
|
|
5
3
|
import { Button } from '../Button/Button.tsx';
|
|
6
4
|
import type { ButtonProps } from '../Button/Button.types.ts';
|
|
5
|
+
import styles from './Header.module.css';
|
|
6
|
+
import type { HeaderProps } from './Header.types.ts';
|
|
7
7
|
|
|
8
8
|
export const Header = ({
|
|
9
9
|
id,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import classnames from 'classnames';
|
|
2
|
-
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
3
2
|
|
|
3
|
+
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
4
4
|
import styles from './Input.module.css';
|
|
5
5
|
import type { InputProps } from './Input.types.ts';
|
|
6
6
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import classnames from 'classnames';
|
|
2
2
|
import type { CSSProperties } from 'react';
|
|
3
3
|
|
|
4
|
+
import { getSpacingStyles } from '../Box/helpers/getSpacingStyles';
|
|
4
5
|
import styles from './List.module.css';
|
|
5
6
|
import type { ListProps } from './List.types';
|
|
6
|
-
import { getSpacingStyles } from '../Box/helpers/getSpacingStyles';
|
|
7
7
|
import { ListItem } from './ListItem';
|
|
8
8
|
|
|
9
9
|
export const List = ({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { BoxMargin, BoxPadding } from '../Box/Box.types';
|
|
3
4
|
|
|
4
5
|
export type ListVariant = 'unordered' | 'ordered' | 'none';
|
|
5
6
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import classnames from 'classnames';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import styles from './ListItem.module.css';
|
|
4
|
+
import type { ListItemProps } from './ListItem.types';
|
|
4
5
|
|
|
5
6
|
export const ListItem = ({ children, icon, className, ...props }: ListItemProps) => {
|
|
6
7
|
return (
|
|
@@ -2,12 +2,12 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { fn } from 'storybook/test';
|
|
4
4
|
|
|
5
|
-
import { Modal } from './Modal.tsx';
|
|
6
5
|
import { Box } from '../Box/Box.tsx';
|
|
7
6
|
import { Button } from '../Button/Button.tsx';
|
|
8
7
|
import { Input } from '../Input/Input.tsx';
|
|
9
8
|
import { Text } from '../Text/Text.tsx';
|
|
10
9
|
import { Textarea } from '../Textarea/Textarea.tsx';
|
|
10
|
+
import { Modal } from './Modal.tsx';
|
|
11
11
|
|
|
12
12
|
const meta = {
|
|
13
13
|
title: 'Components/Modal',
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import classnames from 'classnames';
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
2
3
|
|
|
3
4
|
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
4
5
|
import { useFocusTrap } from '../../hooks/useFocusTrap.ts';
|
|
5
|
-
import {
|
|
6
|
-
|
|
6
|
+
import { Button } from '../Button/Button.tsx';
|
|
7
7
|
import styles from './Modal.module.css';
|
|
8
8
|
import type { ModalProps } from './Modal.types.ts';
|
|
9
|
-
import { Button } from '../Button/Button.tsx';
|
|
10
9
|
|
|
11
10
|
export const Modal = ({
|
|
12
11
|
isOpen,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { fn } from 'storybook/test';
|
|
3
3
|
|
|
4
|
-
import { Notification } from './Notification.tsx';
|
|
5
4
|
import { Box } from '../Box/Box.tsx';
|
|
5
|
+
import { Notification } from './Notification.tsx';
|
|
6
6
|
|
|
7
7
|
const meta = {
|
|
8
8
|
title: 'Components/Notification',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import classnames from 'classnames';
|
|
2
2
|
|
|
3
|
+
import { Button } from '../Button/Button.tsx';
|
|
3
4
|
import styles from './Notification.module.css';
|
|
4
5
|
import type { NotificationProps } from './Notification.types.ts';
|
|
5
|
-
import { Button } from '../Button/Button.tsx';
|
|
6
6
|
|
|
7
7
|
export const Notification = ({
|
|
8
8
|
intent = 'neutral',
|
|
@@ -2,10 +2,9 @@ import classnames from 'classnames';
|
|
|
2
2
|
import { useMemo, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
5
|
-
|
|
5
|
+
import { Button } from '../Button/Button.tsx';
|
|
6
6
|
import styles from './Pagination.module.css';
|
|
7
7
|
import type { PaginationProps } from './Pagination.types.ts';
|
|
8
|
-
import { Button } from '../Button/Button.tsx';
|
|
9
8
|
|
|
10
9
|
type PageItem = number | 'ellipsis';
|
|
11
10
|
|
|
@@ -16,6 +15,7 @@ const range = (start: number, end: number) => {
|
|
|
16
15
|
for (let i = start; i <= end; i += 1) {
|
|
17
16
|
items.push(i);
|
|
18
17
|
}
|
|
18
|
+
|
|
19
19
|
return items;
|
|
20
20
|
};
|
|
21
21
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import classnames from 'classnames';
|
|
2
|
-
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
3
2
|
|
|
3
|
+
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
4
4
|
import styles from './ProgressBar.module.css';
|
|
5
5
|
import type { ProgressBarProps } from './ProgressBar.types.ts';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import classnames from 'classnames';
|
|
2
|
-
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
3
2
|
|
|
3
|
+
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
4
4
|
import styles from './RadioButton.module.css';
|
|
5
5
|
import type { RadioButtonProps } from './RadioButton.types.ts';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import classnames from 'classnames';
|
|
2
|
-
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
3
2
|
|
|
3
|
+
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
4
4
|
import styles from './Select.module.css';
|
|
5
5
|
import type { SelectProps } from './Select.types.ts';
|
|
6
6
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import classnames from 'classnames';
|
|
2
2
|
|
|
3
|
+
import { Box } from '../Box/Box.tsx';
|
|
3
4
|
import styles from './Skeleton.module.css';
|
|
4
5
|
import type { SkeletonProps } from './Skeleton.types.ts';
|
|
5
|
-
import { Box } from '../Box/Box.tsx';
|
|
6
6
|
|
|
7
7
|
export const Skeleton = ({
|
|
8
8
|
variant = 'rectangular',
|
|
@@ -2,7 +2,6 @@ import classnames from 'classnames';
|
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
5
|
-
|
|
6
5
|
import { Input } from '../Input/Input.tsx';
|
|
7
6
|
import styles from './Slider.module.css';
|
|
8
7
|
import type { SliderProps, SliderValue } from './Slider.types.ts';
|
|
@@ -12,6 +11,7 @@ const toNumber = (value: number | string | undefined, fallback: number): number
|
|
|
12
11
|
return fallback;
|
|
13
12
|
}
|
|
14
13
|
const parsed = typeof value === 'number' ? value : Number(value);
|
|
14
|
+
|
|
15
15
|
return Number.isNaN(parsed) ? fallback : parsed;
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -29,6 +29,7 @@ const alignToStep = (
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
const steps = Math.round((value - min) / step);
|
|
32
|
+
|
|
32
33
|
return clamp(min + steps * step, min, max);
|
|
33
34
|
};
|
|
34
35
|
|
|
@@ -40,10 +41,12 @@ const normalizeToPair = (
|
|
|
40
41
|
if (Array.isArray(value)) {
|
|
41
42
|
const left = clamp(toNumber(value[0], min), min, max);
|
|
42
43
|
const right = clamp(toNumber(value[1], max), min, max);
|
|
44
|
+
|
|
43
45
|
return left <= right ? [left, right] : [right, left];
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
const resolved = clamp(toNumber(value, min), min, max);
|
|
49
|
+
|
|
47
50
|
return [resolved, resolved];
|
|
48
51
|
};
|
|
49
52
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
|
|
3
|
+
import { Box } from '../Box/Box.tsx';
|
|
3
4
|
import type { StepOptions } from './Step.types.ts';
|
|
4
5
|
import { Stepper } from './Stepper.tsx';
|
|
5
|
-
import { Box } from '../Box/Box.tsx';
|
|
6
6
|
|
|
7
7
|
const meta = {
|
|
8
8
|
title: 'Components/Stepper',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import classnames from 'classnames';
|
|
2
|
-
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
3
2
|
|
|
3
|
+
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
4
4
|
import { Step } from './Step.tsx';
|
|
5
5
|
import styles from './Stepper.module.css';
|
|
6
6
|
import type { StepperProps } from './Stepper.types.ts';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { StepOptions, StepperStatus } from './Step.types.ts';
|
|
2
2
|
|
|
3
3
|
const clampIndex = (index: number, length: number) => {
|
|
4
4
|
if (Number.isNaN(index) || length <= 0) {
|
|
5
5
|
return -1;
|
|
6
6
|
}
|
|
7
|
+
|
|
7
8
|
return Math.min(Math.max(index, 0), length - 1);
|
|
8
9
|
};
|
|
9
10
|
|
|
@@ -17,6 +18,7 @@ export const resolveCurrentIndex = (
|
|
|
17
18
|
if (typeof currentStep === 'string') {
|
|
18
19
|
return steps.findIndex((step) => step.id === currentStep);
|
|
19
20
|
}
|
|
21
|
+
|
|
20
22
|
return steps.findIndex((step) => step.status === 'current');
|
|
21
23
|
};
|
|
22
24
|
|
|
@@ -37,5 +39,6 @@ export const getStepStatus = (
|
|
|
37
39
|
if (index === currentIndex) {
|
|
38
40
|
return 'current';
|
|
39
41
|
}
|
|
42
|
+
|
|
40
43
|
return 'upcoming';
|
|
41
44
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import classnames from 'classnames';
|
|
2
|
-
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
3
2
|
|
|
3
|
+
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
4
4
|
import styles from './Switch.module.css';
|
|
5
5
|
import type { SwitchProps } from './Switch.types.ts';
|
|
6
6
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
|
|
3
|
-
import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell } from './Table.tsx';
|
|
4
3
|
import { Badge } from '../Badge/Badge.tsx';
|
|
5
4
|
import { Button } from '../Button/Button.tsx';
|
|
5
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from './Table.tsx';
|
|
6
6
|
|
|
7
7
|
const meta = {
|
|
8
8
|
title: 'Components/Table',
|
|
@@ -2,12 +2,12 @@ import { render, screen } from '@testing-library/react';
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
Table,
|
|
5
|
-
TableHeader,
|
|
6
5
|
TableBody,
|
|
6
|
+
TableCell,
|
|
7
7
|
TableFooter,
|
|
8
|
-
TableRow,
|
|
9
8
|
TableHead,
|
|
10
|
-
|
|
9
|
+
TableHeader,
|
|
10
|
+
TableRow,
|
|
11
11
|
} from './Table.tsx';
|
|
12
12
|
|
|
13
13
|
const BasicTable = () => (
|
|
@@ -2,13 +2,13 @@ import classnames from 'classnames';
|
|
|
2
2
|
|
|
3
3
|
import styles from './Table.module.css';
|
|
4
4
|
import type {
|
|
5
|
-
TableProps,
|
|
6
|
-
TableHeaderProps,
|
|
7
5
|
TableBodyProps,
|
|
6
|
+
TableCellProps,
|
|
8
7
|
TableFooterProps,
|
|
9
|
-
|
|
8
|
+
TableHeaderProps,
|
|
10
9
|
TableHeadProps,
|
|
11
|
-
|
|
10
|
+
TableProps,
|
|
11
|
+
TableRowProps,
|
|
12
12
|
} from './Table.types.ts';
|
|
13
13
|
|
|
14
14
|
export const Table = ({
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import classnames from 'classnames';
|
|
2
|
-
import {
|
|
2
|
+
import { type KeyboardEvent, useRef, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
5
|
-
|
|
6
5
|
import styles from './Tabs.module.css';
|
|
7
6
|
import type { TabsProps } from './Tabs.types.ts';
|
|
8
7
|
|
|
@@ -76,6 +75,7 @@ export const Tabs = ({
|
|
|
76
75
|
const isSelected = item.id === activeId;
|
|
77
76
|
const isDisabled = Boolean(item.disabled);
|
|
78
77
|
const tabIndex = isDisabled ? -1 : isSelected ? 0 : -1;
|
|
78
|
+
|
|
79
79
|
return (
|
|
80
80
|
<button
|
|
81
81
|
key={item.id}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ElementType, HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { BoxMargin, BoxPadding } from '../Box/Box.types.ts';
|
|
4
4
|
|
|
5
|
-
export type {
|
|
5
|
+
export type { BoxMargin, BoxPadding };
|
|
6
6
|
|
|
7
7
|
export type TextVariant =
|
|
8
8
|
| 'h1'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import classnames from 'classnames';
|
|
2
|
-
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
3
2
|
|
|
3
|
+
import { useComponentId } from '../../hooks/useComponentId.ts';
|
|
4
4
|
import styles from './Textarea.module.css';
|
|
5
5
|
import type { TextareaProps } from './Textarea.types.ts';
|
|
6
6
|
|