@egov3/system-design 1.0.29 → 1.0.30

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,4 @@
1
+ import React from "react";
2
+ export declare const ClearIcon: ({ fill, pathFill, width, height, ...props }: React.SVGProps<SVGSVGElement> & {
3
+ pathFill?: string | undefined;
4
+ }) => React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { ClearIcon } from "./ClearIcon";
2
+ export { ClearIcon };
@@ -0,0 +1 @@
1
+ export declare const ClassNamesFn: (...args: unknown[]) => string;
@@ -1 +1,13 @@
1
- export { Button } from "./Button";
1
+ import React from 'react';
2
+ export interface IButtonProps {
3
+ ariaLabel?: string;
4
+ onClick?: () => void;
5
+ children: React.ReactNode;
6
+ className?: string;
7
+ isRounded?: boolean;
8
+ disabled?: boolean;
9
+ variant?: 'default' | 'tinted' | 'secondary';
10
+ size?: 'mini' | 'small' | 'medium' | 'large';
11
+ style?: React.CSSProperties;
12
+ }
13
+ export declare const Button: ({ onClick, children, style, className, isRounded, disabled, variant, size, ariaLabel, }: IButtonProps) => React.JSX.Element;
@@ -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;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  export declare const components: {
3
- Button: (props: import("./Button/Button").ButtonProps) => import("react").JSX.Element;
3
+ Button: ({ onClick, children, style, className, isRounded, disabled, variant, size, ariaLabel, }: import("./Button").IButtonProps) => import("react").JSX.Element;
4
+ InputField: ({ onFocus, onBlur, onChange, onEnterPress, value, inputLeftIcon, placeholder, className, style, isClearable, type, id, labelText, ariaLabel, }: import("./InputField").IInputFieldProps) => import("react").ReactNode;
4
5
  };
@@ -1,12 +1,39 @@
1
1
  /// <reference types="react" />
2
2
  import * as React from 'react';
3
+ import React__default, { HTMLInputTypeAttribute } from 'react';
3
4
 
4
- interface ButtonProps {
5
- label: string;
5
+ interface IInputFieldProps {
6
+ onFocus?: () => void;
7
+ onBlur?: () => void;
8
+ onEnterPress?: (event: React__default.KeyboardEvent<HTMLInputElement>) => void;
9
+ onChange?: (event: React__default.ChangeEvent<HTMLInputElement>) => void;
10
+ value?: string;
11
+ placeholder?: string;
12
+ className?: string;
13
+ style?: React__default.CSSProperties;
14
+ isClearable?: boolean;
15
+ inputLeftIcon?: JSX.Element;
16
+ type?: HTMLInputTypeAttribute;
17
+ id: string;
18
+ labelText?: string;
19
+ ariaLabel: string;
20
+ }
21
+
22
+ interface IButtonProps {
23
+ ariaLabel?: string;
24
+ onClick?: () => void;
25
+ children: React__default.ReactNode;
26
+ className?: string;
27
+ isRounded?: boolean;
28
+ disabled?: boolean;
29
+ variant?: 'default' | 'tinted' | 'secondary';
30
+ size?: 'mini' | 'small' | 'medium' | 'large';
31
+ style?: React__default.CSSProperties;
6
32
  }
7
33
 
8
34
  declare const components: {
9
- Button: (props: ButtonProps) => React.JSX.Element;
35
+ Button: ({ onClick, children, style, className, isRounded, disabled, variant, size, ariaLabel, }: IButtonProps) => React.JSX.Element;
36
+ InputField: ({ onFocus, onBlur, onChange, onEnterPress, value, inputLeftIcon, placeholder, className, style, isClearable, type, id, labelText, ariaLabel, }: IInputFieldProps) => React.ReactNode;
10
37
  };
11
38
 
12
39
  export { components };
package/dist/esm/index.js CHANGED
@@ -2779,6 +2779,14 @@ if (process.env.NODE_ENV === 'production') {
2779
2779
 
2780
2780
  var React = react.exports;
2781
2781
 
2782
+ var ClassNamesFn = function () {
2783
+ var args = [];
2784
+ for (var _i = 0; _i < arguments.length; _i++) {
2785
+ args[_i] = arguments[_i];
2786
+ }
2787
+ return args.filter(function (item) { return !!item; }).join(" ");
2788
+ };
2789
+
2782
2790
  function styleInject(css, ref) {
2783
2791
  if ( ref === void 0 ) ref = {};
2784
2792
  var insertAt = ref.insertAt;
@@ -2806,15 +2814,103 @@ function styleInject(css, ref) {
2806
2814
  }
2807
2815
  }
2808
2816
 
2809
- var css_248z = "button {\n font-size: 60px;\n}";
2817
+ var css_248z$1 = "/* 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.button-module_button__WDVlB {\n border: none;\n transition: background-color 0.2s ease;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n}\n\n.button-module_btn-default__upnYC {\n color: #fff;\n background-color: #0581da;\n}\n\n.button-module_btn-default--disabled__tlBX8 {\n color: #929daa;\n background-color: #c5ccd3;\n}\n\n.button-module_btn-tinted__hE7vU {\n color: #0581da;\n background-color: #e1f0fb;\n}\n\n.button-module_btn-tinted--disabled__KYbnK {\n color: #9bcdf0;\n background-color: #e1f0fb;\n}\n\n.button-module_btn-secondary__C8isQ {\n color: #000;\n background-color: #e3e7eb;\n}\n\n.button-module_btn-secondary--disabled__2Y-Q3 {\n color: #758393;\n background-color: #e3e7eb;\n}\n\n.button-module_btn-default__upnYC:hover {\n background-color: #1a9cfa;\n}\n\n.button-module_btn-tinted__hE7vU:hover {\n background-color: #b2d9f5;\n}\n\n.button-module_btn-secondary__C8isQ:hover {\n background-color: #c5ccd3;\n}\n\n.button-module_btn--mini__7zJ2M {\n gap: 4px;\n padding: 6px 12px;\n font-family: Inter;\n font-size: 10px;\n font-style: normal;\n font-weight: 500;\n line-height: 12px; /* 120% */\n}\n\n.button-module_btn--small__IGPOx {\n gap: 8px;\n padding: 8px 16px;\n font-family: Inter;\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px; /* 133.333% */\n}\n\n.button-module_btn--medium__WaM0q {\n gap: 8px;\n padding: 8px 20px;\n font-family: Inter;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px; /* 142.857% */\n}\n\n.button-module_btn--large__qrwDc {\n gap: 8px;\n padding: 14px 24px;\n font-family: Inter;\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px; /* 150% */\n}\n\n.button-module_btn-square--mini__Ak5mN {\n border-radius: 4px;\n}\n\n.button-module_btn-square--small__O58ux {\n border-radius: 6px;\n}\n\n.button-module_btn-square--medium__xNiKL {\n border-radius: 10px;\n}\n\n.button-module_btn-square--large__9JUii {\n border-radius: 12px;\n}\n\n.button-module_btn-rounded--mini__7ZTyL {\n border-radius: 32px;\n}\n\n.button-module_btn-rounded--small__KJhsk {\n border-radius: 32px;\n}\n\n.button-module_btn-rounded--medium__wT5Uc {\n border-radius: 32px;\n}\n\n.button-module_btn-rounded--large__46yFD {\n border-radius: 40px;\n}";
2818
+ var styles$1 = {"button":"button-module_button__WDVlB","btn-default":"button-module_btn-default__upnYC","btn-default--disabled":"button-module_btn-default--disabled__tlBX8","btn-tinted":"button-module_btn-tinted__hE7vU","btn-tinted--disabled":"button-module_btn-tinted--disabled__KYbnK","btn-secondary":"button-module_btn-secondary__C8isQ","btn-secondary--disabled":"button-module_btn-secondary--disabled__2Y-Q3","btn--mini":"button-module_btn--mini__7zJ2M","btn--small":"button-module_btn--small__IGPOx","btn--medium":"button-module_btn--medium__WaM0q","btn--large":"button-module_btn--large__qrwDc","btn-square--mini":"button-module_btn-square--mini__Ak5mN","btn-square--small":"button-module_btn-square--small__O58ux","btn-square--medium":"button-module_btn-square--medium__xNiKL","btn-square--large":"button-module_btn-square--large__9JUii","btn-rounded--mini":"button-module_btn-rounded--mini__7ZTyL","btn-rounded--small":"button-module_btn-rounded--small__KJhsk","btn-rounded--medium":"button-module_btn-rounded--medium__wT5Uc","btn-rounded--large":"button-module_btn-rounded--large__46yFD"};
2819
+ styleInject(css_248z$1);
2820
+
2821
+ var Button = function (_a) {
2822
+ var onClick = _a.onClick, children = _a.children, style = _a.style, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.isRounded, isRounded = _c === void 0 ? false : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.variant, variant = _e === void 0 ? 'default' : _e, _f = _a.size, size = _f === void 0 ? 'medium' : _f, _g = _a.ariaLabel, ariaLabel = _g === void 0 ? 'Кнопка' : _g;
2823
+ return (React.createElement("button", { "data-testid": "Button_MAIN", "aria-label": ariaLabel, disabled: disabled, "aria-disabled": disabled, onClick: onClick, className: ClassNamesFn(styles$1["btn--".concat(size)], isRounded
2824
+ ? styles$1["btn-rounded--".concat(size)]
2825
+ : styles$1["btn-square--".concat(size)], disabled ? styles$1["btn-".concat(variant, "--disabled")] : styles$1["btn-".concat(variant)], styles$1.button, className), style: style }, children));
2826
+ };
2827
+
2828
+ var css_248z = "/* 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.InputField-module_inputContainer__J1gSu {\n display: flex;\n align-items: center;\n background-color: #f0f2f4;\n border-radius: 8px;\n padding: 12px 16px;\n}\n\n.InputField-module_inputContainerLabeled__63H-X {\n display: block;\n background-color: #f0f2f4;\n border-radius: 8px;\n padding: 12px 16px;\n}\n.InputField-module_inputContainerLabeled__63H-X label {\n color: #758393;\n}\n\n.InputField-module_input__y6Hs- {\n width: 100%;\n border: none;\n background-color: #f0f2f4;\n}\n.InputField-module_input__y6Hs-:active, .InputField-module_input__y6Hs-:focus {\n outline: none;\n}\n.InputField-module_input__y6Hs-::placeholder {\n color: #929daa;\n}\n.InputField-module_input__y6Hs-::-webkit-inner-spin-button, .InputField-module_input__y6Hs-::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\n.InputField-module_clearIcon__WFQKa {\n cursor: pointer;\n}\n\n.InputField-module_input--onfocus__F5PRb {\n background-color: #e3e7eb;\n}\n.InputField-module_input--onfocus__F5PRb .InputField-module_input__y6Hs- {\n background-color: #e3e7eb;\n}\n\n.InputField-module_input-text__Cg-9A {\n font-family: Inter;\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 24px; /* 150% */\n}";
2829
+ var styles = {"inputContainer":"InputField-module_inputContainer__J1gSu","inputContainerLabeled":"InputField-module_inputContainerLabeled__63H-X","input":"InputField-module_input__y6Hs-","clearIcon":"InputField-module_clearIcon__WFQKa","input--onfocus":"InputField-module_input--onfocus__F5PRb","input-text":"InputField-module_input-text__Cg-9A"};
2810
2830
  styleInject(css_248z);
2811
2831
 
2812
- var Button = function (props) {
2813
- return React.createElement("button", null, props.label);
2832
+ /******************************************************************************
2833
+ Copyright (c) Microsoft Corporation.
2834
+
2835
+ Permission to use, copy, modify, and/or distribute this software for any
2836
+ purpose with or without fee is hereby granted.
2837
+
2838
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2839
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2840
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2841
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2842
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2843
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2844
+ PERFORMANCE OF THIS SOFTWARE.
2845
+ ***************************************************************************** */
2846
+
2847
+ var __assign = function() {
2848
+ __assign = Object.assign || function __assign(t) {
2849
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
2850
+ s = arguments[i];
2851
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
2852
+ }
2853
+ return t;
2854
+ };
2855
+ return __assign.apply(this, arguments);
2856
+ };
2857
+
2858
+ function __rest(s, e) {
2859
+ var t = {};
2860
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
2861
+ t[p] = s[p];
2862
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
2863
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2864
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
2865
+ t[p[i]] = s[p[i]];
2866
+ }
2867
+ return t;
2868
+ }
2869
+
2870
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
2871
+ var e = new Error(message);
2872
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
2873
+ };
2874
+
2875
+ var ClearIcon = function (_a) {
2876
+ var _b = _a.fill, fill = _b === void 0 ? "none" : _b, _c = _a.pathFill, pathFill = _c === void 0 ? "#fff" : _c, _d = _a.width, width = _d === void 0 ? 20 : _d, _e = _a.height, height = _e === void 0 ? 20 : _e, props = __rest(_a, ["fill", "pathFill", "width", "height"]);
2877
+ return (React.createElement("svg", __assign({ "data-testid": "Icons_CLEAR", xmlns: "http://www.w3.org/2000/svg", width: width, height: height, fill: fill, viewBox: "0 0 20 20" }, props),
2878
+ 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" })));
2879
+ };
2880
+
2881
+ var InputField = function (_a) {
2882
+ 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;
2883
+ var _j = react.exports.useState(false), focused = _j[0], setFocused = _j[1];
2884
+ return (React.createElement("div", { "data-testid": "InputField_MAIN", className: ClassNamesFn(styles[labelText.length ? "inputContainerLabeled" : "inputContainer"], className, focused ? styles["input--onfocus"] : undefined, styles["input-".concat(type === null || type === void 0 ? void 0 : type.toLocaleLowerCase())]), style: style },
2885
+ labelText.length > 0 && (React.createElement("label", { htmlFor: id, "data-testid": "InputField_LABEL" }, labelText)),
2886
+ inputLeftIcon,
2887
+ React.createElement("input", { "data-testid": "InputField_INPUT", "aria-label": ariaLabel, id: id, type: type, className: styles.input, placeholder: placeholder, "aria-placeholder": placeholder, onFocus: function () {
2888
+ setFocused(true);
2889
+ if (onFocus) {
2890
+ onFocus();
2891
+ }
2892
+ }, onBlur: function () {
2893
+ setFocused(false);
2894
+ if (onBlur) {
2895
+ onBlur();
2896
+ }
2897
+ }, onChange: onChange, onKeyDown: function (event) {
2898
+ if (onEnterPress && event.key === "Enter") {
2899
+ onEnterPress(event);
2900
+ }
2901
+ }, value: value, readOnly: !onChange }),
2902
+ isClearable && value && (React.createElement(ClearIcon, { fill: "red", pathFill: "#758393", className: styles.clearIcon, onClick: function () {
2903
+ if (onChange) {
2904
+ onChange({
2905
+ target: { value: "" },
2906
+ });
2907
+ }
2908
+ } }))));
2814
2909
  };
2815
2910
 
2816
2911
  var components = {
2817
- Button: Button
2912
+ Button: Button,
2913
+ InputField: InputField
2818
2914
  };
2819
2915
 
2820
2916
  export { components };