@teamturing/react-kit 2.23.7 → 2.24.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/dist/core/Flash/index.d.ts +4 -2
- package/dist/index.js +63 -23
- package/esm/core/Flash/index.js +62 -22
- package/esm/core/FormControl/index.js +4 -1
- package/package.json +2 -2
|
@@ -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
|
})}
|
|
@@ -36017,7 +36054,8 @@ const FormControl = ({
|
|
|
36017
36054
|
disabled,
|
|
36018
36055
|
required,
|
|
36019
36056
|
additionalInputComponentCandidates = [],
|
|
36020
|
-
sx
|
|
36057
|
+
sx,
|
|
36058
|
+
...props
|
|
36021
36059
|
}, ref) => {
|
|
36022
36060
|
const [relocatableComponentsObject, restComponents] = useRelocation({
|
|
36023
36061
|
children: propChildren,
|
|
@@ -36044,6 +36082,7 @@ const FormControl = ({
|
|
|
36044
36082
|
columnGap: 2,
|
|
36045
36083
|
...sx
|
|
36046
36084
|
},
|
|
36085
|
+
...props,
|
|
36047
36086
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx(View, {
|
|
36048
36087
|
display: 'inline-flex',
|
|
36049
36088
|
children: /*#__PURE__*/React.cloneElement(InputComponent, {
|
|
@@ -36072,6 +36111,7 @@ const FormControl = ({
|
|
|
36072
36111
|
},
|
|
36073
36112
|
...sx
|
|
36074
36113
|
},
|
|
36114
|
+
...props,
|
|
36075
36115
|
children: [relocatableComponentsObject.label, /*#__PURE__*/React.cloneElement(InputComponent, {
|
|
36076
36116
|
id,
|
|
36077
36117
|
disabled,
|
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
|
})}
|
|
@@ -20,7 +20,8 @@ const FormControl = ({
|
|
|
20
20
|
disabled,
|
|
21
21
|
required,
|
|
22
22
|
additionalInputComponentCandidates = [],
|
|
23
|
-
sx
|
|
23
|
+
sx,
|
|
24
|
+
...props
|
|
24
25
|
}, ref) => {
|
|
25
26
|
const [relocatableComponentsObject, restComponents] = useRelocation({
|
|
26
27
|
children: propChildren,
|
|
@@ -47,6 +48,7 @@ const FormControl = ({
|
|
|
47
48
|
columnGap: 2,
|
|
48
49
|
...sx
|
|
49
50
|
},
|
|
51
|
+
...props,
|
|
50
52
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx(View, {
|
|
51
53
|
display: 'inline-flex',
|
|
52
54
|
children: /*#__PURE__*/cloneElement(InputComponent, {
|
|
@@ -75,6 +77,7 @@ const FormControl = ({
|
|
|
75
77
|
},
|
|
76
78
|
...sx
|
|
77
79
|
},
|
|
80
|
+
...props,
|
|
78
81
|
children: [relocatableComponentsObject.label, /*#__PURE__*/cloneElement(InputComponent, {
|
|
79
82
|
id,
|
|
80
83
|
disabled,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamturing/react-kit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.24.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",
|
|
@@ -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": "4552a5ead57814709712fd7c644eddba24b95f6e"
|
|
70
70
|
}
|