enwawa-ui 1.0.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/.babelrc.json +16 -0
- package/.eslintrc.cjs +37 -0
- package/.husky/pre-commit +6 -0
- package/.prettierignore +6 -0
- package/.prettierrc +4 -0
- package/.storybook/main.ts +21 -0
- package/.storybook/preview.tsx +57 -0
- package/.vscode/settings.json +14 -0
- package/CHANGELOG.md +118 -0
- package/auto.config.ts +34 -0
- package/constants.ts +1 -0
- package/createIndexes.js +34 -0
- package/index.ts +5 -0
- package/package.json +94 -0
- package/placeholder.ts +1 -0
- package/readme.md +1 -0
- package/rollup.config.mjs +48 -0
- package/stories/Introduction.mdx +221 -0
- package/stories/assets/backgrounds/bg-1.png +0 -0
- package/stories/assets/carousel/login/1st.png +0 -0
- package/stories/assets/icons/code-brackets.svg +1 -0
- package/stories/assets/icons/colors.svg +1 -0
- package/stories/assets/icons/comments.svg +1 -0
- package/stories/assets/icons/direction.svg +1 -0
- package/stories/assets/icons/flow.svg +1 -0
- package/stories/assets/icons/plugin.svg +1 -0
- package/stories/assets/icons/repo.svg +1 -0
- package/stories/assets/icons/stackalt.svg +1 -0
- package/stories/assets/icons/wawa-isotype.svg +4 -0
- package/stories/assets/icons/wawa-logo.svg +6 -0
- package/stories/atoms/AtAvatar/AtAvatar.stories.tsx +61 -0
- package/stories/atoms/AtAvatar/index.tsx +46 -0
- package/stories/atoms/AtButton/AtButton.stories.ts +88 -0
- package/stories/atoms/AtButton/index.tsx +69 -0
- package/stories/atoms/AtButton/styles.ts +13 -0
- package/stories/atoms/AtCheckBox/AtCheckBox.stories.tsx +30 -0
- package/stories/atoms/AtCheckBox/index.tsx +38 -0
- package/stories/atoms/AtDatePicker/AtDatePicker.stories.tsx +45 -0
- package/stories/atoms/AtDatePicker/index.tsx +93 -0
- package/stories/atoms/AtDivider/AtDivider.stories.tsx +57 -0
- package/stories/atoms/AtDivider/index.tsx +44 -0
- package/stories/atoms/AtImage/AtImage.stories.tsx +66 -0
- package/stories/atoms/AtImage/index.tsx +41 -0
- package/stories/atoms/AtLogo/AtLogo.stories.ts +47 -0
- package/stories/atoms/AtLogo/index.tsx +22 -0
- package/stories/atoms/AtLogo/styles.ts +26 -0
- package/stories/atoms/AtNumberInput/AtNumberInput.stories.ts +40 -0
- package/stories/atoms/AtNumberInput/index.tsx +138 -0
- package/stories/atoms/AtNumberInput/styles.tsx +7 -0
- package/stories/atoms/AtPasswordInput/AtPasswordInput.stories.ts +24 -0
- package/stories/atoms/AtPasswordInput/index.tsx +11 -0
- package/stories/atoms/AtRadio/AtRadio.stories.tsx +36 -0
- package/stories/atoms/AtRadio/index.tsx +44 -0
- package/stories/atoms/AtSelect/AtSelect.stories.tsx +132 -0
- package/stories/atoms/AtSelect/index.tsx +229 -0
- package/stories/atoms/AtSelect/styles.tsx +8 -0
- package/stories/atoms/AtText/AtText.stories.ts +104 -0
- package/stories/atoms/AtText/index.tsx +65 -0
- package/stories/atoms/AtTextInput/AtTextInput.stories.ts +40 -0
- package/stories/atoms/AtTextInput/index.tsx +85 -0
- package/stories/atoms/AtTitle/AtTitle.stories.ts +103 -0
- package/stories/atoms/AtTitle/index.tsx +77 -0
- package/stories/atoms/AtTitle/styles.ts +7 -0
- package/stories/atoms/index.ts +14 -0
- package/stories/molecules/MlBreadCrumb/MlBreadCrumb.stories.tsx +123 -0
- package/stories/molecules/MlBreadCrumb/index.tsx +29 -0
- package/stories/molecules/MlCard/MlCard.stories.tsx +55 -0
- package/stories/molecules/MlCard/index.tsx +100 -0
- package/stories/molecules/MlCard/styles.tsx +22 -0
- package/stories/molecules/MlCarousel/MlCarousel.stories.tsx +98 -0
- package/stories/molecules/MlCarousel/index.tsx +67 -0
- package/stories/molecules/MlDropdown/MlDropdown.stories.tsx +121 -0
- package/stories/molecules/MlDropdown/index.tsx +97 -0
- package/stories/molecules/MlFormItem/MlFormItem.stories.tsx +33 -0
- package/stories/molecules/MlFormItem/index.tsx +100 -0
- package/stories/molecules/MlRadioGroup/MlRadioGroup.stories.ts +40 -0
- package/stories/molecules/MlRadioGroup/index.tsx +60 -0
- package/stories/molecules/index.ts +6 -0
- package/stories/organisms/OrAlert/OrAlert.stories.tsx +136 -0
- package/stories/organisms/OrAlert/index.tsx +64 -0
- package/stories/organisms/OrCol/OrCol.stories.tsx +33 -0
- package/stories/organisms/OrCol/index.tsx +108 -0
- package/stories/organisms/OrCol/styles.ts +86 -0
- package/stories/organisms/OrContent/index.tsx +6 -0
- package/stories/organisms/OrCountryCard/OrCountryCard.stories.ts +19 -0
- package/stories/organisms/OrCountryCard/index.tsx +55 -0
- package/stories/organisms/OrFlagGrid/OrFlagGrid.stories.ts +41 -0
- package/stories/organisms/OrFlagGrid/index.tsx +54 -0
- package/stories/organisms/OrFrom/index.tsx +10 -0
- package/stories/organisms/OrHeader/index.tsx +6 -0
- package/stories/organisms/OrLayout/index.tsx +6 -0
- package/stories/organisms/OrLoginLayout/OrLoginLayout.stories.tsx +34 -0
- package/stories/organisms/OrLoginLayout/index.tsx +63 -0
- package/stories/organisms/OrLoginLayout/styles.tsx +16 -0
- package/stories/organisms/OrRow/OrRow.stories.tsx +48 -0
- package/stories/organisms/OrRow/index.tsx +71 -0
- package/stories/organisms/OrRow/styles.ts +24 -0
- package/stories/organisms/OrSider/index.tsx +6 -0
- package/stories/organisms/OrSimpleBanner/OrSimpleBanner.stories.ts +18 -0
- package/stories/organisms/OrSimpleBanner/index.tsx +26 -0
- package/stories/organisms/OrSimpleBanner/styles.ts +12 -0
- package/stories/organisms/OrSpace/OrSpace.stories.tsx +169 -0
- package/stories/organisms/OrSpace/index.tsx +43 -0
- package/stories/organisms/OrSpaceCompact/OrSpaceCompact.stories.tsx +94 -0
- package/stories/organisms/OrSpaceCompact/index.tsx +35 -0
- package/stories/organisms/index.ts +14 -0
- package/stories/templates/TmLoginCountry/TmLoginCountry.stories.ts +44 -0
- package/stories/templates/TmLoginCountry/index.tsx +64 -0
- package/stories/templates/TmLoginCountry/styles.tsx +14 -0
- package/stories/templates/TmLoginPhone/TmLoginPhone.stories.tsx +49 -0
- package/stories/templates/TmLoginPhone/index.tsx +191 -0
- package/stories/templates/TmLoginPhone/styles.tsx +31 -0
- package/stories/templates/index.ts +2 -0
- package/theme.tsx +56 -0
- package/tsconfig.json +38 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AtDatePicker } from '.';
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Atoms/AtDatePicker',
|
|
6
|
+
component: AtDatePicker,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
} satisfies Meta<typeof AtDatePicker>;
|
|
9
|
+
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
|
|
13
|
+
export const Basic: Story = {
|
|
14
|
+
args: {},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const ByMode: Story = {
|
|
18
|
+
args: {
|
|
19
|
+
picker: 'time',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Size: Story = {
|
|
24
|
+
args: {
|
|
25
|
+
size: 'large',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Status: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
status: 'error',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const Disabled: Story = {
|
|
36
|
+
args: {
|
|
37
|
+
disabled: true,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Borderless: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
bordered: false,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DatePicker, DatePickerProps } from 'antd';
|
|
3
|
+
import { Dayjs } from 'dayjs';
|
|
4
|
+
|
|
5
|
+
interface AtDatePickerPros {
|
|
6
|
+
/**
|
|
7
|
+
* If true, the date picker will be disabled
|
|
8
|
+
*/
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether to show clear button
|
|
12
|
+
*/
|
|
13
|
+
allowClear?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* If get focus when component mounted
|
|
16
|
+
*/
|
|
17
|
+
autoFocus?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether has border style
|
|
20
|
+
*/
|
|
21
|
+
bordered?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Trigger change when blur. e.g. datetime picker no need click confirm button
|
|
24
|
+
*/
|
|
25
|
+
changeOnBlur?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Specify the date that cannot be selected
|
|
28
|
+
*/
|
|
29
|
+
disabledDate?: (currentDate: Dayjs) => boolean;
|
|
30
|
+
/**
|
|
31
|
+
* To set the date format, support multi-format matching when it is an array, display the first one shall prevail. refer to dayjs#format. for example: Custom Format
|
|
32
|
+
*/
|
|
33
|
+
format?: string | string[];
|
|
34
|
+
/**
|
|
35
|
+
* Set the readonly attribute of the input tag (avoids virtual keyboard on touch devices)
|
|
36
|
+
*/
|
|
37
|
+
inputReadOnly?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Localization configuration
|
|
40
|
+
*/
|
|
41
|
+
locale?: DatePickerProps['locale'];
|
|
42
|
+
/**
|
|
43
|
+
* The picker panel mode( Cannot select year or month anymore? )
|
|
44
|
+
*/
|
|
45
|
+
mode?: 'time' | 'date' | 'month' | 'year' | 'decade';
|
|
46
|
+
/**
|
|
47
|
+
* The open state of picker
|
|
48
|
+
*/
|
|
49
|
+
open?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Set picker type
|
|
52
|
+
*/
|
|
53
|
+
picker?: DatePickerProps['picker'];
|
|
54
|
+
/**
|
|
55
|
+
* Placeholder of the input
|
|
56
|
+
*/
|
|
57
|
+
placeholder?: string;
|
|
58
|
+
/**
|
|
59
|
+
* The position where the selection box pops up
|
|
60
|
+
*/
|
|
61
|
+
placement?: DatePickerProps['placement'];
|
|
62
|
+
/**
|
|
63
|
+
* The preset ranges for quick selection
|
|
64
|
+
*/
|
|
65
|
+
presents?: DatePickerProps['presets'];
|
|
66
|
+
/**
|
|
67
|
+
* To determine the size of the input box, the height of large and small, are 40px and 24px respectively, while default size is 32px
|
|
68
|
+
*/
|
|
69
|
+
size?: DatePickerProps['size'];
|
|
70
|
+
/**
|
|
71
|
+
* Set validation status
|
|
72
|
+
*/
|
|
73
|
+
status?: DatePickerProps['status'];
|
|
74
|
+
/**
|
|
75
|
+
* Callback function, can be executed whether the popup calendar is popped up or closed
|
|
76
|
+
*/
|
|
77
|
+
onOpenChange?: (status: boolean) => void;
|
|
78
|
+
/**
|
|
79
|
+
* Callback when picker panel mode is changed
|
|
80
|
+
*/
|
|
81
|
+
onPanelChange?: (value: Dayjs | null, mode: DatePickerProps['mode']) => void;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const AtDatePicker: React.FC<AtDatePickerPros> = (props) => {
|
|
85
|
+
return <DatePicker {...props} />;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
AtDatePicker.defaultProps = {
|
|
89
|
+
autoFocus: false,
|
|
90
|
+
bordered: true,
|
|
91
|
+
changeOnBlur: false,
|
|
92
|
+
inputReadOnly: false,
|
|
93
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AtDivider } from '.';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Atoms/AtDivider',
|
|
7
|
+
component: AtDivider,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
orientation: { options: ['left', 'right', 'center'] },
|
|
11
|
+
type: { options: ['horizontal', 'vertical'] },
|
|
12
|
+
},
|
|
13
|
+
} satisfies Meta<typeof AtDivider>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
|
|
18
|
+
export const Basic: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
id: '1',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export const Vertical: Story = {
|
|
24
|
+
args: {
|
|
25
|
+
id: '1',
|
|
26
|
+
type: 'vertical',
|
|
27
|
+
},
|
|
28
|
+
render: () => {
|
|
29
|
+
return (
|
|
30
|
+
<>
|
|
31
|
+
Text
|
|
32
|
+
<AtDivider type="vertical" />
|
|
33
|
+
<a href="#">Link</a>
|
|
34
|
+
<AtDivider type="vertical" />
|
|
35
|
+
<a href="#">Link</a>
|
|
36
|
+
</>
|
|
37
|
+
);
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export const Dashed: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
id: '1',
|
|
43
|
+
dashed: true,
|
|
44
|
+
},
|
|
45
|
+
render: (args) => {
|
|
46
|
+
return (
|
|
47
|
+
<div>
|
|
48
|
+
<p>
|
|
49
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne
|
|
50
|
+
merninisti licere mihi ista probare, quae sunt a te dicta? Refert
|
|
51
|
+
tamen, quo modo.
|
|
52
|
+
</p>
|
|
53
|
+
<AtDivider {...args} />
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { Divider } from 'antd';
|
|
3
|
+
|
|
4
|
+
export interface AtDividerProps {
|
|
5
|
+
/**
|
|
6
|
+
* The ID for input
|
|
7
|
+
*/
|
|
8
|
+
id?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The wrapped title
|
|
11
|
+
*/
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Whether line is dashed
|
|
15
|
+
*/
|
|
16
|
+
dashed?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The position of title inside divider
|
|
19
|
+
*/
|
|
20
|
+
orientation?: 'left' | 'right' | 'center';
|
|
21
|
+
/**
|
|
22
|
+
* The margin-left/right between the title and its closest border, while the orientation must be left or right, If a numeric value of type string is provided without a unit, it is assumed to be in pixels (px) by default.
|
|
23
|
+
*/
|
|
24
|
+
orientationMargin?: string | number;
|
|
25
|
+
/**
|
|
26
|
+
* Divider text show as plain style
|
|
27
|
+
*/
|
|
28
|
+
plain?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The direction type of divider
|
|
31
|
+
*/
|
|
32
|
+
type?: 'horizontal' | 'vertical';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const AtDivider: React.FC<AtDividerProps> = (props) => {
|
|
36
|
+
return <Divider {...props}>{props.children}</Divider>;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
AtDivider.defaultProps = {
|
|
40
|
+
dashed: false,
|
|
41
|
+
orientation: 'center',
|
|
42
|
+
plain: true,
|
|
43
|
+
type: 'horizontal',
|
|
44
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { AtImage } from '.';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Atoms/AtImage',
|
|
7
|
+
component: AtImage,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
alt: { control: 'text' },
|
|
11
|
+
fallback: { control: 'text' },
|
|
12
|
+
height: { control: 'text' },
|
|
13
|
+
placeholder: { control: 'text' },
|
|
14
|
+
preview: { control: 'boolean' },
|
|
15
|
+
src: { control: 'text' },
|
|
16
|
+
width: { control: 'text' },
|
|
17
|
+
onError: { control: 'function' },
|
|
18
|
+
},
|
|
19
|
+
} satisfies Meta<typeof AtImage>;
|
|
20
|
+
|
|
21
|
+
export default meta;
|
|
22
|
+
|
|
23
|
+
type Story = StoryObj<typeof AtImage>;
|
|
24
|
+
|
|
25
|
+
export const Basic: Story = {
|
|
26
|
+
args: {
|
|
27
|
+
src: 'https://fastly.picsum.photos/id/1037/200/300.jpg?hmac=4eugJlD2Tm8e9ZZIDrSXnYPKNyVQ9Mm58HkQrLYBy1c',
|
|
28
|
+
alt: 'Example Image',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const WithHeightAndWidth: Story = {
|
|
33
|
+
args: {
|
|
34
|
+
src: 'https://fastly.picsum.photos/id/1037/200/300.jpg?hmac=4eugJlD2Tm8e9ZZIDrSXnYPKNyVQ9Mm58HkQrLYBy1c',
|
|
35
|
+
alt: 'Example Image',
|
|
36
|
+
height: '200px',
|
|
37
|
+
width: '300px',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const WithFallbackAndPlaceholder: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
src: 'https://fastly.picsum.photos/id/1037/200/300.jpg?hmac=4eugJlD2Tm8e9ZZIDrSXnYPKNyVQ9Mm58HkQrLYBy1c',
|
|
44
|
+
alt: 'Example Image',
|
|
45
|
+
fallback: 'Fallback Image URL',
|
|
46
|
+
placeholder: 'Placeholder Image URL',
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const WithPreview: Story = {
|
|
51
|
+
args: {
|
|
52
|
+
src: 'https://fastly.picsum.photos/id/1037/200/300.jpg?hmac=4eugJlD2Tm8e9ZZIDrSXnYPKNyVQ9Mm58HkQrLYBy1c',
|
|
53
|
+
alt: 'Example Image',
|
|
54
|
+
preview: true,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const WithOnErrorCallback: Story = {
|
|
59
|
+
args: {
|
|
60
|
+
src: 'https://fastly.picsum.photos/id/1037/200/300.jpg?hmac=4eugJlD2Tm8e9ZZIDrSXnYPKNyVQ9Mm58HkQrLYBy1c',
|
|
61
|
+
alt: 'Example Image',
|
|
62
|
+
onError: (e: React.SyntheticEvent<HTMLImageElement, Event>) => {
|
|
63
|
+
console.error('Image loading failed:', e);
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Image as AntImage, ImageProps } from 'antd';
|
|
3
|
+
|
|
4
|
+
interface AtImageProps {
|
|
5
|
+
/**
|
|
6
|
+
* Image description
|
|
7
|
+
*/
|
|
8
|
+
alt?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Load failure fault-tolerant src
|
|
11
|
+
*/
|
|
12
|
+
fallback?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Image height
|
|
15
|
+
*/
|
|
16
|
+
height?: string | number;
|
|
17
|
+
/**
|
|
18
|
+
* Image path
|
|
19
|
+
*/
|
|
20
|
+
src?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Image width
|
|
23
|
+
*/
|
|
24
|
+
width?: string | number;
|
|
25
|
+
/**
|
|
26
|
+
* Load failed callback
|
|
27
|
+
*/
|
|
28
|
+
onError?: ImageProps['onError'];
|
|
29
|
+
/**
|
|
30
|
+
* Load placeholder, use default placeholder when set true
|
|
31
|
+
*/
|
|
32
|
+
placeholder?: ImageProps['placeholder'];
|
|
33
|
+
/**
|
|
34
|
+
* preview config, disabled when false
|
|
35
|
+
*/
|
|
36
|
+
preview?: ImageProps['preview'];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const AtImage: React.FC<AtImageProps> = (props) => {
|
|
40
|
+
return <AntImage {...props} />;
|
|
41
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AtLogo } from '.';
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Atoms/AtLogo',
|
|
6
|
+
component: AtLogo,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
} satisfies Meta<typeof AtLogo>;
|
|
9
|
+
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
|
|
13
|
+
export const Basic: Story = {
|
|
14
|
+
args: {},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const Gold: Story = {
|
|
18
|
+
args: {
|
|
19
|
+
color: 'gold',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const White: Story = {
|
|
24
|
+
args: {
|
|
25
|
+
color: 'white',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Isotype: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
type: 'isotype',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const IsotypeGold: Story = {
|
|
36
|
+
args: {
|
|
37
|
+
type: 'isotype',
|
|
38
|
+
color: 'gold',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const IsotypeWhite: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
type: 'isotype',
|
|
45
|
+
color: 'white',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import WaWaLogo from '../../assets/icons/wawa-logo.svg';
|
|
3
|
+
import WaWaIsotype from '../../assets/icons/wawa-isotype.svg';
|
|
4
|
+
import { Logo } from './styles';
|
|
5
|
+
|
|
6
|
+
export interface AtLogoProps {
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
color?: 'violet' | 'gold' | 'white';
|
|
10
|
+
type?: 'logo' | 'isotype';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const AtLogo: React.FC<AtLogoProps> = (props) => {
|
|
14
|
+
return (
|
|
15
|
+
<Logo {...props} src={props.type === 'logo' ? WaWaLogo : WaWaIsotype} />
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
AtLogo.defaultProps = {
|
|
20
|
+
color: 'violet',
|
|
21
|
+
type: 'logo',
|
|
22
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { styled } from 'styled-components';
|
|
2
|
+
import { AtLogoProps } from '.';
|
|
3
|
+
import { violet } from '../../../theme';
|
|
4
|
+
import { gold } from '@ant-design/colors';
|
|
5
|
+
import SVG from 'react-inlinesvg';
|
|
6
|
+
|
|
7
|
+
type LogoAttrs = AtLogoProps & {
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const colorMap = {
|
|
13
|
+
violet: violet[5],
|
|
14
|
+
gold: gold[5],
|
|
15
|
+
white: '#FFFFFF',
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const Logo = styled(SVG)<LogoAttrs>`
|
|
19
|
+
& svg {
|
|
20
|
+
width: ${({ width, type }) => width ?? (type === 'logo' ? 243 : 90)};
|
|
21
|
+
height: ${({ height, type }) => height ?? (type === 'logo' ? 50 : 38)};
|
|
22
|
+
}
|
|
23
|
+
& path {
|
|
24
|
+
fill: ${({ color }) => (color ? colorMap[color] : colorMap.violet)};
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AtNumberInput } from '.';
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Atoms/AtNumberInput',
|
|
6
|
+
component: AtNumberInput,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: {
|
|
9
|
+
status: {
|
|
10
|
+
options: ['none', 'error', 'warning'],
|
|
11
|
+
},
|
|
12
|
+
size: {
|
|
13
|
+
options: ['large', 'middle', 'small'],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
} satisfies Meta<typeof AtNumberInput>;
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
type Story = StoryObj<typeof meta>;
|
|
20
|
+
|
|
21
|
+
export const Basic: Story = {
|
|
22
|
+
args: {
|
|
23
|
+
id: '1',
|
|
24
|
+
value: 1,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const Error: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
value: 1,
|
|
31
|
+
status: 'error',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const Warning: Story = {
|
|
36
|
+
args: {
|
|
37
|
+
value: 1,
|
|
38
|
+
status: 'warning',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import React, { ChangeEvent, ReactNode } from 'react';
|
|
2
|
+
import { ValueType } from '@rc-component/mini-decimal';
|
|
3
|
+
import { StyledInputNumber } from './styles';
|
|
4
|
+
|
|
5
|
+
export interface AtNumberInputProps {
|
|
6
|
+
/**
|
|
7
|
+
* The ID for input
|
|
8
|
+
*/
|
|
9
|
+
id?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The label text displayed after (on the right side of) the input field
|
|
12
|
+
*/
|
|
13
|
+
addonAfter?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* The label text displayed before (on the left side of) the input field
|
|
16
|
+
*/
|
|
17
|
+
addonBefore?: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* If get focus when component mounted
|
|
20
|
+
*/
|
|
21
|
+
autoFocus?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether has border style
|
|
24
|
+
*/
|
|
25
|
+
bordered?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to show +- controls, or set custom arrows icon
|
|
28
|
+
*/
|
|
29
|
+
controls?: boolean | { upIcon?: React.ReactNode; downIcon?: React.ReactNode };
|
|
30
|
+
/**
|
|
31
|
+
* Decimal separator
|
|
32
|
+
*/
|
|
33
|
+
decimalSeparator?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The initial value
|
|
36
|
+
*/
|
|
37
|
+
defaultValue?: number;
|
|
38
|
+
/**
|
|
39
|
+
* If disable the input
|
|
40
|
+
*/
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Specifies the format of the value presented
|
|
44
|
+
*/
|
|
45
|
+
formatter?: (
|
|
46
|
+
value: number | undefined,
|
|
47
|
+
info: { userTyping: boolean; input: string },
|
|
48
|
+
) => string;
|
|
49
|
+
/**
|
|
50
|
+
* If enable keyboard behavior
|
|
51
|
+
*/
|
|
52
|
+
keyboard?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* The max value
|
|
55
|
+
*/
|
|
56
|
+
max?: number;
|
|
57
|
+
/**
|
|
58
|
+
* The min value
|
|
59
|
+
*/
|
|
60
|
+
min?: number;
|
|
61
|
+
/**
|
|
62
|
+
* Specifies the value extracted from formatter
|
|
63
|
+
*/
|
|
64
|
+
parser?: (displayValue: string | undefined) => number;
|
|
65
|
+
/**
|
|
66
|
+
* The precision of input value. Will use formatter when config of formatter
|
|
67
|
+
*/
|
|
68
|
+
precision?: number;
|
|
69
|
+
/**
|
|
70
|
+
* If readonly the input
|
|
71
|
+
*/
|
|
72
|
+
readOnly?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Set validation status
|
|
75
|
+
*/
|
|
76
|
+
status?: 'error' | 'warning';
|
|
77
|
+
/**
|
|
78
|
+
* The prefix icon for the Input
|
|
79
|
+
*/
|
|
80
|
+
prefix?: ReactNode;
|
|
81
|
+
/**
|
|
82
|
+
* The height of input box
|
|
83
|
+
*/
|
|
84
|
+
size?: 'large' | 'middle' | 'small';
|
|
85
|
+
/**
|
|
86
|
+
* The number to which the current value is increased or decreased. It can be an integer or decimal
|
|
87
|
+
*/
|
|
88
|
+
step?: number | string;
|
|
89
|
+
/**
|
|
90
|
+
* Set value as string to support high precision decimals. Will return string value by onChange
|
|
91
|
+
*/
|
|
92
|
+
stringMode?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* The current value
|
|
95
|
+
*/
|
|
96
|
+
value?: number;
|
|
97
|
+
/**
|
|
98
|
+
* The callback triggered when the value is changed
|
|
99
|
+
*/
|
|
100
|
+
onChange?: (value: number | string | null) => void;
|
|
101
|
+
/**
|
|
102
|
+
* The callback function that is triggered when Enter key is pressed
|
|
103
|
+
*/
|
|
104
|
+
onPressEnter?: (e: ChangeEvent<EventTarget>) => void;
|
|
105
|
+
/**
|
|
106
|
+
* The callback function that is triggered when click up or down buttons
|
|
107
|
+
*/
|
|
108
|
+
onStep?: (
|
|
109
|
+
value: number,
|
|
110
|
+
info: {
|
|
111
|
+
offset: ValueType;
|
|
112
|
+
type: 'up' | 'down';
|
|
113
|
+
},
|
|
114
|
+
) => void;
|
|
115
|
+
/**
|
|
116
|
+
* Element width
|
|
117
|
+
*/
|
|
118
|
+
$width?: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Primary input UI component for user interaction
|
|
123
|
+
*/
|
|
124
|
+
export const AtNumberInput: React.FC<AtNumberInputProps> = (props) => {
|
|
125
|
+
return <StyledInputNumber type="number" {...props} />;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
AtNumberInput.defaultProps = {
|
|
129
|
+
autoFocus: false,
|
|
130
|
+
bordered: true,
|
|
131
|
+
disabled: false,
|
|
132
|
+
keyboard: true,
|
|
133
|
+
max: Number.MAX_SAFE_INTEGER,
|
|
134
|
+
min: Number.MIN_SAFE_INTEGER,
|
|
135
|
+
readOnly: false,
|
|
136
|
+
step: 1,
|
|
137
|
+
stringMode: false,
|
|
138
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AtPasswordInput } from '.';
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Atoms/AtPasswordInput',
|
|
6
|
+
component: AtPasswordInput,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: {
|
|
9
|
+
status: {
|
|
10
|
+
options: ['none', 'error', 'warning'],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
} satisfies Meta<typeof AtPasswordInput>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
|
|
18
|
+
export const Basic: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
id: '1',
|
|
21
|
+
value: '',
|
|
22
|
+
placeholder: 'Placeholder',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Input } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AtTextInputProps } from '../AtTextInput';
|
|
4
|
+
|
|
5
|
+
type AtPasswordInputProp = AtTextInputProps & {
|
|
6
|
+
iconRender?: (visible: boolean) => React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const AtPasswordInput: React.FC<AtPasswordInputProp> = (props) => {
|
|
10
|
+
return <Input.Password {...props} />;
|
|
11
|
+
};
|