@semcore/radio 16.0.0-prerelease.4 → 16.0.0-prerelease.7

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/esm/Radio.mjs CHANGED
@@ -1,270 +1,327 @@
1
- import G from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
- import F from "@babel/runtime/helpers/esm/slicedToArray";
3
- import v from "@babel/runtime/helpers/esm/objectSpread2";
4
- import R from "@babel/runtime/helpers/esm/assertThisInitialized";
5
- import V from "@babel/runtime/helpers/esm/classCallCheck";
6
- import z from "@babel/runtime/helpers/esm/createClass";
7
- import D from "@babel/runtime/helpers/esm/inherits";
8
- import T from "@babel/runtime/helpers/esm/createSuper";
9
- import d from "@babel/runtime/helpers/esm/defineProperty";
10
- import { sstyled as f, createComponent as w, CONTEXT_COMPONENT as j, assignProps as P, Component as I } from "@semcore/core";
11
- import _ from "react";
12
- import { Flex as Y, Box as E, InvalidStateBox as Z } from "@semcore/flex-box";
13
- import A, { callAllEventHandlers as H } from "@semcore/core/lib/utils/assignProps";
14
- import ee from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
15
- import O, { inputProps as te } from "@semcore/core/lib/utils/inputProps";
16
- import { inputProps as De } from "@semcore/core/lib/utils/inputProps";
17
- import { useColorResolver as re } from "@semcore/core/lib/utils/use/useColorResolver";
18
- import ae from "@semcore/core/lib/utils/logger";
19
- import { Text as oe } from "@semcore/typography";
20
- var ne = ["size", "state", "theme", "keyboardFocused", "value", "tag", "disabled", "includeInputProps", "resolveColor"], le = ["children", "Children"], B = (
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
6
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
7
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
8
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
9
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
10
+ import { sstyled, createComponent, CONTEXT_COMPONENT, assignProps, Component } from "@semcore/core";
11
+ import React from "react";
12
+ import { Flex, Box, InvalidStateBox } from "@semcore/flex-box";
13
+ import assignProps$1, { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
14
+ import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
15
+ import getInputProps, { inputProps } from "@semcore/core/lib/utils/inputProps";
16
+ import { inputProps as inputProps2 } from "@semcore/core/lib/utils/inputProps";
17
+ import { useColorResolver } from "@semcore/core/lib/utils/use/useColorResolver";
18
+ import logger from "@semcore/core/lib/utils/logger";
19
+ import { Text as Text$1 } from "@semcore/typography";
20
+ var _excluded = ["size", "state", "theme", "keyboardFocused", "value", "tag", "disabled", "includeInputProps", "resolveColor"], _excluded2 = ["children", "Children"];
21
+ var style = (
21
22
  /*__reshadow_css_start__*/
22
- (f.insert(
23
+ (sstyled.insert(
23
24
  /*__inner_css_start__*/
24
25
  '.___SRadio_lyu5n_gg_{display:inline-flex;align-items:flex-start;cursor:pointer}.___SRadio_lyu5n_gg_ .___SText_lyu5n_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);color:var(--intergalactic-text-primary, #191b23)}.___SRadio_lyu5n_gg_ .___SText_lyu5n_gg_.__color_lyu5n_gg_{color:var(--color_lyu5n)}.___SRadio_lyu5n_gg_.__disabled_lyu5n_gg_{pointer-events:none}.___SText_lyu5n_gg_._size_m_lyu5n_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SText_lyu5n_gg_._size_l_lyu5n_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}.___SValue_lyu5n_gg_{position:relative;flex-shrink:0;padding:0;outline:0;z-index:0;margin-top:var(--intergalactic-spacing-05x, 2px)}.___SValue_lyu5n_gg_::after,.___SValue_lyu5n_gg_::before{content:"";position:absolute;right:0;bottom:0;border-radius:50%;background:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SValue_lyu5n_gg_::before{top:0;left:0;border:1px solid;transition:calc(var(--intergalactic-duration-control, 200)*1ms) all ease-in-out}.___SValue_lyu5n_gg_::after{top:50%;left:50%;transform:translate(-50%,-50%);width:0;height:0}.___SValue_lyu5n_gg_.__disabled_lyu5n_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_lyu5n_gg_._size_m_lyu5n_gg_{width:16px;height:16px}.___SValue_lyu5n_gg_._size_m_lyu5n_gg_ .___SInvalidPattern_lyu5n_gg_:before{width:14px;height:14px}.___SValue_lyu5n_gg_._size_l_lyu5n_gg_{width:20px;height:20px}.___SValue_lyu5n_gg_._size_l_lyu5n_gg_ .___SInvalidPattern_lyu5n_gg_:before{width:18px;height:18px}.___SValue_lyu5n_gg_._state_normal_lyu5n_gg_::before{border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SValue_lyu5n_gg_._state_invalid_lyu5n_gg_::before{border-color:var(--intergalactic-border-critical-active, #d1002f)}.___SControl_lyu5n_gg_{position:absolute;clip:rect(1px,1px,1px,1px)}.___SControl_lyu5n_gg_:checked~.___SValue_lyu5n_gg_::before{border-color:var(--intergalactic-control-primary-info, #008ff8);background-color:var(--intergalactic-control-primary-info, #008ff8)}.___SControl_lyu5n_gg_:checked~.___SValue_lyu5n_gg_._size_m_lyu5n_gg_::after{width:6px;height:6px}.___SControl_lyu5n_gg_:checked~.___SValue_lyu5n_gg_._size_l_lyu5n_gg_::after{width:8px;height:8px}.___SControl_lyu5n_gg_:focus-visible+.___SValue_lyu5n_gg_._state_normal_lyu5n_gg_::before{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));border-color:var(--intergalactic-border-info-active, #006dca)}.___SControl_lyu5n_gg_:focus-visible+.___SValue_lyu5n_gg_._state_invalid_lyu5n_gg_::before{box-shadow:var(--intergalactic-keyboard-focus-invalid, 0px 0px 0px 3px rgba(255, 73, 83, 0.5))}.___SControl_lyu5n_gg_:checked~.___SValue_lyu5n_gg_.__theme_lyu5n_gg_::before{border-color:var(--theme_lyu5n);background-color:var(--theme_lyu5n)}.___SValue_lyu5n_gg_._state_normal_lyu5n_gg_.__theme_lyu5n_gg_::before{border-color:var(--theme_lyu5n)}.___SInvalidPattern_lyu5n_gg_{background:0 0;overflow:hidden}.___SInvalidPattern_lyu5n_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)}',
25
26
  "lyu5n_gg_"
26
27
  ), {
27
- __SRadio: "___SRadio_lyu5n_gg_",
28
- _disabled: "__disabled_lyu5n_gg_",
29
- __SText: "___SText_lyu5n_gg_",
30
- _size_m: "_size_m_lyu5n_gg_",
31
- _size_l: "_size_l_lyu5n_gg_",
32
- __SValue: "___SValue_lyu5n_gg_",
33
- _state_normal: "_state_normal_lyu5n_gg_",
34
- _state_invalid: "_state_invalid_lyu5n_gg_",
35
- __SControl: "___SControl_lyu5n_gg_",
36
- _theme: "__theme_lyu5n_gg_",
28
+ "__SRadio": "___SRadio_lyu5n_gg_",
29
+ "_disabled": "__disabled_lyu5n_gg_",
30
+ "__SText": "___SText_lyu5n_gg_",
31
+ "_size_m": "_size_m_lyu5n_gg_",
32
+ "_size_l": "_size_l_lyu5n_gg_",
33
+ "__SValue": "___SValue_lyu5n_gg_",
34
+ "_state_normal": "_state_normal_lyu5n_gg_",
35
+ "_state_invalid": "_state_invalid_lyu5n_gg_",
36
+ "__SControl": "___SControl_lyu5n_gg_",
37
+ "_theme": "__theme_lyu5n_gg_",
37
38
  "--theme": "--theme_lyu5n",
38
- _color: "__color_lyu5n_gg_",
39
+ "_color": "__color_lyu5n_gg_",
39
40
  "--color": "--color_lyu5n",
40
- __SInvalidPattern: "___SInvalidPattern_lyu5n_gg_"
41
+ "__SInvalidPattern": "___SInvalidPattern_lyu5n_gg_"
41
42
  })
42
- ), $ = /* @__PURE__ */ function(g) {
43
- D(l, g);
44
- var o = T(l);
45
- function l() {
46
- return V(this, l), o.apply(this, arguments);
43
+ );
44
+ var RadioGroupRoot = /* @__PURE__ */ function(_Component) {
45
+ _inherits(RadioGroupRoot2, _Component);
46
+ var _super = _createSuper(RadioGroupRoot2);
47
+ function RadioGroupRoot2() {
48
+ _classCallCheck(this, RadioGroupRoot2);
49
+ return _super.apply(this, arguments);
47
50
  }
48
- return z(l, [{
51
+ _createClass(RadioGroupRoot2, [{
49
52
  key: "uncontrolledProps",
50
- value: function() {
53
+ value: function uncontrolledProps() {
51
54
  return {
52
55
  value: null
53
56
  };
54
57
  }
55
58
  }, {
56
59
  key: "setContext",
57
- value: function() {
58
- var t = this.asProps, e = t.theme, a = t.size, n = t.name, i = t.value, s = t.onChange, u = t.disabled;
60
+ value: function setContext() {
61
+ var _this$asProps = this.asProps, theme = _this$asProps.theme, size = _this$asProps.size, name = _this$asProps.name, value = _this$asProps.value, onChange = _this$asProps.onChange, disabled = _this$asProps.disabled;
59
62
  return {
60
- onChange: s,
61
- value: i,
62
- theme: e,
63
- size: a,
64
- name: n,
65
- disabled: u
63
+ onChange,
64
+ value,
65
+ theme,
66
+ size,
67
+ name,
68
+ disabled
66
69
  };
67
70
  }
68
71
  }, {
69
72
  key: "render",
70
- value: function() {
71
- var t = this.asProps, e = this.asProps.Children;
72
- return /* @__PURE__ */ _.createElement(Y, P({
73
- direction: "column",
74
- role: "group",
75
- __excludeProps: ["onChange"]
76
- }, t), /* @__PURE__ */ _.createElement(e, null));
73
+ value: function render() {
74
+ var _ref = this.asProps;
75
+ var Children = this.asProps.Children;
76
+ return /* @__PURE__ */ React.createElement(Flex, assignProps({
77
+ "direction": "column",
78
+ "role": "group",
79
+ "__excludeProps": ["onChange"]
80
+ }, _ref), /* @__PURE__ */ React.createElement(Children, null));
77
81
  }
78
- }]), l;
79
- }(I);
80
- d($, "displayName", "RadioGroup");
81
- d($, "defaultProps", {
82
+ }]);
83
+ return RadioGroupRoot2;
84
+ }(Component);
85
+ _defineProperty(RadioGroupRoot, "displayName", "RadioGroup");
86
+ _defineProperty(RadioGroupRoot, "defaultProps", {
82
87
  defaultValue: null
83
88
  });
84
- var U = w($), S = /* @__PURE__ */ function(g) {
85
- D(l, g);
86
- var o = T(l);
87
- function l() {
88
- var r;
89
- V(this, l);
90
- for (var t = arguments.length, e = new Array(t), a = 0; a < t; a++)
91
- e[a] = arguments[a];
92
- return r = o.call.apply(o, [this].concat(e)), d(R(r), "state", {
89
+ var RadioGroup = createComponent(RadioGroupRoot);
90
+ var RadioRoot = /* @__PURE__ */ function(_Component2) {
91
+ _inherits(RadioRoot2, _Component2);
92
+ var _super2 = _createSuper(RadioRoot2);
93
+ function RadioRoot2() {
94
+ var _this;
95
+ _classCallCheck(this, RadioRoot2);
96
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
97
+ args[_key] = arguments[_key];
98
+ }
99
+ _this = _super2.call.apply(_super2, [this].concat(args));
100
+ _defineProperty(_assertThisInitialized(_this), "state", {
93
101
  hoistedDisabled: void 0
94
- }), d(R(r), "hoistDisabled", function(n) {
95
- ae.warn(!0, "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.", r.asProps["data-ui-name"]), r.setState({
96
- hoistedDisabled: n
102
+ });
103
+ _defineProperty(_assertThisInitialized(_this), "hoistDisabled", function(disabled) {
104
+ logger.warn(true, "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.", _this.asProps["data-ui-name"]);
105
+ _this.setState({
106
+ hoistedDisabled: disabled
97
107
  });
98
- }), r;
108
+ });
109
+ return _this;
99
110
  }
100
- return z(l, [{
111
+ _createClass(RadioRoot2, [{
101
112
  key: "getTextProps",
102
- value: function() {
103
- var t = A(this.asProps, this.context), e = t.size, a = e === void 0 ? "m" : e, n = t.disabled, i = t.label, s = this.state.hoistedDisabled, u = {
104
- size: a,
105
- children: i,
106
- disabled: n ?? s,
113
+ value: function getTextProps() {
114
+ var _assignProps6 = assignProps$1(this.asProps, this.context), _assignProps6$size = _assignProps6.size, size = _assignProps6$size === void 0 ? "m" : _assignProps6$size, disabled = _assignProps6.disabled, label = _assignProps6.label;
115
+ var hoistedDisabled = this.state.hoistedDisabled;
116
+ var textProps = {
117
+ size,
118
+ children: label,
119
+ disabled: disabled !== null && disabled !== void 0 ? disabled : hoistedDisabled,
107
120
  hoistDisabled: this.hoistDisabled,
108
121
  rootDisabled: this.props.disabled
109
122
  };
110
- return u;
123
+ return textProps;
111
124
  }
112
125
  }, {
113
126
  key: "getValueProps",
114
- value: function() {
115
- var t, e = A(this.asProps, this.context), a = e.size, n = a === void 0 ? "m" : a, i = e.state, s = i === void 0 ? "normal" : i, u = e.theme, p = e.disabled, b = e.name, c = this.asProps, h = c.value, m = c.checked, x = this.state.hoistedDisabled;
127
+ value: function getValueProps() {
128
+ var _this$props$size;
129
+ var _assignProps7 = assignProps$1(this.asProps, this.context), _assignProps7$size = _assignProps7.size, size = _assignProps7$size === void 0 ? "m" : _assignProps7$size, _assignProps7$state = _assignProps7.state, state = _assignProps7$state === void 0 ? "normal" : _assignProps7$state, theme = _assignProps7.theme, disabled = _assignProps7.disabled, name = _assignProps7.name;
130
+ var _this$asProps2 = this.asProps, value = _this$asProps2.value, checked = _this$asProps2.checked;
131
+ var hoistedDisabled = this.state.hoistedDisabled;
116
132
  return {
117
- size: (t = this.props.size) !== null && t !== void 0 ? t : n,
118
- disabled: p ?? x,
119
- state: s,
120
- theme: u,
121
- value: h,
122
- checked: m,
123
- name: b,
133
+ size: (_this$props$size = this.props.size) !== null && _this$props$size !== void 0 ? _this$props$size : size,
134
+ disabled: disabled !== null && disabled !== void 0 ? disabled : hoistedDisabled,
135
+ state,
136
+ theme,
137
+ value,
138
+ checked,
139
+ name,
124
140
  hoistDisabled: this.hoistDisabled,
125
141
  rootDisabled: this.props.disabled
126
142
  };
127
143
  }
128
144
  }, {
129
145
  key: "render",
130
- value: function() {
131
- var t = this.asProps, e, a = E, n = this.asProps, i = n.styles, s = n.Children, u = n.children;
132
- return e = f(i), /* @__PURE__ */ _.createElement(a, e.cn("SRadio", v({}, P({
133
- tag: "label",
134
- __excludeProps: ["onChange", "label", "disabled"]
135
- }, t))), u ? /* @__PURE__ */ _.createElement(s, e.cn("Children", {})) : /* @__PURE__ */ _.createElement(_.Fragment, null, /* @__PURE__ */ _.createElement(C.Value, null), /* @__PURE__ */ _.createElement(C.Text, null)));
146
+ value: function render() {
147
+ var _ref2 = this.asProps, _ref6;
148
+ var SRadio = Box;
149
+ var _this$asProps3 = this.asProps, styles = _this$asProps3.styles, Children = _this$asProps3.Children, hasChildren = _this$asProps3.children;
150
+ return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SRadio, _ref6.cn("SRadio", _objectSpread({}, assignProps({
151
+ "tag": "label",
152
+ "__excludeProps": ["onChange", "label", "disabled"]
153
+ }, _ref2))), hasChildren ? /* @__PURE__ */ React.createElement(Children, _ref6.cn("Children", {})) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Radio.Value, null), /* @__PURE__ */ React.createElement(Radio.Text, null)));
154
+ }
155
+ }]);
156
+ return RadioRoot2;
157
+ }(Component);
158
+ _defineProperty(RadioRoot, "displayName", "Radio");
159
+ _defineProperty(RadioRoot, "style", style);
160
+ _defineProperty(RadioRoot, "contextType", RadioGroup[CONTEXT_COMPONENT]);
161
+ var ValueRoot = /* @__PURE__ */ function(_Component3) {
162
+ _inherits(ValueRoot2, _Component3);
163
+ var _super3 = _createSuper(ValueRoot2);
164
+ function ValueRoot2() {
165
+ var _this2;
166
+ _classCallCheck(this, ValueRoot2);
167
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
168
+ args[_key2] = arguments[_key2];
136
169
  }
137
- }]), l;
138
- }(I);
139
- d(S, "displayName", "Radio");
140
- d(S, "style", B);
141
- d(S, "contextType", U[j]);
142
- var y = /* @__PURE__ */ function(g) {
143
- D(l, g);
144
- var o = T(l);
145
- function l() {
146
- var r;
147
- V(this, l);
148
- for (var t = arguments.length, e = new Array(t), a = 0; a < t; a++)
149
- e[a] = arguments[a];
150
- return r = o.call.apply(o, [this].concat(e)), d(R(r), "bindHandlerChange", function(n) {
151
- return function(i) {
152
- typeof r.context.onChange == "function" && r.context.onChange(n, i);
170
+ _this2 = _super3.call.apply(_super3, [this].concat(args));
171
+ _defineProperty(_assertThisInitialized(_this2), "bindHandlerChange", function(value) {
172
+ return function(e) {
173
+ if (typeof _this2.context.onChange === "function") {
174
+ _this2.context.onChange(value, e);
175
+ }
153
176
  };
154
- }), r;
177
+ });
178
+ return _this2;
155
179
  }
156
- return z(l, [{
180
+ _createClass(ValueRoot2, [{
157
181
  key: "uncontrolledProps",
158
- value: function() {
182
+ value: function uncontrolledProps() {
159
183
  return {
160
- checked: function(e) {
184
+ checked: function checked(e) {
161
185
  return e.target.checked;
162
186
  }
163
187
  };
164
188
  }
165
189
  }, {
166
190
  key: "getControlProps",
167
- value: function() {
168
- var t = this.context.value, e = this.asProps, a = e.forwardRef, n = e.includeInputProps, i = e.state, s = e.value, u = O(this.asProps, n), p = F(u, 1), b = p[0], c = s ?? "", h = v(v({
169
- ref: a,
170
- state: i
171
- }, b), {}, {
172
- value: c
191
+ value: function getControlProps() {
192
+ var currentValue = this.context.value;
193
+ var _this$asProps4 = this.asProps, forwardRef = _this$asProps4.forwardRef, includeInputProps = _this$asProps4.includeInputProps, state = _this$asProps4.state, value = _this$asProps4.value;
194
+ var _getInputProps = getInputProps(this.asProps, includeInputProps), _getInputProps2 = _slicedToArray(_getInputProps, 1), commonControlProps = _getInputProps2[0];
195
+ var inputValue = value !== null && value !== void 0 ? value : "";
196
+ var controlProps = _objectSpread(_objectSpread({
197
+ ref: forwardRef,
198
+ state
199
+ }, commonControlProps), {}, {
200
+ value: inputValue
173
201
  });
174
- if (t !== void 0) {
175
- var m = this.props, x = m.onChange;
176
- m.onClick, h.checked = t === c, h.onChange = H(x, this.bindHandlerChange(c));
202
+ if (currentValue !== void 0) {
203
+ var _this$props = this.props, onChange = _this$props.onChange;
204
+ _this$props.onClick;
205
+ controlProps.checked = currentValue === inputValue;
206
+ controlProps.onChange = callAllEventHandlers(onChange, this.bindHandlerChange(inputValue));
177
207
  }
178
- return h;
208
+ return controlProps;
179
209
  }
180
210
  }, {
181
211
  key: "getRadioMarkProps",
182
- value: function() {
183
- var t = this.context.value, e = this.asProps, a = e.size, n = e.state, i = e.theme, s = e.keyboardFocused, u = e.value, p = e.tag, b = e.disabled, c = e.includeInputProps, h = e.resolveColor, m = G(e, ne), x = O(m, c), M = F(x, 2), J = M[0], k = M[1];
184
- k.children, k.Children;
185
- var K = G(k, le), L = u ?? "", N = v({
186
- theme: i,
187
- size: a,
188
- state: n,
189
- keyboardFocused: s,
190
- disabled: b,
191
- resolveColor: h,
192
- checked: J.checked
193
- }, K);
194
- if (t !== void 0) {
195
- var Q = this.props.onClick;
196
- p !== "label" && (N.onClick = H(Q, this.bindHandlerChange(L)));
212
+ value: function getRadioMarkProps() {
213
+ var currentValue = this.context.value;
214
+ var _this$asProps5 = this.asProps, size = _this$asProps5.size, state = _this$asProps5.state, theme = _this$asProps5.theme, keyboardFocused = _this$asProps5.keyboardFocused, value = _this$asProps5.value, tag = _this$asProps5.tag, disabled = _this$asProps5.disabled, includeInputProps = _this$asProps5.includeInputProps, resolveColor = _this$asProps5.resolveColor, other = _objectWithoutProperties(_this$asProps5, _excluded);
215
+ var _getInputProps3 = getInputProps(other, includeInputProps), _getInputProps4 = _slicedToArray(_getInputProps3, 2), commonControlProps = _getInputProps4[0], radioMarkProps = _getInputProps4[1];
216
+ radioMarkProps.children;
217
+ radioMarkProps.Children;
218
+ var propsWithoutChildren = _objectWithoutProperties(radioMarkProps, _excluded2);
219
+ var inputValue = value !== null && value !== void 0 ? value : "";
220
+ var markProps = _objectSpread({
221
+ theme,
222
+ size,
223
+ state,
224
+ keyboardFocused,
225
+ disabled,
226
+ resolveColor,
227
+ checked: commonControlProps.checked
228
+ }, propsWithoutChildren);
229
+ if (currentValue !== void 0) {
230
+ var onClick = this.props.onClick;
231
+ if (tag !== "label") {
232
+ markProps.onClick = callAllEventHandlers(onClick, this.bindHandlerChange(inputValue));
233
+ }
197
234
  }
198
- return N;
235
+ return markProps;
199
236
  }
200
237
  }, {
201
238
  key: "componentDidUpdate",
202
- value: function() {
203
- this.asProps.rootDisabled !== this.asProps.disabled && this.asProps.hoistDisabled(this.asProps.disabled);
239
+ value: function componentDidUpdate() {
240
+ if (this.asProps.rootDisabled !== this.asProps.disabled) {
241
+ this.asProps.hoistDisabled(this.asProps.disabled);
242
+ }
204
243
  }
205
244
  }, {
206
245
  key: "componentDidMount",
207
- value: function() {
208
- this.asProps.rootDisabled !== this.asProps.disabled && this.asProps.hoistDisabled(this.asProps.disabled);
246
+ value: function componentDidMount() {
247
+ if (this.asProps.rootDisabled !== this.asProps.disabled) {
248
+ this.asProps.hoistDisabled(this.asProps.disabled);
249
+ }
209
250
  }
210
251
  }, {
211
252
  key: "render",
212
- value: function() {
213
- var t, e = this.asProps, a = e.styles, n = e.children, i = e.Children;
214
- return n ? (t = f(a), /* @__PURE__ */ _.createElement(i, t.cn("Children", {}))) : (f(a), /* @__PURE__ */ _.createElement(_.Fragment, null, /* @__PURE__ */ _.createElement(C.Value.Control, null), /* @__PURE__ */ _.createElement(C.Value.RadioMark, null)));
253
+ value: function render() {
254
+ var _ref8;
255
+ var _this$asProps6 = this.asProps, styles = _this$asProps6.styles, hasChildren = _this$asProps6.children, Children = _this$asProps6.Children;
256
+ if (!hasChildren) {
257
+ return sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Radio.Value.Control, null), /* @__PURE__ */ React.createElement(Radio.Value.RadioMark, null));
258
+ }
259
+ return _ref8 = sstyled(styles), /* @__PURE__ */ React.createElement(Children, _ref8.cn("Children", {}));
215
260
  }
216
- }]), l;
217
- }(I);
218
- d(y, "defaultProps", {
219
- includeInputProps: te,
220
- defaultChecked: !1
261
+ }]);
262
+ return ValueRoot2;
263
+ }(Component);
264
+ _defineProperty(ValueRoot, "defaultProps", {
265
+ includeInputProps: inputProps,
266
+ defaultChecked: false
221
267
  });
222
- d(y, "enhance", [ee()]);
223
- d(y, "displayName", "Value");
224
- d(y, "contextType", U[j]);
225
- d(y, "style", B);
226
- var W = function(o) {
227
- var l = arguments[0], r, t = E, e = o.styles, a = o.state;
228
- return r = f(e), /* @__PURE__ */ _.createElement(t, r.cn("SControl", v({}, P({
229
- tag: "input",
230
- type: "radio",
231
- "aria-invalid": a === "invalid"
232
- }, l))));
268
+ _defineProperty(ValueRoot, "enhance", [resolveColorEnhance()]);
269
+ _defineProperty(ValueRoot, "displayName", "Value");
270
+ _defineProperty(ValueRoot, "contextType", RadioGroup[CONTEXT_COMPONENT]);
271
+ _defineProperty(ValueRoot, "style", style);
272
+ var Control = function Control2(props) {
273
+ var _ref3 = arguments[0], _ref9;
274
+ var SControl = Box;
275
+ var styles = props.styles, state = props.state;
276
+ return _ref9 = sstyled(styles), /* @__PURE__ */ React.createElement(SControl, _ref9.cn("SControl", _objectSpread({}, assignProps({
277
+ "tag": "input",
278
+ "type": "radio",
279
+ "aria-invalid": state === "invalid"
280
+ }, _ref3))));
233
281
  };
234
- W.displayName = "Control";
235
- var X = function(o) {
236
- var l = arguments[0], r, t = E, e = Z, a = o.theme, n = o.styles, i = o.resolveColor, s = o.state, u = o.checked;
237
- return r = f(n), /* @__PURE__ */ _.createElement(t, r.cn("SValue", v({}, P({
238
- tag: "div",
239
- "use:theme": i(a),
240
- "aria-hidden": !0
241
- }, l))), s === "invalid" && !u && /* @__PURE__ */ _.createElement(e, r.cn("SInvalidPattern", {})));
282
+ Control.displayName = "Control";
283
+ var RadioMark = function RadioMark2(props) {
284
+ var _ref4 = arguments[0], _ref10;
285
+ var SValue = Box;
286
+ var SInvalidPattern = InvalidStateBox;
287
+ var theme = props.theme, styles = props.styles, resolveColor = props.resolveColor, state = props.state, checked = props.checked;
288
+ return _ref10 = sstyled(styles), /* @__PURE__ */ React.createElement(SValue, _ref10.cn("SValue", _objectSpread({}, assignProps({
289
+ "tag": "div",
290
+ "use:theme": resolveColor(theme),
291
+ "aria-hidden": true
292
+ }, _ref4))), state === "invalid" && !checked && /* @__PURE__ */ React.createElement(SInvalidPattern, _ref10.cn("SInvalidPattern", {})));
242
293
  };
243
- X.displayName = "RadioMark";
244
- var q = function(o) {
245
- var l = arguments[0], r, t = oe, e = o.styles, a = o.color;
246
- _.useEffect(function() {
247
- o.rootDisabled !== o.disabled && o.hoistDisabled(o.disabled);
248
- }, [o.rootDisabled, o.disabled, o.hoistDisabled]);
249
- var n = re();
250
- return r = f(e), /* @__PURE__ */ _.createElement(t, r.cn("SText", v({}, P({
251
- tag: "span",
252
- "use:color": n(a)
253
- }, l))));
294
+ RadioMark.displayName = "RadioMark";
295
+ var Text = function Text2(props) {
296
+ var _ref5 = arguments[0], _ref11;
297
+ var SText = Text$1;
298
+ var styles = props.styles, color = props.color;
299
+ React.useEffect(function() {
300
+ if (props.rootDisabled !== props.disabled) {
301
+ props.hoistDisabled(props.disabled);
302
+ }
303
+ }, [props.rootDisabled, props.disabled, props.hoistDisabled]);
304
+ var resolveColor = useColorResolver();
305
+ return _ref11 = sstyled(styles), /* @__PURE__ */ React.createElement(SText, _ref11.cn("SText", _objectSpread({}, assignProps({
306
+ "tag": "span",
307
+ "use:color": resolveColor(color)
308
+ }, _ref5))));
254
309
  };
255
- q.displayName = "Text";
256
- var ie = w(y, {
257
- Control: W,
258
- RadioMark: X
259
- }), C = w(S, {
260
- Text: q,
261
- Value: ie
262
- }), Re = function(o) {
263
- return o;
310
+ Text.displayName = "Text";
311
+ var Value = createComponent(ValueRoot, {
312
+ Control,
313
+ RadioMark
314
+ });
315
+ var Radio = createComponent(RadioRoot, {
316
+ Text,
317
+ Value
318
+ });
319
+ var wrapRadioGroup = function wrapRadioGroup2(wrapper) {
320
+ return wrapper;
264
321
  };
265
322
  export {
266
- U as RadioGroup,
267
- C as default,
268
- De as inputProps,
269
- Re as wrapRadioGroup
323
+ RadioGroup,
324
+ Radio as default,
325
+ inputProps2 as inputProps,
326
+ wrapRadioGroup
270
327
  };
package/lib/esm/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { RadioGroup as p, default as a, wrapRadioGroup as t } from "./Radio.mjs";
2
- import { inputProps as d } from "@semcore/core/lib/utils/inputProps";
1
+ import { RadioGroup, default as default2, wrapRadioGroup } from "./Radio.mjs";
2
+ import { inputProps } from "@semcore/core/lib/utils/inputProps";
3
3
  export {
4
- p as RadioGroup,
5
- a as default,
6
- d as inputProps,
7
- t as wrapRadioGroup
4
+ RadioGroup,
5
+ default2 as default,
6
+ inputProps,
7
+ wrapRadioGroup
8
8
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/radio",
3
3
  "description": "Semrush Radio Component",
4
- "version": "16.0.0-prerelease.4",
4
+ "version": "16.0.0-prerelease.7",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -14,11 +14,11 @@
14
14
  "types": "./lib/types/index.d.ts"
15
15
  },
16
16
  "dependencies": {
17
- "@semcore/flex-box": "16.0.0-prerelease.4",
18
- "@semcore/typography": "16.0.0-prerelease.4"
17
+ "@semcore/flex-box": "16.0.0-prerelease.7",
18
+ "@semcore/typography": "16.0.0-prerelease.7"
19
19
  },
20
20
  "peerDependencies": {
21
- "@semcore/base-components": "^16.0.0-prerelease.4"
21
+ "@semcore/base-components": "^16.0.0-prerelease.7"
22
22
  },
23
23
  "repository": {
24
24
  "type": "git",