@semcore/radio 16.2.0 → 16.2.1

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
@@ -6,44 +6,43 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
6
6
  import _callSuper from "@babel/runtime/helpers/esm/callSuper";
7
7
  import _inherits from "@babel/runtime/helpers/esm/inherits";
8
8
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
- import { sstyled, assignProps, Component, createComponent } from "@semcore/core";
10
- import { Flex, Box, InvalidStateBox } from "@semcore/base-components";
11
- import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
9
+ import { sstyled, createComponent, CONTEXT_COMPONENT, assignProps, Component } from "@semcore/core";
10
+ import assignProps$1, { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
12
11
  import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
13
12
  import getInputProps, { inputProps } from "@semcore/core/lib/utils/inputProps";
14
13
  import { inputProps as inputProps2 } from "@semcore/core/lib/utils/inputProps";
15
14
  import logger from "@semcore/core/lib/utils/logger";
16
15
  import { useColorResolver } from "@semcore/core/lib/utils/use/useColorResolver";
16
+ import { Flex, Box, InvalidStateBox } from "@semcore/flex-box";
17
17
  import { Text as Text$1 } from "@semcore/typography";
18
18
  import React from "react";
19
- var _excluded = ["size", "state", "theme", "keyboardFocused", "value", "tag", "disabled", "includeInputProps", "resolveColor", "children", "Children"];
19
+ var _excluded = ["size", "state", "theme", "keyboardFocused", "value", "tag", "disabled", "includeInputProps", "resolveColor"], _excluded2 = ["children", "Children"];
20
20
  /*!__reshadow-styles__:"./style/radio.shadow.css"*/
21
21
  var style = (
22
22
  /*__reshadow_css_start__*/
23
23
  (sstyled.insert(
24
24
  /*__inner_css_start__*/
25
- '.___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%))}}}',
25
+ '.___SRadio_1382i_gg_{display:inline-flex;align-items:flex-start;cursor:pointer}.___SRadio_1382i_gg_ .___SText_1382i_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899))}.___SRadio_1382i_gg_ .___SText_1382i_gg_.__color_1382i_gg_{color:var(--color_1382i)}.___SRadio_1382i_gg_.__disabled_1382i_gg_{pointer-events:none}.___SText_1382i_gg_._size_m_1382i_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SText_1382i_gg_._size_l_1382i_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}.___SValue_1382i_gg_{position:relative;flex-shrink:0;padding:0;outline:0;z-index:0;margin-top:var(--intergalactic-spacing-05x, 2px)}.___SValue_1382i_gg_::after,.___SValue_1382i_gg_::before{content:"";position:absolute;right:0;bottom:0;border-radius:50%;background:var(--intergalactic-bg-primary-neutral, rgb(255, 255, 255))}.___SValue_1382i_gg_::before{top:0;left:0;border:1px solid;transition:calc(var(--intergalactic-duration-control, 200)*1ms) all ease-in-out}.___SValue_1382i_gg_::after{top:50%;left:50%;transform:translate(-50%,-50%);width:0;height:0}.___SValue_1382i_gg_.__disabled_1382i_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_1382i_gg_._size_m_1382i_gg_{width:16px;height:16px}.___SValue_1382i_gg_._size_m_1382i_gg_ .___SInvalidPattern_1382i_gg_:before{width:14px;height:14px}.___SValue_1382i_gg_._size_l_1382i_gg_{width:20px;height:20px}.___SValue_1382i_gg_._size_l_1382i_gg_ .___SInvalidPattern_1382i_gg_:before{width:18px;height:18px}.___SValue_1382i_gg_._state_normal_1382i_gg_::before{border-color:var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@supports (color:color(display-p3 0 0 0%)){.___SValue_1382i_gg_._state_normal_1382i_gg_::before{border-color:var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___SValue_1382i_gg_._state_normal_1382i_gg_::before{border-color:var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___SValue_1382i_gg_._state_invalid_1382i_gg_::before{border-color:var(--intergalactic-border-critical-active, rgba(255, 0, 4, 0.56))}@supports (color:color(display-p3 0 0 0%)){.___SValue_1382i_gg_._state_invalid_1382i_gg_::before{border-color:var(--intergalactic-border-critical-active, rgba(255, 0, 4, 0.56))}@media (color-gamut:p3){.___SValue_1382i_gg_._state_invalid_1382i_gg_::before{border-color:var(--intergalactic-border-critical-active, color(display-p3 0.918 0.19866 0.14259 / 0.56))}}}.___SControl_1382i_gg_{position:absolute;clip:rect(1px,1px,1px,1px)}.___SControl_1382i_gg_:checked~.___SValue_1382i_gg_._size_m_1382i_gg_::after{width:6px;height:6px}.___SControl_1382i_gg_:checked~.___SValue_1382i_gg_._size_l_1382i_gg_::after{width:8px;height:8px}.___SControl_1382i_gg_:focus-visible+.___SValue_1382i_gg_._state_normal_1382i_gg_::before{border-color:var(--intergalactic-border-info-active, rgba(0, 40, 230, 0.419));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_1382i_gg_:focus-visible+.___SValue_1382i_gg_._state_normal_1382i_gg_::before{outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 32, 221, 0.469))}@media (color-gamut:p3){.___SControl_1382i_gg_:focus-visible+.___SValue_1382i_gg_._state_normal_1382i_gg_::before{outline-color:var(--intergalactic-keyboard-focus-outline, color(display-p3 0.03256 0.12227 0.83249 / 0.469))}}}.___SControl_1382i_gg_:checked:focus-visible~.___SValue_1382i_gg_::before,.___SControl_1382i_gg_:checked~.___SValue_1382i_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_1382i_gg_:focus-visible+.___SValue_1382i_gg_._state_invalid_1382i_gg_::before{border-color:var(--intergalactic-border-critical-active, rgba(255, 0, 4, 0.56));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_1382i_gg_:focus-visible+.___SValue_1382i_gg_._state_invalid_1382i_gg_::before{border-color:var(--intergalactic-border-critical-active, rgba(255, 0, 4, 0.56));outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 32, 221, 0.469))}@media (color-gamut:p3){.___SControl_1382i_gg_:focus-visible+.___SValue_1382i_gg_._state_invalid_1382i_gg_::before{border-color:var(--intergalactic-border-critical-active, color(display-p3 0.918 0.19866 0.14259 / 0.56));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_1382i_gg_:focus-visible+.___SValue_1382i_gg_._state_invalid_1382i_gg_::before{outline-color:var(--intergalactic-keyboard-focus-invalid-outline, oklch(0.628 0.257 28.9 / 0.652))}}.___SControl_1382i_gg_:checked~.___SValue_1382i_gg_.__theme_1382i_gg_::before{border-color:var(--theme_1382i);background-color:var(--theme_1382i)}.___SValue_1382i_gg_._state_normal_1382i_gg_.__theme_1382i_gg_::before{border-color:var(--theme_1382i)}.___SInvalidPattern_1382i_gg_{background:0 0;overflow:hidden}.___SInvalidPattern_1382i_gg_:before{content:"";position:absolute;top:1px;left:1px;border-radius:50%;background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, rgba(255, 0, 4, 0.56) 0, rgba(255, 0, 4, 0.56) 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_1382i_gg_:before{background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, rgba(255, 0, 4, 0.56) 0, rgba(255, 0, 4, 0.56) 1px, transparent 0, transparent 50%))}@media (color-gamut:p3){.___SInvalidPattern_1382i_gg_:before{background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, color(display-p3 0.918 0.19866 0.14259 / 0.56) 0, color(display-p3 0.918 0.19866 0.14259 / 0.56) 1px, transparent 0, transparent 50%))}}}',
26
26
  /*__inner_css_end__*/
27
- "1p42f_gg_"
27
+ "1382i_gg_"
28
28
  ), /*__reshadow_css_end__*/
29
29
  {
30
- "__SRadio": "___SRadio_1p42f_gg_",
31
- "_disabled": "__disabled_1p42f_gg_",
32
- "__SValue": "___SValue_1p42f_gg_",
33
- "_state_normal": "_state_normal_1p42f_gg_",
34
- "_state_invalid": "_state_invalid_1p42f_gg_",
35
- "__SControl": "___SControl_1p42f_gg_",
36
- "_size_m": "_size_m_1p42f_gg_",
37
- "_size_l": "_size_l_1p42f_gg_",
38
- "_theme": "__theme_1p42f_gg_",
39
- "--theme": "--theme_1p42f",
40
- "__SText": "___SText_1p42f_gg_",
41
- "_color": "__color_1p42f_gg_",
42
- "--color": "--color_1p42f",
43
- "__SInvalidPattern": "___SInvalidPattern_1p42f_gg_"
30
+ "__SRadio": "___SRadio_1382i_gg_",
31
+ "_disabled": "__disabled_1382i_gg_",
32
+ "__SText": "___SText_1382i_gg_",
33
+ "_size_m": "_size_m_1382i_gg_",
34
+ "_size_l": "_size_l_1382i_gg_",
35
+ "__SValue": "___SValue_1382i_gg_",
36
+ "_state_normal": "_state_normal_1382i_gg_",
37
+ "_state_invalid": "_state_invalid_1382i_gg_",
38
+ "__SControl": "___SControl_1382i_gg_",
39
+ "_theme": "__theme_1382i_gg_",
40
+ "--theme": "--theme_1382i",
41
+ "_color": "__color_1382i_gg_",
42
+ "--color": "--color_1382i",
43
+ "__SInvalidPattern": "___SInvalidPattern_1382i_gg_"
44
44
  })
45
45
  );
46
- var RadioContext = /* @__PURE__ */ React.createContext({});
47
46
  var RadioGroupRoot = /* @__PURE__ */ (function(_Component) {
48
47
  function RadioGroupRoot2() {
49
48
  _classCallCheck(this, RadioGroupRoot2);
@@ -87,9 +86,7 @@ _defineProperty(RadioGroupRoot, "displayName", "RadioGroup");
87
86
  _defineProperty(RadioGroupRoot, "defaultProps", {
88
87
  defaultValue: null
89
88
  });
90
- var RadioGroup = createComponent(RadioGroupRoot, {}, {
91
- context: RadioContext
92
- });
89
+ var RadioGroup = createComponent(RadioGroupRoot);
93
90
  var RadioRoot = /* @__PURE__ */ (function(_Component2) {
94
91
  function RadioRoot2() {
95
92
  var _this;
@@ -98,7 +95,6 @@ var RadioRoot = /* @__PURE__ */ (function(_Component2) {
98
95
  args[_key] = arguments[_key];
99
96
  }
100
97
  _this = _callSuper(this, RadioRoot2, [].concat(args));
101
- _defineProperty(_this, "context", {});
102
98
  _defineProperty(_this, "state", {
103
99
  hoistedDisabled: void 0
104
100
  });
@@ -114,11 +110,10 @@ var RadioRoot = /* @__PURE__ */ (function(_Component2) {
114
110
  return _createClass(RadioRoot2, [{
115
111
  key: "getTextProps",
116
112
  value: function getTextProps() {
117
- var _this$context$size;
118
- var _this$asProps2 = this.asProps, _this$asProps2$size = _this$asProps2.size, 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, _this$asProps2$disabl = _this$asProps2.disabled, disabled = _this$asProps2$disabl === void 0 ? this.context.disabled : _this$asProps2$disabl, label = _this$asProps2.label;
113
+ 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;
119
114
  var hoistedDisabled = this.state.hoistedDisabled;
120
115
  var textProps = {
121
- size: size === "m" ? 200 : 300,
116
+ size,
122
117
  children: label,
123
118
  disabled: disabled !== null && disabled !== void 0 ? disabled : hoistedDisabled,
124
119
  hoistDisabled: this.hoistDisabled,
@@ -129,9 +124,9 @@ var RadioRoot = /* @__PURE__ */ (function(_Component2) {
129
124
  }, {
130
125
  key: "getValueProps",
131
126
  value: function getValueProps() {
132
- var _this$context$size2, _this$props$size;
133
- var _this$asProps3 = this.asProps, _this$asProps3$state = _this$asProps3.state, state = _this$asProps3$state === void 0 ? "normal" : _this$asProps3$state, _this$asProps3$size = _this$asProps3.size, 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, _this$asProps3$theme = _this$asProps3.theme, theme = _this$asProps3$theme === void 0 ? this.context.theme : _this$asProps3$theme, _this$asProps3$disabl = _this$asProps3.disabled, disabled = _this$asProps3$disabl === void 0 ? this.context.disabled : _this$asProps3$disabl, _this$asProps3$name = _this$asProps3.name, name = _this$asProps3$name === void 0 ? this.context.name : _this$asProps3$name;
134
- var _this$asProps4 = this.asProps, value = _this$asProps4.value, checked = _this$asProps4.checked;
127
+ var _this$props$size;
128
+ 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;
129
+ var _this$asProps2 = this.asProps, value = _this$asProps2.value, checked = _this$asProps2.checked;
135
130
  var hoistedDisabled = this.state.hoistedDisabled;
136
131
  return {
137
132
  size: (_this$props$size = this.props.size) !== null && _this$props$size !== void 0 ? _this$props$size : size,
@@ -150,7 +145,7 @@ var RadioRoot = /* @__PURE__ */ (function(_Component2) {
150
145
  value: function render() {
151
146
  var _ref2 = this.asProps, _ref6;
152
147
  var SRadio = Box;
153
- var _this$asProps5 = this.asProps, styles = _this$asProps5.styles, Children = _this$asProps5.Children, hasChildren = _this$asProps5.children;
148
+ var _this$asProps3 = this.asProps, styles = _this$asProps3.styles, Children = _this$asProps3.Children, hasChildren = _this$asProps3.children;
154
149
  return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SRadio, _ref6.cn("SRadio", _objectSpread({}, assignProps({
155
150
  "tag": "label",
156
151
  "__excludeProps": ["onChange", "label", "disabled"]
@@ -160,7 +155,7 @@ var RadioRoot = /* @__PURE__ */ (function(_Component2) {
160
155
  })(Component);
161
156
  _defineProperty(RadioRoot, "displayName", "Radio");
162
157
  _defineProperty(RadioRoot, "style", style);
163
- _defineProperty(RadioRoot, "contextType", RadioContext);
158
+ _defineProperty(RadioRoot, "contextType", RadioGroup[CONTEXT_COMPONENT]);
164
159
  var ValueRoot = /* @__PURE__ */ (function(_Component3) {
165
160
  function ValueRoot2() {
166
161
  var _this2;
@@ -169,10 +164,9 @@ var ValueRoot = /* @__PURE__ */ (function(_Component3) {
169
164
  args[_key2] = arguments[_key2];
170
165
  }
171
166
  _this2 = _callSuper(this, ValueRoot2, [].concat(args));
172
- _defineProperty(_this2, "context", {});
173
167
  _defineProperty(_this2, "bindHandlerChange", function(value) {
174
168
  return function(e) {
175
- if (typeof _this2.context.onChange === "function" && value !== void 0) {
169
+ if (typeof _this2.context.onChange === "function") {
176
170
  _this2.context.onChange(value, e);
177
171
  }
178
172
  };
@@ -193,29 +187,33 @@ var ValueRoot = /* @__PURE__ */ (function(_Component3) {
193
187
  key: "getControlProps",
194
188
  value: function getControlProps() {
195
189
  var currentValue = this.context.value;
196
- var _this$asProps6 = this.asProps, forwardRef = _this$asProps6.forwardRef, includeInputProps = _this$asProps6.includeInputProps, state = _this$asProps6.state, value = _this$asProps6.value;
197
- var onChange = this.props.onChange;
190
+ var _this$asProps4 = this.asProps, forwardRef = _this$asProps4.forwardRef, includeInputProps = _this$asProps4.includeInputProps, state = _this$asProps4.state, value = _this$asProps4.value;
198
191
  var _getInputProps = getInputProps(this.asProps, includeInputProps), _getInputProps2 = _slicedToArray(_getInputProps, 1), commonControlProps = _getInputProps2[0];
199
192
  var inputValue = value !== null && value !== void 0 ? value : "";
200
- return _objectSpread(_objectSpread({
193
+ var controlProps = _objectSpread(_objectSpread({
201
194
  ref: forwardRef,
202
195
  state
203
196
  }, commonControlProps), {}, {
204
197
  value: inputValue
205
- }, currentValue !== void 0 ? {
206
- checked: currentValue === inputValue,
207
- onChange: callAllEventHandlers(onChange, this.bindHandlerChange(inputValue))
208
- } : {});
198
+ });
199
+ if (currentValue !== void 0) {
200
+ var onChange = this.props.onChange;
201
+ controlProps.checked = currentValue === inputValue;
202
+ controlProps.onChange = callAllEventHandlers(onChange, this.bindHandlerChange(inputValue));
203
+ }
204
+ return controlProps;
209
205
  }
210
206
  }, {
211
207
  key: "getRadioMarkProps",
212
208
  value: function getRadioMarkProps() {
213
209
  var currentValue = this.context.value;
214
- var _this$asProps7 = this.asProps, size = _this$asProps7.size, state = _this$asProps7.state, theme = _this$asProps7.theme, keyboardFocused = _this$asProps7.keyboardFocused, value = _this$asProps7.value, tag = _this$asProps7.tag, disabled = _this$asProps7.disabled, includeInputProps = _this$asProps7.includeInputProps, resolveColor = _this$asProps7.resolveColor, children = _this$asProps7.children, Children = _this$asProps7.Children, other = _objectWithoutProperties(_this$asProps7, _excluded);
215
- var onClick = this.props.onClick;
210
+ 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);
216
211
  var _getInputProps3 = getInputProps(other, includeInputProps), _getInputProps4 = _slicedToArray(_getInputProps3, 2), commonControlProps = _getInputProps4[0], radioMarkProps = _getInputProps4[1];
212
+ radioMarkProps.children;
213
+ radioMarkProps.Children;
214
+ var propsWithoutChildren = _objectWithoutProperties(radioMarkProps, _excluded2);
217
215
  var inputValue = value !== null && value !== void 0 ? value : "";
218
- return _objectSpread(_objectSpread({
216
+ var markProps = _objectSpread({
219
217
  theme,
220
218
  size,
221
219
  state,
@@ -223,9 +221,14 @@ var ValueRoot = /* @__PURE__ */ (function(_Component3) {
223
221
  disabled,
224
222
  resolveColor,
225
223
  checked: commonControlProps.checked
226
- }, radioMarkProps), currentValue !== void 0 && tag !== "label" ? {
227
- onClick: callAllEventHandlers(onClick, this.bindHandlerChange(inputValue))
228
- } : {});
224
+ }, propsWithoutChildren);
225
+ if (currentValue !== void 0) {
226
+ var onClick = this.props.onClick;
227
+ if (tag !== "label") {
228
+ markProps.onClick = callAllEventHandlers(onClick, this.bindHandlerChange(inputValue));
229
+ }
230
+ }
231
+ return markProps;
229
232
  }
230
233
  }, {
231
234
  key: "componentDidUpdate",
@@ -245,10 +248,9 @@ var ValueRoot = /* @__PURE__ */ (function(_Component3) {
245
248
  key: "render",
246
249
  value: function render() {
247
250
  var _ref8;
248
- var _this$asProps8 = this.asProps, styles = _this$asProps8.styles, hasChildren = _this$asProps8.children, Children = _this$asProps8.Children;
251
+ var _this$asProps6 = this.asProps, styles = _this$asProps6.styles, hasChildren = _this$asProps6.children, Children = _this$asProps6.Children;
249
252
  if (!hasChildren) {
250
- var _ref7;
251
- return _ref7 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Radio.Value.Control, null), /* @__PURE__ */ React.createElement(Radio.Value.RadioMark, null));
253
+ return sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Radio.Value.Control, null), /* @__PURE__ */ React.createElement(Radio.Value.RadioMark, null));
252
254
  }
253
255
  return _ref8 = sstyled(styles), /* @__PURE__ */ React.createElement(Children, _ref8.cn("Children", {}));
254
256
  }
@@ -260,7 +262,7 @@ _defineProperty(ValueRoot, "defaultProps", {
260
262
  });
261
263
  _defineProperty(ValueRoot, "enhance", [resolveColorEnhance()]);
262
264
  _defineProperty(ValueRoot, "displayName", "Value");
263
- _defineProperty(ValueRoot, "contextType", RadioContext);
265
+ _defineProperty(ValueRoot, "contextType", RadioGroup[CONTEXT_COMPONENT]);
264
266
  _defineProperty(ValueRoot, "style", style);
265
267
  function Control(props) {
266
268
  var _ref3 = arguments[0], _ref9;
package/lib/esm/index.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  import { RadioGroup, default as default2, wrapRadioGroup } from "./Radio.mjs";
2
- import "./Radio.type.mjs";
2
+ import { inputProps } from "@semcore/core/lib/utils/inputProps";
3
3
  export {
4
4
  RadioGroup,
5
5
  default2 as default,
6
+ inputProps,
6
7
  wrapRadioGroup
7
8
  };
@@ -17,6 +17,16 @@ 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
+
20
30
  SValue {
21
31
  position: relative;
22
32
  flex-shrink: 0;
@@ -86,7 +96,7 @@ SValue[state='normal']::before {
86
96
  }
87
97
 
88
98
  SValue[state='invalid']::before {
89
- border-color: var(--intergalactic-border-critical-active, oklch(0.7 0.21 23));
99
+ border-color: var(--intergalactic-border-critical-active, oklch(0.628 0.258 29 / 0.56));
90
100
  }
91
101
 
92
102
  SControl {
@@ -105,7 +115,7 @@ SControl:checked~SValue[size='l']::after {
105
115
  }
106
116
 
107
117
  SControl:focus-visible+SValue[state='normal']::before {
108
- border-color: var(--intergalactic-border-info-active, oklch(0.7 0.131 275.2));
118
+ border-color: var(--intergalactic-border-info-active, oklch(0.443 0.273 264.2 / 0.419));
109
119
  @mixin focus-outline-mixin;
110
120
  }
111
121
 
@@ -116,7 +126,7 @@ SControl:checked:focus-visible~SValue::before {
116
126
  }
117
127
 
118
128
  SControl:focus-visible+SValue[state='invalid']::before {
119
- border-color: var(--intergalactic-border-critical-active, oklch(0.7 0.21 23));
129
+ border-color: var(--intergalactic-border-critical-active, oklch(0.628 0.258 29 / 0.56));
120
130
  @mixin focus-outline-mixin;
121
131
  outline-color: var(--intergalactic-keyboard-focus-invalid-outline, oklch(0.628 0.257 28.9 / 0.652));
122
132
  }
@@ -140,7 +150,7 @@ SInvalidPattern {
140
150
  top: 1px;
141
151
  left: 1px;
142
152
  border-radius: 50%;
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%));
153
+ background-image: var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, oklch(0.628 0.258 29 / 0.56) 0, oklch(0.628 0.258 29 / 0.56) 1px, transparent 0, transparent 50%));
144
154
  background-size: 6px 6px;
145
155
  background-color: var(--intergalactic-bg-primary-neutral, oklch(1 0 0));
146
156
  }
@@ -1,2 +1,147 @@
1
- export { default, wrapRadioGroup, RadioGroup } from './Radio';
2
- export * from './Radio.type';
1
+ import type { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';
2
+ import type { Box, BoxProps, Flex } from '@semcore/flex-box';
3
+ import type { Text } from '@semcore/typography';
4
+ import type React from 'react';
5
+
6
+ export type RadioSize = 'm' | 'l';
7
+ export type RadioState = 'normal' | 'invalid';
8
+ export type RadioValue = string | number | boolean;
9
+
10
+ /** @deprecated */
11
+ export interface IRadioProps extends RadioProps, UnknownProperties {}
12
+ export type RadioProps = BoxProps & {
13
+ /** Radio item value **/
14
+ value?: RadioValue;
15
+
16
+ /** Radio item checked flag **/
17
+ checked?: boolean;
18
+
19
+ /**
20
+ * The value displaying the state of the component
21
+ * @default normal
22
+ */
23
+ state?: RadioState;
24
+ /**
25
+ * Radio button size
26
+ * @default m
27
+ **/
28
+ size?: RadioSize;
29
+ /** The theme of the radio button that you can send your color to */
30
+ theme?: string;
31
+ /** Radio item text **/
32
+ label?: string;
33
+ /** Blocks access and changes to the radio item **/
34
+ disabled?: boolean;
35
+ };
36
+
37
+ /** @deprecated */
38
+ export interface IRadioGroupProps extends RadioGroupProps, UnknownProperties {
39
+ /**
40
+ * HTML tag name for the displayed item
41
+ */
42
+ tag?: React.ElementType | string;
43
+ }
44
+ export type RadioGroupProps<T extends RadioValue = RadioValue> = {
45
+ /** Radio group name */
46
+ name?: string;
47
+ /** Active default value */
48
+ defaultValue?: T;
49
+ /** Active value */
50
+ value?: T;
51
+ /** Called when the selected element is changed */
52
+ onChange?:
53
+ | ((value: T, e?: React.SyntheticEvent<HTMLInputElement>) => void)
54
+ | React.Dispatch<React.SetStateAction<T>>;
55
+ /** Radio button size */
56
+ size?: RadioSize;
57
+ /** The theme of the radio button that you can send your color to */
58
+ theme?: string;
59
+ /** Blocks access and changes to the form field */
60
+ disabled?: boolean;
61
+ };
62
+
63
+ /** @deprecated */
64
+ export interface IRadioValueProps extends RadioValueProps, UnknownProperties {}
65
+ export type RadioValueProps = BoxProps & {
66
+ /** List of elements that can be put on a hidden input */
67
+ includeInputProps?: string[];
68
+ /**
69
+ * @deprecated set `state` on root Radio instead
70
+ * The value displaying the state of the component
71
+ * @default normal
72
+ */
73
+ state?: RadioState;
74
+ /**
75
+ * @deprecated
76
+ * The theme of the radio button that you can send your color to
77
+ */
78
+ theme?: string;
79
+ /**
80
+ * @deprecated set `size` on root RadioGroup instead
81
+ * Radio button size
82
+ */
83
+ size?: RadioSize;
84
+ /**
85
+ * @deprecated set `value` on root Radio instead
86
+ * The element value is required for RadioGroup
87
+ */
88
+ value?: RadioValue;
89
+ /**
90
+ * @deprecated set `defaultValue` on root RadioGroup instead
91
+ * Default value if `value` property is not provided
92
+ */
93
+ defaultValue?: RadioValue;
94
+ /**
95
+ * @deprecated set `onChange` on root RadioGroup instead
96
+ * Called when the value changes
97
+ */
98
+ onChange?: (value: boolean, e?: React.SyntheticEvent<HTMLInputElement>) => void;
99
+ /**
100
+ * @deprecated set `disabled` on root Radio instead
101
+ * Blocks access and changes to the form field
102
+ */
103
+ disabled?: boolean;
104
+ };
105
+
106
+ /** @deprecated */
107
+ export interface IRadioCtx extends RadioCtx, UnknownProperties {}
108
+ export type RadioCtx = {
109
+ getValueProps: PropGetterFn;
110
+ getTextProps: PropGetterFn;
111
+ };
112
+
113
+ type IntergalacticRadioGroupComponent<PropsExtending = {}> = (<
114
+ Value extends RadioValue,
115
+ Tag extends Intergalactic.Tag = typeof Flex,
116
+ >(
117
+ props: Intergalactic.InternalTypings.ComponentProps<Tag, typeof Flex, RadioGroupProps<Value>> &
118
+ PropsExtending,
119
+ ) => Intergalactic.InternalTypings.ComponentRenderingResults) &
120
+ Intergalactic.InternalTypings.ComponentAdditive<'div', typeof Flex, RadioGroupProps>;
121
+
122
+ export type RadioValueControlProps = {};
123
+ export type RadioValueMarkProps = {};
124
+
125
+ declare const RadioGroup: IntergalacticRadioGroupComponent;
126
+
127
+ export { RadioGroup };
128
+
129
+ declare const Radio: Intergalactic.Component<'label', RadioProps, RadioCtx> & {
130
+ Value: Intergalactic.Component<'input', RadioValueProps> & {
131
+ Control: Intergalactic.Component<'input', RadioValueControlProps>;
132
+ RadioMark: Intergalactic.Component<typeof Box, RadioValueMarkProps>;
133
+ };
134
+ Text: typeof Text;
135
+ };
136
+
137
+ declare const wrapRadioGroup: <PropsExtending extends {}>(
138
+ wrapper: (
139
+ props: Intergalactic.InternalTypings.UntypeRefAndTag<
140
+ Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticRadioGroupComponent>
141
+ > &
142
+ PropsExtending,
143
+ ) => React.ReactNode,
144
+ ) => IntergalacticRadioGroupComponent<PropsExtending>;
145
+ export { wrapRadioGroup };
146
+
147
+ export default Radio;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/radio",
3
3
  "description": "Semrush Radio Component",
4
- "version": "16.2.0",
4
+ "version": "16.2.1",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -14,8 +14,8 @@
14
14
  "types": "./lib/types/index.d.ts"
15
15
  },
16
16
  "dependencies": {
17
- "@semcore/flex-box": "16.1.0",
18
- "@semcore/typography": "16.4.0"
17
+ "@semcore/flex-box": "16.1.1",
18
+ "@semcore/typography": "16.4.1"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "@semcore/base-components": "^16.6.0"
@@ -26,8 +26,8 @@
26
26
  "directory": "semcore/radio"
27
27
  },
28
28
  "devDependencies": {
29
- "@semcore/testing-utils": "1.0.0",
30
- "@semcore/core": "16.6.0"
29
+ "@semcore/core": "16.6.0",
30
+ "@semcore/testing-utils": "1.0.0"
31
31
  },
32
32
  "scripts": {
33
33
  "build": "pnpm semcore-builder --source=js && pnpm vite build"
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=Radio.type.js.map
@@ -1 +0,0 @@
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":[]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Radio.type.js.map
@@ -1 +0,0 @@
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":[]}
@@ -1 +0,0 @@
1
-
@@ -1,9 +0,0 @@
1
- import type { Intergalactic } from '@semcore/core';
2
- import { inputProps } from '@semcore/core/lib/utils/inputProps';
3
- import React from 'react';
4
- import type { NSRadio } from './Radio.type';
5
- declare const RadioGroup: NSRadio.Group.Component;
6
- declare const Radio: NSRadio.Component;
7
- export declare const wrapRadioGroup: <PropsExtending extends {}>(wrapper: (props: Intergalactic.InternalTypings.UntypeRefAndTag<Intergalactic.InternalTypings.ComponentPropsNesting<NSRadio.Group.Component>> & PropsExtending) => React.ReactNode) => NSRadio.Group.Component<PropsExtending>;
8
- export { inputProps, RadioGroup };
9
- export default Radio;
@@ -1,98 +0,0 @@
1
- import type { Flex, BoxProps } from '@semcore/base-components';
2
- import type { Intergalactic, PropGetterFn } from '@semcore/core';
3
- import type { NSText } from '@semcore/typography';
4
- declare namespace NSRadio {
5
- type Size = 'm' | 'l';
6
- type State = 'normal' | 'invalid';
7
- type Value = string | number | boolean;
8
- type Props = BoxProps & {
9
- /** Radio item value **/
10
- value?: NSRadio.Value;
11
- /** Radio item checked flag **/
12
- checked?: boolean;
13
- /**
14
- * The value displaying the state of the component
15
- * @default normal
16
- */
17
- state?: NSRadio.State;
18
- /**
19
- * Radio button size
20
- * @default m
21
- **/
22
- size?: NSRadio.Size;
23
- /** The theme of the radio button that you can send your color to */
24
- theme?: string;
25
- /** Radio item text **/
26
- label?: string;
27
- /** Blocks access and changes to the radio item **/
28
- disabled?: boolean;
29
- };
30
- type Ctx = {
31
- getValueProps: PropGetterFn;
32
- getTextProps: PropGetterFn;
33
- };
34
- namespace Value {
35
- type Props = BoxProps & {
36
- /** List of elements that can be put on a hidden input */
37
- includeInputProps?: string[];
38
- };
39
- namespace Control {
40
- type Props = {};
41
- type Component = Intergalactic.Component<'input', Props>;
42
- }
43
- namespace Mark {
44
- type Props = {};
45
- type Component = Intergalactic.Component<'input', Props>;
46
- }
47
- type Component = Intergalactic.Component<'input', Props> & {
48
- Control: Control.Component;
49
- RadioMark: Mark.Component;
50
- };
51
- }
52
- namespace Text {
53
- type Props = NSText.Props;
54
- type Component = Intergalactic.Component<'span', Props>;
55
- }
56
- namespace Group {
57
- type Props<T extends NSRadio.Value = NSRadio.Value> = {
58
- /** Radio group name */
59
- name?: string;
60
- /** Active default value */
61
- defaultValue?: T;
62
- /** Active value */
63
- value?: T;
64
- /** Called when the selected element is changed */
65
- onChange?: ((value: T, e?: React.SyntheticEvent<HTMLInputElement>) => void) | React.Dispatch<React.SetStateAction<T>>;
66
- /** Radio button size */
67
- size?: NSRadio.Size;
68
- /** The theme of the radio button that you can send your color to */
69
- theme?: string;
70
- /** Blocks access and changes to the form field */
71
- disabled?: boolean;
72
- };
73
- type Component<PropsExtending = {}> = (<V extends Value, Tag extends Intergalactic.Tag = 'div'>(props: Intergalactic.InternalTypings.ComponentProps<Tag, typeof Flex, Props<V>> & PropsExtending) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', typeof Flex, Props>;
74
- }
75
- type Component = Intergalactic.Component<'label', Props, Ctx> & {
76
- Value: Value.Component;
77
- Text: Text.Component;
78
- };
79
- }
80
- /** @deprecated It will be removed in v18. */
81
- export type RadioSize = NSRadio.Size;
82
- /** @deprecated It will be removed in v18. */
83
- export type RadioState = NSRadio.State;
84
- /** @deprecated It will be removed in v18. */
85
- export type RadioValue = NSRadio.Value;
86
- /** @deprecated It will be removed in v18. */
87
- export type RadioProps = NSRadio.Props;
88
- /** @deprecated It will be removed in v18. */
89
- export type RadioGroupProps<T extends RadioValue = RadioValue> = NSRadio.Group.Props<T>;
90
- /** @deprecated It will be removed in v18. */
91
- export type RadioValueProps = NSRadio.Value.Props;
92
- /** @deprecated It will be removed in v18. */
93
- export type RadioCtx = NSRadio.Ctx;
94
- /** @deprecated It will be removed in v18. */
95
- export type RadioValueControlProps = NSRadio.Value.Control.Props;
96
- /** @deprecated It will be removed in v18. */
97
- export type RadioValueMarkProps = NSRadio.Value.Mark.Props;
98
- export type { NSRadio };