@lotte-innovate/ui-component-test 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +163 -163
- package/dist/Typography/Header/index.d.ts +1 -1
- package/dist/Typography/index.d.ts +2 -2
- package/dist/Typography/index.js +3 -3
- package/dist/app/page.d.ts +1 -1
- package/dist/app/page.js +3 -22
- package/dist/components/Input/Input.stories.d.ts +77 -0
- package/dist/components/Input/Input.stories.js +74 -0
- package/dist/components/Input/index.d.ts +14 -0
- package/dist/components/Input/index.js +53 -0
- package/dist/components/Tooltip/index.d.ts +1 -1
- package/dist/components/index.d.ts +0 -2
- package/dist/index.d.ts +2 -5
- package/dist/index.js +0 -3
- package/dist/stories/navigation-menu/NavigationMenu.stories.d.ts +11 -11
- package/dist/stories/navigation-menu/NavigationMenu.stories.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +120 -118
package/README.md
CHANGED
@@ -1,163 +1,163 @@
|
|
1
|
-
# radix-ui 라이브러리 활용 Storybook UI Component 만들기
|
2
|
-
|
3
|
-
<br />
|
4
|
-
|
5
|
-
## 사전 설치 라이브러리
|
6
|
-
|
7
|
-
- radix-ui
|
8
|
-
- 주요 컴포넌트 사용 시 활용할 Headless UI 라이브러리
|
9
|
-
|
10
|
-
```shell
|
11
|
-
npm install @radix-ui/react-popover@latest -E
|
12
|
-
```
|
13
|
-
|
14
|
-
- storybook
|
15
|
-
- 컴포넌트 관리를 위해 사용
|
16
|
-
|
17
|
-
```shell
|
18
|
-
npx sb init
|
19
|
-
npx storybook@latest add @storybook/addon-styling-webpack
|
20
|
-
```
|
21
|
-
|
22
|
-
- clsx
|
23
|
-
- 조건부 className 작성을 위해 사용
|
24
|
-
|
25
|
-
```shell
|
26
|
-
npm i clsx
|
27
|
-
```
|
28
|
-
|
29
|
-
- tailwind-merge
|
30
|
-
- 스타일 충돌 없이 자바스크립트에서 tailwind CSS 클래스를 효율적으로 병합하는 기능을 가진 라이브러리
|
31
|
-
|
32
|
-
```shell
|
33
|
-
npm i tailwind-merge
|
34
|
-
```
|
35
|
-
|
36
|
-
- class-variance-authority (CVA)
|
37
|
-
- 일관성 있는 UI를 정의하고 사용할 수 있도록 도와주는 툴로써 shadcn/ui 컴포넌트의 핵심 도구
|
38
|
-
|
39
|
-
```shell
|
40
|
-
npm i class-variance-authority
|
41
|
-
```
|
42
|
-
|
43
|
-
<br />
|
44
|
-
|
45
|
-
## 실행
|
46
|
-
|
47
|
-
- 스토리북 실행
|
48
|
-
|
49
|
-
```shell
|
50
|
-
npm run storybook
|
51
|
-
```
|
52
|
-
|
53
|
-
> 접속주소(포트 6006 사용 시): `http://localhost:6006`
|
54
|
-
|
55
|
-
- 웹페이지 실행
|
56
|
-
|
57
|
-
```shell
|
58
|
-
npm run dev
|
59
|
-
```
|
60
|
-
|
61
|
-
> 접속주소(포트 3000 사용 시): `http://localhost:3000`
|
62
|
-
|
63
|
-
## package publish
|
64
|
-
|
65
|
-
- 타입스크립트 컴파일
|
66
|
-
|
67
|
-
```shell
|
68
|
-
npm run publish:npm
|
69
|
-
```
|
70
|
-
|
71
|
-
- npm package 배포 시
|
72
|
-
|
73
|
-
- npm 로그인
|
74
|
-
|
75
|
-
```shell
|
76
|
-
npm login
|
77
|
-
```
|
78
|
-
|
79
|
-
- package.json 버전 수정 후 컴파일 진행
|
80
|
-
|
81
|
-
```shell
|
82
|
-
npm run publish:npm
|
83
|
-
```
|
84
|
-
|
85
|
-
- 패키지 배포
|
86
|
-
|
87
|
-
```shell
|
88
|
-
npm publish
|
89
|
-
```
|
90
|
-
|
91
|
-
- npm scope 배포
|
92
|
-
- npm 로그인 후, 조직 생성 시 @계정명 으로 scope 생성
|
93
|
-
scope로 생성된 패키지는 npm publish 시, 아래 옵션 추가
|
94
|
-
|
95
|
-
```shell
|
96
|
-
npm publish --access=public
|
97
|
-
```
|
98
|
-
|
99
|
-
|
100
|
-
- npm package 미배포시
|
101
|
-
|
102
|
-
- package.json 버전 수정 후 컴파일 진행
|
103
|
-
|
104
|
-
```shell
|
105
|
-
npm run publish:npm
|
106
|
-
```
|
107
|
-
|
108
|
-
- dist/ 파일 및 설정파일 추출 후 전달
|
109
|
-
|
110
|
-
## 사용자 이용 방법
|
111
|
-
|
112
|
-
### npm 배포 시
|
113
|
-
|
114
|
-
- npm package 설치
|
115
|
-
|
116
|
-
```sh
|
117
|
-
npm install <package_name>
|
118
|
-
```
|
119
|
-
|
120
|
-
### npm 미배포시
|
121
|
-
|
122
|
-
- 전달 받은 package 모듈 파일을 node_modules/ 폴더에 추가
|
123
|
-
|
124
|
-
### tailwind 설정 방법
|
125
|
-
|
126
|
-
- tailwind config 파일 설정
|
127
|
-
|
128
|
-
```js
|
129
|
-
// tailwind.config.ts
|
130
|
-
import type { Config } from 'tailwindcss';
|
131
|
-
// UI 라이브러리 tailwind config 파일 호출
|
132
|
-
// >>>>>>>> 추가
|
133
|
-
const packageTailwindConfig = require('ui-component-test/tailwind.config.js');
|
134
|
-
// >>>>>>>>
|
135
|
-
|
136
|
-
const config: Config = {
|
137
|
-
content: [
|
138
|
-
'./src/pages/**/*.{js,ts,jsx,tsx,mdx,zip}',
|
139
|
-
'./src/components/**/*.{js,ts,jsx,tsx,mdx,zip}',
|
140
|
-
'./src/app/**/*.{js,ts,jsx,tsx,mdx,zip}',
|
141
|
-
// 해당 프로젝트 css 표준 컴포넌트에 적용 가능
|
142
|
-
// >>>>>>>> 추가
|
143
|
-
'./node_modules/ui-component-test/**/*.{js,ts,jsx,tsx,mdx,zip}',
|
144
|
-
// >>>>>>>>
|
145
|
-
],
|
146
|
-
theme: {
|
147
|
-
extend: {
|
148
|
-
backgroundImage: {
|
149
|
-
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
|
150
|
-
'gradient-conic': 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
|
151
|
-
},
|
152
|
-
colors: {},
|
153
|
-
// UI 라이브러리 tailwind config 파일 적용
|
154
|
-
// >>>>>>>> 추가
|
155
|
-
...packageTailwindConfig?.theme?.extend,
|
156
|
-
// >>>>>>>>
|
157
|
-
},
|
158
|
-
},
|
159
|
-
plugins: [],
|
160
|
-
};
|
161
|
-
export default config;
|
162
|
-
|
163
|
-
```
|
1
|
+
# radix-ui 라이브러리 활용 Storybook UI Component 만들기
|
2
|
+
|
3
|
+
<br />
|
4
|
+
|
5
|
+
## 사전 설치 라이브러리
|
6
|
+
|
7
|
+
- radix-ui
|
8
|
+
- 주요 컴포넌트 사용 시 활용할 Headless UI 라이브러리
|
9
|
+
|
10
|
+
```shell
|
11
|
+
npm install @radix-ui/react-popover@latest -E
|
12
|
+
```
|
13
|
+
|
14
|
+
- storybook
|
15
|
+
- 컴포넌트 관리를 위해 사용
|
16
|
+
|
17
|
+
```shell
|
18
|
+
npx sb init
|
19
|
+
npx storybook@latest add @storybook/addon-styling-webpack
|
20
|
+
```
|
21
|
+
|
22
|
+
- clsx
|
23
|
+
- 조건부 className 작성을 위해 사용
|
24
|
+
|
25
|
+
```shell
|
26
|
+
npm i clsx
|
27
|
+
```
|
28
|
+
|
29
|
+
- tailwind-merge
|
30
|
+
- 스타일 충돌 없이 자바스크립트에서 tailwind CSS 클래스를 효율적으로 병합하는 기능을 가진 라이브러리
|
31
|
+
|
32
|
+
```shell
|
33
|
+
npm i tailwind-merge
|
34
|
+
```
|
35
|
+
|
36
|
+
- class-variance-authority (CVA)
|
37
|
+
- 일관성 있는 UI를 정의하고 사용할 수 있도록 도와주는 툴로써 shadcn/ui 컴포넌트의 핵심 도구
|
38
|
+
|
39
|
+
```shell
|
40
|
+
npm i class-variance-authority
|
41
|
+
```
|
42
|
+
|
43
|
+
<br />
|
44
|
+
|
45
|
+
## 실행
|
46
|
+
|
47
|
+
- 스토리북 실행
|
48
|
+
|
49
|
+
```shell
|
50
|
+
npm run storybook
|
51
|
+
```
|
52
|
+
|
53
|
+
> 접속주소(포트 6006 사용 시): `http://localhost:6006`
|
54
|
+
|
55
|
+
- 웹페이지 실행
|
56
|
+
|
57
|
+
```shell
|
58
|
+
npm run dev
|
59
|
+
```
|
60
|
+
|
61
|
+
> 접속주소(포트 3000 사용 시): `http://localhost:3000`
|
62
|
+
|
63
|
+
## package publish
|
64
|
+
|
65
|
+
- 타입스크립트 컴파일
|
66
|
+
|
67
|
+
```shell
|
68
|
+
npm run publish:npm
|
69
|
+
```
|
70
|
+
|
71
|
+
- npm package 배포 시
|
72
|
+
|
73
|
+
- npm 로그인
|
74
|
+
|
75
|
+
```shell
|
76
|
+
npm login
|
77
|
+
```
|
78
|
+
|
79
|
+
- package.json 버전 수정 후 컴파일 진행
|
80
|
+
|
81
|
+
```shell
|
82
|
+
npm run publish:npm
|
83
|
+
```
|
84
|
+
|
85
|
+
- 패키지 배포
|
86
|
+
|
87
|
+
```shell
|
88
|
+
npm publish
|
89
|
+
```
|
90
|
+
|
91
|
+
- npm scope 배포
|
92
|
+
- npm 로그인 후, 조직 생성 시 @계정명 으로 scope 생성
|
93
|
+
scope로 생성된 패키지는 npm publish 시, 아래 옵션 추가
|
94
|
+
|
95
|
+
```shell
|
96
|
+
npm publish --access=public
|
97
|
+
```
|
98
|
+
|
99
|
+
|
100
|
+
- npm package 미배포시
|
101
|
+
|
102
|
+
- package.json 버전 수정 후 컴파일 진행
|
103
|
+
|
104
|
+
```shell
|
105
|
+
npm run publish:npm
|
106
|
+
```
|
107
|
+
|
108
|
+
- dist/ 파일 및 설정파일 추출 후 전달
|
109
|
+
|
110
|
+
## 사용자 이용 방법
|
111
|
+
|
112
|
+
### npm 배포 시
|
113
|
+
|
114
|
+
- npm package 설치
|
115
|
+
|
116
|
+
```sh
|
117
|
+
npm install <package_name>
|
118
|
+
```
|
119
|
+
|
120
|
+
### npm 미배포시
|
121
|
+
|
122
|
+
- 전달 받은 package 모듈 파일을 node_modules/ 폴더에 추가
|
123
|
+
|
124
|
+
### tailwind 설정 방법
|
125
|
+
|
126
|
+
- tailwind config 파일 설정
|
127
|
+
|
128
|
+
```js
|
129
|
+
// tailwind.config.ts
|
130
|
+
import type { Config } from 'tailwindcss';
|
131
|
+
// UI 라이브러리 tailwind config 파일 호출
|
132
|
+
// >>>>>>>> 추가
|
133
|
+
const packageTailwindConfig = require('ui-component-test/tailwind.config.js');
|
134
|
+
// >>>>>>>>
|
135
|
+
|
136
|
+
const config: Config = {
|
137
|
+
content: [
|
138
|
+
'./src/pages/**/*.{js,ts,jsx,tsx,mdx,zip}',
|
139
|
+
'./src/components/**/*.{js,ts,jsx,tsx,mdx,zip}',
|
140
|
+
'./src/app/**/*.{js,ts,jsx,tsx,mdx,zip}',
|
141
|
+
// 해당 프로젝트 css 표준 컴포넌트에 적용 가능
|
142
|
+
// >>>>>>>> 추가
|
143
|
+
'./node_modules/ui-component-test/**/*.{js,ts,jsx,tsx,mdx,zip}',
|
144
|
+
// >>>>>>>>
|
145
|
+
],
|
146
|
+
theme: {
|
147
|
+
extend: {
|
148
|
+
backgroundImage: {
|
149
|
+
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
|
150
|
+
'gradient-conic': 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
|
151
|
+
},
|
152
|
+
colors: {},
|
153
|
+
// UI 라이브러리 tailwind config 파일 적용
|
154
|
+
// >>>>>>>> 추가
|
155
|
+
...packageTailwindConfig?.theme?.extend,
|
156
|
+
// >>>>>>>>
|
157
|
+
},
|
158
|
+
},
|
159
|
+
plugins: [],
|
160
|
+
};
|
161
|
+
export default config;
|
162
|
+
|
163
|
+
```
|
@@ -6,7 +6,7 @@ export interface HeaderProps extends VariantProps<typeof headerVariants> {
|
|
6
6
|
}
|
7
7
|
declare let headerVariants: (props?: ({
|
8
8
|
weight?: "medium" | "regular" | "semibold" | "bold" | null | undefined;
|
9
|
-
headers?: "
|
9
|
+
headers?: "h2" | "h3" | "h1" | "h4" | "h5" | "h6" | null | undefined;
|
10
10
|
color?: string | null | undefined;
|
11
11
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
12
12
|
export declare const Header: React.ForwardRefExoticComponent<Omit<import("@radix-ui/themes").HeadingProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & HeaderProps & React.RefAttributes<HTMLHeadingElement>>;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export { default as Header } from './Header';
|
2
|
-
export { default as Text } from './Text';
|
1
|
+
export { default as Header } from './Header';
|
2
|
+
export { default as Text } from './Text';
|
package/dist/Typography/index.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
// Typography
|
2
|
-
export { default as Header } from '
|
3
|
-
export { default as Text } from '
|
1
|
+
// Typography
|
2
|
+
export { default as Header } from './Header';
|
3
|
+
export { default as Text } from './Text';
|
package/dist/app/page.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export default function Home():
|
1
|
+
export default function Home(): import("react/jsx-runtime").JSX.Element;
|
package/dist/app/page.js
CHANGED
@@ -1,25 +1,6 @@
|
|
1
1
|
'use client';
|
2
|
-
import { jsx as _jsx
|
3
|
-
import {
|
4
|
-
import Theme from './template/theme';
|
5
|
-
import BadgeTemplate from './template/badgeTemplate';
|
6
|
-
import ButtonTemplate from './template/buttonTemplate';
|
7
|
-
import TextTemplate from './template/textTemplate';
|
8
|
-
import Button from 'components/Button';
|
9
|
-
import { Toast, ToastActionButton, ToastDescription } from 'components/Toast';
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
3
|
+
// import { Button } from '@lotte-innovate/ui-component-test';
|
10
4
|
export default function Home() {
|
11
|
-
|
12
|
-
var _b = useState('95%'), scalingTheme = _b[0], setScalingTheme = _b[1];
|
13
|
-
var _c = useState('semibold'), fontWeightTheme = _c[0], setFontWeightTheme = _c[1];
|
14
|
-
var _d = useState('blue'), colorTheme = _d[0], setColorTheme = _d[1];
|
15
|
-
var _e = useState('blue'), fontColorTheme = _e[0], setFontColorTheme = _e[1];
|
16
|
-
var _f = useState('light'), mode = _f[0], setMode = _f[1];
|
17
|
-
var _g = useState(false), mounted = _g[0], setMounted = _g[1];
|
18
|
-
var _h = useState(false), open = _h[0], setOpen = _h[1];
|
19
|
-
useEffect(function () {
|
20
|
-
setMounted(true);
|
21
|
-
}, []);
|
22
|
-
return (mounted && (_jsxs("div", { className: "flex flex-col w-full h-auto min-h-screen ".concat(mode == 'light' ? 'bg-white text-black' : 'bg-black text-white', " p-3"), children: [_jsx("div", { onClick: function () {
|
23
|
-
setMode(mode === 'light' ? 'dark' : 'light');
|
24
|
-
}, children: mode === 'light' ? 'light' : 'dark' }), _jsx(Button, { onClick: function () { return setOpen(true); }, className: "w-[200px]", scaling: '95%', children: "toast" }), _jsxs(Toast, { openToast: open, setOpenToast: setOpen, children: [_jsx(ToastDescription, { children: "There was a problem with your request." }), _jsx(ToastActionButton, { altText: "\uC561\uC158\uBC84\uD2BC", children: "\uBC84\uD2BC" })] }), _jsx(Theme, { setRadiusTheme: setRadiusTheme, setScalingTheme: setScalingTheme, setFontWeightTheme: setFontWeightTheme, setColorTheme: setColorTheme, setFontColorTheme: setFontColorTheme, mode: mode }), _jsx(BadgeTemplate, { radiusTheme: radiusTheme, scalingTheme: scalingTheme, fontWeightTheme: fontWeightTheme, colorTheme: colorTheme, mode: mode }), _jsx(ButtonTemplate, { radiusTheme: radiusTheme, scalingTheme: scalingTheme, fontWeightTheme: fontWeightTheme, colorTheme: colorTheme, mode: mode }), _jsx(TextTemplate, { scalingTheme: scalingTheme, fontWeightTheme: fontWeightTheme, colorTheme: fontColorTheme, mode: mode })] })));
|
5
|
+
return _jsx("div", {});
|
25
6
|
}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import type { StoryObj } from '@storybook/react';
|
3
|
+
import { InputProps } from './index';
|
4
|
+
import { IRadius, IScaling, IWeight } from '../../types';
|
5
|
+
declare const meta: {
|
6
|
+
title: string;
|
7
|
+
component: ({ radius, scaling, weight, color, ...props }: InputProps) => import("react/jsx-runtime").JSX.Element;
|
8
|
+
parameters: {
|
9
|
+
layout: string;
|
10
|
+
themes: {
|
11
|
+
themeOverride: string;
|
12
|
+
};
|
13
|
+
docs: {
|
14
|
+
page: null;
|
15
|
+
description: {
|
16
|
+
component: string;
|
17
|
+
};
|
18
|
+
};
|
19
|
+
};
|
20
|
+
tags: string[];
|
21
|
+
argTypes: {
|
22
|
+
radius: {
|
23
|
+
options: IRadius[];
|
24
|
+
control: {
|
25
|
+
type: string;
|
26
|
+
};
|
27
|
+
description: string;
|
28
|
+
defaultValue: {
|
29
|
+
summary: string;
|
30
|
+
};
|
31
|
+
};
|
32
|
+
scaling: {
|
33
|
+
options: IScaling[];
|
34
|
+
control: {
|
35
|
+
type: string;
|
36
|
+
};
|
37
|
+
description: string;
|
38
|
+
defaultValue: {
|
39
|
+
summary: string;
|
40
|
+
};
|
41
|
+
};
|
42
|
+
weight: {
|
43
|
+
options: IWeight[];
|
44
|
+
control: {
|
45
|
+
type: string;
|
46
|
+
};
|
47
|
+
description: string;
|
48
|
+
defaultValue: {
|
49
|
+
summary: string;
|
50
|
+
};
|
51
|
+
};
|
52
|
+
onChange: {
|
53
|
+
table: {
|
54
|
+
category: string;
|
55
|
+
};
|
56
|
+
};
|
57
|
+
color: {
|
58
|
+
options: import("../../types").IColor[];
|
59
|
+
description: string;
|
60
|
+
defaultValue: {
|
61
|
+
summary: string;
|
62
|
+
};
|
63
|
+
control: {
|
64
|
+
type: string;
|
65
|
+
};
|
66
|
+
};
|
67
|
+
};
|
68
|
+
args: {
|
69
|
+
onClick: import("@vitest/spy").Mock<[event: import("react").MouseEvent<HTMLInputElement, MouseEvent>], void>;
|
70
|
+
};
|
71
|
+
};
|
72
|
+
export default meta;
|
73
|
+
type Story = StoryObj<typeof meta>;
|
74
|
+
export declare const Default: Story;
|
75
|
+
export declare const Radius: (args: InputProps) => import("react/jsx-runtime").JSX.Element;
|
76
|
+
export declare const Scaling: (args: InputProps) => import("react/jsx-runtime").JSX.Element;
|
77
|
+
export declare const Weight: (args: InputProps) => import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,74 @@
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
2
|
+
__assign = Object.assign || function(t) {
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
+
s = arguments[i];
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
+
t[p] = s[p];
|
7
|
+
}
|
8
|
+
return t;
|
9
|
+
};
|
10
|
+
return __assign.apply(this, arguments);
|
11
|
+
};
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
13
|
+
import { fn } from '@storybook/test';
|
14
|
+
import { Input } from './index';
|
15
|
+
import { radiusOptions, scalingOptions, weightOptions } from '../../../src/constants';
|
16
|
+
import { colorOptions } from 'color/constants';
|
17
|
+
var meta = {
|
18
|
+
title: '작업중/Input',
|
19
|
+
component: Input,
|
20
|
+
parameters: {
|
21
|
+
layout: 'centered',
|
22
|
+
themes: {
|
23
|
+
themeOverride: 'dark',
|
24
|
+
},
|
25
|
+
docs: {
|
26
|
+
page: null,
|
27
|
+
description: {
|
28
|
+
component: '',
|
29
|
+
},
|
30
|
+
},
|
31
|
+
},
|
32
|
+
tags: ['autodocs'],
|
33
|
+
argTypes: {
|
34
|
+
radius: {
|
35
|
+
options: radiusOptions,
|
36
|
+
control: { type: 'select' },
|
37
|
+
description: '둥글기',
|
38
|
+
defaultValue: { summary: 'small' },
|
39
|
+
},
|
40
|
+
scaling: {
|
41
|
+
options: scalingOptions,
|
42
|
+
control: { type: 'select' },
|
43
|
+
description: '크기',
|
44
|
+
defaultValue: { summary: '100%' },
|
45
|
+
},
|
46
|
+
weight: {
|
47
|
+
options: weightOptions,
|
48
|
+
control: { type: 'select' },
|
49
|
+
description: '폰트 두께',
|
50
|
+
defaultValue: { summary: 'normal' },
|
51
|
+
},
|
52
|
+
onChange: {
|
53
|
+
table: {
|
54
|
+
category: 'EVENT HANDLER',
|
55
|
+
},
|
56
|
+
},
|
57
|
+
color: {
|
58
|
+
options: colorOptions,
|
59
|
+
description: 'background color',
|
60
|
+
defaultValue: { summary: 'blue' },
|
61
|
+
control: { type: 'select' },
|
62
|
+
},
|
63
|
+
},
|
64
|
+
args: {
|
65
|
+
onClick: fn(),
|
66
|
+
},
|
67
|
+
};
|
68
|
+
export default meta;
|
69
|
+
export var Default = {
|
70
|
+
args: {},
|
71
|
+
};
|
72
|
+
export var Radius = function (args) { return (_jsx("div", { className: "flex space-x-2", children: radiusOptions.map(function (radius) { return (_jsx(Input, __assign({}, args, { radius: radius }), radius)); }) })); };
|
73
|
+
export var Scaling = function (args) { return (_jsx("div", { className: "flex items-center space-x-2", children: scalingOptions.map(function (scaling) { return (_jsx(Input, __assign({}, args, { scaling: scaling }), scaling)); }) })); };
|
74
|
+
export var Weight = function (args) { return (_jsx("div", { className: "flex items-center space-x-2", children: weightOptions.map(function (weight) { return (_jsx(Input, __assign({}, args, { weight: weight }), weight)); }) })); };
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
3
|
+
import { IColor } from '../../types';
|
4
|
+
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>, VariantProps<typeof inputVariants> {
|
5
|
+
color?: IColor;
|
6
|
+
}
|
7
|
+
declare const inputVariants: (props?: ({
|
8
|
+
radius?: "none" | "small" | "medium" | "large" | "full" | null | undefined;
|
9
|
+
scaling?: "90%" | "95%" | "100%" | "105%" | "110%" | null | undefined;
|
10
|
+
weight?: "medium" | "regular" | "semibold" | "bold" | null | undefined;
|
11
|
+
color?: string | null | undefined;
|
12
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
13
|
+
export declare const Input: ({ radius, scaling, weight, color, ...props }: InputProps) => import("react/jsx-runtime").JSX.Element;
|
14
|
+
export default Input;
|
@@ -0,0 +1,53 @@
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
2
|
+
__assign = Object.assign || function(t) {
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
+
s = arguments[i];
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
+
t[p] = s[p];
|
7
|
+
}
|
8
|
+
return t;
|
9
|
+
};
|
10
|
+
return __assign.apply(this, arguments);
|
11
|
+
};
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
13
|
+
var t = {};
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
15
|
+
t[p] = s[p];
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
19
|
+
t[p[i]] = s[p[i]];
|
20
|
+
}
|
21
|
+
return t;
|
22
|
+
};
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
24
|
+
import { cva } from 'class-variance-authority';
|
25
|
+
import { cn } from '../../utils/utils';
|
26
|
+
import { bgColorStyle, radiusVariants, weightVariants } from '../../constants';
|
27
|
+
var inputVariants = cva('inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', {
|
28
|
+
variants: {
|
29
|
+
radius: __assign({}, radiusVariants['base']),
|
30
|
+
scaling: {
|
31
|
+
'90%': 'text-xs py-1 px-2',
|
32
|
+
'95%': 'text-sm py-1 px-2',
|
33
|
+
'100%': 'text-base py-2 px-6',
|
34
|
+
'105%': 'text-lg py-3 px-6',
|
35
|
+
'110%': 'text-xl py-3 px-6',
|
36
|
+
},
|
37
|
+
weight: __assign({}, weightVariants),
|
38
|
+
color: bgColorStyle(),
|
39
|
+
},
|
40
|
+
defaultVariants: {
|
41
|
+
radius: 'small',
|
42
|
+
},
|
43
|
+
});
|
44
|
+
export var Input = function (_a) {
|
45
|
+
var radius = _a.radius, scaling = _a.scaling, weight = _a.weight, color = _a.color, props = __rest(_a, ["radius", "scaling", "weight", "color"]);
|
46
|
+
return (_jsx("input", __assign({ className: cn(inputVariants({
|
47
|
+
radius: radius,
|
48
|
+
scaling: scaling,
|
49
|
+
weight: weight,
|
50
|
+
color: color,
|
51
|
+
})) }, props)));
|
52
|
+
};
|
53
|
+
export default Input;
|
@@ -11,7 +11,7 @@ export interface TooltipProps extends React.InputHTMLAttributes<HTMLInputElement
|
|
11
11
|
side?: 'top' | 'right' | 'bottom' | 'left';
|
12
12
|
}
|
13
13
|
declare const tooltipVariants: (props?: ({
|
14
|
-
scaling?: number | typeof Symbol.iterator | typeof Symbol.unscopables | "
|
14
|
+
scaling?: number | typeof Symbol.iterator | typeof Symbol.unscopables | "map" | "filter" | "fill" | "values" | "concat" | "indexOf" | "lastIndexOf" | "slice" | "length" | "includes" | "at" | "toLocaleString" | "toString" | "pop" | "push" | "join" | "reverse" | "shift" | "sort" | "splice" | "unshift" | "every" | "some" | "forEach" | "reduce" | "reduceRight" | "find" | "findIndex" | "copyWithin" | "entries" | "keys" | "flatMap" | "flat" | "findLast" | "findLastIndex" | "toReversed" | "toSorted" | "toSpliced" | "with" | null | undefined;
|
15
15
|
weight?: "medium" | "regular" | "semibold" | "bold" | null | undefined;
|
16
16
|
radius?: "none" | "small" | "medium" | "large" | "full" | null | undefined;
|
17
17
|
color?: string | null | undefined;
|
@@ -40,8 +40,6 @@ export { default as Toast } from './Toast';
|
|
40
40
|
export { default as Toggle } from './Toggle';
|
41
41
|
export { default as ToggleGroup } from './ToggleGroup';
|
42
42
|
export { default as ToggleSwitch } from './ToggleSwitch';
|
43
|
-
export { default as Header } from '../Typography/Header';
|
44
|
-
export { default as Text } from '../Typography/Text';
|
45
43
|
export { default as BubbleChart } from './BubbleChart';
|
46
44
|
export { default as RadarChart } from './RadarChart';
|
47
45
|
export { default as PieChart } from './PieChart';
|
package/dist/index.d.ts
CHANGED