@de-kit/st-ui 0.1.0 → 0.1.2
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 +19 -17
- package/dist/components/button/button.cjs +4 -7
- package/dist/components/button/button.cjs.map +1 -1
- package/dist/components/button/button.d.cts +4 -5
- package/dist/components/button/button.d.ts +4 -5
- package/dist/components/button/button.js +4 -5
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/button/button.scss +94 -0
- package/dist/components/button/index.d.cts +2 -2
- package/dist/components/button/index.d.ts +2 -2
- package/dist/components/checkbox/checkbox.cjs +4 -6
- package/dist/components/checkbox/checkbox.cjs.map +1 -1
- package/dist/components/checkbox/checkbox.js +4 -4
- package/dist/components/checkbox/checkbox.js.map +1 -1
- package/dist/components/checkbox/{checkbox.module.scss → checkbox.scss} +11 -13
- package/dist/components/input/input.cjs +2 -4
- package/dist/components/input/input.cjs.map +1 -1
- package/dist/components/input/input.js +2 -2
- package/dist/components/input/input.js.map +1 -1
- package/dist/components/input/{input.module.scss → input.scss} +11 -13
- package/dist/components/radio/radio.cjs +4 -6
- package/dist/components/radio/radio.cjs.map +1 -1
- package/dist/components/radio/radio.js +4 -4
- package/dist/components/radio/radio.js.map +1 -1
- package/dist/components/radio/{radio.module.scss → radio.scss} +14 -13
- package/dist/components/spinner/spinner.cjs +2 -4
- package/dist/components/spinner/spinner.cjs.map +1 -1
- package/dist/components/spinner/spinner.js +2 -2
- package/dist/components/spinner/spinner.js.map +1 -1
- package/dist/components/spinner/{spinner.module.scss → spinner.scss} +3 -3
- package/dist/components/textarea/textarea.cjs +4 -6
- package/dist/components/textarea/textarea.cjs.map +1 -1
- package/dist/components/textarea/textarea.js +4 -4
- package/dist/components/textarea/textarea.js.map +1 -1
- package/dist/components/textarea/textarea.scss +58 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -0
- package/dist/lib/cn.cjs +2 -2
- package/dist/lib/cn.cjs.map +1 -1
- package/dist/lib/cn.js +2 -2
- package/dist/lib/cn.js.map +1 -1
- package/dist/styles/global.scss +17 -17
- package/dist/styles/mixins.scss +22 -24
- package/dist/styles/vars.scss +31 -34
- package/package.json +2 -2
- package/dist/_virtual/_rolldown/runtime.cjs +0 -22
- package/dist/components/button/button.module.scss +0 -95
- package/dist/components/textarea/textarea.module.scss +0 -60
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { cn, when } from "../../lib/cn.js";
|
|
2
2
|
import { forwardRef, useId } from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import
|
|
4
|
+
import "./radio.scss";
|
|
5
5
|
// src/components/radio/radio.tsx
|
|
6
6
|
const RadioInput = forwardRef(function RadioInput({ id, className, title, error, disabled, ...props }, ref) {
|
|
7
7
|
const autoId = useId();
|
|
8
8
|
const inputId = id ?? autoId;
|
|
9
9
|
return /* @__PURE__ */ jsxs("div", {
|
|
10
|
-
className: cn(
|
|
10
|
+
className: cn("radio", className, when(error, "radio--error")),
|
|
11
11
|
children: [/* @__PURE__ */ jsx("input", {
|
|
12
12
|
ref,
|
|
13
13
|
type: "radio",
|
|
14
14
|
id: inputId,
|
|
15
15
|
disabled,
|
|
16
|
-
className:
|
|
16
|
+
className: "radio__input",
|
|
17
17
|
...props
|
|
18
18
|
}), title ? /* @__PURE__ */ jsx("label", {
|
|
19
|
-
className:
|
|
19
|
+
className: "radio__label",
|
|
20
20
|
htmlFor: inputId,
|
|
21
21
|
children: title
|
|
22
22
|
}) : null]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.js","names":[],"sources":["../../../src/components/radio/radio.tsx"],"sourcesContent":["import { forwardRef, useId, type InputHTMLAttributes } from 'react';\n\nimport { cn, when } from '../../lib/cn';\nimport
|
|
1
|
+
{"version":3,"file":"radio.js","names":[],"sources":["../../../src/components/radio/radio.tsx"],"sourcesContent":["import { forwardRef, useId, type InputHTMLAttributes } from 'react';\n\nimport { cn, when } from '../../lib/cn';\nimport './radio.scss';\n\nexport interface RadioInputProps extends InputHTMLAttributes<HTMLInputElement> {\n title?: string;\n error?: boolean;\n}\n\nexport const RadioInput = forwardRef<HTMLInputElement, RadioInputProps>(\n function RadioInput(\n { id, className, title, error, disabled, ...props },\n ref,\n ) {\n const autoId = useId();\n const inputId = id ?? autoId;\n\n return (\n <div className={cn('radio', className, when(error, 'radio--error'))}>\n <input\n ref={ref}\n type=\"radio\"\n id={inputId}\n disabled={disabled}\n className=\"radio__input\"\n {...props}\n />\n {title ? (\n <label className=\"radio__label\" htmlFor={inputId}>\n {title}\n </label>\n ) : null}\n </div>\n );\n },\n);\n"],"mappings":";;;;;AAUA,MAAa,aAAa,WACxB,SAAS,WACP,EAAE,IAAI,WAAW,OAAO,OAAO,UAAU,GAAG,SAC5C,KACA;CACA,MAAM,SAAS,MAAM;CACrB,MAAM,UAAU,MAAM;CAEtB,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,SAAS,WAAW,KAAK,OAAO,cAAc,CAAC;EAAlE,UAAA,CACE,oBAAC,SAAD;GACO;GACL,MAAK;GACL,IAAI;GACM;GACV,WAAU;GACV,GAAI;EACL,CAAA,GACA,QACC,oBAAC,SAAD;GAAO,WAAU;GAAe,SAAS;GACtC,UAAA;EACI,CAAA,IACL,IACD;;AAET,CACF"}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
.radio {
|
|
4
|
-
display: flex;
|
|
5
|
-
align-items: flex-start;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.label {
|
|
1
|
+
.radio__label {
|
|
9
2
|
font-size: 14px;
|
|
10
3
|
line-height: 20px;
|
|
11
4
|
display: inline-block;
|
|
@@ -15,7 +8,7 @@
|
|
|
15
8
|
cursor: pointer;
|
|
16
9
|
}
|
|
17
10
|
|
|
18
|
-
.
|
|
11
|
+
.radio__input {
|
|
19
12
|
--active: #000;
|
|
20
13
|
--active-inner: #fff;
|
|
21
14
|
--border: #e5e5e5;
|
|
@@ -96,13 +89,21 @@
|
|
|
96
89
|
}
|
|
97
90
|
}
|
|
98
91
|
|
|
99
|
-
& + .
|
|
100
|
-
color:
|
|
92
|
+
& + .radio__label {
|
|
93
|
+
color: var(--color-gray);
|
|
101
94
|
cursor: not-allowed;
|
|
102
95
|
}
|
|
103
96
|
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Модификатор ошибки после .radio__input: иначе shorthand border затрёт border-color.
|
|
100
|
+
.radio {
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: flex-start;
|
|
104
103
|
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
&--error {
|
|
105
|
+
.radio__input {
|
|
106
|
+
border-color: color-mix(in srgb, var(--color-red) 50%, transparent);
|
|
107
|
+
}
|
|
107
108
|
}
|
|
108
109
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
1
|
const require_cn = require("../../lib/cn.cjs");
|
|
3
2
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
-
|
|
5
|
-
src_components_spinner_spinner_module_scss = require_runtime.__toESM(src_components_spinner_spinner_module_scss, 1);
|
|
3
|
+
require("./spinner.scss");
|
|
6
4
|
// src/components/spinner/spinner.tsx
|
|
7
5
|
const spinnerPosition = {
|
|
8
6
|
top: "top",
|
|
@@ -42,7 +40,7 @@ const svgProps = {
|
|
|
42
40
|
"aria-hidden": true
|
|
43
41
|
};
|
|
44
42
|
const Spinner = ({ className, position = spinnerPosition.center }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
45
|
-
className: require_cn.cn(
|
|
43
|
+
className: require_cn.cn("spinner", className, require_cn.when(position === spinnerPosition.top, "spinner--top")),
|
|
46
44
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
47
45
|
...svgProps,
|
|
48
46
|
children: dotDelays.map((begin, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dot, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.cjs","names":["cn","
|
|
1
|
+
{"version":3,"file":"spinner.cjs","names":["cn","when"],"sources":["../../../src/components/spinner/spinner.tsx"],"sourcesContent":["import type { FC, SVGProps } from 'react';\n\nimport { cn, when } from '../../lib/cn';\nimport './spinner.scss';\n\nconst spinnerPosition = {\n top: 'top',\n center: 'center',\n} as const;\n\nexport type SpinnerPosition =\n (typeof spinnerPosition)[keyof typeof spinnerPosition];\n\nexport interface SpinnerProps {\n className?: string;\n position?: SpinnerPosition;\n}\n\nconst dotDelays = [\n '0s',\n '0.125s',\n '0.25s',\n '0.375s',\n '0.5s',\n '0.625s',\n '0.75s',\n '0.875s',\n] as const;\n\nconst Dot = ({ begin, rotate }: { begin: string; rotate: number }) => (\n <circle transform={`rotate(${rotate} 16 16)`} cx=\"16\" cy=\"3\" r=\"0\">\n <animate\n attributeName=\"r\"\n values=\"0;3;0;0\"\n dur=\"1s\"\n repeatCount=\"indefinite\"\n begin={begin}\n keySplines=\"0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8\"\n calcMode=\"spline\"\n />\n </circle>\n);\n\nconst svgProps: SVGProps<SVGSVGElement> = {\n 'xmlns': 'http://www.w3.org/2000/svg',\n 'viewBox': '0 0 32 32',\n 'width': 64,\n 'height': 64,\n 'fill': '#ecebeb',\n 'aria-hidden': true,\n};\n\nexport const Spinner: FC<SpinnerProps> = ({\n className,\n position = spinnerPosition.center,\n}) => (\n <div\n className={cn(\n 'spinner',\n className,\n when(position === spinnerPosition.top, 'spinner--top'),\n )}\n >\n <svg {...svgProps}>\n {dotDelays.map((begin, index) => (\n <Dot key={begin} begin={begin} rotate={index * 45} />\n ))}\n </svg>\n </div>\n);\n"],"mappings":";;;;AAKA,MAAM,kBAAkB;CACtB,KAAK;CACL,QAAQ;AACV;AAUA,MAAM,YAAY;CAChB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,OAAO,EAAE,OAAO,aACpB,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;CAAQ,WAAW,UAAU,OAAO;CAAU,IAAG;CAAK,IAAG;CAAI,GAAE;CAC7D,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD;EACE,eAAc;EACd,QAAO;EACP,KAAI;EACJ,aAAY;EACL;EACP,YAAW;EACX,UAAS;CACV,CAAA;AACK,CAAA;AAGV,MAAM,WAAoC;CACxC,SAAS;CACT,WAAW;CACX,SAAS;CACT,UAAU;CACV,QAAQ;CACR,eAAe;AACjB;AAEA,MAAa,WAA6B,EACxC,WACA,WAAW,gBAAgB,aAE3B,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;CACE,WAAWA,WAAAA,GACT,WACA,WACAC,WAAAA,KAAK,aAAa,gBAAgB,KAAK,cAAc,CACvD;CAEA,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,GAAI;EACN,UAAA,UAAU,KAAK,OAAO,UACrB,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;GAAwB;GAAO,QAAQ,QAAQ;EAAK,GAA1C,KAA0C,CACrD;CACE,CAAA;AACF,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cn, when } from "../../lib/cn.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import "./spinner.scss";
|
|
4
4
|
// src/components/spinner/spinner.tsx
|
|
5
5
|
const spinnerPosition = {
|
|
6
6
|
top: "top",
|
|
@@ -40,7 +40,7 @@ const svgProps = {
|
|
|
40
40
|
"aria-hidden": true
|
|
41
41
|
};
|
|
42
42
|
const Spinner = ({ className, position = spinnerPosition.center }) => /* @__PURE__ */ jsx("div", {
|
|
43
|
-
className: cn(
|
|
43
|
+
className: cn("spinner", className, when(position === spinnerPosition.top, "spinner--top")),
|
|
44
44
|
children: /* @__PURE__ */ jsx("svg", {
|
|
45
45
|
...svgProps,
|
|
46
46
|
children: dotDelays.map((begin, index) => /* @__PURE__ */ jsx(Dot, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.js","names":[],"sources":["../../../src/components/spinner/spinner.tsx"],"sourcesContent":["import type { FC, SVGProps } from 'react';\n\nimport { cn, when } from '../../lib/cn';\nimport
|
|
1
|
+
{"version":3,"file":"spinner.js","names":[],"sources":["../../../src/components/spinner/spinner.tsx"],"sourcesContent":["import type { FC, SVGProps } from 'react';\n\nimport { cn, when } from '../../lib/cn';\nimport './spinner.scss';\n\nconst spinnerPosition = {\n top: 'top',\n center: 'center',\n} as const;\n\nexport type SpinnerPosition =\n (typeof spinnerPosition)[keyof typeof spinnerPosition];\n\nexport interface SpinnerProps {\n className?: string;\n position?: SpinnerPosition;\n}\n\nconst dotDelays = [\n '0s',\n '0.125s',\n '0.25s',\n '0.375s',\n '0.5s',\n '0.625s',\n '0.75s',\n '0.875s',\n] as const;\n\nconst Dot = ({ begin, rotate }: { begin: string; rotate: number }) => (\n <circle transform={`rotate(${rotate} 16 16)`} cx=\"16\" cy=\"3\" r=\"0\">\n <animate\n attributeName=\"r\"\n values=\"0;3;0;0\"\n dur=\"1s\"\n repeatCount=\"indefinite\"\n begin={begin}\n keySplines=\"0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8\"\n calcMode=\"spline\"\n />\n </circle>\n);\n\nconst svgProps: SVGProps<SVGSVGElement> = {\n 'xmlns': 'http://www.w3.org/2000/svg',\n 'viewBox': '0 0 32 32',\n 'width': 64,\n 'height': 64,\n 'fill': '#ecebeb',\n 'aria-hidden': true,\n};\n\nexport const Spinner: FC<SpinnerProps> = ({\n className,\n position = spinnerPosition.center,\n}) => (\n <div\n className={cn(\n 'spinner',\n className,\n when(position === spinnerPosition.top, 'spinner--top'),\n )}\n >\n <svg {...svgProps}>\n {dotDelays.map((begin, index) => (\n <Dot key={begin} begin={begin} rotate={index * 45} />\n ))}\n </svg>\n </div>\n);\n"],"mappings":";;;;AAKA,MAAM,kBAAkB;CACtB,KAAK;CACL,QAAQ;AACV;AAUA,MAAM,YAAY;CAChB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,OAAO,EAAE,OAAO,aACpB,oBAAC,UAAD;CAAQ,WAAW,UAAU,OAAO;CAAU,IAAG;CAAK,IAAG;CAAI,GAAE;CAC7D,UAAA,oBAAC,WAAD;EACE,eAAc;EACd,QAAO;EACP,KAAI;EACJ,aAAY;EACL;EACP,YAAW;EACX,UAAS;CACV,CAAA;AACK,CAAA;AAGV,MAAM,WAAoC;CACxC,SAAS;CACT,WAAW;CACX,SAAS;CACT,UAAU;CACV,QAAQ;CACR,eAAe;AACjB;AAEA,MAAa,WAA6B,EACxC,WACA,WAAW,gBAAgB,aAE3B,oBAAC,OAAD;CACE,WAAW,GACT,WACA,WACA,KAAK,aAAa,gBAAgB,KAAK,cAAc,CACvD;CAEA,UAAA,oBAAC,OAAD;EAAK,GAAI;EACN,UAAA,UAAU,KAAK,OAAO,UACrB,oBAAC,KAAD;GAAwB;GAAO,QAAQ,QAAQ;EAAK,GAA1C,KAA0C,CACrD;CACE,CAAA;AACF,CAAA"}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
1
|
const require_cn = require("../../lib/cn.cjs");
|
|
3
2
|
let react = require("react");
|
|
4
3
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
-
|
|
6
|
-
src_components_textarea_textarea_module_scss = require_runtime.__toESM(src_components_textarea_textarea_module_scss, 1);
|
|
4
|
+
require("./textarea.scss");
|
|
7
5
|
// src/components/textarea/textarea.tsx
|
|
8
6
|
const TextArea = (0, react.forwardRef)(function TextArea({ maxLength, value = "", recommended, error, hideCounter = false, className, ...props }, ref) {
|
|
9
7
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
10
|
-
className:
|
|
8
|
+
className: "textarea__wrap",
|
|
11
9
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
12
10
|
ref,
|
|
13
|
-
className: require_cn.cn(
|
|
11
|
+
className: require_cn.cn("textarea", className, require_cn.when(recommended, "textarea--recommended"), require_cn.when(error, "textarea--error")),
|
|
14
12
|
value,
|
|
15
13
|
maxLength,
|
|
16
14
|
"aria-invalid": error || void 0,
|
|
17
15
|
...props
|
|
18
16
|
}), maxLength && !hideCounter ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
19
|
-
className:
|
|
17
|
+
className: "textarea__counter",
|
|
20
18
|
children: [
|
|
21
19
|
"Максимум ",
|
|
22
20
|
maxLength,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.cjs","names":["forwardRef","
|
|
1
|
+
{"version":3,"file":"textarea.cjs","names":["forwardRef","cn","when"],"sources":["../../../src/components/textarea/textarea.tsx"],"sourcesContent":["import { forwardRef, type TextareaHTMLAttributes } from 'react';\n\nimport { cn, when } from '../../lib/cn';\nimport './textarea.scss';\n\nexport interface TextAreaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n recommended?: boolean;\n error?: boolean;\n /** В приложении проп называется `noMaxMoty`. */\n hideCounter?: boolean;\n}\n\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n function TextArea(\n {\n maxLength,\n value = '',\n recommended,\n error,\n hideCounter = false,\n className,\n ...props\n },\n ref,\n ) {\n return (\n <div className=\"textarea__wrap\">\n <textarea\n ref={ref}\n className={cn(\n 'textarea',\n className,\n when(recommended, 'textarea--recommended'),\n when(error, 'textarea--error'),\n )}\n value={value}\n maxLength={maxLength}\n aria-invalid={error || undefined}\n {...props}\n />\n {maxLength && !hideCounter ? (\n <span className=\"textarea__counter\">\n Максимум {maxLength} символов\n </span>\n ) : null}\n </div>\n );\n },\n);\n"],"mappings":";;;;;AAYA,MAAa,YAAA,GAAWA,MAAAA,WAAAA,CACtB,SAAS,SACP,EACE,WACA,QAAQ,IACR,aACA,OACA,cAAc,OACd,WACA,GAAG,SAEL,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,YAAD;GACO;GACL,WAAWC,WAAAA,GACT,YACA,WACAC,WAAAA,KAAK,aAAa,uBAAuB,GACzCA,WAAAA,KAAK,OAAO,iBAAiB,CAC/B;GACO;GACI;GACX,gBAAc,SAAS,KAAA;GACvB,GAAI;EACL,CAAA,GACA,aAAa,CAAC,cACb,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;GAAM,WAAU;GAAhB,UAAA;IAAoC;IACxB;IAAU;GAChB;EACJ,CAAA,IAAA,IACD;;AAET,CACF"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { cn, when } from "../../lib/cn.js";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import
|
|
4
|
+
import "./textarea.scss";
|
|
5
5
|
// src/components/textarea/textarea.tsx
|
|
6
6
|
const TextArea = forwardRef(function TextArea({ maxLength, value = "", recommended, error, hideCounter = false, className, ...props }, ref) {
|
|
7
7
|
return /* @__PURE__ */ jsxs("div", {
|
|
8
|
-
className:
|
|
8
|
+
className: "textarea__wrap",
|
|
9
9
|
children: [/* @__PURE__ */ jsx("textarea", {
|
|
10
10
|
ref,
|
|
11
|
-
className: cn(
|
|
11
|
+
className: cn("textarea", className, when(recommended, "textarea--recommended"), when(error, "textarea--error")),
|
|
12
12
|
value,
|
|
13
13
|
maxLength,
|
|
14
14
|
"aria-invalid": error || void 0,
|
|
15
15
|
...props
|
|
16
16
|
}), maxLength && !hideCounter ? /* @__PURE__ */ jsxs("span", {
|
|
17
|
-
className:
|
|
17
|
+
className: "textarea__counter",
|
|
18
18
|
children: [
|
|
19
19
|
"Максимум ",
|
|
20
20
|
maxLength,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.js","names":[],"sources":["../../../src/components/textarea/textarea.tsx"],"sourcesContent":["import { forwardRef, type TextareaHTMLAttributes } from 'react';\n\nimport { cn, when } from '../../lib/cn';\nimport
|
|
1
|
+
{"version":3,"file":"textarea.js","names":[],"sources":["../../../src/components/textarea/textarea.tsx"],"sourcesContent":["import { forwardRef, type TextareaHTMLAttributes } from 'react';\n\nimport { cn, when } from '../../lib/cn';\nimport './textarea.scss';\n\nexport interface TextAreaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n recommended?: boolean;\n error?: boolean;\n /** В приложении проп называется `noMaxMoty`. */\n hideCounter?: boolean;\n}\n\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n function TextArea(\n {\n maxLength,\n value = '',\n recommended,\n error,\n hideCounter = false,\n className,\n ...props\n },\n ref,\n ) {\n return (\n <div className=\"textarea__wrap\">\n <textarea\n ref={ref}\n className={cn(\n 'textarea',\n className,\n when(recommended, 'textarea--recommended'),\n when(error, 'textarea--error'),\n )}\n value={value}\n maxLength={maxLength}\n aria-invalid={error || undefined}\n {...props}\n />\n {maxLength && !hideCounter ? (\n <span className=\"textarea__counter\">\n Максимум {maxLength} символов\n </span>\n ) : null}\n </div>\n );\n },\n);\n"],"mappings":";;;;;AAYA,MAAa,WAAW,WACtB,SAAS,SACP,EACE,WACA,QAAQ,IACR,aACA,OACA,cAAc,OACd,WACA,GAAG,SAEL,KACA;CACA,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,YAAD;GACO;GACL,WAAW,GACT,YACA,WACA,KAAK,aAAa,uBAAuB,GACzC,KAAK,OAAO,iBAAiB,CAC/B;GACO;GACI;GACX,gBAAc,SAAS,KAAA;GACvB,GAAI;EACL,CAAA,GACA,aAAa,CAAC,cACb,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA;IAAoC;IACxB;IAAU;GAChB;EACJ,CAAA,IAAA,IACD;;AAET,CACF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
.textarea__wrap {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.textarea {
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
width: 100%;
|
|
8
|
+
min-height: 160px;
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
padding: 10px 15px;
|
|
12
|
+
font-size: 14px;
|
|
13
|
+
line-height: 20px;
|
|
14
|
+
background-color: transparent;
|
|
15
|
+
color: var(--color-black);
|
|
16
|
+
border-radius: var(--radius-sm);
|
|
17
|
+
resize: none;
|
|
18
|
+
font-family: var(--font-sans);
|
|
19
|
+
border: 1px solid var(--color-input);
|
|
20
|
+
outline: 1px solid transparent;
|
|
21
|
+
transition:
|
|
22
|
+
background 0.3s,
|
|
23
|
+
border-color 0.3s,
|
|
24
|
+
box-shadow 0.2s;
|
|
25
|
+
|
|
26
|
+
&:focus {
|
|
27
|
+
border-color: var(--color-black);
|
|
28
|
+
outline: 1px solid var(--color-black);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&:disabled {
|
|
32
|
+
background-color: var(--color-neutral-200);
|
|
33
|
+
border-color: var(--color-neutral-200);
|
|
34
|
+
color: color-mix(in srgb, var(--color-black) 50%, transparent);
|
|
35
|
+
fill: var(--color-neutral-500);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media (min-width: 680px) {
|
|
39
|
+
min-height: 80px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&--recommended {
|
|
43
|
+
background-color: color-mix(in srgb, var(--color-yellow) 10%, transparent);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&--error {
|
|
47
|
+
border-color: color-mix(in srgb, var(--color-red) 50%, transparent);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.textarea__counter {
|
|
52
|
+
display: block;
|
|
53
|
+
margin-top: 5px;
|
|
54
|
+
font-size: 11px;
|
|
55
|
+
line-height: 20px;
|
|
56
|
+
color: color-mix(in srgb, var(--color-black) 50%, transparent);
|
|
57
|
+
text-align: left;
|
|
58
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -5,6 +5,7 @@ const require_input = require("./components/input/input.cjs");
|
|
|
5
5
|
const require_radio = require("./components/radio/radio.cjs");
|
|
6
6
|
const require_spinner = require("./components/spinner/spinner.cjs");
|
|
7
7
|
const require_textarea = require("./components/textarea/textarea.cjs");
|
|
8
|
+
require("./styles/vars.scss");
|
|
8
9
|
exports.Button = require_button.Button;
|
|
9
10
|
exports.CheckboxInput = require_checkbox.CheckboxInput;
|
|
10
11
|
exports.Input = require_input.Input;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button, ButtonComponentProps, ButtonLinkProps, ButtonProps } from "./components/button/button.cjs";
|
|
1
|
+
import { Button, ButtonComponentProps, ButtonLinkProps, ButtonProps, ButtonSize, ButtonVariant } from "./components/button/button.cjs";
|
|
2
2
|
import "./components/button/index.cjs";
|
|
3
3
|
import { CheckboxInput, CheckboxInputProps } from "./components/checkbox/checkbox.cjs";
|
|
4
4
|
import "./components/checkbox/index.cjs";
|
|
@@ -10,4 +10,4 @@ import { Spinner, SpinnerPosition, SpinnerProps } from "./components/spinner/spi
|
|
|
10
10
|
import "./components/spinner/index.cjs";
|
|
11
11
|
import { TextArea, TextAreaProps } from "./components/textarea/textarea.cjs";
|
|
12
12
|
import "./components/textarea/index.cjs";
|
|
13
|
-
export { Button, type ButtonComponentProps, type ButtonLinkProps, type ButtonProps, CheckboxInput, type CheckboxInputProps, Input, type InputProps, RadioInput, type RadioInputProps, Spinner, type SpinnerPosition, type SpinnerProps, TextArea, type TextAreaProps };
|
|
13
|
+
export { Button, type ButtonComponentProps, type ButtonLinkProps, type ButtonProps, type ButtonSize, type ButtonVariant, CheckboxInput, type CheckboxInputProps, Input, type InputProps, RadioInput, type RadioInputProps, Spinner, type SpinnerPosition, type SpinnerProps, TextArea, type TextAreaProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button, ButtonComponentProps, ButtonLinkProps, ButtonProps } from "./components/button/button.js";
|
|
1
|
+
import { Button, ButtonComponentProps, ButtonLinkProps, ButtonProps, ButtonSize, ButtonVariant } from "./components/button/button.js";
|
|
2
2
|
import "./components/button/index.js";
|
|
3
3
|
import { CheckboxInput, CheckboxInputProps } from "./components/checkbox/checkbox.js";
|
|
4
4
|
import "./components/checkbox/index.js";
|
|
@@ -10,4 +10,4 @@ import { Spinner, SpinnerPosition, SpinnerProps } from "./components/spinner/spi
|
|
|
10
10
|
import "./components/spinner/index.js";
|
|
11
11
|
import { TextArea, TextAreaProps } from "./components/textarea/textarea.js";
|
|
12
12
|
import "./components/textarea/index.js";
|
|
13
|
-
export { Button, type ButtonComponentProps, type ButtonLinkProps, type ButtonProps, CheckboxInput, type CheckboxInputProps, Input, type InputProps, RadioInput, type RadioInputProps, Spinner, type SpinnerPosition, type SpinnerProps, TextArea, type TextAreaProps };
|
|
13
|
+
export { Button, type ButtonComponentProps, type ButtonLinkProps, type ButtonProps, type ButtonSize, type ButtonVariant, CheckboxInput, type CheckboxInputProps, Input, type InputProps, RadioInput, type RadioInputProps, Spinner, type SpinnerPosition, type SpinnerProps, TextArea, type TextAreaProps };
|
package/dist/index.js
CHANGED
|
@@ -4,4 +4,5 @@ import { Input } from "./components/input/input.js";
|
|
|
4
4
|
import { RadioInput } from "./components/radio/radio.js";
|
|
5
5
|
import { Spinner } from "./components/spinner/spinner.js";
|
|
6
6
|
import { TextArea } from "./components/textarea/textarea.js";
|
|
7
|
+
import "./styles/vars.scss";
|
|
7
8
|
export { Button, CheckboxInput, Input, RadioInput, Spinner, TextArea };
|
package/dist/lib/cn.cjs
CHANGED
|
@@ -11,13 +11,13 @@ const pushClass = (classes, value) => {
|
|
|
11
11
|
}
|
|
12
12
|
for (const key of Object.keys(value)) if (value[key]) classes.push(key);
|
|
13
13
|
};
|
|
14
|
-
/** Склейка классов. Без tailwind-merge:
|
|
14
|
+
/** Склейка классов. Без tailwind-merge: одноимённые правила решает специфичность. */
|
|
15
15
|
const cn = (...inputs) => {
|
|
16
16
|
const classes = [];
|
|
17
17
|
inputs.forEach((input) => pushClass(classes, input));
|
|
18
18
|
return classes.join(" ");
|
|
19
19
|
};
|
|
20
|
-
/**
|
|
20
|
+
/** Условный класс. Пустая строка и `undefined` в `cn` не попадают. */
|
|
21
21
|
const when = (enabled, className) => Boolean(enabled) && className ? className : false;
|
|
22
22
|
exports.cn = cn;
|
|
23
23
|
exports.when = when;
|
package/dist/lib/cn.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cn.cjs","names":[],"sources":["../../src/lib/cn.ts"],"sourcesContent":["type ClassDictionary = Record<string, boolean | null | undefined>;\ntype ClassValue =\n | string\n | number\n | null\n | undefined\n | false\n | ClassDictionary\n | ClassValue[];\n\nconst pushClass = (classes: string[], value: ClassValue): void => {\n if (!value) return;\n\n if (typeof value === 'string' || typeof value === 'number') {\n classes.push(String(value));\n return;\n }\n\n if (Array.isArray(value)) {\n value.forEach(item => pushClass(classes, item));\n return;\n }\n\n for (const key of Object.keys(value)) {\n if (value[key]) classes.push(key);\n }\n};\n\n/** Склейка классов. Без tailwind-merge:
|
|
1
|
+
{"version":3,"file":"cn.cjs","names":[],"sources":["../../src/lib/cn.ts"],"sourcesContent":["type ClassDictionary = Record<string, boolean | null | undefined>;\ntype ClassValue =\n | string\n | number\n | null\n | undefined\n | false\n | ClassDictionary\n | ClassValue[];\n\nconst pushClass = (classes: string[], value: ClassValue): void => {\n if (!value) return;\n\n if (typeof value === 'string' || typeof value === 'number') {\n classes.push(String(value));\n return;\n }\n\n if (Array.isArray(value)) {\n value.forEach(item => pushClass(classes, item));\n return;\n }\n\n for (const key of Object.keys(value)) {\n if (value[key]) classes.push(key);\n }\n};\n\n/** Склейка классов. Без tailwind-merge: одноимённые правила решает специфичность. */\nexport const cn = (...inputs: ClassValue[]): string => {\n const classes: string[] = [];\n inputs.forEach(input => pushClass(classes, input));\n return classes.join(' ');\n};\n\n/** Условный класс. Пустая строка и `undefined` в `cn` не попадают. */\nexport const when = (\n enabled: boolean | undefined,\n className: string | undefined,\n): string | false => (Boolean(enabled) && className ? className : false);\n"],"mappings":";AAUA,MAAM,aAAa,SAAmB,UAA4B;CAChE,IAAI,CAAC,OAAO;CAEZ,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,UAAU;EAC1D,QAAQ,KAAK,OAAO,KAAK,CAAC;EAC1B;CACF;CAEA,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,MAAM,SAAQ,SAAQ,UAAU,SAAS,IAAI,CAAC;EAC9C;CACF;CAEA,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GACjC,IAAI,MAAM,MAAM,QAAQ,KAAK,GAAG;AAEpC;;AAGA,MAAa,MAAM,GAAG,WAAiC;CACrD,MAAM,UAAoB,CAAC;CAC3B,OAAO,SAAQ,UAAS,UAAU,SAAS,KAAK,CAAC;CACjD,OAAO,QAAQ,KAAK,GAAG;AACzB;;AAGA,MAAa,QACX,SACA,cACoB,QAAQ,OAAO,KAAK,YAAY,YAAY"}
|
package/dist/lib/cn.js
CHANGED
|
@@ -11,13 +11,13 @@ const pushClass = (classes, value) => {
|
|
|
11
11
|
}
|
|
12
12
|
for (const key of Object.keys(value)) if (value[key]) classes.push(key);
|
|
13
13
|
};
|
|
14
|
-
/** Склейка классов. Без tailwind-merge:
|
|
14
|
+
/** Склейка классов. Без tailwind-merge: одноимённые правила решает специфичность. */
|
|
15
15
|
const cn = (...inputs) => {
|
|
16
16
|
const classes = [];
|
|
17
17
|
inputs.forEach((input) => pushClass(classes, input));
|
|
18
18
|
return classes.join(" ");
|
|
19
19
|
};
|
|
20
|
-
/**
|
|
20
|
+
/** Условный класс. Пустая строка и `undefined` в `cn` не попадают. */
|
|
21
21
|
const when = (enabled, className) => Boolean(enabled) && className ? className : false;
|
|
22
22
|
export { cn, when };
|
|
23
23
|
|
package/dist/lib/cn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cn.js","names":[],"sources":["../../src/lib/cn.ts"],"sourcesContent":["type ClassDictionary = Record<string, boolean | null | undefined>;\ntype ClassValue =\n | string\n | number\n | null\n | undefined\n | false\n | ClassDictionary\n | ClassValue[];\n\nconst pushClass = (classes: string[], value: ClassValue): void => {\n if (!value) return;\n\n if (typeof value === 'string' || typeof value === 'number') {\n classes.push(String(value));\n return;\n }\n\n if (Array.isArray(value)) {\n value.forEach(item => pushClass(classes, item));\n return;\n }\n\n for (const key of Object.keys(value)) {\n if (value[key]) classes.push(key);\n }\n};\n\n/** Склейка классов. Без tailwind-merge:
|
|
1
|
+
{"version":3,"file":"cn.js","names":[],"sources":["../../src/lib/cn.ts"],"sourcesContent":["type ClassDictionary = Record<string, boolean | null | undefined>;\ntype ClassValue =\n | string\n | number\n | null\n | undefined\n | false\n | ClassDictionary\n | ClassValue[];\n\nconst pushClass = (classes: string[], value: ClassValue): void => {\n if (!value) return;\n\n if (typeof value === 'string' || typeof value === 'number') {\n classes.push(String(value));\n return;\n }\n\n if (Array.isArray(value)) {\n value.forEach(item => pushClass(classes, item));\n return;\n }\n\n for (const key of Object.keys(value)) {\n if (value[key]) classes.push(key);\n }\n};\n\n/** Склейка классов. Без tailwind-merge: одноимённые правила решает специфичность. */\nexport const cn = (...inputs: ClassValue[]): string => {\n const classes: string[] = [];\n inputs.forEach(input => pushClass(classes, input));\n return classes.join(' ');\n};\n\n/** Условный класс. Пустая строка и `undefined` в `cn` не попадают. */\nexport const when = (\n enabled: boolean | undefined,\n className: string | undefined,\n): string | false => (Boolean(enabled) && className ? className : false);\n"],"mappings":";AAUA,MAAM,aAAa,SAAmB,UAA4B;CAChE,IAAI,CAAC,OAAO;CAEZ,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,UAAU;EAC1D,QAAQ,KAAK,OAAO,KAAK,CAAC;EAC1B;CACF;CAEA,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,MAAM,SAAQ,SAAQ,UAAU,SAAS,IAAI,CAAC;EAC9C;CACF;CAEA,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GACjC,IAAI,MAAM,MAAM,QAAQ,KAAK,GAAG;AAEpC;;AAGA,MAAa,MAAM,GAAG,WAAiC;CACrD,MAAM,UAAoB,CAAC;CAC3B,OAAO,SAAQ,UAAS,UAAU,SAAS,KAAK,CAAC;CACjD,OAAO,QAAQ,KAAK,GAAG;AACzB;;AAGA,MAAa,QACX,SACA,cACoB,QAAQ,OAAO,KAAK,YAAY,YAAY"}
|
package/dist/styles/global.scss
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// База приложения. Шрифт Inter подключает хост — файлы лежат в splittest-frontend/src/app/fonts.
|
|
2
|
-
|
|
2
|
+
// Токены (`--color-*`) подключает вход пакета, этот файл их не эмитит.
|
|
3
3
|
|
|
4
4
|
:root {
|
|
5
5
|
--pink: #ff00ff;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
--window-max-height: 100vh;
|
|
8
8
|
--wrapper-padding: 20px;
|
|
9
9
|
|
|
10
|
-
@media (min-width:
|
|
10
|
+
@media (min-width: 680px) {
|
|
11
11
|
--wrapper-padding: 30px;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -32,19 +32,19 @@ body {
|
|
|
32
32
|
display: flex;
|
|
33
33
|
flex-direction: column;
|
|
34
34
|
margin: 0;
|
|
35
|
-
font-family:
|
|
35
|
+
font-family: var(--font-sans);
|
|
36
36
|
-webkit-font-smoothing: antialiased;
|
|
37
37
|
-moz-osx-font-smoothing: grayscale;
|
|
38
|
-
color:
|
|
39
|
-
background-color:
|
|
40
|
-
font-size:
|
|
38
|
+
color: var(--color-black);
|
|
39
|
+
background-color: var(--color-white);
|
|
40
|
+
font-size: var(--text-sm);
|
|
41
41
|
line-height: 20px;
|
|
42
42
|
font-weight: 400;
|
|
43
43
|
|
|
44
44
|
&::after {
|
|
45
45
|
content: '';
|
|
46
46
|
display: block;
|
|
47
|
-
background-color:
|
|
47
|
+
background-color: color-mix(in srgb, var(--color-black) 30%, transparent);
|
|
48
48
|
position: fixed;
|
|
49
49
|
left: 0;
|
|
50
50
|
top: 0;
|
|
@@ -91,11 +91,11 @@ body {
|
|
|
91
91
|
padding-left: var(--wrapper-padding);
|
|
92
92
|
padding-right: var(--wrapper-padding);
|
|
93
93
|
|
|
94
|
-
@media (min-width:
|
|
94
|
+
@media (min-width: 680px) {
|
|
95
95
|
max-width: 680px;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
@media (min-width:
|
|
98
|
+
@media (min-width: 1000px) {
|
|
99
99
|
max-width: 1000px;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -115,13 +115,13 @@ body {
|
|
|
115
115
|
a {
|
|
116
116
|
text-decoration: none;
|
|
117
117
|
transition: color 0.3s ease;
|
|
118
|
-
color:
|
|
118
|
+
color: var(--color-black);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
button {
|
|
122
|
-
color:
|
|
123
|
-
font-size:
|
|
124
|
-
font-family:
|
|
122
|
+
color: var(--color-black);
|
|
123
|
+
font-size: var(--text-sm);
|
|
124
|
+
font-family: var(--font-sans);
|
|
125
125
|
|
|
126
126
|
&:not(:disabled) {
|
|
127
127
|
cursor: pointer;
|
|
@@ -144,16 +144,16 @@ table {
|
|
|
144
144
|
|
|
145
145
|
td {
|
|
146
146
|
word-break: break-word;
|
|
147
|
-
border-top: 1px solid
|
|
147
|
+
border-top: 1px solid var(--color-border);
|
|
148
148
|
padding: 15px 0;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
tr:last-of-type td {
|
|
152
|
-
border-bottom: 1px solid
|
|
152
|
+
border-bottom: 1px solid var(--color-border);
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
th {
|
|
156
|
-
color:
|
|
156
|
+
color: color-mix(in srgb, var(--color-black) 50%, transparent);
|
|
157
157
|
font-size: 11px;
|
|
158
158
|
line-height: 15px;
|
|
159
159
|
text-align: left;
|
|
@@ -173,7 +173,7 @@ h1 {
|
|
|
173
173
|
font-size: 28px;
|
|
174
174
|
line-height: 30px;
|
|
175
175
|
|
|
176
|
-
@media (min-width:
|
|
176
|
+
@media (min-width: 680px) {
|
|
177
177
|
font-size: 45px;
|
|
178
178
|
line-height: 50px;
|
|
179
179
|
}
|