@teamturing/react-kit 1.1.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/LICENSE +21 -0
- package/README.md +5 -0
- package/dist/core/Chip/index.d.ts +25 -0
- package/dist/core/GradientText/index.d.ts +287 -0
- package/dist/core/Grid/index.d.ts +25 -0
- package/dist/core/IconButton/index.d.ts +53 -0
- package/dist/core/IconToggleButton/index.d.ts +28 -0
- package/dist/core/ItemList/index.d.ts +10 -0
- package/dist/core/Space/index.d.ts +8 -0
- package/dist/core/Spinner/index.d.ts +487 -0
- package/dist/core/Stack/index.d.ts +19 -0
- package/dist/core/StyledIcon/index.d.ts +10 -0
- package/dist/core/Text/index.d.ts +10 -0
- package/dist/core/View/index.d.ts +8 -0
- package/dist/core/_UnstyledButton.d.ts +6 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +4010 -0
- package/dist/utils/forcePixelValue.d.ts +6 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/isArray.d.ts +1 -0
- package/dist/utils/isNullable.d.ts +1 -0
- package/dist/utils/styled-system/index.d.ts +31 -0
- package/esm/_virtual/_commonjsHelpers.js +5 -0
- package/esm/_virtual/_rollupPluginBabelHelpers.js +16 -0
- package/esm/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js +12 -0
- package/esm/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js +9 -0
- package/esm/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js +51 -0
- package/esm/node_modules/@styled-system/background/dist/index.esm.js +16 -0
- package/esm/node_modules/@styled-system/border/dist/index.esm.js +131 -0
- package/esm/node_modules/@styled-system/color/dist/index.esm.js +17 -0
- package/esm/node_modules/@styled-system/core/dist/index.esm.js +178 -0
- package/esm/node_modules/@styled-system/css/dist/index.esm.js +209 -0
- package/esm/node_modules/@styled-system/flexbox/dist/index.esm.js +21 -0
- package/esm/node_modules/@styled-system/grid/dist/index.esm.js +34 -0
- package/esm/node_modules/@styled-system/layout/dist/index.esm.js +47 -0
- package/esm/node_modules/@styled-system/position/dist/index.esm.js +35 -0
- package/esm/node_modules/@styled-system/shadow/dist/index.esm.js +14 -0
- package/esm/node_modules/@styled-system/space/dist/index.esm.js +121 -0
- package/esm/node_modules/@styled-system/typography/dist/index.esm.js +33 -0
- package/esm/node_modules/@styled-system/variant/dist/index.esm.js +40 -0
- package/esm/node_modules/object-assign/index.js +83 -0
- package/esm/node_modules/styled-components/dist/styled-components.esm.js +657 -0
- package/esm/node_modules/styled-system/dist/index.esm.js +77 -0
- package/esm/node_modules/stylis/src/Enum.js +11 -0
- package/esm/node_modules/stylis/src/Middleware.js +85 -0
- package/esm/node_modules/stylis/src/Parser.js +187 -0
- package/esm/node_modules/stylis/src/Prefixer.js +197 -0
- package/esm/node_modules/stylis/src/Serializer.js +39 -0
- package/esm/node_modules/stylis/src/Tokenizer.js +242 -0
- package/esm/node_modules/stylis/src/Utility.js +128 -0
- package/esm/node_modules/tslib/tslib.es6.js +44 -0
- package/esm/packages/icons/src/ProgressGradient.js +41 -0
- package/esm/packages/react-kit/src/core/Chip/index.js +179 -0
- package/esm/packages/react-kit/src/core/GradientText/index.js +13 -0
- package/esm/packages/react-kit/src/core/Grid/index.js +106 -0
- package/esm/packages/react-kit/src/core/IconButton/index.js +212 -0
- package/esm/packages/react-kit/src/core/IconToggleButton/index.js +105 -0
- package/esm/packages/react-kit/src/core/ItemList/index.js +11 -0
- package/esm/packages/react-kit/src/core/Space/index.js +12 -0
- package/esm/packages/react-kit/src/core/Spinner/index.js +23 -0
- package/esm/packages/react-kit/src/core/Stack/index.js +57 -0
- package/esm/packages/react-kit/src/core/StyledIcon/index.js +20 -0
- package/esm/packages/react-kit/src/core/Text/index.js +49 -0
- package/esm/packages/react-kit/src/core/View/index.js +18 -0
- package/esm/packages/react-kit/src/core/_UnstyledButton.js +14 -0
- package/esm/packages/react-kit/src/index.js +12 -0
- package/esm/packages/react-kit/src/utils/forcePixelValue.js +8 -0
- package/esm/packages/react-kit/src/utils/isArray.js +3 -0
- package/esm/packages/react-kit/src/utils/isNullable.js +3 -0
- package/esm/packages/react-kit/src/utils/styled-system/index.js +27 -0
- package/esm/packages/token-studio/src/foundation/palette/index.js +90 -0
- package/esm/packages/token-studio/src/foundation/rounding/index.js +13 -0
- package/esm/packages/token-studio/src/foundation/spacing/index.js +56 -0
- package/esm/packages/token-studio/src/foundation/typography/fontSize/index.js +18 -0
- package/esm/packages/token-studio/src/foundation/typography/fontWeight/index.js +13 -0
- package/esm/packages/token-studio/src/foundation/typography/lineHeight/index.js +6 -0
- package/esm/packages/token-studio/src/token/color/index.js +140 -0
- package/esm/packages/token-studio/src/token/radii/index.js +15 -0
- package/esm/packages/token-studio/src/token/space/index.js +55 -0
- package/esm/packages/token-studio/src/token/typography/fontSizes.js +17 -0
- package/esm/packages/token-studio/src/token/typography/fontWeights.js +9 -0
- package/esm/packages/token-studio/src/token/typography/index.js +133 -0
- package/esm/packages/token-studio/src/token/typography/lineHeights.js +8 -0
- package/package.json +59 -0
- package/src/index.ts +12 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { extends as _extends } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import space from '../../../../token-studio/src/token/space/index.js';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import Qe from '../../../../../node_modules/styled-components/dist/styled-components.esm.js';
|
|
5
|
+
import '../../../../../node_modules/styled-system/dist/index.esm.js';
|
|
6
|
+
import { forcePixelValue } from '../../utils/forcePixelValue.js';
|
|
7
|
+
import { isArray } from '../../utils/isArray.js';
|
|
8
|
+
import { isNullable } from '../../utils/isNullable.js';
|
|
9
|
+
import View from '../View/index.js';
|
|
10
|
+
import { variant } from '../../../../../node_modules/@styled-system/variant/dist/index.esm.js';
|
|
11
|
+
|
|
12
|
+
const Grid = /*#__PURE__*/forwardRef(({
|
|
13
|
+
children,
|
|
14
|
+
wrap: propWrap = true,
|
|
15
|
+
gapX = 0,
|
|
16
|
+
gapY = 0,
|
|
17
|
+
as,
|
|
18
|
+
...props
|
|
19
|
+
}, ref) => {
|
|
20
|
+
const wrap = Array.isArray(propWrap) ? propWrap.map(value => value === true ? 'true' : 'false') : propWrap === true ? 'true' : 'false';
|
|
21
|
+
return /*#__PURE__*/React.createElement(BaseGrid, _extends({
|
|
22
|
+
ref: ref,
|
|
23
|
+
gapX: gapX,
|
|
24
|
+
gapY: gapY,
|
|
25
|
+
wrap: wrap,
|
|
26
|
+
as: as
|
|
27
|
+
}, props), children);
|
|
28
|
+
});
|
|
29
|
+
const BaseGrid = Qe(View)({
|
|
30
|
+
display: 'flex',
|
|
31
|
+
flexDirection: 'row'
|
|
32
|
+
}, variant({
|
|
33
|
+
prop: 'gapX',
|
|
34
|
+
variants: Object.fromEntries(Object.entries(space).map(([key, value]) => {
|
|
35
|
+
const styleValue = {
|
|
36
|
+
'& > *': {
|
|
37
|
+
px: forcePixelValue(value / 2)
|
|
38
|
+
},
|
|
39
|
+
'mx': forcePixelValue(-value / 2)
|
|
40
|
+
};
|
|
41
|
+
return [key, styleValue];
|
|
42
|
+
}))
|
|
43
|
+
}), variant({
|
|
44
|
+
prop: 'gapY',
|
|
45
|
+
variants: Object.fromEntries(Object.entries(space).map(([key, value]) => {
|
|
46
|
+
const styleValue = {
|
|
47
|
+
'& > *': {
|
|
48
|
+
mt: forcePixelValue(value)
|
|
49
|
+
},
|
|
50
|
+
'mt': forcePixelValue(-value)
|
|
51
|
+
};
|
|
52
|
+
return [key, styleValue];
|
|
53
|
+
}))
|
|
54
|
+
}), variant({
|
|
55
|
+
prop: 'wrap',
|
|
56
|
+
variants: {
|
|
57
|
+
true: {
|
|
58
|
+
flexWrap: 'wrap'
|
|
59
|
+
},
|
|
60
|
+
false: {
|
|
61
|
+
flexWrap: 'nowrap'
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
const mapValueToResponsiveValueProps = (value, propsAccessor) => {
|
|
66
|
+
if (isNullable(value) || typeof value === 'object' && !isArray(value)) return null;
|
|
67
|
+
if (!isArray(value)) return propsAccessor(value);
|
|
68
|
+
return value.reduce((acc, cur) => {
|
|
69
|
+
const curProps = propsAccessor(cur);
|
|
70
|
+
const curPropKeys = Object.keys(curProps);
|
|
71
|
+
return Object.fromEntries(curPropKeys.map(curPropKey => [curPropKey, acc[curPropKey] === undefined || acc[curPropKey] === null ? [curProps[curPropKey]] : isArray(acc[curPropKey]) ? [...acc[curPropKey], curProps[curPropKey]] : [acc[curPropKey], curProps[curPropKey]]]));
|
|
72
|
+
}, {});
|
|
73
|
+
};
|
|
74
|
+
const Unit = ({
|
|
75
|
+
size,
|
|
76
|
+
as,
|
|
77
|
+
children,
|
|
78
|
+
...props
|
|
79
|
+
}) => {
|
|
80
|
+
const getFlexGrowBySize = size => size === 'max' ? 1 : size === 'min' ? 0 : 1;
|
|
81
|
+
const getFlexBySize = size => size === 'max' ? 1 : size === 'min' ? 'none' : 'none';
|
|
82
|
+
const getFlexBasisBySize = size => {
|
|
83
|
+
const percentage = Math.round(size * 100 * 10000) / 10000;
|
|
84
|
+
return size === 'max' ? 'auto' : size === 'min' ? 'auto' : `${percentage}%`;
|
|
85
|
+
};
|
|
86
|
+
const getWidthBySize = size => size === 'max' ? 'auto' : size === 'min' ? 'auto' : 'none';
|
|
87
|
+
const getMaxWidthBySize = size => {
|
|
88
|
+
const percentage = Math.round(size * 100 * 10000) / 10000;
|
|
89
|
+
return size === 'max' ? '100%' : size === 'min' ? 'none' : `${percentage}%`;
|
|
90
|
+
};
|
|
91
|
+
return /*#__PURE__*/React.createElement(View, _extends({}, mapValueToResponsiveValueProps(size, value => ({
|
|
92
|
+
display: value === 0 ? 'none' : 'initial',
|
|
93
|
+
flowGrow: getFlexGrowBySize(value),
|
|
94
|
+
flex: getFlexBySize(value),
|
|
95
|
+
flexBasis: getFlexBasisBySize(value),
|
|
96
|
+
width: getWidthBySize(value),
|
|
97
|
+
maxWidth: getMaxWidthBySize(value)
|
|
98
|
+
})), {
|
|
99
|
+
as: as
|
|
100
|
+
}, props), children);
|
|
101
|
+
};
|
|
102
|
+
var index = Object.assign(Grid, {
|
|
103
|
+
Unit
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
export { index as default };
|
|
@@ -0,0 +1,212 @@
|
|
|
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';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import Qe from '../../../../../node_modules/styled-components/dist/styled-components.esm.js';
|
|
6
|
+
import '../../../../../node_modules/styled-system/dist/index.esm.js';
|
|
7
|
+
import Spinner from '../Spinner/index.js';
|
|
8
|
+
import UnstyledButton from '../_UnstyledButton.js';
|
|
9
|
+
import { variant } from '../../../../../node_modules/@styled-system/variant/dist/index.esm.js';
|
|
10
|
+
|
|
11
|
+
const IconButton = /*#__PURE__*/forwardRef(({
|
|
12
|
+
icon: Icon,
|
|
13
|
+
size = 'm',
|
|
14
|
+
variant = 'primary',
|
|
15
|
+
disabled = false,
|
|
16
|
+
loading = false,
|
|
17
|
+
type = 'button',
|
|
18
|
+
...props
|
|
19
|
+
}, ref) => {
|
|
20
|
+
return /*#__PURE__*/React.createElement(BaseIconButton, _extends({
|
|
21
|
+
ref: ref,
|
|
22
|
+
type: type,
|
|
23
|
+
icon: Icon,
|
|
24
|
+
size: size,
|
|
25
|
+
variant: variant,
|
|
26
|
+
disabled: disabled || loading,
|
|
27
|
+
$disabled: disabled,
|
|
28
|
+
$loading: loading
|
|
29
|
+
}, props), !loading ? /*#__PURE__*/React.createElement(Icon, null) : /*#__PURE__*/React.createElement(Spinner, {
|
|
30
|
+
color: 'currentColor'
|
|
31
|
+
}));
|
|
32
|
+
});
|
|
33
|
+
const BaseIconButton = Qe(UnstyledButton)(({
|
|
34
|
+
$loading,
|
|
35
|
+
$disabled
|
|
36
|
+
}) => ({
|
|
37
|
+
'position': 'relative',
|
|
38
|
+
'borderRadius': radii.full,
|
|
39
|
+
'transition': 'background-color 100ms, color 100ms',
|
|
40
|
+
'& svg': {
|
|
41
|
+
display: 'block',
|
|
42
|
+
pointerEvents: 'none'
|
|
43
|
+
},
|
|
44
|
+
'cursor': $loading ? 'progress' : $disabled ? 'not-allowed' : 'pointer',
|
|
45
|
+
':focus-visible': {
|
|
46
|
+
outlineColor: color['border/focused'],
|
|
47
|
+
outlineStyle: 'solid',
|
|
48
|
+
outlineWidth: 2,
|
|
49
|
+
outlineOffset: 2
|
|
50
|
+
}
|
|
51
|
+
}), variant({
|
|
52
|
+
prop: 'size',
|
|
53
|
+
variants: {
|
|
54
|
+
l: {
|
|
55
|
+
'p': 3,
|
|
56
|
+
'& svg': {
|
|
57
|
+
width: 24,
|
|
58
|
+
height: 24
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
m: {
|
|
62
|
+
'p': 2,
|
|
63
|
+
'& svg': {
|
|
64
|
+
width: 24,
|
|
65
|
+
height: 24
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
s: {
|
|
69
|
+
'p': 2,
|
|
70
|
+
'& svg': {
|
|
71
|
+
width: 16,
|
|
72
|
+
height: 16
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}), ({
|
|
77
|
+
$disabled
|
|
78
|
+
}) => variant({
|
|
79
|
+
prop: 'variant',
|
|
80
|
+
variants: {
|
|
81
|
+
'primary': {
|
|
82
|
+
'backgroundColor': color['bg/primary'],
|
|
83
|
+
'color': color['icon/inverse'],
|
|
84
|
+
':hover:not(:disabled)': {
|
|
85
|
+
backgroundColor: color['bg/primary/hovered']
|
|
86
|
+
},
|
|
87
|
+
':active:not(:disabled)': {
|
|
88
|
+
backgroundColor: color['bg/primary/pressed']
|
|
89
|
+
},
|
|
90
|
+
...($disabled ? {
|
|
91
|
+
backgroundColor: color['bg/disabled'],
|
|
92
|
+
color: color['icon/disabled']
|
|
93
|
+
} : {})
|
|
94
|
+
},
|
|
95
|
+
'secondary': {
|
|
96
|
+
'backgroundColor': color['bg/secondary'],
|
|
97
|
+
'color': color['icon/primary'],
|
|
98
|
+
':hover:not(:disabled)': {
|
|
99
|
+
backgroundColor: color['bg/secondary/hovered']
|
|
100
|
+
},
|
|
101
|
+
':active:not(:disabled)': {
|
|
102
|
+
backgroundColor: color['bg/secondary/pressed']
|
|
103
|
+
},
|
|
104
|
+
...($disabled ? {
|
|
105
|
+
backgroundColor: color['bg/disabled'],
|
|
106
|
+
color: color['icon/disabled']
|
|
107
|
+
} : {})
|
|
108
|
+
},
|
|
109
|
+
'tertiary': {
|
|
110
|
+
'backgroundColor': color['bg/neutral'],
|
|
111
|
+
'color': color['icon/accent/gray'],
|
|
112
|
+
':hover:not(:disabled)': {
|
|
113
|
+
backgroundColor: color['bg/neutral/hovered']
|
|
114
|
+
},
|
|
115
|
+
':active:not(:disabled)': {
|
|
116
|
+
backgroundColor: color['bg/neutral/pressed']
|
|
117
|
+
},
|
|
118
|
+
...($disabled ? {
|
|
119
|
+
backgroundColor: color['bg/disabled'],
|
|
120
|
+
color: color['icon/disabled']
|
|
121
|
+
} : {})
|
|
122
|
+
},
|
|
123
|
+
'outlined': {
|
|
124
|
+
'backgroundColor': color['bg/neutral/subtler'],
|
|
125
|
+
'color': color['icon/neutral/bolder'],
|
|
126
|
+
':after': {
|
|
127
|
+
content: '""',
|
|
128
|
+
position: 'absolute',
|
|
129
|
+
top: 0,
|
|
130
|
+
right: 0,
|
|
131
|
+
bottom: 0,
|
|
132
|
+
left: 0,
|
|
133
|
+
borderWidth: 1,
|
|
134
|
+
borderStyle: 'solid',
|
|
135
|
+
borderColor: color['border/neutral/bolder'],
|
|
136
|
+
borderRadius: radii.full,
|
|
137
|
+
boxSizing: 'border-box'
|
|
138
|
+
},
|
|
139
|
+
':hover:not(:disabled)': {
|
|
140
|
+
backgroundColor: color['bg/neutral/subtler/hovered']
|
|
141
|
+
},
|
|
142
|
+
':active:not(:disabled)': {
|
|
143
|
+
backgroundColor: color['bg/neutral/subtler/pressed']
|
|
144
|
+
},
|
|
145
|
+
...($disabled ? {
|
|
146
|
+
'backgroundColor': color['bg/disabled'],
|
|
147
|
+
'color': color['icon/disabled'],
|
|
148
|
+
':after': {
|
|
149
|
+
display: 'none'
|
|
150
|
+
}
|
|
151
|
+
} : {})
|
|
152
|
+
},
|
|
153
|
+
'plain-bold': {
|
|
154
|
+
'backgroundColor': color['bg/neutral/subtler'],
|
|
155
|
+
'color': color['icon/neutral/bolder'],
|
|
156
|
+
':hover:not(:disabled)': {
|
|
157
|
+
color: color['icon/accent/gray']
|
|
158
|
+
},
|
|
159
|
+
':active:not(:disabled)': {
|
|
160
|
+
color: color['icon/accent/gray']
|
|
161
|
+
},
|
|
162
|
+
...($disabled ? {
|
|
163
|
+
backgroundColor: color['bg/disabled/subtlest'],
|
|
164
|
+
color: color['icon/disabled']
|
|
165
|
+
} : {})
|
|
166
|
+
},
|
|
167
|
+
'plain': {
|
|
168
|
+
'backgroundColor': color['bg/neutral/subtler'],
|
|
169
|
+
'color': color['icon/neutral/bold'],
|
|
170
|
+
':hover:not(:disabled)': {
|
|
171
|
+
color: color['icon/neutral/bolder']
|
|
172
|
+
},
|
|
173
|
+
':active:not(:disabled)': {
|
|
174
|
+
color: color['icon/neutral/bolder']
|
|
175
|
+
},
|
|
176
|
+
...($disabled ? {
|
|
177
|
+
backgroundColor: color['bg/disabled/subtlest'],
|
|
178
|
+
color: color['icon/disabled/subtler']
|
|
179
|
+
} : {})
|
|
180
|
+
},
|
|
181
|
+
'plain-subtle': {
|
|
182
|
+
'backgroundColor': color['bg/neutral/subtler'],
|
|
183
|
+
'color': color['icon/neutral'],
|
|
184
|
+
':hover:not(:disabled)': {
|
|
185
|
+
color: color['icon/neutral/bold']
|
|
186
|
+
},
|
|
187
|
+
':active:not(:disabled)': {
|
|
188
|
+
color: color['icon/neutral/bold']
|
|
189
|
+
},
|
|
190
|
+
...($disabled ? {
|
|
191
|
+
backgroundColor: color['bg/disabled/subtlest'],
|
|
192
|
+
color: color['icon/disabled/subtler']
|
|
193
|
+
} : {})
|
|
194
|
+
},
|
|
195
|
+
'danger': {
|
|
196
|
+
'backgroundColor': color['bg/danger/bold'],
|
|
197
|
+
'color': color['icon/inverse'],
|
|
198
|
+
':hover:not(:disabled)': {
|
|
199
|
+
backgroundColor: color['bg/danger/bold/hovered']
|
|
200
|
+
},
|
|
201
|
+
':active:not(:disabled)': {
|
|
202
|
+
backgroundColor: color['bg/danger/bold/pressed']
|
|
203
|
+
},
|
|
204
|
+
...($disabled ? {
|
|
205
|
+
backgroundColor: color['bg/disabled'],
|
|
206
|
+
color: color['icon/disabled']
|
|
207
|
+
} : {})
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}));
|
|
211
|
+
|
|
212
|
+
export { IconButton as default };
|
|
@@ -0,0 +1,105 @@
|
|
|
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';
|
|
4
|
+
import Qe from '../../../../../node_modules/styled-components/dist/styled-components.esm.js';
|
|
5
|
+
import '../../../../../node_modules/styled-system/dist/index.esm.js';
|
|
6
|
+
import { sx } from '../../utils/styled-system/index.js';
|
|
7
|
+
import UnstyledButton from '../_UnstyledButton.js';
|
|
8
|
+
import { variant } from '../../../../../node_modules/@styled-system/variant/dist/index.esm.js';
|
|
9
|
+
|
|
10
|
+
const IconToggleButton = ({
|
|
11
|
+
icon: Icon,
|
|
12
|
+
size = 'm',
|
|
13
|
+
variant = 'primary',
|
|
14
|
+
selected = false,
|
|
15
|
+
disabled = false,
|
|
16
|
+
sx,
|
|
17
|
+
...props
|
|
18
|
+
}) => {
|
|
19
|
+
return /*#__PURE__*/React.createElement(BaseIconToggleButton, _extends({
|
|
20
|
+
icon: Icon,
|
|
21
|
+
size: size,
|
|
22
|
+
variant: variant,
|
|
23
|
+
selected: selected,
|
|
24
|
+
type: 'button',
|
|
25
|
+
disabled: disabled,
|
|
26
|
+
$disabled: disabled,
|
|
27
|
+
sx: sx
|
|
28
|
+
}, props), /*#__PURE__*/React.createElement(Icon, null));
|
|
29
|
+
};
|
|
30
|
+
const BaseIconToggleButton = Qe(UnstyledButton)(({
|
|
31
|
+
$disabled
|
|
32
|
+
}) => ({
|
|
33
|
+
'position': 'relative',
|
|
34
|
+
'borderRadius': radii.full,
|
|
35
|
+
'transition': 'background-color 100ms, color 100ms',
|
|
36
|
+
'& svg': {
|
|
37
|
+
display: 'block'
|
|
38
|
+
},
|
|
39
|
+
'cursor': $disabled ? 'not-allowed' : 'pointer',
|
|
40
|
+
':focus-visible': {
|
|
41
|
+
outlineColor: color['border/focused'],
|
|
42
|
+
outlineStyle: 'solid',
|
|
43
|
+
outlineWidth: 2,
|
|
44
|
+
outlineOffset: 2
|
|
45
|
+
}
|
|
46
|
+
}), variant({
|
|
47
|
+
prop: 'size',
|
|
48
|
+
variants: {
|
|
49
|
+
l: {
|
|
50
|
+
'p': 3,
|
|
51
|
+
'& svg': {
|
|
52
|
+
width: 24,
|
|
53
|
+
height: 24
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
m: {
|
|
57
|
+
'p': 2,
|
|
58
|
+
'& svg': {
|
|
59
|
+
width: 24,
|
|
60
|
+
height: 24
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
s: {
|
|
64
|
+
'p': 2,
|
|
65
|
+
'& svg': {
|
|
66
|
+
width: 16,
|
|
67
|
+
height: 16
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}), ({
|
|
72
|
+
selected,
|
|
73
|
+
$disabled
|
|
74
|
+
}) => variant({
|
|
75
|
+
prop: 'variant',
|
|
76
|
+
variants: {
|
|
77
|
+
primary: {
|
|
78
|
+
...(selected ? {
|
|
79
|
+
backgroundColor: color['bg/selected/violet'],
|
|
80
|
+
color: color['icon/inverse']
|
|
81
|
+
} : {
|
|
82
|
+
backgroundColor: color['bg/neutral'],
|
|
83
|
+
color: color['icon/accent/gray']
|
|
84
|
+
}),
|
|
85
|
+
...($disabled ? {
|
|
86
|
+
backgroundColor: color['bg/disabled'],
|
|
87
|
+
color: color['icon/disabled']
|
|
88
|
+
} : {})
|
|
89
|
+
},
|
|
90
|
+
plain: {
|
|
91
|
+
backgroundColor: color['bg/neutral/subtler'],
|
|
92
|
+
...(selected ? {
|
|
93
|
+
color: color['icon/selected/primary']
|
|
94
|
+
} : {
|
|
95
|
+
color: color['icon/neutral']
|
|
96
|
+
}),
|
|
97
|
+
...($disabled ? {
|
|
98
|
+
backgroundColor: color['bg/disabled/subtlest'],
|
|
99
|
+
color: color['icon/disabled/subtler']
|
|
100
|
+
} : {})
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}), sx);
|
|
104
|
+
|
|
105
|
+
export { IconToggleButton as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const ItemList = ({
|
|
2
|
+
items,
|
|
3
|
+
renderItem,
|
|
4
|
+
renderItemWrapper = children => children,
|
|
5
|
+
emptyState = null
|
|
6
|
+
}) => {
|
|
7
|
+
if (items.length === 0) return emptyState;
|
|
8
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, items.map((item, i) => renderItemWrapper(renderItem(item, i), item, i)));
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { ItemList as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Qe from '../../../../../node_modules/styled-components/dist/styled-components.esm.js';
|
|
2
|
+
import '../../../../../node_modules/styled-system/dist/index.esm.js';
|
|
3
|
+
import { sx } from '../../utils/styled-system/index.js';
|
|
4
|
+
import { space } from '../../../../../node_modules/@styled-system/space/dist/index.esm.js';
|
|
5
|
+
|
|
6
|
+
const Space = Qe.div`
|
|
7
|
+
width: inherit;
|
|
8
|
+
${space};
|
|
9
|
+
${sx}
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
export { Space as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import SvgProgressGradient from '../../../../icons/src/ProgressGradient.js';
|
|
3
|
+
import color from '../../../../token-studio/src/token/color/index.js';
|
|
4
|
+
import Qe, { keyframes as nt } from '../../../../../node_modules/styled-components/dist/styled-components.esm.js';
|
|
5
|
+
|
|
6
|
+
const spin = nt`
|
|
7
|
+
from {
|
|
8
|
+
transform: rotate(0);
|
|
9
|
+
}
|
|
10
|
+
to {
|
|
11
|
+
transform: rotate(360deg);
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
const Spinner = Qe(SvgProgressGradient)`
|
|
15
|
+
animation: ${spin} 1000ms infinite steps(8, end);
|
|
16
|
+
`;
|
|
17
|
+
Spinner.defaultProps = {
|
|
18
|
+
width: 32,
|
|
19
|
+
height: 32,
|
|
20
|
+
color: color['icon/neutral']
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { Spinner as default };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { extends as _extends } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import space from '../../../../token-studio/src/token/space/index.js';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import Qe from '../../../../../node_modules/styled-components/dist/styled-components.esm.js';
|
|
5
|
+
import '../../../../../node_modules/styled-system/dist/index.esm.js';
|
|
6
|
+
import { forcePixelValue } from '../../utils/forcePixelValue.js';
|
|
7
|
+
import View from '../View/index.js';
|
|
8
|
+
import { variant } from '../../../../../node_modules/@styled-system/variant/dist/index.esm.js';
|
|
9
|
+
|
|
10
|
+
const Stack = /*#__PURE__*/forwardRef(({
|
|
11
|
+
gapX = 0,
|
|
12
|
+
gapY = 0,
|
|
13
|
+
children,
|
|
14
|
+
alignItems = 'center',
|
|
15
|
+
...props
|
|
16
|
+
}, ref) => /*#__PURE__*/React.createElement(BaseStack, _extends({
|
|
17
|
+
ref: ref,
|
|
18
|
+
alignItems: alignItems,
|
|
19
|
+
gapX: gapX,
|
|
20
|
+
gapY: gapY
|
|
21
|
+
}, props), children));
|
|
22
|
+
const BaseStack = Qe(View)({
|
|
23
|
+
display: 'flex',
|
|
24
|
+
flexDirection: 'row',
|
|
25
|
+
flexWrap: 'wrap'
|
|
26
|
+
}, variant({
|
|
27
|
+
prop: 'gapX',
|
|
28
|
+
variants: Object.fromEntries(Object.entries(space).map(([key, value]) => {
|
|
29
|
+
const styleValue = {
|
|
30
|
+
'& > *': {
|
|
31
|
+
px: forcePixelValue(value / 2)
|
|
32
|
+
},
|
|
33
|
+
'mx': forcePixelValue(-value / 2)
|
|
34
|
+
};
|
|
35
|
+
return [key, styleValue];
|
|
36
|
+
}))
|
|
37
|
+
}), variant({
|
|
38
|
+
prop: 'gapY',
|
|
39
|
+
variants: Object.fromEntries(Object.entries(space).map(([key, value]) => {
|
|
40
|
+
const styleValue = {
|
|
41
|
+
'& > *': {
|
|
42
|
+
mt: forcePixelValue(value)
|
|
43
|
+
},
|
|
44
|
+
'mt': forcePixelValue(-value)
|
|
45
|
+
};
|
|
46
|
+
return [key, styleValue];
|
|
47
|
+
}))
|
|
48
|
+
}));
|
|
49
|
+
const Item = ({
|
|
50
|
+
children,
|
|
51
|
+
...props
|
|
52
|
+
}) => /*#__PURE__*/React.createElement(View, props, children);
|
|
53
|
+
var index = Object.assign(Stack, {
|
|
54
|
+
Item
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export { index as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { extends as _extends } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import View from '../View/index.js';
|
|
3
|
+
|
|
4
|
+
const StyledIcon = ({
|
|
5
|
+
icon: Icon,
|
|
6
|
+
sx,
|
|
7
|
+
...props
|
|
8
|
+
}) => /*#__PURE__*/React.createElement(View, _extends({}, props, {
|
|
9
|
+
color: props.color,
|
|
10
|
+
sx: {
|
|
11
|
+
'& svg': {
|
|
12
|
+
display: 'inline-flex',
|
|
13
|
+
width: '100%',
|
|
14
|
+
height: '100%'
|
|
15
|
+
},
|
|
16
|
+
...sx
|
|
17
|
+
}
|
|
18
|
+
}), /*#__PURE__*/React.createElement(Icon, null));
|
|
19
|
+
|
|
20
|
+
export { StyledIcon as default };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import typography from '../../../../token-studio/src/token/typography/index.js';
|
|
2
|
+
import Qe from '../../../../../node_modules/styled-components/dist/styled-components.esm.js';
|
|
3
|
+
import { fontSize, fontWeight, lineHeight, textAlign } from '../../../../../node_modules/styled-system/dist/index.esm.js';
|
|
4
|
+
import { sx, wordBreak, whiteSpace, textDecoration } from '../../utils/styled-system/index.js';
|
|
5
|
+
import { variant } from '../../../../../node_modules/@styled-system/variant/dist/index.esm.js';
|
|
6
|
+
import { compose } from '../../../../../node_modules/@styled-system/core/dist/index.esm.js';
|
|
7
|
+
import { color } from '../../../../../node_modules/@styled-system/color/dist/index.esm.js';
|
|
8
|
+
|
|
9
|
+
const Text = Qe.span({
|
|
10
|
+
'display': 'block',
|
|
11
|
+
'whiteSpace': 'pre-wrap',
|
|
12
|
+
'& > span': {
|
|
13
|
+
display: 'inline'
|
|
14
|
+
}
|
|
15
|
+
}, variant({
|
|
16
|
+
prop: 'typography',
|
|
17
|
+
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']
|
|
43
|
+
}
|
|
44
|
+
}), compose(wordBreak, whiteSpace, textDecoration, fontSize, fontWeight, lineHeight, color, textAlign), sx);
|
|
45
|
+
Text.defaultProps = {
|
|
46
|
+
color: 'text/neutral'
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { Text as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Qe from '../../../../../node_modules/styled-components/dist/styled-components.esm.js';
|
|
2
|
+
import '../../../../../node_modules/styled-system/dist/index.esm.js';
|
|
3
|
+
import { sx } from '../../utils/styled-system/index.js';
|
|
4
|
+
import { compose } from '../../../../../node_modules/@styled-system/core/dist/index.esm.js';
|
|
5
|
+
import { layout } from '../../../../../node_modules/@styled-system/layout/dist/index.esm.js';
|
|
6
|
+
import { color } from '../../../../../node_modules/@styled-system/color/dist/index.esm.js';
|
|
7
|
+
import { flexbox } from '../../../../../node_modules/@styled-system/flexbox/dist/index.esm.js';
|
|
8
|
+
import { background } from '../../../../../node_modules/@styled-system/background/dist/index.esm.js';
|
|
9
|
+
import { border } from '../../../../../node_modules/@styled-system/border/dist/index.esm.js';
|
|
10
|
+
import { position } from '../../../../../node_modules/@styled-system/position/dist/index.esm.js';
|
|
11
|
+
import { shadow } from '../../../../../node_modules/@styled-system/shadow/dist/index.esm.js';
|
|
12
|
+
|
|
13
|
+
const View = Qe.div`
|
|
14
|
+
${compose(layout, color, flexbox, background, border, position, shadow)}
|
|
15
|
+
${sx}
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
export { View as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Qe from '../../../../node_modules/styled-components/dist/styled-components.esm.js';
|
|
2
|
+
import { sx } from '../utils/styled-system/index.js';
|
|
3
|
+
|
|
4
|
+
const UnstyledButton = Qe.button`
|
|
5
|
+
background: none;
|
|
6
|
+
border: 0;
|
|
7
|
+
padding: 0;
|
|
8
|
+
outline: none;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
|
|
11
|
+
${sx}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export { UnstyledButton as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as Chip } from './core/Chip/index.js';
|
|
2
|
+
export { default as GradientText } from './core/GradientText/index.js';
|
|
3
|
+
export { default as Grid } from './core/Grid/index.js';
|
|
4
|
+
export { default as IconButton } from './core/IconButton/index.js';
|
|
5
|
+
export { default as IconToggleButton } from './core/IconToggleButton/index.js';
|
|
6
|
+
export { default as ItemList } from './core/ItemList/index.js';
|
|
7
|
+
export { default as Space } from './core/Space/index.js';
|
|
8
|
+
export { default as Spinner } from './core/Spinner/index.js';
|
|
9
|
+
export { default as Stack } from './core/Stack/index.js';
|
|
10
|
+
export { default as StyledIcon } from './core/StyledIcon/index.js';
|
|
11
|
+
export { default as Text } from './core/Text/index.js';
|
|
12
|
+
export { default as View } from './core/View/index.js';
|