@egov3/system-design 1.0.17 → 1.0.22

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 (39) hide show
  1. package/.github/workflows/publish.yml +4 -2
  2. package/__tests__/components/InputField.test.tsx +101 -101
  3. package/dist/index.d.ts +6 -2
  4. package/dist/index.js +2 -2
  5. package/dist/tsconfig.tsbuildinfo +1 -0
  6. package/index.tsx +4 -3
  7. package/jest.config.ts +45 -45
  8. package/jest.setup.ts +2 -2
  9. package/package.json +90 -90
  10. package/public/img/Circled-1.svg +11 -11
  11. package/public/img/Circled-2.svg +11 -11
  12. package/public/img/Circled-3.svg +11 -11
  13. package/public/img/Mobile-chat.svg +11 -11
  14. package/public/img/accessibility-1.svg +3 -3
  15. package/public/img/account-1.svg +3 -3
  16. package/public/img/car.svg +3 -3
  17. package/public/img/language-1.svg +5 -5
  18. package/public/img/logo.svg +7 -7
  19. package/src/components/InputField/InputField.module.scss +57 -57
  20. package/src/components/InputField/index.tsx +108 -108
  21. package/src/components/index.tsx +3 -3
  22. package/src/stories/CardWrapperItem.tsx +29 -29
  23. package/src/stories/Configure.tsx +494 -494
  24. package/src/stories/assets/accessibility.svg +4 -4
  25. package/src/stories/assets/discord.svg +15 -15
  26. package/src/stories/assets/github.svg +3 -3
  27. package/src/stories/assets/tutorials.svg +12 -12
  28. package/src/stories/assets/youtube.svg +4 -4
  29. package/src/stories/components/Button.stories.tsx +127 -127
  30. package/src/styles/colors.module.scss +42 -42
  31. package/src/styles/globals.scss +43 -43
  32. package/src/styles/structure.module.scss +60 -60
  33. package/src/styles/typography.module.scss +120 -120
  34. package/src/svg/ClearIcon.tsx +26 -26
  35. package/src/svg/index.tsx +3 -3
  36. package/src/utils/ClassNamesFn.tsx +2 -2
  37. package/tsconfig.json +38 -38
  38. package/.storybook/main.ts +0 -21
  39. 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
+ };
@@ -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
+ );