@semcore/radio 17.0.0-prerelease.31 → 17.0.0-prerelease.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es6/Radio.js CHANGED
@@ -6,8 +6,8 @@ import { assignProps as _assignProps3 } from "@semcore/core";
6
6
  import { assignProps as _assignProps2 } from "@semcore/core";
7
7
  import { assignProps as _assignProps } from "@semcore/core";
8
8
  import { Flex, Box, InvalidStateBox } from '@semcore/base-components';
9
- import { createComponent, Component, CONTEXT_COMPONENT, sstyled, Root } from '@semcore/core';
10
- import assignProps, { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';
9
+ import { createComponent, Component, sstyled, Root } from '@semcore/core';
10
+ import { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';
11
11
  import resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';
12
12
  import getInputProps, { inputProps } from '@semcore/core/lib/utils/inputProps';
13
13
  import logger from '@semcore/core/lib/utils/logger';
@@ -15,24 +15,25 @@ import { useColorResolver } from '@semcore/core/lib/utils/use/useColorResolver';
15
15
  import { Text as TypographyText } from '@semcore/typography';
16
16
  import React from 'react';
17
17
  /*!__reshadow-styles__:"./style/radio.shadow.css"*/
18
- const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SRadio_1qr3e_gg_{display:inline-flex;align-items:flex-start;cursor:pointer}.___SRadio_1qr3e_gg_ .___SText_1qr3e_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);color:var(--intergalactic-text-primary, #191b23)}.___SRadio_1qr3e_gg_ .___SText_1qr3e_gg_.__color_1qr3e_gg_{color:var(--color_1qr3e)}.___SRadio_1qr3e_gg_.__disabled_1qr3e_gg_{pointer-events:none}.___SText_1qr3e_gg_._size_m_1qr3e_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SText_1qr3e_gg_._size_l_1qr3e_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}.___SValue_1qr3e_gg_{position:relative;flex-shrink:0;padding:0;outline:0;z-index:0;margin-top:var(--intergalactic-spacing-05x, 2px)}.___SValue_1qr3e_gg_::after,.___SValue_1qr3e_gg_::before{content:\"\";position:absolute;right:0;bottom:0;border-radius:50%;background:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SValue_1qr3e_gg_::before{top:0;left:0;border:1px solid;transition:calc(var(--intergalactic-duration-control, 200)*1ms) all ease-in-out}.___SValue_1qr3e_gg_::after{top:50%;left:50%;transform:translate(-50%,-50%);width:0;height:0}.___SValue_1qr3e_gg_.__disabled_1qr3e_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SValue_1qr3e_gg_._size_m_1qr3e_gg_{width:16px;height:16px}.___SValue_1qr3e_gg_._size_m_1qr3e_gg_ .___SInvalidPattern_1qr3e_gg_:before{width:14px;height:14px}.___SValue_1qr3e_gg_._size_l_1qr3e_gg_{width:20px;height:20px}.___SValue_1qr3e_gg_._size_l_1qr3e_gg_ .___SInvalidPattern_1qr3e_gg_:before{width:18px;height:18px}.___SValue_1qr3e_gg_._state_normal_1qr3e_gg_::before{border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SValue_1qr3e_gg_._state_invalid_1qr3e_gg_::before{border-color:var(--intergalactic-border-critical-active, #d1002f)}.___SControl_1qr3e_gg_{position:absolute;clip:rect(1px,1px,1px,1px)}.___SControl_1qr3e_gg_:checked~.___SValue_1qr3e_gg_._size_m_1qr3e_gg_::after{width:6px;height:6px}.___SControl_1qr3e_gg_:checked~.___SValue_1qr3e_gg_._size_l_1qr3e_gg_::after{width:8px;height:8px}.___SControl_1qr3e_gg_:focus-visible+.___SValue_1qr3e_gg_._state_normal_1qr3e_gg_::before{border-color:var(--intergalactic-border-info-active, #006dca);outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset}.___SControl_1qr3e_gg_:checked:focus-visible~.___SValue_1qr3e_gg_::before,.___SControl_1qr3e_gg_:checked~.___SValue_1qr3e_gg_::before{border-color:var(--intergalactic-control-primary-info, #008ff8);background-color:var(--intergalactic-control-primary-info, #008ff8)}.___SControl_1qr3e_gg_:focus-visible+.___SValue_1qr3e_gg_._state_invalid_1qr3e_gg_::before{border-color:var(--intergalactic-border-critical-active, #d1002f);outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset;outline-color:var(--intergalactic-keyboard-focus-invalid-outline, #ff4953)}.___SControl_1qr3e_gg_:checked~.___SValue_1qr3e_gg_.__theme_1qr3e_gg_::before{border-color:var(--theme_1qr3e);background-color:var(--theme_1qr3e)}.___SValue_1qr3e_gg_._state_normal_1qr3e_gg_.__theme_1qr3e_gg_::before{border-color:var(--theme_1qr3e)}.___SInvalidPattern_1qr3e_gg_{background:0 0;overflow:hidden}.___SInvalidPattern_1qr3e_gg_:before{content:\"\";position:absolute;top:1px;left:1px;border-radius:50%;background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, rgba(209, 0, 47, 1) 0, rgba(209, 0, 47, 1) 2px, transparent 0, transparent 50%));background-size:6px 6px;background-color:var(--intergalactic-bg-primary-neutral, #ffffff)}", /*__inner_css_end__*/"1qr3e_gg_"),
18
+ const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SRadio_1ifzo_gg_{display:inline-flex;align-items:flex-start;cursor:pointer}.___SRadio_1ifzo_gg_ .___SText_1ifzo_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);color:var(--intergalactic-text-primary, #191b23)}.___SRadio_1ifzo_gg_ .___SText_1ifzo_gg_.__color_1ifzo_gg_{color:var(--color_1ifzo)}.___SRadio_1ifzo_gg_.__disabled_1ifzo_gg_{pointer-events:none}.___SValue_1ifzo_gg_{position:relative;flex-shrink:0;padding:0;outline:0;z-index:0;margin-top:var(--intergalactic-spacing-05x, 2px)}.___SValue_1ifzo_gg_::after,.___SValue_1ifzo_gg_::before{content:\"\";position:absolute;right:0;bottom:0;border-radius:50%;background:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SValue_1ifzo_gg_::before{top:0;left:0;border:1px solid;transition:calc(var(--intergalactic-duration-control, 200)*1ms) all ease-in-out}.___SValue_1ifzo_gg_::after{top:50%;left:50%;transform:translate(-50%,-50%);width:0;height:0}.___SValue_1ifzo_gg_.__disabled_1ifzo_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SValue_1ifzo_gg_._size_m_1ifzo_gg_{width:16px;height:16px}.___SValue_1ifzo_gg_._size_m_1ifzo_gg_ .___SInvalidPattern_1ifzo_gg_:before{width:14px;height:14px}.___SValue_1ifzo_gg_._size_l_1ifzo_gg_{width:20px;height:20px}.___SValue_1ifzo_gg_._size_l_1ifzo_gg_ .___SInvalidPattern_1ifzo_gg_:before{width:18px;height:18px}.___SValue_1ifzo_gg_._state_normal_1ifzo_gg_::before{border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SValue_1ifzo_gg_._state_invalid_1ifzo_gg_::before{border-color:var(--intergalactic-border-critical-active, #d1002f)}.___SControl_1ifzo_gg_{position:absolute;clip:rect(1px,1px,1px,1px)}.___SControl_1ifzo_gg_:checked~.___SValue_1ifzo_gg_._size_m_1ifzo_gg_::after{width:6px;height:6px}.___SControl_1ifzo_gg_:checked~.___SValue_1ifzo_gg_._size_l_1ifzo_gg_::after{width:8px;height:8px}.___SControl_1ifzo_gg_:focus-visible+.___SValue_1ifzo_gg_._state_normal_1ifzo_gg_::before{border-color:var(--intergalactic-border-info-active, #006dca);outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset}.___SControl_1ifzo_gg_:checked:focus-visible~.___SValue_1ifzo_gg_::before,.___SControl_1ifzo_gg_:checked~.___SValue_1ifzo_gg_::before{border-color:var(--intergalactic-control-primary-info, #008ff8);background-color:var(--intergalactic-control-primary-info, #008ff8)}.___SControl_1ifzo_gg_:focus-visible+.___SValue_1ifzo_gg_._state_invalid_1ifzo_gg_::before{border-color:var(--intergalactic-border-critical-active, #d1002f);outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset;outline-color:var(--intergalactic-keyboard-focus-invalid-outline, #ff4953)}.___SControl_1ifzo_gg_:checked~.___SValue_1ifzo_gg_.__theme_1ifzo_gg_::before{border-color:var(--theme_1ifzo);background-color:var(--theme_1ifzo)}.___SValue_1ifzo_gg_._state_normal_1ifzo_gg_.__theme_1ifzo_gg_::before{border-color:var(--theme_1ifzo)}.___SInvalidPattern_1ifzo_gg_{background:0 0;overflow:hidden}.___SInvalidPattern_1ifzo_gg_:before{content:\"\";position:absolute;top:1px;left:1px;border-radius:50%;background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, rgba(209, 0, 47, 1) 0, rgba(209, 0, 47, 1) 2px, transparent 0, transparent 50%));background-size:6px 6px;background-color:var(--intergalactic-bg-primary-neutral, #ffffff)}", /*__inner_css_end__*/"1ifzo_gg_"),
19
19
  /*__reshadow_css_end__*/
20
20
  {
21
- "__SRadio": "___SRadio_1qr3e_gg_",
22
- "_disabled": "__disabled_1qr3e_gg_",
23
- "__SText": "___SText_1qr3e_gg_",
24
- "_size_m": "_size_m_1qr3e_gg_",
25
- "_size_l": "_size_l_1qr3e_gg_",
26
- "__SValue": "___SValue_1qr3e_gg_",
27
- "_state_normal": "_state_normal_1qr3e_gg_",
28
- "_state_invalid": "_state_invalid_1qr3e_gg_",
29
- "__SControl": "___SControl_1qr3e_gg_",
30
- "_theme": "__theme_1qr3e_gg_",
31
- "--theme": "--theme_1qr3e",
32
- "_color": "__color_1qr3e_gg_",
33
- "--color": "--color_1qr3e",
34
- "__SInvalidPattern": "___SInvalidPattern_1qr3e_gg_"
21
+ "__SRadio": "___SRadio_1ifzo_gg_",
22
+ "_disabled": "__disabled_1ifzo_gg_",
23
+ "__SValue": "___SValue_1ifzo_gg_",
24
+ "_state_normal": "_state_normal_1ifzo_gg_",
25
+ "_state_invalid": "_state_invalid_1ifzo_gg_",
26
+ "__SControl": "___SControl_1ifzo_gg_",
27
+ "_size_m": "_size_m_1ifzo_gg_",
28
+ "_size_l": "_size_l_1ifzo_gg_",
29
+ "_theme": "__theme_1ifzo_gg_",
30
+ "--theme": "--theme_1ifzo",
31
+ "__SText": "___SText_1ifzo_gg_",
32
+ "_color": "__color_1ifzo_gg_",
33
+ "--color": "--color_1ifzo",
34
+ "__SInvalidPattern": "___SInvalidPattern_1ifzo_gg_"
35
35
  });
36
+ const RadioContext = /*#__PURE__*/React.createContext({});
36
37
  class RadioGroupRoot extends Component {
37
38
  uncontrolledProps() {
38
39
  return {
@@ -73,10 +74,13 @@ _defineProperty(RadioGroupRoot, "displayName", 'RadioGroup');
73
74
  _defineProperty(RadioGroupRoot, "defaultProps", {
74
75
  defaultValue: null
75
76
  });
76
- const RadioGroup = createComponent(RadioGroupRoot);
77
+ const RadioGroup = createComponent(RadioGroupRoot, {}, {
78
+ context: RadioContext
79
+ });
77
80
  class RadioRoot extends Component {
78
81
  constructor(...args) {
79
82
  super(...args);
83
+ _defineProperty(this, "context", {});
80
84
  _defineProperty(this, "state", {
81
85
  hoistedDisabled: undefined
82
86
  });
@@ -88,17 +92,16 @@ class RadioRoot extends Component {
88
92
  });
89
93
  }
90
94
  getTextProps() {
91
- // The default values are here, since you cannot rewrite out of context
92
95
  const {
93
- size = 'm',
94
- disabled,
96
+ size = this.context.size ?? 'm',
97
+ disabled = this.context.disabled,
95
98
  label
96
- } = assignProps(this.asProps, this.context);
99
+ } = this.asProps;
97
100
  const {
98
101
  hoistedDisabled
99
102
  } = this.state;
100
103
  const textProps = {
101
- size,
104
+ size: size === 'm' ? 200 : 300,
102
105
  children: label,
103
106
  disabled: disabled ?? hoistedDisabled,
104
107
  hoistDisabled: this.hoistDisabled,
@@ -107,14 +110,13 @@ class RadioRoot extends Component {
107
110
  return textProps;
108
111
  }
109
112
  getValueProps() {
110
- // The default values are here, since you cannot rewrite out of context
111
113
  const {
112
- size = 'm',
113
114
  state = 'normal',
114
- theme,
115
- disabled,
116
- name
117
- } = assignProps(this.asProps, this.context);
115
+ size = this.context.size ?? 'm',
116
+ theme = this.context.theme,
117
+ disabled = this.context.disabled,
118
+ name = this.context.name
119
+ } = this.asProps;
118
120
  const {
119
121
  value,
120
122
  checked
@@ -153,12 +155,13 @@ class RadioRoot extends Component {
153
155
  }
154
156
  _defineProperty(RadioRoot, "displayName", 'Radio');
155
157
  _defineProperty(RadioRoot, "style", style);
156
- _defineProperty(RadioRoot, "contextType", RadioGroup[CONTEXT_COMPONENT]);
158
+ _defineProperty(RadioRoot, "contextType", RadioContext);
157
159
  class ValueRoot extends Component {
158
160
  constructor(...args) {
159
161
  super(...args);
162
+ _defineProperty(this, "context", {});
160
163
  _defineProperty(this, "bindHandlerChange", value => e => {
161
- if (typeof this.context.onChange === 'function') {
164
+ if (typeof this.context.onChange === 'function' && value !== undefined) {
162
165
  this.context.onChange(value, e);
163
166
  }
164
167
  });
@@ -169,32 +172,35 @@ class ValueRoot extends Component {
169
172
  };
170
173
  }
171
174
  getControlProps() {
172
- const currentValue = this.context.value;
175
+ const {
176
+ value: currentValue
177
+ } = this.context;
173
178
  const {
174
179
  forwardRef,
175
180
  includeInputProps,
176
181
  state,
177
182
  value
178
183
  } = this.asProps;
184
+ const {
185
+ onChange
186
+ } = this.props;
179
187
  const [commonControlProps] = getInputProps(this.asProps, includeInputProps);
180
188
  const inputValue = value ?? '';
181
- const controlProps = {
189
+ return {
182
190
  ref: forwardRef,
183
191
  state,
184
192
  ...commonControlProps,
185
- value: inputValue
193
+ value: inputValue,
194
+ ...(currentValue !== undefined ? {
195
+ checked: currentValue === inputValue,
196
+ onChange: callAllEventHandlers(onChange, this.bindHandlerChange(inputValue))
197
+ } : {})
186
198
  };
187
- if (currentValue !== undefined) {
188
- const {
189
- onChange
190
- } = this.props;
191
- controlProps.checked = currentValue === inputValue;
192
- controlProps.onChange = callAllEventHandlers(onChange, this.bindHandlerChange(inputValue));
193
- }
194
- return controlProps;
195
199
  }
196
200
  getRadioMarkProps() {
197
- const currentValue = this.context.value;
201
+ const {
202
+ value: currentValue
203
+ } = this.context;
198
204
  const {
199
205
  size,
200
206
  state,
@@ -205,16 +211,16 @@ class ValueRoot extends Component {
205
211
  disabled,
206
212
  includeInputProps,
207
213
  resolveColor,
214
+ children,
215
+ Children,
208
216
  ...other
209
217
  } = this.asProps;
210
- const [commonControlProps, radioMarkProps] = getInputProps(other, includeInputProps);
211
218
  const {
212
- children: _children,
213
- Children: _Children,
214
- ...propsWithoutChildren
215
- } = radioMarkProps;
219
+ onClick
220
+ } = this.props;
221
+ const [commonControlProps, radioMarkProps] = getInputProps(other, includeInputProps);
216
222
  const inputValue = value ?? '';
217
- const markProps = {
223
+ return {
218
224
  theme,
219
225
  size,
220
226
  state,
@@ -222,17 +228,11 @@ class ValueRoot extends Component {
222
228
  disabled,
223
229
  resolveColor,
224
230
  checked: commonControlProps.checked,
225
- ...propsWithoutChildren
231
+ ...radioMarkProps,
232
+ ...(currentValue !== undefined && tag !== 'label' ? {
233
+ onClick: callAllEventHandlers(onClick, this.bindHandlerChange(inputValue))
234
+ } : {})
226
235
  };
227
- if (currentValue !== undefined) {
228
- const {
229
- onClick
230
- } = this.props;
231
- if (tag !== 'label') {
232
- markProps.onClick = callAllEventHandlers(onClick, this.bindHandlerChange(inputValue));
233
- }
234
- }
235
- return markProps;
236
236
  }
237
237
  componentDidUpdate() {
238
238
  if (this.asProps.rootDisabled !== this.asProps.disabled) {
@@ -264,7 +264,7 @@ _defineProperty(ValueRoot, "defaultProps", {
264
264
  });
265
265
  _defineProperty(ValueRoot, "enhance", [resolveColorEnhance()]);
266
266
  _defineProperty(ValueRoot, "displayName", 'Value');
267
- _defineProperty(ValueRoot, "contextType", RadioGroup[CONTEXT_COMPONENT]);
267
+ _defineProperty(ValueRoot, "contextType", RadioContext);
268
268
  _defineProperty(ValueRoot, "style", style);
269
269
  function Control(props) {
270
270
  var _ref3 = arguments[0],
@@ -327,7 +327,6 @@ function Text(props) {
327
327
  }));
328
328
  }
329
329
  Text.displayName = 'Text';
330
- export { inputProps, RadioGroup };
331
330
  const Value = createComponent(ValueRoot, {
332
331
  Control,
333
332
  RadioMark
@@ -337,5 +336,6 @@ const Radio = createComponent(RadioRoot, {
337
336
  Value
338
337
  });
339
338
  export const wrapRadioGroup = wrapper => wrapper;
339
+ export { inputProps, RadioGroup };
340
340
  export default Radio;
341
341
  //# sourceMappingURL=Radio.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.js","names":["Flex","Box","InvalidStateBox","createComponent","Component","CONTEXT_COMPONENT","sstyled","Root","assignProps","callAllEventHandlers","resolveColorEnhance","getInputProps","inputProps","logger","useColorResolver","Text","TypographyText","React","style","_sstyled","insert","RadioGroupRoot","uncontrolledProps","value","setContext","theme","size","name","onChange","disabled","asProps","render","_ref","Children","createElement","_assignProps","_defineProperty","defaultValue","RadioGroup","RadioRoot","constructor","args","hoistedDisabled","undefined","warn","setState","getTextProps","label","context","state","textProps","children","hoistDisabled","rootDisabled","props","getValueProps","checked","_ref2","_ref6","SRadio","styles","hasChildren","cn","_assignProps2","Fragment","Radio","Value","ValueRoot","e","target","getControlProps","currentValue","forwardRef","includeInputProps","commonControlProps","inputValue","controlProps","ref","bindHandlerChange","getRadioMarkProps","keyboardFocused","tag","resolveColor","other","radioMarkProps","_children","_Children","propsWithoutChildren","markProps","onClick","componentDidUpdate","componentDidMount","_ref8","_ref7","Control","RadioMark","defaultChecked","_ref3","arguments[0]","_ref9","SControl","_assignProps3","displayName","_ref4","_ref0","SValue","SInvalidPattern","_assignProps4","_ref5","_ref1","SText","color","useEffect","_assignProps5","wrapRadioGroup","wrapper"],"sources":["../../src/Radio.jsx"],"sourcesContent":["import { Flex, Box, InvalidStateBox } from '@semcore/base-components';\nimport { createComponent, Component, CONTEXT_COMPONENT, sstyled, Root } from '@semcore/core';\nimport assignProps, { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport getInputProps, { inputProps } from '@semcore/core/lib/utils/inputProps';\nimport logger from '@semcore/core/lib/utils/logger';\nimport { useColorResolver } from '@semcore/core/lib/utils/use/useColorResolver';\nimport { Text as TypographyText } from '@semcore/typography';\nimport React from 'react';\n\nimport style from './style/radio.shadow.css';\n\nclass RadioGroupRoot extends Component {\n static displayName = 'RadioGroup';\n\n static defaultProps = {\n defaultValue: null,\n };\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n setContext() {\n const { theme, size, name, value, onChange, disabled } = this.asProps;\n\n return {\n onChange,\n value,\n theme,\n size,\n name,\n disabled,\n };\n }\n\n render() {\n const { Children } = this.asProps;\n\n return (\n <Root render={Flex} direction='column' role='group' __excludeProps={['onChange']}>\n <Children />\n </Root>\n );\n }\n}\n\nconst RadioGroup = createComponent(RadioGroupRoot);\n\nclass RadioRoot extends Component {\n static displayName = 'Radio';\n static style = style;\n static contextType = RadioGroup[CONTEXT_COMPONENT];\n\n state = {\n hoistedDisabled: undefined,\n };\n\n hoistDisabled = (disabled) => {\n logger.warn(\n true,\n `Don't set disabled on Radio.Value or Radio.Text, set it on Radio or on RadioGroup (for all items) instead. Otherwise it will produce wrong SSR output.`,\n this.asProps['data-ui-name'],\n );\n this.setState({ hoistedDisabled: disabled });\n };\n\n getTextProps() {\n // The default values are here, since you cannot rewrite out of context\n const { size = 'm', disabled, label } = assignProps(this.asProps, this.context);\n const { hoistedDisabled } = this.state;\n\n const textProps = {\n size,\n children: label,\n disabled: disabled ?? hoistedDisabled,\n hoistDisabled: this.hoistDisabled,\n rootDisabled: this.props.disabled,\n };\n\n return textProps;\n }\n\n getValueProps() {\n // The default values are here, since you cannot rewrite out of context\n const {\n size = 'm',\n state = 'normal',\n theme,\n disabled,\n name,\n } = assignProps(this.asProps, this.context);\n const { value, checked } = this.asProps;\n const { hoistedDisabled } = this.state;\n\n return {\n size: this.props.size ?? size,\n disabled: disabled ?? hoistedDisabled,\n state: state,\n theme,\n value,\n checked,\n name,\n hoistDisabled: this.hoistDisabled,\n rootDisabled: this.props.disabled,\n };\n }\n\n render() {\n const SRadio = Root;\n const { styles, Children, children: hasChildren } = this.asProps;\n\n return sstyled(styles)(\n <SRadio render={Box} tag='label' __excludeProps={['onChange', 'label', 'disabled']}>\n {hasChildren\n ? (\n <Children />\n )\n : (\n <>\n <Radio.Value />\n <Radio.Text />\n </>\n )}\n </SRadio>,\n );\n }\n}\n\nclass ValueRoot extends Component {\n static defaultProps = {\n includeInputProps: inputProps,\n defaultChecked: false,\n };\n\n static enhance = [resolveColorEnhance()];\n static displayName = 'Value';\n static contextType = RadioGroup[CONTEXT_COMPONENT];\n static style = style;\n\n bindHandlerChange = (value) => (e) => {\n if (typeof this.context.onChange === 'function') {\n this.context.onChange(value, e);\n }\n };\n\n uncontrolledProps() {\n return {\n checked: (e) => e.target.checked,\n };\n }\n\n getControlProps() {\n const currentValue = this.context.value;\n const { forwardRef, includeInputProps, state, value } = this.asProps;\n const [commonControlProps] = getInputProps(this.asProps, includeInputProps);\n const inputValue = value ?? '';\n\n const controlProps = {\n ref: forwardRef,\n state,\n ...commonControlProps,\n value: inputValue,\n };\n\n if (currentValue !== undefined) {\n const { onChange } = this.props;\n\n controlProps.checked = currentValue === inputValue;\n controlProps.onChange = callAllEventHandlers(onChange, this.bindHandlerChange(inputValue));\n }\n\n return controlProps;\n }\n\n getRadioMarkProps() {\n const currentValue = this.context.value;\n const {\n size,\n state,\n theme,\n keyboardFocused,\n value,\n tag,\n disabled,\n includeInputProps,\n resolveColor,\n ...other\n } = this.asProps;\n const [commonControlProps, radioMarkProps] = getInputProps(other, includeInputProps);\n const { children: _children, Children: _Children, ...propsWithoutChildren } = radioMarkProps;\n const inputValue = value ?? '';\n\n const markProps = {\n theme,\n size,\n state,\n keyboardFocused,\n disabled,\n resolveColor,\n checked: commonControlProps.checked,\n ...propsWithoutChildren,\n };\n\n if (currentValue !== undefined) {\n const { onClick } = this.props;\n\n if (tag !== 'label') {\n markProps.onClick = callAllEventHandlers(onClick, this.bindHandlerChange(inputValue));\n }\n }\n\n return markProps;\n }\n\n componentDidUpdate() {\n if (this.asProps.rootDisabled !== this.asProps.disabled) {\n this.asProps.hoistDisabled(this.asProps.disabled);\n }\n }\n\n componentDidMount() {\n if (this.asProps.rootDisabled !== this.asProps.disabled) {\n this.asProps.hoistDisabled(this.asProps.disabled);\n }\n }\n\n render() {\n const { styles, children: hasChildren, Children } = this.asProps;\n\n if (!hasChildren) {\n return sstyled(styles)(\n <>\n <Radio.Value.Control />\n <Radio.Value.RadioMark />\n </>,\n );\n }\n\n return sstyled(styles)(<Children />);\n }\n}\n\nfunction Control(props) {\n const SControl = Root;\n const { styles, state } = props;\n\n return sstyled(styles)(\n <SControl render={Box} tag='input' type='radio' aria-invalid={state === 'invalid'} />,\n );\n};\nControl.displayName = 'Control';\n\nfunction RadioMark(props) {\n const SValue = Root;\n const SInvalidPattern = InvalidStateBox;\n const { theme, styles, resolveColor, state, checked } = props;\n\n return sstyled(styles)(\n <SValue render={Box} tag='div' use:theme={resolveColor(theme)} aria-hidden={true}>\n {state === 'invalid' && !checked && <SInvalidPattern />}\n </SValue>,\n );\n}\nRadioMark.displayName = 'RadioMark';\n\nfunction Text(props) {\n const SText = Root;\n const { styles, color } = props;\n\n React.useEffect(() => {\n if (props.rootDisabled !== props.disabled) {\n props.hoistDisabled(props.disabled);\n }\n }, [props.rootDisabled, props.disabled, props.hoistDisabled]);\n const resolveColor = useColorResolver();\n\n return sstyled(styles)(\n <SText render={TypographyText} tag='span' use:color={resolveColor(color)} />,\n );\n}\nText.displayName = 'Text';\n\nexport { inputProps, RadioGroup };\n\nconst Value = createComponent(ValueRoot, {\n Control,\n RadioMark,\n});\n\nconst Radio = createComponent(RadioRoot, {\n Text,\n Value,\n});\n\nexport const wrapRadioGroup = (wrapper) => wrapper;\n\nexport default Radio;\n"],"mappings":";;;;;;;AAAA,SAASA,IAAI,EAAEC,GAAG,EAAEC,eAAe,QAAQ,0BAA0B;AACrE,SAASC,eAAe,EAAEC,SAAS,EAAEC,iBAAiB,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AAC5F,OAAOC,WAAW,IAAIC,oBAAoB,QAAQ,qCAAqC;AACvF,OAAOC,mBAAmB,MAAM,sDAAsD;AACtF,OAAOC,aAAa,IAAIC,UAAU,QAAQ,oCAAoC;AAC9E,OAAOC,MAAM,MAAM,gCAAgC;AACnD,SAASC,gBAAgB,QAAQ,8CAA8C;AAC/E,SAASC,IAAI,IAAIC,cAAc,QAAQ,qBAAqB;AAC5D,OAAOC,KAAK,MAAM,OAAO;AAAC;AAAA,MAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAI1B,MAAMC,cAAc,SAASjB,SAAS,CAAC;EAOrCkB,iBAAiBA,CAAA,EAAG;IAClB,OAAO;MACLC,KAAK,EAAE;IACT,CAAC;EACH;EAEAC,UAAUA,CAAA,EAAG;IACX,MAAM;MAAEC,KAAK;MAAEC,IAAI;MAAEC,IAAI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AACgE,SAAS,EAAE;EACvC2B,OAAO;EACPC;AACF,CAAC,CAAC;AAEF,MAAM9B,KAAK,GAAG9D,eAAe,CAACoC,SAAS,EAAE;EACvCxB,IAAI;EACJmD;AACF,CAAC,CAAC;AAEF,OAAO,MAAMgD,cAAc,GAAIC,OAAO,IAAKA,OAAO;AAElD,eAAelD,KAAK","ignoreList":[]}
1
+ {"version":3,"file":"Radio.js","names":["Flex","Box","InvalidStateBox","createComponent","Component","sstyled","Root","callAllEventHandlers","resolveColorEnhance","getInputProps","inputProps","logger","useColorResolver","Text","TypographyText","React","style","_sstyled","insert","RadioContext","createContext","RadioGroupRoot","uncontrolledProps","value","setContext","theme","size","name","onChange","disabled","asProps","render","_ref","Children","createElement","_assignProps","_defineProperty","defaultValue","RadioGroup","context","RadioRoot","constructor","args","hoistedDisabled","undefined","warn","setState","getTextProps","label","state","textProps","children","hoistDisabled","rootDisabled","props","getValueProps","checked","_ref2","_ref6","SRadio","styles","hasChildren","cn","_assignProps2","Fragment","Radio","Value","ValueRoot","e","target","getControlProps","currentValue","forwardRef","includeInputProps","commonControlProps","inputValue","ref","bindHandlerChange","getRadioMarkProps","keyboardFocused","tag","resolveColor","other","onClick","radioMarkProps","componentDidUpdate","componentDidMount","_ref8","_ref7","Control","RadioMark","defaultChecked","_ref3","arguments[0]","_ref9","SControl","_assignProps3","displayName","_ref4","_ref0","SValue","SInvalidPattern","_assignProps4","_ref5","_ref1","SText","color","useEffect","_assignProps5","wrapRadioGroup","wrapper"],"sources":["../../src/Radio.tsx"],"sourcesContent":["import { Flex, Box, InvalidStateBox } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport getInputProps, { inputProps } from '@semcore/core/lib/utils/inputProps';\nimport logger from '@semcore/core/lib/utils/logger';\nimport { useColorResolver } from '@semcore/core/lib/utils/use/useColorResolver';\nimport { Text as TypographyText } from '@semcore/typography';\nimport React from 'react';\n\nimport type {\n IntergalacticRadioGroupComponent,\n RadioProps,\n RadioComponent,\n RadioGroupProps,\n RadioValueComponent,\n RadioTextComponent,\n RadioValueRadioMarkComponent,\n RadioRootComponent,\n RadioValueControlComponent,\n} from './Radio.type';\nimport style from './style/radio.shadow.css';\n\nconst RadioContext = React.createContext<{\n onChange?: RadioGroupProps['onChange'];\n value?: RadioGroupProps['value'];\n theme?: RadioGroupProps['theme'];\n size?: RadioGroupProps['size'];\n name?: RadioGroupProps['name'];\n disabled?: RadioGroupProps['disabled'];\n}>({});\n\nclass RadioGroupRoot extends Component<Intergalactic.InternalTypings.InferComponentProps<IntergalacticRadioGroupComponent>, [], { value: null }> {\n static displayName = 'RadioGroup';\n\n static defaultProps = {\n defaultValue: null,\n };\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n setContext() {\n const { theme, size, name, value, onChange, disabled } = this.asProps;\n\n return {\n onChange,\n value,\n theme,\n size,\n name,\n disabled,\n };\n }\n\n render() {\n const { Children } = this.asProps;\n\n return (\n <Root render={Flex} direction='column' role='group' __excludeProps={['onChange']}>\n <Children />\n </Root>\n );\n }\n}\n\nconst RadioGroup = createComponent(RadioGroupRoot, {}, { context: RadioContext }) as unknown as IntergalacticRadioGroupComponent;\n\nclass RadioRoot extends Component<\n Intergalactic.InternalTypings.InferComponentProps<RadioRootComponent>\n> {\n static displayName = 'Radio';\n static style = style;\n static contextType = RadioContext;\n\n context: React.ContextType<typeof RadioContext> = {};\n\n state = {\n hoistedDisabled: undefined,\n };\n\n hoistDisabled = (disabled: RadioProps['disabled']) => {\n logger.warn(\n true,\n `Don't set disabled on Radio.Value or Radio.Text, set it on Radio or on RadioGroup (for all items) instead. Otherwise it will produce wrong SSR output.`,\n this.asProps['data-ui-name'],\n );\n this.setState({ hoistedDisabled: disabled });\n };\n\n getTextProps() {\n const {\n size = this.context.size ?? 'm',\n disabled = this.context.disabled,\n label,\n } = this.asProps;\n\n const { hoistedDisabled } = this.state;\n\n const textProps = {\n size: size === 'm' ? 200 : 300,\n children: label,\n disabled: disabled ?? hoistedDisabled,\n hoistDisabled: this.hoistDisabled,\n rootDisabled: this.props.disabled,\n };\n\n return textProps;\n }\n\n getValueProps() {\n const {\n state = 'normal',\n size = this.context.size ?? 'm',\n theme = this.context.theme,\n disabled = this.context.disabled,\n name = this.context.name,\n } = this.asProps;\n\n const { value, checked } = this.asProps;\n const { hoistedDisabled } = this.state;\n\n return {\n size: this.props.size ?? size,\n disabled: disabled ?? hoistedDisabled,\n state: state,\n theme,\n value,\n checked,\n name,\n hoistDisabled: this.hoistDisabled,\n rootDisabled: this.props.disabled,\n };\n }\n\n render() {\n const SRadio = Root;\n const { styles, Children, children: hasChildren } = this.asProps;\n\n return sstyled(styles)(\n <SRadio render={Box} tag='label' __excludeProps={['onChange', 'label', 'disabled']}>\n {hasChildren\n ? (\n <Children />\n )\n : (\n <>\n <Radio.Value />\n <Radio.Text />\n </>\n )}\n </SRadio>,\n );\n }\n}\n\nclass ValueRoot extends Component<\n Intergalactic.InternalTypings.InferChildComponentProps<RadioValueComponent, typeof RadioRoot, 'Value'>,\n typeof ValueRoot.enhance,\n { checked: (e: React.ChangeEvent<HTMLInputElement>) => boolean }\n> {\n context: React.ContextType<typeof RadioContext> = {};\n\n static defaultProps = {\n includeInputProps: inputProps,\n defaultChecked: false,\n };\n\n static enhance = [resolveColorEnhance()] as const;\n static displayName = 'Value';\n static contextType = RadioContext;\n static style = style;\n\n bindHandlerChange = (value: RadioProps['value']) => (e: React.ChangeEvent<HTMLInputElement>) => {\n if (typeof this.context.onChange === 'function' && value !== undefined) {\n this.context.onChange(value, e);\n }\n };\n\n uncontrolledProps() {\n return {\n checked: (e: React.ChangeEvent<HTMLInputElement>) => e.target.checked,\n };\n }\n\n getControlProps() {\n const { value: currentValue } = this.context;\n const { forwardRef, includeInputProps, state, value } = this.asProps;\n const { onChange } = this.props;\n\n const [commonControlProps] = getInputProps(this.asProps, includeInputProps);\n const inputValue = value ?? '';\n\n return {\n ref: forwardRef,\n state,\n ...commonControlProps,\n value: inputValue,\n ...(currentValue !== undefined\n ? {\n checked: currentValue === inputValue,\n onChange: callAllEventHandlers(onChange, this.bindHandlerChange(inputValue)),\n }\n : {}\n ),\n };\n }\n\n getRadioMarkProps() {\n const { value: currentValue } = this.context;\n const {\n size,\n state,\n theme,\n keyboardFocused,\n value,\n tag,\n disabled,\n includeInputProps,\n resolveColor,\n children,\n Children,\n ...other\n } = this.asProps;\n const { onClick } = this.props;\n const [commonControlProps, radioMarkProps] = getInputProps(other, includeInputProps);\n const inputValue = value ?? '';\n\n return {\n theme,\n size,\n state,\n keyboardFocused,\n disabled,\n resolveColor,\n checked: commonControlProps.checked,\n ...radioMarkProps,\n ...(currentValue !== undefined && tag !== 'label'\n ? {\n onClick: callAllEventHandlers(onClick, this.bindHandlerChange(inputValue)),\n }\n : {}\n\n ),\n };\n }\n\n componentDidUpdate() {\n if (this.asProps.rootDisabled !== this.asProps.disabled) {\n this.asProps.hoistDisabled(this.asProps.disabled);\n }\n }\n\n componentDidMount() {\n if (this.asProps.rootDisabled !== this.asProps.disabled) {\n this.asProps.hoistDisabled(this.asProps.disabled);\n }\n }\n\n render() {\n const { styles, children: hasChildren, Children } = this.asProps;\n\n if (!hasChildren) {\n return sstyled(styles)(\n <>\n <Radio.Value.Control />\n <Radio.Value.RadioMark />\n </>,\n );\n }\n\n return sstyled(styles)(<Children />);\n }\n}\n\nfunction Control(props: Intergalactic.InternalTypings.InferChildComponentProps<RadioValueControlComponent, typeof ValueRoot, 'Control'>) {\n const SControl = Root;\n const { styles, state } = props;\n\n return sstyled(styles)(\n <SControl render={Box} tag='input' type='radio' aria-invalid={state === 'invalid'} />,\n );\n};\nControl.displayName = 'Control';\n\nfunction RadioMark(props: Intergalactic.InternalTypings.InferChildComponentProps<RadioValueRadioMarkComponent, typeof ValueRoot, 'RadioMark'>) {\n const SValue = Root;\n const SInvalidPattern = InvalidStateBox;\n const { theme, styles, resolveColor, state, checked } = props;\n\n return sstyled(styles)(\n <SValue render={Box} tag='div' use:theme={resolveColor(theme)} aria-hidden={true}>\n {state === 'invalid' && !checked && <SInvalidPattern />}\n </SValue>,\n );\n}\nRadioMark.displayName = 'RadioMark';\n\nfunction Text(props: Intergalactic.InternalTypings.InferChildComponentProps<RadioTextComponent, typeof RadioRoot, 'Text'>) {\n const SText = Root;\n const { styles, color } = props;\n\n React.useEffect(() => {\n if (props.rootDisabled !== props.disabled) {\n props.hoistDisabled(props.disabled);\n }\n }, [props.rootDisabled, props.disabled, props.hoistDisabled]);\n const resolveColor = useColorResolver();\n\n return sstyled(styles)(\n <SText render={TypographyText} tag='span' use:color={resolveColor(color)} />,\n );\n}\nText.displayName = 'Text';\n\nconst Value = createComponent(ValueRoot, {\n Control,\n RadioMark,\n}) as RadioValueComponent;\n\nconst Radio = createComponent(RadioRoot, {\n Text,\n Value,\n}) as RadioComponent;\n\nexport const wrapRadioGroup = <PropsExtending extends {}>(wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticRadioGroupComponent>\n > &\n PropsExtending,\n) => React.ReactNode) => wrapper as IntergalacticRadioGroupComponent<PropsExtending>;\n\nexport { inputProps, RadioGroup };\n\nexport default Radio;\n"],"mappings":";;;;;;;AAAA,SAASA,IAAI,EAAEC,GAAG,EAAEC,eAAe,QAAQ,0BAA0B;AAErE,SAASC,eAAe,EAAEC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AACzE,SAASC,oBAAoB,QAAQ,qCAAqC;AAC1E,OAAOC,mBAAmB,MAAM,sDAAsD;AACtF,OAAOC,aAAa,IAAIC,UAAU,QAAQ,oCAAoC;AAC9E,OAAOC,MAAM,MAAM,gCAAgC;AACnD,SAASC,gBAAgB,QAAQ,8CAA8C;AAC/E,SAASC,IAAI,IAAIC,cAAc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,CAACD,YAAY,KAAKC,KAAK,CAACzB,QAAQ,EAAE;MACzCyB,KAAK,CAACF,aAAa,CAACE,KAAK,CAACzB,QAAQ,CAAC;IACrC;EACF,CAAC,EAAE,CAACyB,KAAK,CAACD,YAAY,EAAEC,KAAK,CAACzB,QAAQ,EAAEyB,KAAK,CAACF,aAAa,CAAC,CAAC;EAC7D,MAAM6B,YAAY,GAAGrE,gBAAgB,CAAC,CAAC;EAEvC,OAAA4F,KAAA,GAAOnG,OAAO,CAACuD,MAAM,CAAC,eACpB7C,KAAA,CAAAmB,aAAA,CAACuE,KAAK,EAAAD,KAAA,CAAA1C,EAAA;IAAA,GAAA8C,aAAA;MAAA,OAA6B,MAAM;MAAA,aAAY3B,YAAY,CAACyB,KAAK;IAAC,GAAAH,KAAA;EAAA,EAAG,CAAC;AAEhF;AACA1F,IAAI,CAACoF,WAAW,GAAG,MAAM;AAEzB,MAAM/B,KAAK,GAAG/D,eAAe,CAACgE,SAAS,EAAE;EACvCsB,OAAO;EACPC;AACF,CAAC,CAAwB;AAEzB,MAAMzB,KAAK,GAAG9D,eAAe,CAACqC,SAAS,EAAE;EACvC3B,IAAI;EACJqD;AACF,CAAC,CAAmB;AAEpB,OAAO,MAAM2C,cAAc,GAA+BC,OAKtC,IAAKA,OAA2D;AAEpF,SAASpG,UAAU,EAAE4B,UAAU;AAE/B,eAAe2B,KAAK","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Radio.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Radio.type.js","names":[],"sources":["../../src/Radio.type.ts"],"sourcesContent":["import type { Box, BoxProps, Flex } from '@semcore/base-components';\nimport type { PropGetterFn, Intergalactic } from '@semcore/core';\nimport type { Text, TextProps } from '@semcore/typography';\nimport type React from 'react';\n\nexport type RadioSize = 'm' | 'l';\nexport type RadioState = 'normal' | 'invalid';\nexport type RadioValue = string | number | boolean;\n\nexport type RadioProps = BoxProps & {\n /** Radio item value **/\n value?: RadioValue;\n\n /** Radio item checked flag **/\n checked?: boolean;\n\n /**\n * The value displaying the state of the component\n * @default normal\n */\n state?: RadioState;\n /**\n * Radio button size\n * @default m\n **/\n size?: RadioSize;\n /** The theme of the radio button that you can send your color to */\n theme?: string;\n /** Radio item text **/\n label?: string;\n /** Blocks access and changes to the radio item **/\n disabled?: boolean;\n};\n\nexport type RadioGroupProps<T extends RadioValue = RadioValue> = {\n /** Radio group name */\n name?: string;\n /** Active default value */\n defaultValue?: T;\n /** Active value */\n value?: T;\n /** Called when the selected element is changed */\n onChange?:\n | ((value: T, e?: React.SyntheticEvent<HTMLInputElement>) => void)\n | React.Dispatch<React.SetStateAction<T>>;\n /** Radio button size */\n size?: RadioSize;\n /** The theme of the radio button that you can send your color to */\n theme?: string;\n /** Blocks access and changes to the form field */\n disabled?: boolean;\n};\n\nexport type RadioValueProps = BoxProps & {\n /** List of elements that can be put on a hidden input */\n includeInputProps?: string[];\n};\n\nexport type RadioCtx = {\n getValueProps: PropGetterFn;\n getTextProps: PropGetterFn;\n};\n\nexport type IntergalacticRadioGroupComponent<PropsExtending = {}> = (<\n Value extends RadioValue,\n Tag extends Intergalactic.Tag = typeof Flex,\n>(\n props: Intergalactic.InternalTypings.ComponentProps<Tag, typeof Flex, RadioGroupProps<Value>> &\n PropsExtending,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\nIntergalactic.InternalTypings.ComponentAdditive<'div', typeof Flex, RadioGroupProps>;\n\nexport type RadioValueControlProps = {};\nexport type RadioValueMarkProps = {};\nexport type RadioTextProps = TextProps;\n\nexport type RadioValueControlComponent = Intergalactic.Component<'input', RadioValueControlProps>;\nexport type RadioValueRadioMarkComponent = Intergalactic.Component<typeof Box, RadioValueMarkProps>;\n\nexport type RadioValueComponent = Intergalactic.Component<'input', RadioValueProps> & {\n Control: RadioValueControlComponent;\n RadioMark: RadioValueRadioMarkComponent;\n};\n\nexport type RadioTextComponent = typeof Text;\n\nexport type RadioRootComponent = Intergalactic.Component<'label', RadioProps, RadioCtx>;\nexport type RadioComponent = RadioRootComponent & {\n Value: RadioValueComponent;\n Text: RadioTextComponent;\n};\n"],"mappings":"","ignoreList":[]}
package/lib/es6/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { default } from './Radio';
2
- export * from './Radio';
1
+ export { default, wrapRadioGroup, RadioGroup } from './Radio';
2
+ export * from './Radio.type';
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["default"],"sources":["../../src/index.js"],"sourcesContent":["export { default } from './Radio';\nexport * from './Radio';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,SAAS;AACjC,cAAc,SAAS","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["default","wrapRadioGroup","RadioGroup"],"sources":["../../src/index.ts"],"sourcesContent":["export { default, wrapRadioGroup, RadioGroup } from './Radio';\nexport * from './Radio.type';\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,cAAc,EAAEC,UAAU,QAAQ,SAAS;AAC7D,cAAc,cAAc","ignoreList":[]}
@@ -17,16 +17,6 @@ SRadio[disabled] {
17
17
  pointer-events: none;
18
18
  }
19
19
 
20
- SText[size='m'] {
21
- font-size: var(--intergalactic-fs-200, 14px);
22
- line-height: var(--intergalactic-lh-200, 142%);
23
- }
24
-
25
- SText[size='l'] {
26
- font-size: var(--intergalactic-fs-300, 16px);
27
- line-height: var(--intergalactic-lh-300, 150%);
28
- }
29
-
30
20
  SValue {
31
21
  position: relative;
32
22
  flex-shrink: 0;
package/lib/esm/Radio.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { sstyled, createComponent, CONTEXT_COMPONENT, Component, assignProps } from "@semcore/core";
2
+ import { sstyled, createComponent, Component, assignProps } from "@semcore/core";
3
3
  import { Flex, Box, InvalidStateBox } from "@semcore/base-components";
4
- import assignProps$1, { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
4
+ import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
5
5
  import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
6
6
  import getInputProps, { inputProps } from "@semcore/core/lib/utils/inputProps";
7
7
  import { inputProps as inputProps2 } from "@semcore/core/lib/utils/inputProps";
@@ -14,27 +14,28 @@ const style = (
14
14
  /*__reshadow_css_start__*/
15
15
  (sstyled.insert(
16
16
  /*__inner_css_start__*/
17
- '.___SRadio_1qr3e_gg_{display:inline-flex;align-items:flex-start;cursor:pointer}.___SRadio_1qr3e_gg_ .___SText_1qr3e_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);color:var(--intergalactic-text-primary, #191b23)}.___SRadio_1qr3e_gg_ .___SText_1qr3e_gg_.__color_1qr3e_gg_{color:var(--color_1qr3e)}.___SRadio_1qr3e_gg_.__disabled_1qr3e_gg_{pointer-events:none}.___SText_1qr3e_gg_._size_m_1qr3e_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SText_1qr3e_gg_._size_l_1qr3e_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}.___SValue_1qr3e_gg_{position:relative;flex-shrink:0;padding:0;outline:0;z-index:0;margin-top:var(--intergalactic-spacing-05x, 2px)}.___SValue_1qr3e_gg_::after,.___SValue_1qr3e_gg_::before{content:"";position:absolute;right:0;bottom:0;border-radius:50%;background:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SValue_1qr3e_gg_::before{top:0;left:0;border:1px solid;transition:calc(var(--intergalactic-duration-control, 200)*1ms) all ease-in-out}.___SValue_1qr3e_gg_::after{top:50%;left:50%;transform:translate(-50%,-50%);width:0;height:0}.___SValue_1qr3e_gg_.__disabled_1qr3e_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SValue_1qr3e_gg_._size_m_1qr3e_gg_{width:16px;height:16px}.___SValue_1qr3e_gg_._size_m_1qr3e_gg_ .___SInvalidPattern_1qr3e_gg_:before{width:14px;height:14px}.___SValue_1qr3e_gg_._size_l_1qr3e_gg_{width:20px;height:20px}.___SValue_1qr3e_gg_._size_l_1qr3e_gg_ .___SInvalidPattern_1qr3e_gg_:before{width:18px;height:18px}.___SValue_1qr3e_gg_._state_normal_1qr3e_gg_::before{border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SValue_1qr3e_gg_._state_invalid_1qr3e_gg_::before{border-color:var(--intergalactic-border-critical-active, #d1002f)}.___SControl_1qr3e_gg_{position:absolute;clip:rect(1px,1px,1px,1px)}.___SControl_1qr3e_gg_:checked~.___SValue_1qr3e_gg_._size_m_1qr3e_gg_::after{width:6px;height:6px}.___SControl_1qr3e_gg_:checked~.___SValue_1qr3e_gg_._size_l_1qr3e_gg_::after{width:8px;height:8px}.___SControl_1qr3e_gg_:focus-visible+.___SValue_1qr3e_gg_._state_normal_1qr3e_gg_::before{border-color:var(--intergalactic-border-info-active, #006dca);outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset}.___SControl_1qr3e_gg_:checked:focus-visible~.___SValue_1qr3e_gg_::before,.___SControl_1qr3e_gg_:checked~.___SValue_1qr3e_gg_::before{border-color:var(--intergalactic-control-primary-info, #008ff8);background-color:var(--intergalactic-control-primary-info, #008ff8)}.___SControl_1qr3e_gg_:focus-visible+.___SValue_1qr3e_gg_._state_invalid_1qr3e_gg_::before{border-color:var(--intergalactic-border-critical-active, #d1002f);outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset;outline-color:var(--intergalactic-keyboard-focus-invalid-outline, #ff4953)}.___SControl_1qr3e_gg_:checked~.___SValue_1qr3e_gg_.__theme_1qr3e_gg_::before{border-color:var(--theme_1qr3e);background-color:var(--theme_1qr3e)}.___SValue_1qr3e_gg_._state_normal_1qr3e_gg_.__theme_1qr3e_gg_::before{border-color:var(--theme_1qr3e)}.___SInvalidPattern_1qr3e_gg_{background:0 0;overflow:hidden}.___SInvalidPattern_1qr3e_gg_:before{content:"";position:absolute;top:1px;left:1px;border-radius:50%;background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, rgba(209, 0, 47, 1) 0, rgba(209, 0, 47, 1) 2px, transparent 0, transparent 50%));background-size:6px 6px;background-color:var(--intergalactic-bg-primary-neutral, #ffffff)}',
17
+ '.___SRadio_1ifzo_gg_{display:inline-flex;align-items:flex-start;cursor:pointer}.___SRadio_1ifzo_gg_ .___SText_1ifzo_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);color:var(--intergalactic-text-primary, #191b23)}.___SRadio_1ifzo_gg_ .___SText_1ifzo_gg_.__color_1ifzo_gg_{color:var(--color_1ifzo)}.___SRadio_1ifzo_gg_.__disabled_1ifzo_gg_{pointer-events:none}.___SValue_1ifzo_gg_{position:relative;flex-shrink:0;padding:0;outline:0;z-index:0;margin-top:var(--intergalactic-spacing-05x, 2px)}.___SValue_1ifzo_gg_::after,.___SValue_1ifzo_gg_::before{content:"";position:absolute;right:0;bottom:0;border-radius:50%;background:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SValue_1ifzo_gg_::before{top:0;left:0;border:1px solid;transition:calc(var(--intergalactic-duration-control, 200)*1ms) all ease-in-out}.___SValue_1ifzo_gg_::after{top:50%;left:50%;transform:translate(-50%,-50%);width:0;height:0}.___SValue_1ifzo_gg_.__disabled_1ifzo_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SValue_1ifzo_gg_._size_m_1ifzo_gg_{width:16px;height:16px}.___SValue_1ifzo_gg_._size_m_1ifzo_gg_ .___SInvalidPattern_1ifzo_gg_:before{width:14px;height:14px}.___SValue_1ifzo_gg_._size_l_1ifzo_gg_{width:20px;height:20px}.___SValue_1ifzo_gg_._size_l_1ifzo_gg_ .___SInvalidPattern_1ifzo_gg_:before{width:18px;height:18px}.___SValue_1ifzo_gg_._state_normal_1ifzo_gg_::before{border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SValue_1ifzo_gg_._state_invalid_1ifzo_gg_::before{border-color:var(--intergalactic-border-critical-active, #d1002f)}.___SControl_1ifzo_gg_{position:absolute;clip:rect(1px,1px,1px,1px)}.___SControl_1ifzo_gg_:checked~.___SValue_1ifzo_gg_._size_m_1ifzo_gg_::after{width:6px;height:6px}.___SControl_1ifzo_gg_:checked~.___SValue_1ifzo_gg_._size_l_1ifzo_gg_::after{width:8px;height:8px}.___SControl_1ifzo_gg_:focus-visible+.___SValue_1ifzo_gg_._state_normal_1ifzo_gg_::before{border-color:var(--intergalactic-border-info-active, #006dca);outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset}.___SControl_1ifzo_gg_:checked:focus-visible~.___SValue_1ifzo_gg_::before,.___SControl_1ifzo_gg_:checked~.___SValue_1ifzo_gg_::before{border-color:var(--intergalactic-control-primary-info, #008ff8);background-color:var(--intergalactic-control-primary-info, #008ff8)}.___SControl_1ifzo_gg_:focus-visible+.___SValue_1ifzo_gg_._state_invalid_1ifzo_gg_::before{border-color:var(--intergalactic-border-critical-active, #d1002f);outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset;outline-color:var(--intergalactic-keyboard-focus-invalid-outline, #ff4953)}.___SControl_1ifzo_gg_:checked~.___SValue_1ifzo_gg_.__theme_1ifzo_gg_::before{border-color:var(--theme_1ifzo);background-color:var(--theme_1ifzo)}.___SValue_1ifzo_gg_._state_normal_1ifzo_gg_.__theme_1ifzo_gg_::before{border-color:var(--theme_1ifzo)}.___SInvalidPattern_1ifzo_gg_{background:0 0;overflow:hidden}.___SInvalidPattern_1ifzo_gg_:before{content:"";position:absolute;top:1px;left:1px;border-radius:50%;background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, rgba(209, 0, 47, 1) 0, rgba(209, 0, 47, 1) 2px, transparent 0, transparent 50%));background-size:6px 6px;background-color:var(--intergalactic-bg-primary-neutral, #ffffff)}',
18
18
  /*__inner_css_end__*/
19
- "1qr3e_gg_"
19
+ "1ifzo_gg_"
20
20
  ), /*__reshadow_css_end__*/
21
21
  {
22
- "__SRadio": "___SRadio_1qr3e_gg_",
23
- "_disabled": "__disabled_1qr3e_gg_",
24
- "__SText": "___SText_1qr3e_gg_",
25
- "_size_m": "_size_m_1qr3e_gg_",
26
- "_size_l": "_size_l_1qr3e_gg_",
27
- "__SValue": "___SValue_1qr3e_gg_",
28
- "_state_normal": "_state_normal_1qr3e_gg_",
29
- "_state_invalid": "_state_invalid_1qr3e_gg_",
30
- "__SControl": "___SControl_1qr3e_gg_",
31
- "_theme": "__theme_1qr3e_gg_",
32
- "--theme": "--theme_1qr3e",
33
- "_color": "__color_1qr3e_gg_",
34
- "--color": "--color_1qr3e",
35
- "__SInvalidPattern": "___SInvalidPattern_1qr3e_gg_"
22
+ "__SRadio": "___SRadio_1ifzo_gg_",
23
+ "_disabled": "__disabled_1ifzo_gg_",
24
+ "__SValue": "___SValue_1ifzo_gg_",
25
+ "_state_normal": "_state_normal_1ifzo_gg_",
26
+ "_state_invalid": "_state_invalid_1ifzo_gg_",
27
+ "__SControl": "___SControl_1ifzo_gg_",
28
+ "_size_m": "_size_m_1ifzo_gg_",
29
+ "_size_l": "_size_l_1ifzo_gg_",
30
+ "_theme": "__theme_1ifzo_gg_",
31
+ "--theme": "--theme_1ifzo",
32
+ "__SText": "___SText_1ifzo_gg_",
33
+ "_color": "__color_1ifzo_gg_",
34
+ "--color": "--color_1ifzo",
35
+ "__SInvalidPattern": "___SInvalidPattern_1ifzo_gg_"
36
36
  })
37
37
  );
38
+ const RadioContext = /* @__PURE__ */ React.createContext({});
38
39
  class RadioGroupRoot extends Component {
39
40
  uncontrolledProps() {
40
41
  return {
@@ -75,10 +76,13 @@ _defineProperty(RadioGroupRoot, "displayName", "RadioGroup");
75
76
  _defineProperty(RadioGroupRoot, "defaultProps", {
76
77
  defaultValue: null
77
78
  });
78
- const RadioGroup = createComponent(RadioGroupRoot);
79
+ const RadioGroup = createComponent(RadioGroupRoot, {}, {
80
+ context: RadioContext
81
+ });
79
82
  class RadioRoot extends Component {
80
83
  constructor(...args) {
81
84
  super(...args);
85
+ _defineProperty(this, "context", {});
82
86
  _defineProperty(this, "state", {
83
87
  hoistedDisabled: void 0
84
88
  });
@@ -91,15 +95,15 @@ class RadioRoot extends Component {
91
95
  }
92
96
  getTextProps() {
93
97
  const {
94
- size = "m",
95
- disabled,
98
+ size = this.context.size ?? "m",
99
+ disabled = this.context.disabled,
96
100
  label
97
- } = assignProps$1(this.asProps, this.context);
101
+ } = this.asProps;
98
102
  const {
99
103
  hoistedDisabled
100
104
  } = this.state;
101
105
  const textProps = {
102
- size,
106
+ size: size === "m" ? 200 : 300,
103
107
  children: label,
104
108
  disabled: disabled ?? hoistedDisabled,
105
109
  hoistDisabled: this.hoistDisabled,
@@ -109,12 +113,12 @@ class RadioRoot extends Component {
109
113
  }
110
114
  getValueProps() {
111
115
  const {
112
- size = "m",
113
116
  state = "normal",
114
- theme,
115
- disabled,
116
- name
117
- } = assignProps$1(this.asProps, this.context);
117
+ size = this.context.size ?? "m",
118
+ theme = this.context.theme,
119
+ disabled = this.context.disabled,
120
+ name = this.context.name
121
+ } = this.asProps;
118
122
  const {
119
123
  value,
120
124
  checked
@@ -152,12 +156,13 @@ class RadioRoot extends Component {
152
156
  }
153
157
  _defineProperty(RadioRoot, "displayName", "Radio");
154
158
  _defineProperty(RadioRoot, "style", style);
155
- _defineProperty(RadioRoot, "contextType", RadioGroup[CONTEXT_COMPONENT]);
159
+ _defineProperty(RadioRoot, "contextType", RadioContext);
156
160
  class ValueRoot extends Component {
157
161
  constructor(...args) {
158
162
  super(...args);
163
+ _defineProperty(this, "context", {});
159
164
  _defineProperty(this, "bindHandlerChange", (value) => (e) => {
160
- if (typeof this.context.onChange === "function") {
165
+ if (typeof this.context.onChange === "function" && value !== void 0) {
161
166
  this.context.onChange(value, e);
162
167
  }
163
168
  });
@@ -168,32 +173,35 @@ class ValueRoot extends Component {
168
173
  };
169
174
  }
170
175
  getControlProps() {
171
- const currentValue = this.context.value;
176
+ const {
177
+ value: currentValue
178
+ } = this.context;
172
179
  const {
173
180
  forwardRef,
174
181
  includeInputProps,
175
182
  state,
176
183
  value
177
184
  } = this.asProps;
185
+ const {
186
+ onChange
187
+ } = this.props;
178
188
  const [commonControlProps] = getInputProps(this.asProps, includeInputProps);
179
189
  const inputValue = value ?? "";
180
- const controlProps = {
190
+ return {
181
191
  ref: forwardRef,
182
192
  state,
183
193
  ...commonControlProps,
184
- value: inputValue
194
+ value: inputValue,
195
+ ...currentValue !== void 0 ? {
196
+ checked: currentValue === inputValue,
197
+ onChange: callAllEventHandlers(onChange, this.bindHandlerChange(inputValue))
198
+ } : {}
185
199
  };
186
- if (currentValue !== void 0) {
187
- const {
188
- onChange
189
- } = this.props;
190
- controlProps.checked = currentValue === inputValue;
191
- controlProps.onChange = callAllEventHandlers(onChange, this.bindHandlerChange(inputValue));
192
- }
193
- return controlProps;
194
200
  }
195
201
  getRadioMarkProps() {
196
- const currentValue = this.context.value;
202
+ const {
203
+ value: currentValue
204
+ } = this.context;
197
205
  const {
198
206
  size,
199
207
  state,
@@ -204,16 +212,16 @@ class ValueRoot extends Component {
204
212
  disabled,
205
213
  includeInputProps,
206
214
  resolveColor,
215
+ children,
216
+ Children,
207
217
  ...other
208
218
  } = this.asProps;
209
- const [commonControlProps, radioMarkProps] = getInputProps(other, includeInputProps);
210
219
  const {
211
- children: _children,
212
- Children: _Children,
213
- ...propsWithoutChildren
214
- } = radioMarkProps;
220
+ onClick
221
+ } = this.props;
222
+ const [commonControlProps, radioMarkProps] = getInputProps(other, includeInputProps);
215
223
  const inputValue = value ?? "";
216
- const markProps = {
224
+ return {
217
225
  theme,
218
226
  size,
219
227
  state,
@@ -221,17 +229,11 @@ class ValueRoot extends Component {
221
229
  disabled,
222
230
  resolveColor,
223
231
  checked: commonControlProps.checked,
224
- ...propsWithoutChildren
232
+ ...radioMarkProps,
233
+ ...currentValue !== void 0 && tag !== "label" ? {
234
+ onClick: callAllEventHandlers(onClick, this.bindHandlerChange(inputValue))
235
+ } : {}
225
236
  };
226
- if (currentValue !== void 0) {
227
- const {
228
- onClick
229
- } = this.props;
230
- if (tag !== "label") {
231
- markProps.onClick = callAllEventHandlers(onClick, this.bindHandlerChange(inputValue));
232
- }
233
- }
234
- return markProps;
235
237
  }
236
238
  componentDidUpdate() {
237
239
  if (this.asProps.rootDisabled !== this.asProps.disabled) {
@@ -262,7 +264,7 @@ _defineProperty(ValueRoot, "defaultProps", {
262
264
  });
263
265
  _defineProperty(ValueRoot, "enhance", [resolveColorEnhance()]);
264
266
  _defineProperty(ValueRoot, "displayName", "Value");
265
- _defineProperty(ValueRoot, "contextType", RadioGroup[CONTEXT_COMPONENT]);
267
+ _defineProperty(ValueRoot, "contextType", RadioContext);
266
268
  _defineProperty(ValueRoot, "style", style);
267
269
  function Control(props) {
268
270
  var _ref3 = arguments[0], _ref9;
package/lib/esm/index.mjs CHANGED
@@ -1,8 +1,6 @@
1
1
  import { RadioGroup, default as default2, wrapRadioGroup } from "./Radio.mjs";
2
- import { inputProps } from "@semcore/core/lib/utils/inputProps";
3
2
  export {
4
3
  RadioGroup,
5
4
  default2 as default,
6
- inputProps,
7
5
  wrapRadioGroup
8
6
  };