@teamturing/react-kit 1.1.5 → 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.
Files changed (32) hide show
  1. package/dist/core/Button/index.d.ts +71 -0
  2. package/dist/core/GradientText/index.d.ts +5 -5
  3. package/dist/core/Grid/index.d.ts +2 -2
  4. package/dist/core/IconButton/index.d.ts +1 -1
  5. package/dist/core/Stack/index.d.ts +2 -2
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.js +457 -107
  8. package/esm/packages/icons/{src → esm}/ProgressGradient.js +1 -1
  9. package/esm/packages/icons/esm/_virtual/_rollupPluginBabelHelpers.js +16 -0
  10. package/esm/packages/react-kit/src/core/Button/index.js +347 -0
  11. package/esm/packages/react-kit/src/core/Chip/index.js +3 -3
  12. package/esm/packages/react-kit/src/core/Grid/index.js +1 -1
  13. package/esm/packages/react-kit/src/core/IconButton/index.js +2 -2
  14. package/esm/packages/react-kit/src/core/IconToggleButton/index.js +2 -2
  15. package/esm/packages/react-kit/src/core/Spinner/index.js +2 -2
  16. package/esm/packages/react-kit/src/core/Stack/index.js +1 -1
  17. package/esm/packages/react-kit/src/core/Text/index.js +1 -1
  18. package/esm/packages/react-kit/src/index.js +1 -0
  19. package/package.json +7 -6
  20. /package/esm/packages/token-studio/{src → esm}/foundation/palette/index.js +0 -0
  21. /package/esm/packages/token-studio/{src → esm}/foundation/rounding/index.js +0 -0
  22. /package/esm/packages/token-studio/{src → esm}/foundation/spacing/index.js +0 -0
  23. /package/esm/packages/token-studio/{src → esm}/foundation/typography/fontSize/index.js +0 -0
  24. /package/esm/packages/token-studio/{src → esm}/foundation/typography/fontWeight/index.js +0 -0
  25. /package/esm/packages/token-studio/{src → esm}/foundation/typography/lineHeight/index.js +0 -0
  26. /package/esm/packages/token-studio/{src → esm}/token/color/index.js +0 -0
  27. /package/esm/packages/token-studio/{src → esm}/token/radii/index.js +0 -0
  28. /package/esm/packages/token-studio/{src → esm}/token/space/index.js +0 -0
  29. /package/esm/packages/token-studio/{src → esm}/token/typography/fontSizes.js +0 -0
  30. /package/esm/packages/token-studio/{src → esm}/token/typography/fontWeights.js +0 -0
  31. /package/esm/packages/token-studio/{src → esm}/token/typography/index.js +0 -0
  32. /package/esm/packages/token-studio/{src → esm}/token/typography/lineHeights.js +0 -0
@@ -0,0 +1,347 @@
1
+ import { extends as _extends } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import color from '../../../../token-studio/esm/token/color/index.js';
3
+ import radii from '../../../../token-studio/esm/token/radii/index.js';
4
+ import typography from '../../../../token-studio/esm/token/typography/index.js';
5
+ import { forwardRef } from 'react';
6
+ import Qe from '../../../../../node_modules/styled-components/dist/styled-components.esm.js';
7
+ import '../../../../../node_modules/styled-system/dist/index.esm.js';
8
+ import Spinner from '../Spinner/index.js';
9
+ import View from '../View/index.js';
10
+ import UnstyledButton from '../_UnstyledButton.js';
11
+ import { variant } from '../../../../../node_modules/@styled-system/variant/dist/index.esm.js';
12
+
13
+ const Button = /*#__PURE__*/forwardRef(({
14
+ size = 'm',
15
+ variant = 'primary',
16
+ fillWidth = false,
17
+ disabled = false,
18
+ loading = false,
19
+ leadingIcon: LeadingIcon,
20
+ trailingIcon: TrailingIcon,
21
+ children,
22
+ ...props
23
+ }, ref) => {
24
+ return /*#__PURE__*/React.createElement(BaseButton, _extends({
25
+ ref: ref,
26
+ size: size,
27
+ disabled: disabled || loading,
28
+ $disabled: disabled,
29
+ $loading: loading,
30
+ variant: variant,
31
+ leadingIcon: LeadingIcon,
32
+ trailingIcon: TrailingIcon,
33
+ fillWidth: fillWidth
34
+ }, props), /*#__PURE__*/React.createElement(View, {
35
+ sx: {
36
+ display: 'flex',
37
+ flexDirection: 'row',
38
+ alignItems: 'center',
39
+ justifyContent: 'center',
40
+ columnGap: 1,
41
+ visibility: !loading ? 'initial' : 'hidden'
42
+ }
43
+ }, LeadingIcon ? /*#__PURE__*/React.createElement(LeadingIcon, null) : null, children, TrailingIcon ? /*#__PURE__*/React.createElement(TrailingIcon, null) : null), loading ? /*#__PURE__*/React.createElement(View, {
44
+ sx: {
45
+ position: 'absolute',
46
+ top: 0,
47
+ right: 0,
48
+ bottom: 0,
49
+ left: 0,
50
+ display: 'flex',
51
+ alignItems: 'center',
52
+ justifyContent: 'center'
53
+ }
54
+ }, /*#__PURE__*/React.createElement(BaseSpinner, {
55
+ size: size,
56
+ variant: variant
57
+ })) : null);
58
+ });
59
+ const BaseButton = Qe(UnstyledButton)(({
60
+ $loading,
61
+ $disabled,
62
+ fillWidth
63
+ }) => ({
64
+ 'position': 'relative',
65
+ 'borderRadius': radii.full,
66
+ 'backgroundColor': 'black',
67
+ 'transition': 'background-color 100ms, color 100ms',
68
+ 'cursor': $loading ? 'progress' : $disabled ? 'not-allowed' : 'pointer',
69
+ 'width': fillWidth ? '100%' : 'initial',
70
+ '& svg': {
71
+ transition: 'color 100ms'
72
+ }
73
+ }), ({
74
+ leadingIcon,
75
+ trailingIcon
76
+ }) => variant({
77
+ prop: 'size',
78
+ variants: {
79
+ l: {
80
+ 'pl': leadingIcon && !trailingIcon ? 3 : 4,
81
+ 'pr': !leadingIcon && trailingIcon ? 3 : 4,
82
+ 'py': 3,
83
+ 'height': 'initial',
84
+ 'maxHeight': 'initial',
85
+ 'fontSize': typography['s'].fontSize,
86
+ 'fontWeight': typography['s'].fontWeight,
87
+ 'lineHeight': typography['s'].lineHeight,
88
+ '& svg': {
89
+ width: 20,
90
+ height: 20
91
+ }
92
+ },
93
+ m: {
94
+ 'pl': leadingIcon && !trailingIcon ? 3 : 4,
95
+ 'pr': !leadingIcon && trailingIcon ? 3 : 4,
96
+ 'py': 2,
97
+ 'height': 'initial',
98
+ 'maxHeight': 'initial',
99
+ 'fontSize': typography['xs'].fontSize,
100
+ 'fontWeight': typography['xs'].fontWeight,
101
+ 'lineHeight': typography['xs'].lineHeight,
102
+ '& svg': {
103
+ width: 16,
104
+ height: 16
105
+ }
106
+ },
107
+ s: {
108
+ 'pl': leadingIcon && !trailingIcon ? 2 : 3,
109
+ 'pr': !leadingIcon && trailingIcon ? 2 : 3,
110
+ 'py': 0,
111
+ 'height': 32,
112
+ 'maxHeight': 32,
113
+ 'fontSize': typography['xxs'].fontSize,
114
+ 'fontWeight': typography['xxs'].fontWeight,
115
+ 'lineHeight': typography['xxs'].lineHeight,
116
+ '& svg': {
117
+ width: 12,
118
+ height: 12
119
+ }
120
+ }
121
+ }
122
+ }), ({
123
+ $disabled
124
+ }) => variant({
125
+ prop: 'variant',
126
+ variants: {
127
+ primary: {
128
+ 'backgroundColor': color['bg/primary'],
129
+ 'color': color['text/inverse'],
130
+ '& svg': {
131
+ color: color['icon/inverse']
132
+ },
133
+ ':hover:not(:disabled)': {
134
+ backgroundColor: color['bg/primary/hovered']
135
+ },
136
+ ':active:not(:disabled)': {
137
+ backgroundColor: color['bg/primary/pressed']
138
+ },
139
+ ':focus-visible': {
140
+ outlineColor: color['border/focused'],
141
+ outlineStyle: 'solid',
142
+ outlineWidth: 2,
143
+ outlineOffset: 2
144
+ },
145
+ ...($disabled ? {
146
+ 'backgroundColor': color['bg/disabled'],
147
+ 'color': color['text/disabled'],
148
+ '& svg': {
149
+ color: color['icon/disabled']
150
+ }
151
+ } : {})
152
+ },
153
+ secondary: {
154
+ 'backgroundColor': color['bg/secondary'],
155
+ 'color': color['text/primary'],
156
+ '& svg': {
157
+ color: color['icon/primary']
158
+ },
159
+ ':hover:not(:disabled)': {
160
+ backgroundColor: color['bg/secondary/hovered']
161
+ },
162
+ ':active:not(:disabled)': {
163
+ backgroundColor: color['bg/secondary/pressed']
164
+ },
165
+ ':focus-visible': {
166
+ outlineColor: color['border/focused'],
167
+ outlineStyle: 'solid',
168
+ outlineWidth: 2,
169
+ outlineOffset: 2
170
+ },
171
+ ...($disabled ? {
172
+ 'backgroundColor': color['bg/disabled'],
173
+ 'color': color['text/disabled'],
174
+ '& svg': {
175
+ color: color['icon/disabled']
176
+ }
177
+ } : {})
178
+ },
179
+ tertiary: {
180
+ 'backgroundColor': color['bg/neutral'],
181
+ 'color': color['text/neutral'],
182
+ '& svg': {
183
+ color: color['icon/accent/gray']
184
+ },
185
+ ':hover:not(:disabled)': {
186
+ backgroundColor: color['bg/neutral/hovered']
187
+ },
188
+ ':active:not(:disabled)': {
189
+ backgroundColor: color['bg/neutral/pressed']
190
+ },
191
+ ':focus-visible': {
192
+ outlineColor: color['border/focused'],
193
+ outlineStyle: 'solid',
194
+ outlineWidth: 2,
195
+ outlineOffset: 2
196
+ },
197
+ ...($disabled ? {
198
+ 'backgroundColor': color['bg/disabled'],
199
+ 'color': color['text/disabled'],
200
+ '& svg': {
201
+ color: color['icon/disabled']
202
+ }
203
+ } : {})
204
+ },
205
+ outlined: {
206
+ 'backgroundColor': color['bg/neutral/subtler'],
207
+ 'color': color['text/neutral/subtle'],
208
+ '& svg': {
209
+ color: color['icon/neutral/bolder']
210
+ },
211
+ ':after': {
212
+ content: '""',
213
+ position: 'absolute',
214
+ top: 0,
215
+ right: 0,
216
+ bottom: 0,
217
+ left: 0,
218
+ borderWidth: 1,
219
+ borderStyle: 'solid',
220
+ borderColor: color['border/neutral/bolder'],
221
+ borderRadius: radii.full,
222
+ boxSizing: 'border-box'
223
+ },
224
+ ':hover:not(:disabled)': {
225
+ backgroundColor: color['bg/neutral/subtler/hovered']
226
+ },
227
+ ':active:not(:disabled)': {
228
+ backgroundColor: color['bg/neutral/subtler/pressed']
229
+ },
230
+ ':focus-visible': {
231
+ outlineColor: color['border/focused'],
232
+ outlineStyle: 'solid',
233
+ outlineWidth: 2,
234
+ outlineOffset: 2
235
+ },
236
+ ...($disabled ? {
237
+ 'backgroundColor': color['bg/disabled'],
238
+ 'color': color['text/disabled'],
239
+ '& svg': {
240
+ color: color['icon/disabled']
241
+ },
242
+ ':after': {
243
+ display: 'none'
244
+ }
245
+ } : {})
246
+ },
247
+ plain: {
248
+ 'backgroundColor': color['bg/neutral/subtler'],
249
+ 'color': color['text/neutral/subtle'],
250
+ '& svg': {
251
+ color: color['icon/neutral/bolder']
252
+ },
253
+ ':hover:not(:disabled)': {
254
+ 'color': color['text/neutral'],
255
+ '& svg': {
256
+ color: color['icon/accent/gray']
257
+ }
258
+ },
259
+ ':active:not(:disabled)': {
260
+ 'color': color['text/neutral'],
261
+ '& svg': {
262
+ color: color['icon/accent/gray']
263
+ }
264
+ },
265
+ ':focus-visible': {
266
+ outlineColor: color['border/focused'],
267
+ outlineStyle: 'solid',
268
+ outlineWidth: 2,
269
+ outlineOffset: 2
270
+ },
271
+ ...($disabled ? {
272
+ 'backgroundColor': color['bg/disabled'],
273
+ 'color': color['text/disabled'],
274
+ '& svg': {
275
+ color: color['icon/disabled']
276
+ }
277
+ } : {})
278
+ },
279
+ danger: {
280
+ 'backgroundColor': color['bg/danger/bold'],
281
+ 'color': color['text/inverse'],
282
+ '& svg': {
283
+ color: color['icon/inverse']
284
+ },
285
+ ':hover:not(:disabled)': {
286
+ backgroundColor: color['bg/danger/bold/hovered']
287
+ },
288
+ ':active:not(:disabled)': {
289
+ backgroundColor: color['bg/danger/bold/pressed']
290
+ },
291
+ ':focus-visible': {
292
+ outlineColor: color['border/focused'],
293
+ outlineStyle: 'solid',
294
+ outlineWidth: 2,
295
+ outlineOffset: 2
296
+ },
297
+ ...($disabled ? {
298
+ 'backgroundColor': color['bg/disabled'],
299
+ 'color': color['text/disabled'],
300
+ '& svg': {
301
+ color: color['icon/disabled']
302
+ }
303
+ } : {})
304
+ }
305
+ }
306
+ }));
307
+ const BaseSpinner = Qe(Spinner)(variant({
308
+ prop: 'size',
309
+ variants: {
310
+ l: {
311
+ width: 20,
312
+ height: 20
313
+ },
314
+ m: {
315
+ width: 16,
316
+ height: 16
317
+ },
318
+ s: {
319
+ width: 16,
320
+ height: 16
321
+ }
322
+ }
323
+ }), variant({
324
+ prop: 'variant',
325
+ variants: {
326
+ primary: {
327
+ color: color['icon/inverse']
328
+ },
329
+ secondary: {
330
+ color: color['icon/primary']
331
+ },
332
+ tertiary: {
333
+ color: color['icon/accent/gray']
334
+ },
335
+ outlined: {
336
+ color: color['icon/neutral/bolder']
337
+ },
338
+ plain: {
339
+ color: color['icon/neutral/bolder']
340
+ },
341
+ danger: {
342
+ color: color['icon/inverse']
343
+ }
344
+ }
345
+ }));
346
+
347
+ export { Button as default };
@@ -1,6 +1,6 @@
1
- import color from '../../../../token-studio/src/token/color/index.js';
2
- import radii from '../../../../token-studio/src/token/radii/index.js';
3
- import typography from '../../../../token-studio/src/token/typography/index.js';
1
+ import color from '../../../../token-studio/esm/token/color/index.js';
2
+ import radii from '../../../../token-studio/esm/token/radii/index.js';
3
+ import typography from '../../../../token-studio/esm/token/typography/index.js';
4
4
  import Qe from '../../../../../node_modules/styled-components/dist/styled-components.esm.js';
5
5
  import '../../../../../node_modules/styled-system/dist/index.esm.js';
6
6
  import { sx } from '../../utils/styled-system/index.js';
@@ -1,5 +1,5 @@
1
1
  import { extends as _extends } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
2
- import space from '../../../../token-studio/src/token/space/index.js';
2
+ import space from '../../../../token-studio/esm/token/space/index.js';
3
3
  import { forwardRef } from 'react';
4
4
  import Qe from '../../../../../node_modules/styled-components/dist/styled-components.esm.js';
5
5
  import '../../../../../node_modules/styled-system/dist/index.esm.js';
@@ -1,6 +1,6 @@
1
1
  import { extends as _extends } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
2
- import color from '../../../../token-studio/src/token/color/index.js';
3
- import radii from '../../../../token-studio/src/token/radii/index.js';
2
+ import color from '../../../../token-studio/esm/token/color/index.js';
3
+ import radii from '../../../../token-studio/esm/token/radii/index.js';
4
4
  import { forwardRef } from 'react';
5
5
  import Qe from '../../../../../node_modules/styled-components/dist/styled-components.esm.js';
6
6
  import '../../../../../node_modules/styled-system/dist/index.esm.js';
@@ -1,6 +1,6 @@
1
1
  import { extends as _extends } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
2
- import color from '../../../../token-studio/src/token/color/index.js';
3
- import radii from '../../../../token-studio/src/token/radii/index.js';
2
+ import color from '../../../../token-studio/esm/token/color/index.js';
3
+ import radii from '../../../../token-studio/esm/token/radii/index.js';
4
4
  import Qe from '../../../../../node_modules/styled-components/dist/styled-components.esm.js';
5
5
  import '../../../../../node_modules/styled-system/dist/index.esm.js';
6
6
  import { sx } from '../../utils/styled-system/index.js';
@@ -1,6 +1,6 @@
1
1
  import 'react';
2
- import SvgProgressGradient from '../../../../icons/src/ProgressGradient.js';
3
- import color from '../../../../token-studio/src/token/color/index.js';
2
+ import SvgProgressGradient from '../../../../icons/esm/ProgressGradient.js';
3
+ import color from '../../../../token-studio/esm/token/color/index.js';
4
4
  import Qe, { keyframes as nt } from '../../../../../node_modules/styled-components/dist/styled-components.esm.js';
5
5
 
6
6
  const spin = nt`
@@ -1,5 +1,5 @@
1
1
  import { extends as _extends } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
2
- import space from '../../../../token-studio/src/token/space/index.js';
2
+ import space from '../../../../token-studio/esm/token/space/index.js';
3
3
  import { forwardRef } from 'react';
4
4
  import Qe from '../../../../../node_modules/styled-components/dist/styled-components.esm.js';
5
5
  import '../../../../../node_modules/styled-system/dist/index.esm.js';
@@ -1,4 +1,4 @@
1
- import typography from '../../../../token-studio/src/token/typography/index.js';
1
+ import typography from '../../../../token-studio/esm/token/typography/index.js';
2
2
  import Qe from '../../../../../node_modules/styled-components/dist/styled-components.esm.js';
3
3
  import { fontSize, fontWeight, lineHeight, textAlign } from '../../../../../node_modules/styled-system/dist/index.esm.js';
4
4
  import { sx, wordBreak, whiteSpace, textDecoration } from '../../utils/styled-system/index.js';
@@ -1,3 +1,4 @@
1
+ export { default as Button } from './core/Button/index.js';
1
2
  export { default as Chip } from './core/Chip/index.js';
2
3
  export { default as GradientText } from './core/GradientText/index.js';
3
4
  export { default as Grid } from './core/Grid/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamturing/react-kit",
3
- "version": "1.1.5",
3
+ "version": "1.2.0",
4
4
  "description": "React components, hooks for create teamturing web application",
5
5
  "author": "Sungchang Park <psch300@gmail.com> (https://github.com/psch300)",
6
6
  "homepage": "https://github.com/weareteamturing/bombe#readme",
@@ -11,8 +11,9 @@
11
11
  "esm"
12
12
  ],
13
13
  "exports": {
14
- "require": "./src/index.ts",
15
- "import": "./src/index.ts"
14
+ "require": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./esm/index.js"
16
17
  },
17
18
  "repository": {
18
19
  "type": "git",
@@ -44,8 +45,8 @@
44
45
  "styled-system": "^5.1.5"
45
46
  },
46
47
  "dependencies": {
47
- "@teamturing/icons": "^1.17.5",
48
- "@teamturing/token-studio": "^1.1.5"
48
+ "@teamturing/icons": "^1.17.6",
49
+ "@teamturing/token-studio": "^1.1.6"
49
50
  },
50
- "gitHead": "feca6a32202c553c53ef2870fa2e374009b737ef"
51
+ "gitHead": "9a886f294a5301d5733ea151fca77233a541ff96"
51
52
  }