@chain-ui/core 0.1.1 → 0.2.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/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +1052 -277
- package/dist/src/components/checkbox/checkbox.d.ts +40 -0
- package/dist/src/components/checkbox/checkbox.stories.d.ts +29 -0
- package/dist/src/components/checkbox/checkbox.test.d.ts +1 -0
- package/dist/src/components/checkbox/index.d.ts +2 -0
- package/dist/src/components/index.d.ts +7 -0
- package/dist/src/components/message/index.d.ts +2 -0
- package/dist/src/components/message/message.d.ts +16 -0
- package/dist/src/components/message/message.stories.d.ts +18 -0
- package/dist/src/components/message/message.test.d.ts +1 -0
- package/dist/src/components/notification/index.d.ts +2 -0
- package/dist/src/components/notification/notification.d.ts +18 -0
- package/dist/src/components/notification/notification.stories.d.ts +18 -0
- package/dist/src/components/notification/notification.test.d.ts +1 -0
- package/dist/src/components/popover/index.d.ts +2 -0
- package/dist/src/components/popover/popover.d.ts +23 -0
- package/dist/src/components/popover/popover.stories.d.ts +18 -0
- package/dist/src/components/popover/popover.test.d.ts +1 -0
- package/dist/src/components/radio/index.d.ts +2 -0
- package/dist/src/components/radio/radio.d.ts +37 -0
- package/dist/src/components/radio/radio.stories.d.ts +28 -0
- package/dist/src/components/radio/radio.test.d.ts +1 -0
- package/dist/src/components/space/space.d.ts +2 -1
- package/dist/src/components/switch/index.d.ts +2 -0
- package/dist/src/components/switch/switch.d.ts +14 -0
- package/dist/src/components/switch/switch.stories.d.ts +24 -0
- package/dist/src/components/switch/switch.test.d.ts +1 -0
- package/dist/src/components/tooltip/index.d.ts +2 -0
- package/dist/src/components/tooltip/tooltip.d.ts +20 -0
- package/dist/src/components/tooltip/tooltip.stories.d.ts +19 -0
- package/dist/src/components/tooltip/tooltip.test.d.ts +1 -0
- package/dist/src/utils/icons.d.ts +1 -0
- package/dist/src/utils/index.d.ts +5 -1
- package/dist/src/utils/portal.d.ts +13 -0
- package/dist/src/utils/position.d.ts +7 -0
- package/package.json +6 -2
- package/dist/index.d.ts +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { default as React, InputHTMLAttributes, ReactNode, ChangeEvent } from 'react';
|
|
2
|
+
export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'size' | 'value' | 'defaultValue' | 'checked' | 'defaultChecked' | 'type' | 'children'> {
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
defaultChecked?: boolean;
|
|
5
|
+
onChange?: (checked: boolean, event?: ChangeEvent<HTMLInputElement>) => void;
|
|
6
|
+
indeterminate?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
size?: 'sm' | 'md' | 'lg';
|
|
9
|
+
color?: 'primary' | 'brand' | 'success' | 'warning' | 'error' | 'info';
|
|
10
|
+
status?: 'default' | 'error' | 'warning';
|
|
11
|
+
shape?: 'square' | 'round';
|
|
12
|
+
label?: ReactNode;
|
|
13
|
+
ariaLabel?: string;
|
|
14
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
15
|
+
value?: string | number;
|
|
16
|
+
className?: string;
|
|
17
|
+
style?: React.CSSProperties;
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLLabelElement>>;
|
|
21
|
+
export interface CheckboxOption {
|
|
22
|
+
label: ReactNode;
|
|
23
|
+
value: string | number;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
indeterminate?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface CheckboxGroupProps {
|
|
28
|
+
value?: (string | number)[];
|
|
29
|
+
defaultValue?: (string | number)[];
|
|
30
|
+
onChange?: (value: (string | number)[], event?: ChangeEvent<HTMLInputElement>) => void;
|
|
31
|
+
options?: CheckboxOption[];
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
size?: 'sm' | 'md' | 'lg';
|
|
34
|
+
color?: 'primary' | 'brand' | 'success' | 'warning' | 'error' | 'info';
|
|
35
|
+
direction?: 'horizontal' | 'vertical';
|
|
36
|
+
className?: string;
|
|
37
|
+
style?: React.CSSProperties;
|
|
38
|
+
children?: ReactNode;
|
|
39
|
+
}
|
|
40
|
+
export declare const CheckboxGroup: React.ForwardRefExoticComponent<CheckboxGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Checkbox, CheckboxGroup } from './checkbox';
|
|
3
|
+
declare const meta: Meta<typeof Checkbox>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Checkbox>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Checked: Story;
|
|
8
|
+
export declare const Indeterminate: Story;
|
|
9
|
+
export declare const Disabled: Story;
|
|
10
|
+
export declare const DisabledChecked: Story;
|
|
11
|
+
export declare const Small: Story;
|
|
12
|
+
export declare const Medium: Story;
|
|
13
|
+
export declare const Large: Story;
|
|
14
|
+
export declare const Round: Story;
|
|
15
|
+
export declare const ColorPrimary: Story;
|
|
16
|
+
export declare const ColorBrand: Story;
|
|
17
|
+
export declare const ColorSuccess: Story;
|
|
18
|
+
export declare const ColorWarning: Story;
|
|
19
|
+
export declare const ColorError: Story;
|
|
20
|
+
export declare const ColorInfo: Story;
|
|
21
|
+
export declare const StatusError: Story;
|
|
22
|
+
export declare const StatusWarning: Story;
|
|
23
|
+
export declare const NoLabel: Story;
|
|
24
|
+
export declare const WithChildren: Story;
|
|
25
|
+
export declare const GroupVertical: StoryObj<typeof CheckboxGroup>;
|
|
26
|
+
export declare const GroupHorizontal: StoryObj<typeof CheckboxGroup>;
|
|
27
|
+
export declare const GroupDisabled: StoryObj<typeof CheckboxGroup>;
|
|
28
|
+
export declare const GroupSmall: StoryObj<typeof CheckboxGroup>;
|
|
29
|
+
export declare const GroupCustomColor: StoryObj<typeof CheckboxGroup>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -10,3 +10,10 @@ export * from './pagination';
|
|
|
10
10
|
export * from './alert';
|
|
11
11
|
export * from './space';
|
|
12
12
|
export * from './divider';
|
|
13
|
+
export * from './checkbox';
|
|
14
|
+
export * from './radio';
|
|
15
|
+
export * from './switch';
|
|
16
|
+
export * from './tooltip';
|
|
17
|
+
export * from './popover';
|
|
18
|
+
export * from './message';
|
|
19
|
+
export * from './notification';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface MessageProps extends Omit<HTMLAttributes<HTMLDivElement>, 'content'> {
|
|
3
|
+
type?: 'success' | 'error' | 'warning' | 'info';
|
|
4
|
+
content?: ReactNode;
|
|
5
|
+
open?: boolean;
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
duration?: number;
|
|
9
|
+
closable?: boolean;
|
|
10
|
+
closeAriaLabel?: string;
|
|
11
|
+
icon?: ReactNode | false;
|
|
12
|
+
placement?: 'top' | 'top-left' | 'top-right';
|
|
13
|
+
getContainer?: () => HTMLElement;
|
|
14
|
+
destroyOnClose?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const Message: React.ForwardRefExoticComponent<MessageProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Message } from './message';
|
|
3
|
+
declare const meta: Meta<typeof Message>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Message>;
|
|
6
|
+
export declare const Success: Story;
|
|
7
|
+
export declare const Error: Story;
|
|
8
|
+
export declare const Warning: Story;
|
|
9
|
+
export declare const Info: Story;
|
|
10
|
+
export declare const Closable: Story;
|
|
11
|
+
export declare const AutoDismiss: Story;
|
|
12
|
+
export declare const TopLeft: Story;
|
|
13
|
+
export declare const TopRight: Story;
|
|
14
|
+
export declare const NoIcon: Story;
|
|
15
|
+
export declare const CustomIcon: Story;
|
|
16
|
+
export declare const LongText: Story;
|
|
17
|
+
export declare const Stacked: Story;
|
|
18
|
+
export declare const Controlled: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface NotificationProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
3
|
+
type?: 'success' | 'error' | 'warning' | 'info';
|
|
4
|
+
title?: ReactNode;
|
|
5
|
+
description?: ReactNode;
|
|
6
|
+
open?: boolean;
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
onClose?: () => void;
|
|
9
|
+
duration?: number;
|
|
10
|
+
closable?: boolean;
|
|
11
|
+
closeAriaLabel?: string;
|
|
12
|
+
icon?: ReactNode | false;
|
|
13
|
+
placement?: 'top-right' | 'top-left';
|
|
14
|
+
action?: ReactNode;
|
|
15
|
+
getContainer?: () => HTMLElement;
|
|
16
|
+
destroyOnClose?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const Notification: React.ForwardRefExoticComponent<NotificationProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Notification } from './notification';
|
|
3
|
+
declare const meta: Meta<typeof Notification>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Notification>;
|
|
6
|
+
export declare const Success: Story;
|
|
7
|
+
export declare const Error: Story;
|
|
8
|
+
export declare const Warning: Story;
|
|
9
|
+
export declare const Info: Story;
|
|
10
|
+
export declare const WithAction: Story;
|
|
11
|
+
export declare const TitleOnly: Story;
|
|
12
|
+
export declare const NoCloseButton: Story;
|
|
13
|
+
export declare const AutoDismiss: Story;
|
|
14
|
+
export declare const TopLeft: Story;
|
|
15
|
+
export declare const NoIcon: Story;
|
|
16
|
+
export declare const CustomIcon: Story;
|
|
17
|
+
export declare const Stacked: Story;
|
|
18
|
+
export declare const Controlled: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as React, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { Placement } from '../../utils';
|
|
3
|
+
export interface PopoverProps extends Omit<HTMLAttributes<HTMLDivElement>, 'content' | 'children' | 'title'> {
|
|
4
|
+
title?: ReactNode;
|
|
5
|
+
content?: ReactNode;
|
|
6
|
+
footer?: ReactNode;
|
|
7
|
+
placement?: Placement;
|
|
8
|
+
trigger?: 'hover' | 'focus' | 'click';
|
|
9
|
+
visible?: boolean;
|
|
10
|
+
defaultVisible?: boolean;
|
|
11
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
12
|
+
closable?: boolean;
|
|
13
|
+
closeAriaLabel?: string;
|
|
14
|
+
arrow?: boolean;
|
|
15
|
+
width?: number | string;
|
|
16
|
+
mouseEnterDelay?: number;
|
|
17
|
+
mouseLeaveDelay?: number;
|
|
18
|
+
zIndex?: number;
|
|
19
|
+
getPopupContainer?: () => HTMLElement;
|
|
20
|
+
destroyOnClose?: boolean;
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export declare const Popover: React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Popover } from './popover';
|
|
3
|
+
declare const meta: Meta<typeof Popover>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Popover>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithFooter: Story;
|
|
8
|
+
export declare const Closable: Story;
|
|
9
|
+
export declare const ContentOnly: Story;
|
|
10
|
+
export declare const PlacementBottom: Story;
|
|
11
|
+
export declare const PlacementBottomStart: Story;
|
|
12
|
+
export declare const PlacementLeft: Story;
|
|
13
|
+
export declare const PlacementRight: Story;
|
|
14
|
+
export declare const HoverTrigger: Story;
|
|
15
|
+
export declare const FocusTrigger: Story;
|
|
16
|
+
export declare const Wide: Story;
|
|
17
|
+
export declare const NoArrow: Story;
|
|
18
|
+
export declare const RichContent: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { default as React, InputHTMLAttributes, ReactNode, ChangeEvent } from 'react';
|
|
2
|
+
export interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'size' | 'value' | 'defaultValue' | 'checked' | 'defaultChecked' | 'type' | 'children'> {
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
defaultChecked?: boolean;
|
|
5
|
+
onChange?: (checked: boolean, event?: ChangeEvent<HTMLInputElement>) => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
size?: 'sm' | 'md' | 'lg';
|
|
8
|
+
color?: 'primary' | 'brand' | 'success' | 'warning' | 'error' | 'info';
|
|
9
|
+
status?: 'default' | 'error' | 'warning';
|
|
10
|
+
label?: ReactNode;
|
|
11
|
+
ariaLabel?: string;
|
|
12
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
13
|
+
value?: string | number;
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
export declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLLabelElement>>;
|
|
19
|
+
export interface RadioOption {
|
|
20
|
+
label: ReactNode;
|
|
21
|
+
value: string | number;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface RadioGroupProps {
|
|
25
|
+
value?: string | number;
|
|
26
|
+
defaultValue?: string | number;
|
|
27
|
+
onChange?: (value: string | number, event?: ChangeEvent<HTMLInputElement>) => void;
|
|
28
|
+
options?: RadioOption[];
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
size?: 'sm' | 'md' | 'lg';
|
|
31
|
+
color?: 'primary' | 'brand' | 'success' | 'warning' | 'error' | 'info';
|
|
32
|
+
direction?: 'horizontal' | 'vertical';
|
|
33
|
+
className?: string;
|
|
34
|
+
style?: React.CSSProperties;
|
|
35
|
+
children?: ReactNode;
|
|
36
|
+
}
|
|
37
|
+
export declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Radio, RadioGroup } from './radio';
|
|
3
|
+
declare const meta: Meta<typeof Radio>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Radio>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Checked: Story;
|
|
8
|
+
export declare const Disabled: Story;
|
|
9
|
+
export declare const DisabledChecked: Story;
|
|
10
|
+
export declare const Small: Story;
|
|
11
|
+
export declare const Medium: Story;
|
|
12
|
+
export declare const Large: Story;
|
|
13
|
+
export declare const ColorPrimary: Story;
|
|
14
|
+
export declare const ColorBrand: Story;
|
|
15
|
+
export declare const ColorSuccess: Story;
|
|
16
|
+
export declare const ColorWarning: Story;
|
|
17
|
+
export declare const ColorError: Story;
|
|
18
|
+
export declare const ColorInfo: Story;
|
|
19
|
+
export declare const StatusError: Story;
|
|
20
|
+
export declare const StatusWarning: Story;
|
|
21
|
+
export declare const NoLabel: Story;
|
|
22
|
+
export declare const WithChildren: Story;
|
|
23
|
+
export declare const GroupVertical: StoryObj<typeof RadioGroup>;
|
|
24
|
+
export declare const GroupHorizontal: StoryObj<typeof RadioGroup>;
|
|
25
|
+
export declare const GroupDisabled: StoryObj<typeof RadioGroup>;
|
|
26
|
+
export declare const GroupSmall: StoryObj<typeof RadioGroup>;
|
|
27
|
+
export declare const GroupCustomColor: StoryObj<typeof RadioGroup>;
|
|
28
|
+
export declare const GroupChildrenMode: StoryObj<typeof RadioGroup>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
export interface SpaceProps extends HTMLAttributes<HTMLDivElement> {
|
|
2
|
+
export interface SpaceProps extends Omit<HTMLAttributes<HTMLDivElement>, 'size'> {
|
|
3
3
|
size?: 'sm' | 'md' | 'lg' | number;
|
|
4
|
+
gap?: string | number;
|
|
4
5
|
direction?: 'horizontal' | 'vertical';
|
|
5
6
|
align?: 'start' | 'end' | 'center' | 'baseline';
|
|
6
7
|
wrap?: boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React, ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface SwitchProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'type' | 'role' | 'children'> {
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
defaultChecked?: boolean;
|
|
5
|
+
onChange?: (checked: boolean, event?: React.MouseEvent<HTMLButtonElement>) => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
size?: 'sm' | 'md' | 'lg';
|
|
9
|
+
color?: 'primary' | 'brand' | 'success' | 'warning' | 'error' | 'info';
|
|
10
|
+
checkedChildren?: ReactNode;
|
|
11
|
+
unCheckedChildren?: ReactNode;
|
|
12
|
+
ariaLabel?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Switch } from './switch';
|
|
3
|
+
declare const meta: Meta<typeof Switch>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Switch>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Checked: Story;
|
|
8
|
+
export declare const Disabled: Story;
|
|
9
|
+
export declare const DisabledChecked: Story;
|
|
10
|
+
export declare const Loading: Story;
|
|
11
|
+
export declare const LoadingChecked: Story;
|
|
12
|
+
export declare const Small: Story;
|
|
13
|
+
export declare const SmallChecked: Story;
|
|
14
|
+
export declare const Medium: Story;
|
|
15
|
+
export declare const Large: Story;
|
|
16
|
+
export declare const ColorPrimary: Story;
|
|
17
|
+
export declare const ColorBrand: Story;
|
|
18
|
+
export declare const ColorSuccess: Story;
|
|
19
|
+
export declare const ColorWarning: Story;
|
|
20
|
+
export declare const ColorError: Story;
|
|
21
|
+
export declare const ColorInfo: Story;
|
|
22
|
+
export declare const WithText: Story;
|
|
23
|
+
export declare const WithTextUnchecked: Story;
|
|
24
|
+
export declare const LargeWithText: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { default as React, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { Placement } from '../../utils/position';
|
|
3
|
+
export interface TooltipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'content' | 'children' | 'title'> {
|
|
4
|
+
title?: ReactNode;
|
|
5
|
+
content?: ReactNode;
|
|
6
|
+
placement?: Placement;
|
|
7
|
+
trigger?: 'hover' | 'focus' | 'click';
|
|
8
|
+
visible?: boolean;
|
|
9
|
+
defaultVisible?: boolean;
|
|
10
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
11
|
+
color?: 'dark' | 'light';
|
|
12
|
+
arrow?: boolean;
|
|
13
|
+
mouseEnterDelay?: number;
|
|
14
|
+
mouseLeaveDelay?: number;
|
|
15
|
+
zIndex?: number;
|
|
16
|
+
getPopupContainer?: () => HTMLElement;
|
|
17
|
+
destroyOnClose?: boolean;
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export declare const Tooltip: React.ForwardRefExoticComponent<TooltipProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Tooltip } from './tooltip';
|
|
3
|
+
declare const meta: Meta<typeof Tooltip>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Tooltip>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const PlacementTop: Story;
|
|
8
|
+
export declare const PlacementTopStart: Story;
|
|
9
|
+
export declare const PlacementTopEnd: Story;
|
|
10
|
+
export declare const PlacementBottom: Story;
|
|
11
|
+
export declare const PlacementLeft: Story;
|
|
12
|
+
export declare const PlacementRight: Story;
|
|
13
|
+
export declare const LightTheme: Story;
|
|
14
|
+
export declare const NoArrow: Story;
|
|
15
|
+
export declare const RichContent: Story;
|
|
16
|
+
export declare const ClickTrigger: Story;
|
|
17
|
+
export declare const FocusTrigger: Story;
|
|
18
|
+
export declare const LongText: Story;
|
|
19
|
+
export declare const OnDisabledElement: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const STATUS_ICONS: Record<string, string>;
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { calculatePosition } from './position';
|
|
2
|
+
export type { Placement, Position } from './position';
|
|
3
|
+
export { STATUS_ICONS } from './icons';
|
|
4
|
+
export { useAnimationState, Portal } from './portal';
|
|
5
|
+
export type { AnimationState, PortalProps } from './portal';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { AnimationState } from '@chain-ui/hooks';
|
|
3
|
+
export interface AnimationStateOptions {
|
|
4
|
+
duration?: number;
|
|
5
|
+
onExited?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export { type AnimationState };
|
|
8
|
+
export declare function useAnimationState(open: boolean, options?: AnimationStateOptions): AnimationState;
|
|
9
|
+
export interface PortalProps {
|
|
10
|
+
getContainer?: () => HTMLElement;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare function Portal({ getContainer, children }: PortalProps): React.ReactPortal;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type Placement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
|
|
2
|
+
export interface Position {
|
|
3
|
+
top: number;
|
|
4
|
+
left: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const POPPER_OFFSET: number;
|
|
7
|
+
export declare function calculatePosition(triggerRect: DOMRect, tooltipRect: DOMRect, placement: Placement): Position;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chain-ui/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core UI components for Chain UI design system",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"import": "./dist/*.js",
|
|
17
17
|
"require": "./dist/*.cjs",
|
|
18
18
|
"types": "./dist/*.d.ts"
|
|
19
|
-
}
|
|
19
|
+
},
|
|
20
|
+
"./dist/*.css": "./dist/*.css"
|
|
20
21
|
},
|
|
21
22
|
"files": [
|
|
22
23
|
"dist"
|
|
@@ -30,6 +31,9 @@
|
|
|
30
31
|
"test": "vitest run",
|
|
31
32
|
"lint": "eslint src/"
|
|
32
33
|
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@chain-ui/hooks": "^0.1.0"
|
|
36
|
+
},
|
|
33
37
|
"peerDependencies": {
|
|
34
38
|
"react": ">=18.0.0",
|
|
35
39
|
"react-dom": ">=18.0.0"
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/index';
|