@de-kit/st-ui 0.0.0-stage → 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.
Files changed (67) hide show
  1. package/README.md +73 -2
  2. package/dist/components/button/button.cjs +47 -0
  3. package/dist/components/button/button.cjs.map +1 -0
  4. package/dist/components/button/button.d.cts +21 -0
  5. package/dist/components/button/button.d.ts +21 -0
  6. package/dist/components/button/button.js +47 -0
  7. package/dist/components/button/button.js.map +1 -0
  8. package/dist/components/button/button.scss +93 -0
  9. package/dist/components/button/index.d.cts +2 -0
  10. package/dist/components/button/index.d.ts +2 -0
  11. package/dist/components/checkbox/checkbox.cjs +27 -0
  12. package/dist/components/checkbox/checkbox.cjs.map +1 -0
  13. package/dist/components/checkbox/checkbox.d.cts +8 -0
  14. package/dist/components/checkbox/checkbox.d.ts +8 -0
  15. package/dist/components/checkbox/checkbox.js +27 -0
  16. package/dist/components/checkbox/checkbox.js.map +1 -0
  17. package/dist/components/checkbox/checkbox.scss +108 -0
  18. package/dist/components/checkbox/index.d.cts +2 -0
  19. package/dist/components/checkbox/index.d.ts +2 -0
  20. package/dist/components/input/index.d.cts +2 -0
  21. package/dist/components/input/index.d.ts +2 -0
  22. package/dist/components/input/input.cjs +18 -0
  23. package/dist/components/input/input.cjs.map +1 -0
  24. package/dist/components/input/input.d.cts +7 -0
  25. package/dist/components/input/input.d.ts +7 -0
  26. package/dist/components/input/input.js +18 -0
  27. package/dist/components/input/input.js.map +1 -0
  28. package/dist/components/input/input.scss +64 -0
  29. package/dist/components/radio/index.d.cts +2 -0
  30. package/dist/components/radio/index.d.ts +2 -0
  31. package/dist/components/radio/radio.cjs +27 -0
  32. package/dist/components/radio/radio.cjs.map +1 -0
  33. package/dist/components/radio/radio.d.cts +7 -0
  34. package/dist/components/radio/radio.d.ts +7 -0
  35. package/dist/components/radio/radio.js +27 -0
  36. package/dist/components/radio/radio.js.map +1 -0
  37. package/dist/components/radio/radio.scss +109 -0
  38. package/dist/components/spinner/index.d.cts +2 -0
  39. package/dist/components/spinner/index.d.ts +2 -0
  40. package/dist/components/spinner/spinner.cjs +54 -0
  41. package/dist/components/spinner/spinner.cjs.map +1 -0
  42. package/dist/components/spinner/spinner.d.cts +13 -0
  43. package/dist/components/spinner/spinner.d.ts +13 -0
  44. package/dist/components/spinner/spinner.js +54 -0
  45. package/dist/components/spinner/spinner.js.map +1 -0
  46. package/dist/components/spinner/spinner.scss +12 -0
  47. package/dist/components/textarea/index.d.cts +2 -0
  48. package/dist/components/textarea/index.d.ts +2 -0
  49. package/dist/components/textarea/textarea.cjs +28 -0
  50. package/dist/components/textarea/textarea.cjs.map +1 -0
  51. package/dist/components/textarea/textarea.d.cts +9 -0
  52. package/dist/components/textarea/textarea.d.ts +9 -0
  53. package/dist/components/textarea/textarea.js +28 -0
  54. package/dist/components/textarea/textarea.js.map +1 -0
  55. package/dist/components/textarea/textarea.scss +58 -0
  56. package/dist/index.cjs +14 -0
  57. package/dist/index.d.cts +13 -0
  58. package/dist/index.d.ts +13 -0
  59. package/dist/index.js +8 -0
  60. package/dist/lib/cn.cjs +25 -0
  61. package/dist/lib/cn.cjs.map +1 -0
  62. package/dist/lib/cn.js +24 -0
  63. package/dist/lib/cn.js.map +1 -0
  64. package/dist/styles/global.scss +195 -0
  65. package/dist/styles/mixins.scss +186 -0
  66. package/dist/styles/vars.scss +36 -0
  67. package/package.json +91 -3
package/README.md CHANGED
@@ -1,3 +1,74 @@
1
- # Temporary Holding Version
1
+ # @de-kit/st-ui
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ React-компоненты splittest. Стили едут вместе с компонентом (глобальный SCSS, не CSS-модули). Токены скопированы из `splittest-frontend/src/app/styles`. Tailwind нет.
4
+
5
+ ## Подключение
6
+
7
+ В CRA и в Vite отдельный импорт CSS не нужен — `import './button.scss'` сидит внутри компонента:
8
+
9
+ ```tsx
10
+ import {
11
+ Button,
12
+ Input,
13
+ TextArea,
14
+ CheckboxInput,
15
+ RadioInput,
16
+ Spinner,
17
+ } from '@de-kit/st-ui';
18
+ ```
19
+
20
+ `global.scss` — база приложения (body, заголовки, таблицы, `.wrapper`). В чужой странице его не подключать. Шрифт Inter библиотека не везёт, его по-прежнему грузит фронтенд.
21
+
22
+ Токены подключаются один раз вместе с пакетом (`import './styles/vars.scss'` в `src/index.ts`). В своих scss это обычные `var()`, `@use` не нужен. `@use '@de-kit/st-ui/vars.scss'` — только если стили собираются без JS. Миксины отдельно:
23
+
24
+ ```scss
25
+ @use '@de-kit/st-ui/mixins.scss' as mixins;
26
+ ```
27
+
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
+
32
+ ## Кнопка
33
+
34
+ Пропсы как в `shared/components/button`, без `react-router`.
35
+
36
+ ```tsx
37
+ <Button onClick={save}>Сохранить</Button>
38
+ <Button outline>Отмена</Button>
39
+ <Button transparent disabled>Скрыть</Button>
40
+ <Button href="/prices">Тарифы</Button>
41
+ <Button fullWidth>Дальше</Button>
42
+ ```
43
+
44
+ | Prop | По умолчанию | |
45
+ | ---------------------------------------------------------- | ------------ | ------------------------------------------ |
46
+ | `transparent` / `outline` / `empty` / `link` / `nopadding` | `false` | варианты из `index.module.scss` приложения |
47
+ | `withIcon` | `true` | как в приложении: левый паддинг под иконку |
48
+ | `fullWidth` | `false` | `width: 100%` |
49
+ | `href` | — | рендер `<a>`, не `<Link>` |
50
+
51
+ `link` — это `font-weight: 400`, не тип элемента.
52
+
53
+ ## Остальные
54
+
55
+ ```tsx
56
+ <Input recommended />
57
+ <Input error />
58
+ <TextArea maxLength={200} />
59
+ <TextArea maxLength={200} hideCounter />
60
+ <CheckboxInput title="18-24" />
61
+ <RadioInput name="age" title="18–24" />
62
+ <Spinner position="top" />
63
+ ```
64
+
65
+ `hideCounter` заменяет опечатку `noMaxMoty`. `CheckboxInput` сам ставит `id`, если его не передали. Дефис в `title` чекбокса по-прежнему меняется на тире.
66
+
67
+ ## Разработка
68
+
69
+ ```bash
70
+ pnpm install
71
+ pnpm dev # Storybook, :6006
72
+ pnpm test
73
+ pnpm build # dist: js + d.ts + scss рядом с компонентами
74
+ ```
@@ -0,0 +1,47 @@
1
+ const require_cn = require("../../lib/cn.cjs");
2
+ let react = require("react");
3
+ require("./button.scss");
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ // src/components/button/button.tsx
6
+ const styleKeys = [
7
+ "outline",
8
+ "withIcon",
9
+ "fullWidth",
10
+ "link",
11
+ "className"
12
+ ];
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"));
14
+ const omitStyleProps = (props) => {
15
+ const next = {};
16
+ const skipped = new Set(styleKeys);
17
+ for (const [key, value] of Object.entries(props)) if (!skipped.has(key)) next[key] = value;
18
+ return next;
19
+ };
20
+ const Button = (0, react.forwardRef)(function Button(props, ref) {
21
+ const className = getClassName(props);
22
+ const { children, href, ...domProps } = omitStyleProps(props);
23
+ if (typeof href === "string") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
24
+ ref,
25
+ href,
26
+ className,
27
+ ...domProps,
28
+ children
29
+ });
30
+ const { type = "button", disabled, onClick, ...buttonProps } = domProps;
31
+ const handleClick = (event) => {
32
+ if (disabled) return;
33
+ onClick?.(event);
34
+ };
35
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
36
+ ref,
37
+ className,
38
+ type,
39
+ disabled,
40
+ onClick: handleClick,
41
+ ...buttonProps,
42
+ children
43
+ });
44
+ });
45
+ exports.Button = Button;
46
+
47
+ //# sourceMappingURL=button.cjs.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,21 @@
1
+ import { AnchorHTMLAttributes, ButtonHTMLAttributes, ReactNode } from "react";
2
+ interface ButtonStyleProps {
3
+ outline?: boolean;
4
+ /** В приложении по умолчанию true: левый паддинг под иконку. */
5
+ withIcon?: boolean;
6
+ fullWidth?: boolean;
7
+ /** Визуальный вес ссылки (font-weight: 400), не тип элемента. */
8
+ link?: boolean;
9
+ className?: string;
10
+ children?: ReactNode;
11
+ }
12
+ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, ButtonStyleProps {
13
+ href?: undefined;
14
+ }
15
+ export interface ButtonLinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>, ButtonStyleProps {
16
+ href: string;
17
+ }
18
+ export type ButtonComponentProps = ButtonProps | ButtonLinkProps;
19
+ export declare const Button: import("react").ForwardRefExoticComponent<ButtonComponentProps & import("react").RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
20
+ export {};
21
+ //# sourceMappingURL=button.d.cts.map
@@ -0,0 +1,21 @@
1
+ import { AnchorHTMLAttributes, ButtonHTMLAttributes, ReactNode } from "react";
2
+ interface ButtonStyleProps {
3
+ outline?: boolean;
4
+ /** В приложении по умолчанию true: левый паддинг под иконку. */
5
+ withIcon?: boolean;
6
+ fullWidth?: boolean;
7
+ /** Визуальный вес ссылки (font-weight: 400), не тип элемента. */
8
+ link?: boolean;
9
+ className?: string;
10
+ children?: ReactNode;
11
+ }
12
+ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, ButtonStyleProps {
13
+ href?: undefined;
14
+ }
15
+ export interface ButtonLinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>, ButtonStyleProps {
16
+ href: string;
17
+ }
18
+ export type ButtonComponentProps = ButtonProps | ButtonLinkProps;
19
+ export declare const Button: import("react").ForwardRefExoticComponent<ButtonComponentProps & import("react").RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
20
+ export {};
21
+ //# sourceMappingURL=button.d.ts.map
@@ -0,0 +1,47 @@
1
+ import { cn, when } from "../../lib/cn.js";
2
+ import { forwardRef } from "react";
3
+ import "./button.scss";
4
+ import { jsx } from "react/jsx-runtime";
5
+ // src/components/button/button.tsx
6
+ const styleKeys = [
7
+ "outline",
8
+ "withIcon",
9
+ "fullWidth",
10
+ "link",
11
+ "className"
12
+ ];
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
+ const omitStyleProps = (props) => {
15
+ const next = {};
16
+ const skipped = new Set(styleKeys);
17
+ for (const [key, value] of Object.entries(props)) if (!skipped.has(key)) next[key] = value;
18
+ return next;
19
+ };
20
+ const Button = forwardRef(function Button(props, ref) {
21
+ const className = getClassName(props);
22
+ const { children, href, ...domProps } = omitStyleProps(props);
23
+ if (typeof href === "string") return /* @__PURE__ */ jsx("a", {
24
+ ref,
25
+ href,
26
+ className,
27
+ ...domProps,
28
+ children
29
+ });
30
+ const { type = "button", disabled, onClick, ...buttonProps } = domProps;
31
+ const handleClick = (event) => {
32
+ if (disabled) return;
33
+ onClick?.(event);
34
+ };
35
+ return /* @__PURE__ */ jsx("button", {
36
+ ref,
37
+ className,
38
+ type,
39
+ disabled,
40
+ onClick: handleClick,
41
+ ...buttonProps,
42
+ children
43
+ });
44
+ });
45
+ export { Button };
46
+
47
+ //# sourceMappingURL=button.js.map
@@ -0,0 +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 './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
+ }
@@ -0,0 +1,2 @@
1
+ import { Button, ButtonComponentProps, ButtonLinkProps, ButtonProps } from "./button.cjs";
2
+ export { Button, type ButtonComponentProps, type ButtonLinkProps, type ButtonProps };
@@ -0,0 +1,2 @@
1
+ import { Button, ButtonComponentProps, ButtonLinkProps, ButtonProps } from "./button.js";
2
+ export { Button, type ButtonComponentProps, type ButtonLinkProps, type ButtonProps };
@@ -0,0 +1,27 @@
1
+ const require_cn = require("../../lib/cn.cjs");
2
+ let react = require("react");
3
+ let react_jsx_runtime = require("react/jsx-runtime");
4
+ require("./checkbox.scss");
5
+ // src/components/checkbox/checkbox.tsx
6
+ const CheckboxInput = (0, react.forwardRef)(function CheckboxInput({ className, id, title, hide, disabled, withCursor = true, ...props }, ref) {
7
+ const autoId = (0, react.useId)();
8
+ const inputId = id ?? autoId;
9
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10
+ className: require_cn.cn("checkbox", className, require_cn.when(hide, "checkbox--hide")),
11
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
12
+ ref,
13
+ type: "checkbox",
14
+ id: inputId,
15
+ disabled,
16
+ className: require_cn.cn("checkbox__input", require_cn.when(!withCursor, "checkbox__input--no-events")),
17
+ ...props
18
+ }), title ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
19
+ className: "checkbox__label",
20
+ htmlFor: inputId,
21
+ children: title.replaceAll("-", "–")
22
+ }) : null]
23
+ });
24
+ });
25
+ exports.CheckboxInput = CheckboxInput;
26
+
27
+ //# sourceMappingURL=checkbox.cjs.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,8 @@
1
+ import { InputHTMLAttributes } from "react";
2
+ export interface CheckboxInputProps extends InputHTMLAttributes<HTMLInputElement> {
3
+ title?: string;
4
+ hide?: boolean;
5
+ withCursor?: boolean;
6
+ }
7
+ export declare const CheckboxInput: import("react").ForwardRefExoticComponent<CheckboxInputProps & import("react").RefAttributes<HTMLInputElement>>;
8
+ //# sourceMappingURL=checkbox.d.cts.map
@@ -0,0 +1,8 @@
1
+ import { InputHTMLAttributes } from "react";
2
+ export interface CheckboxInputProps extends InputHTMLAttributes<HTMLInputElement> {
3
+ title?: string;
4
+ hide?: boolean;
5
+ withCursor?: boolean;
6
+ }
7
+ export declare const CheckboxInput: import("react").ForwardRefExoticComponent<CheckboxInputProps & import("react").RefAttributes<HTMLInputElement>>;
8
+ //# sourceMappingURL=checkbox.d.ts.map
@@ -0,0 +1,27 @@
1
+ import { cn, when } from "../../lib/cn.js";
2
+ import { forwardRef, useId } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import "./checkbox.scss";
5
+ // src/components/checkbox/checkbox.tsx
6
+ const CheckboxInput = forwardRef(function CheckboxInput({ className, id, title, hide, disabled, withCursor = true, ...props }, ref) {
7
+ const autoId = useId();
8
+ const inputId = id ?? autoId;
9
+ return /* @__PURE__ */ jsxs("div", {
10
+ className: cn("checkbox", className, when(hide, "checkbox--hide")),
11
+ children: [/* @__PURE__ */ jsx("input", {
12
+ ref,
13
+ type: "checkbox",
14
+ id: inputId,
15
+ disabled,
16
+ className: cn("checkbox__input", when(!withCursor, "checkbox__input--no-events")),
17
+ ...props
18
+ }), title ? /* @__PURE__ */ jsx("label", {
19
+ className: "checkbox__label",
20
+ htmlFor: inputId,
21
+ children: title.replaceAll("-", "–")
22
+ }) : null]
23
+ });
24
+ });
25
+ export { CheckboxInput };
26
+
27
+ //# sourceMappingURL=checkbox.js.map
@@ -0,0 +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 './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"}
@@ -0,0 +1,108 @@
1
+ @function get-check-icon($color: 'fff') {
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");
3
+ }
4
+
5
+ .checkbox {
6
+ display: flex;
7
+ align-items: flex-start;
8
+
9
+ &--hide {
10
+ display: none;
11
+ }
12
+ }
13
+
14
+ .checkbox__label {
15
+ font-size: 14px;
16
+ line-height: 20px;
17
+ display: inline-block;
18
+ vertical-align: top;
19
+ padding-left: 5px;
20
+ user-select: none;
21
+ cursor: pointer;
22
+ }
23
+
24
+ .checkbox__input {
25
+ --active: #000;
26
+ --active-inner: #fff;
27
+ --border: #e5e5e5;
28
+ --border-hover: #000;
29
+ --background: #fff;
30
+ --disabled: #e5e5e5;
31
+ --disabled-inner: #e5e5e5;
32
+ box-sizing: border-box;
33
+ appearance: none;
34
+ width: 20px;
35
+ height: 20px;
36
+ outline: none;
37
+ display: inline-block;
38
+ vertical-align: top;
39
+ position: relative;
40
+ margin: 0;
41
+ flex-shrink: 0;
42
+ border: 1px solid var(--bc, var(--border));
43
+ background: var(--b, var(--background));
44
+ border-radius: 5px;
45
+ transition:
46
+ background 0.3s,
47
+ border-color 0.3s,
48
+ box-shadow 0.2s;
49
+ cursor: pointer;
50
+
51
+ &::after {
52
+ content: '';
53
+ display: block;
54
+ left: 0;
55
+ top: 0;
56
+ right: 0;
57
+ bottom: 0;
58
+ position: absolute;
59
+ transition: opacity var(--d-o, 0.2s);
60
+ opacity: var(--o, 0);
61
+ background-position: center;
62
+ background-image: get-check-icon();
63
+ }
64
+
65
+ &:required:not(:hover):not(:checked):not(:disabled) {
66
+ border: 1px solid var(--color-red);
67
+ }
68
+
69
+ &:checked {
70
+ --b: var(--active);
71
+ --bc: var(--active);
72
+ --o: 1;
73
+ }
74
+
75
+ &:hover:not(:checked):not(:disabled) {
76
+ border-width: 2px;
77
+ --bc: var(--active);
78
+ }
79
+
80
+ &:focus {
81
+ border-color: var(--border-hover);
82
+ border-width: 2px;
83
+ }
84
+
85
+ &:disabled {
86
+ --b: var(--disabled);
87
+ border: 1px solid var(--disabled);
88
+ cursor: not-allowed;
89
+ opacity: 1;
90
+
91
+ &:checked {
92
+ --b: var(--disabled-inner);
93
+
94
+ &::after {
95
+ background-image: get-check-icon('727272');
96
+ }
97
+ }
98
+
99
+ & + .checkbox__label {
100
+ color: var(--color-gray);
101
+ cursor: not-allowed;
102
+ }
103
+ }
104
+
105
+ &--no-events {
106
+ pointer-events: none;
107
+ }
108
+ }
@@ -0,0 +1,2 @@
1
+ import { CheckboxInput, CheckboxInputProps } from "./checkbox.cjs";
2
+ export { CheckboxInput, type CheckboxInputProps };
@@ -0,0 +1,2 @@
1
+ import { CheckboxInput, CheckboxInputProps } from "./checkbox.js";
2
+ export { CheckboxInput, type CheckboxInputProps };
@@ -0,0 +1,2 @@
1
+ import { Input, InputProps } from "./input.cjs";
2
+ export { Input, type InputProps };
@@ -0,0 +1,2 @@
1
+ import { Input, InputProps } from "./input.js";
2
+ export { Input, type InputProps };
@@ -0,0 +1,18 @@
1
+ const require_cn = require("../../lib/cn.cjs");
2
+ let react = require("react");
3
+ let react_jsx_runtime = require("react/jsx-runtime");
4
+ require("./input.scss");
5
+ // src/components/input/input.tsx
6
+ const Input = (0, react.forwardRef)(function Input({ type = "text", recommended, error, className, disabled, ...props }, ref) {
7
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8
+ ref,
9
+ type,
10
+ disabled,
11
+ "aria-invalid": error || void 0,
12
+ className: require_cn.cn("input", className, require_cn.when(recommended, "input--recommended"), require_cn.when(error, "input--error")),
13
+ ...props
14
+ });
15
+ });
16
+ exports.Input = Input;
17
+
18
+ //# sourceMappingURL=input.cjs.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,7 @@
1
+ import { InputHTMLAttributes } from "react";
2
+ export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
3
+ recommended?: boolean;
4
+ error?: boolean;
5
+ }
6
+ export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
7
+ //# sourceMappingURL=input.d.cts.map
@@ -0,0 +1,7 @@
1
+ import { InputHTMLAttributes } from "react";
2
+ export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
3
+ recommended?: boolean;
4
+ error?: boolean;
5
+ }
6
+ export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
7
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1,18 @@
1
+ import { cn, when } from "../../lib/cn.js";
2
+ import { forwardRef } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import "./input.scss";
5
+ // src/components/input/input.tsx
6
+ const Input = forwardRef(function Input({ type = "text", recommended, error, className, disabled, ...props }, ref) {
7
+ return /* @__PURE__ */ jsx("input", {
8
+ ref,
9
+ type,
10
+ disabled,
11
+ "aria-invalid": error || void 0,
12
+ className: cn("input", className, when(recommended, "input--recommended"), when(error, "input--error")),
13
+ ...props
14
+ });
15
+ });
16
+ export { Input };
17
+
18
+ //# sourceMappingURL=input.js.map
@@ -0,0 +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 './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"}