@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
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
|
|
|
@@ -35,20 +35,22 @@ import {
|
|
|
35
35
|
|
|
36
36
|
```tsx
|
|
37
37
|
<Button onClick={save}>Сохранить</Button>
|
|
38
|
-
<Button outline>Отмена</Button>
|
|
39
|
-
<Button
|
|
38
|
+
<Button variant="outline">Отмена</Button>
|
|
39
|
+
<Button variant="link" disabled>Скрыть</Button>
|
|
40
40
|
<Button href="/prices">Тарифы</Button>
|
|
41
|
+
<Button size="sm">Маленькая</Button>
|
|
42
|
+
<Button size="lg">Крупная</Button>
|
|
41
43
|
<Button fullWidth>Дальше</Button>
|
|
42
44
|
```
|
|
43
45
|
|
|
44
|
-
| Prop
|
|
45
|
-
|
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
| `fullWidth`
|
|
49
|
-
| `href`
|
|
46
|
+
| Prop | По умолчанию | |
|
|
47
|
+
| ----------- | ------------ | -------------------------------------------------- |
|
|
48
|
+
| `variant` | `default` | `default` заливка, `outline` обводка, `link` текст |
|
|
49
|
+
| `size` | `md` | `sm` компактная, `md` обычная, `lg` крупная |
|
|
50
|
+
| `fullWidth` | `false` | ширина 100%, не зависит от `size` |
|
|
51
|
+
| `href` | — | рендер `<a>`, не `<Link>` |
|
|
50
52
|
|
|
51
|
-
`link` — это `font-weight: 400
|
|
53
|
+
`variant="link"` — это вид кнопки (`font-weight: 400`), не тип элемента. Ссылка — отдельный проп `href`.
|
|
52
54
|
|
|
53
55
|
## Остальные
|
|
54
56
|
|
|
@@ -70,5 +72,5 @@ import {
|
|
|
70
72
|
pnpm install
|
|
71
73
|
pnpm dev # Storybook, :6006
|
|
72
74
|
pnpm test
|
|
73
|
-
pnpm build # dist: js + d.ts + scss рядом с
|
|
75
|
+
pnpm build # dist: js + d.ts + scss рядом с компонентами
|
|
74
76
|
```
|
|
@@ -1,18 +1,15 @@
|
|
|
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 = [
|
|
9
|
-
"
|
|
10
|
-
"
|
|
7
|
+
"variant",
|
|
8
|
+
"size",
|
|
11
9
|
"fullWidth",
|
|
12
|
-
"link",
|
|
13
10
|
"className"
|
|
14
11
|
];
|
|
15
|
-
const getClassName = ({
|
|
12
|
+
const getClassName = ({ variant = "default", size = "md", fullWidth = false, className, disabled }) => require_cn.cn("button", className, `button--${variant}`, `button--${size}`, require_cn.when(fullWidth, "button--full-width"), require_cn.when(disabled, "button--disabled"));
|
|
16
13
|
const omitStyleProps = (props) => {
|
|
17
14
|
const next = {};
|
|
18
15
|
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\nexport type ButtonVariant = 'default' | 'outline' | 'link';\nexport type ButtonSize = 'sm' | 'md' | 'lg';\n\ninterface ButtonStyleProps {\n variant?: ButtonVariant;\n size?: ButtonSize;\n fullWidth?: 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 = ['variant', 'size', 'fullWidth', 'className'] as const;\n\nconst getClassName = ({\n variant = 'default',\n size = 'md',\n fullWidth = false,\n className,\n disabled,\n}: ButtonStyleProps & { disabled?: boolean }) =>\n cn(\n 'button',\n className,\n `button--${variant}`,\n `button--${size}`,\n when(fullWidth, 'button--full-width'),\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;CAAC;CAAW;CAAQ;CAAa;AAAW;AAE9D,MAAM,gBAAgB,EACpB,UAAU,WACV,OAAO,MACP,YAAY,OACZ,WACA,eAEAA,WAAAA,GACE,UACA,WACA,WAAW,WACX,WAAW,QACXC,WAAAA,KAAK,WAAW,oBAAoB,GACpCA,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,11 +1,10 @@
|
|
|
1
1
|
import { AnchorHTMLAttributes, ButtonHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export type ButtonVariant = 'default' | 'outline' | 'link';
|
|
3
|
+
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
2
4
|
interface ButtonStyleProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
withIcon?: boolean;
|
|
5
|
+
variant?: ButtonVariant;
|
|
6
|
+
size?: ButtonSize;
|
|
6
7
|
fullWidth?: boolean;
|
|
7
|
-
/** Визуальный вес ссылки (font-weight: 400), не тип элемента. */
|
|
8
|
-
link?: boolean;
|
|
9
8
|
className?: string;
|
|
10
9
|
children?: ReactNode;
|
|
11
10
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { AnchorHTMLAttributes, ButtonHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export type ButtonVariant = 'default' | 'outline' | 'link';
|
|
3
|
+
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
2
4
|
interface ButtonStyleProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
withIcon?: boolean;
|
|
5
|
+
variant?: ButtonVariant;
|
|
6
|
+
size?: ButtonSize;
|
|
6
7
|
fullWidth?: boolean;
|
|
7
|
-
/** Визуальный вес ссылки (font-weight: 400), не тип элемента. */
|
|
8
|
-
link?: boolean;
|
|
9
8
|
className?: string;
|
|
10
9
|
children?: ReactNode;
|
|
11
10
|
}
|
|
@@ -1,16 +1,15 @@
|
|
|
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 = [
|
|
7
|
-
"
|
|
8
|
-
"
|
|
7
|
+
"variant",
|
|
8
|
+
"size",
|
|
9
9
|
"fullWidth",
|
|
10
|
-
"link",
|
|
11
10
|
"className"
|
|
12
11
|
];
|
|
13
|
-
const getClassName = ({
|
|
12
|
+
const getClassName = ({ variant = "default", size = "md", fullWidth = false, className, disabled }) => cn("button", className, `button--${variant}`, `button--${size}`, when(fullWidth, "button--full-width"), when(disabled, "button--disabled"));
|
|
14
13
|
const omitStyleProps = (props) => {
|
|
15
14
|
const next = {};
|
|
16
15
|
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\nexport type ButtonVariant = 'default' | 'outline' | 'link';\nexport type ButtonSize = 'sm' | 'md' | 'lg';\n\ninterface ButtonStyleProps {\n variant?: ButtonVariant;\n size?: ButtonSize;\n fullWidth?: 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 = ['variant', 'size', 'fullWidth', 'className'] as const;\n\nconst getClassName = ({\n variant = 'default',\n size = 'md',\n fullWidth = false,\n className,\n disabled,\n}: ButtonStyleProps & { disabled?: boolean }) =>\n cn(\n 'button',\n className,\n `button--${variant}`,\n `button--${size}`,\n when(fullWidth, 'button--full-width'),\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;CAAC;CAAW;CAAQ;CAAa;AAAW;AAE9D,MAAM,gBAAgB,EACpB,UAAU,WACV,OAAO,MACP,YAAY,OACZ,WACA,eAEA,GACE,UACA,WACA,WAAW,WACX,WAAW,QACX,KAAK,WAAW,oBAAoB,GACpC,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,94 @@
|
|
|
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
|
+
border: 2px solid var(--color-black);
|
|
44
|
+
|
|
45
|
+
&:disabled {
|
|
46
|
+
background-color: transparent;
|
|
47
|
+
border: 2px solid var(--color-black);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&--sm {
|
|
52
|
+
padding: 6px 12px;
|
|
53
|
+
font-size: 12px;
|
|
54
|
+
line-height: 16px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&--lg {
|
|
58
|
+
padding: 14px 24px;
|
|
59
|
+
font-size: 16px;
|
|
60
|
+
line-height: 24px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&--full-width {
|
|
64
|
+
width: 100%;
|
|
65
|
+
justify-content: center;
|
|
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
|
+
font-weight: 400;
|
|
76
|
+
|
|
77
|
+
&:active,
|
|
78
|
+
&:disabled {
|
|
79
|
+
background-color: transparent;
|
|
80
|
+
color: rgba(0, 0, 0, 0.5);
|
|
81
|
+
fill: rgba(0, 0, 0, 0.5);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&--disabled {
|
|
86
|
+
background-color: var(--color-neutral-200);
|
|
87
|
+
color: var(--color-neutral-500);
|
|
88
|
+
fill: var(--color-neutral-500);
|
|
89
|
+
border-color: var(--color-neutral-200);
|
|
90
|
+
cursor: default;
|
|
91
|
+
pointer-events: none;
|
|
92
|
+
user-select: none;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Button, ButtonComponentProps, ButtonLinkProps, ButtonProps } from "./button.cjs";
|
|
2
|
-
export { Button, type ButtonComponentProps, type ButtonLinkProps, type ButtonProps };
|
|
1
|
+
import { Button, ButtonComponentProps, ButtonLinkProps, ButtonProps, ButtonSize, ButtonVariant } from "./button.cjs";
|
|
2
|
+
export { Button, type ButtonComponentProps, type ButtonLinkProps, type ButtonProps, type ButtonSize, type ButtonVariant };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Button, ButtonComponentProps, ButtonLinkProps, ButtonProps } from "./button.js";
|
|
2
|
-
export { Button, type ButtonComponentProps, type ButtonLinkProps, type ButtonProps };
|
|
1
|
+
import { Button, ButtonComponentProps, ButtonLinkProps, ButtonProps, ButtonSize, ButtonVariant } from "./button.js";
|
|
2
|
+
export { Button, type ButtonComponentProps, type ButtonLinkProps, type ButtonProps, type ButtonSize, type ButtonVariant };
|
|
@@ -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"}
|