@bezdenegsvarkinet/ui-library 1.1.2 → 1.2.0
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/dist/index.cjs +68 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +148 -29
- package/dist/index.d.cts +60 -9
- package/dist/index.d.ts +60 -9
- package/dist/index.js +69 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -37,8 +37,36 @@ var import_class_variance_authority = require("class-variance-authority");
|
|
|
37
37
|
|
|
38
38
|
// src/stories/typography/config/typography-sizes.ts
|
|
39
39
|
var typographySizes = {
|
|
40
|
+
"display/eb/64": "text-[64px] font-extrabold",
|
|
41
|
+
"display/b/56": "text-[56px] font-bold",
|
|
42
|
+
"heading/b/48": "text-[48px] font-bold",
|
|
43
|
+
"heading/sb/40": "text-[40px] font-semibold",
|
|
44
|
+
"heading/sb/36": "text-[36px] font-semibold",
|
|
45
|
+
"heading/sb/32": "text-[32px] font-semibold",
|
|
46
|
+
"heading/sb/28": "text-[28px] font-semibold",
|
|
47
|
+
"subtitle/sb/24": "text-[24px] font-semibold",
|
|
48
|
+
"subtitle/m/24": "text-[24px] font-medium",
|
|
49
|
+
"subtitle/sb/20": "text-[20px] font-semibold",
|
|
50
|
+
"subtitle/m/20": "text-[20px] font-medium",
|
|
51
|
+
"subtitle/sb/18": "text-[18px] font-semibold",
|
|
52
|
+
"subtitle/m/18": "text-[18px] font-medium",
|
|
53
|
+
"body/m/18": "text-[18px] font-medium",
|
|
54
|
+
"body/sb/16": "text-[16px] font-semibold",
|
|
55
|
+
"body/m/16": "text-[16px] font-medium",
|
|
56
|
+
"body/r/16": "text-[16px] font-normal",
|
|
57
|
+
"body/sb/14": "text-[14px] font-semibold",
|
|
58
|
+
"body/m/14": "text-[14px] font-medium",
|
|
59
|
+
"body/r/14": "text-[14px] font-normal",
|
|
60
|
+
"button/m/20": "text-[20px] font-medium",
|
|
61
|
+
"button/m/18": "text-[18px] font-medium",
|
|
40
62
|
"button/m/16": "text-[16px] font-medium",
|
|
41
|
-
"button/m/14": "text-[14px] font-medium"
|
|
63
|
+
"button/m/14": "text-[14px] font-medium",
|
|
64
|
+
"caption/r/14": "text-[14px] font-normal",
|
|
65
|
+
"caption/sb/12": "text-[12px] font-semibold",
|
|
66
|
+
"caption/m/12": "text-[12px] font-medium",
|
|
67
|
+
"caption/r/12": "text-[12px] font-normal",
|
|
68
|
+
"caption/m/10": "text-[10px] font-medium",
|
|
69
|
+
"caption/r/10": "text-[10px] font-normal"
|
|
42
70
|
};
|
|
43
71
|
|
|
44
72
|
// src/stories/typography/ui/typography.tsx
|
|
@@ -50,7 +78,7 @@ var typographyVariants = (0, import_class_variance_authority.cva)("transition-al
|
|
|
50
78
|
}
|
|
51
79
|
},
|
|
52
80
|
defaultVariants: {
|
|
53
|
-
size: "
|
|
81
|
+
size: "body/r/16"
|
|
54
82
|
}
|
|
55
83
|
});
|
|
56
84
|
var Typography = ({ children, tag = "p", size, className, ...props }) => {
|
|
@@ -61,11 +89,12 @@ var Typography = ({ children, tag = "p", size, className, ...props }) => {
|
|
|
61
89
|
// src/stories/button/ui/button.tsx
|
|
62
90
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
63
91
|
|
|
64
|
-
// src/stories/button/config/button-
|
|
65
|
-
var
|
|
66
|
-
primary: "bg-blue-500 text-white hover:bg-blue-
|
|
67
|
-
|
|
68
|
-
|
|
92
|
+
// src/stories/button/config/button-variants.ts
|
|
93
|
+
var buttonVariants = {
|
|
94
|
+
"primary-fill": "bg-blue-500 text-white not-disabled:hover:bg-blue-800 not-disabled:active:bg-blue-700 disabled:bg-neutral-200 disabled:text-neutral-500",
|
|
95
|
+
"primary-outline": "bg-transparent border border-blue-500 text-blue-500 not-disabled:hover:border-blue-800 not-disabled:active:border-blue-700 disabled:border-neutral-500 disabled:bg-neutral-200",
|
|
96
|
+
"secondary-fill": "bg-neutral-800 text-white hover:bg-neutral-700",
|
|
97
|
+
"secondary-outline": "border-2 border-neutral-800 text-neutral-800 not-disabled:hover:bg-neutral-700 not-disabled:active:bg-neutral-700 disabled:bg-neutral-200"
|
|
69
98
|
};
|
|
70
99
|
|
|
71
100
|
// src/stories/button/config/button-sizes.ts
|
|
@@ -77,23 +106,42 @@ var buttonSizes = {
|
|
|
77
106
|
};
|
|
78
107
|
|
|
79
108
|
// src/stories/button/ui/button.tsx
|
|
109
|
+
var import_lucide_react = require("lucide-react");
|
|
80
110
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
81
|
-
var
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
111
|
+
var buttonConfig = (0, import_class_variance_authority2.cva)(
|
|
112
|
+
"transition-all cursor-pointer duration-300 py-2 px-4 rounded-[8px] flex items-center gap-2 disabled:cursor-not-allowed",
|
|
113
|
+
{
|
|
114
|
+
variants: {
|
|
115
|
+
variant: {
|
|
116
|
+
...buttonVariants
|
|
117
|
+
},
|
|
118
|
+
size: {
|
|
119
|
+
...buttonSizes
|
|
120
|
+
}
|
|
85
121
|
},
|
|
86
|
-
|
|
87
|
-
|
|
122
|
+
defaultVariants: {
|
|
123
|
+
variant: "primary-fill",
|
|
124
|
+
size: "56"
|
|
88
125
|
}
|
|
89
|
-
},
|
|
90
|
-
defaultVariants: {
|
|
91
|
-
bg: "primary",
|
|
92
|
-
size: "32"
|
|
93
126
|
}
|
|
94
|
-
|
|
95
|
-
var Button = ({
|
|
96
|
-
|
|
127
|
+
);
|
|
128
|
+
var Button = ({
|
|
129
|
+
children,
|
|
130
|
+
variant,
|
|
131
|
+
size,
|
|
132
|
+
className,
|
|
133
|
+
iconSide = "left",
|
|
134
|
+
textSize = "body/r/16",
|
|
135
|
+
showLoader = false,
|
|
136
|
+
icon,
|
|
137
|
+
...props
|
|
138
|
+
}) => {
|
|
139
|
+
const Icon = icon && import_lucide_react.icons[icon];
|
|
140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { ...props, className: cn(buttonConfig({ variant, size, className })), children: props.disabled && showLoader ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.Loader2, { size: 20, strokeWidth: 1.5, className: "animate-spin" }) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
141
|
+
Icon && iconSide === "left" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { size: 20, strokeWidth: 1.5 }),
|
|
142
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Typography, { size: textSize, children }),
|
|
143
|
+
Icon && iconSide === "right" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { size: 20, strokeWidth: 1.5 })
|
|
144
|
+
] }) });
|
|
97
145
|
};
|
|
98
146
|
// Annotate the CommonJS export names for ESM import in node:
|
|
99
147
|
0 && (module.exports = {
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/lib/utils.ts","../src/stories/typography/ui/typography.tsx","../src/stories/typography/config/typography-sizes.ts","../src/stories/button/ui/button.tsx","../src/stories/button/config/button-
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/lib/utils.ts","../src/stories/typography/ui/typography.tsx","../src/stories/typography/config/typography-sizes.ts","../src/stories/button/ui/button.tsx","../src/stories/button/config/button-variants.ts","../src/stories/button/config/button-sizes.ts"],"sourcesContent":["// Экспортируем только компоненты, не stories и не CSS\nexport { Typography } from './stories/typography'\nexport { Button } from './stories/button'\n\n// export type { IButtonProps } from 'src/stories/button/ui/button'\n// export type { ITypographyProps } from 'src/stories/typography/ui/typography'\n\n// Импортируем CSS с Tailwind (он попадёт в сборку)\nimport './index.css'","import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","'use client'\n\nimport { FC } from 'react'\nimport { cn } from '@/lib/utils'\nimport { cva, VariantProps } from 'class-variance-authority'\nimport { typographySizes } from '../config/typography-sizes'\n\nconst typographyVariants = cva('transition-all duration-300 leading-[100%]', {\n\tvariants: {\n\t\tsize: {\n\t\t\t...typographySizes,\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tsize: 'body/r/16',\n\t},\n})\n\ntype TTag = 'p' | 'span'\n\nexport interface ITypographyProps\n\textends React.HTMLAttributes<HTMLParagraphElement>, VariantProps<typeof typographyVariants> {\n\tchildren: React.ReactNode\n\ttag?: TTag\n}\n\nexport const Typography: FC<ITypographyProps> = ({ children, tag = 'p', size, className, ...props }) => {\n\tconst Tag = tag\n\n\treturn (\n\t\t<Tag {...props} className={cn(typographyVariants({ size, className }))}>\n\t\t\t{children}\n\t\t</Tag>\n\t)\n}","export const typographySizes = {\n\t'display/eb/64': 'text-[64px] font-extrabold',\n\t'display/b/56': 'text-[56px] font-bold',\n\n\t'heading/b/48': 'text-[48px] font-bold',\n\t'heading/sb/40': 'text-[40px] font-semibold',\n\t'heading/sb/36': 'text-[36px] font-semibold',\n\t'heading/sb/32': 'text-[32px] font-semibold',\n\t'heading/sb/28': 'text-[28px] font-semibold',\n\n\t'subtitle/sb/24': 'text-[24px] font-semibold',\n\t'subtitle/m/24': 'text-[24px] font-medium',\n\t'subtitle/sb/20': 'text-[20px] font-semibold',\n\t'subtitle/m/20': 'text-[20px] font-medium',\n\t'subtitle/sb/18': 'text-[18px] font-semibold',\n\t'subtitle/m/18': 'text-[18px] font-medium',\n\n\t'body/m/18': 'text-[18px] font-medium',\n\t'body/sb/16': 'text-[16px] font-semibold',\n\t'body/m/16': 'text-[16px] font-medium',\n\t'body/r/16': 'text-[16px] font-normal',\n\t'body/sb/14': 'text-[14px] font-semibold',\n\t'body/m/14': 'text-[14px] font-medium',\n\t'body/r/14': 'text-[14px] font-normal',\n\n\t'button/m/20': 'text-[20px] font-medium',\n\t'button/m/18': 'text-[18px] font-medium',\n\t'button/m/16': 'text-[16px] font-medium',\n\t'button/m/14': 'text-[14px] font-medium',\n\n\t'caption/r/14': 'text-[14px] font-normal',\n\t'caption/sb/12': 'text-[12px] font-semibold',\n\t'caption/m/12': 'text-[12px] font-medium',\n\t'caption/r/12': 'text-[12px] font-normal',\n\t'caption/m/10': 'text-[10px] font-medium',\n\t'caption/r/10': 'text-[10px] font-normal',\n}","'use client'\n\nimport { FC } from 'react'\nimport { cva, VariantProps } from 'class-variance-authority'\nimport { cn } from '@/lib/utils'\nimport { Typography } from '@/stories/typography'\nimport { buttonSizes, buttonVariants } from '../config'\nimport { icons, Loader2 } from 'lucide-react'\nimport { TTypographySizes } from '@/stories/typography/types'\n\nconst buttonConfig = cva(\n\t'transition-all cursor-pointer duration-300 py-2 px-4 rounded-[8px] flex items-center gap-2 disabled:cursor-not-allowed',\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\t...buttonVariants,\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\t...buttonSizes,\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tvariant: 'primary-fill',\n\t\t\tsize: '56',\n\t\t},\n\t},\n)\n\nexport interface IButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonConfig> {\n\t/** Контент кнопки (текст или иконки) */\n\tchildren: React.ReactNode\n\n\t/**\n\t * Иконка для отображения внутри кнопки.\n\t */\n\ticon?: keyof typeof icons\n\n\t/**\n\t * Расположение иконки внутри кнопки.\n\t * По умолчанию 'left'.\n\t */\n\ticonSide?: 'left' | 'right'\n\n\t/**\n\t * Размер текста внутри кнопки.\n\t * По умолчанию 'body/r/16'.\n\t */\n\ttextSize?: TTypographySizes\n\n\t/**\n\t * Отображение индикатора загрузки внутри кнопки.\n\t * Индикатор отображается только при disabled=true.\n\t * По умолчанию false.\n\t */\n\tshowLoader?: boolean\n}\n\n/**\n * Компонент Button используется для интерактивных элементов действия.\n * Поддерживает различные варианты оформления (variant) и размеры (size).\n *\n * @example\n * <Button variant=\"primary-fill\" size=\"40\">Нажми меня</Button>\n */\nexport const Button: FC<IButtonProps> = ({\n\tchildren,\n\tvariant,\n\tsize,\n\tclassName,\n\ticonSide = 'left',\n\ttextSize = 'body/r/16',\n\tshowLoader = false,\n\ticon,\n\t...props\n}) => {\n\tconst Icon = icon && icons[icon]\n\n\treturn (\n\t\t<button {...props} className={cn(buttonConfig({ variant, size, className }))}>\n\t\t\t{props.disabled && showLoader ? (\n\t\t\t\t<div className='flex items-center justify-center'>\n\t\t\t\t\t<Loader2 size={20} strokeWidth={1.5} className='animate-spin' />\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t{Icon && iconSide === 'left' && <Icon size={20} strokeWidth={1.5} />}\n\n\t\t\t\t\t<Typography size={textSize}>{children}</Typography>\n\n\t\t\t\t\t{Icon && iconSide === 'right' && <Icon size={20} strokeWidth={1.5} />}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</button>\n\t)\n}","export const buttonVariants = {\n\t'primary-fill':\n\t\t'bg-blue-500 text-white not-disabled:hover:bg-blue-800 not-disabled:active:bg-blue-700 disabled:bg-neutral-200 disabled:text-neutral-500',\n\t'primary-outline':\n\t\t'bg-transparent border border-blue-500 text-blue-500 not-disabled:hover:border-blue-800 not-disabled:active:border-blue-700 disabled:border-neutral-500 disabled:bg-neutral-200',\n\n\t'secondary-fill': 'bg-neutral-800 text-white hover:bg-neutral-700',\n\t'secondary-outline':\n\t\t'border-2 border-neutral-800 text-neutral-800 not-disabled:hover:bg-neutral-700 not-disabled:active:bg-neutral-700 disabled:bg-neutral-200',\n}","export const buttonSizes = {\n\t'32': 'h-[32px]',\n\t'40': 'h-[40px]',\n\t'48': 'h-[48px]',\n\t'56': 'h-[56px]',\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ACDA,sCAAkC;;;ACJ3B,IAAM,kBAAkB;AAAA,EAC9B,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAEhB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EAEjB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EAEjB,aAAa;AAAA,EACb,cAAc;AAAA,EACd,aAAa;AAAA,EACb,aAAa;AAAA,EACb,cAAc;AAAA,EACd,aAAa;AAAA,EACb,aAAa;AAAA,EAEb,eAAe;AAAA,EACf,eAAe;AAAA,EACf,eAAe;AAAA,EACf,eAAe;AAAA,EAEf,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,gBAAgB;AACjB;;;ADNE;AAvBF,IAAM,yBAAqB,qCAAI,8CAA8C;AAAA,EAC5E,UAAU;AAAA,IACT,MAAM;AAAA,MACL,GAAG;AAAA,IACJ;AAAA,EACD;AAAA,EACA,iBAAiB;AAAA,IAChB,MAAM;AAAA,EACP;AACD,CAAC;AAUM,IAAM,aAAmC,CAAC,EAAE,UAAU,MAAM,KAAK,MAAM,WAAW,GAAG,MAAM,MAAM;AACvG,QAAM,MAAM;AAEZ,SACC,4CAAC,OAAK,GAAG,OAAO,WAAW,GAAG,mBAAmB,EAAE,MAAM,UAAU,CAAC,CAAC,GACnE,UACF;AAEF;;;AE/BA,IAAAA,mCAAkC;;;ACH3B,IAAM,iBAAiB;AAAA,EAC7B,gBACC;AAAA,EACD,mBACC;AAAA,EAED,kBAAkB;AAAA,EAClB,qBACC;AACF;;;ACTO,IAAM,cAAc;AAAA,EAC1B,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACP;;;AFEA,0BAA+B;AA0E1B,IAAAC,sBAAA;AAvEL,IAAM,mBAAe;AAAA,EACpB;AAAA,EACA;AAAA,IACC,UAAU;AAAA,MACT,SAAS;AAAA,QACR,GAAG;AAAA,MACJ;AAAA,MACA,MAAM;AAAA,QACL,GAAG;AAAA,MACJ;AAAA,IACD;AAAA,IACA,iBAAiB;AAAA,MAChB,SAAS;AAAA,MACT,MAAM;AAAA,IACP;AAAA,EACD;AACD;AAsCO,IAAM,SAA2B,CAAC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,WAAW;AAAA,EACX,aAAa;AAAA,EACb;AAAA,EACA,GAAG;AACJ,MAAM;AACL,QAAM,OAAO,QAAQ,0BAAM,IAAI;AAE/B,SACC,6CAAC,YAAQ,GAAG,OAAO,WAAW,GAAG,aAAa,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC,GACzE,gBAAM,YAAY,aAClB,6CAAC,SAAI,WAAU,oCACd,uDAAC,+BAAQ,MAAM,IAAI,aAAa,KAAK,WAAU,gBAAe,GAC/D,IAEA,8EACE;AAAA,YAAQ,aAAa,UAAU,6CAAC,QAAK,MAAM,IAAI,aAAa,KAAK;AAAA,IAElE,6CAAC,cAAW,MAAM,UAAW,UAAS;AAAA,IAErC,QAAQ,aAAa,WAAW,6CAAC,QAAK,MAAM,IAAI,aAAa,KAAK;AAAA,KACpE,GAEF;AAEF;","names":["import_class_variance_authority","import_jsx_runtime"]}
|
package/dist/index.css
CHANGED
|
@@ -8,15 +8,21 @@
|
|
|
8
8
|
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
|
|
9
9
|
"Courier New", monospace;
|
|
10
10
|
--color-red-500: oklch(63.7% 0.237 25.331);
|
|
11
|
-
--color-blue-50: oklch(97% 0.014 254.604);
|
|
12
11
|
--color-blue-500: oklch(62.3% 0.214 259.815);
|
|
13
|
-
--color-blue-
|
|
14
|
-
--color-
|
|
15
|
-
--color-
|
|
16
|
-
--color-
|
|
12
|
+
--color-blue-700: oklch(48.8% 0.243 264.376);
|
|
13
|
+
--color-blue-800: oklch(42.4% 0.199 265.638);
|
|
14
|
+
--color-neutral-200: oklch(92.2% 0 0);
|
|
15
|
+
--color-neutral-500: oklch(55.6% 0 0);
|
|
16
|
+
--color-neutral-700: oklch(37.1% 0 0);
|
|
17
|
+
--color-neutral-800: oklch(26.9% 0 0);
|
|
17
18
|
--color-white: #fff;
|
|
18
19
|
--spacing: 0.25rem;
|
|
20
|
+
--font-weight-normal: 400;
|
|
19
21
|
--font-weight-medium: 500;
|
|
22
|
+
--font-weight-semibold: 600;
|
|
23
|
+
--font-weight-bold: 700;
|
|
24
|
+
--font-weight-extrabold: 800;
|
|
25
|
+
--animate-spin: spin 1s linear infinite;
|
|
20
26
|
--default-transition-duration: 150ms;
|
|
21
27
|
--default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
22
28
|
--default-font-family: var(--font-sans);
|
|
@@ -202,6 +208,12 @@
|
|
|
202
208
|
.transform {
|
|
203
209
|
transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);
|
|
204
210
|
}
|
|
211
|
+
.animate-spin {
|
|
212
|
+
animation: var(--animate-spin);
|
|
213
|
+
}
|
|
214
|
+
.cursor-pointer {
|
|
215
|
+
cursor: pointer;
|
|
216
|
+
}
|
|
205
217
|
.flex-col {
|
|
206
218
|
flex-direction: column;
|
|
207
219
|
}
|
|
@@ -214,6 +226,9 @@
|
|
|
214
226
|
.items-start {
|
|
215
227
|
align-items: flex-start;
|
|
216
228
|
}
|
|
229
|
+
.justify-center {
|
|
230
|
+
justify-content: center;
|
|
231
|
+
}
|
|
217
232
|
.gap-2 {
|
|
218
233
|
gap: calc(var(--spacing) * 2);
|
|
219
234
|
}
|
|
@@ -234,11 +249,14 @@
|
|
|
234
249
|
.border-blue-500 {
|
|
235
250
|
border-color: var(--color-blue-500);
|
|
236
251
|
}
|
|
252
|
+
.border-neutral-800 {
|
|
253
|
+
border-color: var(--color-neutral-800);
|
|
254
|
+
}
|
|
237
255
|
.bg-blue-500 {
|
|
238
256
|
background-color: var(--color-blue-500);
|
|
239
257
|
}
|
|
240
|
-
.bg-
|
|
241
|
-
background-color: var(--color-
|
|
258
|
+
.bg-neutral-800 {
|
|
259
|
+
background-color: var(--color-neutral-800);
|
|
242
260
|
}
|
|
243
261
|
.bg-transparent {
|
|
244
262
|
background-color: transparent;
|
|
@@ -249,25 +267,77 @@
|
|
|
249
267
|
.py-2 {
|
|
250
268
|
padding-block: calc(var(--spacing) * 2);
|
|
251
269
|
}
|
|
270
|
+
.text-\[10px\] {
|
|
271
|
+
font-size: 10px;
|
|
272
|
+
}
|
|
273
|
+
.text-\[12px\] {
|
|
274
|
+
font-size: 12px;
|
|
275
|
+
}
|
|
252
276
|
.text-\[14px\] {
|
|
253
277
|
font-size: 14px;
|
|
254
278
|
}
|
|
255
279
|
.text-\[16px\] {
|
|
256
280
|
font-size: 16px;
|
|
257
281
|
}
|
|
282
|
+
.text-\[18px\] {
|
|
283
|
+
font-size: 18px;
|
|
284
|
+
}
|
|
285
|
+
.text-\[20px\] {
|
|
286
|
+
font-size: 20px;
|
|
287
|
+
}
|
|
288
|
+
.text-\[24px\] {
|
|
289
|
+
font-size: 24px;
|
|
290
|
+
}
|
|
291
|
+
.text-\[28px\] {
|
|
292
|
+
font-size: 28px;
|
|
293
|
+
}
|
|
294
|
+
.text-\[32px\] {
|
|
295
|
+
font-size: 32px;
|
|
296
|
+
}
|
|
297
|
+
.text-\[36px\] {
|
|
298
|
+
font-size: 36px;
|
|
299
|
+
}
|
|
300
|
+
.text-\[40px\] {
|
|
301
|
+
font-size: 40px;
|
|
302
|
+
}
|
|
303
|
+
.text-\[48px\] {
|
|
304
|
+
font-size: 48px;
|
|
305
|
+
}
|
|
306
|
+
.text-\[56px\] {
|
|
307
|
+
font-size: 56px;
|
|
308
|
+
}
|
|
309
|
+
.text-\[64px\] {
|
|
310
|
+
font-size: 64px;
|
|
311
|
+
}
|
|
258
312
|
.leading-\[100\%\] {
|
|
259
313
|
--tw-leading: 100%;
|
|
260
314
|
line-height: 100%;
|
|
261
315
|
}
|
|
316
|
+
.font-bold {
|
|
317
|
+
--tw-font-weight: var(--font-weight-bold);
|
|
318
|
+
font-weight: var(--font-weight-bold);
|
|
319
|
+
}
|
|
320
|
+
.font-extrabold {
|
|
321
|
+
--tw-font-weight: var(--font-weight-extrabold);
|
|
322
|
+
font-weight: var(--font-weight-extrabold);
|
|
323
|
+
}
|
|
262
324
|
.font-medium {
|
|
263
325
|
--tw-font-weight: var(--font-weight-medium);
|
|
264
326
|
font-weight: var(--font-weight-medium);
|
|
265
327
|
}
|
|
328
|
+
.font-normal {
|
|
329
|
+
--tw-font-weight: var(--font-weight-normal);
|
|
330
|
+
font-weight: var(--font-weight-normal);
|
|
331
|
+
}
|
|
332
|
+
.font-semibold {
|
|
333
|
+
--tw-font-weight: var(--font-weight-semibold);
|
|
334
|
+
font-weight: var(--font-weight-semibold);
|
|
335
|
+
}
|
|
266
336
|
.text-blue-500 {
|
|
267
337
|
color: var(--color-blue-500);
|
|
268
338
|
}
|
|
269
|
-
.text-
|
|
270
|
-
color: var(--color-
|
|
339
|
+
.text-neutral-800 {
|
|
340
|
+
color: var(--color-neutral-800);
|
|
271
341
|
}
|
|
272
342
|
.text-red-500 {
|
|
273
343
|
color: var(--color-red-500);
|
|
@@ -275,10 +345,6 @@
|
|
|
275
345
|
.text-white {
|
|
276
346
|
color: var(--color-white);
|
|
277
347
|
}
|
|
278
|
-
.outline {
|
|
279
|
-
outline-style: var(--tw-outline-style);
|
|
280
|
-
outline-width: 1px;
|
|
281
|
-
}
|
|
282
348
|
.transition-all {
|
|
283
349
|
transition-property: all;
|
|
284
350
|
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
@@ -288,27 +354,81 @@
|
|
|
288
354
|
--tw-duration: 300ms;
|
|
289
355
|
transition-duration: 300ms;
|
|
290
356
|
}
|
|
291
|
-
.hover\:bg-
|
|
357
|
+
.hover\:bg-neutral-700 {
|
|
292
358
|
&:hover {
|
|
293
359
|
@media (hover: hover) {
|
|
294
|
-
background-color: var(--color-
|
|
360
|
+
background-color: var(--color-neutral-700);
|
|
295
361
|
}
|
|
296
362
|
}
|
|
297
363
|
}
|
|
298
|
-
.hover\:
|
|
299
|
-
&:
|
|
300
|
-
|
|
301
|
-
|
|
364
|
+
.not-disabled\:hover\:border-blue-800 {
|
|
365
|
+
&:not(*:disabled) {
|
|
366
|
+
&:hover {
|
|
367
|
+
@media (hover: hover) {
|
|
368
|
+
border-color: var(--color-blue-800);
|
|
369
|
+
}
|
|
302
370
|
}
|
|
303
371
|
}
|
|
304
372
|
}
|
|
305
|
-
.hover\:bg-
|
|
306
|
-
&:
|
|
307
|
-
|
|
308
|
-
|
|
373
|
+
.not-disabled\:hover\:bg-blue-800 {
|
|
374
|
+
&:not(*:disabled) {
|
|
375
|
+
&:hover {
|
|
376
|
+
@media (hover: hover) {
|
|
377
|
+
background-color: var(--color-blue-800);
|
|
378
|
+
}
|
|
309
379
|
}
|
|
310
380
|
}
|
|
311
381
|
}
|
|
382
|
+
.not-disabled\:hover\:bg-neutral-700 {
|
|
383
|
+
&:not(*:disabled) {
|
|
384
|
+
&:hover {
|
|
385
|
+
@media (hover: hover) {
|
|
386
|
+
background-color: var(--color-neutral-700);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
.not-disabled\:active\:border-blue-700 {
|
|
392
|
+
&:not(*:disabled) {
|
|
393
|
+
&:active {
|
|
394
|
+
border-color: var(--color-blue-700);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
.not-disabled\:active\:bg-blue-700 {
|
|
399
|
+
&:not(*:disabled) {
|
|
400
|
+
&:active {
|
|
401
|
+
background-color: var(--color-blue-700);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
.not-disabled\:active\:bg-neutral-700 {
|
|
406
|
+
&:not(*:disabled) {
|
|
407
|
+
&:active {
|
|
408
|
+
background-color: var(--color-neutral-700);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
.disabled\:cursor-not-allowed {
|
|
413
|
+
&:disabled {
|
|
414
|
+
cursor: not-allowed;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
.disabled\:border-neutral-500 {
|
|
418
|
+
&:disabled {
|
|
419
|
+
border-color: var(--color-neutral-500);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
.disabled\:bg-neutral-200 {
|
|
423
|
+
&:disabled {
|
|
424
|
+
background-color: var(--color-neutral-200);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
.disabled\:text-neutral-500 {
|
|
428
|
+
&:disabled {
|
|
429
|
+
color: var(--color-neutral-500);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
312
432
|
}
|
|
313
433
|
:root {
|
|
314
434
|
--color-primary: #3b82f6;
|
|
@@ -426,15 +546,15 @@
|
|
|
426
546
|
syntax: "*";
|
|
427
547
|
inherits: false;
|
|
428
548
|
}
|
|
429
|
-
@property --tw-outline-style {
|
|
430
|
-
syntax: "*";
|
|
431
|
-
inherits: false;
|
|
432
|
-
initial-value: solid;
|
|
433
|
-
}
|
|
434
549
|
@property --tw-duration {
|
|
435
550
|
syntax: "*";
|
|
436
551
|
inherits: false;
|
|
437
552
|
}
|
|
553
|
+
@keyframes spin {
|
|
554
|
+
to {
|
|
555
|
+
transform: rotate(360deg);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
438
558
|
@layer properties {
|
|
439
559
|
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
440
560
|
*, ::before, ::after, ::backdrop {
|
|
@@ -446,7 +566,6 @@
|
|
|
446
566
|
--tw-border-style: solid;
|
|
447
567
|
--tw-leading: initial;
|
|
448
568
|
--tw-font-weight: initial;
|
|
449
|
-
--tw-outline-style: solid;
|
|
450
569
|
--tw-duration: initial;
|
|
451
570
|
}
|
|
452
571
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
2
|
import { FC } from 'react';
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { icons } from 'lucide-react';
|
|
4
5
|
|
|
5
6
|
declare const typographyVariants: (props?: ({
|
|
6
|
-
size?: "button/m/16" | "button/m/14" | null | undefined;
|
|
7
|
+
size?: "body/r/16" | "display/eb/64" | "display/b/56" | "heading/b/48" | "heading/sb/40" | "heading/sb/36" | "heading/sb/32" | "heading/sb/28" | "subtitle/sb/24" | "subtitle/m/24" | "subtitle/sb/20" | "subtitle/m/20" | "subtitle/sb/18" | "subtitle/m/18" | "body/m/18" | "body/sb/16" | "body/m/16" | "body/sb/14" | "body/m/14" | "body/r/14" | "button/m/20" | "button/m/18" | "button/m/16" | "button/m/14" | "caption/r/14" | "caption/sb/12" | "caption/m/12" | "caption/r/12" | "caption/m/10" | "caption/r/10" | null | undefined;
|
|
7
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
8
9
|
type TTag = 'p' | 'span';
|
|
9
10
|
interface ITypographyProps extends React.HTMLAttributes<HTMLParagraphElement>, VariantProps<typeof typographyVariants> {
|
|
@@ -12,25 +13,75 @@ interface ITypographyProps extends React.HTMLAttributes<HTMLParagraphElement>, V
|
|
|
12
13
|
}
|
|
13
14
|
declare const Typography: FC<ITypographyProps>;
|
|
14
15
|
|
|
15
|
-
declare const
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
declare const typographySizes: {
|
|
17
|
+
'display/eb/64': string;
|
|
18
|
+
'display/b/56': string;
|
|
19
|
+
'heading/b/48': string;
|
|
20
|
+
'heading/sb/40': string;
|
|
21
|
+
'heading/sb/36': string;
|
|
22
|
+
'heading/sb/32': string;
|
|
23
|
+
'heading/sb/28': string;
|
|
24
|
+
'subtitle/sb/24': string;
|
|
25
|
+
'subtitle/m/24': string;
|
|
26
|
+
'subtitle/sb/20': string;
|
|
27
|
+
'subtitle/m/20': string;
|
|
28
|
+
'subtitle/sb/18': string;
|
|
29
|
+
'subtitle/m/18': string;
|
|
30
|
+
'body/m/18': string;
|
|
31
|
+
'body/sb/16': string;
|
|
32
|
+
'body/m/16': string;
|
|
33
|
+
'body/r/16': string;
|
|
34
|
+
'body/sb/14': string;
|
|
35
|
+
'body/m/14': string;
|
|
36
|
+
'body/r/14': string;
|
|
37
|
+
'button/m/20': string;
|
|
38
|
+
'button/m/18': string;
|
|
39
|
+
'button/m/16': string;
|
|
40
|
+
'button/m/14': string;
|
|
41
|
+
'caption/r/14': string;
|
|
42
|
+
'caption/sb/12': string;
|
|
43
|
+
'caption/m/12': string;
|
|
44
|
+
'caption/r/12': string;
|
|
45
|
+
'caption/m/10': string;
|
|
46
|
+
'caption/r/10': string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
type TTypographySizes = keyof typeof typographySizes;
|
|
50
|
+
|
|
51
|
+
declare const buttonConfig: (props?: ({
|
|
52
|
+
variant?: "primary-fill" | "primary-outline" | "secondary-fill" | "secondary-outline" | null | undefined;
|
|
53
|
+
size?: "56" | "32" | "40" | "48" | null | undefined;
|
|
18
54
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
19
|
-
interface IButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof
|
|
55
|
+
interface IButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonConfig> {
|
|
20
56
|
/** Контент кнопки (текст или иконки) */
|
|
21
57
|
children: React.ReactNode;
|
|
22
58
|
/**
|
|
23
|
-
*
|
|
59
|
+
* Иконка для отображения внутри кнопки.
|
|
60
|
+
*/
|
|
61
|
+
icon?: keyof typeof icons;
|
|
62
|
+
/**
|
|
63
|
+
* Расположение иконки внутри кнопки.
|
|
64
|
+
* По умолчанию 'left'.
|
|
65
|
+
*/
|
|
66
|
+
iconSide?: 'left' | 'right';
|
|
67
|
+
/**
|
|
68
|
+
* Размер текста внутри кнопки.
|
|
69
|
+
* По умолчанию 'body/r/16'.
|
|
70
|
+
*/
|
|
71
|
+
textSize?: TTypographySizes;
|
|
72
|
+
/**
|
|
73
|
+
* Отображение индикатора загрузки внутри кнопки.
|
|
74
|
+
* Индикатор отображается только при disabled=true.
|
|
24
75
|
* По умолчанию false.
|
|
25
76
|
*/
|
|
26
|
-
|
|
77
|
+
showLoader?: boolean;
|
|
27
78
|
}
|
|
28
79
|
/**
|
|
29
80
|
* Компонент Button используется для интерактивных элементов действия.
|
|
30
|
-
* Поддерживает различные варианты оформления (
|
|
81
|
+
* Поддерживает различные варианты оформления (variant) и размеры (size).
|
|
31
82
|
*
|
|
32
83
|
* @example
|
|
33
|
-
* <Button
|
|
84
|
+
* <Button variant="primary-fill" size="40">Нажми меня</Button>
|
|
34
85
|
*/
|
|
35
86
|
declare const Button: FC<IButtonProps>;
|
|
36
87
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
2
|
import { FC } from 'react';
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { icons } from 'lucide-react';
|
|
4
5
|
|
|
5
6
|
declare const typographyVariants: (props?: ({
|
|
6
|
-
size?: "button/m/16" | "button/m/14" | null | undefined;
|
|
7
|
+
size?: "body/r/16" | "display/eb/64" | "display/b/56" | "heading/b/48" | "heading/sb/40" | "heading/sb/36" | "heading/sb/32" | "heading/sb/28" | "subtitle/sb/24" | "subtitle/m/24" | "subtitle/sb/20" | "subtitle/m/20" | "subtitle/sb/18" | "subtitle/m/18" | "body/m/18" | "body/sb/16" | "body/m/16" | "body/sb/14" | "body/m/14" | "body/r/14" | "button/m/20" | "button/m/18" | "button/m/16" | "button/m/14" | "caption/r/14" | "caption/sb/12" | "caption/m/12" | "caption/r/12" | "caption/m/10" | "caption/r/10" | null | undefined;
|
|
7
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
8
9
|
type TTag = 'p' | 'span';
|
|
9
10
|
interface ITypographyProps extends React.HTMLAttributes<HTMLParagraphElement>, VariantProps<typeof typographyVariants> {
|
|
@@ -12,25 +13,75 @@ interface ITypographyProps extends React.HTMLAttributes<HTMLParagraphElement>, V
|
|
|
12
13
|
}
|
|
13
14
|
declare const Typography: FC<ITypographyProps>;
|
|
14
15
|
|
|
15
|
-
declare const
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
declare const typographySizes: {
|
|
17
|
+
'display/eb/64': string;
|
|
18
|
+
'display/b/56': string;
|
|
19
|
+
'heading/b/48': string;
|
|
20
|
+
'heading/sb/40': string;
|
|
21
|
+
'heading/sb/36': string;
|
|
22
|
+
'heading/sb/32': string;
|
|
23
|
+
'heading/sb/28': string;
|
|
24
|
+
'subtitle/sb/24': string;
|
|
25
|
+
'subtitle/m/24': string;
|
|
26
|
+
'subtitle/sb/20': string;
|
|
27
|
+
'subtitle/m/20': string;
|
|
28
|
+
'subtitle/sb/18': string;
|
|
29
|
+
'subtitle/m/18': string;
|
|
30
|
+
'body/m/18': string;
|
|
31
|
+
'body/sb/16': string;
|
|
32
|
+
'body/m/16': string;
|
|
33
|
+
'body/r/16': string;
|
|
34
|
+
'body/sb/14': string;
|
|
35
|
+
'body/m/14': string;
|
|
36
|
+
'body/r/14': string;
|
|
37
|
+
'button/m/20': string;
|
|
38
|
+
'button/m/18': string;
|
|
39
|
+
'button/m/16': string;
|
|
40
|
+
'button/m/14': string;
|
|
41
|
+
'caption/r/14': string;
|
|
42
|
+
'caption/sb/12': string;
|
|
43
|
+
'caption/m/12': string;
|
|
44
|
+
'caption/r/12': string;
|
|
45
|
+
'caption/m/10': string;
|
|
46
|
+
'caption/r/10': string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
type TTypographySizes = keyof typeof typographySizes;
|
|
50
|
+
|
|
51
|
+
declare const buttonConfig: (props?: ({
|
|
52
|
+
variant?: "primary-fill" | "primary-outline" | "secondary-fill" | "secondary-outline" | null | undefined;
|
|
53
|
+
size?: "56" | "32" | "40" | "48" | null | undefined;
|
|
18
54
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
19
|
-
interface IButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof
|
|
55
|
+
interface IButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonConfig> {
|
|
20
56
|
/** Контент кнопки (текст или иконки) */
|
|
21
57
|
children: React.ReactNode;
|
|
22
58
|
/**
|
|
23
|
-
*
|
|
59
|
+
* Иконка для отображения внутри кнопки.
|
|
60
|
+
*/
|
|
61
|
+
icon?: keyof typeof icons;
|
|
62
|
+
/**
|
|
63
|
+
* Расположение иконки внутри кнопки.
|
|
64
|
+
* По умолчанию 'left'.
|
|
65
|
+
*/
|
|
66
|
+
iconSide?: 'left' | 'right';
|
|
67
|
+
/**
|
|
68
|
+
* Размер текста внутри кнопки.
|
|
69
|
+
* По умолчанию 'body/r/16'.
|
|
70
|
+
*/
|
|
71
|
+
textSize?: TTypographySizes;
|
|
72
|
+
/**
|
|
73
|
+
* Отображение индикатора загрузки внутри кнопки.
|
|
74
|
+
* Индикатор отображается только при disabled=true.
|
|
24
75
|
* По умолчанию false.
|
|
25
76
|
*/
|
|
26
|
-
|
|
77
|
+
showLoader?: boolean;
|
|
27
78
|
}
|
|
28
79
|
/**
|
|
29
80
|
* Компонент Button используется для интерактивных элементов действия.
|
|
30
|
-
* Поддерживает различные варианты оформления (
|
|
81
|
+
* Поддерживает различные варианты оформления (variant) и размеры (size).
|
|
31
82
|
*
|
|
32
83
|
* @example
|
|
33
|
-
* <Button
|
|
84
|
+
* <Button variant="primary-fill" size="40">Нажми меня</Button>
|
|
34
85
|
*/
|
|
35
86
|
declare const Button: FC<IButtonProps>;
|
|
36
87
|
|
package/dist/index.js
CHANGED
|
@@ -10,8 +10,36 @@ import { cva } from "class-variance-authority";
|
|
|
10
10
|
|
|
11
11
|
// src/stories/typography/config/typography-sizes.ts
|
|
12
12
|
var typographySizes = {
|
|
13
|
+
"display/eb/64": "text-[64px] font-extrabold",
|
|
14
|
+
"display/b/56": "text-[56px] font-bold",
|
|
15
|
+
"heading/b/48": "text-[48px] font-bold",
|
|
16
|
+
"heading/sb/40": "text-[40px] font-semibold",
|
|
17
|
+
"heading/sb/36": "text-[36px] font-semibold",
|
|
18
|
+
"heading/sb/32": "text-[32px] font-semibold",
|
|
19
|
+
"heading/sb/28": "text-[28px] font-semibold",
|
|
20
|
+
"subtitle/sb/24": "text-[24px] font-semibold",
|
|
21
|
+
"subtitle/m/24": "text-[24px] font-medium",
|
|
22
|
+
"subtitle/sb/20": "text-[20px] font-semibold",
|
|
23
|
+
"subtitle/m/20": "text-[20px] font-medium",
|
|
24
|
+
"subtitle/sb/18": "text-[18px] font-semibold",
|
|
25
|
+
"subtitle/m/18": "text-[18px] font-medium",
|
|
26
|
+
"body/m/18": "text-[18px] font-medium",
|
|
27
|
+
"body/sb/16": "text-[16px] font-semibold",
|
|
28
|
+
"body/m/16": "text-[16px] font-medium",
|
|
29
|
+
"body/r/16": "text-[16px] font-normal",
|
|
30
|
+
"body/sb/14": "text-[14px] font-semibold",
|
|
31
|
+
"body/m/14": "text-[14px] font-medium",
|
|
32
|
+
"body/r/14": "text-[14px] font-normal",
|
|
33
|
+
"button/m/20": "text-[20px] font-medium",
|
|
34
|
+
"button/m/18": "text-[18px] font-medium",
|
|
13
35
|
"button/m/16": "text-[16px] font-medium",
|
|
14
|
-
"button/m/14": "text-[14px] font-medium"
|
|
36
|
+
"button/m/14": "text-[14px] font-medium",
|
|
37
|
+
"caption/r/14": "text-[14px] font-normal",
|
|
38
|
+
"caption/sb/12": "text-[12px] font-semibold",
|
|
39
|
+
"caption/m/12": "text-[12px] font-medium",
|
|
40
|
+
"caption/r/12": "text-[12px] font-normal",
|
|
41
|
+
"caption/m/10": "text-[10px] font-medium",
|
|
42
|
+
"caption/r/10": "text-[10px] font-normal"
|
|
15
43
|
};
|
|
16
44
|
|
|
17
45
|
// src/stories/typography/ui/typography.tsx
|
|
@@ -23,7 +51,7 @@ var typographyVariants = cva("transition-all duration-300 leading-[100%]", {
|
|
|
23
51
|
}
|
|
24
52
|
},
|
|
25
53
|
defaultVariants: {
|
|
26
|
-
size: "
|
|
54
|
+
size: "body/r/16"
|
|
27
55
|
}
|
|
28
56
|
});
|
|
29
57
|
var Typography = ({ children, tag = "p", size, className, ...props }) => {
|
|
@@ -34,11 +62,12 @@ var Typography = ({ children, tag = "p", size, className, ...props }) => {
|
|
|
34
62
|
// src/stories/button/ui/button.tsx
|
|
35
63
|
import { cva as cva2 } from "class-variance-authority";
|
|
36
64
|
|
|
37
|
-
// src/stories/button/config/button-
|
|
38
|
-
var
|
|
39
|
-
primary: "bg-blue-500 text-white hover:bg-blue-
|
|
40
|
-
|
|
41
|
-
|
|
65
|
+
// src/stories/button/config/button-variants.ts
|
|
66
|
+
var buttonVariants = {
|
|
67
|
+
"primary-fill": "bg-blue-500 text-white not-disabled:hover:bg-blue-800 not-disabled:active:bg-blue-700 disabled:bg-neutral-200 disabled:text-neutral-500",
|
|
68
|
+
"primary-outline": "bg-transparent border border-blue-500 text-blue-500 not-disabled:hover:border-blue-800 not-disabled:active:border-blue-700 disabled:border-neutral-500 disabled:bg-neutral-200",
|
|
69
|
+
"secondary-fill": "bg-neutral-800 text-white hover:bg-neutral-700",
|
|
70
|
+
"secondary-outline": "border-2 border-neutral-800 text-neutral-800 not-disabled:hover:bg-neutral-700 not-disabled:active:bg-neutral-700 disabled:bg-neutral-200"
|
|
42
71
|
};
|
|
43
72
|
|
|
44
73
|
// src/stories/button/config/button-sizes.ts
|
|
@@ -50,23 +79,42 @@ var buttonSizes = {
|
|
|
50
79
|
};
|
|
51
80
|
|
|
52
81
|
// src/stories/button/ui/button.tsx
|
|
53
|
-
import {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
82
|
+
import { icons, Loader2 } from "lucide-react";
|
|
83
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
84
|
+
var buttonConfig = cva2(
|
|
85
|
+
"transition-all cursor-pointer duration-300 py-2 px-4 rounded-[8px] flex items-center gap-2 disabled:cursor-not-allowed",
|
|
86
|
+
{
|
|
87
|
+
variants: {
|
|
88
|
+
variant: {
|
|
89
|
+
...buttonVariants
|
|
90
|
+
},
|
|
91
|
+
size: {
|
|
92
|
+
...buttonSizes
|
|
93
|
+
}
|
|
58
94
|
},
|
|
59
|
-
|
|
60
|
-
|
|
95
|
+
defaultVariants: {
|
|
96
|
+
variant: "primary-fill",
|
|
97
|
+
size: "56"
|
|
61
98
|
}
|
|
62
|
-
},
|
|
63
|
-
defaultVariants: {
|
|
64
|
-
bg: "primary",
|
|
65
|
-
size: "32"
|
|
66
99
|
}
|
|
67
|
-
|
|
68
|
-
var Button = ({
|
|
69
|
-
|
|
100
|
+
);
|
|
101
|
+
var Button = ({
|
|
102
|
+
children,
|
|
103
|
+
variant,
|
|
104
|
+
size,
|
|
105
|
+
className,
|
|
106
|
+
iconSide = "left",
|
|
107
|
+
textSize = "body/r/16",
|
|
108
|
+
showLoader = false,
|
|
109
|
+
icon,
|
|
110
|
+
...props
|
|
111
|
+
}) => {
|
|
112
|
+
const Icon = icon && icons[icon];
|
|
113
|
+
return /* @__PURE__ */ jsx2("button", { ...props, className: cn(buttonConfig({ variant, size, className })), children: props.disabled && showLoader ? /* @__PURE__ */ jsx2("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx2(Loader2, { size: 20, strokeWidth: 1.5, className: "animate-spin" }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
114
|
+
Icon && iconSide === "left" && /* @__PURE__ */ jsx2(Icon, { size: 20, strokeWidth: 1.5 }),
|
|
115
|
+
/* @__PURE__ */ jsx2(Typography, { size: textSize, children }),
|
|
116
|
+
Icon && iconSide === "right" && /* @__PURE__ */ jsx2(Icon, { size: 20, strokeWidth: 1.5 })
|
|
117
|
+
] }) });
|
|
70
118
|
};
|
|
71
119
|
export {
|
|
72
120
|
Button,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/utils.ts","../src/stories/typography/ui/typography.tsx","../src/stories/typography/config/typography-sizes.ts","../src/stories/button/ui/button.tsx","../src/stories/button/config/button-
|
|
1
|
+
{"version":3,"sources":["../src/lib/utils.ts","../src/stories/typography/ui/typography.tsx","../src/stories/typography/config/typography-sizes.ts","../src/stories/button/ui/button.tsx","../src/stories/button/config/button-variants.ts","../src/stories/button/config/button-sizes.ts"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","'use client'\n\nimport { FC } from 'react'\nimport { cn } from '@/lib/utils'\nimport { cva, VariantProps } from 'class-variance-authority'\nimport { typographySizes } from '../config/typography-sizes'\n\nconst typographyVariants = cva('transition-all duration-300 leading-[100%]', {\n\tvariants: {\n\t\tsize: {\n\t\t\t...typographySizes,\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tsize: 'body/r/16',\n\t},\n})\n\ntype TTag = 'p' | 'span'\n\nexport interface ITypographyProps\n\textends React.HTMLAttributes<HTMLParagraphElement>, VariantProps<typeof typographyVariants> {\n\tchildren: React.ReactNode\n\ttag?: TTag\n}\n\nexport const Typography: FC<ITypographyProps> = ({ children, tag = 'p', size, className, ...props }) => {\n\tconst Tag = tag\n\n\treturn (\n\t\t<Tag {...props} className={cn(typographyVariants({ size, className }))}>\n\t\t\t{children}\n\t\t</Tag>\n\t)\n}","export const typographySizes = {\n\t'display/eb/64': 'text-[64px] font-extrabold',\n\t'display/b/56': 'text-[56px] font-bold',\n\n\t'heading/b/48': 'text-[48px] font-bold',\n\t'heading/sb/40': 'text-[40px] font-semibold',\n\t'heading/sb/36': 'text-[36px] font-semibold',\n\t'heading/sb/32': 'text-[32px] font-semibold',\n\t'heading/sb/28': 'text-[28px] font-semibold',\n\n\t'subtitle/sb/24': 'text-[24px] font-semibold',\n\t'subtitle/m/24': 'text-[24px] font-medium',\n\t'subtitle/sb/20': 'text-[20px] font-semibold',\n\t'subtitle/m/20': 'text-[20px] font-medium',\n\t'subtitle/sb/18': 'text-[18px] font-semibold',\n\t'subtitle/m/18': 'text-[18px] font-medium',\n\n\t'body/m/18': 'text-[18px] font-medium',\n\t'body/sb/16': 'text-[16px] font-semibold',\n\t'body/m/16': 'text-[16px] font-medium',\n\t'body/r/16': 'text-[16px] font-normal',\n\t'body/sb/14': 'text-[14px] font-semibold',\n\t'body/m/14': 'text-[14px] font-medium',\n\t'body/r/14': 'text-[14px] font-normal',\n\n\t'button/m/20': 'text-[20px] font-medium',\n\t'button/m/18': 'text-[18px] font-medium',\n\t'button/m/16': 'text-[16px] font-medium',\n\t'button/m/14': 'text-[14px] font-medium',\n\n\t'caption/r/14': 'text-[14px] font-normal',\n\t'caption/sb/12': 'text-[12px] font-semibold',\n\t'caption/m/12': 'text-[12px] font-medium',\n\t'caption/r/12': 'text-[12px] font-normal',\n\t'caption/m/10': 'text-[10px] font-medium',\n\t'caption/r/10': 'text-[10px] font-normal',\n}","'use client'\n\nimport { FC } from 'react'\nimport { cva, VariantProps } from 'class-variance-authority'\nimport { cn } from '@/lib/utils'\nimport { Typography } from '@/stories/typography'\nimport { buttonSizes, buttonVariants } from '../config'\nimport { icons, Loader2 } from 'lucide-react'\nimport { TTypographySizes } from '@/stories/typography/types'\n\nconst buttonConfig = cva(\n\t'transition-all cursor-pointer duration-300 py-2 px-4 rounded-[8px] flex items-center gap-2 disabled:cursor-not-allowed',\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\t...buttonVariants,\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\t...buttonSizes,\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tvariant: 'primary-fill',\n\t\t\tsize: '56',\n\t\t},\n\t},\n)\n\nexport interface IButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonConfig> {\n\t/** Контент кнопки (текст или иконки) */\n\tchildren: React.ReactNode\n\n\t/**\n\t * Иконка для отображения внутри кнопки.\n\t */\n\ticon?: keyof typeof icons\n\n\t/**\n\t * Расположение иконки внутри кнопки.\n\t * По умолчанию 'left'.\n\t */\n\ticonSide?: 'left' | 'right'\n\n\t/**\n\t * Размер текста внутри кнопки.\n\t * По умолчанию 'body/r/16'.\n\t */\n\ttextSize?: TTypographySizes\n\n\t/**\n\t * Отображение индикатора загрузки внутри кнопки.\n\t * Индикатор отображается только при disabled=true.\n\t * По умолчанию false.\n\t */\n\tshowLoader?: boolean\n}\n\n/**\n * Компонент Button используется для интерактивных элементов действия.\n * Поддерживает различные варианты оформления (variant) и размеры (size).\n *\n * @example\n * <Button variant=\"primary-fill\" size=\"40\">Нажми меня</Button>\n */\nexport const Button: FC<IButtonProps> = ({\n\tchildren,\n\tvariant,\n\tsize,\n\tclassName,\n\ticonSide = 'left',\n\ttextSize = 'body/r/16',\n\tshowLoader = false,\n\ticon,\n\t...props\n}) => {\n\tconst Icon = icon && icons[icon]\n\n\treturn (\n\t\t<button {...props} className={cn(buttonConfig({ variant, size, className }))}>\n\t\t\t{props.disabled && showLoader ? (\n\t\t\t\t<div className='flex items-center justify-center'>\n\t\t\t\t\t<Loader2 size={20} strokeWidth={1.5} className='animate-spin' />\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t{Icon && iconSide === 'left' && <Icon size={20} strokeWidth={1.5} />}\n\n\t\t\t\t\t<Typography size={textSize}>{children}</Typography>\n\n\t\t\t\t\t{Icon && iconSide === 'right' && <Icon size={20} strokeWidth={1.5} />}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</button>\n\t)\n}","export const buttonVariants = {\n\t'primary-fill':\n\t\t'bg-blue-500 text-white not-disabled:hover:bg-blue-800 not-disabled:active:bg-blue-700 disabled:bg-neutral-200 disabled:text-neutral-500',\n\t'primary-outline':\n\t\t'bg-transparent border border-blue-500 text-blue-500 not-disabled:hover:border-blue-800 not-disabled:active:border-blue-700 disabled:border-neutral-500 disabled:bg-neutral-200',\n\n\t'secondary-fill': 'bg-neutral-800 text-white hover:bg-neutral-700',\n\t'secondary-outline':\n\t\t'border-2 border-neutral-800 text-neutral-800 not-disabled:hover:bg-neutral-700 not-disabled:active:bg-neutral-700 disabled:bg-neutral-200',\n}","export const buttonSizes = {\n\t'32': 'h-[32px]',\n\t'40': 'h-[40px]',\n\t'48': 'h-[48px]',\n\t'56': 'h-[56px]',\n}"],"mappings":";AAAA,SAAS,YAA6B;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACDA,SAAS,WAAyB;;;ACJ3B,IAAM,kBAAkB;AAAA,EAC9B,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAEhB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EAEjB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EAEjB,aAAa;AAAA,EACb,cAAc;AAAA,EACd,aAAa;AAAA,EACb,aAAa;AAAA,EACb,cAAc;AAAA,EACd,aAAa;AAAA,EACb,aAAa;AAAA,EAEb,eAAe;AAAA,EACf,eAAe;AAAA,EACf,eAAe;AAAA,EACf,eAAe;AAAA,EAEf,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,gBAAgB;AACjB;;;ADNE;AAvBF,IAAM,qBAAqB,IAAI,8CAA8C;AAAA,EAC5E,UAAU;AAAA,IACT,MAAM;AAAA,MACL,GAAG;AAAA,IACJ;AAAA,EACD;AAAA,EACA,iBAAiB;AAAA,IAChB,MAAM;AAAA,EACP;AACD,CAAC;AAUM,IAAM,aAAmC,CAAC,EAAE,UAAU,MAAM,KAAK,MAAM,WAAW,GAAG,MAAM,MAAM;AACvG,QAAM,MAAM;AAEZ,SACC,oBAAC,OAAK,GAAG,OAAO,WAAW,GAAG,mBAAmB,EAAE,MAAM,UAAU,CAAC,CAAC,GACnE,UACF;AAEF;;;AE/BA,SAAS,OAAAA,YAAyB;;;ACH3B,IAAM,iBAAiB;AAAA,EAC7B,gBACC;AAAA,EACD,mBACC;AAAA,EAED,kBAAkB;AAAA,EAClB,qBACC;AACF;;;ACTO,IAAM,cAAc;AAAA,EAC1B,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACP;;;AFEA,SAAS,OAAO,eAAe;AA0E1B,SAGD,UAHC,OAAAC,MAGD,YAHC;AAvEL,IAAM,eAAeC;AAAA,EACpB;AAAA,EACA;AAAA,IACC,UAAU;AAAA,MACT,SAAS;AAAA,QACR,GAAG;AAAA,MACJ;AAAA,MACA,MAAM;AAAA,QACL,GAAG;AAAA,MACJ;AAAA,IACD;AAAA,IACA,iBAAiB;AAAA,MAChB,SAAS;AAAA,MACT,MAAM;AAAA,IACP;AAAA,EACD;AACD;AAsCO,IAAM,SAA2B,CAAC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,WAAW;AAAA,EACX,aAAa;AAAA,EACb;AAAA,EACA,GAAG;AACJ,MAAM;AACL,QAAM,OAAO,QAAQ,MAAM,IAAI;AAE/B,SACC,gBAAAD,KAAC,YAAQ,GAAG,OAAO,WAAW,GAAG,aAAa,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC,GACzE,gBAAM,YAAY,aAClB,gBAAAA,KAAC,SAAI,WAAU,oCACd,0BAAAA,KAAC,WAAQ,MAAM,IAAI,aAAa,KAAK,WAAU,gBAAe,GAC/D,IAEA,iCACE;AAAA,YAAQ,aAAa,UAAU,gBAAAA,KAAC,QAAK,MAAM,IAAI,aAAa,KAAK;AAAA,IAElE,gBAAAA,KAAC,cAAW,MAAM,UAAW,UAAS;AAAA,IAErC,QAAQ,aAAa,WAAW,gBAAAA,KAAC,QAAK,MAAM,IAAI,aAAa,KAAK;AAAA,KACpE,GAEF;AAEF;","names":["cva","jsx","cva"]}
|