@egov3/system-design 1.0.16 → 1.0.17

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.
@@ -0,0 +1,2 @@
1
+ import { Components } from "./src/components";
2
+ export { Components };
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Components = void 0;
4
+ const components_1 = require("./src/components");
5
+ Object.defineProperty(exports, "Components", { enumerable: true, get: function () { return components_1.Components; } });
@@ -0,0 +1,3 @@
1
+ import type { Config } from '@jest/types';
2
+ declare const _default: () => Promise<Config.InitialProjectOptions>;
3
+ export default _default;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jest_1 = __importDefault(require("next/jest"));
7
+ const createJestConfig = (0, jest_1.default)({
8
+ dir: './'
9
+ });
10
+ const customJestConfig = {
11
+ collectCoverage: true,
12
+ collectCoverageFrom: [
13
+ 'src/**/*.tsx'
14
+ ],
15
+ coveragePathIgnorePatterns: [
16
+ '<rootDir>/src/store',
17
+ '<rootDir>/src/stories',
18
+ ],
19
+ testMatch: ['**/*.test.tsx'],
20
+ setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
21
+ testEnvironment: 'jsdom',
22
+ moduleNameMapper: {
23
+ '@/(.*)': '<rootDir>/$1',
24
+ '~constants/(.*)': '<rootDir>/src/constants/$1',
25
+ '~customHooks/(.*)': '<rootDir>/src/customHooks/$1',
26
+ '~customMock/(.*)': '<rootDir>/__tests__/customMock/$1',
27
+ '~components': '<rootDir>/src/components/index.tsx',
28
+ '~module': '<rootDir>/src/components/index.tsx',
29
+ '~svg': '<rootDir>/src/svg/index.tsx',
30
+ '~templates': '<rootDir>/src/templates/index.tsx',
31
+ '~utils/(.*)': '<rootDir>/src/utils/$1'
32
+ },
33
+ coverageThreshold: {
34
+ global: {
35
+ branches: 40,
36
+ functions: 40,
37
+ lines: 40,
38
+ statements: 40
39
+ }
40
+ },
41
+ transform: {
42
+ '^.+\\.(ts|tsx)$': 'ts-jest',
43
+ },
44
+ transformIgnorePatterns: ['/node_modules/'],
45
+ };
46
+ exports.default = createJestConfig(customJestConfig);
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // Learn more: https://github.com/testing-library/jest-dom
4
+ require("@testing-library/jest-dom");
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,19 @@
1
+ import React, { HTMLInputTypeAttribute } from "react";
2
+ export type TOtpType = "OTP" | "TEXT";
3
+ export interface IInputFieldProps {
4
+ onFocus?: () => void;
5
+ onBlur?: () => void;
6
+ onEnterPress?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
7
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
8
+ value?: string;
9
+ placeholder?: string;
10
+ className?: string;
11
+ style?: React.CSSProperties;
12
+ isClearable?: boolean;
13
+ inputLeftIcon?: JSX.Element;
14
+ type?: HTMLInputTypeAttribute;
15
+ id: string;
16
+ labelText?: string;
17
+ ariaLabel: string;
18
+ }
19
+ export declare const InputField: ({ onFocus, onBlur, onChange, onEnterPress, value, inputLeftIcon, placeholder, className, style, isClearable, type, id, labelText, ariaLabel, }: IInputFieldProps) => React.ReactNode;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.InputField = void 0;
8
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const react_1 = require("react");
10
+ const ClassNamesFn_1 = require("~utils/ClassNamesFn");
11
+ const InputField_module_scss_1 = __importDefault(require("./InputField.module.scss"));
12
+ const _svg_1 = require("~svg");
13
+ const InputField = ({ onFocus, onBlur, onChange, onEnterPress, value = "", inputLeftIcon, placeholder = "", className = "", style, isClearable = false, type = "text", id, labelText = "", ariaLabel = "", }) => {
14
+ const [focused, setFocused] = (0, react_1.useState)(false);
15
+ return ((0, jsx_runtime_1.jsxs)("div", { "data-testid": "InputField_MAIN", className: (0, ClassNamesFn_1.ClassNamesFn)(InputField_module_scss_1.default[labelText.length ? "inputContainerLabeled" : "inputContainer"], className, focused ? InputField_module_scss_1.default[`input--onfocus`] : undefined, InputField_module_scss_1.default[`input-${type === null || type === void 0 ? void 0 : type.toLocaleLowerCase()}`]), style: style, children: [labelText.length > 0 && ((0, jsx_runtime_1.jsx)("label", { htmlFor: id, "data-testid": "InputField_LABEL", children: labelText })), inputLeftIcon, (0, jsx_runtime_1.jsx)("input", { "data-testid": "InputField_INPUT", "aria-label": ariaLabel, id: id, type: type, className: InputField_module_scss_1.default.input, placeholder: placeholder, "aria-placeholder": placeholder, onFocus: () => {
16
+ setFocused(true);
17
+ if (onFocus) {
18
+ onFocus();
19
+ }
20
+ }, onBlur: () => {
21
+ setFocused(false);
22
+ if (onBlur) {
23
+ onBlur();
24
+ }
25
+ }, onChange: onChange, onKeyDown: (event) => {
26
+ if (onEnterPress && event.key === "Enter") {
27
+ onEnterPress(event);
28
+ }
29
+ }, value: value, readOnly: !onChange }), isClearable && value && ((0, jsx_runtime_1.jsx)(_svg_1.ClearIcon, { fill: "red", pathFill: "#758393", className: InputField_module_scss_1.default.clearIcon, onClick: () => {
30
+ if (onChange) {
31
+ onChange({
32
+ target: { value: "" },
33
+ });
34
+ }
35
+ } }))] }));
36
+ };
37
+ exports.InputField = InputField;
@@ -0,0 +1,3 @@
1
+ export declare const Components: {
2
+ InputField: ({ onFocus, onBlur, onChange, onEnterPress, value, inputLeftIcon, placeholder, className, style, isClearable, type, id, labelText, ariaLabel, }: import("./InputField").IInputFieldProps) => React.ReactNode;
3
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Components = void 0;
4
+ const InputField_1 = require("./InputField");
5
+ exports.Components = { InputField: InputField_1.InputField };
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ export declare const ClearIcon: ({ width, height, fill, pathFill, }: React.SVGProps<SVGSVGElement> & {
3
+ pathFill?: string;
4
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClearIcon = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const ClearIcon = ({ width = 20, height = 20, fill = "none", pathFill = "#fff", }) => {
6
+ return ((0, jsx_runtime_1.jsx)("svg", { "data-testid": "Icons_CLEAR", xmlns: "http://www.w3.org/2000/svg", width: width, height: height, fill: fill, viewBox: "0 0 20 20", children: (0, jsx_runtime_1.jsx)("path", { fill: pathFill, fillRule: "evenodd", d: "M10 18.333a8.333 8.333 0 100-16.666 8.333 8.333 0 000 16.666zM7.5 6.027L6.027 7.5l2.5 2.5-2.5 2.5L7.5 13.973l2.5-2.5 2.5 2.5 1.473-1.473-2.5-2.5 2.5-2.5L12.5 6.027l-2.5 2.5-2.5-2.5z", clipRule: "evenodd" }) }));
7
+ };
8
+ exports.ClearIcon = ClearIcon;
@@ -0,0 +1,2 @@
1
+ import { ClearIcon } from "./ClearIcon";
2
+ export { ClearIcon };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClearIcon = void 0;
4
+ const ClearIcon_1 = require("./ClearIcon");
5
+ Object.defineProperty(exports, "ClearIcon", { enumerable: true, get: function () { return ClearIcon_1.ClearIcon; } });
@@ -0,0 +1 @@
1
+ export declare const ClassNamesFn: (...args: unknown[]) => string;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClassNamesFn = void 0;
4
+ const ClassNamesFn = (...args) => args.filter((item) => !!item).join(" ");
5
+ exports.ClassNamesFn = ClassNamesFn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@egov3/system-design",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",