@semcore/radio 16.2.0-prerelease.3 → 16.2.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/lib/cjs/Radio.js +92 -93
- 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 +4 -14
- package/lib/es6/Radio.js +89 -90
- 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 +4 -14
- package/lib/esm/Radio.mjs +52 -54
- package/lib/esm/Radio.type.mjs +1 -0
- package/lib/esm/index.mjs +1 -2
- package/lib/esm/style/radio.shadow.css +4 -14
- package/lib/types/Radio.d.ts +9 -0
- package/lib/types/Radio.type.d.ts +98 -0
- package/lib/types/index.d.ts +2 -147
- package/package.json +6 -6
- 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/lib/es6/Radio.js
CHANGED
|
@@ -12,36 +12,36 @@ import { assignProps as _assignProps4 } from "@semcore/core";
|
|
|
12
12
|
import { assignProps as _assignProps3 } from "@semcore/core";
|
|
13
13
|
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
14
14
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
15
|
-
var _excluded = ["size", "state", "theme", "keyboardFocused", "value", "tag", "disabled", "includeInputProps", "resolveColor"]
|
|
16
|
-
|
|
17
|
-
import { createComponent, Component,
|
|
18
|
-
import
|
|
15
|
+
var _excluded = ["size", "state", "theme", "keyboardFocused", "value", "tag", "disabled", "includeInputProps", "resolveColor", "children", "Children"];
|
|
16
|
+
import { Flex, Box, InvalidStateBox } from '@semcore/base-components';
|
|
17
|
+
import { createComponent, Component, sstyled, Root } from '@semcore/core';
|
|
18
|
+
import { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';
|
|
19
19
|
import resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';
|
|
20
20
|
import getInputProps, { inputProps } from '@semcore/core/lib/utils/inputProps';
|
|
21
21
|
import logger from '@semcore/core/lib/utils/logger';
|
|
22
22
|
import { useColorResolver } from '@semcore/core/lib/utils/use/useColorResolver';
|
|
23
|
-
import { Flex, Box, InvalidStateBox } from '@semcore/flex-box';
|
|
24
23
|
import { Text as TypographyText } from '@semcore/typography';
|
|
25
24
|
import React from 'react';
|
|
26
25
|
/*!__reshadow-styles__:"./style/radio.shadow.css"*/
|
|
27
|
-
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".
|
|
26
|
+
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SRadio_1p42f_gg_{display:inline-flex;align-items:flex-start;cursor:pointer}.___SRadio_1p42f_gg_ .___SText_1p42f_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899))}.___SRadio_1p42f_gg_ .___SText_1p42f_gg_.__color_1p42f_gg_{color:var(--color_1p42f)}.___SRadio_1p42f_gg_.__disabled_1p42f_gg_{pointer-events:none}.___SValue_1p42f_gg_{position:relative;flex-shrink:0;padding:0;outline:0;z-index:0;margin-top:var(--intergalactic-spacing-05x, 2px)}.___SValue_1p42f_gg_::after,.___SValue_1p42f_gg_::before{content:\"\";position:absolute;right:0;bottom:0;border-radius:50%;background:var(--intergalactic-bg-primary-neutral, rgb(255, 255, 255))}.___SValue_1p42f_gg_::before{top:0;left:0;border:1px solid;transition:calc(var(--intergalactic-duration-control, 200)*1ms) all ease-in-out}.___SValue_1p42f_gg_::after{top:50%;left:50%;transform:translate(-50%,-50%);width:0;height:0}.___SValue_1p42f_gg_.__disabled_1p42f_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4);cursor:default;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SValue_1p42f_gg_._size_m_1p42f_gg_{width:16px;height:16px}.___SValue_1p42f_gg_._size_m_1p42f_gg_ .___SInvalidPattern_1p42f_gg_:before{width:14px;height:14px}.___SValue_1p42f_gg_._size_l_1p42f_gg_{width:20px;height:20px}.___SValue_1p42f_gg_._size_l_1p42f_gg_ .___SInvalidPattern_1p42f_gg_:before{width:18px;height:18px}.___SValue_1p42f_gg_._state_normal_1p42f_gg_::before{border-color:var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@supports (color:color(display-p3 0 0 0%)){.___SValue_1p42f_gg_._state_normal_1p42f_gg_::before{border-color:var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___SValue_1p42f_gg_._state_normal_1p42f_gg_::before{border-color:var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___SValue_1p42f_gg_._state_invalid_1p42f_gg_::before{border-color:var(--intergalactic-border-critical-active, rgb(255, 99, 100))}@supports (color:color(display-p3 0 0 0%)){.___SValue_1p42f_gg_._state_invalid_1p42f_gg_::before{border-color:var(--intergalactic-border-critical-active, rgb(255, 99, 100))}@media (color-gamut:p3){.___SValue_1p42f_gg_._state_invalid_1p42f_gg_::before{border-color:var(--intergalactic-border-critical-active, color(display-p3 0.95478 0.398 0.38923))}}}.___SControl_1p42f_gg_{position:absolute;clip:rect(1px,1px,1px,1px)}.___SControl_1p42f_gg_:checked~.___SValue_1p42f_gg_._size_m_1p42f_gg_::after{width:6px;height:6px}.___SControl_1p42f_gg_:checked~.___SValue_1p42f_gg_._size_l_1p42f_gg_::after{width:8px;height:8px}.___SControl_1p42f_gg_:focus-visible+.___SValue_1p42f_gg_._state_normal_1p42f_gg_::before{border-color:var(--intergalactic-border-info-active, rgb(135, 150, 239));outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 32, 221, 0.469));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}@supports (color:color(display-p3 0 0 0%)){.___SControl_1p42f_gg_:focus-visible+.___SValue_1p42f_gg_._state_normal_1p42f_gg_::before{outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 32, 221, 0.469))}@media (color-gamut:p3){.___SControl_1p42f_gg_:focus-visible+.___SValue_1p42f_gg_._state_normal_1p42f_gg_::before{outline-color:var(--intergalactic-keyboard-focus-outline, color(display-p3 0.03256 0.12227 0.83249 / 0.469))}}}.___SControl_1p42f_gg_:checked:focus-visible~.___SValue_1p42f_gg_::before,.___SControl_1p42f_gg_:checked~.___SValue_1p42f_gg_::before{border-color:var(--intergalactic-control-primary-info, rgb(26, 30, 26));background-color:var(--intergalactic-control-primary-info, rgb(26, 30, 26))}.___SControl_1p42f_gg_:focus-visible+.___SValue_1p42f_gg_._state_invalid_1p42f_gg_::before{border-color:var(--intergalactic-border-critical-active, rgb(255, 99, 100));outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 32, 221, 0.469));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}@supports (color:color(display-p3 0 0 0%)){.___SControl_1p42f_gg_:focus-visible+.___SValue_1p42f_gg_._state_invalid_1p42f_gg_::before{border-color:var(--intergalactic-border-critical-active, rgb(255, 99, 100));outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 32, 221, 0.469))}@media (color-gamut:p3){.___SControl_1p42f_gg_:focus-visible+.___SValue_1p42f_gg_._state_invalid_1p42f_gg_::before{border-color:var(--intergalactic-border-critical-active, color(display-p3 0.95478 0.398 0.38923));outline-color:var(--intergalactic-keyboard-focus-outline, color(display-p3 0.03256 0.12227 0.83249 / 0.469))}}}@supports (color:oklab(0%0 0%)){.___SControl_1p42f_gg_:focus-visible+.___SValue_1p42f_gg_._state_invalid_1p42f_gg_::before{outline-color:var(--intergalactic-keyboard-focus-invalid-outline, oklch(0.628 0.257 28.9 / 0.652))}}.___SControl_1p42f_gg_:checked~.___SValue_1p42f_gg_.__theme_1p42f_gg_::before{border-color:var(--theme_1p42f);background-color:var(--theme_1p42f)}.___SValue_1p42f_gg_._state_normal_1p42f_gg_.__theme_1p42f_gg_::before{border-color:var(--theme_1p42f)}.___SInvalidPattern_1p42f_gg_{background:0 0;overflow:hidden}.___SInvalidPattern_1p42f_gg_:before{content:\"\";position:absolute;top:1px;left:1px;border-radius:50%;background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, rgb(255, 99, 100) 0, rgb(255, 99, 100) 1px, transparent 0, transparent 50%));background-size:6px 6px;background-color:var(--intergalactic-bg-primary-neutral, rgb(255, 255, 255))}@supports (color:color(display-p3 0 0 0%)){.___SInvalidPattern_1p42f_gg_:before{background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, rgb(255, 99, 100) 0, rgb(255, 99, 100) 1px, transparent 0, transparent 50%))}@media (color-gamut:p3){.___SInvalidPattern_1p42f_gg_:before{background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, color(display-p3 0.95478 0.398 0.38923) 0, color(display-p3 0.95478 0.398 0.38923) 1px, transparent 0, transparent 50%))}}}", /*__inner_css_end__*/"1p42f_gg_"),
|
|
28
27
|
/*__reshadow_css_end__*/
|
|
29
28
|
{
|
|
30
|
-
"__SRadio": "
|
|
31
|
-
"_disabled": "
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"_color": "
|
|
42
|
-
"--color": "--
|
|
43
|
-
"__SInvalidPattern": "
|
|
29
|
+
"__SRadio": "___SRadio_1p42f_gg_",
|
|
30
|
+
"_disabled": "__disabled_1p42f_gg_",
|
|
31
|
+
"__SValue": "___SValue_1p42f_gg_",
|
|
32
|
+
"_state_normal": "_state_normal_1p42f_gg_",
|
|
33
|
+
"_state_invalid": "_state_invalid_1p42f_gg_",
|
|
34
|
+
"__SControl": "___SControl_1p42f_gg_",
|
|
35
|
+
"_size_m": "_size_m_1p42f_gg_",
|
|
36
|
+
"_size_l": "_size_l_1p42f_gg_",
|
|
37
|
+
"_theme": "__theme_1p42f_gg_",
|
|
38
|
+
"--theme": "--theme_1p42f",
|
|
39
|
+
"__SText": "___SText_1p42f_gg_",
|
|
40
|
+
"_color": "__color_1p42f_gg_",
|
|
41
|
+
"--color": "--color_1p42f",
|
|
42
|
+
"__SInvalidPattern": "___SInvalidPattern_1p42f_gg_"
|
|
44
43
|
});
|
|
44
|
+
var RadioContext = /*#__PURE__*/React.createContext({});
|
|
45
45
|
var RadioGroupRoot = /*#__PURE__*/function (_Component) {
|
|
46
46
|
function RadioGroupRoot() {
|
|
47
47
|
_classCallCheck(this, RadioGroupRoot);
|
|
@@ -91,7 +91,9 @@ _defineProperty(RadioGroupRoot, "displayName", 'RadioGroup');
|
|
|
91
91
|
_defineProperty(RadioGroupRoot, "defaultProps", {
|
|
92
92
|
defaultValue: null
|
|
93
93
|
});
|
|
94
|
-
var RadioGroup = createComponent(RadioGroupRoot
|
|
94
|
+
var RadioGroup = createComponent(RadioGroupRoot, {}, {
|
|
95
|
+
context: RadioContext
|
|
96
|
+
});
|
|
95
97
|
var RadioRoot = /*#__PURE__*/function (_Component2) {
|
|
96
98
|
function RadioRoot() {
|
|
97
99
|
var _this;
|
|
@@ -100,6 +102,7 @@ var RadioRoot = /*#__PURE__*/function (_Component2) {
|
|
|
100
102
|
args[_key] = arguments[_key];
|
|
101
103
|
}
|
|
102
104
|
_this = _callSuper(this, RadioRoot, [].concat(args));
|
|
105
|
+
_defineProperty(_this, "context", {});
|
|
103
106
|
_defineProperty(_this, "state", {
|
|
104
107
|
hoistedDisabled: undefined
|
|
105
108
|
});
|
|
@@ -115,15 +118,16 @@ var RadioRoot = /*#__PURE__*/function (_Component2) {
|
|
|
115
118
|
return _createClass(RadioRoot, [{
|
|
116
119
|
key: "getTextProps",
|
|
117
120
|
value: function getTextProps() {
|
|
118
|
-
|
|
119
|
-
var
|
|
120
|
-
|
|
121
|
-
size =
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
var _this$context$size;
|
|
122
|
+
var _this$asProps2 = this.asProps,
|
|
123
|
+
_this$asProps2$size = _this$asProps2.size,
|
|
124
|
+
size = _this$asProps2$size === void 0 ? (_this$context$size = this.context.size) !== null && _this$context$size !== void 0 ? _this$context$size : 'm' : _this$asProps2$size,
|
|
125
|
+
_this$asProps2$disabl = _this$asProps2.disabled,
|
|
126
|
+
disabled = _this$asProps2$disabl === void 0 ? this.context.disabled : _this$asProps2$disabl,
|
|
127
|
+
label = _this$asProps2.label;
|
|
124
128
|
var hoistedDisabled = this.state.hoistedDisabled;
|
|
125
129
|
var textProps = {
|
|
126
|
-
size: size,
|
|
130
|
+
size: size === 'm' ? 200 : 300,
|
|
127
131
|
children: label,
|
|
128
132
|
disabled: disabled !== null && disabled !== void 0 ? disabled : hoistedDisabled,
|
|
129
133
|
hoistDisabled: this.hoistDisabled,
|
|
@@ -134,19 +138,21 @@ var RadioRoot = /*#__PURE__*/function (_Component2) {
|
|
|
134
138
|
}, {
|
|
135
139
|
key: "getValueProps",
|
|
136
140
|
value: function getValueProps() {
|
|
137
|
-
var _this$props$size;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
size =
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
theme =
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
141
|
+
var _this$context$size2, _this$props$size;
|
|
142
|
+
var _this$asProps3 = this.asProps,
|
|
143
|
+
_this$asProps3$state = _this$asProps3.state,
|
|
144
|
+
state = _this$asProps3$state === void 0 ? 'normal' : _this$asProps3$state,
|
|
145
|
+
_this$asProps3$size = _this$asProps3.size,
|
|
146
|
+
size = _this$asProps3$size === void 0 ? (_this$context$size2 = this.context.size) !== null && _this$context$size2 !== void 0 ? _this$context$size2 : 'm' : _this$asProps3$size,
|
|
147
|
+
_this$asProps3$theme = _this$asProps3.theme,
|
|
148
|
+
theme = _this$asProps3$theme === void 0 ? this.context.theme : _this$asProps3$theme,
|
|
149
|
+
_this$asProps3$disabl = _this$asProps3.disabled,
|
|
150
|
+
disabled = _this$asProps3$disabl === void 0 ? this.context.disabled : _this$asProps3$disabl,
|
|
151
|
+
_this$asProps3$name = _this$asProps3.name,
|
|
152
|
+
name = _this$asProps3$name === void 0 ? this.context.name : _this$asProps3$name;
|
|
153
|
+
var _this$asProps4 = this.asProps,
|
|
154
|
+
value = _this$asProps4.value,
|
|
155
|
+
checked = _this$asProps4.checked;
|
|
150
156
|
var hoistedDisabled = this.state.hoistedDisabled;
|
|
151
157
|
return {
|
|
152
158
|
size: (_this$props$size = this.props.size) !== null && _this$props$size !== void 0 ? _this$props$size : size,
|
|
@@ -166,10 +172,10 @@ var RadioRoot = /*#__PURE__*/function (_Component2) {
|
|
|
166
172
|
var _ref2 = this.asProps,
|
|
167
173
|
_ref6;
|
|
168
174
|
var SRadio = Box;
|
|
169
|
-
var _this$
|
|
170
|
-
styles = _this$
|
|
171
|
-
Children = _this$
|
|
172
|
-
hasChildren = _this$
|
|
175
|
+
var _this$asProps5 = this.asProps,
|
|
176
|
+
styles = _this$asProps5.styles,
|
|
177
|
+
Children = _this$asProps5.Children,
|
|
178
|
+
hasChildren = _this$asProps5.children;
|
|
173
179
|
return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SRadio, _ref6.cn("SRadio", _objectSpread({}, _assignProps2({
|
|
174
180
|
"tag": 'label',
|
|
175
181
|
"__excludeProps": ['onChange', 'label', 'disabled']
|
|
@@ -179,7 +185,7 @@ var RadioRoot = /*#__PURE__*/function (_Component2) {
|
|
|
179
185
|
}(Component);
|
|
180
186
|
_defineProperty(RadioRoot, "displayName", 'Radio');
|
|
181
187
|
_defineProperty(RadioRoot, "style", style);
|
|
182
|
-
_defineProperty(RadioRoot, "contextType",
|
|
188
|
+
_defineProperty(RadioRoot, "contextType", RadioContext);
|
|
183
189
|
var ValueRoot = /*#__PURE__*/function (_Component3) {
|
|
184
190
|
function ValueRoot() {
|
|
185
191
|
var _this2;
|
|
@@ -188,9 +194,10 @@ var ValueRoot = /*#__PURE__*/function (_Component3) {
|
|
|
188
194
|
args[_key2] = arguments[_key2];
|
|
189
195
|
}
|
|
190
196
|
_this2 = _callSuper(this, ValueRoot, [].concat(args));
|
|
197
|
+
_defineProperty(_this2, "context", {});
|
|
191
198
|
_defineProperty(_this2, "bindHandlerChange", function (value) {
|
|
192
199
|
return function (e) {
|
|
193
|
-
if (typeof _this2.context.onChange === 'function') {
|
|
200
|
+
if (typeof _this2.context.onChange === 'function' && value !== undefined) {
|
|
194
201
|
_this2.context.onChange(value, e);
|
|
195
202
|
}
|
|
196
203
|
};
|
|
@@ -211,52 +218,50 @@ var ValueRoot = /*#__PURE__*/function (_Component3) {
|
|
|
211
218
|
key: "getControlProps",
|
|
212
219
|
value: function getControlProps() {
|
|
213
220
|
var currentValue = this.context.value;
|
|
214
|
-
var _this$
|
|
215
|
-
forwardRef = _this$
|
|
216
|
-
includeInputProps = _this$
|
|
217
|
-
state = _this$
|
|
218
|
-
value = _this$
|
|
221
|
+
var _this$asProps6 = this.asProps,
|
|
222
|
+
forwardRef = _this$asProps6.forwardRef,
|
|
223
|
+
includeInputProps = _this$asProps6.includeInputProps,
|
|
224
|
+
state = _this$asProps6.state,
|
|
225
|
+
value = _this$asProps6.value;
|
|
226
|
+
var onChange = this.props.onChange;
|
|
219
227
|
var _getInputProps = getInputProps(this.asProps, includeInputProps),
|
|
220
228
|
_getInputProps2 = _slicedToArray(_getInputProps, 1),
|
|
221
229
|
commonControlProps = _getInputProps2[0];
|
|
222
230
|
var inputValue = value !== null && value !== void 0 ? value : '';
|
|
223
|
-
|
|
231
|
+
return _objectSpread(_objectSpread({
|
|
224
232
|
ref: forwardRef,
|
|
225
233
|
state: state
|
|
226
234
|
}, commonControlProps), {}, {
|
|
227
235
|
value: inputValue
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
controlProps.onChange = callAllEventHandlers(onChange, this.bindHandlerChange(inputValue));
|
|
233
|
-
}
|
|
234
|
-
return controlProps;
|
|
236
|
+
}, currentValue !== undefined ? {
|
|
237
|
+
checked: currentValue === inputValue,
|
|
238
|
+
onChange: callAllEventHandlers(onChange, this.bindHandlerChange(inputValue))
|
|
239
|
+
} : {});
|
|
235
240
|
}
|
|
236
241
|
}, {
|
|
237
242
|
key: "getRadioMarkProps",
|
|
238
243
|
value: function getRadioMarkProps() {
|
|
239
244
|
var currentValue = this.context.value;
|
|
240
|
-
var _this$
|
|
241
|
-
size = _this$
|
|
242
|
-
state = _this$
|
|
243
|
-
theme = _this$
|
|
244
|
-
keyboardFocused = _this$
|
|
245
|
-
value = _this$
|
|
246
|
-
tag = _this$
|
|
247
|
-
disabled = _this$
|
|
248
|
-
includeInputProps = _this$
|
|
249
|
-
resolveColor = _this$
|
|
250
|
-
|
|
245
|
+
var _this$asProps7 = this.asProps,
|
|
246
|
+
size = _this$asProps7.size,
|
|
247
|
+
state = _this$asProps7.state,
|
|
248
|
+
theme = _this$asProps7.theme,
|
|
249
|
+
keyboardFocused = _this$asProps7.keyboardFocused,
|
|
250
|
+
value = _this$asProps7.value,
|
|
251
|
+
tag = _this$asProps7.tag,
|
|
252
|
+
disabled = _this$asProps7.disabled,
|
|
253
|
+
includeInputProps = _this$asProps7.includeInputProps,
|
|
254
|
+
resolveColor = _this$asProps7.resolveColor,
|
|
255
|
+
children = _this$asProps7.children,
|
|
256
|
+
Children = _this$asProps7.Children,
|
|
257
|
+
other = _objectWithoutProperties(_this$asProps7, _excluded);
|
|
258
|
+
var onClick = this.props.onClick;
|
|
251
259
|
var _getInputProps3 = getInputProps(other, includeInputProps),
|
|
252
260
|
_getInputProps4 = _slicedToArray(_getInputProps3, 2),
|
|
253
261
|
commonControlProps = _getInputProps4[0],
|
|
254
262
|
radioMarkProps = _getInputProps4[1];
|
|
255
|
-
var _children = radioMarkProps.children,
|
|
256
|
-
_Children = radioMarkProps.Children,
|
|
257
|
-
propsWithoutChildren = _objectWithoutProperties(radioMarkProps, _excluded2);
|
|
258
263
|
var inputValue = value !== null && value !== void 0 ? value : '';
|
|
259
|
-
|
|
264
|
+
return _objectSpread(_objectSpread({
|
|
260
265
|
theme: theme,
|
|
261
266
|
size: size,
|
|
262
267
|
state: state,
|
|
@@ -264,14 +269,9 @@ var ValueRoot = /*#__PURE__*/function (_Component3) {
|
|
|
264
269
|
disabled: disabled,
|
|
265
270
|
resolveColor: resolveColor,
|
|
266
271
|
checked: commonControlProps.checked
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
if (tag !== 'label') {
|
|
271
|
-
markProps.onClick = callAllEventHandlers(onClick, this.bindHandlerChange(inputValue));
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
return markProps;
|
|
272
|
+
}, radioMarkProps), currentValue !== undefined && tag !== 'label' ? {
|
|
273
|
+
onClick: callAllEventHandlers(onClick, this.bindHandlerChange(inputValue))
|
|
274
|
+
} : {});
|
|
275
275
|
}
|
|
276
276
|
}, {
|
|
277
277
|
key: "componentDidUpdate",
|
|
@@ -291,10 +291,10 @@ var ValueRoot = /*#__PURE__*/function (_Component3) {
|
|
|
291
291
|
key: "render",
|
|
292
292
|
value: function render() {
|
|
293
293
|
var _ref8;
|
|
294
|
-
var _this$
|
|
295
|
-
styles = _this$
|
|
296
|
-
hasChildren = _this$
|
|
297
|
-
Children = _this$
|
|
294
|
+
var _this$asProps8 = this.asProps,
|
|
295
|
+
styles = _this$asProps8.styles,
|
|
296
|
+
hasChildren = _this$asProps8.children,
|
|
297
|
+
Children = _this$asProps8.Children;
|
|
298
298
|
if (!hasChildren) {
|
|
299
299
|
var _ref7;
|
|
300
300
|
return _ref7 = sstyled(styles), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Radio.Value.Control, null), /*#__PURE__*/React.createElement(Radio.Value.RadioMark, null));
|
|
@@ -309,7 +309,7 @@ _defineProperty(ValueRoot, "defaultProps", {
|
|
|
309
309
|
});
|
|
310
310
|
_defineProperty(ValueRoot, "enhance", [resolveColorEnhance()]);
|
|
311
311
|
_defineProperty(ValueRoot, "displayName", 'Value');
|
|
312
|
-
_defineProperty(ValueRoot, "contextType",
|
|
312
|
+
_defineProperty(ValueRoot, "contextType", RadioContext);
|
|
313
313
|
_defineProperty(ValueRoot, "style", style);
|
|
314
314
|
function Control(props) {
|
|
315
315
|
var _ref3 = arguments[0],
|
|
@@ -323,7 +323,6 @@ function Control(props) {
|
|
|
323
323
|
"aria-invalid": state === 'invalid'
|
|
324
324
|
}, _ref3))));
|
|
325
325
|
}
|
|
326
|
-
;
|
|
327
326
|
Control.displayName = 'Control';
|
|
328
327
|
function RadioMark(props) {
|
|
329
328
|
var _ref4 = arguments[0],
|
|
@@ -360,7 +359,6 @@ function Text(props) {
|
|
|
360
359
|
}, _ref5))));
|
|
361
360
|
}
|
|
362
361
|
Text.displayName = 'Text';
|
|
363
|
-
export { inputProps, RadioGroup };
|
|
364
362
|
var Value = createComponent(ValueRoot, {
|
|
365
363
|
Control: Control,
|
|
366
364
|
RadioMark: RadioMark
|
|
@@ -372,5 +370,6 @@ var Radio = createComponent(RadioRoot, {
|
|
|
372
370
|
export var wrapRadioGroup = function wrapRadioGroup(wrapper) {
|
|
373
371
|
return wrapper;
|
|
374
372
|
};
|
|
373
|
+
export { inputProps, RadioGroup };
|
|
375
374
|
export default Radio;
|
|
376
375
|
//# sourceMappingURL=Radio.js.map
|
package/lib/es6/Radio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","names":["createComponent","Component","CONTEXT_COMPONENT","sstyled","Root","assignProps","callAllEventHandlers","resolveColorEnhance","getInputProps","inputProps","logger","useColorResolver","Flex","Box","InvalidStateBox","Text","TypographyText","React","style","_sstyled","insert","RadioGroupRoot","_Component","_classCallCheck","_callSuper","arguments","_inherits","_createClass","key","value","uncontrolledProps","setContext","_this$asProps","asProps","theme","size","name","onChange","disabled","render","_ref","Children","createElement","_assignProps","_defineProperty","defaultValue","RadioGroup","RadioRoot","_Component2","_this","_len","length","args","Array","_key","concat","hoistedDisabled","undefined","warn","setState","getTextProps","_assignProps6","context","_assignProps6$size","label","state","textProps","children","hoistDisabled","rootDisabled","props","getValueProps","_this$props$size","_assignProps7","_assignProps7$size","_assignProps7$state","_this$asProps2","checked","_ref2","_ref6","SRadio","_this$asProps3","styles","hasChildren","cn","_objectSpread","_assignProps2","Fragment","Radio","Value","ValueRoot","_Component3","_this2","_len2","_key2","e","target","getControlProps","currentValue","_this$asProps4","forwardRef","includeInputProps","_getInputProps","_getInputProps2","_slicedToArray","commonControlProps","inputValue","controlProps","ref","bindHandlerChange","getRadioMarkProps","_this$asProps5","keyboardFocused","tag","resolveColor","other","_objectWithoutProperties","_excluded","_getInputProps3","_getInputProps4","radioMarkProps","_children","_Children","propsWithoutChildren","_excluded2","markProps","onClick","componentDidUpdate","componentDidMount","_ref8","_this$asProps6","_ref7","Control","RadioMark","defaultChecked","_ref3","arguments[0]","_ref9","SControl","_assignProps3","displayName","_ref4","_ref0","SValue","SInvalidPattern","_assignProps4","_ref5","_ref1","SText","color","useEffect","_assignProps5","wrapRadioGroup","wrapper"],"sources":["../../src/Radio.jsx"],"sourcesContent":["import { 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 { Flex, Box, InvalidStateBox } from '@semcore/flex-box';\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":";;;;;;;;;;;;;;;;AAAA,SAASA,eAAe,EAAEC,SAAS,EAAEC,iBAAiB,EAAEC,OAAO,E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Q,CAAC;IACrC;EACF,CAAC,EAAE,CAACgC,KAAK,CAACD,YAAY,EAAEC,KAAK,CAAChC,QAAQ,EAAEgC,KAAK,CAACF,aAAa,CAAC,CAAC;EAC7D,IAAM8C,YAAY,GAAGvG,gBAAgB,CAAC,CAAC;EAEvC,OAAAwI,KAAA,GAAOhJ,OAAO,CAAC+E,MAAM,CAAC,eACpBjE,KAAA,CAAAyB,aAAA,CAAC0G,KAAK,EAAAD,KAAA,CAAA/D,EAAA,UAAAC,aAAA,KAAAkE,aAAA;IAAA,OAA6B,MAAM;IAAA,aAAYrC,YAAY,CAACmC,KAAK;EAAC,GAAAH,KAAA,GAAG,CAAC;AAEhF;AACAnI,IAAI,CAAC6H,WAAW,GAAG,MAAM;AAEzB,SAASnI,UAAU,EAAEqC,UAAU;AAE/B,IAAM2C,KAAK,GAAGzF,eAAe,CAAC0F,SAAS,EAAE;EACvC0C,OAAO,EAAPA,OAAO;EACPC,SAAS,EAATA;AACF,CAAC,CAAC;AAEF,IAAM7C,KAAK,GAAGxF,eAAe,CAAC+C,SAAS,EAAE;EACvChC,IAAI,EAAJA,IAAI;EACJ0E,KAAK,EAALA;AACF,CAAC,CAAC;AAEF,OAAO,IAAM+D,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,OAAO;EAAA,OAAKA,OAAO;AAAA;AAElD,eAAejE,KAAK","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Radio.js","names":["Flex","Box","InvalidStateBox","createComponent","Component","sstyled","Root","callAllEventHandlers","resolveColorEnhance","getInputProps","inputProps","logger","useColorResolver","Text","TypographyText","React","style","_sstyled","insert","RadioContext","createContext","RadioGroupRoot","_Component","_classCallCheck","_callSuper","arguments","_inherits","_createClass","key","value","uncontrolledProps","setContext","_this$asProps","asProps","theme","size","name","onChange","disabled","render","_ref","Children","createElement","_assignProps","_defineProperty","defaultValue","RadioGroup","context","RadioRoot","_Component2","_this","_len","length","args","Array","_key","concat","hoistedDisabled","undefined","warn","setState","getTextProps","_this$context$size","_this$asProps2","_this$asProps2$size","_this$asProps2$disabl","label","state","textProps","children","hoistDisabled","rootDisabled","props","getValueProps","_this$context$size2","_this$props$size","_this$asProps3","_this$asProps3$state","_this$asProps3$size","_this$asProps3$theme","_this$asProps3$disabl","_this$asProps3$name","_this$asProps4","checked","_ref2","_ref6","SRadio","_this$asProps5","styles","hasChildren","cn","_objectSpread","_assignProps2","Fragment","Radio","Value","ValueRoot","_Component3","_this2","_len2","_key2","e","target","getControlProps","currentValue","_this$asProps6","forwardRef","includeInputProps","_getInputProps","_getInputProps2","_slicedToArray","commonControlProps","inputValue","ref","bindHandlerChange","getRadioMarkProps","_this$asProps7","keyboardFocused","tag","resolveColor","other","_objectWithoutProperties","_excluded","onClick","_getInputProps3","_getInputProps4","radioMarkProps","componentDidUpdate","componentDidMount","_ref8","_this$asProps8","_ref7","Control","RadioMark","defaultChecked","_ref3","arguments[0]","_ref9","SControl","_assignProps3","displayName","_ref4","_ref0","SValue","SInvalidPattern","_assignProps4","_ref5","_ref1","SText","color","useEffect","_assignProps5","wrapRadioGroup","wrapper"],"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 { NSRadio } from './Radio.type';\nimport style from './style/radio.shadow.css';\n\nconst RadioContext = React.createContext<{\n onChange?: NSRadio.Group.Props['onChange'];\n value?: NSRadio.Group.Props['value'];\n theme?: NSRadio.Group.Props['theme'];\n size?: NSRadio.Group.Props['size'];\n name?: NSRadio.Group.Props['name'];\n disabled?: NSRadio.Group.Props['disabled'];\n}>({});\n\nclass RadioGroupRoot extends Component<\n Intergalactic.InternalTypings.InferComponentProps<NSRadio.Group.Component>,\n [],\n { value: null }\n> {\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 NSRadio.Group.Component;\n\nclass RadioRoot extends Component<Intergalactic.InternalTypings.InferComponentProps<NSRadio.Component>> {\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: NSRadio.Props['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 { size = this.context.size ?? 'm', disabled = this.context.disabled, label } = 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<NSRadio.Value.Component, 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: NSRadio.Props['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 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 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(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSRadio.Value.Control.Component,\n typeof ValueRoot,\n 'Control'\n >,\n) {\n const SControl = Root;\n const { styles, state } = props;\n\n return sstyled(styles)(<SControl render={Box} tag='input' type='radio' aria-invalid={state === 'invalid'} />);\n}\nControl.displayName = 'Control';\n\nfunction RadioMark(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSRadio.Value.Mark.Component,\n typeof ValueRoot,\n 'RadioMark'\n >,\n) {\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(\n props: Intergalactic.InternalTypings.InferChildComponentProps<NSRadio.Text.Component, typeof RadioRoot, 'Text'>,\n) {\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)(<SText render={TypographyText} tag='span' use:color={resolveColor(color)} />);\n}\nText.displayName = 'Text';\n\nconst Value = createComponent(ValueRoot, {\n Control,\n RadioMark,\n}) as NSRadio.Value.Component;\n\nconst Radio = createComponent(RadioRoot, {\n Text,\n Value,\n}) as NSRadio.Component;\n\nexport const wrapRadioGroup = <PropsExtending extends {}>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<NSRadio.Group.Component>\n > &\n PropsExtending,\n ) => React.ReactNode,\n) => wrapper as NSRadio.Group.Component<PropsExtending>;\n\nexport { inputProps, RadioGroup };\n\nexport default Radio;\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAASA,IAAI,EAAEC,GAAG,EAAEC,eAAe,QAAQ,0BAA0B;AAErE,SAASC,eAAe,EAAEC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AACzE,SAASC,oBAAoB,QAAQ,qCAAqC;AAC1E,OAAOC,mBAAmB,MAAM,sDAAsD;AACtF,OAAOC,aAAa,IAAIC,UAAU,QAAQ,oCAAoC;AAC9E,OAAOC,MAAM,MAAM,gCAAgC;AACnD,SAASC,gBAAgB,QAAQ,8CAA8C;AAC/E,SAASC,IAAI,IAAIC,cAAc,QAAQ,qBAAqB;AAC5D,OAAOC,KAAK,MAAM,OAAO;AAAC;AAAA,IAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAK1B,IAAMC,YAAY,gBAAGJ,KAAK,CAACK,aAAa,CAOrC,CAAC,CAAC,CAAC;AAAC,IAEDC,cAAc,0BAAAC,UAAA;EAAA,SAAAD,e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,CAAC,CAAC;EAEvC,OAAAuI,KAAA,GAAO9I,OAAO,CAACmF,MAAM,CAAC,eAACzE,KAAA,CAAA2B,aAAA,CAAC0G,KAAK,EAAAD,KAAA,CAAAzD,EAAA,UAAAC,aAAA,KAAA4D,aAAA;IAAA,OAA6B,MAAM;IAAA,aAAYhC,YAAY,CAAC8B,KAAK;EAAC,GAAAH,KAAA,GAAG,CAAC;AACrG;AACArI,IAAI,CAAC+H,WAAW,GAAG,MAAM;AAEzB,IAAM7C,KAAK,GAAG5F,eAAe,CAAC6F,SAAS,EAAE;EACvCoC,OAAO,EAAPA,OAAO;EACPC,SAAS,EAATA;AACF,CAAC,CAA4B;AAE7B,IAAMvC,KAAK,GAAG3F,eAAe,CAAC6C,SAAS,EAAE;EACvCnC,IAAI,EAAJA,IAAI;EACJkF,KAAK,EAALA;AACF,CAAC,CAAsB;AAEvB,OAAO,IAAMyD,cAAc,GAAG,SAAjBA,cAAcA,CACzBC,OAKoB;EAAA,OACjBA,OAAO;AAAA,CAA2C;AAEvD,SAAS/I,UAAU,EAAEoC,UAAU;AAE/B,eAAegD,KAAK","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Radio.type.js","names":[],"sources":["../../src/Radio.type.ts"],"sourcesContent":["import type { Flex, BoxProps } from '@semcore/base-components';\nimport type { Intergalactic, PropGetterFn } from '@semcore/core';\nimport type { NSText } from '@semcore/typography';\n\ndeclare namespace NSRadio {\n type Size = 'm' | 'l';\n type State = 'normal' | 'invalid';\n type Value = string | number | boolean;\n type Props = BoxProps & {\n /** Radio item value **/\n value?: NSRadio.Value;\n /** Radio item checked flag **/\n checked?: boolean;\n /**\n * The value displaying the state of the component\n * @default normal\n */\n state?: NSRadio.State;\n /**\n * Radio button size\n * @default m\n **/\n size?: NSRadio.Size;\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 type Ctx = {\n getValueProps: PropGetterFn;\n getTextProps: PropGetterFn;\n };\n namespace Value {\n type Props = BoxProps & {\n /** List of elements that can be put on a hidden input */\n includeInputProps?: string[];\n };\n namespace Control {\n type Props = {};\n type Component = Intergalactic.Component<'input', Props>;\n }\n\n namespace Mark {\n type Props = {};\n type Component = Intergalactic.Component<'input', Props>;\n }\n\n type Component = Intergalactic.Component<'input', Props> & {\n Control: Control.Component;\n RadioMark: Mark.Component;\n };\n }\n\n namespace Text {\n type Props = NSText.Props;\n type Component = Intergalactic.Component<'span', Props>;\n }\n\n namespace Group {\n type Props<T extends NSRadio.Value = NSRadio.Value> = {\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?: NSRadio.Size;\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 type Component<PropsExtending = {}> = (<V extends Value, Tag extends Intergalactic.Tag = 'div'>(\n props: Intergalactic.InternalTypings.ComponentProps<Tag, typeof Flex, Props<V>> & PropsExtending,\n ) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<'div', typeof Flex, Props>;\n }\n type Component = Intergalactic.Component<'label', Props, Ctx> & {\n Value: Value.Component;\n Text: Text.Component;\n };\n}\n\n/** @deprecated It will be removed in v18. */\nexport type RadioSize = NSRadio.Size;\n/** @deprecated It will be removed in v18. */\nexport type RadioState = NSRadio.State;\n/** @deprecated It will be removed in v18. */\nexport type RadioValue = NSRadio.Value;\n/** @deprecated It will be removed in v18. */\nexport type RadioProps = NSRadio.Props;\n/** @deprecated It will be removed in v18. */\nexport type RadioGroupProps<T extends RadioValue = RadioValue> = NSRadio.Group.Props<T>;\n/** @deprecated It will be removed in v18. */\nexport type RadioValueProps = NSRadio.Value.Props;\n/** @deprecated It will be removed in v18. */\nexport type RadioCtx = NSRadio.Ctx;\n/** @deprecated It will be removed in v18. */\nexport type RadioValueControlProps = NSRadio.Value.Control.Props;\n/** @deprecated It will be removed in v18. */\nexport type RadioValueMarkProps = NSRadio.Value.Mark.Props;\n\nexport type { NSRadio };\n"],"mappings":"","ignoreList":[]}
|
package/lib/es6/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default } from './Radio';
|
|
2
|
-
export * from './Radio';
|
|
1
|
+
export { default, wrapRadioGroup, RadioGroup } from './Radio';
|
|
2
|
+
export * from './Radio.type';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/index.
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","wrapRadioGroup","RadioGroup"],"sources":["../../src/index.ts"],"sourcesContent":["export { default, wrapRadioGroup, RadioGroup } from './Radio';\nexport * from './Radio.type';\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,cAAc,EAAEC,UAAU,QAAQ,SAAS;AAC7D,cAAc,cAAc","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;
|
|
@@ -96,7 +86,7 @@ SValue[state='normal']::before {
|
|
|
96
86
|
}
|
|
97
87
|
|
|
98
88
|
SValue[state='invalid']::before {
|
|
99
|
-
border-color: var(--intergalactic-border-critical-active, oklch(0.
|
|
89
|
+
border-color: var(--intergalactic-border-critical-active, oklch(0.7 0.21 23));
|
|
100
90
|
}
|
|
101
91
|
|
|
102
92
|
SControl {
|
|
@@ -115,7 +105,7 @@ SControl:checked~SValue[size='l']::after {
|
|
|
115
105
|
}
|
|
116
106
|
|
|
117
107
|
SControl:focus-visible+SValue[state='normal']::before {
|
|
118
|
-
border-color: var(--intergalactic-border-info-active, oklch(0.
|
|
108
|
+
border-color: var(--intergalactic-border-info-active, oklch(0.7 0.131 275.2));
|
|
119
109
|
@mixin focus-outline-mixin;
|
|
120
110
|
}
|
|
121
111
|
|
|
@@ -126,7 +116,7 @@ SControl:checked:focus-visible~SValue::before {
|
|
|
126
116
|
}
|
|
127
117
|
|
|
128
118
|
SControl:focus-visible+SValue[state='invalid']::before {
|
|
129
|
-
border-color: var(--intergalactic-border-critical-active, oklch(0.
|
|
119
|
+
border-color: var(--intergalactic-border-critical-active, oklch(0.7 0.21 23));
|
|
130
120
|
@mixin focus-outline-mixin;
|
|
131
121
|
outline-color: var(--intergalactic-keyboard-focus-invalid-outline, oklch(0.628 0.257 28.9 / 0.652));
|
|
132
122
|
}
|
|
@@ -150,7 +140,7 @@ SInvalidPattern {
|
|
|
150
140
|
top: 1px;
|
|
151
141
|
left: 1px;
|
|
152
142
|
border-radius: 50%;
|
|
153
|
-
background-image: var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, oklch(0.
|
|
143
|
+
background-image: var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, oklch(0.7 0.21 23) 0, oklch(0.7 0.21 23) 1px, transparent 0, transparent 50%));
|
|
154
144
|
background-size: 6px 6px;
|
|
155
145
|
background-color: var(--intergalactic-bg-primary-neutral, oklch(1 0 0));
|
|
156
146
|
}
|