@teamturing/react-kit 2.21.6 → 2.21.7

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.
@@ -1,4 +1,3 @@
1
- import typography from '../../packages/token-studio/esm/token/typography/index.js';
2
1
  import { scrollIntoView } from '../../packages/utils/esm/scrollIntoView.js';
3
2
  import { useRef, useContext } from 'react';
4
3
  import styled from 'styled-components';
@@ -77,15 +76,17 @@ const BaseTabItem = styled(UnstyledButton)(({
77
76
  outlineWidth: 2,
78
77
  outlineOffset: 2
79
78
  }
80
- }), () => variant({
79
+ }), ({
80
+ theme
81
+ }) => variant({
81
82
  prop: 'size',
82
83
  variants: {
83
84
  l: {
84
85
  'px': 4,
85
86
  'py': 2,
86
- 'fontSize': typography['s'].fontSize,
87
- 'fontWeight': typography['s'].fontWeight,
88
- 'lineHeight': typography['s'].lineHeight,
87
+ 'fontSize': theme.fontSizes.s,
88
+ 'fontWeight': theme.fontWeights.medium,
89
+ 'lineHeight': theme.lineHeights[2],
89
90
  '& svg': {
90
91
  width: 20,
91
92
  height: 20
@@ -94,9 +95,9 @@ const BaseTabItem = styled(UnstyledButton)(({
94
95
  m: {
95
96
  'px': 4,
96
97
  'py': 2,
97
- 'fontSize': typography['xs'].fontSize,
98
- 'fontWeight': typography['xs'].fontWeight,
99
- 'lineHeight': typography['xs'].lineHeight,
98
+ 'fontSize': theme.fontSizes.xs,
99
+ 'fontWeight': theme.fontWeights.medium,
100
+ 'lineHeight': theme.lineHeights[2],
100
101
  '& svg': {
101
102
  width: 20,
102
103
  height: 20
@@ -105,9 +106,9 @@ const BaseTabItem = styled(UnstyledButton)(({
105
106
  s: {
106
107
  'px': 3,
107
108
  'py': 2,
108
- 'fontSize': typography['xxs'].fontSize,
109
- 'fontWeight': typography['xxs'].fontWeight,
110
- 'lineHeight': typography['xxs'].lineHeight,
109
+ 'fontSize': theme.fontSizes.xxs,
110
+ 'fontWeight': theme.fontWeights.medium,
111
+ 'lineHeight': theme.lineHeights[2],
111
112
  '& svg': {
112
113
  width: 16,
113
114
  height: 16
@@ -1,11 +1,9 @@
1
1
  import { createContext, useRef, useState, useEffect } from 'react';
2
2
  import SvgChevronLeft from '../../packages/icons/esm/ChevronLeft.js';
3
3
  import SvgChevronRight from '../../packages/icons/esm/ChevronRight.js';
4
- import elevation from '../../packages/token-studio/esm/token/elevation/index.js';
5
- import gradient from '../../packages/token-studio/esm/token/gradient/index.js';
6
- import '../../packages/token-studio/esm/token/typography/index.js';
7
4
  import { forcePixelValue } from '../../packages/utils/esm/forcePixelValue.js';
8
5
  import throttle from '../../node_modules/lodash.throttle/index.js';
6
+ import { useTheme } from 'styled-components';
9
7
  import useResize from '../../hook/useResize.js';
10
8
  import IconButton from '../IconButton/index.js';
11
9
  import View from '../View/index.js';
@@ -19,6 +17,7 @@ const Tab = ({
19
17
  gap = 2,
20
18
  children
21
19
  }) => {
20
+ const theme = useTheme();
22
21
  const rootRef = useRef(null);
23
22
  const [isLeftButtonVisible, setIsLeftButtonVisible] = useState(rootRef.current ? rootRef.current.scrollLeft > 0 : false);
24
23
  const [isRightButtonVisible, setIsRightButtonVisible] = useState(rootRef.current ? rootRef.current.clientWidth + rootRef.current.scrollLeft < rootRef.current.scrollWidth : false);
@@ -86,7 +85,7 @@ const Tab = ({
86
85
  bottom: 0,
87
86
  width: forcePixelValue(gradientWidth),
88
87
  height: '100%',
89
- background: `linear-gradient(${gradient['overlay/floating/toright']})`,
88
+ background: `linear-gradient(${theme.gradients['overlay/floating/toright']})`,
90
89
  pointerEvents: 'none'
91
90
  }
92
91
  }), /*#__PURE__*/jsxRuntimeExports.jsx(View, {
@@ -97,7 +96,7 @@ const Tab = ({
97
96
  top: 0,
98
97
  left: 0,
99
98
  bottom: 0,
100
- backgroundColor: elevation.surface
99
+ backgroundColor: theme.colors.surface
101
100
  },
102
101
  children: /*#__PURE__*/jsxRuntimeExports.jsx(IconButton, {
103
102
  size: 's',
@@ -115,7 +114,7 @@ const Tab = ({
115
114
  bottom: 0,
116
115
  width: forcePixelValue(gradientWidth),
117
116
  height: '100%',
118
- background: `linear-gradient(${gradient['overlay/floating/toleft']})`,
117
+ background: `linear-gradient(${theme.gradients['overlay/floating/toleft']})`,
119
118
  pointerEvents: 'none'
120
119
  }
121
120
  }), /*#__PURE__*/jsxRuntimeExports.jsx(View, {
@@ -126,7 +125,7 @@ const Tab = ({
126
125
  top: 0,
127
126
  right: 0,
128
127
  bottom: 0,
129
- backgroundColor: elevation.surface
128
+ backgroundColor: theme.colors.surface
130
129
  },
131
130
  children: /*#__PURE__*/jsxRuntimeExports.jsx(IconButton, {
132
131
  size: 's',
@@ -1,4 +1,3 @@
1
- import typography from '../../packages/token-studio/esm/token/typography/index.js';
2
1
  import styled from 'styled-components';
3
2
  import { fontSize, fontWeight, lineHeight, textAlign } from '../../node_modules/styled-system/dist/index.esm.js';
4
3
  import { sx, wordBreak, whiteSpace, textDecoration } from '../../utils/styled-system/index.js';
@@ -12,34 +11,136 @@ const Text = styled.span({
12
11
  '& > span': {
13
12
  display: 'inline'
14
13
  }
15
- }, variant({
14
+ }, ({
15
+ theme
16
+ }) => variant({
16
17
  prop: 'typography',
17
18
  variants: {
18
- 'display1': typography.display1,
19
- 'display2': typography.display2,
20
- 'display3': typography.display3,
21
- 'display4': typography.display4,
22
- 'xxl/regular': typography['xxl/regular'],
23
- 'xxl': typography['xxl'],
24
- 'xxl/bold': typography['xxl/bold'],
25
- 'xl/regular': typography['xl/regular'],
26
- 'xl': typography['xl'],
27
- 'xl/bold': typography['xl/bold'],
28
- 'l/regular': typography['l/regular'],
29
- 'l': typography['l'],
30
- 'l/bold': typography['l/bold'],
31
- 'm/regular': typography['m/regular'],
32
- 'm': typography['m'],
33
- 'm/bold': typography['m/bold'],
34
- 's/regular': typography['s/regular'],
35
- 's': typography['s'],
36
- 's/bold': typography['s/bold'],
37
- 'xs/regular': typography['xs/regular'],
38
- 'xs': typography['xs'],
39
- 'xs/bold': typography['xs/bold'],
40
- 'xxs/regular': typography['xxs/regular'],
41
- 'xxs': typography['xxs'],
42
- 'xxs/bold': typography['xxs/bold']
19
+ 'display1': {
20
+ fontSize: theme.fontSizes.display1,
21
+ fontWeight: theme.fontWeights.bold,
22
+ lineHeight: theme.lineHeights[1]
23
+ },
24
+ 'display2': {
25
+ fontSize: theme.fontSizes.display2,
26
+ fontWeight: theme.fontWeights.bold,
27
+ lineHeight: theme.lineHeights[1]
28
+ },
29
+ 'display3': {
30
+ fontSize: theme.fontSizes.display3,
31
+ fontWeight: theme.fontWeights.bold,
32
+ lineHeight: theme.lineHeights[1]
33
+ },
34
+ 'display4': {
35
+ fontSize: theme.fontSizes.display4,
36
+ fontWeight: theme.fontWeights.bold,
37
+ lineHeight: theme.lineHeights[2]
38
+ },
39
+ 'xxl/regular': {
40
+ fontSize: theme.fontSizes.xxl,
41
+ fontWeight: theme.fontWeights.regular,
42
+ lineHeight: theme.lineHeights[2]
43
+ },
44
+ 'xxl': {
45
+ fontSize: theme.fontSizes.xxl,
46
+ fontWeight: theme.fontWeights.medium,
47
+ lineHeight: theme.lineHeights[2]
48
+ },
49
+ 'xxl/bold': {
50
+ fontSize: theme.fontSizes.xxl,
51
+ fontWeight: theme.fontWeights.bold,
52
+ lineHeight: theme.lineHeights[2]
53
+ },
54
+ 'xl/regular': {
55
+ fontSize: theme.fontSizes.xl,
56
+ fontWeight: theme.fontWeights.regular,
57
+ lineHeight: theme.lineHeights[2]
58
+ },
59
+ 'xl': {
60
+ fontSize: theme.fontSizes.xl,
61
+ fontWeight: theme.fontWeights.medium,
62
+ lineHeight: theme.lineHeights[2]
63
+ },
64
+ 'xl/bold': {
65
+ fontSize: theme.fontSizes.xl,
66
+ fontWeight: theme.fontWeights.bold,
67
+ lineHeight: theme.lineHeights[2]
68
+ },
69
+ 'l/regular': {
70
+ fontSize: theme.fontSizes.l,
71
+ fontWeight: theme.fontWeights.regular,
72
+ lineHeight: theme.lineHeights[2]
73
+ },
74
+ 'l': {
75
+ fontSize: theme.fontSizes.l,
76
+ fontWeight: theme.fontWeights.medium,
77
+ lineHeight: theme.lineHeights[2]
78
+ },
79
+ 'l/bold': {
80
+ fontSize: theme.fontSizes.l,
81
+ fontWeight: theme.fontWeights.bold,
82
+ lineHeight: theme.lineHeights[2]
83
+ },
84
+ 'm/regular': {
85
+ fontSize: theme.fontSizes.m,
86
+ fontWeight: theme.fontWeights.regular,
87
+ lineHeight: theme.lineHeights[2]
88
+ },
89
+ 'm': {
90
+ fontSize: theme.fontSizes.m,
91
+ fontWeight: theme.fontWeights.medium,
92
+ lineHeight: theme.lineHeights[2]
93
+ },
94
+ 'm/bold': {
95
+ fontSize: theme.fontSizes.m,
96
+ fontWeight: theme.fontWeights.bold,
97
+ lineHeight: theme.lineHeights[2]
98
+ },
99
+ 's/regular': {
100
+ fontSize: theme.fontSizes.s,
101
+ fontWeight: theme.fontWeights.regular,
102
+ lineHeight: theme.lineHeights[2]
103
+ },
104
+ 's': {
105
+ fontSize: theme.fontSizes.s,
106
+ fontWeight: theme.fontWeights.medium,
107
+ lineHeight: theme.lineHeights[2]
108
+ },
109
+ 's/bold': {
110
+ fontSize: theme.fontSizes.s,
111
+ fontWeight: theme.fontWeights.bold,
112
+ lineHeight: theme.lineHeights[2]
113
+ },
114
+ 'xs/regular': {
115
+ fontSize: theme.fontSizes.xs,
116
+ fontWeight: theme.fontWeights.regular,
117
+ lineHeight: theme.lineHeights[2]
118
+ },
119
+ 'xs': {
120
+ fontSize: theme.fontSizes.xs,
121
+ fontWeight: theme.fontWeights.medium,
122
+ lineHeight: theme.lineHeights[2]
123
+ },
124
+ 'xs/bold': {
125
+ fontSize: theme.fontSizes.xs,
126
+ fontWeight: theme.fontWeights.bold,
127
+ lineHeight: theme.lineHeights[2]
128
+ },
129
+ 'xxs/regular': {
130
+ fontSize: theme.fontSizes.xxs,
131
+ fontWeight: theme.fontWeights.regular,
132
+ lineHeight: theme.lineHeights[2]
133
+ },
134
+ 'xxs': {
135
+ fontSize: theme.fontSizes.xxs,
136
+ fontWeight: theme.fontWeights.medium,
137
+ lineHeight: theme.lineHeights[2]
138
+ },
139
+ 'xxs/bold': {
140
+ fontSize: theme.fontSizes.xxs,
141
+ fontWeight: theme.fontWeights.bold,
142
+ lineHeight: theme.lineHeights[2]
143
+ }
43
144
  }
44
145
  }), compose(wordBreak, whiteSpace, textDecoration, fontSize, fontWeight, lineHeight, color, textAlign), sx);
45
146
  Text.defaultProps = {
@@ -1,11 +1,9 @@
1
- import color from '../../packages/token-studio/esm/token/color/index.js';
2
- import '../../packages/token-studio/esm/token/typography/index.js';
3
1
  import { forcePixelValue } from '../../packages/utils/esm/forcePixelValue.js';
4
2
  import { isFunction } from '../../packages/utils/esm/isFunction.js';
5
3
  import { isNullable } from '../../packages/utils/esm/isNullable.js';
6
4
  import { forwardRef, cloneElement } from 'react';
7
5
  import { r as reactIsExports } from '../../node_modules/react-is/index.js';
8
- import styled, { css } from 'styled-components';
6
+ import styled, { css, useTheme } from 'styled-components';
9
7
  import useProvidedOrCreatedRef from '../../hook/useProvidedOrCreatedRef.js';
10
8
  import View from '../View/index.js';
11
9
  import TextInputTrailingAction from './TextInputTrailingAction.js';
@@ -20,6 +18,7 @@ const TextInput = ({
20
18
  trailingAction,
21
19
  ...props
22
20
  }, ref) => {
21
+ const theme = useTheme();
23
22
  const inputRef = useProvidedOrCreatedRef(ref);
24
23
  const focusInput = () => {
25
24
  inputRef.current?.focus();
@@ -36,12 +35,12 @@ const TextInput = ({
36
35
  'flexShrink': 0,
37
36
  'fontSize': 'xxs',
38
37
  'fontWeight': 'medium',
39
- 'color': color['text/neutral'],
38
+ 'color': theme.colors['text/neutral'],
40
39
  '& > svg': {
41
40
  display: 'block',
42
41
  width: 16,
43
42
  height: 16,
44
- color: color['icon/neutral/bold']
43
+ color: theme.colors['icon/neutral/bold']
45
44
  }
46
45
  },
47
46
  children: typeof LeadingVisual !== 'string' && reactIsExports.isValidElementType(LeadingVisual) ? /*#__PURE__*/jsxRuntimeExports.jsx(LeadingVisual, {}) : LeadingVisual
@@ -61,12 +60,12 @@ const TextInput = ({
61
60
  'flexShrink': 0,
62
61
  'fontSize': 'xxs',
63
62
  'fontWeight': 'medium',
64
- 'color': color['text/neutral'],
63
+ 'color': theme.colors['text/neutral'],
65
64
  '& > svg': {
66
65
  display: 'block',
67
66
  width: 16,
68
67
  height: 16,
69
- color: color['icon/neutral/bold']
68
+ color: theme.colors['icon/neutral/bold']
70
69
  }
71
70
  },
72
71
  children: [typeof TrailingVisual !== 'string' && reactIsExports.isValidElementType(TrailingVisual) ? /*#__PURE__*/jsxRuntimeExports.jsx(TrailingVisual, {}) : TrailingVisual, trailingAction ? /*#__PURE__*/cloneElement(trailingAction, {
@@ -8,9 +8,5 @@ const surfaceElevation = {
8
8
  const shadowElevation = {
9
9
  'shadow/overlay': shadow.shadowMedium
10
10
  };
11
- const elevation = {
12
- ...surfaceElevation,
13
- ...shadowElevation
14
- };
15
11
 
16
- export { elevation as default, shadowElevation, surfaceElevation };
12
+ export { shadowElevation, surfaceElevation };
@@ -2,7 +2,7 @@ import fontSizes from './fontSizes.js';
2
2
  import fontWeights from './fontWeights.js';
3
3
  import lineHeights from './lineHeights.js';
4
4
 
5
- const typography = {
5
+ ({
6
6
  'display1': {
7
7
  fontSize: fontSizes.display1,
8
8
  fontWeight: fontWeights.bold,
@@ -128,6 +128,6 @@ const typography = {
128
128
  fontWeight: fontWeights.bold,
129
129
  lineHeight: lineHeights[2]
130
130
  }
131
- };
131
+ });
132
132
 
133
- export { typography as default, fontSizes, fontWeights, lineHeights };
133
+ export { fontSizes, fontWeights, lineHeights };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamturing/react-kit",
3
- "version": "2.21.6",
3
+ "version": "2.21.7",
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",
@@ -66,5 +66,5 @@
66
66
  "react-textarea-autosize": "^8.5.3",
67
67
  "styled-system": "^5.1.5"
68
68
  },
69
- "gitHead": "75256eb184a6e69f6e8c61d6d4927ba0ee501e26"
69
+ "gitHead": "01d4f7727cb5dc9d953a857a50dbf66db1a0c734"
70
70
  }