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,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
+ `;
@@ -0,0 +1,2 @@
1
+ export * from './TmLoginCountry';
2
+ export * from './TmLoginPhone';
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
+ }