@egov3/system-design 1.0.38 → 1.0.41
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/README.md +10 -0
- package/dist/cjs/components/InputField/index.d.ts +3 -2
- package/dist/cjs/components/index.d.ts +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +31 -28
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/stories/CardWrapperItem.d.ts +1 -1
- package/dist/cjs/stories/InputField.stories.d.ts +2 -1
- package/dist/cjs/utils/CreateArray.d.ts +1 -0
- package/dist/cjs/utils/string/SetCharAt.d.ts +1 -0
- package/dist/esm/components/InputField/index.d.ts +3 -2
- package/dist/esm/components/index.d.ts +1 -1
- package/dist/esm/index.d.ts +3 -2
- package/dist/esm/index.js +31 -28
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/stories/CardWrapperItem.d.ts +1 -1
- package/dist/esm/stories/InputField.stories.d.ts +2 -1
- package/dist/esm/utils/CreateArray.d.ts +1 -0
- package/dist/esm/utils/string/SetCharAt.d.ts +1 -0
- package/package.json +11 -12
|
@@ -2,7 +2,7 @@ import type { StoryObj } from "@storybook/react";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
|
-
component:
|
|
5
|
+
component: React.ForwardRefExoticComponent<Omit<import("../components/InputField").IInputFieldProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
6
6
|
parameters: {
|
|
7
7
|
layout: string;
|
|
8
8
|
};
|
|
@@ -19,3 +19,4 @@ export declare const Default: Story;
|
|
|
19
19
|
export declare const LeftIcon: Story;
|
|
20
20
|
export declare const IsClearable: Story;
|
|
21
21
|
export declare const Label: Story;
|
|
22
|
+
export declare const InputGroup: () => React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CreateArray: (n: number) => number[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SetCharAt: (str: string, index: number, chr: string) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { HTMLInputTypeAttribute } from "react";
|
|
2
2
|
export type TOtpType = "OTP" | "TEXT";
|
|
3
|
-
export interface IInputFieldProps {
|
|
3
|
+
export interface IInputFieldProps extends React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
4
4
|
onFocus?: () => void;
|
|
5
5
|
onBlur?: () => void;
|
|
6
6
|
onEnterPress?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
@@ -17,5 +17,6 @@ export interface IInputFieldProps {
|
|
|
17
17
|
ariaLabel: string;
|
|
18
18
|
focused?: boolean;
|
|
19
19
|
setFocused?: (val: boolean) => void;
|
|
20
|
+
readOnly?: boolean;
|
|
20
21
|
}
|
|
21
|
-
export declare const InputField:
|
|
22
|
+
export declare const InputField: React.ForwardRefExoticComponent<Omit<IInputFieldProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Button } from "./Button";
|
|
3
3
|
export declare const Сomponents: {
|
|
4
4
|
Button: ({ onClick, children, style, className, isRounded, disabled, variant, size, ariaLabel, }: import("./Button").IButtonProps) => import("react").JSX.Element;
|
|
5
|
-
InputField: (
|
|
5
|
+
InputField: import("react").ForwardRefExoticComponent<Omit<import("./InputField").IInputFieldProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
6
6
|
RadioGroup: ({ RadioGroupItems, invokeCustomOnChange, setSelectedOption, selectedOption, }: import("./RadioGroup").IRadioGroupProps) => import("react").JSX.Element;
|
|
7
7
|
CustomRadioButton: ({ label, name, checked, onChange, value, }: import("./RadioGroup").ICustomRadioButtonProps) => import("react").JSX.Element;
|
|
8
8
|
Accordion: ({ open, setOpen, children, title, }: import("./Accordion").IAccordionProps) => import("react").JSX.Element;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ interface IRadioGroupProps {
|
|
|
38
38
|
selectedOption: string;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
interface IInputFieldProps {
|
|
41
|
+
interface IInputFieldProps extends React__default.DetailedHTMLProps<React__default.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
42
42
|
onFocus?: () => void;
|
|
43
43
|
onBlur?: () => void;
|
|
44
44
|
onEnterPress?: (event: React__default.KeyboardEvent<HTMLInputElement>) => void;
|
|
@@ -55,6 +55,7 @@ interface IInputFieldProps {
|
|
|
55
55
|
ariaLabel: string;
|
|
56
56
|
focused?: boolean;
|
|
57
57
|
setFocused?: (val: boolean) => void;
|
|
58
|
+
readOnly?: boolean;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
interface IButtonProps {
|
|
@@ -72,7 +73,7 @@ interface IButtonProps {
|
|
|
72
73
|
declare const SystemDesign: {
|
|
73
74
|
Сomponents: {
|
|
74
75
|
Button: ({ onClick, children, style, className, isRounded, disabled, variant, size, ariaLabel, }: IButtonProps) => React.JSX.Element;
|
|
75
|
-
InputField:
|
|
76
|
+
InputField: React.ForwardRefExoticComponent<Omit<IInputFieldProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
76
77
|
RadioGroup: ({ RadioGroupItems, invokeCustomOnChange, setSelectedOption, selectedOption, }: IRadioGroupProps) => React.JSX.Element;
|
|
77
78
|
CustomRadioButton: ({ label, name, checked, onChange, value, }: ICustomRadioButtonProps) => React.JSX.Element;
|
|
78
79
|
Accordion: ({ open, setOpen, children, title, }: IAccordionProps) => React.JSX.Element;
|
package/dist/esm/index.js
CHANGED
|
@@ -2826,7 +2826,7 @@ var Accordion = function (_a) {
|
|
|
2826
2826
|
} },
|
|
2827
2827
|
title,
|
|
2828
2828
|
React.createElement("svg", { "data-testid": "Accordion_DIRECTION", xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", style: {
|
|
2829
|
-
transform: !open ? "rotate(0.5turn)"
|
|
2829
|
+
transform: !open ? "none" : "rotate(0.5turn)",
|
|
2830
2830
|
} },
|
|
2831
2831
|
React.createElement("path", { d: "M15.8346 7.5L10.0013 13.3333L4.16797 7.5", stroke: "#758393" }))),
|
|
2832
2832
|
React.createElement("div", { "data-testid": "Accordion_CONTENT", className: CombineClassNames(styles$5.accordionContent, !open && styles$5["accordionContent--hidden"]) }, children)));
|
|
@@ -2896,34 +2896,37 @@ var ClearIcon = function (_a) {
|
|
|
2896
2896
|
React.createElement("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" })));
|
|
2897
2897
|
};
|
|
2898
2898
|
|
|
2899
|
-
|
|
2900
|
-
|
|
2899
|
+
// InputField.tsx
|
|
2900
|
+
var InputField = react.exports.forwardRef(function (_a, ref) {
|
|
2901
|
+
var onFocus = _a.onFocus, onBlur = _a.onBlur, onChange = _a.onChange, onEnterPress = _a.onEnterPress, _b = _a.value, value = _b === void 0 ? "" : _b, inputLeftIcon = _a.inputLeftIcon, _c = _a.placeholder, placeholder = _c === void 0 ? "" : _c, _d = _a.className, className = _d === void 0 ? "" : _d, style = _a.style, _e = _a.isClearable, isClearable = _e === void 0 ? false : _e, _f = _a.type, type = _f === void 0 ? "text" : _f, id = _a.id, _g = _a.labelText, labelText = _g === void 0 ? "" : _g, _h = _a.ariaLabel, ariaLabel = _h === void 0 ? "" : _h, _j = _a.focused, focused = _j === void 0 ? false : _j, _k = _a.setFocused, setFocused = _k === void 0 ? function () { } : _k, _l = _a.readOnly, readOnly = _l === void 0 ? false : _l;
|
|
2902
|
+
var handleClear = function () {
|
|
2903
|
+
if (onChange) {
|
|
2904
|
+
onChange({
|
|
2905
|
+
target: { value: "" },
|
|
2906
|
+
});
|
|
2907
|
+
}
|
|
2908
|
+
};
|
|
2909
|
+
var handleFocus = function () {
|
|
2910
|
+
setFocused(true);
|
|
2911
|
+
if (onFocus)
|
|
2912
|
+
onFocus();
|
|
2913
|
+
};
|
|
2914
|
+
var handleBlur = function () {
|
|
2915
|
+
setFocused(false);
|
|
2916
|
+
if (onBlur)
|
|
2917
|
+
onBlur();
|
|
2918
|
+
};
|
|
2919
|
+
var handleKeyDown = function (event) {
|
|
2920
|
+
if (onEnterPress && event.key === "Enter") {
|
|
2921
|
+
onEnterPress(event);
|
|
2922
|
+
}
|
|
2923
|
+
};
|
|
2901
2924
|
return (React.createElement("div", { "data-testid": "InputField_MAIN", className: CombineClassNames(styles$3[labelText.length ? "inputContainerLabeled" : "inputContainer"], focused ? styles$3["input--onfocus"] : undefined, styles$3["input-".concat(type === null || type === void 0 ? void 0 : type.toLocaleLowerCase())], className), style: style },
|
|
2902
2925
|
labelText.length > 0 && (React.createElement("label", { htmlFor: id, "data-testid": "InputField_LABEL" }, labelText)),
|
|
2903
2926
|
inputLeftIcon,
|
|
2904
|
-
React.createElement("input", { "data-testid": "InputField_INPUT", "aria-label": ariaLabel, id: id, type: type, className: styles$3.input, placeholder: placeholder, "aria-placeholder": placeholder, onFocus:
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
onFocus();
|
|
2908
|
-
}
|
|
2909
|
-
}, onBlur: function () {
|
|
2910
|
-
setFocused(false);
|
|
2911
|
-
if (onBlur) {
|
|
2912
|
-
onBlur();
|
|
2913
|
-
}
|
|
2914
|
-
}, onChange: onChange, onKeyDown: function (event) {
|
|
2915
|
-
if (onEnterPress && event.key === "Enter") {
|
|
2916
|
-
onEnterPress(event);
|
|
2917
|
-
}
|
|
2918
|
-
}, value: value, readOnly: !onChange }),
|
|
2919
|
-
isClearable && value && (React.createElement(ClearIcon, { fill: "red", pathFill: "#758393", className: styles$3.clearIcon, onClick: function () {
|
|
2920
|
-
if (onChange) {
|
|
2921
|
-
onChange({
|
|
2922
|
-
target: { value: "" },
|
|
2923
|
-
});
|
|
2924
|
-
}
|
|
2925
|
-
} }))));
|
|
2926
|
-
};
|
|
2927
|
+
React.createElement("input", { ref: ref, "data-testid": "InputField_INPUT", "aria-label": ariaLabel, id: id, type: type, className: styles$3.input, placeholder: placeholder, "aria-placeholder": placeholder, onFocus: handleFocus, onBlur: handleBlur, onChange: onChange, onKeyDown: handleKeyDown, value: value, readOnly: readOnly }),
|
|
2928
|
+
isClearable && value && (React.createElement(ClearIcon, { fill: "red", pathFill: "#758393", className: styles$3.clearIcon, onClick: handleClear }))));
|
|
2929
|
+
});
|
|
2927
2930
|
|
|
2928
2931
|
var css_248z$2 = "/* Headings/Heading 1 */\n/* Headings/Heading 3 */\n/* Subtitles/Subtitle 3 */\n/* Body/Body 1, Medium */\n/* Body/Body 1, Regular */\n/* Body/Body 2, Medium */\n/* Body/Body 2, Regular */\n/* Body/Body 3, Regular */\n/* Caption/Caption 1, Medium */\n/* Caption/Caption 1, Regular */\n/* Caption/Caption 1, Semibold */\n/* Caption/Caption 2, Medium */\n/* Caption/Caption 2, Regular */\n.RadioGroup-module_radio__cmSnZ {\n display: flex;\n align-items: center;\n cursor: pointer;\n}\n\n.RadioGroup-module_radio__cmSnZ input {\n display: none;\n}\n\n.RadioGroup-module_radioBtn__HSuIE {\n position: relative;\n height: 15px;\n width: 15px;\n border-radius: 50%;\n border: 2px solid #c5ccd3;\n margin: 10px;\n transition: background 0.3s;\n}\n\n.RadioGroup-module_radioBtn__HSuIE::after {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n height: 10px;\n width: 10px;\n background: #0581da;\n border-radius: 50%;\n transform: scale(0) translate(-50%, -50%);\n transition: transform 0.3s;\n}\n\ninput:checked + .RadioGroup-module_radioBtn__HSuIE::after {\n transform: scale(1) translate(-50%, -50%);\n}\n\ninput:checked + .RadioGroup-module_radioBtn__HSuIE {\n border: 2px solid #0581da;\n}\n\n.RadioGroup-module_radioBtnText__Kx9T1 {\n padding-left: 10px;\n width: fit-content;\n font-family: Inter;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px; /* 142.857% */\n}";
|
|
2929
2932
|
var styles$2 = {"radio":"RadioGroup-module_radio__cmSnZ","radioBtn":"RadioGroup-module_radioBtn__HSuIE","radioBtnText":"RadioGroup-module_radioBtnText__Kx9T1"};
|
|
@@ -2964,8 +2967,8 @@ var styles = {"Heading1":"Typography-module_Heading1__2wNRy","Heading3":"Typogra
|
|
|
2964
2967
|
styleInject(css_248z);
|
|
2965
2968
|
|
|
2966
2969
|
var Typography = function (_a) {
|
|
2967
|
-
var tag = _a.tag, fontClass = _a.fontClass, className = _a.className, children = _a.children, restProps = __rest(_a, ["tag", "fontClass", "className", "children"]);
|
|
2968
|
-
return React.createElement(tag, __assign(__assign({}, restProps), { className: CombineClassNames(fontClass ? styles[fontClass] : "", className) }), children);
|
|
2970
|
+
var tag = _a.tag, fontClass = _a.fontClass, className = _a.className, children = _a.children, style = _a.style, restProps = __rest(_a, ["tag", "fontClass", "className", "children", "style"]);
|
|
2971
|
+
return React.createElement(tag, __assign(__assign({}, restProps), { className: CombineClassNames(fontClass ? styles[fontClass] : "", className), style: style }), children);
|
|
2969
2972
|
};
|
|
2970
2973
|
|
|
2971
2974
|
var Сomponents = {
|