@teamturing/react-kit 2.19.31 → 2.19.33

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.
@@ -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
@@ -19306,6 +19306,126 @@ const BaseFlash = styled__default.default.div`
19306
19306
  ${sx}
19307
19307
  `;
19308
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
+
19309
19429
  const Overlay = ({
19310
19430
  children,
19311
19431
  isOpen,
@@ -23122,9 +23242,9 @@ const FormControl = ({
23122
23242
  successMessage: FormControlSuccessMessage
23123
23243
  }
23124
23244
  });
23125
- 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];
23126
23246
  const InputComponent = restComponents.find(component => inputComponentCandidates.some(candidate => /*#__PURE__*/React.isValidElement(component) && component.type === candidate));
23127
- 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);
23128
23248
  return /*#__PURE__*/jsxRuntimeExports.jsx(FormControlContext.Provider, {
23129
23249
  value: {
23130
23250
  id,
@@ -23138,6 +23258,7 @@ const FormControl = ({
23138
23258
  columnGap: 2
23139
23259
  },
23140
23260
  children: [/*#__PURE__*/jsxRuntimeExports.jsx(View, {
23261
+ display: 'inline-flex',
23141
23262
  children: /*#__PURE__*/React.cloneElement(InputComponent, {
23142
23263
  id,
23143
23264
  disabled,
@@ -25399,6 +25520,7 @@ exports.Overlay = Overlay$1;
25399
25520
  exports.OverlayPopper = OverlayPopper;
25400
25521
  exports.Pagination = index$3;
25401
25522
  exports.Pill = index$2;
25523
+ exports.Radio = Radio$1;
25402
25524
  exports.SearchSelectInput = SearchSelectInput$1;
25403
25525
  exports.Select = Select$1;
25404
25526
  exports.Space = Space;
@@ -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,
@@ -45,6 +46,7 @@ const FormControl = ({
45
46
  columnGap: 2
46
47
  },
47
48
  children: [/*#__PURE__*/jsxRuntimeExports.jsx(View, {
49
+ display: 'inline-flex',
48
50
  children: /*#__PURE__*/cloneElement(InputComponent, {
49
51
  id,
50
52
  disabled,
@@ -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.31",
3
+ "version": "2.19.33",
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": "fafd0ad315a50e2779a033af6f92420eb9b49a0f"
68
+ "gitHead": "087278f1712786751daaf663ccb1c59116c89510"
69
69
  }