@teamturing/react-kit 2.19.30 → 2.19.32

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,9 +1,10 @@
1
- import { PropsWithChildren } from 'react';
1
+ import { ComponentType, PropsWithChildren, SVGProps } from 'react';
2
2
  import { SxProp } from '../../utils/styled-system';
3
- type FlashVariantType = 'danger';
3
+ type FlashVariantType = 'neutral' | 'danger';
4
4
  type Props = {
5
5
  variant?: FlashVariantType;
6
+ icon?: ComponentType<SVGProps<SVGSVGElement>>;
6
7
  } & SxProp;
7
- declare const Flash: ({ variant, children, ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
8
+ declare const Flash: ({ variant, icon: Icon, children, ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
8
9
  export default Flash;
9
10
  export type { Props as FlashProps };
@@ -0,0 +1,10 @@
1
+ import { InputHTMLAttributes } from 'react';
2
+ import { SxProp } from '../../utils/styled-system';
3
+ type Props = {
4
+ validationStatus?: 'error' | 'success' | undefined;
5
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> & SxProp;
6
+ declare const _default: import("react").ForwardRefExoticComponent<{
7
+ validationStatus?: "error" | "success" | undefined;
8
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, "type"> & SxProp & import("react").RefAttributes<HTMLInputElement>>;
9
+ export default _default;
10
+ export type { Props as RadioProps };
package/dist/index.d.ts CHANGED
@@ -54,6 +54,8 @@ export { default as Pagination } from './core/Pagination';
54
54
  export type { PaginationProps, PaginationPageProps, PaginationPageDirectionProps } from './core/Pagination';
55
55
  export { default as Pill } from './core/Pill';
56
56
  export type { PillProps } from './core/Pill';
57
+ export { default as Radio } from './core/Radio';
58
+ export type { RadioProps } from './core/Radio';
57
59
  export { default as SearchSelectInput } from './core/SearchSelectInput';
58
60
  export type { SearchSelectInputProps } from './core/SearchSelectInput';
59
61
  export { default as Select } from './core/Select';
package/dist/index.js CHANGED
@@ -19245,14 +19245,15 @@ const BaseEmptyState = styled__default.default.div`
19245
19245
  `;
19246
19246
 
19247
19247
  const Flash = ({
19248
- variant = 'danger',
19248
+ variant = 'neutral',
19249
+ icon: Icon = SvgInfoInCircle,
19249
19250
  children,
19250
19251
  ...props
19251
19252
  }) => {
19252
19253
  return /*#__PURE__*/jsxRuntimeExports.jsxs(BaseFlash, {
19253
19254
  variant: variant,
19254
19255
  ...props,
19255
- children: [variant === 'danger' ? /*#__PURE__*/jsxRuntimeExports.jsx(SvgWarning, {}) : null, children]
19256
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx(Icon, {}), children]
19256
19257
  });
19257
19258
  };
19258
19259
  const BaseFlash = styled__default.default.div`
@@ -19271,6 +19272,20 @@ const BaseFlash = styled__default.default.div`
19271
19272
  ${variant({
19272
19273
  prop: 'variant',
19273
19274
  variants: {
19275
+ neutral: {
19276
+ 'display': 'flex',
19277
+ 'flexDirection': 'row',
19278
+ 'alignItems': 'center',
19279
+ 'padding': 4,
19280
+ 'fontSize': 'xs',
19281
+ 'fontWeight': 'medium',
19282
+ 'lineHeight': 2,
19283
+ 'color': 'text/neutral',
19284
+ 'backgroundColor': 'bg/neutral',
19285
+ '& > svg': {
19286
+ color: 'icon/neutral/bold'
19287
+ }
19288
+ },
19274
19289
  danger: {
19275
19290
  'display': 'flex',
19276
19291
  'flexDirection': 'row',
@@ -19291,6 +19306,126 @@ const BaseFlash = styled__default.default.div`
19291
19306
  ${sx}
19292
19307
  `;
19293
19308
 
19309
+ const Radio = ({
19310
+ checked,
19311
+ validationStatus,
19312
+ ...props
19313
+ }, ref) => {
19314
+ const radioRef = useProvidedOrCreatedRef(ref);
19315
+ return /*#__PURE__*/jsxRuntimeExports.jsx(BaseRadio, {
19316
+ ref: radioRef,
19317
+ checked: checked,
19318
+ validationStatus: validationStatus,
19319
+ ...props
19320
+ });
19321
+ };
19322
+ const UnstyledRadio = styled__default.default.input.attrs({
19323
+ type: 'radio'
19324
+ })`
19325
+ appearance: none;
19326
+
19327
+ ${sx}
19328
+ `;
19329
+ const BaseRadio = styled__default.default(UnstyledRadio)`
19330
+ position: relative;
19331
+
19332
+ width: ${forcePixelValue(20)};
19333
+ height: ${forcePixelValue(20)};
19334
+
19335
+ border-width: ${forcePixelValue(2)};
19336
+ border-style: solid;
19337
+ border-color: ${({
19338
+ theme
19339
+ }) => theme.colors['border/neutral']};
19340
+ border-radius: ${({
19341
+ theme
19342
+ }) => `${forcePixelValue(theme.radii.full)}`};
19343
+ cursor: pointer;
19344
+
19345
+ transition: visibility 200ms;
19346
+
19347
+ &::before {
19348
+ visibility: hidden;
19349
+
19350
+ content: '';
19351
+ display: grid;
19352
+ position: absolute;
19353
+
19354
+ top: 0;
19355
+ right: 0;
19356
+ bottom: 0;
19357
+ left: 0;
19358
+
19359
+ border-radius: ${({
19360
+ theme
19361
+ }) => `${forcePixelValue(theme.radii.full)}`};
19362
+
19363
+ background-color: ${({
19364
+ theme
19365
+ }) => theme.colors['icon/inverse']};
19366
+ mask-image: url("data:image/svg+xml,%3Csvg width='8' height='8' viewBox='0 0 8 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='4' cy='4' r='4' fill='white'/%3E%3C/svg%3E%0A");
19367
+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='8' height='8' viewBox='0 0 8 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='4' cy='4' r='4' fill='white'/%3E%3C/svg%3E%0A");
19368
+ mask-size: 40%;
19369
+ -webkit-mask-size: 40%;
19370
+ mask-repeat: no-repeat;
19371
+ -webkit-mask-repeat: no-repeat;
19372
+ mask-position: center;
19373
+ -webkit-mask-position: center;
19374
+ }
19375
+
19376
+ &:disabled {
19377
+ background-color: ${({
19378
+ theme
19379
+ }) => theme.colors['bg/disabled']};
19380
+ border-color: ${({
19381
+ theme
19382
+ }) => theme.colors['border/disabled']};
19383
+ }
19384
+
19385
+ &:checked {
19386
+ background-color: ${({
19387
+ theme
19388
+ }) => theme.colors['bg/primary']};
19389
+ border-width: 0;
19390
+
19391
+ &::before {
19392
+ visibility: visible;
19393
+ }
19394
+
19395
+ &:disabled {
19396
+ background-color: ${({
19397
+ theme
19398
+ }) => theme.colors['bg/disabled']};
19399
+ border-color: ${({
19400
+ theme
19401
+ }) => theme.colors['border/disabled']};
19402
+
19403
+ &::before {
19404
+ background-color: ${({
19405
+ theme
19406
+ }) => theme.colors['icon/disabled']};
19407
+ }
19408
+ }
19409
+ }
19410
+
19411
+ &:focus-visible {
19412
+ outline-width: ${forcePixelValue(2)};
19413
+ outline-style: solid;
19414
+ outline-color: ${({
19415
+ theme
19416
+ }) => theme.colors['border/focused']};
19417
+ }
19418
+
19419
+ ${props => props.validationStatus === 'error' && styled.css`
19420
+ border-color: ${({
19421
+ theme
19422
+ }) => theme.colors['border/danger']};
19423
+ `}
19424
+
19425
+ ${sx}
19426
+ `;
19427
+ var Radio$1 = /*#__PURE__*/React.forwardRef(Radio);
19428
+
19294
19429
  const Overlay = ({
19295
19430
  children,
19296
19431
  isOpen,
@@ -23107,9 +23242,9 @@ const FormControl = ({
23107
23242
  successMessage: FormControlSuccessMessage
23108
23243
  }
23109
23244
  });
23110
- const inputComponentCandidates = [TextInput$1, Textarea, Select$1, SearchSelectInput$1, Checkbox$1, ...additionalInputComponentCandidates];
23245
+ const inputComponentCandidates = [TextInput$1, Textarea, Select$1, SearchSelectInput$1, Checkbox$1, Radio$1, ...additionalInputComponentCandidates];
23111
23246
  const InputComponent = restComponents.find(component => inputComponentCandidates.some(candidate => /*#__PURE__*/React.isValidElement(component) && component.type === candidate));
23112
- const isHorizontalLayoutNeeded = /*#__PURE__*/React.isValidElement(InputComponent) && InputComponent.type === Checkbox$1;
23247
+ const isHorizontalLayoutNeeded = /*#__PURE__*/React.isValidElement(InputComponent) && (InputComponent.type === Checkbox$1 || InputComponent.type === Radio$1);
23113
23248
  return /*#__PURE__*/jsxRuntimeExports.jsx(FormControlContext.Provider, {
23114
23249
  value: {
23115
23250
  id,
@@ -25384,6 +25519,7 @@ exports.Overlay = Overlay$1;
25384
25519
  exports.OverlayPopper = OverlayPopper;
25385
25520
  exports.Pagination = index$3;
25386
25521
  exports.Pill = index$2;
25522
+ exports.Radio = Radio$1;
25387
25523
  exports.SearchSelectInput = SearchSelectInput$1;
25388
25524
  exports.Select = Select$1;
25389
25525
  exports.Space = Space;
@@ -1,5 +1,5 @@
1
1
  import 'react';
2
- import SvgWarning from '../../packages/icons/esm/Warning.js';
2
+ import SvgInfoInCircle from '../../packages/icons/esm/InfoInCircle.js';
3
3
  import { forcePixelValue } from '../../packages/utils/esm/forcePixelValue.js';
4
4
  import styled from 'styled-components';
5
5
  import '../../node_modules/styled-system/dist/index.esm.js';
@@ -8,14 +8,15 @@ import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js'
8
8
  import { variant } from '../../node_modules/@styled-system/variant/dist/index.esm.js';
9
9
 
10
10
  const Flash = ({
11
- variant = 'danger',
11
+ variant = 'neutral',
12
+ icon: Icon = SvgInfoInCircle,
12
13
  children,
13
14
  ...props
14
15
  }) => {
15
16
  return /*#__PURE__*/jsxRuntimeExports.jsxs(BaseFlash, {
16
17
  variant: variant,
17
18
  ...props,
18
- children: [variant === 'danger' ? /*#__PURE__*/jsxRuntimeExports.jsx(SvgWarning, {}) : null, children]
19
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx(Icon, {}), children]
19
20
  });
20
21
  };
21
22
  const BaseFlash = styled.div`
@@ -34,6 +35,20 @@ const BaseFlash = styled.div`
34
35
  ${variant({
35
36
  prop: 'variant',
36
37
  variants: {
38
+ neutral: {
39
+ 'display': 'flex',
40
+ 'flexDirection': 'row',
41
+ 'alignItems': 'center',
42
+ 'padding': 4,
43
+ 'fontSize': 'xs',
44
+ 'fontWeight': 'medium',
45
+ 'lineHeight': 2,
46
+ 'color': 'text/neutral',
47
+ 'backgroundColor': 'bg/neutral',
48
+ '& > svg': {
49
+ color: 'icon/neutral/bold'
50
+ }
51
+ },
37
52
  danger: {
38
53
  'display': 'flex',
39
54
  'flexDirection': 'row',
@@ -1,6 +1,7 @@
1
1
  import { forwardRef, createContext, isValidElement, cloneElement } from 'react';
2
2
  import useRelocation from '../../hook/useRelocation.js';
3
3
  import Checkbox from '../Checkbox/index.js';
4
+ import Radio from '../Radio/index.js';
4
5
  import SearchSelectInput from '../SearchSelectInput/index.js';
5
6
  import Select from '../Select/index.js';
6
7
  import TextInput from '../TextInput/index.js';
@@ -29,9 +30,9 @@ const FormControl = ({
29
30
  successMessage: FormControlSuccessMessage
30
31
  }
31
32
  });
32
- const inputComponentCandidates = [TextInput, Textarea, Select, SearchSelectInput, Checkbox, ...additionalInputComponentCandidates];
33
+ const inputComponentCandidates = [TextInput, Textarea, Select, SearchSelectInput, Checkbox, Radio, ...additionalInputComponentCandidates];
33
34
  const InputComponent = restComponents.find(component => inputComponentCandidates.some(candidate => /*#__PURE__*/isValidElement(component) && component.type === candidate));
34
- const isHorizontalLayoutNeeded = /*#__PURE__*/isValidElement(InputComponent) && InputComponent.type === Checkbox;
35
+ const isHorizontalLayoutNeeded = /*#__PURE__*/isValidElement(InputComponent) && (InputComponent.type === Checkbox || InputComponent.type === Radio);
35
36
  return /*#__PURE__*/jsxRuntimeExports.jsx(FormControlContext.Provider, {
36
37
  value: {
37
38
  id,
@@ -0,0 +1,128 @@
1
+ import { forcePixelValue } from '../../packages/utils/esm/forcePixelValue.js';
2
+ import { forwardRef } from 'react';
3
+ import styled, { css } from 'styled-components';
4
+ import useProvidedOrCreatedRef from '../../hook/useProvidedOrCreatedRef.js';
5
+ import { sx } from '../../utils/styled-system/index.js';
6
+ import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
7
+
8
+ const Radio = ({
9
+ checked,
10
+ validationStatus,
11
+ ...props
12
+ }, ref) => {
13
+ const radioRef = useProvidedOrCreatedRef(ref);
14
+ return /*#__PURE__*/jsxRuntimeExports.jsx(BaseRadio, {
15
+ ref: radioRef,
16
+ checked: checked,
17
+ validationStatus: validationStatus,
18
+ ...props
19
+ });
20
+ };
21
+ const UnstyledRadio = styled.input.attrs({
22
+ type: 'radio'
23
+ })`
24
+ appearance: none;
25
+
26
+ ${sx}
27
+ `;
28
+ const BaseRadio = styled(UnstyledRadio)`
29
+ position: relative;
30
+
31
+ width: ${forcePixelValue(20)};
32
+ height: ${forcePixelValue(20)};
33
+
34
+ border-width: ${forcePixelValue(2)};
35
+ border-style: solid;
36
+ border-color: ${({
37
+ theme
38
+ }) => theme.colors['border/neutral']};
39
+ border-radius: ${({
40
+ theme
41
+ }) => `${forcePixelValue(theme.radii.full)}`};
42
+ cursor: pointer;
43
+
44
+ transition: visibility 200ms;
45
+
46
+ &::before {
47
+ visibility: hidden;
48
+
49
+ content: '';
50
+ display: grid;
51
+ position: absolute;
52
+
53
+ top: 0;
54
+ right: 0;
55
+ bottom: 0;
56
+ left: 0;
57
+
58
+ border-radius: ${({
59
+ theme
60
+ }) => `${forcePixelValue(theme.radii.full)}`};
61
+
62
+ background-color: ${({
63
+ theme
64
+ }) => theme.colors['icon/inverse']};
65
+ mask-image: url("data:image/svg+xml,%3Csvg width='8' height='8' viewBox='0 0 8 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='4' cy='4' r='4' fill='white'/%3E%3C/svg%3E%0A");
66
+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='8' height='8' viewBox='0 0 8 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='4' cy='4' r='4' fill='white'/%3E%3C/svg%3E%0A");
67
+ mask-size: 40%;
68
+ -webkit-mask-size: 40%;
69
+ mask-repeat: no-repeat;
70
+ -webkit-mask-repeat: no-repeat;
71
+ mask-position: center;
72
+ -webkit-mask-position: center;
73
+ }
74
+
75
+ &:disabled {
76
+ background-color: ${({
77
+ theme
78
+ }) => theme.colors['bg/disabled']};
79
+ border-color: ${({
80
+ theme
81
+ }) => theme.colors['border/disabled']};
82
+ }
83
+
84
+ &:checked {
85
+ background-color: ${({
86
+ theme
87
+ }) => theme.colors['bg/primary']};
88
+ border-width: 0;
89
+
90
+ &::before {
91
+ visibility: visible;
92
+ }
93
+
94
+ &:disabled {
95
+ background-color: ${({
96
+ theme
97
+ }) => theme.colors['bg/disabled']};
98
+ border-color: ${({
99
+ theme
100
+ }) => theme.colors['border/disabled']};
101
+
102
+ &::before {
103
+ background-color: ${({
104
+ theme
105
+ }) => theme.colors['icon/disabled']};
106
+ }
107
+ }
108
+ }
109
+
110
+ &:focus-visible {
111
+ outline-width: ${forcePixelValue(2)};
112
+ outline-style: solid;
113
+ outline-color: ${({
114
+ theme
115
+ }) => theme.colors['border/focused']};
116
+ }
117
+
118
+ ${props => props.validationStatus === 'error' && css`
119
+ border-color: ${({
120
+ theme
121
+ }) => theme.colors['border/danger']};
122
+ `}
123
+
124
+ ${sx}
125
+ `;
126
+ var Radio$1 = /*#__PURE__*/forwardRef(Radio);
127
+
128
+ export { Radio$1 as default };
package/esm/index.js CHANGED
@@ -24,6 +24,7 @@ export { default as Overlay } from './core/Overlay/index.js';
24
24
  export { default as OverlayPopper } from './core/OverlayPopper/index.js';
25
25
  export { default as Pagination } from './core/Pagination/index.js';
26
26
  export { default as Pill } from './core/Pill/index.js';
27
+ export { default as Radio } from './core/Radio/index.js';
27
28
  export { default as SearchSelectInput } from './core/SearchSelectInput/index.js';
28
29
  export { default as Select } from './core/Select/index.js';
29
30
  export { default as Space } from './core/Space/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamturing/react-kit",
3
- "version": "2.19.30",
3
+ "version": "2.19.32",
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",
@@ -65,5 +65,5 @@
65
65
  "react-textarea-autosize": "^8.5.3",
66
66
  "styled-system": "^5.1.5"
67
67
  },
68
- "gitHead": "0efd1dddc8466518e381a7fa855f19f2a7e5a7b3"
68
+ "gitHead": "810f5dc18c7ede79944480e217574b67125b5b97"
69
69
  }