@teamturing/react-kit 2.23.8 → 2.24.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/dist/core/Flash/index.d.ts +4 -2
- package/dist/index.js +59 -22
- package/esm/core/Flash/index.js +62 -22
- package/package.json +3 -3
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { ComponentType, HTMLAttributes, SVGProps } from 'react';
|
|
1
|
+
import { ComponentType, HTMLAttributes, HTMLProps, ReactElement, SVGProps } from 'react';
|
|
2
2
|
import { SxProp } from '../../utils/styled-system';
|
|
3
|
-
type FlashVariantType = 'neutral' | 'danger';
|
|
3
|
+
type FlashVariantType = 'neutral' | 'danger' | 'assist';
|
|
4
4
|
type Props = {
|
|
5
5
|
variant?: FlashVariantType;
|
|
6
6
|
icon?: ComponentType<SVGProps<SVGSVGElement>>;
|
|
7
|
+
buttons?: Array<ReactElement<HTMLProps<HTMLButtonElement>>>;
|
|
7
8
|
} & SxProp & HTMLAttributes<HTMLDivElement>;
|
|
8
9
|
declare const _default: import("react").ForwardRefExoticComponent<{
|
|
9
10
|
variant?: FlashVariantType | undefined;
|
|
10
11
|
icon?: ComponentType<SVGProps<SVGSVGElement>> | undefined;
|
|
12
|
+
buttons?: ReactElement<HTMLProps<HTMLButtonElement>, string | import("react").JSXElementConstructor<any>>[] | undefined;
|
|
11
13
|
} & SxProp & HTMLAttributes<HTMLDivElement> & {
|
|
12
14
|
children?: import("react").ReactNode;
|
|
13
15
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
package/dist/index.js
CHANGED
|
@@ -19076,60 +19076,97 @@ const BaseEmptyState = styled__default.default.div`
|
|
|
19076
19076
|
|
|
19077
19077
|
const Flash = ({
|
|
19078
19078
|
variant = 'neutral',
|
|
19079
|
-
icon: Icon = SvgInfoInCircle,
|
|
19079
|
+
icon: Icon = variant === 'danger' ? SvgWarning : variant === 'assist' ? SvgTwinkle : SvgInfoInCircle,
|
|
19080
|
+
buttons,
|
|
19080
19081
|
children,
|
|
19081
19082
|
...props
|
|
19082
19083
|
}, ref) => {
|
|
19084
|
+
const isButtonExist = !isNullable(buttons) && buttons.length > 0;
|
|
19083
19085
|
return /*#__PURE__*/jsxRuntimeExports.jsxs(BaseFlash, {
|
|
19084
19086
|
ref: ref,
|
|
19085
19087
|
variant: variant,
|
|
19086
19088
|
...props,
|
|
19087
|
-
children: [/*#__PURE__*/jsxRuntimeExports.jsx(Icon, {}),
|
|
19089
|
+
children: [/*#__PURE__*/jsxRuntimeExports.jsx(Icon, {}), /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
19090
|
+
className: 'flash__content',
|
|
19091
|
+
children: [/*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
19092
|
+
className: 'flash__content__children',
|
|
19093
|
+
children: children
|
|
19094
|
+
}), isButtonExist ? /*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
19095
|
+
className: 'flash__content__buttons',
|
|
19096
|
+
children: buttons
|
|
19097
|
+
}) : null]
|
|
19098
|
+
})]
|
|
19088
19099
|
});
|
|
19089
19100
|
};
|
|
19090
19101
|
const BaseFlash = styled__default.default.div`
|
|
19102
|
+
box-sizing: border-box;
|
|
19103
|
+
|
|
19104
|
+
display: flex;
|
|
19105
|
+
flex-direction: row;
|
|
19106
|
+
align-items: flex-start;
|
|
19107
|
+
padding: ${({
|
|
19108
|
+
theme
|
|
19109
|
+
}) => forcePixelValue(theme.space[4])};
|
|
19091
19110
|
border-radius: ${({
|
|
19092
19111
|
theme
|
|
19093
19112
|
}) => forcePixelValue(theme.radii.xs)};
|
|
19113
|
+
|
|
19114
|
+
& .flash__content__children {
|
|
19115
|
+
font-size: ${({
|
|
19116
|
+
theme
|
|
19117
|
+
}) => forcePixelValue(theme.fontSizes.xs)};
|
|
19118
|
+
font-weight: ${({
|
|
19119
|
+
theme
|
|
19120
|
+
}) => theme.fontWeights.medium};
|
|
19121
|
+
line-height: ${({
|
|
19122
|
+
theme
|
|
19123
|
+
}) => theme.lineHeights[2]};
|
|
19124
|
+
color: ${({
|
|
19125
|
+
theme
|
|
19126
|
+
}) => theme.colors['text/neutral']};
|
|
19127
|
+
word-break: keep-all;
|
|
19128
|
+
white-space: pre-wrap;
|
|
19129
|
+
}
|
|
19130
|
+
|
|
19131
|
+
& .flash__content__buttons {
|
|
19132
|
+
margin-top: ${({
|
|
19133
|
+
theme
|
|
19134
|
+
}) => forcePixelValue(theme.space[2])};
|
|
19135
|
+
}
|
|
19136
|
+
|
|
19094
19137
|
& > svg {
|
|
19095
|
-
min-width: ${forcePixelValue(
|
|
19096
|
-
height: ${forcePixelValue(
|
|
19138
|
+
min-width: ${forcePixelValue(20)};
|
|
19139
|
+
height: ${forcePixelValue(20)};
|
|
19097
19140
|
margin-right: ${({
|
|
19098
19141
|
theme
|
|
19099
19142
|
}) => forcePixelValue(theme.space[2])};
|
|
19100
19143
|
}
|
|
19101
|
-
word-break: keep-all;
|
|
19102
19144
|
|
|
19103
|
-
${
|
|
19145
|
+
${({
|
|
19146
|
+
theme
|
|
19147
|
+
}) => variant({
|
|
19104
19148
|
prop: 'variant',
|
|
19105
19149
|
variants: {
|
|
19106
19150
|
neutral: {
|
|
19107
|
-
'display': 'flex',
|
|
19108
|
-
'flexDirection': 'row',
|
|
19109
|
-
'alignItems': 'center',
|
|
19110
|
-
'padding': 4,
|
|
19111
|
-
'fontSize': 'xs',
|
|
19112
|
-
'fontWeight': 'medium',
|
|
19113
|
-
'lineHeight': 2,
|
|
19114
|
-
'color': 'text/neutral',
|
|
19115
19151
|
'backgroundColor': 'bg/neutral',
|
|
19116
19152
|
'& > svg': {
|
|
19117
19153
|
color: 'icon/neutral/bold'
|
|
19118
19154
|
}
|
|
19119
19155
|
},
|
|
19120
19156
|
danger: {
|
|
19121
|
-
'display': 'flex',
|
|
19122
|
-
'flexDirection': 'row',
|
|
19123
|
-
'alignItems': 'center',
|
|
19124
|
-
'padding': 4,
|
|
19125
|
-
'fontSize': 'xs',
|
|
19126
|
-
'fontWeight': 'medium',
|
|
19127
|
-
'lineHeight': 2,
|
|
19128
|
-
'color': 'text/neutral',
|
|
19129
19157
|
'backgroundColor': 'bg/danger',
|
|
19130
19158
|
'& > svg': {
|
|
19131
19159
|
color: 'icon/danger'
|
|
19132
19160
|
}
|
|
19161
|
+
},
|
|
19162
|
+
assist: {
|
|
19163
|
+
'background': `linear-gradient(${theme.colors['surface/overlay']}, ${theme.colors['surface/overlay']}) padding-box, linear-gradient(${theme.gradients['border/accent/violet']}) border-box`,
|
|
19164
|
+
'borderWidth': 1,
|
|
19165
|
+
'borderStyle': 'solid',
|
|
19166
|
+
'borderColor': 'transparent',
|
|
19167
|
+
'& > svg': {
|
|
19168
|
+
color: 'icon/primary'
|
|
19169
|
+
}
|
|
19133
19170
|
}
|
|
19134
19171
|
}
|
|
19135
19172
|
})}
|
package/esm/core/Flash/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import SvgInfoInCircle from '../../packages/icons/esm/InfoInCircle.js';
|
|
3
|
+
import SvgTwinkle from '../../packages/icons/esm/Twinkle.js';
|
|
4
|
+
import SvgWarning from '../../packages/icons/esm/Warning.js';
|
|
3
5
|
import { forcePixelValue } from '../../packages/utils/esm/forcePixelValue.js';
|
|
6
|
+
import { isNullable } from '../../packages/utils/esm/isNullable.js';
|
|
4
7
|
import styled from 'styled-components';
|
|
5
8
|
import '../../node_modules/styled-system/dist/index.esm.js';
|
|
6
9
|
import { sx } from '../../utils/styled-system/index.js';
|
|
@@ -9,60 +12,97 @@ import { variant } from '../../node_modules/@styled-system/variant/dist/index.es
|
|
|
9
12
|
|
|
10
13
|
const Flash = ({
|
|
11
14
|
variant = 'neutral',
|
|
12
|
-
icon: Icon = SvgInfoInCircle,
|
|
15
|
+
icon: Icon = variant === 'danger' ? SvgWarning : variant === 'assist' ? SvgTwinkle : SvgInfoInCircle,
|
|
16
|
+
buttons,
|
|
13
17
|
children,
|
|
14
18
|
...props
|
|
15
19
|
}, ref) => {
|
|
20
|
+
const isButtonExist = !isNullable(buttons) && buttons.length > 0;
|
|
16
21
|
return /*#__PURE__*/jsxRuntimeExports.jsxs(BaseFlash, {
|
|
17
22
|
ref: ref,
|
|
18
23
|
variant: variant,
|
|
19
24
|
...props,
|
|
20
|
-
children: [/*#__PURE__*/jsxRuntimeExports.jsx(Icon, {}),
|
|
25
|
+
children: [/*#__PURE__*/jsxRuntimeExports.jsx(Icon, {}), /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
26
|
+
className: 'flash__content',
|
|
27
|
+
children: [/*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
28
|
+
className: 'flash__content__children',
|
|
29
|
+
children: children
|
|
30
|
+
}), isButtonExist ? /*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
31
|
+
className: 'flash__content__buttons',
|
|
32
|
+
children: buttons
|
|
33
|
+
}) : null]
|
|
34
|
+
})]
|
|
21
35
|
});
|
|
22
36
|
};
|
|
23
37
|
const BaseFlash = styled.div`
|
|
38
|
+
box-sizing: border-box;
|
|
39
|
+
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: row;
|
|
42
|
+
align-items: flex-start;
|
|
43
|
+
padding: ${({
|
|
44
|
+
theme
|
|
45
|
+
}) => forcePixelValue(theme.space[4])};
|
|
24
46
|
border-radius: ${({
|
|
25
47
|
theme
|
|
26
48
|
}) => forcePixelValue(theme.radii.xs)};
|
|
49
|
+
|
|
50
|
+
& .flash__content__children {
|
|
51
|
+
font-size: ${({
|
|
52
|
+
theme
|
|
53
|
+
}) => forcePixelValue(theme.fontSizes.xs)};
|
|
54
|
+
font-weight: ${({
|
|
55
|
+
theme
|
|
56
|
+
}) => theme.fontWeights.medium};
|
|
57
|
+
line-height: ${({
|
|
58
|
+
theme
|
|
59
|
+
}) => theme.lineHeights[2]};
|
|
60
|
+
color: ${({
|
|
61
|
+
theme
|
|
62
|
+
}) => theme.colors['text/neutral']};
|
|
63
|
+
word-break: keep-all;
|
|
64
|
+
white-space: pre-wrap;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
& .flash__content__buttons {
|
|
68
|
+
margin-top: ${({
|
|
69
|
+
theme
|
|
70
|
+
}) => forcePixelValue(theme.space[2])};
|
|
71
|
+
}
|
|
72
|
+
|
|
27
73
|
& > svg {
|
|
28
|
-
min-width: ${forcePixelValue(
|
|
29
|
-
height: ${forcePixelValue(
|
|
74
|
+
min-width: ${forcePixelValue(20)};
|
|
75
|
+
height: ${forcePixelValue(20)};
|
|
30
76
|
margin-right: ${({
|
|
31
77
|
theme
|
|
32
78
|
}) => forcePixelValue(theme.space[2])};
|
|
33
79
|
}
|
|
34
|
-
word-break: keep-all;
|
|
35
80
|
|
|
36
|
-
${
|
|
81
|
+
${({
|
|
82
|
+
theme
|
|
83
|
+
}) => variant({
|
|
37
84
|
prop: 'variant',
|
|
38
85
|
variants: {
|
|
39
86
|
neutral: {
|
|
40
|
-
'display': 'flex',
|
|
41
|
-
'flexDirection': 'row',
|
|
42
|
-
'alignItems': 'center',
|
|
43
|
-
'padding': 4,
|
|
44
|
-
'fontSize': 'xs',
|
|
45
|
-
'fontWeight': 'medium',
|
|
46
|
-
'lineHeight': 2,
|
|
47
|
-
'color': 'text/neutral',
|
|
48
87
|
'backgroundColor': 'bg/neutral',
|
|
49
88
|
'& > svg': {
|
|
50
89
|
color: 'icon/neutral/bold'
|
|
51
90
|
}
|
|
52
91
|
},
|
|
53
92
|
danger: {
|
|
54
|
-
'display': 'flex',
|
|
55
|
-
'flexDirection': 'row',
|
|
56
|
-
'alignItems': 'center',
|
|
57
|
-
'padding': 4,
|
|
58
|
-
'fontSize': 'xs',
|
|
59
|
-
'fontWeight': 'medium',
|
|
60
|
-
'lineHeight': 2,
|
|
61
|
-
'color': 'text/neutral',
|
|
62
93
|
'backgroundColor': 'bg/danger',
|
|
63
94
|
'& > svg': {
|
|
64
95
|
color: 'icon/danger'
|
|
65
96
|
}
|
|
97
|
+
},
|
|
98
|
+
assist: {
|
|
99
|
+
'background': `linear-gradient(${theme.colors['surface/overlay']}, ${theme.colors['surface/overlay']}) padding-box, linear-gradient(${theme.gradients['border/accent/violet']}) border-box`,
|
|
100
|
+
'borderWidth': 1,
|
|
101
|
+
'borderStyle': 'solid',
|
|
102
|
+
'borderColor': 'transparent',
|
|
103
|
+
'& > svg': {
|
|
104
|
+
color: 'icon/primary'
|
|
105
|
+
}
|
|
66
106
|
}
|
|
67
107
|
}
|
|
68
108
|
})}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamturing/react-kit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.24.1",
|
|
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",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@primer/behaviors": "^1.3.6",
|
|
58
58
|
"@teamturing/icons": "^1.37.2",
|
|
59
59
|
"@teamturing/token-studio": "^1.5.0",
|
|
60
|
-
"@teamturing/utils": "^1.
|
|
60
|
+
"@teamturing/utils": "^1.3.0",
|
|
61
61
|
"framer-motion": "^10.16.4",
|
|
62
62
|
"lodash.debounce": "^4.0.8",
|
|
63
63
|
"lodash.throttle": "^4.1.1",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"react-textarea-autosize": "^8.5.3",
|
|
67
67
|
"styled-system": "^5.1.5"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "f389aaf563e5174a1bb70cd0c739be89c5b4fe73"
|
|
70
70
|
}
|