@egov3/system-design 1.0.39 → 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 +30 -27
- 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 +30 -27
- 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
package/README.md
CHANGED
|
@@ -2,3 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## storybook
|
|
4
4
|
yarn storybook
|
|
5
|
+
|
|
6
|
+
### release 1.0.40
|
|
7
|
+
1. Typography теперь поддерживает jsx style
|
|
8
|
+
2. Обновление версии storybook и зависимых библиотек
|
|
9
|
+
3. Убрали плагин addon-mdx-gfm
|
|
10
|
+
4. Добавили utils функции
|
|
11
|
+
4.1. CreateArray создает массив с заданным количеством элементов
|
|
12
|
+
4.2. SetCharAt добавляет символ в заданный промежуток в строке
|
|
13
|
+
5. InputGroup story, группа из нескольких InputField
|
|
14
|
+
6. InputField props interface расширили стандартным интерфейсом от Реакт
|
|
@@ -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/cjs/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
declare const SystemDesign: {
|
|
3
3
|
Сomponents: {
|
|
4
4
|
Button: ({ onClick, children, style, className, isRounded, disabled, variant, size, ariaLabel, }: import("./components/Button").IButtonProps) => import("react").JSX.Element;
|
|
5
|
-
InputField: (
|
|
5
|
+
InputField: import("react").ForwardRefExoticComponent<Omit<import("./components/InputField").IInputFieldProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
6
6
|
RadioGroup: ({ RadioGroupItems, invokeCustomOnChange, setSelectedOption, selectedOption, }: import("./components/RadioGroup").IRadioGroupProps) => import("react").JSX.Element;
|
|
7
7
|
CustomRadioButton: ({ label, name, checked, onChange, value, }: import("./components/RadioGroup").ICustomRadioButtonProps) => import("react").JSX.Element;
|
|
8
8
|
Accordion: ({ open, setOpen, children, title, }: import("./components/Accordion").IAccordionProps) => import("react").JSX.Element;
|
package/dist/cjs/index.js
CHANGED
|
@@ -2898,34 +2898,37 @@ var ClearIcon = function (_a) {
|
|
|
2898
2898
|
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" })));
|
|
2899
2899
|
};
|
|
2900
2900
|
|
|
2901
|
-
|
|
2902
|
-
|
|
2901
|
+
// InputField.tsx
|
|
2902
|
+
var InputField = react.exports.forwardRef(function (_a, ref) {
|
|
2903
|
+
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;
|
|
2904
|
+
var handleClear = function () {
|
|
2905
|
+
if (onChange) {
|
|
2906
|
+
onChange({
|
|
2907
|
+
target: { value: "" },
|
|
2908
|
+
});
|
|
2909
|
+
}
|
|
2910
|
+
};
|
|
2911
|
+
var handleFocus = function () {
|
|
2912
|
+
setFocused(true);
|
|
2913
|
+
if (onFocus)
|
|
2914
|
+
onFocus();
|
|
2915
|
+
};
|
|
2916
|
+
var handleBlur = function () {
|
|
2917
|
+
setFocused(false);
|
|
2918
|
+
if (onBlur)
|
|
2919
|
+
onBlur();
|
|
2920
|
+
};
|
|
2921
|
+
var handleKeyDown = function (event) {
|
|
2922
|
+
if (onEnterPress && event.key === "Enter") {
|
|
2923
|
+
onEnterPress(event);
|
|
2924
|
+
}
|
|
2925
|
+
};
|
|
2903
2926
|
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 },
|
|
2904
2927
|
labelText.length > 0 && (React.createElement("label", { htmlFor: id, "data-testid": "InputField_LABEL" }, labelText)),
|
|
2905
2928
|
inputLeftIcon,
|
|
2906
|
-
React.createElement("input", { "data-testid": "InputField_INPUT", "aria-label": ariaLabel, id: id, type: type, className: styles$3.input, placeholder: placeholder, "aria-placeholder": placeholder, onFocus:
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
onFocus();
|
|
2910
|
-
}
|
|
2911
|
-
}, onBlur: function () {
|
|
2912
|
-
setFocused(false);
|
|
2913
|
-
if (onBlur) {
|
|
2914
|
-
onBlur();
|
|
2915
|
-
}
|
|
2916
|
-
}, onChange: onChange, onKeyDown: function (event) {
|
|
2917
|
-
if (onEnterPress && event.key === "Enter") {
|
|
2918
|
-
onEnterPress(event);
|
|
2919
|
-
}
|
|
2920
|
-
}, value: value, readOnly: !onChange }),
|
|
2921
|
-
isClearable && value && (React.createElement(ClearIcon, { fill: "red", pathFill: "#758393", className: styles$3.clearIcon, onClick: function () {
|
|
2922
|
-
if (onChange) {
|
|
2923
|
-
onChange({
|
|
2924
|
-
target: { value: "" },
|
|
2925
|
-
});
|
|
2926
|
-
}
|
|
2927
|
-
} }))));
|
|
2928
|
-
};
|
|
2929
|
+
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 }),
|
|
2930
|
+
isClearable && value && (React.createElement(ClearIcon, { fill: "red", pathFill: "#758393", className: styles$3.clearIcon, onClick: handleClear }))));
|
|
2931
|
+
});
|
|
2929
2932
|
|
|
2930
2933
|
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}";
|
|
2931
2934
|
var styles$2 = {"radio":"RadioGroup-module_radio__cmSnZ","radioBtn":"RadioGroup-module_radioBtn__HSuIE","radioBtnText":"RadioGroup-module_radioBtnText__Kx9T1"};
|
|
@@ -2966,8 +2969,8 @@ var styles = {"Heading1":"Typography-module_Heading1__2wNRy","Heading3":"Typogra
|
|
|
2966
2969
|
styleInject(css_248z);
|
|
2967
2970
|
|
|
2968
2971
|
var Typography = function (_a) {
|
|
2969
|
-
var tag = _a.tag, fontClass = _a.fontClass, className = _a.className, children = _a.children, restProps = __rest(_a, ["tag", "fontClass", "className", "children"]);
|
|
2970
|
-
return React.createElement(tag, __assign(__assign({}, restProps), { className: CombineClassNames(fontClass ? styles[fontClass] : "", className) }), children);
|
|
2972
|
+
var tag = _a.tag, fontClass = _a.fontClass, className = _a.className, children = _a.children, style = _a.style, restProps = __rest(_a, ["tag", "fontClass", "className", "children", "style"]);
|
|
2973
|
+
return React.createElement(tag, __assign(__assign({}, restProps), { className: CombineClassNames(fontClass ? styles[fontClass] : "", className), style: style }), children);
|
|
2971
2974
|
};
|
|
2972
2975
|
|
|
2973
2976
|
var Сomponents = {
|