@teamturing/react-kit 2.26.4 → 2.27.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/README.md CHANGED
@@ -2,4 +2,20 @@
2
2
 
3
3
  튜링 내에서 웹 애플리케이션을 만들 때 필요한 리액트의 핵심 컴포넌트, 훅을 모아둔 패키지입니다.
4
4
 
5
- > react-native와는 호환성이 맞지 않을 수 있습니다.
5
+ ## 설치
6
+
7
+ ```bash
8
+ yarn add @teamturing/react-kit styled-components styled-system @emotion/is-prop-valid
9
+ ```
10
+
11
+ ## 시작하기
12
+
13
+ ```jsx
14
+ <StyleSheetManager shouldForwardProp={isPropValid}>
15
+ <ThemeProvider>
16
+ <App />
17
+ </ThemeProvider>
18
+ </StyleSheetManager>
19
+ ```
20
+
21
+ [Pretendard](https://github.com/orioncactus/pretendard) 폰트와 사용하는 것을 추천합니다.
@@ -1,17 +1,19 @@
1
- import { ComponentType, HTMLAttributes, HTMLProps, ReactElement, SVGProps } from 'react';
1
+ import { ComponentType, ElementType, HTMLAttributes, HTMLProps, ReactElement, ReactNode, SVGProps } from 'react';
2
2
  import { SxProp } from '../../utils/styled-system';
3
- type FlashVariantType = 'neutral' | 'danger' | 'assist';
3
+ type FlashVariantType = 'neutral' | 'danger' | 'assist' | 'accent';
4
4
  type Props = {
5
5
  variant?: FlashVariantType;
6
6
  icon?: ComponentType<SVGProps<SVGSVGElement>>;
7
+ trailingVisual?: ElementType | ReactNode;
7
8
  buttons?: Array<ReactElement<HTMLProps<HTMLButtonElement>>>;
8
9
  } & SxProp & HTMLAttributes<HTMLDivElement>;
9
10
  declare const _default: import("react").ForwardRefExoticComponent<{
10
11
  variant?: FlashVariantType | undefined;
11
12
  icon?: ComponentType<SVGProps<SVGSVGElement>> | undefined;
13
+ trailingVisual?: string | number | boolean | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | import("react").ReactPortal | null | undefined;
12
14
  buttons?: ReactElement<HTMLProps<HTMLButtonElement>, string | import("react").JSXElementConstructor<any>>[] | undefined;
13
15
  } & SxProp & HTMLAttributes<HTMLDivElement> & {
14
- children?: import("react").ReactNode;
16
+ children?: ReactNode;
15
17
  } & import("react").RefAttributes<HTMLDivElement>>;
16
18
  export default _default;
17
19
  export type { Props as FlashProps };
package/dist/index.js CHANGED
@@ -19279,7 +19279,8 @@ const BaseEmptyState = styled__default.default.div`
19279
19279
 
19280
19280
  const Flash = ({
19281
19281
  variant = 'neutral',
19282
- icon: Icon = variant === 'danger' ? SvgWarning : variant === 'assist' ? SvgTwinkle : SvgInfoInCircle,
19282
+ icon: Icon = variant === 'danger' ? SvgWarning : variant === 'assist' ? SvgTwinkle : variant === 'accent' ? SvgInfoInCircle : SvgInfoInCircle,
19283
+ trailingVisual: TrailingVisual,
19283
19284
  buttons,
19284
19285
  children,
19285
19286
  ...props
@@ -19289,7 +19290,9 @@ const Flash = ({
19289
19290
  ref: ref,
19290
19291
  variant: variant,
19291
19292
  ...props,
19292
- children: [/*#__PURE__*/jsxRuntimeExports.jsx(Icon, {}), /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
19293
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx(Icon, {
19294
+ className: 'flash__leading_icon'
19295
+ }), /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
19293
19296
  className: 'flash__content',
19294
19297
  children: [/*#__PURE__*/jsxRuntimeExports.jsx("span", {
19295
19298
  className: 'flash__content__children',
@@ -19298,7 +19301,10 @@ const Flash = ({
19298
19301
  className: 'flash__content__buttons',
19299
19302
  children: buttons
19300
19303
  }) : null]
19301
- })]
19304
+ }), TrailingVisual ? /*#__PURE__*/jsxRuntimeExports.jsx("div", {
19305
+ className: 'flash__trailing_visual',
19306
+ children: typeof TrailingVisual !== 'string' && reactIsExports.isValidElementType(TrailingVisual) ? /*#__PURE__*/jsxRuntimeExports.jsx(TrailingVisual, {}) : TrailingVisual
19307
+ }) : null]
19302
19308
  });
19303
19309
  };
19304
19310
  const BaseFlash = styled__default.default.div`
@@ -19309,15 +19315,24 @@ const BaseFlash = styled__default.default.div`
19309
19315
  align-items: flex-start;
19310
19316
  padding: ${({
19311
19317
  theme
19312
- }) => forcePixelValue(theme.space[4])};
19318
+ }) => forcePixelValue(theme.space[3])};
19313
19319
  border-radius: ${({
19314
19320
  theme
19315
19321
  }) => forcePixelValue(theme.radii.xs)};
19322
+ column-gap: ${({
19323
+ theme
19324
+ }) => forcePixelValue(theme.space[2])};
19325
+
19326
+ & .flash__content {
19327
+ flex: 1;
19328
+ display: flex;
19329
+ flex-direction: column;
19330
+ }
19316
19331
 
19317
19332
  & .flash__content__children {
19318
19333
  font-size: ${({
19319
19334
  theme
19320
- }) => forcePixelValue(theme.fontSizes.xs)};
19335
+ }) => forcePixelValue(theme.fontSizes.xxs)};
19321
19336
  font-weight: ${({
19322
19337
  theme
19323
19338
  }) => theme.fontWeights.medium};
@@ -19337,12 +19352,22 @@ const BaseFlash = styled__default.default.div`
19337
19352
  }) => forcePixelValue(theme.space[2])};
19338
19353
  }
19339
19354
 
19340
- & > svg {
19341
- min-width: ${forcePixelValue(20)};
19342
- height: ${forcePixelValue(20)};
19343
- margin-right: ${({
19355
+ & .flash__leading_icon {
19356
+ min-width: ${forcePixelValue(16)};
19357
+ height: ${forcePixelValue(16)};
19358
+ }
19359
+
19360
+ & .flash__trailing_visual {
19361
+ display: flex;
19362
+ flex-direction: column;
19363
+
19364
+ svg {
19365
+ width: ${forcePixelValue(16)};
19366
+ height: ${forcePixelValue(16)};
19367
+ color: ${({
19344
19368
  theme
19345
- }) => forcePixelValue(theme.space[2])};
19369
+ }) => theme.colors['icon/neutral/bold']};
19370
+ }
19346
19371
  }
19347
19372
 
19348
19373
  ${({
@@ -19352,13 +19377,13 @@ const BaseFlash = styled__default.default.div`
19352
19377
  variants: {
19353
19378
  neutral: {
19354
19379
  'backgroundColor': 'bg/neutral',
19355
- '& > svg': {
19380
+ '& .flash__leading_icon': {
19356
19381
  color: 'icon/neutral/bold'
19357
19382
  }
19358
19383
  },
19359
19384
  danger: {
19360
19385
  'backgroundColor': 'bg/danger',
19361
- '& > svg': {
19386
+ '& .flash__leading_icon': {
19362
19387
  color: 'icon/danger'
19363
19388
  }
19364
19389
  },
@@ -19367,9 +19392,15 @@ const BaseFlash = styled__default.default.div`
19367
19392
  'borderWidth': 1,
19368
19393
  'borderStyle': 'solid',
19369
19394
  'borderColor': 'transparent',
19370
- '& > svg': {
19395
+ '& .flash__leading_icon': {
19371
19396
  color: 'icon/primary'
19372
19397
  }
19398
+ },
19399
+ accent: {
19400
+ 'backgroundColor': 'bg/accent/blue/subtlest',
19401
+ '& .flash__leading_icon': {
19402
+ color: 'icon/accent/blue'
19403
+ }
19373
19404
  }
19374
19405
  }
19375
19406
  })}
@@ -4,6 +4,7 @@ import SvgTwinkle from '../../packages/icons/esm/Twinkle.js';
4
4
  import SvgWarning from '../../packages/icons/esm/Warning.js';
5
5
  import { forcePixelValue } from '../../packages/utils/esm/forcePixelValue.js';
6
6
  import { isNullable } from '../../packages/utils/esm/isNullable.js';
7
+ import { r as reactIsExports } from '../../node_modules/react-is/index.js';
7
8
  import styled from 'styled-components';
8
9
  import '../../node_modules/styled-system/dist/index.esm.js';
9
10
  import { sx } from '../../utils/styled-system/index.js';
@@ -12,7 +13,8 @@ import { variant } from '../../node_modules/@styled-system/variant/dist/index.es
12
13
 
13
14
  const Flash = ({
14
15
  variant = 'neutral',
15
- icon: Icon = variant === 'danger' ? SvgWarning : variant === 'assist' ? SvgTwinkle : SvgInfoInCircle,
16
+ icon: Icon = variant === 'danger' ? SvgWarning : variant === 'assist' ? SvgTwinkle : variant === 'accent' ? SvgInfoInCircle : SvgInfoInCircle,
17
+ trailingVisual: TrailingVisual,
16
18
  buttons,
17
19
  children,
18
20
  ...props
@@ -22,7 +24,9 @@ const Flash = ({
22
24
  ref: ref,
23
25
  variant: variant,
24
26
  ...props,
25
- children: [/*#__PURE__*/jsxRuntimeExports.jsx(Icon, {}), /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
27
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx(Icon, {
28
+ className: 'flash__leading_icon'
29
+ }), /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
26
30
  className: 'flash__content',
27
31
  children: [/*#__PURE__*/jsxRuntimeExports.jsx("span", {
28
32
  className: 'flash__content__children',
@@ -31,7 +35,10 @@ const Flash = ({
31
35
  className: 'flash__content__buttons',
32
36
  children: buttons
33
37
  }) : null]
34
- })]
38
+ }), TrailingVisual ? /*#__PURE__*/jsxRuntimeExports.jsx("div", {
39
+ className: 'flash__trailing_visual',
40
+ children: typeof TrailingVisual !== 'string' && reactIsExports.isValidElementType(TrailingVisual) ? /*#__PURE__*/jsxRuntimeExports.jsx(TrailingVisual, {}) : TrailingVisual
41
+ }) : null]
35
42
  });
36
43
  };
37
44
  const BaseFlash = styled.div`
@@ -42,15 +49,24 @@ const BaseFlash = styled.div`
42
49
  align-items: flex-start;
43
50
  padding: ${({
44
51
  theme
45
- }) => forcePixelValue(theme.space[4])};
52
+ }) => forcePixelValue(theme.space[3])};
46
53
  border-radius: ${({
47
54
  theme
48
55
  }) => forcePixelValue(theme.radii.xs)};
56
+ column-gap: ${({
57
+ theme
58
+ }) => forcePixelValue(theme.space[2])};
59
+
60
+ & .flash__content {
61
+ flex: 1;
62
+ display: flex;
63
+ flex-direction: column;
64
+ }
49
65
 
50
66
  & .flash__content__children {
51
67
  font-size: ${({
52
68
  theme
53
- }) => forcePixelValue(theme.fontSizes.xs)};
69
+ }) => forcePixelValue(theme.fontSizes.xxs)};
54
70
  font-weight: ${({
55
71
  theme
56
72
  }) => theme.fontWeights.medium};
@@ -70,12 +86,22 @@ const BaseFlash = styled.div`
70
86
  }) => forcePixelValue(theme.space[2])};
71
87
  }
72
88
 
73
- & > svg {
74
- min-width: ${forcePixelValue(20)};
75
- height: ${forcePixelValue(20)};
76
- margin-right: ${({
89
+ & .flash__leading_icon {
90
+ min-width: ${forcePixelValue(16)};
91
+ height: ${forcePixelValue(16)};
92
+ }
93
+
94
+ & .flash__trailing_visual {
95
+ display: flex;
96
+ flex-direction: column;
97
+
98
+ svg {
99
+ width: ${forcePixelValue(16)};
100
+ height: ${forcePixelValue(16)};
101
+ color: ${({
77
102
  theme
78
- }) => forcePixelValue(theme.space[2])};
103
+ }) => theme.colors['icon/neutral/bold']};
104
+ }
79
105
  }
80
106
 
81
107
  ${({
@@ -85,13 +111,13 @@ const BaseFlash = styled.div`
85
111
  variants: {
86
112
  neutral: {
87
113
  'backgroundColor': 'bg/neutral',
88
- '& > svg': {
114
+ '& .flash__leading_icon': {
89
115
  color: 'icon/neutral/bold'
90
116
  }
91
117
  },
92
118
  danger: {
93
119
  'backgroundColor': 'bg/danger',
94
- '& > svg': {
120
+ '& .flash__leading_icon': {
95
121
  color: 'icon/danger'
96
122
  }
97
123
  },
@@ -100,9 +126,15 @@ const BaseFlash = styled.div`
100
126
  'borderWidth': 1,
101
127
  'borderStyle': 'solid',
102
128
  'borderColor': 'transparent',
103
- '& > svg': {
129
+ '& .flash__leading_icon': {
104
130
  color: 'icon/primary'
105
131
  }
132
+ },
133
+ accent: {
134
+ 'backgroundColor': 'bg/accent/blue/subtlest',
135
+ '& .flash__leading_icon': {
136
+ color: 'icon/accent/blue'
137
+ }
106
138
  }
107
139
  }
108
140
  })}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamturing/react-kit",
3
- "version": "2.26.4",
3
+ "version": "2.27.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": "2ac83a049bfab481eec183d3baa80964d7a2d4c5"
69
+ "gitHead": "e5fe17d304318b42494a115dc6d472773065842a"
70
70
  }