@kkkarsss/ui 1.0.0
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/.storybook/main.d.ts +3 -0
- package/dist/.storybook/main.js +34 -0
- package/dist/.storybook/preview.d.ts +4 -0
- package/dist/.storybook/preview.js +19 -0
- package/dist/index.css +238 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/providers/alert/alert-context.d.ts +16 -0
- package/dist/providers/alert/alert-context.js +2 -0
- package/dist/providers/alert/alert-provider.d.ts +6 -0
- package/dist/providers/alert/alert-provider.js +50 -0
- package/dist/providers/alert/use-alerts.d.ts +1 -0
- package/dist/providers/alert/use-alerts.js +9 -0
- package/dist/providers/index.d.ts +9 -0
- package/dist/providers/index.js +9 -0
- package/dist/providers/theme/index.d.ts +3 -0
- package/dist/providers/theme/index.js +3 -0
- package/dist/providers/theme/theme-context.d.ts +7 -0
- package/dist/providers/theme/theme-context.js +6 -0
- package/dist/providers/theme/theme-provider.d.ts +9 -0
- package/dist/providers/theme/theme-provider.js +27 -0
- package/dist/providers/theme/use-theme.d.ts +4 -0
- package/dist/providers/theme/use-theme.js +8 -0
- package/dist/providers/widget/index.d.ts +3 -0
- package/dist/providers/widget/index.js +3 -0
- package/dist/providers/widget/use-widgets.d.ts +4 -0
- package/dist/providers/widget/use-widgets.js +8 -0
- package/dist/providers/widget/widget-context.d.ts +12 -0
- package/dist/providers/widget/widget-context.js +6 -0
- package/dist/providers/widget/widget-provider.d.ts +6 -0
- package/dist/providers/widget/widget-provider.js +13 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +4 -0
- package/dist/src/providers/alert/alert-context.d.ts +16 -0
- package/dist/src/providers/alert/alert-context.js +2 -0
- package/dist/src/providers/alert/alert-provider.d.ts +6 -0
- package/dist/src/providers/alert/alert-provider.js +50 -0
- package/dist/src/providers/alert/use-alerts.d.ts +1 -0
- package/dist/src/providers/alert/use-alerts.js +9 -0
- package/dist/src/providers/index.d.ts +9 -0
- package/dist/src/providers/index.js +9 -0
- package/dist/src/providers/theme/theme-context.d.ts +7 -0
- package/dist/src/providers/theme/theme-context.js +6 -0
- package/dist/src/providers/theme/theme-provider.d.ts +9 -0
- package/dist/src/providers/theme/theme-provider.js +27 -0
- package/dist/src/providers/theme/use-theme.d.ts +4 -0
- package/dist/src/providers/theme/use-theme.js +8 -0
- package/dist/src/providers/widget/use-widgets.d.ts +4 -0
- package/dist/src/providers/widget/use-widgets.js +8 -0
- package/dist/src/providers/widget/widget-context.d.ts +12 -0
- package/dist/src/providers/widget/widget-context.js +6 -0
- package/dist/src/providers/widget/widget-provider.d.ts +6 -0
- package/dist/src/providers/widget/widget-provider.js +15 -0
- package/dist/src/ui/controls/button/button.d.ts +10 -0
- package/dist/src/ui/controls/button/button.js +11 -0
- package/dist/src/ui/controls/button/button.stories.d.ts +9 -0
- package/dist/src/ui/controls/button/button.stories.js +38 -0
- package/dist/src/ui/controls/chip/chip.d.ts +12 -0
- package/dist/src/ui/controls/chip/chip.js +11 -0
- package/dist/src/ui/controls/chip/chip.stories.d.ts +9 -0
- package/dist/src/ui/controls/chip/chip.stories.js +42 -0
- package/dist/src/ui/controls/color-picker/color-picker.d.ts +8 -0
- package/dist/src/ui/controls/color-picker/color-picker.js +21 -0
- package/dist/src/ui/controls/color-picker/color-picker.stories.d.ts +7 -0
- package/dist/src/ui/controls/color-picker/color-picker.stories.js +21 -0
- package/dist/src/ui/controls/copy/copy.d.ts +6 -0
- package/dist/src/ui/controls/copy/copy.js +20 -0
- package/dist/src/ui/controls/copy/copy.stories.d.ts +7 -0
- package/dist/src/ui/controls/copy/copy.stories.js +20 -0
- package/dist/src/ui/controls/index.d.ts +7 -0
- package/dist/src/ui/controls/index.js +7 -0
- package/dist/src/ui/controls/input/input.d.ts +14 -0
- package/dist/src/ui/controls/input/input.js +12 -0
- package/dist/src/ui/controls/input/input.stories.d.ts +9 -0
- package/dist/src/ui/controls/input/input.stories.js +46 -0
- package/dist/src/ui/controls/select/select.d.ts +14 -0
- package/dist/src/ui/controls/select/select.js +80 -0
- package/dist/src/ui/controls/select/select.stories.d.ts +8 -0
- package/dist/src/ui/controls/select/select.stories.js +40 -0
- package/dist/src/ui/controls/textarea/textarea.d.ts +11 -0
- package/dist/src/ui/controls/textarea/textarea.js +20 -0
- package/dist/src/ui/controls/textarea/textarea.stories.d.ts +8 -0
- package/dist/src/ui/controls/textarea/textarea.stories.js +35 -0
- package/dist/src/ui/index.d.ts +3 -0
- package/dist/src/ui/index.js +3 -0
- package/dist/src/ui/information/block/block.d.ts +10 -0
- package/dist/src/ui/information/block/block.js +10 -0
- package/dist/src/ui/information/block/block.stories.d.ts +8 -0
- package/dist/src/ui/information/block/block.stories.js +38 -0
- package/dist/src/ui/information/cell/cell.d.ts +26 -0
- package/dist/src/ui/information/cell/cell.js +31 -0
- package/dist/src/ui/information/cell/cell.stories.d.ts +11 -0
- package/dist/src/ui/information/cell/cell.stories.js +62 -0
- package/dist/src/ui/information/cell/cells-block.d.ts +9 -0
- package/dist/src/ui/information/cell/cells-block.js +5 -0
- package/dist/src/ui/information/cell/cells-block.stories.d.ts +6 -0
- package/dist/src/ui/information/cell/cells-block.stories.js +20 -0
- package/dist/src/ui/information/index.d.ts +6 -0
- package/dist/src/ui/information/index.js +6 -0
- package/dist/src/ui/information/spinner/spinner.d.ts +2 -0
- package/dist/src/ui/information/spinner/spinner.js +5 -0
- package/dist/src/ui/information/spinner/spinner.stories.d.ts +6 -0
- package/dist/src/ui/information/spinner/spinner.stories.js +8 -0
- package/dist/src/ui/information/tag/tag.d.ts +6 -0
- package/dist/src/ui/information/tag/tag.js +7 -0
- package/dist/src/ui/information/tag/tag.stories.d.ts +8 -0
- package/dist/src/ui/information/tag/tag.stories.js +25 -0
- package/dist/src/ui/information/text/typo.d.ts +12 -0
- package/dist/src/ui/information/text/typo.js +41 -0
- package/dist/src/ui/information/text/typo.stories.d.ts +10 -0
- package/dist/src/ui/information/text/typo.stories.js +60 -0
- package/dist/src/ui/layout/dropdown/dropdown.d.ts +11 -0
- package/dist/src/ui/layout/dropdown/dropdown.js +59 -0
- package/dist/src/ui/layout/dropdown/dropdown.stories.d.ts +6 -0
- package/dist/src/ui/layout/dropdown/dropdown.stories.js +24 -0
- package/dist/src/ui/layout/flex/flex.d.ts +12 -0
- package/dist/src/ui/layout/flex/flex.js +36 -0
- package/dist/src/ui/layout/flex/flex.stories.d.ts +8 -0
- package/dist/src/ui/layout/flex/flex.stories.js +53 -0
- package/dist/src/ui/layout/icon-action/icon-action.d.ts +9 -0
- package/dist/src/ui/layout/icon-action/icon-action.js +11 -0
- package/dist/src/ui/layout/icon-action/icon-action.stories.d.ts +7 -0
- package/dist/src/ui/layout/icon-action/icon-action.stories.js +23 -0
- package/dist/src/ui/layout/index.d.ts +5 -0
- package/dist/src/ui/layout/index.js +5 -0
- package/dist/src/ui/layout/main-page-layout/main-page-layout.d.ts +7 -0
- package/dist/src/ui/layout/main-page-layout/main-page-layout.js +8 -0
- package/dist/src/ui/layout/main-page-layout/main-page-layout.stories.d.ts +6 -0
- package/dist/src/ui/layout/main-page-layout/main-page-layout.stories.js +19 -0
- package/dist/src/ui/layout/offset/offset.d.ts +6 -0
- package/dist/src/ui/layout/offset/offset.js +10 -0
- package/dist/src/ui/layout/offset/offset.stories.d.ts +8 -0
- package/dist/src/ui/layout/offset/offset.stories.js +33 -0
- package/dist/src/utils/classes.d.ts +1 -0
- package/dist/src/utils/classes.js +1 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.js +1 -0
- package/dist/stories/Button.d.ts +15 -0
- package/dist/stories/Button.js +7 -0
- package/dist/stories/Button.stories.d.ts +23 -0
- package/dist/stories/Button.stories.js +44 -0
- package/dist/stories/Header.d.ts +12 -0
- package/dist/stories/Header.js +4 -0
- package/dist/stories/Header.stories.d.ts +18 -0
- package/dist/stories/Header.stories.js +26 -0
- package/dist/stories/Page.d.ts +3 -0
- package/dist/stories/Page.js +8 -0
- package/dist/stories/Page.stories.d.ts +12 -0
- package/dist/stories/Page.stories.js +24 -0
- package/dist/ui/controls/button/button.d.ts +10 -0
- package/dist/ui/controls/button/button.js +11 -0
- package/dist/ui/controls/button/button.stories.d.ts +9 -0
- package/dist/ui/controls/button/button.stories.js +38 -0
- package/dist/ui/controls/chip/chip.d.ts +12 -0
- package/dist/ui/controls/chip/chip.js +11 -0
- package/dist/ui/controls/chip/chip.stories.d.ts +9 -0
- package/dist/ui/controls/chip/chip.stories.js +42 -0
- package/dist/ui/controls/color-picker/color-picker.d.ts +8 -0
- package/dist/ui/controls/color-picker/color-picker.js +21 -0
- package/dist/ui/controls/color-picker/color-picker.stories.d.ts +7 -0
- package/dist/ui/controls/color-picker/color-picker.stories.js +21 -0
- package/dist/ui/controls/copy/copy.d.ts +6 -0
- package/dist/ui/controls/copy/copy.js +20 -0
- package/dist/ui/controls/copy/copy.stories.d.ts +7 -0
- package/dist/ui/controls/copy/copy.stories.js +20 -0
- package/dist/ui/controls/date-input/date-input.d.ts +10 -0
- package/dist/ui/controls/date-input/date-input.js +25 -0
- package/dist/ui/controls/date-picker/date-picker.d.ts +7 -0
- package/dist/ui/controls/date-picker/date-picker.js +32 -0
- package/dist/ui/controls/index.d.ts +9 -0
- package/dist/ui/controls/index.js +9 -0
- package/dist/ui/controls/input/input.d.ts +15 -0
- package/dist/ui/controls/input/input.js +12 -0
- package/dist/ui/controls/input/input.stories.d.ts +9 -0
- package/dist/ui/controls/input/input.stories.js +46 -0
- package/dist/ui/controls/select/select.d.ts +14 -0
- package/dist/ui/controls/select/select.js +80 -0
- package/dist/ui/controls/select/select.stories.d.ts +8 -0
- package/dist/ui/controls/select/select.stories.js +40 -0
- package/dist/ui/controls/textarea/textarea.d.ts +11 -0
- package/dist/ui/controls/textarea/textarea.js +20 -0
- package/dist/ui/controls/textarea/textarea.stories.d.ts +8 -0
- package/dist/ui/controls/textarea/textarea.stories.js +35 -0
- package/dist/ui/controls/theme-toggle/theme-toggle.d.ts +2 -0
- package/dist/ui/controls/theme-toggle/theme-toggle.js +10 -0
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/index.js +3 -0
- package/dist/ui/information/block/block.d.ts +13 -0
- package/dist/ui/information/block/block.js +10 -0
- package/dist/ui/information/block/block.stories.d.ts +9 -0
- package/dist/ui/information/block/block.stories.js +47 -0
- package/dist/ui/information/calendar-like/calendar-like.d.ts +24 -0
- package/dist/ui/information/calendar-like/calendar-like.js +71 -0
- package/dist/ui/information/cell/cell.d.ts +26 -0
- package/dist/ui/information/cell/cell.js +31 -0
- package/dist/ui/information/cell/cell.stories.d.ts +11 -0
- package/dist/ui/information/cell/cell.stories.js +62 -0
- package/dist/ui/information/cell/cells-block.d.ts +9 -0
- package/dist/ui/information/cell/cells-block.js +5 -0
- package/dist/ui/information/cell/cells-block.stories.d.ts +6 -0
- package/dist/ui/information/cell/cells-block.stories.js +20 -0
- package/dist/ui/information/index.d.ts +8 -0
- package/dist/ui/information/index.js +8 -0
- package/dist/ui/information/not-found/not-found.d.ts +2 -0
- package/dist/ui/information/not-found/not-found.js +6 -0
- package/dist/ui/information/spinner/spinner.d.ts +2 -0
- package/dist/ui/information/spinner/spinner.js +5 -0
- package/dist/ui/information/spinner/spinner.stories.d.ts +6 -0
- package/dist/ui/information/spinner/spinner.stories.js +8 -0
- package/dist/ui/information/tag/tag.d.ts +6 -0
- package/dist/ui/information/tag/tag.js +7 -0
- package/dist/ui/information/tag/tag.stories.d.ts +8 -0
- package/dist/ui/information/tag/tag.stories.js +25 -0
- package/dist/ui/information/text/typo.d.ts +13 -0
- package/dist/ui/information/text/typo.js +41 -0
- package/dist/ui/information/text/typo.stories.d.ts +10 -0
- package/dist/ui/information/text/typo.stories.js +60 -0
- package/dist/ui/information/typo.d.ts +12 -0
- package/dist/ui/information/typo.js +41 -0
- package/dist/ui/layout/dropdown/dropdown.d.ts +11 -0
- package/dist/ui/layout/dropdown/dropdown.js +44 -0
- package/dist/ui/layout/dropdown/dropdown.stories.d.ts +6 -0
- package/dist/ui/layout/dropdown/dropdown.stories.js +24 -0
- package/dist/ui/layout/flex/flex.d.ts +13 -0
- package/dist/ui/layout/flex/flex.js +36 -0
- package/dist/ui/layout/flex/flex.stories.d.ts +8 -0
- package/dist/ui/layout/flex/flex.stories.js +53 -0
- package/dist/ui/layout/icon-action/icon-action.d.ts +9 -0
- package/dist/ui/layout/icon-action/icon-action.js +11 -0
- package/dist/ui/layout/icon-action/icon-action.stories.d.ts +7 -0
- package/dist/ui/layout/icon-action/icon-action.stories.js +23 -0
- package/dist/ui/layout/index.d.ts +5 -0
- package/dist/ui/layout/index.js +5 -0
- package/dist/ui/layout/main-page-layout/main-page-layout.d.ts +7 -0
- package/dist/ui/layout/main-page-layout/main-page-layout.js +8 -0
- package/dist/ui/layout/main-page-layout/main-page-layout.stories.d.ts +6 -0
- package/dist/ui/layout/main-page-layout/main-page-layout.stories.js +19 -0
- package/dist/ui/layout/offset/offset.d.ts +7 -0
- package/dist/ui/layout/offset/offset.js +10 -0
- package/dist/ui/layout/offset/offset.stories.d.ts +8 -0
- package/dist/ui/layout/offset/offset.stories.js +33 -0
- package/dist/utils/classes.d.ts +1 -0
- package/dist/utils/classes.js +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Select } from './select';
|
|
2
|
+
const meta = {
|
|
3
|
+
title: 'Controls/Select',
|
|
4
|
+
component: Select,
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
argTypes: {
|
|
7
|
+
onChange: { action: 'changed' },
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
const options = [
|
|
12
|
+
{ value: '1', label: 'Option 1' },
|
|
13
|
+
{ value: '2', label: 'Option 2' },
|
|
14
|
+
{ value: '3', label: 'Option 3' },
|
|
15
|
+
{ value: '4', label: 'Option 4' },
|
|
16
|
+
{ value: '5', label: 'Option 5' },
|
|
17
|
+
];
|
|
18
|
+
export const Default = {
|
|
19
|
+
args: {
|
|
20
|
+
label: 'Choose an option',
|
|
21
|
+
options,
|
|
22
|
+
value: '1',
|
|
23
|
+
placeholder: 'Select...',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export const WithoutLabel = {
|
|
27
|
+
args: {
|
|
28
|
+
options,
|
|
29
|
+
value: '',
|
|
30
|
+
placeholder: 'Pick something',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export const Disabled = {
|
|
34
|
+
args: {
|
|
35
|
+
label: 'Disabled Select',
|
|
36
|
+
options,
|
|
37
|
+
value: '1',
|
|
38
|
+
disabled: true,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ChangeEvent, type FC } from 'react';
|
|
2
|
+
export type TTextAreaProps = {
|
|
3
|
+
value: string;
|
|
4
|
+
onChange: (e: ChangeEvent<HTMLTextAreaElement>) => void;
|
|
5
|
+
label?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
size?: 's' | 'm' | 'l';
|
|
10
|
+
};
|
|
11
|
+
export declare const TextArea: FC<TTextAreaProps>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import { jc } from '../../../utils';
|
|
4
|
+
import { Typo } from '../../information';
|
|
5
|
+
import { Offset } from '../../layout';
|
|
6
|
+
const sizeMap = {
|
|
7
|
+
s: 'text-[12px] font-normal placeholder:text-[12px] placeholder:font-normal',
|
|
8
|
+
m: 'text-[14px] font-medium placeholder:text-[14px] placeholder:font-medium',
|
|
9
|
+
l: 'text-[16px] font-medium placeholder:text-[16px] placeholder:font-medium',
|
|
10
|
+
};
|
|
11
|
+
export const TextArea = ({ onChange, label, value, required, disabled, placeholder, size = 'm', }) => {
|
|
12
|
+
const textareaRef = useRef(null);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (textareaRef.current) {
|
|
15
|
+
textareaRef.current.style.height = 'auto';
|
|
16
|
+
textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;
|
|
17
|
+
}
|
|
18
|
+
}, [value]);
|
|
19
|
+
return (_jsxs("label", { className: "flex w-full cursor-pointer flex-col gap-[2px]", children: [_jsx(Offset, { children: _jsx(Typo, { size: 's', color: 'secondary', weight: '500', children: label }) }), _jsx("textarea", { ref: textareaRef, className: jc('w-full cursor-text resize-none overflow-hidden rounded-sm border-none bg-inherit px-4 pb-2 pt-1 outline-none transition-all duration-200 placeholder:text-secondary-foreground', sizeMap[size]), placeholder: placeholder, value: value, onChange: onChange, disabled: disabled, required: required, rows: 1 })] }));
|
|
20
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { TextArea } from './textarea';
|
|
3
|
+
declare const meta: Meta<typeof TextArea>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithValue: Story;
|
|
8
|
+
export declare const Disabled: Story;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TextArea } from './textarea';
|
|
2
|
+
const meta = {
|
|
3
|
+
title: 'Controls/TextArea',
|
|
4
|
+
component: TextArea,
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
argTypes: {
|
|
7
|
+
onChange: { action: 'changed' },
|
|
8
|
+
size: {
|
|
9
|
+
control: 'select',
|
|
10
|
+
options: ['s', 'm', 'l'],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
export const Default = {
|
|
16
|
+
args: {
|
|
17
|
+
label: 'Description',
|
|
18
|
+
value: '',
|
|
19
|
+
placeholder: 'Type something...',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export const WithValue = {
|
|
23
|
+
args: {
|
|
24
|
+
label: 'Bio',
|
|
25
|
+
value: 'This is a long text that should automatically resize the textarea as it gets longer and longer...',
|
|
26
|
+
placeholder: 'Tell us about yourself',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export const Disabled = {
|
|
30
|
+
args: {
|
|
31
|
+
label: 'Disabled TextArea',
|
|
32
|
+
value: 'ReadOnly content',
|
|
33
|
+
disabled: true,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme } from '../../../providers';
|
|
3
|
+
import { Button } from '../button/button';
|
|
4
|
+
export const ThemeToggle = () => {
|
|
5
|
+
const { theme, setTheme } = useTheme();
|
|
6
|
+
const toggleTheme = () => {
|
|
7
|
+
setTheme(theme === 'light' ? 'dark' : 'light');
|
|
8
|
+
};
|
|
9
|
+
return (_jsx(Button, { variant: "secondary", onClick: toggleTheme, children: theme === 'light' ? 'Темная тема' : 'Светлая тема' }));
|
|
10
|
+
};
|
package/dist/ui/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FC, PropsWithChildren, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { TTypoProps } from '../text/typo';
|
|
3
|
+
export type TBlockProps = PropsWithChildren<{
|
|
4
|
+
title?: ReactElement<TTypoProps>;
|
|
5
|
+
type?: 'fill' | 'hug';
|
|
6
|
+
topAcc?: ReactNode;
|
|
7
|
+
filters?: ReactNode;
|
|
8
|
+
maxWidth?: number | string;
|
|
9
|
+
maxHeight?: number | string;
|
|
10
|
+
minWidth?: number | string;
|
|
11
|
+
minHeight?: number | string;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const Block: FC<TBlockProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jc } from '../../../utils';
|
|
3
|
+
import { Flex, Offset } from '../../layout';
|
|
4
|
+
const typeMap = {
|
|
5
|
+
fill: 'h-full',
|
|
6
|
+
hug: 'h-auto',
|
|
7
|
+
};
|
|
8
|
+
export const Block = ({ children, title, topAcc, filters, type = 'fill', maxWidth, maxHeight, minWidth, minHeight, }) => {
|
|
9
|
+
return (_jsxs("div", { className: jc('w-full flex flex-col', 'rounded-2xl', 'bg-background-accent', 'shadow-[0_0_8px_var(--shadow)]', 'scrollbar-none', 'overflow-hidden', typeMap[type]), style: { maxWidth, maxHeight, minWidth, minHeight }, children: [_jsx("div", { className: jc('sticky', 'top-0', 'z-20', 'bg-background-accent', 'w-full', 'shrink-0'), children: _jsxs(Flex, { direction: 'column', children: [_jsxs(Flex, { justify: 'space-between', align: 'center', children: [title && _jsx(Offset, { type: 'both', children: title }), _jsx("div", { className: 'mx-m', children: _jsx(Flex, { direction: 'column', children: _jsx(Flex, { align: 'center', gap: '4px', children: topAcc }) }) })] }), filters && _jsx("div", { className: 'mb-l', children: filters })] }) }), _jsx("div", { className: "flex-1 overflow-auto scrollbar-none", children: _jsx(Flex, { direction: 'column', type: 'fill', children: children }) })] }));
|
|
10
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Block } from './block';
|
|
3
|
+
declare const meta: Meta<typeof Block>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithTopAcc: Story;
|
|
8
|
+
export declare const Fill: Story;
|
|
9
|
+
export declare const WithNotFound: Story;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Block } from './block';
|
|
3
|
+
import { NotFound } from '../not-found/not-found';
|
|
4
|
+
import { Typo } from '../text/typo';
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Information/Block',
|
|
7
|
+
component: Block,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
type: {
|
|
11
|
+
control: 'select',
|
|
12
|
+
options: ['fill', 'hug'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
export default meta;
|
|
17
|
+
export const Default = {
|
|
18
|
+
args: {
|
|
19
|
+
title: _jsx(Typo, { weight: "500", children: "Block Title" }),
|
|
20
|
+
children: (_jsx("div", { className: "p-4", children: _jsx(Typo, { children: "This is the content of the block." }) })),
|
|
21
|
+
type: 'hug',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
export const WithTopAcc = {
|
|
25
|
+
args: {
|
|
26
|
+
title: _jsx(Typo, { weight: "500", children: "Settings" }),
|
|
27
|
+
topAcc: _jsx("button", { className: "text-xs text-accent", children: "Edit" }),
|
|
28
|
+
children: (_jsx("div", { className: "p-4", children: _jsx(Typo, { children: "Content with top accessory." }) })),
|
|
29
|
+
type: 'hug',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
export const Fill = {
|
|
33
|
+
args: {
|
|
34
|
+
title: _jsx(Typo, { weight: "500", children: "Full Height Block" }),
|
|
35
|
+
children: (_jsx("div", { className: "p-4 h-[200px]", children: _jsx(Typo, { children: "This block is set to fill height." }) })),
|
|
36
|
+
type: 'fill',
|
|
37
|
+
maxHeight: 300,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export const WithNotFound = {
|
|
41
|
+
args: {
|
|
42
|
+
title: _jsx(Typo, { weight: "500", children: "Empty State" }),
|
|
43
|
+
children: _jsx(NotFound, {}),
|
|
44
|
+
minHeight: '200px',
|
|
45
|
+
type: 'hug',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type FC, type ReactNode, type DragEvent } from 'react';
|
|
2
|
+
export type TCalendarItemProps = {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
isCompleted?: boolean;
|
|
7
|
+
isInWork?: boolean;
|
|
8
|
+
onDragStart?: (e: DragEvent<HTMLDivElement>, id: string) => void;
|
|
9
|
+
onClick?: (id: string) => void;
|
|
10
|
+
onResize?: (id: string, newEstimatedTime: number) => void;
|
|
11
|
+
icon?: ReactNode;
|
|
12
|
+
estimatedTime?: number;
|
|
13
|
+
width?: string;
|
|
14
|
+
left?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
color?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const CalendarItem: FC<TCalendarItemProps>;
|
|
19
|
+
export type TCalendarLikeProps = {
|
|
20
|
+
hours?: number[];
|
|
21
|
+
onDrop?: (e: DragEvent<HTMLDivElement>, hour: number) => void;
|
|
22
|
+
renderItem?: (hour: number) => ReactNode;
|
|
23
|
+
};
|
|
24
|
+
export declare const CalendarLike: FC<TCalendarLikeProps>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ExternalLink } from 'lucide-react';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { jc } from '../../../utils';
|
|
5
|
+
import { Flex } from '../../layout';
|
|
6
|
+
import { Offset } from '../../layout';
|
|
7
|
+
import { Typo } from '../text/typo';
|
|
8
|
+
export const CalendarItem = ({ id, title, description, isCompleted, isInWork, onDragStart, onClick, onResize, icon, estimatedTime = 30, width = '100%', left = '0%', className, color, }) => {
|
|
9
|
+
const [previewEstimatedTime, setPreviewEstimatedTime] = useState(null);
|
|
10
|
+
const handleMouseDown = (e) => {
|
|
11
|
+
if (onResize) {
|
|
12
|
+
e.preventDefault();
|
|
13
|
+
e.stopPropagation();
|
|
14
|
+
const startY = e.clientY;
|
|
15
|
+
const startHeight = (estimatedTime / 60) * 80;
|
|
16
|
+
const onMouseMove = (moveEvent) => {
|
|
17
|
+
const deltaY = moveEvent.clientY - startY;
|
|
18
|
+
const newHeight = Math.max(20, startHeight + deltaY);
|
|
19
|
+
// Round to nearest 15 minutes
|
|
20
|
+
const newEstimatedTime = Math.max(15, Math.round(((newHeight / 80) * 60) / 15) * 15);
|
|
21
|
+
setPreviewEstimatedTime(newEstimatedTime);
|
|
22
|
+
};
|
|
23
|
+
const onMouseUp = (upEvent) => {
|
|
24
|
+
const deltaY = upEvent.clientY - startY;
|
|
25
|
+
const newHeight = Math.max(20, startHeight + deltaY);
|
|
26
|
+
const newEstimatedTime = Math.max(15, Math.round(((newHeight / 80) * 60) / 15) * 15);
|
|
27
|
+
if (newEstimatedTime !== estimatedTime) {
|
|
28
|
+
onResize(id, newEstimatedTime);
|
|
29
|
+
}
|
|
30
|
+
setPreviewEstimatedTime(null);
|
|
31
|
+
document.removeEventListener('mousemove', onMouseMove);
|
|
32
|
+
document.removeEventListener('mouseup', onMouseUp);
|
|
33
|
+
// Prevent click event after resize
|
|
34
|
+
const clickPreventer = (e) => {
|
|
35
|
+
e.stopImmediatePropagation();
|
|
36
|
+
document.removeEventListener('click', clickPreventer, true);
|
|
37
|
+
};
|
|
38
|
+
document.addEventListener('click', clickPreventer, true);
|
|
39
|
+
};
|
|
40
|
+
document.addEventListener('mousemove', onMouseMove);
|
|
41
|
+
document.addEventListener('mouseup', onMouseUp);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const displayEstimatedTime = previewEstimatedTime ?? estimatedTime;
|
|
45
|
+
return (_jsx("div", { draggable: !!onDragStart, onDragStart: (e) => {
|
|
46
|
+
onDragStart?.(e, id);
|
|
47
|
+
// Delay applying pointer-events-none to allow the drag operation to start
|
|
48
|
+
setTimeout(() => {
|
|
49
|
+
const el = e.currentTarget;
|
|
50
|
+
if (el)
|
|
51
|
+
el.style.pointerEvents = 'none';
|
|
52
|
+
}, 0);
|
|
53
|
+
}, onDragEnd: (e) => {
|
|
54
|
+
const el = e.currentTarget;
|
|
55
|
+
if (el)
|
|
56
|
+
el.style.pointerEvents = '';
|
|
57
|
+
}, style: { height: `${(displayEstimatedTime / 60) * 80}px`, width, left }, className: jc('calendar-item absolute p-[2px] transition-all flex flex-col z-50 select-none', onDragStart ? 'cursor-move' : '', 'hover:z-[60]', previewEstimatedTime !== null ? 'transition-none z-[60]' : '', className), children: _jsxs("div", { className: jc('w-full h-full p-1 rounded-sm border flex flex-col transition-colors relative', !color && (isCompleted ? 'opacity-50 border-secondary bg-accent/50' : 'border-accent bg-accent'), color && (isCompleted ? 'opacity-50' : ''), previewEstimatedTime !== null ? '!opacity-100' : ''), style: {
|
|
58
|
+
backgroundColor: color ? `${color}80` : undefined,
|
|
59
|
+
borderColor: color ? color : undefined,
|
|
60
|
+
}, children: [_jsxs(Flex, { gap: "8px", align: "center", justify: "space-between", type: "fill", children: [_jsxs(Flex, { gap: "8px", align: "center", type: "fill", className: "min-w-0 flex-1", children: [_jsx(Typo, { size: "s", weight: "500", textDecoration: isCompleted ? 'line-through' : 'none', className: "truncate", children: title }), isInWork && icon] }), onClick && (_jsx("div", { onClick: (e) => {
|
|
61
|
+
e.stopPropagation();
|
|
62
|
+
onClick(id);
|
|
63
|
+
}, className: "cursor-pointer hover:text-primary transition-colors p-0.5", children: _jsx(ExternalLink, { size: 14 }) }))] }), description && displayEstimatedTime > 30 && (_jsx("div", { className: "truncate", children: _jsx(Typo, { size: "xs", color: "secondary", children: description }) })), onResize && !isCompleted && (_jsx("div", { className: "absolute bottom-0 left-0 right-1 h-2 cursor-ns-resize group/resize flex items-center justify-center", onMouseDown: handleMouseDown, children: _jsx("div", { className: "w-8 h-1 bg-accent/30 rounded-full opacity-0 group-hover/resize:opacity-100 transition-opacity" }) }))] }) }));
|
|
64
|
+
};
|
|
65
|
+
const DEFAULT_HOURS = Array.from({ length: 24 }, (_, i) => i);
|
|
66
|
+
export const CalendarLike = ({ hours = DEFAULT_HOURS, onDrop, renderItem }) => {
|
|
67
|
+
const handleDragOver = (e) => {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
};
|
|
70
|
+
return (_jsx(Offset, { type: 'vertical', children: _jsx("div", { className: "relative border-l border-secondary/20 ml-12", children: hours.map((hour) => (_jsxs("div", { onDragOver: handleDragOver, onDrop: (e) => onDrop?.(e, hour), className: "relative h-20 border-b border-secondary-foreground group hover:z-10 has-[.calendar-item:hover]:z-30 has-[.calendar-item:active]:z-30", children: [_jsx("div", { className: "absolute -left-12 top-0 -translate-y-1/2 w-10 text-right", children: _jsxs(Typo, { size: "xs", color: "secondary", children: [String(hour).padStart(2, '0'), ":00"] }) }), _jsx("div", { className: "pl-4 py-1 relative h-full", children: renderItem?.(hour) })] }, hour))) }) }));
|
|
71
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { LucideProps } from 'lucide-react';
|
|
2
|
+
import { type FC, type MouseEvent, type ReactElement } from 'react';
|
|
3
|
+
import type { TTypoProps, TUIColor } from '../text/typo';
|
|
4
|
+
export type TAccessory = {
|
|
5
|
+
icon: FC<LucideProps>;
|
|
6
|
+
onClick?: VoidFunction;
|
|
7
|
+
color?: string;
|
|
8
|
+
strokeWidth?: number;
|
|
9
|
+
bgc?: CSSStyleDeclaration['backgroundColor'];
|
|
10
|
+
};
|
|
11
|
+
export type TCellProps = {
|
|
12
|
+
title: ReactElement<TTypoProps>;
|
|
13
|
+
subtitle?: ReactElement<TTypoProps>;
|
|
14
|
+
description?: ReactElement<TTypoProps>;
|
|
15
|
+
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
16
|
+
accLeft?: TAccessory[];
|
|
17
|
+
accRight?: TAccessory[];
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
active?: boolean;
|
|
20
|
+
tags?: {
|
|
21
|
+
id: string;
|
|
22
|
+
title: string;
|
|
23
|
+
color?: TUIColor;
|
|
24
|
+
}[];
|
|
25
|
+
};
|
|
26
|
+
export declare const Cell: FC<TCellProps>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { Activity, createElement } from 'react';
|
|
3
|
+
import { jc } from '../../../utils';
|
|
4
|
+
import { Flex, IconAction } from '../../layout';
|
|
5
|
+
import { Tag } from '../tag/tag';
|
|
6
|
+
export const Cell = ({ title, subtitle, description, accLeft, accRight, onClick, tags, disabled = false, active = false, }) => {
|
|
7
|
+
const getColor = (defaultColor = 'default') => {
|
|
8
|
+
if (disabled)
|
|
9
|
+
return { ui: 'secondary', icon: 'var(--secondary-foreground)' };
|
|
10
|
+
if (active)
|
|
11
|
+
return { ui: 'accent', icon: 'var(--accent)' };
|
|
12
|
+
return { ui: defaultColor || 'default', icon: 'var(--foreground)' };
|
|
13
|
+
};
|
|
14
|
+
return (_jsx("div", { className: jc('w-full px-l py-m select-none min-h-[32px]', onClick && !disabled ? 'cursor-pointer transition-all duration-200 hover:bg-[var(--shadow)]' : undefined), onClick: !disabled ? onClick : undefined, children: _jsxs(Flex, { type: 'fill', justify: 'space-between', children: [_jsx(Activity, { mode: accLeft?.length ? 'visible' : 'hidden', children: accLeft?.map((acc, i) => (_jsx(IconAction, { icon: createElement(acc.icon, {
|
|
15
|
+
size: 16,
|
|
16
|
+
color: acc.color || getColor().icon,
|
|
17
|
+
strokeWidth: acc.strokeWidth || 2,
|
|
18
|
+
}), bgc: acc.bgc, onClick: acc.onClick }, acc.icon.name + i.toString()))) }), _jsxs(Flex, { direction: 'column', type: 'fill', justify: 'center', gap: '4px', children: [subtitle &&
|
|
19
|
+
React.cloneElement(subtitle, {
|
|
20
|
+
color: getColor(subtitle.props.color).ui,
|
|
21
|
+
}), React.cloneElement(title, {
|
|
22
|
+
color: getColor(title.props.color).ui,
|
|
23
|
+
}), description &&
|
|
24
|
+
React.cloneElement(description, {
|
|
25
|
+
color: getColor(description.props.color).ui,
|
|
26
|
+
}), !!tags?.length && (_jsx("span", { className: 'mt-xs flex gap-xs', children: tags?.map((tag) => (_jsx(Tag, { color: tag.color, children: tag.title }, tag.id))) }))] }), _jsx(Activity, { mode: accRight?.length ? 'visible' : 'hidden', children: accRight?.map((acc, i) => (_jsx(IconAction, { icon: createElement(acc.icon, {
|
|
27
|
+
size: 16,
|
|
28
|
+
color: acc.color || getColor().icon,
|
|
29
|
+
strokeWidth: acc.strokeWidth || 2,
|
|
30
|
+
}), bgc: acc.bgc, onClick: acc.onClick }, acc.icon.name + i.toString()))) })] }) }));
|
|
31
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Cell } from './cell';
|
|
3
|
+
declare const meta: Meta<typeof Cell>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithSubtitleAndDescription: Story;
|
|
8
|
+
export declare const WithAccessories: Story;
|
|
9
|
+
export declare const WithTags: Story;
|
|
10
|
+
export declare const Active: Story;
|
|
11
|
+
export declare const Disabled: Story;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Mail, Settings } from 'lucide-react';
|
|
3
|
+
import { Cell } from './cell';
|
|
4
|
+
import { Typo } from '../text/typo';
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Information/Cell',
|
|
7
|
+
component: Cell,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
onClick: { action: 'clicked' },
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
export const Default = {
|
|
15
|
+
args: {
|
|
16
|
+
title: _jsx(Typo, { weight: "500", children: "Cell Title" }),
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
export const WithSubtitleAndDescription = {
|
|
20
|
+
args: {
|
|
21
|
+
title: _jsx(Typo, { weight: "500", children: "John Doe" }),
|
|
22
|
+
subtitle: _jsx(Typo, { size: "s", children: "Lead Developer" }),
|
|
23
|
+
description: _jsx(Typo, { size: "xs", children: "Currently working on Storybook integration." }),
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export const WithAccessories = {
|
|
27
|
+
args: {
|
|
28
|
+
title: _jsx(Typo, { weight: "500", children: "Contact Support" }),
|
|
29
|
+
accLeft: [
|
|
30
|
+
{
|
|
31
|
+
icon: Mail,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
accRight: [
|
|
35
|
+
{
|
|
36
|
+
icon: Settings,
|
|
37
|
+
onClick: () => alert('Settings clicked'),
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export const WithTags = {
|
|
43
|
+
args: {
|
|
44
|
+
title: _jsx(Typo, { weight: "500", children: "Task #123" }),
|
|
45
|
+
tags: [
|
|
46
|
+
{ id: '1', title: 'High Priority', color: '#ef4444' },
|
|
47
|
+
{ id: '2', title: 'Feature', color: '#3b82f6' },
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
export const Active = {
|
|
52
|
+
args: {
|
|
53
|
+
title: _jsx(Typo, { weight: "500", children: "Active Cell" }),
|
|
54
|
+
active: true,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
export const Disabled = {
|
|
58
|
+
args: {
|
|
59
|
+
title: _jsx(Typo, { weight: "500", children: "Disabled Cell" }),
|
|
60
|
+
disabled: true,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FC, ReactElement } from 'react';
|
|
2
|
+
import type { TCellProps } from './cell';
|
|
3
|
+
import type { TTypoProps } from '../text/typo';
|
|
4
|
+
type TProps = {
|
|
5
|
+
title?: ReactElement<TTypoProps>;
|
|
6
|
+
children: ReactElement<TCellProps> | ReactElement<TCellProps>[];
|
|
7
|
+
};
|
|
8
|
+
export declare const CellsBlock: FC<TProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Cell } from './cell';
|
|
3
|
+
import { CellsBlock } from './cells-block';
|
|
4
|
+
import { Typo } from '../text/typo';
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Information/CellsBlock',
|
|
7
|
+
component: CellsBlock,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
export const Default = {
|
|
12
|
+
args: {
|
|
13
|
+
title: _jsx(Typo, { weight: "500", children: "Group of Cells" }),
|
|
14
|
+
children: [
|
|
15
|
+
_jsx(Cell, { title: _jsx(Typo, { children: "First Cell" }) }, "1"),
|
|
16
|
+
_jsx(Cell, { title: _jsx(Typo, { children: "Second Cell" }) }, "2"),
|
|
17
|
+
_jsx(Cell, { title: _jsx(Typo, { children: "Third Cell" }) }, "3"),
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './block/block';
|
|
2
|
+
export * from './cell/cell';
|
|
3
|
+
export * from './cell/cells-block';
|
|
4
|
+
export * from './spinner/spinner';
|
|
5
|
+
export * from './not-found/not-found';
|
|
6
|
+
export * from './tag/tag';
|
|
7
|
+
export * from './text/typo';
|
|
8
|
+
export * from './calendar-like/calendar-like';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './block/block';
|
|
2
|
+
export * from './cell/cell';
|
|
3
|
+
export * from './cell/cells-block';
|
|
4
|
+
export * from './spinner/spinner';
|
|
5
|
+
export * from './not-found/not-found';
|
|
6
|
+
export * from './tag/tag';
|
|
7
|
+
export * from './text/typo';
|
|
8
|
+
export * from './calendar-like/calendar-like';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Flex } from '../../layout';
|
|
3
|
+
import { Typo } from '../text/typo';
|
|
4
|
+
export const NotFound = () => {
|
|
5
|
+
return (_jsxs(Flex, { direction: "column", align: "center", justify: "center", type: "fill", gap: "8px", children: [_jsx(Typo, { size: "xl", weight: "500", color: "secondary", children: "404" }), _jsx(Typo, { color: "secondary", children: "\u0414\u0430\u043D\u043D\u044B\u0435 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B" })] }));
|
|
6
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Loader2 } from 'lucide-react';
|
|
3
|
+
export const Spinner = () => {
|
|
4
|
+
return (_jsxs("span", { role: "status", "aria-label": "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430", className: "inline-flex items-center", children: [_jsx(Loader2, { size: 16, strokeWidth: 2, className: "animate-spin text-accent" }), _jsx("span", { className: "sr-only", children: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430" })] }));
|
|
5
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Typo } from '../text/typo';
|
|
3
|
+
export const Tag = ({ children, color }) => {
|
|
4
|
+
return (_jsx("span", { className: `inline py-xs text-nowrap px-m no-underline rounded-xl text-xxs w-min`, style: {
|
|
5
|
+
backgroundColor: `${color}22`,
|
|
6
|
+
}, children: _jsx(Typo, { size: 'inherit', weight: '500', color: color, children: children }) }));
|
|
7
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Tag } from './tag';
|
|
3
|
+
declare const meta: Meta<typeof Tag>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Blue: Story;
|
|
8
|
+
export declare const Green: Story;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Tag } from './tag';
|
|
2
|
+
const meta = {
|
|
3
|
+
title: 'Information/Tag',
|
|
4
|
+
component: Tag,
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
};
|
|
7
|
+
export default meta;
|
|
8
|
+
export const Default = {
|
|
9
|
+
args: {
|
|
10
|
+
children: 'Priority',
|
|
11
|
+
color: '#ef4444',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
export const Blue = {
|
|
15
|
+
args: {
|
|
16
|
+
children: 'Feature',
|
|
17
|
+
color: '#3b82f6',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
export const Green = {
|
|
21
|
+
args: {
|
|
22
|
+
children: 'Completed',
|
|
23
|
+
color: '#10b981',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type CSSProperties, type FC, type PropsWithChildren } from 'react';
|
|
2
|
+
type TypoSize = 'inherit' | 'xs' | 's' | 'm' | 'l' | 'xl';
|
|
3
|
+
export type TUIColor = 'accent' | 'secondary' | 'default' | 'error' | string;
|
|
4
|
+
type TypoWeight = '300' | '400' | '500';
|
|
5
|
+
export type TTypoProps = PropsWithChildren<{
|
|
6
|
+
size?: TypoSize;
|
|
7
|
+
color?: TUIColor;
|
|
8
|
+
weight?: TypoWeight;
|
|
9
|
+
textDecoration?: CSSProperties['textDecoration'];
|
|
10
|
+
className?: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const Typo: FC<TTypoProps>;
|
|
13
|
+
export {};
|