@semcore/radio 17.0.0-prerelease.31 → 17.0.0-prerelease.36
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/CHANGELOG.md +5 -1
- package/lib/cjs/Radio.js +59 -59
- package/lib/cjs/Radio.js.map +1 -1
- package/lib/cjs/Radio.type.js +2 -0
- package/lib/cjs/Radio.type.js.map +1 -0
- package/lib/cjs/index.js +20 -4
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/radio.shadow.css +0 -10
- package/lib/es6/Radio.js +61 -61
- package/lib/es6/Radio.js.map +1 -1
- package/lib/es6/Radio.type.js +2 -0
- package/lib/es6/Radio.type.js.map +1 -0
- package/lib/es6/index.js +2 -2
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/radio.shadow.css +0 -10
- package/lib/esm/Radio.mjs +61 -59
- package/lib/esm/index.mjs +0 -2
- package/lib/esm/style/radio.shadow.css +0 -10
- package/lib/types/Radio.d.ts +9 -0
- package/lib/types/Radio.type.d.ts +69 -0
- package/lib/types/index.d.ts +2 -98
- package/package.json +5 -5
- package/lib/cjs/index.d.js +0 -2
- package/lib/cjs/index.d.js.map +0 -1
- package/lib/es6/index.d.js +0 -2
- package/lib/es6/index.d.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
-
## [17.0.0] - 2026-
|
|
5
|
+
## [17.0.0] - 2026-04-10
|
|
6
6
|
|
|
7
7
|
### BREAK
|
|
8
8
|
|
|
9
9
|
- **ellipsis**: New major version.
|
|
10
10
|
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Rewrite component to TS.
|
|
14
|
+
|
|
11
15
|
## [16.1.1] - 2025-10-29
|
|
12
16
|
|
|
13
17
|
### Changed
|
package/lib/cjs/Radio.js
CHANGED
|
@@ -16,7 +16,7 @@ exports.wrapRadioGroup = void 0;
|
|
|
16
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
17
|
var _core = require("@semcore/core");
|
|
18
18
|
var _baseComponents = require("@semcore/base-components");
|
|
19
|
-
var _assignProps6 =
|
|
19
|
+
var _assignProps6 = require("@semcore/core/lib/utils/assignProps");
|
|
20
20
|
var _resolveColorEnhance = _interopRequireDefault(require("@semcore/core/lib/utils/enhances/resolveColorEnhance"));
|
|
21
21
|
var _inputProps = _interopRequireWildcard(require("@semcore/core/lib/utils/inputProps"));
|
|
22
22
|
var _logger = _interopRequireDefault(require("@semcore/core/lib/utils/logger"));
|
|
@@ -24,24 +24,25 @@ var _useColorResolver = require("@semcore/core/lib/utils/use/useColorResolver");
|
|
|
24
24
|
var _typography = require("@semcore/typography");
|
|
25
25
|
var _react = _interopRequireDefault(require("react"));
|
|
26
26
|
/*!__reshadow-styles__:"./style/radio.shadow.css"*/
|
|
27
|
-
const style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".
|
|
27
|
+
const style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SRadio_1ifzo_gg_{display:inline-flex;align-items:flex-start;cursor:pointer}.___SRadio_1ifzo_gg_ .___SText_1ifzo_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);color:var(--intergalactic-text-primary, #191b23)}.___SRadio_1ifzo_gg_ .___SText_1ifzo_gg_.__color_1ifzo_gg_{color:var(--color_1ifzo)}.___SRadio_1ifzo_gg_.__disabled_1ifzo_gg_{pointer-events:none}.___SValue_1ifzo_gg_{position:relative;flex-shrink:0;padding:0;outline:0;z-index:0;margin-top:var(--intergalactic-spacing-05x, 2px)}.___SValue_1ifzo_gg_::after,.___SValue_1ifzo_gg_::before{content:\"\";position:absolute;right:0;bottom:0;border-radius:50%;background:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SValue_1ifzo_gg_::before{top:0;left:0;border:1px solid;transition:calc(var(--intergalactic-duration-control, 200)*1ms) all ease-in-out}.___SValue_1ifzo_gg_::after{top:50%;left:50%;transform:translate(-50%,-50%);width:0;height:0}.___SValue_1ifzo_gg_.__disabled_1ifzo_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SValue_1ifzo_gg_._size_m_1ifzo_gg_{width:16px;height:16px}.___SValue_1ifzo_gg_._size_m_1ifzo_gg_ .___SInvalidPattern_1ifzo_gg_:before{width:14px;height:14px}.___SValue_1ifzo_gg_._size_l_1ifzo_gg_{width:20px;height:20px}.___SValue_1ifzo_gg_._size_l_1ifzo_gg_ .___SInvalidPattern_1ifzo_gg_:before{width:18px;height:18px}.___SValue_1ifzo_gg_._state_normal_1ifzo_gg_::before{border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SValue_1ifzo_gg_._state_invalid_1ifzo_gg_::before{border-color:var(--intergalactic-border-critical-active, #d1002f)}.___SControl_1ifzo_gg_{position:absolute;clip:rect(1px,1px,1px,1px)}.___SControl_1ifzo_gg_:checked~.___SValue_1ifzo_gg_._size_m_1ifzo_gg_::after{width:6px;height:6px}.___SControl_1ifzo_gg_:checked~.___SValue_1ifzo_gg_._size_l_1ifzo_gg_::after{width:8px;height:8px}.___SControl_1ifzo_gg_:focus-visible+.___SValue_1ifzo_gg_._state_normal_1ifzo_gg_::before{border-color:var(--intergalactic-border-info-active, #006dca);outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset}.___SControl_1ifzo_gg_:checked:focus-visible~.___SValue_1ifzo_gg_::before,.___SControl_1ifzo_gg_:checked~.___SValue_1ifzo_gg_::before{border-color:var(--intergalactic-control-primary-info, #008ff8);background-color:var(--intergalactic-control-primary-info, #008ff8)}.___SControl_1ifzo_gg_:focus-visible+.___SValue_1ifzo_gg_._state_invalid_1ifzo_gg_::before{border-color:var(--intergalactic-border-critical-active, #d1002f);outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset;outline-color:var(--intergalactic-keyboard-focus-invalid-outline, #ff4953)}.___SControl_1ifzo_gg_:checked~.___SValue_1ifzo_gg_.__theme_1ifzo_gg_::before{border-color:var(--theme_1ifzo);background-color:var(--theme_1ifzo)}.___SValue_1ifzo_gg_._state_normal_1ifzo_gg_.__theme_1ifzo_gg_::before{border-color:var(--theme_1ifzo)}.___SInvalidPattern_1ifzo_gg_{background:0 0;overflow:hidden}.___SInvalidPattern_1ifzo_gg_:before{content:\"\";position:absolute;top:1px;left:1px;border-radius:50%;background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, rgba(209, 0, 47, 1) 0, rgba(209, 0, 47, 1) 2px, transparent 0, transparent 50%));background-size:6px 6px;background-color:var(--intergalactic-bg-primary-neutral, #ffffff)}", /*__inner_css_end__*/"1ifzo_gg_"),
|
|
28
28
|
/*__reshadow_css_end__*/
|
|
29
29
|
{
|
|
30
|
-
"__SRadio": "
|
|
31
|
-
"_disabled": "
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"_color": "
|
|
42
|
-
"--color": "--
|
|
43
|
-
"__SInvalidPattern": "
|
|
30
|
+
"__SRadio": "___SRadio_1ifzo_gg_",
|
|
31
|
+
"_disabled": "__disabled_1ifzo_gg_",
|
|
32
|
+
"__SValue": "___SValue_1ifzo_gg_",
|
|
33
|
+
"_state_normal": "_state_normal_1ifzo_gg_",
|
|
34
|
+
"_state_invalid": "_state_invalid_1ifzo_gg_",
|
|
35
|
+
"__SControl": "___SControl_1ifzo_gg_",
|
|
36
|
+
"_size_m": "_size_m_1ifzo_gg_",
|
|
37
|
+
"_size_l": "_size_l_1ifzo_gg_",
|
|
38
|
+
"_theme": "__theme_1ifzo_gg_",
|
|
39
|
+
"--theme": "--theme_1ifzo",
|
|
40
|
+
"__SText": "___SText_1ifzo_gg_",
|
|
41
|
+
"_color": "__color_1ifzo_gg_",
|
|
42
|
+
"--color": "--color_1ifzo",
|
|
43
|
+
"__SInvalidPattern": "___SInvalidPattern_1ifzo_gg_"
|
|
44
44
|
});
|
|
45
|
+
const RadioContext = /*#__PURE__*/_react.default.createContext({});
|
|
45
46
|
class RadioGroupRoot extends _core.Component {
|
|
46
47
|
uncontrolledProps() {
|
|
47
48
|
return {
|
|
@@ -82,10 +83,13 @@ class RadioGroupRoot extends _core.Component {
|
|
|
82
83
|
(0, _defineProperty2.default)(RadioGroupRoot, "defaultProps", {
|
|
83
84
|
defaultValue: null
|
|
84
85
|
});
|
|
85
|
-
const RadioGroup = exports.RadioGroup = (0, _core.createComponent)(RadioGroupRoot
|
|
86
|
+
const RadioGroup = exports.RadioGroup = (0, _core.createComponent)(RadioGroupRoot, {}, {
|
|
87
|
+
context: RadioContext
|
|
88
|
+
});
|
|
86
89
|
class RadioRoot extends _core.Component {
|
|
87
90
|
constructor(...args) {
|
|
88
91
|
super(...args);
|
|
92
|
+
(0, _defineProperty2.default)(this, "context", {});
|
|
89
93
|
(0, _defineProperty2.default)(this, "state", {
|
|
90
94
|
hoistedDisabled: undefined
|
|
91
95
|
});
|
|
@@ -97,17 +101,16 @@ class RadioRoot extends _core.Component {
|
|
|
97
101
|
});
|
|
98
102
|
}
|
|
99
103
|
getTextProps() {
|
|
100
|
-
// The default values are here, since you cannot rewrite out of context
|
|
101
104
|
const {
|
|
102
|
-
size = 'm',
|
|
103
|
-
disabled,
|
|
105
|
+
size = this.context.size ?? 'm',
|
|
106
|
+
disabled = this.context.disabled,
|
|
104
107
|
label
|
|
105
|
-
} =
|
|
108
|
+
} = this.asProps;
|
|
106
109
|
const {
|
|
107
110
|
hoistedDisabled
|
|
108
111
|
} = this.state;
|
|
109
112
|
const textProps = {
|
|
110
|
-
size,
|
|
113
|
+
size: size === 'm' ? 200 : 300,
|
|
111
114
|
children: label,
|
|
112
115
|
disabled: disabled ?? hoistedDisabled,
|
|
113
116
|
hoistDisabled: this.hoistDisabled,
|
|
@@ -116,14 +119,13 @@ class RadioRoot extends _core.Component {
|
|
|
116
119
|
return textProps;
|
|
117
120
|
}
|
|
118
121
|
getValueProps() {
|
|
119
|
-
// The default values are here, since you cannot rewrite out of context
|
|
120
122
|
const {
|
|
121
|
-
size = 'm',
|
|
122
123
|
state = 'normal',
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
size = this.context.size ?? 'm',
|
|
125
|
+
theme = this.context.theme,
|
|
126
|
+
disabled = this.context.disabled,
|
|
127
|
+
name = this.context.name
|
|
128
|
+
} = this.asProps;
|
|
127
129
|
const {
|
|
128
130
|
value,
|
|
129
131
|
checked
|
|
@@ -162,12 +164,13 @@ class RadioRoot extends _core.Component {
|
|
|
162
164
|
}
|
|
163
165
|
(0, _defineProperty2.default)(RadioRoot, "displayName", 'Radio');
|
|
164
166
|
(0, _defineProperty2.default)(RadioRoot, "style", style);
|
|
165
|
-
(0, _defineProperty2.default)(RadioRoot, "contextType",
|
|
167
|
+
(0, _defineProperty2.default)(RadioRoot, "contextType", RadioContext);
|
|
166
168
|
class ValueRoot extends _core.Component {
|
|
167
169
|
constructor(...args) {
|
|
168
170
|
super(...args);
|
|
171
|
+
(0, _defineProperty2.default)(this, "context", {});
|
|
169
172
|
(0, _defineProperty2.default)(this, "bindHandlerChange", value => e => {
|
|
170
|
-
if (typeof this.context.onChange === 'function') {
|
|
173
|
+
if (typeof this.context.onChange === 'function' && value !== undefined) {
|
|
171
174
|
this.context.onChange(value, e);
|
|
172
175
|
}
|
|
173
176
|
});
|
|
@@ -178,32 +181,35 @@ class ValueRoot extends _core.Component {
|
|
|
178
181
|
};
|
|
179
182
|
}
|
|
180
183
|
getControlProps() {
|
|
181
|
-
const
|
|
184
|
+
const {
|
|
185
|
+
value: currentValue
|
|
186
|
+
} = this.context;
|
|
182
187
|
const {
|
|
183
188
|
forwardRef,
|
|
184
189
|
includeInputProps,
|
|
185
190
|
state,
|
|
186
191
|
value
|
|
187
192
|
} = this.asProps;
|
|
193
|
+
const {
|
|
194
|
+
onChange
|
|
195
|
+
} = this.props;
|
|
188
196
|
const [commonControlProps] = (0, _inputProps.default)(this.asProps, includeInputProps);
|
|
189
197
|
const inputValue = value ?? '';
|
|
190
|
-
|
|
198
|
+
return {
|
|
191
199
|
ref: forwardRef,
|
|
192
200
|
state,
|
|
193
201
|
...commonControlProps,
|
|
194
|
-
value: inputValue
|
|
202
|
+
value: inputValue,
|
|
203
|
+
...(currentValue !== undefined ? {
|
|
204
|
+
checked: currentValue === inputValue,
|
|
205
|
+
onChange: (0, _assignProps6.callAllEventHandlers)(onChange, this.bindHandlerChange(inputValue))
|
|
206
|
+
} : {})
|
|
195
207
|
};
|
|
196
|
-
if (currentValue !== undefined) {
|
|
197
|
-
const {
|
|
198
|
-
onChange
|
|
199
|
-
} = this.props;
|
|
200
|
-
controlProps.checked = currentValue === inputValue;
|
|
201
|
-
controlProps.onChange = (0, _assignProps6.callAllEventHandlers)(onChange, this.bindHandlerChange(inputValue));
|
|
202
|
-
}
|
|
203
|
-
return controlProps;
|
|
204
208
|
}
|
|
205
209
|
getRadioMarkProps() {
|
|
206
|
-
const
|
|
210
|
+
const {
|
|
211
|
+
value: currentValue
|
|
212
|
+
} = this.context;
|
|
207
213
|
const {
|
|
208
214
|
size,
|
|
209
215
|
state,
|
|
@@ -214,16 +220,16 @@ class ValueRoot extends _core.Component {
|
|
|
214
220
|
disabled,
|
|
215
221
|
includeInputProps,
|
|
216
222
|
resolveColor,
|
|
223
|
+
children,
|
|
224
|
+
Children,
|
|
217
225
|
...other
|
|
218
226
|
} = this.asProps;
|
|
219
|
-
const [commonControlProps, radioMarkProps] = (0, _inputProps.default)(other, includeInputProps);
|
|
220
227
|
const {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
} = radioMarkProps;
|
|
228
|
+
onClick
|
|
229
|
+
} = this.props;
|
|
230
|
+
const [commonControlProps, radioMarkProps] = (0, _inputProps.default)(other, includeInputProps);
|
|
225
231
|
const inputValue = value ?? '';
|
|
226
|
-
|
|
232
|
+
return {
|
|
227
233
|
theme,
|
|
228
234
|
size,
|
|
229
235
|
state,
|
|
@@ -231,17 +237,11 @@ class ValueRoot extends _core.Component {
|
|
|
231
237
|
disabled,
|
|
232
238
|
resolveColor,
|
|
233
239
|
checked: commonControlProps.checked,
|
|
234
|
-
...
|
|
240
|
+
...radioMarkProps,
|
|
241
|
+
...(currentValue !== undefined && tag !== 'label' ? {
|
|
242
|
+
onClick: (0, _assignProps6.callAllEventHandlers)(onClick, this.bindHandlerChange(inputValue))
|
|
243
|
+
} : {})
|
|
235
244
|
};
|
|
236
|
-
if (currentValue !== undefined) {
|
|
237
|
-
const {
|
|
238
|
-
onClick
|
|
239
|
-
} = this.props;
|
|
240
|
-
if (tag !== 'label') {
|
|
241
|
-
markProps.onClick = (0, _assignProps6.callAllEventHandlers)(onClick, this.bindHandlerChange(inputValue));
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
return markProps;
|
|
245
245
|
}
|
|
246
246
|
componentDidUpdate() {
|
|
247
247
|
if (this.asProps.rootDisabled !== this.asProps.disabled) {
|
|
@@ -273,7 +273,7 @@ class ValueRoot extends _core.Component {
|
|
|
273
273
|
});
|
|
274
274
|
(0, _defineProperty2.default)(ValueRoot, "enhance", [(0, _resolveColorEnhance.default)()]);
|
|
275
275
|
(0, _defineProperty2.default)(ValueRoot, "displayName", 'Value');
|
|
276
|
-
(0, _defineProperty2.default)(ValueRoot, "contextType",
|
|
276
|
+
(0, _defineProperty2.default)(ValueRoot, "contextType", RadioContext);
|
|
277
277
|
(0, _defineProperty2.default)(ValueRoot, "style", style);
|
|
278
278
|
function Control(props) {
|
|
279
279
|
var _ref3 = arguments[0],
|
package/lib/cjs/Radio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","names":["_core","require","_baseComponents","_assignProps6","_interopRequireWildcard","_resolveColorEnhance","_interopRequireDefault","_inputProps","_logger","_useColorResolver","_typography","_react","style","sstyled","insert","RadioGroupRoot","Component","uncontrolledProps","value","setContext","theme","size","name","onChange","disabled","asProps","render","_ref","Children","default","createElement","Flex","assignProps","_defineProperty2","defaultValue","RadioGroup","exports","createComponent","RadioRoot","constructor","args","hoistedDisabled","undefined","logger","warn","setState","getTextProps","label","context","state","textProps","children","hoistDisabled","rootDisabled","props","getValueProps","checked","_ref2","_ref6","SRadio","Box","styles","hasChildren","cn","Fragment","Radio","Value","Text","CONTEXT_COMPONENT","ValueRoot","e","target","getControlProps","currentValue","forwardRef","includeInputProps","commonControlProps","getInputProps","inputValue","controlProps","ref","callAllEventHandlers","bindHandlerChange","getRadioMarkProps","keyboardFocused","tag","resolveColor","other","radioMarkProps","_children","_Children","propsWithoutChildren","markProps","onClick","componentDidUpdate","componentDidMount","_ref8","_ref7","Control","RadioMark","inputProps","defaultChecked","resolveColorEnhance","_ref3","arguments[0]","_ref9","SControl","displayName","_ref4","_ref0","SValue","SInvalidPattern","InvalidStateBox","_ref5","_ref1","SText","TypographyText","color","React","useEffect","useColorResolver","wrapRadioGroup","wrapper","_default"],"sources":["../../src/Radio.jsx"],"sourcesContent":["import { Flex, Box, InvalidStateBox } from '@semcore/base-components';\nimport { createComponent, Component, CONTEXT_COMPONENT, sstyled, Root } from '@semcore/core';\nimport assignProps, { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport getInputProps, { inputProps } from '@semcore/core/lib/utils/inputProps';\nimport logger from '@semcore/core/lib/utils/logger';\nimport { useColorResolver } from '@semcore/core/lib/utils/use/useColorResolver';\nimport { Text as TypographyText } from '@semcore/typography';\nimport React from 'react';\n\nimport style from './style/radio.shadow.css';\n\nclass RadioGroupRoot extends Component {\n static displayName = 'RadioGroup';\n\n static defaultProps = {\n defaultValue: null,\n };\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n setContext() {\n const { theme, size, name, value, onChange, disabled } = this.asProps;\n\n return {\n onChange,\n value,\n theme,\n size,\n name,\n disabled,\n };\n }\n\n render() {\n const { Children } = this.asProps;\n\n return (\n <Root render={Flex} direction='column' role='group' __excludeProps={['onChange']}>\n <Children />\n </Root>\n );\n }\n}\n\nconst RadioGroup = createComponent(RadioGroupRoot);\n\nclass RadioRoot extends Component {\n static displayName = 'Radio';\n static style = style;\n static contextType = RadioGroup[CONTEXT_COMPONENT];\n\n state = {\n hoistedDisabled: undefined,\n };\n\n hoistDisabled = (disabled) => {\n logger.warn(\n true,\n `Don't set disabled on Radio.Value or Radio.Text, set it on Radio or on RadioGroup (for all items) instead. Otherwise it will produce wrong SSR output.`,\n this.asProps['data-ui-name'],\n );\n this.setState({ hoistedDisabled: disabled });\n };\n\n getTextProps() {\n // The default values are here, since you cannot rewrite out of context\n const { size = 'm', disabled, label } = assignProps(this.asProps, this.context);\n const { hoistedDisabled } = this.state;\n\n const textProps = {\n size,\n children: label,\n disabled: disabled ?? hoistedDisabled,\n hoistDisabled: this.hoistDisabled,\n rootDisabled: this.props.disabled,\n };\n\n return textProps;\n }\n\n getValueProps() {\n // The default values are here, since you cannot rewrite out of context\n const {\n size = 'm',\n state = 'normal',\n theme,\n disabled,\n name,\n } = assignProps(this.asProps, this.context);\n const { value, checked } = this.asProps;\n const { hoistedDisabled } = this.state;\n\n return {\n size: this.props.size ?? size,\n disabled: disabled ?? hoistedDisabled,\n state: state,\n theme,\n value,\n checked,\n name,\n hoistDisabled: this.hoistDisabled,\n rootDisabled: this.props.disabled,\n };\n }\n\n render() {\n const SRadio = Root;\n const { styles, Children, children: hasChildren } = this.asProps;\n\n return sstyled(styles)(\n <SRadio render={Box} tag='label' __excludeProps={['onChange', 'label', 'disabled']}>\n {hasChildren\n ? (\n <Children />\n )\n : (\n <>\n <Radio.Value />\n <Radio.Text />\n </>\n )}\n </SRadio>,\n );\n }\n}\n\nclass ValueRoot extends Component {\n static defaultProps = {\n includeInputProps: inputProps,\n defaultChecked: false,\n };\n\n static enhance = [resolveColorEnhance()];\n static displayName = 'Value';\n static contextType = RadioGroup[CONTEXT_COMPONENT];\n static style = style;\n\n bindHandlerChange = (value) => (e) => {\n if (typeof this.context.onChange === 'function') {\n this.context.onChange(value, e);\n }\n };\n\n uncontrolledProps() {\n return {\n checked: (e) => e.target.checked,\n };\n }\n\n getControlProps() {\n const currentValue = this.context.value;\n const { forwardRef, includeInputProps, state, value } = this.asProps;\n const [commonControlProps] = getInputProps(this.asProps, includeInputProps);\n const inputValue = value ?? '';\n\n const controlProps = {\n ref: forwardRef,\n state,\n ...commonControlProps,\n value: inputValue,\n };\n\n if (currentValue !== undefined) {\n const { onChange } = this.props;\n\n controlProps.checked = currentValue === inputValue;\n controlProps.onChange = callAllEventHandlers(onChange, this.bindHandlerChange(inputValue));\n }\n\n return controlProps;\n }\n\n getRadioMarkProps() {\n const currentValue = this.context.value;\n const {\n size,\n state,\n theme,\n keyboardFocused,\n value,\n tag,\n disabled,\n includeInputProps,\n resolveColor,\n ...other\n } = this.asProps;\n const [commonControlProps, radioMarkProps] = getInputProps(other, includeInputProps);\n const { children: _children, Children: _Children, ...propsWithoutChildren } = radioMarkProps;\n const inputValue = value ?? '';\n\n const markProps = {\n theme,\n size,\n state,\n keyboardFocused,\n disabled,\n resolveColor,\n checked: commonControlProps.checked,\n ...propsWithoutChildren,\n };\n\n if (currentValue !== undefined) {\n const { onClick } = this.props;\n\n if (tag !== 'label') {\n markProps.onClick = callAllEventHandlers(onClick, this.bindHandlerChange(inputValue));\n }\n }\n\n return markProps;\n }\n\n componentDidUpdate() {\n if (this.asProps.rootDisabled !== this.asProps.disabled) {\n this.asProps.hoistDisabled(this.asProps.disabled);\n }\n }\n\n componentDidMount() {\n if (this.asProps.rootDisabled !== this.asProps.disabled) {\n this.asProps.hoistDisabled(this.asProps.disabled);\n }\n }\n\n render() {\n const { styles, children: hasChildren, Children } = this.asProps;\n\n if (!hasChildren) {\n return sstyled(styles)(\n <>\n <Radio.Value.Control />\n <Radio.Value.RadioMark />\n </>,\n );\n }\n\n return sstyled(styles)(<Children />);\n }\n}\n\nfunction Control(props) {\n const SControl = Root;\n const { styles, state } = props;\n\n return sstyled(styles)(\n <SControl render={Box} tag='input' type='radio' aria-invalid={state === 'invalid'} />,\n );\n};\nControl.displayName = 'Control';\n\nfunction RadioMark(props) {\n const SValue = Root;\n const SInvalidPattern = InvalidStateBox;\n const { theme, styles, resolveColor, state, checked } = props;\n\n return sstyled(styles)(\n <SValue render={Box} tag='div' use:theme={resolveColor(theme)} aria-hidden={true}>\n {state === 'invalid' && !checked && <SInvalidPattern />}\n </SValue>,\n );\n}\nRadioMark.displayName = 'RadioMark';\n\nfunction Text(props) {\n const SText = Root;\n const { styles, color } = props;\n\n React.useEffect(() => {\n if (props.rootDisabled !== props.disabled) {\n props.hoistDisabled(props.disabled);\n }\n }, [props.rootDisabled, props.disabled, props.hoistDisabled]);\n const resolveColor = useColorResolver();\n\n return sstyled(styles)(\n <SText render={TypographyText} tag='span' use:color={resolveColor(color)} />,\n );\n}\nText.displayName = 'Text';\n\nexport { inputProps, RadioGroup };\n\nconst Value = createComponent(ValueRoot, {\n Control,\n RadioMark,\n});\n\nconst Radio = createComponent(RadioRoot, {\n Text,\n Value,\n});\n\nexport const wrapRadioGroup = (wrapper) => wrapper;\n\nexport default Radio;\n"],"mappings":";;;;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AADA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,aAAA,GAAA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AEhF;AACA9C,IAAI,CAACwC,WAAW,GAAG,MAAM;AAIzB,MAAMzC,KAAK,GAAG,IAAA7B,qBAAe,EAACgC,SAAS,EAAE;EACvC6B,OAAO;EACPC;AACF,CAAC,CAAC;AAEF,MAAMlC,KAAK,GAAG,IAAA5B,qBAAe,EAACC,SAAS,EAAE;EACvC6B,IAAI;EACJD;AACF,CAAC,CAAC;AAEK,MAAMuD,cAAc,GAAIC,OAAO,IAAKA,OAAO;AAACtF,OAAA,CAAAqF,cAAA,GAAAA,cAAA;AAAA,IAAAE,QAAA,GAAAvF,OAAA,CAAAP,OAAA,GAEpCoC,KAAK","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Radio.js","names":["_core","require","_baseComponents","_assignProps6","_resolveColorEnhance","_interopRequireDefault","_inputProps","_interopRequireWildcard","_logger","_useColorResolver","_typography","_react","style","sstyled","insert","RadioContext","React","createContext","RadioGroupRoot","Component","uncontrolledProps","value","setContext","theme","size","name","onChange","disabled","asProps","render","_ref","Children","default","createElement","Flex","assignProps","_defineProperty2","defaultValue","RadioGroup","exports","createComponent","context","RadioRoot","constructor","args","hoistedDisabled","undefined","logger","warn","setState","getTextProps","label","state","textProps","children","hoistDisabled","rootDisabled","props","getValueProps","checked","_ref2","_ref6","SRadio","Box","styles","hasChildren","cn","Fragment","Radio","Value","Text","ValueRoot","e","target","getControlProps","currentValue","forwardRef","includeInputProps","commonControlProps","getInputProps","inputValue","ref","callAllEventHandlers","bindHandlerChange","getRadioMarkProps","keyboardFocused","tag","resolveColor","other","onClick","radioMarkProps","componentDidUpdate","componentDidMount","_ref8","_ref7","Control","RadioMark","inputProps","defaultChecked","resolveColorEnhance","_ref3","arguments[0]","_ref9","SControl","displayName","_ref4","_ref0","SValue","SInvalidPattern","InvalidStateBox","_ref5","_ref1","SText","TypographyText","color","useEffect","useColorResolver","wrapRadioGroup","wrapper","_default"],"sources":["../../src/Radio.tsx"],"sourcesContent":["import { Flex, Box, InvalidStateBox } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport getInputProps, { inputProps } from '@semcore/core/lib/utils/inputProps';\nimport logger from '@semcore/core/lib/utils/logger';\nimport { useColorResolver } from '@semcore/core/lib/utils/use/useColorResolver';\nimport { Text as TypographyText } from '@semcore/typography';\nimport React from 'react';\n\nimport type {\n IntergalacticRadioGroupComponent,\n RadioProps,\n RadioComponent,\n RadioGroupProps,\n RadioValueComponent,\n RadioTextComponent,\n RadioValueRadioMarkComponent,\n RadioRootComponent,\n RadioValueControlComponent,\n} from './Radio.type';\nimport style from './style/radio.shadow.css';\n\nconst RadioContext = React.createContext<{\n onChange?: RadioGroupProps['onChange'];\n value?: RadioGroupProps['value'];\n theme?: RadioGroupProps['theme'];\n size?: RadioGroupProps['size'];\n name?: RadioGroupProps['name'];\n disabled?: RadioGroupProps['disabled'];\n}>({});\n\nclass RadioGroupRoot extends Component<Intergalactic.InternalTypings.InferComponentProps<IntergalacticRadioGroupComponent>, [], { value: null }> {\n static displayName = 'RadioGroup';\n\n static defaultProps = {\n defaultValue: null,\n };\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n setContext() {\n const { theme, size, name, value, onChange, disabled } = this.asProps;\n\n return {\n onChange,\n value,\n theme,\n size,\n name,\n disabled,\n };\n }\n\n render() {\n const { Children } = this.asProps;\n\n return (\n <Root render={Flex} direction='column' role='group' __excludeProps={['onChange']}>\n <Children />\n </Root>\n );\n }\n}\n\nconst RadioGroup = createComponent(RadioGroupRoot, {}, { context: RadioContext }) as unknown as IntergalacticRadioGroupComponent;\n\nclass RadioRoot extends Component<\n Intergalactic.InternalTypings.InferComponentProps<RadioRootComponent>\n> {\n static displayName = 'Radio';\n static style = style;\n static contextType = RadioContext;\n\n context: React.ContextType<typeof RadioContext> = {};\n\n state = {\n hoistedDisabled: undefined,\n };\n\n hoistDisabled = (disabled: RadioProps['disabled']) => {\n logger.warn(\n true,\n `Don't set disabled on Radio.Value or Radio.Text, set it on Radio or on RadioGroup (for all items) instead. Otherwise it will produce wrong SSR output.`,\n this.asProps['data-ui-name'],\n );\n this.setState({ hoistedDisabled: disabled });\n };\n\n getTextProps() {\n const {\n size = this.context.size ?? 'm',\n disabled = this.context.disabled,\n label,\n } = this.asProps;\n\n const { hoistedDisabled } = this.state;\n\n const textProps = {\n size: size === 'm' ? 200 : 300,\n children: label,\n disabled: disabled ?? hoistedDisabled,\n hoistDisabled: this.hoistDisabled,\n rootDisabled: this.props.disabled,\n };\n\n return textProps;\n }\n\n getValueProps() {\n const {\n state = 'normal',\n size = this.context.size ?? 'm',\n theme = this.context.theme,\n disabled = this.context.disabled,\n name = this.context.name,\n } = this.asProps;\n\n const { value, checked } = this.asProps;\n const { hoistedDisabled } = this.state;\n\n return {\n size: this.props.size ?? size,\n disabled: disabled ?? hoistedDisabled,\n state: state,\n theme,\n value,\n checked,\n name,\n hoistDisabled: this.hoistDisabled,\n rootDisabled: this.props.disabled,\n };\n }\n\n render() {\n const SRadio = Root;\n const { styles, Children, children: hasChildren } = this.asProps;\n\n return sstyled(styles)(\n <SRadio render={Box} tag='label' __excludeProps={['onChange', 'label', 'disabled']}>\n {hasChildren\n ? (\n <Children />\n )\n : (\n <>\n <Radio.Value />\n <Radio.Text />\n </>\n )}\n </SRadio>,\n );\n }\n}\n\nclass ValueRoot extends Component<\n Intergalactic.InternalTypings.InferChildComponentProps<RadioValueComponent, typeof RadioRoot, 'Value'>,\n typeof ValueRoot.enhance,\n { checked: (e: React.ChangeEvent<HTMLInputElement>) => boolean }\n> {\n context: React.ContextType<typeof RadioContext> = {};\n\n static defaultProps = {\n includeInputProps: inputProps,\n defaultChecked: false,\n };\n\n static enhance = [resolveColorEnhance()] as const;\n static displayName = 'Value';\n static contextType = RadioContext;\n static style = style;\n\n bindHandlerChange = (value: RadioProps['value']) => (e: React.ChangeEvent<HTMLInputElement>) => {\n if (typeof this.context.onChange === 'function' && value !== undefined) {\n this.context.onChange(value, e);\n }\n };\n\n uncontrolledProps() {\n return {\n checked: (e: React.ChangeEvent<HTMLInputElement>) => e.target.checked,\n };\n }\n\n getControlProps() {\n const { value: currentValue } = this.context;\n const { forwardRef, includeInputProps, state, value } = this.asProps;\n const { onChange } = this.props;\n\n const [commonControlProps] = getInputProps(this.asProps, includeInputProps);\n const inputValue = value ?? '';\n\n return {\n ref: forwardRef,\n state,\n ...commonControlProps,\n value: inputValue,\n ...(currentValue !== undefined\n ? {\n checked: currentValue === inputValue,\n onChange: callAllEventHandlers(onChange, this.bindHandlerChange(inputValue)),\n }\n : {}\n ),\n };\n }\n\n getRadioMarkProps() {\n const { value: currentValue } = this.context;\n const {\n size,\n state,\n theme,\n keyboardFocused,\n value,\n tag,\n disabled,\n includeInputProps,\n resolveColor,\n children,\n Children,\n ...other\n } = this.asProps;\n const { onClick } = this.props;\n const [commonControlProps, radioMarkProps] = getInputProps(other, includeInputProps);\n const inputValue = value ?? '';\n\n return {\n theme,\n size,\n state,\n keyboardFocused,\n disabled,\n resolveColor,\n checked: commonControlProps.checked,\n ...radioMarkProps,\n ...(currentValue !== undefined && tag !== 'label'\n ? {\n onClick: callAllEventHandlers(onClick, this.bindHandlerChange(inputValue)),\n }\n : {}\n\n ),\n };\n }\n\n componentDidUpdate() {\n if (this.asProps.rootDisabled !== this.asProps.disabled) {\n this.asProps.hoistDisabled(this.asProps.disabled);\n }\n }\n\n componentDidMount() {\n if (this.asProps.rootDisabled !== this.asProps.disabled) {\n this.asProps.hoistDisabled(this.asProps.disabled);\n }\n }\n\n render() {\n const { styles, children: hasChildren, Children } = this.asProps;\n\n if (!hasChildren) {\n return sstyled(styles)(\n <>\n <Radio.Value.Control />\n <Radio.Value.RadioMark />\n </>,\n );\n }\n\n return sstyled(styles)(<Children />);\n }\n}\n\nfunction Control(props: Intergalactic.InternalTypings.InferChildComponentProps<RadioValueControlComponent, typeof ValueRoot, 'Control'>) {\n const SControl = Root;\n const { styles, state } = props;\n\n return sstyled(styles)(\n <SControl render={Box} tag='input' type='radio' aria-invalid={state === 'invalid'} />,\n );\n};\nControl.displayName = 'Control';\n\nfunction RadioMark(props: Intergalactic.InternalTypings.InferChildComponentProps<RadioValueRadioMarkComponent, typeof ValueRoot, 'RadioMark'>) {\n const SValue = Root;\n const SInvalidPattern = InvalidStateBox;\n const { theme, styles, resolveColor, state, checked } = props;\n\n return sstyled(styles)(\n <SValue render={Box} tag='div' use:theme={resolveColor(theme)} aria-hidden={true}>\n {state === 'invalid' && !checked && <SInvalidPattern />}\n </SValue>,\n );\n}\nRadioMark.displayName = 'RadioMark';\n\nfunction Text(props: Intergalactic.InternalTypings.InferChildComponentProps<RadioTextComponent, typeof RadioRoot, 'Text'>) {\n const SText = Root;\n const { styles, color } = props;\n\n React.useEffect(() => {\n if (props.rootDisabled !== props.disabled) {\n props.hoistDisabled(props.disabled);\n }\n }, [props.rootDisabled, props.disabled, props.hoistDisabled]);\n const resolveColor = useColorResolver();\n\n return sstyled(styles)(\n <SText render={TypographyText} tag='span' use:color={resolveColor(color)} />,\n );\n}\nText.displayName = 'Text';\n\nconst Value = createComponent(ValueRoot, {\n Control,\n RadioMark,\n}) as RadioValueComponent;\n\nconst Radio = createComponent(RadioRoot, {\n Text,\n Value,\n}) as RadioComponent;\n\nexport const wrapRadioGroup = <PropsExtending extends {}>(wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticRadioGroupComponent>\n > &\n PropsExtending,\n) => React.ReactNode) => wrapper as IntergalacticRadioGroupComponent<PropsExtending>;\n\nexport { inputProps, RadioGroup };\n\nexport default Radio;\n"],"mappings":";;;;;;;;;;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAFA,IAAAC,eAAA,GAAAD,OAAA;AAGA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG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,IAAAlG,aAAO,EAACmD,MAAM,CAAC,eACpBrD,MAAA,CAAAqB,OAAA,CAAAC,aAAA,CAAC+E,KAAK,EAAAD,KAAA,CAAA7C,EAAA;IAAA,OAAAlE,KAAA,CAAAmC,WAAA;MAAA,OAA6B,MAAM;MAAA,aAAYoD,YAAY,CAAC2B,KAAK;IAAC,GAAAJ,KAAA;EAAA,EAAG,CAAC;AAEhF;AACAxC,IAAI,CAACkC,WAAW,GAAG,MAAM;AAEzB,MAAMnC,KAAK,GAAG,IAAA7B,qBAAe,EAAC+B,SAAS,EAAE;EACvCwB,OAAO;EACPC;AACF,CAAC,CAAwB;AAEzB,MAAM5B,KAAK,GAAG,IAAA5B,qBAAe,EAACE,SAAS,EAAE;EACvC4B,IAAI;EACJD;AACF,CAAC,CAAmB;AAEb,MAAMgD,cAAc,GAA+BC,OAKtC,IAAKA,OAA2D;AAAC/E,OAAA,CAAA8E,cAAA,GAAAA,cAAA;AAAA,IAAAE,QAAA,GAAAhF,OAAA,CAAAP,OAAA,GAItEoC,KAAK","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Radio.type.js","names":[],"sources":["../../src/Radio.type.ts"],"sourcesContent":["import type { Box, BoxProps, Flex } from '@semcore/base-components';\nimport type { PropGetterFn, Intergalactic } from '@semcore/core';\nimport type { Text, TextProps } from '@semcore/typography';\nimport type React from 'react';\n\nexport type RadioSize = 'm' | 'l';\nexport type RadioState = 'normal' | 'invalid';\nexport type RadioValue = string | number | boolean;\n\nexport type RadioProps = BoxProps & {\n /** Radio item value **/\n value?: RadioValue;\n\n /** Radio item checked flag **/\n checked?: boolean;\n\n /**\n * The value displaying the state of the component\n * @default normal\n */\n state?: RadioState;\n /**\n * Radio button size\n * @default m\n **/\n size?: RadioSize;\n /** The theme of the radio button that you can send your color to */\n theme?: string;\n /** Radio item text **/\n label?: string;\n /** Blocks access and changes to the radio item **/\n disabled?: boolean;\n};\n\nexport type RadioGroupProps<T extends RadioValue = RadioValue> = {\n /** Radio group name */\n name?: string;\n /** Active default value */\n defaultValue?: T;\n /** Active value */\n value?: T;\n /** Called when the selected element is changed */\n onChange?:\n | ((value: T, e?: React.SyntheticEvent<HTMLInputElement>) => void)\n | React.Dispatch<React.SetStateAction<T>>;\n /** Radio button size */\n size?: RadioSize;\n /** The theme of the radio button that you can send your color to */\n theme?: string;\n /** Blocks access and changes to the form field */\n disabled?: boolean;\n};\n\nexport type RadioValueProps = BoxProps & {\n /** List of elements that can be put on a hidden input */\n includeInputProps?: string[];\n};\n\nexport type RadioCtx = {\n getValueProps: PropGetterFn;\n getTextProps: PropGetterFn;\n};\n\nexport type IntergalacticRadioGroupComponent<PropsExtending = {}> = (<\n Value extends RadioValue,\n Tag extends Intergalactic.Tag = typeof Flex,\n>(\n props: Intergalactic.InternalTypings.ComponentProps<Tag, typeof Flex, RadioGroupProps<Value>> &\n PropsExtending,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\nIntergalactic.InternalTypings.ComponentAdditive<'div', typeof Flex, RadioGroupProps>;\n\nexport type RadioValueControlProps = {};\nexport type RadioValueMarkProps = {};\nexport type RadioTextProps = TextProps;\n\nexport type RadioValueControlComponent = Intergalactic.Component<'input', RadioValueControlProps>;\nexport type RadioValueRadioMarkComponent = Intergalactic.Component<typeof Box, RadioValueMarkProps>;\n\nexport type RadioValueComponent = Intergalactic.Component<'input', RadioValueProps> & {\n Control: RadioValueControlComponent;\n RadioMark: RadioValueRadioMarkComponent;\n};\n\nexport type RadioTextComponent = typeof Text;\n\nexport type RadioRootComponent = Intergalactic.Component<'label', RadioProps, RadioCtx>;\nexport type RadioComponent = RadioRootComponent & {\n Value: RadioValueComponent;\n Text: RadioTextComponent;\n};\n"],"mappings":"","ignoreList":[]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -4,22 +4,38 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
var _exportNames = {
|
|
7
|
+
var _exportNames = {
|
|
8
|
+
wrapRadioGroup: true,
|
|
9
|
+
RadioGroup: true
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "RadioGroup", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () {
|
|
14
|
+
return _Radio.RadioGroup;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
8
17
|
Object.defineProperty(exports, "default", {
|
|
9
18
|
enumerable: true,
|
|
10
19
|
get: function () {
|
|
11
20
|
return _Radio.default;
|
|
12
21
|
}
|
|
13
22
|
});
|
|
23
|
+
Object.defineProperty(exports, "wrapRadioGroup", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () {
|
|
26
|
+
return _Radio.wrapRadioGroup;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
14
29
|
var _Radio = _interopRequireWildcard(require("./Radio"));
|
|
15
|
-
|
|
30
|
+
var _Radio2 = require("./Radio.type");
|
|
31
|
+
Object.keys(_Radio2).forEach(function (key) {
|
|
16
32
|
if (key === "default" || key === "__esModule") return;
|
|
17
33
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
18
|
-
if (key in exports && exports[key] ===
|
|
34
|
+
if (key in exports && exports[key] === _Radio2[key]) return;
|
|
19
35
|
Object.defineProperty(exports, key, {
|
|
20
36
|
enumerable: true,
|
|
21
37
|
get: function () {
|
|
22
|
-
return
|
|
38
|
+
return _Radio2[key];
|
|
23
39
|
}
|
|
24
40
|
});
|
|
25
41
|
});
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Radio","_interopRequireWildcard","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get"],"sources":["../../src/index.
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Radio","_interopRequireWildcard","require","_Radio2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get"],"sources":["../../src/index.ts"],"sourcesContent":["export { default, wrapRadioGroup, RadioGroup } from './Radio';\nexport * from './Radio.type';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,OAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,OAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,OAAA,CAAAI,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -17,16 +17,6 @@ SRadio[disabled] {
|
|
|
17
17
|
pointer-events: none;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
SText[size='m'] {
|
|
21
|
-
font-size: var(--intergalactic-fs-200, 14px);
|
|
22
|
-
line-height: var(--intergalactic-lh-200, 142%);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
SText[size='l'] {
|
|
26
|
-
font-size: var(--intergalactic-fs-300, 16px);
|
|
27
|
-
line-height: var(--intergalactic-lh-300, 150%);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
20
|
SValue {
|
|
31
21
|
position: relative;
|
|
32
22
|
flex-shrink: 0;
|