@de-kit/st-ui 0.1.0 → 0.1.1
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 +8 -8
- package/dist/components/button/button.cjs +2 -4
- package/dist/components/button/button.cjs.map +1 -1
- package/dist/components/button/button.js +2 -2
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/button/button.scss +93 -0
- 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.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
package/README.md
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
# @de-kit/st-ui
|
|
2
2
|
|
|
3
|
-
React-компоненты splittest. Стили
|
|
3
|
+
React-компоненты splittest. Стили едут вместе с компонентом (глобальный SCSS, не CSS-модули). Токены скопированы из `splittest-frontend/src/app/styles`. Tailwind нет.
|
|
4
4
|
|
|
5
5
|
## Подключение
|
|
6
6
|
|
|
7
|
-
В CRA
|
|
7
|
+
В CRA и в Vite отдельный импорт CSS не нужен — `import './button.scss'` сидит внутри компонента:
|
|
8
8
|
|
|
9
9
|
```tsx
|
|
10
|
-
import '@de-kit/st-ui/global.scss';
|
|
11
10
|
import {
|
|
12
11
|
Button,
|
|
13
12
|
Input,
|
|
@@ -20,14 +19,15 @@ import {
|
|
|
20
19
|
|
|
21
20
|
`global.scss` — база приложения (body, заголовки, таблицы, `.wrapper`). В чужой странице его не подключать. Шрифт Inter библиотека не везёт, его по-прежнему грузит фронтенд.
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
Токены подключаются один раз вместе с пакетом (`import './styles/vars.scss'` в `src/index.ts`). В своих scss это обычные `var()`, `@use` не нужен. `@use '@de-kit/st-ui/vars.scss'` — только если стили собираются без JS. Миксины отдельно:
|
|
24
23
|
|
|
25
24
|
```scss
|
|
26
|
-
@
|
|
27
|
-
@import '@de-kit/st-ui/mixins.scss';
|
|
25
|
+
@use '@de-kit/st-ui/mixins.scss' as mixins;
|
|
28
26
|
```
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
`var(--color-black)`, `var(--font-sans)`, `var(--radius-sm)`, `var(--breakpoint-md)`. Имена как у Tailwind, значения splittest.
|
|
29
|
+
|
|
30
|
+
Компонентный scss собирает sass хоста. Класс в DOM буквальный: `button`, `input`, `checkbox`, `radio`, `textarea`, `spinner`. Корень и модификаторы одинарные (`.button`, `.button--outline`). Внутренние элементы — BEM: `checkbox__input`, `textarea__counter`.
|
|
31
31
|
|
|
32
32
|
## Кнопка
|
|
33
33
|
|
|
@@ -70,5 +70,5 @@ import {
|
|
|
70
70
|
pnpm install
|
|
71
71
|
pnpm dev # Storybook, :6006
|
|
72
72
|
pnpm test
|
|
73
|
-
pnpm build # dist: js + d.ts + scss рядом с
|
|
73
|
+
pnpm build # dist: js + d.ts + scss рядом с компонентами
|
|
74
74
|
```
|
|
@@ -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 = require("react");
|
|
4
|
-
|
|
5
|
-
src_components_button_button_module_scss = require_runtime.__toESM(src_components_button_button_module_scss, 1);
|
|
3
|
+
require("./button.scss");
|
|
6
4
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
5
|
// src/components/button/button.tsx
|
|
8
6
|
const styleKeys = [
|
|
@@ -12,7 +10,7 @@ const styleKeys = [
|
|
|
12
10
|
"link",
|
|
13
11
|
"className"
|
|
14
12
|
];
|
|
15
|
-
const getClassName = ({ withIcon = true, outline, className, fullWidth = false, link = false, disabled }) => require_cn.cn(
|
|
13
|
+
const getClassName = ({ withIcon = true, outline, className, fullWidth = false, link = false, disabled }) => require_cn.cn("button", className, require_cn.when(outline, "button--outline"), require_cn.when(withIcon, "button--with-icon"), require_cn.when(fullWidth, "button--full-width"), require_cn.when(link, "button--link"), require_cn.when(disabled, "button--disabled"));
|
|
16
14
|
const omitStyleProps = (props) => {
|
|
17
15
|
const next = {};
|
|
18
16
|
const skipped = new Set(styleKeys);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.cjs","names":["cn","
|
|
1
|
+
{"version":3,"file":"button.cjs","names":["cn","when","forwardRef"],"sources":["../../../src/components/button/button.tsx"],"sourcesContent":["import {\n forwardRef,\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type MouseEventHandler,\n type ReactNode,\n type Ref,\n} from 'react';\n\nimport { cn, when } from '../../lib/cn';\nimport './button.scss';\n\ninterface ButtonStyleProps {\n outline?: boolean;\n /** В приложении по умолчанию true: левый паддинг под иконку. */\n withIcon?: boolean;\n fullWidth?: boolean;\n /** Визуальный вес ссылки (font-weight: 400), не тип элемента. */\n link?: boolean;\n className?: string;\n children?: ReactNode;\n}\n\nexport interface ButtonProps\n extends ButtonHTMLAttributes<HTMLButtonElement>, ButtonStyleProps {\n href?: undefined;\n}\n\nexport interface ButtonLinkProps\n extends\n Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>,\n ButtonStyleProps {\n href: string;\n}\n\nexport type ButtonComponentProps = ButtonProps | ButtonLinkProps;\n\nconst styleKeys = [\n 'outline',\n 'withIcon',\n 'fullWidth',\n 'link',\n 'className',\n] as const;\n\nconst getClassName = ({\n withIcon = true,\n outline,\n className,\n fullWidth = false,\n link = false,\n disabled,\n}: ButtonStyleProps & { disabled?: boolean }) =>\n cn(\n 'button',\n className,\n when(outline, 'button--outline'),\n when(withIcon, 'button--with-icon'),\n when(fullWidth, 'button--full-width'),\n when(link, 'button--link'),\n when(disabled, 'button--disabled'),\n );\n\nconst omitStyleProps = <T extends ButtonStyleProps>(\n props: T,\n): Omit<T, (typeof styleKeys)[number]> => {\n const next: Record<string, unknown> = {};\n const skipped = new Set<string>(styleKeys);\n\n for (const [key, value] of Object.entries(props)) {\n if (!skipped.has(key)) next[key] = value;\n }\n\n return next as Omit<T, (typeof styleKeys)[number]>;\n};\n\nexport const Button = forwardRef<\n HTMLButtonElement | HTMLAnchorElement,\n ButtonComponentProps\n>(function Button(props, ref) {\n const className = getClassName(props);\n const { children, href, ...domProps } = omitStyleProps(props);\n\n if (typeof href === 'string') {\n return (\n <a\n ref={ref as Ref<HTMLAnchorElement>}\n href={href}\n className={className}\n {...(domProps as AnchorHTMLAttributes<HTMLAnchorElement>)}\n >\n {children}\n </a>\n );\n }\n\n const {\n type = 'button',\n disabled,\n onClick,\n ...buttonProps\n } = domProps as ButtonHTMLAttributes<HTMLButtonElement>;\n\n const handleClick: MouseEventHandler<HTMLButtonElement> = event => {\n if (disabled) return;\n onClick?.(event);\n };\n\n return (\n <button\n ref={ref as Ref<HTMLButtonElement>}\n className={className}\n type={type}\n disabled={disabled}\n onClick={handleClick}\n {...buttonProps}\n >\n {children}\n </button>\n );\n});\n"],"mappings":";;;;;AAqCA,MAAM,YAAY;CAChB;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,gBAAgB,EACpB,WAAW,MACX,SACA,WACA,YAAY,OACZ,OAAO,OACP,eAEAA,WAAAA,GACE,UACA,WACAC,WAAAA,KAAK,SAAS,iBAAiB,GAC/BA,WAAAA,KAAK,UAAU,mBAAmB,GAClCA,WAAAA,KAAK,WAAW,oBAAoB,GACpCA,WAAAA,KAAK,MAAM,cAAc,GACzBA,WAAAA,KAAK,UAAU,kBAAkB,CACnC;AAEF,MAAM,kBACJ,UACwC;CACxC,MAAM,OAAgC,CAAC;CACvC,MAAM,UAAU,IAAI,IAAY,SAAS;CAEzC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAC7C,IAAI,CAAC,QAAQ,IAAI,GAAG,GAAG,KAAK,OAAO;CAGrC,OAAO;AACT;AAEA,MAAa,UAAA,GAASC,MAAAA,WAAAA,CAGpB,SAAS,OAAO,OAAO,KAAK;CAC5B,MAAM,YAAY,aAAa,KAAK;CACpC,MAAM,EAAE,UAAU,MAAM,GAAG,aAAa,eAAe,KAAK;CAE5D,IAAI,OAAO,SAAS,UAClB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;EACO;EACC;EACK;EACX,GAAK;EAEJ;CACA,CAAA;CAIP,MAAM,EACJ,OAAO,UACP,UACA,SACA,GAAG,gBACD;CAEJ,MAAM,eAAoD,UAAS;EACjE,IAAI,UAAU;EACd,UAAU,KAAK;CACjB;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;EACO;EACM;EACL;EACI;EACV,SAAS;EACT,GAAI;EAEH;CACK,CAAA;AAEZ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cn, when } from "../../lib/cn.js";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import
|
|
3
|
+
import "./button.scss";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
// src/components/button/button.tsx
|
|
6
6
|
const styleKeys = [
|
|
@@ -10,7 +10,7 @@ const styleKeys = [
|
|
|
10
10
|
"link",
|
|
11
11
|
"className"
|
|
12
12
|
];
|
|
13
|
-
const getClassName = ({ withIcon = true, outline, className, fullWidth = false, link = false, disabled }) => cn(
|
|
13
|
+
const getClassName = ({ withIcon = true, outline, className, fullWidth = false, link = false, disabled }) => cn("button", className, when(outline, "button--outline"), when(withIcon, "button--with-icon"), when(fullWidth, "button--full-width"), when(link, "button--link"), when(disabled, "button--disabled"));
|
|
14
14
|
const omitStyleProps = (props) => {
|
|
15
15
|
const next = {};
|
|
16
16
|
const skipped = new Set(styleKeys);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","names":[],"sources":["../../../src/components/button/button.tsx"],"sourcesContent":["import {\n forwardRef,\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type MouseEventHandler,\n type ReactNode,\n type Ref,\n} from 'react';\n\nimport { cn, when } from '../../lib/cn';\nimport
|
|
1
|
+
{"version":3,"file":"button.js","names":[],"sources":["../../../src/components/button/button.tsx"],"sourcesContent":["import {\n forwardRef,\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type MouseEventHandler,\n type ReactNode,\n type Ref,\n} from 'react';\n\nimport { cn, when } from '../../lib/cn';\nimport './button.scss';\n\ninterface ButtonStyleProps {\n outline?: boolean;\n /** В приложении по умолчанию true: левый паддинг под иконку. */\n withIcon?: boolean;\n fullWidth?: boolean;\n /** Визуальный вес ссылки (font-weight: 400), не тип элемента. */\n link?: boolean;\n className?: string;\n children?: ReactNode;\n}\n\nexport interface ButtonProps\n extends ButtonHTMLAttributes<HTMLButtonElement>, ButtonStyleProps {\n href?: undefined;\n}\n\nexport interface ButtonLinkProps\n extends\n Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>,\n ButtonStyleProps {\n href: string;\n}\n\nexport type ButtonComponentProps = ButtonProps | ButtonLinkProps;\n\nconst styleKeys = [\n 'outline',\n 'withIcon',\n 'fullWidth',\n 'link',\n 'className',\n] as const;\n\nconst getClassName = ({\n withIcon = true,\n outline,\n className,\n fullWidth = false,\n link = false,\n disabled,\n}: ButtonStyleProps & { disabled?: boolean }) =>\n cn(\n 'button',\n className,\n when(outline, 'button--outline'),\n when(withIcon, 'button--with-icon'),\n when(fullWidth, 'button--full-width'),\n when(link, 'button--link'),\n when(disabled, 'button--disabled'),\n );\n\nconst omitStyleProps = <T extends ButtonStyleProps>(\n props: T,\n): Omit<T, (typeof styleKeys)[number]> => {\n const next: Record<string, unknown> = {};\n const skipped = new Set<string>(styleKeys);\n\n for (const [key, value] of Object.entries(props)) {\n if (!skipped.has(key)) next[key] = value;\n }\n\n return next as Omit<T, (typeof styleKeys)[number]>;\n};\n\nexport const Button = forwardRef<\n HTMLButtonElement | HTMLAnchorElement,\n ButtonComponentProps\n>(function Button(props, ref) {\n const className = getClassName(props);\n const { children, href, ...domProps } = omitStyleProps(props);\n\n if (typeof href === 'string') {\n return (\n <a\n ref={ref as Ref<HTMLAnchorElement>}\n href={href}\n className={className}\n {...(domProps as AnchorHTMLAttributes<HTMLAnchorElement>)}\n >\n {children}\n </a>\n );\n }\n\n const {\n type = 'button',\n disabled,\n onClick,\n ...buttonProps\n } = domProps as ButtonHTMLAttributes<HTMLButtonElement>;\n\n const handleClick: MouseEventHandler<HTMLButtonElement> = event => {\n if (disabled) return;\n onClick?.(event);\n };\n\n return (\n <button\n ref={ref as Ref<HTMLButtonElement>}\n className={className}\n type={type}\n disabled={disabled}\n onClick={handleClick}\n {...buttonProps}\n >\n {children}\n </button>\n );\n});\n"],"mappings":";;;;;AAqCA,MAAM,YAAY;CAChB;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,gBAAgB,EACpB,WAAW,MACX,SACA,WACA,YAAY,OACZ,OAAO,OACP,eAEA,GACE,UACA,WACA,KAAK,SAAS,iBAAiB,GAC/B,KAAK,UAAU,mBAAmB,GAClC,KAAK,WAAW,oBAAoB,GACpC,KAAK,MAAM,cAAc,GACzB,KAAK,UAAU,kBAAkB,CACnC;AAEF,MAAM,kBACJ,UACwC;CACxC,MAAM,OAAgC,CAAC;CACvC,MAAM,UAAU,IAAI,IAAY,SAAS;CAEzC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAC7C,IAAI,CAAC,QAAQ,IAAI,GAAG,GAAG,KAAK,OAAO;CAGrC,OAAO;AACT;AAEA,MAAa,SAAS,WAGpB,SAAS,OAAO,OAAO,KAAK;CAC5B,MAAM,YAAY,aAAa,KAAK;CACpC,MAAM,EAAE,UAAU,MAAM,GAAG,aAAa,eAAe,KAAK;CAE5D,IAAI,OAAO,SAAS,UAClB,OACE,oBAAC,KAAD;EACO;EACC;EACK;EACX,GAAK;EAEJ;CACA,CAAA;CAIP,MAAM,EACJ,OAAO,UACP,UACA,SACA,GAAG,gBACD;CAEJ,MAAM,eAAoD,UAAS;EACjE,IAAI,UAAU;EACd,UAAU,KAAK;CACjB;CAEA,OACE,oBAAC,UAAD;EACO;EACM;EACL;EACI;EACV,SAAS;EACT,GAAI;EAEH;CACK,CAAA;AAEZ,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
.button {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
width: fit-content;
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
padding: 10px 18px;
|
|
7
|
+
border-radius: 30px;
|
|
8
|
+
font-size: 14px;
|
|
9
|
+
line-height: 20px;
|
|
10
|
+
background-color: var(--color-black);
|
|
11
|
+
color: var(--color-white);
|
|
12
|
+
fill: var(--color-white);
|
|
13
|
+
font-weight: bold;
|
|
14
|
+
font-family: var(--font-sans);
|
|
15
|
+
border: 2px solid var(--color-black);
|
|
16
|
+
flex-shrink: 0;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
transition: none;
|
|
19
|
+
gap: 5px;
|
|
20
|
+
text-decoration: none;
|
|
21
|
+
|
|
22
|
+
&:active {
|
|
23
|
+
background-color: var(--color-neutral-200);
|
|
24
|
+
color: var(--color-neutral-500);
|
|
25
|
+
fill: var(--color-neutral-500);
|
|
26
|
+
border-color: var(--color-neutral-200);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&:disabled {
|
|
30
|
+
background-color: var(--color-neutral-200);
|
|
31
|
+
color: var(--color-neutral-500);
|
|
32
|
+
fill: var(--color-neutral-500);
|
|
33
|
+
border-color: var(--color-neutral-200);
|
|
34
|
+
cursor: default;
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
user-select: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&--outline {
|
|
40
|
+
background-color: transparent;
|
|
41
|
+
color: var(--color-black);
|
|
42
|
+
fill: var(--color-black);
|
|
43
|
+
max-height: 40px;
|
|
44
|
+
border: 2px solid var(--color-black);
|
|
45
|
+
|
|
46
|
+
&:disabled {
|
|
47
|
+
background-color: transparent;
|
|
48
|
+
border: 2px solid var(--color-black);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&--full-width {
|
|
53
|
+
width: 100%;
|
|
54
|
+
text-align: center;
|
|
55
|
+
justify-content: center;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&--with-icon {
|
|
59
|
+
padding: 8px 18px 8px 14px;
|
|
60
|
+
gap: 5px;
|
|
61
|
+
text-align: left;
|
|
62
|
+
|
|
63
|
+
.icon {
|
|
64
|
+
flex-shrink: 0;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&--link {
|
|
69
|
+
border: none;
|
|
70
|
+
background-color: transparent;
|
|
71
|
+
color: var(--color-black);
|
|
72
|
+
fill: var(--color-black);
|
|
73
|
+
border-radius: 0;
|
|
74
|
+
padding: 0;
|
|
75
|
+
|
|
76
|
+
&:active,
|
|
77
|
+
&:disabled {
|
|
78
|
+
background-color: transparent;
|
|
79
|
+
color: rgba(0, 0, 0, 0.5);
|
|
80
|
+
fill: rgba(0, 0, 0, 0.5);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&--disabled {
|
|
85
|
+
background-color: var(--color-neutral-200);
|
|
86
|
+
color: var(--color-neutral-500);
|
|
87
|
+
fill: var(--color-neutral-500);
|
|
88
|
+
border-color: var(--color-neutral-200);
|
|
89
|
+
cursor: default;
|
|
90
|
+
pointer-events: none;
|
|
91
|
+
user-select: none;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -1,24 +1,22 @@
|
|
|
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_checkbox_checkbox_module_scss = require_runtime.__toESM(src_components_checkbox_checkbox_module_scss, 1);
|
|
4
|
+
require("./checkbox.scss");
|
|
7
5
|
// src/components/checkbox/checkbox.tsx
|
|
8
6
|
const CheckboxInput = (0, react.forwardRef)(function CheckboxInput({ className, id, title, hide, disabled, withCursor = true, ...props }, ref) {
|
|
9
7
|
const autoId = (0, react.useId)();
|
|
10
8
|
const inputId = id ?? autoId;
|
|
11
9
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12
|
-
className: require_cn.cn(
|
|
10
|
+
className: require_cn.cn("checkbox", className, require_cn.when(hide, "checkbox--hide")),
|
|
13
11
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
14
12
|
ref,
|
|
15
13
|
type: "checkbox",
|
|
16
14
|
id: inputId,
|
|
17
15
|
disabled,
|
|
18
|
-
className: require_cn.cn(
|
|
16
|
+
className: require_cn.cn("checkbox__input", require_cn.when(!withCursor, "checkbox__input--no-events")),
|
|
19
17
|
...props
|
|
20
18
|
}), title ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
21
|
-
className:
|
|
19
|
+
className: "checkbox__label",
|
|
22
20
|
htmlFor: inputId,
|
|
23
21
|
children: title.replaceAll("-", "–")
|
|
24
22
|
}) : null]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.cjs","names":["forwardRef","useId","cn","
|
|
1
|
+
{"version":3,"file":"checkbox.cjs","names":["forwardRef","useId","cn","when"],"sources":["../../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import { forwardRef, useId, type InputHTMLAttributes } from 'react';\n\nimport { cn, when } from '../../lib/cn';\nimport './checkbox.scss';\n\nexport interface CheckboxInputProps extends InputHTMLAttributes<HTMLInputElement> {\n title?: string;\n hide?: boolean;\n withCursor?: boolean;\n}\n\nexport const CheckboxInput = forwardRef<HTMLInputElement, CheckboxInputProps>(\n function CheckboxInput(\n { className, id, title, hide, disabled, withCursor = true, ...props },\n ref,\n ) {\n const autoId = useId();\n const inputId = id ?? autoId;\n\n return (\n <div className={cn('checkbox', className, when(hide, 'checkbox--hide'))}>\n <input\n ref={ref}\n type=\"checkbox\"\n id={inputId}\n disabled={disabled}\n className={cn(\n 'checkbox__input',\n when(!withCursor, 'checkbox__input--no-events'),\n )}\n {...props}\n />\n {title ? (\n <label className=\"checkbox__label\" htmlFor={inputId}>\n {title.replaceAll('-', '–')}\n </label>\n ) : null}\n </div>\n );\n },\n);\n"],"mappings":";;;;;AAWA,MAAa,iBAAA,GAAgBA,MAAAA,WAAAA,CAC3B,SAAS,cACP,EAAE,WAAW,IAAI,OAAO,MAAM,UAAU,aAAa,MAAM,GAAG,SAC9D,KACA;CACA,MAAM,UAAA,GAASC,MAAAA,MAAAA,CAAM;CACrB,MAAM,UAAU,MAAM;CAEtB,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAWC,WAAAA,GAAG,YAAY,WAAWC,WAAAA,KAAK,MAAM,gBAAgB,CAAC;EAAtE,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAD;GACO;GACL,MAAK;GACL,IAAI;GACM;GACV,WAAWD,WAAAA,GACT,mBACAC,WAAAA,KAAK,CAAC,YAAY,4BAA4B,CAChD;GACA,GAAI;EACL,CAAA,GACA,QACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAD;GAAO,WAAU;GAAkB,SAAS;GACzC,UAAA,MAAM,WAAW,KAAK,GAAG;EACrB,CAAA,IACL,IACD;;AAET,CACF"}
|
|
@@ -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 "./checkbox.scss";
|
|
5
5
|
// src/components/checkbox/checkbox.tsx
|
|
6
6
|
const CheckboxInput = forwardRef(function CheckboxInput({ className, id, title, hide, disabled, withCursor = true, ...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("checkbox", className, when(hide, "checkbox--hide")),
|
|
11
11
|
children: [/* @__PURE__ */ jsx("input", {
|
|
12
12
|
ref,
|
|
13
13
|
type: "checkbox",
|
|
14
14
|
id: inputId,
|
|
15
15
|
disabled,
|
|
16
|
-
className: cn(
|
|
16
|
+
className: cn("checkbox__input", when(!withCursor, "checkbox__input--no-events")),
|
|
17
17
|
...props
|
|
18
18
|
}), title ? /* @__PURE__ */ jsx("label", {
|
|
19
|
-
className:
|
|
19
|
+
className: "checkbox__label",
|
|
20
20
|
htmlFor: inputId,
|
|
21
21
|
children: title.replaceAll("-", "–")
|
|
22
22
|
}) : null]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","names":[],"sources":["../../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import { forwardRef, useId, type InputHTMLAttributes } from 'react';\n\nimport { cn, when } from '../../lib/cn';\nimport
|
|
1
|
+
{"version":3,"file":"checkbox.js","names":[],"sources":["../../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import { forwardRef, useId, type InputHTMLAttributes } from 'react';\n\nimport { cn, when } from '../../lib/cn';\nimport './checkbox.scss';\n\nexport interface CheckboxInputProps extends InputHTMLAttributes<HTMLInputElement> {\n title?: string;\n hide?: boolean;\n withCursor?: boolean;\n}\n\nexport const CheckboxInput = forwardRef<HTMLInputElement, CheckboxInputProps>(\n function CheckboxInput(\n { className, id, title, hide, disabled, withCursor = true, ...props },\n ref,\n ) {\n const autoId = useId();\n const inputId = id ?? autoId;\n\n return (\n <div className={cn('checkbox', className, when(hide, 'checkbox--hide'))}>\n <input\n ref={ref}\n type=\"checkbox\"\n id={inputId}\n disabled={disabled}\n className={cn(\n 'checkbox__input',\n when(!withCursor, 'checkbox__input--no-events'),\n )}\n {...props}\n />\n {title ? (\n <label className=\"checkbox__label\" htmlFor={inputId}>\n {title.replaceAll('-', '–')}\n </label>\n ) : null}\n </div>\n );\n },\n);\n"],"mappings":";;;;;AAWA,MAAa,gBAAgB,WAC3B,SAAS,cACP,EAAE,WAAW,IAAI,OAAO,MAAM,UAAU,aAAa,MAAM,GAAG,SAC9D,KACA;CACA,MAAM,SAAS,MAAM;CACrB,MAAM,UAAU,MAAM;CAEtB,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,YAAY,WAAW,KAAK,MAAM,gBAAgB,CAAC;EAAtE,UAAA,CACE,oBAAC,SAAD;GACO;GACL,MAAK;GACL,IAAI;GACM;GACV,WAAW,GACT,mBACA,KAAK,CAAC,YAAY,4BAA4B,CAChD;GACA,GAAI;EACL,CAAA,GACA,QACC,oBAAC,SAAD;GAAO,WAAU;GAAkB,SAAS;GACzC,UAAA,MAAM,WAAW,KAAK,GAAG;EACrB,CAAA,IACL,IACD;;AAET,CACF"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
@import '../../styles/vars.scss';
|
|
2
|
-
|
|
3
1
|
@function get-check-icon($color: 'fff') {
|
|
4
2
|
@return url("data:image/svg+xml,%3Csvg fill='%23#{$color}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' width='20px' height='20px'%3E%3Cpath d='M15.71,6.29c-0.39-0.39-1.02-0.39-1.41,0c-0.31,0.31-3.76,3.76-5.29,5.29c-0.81-0.81-2.01-2.01-2.29-2.29c-0.39-0.39-1.02-0.39-1.41,0c-0.39,0.39-0.39,1.02,0,1.41c0.39,0.39,2.61,2.61,3,3c0.39,0.39,1.02,0.39,1.41,0c0.39-0.39,5.61-5.61,6-6C16.1,7.32,16.1,6.68,15.71,6.29z'/%3E%3C/svg%3E");
|
|
5
3
|
}
|
|
@@ -7,13 +5,13 @@
|
|
|
7
5
|
.checkbox {
|
|
8
6
|
display: flex;
|
|
9
7
|
align-items: flex-start;
|
|
10
|
-
}
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
&--hide {
|
|
10
|
+
display: none;
|
|
11
|
+
}
|
|
14
12
|
}
|
|
15
13
|
|
|
16
|
-
.
|
|
14
|
+
.checkbox__label {
|
|
17
15
|
font-size: 14px;
|
|
18
16
|
line-height: 20px;
|
|
19
17
|
display: inline-block;
|
|
@@ -23,7 +21,7 @@
|
|
|
23
21
|
cursor: pointer;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
.
|
|
24
|
+
.checkbox__input {
|
|
27
25
|
--active: #000;
|
|
28
26
|
--active-inner: #fff;
|
|
29
27
|
--border: #e5e5e5;
|
|
@@ -65,7 +63,7 @@
|
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
&:required:not(:hover):not(:checked):not(:disabled) {
|
|
68
|
-
border: 1px solid
|
|
66
|
+
border: 1px solid var(--color-red);
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
&:checked {
|
|
@@ -98,13 +96,13 @@
|
|
|
98
96
|
}
|
|
99
97
|
}
|
|
100
98
|
|
|
101
|
-
& + .
|
|
102
|
-
color:
|
|
99
|
+
& + .checkbox__label {
|
|
100
|
+
color: var(--color-gray);
|
|
103
101
|
cursor: not-allowed;
|
|
104
102
|
}
|
|
105
103
|
}
|
|
106
|
-
}
|
|
107
104
|
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
&--no-events {
|
|
106
|
+
pointer-events: none;
|
|
107
|
+
}
|
|
110
108
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
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_input_input_module_scss = require_runtime.__toESM(src_components_input_input_module_scss, 1);
|
|
4
|
+
require("./input.scss");
|
|
7
5
|
// src/components/input/input.tsx
|
|
8
6
|
const Input = (0, react.forwardRef)(function Input({ type = "text", recommended, error, className, disabled, ...props }, ref) {
|
|
9
7
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
@@ -11,7 +9,7 @@ const Input = (0, react.forwardRef)(function Input({ type = "text", recommended,
|
|
|
11
9
|
type,
|
|
12
10
|
disabled,
|
|
13
11
|
"aria-invalid": error || void 0,
|
|
14
|
-
className: require_cn.cn(
|
|
12
|
+
className: require_cn.cn("input", className, require_cn.when(recommended, "input--recommended"), require_cn.when(error, "input--error")),
|
|
15
13
|
...props
|
|
16
14
|
});
|
|
17
15
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.cjs","names":["forwardRef","cn","
|
|
1
|
+
{"version":3,"file":"input.cjs","names":["forwardRef","cn","when"],"sources":["../../../src/components/input/input.tsx"],"sourcesContent":["import { forwardRef, type InputHTMLAttributes } from 'react';\n\nimport { cn, when } from '../../lib/cn';\nimport './input.scss';\n\nexport interface InputProps extends InputHTMLAttributes<HTMLInputElement> {\n recommended?: boolean;\n error?: boolean;\n}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n { type = 'text', recommended, error, className, disabled, ...props },\n ref,\n) {\n return (\n <input\n ref={ref}\n type={type}\n disabled={disabled}\n aria-invalid={error || undefined}\n className={cn(\n 'input',\n className,\n when(recommended, 'input--recommended'),\n when(error, 'input--error'),\n )}\n {...props}\n />\n );\n});\n"],"mappings":";;;;;AAUA,MAAa,SAAA,GAAQA,MAAAA,WAAAA,CAAyC,SAAS,MACrE,EAAE,OAAO,QAAQ,aAAa,OAAO,WAAW,UAAU,GAAG,SAC7D,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAD;EACO;EACC;EACI;EACV,gBAAc,SAAS,KAAA;EACvB,WAAWC,WAAAA,GACT,SACA,WACAC,WAAAA,KAAK,aAAa,oBAAoB,GACtCA,WAAAA,KAAK,OAAO,cAAc,CAC5B;EACA,GAAI;CACL,CAAA;AAEL,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn, when } from "../../lib/cn.js";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import
|
|
4
|
+
import "./input.scss";
|
|
5
5
|
// src/components/input/input.tsx
|
|
6
6
|
const Input = forwardRef(function Input({ type = "text", recommended, error, className, disabled, ...props }, ref) {
|
|
7
7
|
return /* @__PURE__ */ jsx("input", {
|
|
@@ -9,7 +9,7 @@ const Input = forwardRef(function Input({ type = "text", recommended, error, cla
|
|
|
9
9
|
type,
|
|
10
10
|
disabled,
|
|
11
11
|
"aria-invalid": error || void 0,
|
|
12
|
-
className: cn(
|
|
12
|
+
className: cn("input", className, when(recommended, "input--recommended"), when(error, "input--error")),
|
|
13
13
|
...props
|
|
14
14
|
});
|
|
15
15
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","names":[],"sources":["../../../src/components/input/input.tsx"],"sourcesContent":["import { forwardRef, type InputHTMLAttributes } from 'react';\n\nimport { cn, when } from '../../lib/cn';\nimport
|
|
1
|
+
{"version":3,"file":"input.js","names":[],"sources":["../../../src/components/input/input.tsx"],"sourcesContent":["import { forwardRef, type InputHTMLAttributes } from 'react';\n\nimport { cn, when } from '../../lib/cn';\nimport './input.scss';\n\nexport interface InputProps extends InputHTMLAttributes<HTMLInputElement> {\n recommended?: boolean;\n error?: boolean;\n}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n { type = 'text', recommended, error, className, disabled, ...props },\n ref,\n) {\n return (\n <input\n ref={ref}\n type={type}\n disabled={disabled}\n aria-invalid={error || undefined}\n className={cn(\n 'input',\n className,\n when(recommended, 'input--recommended'),\n when(error, 'input--error'),\n )}\n {...props}\n />\n );\n});\n"],"mappings":";;;;;AAUA,MAAa,QAAQ,WAAyC,SAAS,MACrE,EAAE,OAAO,QAAQ,aAAa,OAAO,WAAW,UAAU,GAAG,SAC7D,KACA;CACA,OACE,oBAAC,SAAD;EACO;EACC;EACI;EACV,gBAAc,SAAS,KAAA;EACvB,WAAW,GACT,SACA,WACA,KAAK,aAAa,oBAAoB,GACtC,KAAK,OAAO,cAAc,CAC5B;EACA,GAAI;CACL,CAAA;AAEL,CAAC"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
@import '../../styles/vars.scss';
|
|
2
|
-
|
|
3
1
|
.input {
|
|
4
2
|
box-sizing: border-box;
|
|
5
3
|
display: flex;
|
|
@@ -9,11 +7,11 @@
|
|
|
9
7
|
font-size: 14px;
|
|
10
8
|
line-height: 20px;
|
|
11
9
|
background-color: transparent;
|
|
12
|
-
color:
|
|
13
|
-
border-radius:
|
|
10
|
+
color: var(--color-black);
|
|
11
|
+
border-radius: var(--radius-sm);
|
|
14
12
|
appearance: none;
|
|
15
|
-
font-family:
|
|
16
|
-
border: 1px solid
|
|
13
|
+
font-family: var(--font-sans);
|
|
14
|
+
border: 1px solid var(--color-input);
|
|
17
15
|
outline: none;
|
|
18
16
|
transition:
|
|
19
17
|
background 0.3s,
|
|
@@ -46,21 +44,21 @@
|
|
|
46
44
|
}
|
|
47
45
|
|
|
48
46
|
&:focus {
|
|
49
|
-
border-color:
|
|
50
|
-
box-shadow: 0 0 0 1px
|
|
47
|
+
border-color: var(--color-black);
|
|
48
|
+
box-shadow: 0 0 0 1px var(--color-black);
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
&:disabled {
|
|
54
|
-
background-color:
|
|
55
|
-
color:
|
|
56
|
-
fill:
|
|
52
|
+
background-color: var(--color-neutral-200);
|
|
53
|
+
color: var(--color-neutral-500);
|
|
54
|
+
fill: var(--color-neutral-500);
|
|
57
55
|
}
|
|
58
56
|
|
|
59
57
|
&--recommended {
|
|
60
|
-
background-color:
|
|
58
|
+
background-color: color-mix(in srgb, var(--color-yellow) 10%, transparent);
|
|
61
59
|
}
|
|
62
60
|
|
|
63
61
|
&--error {
|
|
64
|
-
border-color:
|
|
62
|
+
border-color: color-mix(in srgb, var(--color-red) 50%, transparent);
|
|
65
63
|
}
|
|
66
64
|
}
|
|
@@ -1,24 +1,22 @@
|
|
|
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_radio_radio_module_scss = require_runtime.__toESM(src_components_radio_radio_module_scss, 1);
|
|
4
|
+
require("./radio.scss");
|
|
7
5
|
// src/components/radio/radio.tsx
|
|
8
6
|
const RadioInput = (0, react.forwardRef)(function RadioInput({ id, className, title, error, disabled, ...props }, ref) {
|
|
9
7
|
const autoId = (0, react.useId)();
|
|
10
8
|
const inputId = id ?? autoId;
|
|
11
9
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12
|
-
className: require_cn.cn(
|
|
10
|
+
className: require_cn.cn("radio", className, require_cn.when(error, "radio--error")),
|
|
13
11
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
14
12
|
ref,
|
|
15
13
|
type: "radio",
|
|
16
14
|
id: inputId,
|
|
17
15
|
disabled,
|
|
18
|
-
className:
|
|
16
|
+
className: "radio__input",
|
|
19
17
|
...props
|
|
20
18
|
}), title ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
21
|
-
className:
|
|
19
|
+
className: "radio__label",
|
|
22
20
|
htmlFor: inputId,
|
|
23
21
|
children: title
|
|
24
22
|
}) : null]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.cjs","names":["forwardRef","useId","cn","
|
|
1
|
+
{"version":3,"file":"radio.cjs","names":["forwardRef","useId","cn","when"],"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,cAAA,GAAaA,MAAAA,WAAAA,CACxB,SAAS,WACP,EAAE,IAAI,WAAW,OAAO,OAAO,UAAU,GAAG,SAC5C,KACA;CACA,MAAM,UAAA,GAASC,MAAAA,MAAAA,CAAM;CACrB,MAAM,UAAU,MAAM;CAEtB,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAWC,WAAAA,GAAG,SAAS,WAAWC,WAAAA,KAAK,OAAO,cAAc,CAAC;EAAlE,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAD;GACO;GACL,MAAK;GACL,IAAI;GACM;GACV,WAAU;GACV,GAAI;EACL,CAAA,GACA,QACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAD;GAAO,WAAU;GAAe,SAAS;GACtC,UAAA;EACI,CAAA,IACL,IACD;;AAET,CACF"}
|
|
@@ -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, {
|