snapflow-ui-kit 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -0
- package/dist/components/Button/Button.d.ts +14 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/package.json +82 -0
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Snapflow UI Kit
|
|
2
|
+
|
|
3
|
+
Библиотека React UI компонентов на TypeScript с Storybook документацией.
|
|
4
|
+
|
|
5
|
+
> **Проект находится на начальной стадии разработки.** API и документация могут изменяться.
|
|
6
|
+
|
|
7
|
+
## Разработка
|
|
8
|
+
|
|
9
|
+
### Команды
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm dev # Запуск Storybook (порт 6006)
|
|
13
|
+
pnpm build # Сборка библиотеки
|
|
14
|
+
pnpm lint # Проверка ESLint
|
|
15
|
+
pnpm lint:fix # Автоисправление ESLint
|
|
16
|
+
pnpm lint:style # Проверка Stylelint для CSS
|
|
17
|
+
pnpm lint:style:fix # Автоисправление Stylelint
|
|
18
|
+
pnpm format # Проверка Prettier
|
|
19
|
+
pnpm format:fix # Форматирование Prettier
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Структура компонентов
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
src/components/{ComponentName}/
|
|
26
|
+
├── {ComponentName}.tsx # Реализация компонента
|
|
27
|
+
├── {ComponentName}.module.css # CSS Module стили
|
|
28
|
+
├── {ComponentName}.stories.tsx # Storybook истории
|
|
29
|
+
└── index.ts # Экспорты
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
> **Важно:** После создания нового компонента добавьте его экспорт в `src/components/index.ts`.
|
|
33
|
+
>
|
|
34
|
+
> Это barrel-файл, через который все компоненты реэкспортируются наружу библиотеки.
|
|
35
|
+
>
|
|
36
|
+
> Без этого компонент не будет доступен пользователям.
|
|
37
|
+
|
|
38
|
+
### Стек технологий
|
|
39
|
+
|
|
40
|
+
- React 19
|
|
41
|
+
- TypeScript
|
|
42
|
+
- Vite
|
|
43
|
+
- Storybook 10
|
|
44
|
+
- CSS Modules
|
|
45
|
+
- ESLint + Prettier + Stylelint
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'outlined' | 'text';
|
|
3
|
+
type CommonProps = {
|
|
4
|
+
variant?: ButtonVariant;
|
|
5
|
+
};
|
|
6
|
+
type AsButtonProps = {
|
|
7
|
+
asLink?: false;
|
|
8
|
+
} & CommonProps & ComponentPropsWithoutRef<'button'>;
|
|
9
|
+
type AsLinkProps = {
|
|
10
|
+
asLink: true;
|
|
11
|
+
} & CommonProps & ComponentPropsWithoutRef<'a'>;
|
|
12
|
+
export type ButtonProps = AsButtonProps | AsLinkProps;
|
|
13
|
+
export declare const Button: (props: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Button';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Button';
|
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import"https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap";:root{--color-accent-100: #73a5ff;--color-accent-300: #4c8dff;--color-accent-500: #397df6;--color-accent-700: #2f68cc;--color-accent-900: #234e99;--color-success-100: #80ffbf;--color-success-300: #22e584;--color-success-500: #14cc70;--color-success-700: #0f9954;--color-success-900: #0a6638;--color-danger-100: #ff8099;--color-danger-300: #f23d61;--color-danger-500: #cc1439;--color-danger-700: #990f2b;--color-danger-900: #660a1d;--color-warning-100: #ffd073;--color-warning-300: #e5ac39;--color-warning-500: #d99000;--color-warning-700: #960;--color-warning-900: #640;--color-dark-100: #4c4c4c;--color-dark-300: #333;--color-dark-500: #171717;--color-dark-700: #0d0d0d;--color-dark-900: #000;--color-light-100: #fff;--color-light-300: #f7fbff;--color-light-500: #edf3fa;--color-light-700: #d5dae0;--color-light-900: #8d9094}html{box-sizing:border-box;font-size:100%}*,*:before,*:after{box-sizing:border-box}body{margin:0;padding:0;font-family:Inter,sans-serif}input,button,select,textarea,optgroup,option{font-family:inherit;font-size:inherit;font-weight:inherit;font-style:inherit;color:inherit}._button_x75vv_1{all:unset;cursor:pointer;box-sizing:border-box;padding:6px 24px;border-radius:2px;font-weight:600;line-height:150%;text-align:center;transition-duration:.2s}._button_x75vv_1:disabled{cursor:not-allowed}._primary_x75vv_21{color:var(--color-light-100);background-color:var(--color-accent-500)}._primary_x75vv_21:active{color:var(--color-light-500);background-color:var(--color-accent-700)}._primary_x75vv_21:focus-visible{border:2px solid var(--color-accent-700)}._primary_x75vv_21:disabled{color:var(--color-light-900);background-color:var(--color-accent-900)}._primary_x75vv_21:hover:not(:active,:focus-visible){background-color:var(--color-accent-100)}._secondary_x75vv_44{color:var(--color-light-100);background-color:var(--color-dark-300)}._secondary_x75vv_44:active{color:var(--color-light-500);background-color:#212121}._secondary_x75vv_44:focus-visible{border:1px solid var(--color-accent-300)}._secondary_x75vv_44:disabled{color:var(--color-light-900);background-color:var(--color-dark-500)}._secondary_x75vv_44:hover:not(:active,:focus-visible){background-color:var(--color-dark-100)}._outlined_x75vv_67{border:1px solid var(--color-accent-500);color:var(--color-accent-500);background-color:transparent}._outlined_x75vv_67:active{border-color:var(--color-accent-700);color:var(--color-accent-700)}._outlined_x75vv_67:focus-visible{border:2px solid var(--color-accent-700);color:var(--color-accent-700)}._outlined_x75vv_67:disabled{border-color:var(--color-accent-900);color:var(--color-accent-900)}._outlined_x75vv_67:hover:not(:active,:focus-visible){border-color:var(--color-accent-100);color:var(--color-accent-100)}._text_x75vv_93{color:var(--color-accent-500)}._text_x75vv_93:active{color:var(--color-accent-700)}._text_x75vv_93:focus-visible{border:2px solid var(--color-accent-700)}._text_x75vv_93:disabled{color:var(--color-accent-900)}._text_x75vv_93:hover:not(:active,:focus-visible){color:var(--color-accent-100)}._icon_x75vv_113{color:#000;background-color:transparent}._link_x75vv_118{color:#00f;background-color:transparent}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { clsx as v } from "clsx";
|
|
2
|
+
import { clsx as j } from "clsx";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
const x = "_button_x75vv_1", l = "_primary_x75vv_21", m = "_secondary_x75vv_44", u = "_outlined_x75vv_67", p = "_text_x75vv_93", y = "_icon_x75vv_113", b = "_link_x75vv_118", s = {
|
|
5
|
+
button: x,
|
|
6
|
+
primary: l,
|
|
7
|
+
secondary: m,
|
|
8
|
+
outlined: u,
|
|
9
|
+
text: p,
|
|
10
|
+
icon: y,
|
|
11
|
+
link: b
|
|
12
|
+
}, f = (r) => {
|
|
13
|
+
const { className: c, variant: _ = "primary", asLink: i, ...t } = r, o = v(s.button, s[_], c);
|
|
14
|
+
if (i) {
|
|
15
|
+
const { ...e } = t;
|
|
16
|
+
return /* @__PURE__ */ n("a", { className: o, ...e });
|
|
17
|
+
}
|
|
18
|
+
const { ...a } = t;
|
|
19
|
+
return /* @__PURE__ */ n("button", { className: o, ...a });
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
f as Button,
|
|
23
|
+
j as clsx
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/components/Button/Button.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef } from 'react'\n\nimport { clsx } from 'clsx'\n\nimport s from './Button.module.css'\n\nexport type ButtonVariant = 'primary' | 'secondary' | 'outlined' | 'text'\n\ntype CommonProps = {\n variant?: ButtonVariant\n}\n\ntype AsButtonProps = {\n asLink?: false\n} & CommonProps &\n ComponentPropsWithoutRef<'button'>\n\ntype AsLinkProps = {\n asLink: true\n} & CommonProps &\n ComponentPropsWithoutRef<'a'>\n\nexport type ButtonProps = AsButtonProps | AsLinkProps\n\nexport const Button = (props: ButtonProps) => {\n const { className, variant = 'primary', asLink, ...rest } = props\n const classes = clsx(s.button, s[variant], className)\n\n if (asLink) {\n const { ...linkProps } = rest as AsLinkProps\n return <a className={classes} {...linkProps} />\n }\n\n const { ...buttonProps } = rest as AsButtonProps\n return <button className={classes} {...buttonProps} />\n}\n"],"names":["Button","props","className","variant","asLink","rest","classes","clsx","linkProps","jsx","buttonProps"],"mappings":";;;;;;;;;;;GAwBaA,IAAS,CAACC,MAAuB;AAC5C,QAAM,EAAE,WAAAC,GAAW,SAAAC,IAAU,WAAW,QAAAC,GAAQ,GAAGC,MAASJ,GACtDK,IAAUC,EAAK,EAAE,QAAQ,EAAEJ,CAAO,GAAGD,CAAS;AAEpD,MAAIE,GAAQ;AACV,UAAM,EAAE,GAAGI,EAAA,IAAcH;AACzB,WAAO,gBAAAI,EAAC,KAAA,EAAE,WAAWH,GAAU,GAAGE,GAAW;AAAA,EAC/C;AAEA,QAAM,EAAE,GAAGE,EAAA,IAAgBL;AAC3B,SAAO,gBAAAI,EAAC,UAAA,EAAO,WAAWH,GAAU,GAAGI,GAAa;AACtD;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "snapflow-ui-kit",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"sideEffects": [
|
|
13
|
+
"*.css"
|
|
14
|
+
],
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts"
|
|
19
|
+
},
|
|
20
|
+
"./styles.css": "./dist/index.css"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"start": "vite",
|
|
24
|
+
"dev": "storybook dev -p 6006",
|
|
25
|
+
"build": "vite build && tsc",
|
|
26
|
+
"lint": "eslint . --report-unused-disable-directives --max-warnings 0",
|
|
27
|
+
"lint:fix": "eslint . --report-unused-disable-directives --max-warnings 0 --fix",
|
|
28
|
+
"lint:style": "stylelint \"src/**/*.css\"",
|
|
29
|
+
"lint:style:fix": "stylelint \"src/**/*.css\" --fix",
|
|
30
|
+
"format": "prettier -c .",
|
|
31
|
+
"format:fix": "prettier -w .",
|
|
32
|
+
"preview": "vite preview",
|
|
33
|
+
"build-storybook": "storybook build",
|
|
34
|
+
"prepare": "husky"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"clsx": "^2.1.1"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@eslint/js": "^9.39.2",
|
|
41
|
+
"@storybook/addon-docs": "10.2.0",
|
|
42
|
+
"@storybook/react-vite": "10.2.0",
|
|
43
|
+
"@types/node": "^25.0.10",
|
|
44
|
+
"@types/react": "^19.2.9",
|
|
45
|
+
"@types/react-dom": "^19.2.3",
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "8.53.1",
|
|
47
|
+
"@typescript-eslint/parser": "8.53.1",
|
|
48
|
+
"eslint": "9.39.2",
|
|
49
|
+
"eslint-config-prettier": "10.1.8",
|
|
50
|
+
"eslint-plugin-react": "7.37.5",
|
|
51
|
+
"eslint-plugin-react-hooks": "7.0.1",
|
|
52
|
+
"eslint-plugin-storybook": "10.2.0",
|
|
53
|
+
"husky": "^9.1.7",
|
|
54
|
+
"lint-staged": "^16.2.7",
|
|
55
|
+
"prettier": "3.8.1",
|
|
56
|
+
"react": "^19.2.3",
|
|
57
|
+
"react-dom": "^19.2.3",
|
|
58
|
+
"storybook": "10.2.0",
|
|
59
|
+
"stylelint": "^17.0.0",
|
|
60
|
+
"stylelint-config-clean-order": "8.0.0",
|
|
61
|
+
"stylelint-config-standard": "^40.0.0",
|
|
62
|
+
"stylelint-order": "^7.0.1",
|
|
63
|
+
"typescript": "^5.9.3",
|
|
64
|
+
"typescript-eslint": "^8.53.1",
|
|
65
|
+
"vite": "^7.3.1"
|
|
66
|
+
},
|
|
67
|
+
"peerDependencies": {
|
|
68
|
+
"react": "^19.2.3",
|
|
69
|
+
"react-dom": "^19.2.3"
|
|
70
|
+
},
|
|
71
|
+
"lint-staged": {
|
|
72
|
+
"*.{ts,tsx}": [
|
|
73
|
+
"eslint --report-unused-disable-directives --max-warnings 0"
|
|
74
|
+
],
|
|
75
|
+
"*.css": [
|
|
76
|
+
"stylelint"
|
|
77
|
+
],
|
|
78
|
+
"*": [
|
|
79
|
+
"prettier --check --ignore-unknown"
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
}
|