@egov3/system-design 1.0.16 → 1.0.21
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/.github/workflows/publish.yml +4 -2
- package/__tests__/components/InputField.test.tsx +101 -101
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/jest.config.d.ts +3 -0
- package/dist/jest.config.js +46 -0
- package/dist/jest.setup.d.ts +1 -0
- package/dist/jest.setup.js +4 -0
- package/dist/src/app/page.d.ts +0 -0
- package/dist/src/app/page.js +1 -0
- package/dist/src/components/InputField/index.d.ts +19 -0
- package/dist/src/components/InputField/index.js +37 -0
- package/dist/src/components/index.d.ts +3 -0
- package/dist/src/components/index.js +5 -0
- package/dist/src/svg/ClearIcon.d.ts +4 -0
- package/dist/src/svg/ClearIcon.js +8 -0
- package/dist/src/svg/index.d.ts +2 -0
- package/dist/src/svg/index.js +5 -0
- package/dist/src/utils/ClassNamesFn.d.ts +1 -0
- package/dist/src/utils/ClassNamesFn.js +5 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/index.tsx +3 -3
- package/jest.config.ts +45 -45
- package/jest.setup.ts +2 -2
- package/package.json +90 -90
- package/public/img/Circled-1.svg +11 -11
- package/public/img/Circled-2.svg +11 -11
- package/public/img/Circled-3.svg +11 -11
- package/public/img/Mobile-chat.svg +11 -11
- package/public/img/accessibility-1.svg +3 -3
- package/public/img/account-1.svg +3 -3
- package/public/img/car.svg +3 -3
- package/public/img/language-1.svg +5 -5
- package/public/img/logo.svg +7 -7
- package/src/components/InputField/InputField.module.scss +57 -57
- package/src/components/InputField/index.tsx +108 -108
- package/src/components/index.tsx +3 -3
- package/src/stories/CardWrapperItem.tsx +29 -29
- package/src/stories/Configure.tsx +494 -494
- package/src/stories/assets/accessibility.svg +4 -4
- package/src/stories/assets/discord.svg +15 -15
- package/src/stories/assets/github.svg +3 -3
- package/src/stories/assets/tutorials.svg +12 -12
- package/src/stories/assets/youtube.svg +4 -4
- package/src/stories/components/Button.stories.tsx +127 -127
- package/src/styles/colors.module.scss +42 -42
- package/src/styles/globals.scss +43 -43
- package/src/styles/structure.module.scss +60 -60
- package/src/styles/typography.module.scss +120 -120
- package/src/svg/ClearIcon.tsx +26 -26
- package/src/svg/index.tsx +3 -3
- package/src/utils/ClassNamesFn.tsx +2 -2
- package/tsconfig.json +38 -38
- package/.storybook/main.ts +0 -21
- package/.storybook/preview.ts +0 -24
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import React, { HTMLInputTypeAttribute, useState } from "react";
|
|
4
|
-
|
|
5
|
-
import { ClassNamesFn } from "~utils/ClassNamesFn";
|
|
6
|
-
|
|
7
|
-
import styles from "./InputField.module.scss";
|
|
8
|
-
import { ClearIcon } from "~svg";
|
|
9
|
-
|
|
10
|
-
export type TOtpType = "OTP" | "TEXT";
|
|
11
|
-
|
|
12
|
-
export interface IInputFieldProps {
|
|
13
|
-
onFocus?: () => void;
|
|
14
|
-
onBlur?: () => void;
|
|
15
|
-
onEnterPress?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
16
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
17
|
-
value?: string;
|
|
18
|
-
placeholder?: string;
|
|
19
|
-
className?: string;
|
|
20
|
-
style?: React.CSSProperties;
|
|
21
|
-
isClearable?: boolean;
|
|
22
|
-
inputLeftIcon?: JSX.Element;
|
|
23
|
-
type?: HTMLInputTypeAttribute;
|
|
24
|
-
id: string;
|
|
25
|
-
labelText?: string;
|
|
26
|
-
ariaLabel: string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const InputField = ({
|
|
30
|
-
onFocus,
|
|
31
|
-
onBlur,
|
|
32
|
-
onChange,
|
|
33
|
-
onEnterPress,
|
|
34
|
-
value = "",
|
|
35
|
-
inputLeftIcon,
|
|
36
|
-
placeholder = "",
|
|
37
|
-
className = "",
|
|
38
|
-
style,
|
|
39
|
-
isClearable = false,
|
|
40
|
-
type = "text",
|
|
41
|
-
id,
|
|
42
|
-
labelText = "",
|
|
43
|
-
ariaLabel = "",
|
|
44
|
-
}: IInputFieldProps): React.ReactNode => {
|
|
45
|
-
const [focused, setFocused] = useState<boolean>(false);
|
|
46
|
-
return (
|
|
47
|
-
<div
|
|
48
|
-
data-testid="InputField_MAIN"
|
|
49
|
-
className={ClassNamesFn(
|
|
50
|
-
styles[labelText.length ? "inputContainerLabeled" : "inputContainer"],
|
|
51
|
-
className,
|
|
52
|
-
focused ? styles[`input--onfocus`] : undefined,
|
|
53
|
-
styles[`input-${type?.toLocaleLowerCase()}`]
|
|
54
|
-
)}
|
|
55
|
-
style={style}
|
|
56
|
-
>
|
|
57
|
-
{labelText.length > 0 && (
|
|
58
|
-
<label htmlFor={id} data-testid="InputField_LABEL">
|
|
59
|
-
{labelText}
|
|
60
|
-
</label>
|
|
61
|
-
)}
|
|
62
|
-
{inputLeftIcon}
|
|
63
|
-
<input
|
|
64
|
-
data-testid="InputField_INPUT"
|
|
65
|
-
aria-label={ariaLabel}
|
|
66
|
-
id={id}
|
|
67
|
-
type={type}
|
|
68
|
-
className={styles.input}
|
|
69
|
-
placeholder={placeholder}
|
|
70
|
-
aria-placeholder={placeholder}
|
|
71
|
-
onFocus={() => {
|
|
72
|
-
setFocused(true);
|
|
73
|
-
if (onFocus) {
|
|
74
|
-
onFocus();
|
|
75
|
-
}
|
|
76
|
-
}}
|
|
77
|
-
onBlur={() => {
|
|
78
|
-
setFocused(false);
|
|
79
|
-
if (onBlur) {
|
|
80
|
-
onBlur();
|
|
81
|
-
}
|
|
82
|
-
}}
|
|
83
|
-
onChange={onChange}
|
|
84
|
-
onKeyDown={(event: React.KeyboardEvent<HTMLInputElement>) => {
|
|
85
|
-
if (onEnterPress && event.key === "Enter") {
|
|
86
|
-
onEnterPress(event);
|
|
87
|
-
}
|
|
88
|
-
}}
|
|
89
|
-
value={value}
|
|
90
|
-
readOnly={!onChange}
|
|
91
|
-
/>
|
|
92
|
-
{isClearable && value && (
|
|
93
|
-
<ClearIcon
|
|
94
|
-
fill="red"
|
|
95
|
-
pathFill="#758393"
|
|
96
|
-
className={styles.clearIcon}
|
|
97
|
-
onClick={() => {
|
|
98
|
-
if (onChange) {
|
|
99
|
-
onChange({
|
|
100
|
-
target: { value: "" },
|
|
101
|
-
} as React.ChangeEvent<HTMLInputElement>);
|
|
102
|
-
}
|
|
103
|
-
}}
|
|
104
|
-
/>
|
|
105
|
-
)}
|
|
106
|
-
</div>
|
|
107
|
-
);
|
|
108
|
-
};
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React, { HTMLInputTypeAttribute, useState } from "react";
|
|
4
|
+
|
|
5
|
+
import { ClassNamesFn } from "~utils/ClassNamesFn";
|
|
6
|
+
|
|
7
|
+
import styles from "./InputField.module.scss";
|
|
8
|
+
import { ClearIcon } from "~svg";
|
|
9
|
+
|
|
10
|
+
export type TOtpType = "OTP" | "TEXT";
|
|
11
|
+
|
|
12
|
+
export interface IInputFieldProps {
|
|
13
|
+
onFocus?: () => void;
|
|
14
|
+
onBlur?: () => void;
|
|
15
|
+
onEnterPress?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
16
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
17
|
+
value?: string;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
className?: string;
|
|
20
|
+
style?: React.CSSProperties;
|
|
21
|
+
isClearable?: boolean;
|
|
22
|
+
inputLeftIcon?: JSX.Element;
|
|
23
|
+
type?: HTMLInputTypeAttribute;
|
|
24
|
+
id: string;
|
|
25
|
+
labelText?: string;
|
|
26
|
+
ariaLabel: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const InputField = ({
|
|
30
|
+
onFocus,
|
|
31
|
+
onBlur,
|
|
32
|
+
onChange,
|
|
33
|
+
onEnterPress,
|
|
34
|
+
value = "",
|
|
35
|
+
inputLeftIcon,
|
|
36
|
+
placeholder = "",
|
|
37
|
+
className = "",
|
|
38
|
+
style,
|
|
39
|
+
isClearable = false,
|
|
40
|
+
type = "text",
|
|
41
|
+
id,
|
|
42
|
+
labelText = "",
|
|
43
|
+
ariaLabel = "",
|
|
44
|
+
}: IInputFieldProps): React.ReactNode => {
|
|
45
|
+
const [focused, setFocused] = useState<boolean>(false);
|
|
46
|
+
return (
|
|
47
|
+
<div
|
|
48
|
+
data-testid="InputField_MAIN"
|
|
49
|
+
className={ClassNamesFn(
|
|
50
|
+
styles[labelText.length ? "inputContainerLabeled" : "inputContainer"],
|
|
51
|
+
className,
|
|
52
|
+
focused ? styles[`input--onfocus`] : undefined,
|
|
53
|
+
styles[`input-${type?.toLocaleLowerCase()}`]
|
|
54
|
+
)}
|
|
55
|
+
style={style}
|
|
56
|
+
>
|
|
57
|
+
{labelText.length > 0 && (
|
|
58
|
+
<label htmlFor={id} data-testid="InputField_LABEL">
|
|
59
|
+
{labelText}
|
|
60
|
+
</label>
|
|
61
|
+
)}
|
|
62
|
+
{inputLeftIcon}
|
|
63
|
+
<input
|
|
64
|
+
data-testid="InputField_INPUT"
|
|
65
|
+
aria-label={ariaLabel}
|
|
66
|
+
id={id}
|
|
67
|
+
type={type}
|
|
68
|
+
className={styles.input}
|
|
69
|
+
placeholder={placeholder}
|
|
70
|
+
aria-placeholder={placeholder}
|
|
71
|
+
onFocus={() => {
|
|
72
|
+
setFocused(true);
|
|
73
|
+
if (onFocus) {
|
|
74
|
+
onFocus();
|
|
75
|
+
}
|
|
76
|
+
}}
|
|
77
|
+
onBlur={() => {
|
|
78
|
+
setFocused(false);
|
|
79
|
+
if (onBlur) {
|
|
80
|
+
onBlur();
|
|
81
|
+
}
|
|
82
|
+
}}
|
|
83
|
+
onChange={onChange}
|
|
84
|
+
onKeyDown={(event: React.KeyboardEvent<HTMLInputElement>) => {
|
|
85
|
+
if (onEnterPress && event.key === "Enter") {
|
|
86
|
+
onEnterPress(event);
|
|
87
|
+
}
|
|
88
|
+
}}
|
|
89
|
+
value={value}
|
|
90
|
+
readOnly={!onChange}
|
|
91
|
+
/>
|
|
92
|
+
{isClearable && value && (
|
|
93
|
+
<ClearIcon
|
|
94
|
+
fill="red"
|
|
95
|
+
pathFill="#758393"
|
|
96
|
+
className={styles.clearIcon}
|
|
97
|
+
onClick={() => {
|
|
98
|
+
if (onChange) {
|
|
99
|
+
onChange({
|
|
100
|
+
target: { value: "" },
|
|
101
|
+
} as React.ChangeEvent<HTMLInputElement>);
|
|
102
|
+
}
|
|
103
|
+
}}
|
|
104
|
+
/>
|
|
105
|
+
)}
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
};
|
package/src/components/index.tsx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { InputField } from "./InputField";
|
|
2
|
-
|
|
3
|
-
export const Components = { InputField };
|
|
1
|
+
import { InputField } from "./InputField";
|
|
2
|
+
|
|
3
|
+
export const Components = { InputField };
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export const CardWrapperItem = ({
|
|
4
|
-
children,
|
|
5
|
-
}: {
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
}) => (
|
|
8
|
-
<div
|
|
9
|
-
style={{
|
|
10
|
-
display: 'flex',
|
|
11
|
-
justifyContent: 'center',
|
|
12
|
-
minHeight: '100px',
|
|
13
|
-
}}
|
|
14
|
-
>
|
|
15
|
-
<div
|
|
16
|
-
style={{
|
|
17
|
-
backgroundColor: 'bisque',
|
|
18
|
-
padding: '9px',
|
|
19
|
-
display: 'flex',
|
|
20
|
-
width: '80%',
|
|
21
|
-
flexDirection: 'column',
|
|
22
|
-
borderRadius: '20px',
|
|
23
|
-
justifyContent: 'center',
|
|
24
|
-
}}
|
|
25
|
-
>
|
|
26
|
-
{children}
|
|
27
|
-
</div>
|
|
28
|
-
</div>
|
|
29
|
-
);
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export const CardWrapperItem = ({
|
|
4
|
+
children,
|
|
5
|
+
}: {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}) => (
|
|
8
|
+
<div
|
|
9
|
+
style={{
|
|
10
|
+
display: 'flex',
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
minHeight: '100px',
|
|
13
|
+
}}
|
|
14
|
+
>
|
|
15
|
+
<div
|
|
16
|
+
style={{
|
|
17
|
+
backgroundColor: 'bisque',
|
|
18
|
+
padding: '9px',
|
|
19
|
+
display: 'flex',
|
|
20
|
+
width: '80%',
|
|
21
|
+
flexDirection: 'column',
|
|
22
|
+
borderRadius: '20px',
|
|
23
|
+
justifyContent: 'center',
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
{children}
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
);
|