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,191 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
AtButton,
|
|
4
|
+
AtLogo,
|
|
5
|
+
AtNumberInput,
|
|
6
|
+
AtSelect,
|
|
7
|
+
AtTitle,
|
|
8
|
+
} from '../../atoms';
|
|
9
|
+
import {
|
|
10
|
+
OrSpaceCompact,
|
|
11
|
+
OrRow,
|
|
12
|
+
OrCol,
|
|
13
|
+
OrLoginLayout,
|
|
14
|
+
OrForm,
|
|
15
|
+
} from '../../organisms';
|
|
16
|
+
import { violet } from '../../../theme';
|
|
17
|
+
import { Select, FormProps } from 'antd';
|
|
18
|
+
import {
|
|
19
|
+
StyledButtonContainer,
|
|
20
|
+
StyledMainContainer,
|
|
21
|
+
StyledTitleContainer,
|
|
22
|
+
} from './styles';
|
|
23
|
+
import { MlFormItem } from '../../molecules';
|
|
24
|
+
|
|
25
|
+
export interface IRegion {
|
|
26
|
+
id: string;
|
|
27
|
+
countryName: string;
|
|
28
|
+
region: string;
|
|
29
|
+
city: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface IFormData {
|
|
33
|
+
region: string;
|
|
34
|
+
phone: {
|
|
35
|
+
dialCode: string;
|
|
36
|
+
phone: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface TmLoginPhoneProps {
|
|
41
|
+
countrySelectOptions?: IRegion[];
|
|
42
|
+
/**
|
|
43
|
+
* Images to show into carousel
|
|
44
|
+
*/
|
|
45
|
+
carouselImages: string[];
|
|
46
|
+
/**
|
|
47
|
+
* Carousel image background source
|
|
48
|
+
*/
|
|
49
|
+
carouselBackgroundSrc?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Welcome title
|
|
52
|
+
*/
|
|
53
|
+
title?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Highlighted text into title
|
|
56
|
+
*/
|
|
57
|
+
highlightedTitle?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Submit button text
|
|
60
|
+
*/
|
|
61
|
+
buttonText: string;
|
|
62
|
+
/**
|
|
63
|
+
* Form init values
|
|
64
|
+
*/
|
|
65
|
+
initialValues?: IFormData;
|
|
66
|
+
/**
|
|
67
|
+
* Dial codes available
|
|
68
|
+
*/
|
|
69
|
+
dialCodes: string[];
|
|
70
|
+
/**
|
|
71
|
+
* Phone regex validation
|
|
72
|
+
*/
|
|
73
|
+
phoneRegex?: RegExp;
|
|
74
|
+
/**
|
|
75
|
+
* Phone validation message
|
|
76
|
+
*/
|
|
77
|
+
phoneValidationMessage?: string;
|
|
78
|
+
/**
|
|
79
|
+
* On submit function
|
|
80
|
+
*/
|
|
81
|
+
onFinish?: FormProps['onFinish'];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const TmLoginPhone: React.FC<TmLoginPhoneProps> = ({
|
|
85
|
+
countrySelectOptions,
|
|
86
|
+
carouselImages,
|
|
87
|
+
carouselBackgroundSrc,
|
|
88
|
+
title,
|
|
89
|
+
highlightedTitle,
|
|
90
|
+
buttonText,
|
|
91
|
+
initialValues,
|
|
92
|
+
dialCodes,
|
|
93
|
+
phoneRegex,
|
|
94
|
+
phoneValidationMessage,
|
|
95
|
+
onFinish,
|
|
96
|
+
}) => {
|
|
97
|
+
return (
|
|
98
|
+
<OrLoginLayout
|
|
99
|
+
carouselImages={carouselImages}
|
|
100
|
+
$carouselBackgroundSrc={carouselBackgroundSrc}
|
|
101
|
+
>
|
|
102
|
+
<OrForm
|
|
103
|
+
style={{ height: '100%' }}
|
|
104
|
+
initialValues={initialValues}
|
|
105
|
+
onFinish={onFinish}
|
|
106
|
+
>
|
|
107
|
+
<OrRow
|
|
108
|
+
gutter={[0, 20]}
|
|
109
|
+
justify={{ xs: 'center', sm: 'center', lg: 'space-between' }}
|
|
110
|
+
align={'middle'}
|
|
111
|
+
>
|
|
112
|
+
<OrCol>
|
|
113
|
+
<AtLogo color="violet" />
|
|
114
|
+
</OrCol>
|
|
115
|
+
<OrCol>
|
|
116
|
+
<MlFormItem name="region" noStyle>
|
|
117
|
+
<AtSelect size="large">
|
|
118
|
+
{countrySelectOptions?.map((elem) => (
|
|
119
|
+
<Select.Option
|
|
120
|
+
key={elem.id}
|
|
121
|
+
label={elem.countryName}
|
|
122
|
+
value={elem.region}
|
|
123
|
+
>
|
|
124
|
+
{elem.countryName}
|
|
125
|
+
</Select.Option>
|
|
126
|
+
))}
|
|
127
|
+
</AtSelect>
|
|
128
|
+
</MlFormItem>
|
|
129
|
+
</OrCol>
|
|
130
|
+
</OrRow>
|
|
131
|
+
<StyledMainContainer>
|
|
132
|
+
<OrCol $justify={'center'}>
|
|
133
|
+
<StyledTitleContainer>
|
|
134
|
+
<AtTitle>
|
|
135
|
+
{title}{' '}
|
|
136
|
+
<span style={{ color: violet[5] }}>{highlightedTitle}</span>
|
|
137
|
+
</AtTitle>
|
|
138
|
+
</StyledTitleContainer>
|
|
139
|
+
<MlFormItem>
|
|
140
|
+
<OrSpaceCompact block>
|
|
141
|
+
<MlFormItem
|
|
142
|
+
noStyle
|
|
143
|
+
name={['phone', 'dialCode']}
|
|
144
|
+
rules={[{ required: true, message: 'Field is required!!' }]}
|
|
145
|
+
>
|
|
146
|
+
<AtSelect $width="119px" size="large">
|
|
147
|
+
{dialCodes?.map((elem) => (
|
|
148
|
+
<Select.Option key={elem} label={elem} value={elem}>
|
|
149
|
+
{elem}
|
|
150
|
+
</Select.Option>
|
|
151
|
+
))}
|
|
152
|
+
</AtSelect>
|
|
153
|
+
</MlFormItem>
|
|
154
|
+
<MlFormItem
|
|
155
|
+
noStyle
|
|
156
|
+
name={['phone', 'phone']}
|
|
157
|
+
rules={[
|
|
158
|
+
{ required: true, message: 'Field is required' },
|
|
159
|
+
{ pattern: phoneRegex, message: phoneValidationMessage },
|
|
160
|
+
]}
|
|
161
|
+
>
|
|
162
|
+
<AtNumberInput $width="100%" size="large" controls={false} />
|
|
163
|
+
</MlFormItem>
|
|
164
|
+
</OrSpaceCompact>
|
|
165
|
+
</MlFormItem>
|
|
166
|
+
<StyledButtonContainer>
|
|
167
|
+
<MlFormItem noStyle>
|
|
168
|
+
<AtButton
|
|
169
|
+
block
|
|
170
|
+
type="primary"
|
|
171
|
+
size="large"
|
|
172
|
+
value={buttonText}
|
|
173
|
+
htmlType="submit"
|
|
174
|
+
/>
|
|
175
|
+
</MlFormItem>
|
|
176
|
+
</StyledButtonContainer>
|
|
177
|
+
</OrCol>
|
|
178
|
+
</StyledMainContainer>
|
|
179
|
+
</OrForm>
|
|
180
|
+
</OrLoginLayout>
|
|
181
|
+
);
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
TmLoginPhone.defaultProps = {
|
|
185
|
+
countrySelectOptions: [],
|
|
186
|
+
carouselImages: [],
|
|
187
|
+
phoneRegex: new RegExp(
|
|
188
|
+
/^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/im,
|
|
189
|
+
),
|
|
190
|
+
phoneValidationMessage: 'This field must be a phone',
|
|
191
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import { styled } from 'styled-components';
|
|
3
|
+
import { gray } from '../../../theme';
|
|
4
|
+
|
|
5
|
+
export const StyledContainer = styled.div`
|
|
6
|
+
& {
|
|
7
|
+
display: flex;
|
|
8
|
+
background-color: ${gray[1]};
|
|
9
|
+
height: 100vh;
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
export const StyledMainContainer = styled.div`
|
|
14
|
+
max-width: 365px;
|
|
15
|
+
margin-right: auto;
|
|
16
|
+
margin-left: auto;
|
|
17
|
+
height: 100%;
|
|
18
|
+
display: flex;
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
export const StyledTitleContainer = styled.div`
|
|
22
|
+
margin-bottom: 45px;
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
export const StyledButtonContainer = styled.div`
|
|
26
|
+
margin-top: 5px;
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
export const StyledCarouselImageContainer = styled.div`
|
|
30
|
+
text-align: center;
|
|
31
|
+
`;
|
package/theme.tsx
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { ConfigProvider } from 'antd';
|
|
3
|
+
import { generate } from '@ant-design/colors';
|
|
4
|
+
import { PRIMARY_COLOR } from './constants';
|
|
5
|
+
import '@fontsource/ibm-plex-sans/500.css';
|
|
6
|
+
import '@fontsource/ibm-plex-sans/700.css';
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const violet = generate(PRIMARY_COLOR);
|
|
13
|
+
export const gray = [
|
|
14
|
+
'#ffffff',
|
|
15
|
+
'#fafafa',
|
|
16
|
+
'#f5f5f5',
|
|
17
|
+
'#f0f0f0',
|
|
18
|
+
'#d9d9d9',
|
|
19
|
+
'#bfbfbf',
|
|
20
|
+
'#8c8c8c',
|
|
21
|
+
'#595959',
|
|
22
|
+
'#434343',
|
|
23
|
+
'#262626',
|
|
24
|
+
'#1f1f1f',
|
|
25
|
+
'#141414 ',
|
|
26
|
+
'#000000',
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
export const WaWaThemeProvider: React.FC<Props> = ({ children }) => {
|
|
30
|
+
const violetColor = useMemo(() => violet, [violet]);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<>
|
|
34
|
+
<ConfigProvider
|
|
35
|
+
theme={{
|
|
36
|
+
token: {
|
|
37
|
+
fontFamily: 'IBM Plex sans',
|
|
38
|
+
colorPrimary: violetColor[5],
|
|
39
|
+
colorLink: violet[5],
|
|
40
|
+
colorLinkHover: violet[6],
|
|
41
|
+
colorLinkActive: violet[5],
|
|
42
|
+
},
|
|
43
|
+
components: {
|
|
44
|
+
Select: {
|
|
45
|
+
colorBgContainer: gray[2],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
{children}
|
|
51
|
+
</ConfigProvider>
|
|
52
|
+
</>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default WaWaThemeProvider;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es5",
|
|
4
|
+
"outDir": "dist",
|
|
5
|
+
"lib": [
|
|
6
|
+
"dom",
|
|
7
|
+
"dom.iterable",
|
|
8
|
+
"esnext"
|
|
9
|
+
],
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"declarationDir": "lib",
|
|
12
|
+
"allowJs": false,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"esModuleInterop": true,
|
|
15
|
+
"allowSyntheticDefaultImports": true,
|
|
16
|
+
"strict": true,
|
|
17
|
+
"forceConsistentCasingInFileNames": true,
|
|
18
|
+
"module": "esnext",
|
|
19
|
+
"moduleResolution": "node",
|
|
20
|
+
"resolveJsonModule": true,
|
|
21
|
+
"isolatedModules": true,
|
|
22
|
+
"noEmit": false,
|
|
23
|
+
"jsx": "react",
|
|
24
|
+
},
|
|
25
|
+
"include": [
|
|
26
|
+
"src/**/*",
|
|
27
|
+
"index.ts",
|
|
28
|
+
"rollup.config.mjs",
|
|
29
|
+
"theme.tsx"
|
|
30
|
+
],
|
|
31
|
+
"exclude": [
|
|
32
|
+
"node_modules",
|
|
33
|
+
"lib"
|
|
34
|
+
],
|
|
35
|
+
"files": [
|
|
36
|
+
"placeholder.ts"
|
|
37
|
+
],
|
|
38
|
+
}
|