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.
Files changed (115) hide show
  1. package/.babelrc.json +16 -0
  2. package/.eslintrc.cjs +37 -0
  3. package/.husky/pre-commit +6 -0
  4. package/.prettierignore +6 -0
  5. package/.prettierrc +4 -0
  6. package/.storybook/main.ts +21 -0
  7. package/.storybook/preview.tsx +57 -0
  8. package/.vscode/settings.json +14 -0
  9. package/CHANGELOG.md +118 -0
  10. package/auto.config.ts +34 -0
  11. package/constants.ts +1 -0
  12. package/createIndexes.js +34 -0
  13. package/index.ts +5 -0
  14. package/package.json +94 -0
  15. package/placeholder.ts +1 -0
  16. package/readme.md +1 -0
  17. package/rollup.config.mjs +48 -0
  18. package/stories/Introduction.mdx +221 -0
  19. package/stories/assets/backgrounds/bg-1.png +0 -0
  20. package/stories/assets/carousel/login/1st.png +0 -0
  21. package/stories/assets/icons/code-brackets.svg +1 -0
  22. package/stories/assets/icons/colors.svg +1 -0
  23. package/stories/assets/icons/comments.svg +1 -0
  24. package/stories/assets/icons/direction.svg +1 -0
  25. package/stories/assets/icons/flow.svg +1 -0
  26. package/stories/assets/icons/plugin.svg +1 -0
  27. package/stories/assets/icons/repo.svg +1 -0
  28. package/stories/assets/icons/stackalt.svg +1 -0
  29. package/stories/assets/icons/wawa-isotype.svg +4 -0
  30. package/stories/assets/icons/wawa-logo.svg +6 -0
  31. package/stories/atoms/AtAvatar/AtAvatar.stories.tsx +61 -0
  32. package/stories/atoms/AtAvatar/index.tsx +46 -0
  33. package/stories/atoms/AtButton/AtButton.stories.ts +88 -0
  34. package/stories/atoms/AtButton/index.tsx +69 -0
  35. package/stories/atoms/AtButton/styles.ts +13 -0
  36. package/stories/atoms/AtCheckBox/AtCheckBox.stories.tsx +30 -0
  37. package/stories/atoms/AtCheckBox/index.tsx +38 -0
  38. package/stories/atoms/AtDatePicker/AtDatePicker.stories.tsx +45 -0
  39. package/stories/atoms/AtDatePicker/index.tsx +93 -0
  40. package/stories/atoms/AtDivider/AtDivider.stories.tsx +57 -0
  41. package/stories/atoms/AtDivider/index.tsx +44 -0
  42. package/stories/atoms/AtImage/AtImage.stories.tsx +66 -0
  43. package/stories/atoms/AtImage/index.tsx +41 -0
  44. package/stories/atoms/AtLogo/AtLogo.stories.ts +47 -0
  45. package/stories/atoms/AtLogo/index.tsx +22 -0
  46. package/stories/atoms/AtLogo/styles.ts +26 -0
  47. package/stories/atoms/AtNumberInput/AtNumberInput.stories.ts +40 -0
  48. package/stories/atoms/AtNumberInput/index.tsx +138 -0
  49. package/stories/atoms/AtNumberInput/styles.tsx +7 -0
  50. package/stories/atoms/AtPasswordInput/AtPasswordInput.stories.ts +24 -0
  51. package/stories/atoms/AtPasswordInput/index.tsx +11 -0
  52. package/stories/atoms/AtRadio/AtRadio.stories.tsx +36 -0
  53. package/stories/atoms/AtRadio/index.tsx +44 -0
  54. package/stories/atoms/AtSelect/AtSelect.stories.tsx +132 -0
  55. package/stories/atoms/AtSelect/index.tsx +229 -0
  56. package/stories/atoms/AtSelect/styles.tsx +8 -0
  57. package/stories/atoms/AtText/AtText.stories.ts +104 -0
  58. package/stories/atoms/AtText/index.tsx +65 -0
  59. package/stories/atoms/AtTextInput/AtTextInput.stories.ts +40 -0
  60. package/stories/atoms/AtTextInput/index.tsx +85 -0
  61. package/stories/atoms/AtTitle/AtTitle.stories.ts +103 -0
  62. package/stories/atoms/AtTitle/index.tsx +77 -0
  63. package/stories/atoms/AtTitle/styles.ts +7 -0
  64. package/stories/atoms/index.ts +14 -0
  65. package/stories/molecules/MlBreadCrumb/MlBreadCrumb.stories.tsx +123 -0
  66. package/stories/molecules/MlBreadCrumb/index.tsx +29 -0
  67. package/stories/molecules/MlCard/MlCard.stories.tsx +55 -0
  68. package/stories/molecules/MlCard/index.tsx +100 -0
  69. package/stories/molecules/MlCard/styles.tsx +22 -0
  70. package/stories/molecules/MlCarousel/MlCarousel.stories.tsx +98 -0
  71. package/stories/molecules/MlCarousel/index.tsx +67 -0
  72. package/stories/molecules/MlDropdown/MlDropdown.stories.tsx +121 -0
  73. package/stories/molecules/MlDropdown/index.tsx +97 -0
  74. package/stories/molecules/MlFormItem/MlFormItem.stories.tsx +33 -0
  75. package/stories/molecules/MlFormItem/index.tsx +100 -0
  76. package/stories/molecules/MlRadioGroup/MlRadioGroup.stories.ts +40 -0
  77. package/stories/molecules/MlRadioGroup/index.tsx +60 -0
  78. package/stories/molecules/index.ts +6 -0
  79. package/stories/organisms/OrAlert/OrAlert.stories.tsx +136 -0
  80. package/stories/organisms/OrAlert/index.tsx +64 -0
  81. package/stories/organisms/OrCol/OrCol.stories.tsx +33 -0
  82. package/stories/organisms/OrCol/index.tsx +108 -0
  83. package/stories/organisms/OrCol/styles.ts +86 -0
  84. package/stories/organisms/OrContent/index.tsx +6 -0
  85. package/stories/organisms/OrCountryCard/OrCountryCard.stories.ts +19 -0
  86. package/stories/organisms/OrCountryCard/index.tsx +55 -0
  87. package/stories/organisms/OrFlagGrid/OrFlagGrid.stories.ts +41 -0
  88. package/stories/organisms/OrFlagGrid/index.tsx +54 -0
  89. package/stories/organisms/OrFrom/index.tsx +10 -0
  90. package/stories/organisms/OrHeader/index.tsx +6 -0
  91. package/stories/organisms/OrLayout/index.tsx +6 -0
  92. package/stories/organisms/OrLoginLayout/OrLoginLayout.stories.tsx +34 -0
  93. package/stories/organisms/OrLoginLayout/index.tsx +63 -0
  94. package/stories/organisms/OrLoginLayout/styles.tsx +16 -0
  95. package/stories/organisms/OrRow/OrRow.stories.tsx +48 -0
  96. package/stories/organisms/OrRow/index.tsx +71 -0
  97. package/stories/organisms/OrRow/styles.ts +24 -0
  98. package/stories/organisms/OrSider/index.tsx +6 -0
  99. package/stories/organisms/OrSimpleBanner/OrSimpleBanner.stories.ts +18 -0
  100. package/stories/organisms/OrSimpleBanner/index.tsx +26 -0
  101. package/stories/organisms/OrSimpleBanner/styles.ts +12 -0
  102. package/stories/organisms/OrSpace/OrSpace.stories.tsx +169 -0
  103. package/stories/organisms/OrSpace/index.tsx +43 -0
  104. package/stories/organisms/OrSpaceCompact/OrSpaceCompact.stories.tsx +94 -0
  105. package/stories/organisms/OrSpaceCompact/index.tsx +35 -0
  106. package/stories/organisms/index.ts +14 -0
  107. package/stories/templates/TmLoginCountry/TmLoginCountry.stories.ts +44 -0
  108. package/stories/templates/TmLoginCountry/index.tsx +64 -0
  109. package/stories/templates/TmLoginCountry/styles.tsx +14 -0
  110. package/stories/templates/TmLoginPhone/TmLoginPhone.stories.tsx +49 -0
  111. package/stories/templates/TmLoginPhone/index.tsx +191 -0
  112. package/stories/templates/TmLoginPhone/styles.tsx +31 -0
  113. package/stories/templates/index.ts +2 -0
  114. package/theme.tsx +56 -0
  115. package/tsconfig.json +38 -0
@@ -0,0 +1,36 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { AtRadio } from '.';
3
+ import { AtText } from '../AtText';
4
+ import React, { useState } from 'react';
5
+
6
+ const meta = {
7
+ title: 'Atoms/AtRadio',
8
+ component: AtRadio,
9
+ tags: ['autodocs'],
10
+ argTypes: {
11
+ value: {
12
+ control: 'text',
13
+ },
14
+ },
15
+ } satisfies Meta<typeof AtRadio>;
16
+
17
+ export default meta;
18
+
19
+ type Story = StoryObj<typeof meta>;
20
+
21
+ export const Basic: Story = {
22
+ args: {
23
+ id: '1',
24
+ value: 'Basic',
25
+ children: <AtText>Basic</AtText>,
26
+ },
27
+ render: () => {
28
+ const [checked, setChecked] = useState(0)
29
+ return (
30
+ <>
31
+ <AtRadio value="Basic 1" checked={checked===1} onChange={()=>setChecked(1)}><AtText>Basic 1</AtText></AtRadio>
32
+ <AtRadio value="Basic 2" checked={checked===2} onChange={()=>setChecked(2)}><AtText>Basic 2</AtText></AtRadio>
33
+ </>
34
+ );
35
+ },
36
+ };
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import { Radio } from 'antd';
3
+ import { RadioChangeEvent } from 'antd/es/radio';
4
+
5
+ export interface AtRadioProps {
6
+ /**
7
+ * The ID for input
8
+ */
9
+ id?: string;
10
+ /**
11
+ * Specifies whether the radio is selected
12
+ */
13
+ checked?: boolean;
14
+ /**
15
+ * Specifies the initial state: whether or not the radio is selected
16
+ */
17
+ defaultChecked?: boolean;
18
+ /**
19
+ * Disable radio
20
+ */
21
+ disabled?: boolean;
22
+ /**
23
+ * According to value for comparison, to determine whether the selected
24
+ */
25
+ value?: any;
26
+ /**
27
+ * Children of the AtRadio
28
+ */
29
+ children?: React.ReactElement;
30
+ /**
31
+ * On select option callback
32
+ */
33
+ onChange?: ((e: RadioChangeEvent) => void) | undefined;
34
+ }
35
+
36
+ export const AtRadio: React.FC<AtRadioProps> = (props) => {
37
+ return <Radio {...props}>{props.children}</Radio>;
38
+ };
39
+
40
+ AtRadio.defaultProps = {
41
+ checked: false,
42
+ defaultChecked: false,
43
+ disabled: false,
44
+ };
@@ -0,0 +1,132 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { AtSelect } from '.';
3
+
4
+ const meta = {
5
+ title: 'Atoms/AtSelect',
6
+ component: AtSelect,
7
+ tags: ['autodocs'],
8
+ argTypes: {
9
+ filterOption: {
10
+ control: 'boolean',
11
+ },
12
+ size: {
13
+ options: ['large', 'middle', 'small', 'none'],
14
+ },
15
+ status: {
16
+ options: ['error', 'warning', 'none'],
17
+ },
18
+ maxTagCount: {
19
+ options: ['responsive', 1, 3, 5],
20
+ },
21
+ mode: {
22
+ options: ['multiple', 'tags'],
23
+ },
24
+ clearIcon: {
25
+ control: 'none',
26
+ },
27
+ notFoundContent: {
28
+ control: 'none',
29
+ },
30
+ menuItemSelectedIcon: {
31
+ control: 'none',
32
+ },
33
+ placeholder: {
34
+ control: 'text',
35
+ },
36
+ popupMatchSelectWidth: {
37
+ control: 'boolean',
38
+ },
39
+ },
40
+ } satisfies Meta<typeof AtSelect>;
41
+
42
+ export default meta;
43
+ type Story = StoryObj<typeof meta>;
44
+
45
+ const options: { value: string; label: string }[] = [];
46
+
47
+ for (let i = 10; i < 15; i++) {
48
+ options.push({
49
+ label: i.toString(36) + i,
50
+ value: i.toString(36) + i,
51
+ });
52
+ }
53
+
54
+ export const Normal: Story = {
55
+ args: {
56
+ placeholder: 'Normal',
57
+ id: '1',
58
+ options,
59
+ },
60
+ };
61
+ export const Disabled: Story = {
62
+ args: {
63
+ placeholder: 'Disabled',
64
+ id: '1',
65
+ disabled: true,
66
+ options,
67
+ },
68
+ };
69
+ export const Loading: Story = {
70
+ args: {
71
+ placeholder: 'Loading',
72
+ id: '1',
73
+ loading: true,
74
+ options,
75
+ },
76
+ };
77
+ export const AllowClear: Story = {
78
+ args: {
79
+ placeholder: 'AllowClear',
80
+ id: '1',
81
+ allowClear: true,
82
+ options,
83
+ },
84
+ };
85
+ export const Multiple: Story = {
86
+ args: {
87
+ placeholder: 'Multiple',
88
+ id: '1',
89
+ mode: 'multiple',
90
+ options,
91
+ },
92
+ };
93
+ export const Large: Story = {
94
+ args: {
95
+ placeholder: 'Large',
96
+ id: '1',
97
+ size: 'large',
98
+ options,
99
+ },
100
+ };
101
+ export const Default: Story = {
102
+ args: {
103
+ placeholder: 'Default',
104
+ id: '1',
105
+ size: 'middle',
106
+ options,
107
+ },
108
+ };
109
+ export const Small: Story = {
110
+ args: {
111
+ placeholder: 'Small',
112
+ id: '1',
113
+ size: 'small',
114
+ options,
115
+ },
116
+ };
117
+ export const Warning: Story = {
118
+ args: {
119
+ placeholder: 'Warning',
120
+ id: '1',
121
+ status: 'warning',
122
+ options,
123
+ },
124
+ };
125
+ export const Error: Story = {
126
+ args: {
127
+ placeholder: 'Error',
128
+ id: '1',
129
+ status: 'error',
130
+ options,
131
+ },
132
+ };
@@ -0,0 +1,229 @@
1
+ import React, {
2
+ CSSProperties,
3
+ JSXElementConstructor,
4
+ ReactElement,
5
+ ReactNode,
6
+ } from 'react';
7
+ import { SelectProps } from 'antd';
8
+ import { DefaultOptionType as Option, LabeledValue } from 'antd/es/select';
9
+ import { StyledAtSelect } from './styles';
10
+
11
+ export interface AtSelectProps {
12
+ /**
13
+ * The ID for input
14
+ */
15
+ id?: string;
16
+ /**
17
+ * Show clear button
18
+ */
19
+ allowClear?: boolean;
20
+ /**
21
+ * Whether the current search will be cleared on selecting an item. Only applies when mode is set to multiple or tags
22
+ */
23
+ autoClearSearchValue?: boolean;
24
+ /**
25
+ * Get focus by default
26
+ */
27
+ autoFocus?: boolean;
28
+ /**
29
+ * Whether has border style
30
+ */
31
+ bordered?: boolean;
32
+ /**
33
+ * The custom clear icon
34
+ */
35
+ clearIcon?: ReactNode;
36
+ /**
37
+ * Whether active first option by default
38
+ */
39
+ defaultActiveFirstOption?: boolean;
40
+ /**
41
+ * Initial selected option
42
+ */
43
+ defaultValue?:
44
+ | string
45
+ | string[]
46
+ | number
47
+ | number[]
48
+ | LabeledValue
49
+ | LabeledValue[];
50
+ /**
51
+ * Whether disabled select
52
+ */
53
+ disabled?: boolean;
54
+ /**
55
+ * Determine whether the popup menu and the select input are the same width. Default set
56
+ * min-width same as input. Will ignore when value less than select width. false
57
+ * will disable virtual scroll
58
+ */
59
+ popupMatchSelectWidth?: boolean | number;
60
+ /**
61
+ * Customize dropdown content
62
+ */
63
+ dropdownRender?: (
64
+ originNode: ReactNode,
65
+ ) => ReactElement<any, string | JSXElementConstructor<any>>;
66
+ /**
67
+ * The style of dropdown menu
68
+ */
69
+ dropdownStyle?: CSSProperties;
70
+ /**
71
+ * Customize node label, value, options,groupLabel field name
72
+ */
73
+ fieldNames?: object;
74
+ /**
75
+ * If true, filter options by input, if function, filter options against it. The function will receive two arguments, inputValue and option, if the function returns true, the option will be included in the filtered set; Otherwise, it will be excluded
76
+ */
77
+ filterOption?: SelectProps['filterOption'];
78
+ /**
79
+ * Sort function for search options sorting, see Array.sort's
80
+ * compareFunction
81
+ */
82
+ filterSort?: (optionA: Option, optionB: Option) => number;
83
+ /**
84
+ * Whether to embed label in value, turn the format of value from string to { value: string,
85
+ * label: ReactNode }
86
+ */
87
+ labelInValue?: boolean;
88
+ /**
89
+ * Config popup height
90
+ */
91
+ listHeight?: number;
92
+ /**
93
+ * Indicate loading state
94
+ */
95
+ loading?: boolean;
96
+ /**
97
+ * Select height
98
+ */
99
+ $height?: string;
100
+ /**
101
+ * Max tag count to show. responsive will cost render performance
102
+ */
103
+ maxTagCount?: number | 'responsive';
104
+ /**
105
+ * The custom menuItemSelected icon with multiple options
106
+ */
107
+ menuItemSelectedIcon?: ReactNode;
108
+ /**
109
+ * Set mode of Select
110
+ */
111
+ mode?: 'multiple' | 'tags';
112
+ /**
113
+ * Specify content to show when no result matches
114
+ */
115
+ notFoundContent?: ReactNode;
116
+ /**
117
+ * Controlled open state of dropdown
118
+ */
119
+ open?: boolean;
120
+ /**
121
+ * Which prop value of option will be used for filter if filterOption is true. If options is
122
+ set, it should be set to label
123
+ */
124
+ optionFilterProp?: string;
125
+ /**
126
+ * Which prop value of option will render as content of select. Example
127
+ */
128
+ optionLabelProp?: string;
129
+ /**
130
+ * Select options. Will get better perf than jsx definition
131
+ */
132
+ options?: SelectProps['options'];
133
+ /**
134
+ * Placeholder of select
135
+ */
136
+ placeholder?: ReactNode;
137
+ /**
138
+ * The current input "search" text
139
+ */
140
+ searchValue?: string;
141
+ /**
142
+ * Whether to show the drop-down arrow
143
+ */
144
+ showArrow?: boolean;
145
+ /**
146
+ * Whether select is searchable
147
+ */
148
+ showSearch?: boolean;
149
+ /**
150
+ * Size of Select input
151
+ */
152
+ size?: 'large' | 'middle' | 'small';
153
+ /**
154
+ * Set validation status
155
+ */
156
+ status?: 'error' | 'warning';
157
+ /**
158
+ * Styles
159
+ */
160
+ style?: React.CSSProperties;
161
+ /**
162
+ * Current selected option (considered as a immutable array)
163
+ */
164
+ value?: string | string[] | number | number[] | LabeledValue | LabeledValue[];
165
+ /**
166
+ * Called when blur
167
+ */
168
+ onBlur?: () => any;
169
+ /**
170
+ * Called when select an option or input value change
171
+ */
172
+ onChange?: (value: any, option: Option | Array<Option>) => any;
173
+ /**
174
+ * Called when clear
175
+ */
176
+ onClear?: () => any;
177
+ /**
178
+ * Called when an option is deselected, param is the selected option's value. Only called for
179
+ * multiple or tags, effective in multiple or tags mode only
180
+ */
181
+ onDeselect?: (value: string | number | LabeledValue) => any;
182
+ /**
183
+ * Called when dropdown open
184
+ */
185
+ onDropdownVisibleChange?: (open: boolean) => any;
186
+ /**
187
+ * Called when focus
188
+ */
189
+ onFocus?: () => any;
190
+ /**
191
+ * Callback function that is fired when input changed
192
+ */
193
+ onSearch?: (value: string) => any;
194
+ /**
195
+ * Called when an option is selected, the params are option's value (or key) and option instance
196
+ */
197
+ onSelect?: (value: string | number | LabeledValue, option: Option) => any;
198
+ /**
199
+ * Select width
200
+ */
201
+ $width?: string;
202
+ children: any;
203
+ }
204
+
205
+ export const AtSelect: React.FC<AtSelectProps> = (props) => {
206
+ return <StyledAtSelect notFoundContent="None" {...props} />;
207
+ };
208
+
209
+ AtSelect.defaultProps = {
210
+ allowClear: false,
211
+ autoClearSearchValue: true,
212
+ autoFocus: false,
213
+ bordered: true,
214
+ defaultActiveFirstOption: true,
215
+ fieldNames: {
216
+ label: 'label',
217
+ value: 'value',
218
+ options: 'options',
219
+ groupLabel: 'label',
220
+ },
221
+ filterOption: true,
222
+ labelInValue: false,
223
+ listHeight: 256,
224
+ loading: false,
225
+ searchValue: '',
226
+ size: 'middle',
227
+ showArrow: true,
228
+ popupMatchSelectWidth: true,
229
+ };
@@ -0,0 +1,8 @@
1
+ import { styled } from 'styled-components';
2
+ import { Select } from 'antd';
3
+ import { AtSelectProps } from '.';
4
+
5
+ export const StyledAtSelect = styled(Select)<AtSelectProps>`
6
+ ${({ $height }) => ($height ? `height: ${$height};` : '')}
7
+ ${({ $width }) => ($width ? `width: ${$width} !important;` : '')}
8
+ `;
@@ -0,0 +1,104 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { AtText } from '.';
3
+
4
+ const meta = {
5
+ title: 'Atoms/AtText',
6
+ component: AtText,
7
+ tags: ['autodocs'],
8
+ argTypes: {
9
+ type: {
10
+ options: ['none', 'secondary', 'success', 'warning', 'danger'],
11
+ },
12
+ editable: {
13
+ control: 'boolean',
14
+ },
15
+ },
16
+ } satisfies Meta<typeof AtText>;
17
+
18
+ export default meta;
19
+ type Story = StoryObj<typeof meta>;
20
+
21
+ export const Basic: Story = {
22
+ args: {
23
+ children: 'Basic',
24
+ },
25
+ };
26
+
27
+ export const Secondary: Story = {
28
+ args: {
29
+ type: 'secondary',
30
+ children: 'Secondary',
31
+ },
32
+ };
33
+
34
+ export const Success: Story = {
35
+ args: {
36
+ type: 'success',
37
+ children: 'Success',
38
+ },
39
+ };
40
+
41
+ export const Warning: Story = {
42
+ args: {
43
+ type: 'warning',
44
+ children: 'Warning',
45
+ },
46
+ };
47
+
48
+ export const Danger: Story = {
49
+ args: {
50
+ type: 'danger',
51
+ children: 'Danger',
52
+ },
53
+ };
54
+
55
+ export const Code: Story = {
56
+ args: {
57
+ code: true,
58
+ children: 'Code',
59
+ },
60
+ };
61
+
62
+ export const Keyboard: Story = {
63
+ args: {
64
+ keyboard: true,
65
+ children: 'Keyboard',
66
+ },
67
+ };
68
+
69
+ export const Copyable: Story = {
70
+ args: {
71
+ copyable: true,
72
+ children: 'Copyable',
73
+ },
74
+ };
75
+
76
+ export const Editable: Story = {
77
+ args: {
78
+ editable: {
79
+ editing: true,
80
+ },
81
+ children: 'Editable',
82
+ },
83
+ };
84
+
85
+ export const Mark: Story = {
86
+ args: {
87
+ mark: true,
88
+ children: 'Mark',
89
+ },
90
+ };
91
+
92
+ export const Italic: Story = {
93
+ args: {
94
+ italic: true,
95
+ children: 'Italic',
96
+ },
97
+ };
98
+
99
+ export const Underline: Story = {
100
+ args: {
101
+ underline: true,
102
+ children: 'Underline',
103
+ },
104
+ };
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import { Typography } from 'antd';
3
+ import { BlockProps } from 'antd/es/typography/Base';
4
+
5
+ export interface AtTextProps {
6
+ /**
7
+ * Content type
8
+ */
9
+ type?: 'secondary' | 'success' | 'warning' | 'danger';
10
+ /**
11
+ * Whether the text is strong or not
12
+ */
13
+ strong?: boolean;
14
+ /**
15
+ * Whether the text is italic or not
16
+ */
17
+ italic?: boolean;
18
+ /**
19
+ * Whether the text is underline or not
20
+ */
21
+ underline?: boolean;
22
+ /**
23
+ * Whether the text is mark or not
24
+ */
25
+ mark?: boolean;
26
+ /**
27
+ * If editable. Can control edit state when is object
28
+ */
29
+ editable?: boolean | BlockProps['editable'];
30
+ /**
31
+ * Whether to be copyable, customize it via setting an object
32
+ */
33
+ copyable?: boolean | BlockProps['copyable'];
34
+ /**
35
+ * Keyboard style
36
+ */
37
+ keyboard?: boolean;
38
+ /**
39
+ * Code style
40
+ */
41
+ code?: boolean;
42
+ /**
43
+ * children
44
+ */
45
+ children?: React.ReactNode;
46
+ /**
47
+ * Color of the text
48
+ */
49
+ color?: 'violet' | 'gold' | 'white';
50
+ }
51
+
52
+ export const AtText: React.FC<AtTextProps> = (props) => {
53
+ return <Typography.Text {...props}>{props.children}</Typography.Text>;
54
+ };
55
+
56
+ AtText.defaultProps = {
57
+ strong: false,
58
+ italic: false,
59
+ underline: false,
60
+ mark: false,
61
+ editable: false,
62
+ copyable: false,
63
+ keyboard: false,
64
+ code: false,
65
+ };
@@ -0,0 +1,40 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { AtTextInput } from '.';
3
+
4
+ const meta = {
5
+ title: 'Atoms/AtTextInput',
6
+ component: AtTextInput,
7
+ tags: ['autodocs'],
8
+ argTypes: {
9
+ status: {
10
+ options: ['none', 'error', 'warning'],
11
+ },
12
+ },
13
+ } satisfies Meta<typeof AtTextInput>;
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
+ };
25
+
26
+ export const Error: Story = {
27
+ args: {
28
+ value: 'Text',
29
+ placeholder: 'Placeholder',
30
+ status: 'error',
31
+ },
32
+ };
33
+
34
+ export const Warning: Story = {
35
+ args: {
36
+ value: 'Text',
37
+ placeholder: 'Placeholder',
38
+ status: 'warning',
39
+ },
40
+ };