@semcore/radio 16.2.0-prerelease.1 → 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/esm/Radio.mjs CHANGED
@@ -6,43 +6,44 @@ 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 { createComponent, sstyled, CONTEXT_COMPONENT, assignProps, Component } from "@semcore/core";
10
- import assignProps$1, { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
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";
11
12
  import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
12
13
  import getInputProps, { inputProps } from "@semcore/core/lib/utils/inputProps";
13
14
  import { inputProps as inputProps2 } from "@semcore/core/lib/utils/inputProps";
14
15
  import logger from "@semcore/core/lib/utils/logger";
15
16
  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"], _excluded2 = ["children", "Children"];
19
+ var _excluded = ["size", "state", "theme", "keyboardFocused", "value", "tag", "disabled", "includeInputProps", "resolveColor", "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_kdu3z_gg_{display:inline-flex;align-items:flex-start;cursor:pointer}.___SRadio_kdu3z_gg_ .___SText_kdu3z_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899))}.___SRadio_kdu3z_gg_ .___SText_kdu3z_gg_.__color_kdu3z_gg_{color:var(--color_kdu3z)}.___SRadio_kdu3z_gg_.__disabled_kdu3z_gg_{pointer-events:none}.___SText_kdu3z_gg_._size_m_kdu3z_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SText_kdu3z_gg_._size_l_kdu3z_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}.___SValue_kdu3z_gg_{position:relative;flex-shrink:0;padding:0;outline:0;z-index:0;margin-top:var(--intergalactic-spacing-05x, 2px)}.___SValue_kdu3z_gg_::after,.___SValue_kdu3z_gg_::before{content:"";position:absolute;right:0;bottom:0;border-radius:50%;background:var(--intergalactic-bg-primary-neutral, rgb(255, 255, 255))}.___SValue_kdu3z_gg_::before{top:0;left:0;border:1px solid;transition:calc(var(--intergalactic-duration-control, 200)*1ms) all ease-in-out}.___SValue_kdu3z_gg_::after{top:50%;left:50%;transform:translate(-50%,-50%);width:0;height:0}.___SValue_kdu3z_gg_.__disabled_kdu3z_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4);cursor:default;pointer-events:none;-moz-user-select:none;user-select:none}.___SValue_kdu3z_gg_._size_m_kdu3z_gg_{width:16px;height:16px}.___SValue_kdu3z_gg_._size_m_kdu3z_gg_ .___SInvalidPattern_kdu3z_gg_:before{width:14px;height:14px}.___SValue_kdu3z_gg_._size_l_kdu3z_gg_{width:20px;height:20px}.___SValue_kdu3z_gg_._size_l_kdu3z_gg_ .___SInvalidPattern_kdu3z_gg_:before{width:18px;height:18px}.___SValue_kdu3z_gg_._state_normal_kdu3z_gg_::before{border-color:var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@supports (color:color(display-p3 0 0 0%)){.___SValue_kdu3z_gg_._state_normal_kdu3z_gg_::before{border-color:var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___SValue_kdu3z_gg_._state_normal_kdu3z_gg_::before{border-color:var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___SValue_kdu3z_gg_._state_invalid_kdu3z_gg_::before{border-color:var(--intergalactic-border-critical-active, rgba(255, 0, 4, 0.56))}@supports (color:color(display-p3 0 0 0%)){.___SValue_kdu3z_gg_._state_invalid_kdu3z_gg_::before{border-color:var(--intergalactic-border-critical-active, rgba(255, 0, 4, 0.56))}@media (color-gamut:p3){.___SValue_kdu3z_gg_._state_invalid_kdu3z_gg_::before{border-color:var(--intergalactic-border-critical-active, color(display-p3 0.918 0.19866 0.14259 / 0.56))}}}.___SControl_kdu3z_gg_{position:absolute;clip:rect(1px,1px,1px,1px)}.___SControl_kdu3z_gg_:checked~.___SValue_kdu3z_gg_._size_m_kdu3z_gg_::after{width:6px;height:6px}.___SControl_kdu3z_gg_:checked~.___SValue_kdu3z_gg_._size_l_kdu3z_gg_::after{width:8px;height:8px}.___SControl_kdu3z_gg_:focus-visible+.___SValue_kdu3z_gg_._state_normal_kdu3z_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_kdu3z_gg_:focus-visible+.___SValue_kdu3z_gg_._state_normal_kdu3z_gg_::before{outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 32, 221, 0.469))}@media (color-gamut:p3){.___SControl_kdu3z_gg_:focus-visible+.___SValue_kdu3z_gg_._state_normal_kdu3z_gg_::before{outline-color:var(--intergalactic-keyboard-focus-outline, color(display-p3 0.03256 0.12227 0.83249 / 0.469))}}}.___SControl_kdu3z_gg_:checked:focus-visible~.___SValue_kdu3z_gg_::before,.___SControl_kdu3z_gg_:checked~.___SValue_kdu3z_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_kdu3z_gg_:focus-visible+.___SValue_kdu3z_gg_._state_invalid_kdu3z_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_kdu3z_gg_:focus-visible+.___SValue_kdu3z_gg_._state_invalid_kdu3z_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_kdu3z_gg_:focus-visible+.___SValue_kdu3z_gg_._state_invalid_kdu3z_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_kdu3z_gg_:focus-visible+.___SValue_kdu3z_gg_._state_invalid_kdu3z_gg_::before{outline-color:var(--intergalactic-keyboard-focus-invalid-outline, oklch(0.628 0.257 28.9 / 0.652))}}.___SControl_kdu3z_gg_:checked~.___SValue_kdu3z_gg_.__theme_kdu3z_gg_::before{border-color:var(--theme_kdu3z);background-color:var(--theme_kdu3z)}.___SValue_kdu3z_gg_._state_normal_kdu3z_gg_.__theme_kdu3z_gg_::before{border-color:var(--theme_kdu3z)}.___SInvalidPattern_kdu3z_gg_{background:0 0;overflow:hidden}.___SInvalidPattern_kdu3z_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_kdu3z_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_kdu3z_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%))}}}',
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%))}}}',
26
26
  /*__inner_css_end__*/
27
- "kdu3z_gg_"
27
+ "1p42f_gg_"
28
28
  ), /*__reshadow_css_end__*/
29
29
  {
30
- "__SRadio": "___SRadio_kdu3z_gg_",
31
- "_disabled": "__disabled_kdu3z_gg_",
32
- "__SText": "___SText_kdu3z_gg_",
33
- "_size_m": "_size_m_kdu3z_gg_",
34
- "_size_l": "_size_l_kdu3z_gg_",
35
- "__SValue": "___SValue_kdu3z_gg_",
36
- "_state_normal": "_state_normal_kdu3z_gg_",
37
- "_state_invalid": "_state_invalid_kdu3z_gg_",
38
- "__SControl": "___SControl_kdu3z_gg_",
39
- "_theme": "__theme_kdu3z_gg_",
40
- "--theme": "--theme_kdu3z",
41
- "_color": "__color_kdu3z_gg_",
42
- "--color": "--color_kdu3z",
43
- "__SInvalidPattern": "___SInvalidPattern_kdu3z_gg_"
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_"
44
44
  })
45
45
  );
46
+ var RadioContext = /* @__PURE__ */ React.createContext({});
46
47
  var RadioGroupRoot = /* @__PURE__ */ (function(_Component) {
47
48
  function RadioGroupRoot2() {
48
49
  _classCallCheck(this, RadioGroupRoot2);
@@ -86,7 +87,9 @@ _defineProperty(RadioGroupRoot, "displayName", "RadioGroup");
86
87
  _defineProperty(RadioGroupRoot, "defaultProps", {
87
88
  defaultValue: null
88
89
  });
89
- var RadioGroup = createComponent(RadioGroupRoot);
90
+ var RadioGroup = createComponent(RadioGroupRoot, {}, {
91
+ context: RadioContext
92
+ });
90
93
  var RadioRoot = /* @__PURE__ */ (function(_Component2) {
91
94
  function RadioRoot2() {
92
95
  var _this;
@@ -95,6 +98,7 @@ var RadioRoot = /* @__PURE__ */ (function(_Component2) {
95
98
  args[_key] = arguments[_key];
96
99
  }
97
100
  _this = _callSuper(this, RadioRoot2, [].concat(args));
101
+ _defineProperty(_this, "context", {});
98
102
  _defineProperty(_this, "state", {
99
103
  hoistedDisabled: void 0
100
104
  });
@@ -110,10 +114,11 @@ var RadioRoot = /* @__PURE__ */ (function(_Component2) {
110
114
  return _createClass(RadioRoot2, [{
111
115
  key: "getTextProps",
112
116
  value: function getTextProps() {
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;
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;
114
119
  var hoistedDisabled = this.state.hoistedDisabled;
115
120
  var textProps = {
116
- size,
121
+ size: size === "m" ? 200 : 300,
117
122
  children: label,
118
123
  disabled: disabled !== null && disabled !== void 0 ? disabled : hoistedDisabled,
119
124
  hoistDisabled: this.hoistDisabled,
@@ -124,9 +129,9 @@ var RadioRoot = /* @__PURE__ */ (function(_Component2) {
124
129
  }, {
125
130
  key: "getValueProps",
126
131
  value: function getValueProps() {
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;
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;
130
135
  var hoistedDisabled = this.state.hoistedDisabled;
131
136
  return {
132
137
  size: (_this$props$size = this.props.size) !== null && _this$props$size !== void 0 ? _this$props$size : size,
@@ -145,7 +150,7 @@ var RadioRoot = /* @__PURE__ */ (function(_Component2) {
145
150
  value: function render() {
146
151
  var _ref2 = this.asProps, _ref6;
147
152
  var SRadio = Box;
148
- var _this$asProps3 = this.asProps, styles = _this$asProps3.styles, Children = _this$asProps3.Children, hasChildren = _this$asProps3.children;
153
+ var _this$asProps5 = this.asProps, styles = _this$asProps5.styles, Children = _this$asProps5.Children, hasChildren = _this$asProps5.children;
149
154
  return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SRadio, _ref6.cn("SRadio", _objectSpread({}, assignProps({
150
155
  "tag": "label",
151
156
  "__excludeProps": ["onChange", "label", "disabled"]
@@ -155,7 +160,7 @@ var RadioRoot = /* @__PURE__ */ (function(_Component2) {
155
160
  })(Component);
156
161
  _defineProperty(RadioRoot, "displayName", "Radio");
157
162
  _defineProperty(RadioRoot, "style", style);
158
- _defineProperty(RadioRoot, "contextType", RadioGroup[CONTEXT_COMPONENT]);
163
+ _defineProperty(RadioRoot, "contextType", RadioContext);
159
164
  var ValueRoot = /* @__PURE__ */ (function(_Component3) {
160
165
  function ValueRoot2() {
161
166
  var _this2;
@@ -164,9 +169,10 @@ var ValueRoot = /* @__PURE__ */ (function(_Component3) {
164
169
  args[_key2] = arguments[_key2];
165
170
  }
166
171
  _this2 = _callSuper(this, ValueRoot2, [].concat(args));
172
+ _defineProperty(_this2, "context", {});
167
173
  _defineProperty(_this2, "bindHandlerChange", function(value) {
168
174
  return function(e) {
169
- if (typeof _this2.context.onChange === "function") {
175
+ if (typeof _this2.context.onChange === "function" && value !== void 0) {
170
176
  _this2.context.onChange(value, e);
171
177
  }
172
178
  };
@@ -187,33 +193,29 @@ var ValueRoot = /* @__PURE__ */ (function(_Component3) {
187
193
  key: "getControlProps",
188
194
  value: function getControlProps() {
189
195
  var currentValue = this.context.value;
190
- var _this$asProps4 = this.asProps, forwardRef = _this$asProps4.forwardRef, includeInputProps = _this$asProps4.includeInputProps, state = _this$asProps4.state, value = _this$asProps4.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;
191
198
  var _getInputProps = getInputProps(this.asProps, includeInputProps), _getInputProps2 = _slicedToArray(_getInputProps, 1), commonControlProps = _getInputProps2[0];
192
199
  var inputValue = value !== null && value !== void 0 ? value : "";
193
- var controlProps = _objectSpread(_objectSpread({
200
+ return _objectSpread(_objectSpread({
194
201
  ref: forwardRef,
195
202
  state
196
203
  }, commonControlProps), {}, {
197
204
  value: inputValue
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;
205
+ }, currentValue !== void 0 ? {
206
+ checked: currentValue === inputValue,
207
+ onChange: callAllEventHandlers(onChange, this.bindHandlerChange(inputValue))
208
+ } : {});
205
209
  }
206
210
  }, {
207
211
  key: "getRadioMarkProps",
208
212
  value: function getRadioMarkProps() {
209
213
  var currentValue = this.context.value;
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);
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;
211
216
  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);
215
217
  var inputValue = value !== null && value !== void 0 ? value : "";
216
- var markProps = _objectSpread({
218
+ return _objectSpread(_objectSpread({
217
219
  theme,
218
220
  size,
219
221
  state,
@@ -221,14 +223,9 @@ var ValueRoot = /* @__PURE__ */ (function(_Component3) {
221
223
  disabled,
222
224
  resolveColor,
223
225
  checked: commonControlProps.checked
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;
226
+ }, radioMarkProps), currentValue !== void 0 && tag !== "label" ? {
227
+ onClick: callAllEventHandlers(onClick, this.bindHandlerChange(inputValue))
228
+ } : {});
232
229
  }
233
230
  }, {
234
231
  key: "componentDidUpdate",
@@ -248,9 +245,10 @@ var ValueRoot = /* @__PURE__ */ (function(_Component3) {
248
245
  key: "render",
249
246
  value: function render() {
250
247
  var _ref8;
251
- var _this$asProps6 = this.asProps, styles = _this$asProps6.styles, hasChildren = _this$asProps6.children, Children = _this$asProps6.Children;
248
+ var _this$asProps8 = this.asProps, styles = _this$asProps8.styles, hasChildren = _this$asProps8.children, Children = _this$asProps8.Children;
252
249
  if (!hasChildren) {
253
- return sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Radio.Value.Control, null), /* @__PURE__ */ React.createElement(Radio.Value.RadioMark, null));
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));
254
252
  }
255
253
  return _ref8 = sstyled(styles), /* @__PURE__ */ React.createElement(Children, _ref8.cn("Children", {}));
256
254
  }
@@ -262,7 +260,7 @@ _defineProperty(ValueRoot, "defaultProps", {
262
260
  });
263
261
  _defineProperty(ValueRoot, "enhance", [resolveColorEnhance()]);
264
262
  _defineProperty(ValueRoot, "displayName", "Value");
265
- _defineProperty(ValueRoot, "contextType", RadioGroup[CONTEXT_COMPONENT]);
263
+ _defineProperty(ValueRoot, "contextType", RadioContext);
266
264
  _defineProperty(ValueRoot, "style", style);
267
265
  function Control(props) {
268
266
  var _ref3 = arguments[0], _ref9;
@@ -0,0 +1 @@
1
+
package/lib/esm/index.mjs CHANGED
@@ -1,8 +1,7 @@
1
1
  import { RadioGroup, default as default2, wrapRadioGroup } from "./Radio.mjs";
2
- import { inputProps } from "@semcore/core/lib/utils/inputProps";
2
+ import "./Radio.type.mjs";
3
3
  export {
4
4
  RadioGroup,
5
5
  default2 as default,
6
- inputProps,
7
6
  wrapRadioGroup
8
7
  };
@@ -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.628 0.258 29 / 0.56));
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.443 0.273 264.2 / 0.419));
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.628 0.258 29 / 0.56));
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.628 0.258 29 / 0.56) 0, oklch(0.628 0.258 29 / 0.56) 1px, transparent 0, transparent 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%));
154
144
  background-size: 6px 6px;
155
145
  background-color: var(--intergalactic-bg-primary-neutral, oklch(1 0 0));
156
146
  }
@@ -0,0 +1,9 @@
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;
@@ -0,0 +1,98 @@
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 };
@@ -1,147 +1,2 @@
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;
1
+ export { default, wrapRadioGroup, RadioGroup } from './Radio';
2
+ export * from './Radio.type';
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-prerelease.1",
4
+ "version": "16.2.0",
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.1.0-prerelease.1",
18
- "@semcore/typography": "16.4.0-prerelease.1"
17
+ "@semcore/flex-box": "16.1.0",
18
+ "@semcore/typography": "16.4.0"
19
19
  },
20
20
  "peerDependencies": {
21
- "@semcore/base-components": "^16.6.0-prerelease.1"
21
+ "@semcore/base-components": "^16.6.0"
22
22
  },
23
23
  "repository": {
24
24
  "type": "git",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "devDependencies": {
29
29
  "@semcore/testing-utils": "1.0.0",
30
- "@semcore/core": "16.6.0-prerelease.1"
30
+ "@semcore/core": "16.6.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=index.d.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport type { Box, BoxProps, Flex } from '@semcore/flex-box';\nimport type { Text } from '@semcore/typography';\nimport type React from 'react';\n\nexport type RadioSize = 'm' | 'l';\nexport type RadioState = 'normal' | 'invalid';\nexport type RadioValue = string | number | boolean;\n\n/** @deprecated */\nexport interface IRadioProps extends RadioProps, UnknownProperties {}\nexport type RadioProps = BoxProps & {\n /** Radio item value **/\n value?: RadioValue;\n\n /** Radio item checked flag **/\n checked?: boolean;\n\n /**\n * The value displaying the state of the component\n * @default normal\n */\n state?: RadioState;\n /**\n * Radio button size\n * @default m\n **/\n size?: RadioSize;\n /** The theme of the radio button that you can send your color to */\n theme?: string;\n /** Radio item text **/\n label?: string;\n /** Blocks access and changes to the radio item **/\n disabled?: boolean;\n};\n\n/** @deprecated */\nexport interface IRadioGroupProps extends RadioGroupProps, UnknownProperties {\n /**\n * HTML tag name for the displayed item\n */\n tag?: React.ElementType | string;\n}\nexport type RadioGroupProps<T extends RadioValue = RadioValue> = {\n /** Radio group name */\n name?: string;\n /** Active default value */\n defaultValue?: T;\n /** Active value */\n value?: T;\n /** Called when the selected element is changed */\n onChange?:\n | ((value: T, e?: React.SyntheticEvent<HTMLInputElement>) => void)\n | React.Dispatch<React.SetStateAction<T>>;\n /** Radio button size */\n size?: RadioSize;\n /** The theme of the radio button that you can send your color to */\n theme?: string;\n /** Blocks access and changes to the form field */\n disabled?: boolean;\n};\n\n/** @deprecated */\nexport interface IRadioValueProps extends RadioValueProps, UnknownProperties {}\nexport type RadioValueProps = BoxProps & {\n /** List of elements that can be put on a hidden input */\n includeInputProps?: string[];\n /**\n * @deprecated set `state` on root Radio instead\n * The value displaying the state of the component\n * @default normal\n */\n state?: RadioState;\n /**\n * @deprecated\n * The theme of the radio button that you can send your color to\n */\n theme?: string;\n /**\n * @deprecated set `size` on root RadioGroup instead\n * Radio button size\n */\n size?: RadioSize;\n /**\n * @deprecated set `value` on root Radio instead\n * The element value is required for RadioGroup\n */\n value?: RadioValue;\n /**\n * @deprecated set `defaultValue` on root RadioGroup instead\n * Default value if `value` property is not provided\n */\n defaultValue?: RadioValue;\n /**\n * @deprecated set `onChange` on root RadioGroup instead\n * Called when the value changes\n */\n onChange?: (value: boolean, e?: React.SyntheticEvent<HTMLInputElement>) => void;\n /**\n * @deprecated set `disabled` on root Radio instead\n * Blocks access and changes to the form field\n */\n disabled?: boolean;\n};\n\n/** @deprecated */\nexport interface IRadioCtx extends RadioCtx, UnknownProperties {}\nexport type RadioCtx = {\n getValueProps: PropGetterFn;\n getTextProps: PropGetterFn;\n};\n\ntype IntergalacticRadioGroupComponent<PropsExtending = {}> = (<\n Value extends RadioValue,\n Tag extends Intergalactic.Tag = typeof Flex,\n>(\n props: Intergalactic.InternalTypings.ComponentProps<Tag, typeof Flex, RadioGroupProps<Value>> &\n PropsExtending,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\nIntergalactic.InternalTypings.ComponentAdditive<'div', typeof Flex, RadioGroupProps>;\n\nexport type RadioValueControlProps = {};\nexport type RadioValueMarkProps = {};\n\ndeclare const RadioGroup: IntergalacticRadioGroupComponent;\n\nexport { RadioGroup };\n\ndeclare const Radio: Intergalactic.Component<'label', RadioProps, RadioCtx> & {\n Value: Intergalactic.Component<'input', RadioValueProps> & {\n Control: Intergalactic.Component<'input', RadioValueControlProps>;\n RadioMark: Intergalactic.Component<typeof Box, RadioValueMarkProps>;\n };\n Text: typeof Text;\n};\n\ndeclare const wrapRadioGroup: <PropsExtending extends {}>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticRadioGroupComponent>\n > &\n PropsExtending,\n ) => React.ReactNode,\n) => IntergalacticRadioGroupComponent<PropsExtending>;\nexport { wrapRadioGroup };\n\nexport default Radio;\n"],"mappings":"","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.d.js.map