@semcore/radio 17.0.0 → 17.0.2-prerelease.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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
+ ## [17.0.2] - 2026-04-29
6
+
7
+ ### Fixed
8
+
9
+ - Deprecated atomic types. Atomic types are part of `NSRadio` namespace.
10
+
11
+ ## [17.0.1] - 2026-04-16
12
+
13
+ ### Fixed
14
+
15
+ - Build processing to correct extract styles.
16
+
5
17
  ## [17.0.0] - 2026-04-15
6
18
 
7
19
  ### BREAK
package/lib/cjs/Radio.js CHANGED
@@ -24,23 +24,23 @@ var _useColorResolver = require("@semcore/core/lib/utils/use/useColorResolver");
24
24
  var _typography = require("@semcore/typography");
25
25
  var _react = _interopRequireDefault(require("react"));
26
26
  /*!__reshadow-styles__:"./style/radio.shadow.css"*/
27
- const style = (/*__reshadow_css_start__*/_core.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_"),
27
+ const style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SRadio_1r6as_gg_{display:inline-flex;align-items:flex-start;cursor:pointer}.___SRadio_1r6as_gg_ .___SText_1r6as_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);color:var(--intergalactic-text-primary, #191b23)}.___SRadio_1r6as_gg_ .___SText_1r6as_gg_.__color_1r6as_gg_{color:var(--color_1r6as)}.___SRadio_1r6as_gg_.__disabled_1r6as_gg_{pointer-events:none}.___SValue_1r6as_gg_{position:relative;flex-shrink:0;padding:0;outline:0;z-index:0;margin-top:var(--intergalactic-spacing-05x, 2px)}.___SValue_1r6as_gg_::after,.___SValue_1r6as_gg_::before{content:\"\";position:absolute;right:0;bottom:0;border-radius:50%;background:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SValue_1r6as_gg_::before{top:0;left:0;border:1px solid;transition:calc(var(--intergalactic-duration-control, 200)*1ms) all ease-in-out}.___SValue_1r6as_gg_::after{top:50%;left:50%;transform:translate(-50%,-50%);width:0;height:0}.___SValue_1r6as_gg_.__disabled_1r6as_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_1r6as_gg_._size_m_1r6as_gg_{width:16px;height:16px}.___SValue_1r6as_gg_._size_m_1r6as_gg_ .___SInvalidPattern_1r6as_gg_:before{width:14px;height:14px}.___SValue_1r6as_gg_._size_l_1r6as_gg_{width:20px;height:20px}.___SValue_1r6as_gg_._size_l_1r6as_gg_ .___SInvalidPattern_1r6as_gg_:before{width:18px;height:18px}.___SValue_1r6as_gg_._state_normal_1r6as_gg_::before{border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SValue_1r6as_gg_._state_invalid_1r6as_gg_::before{border-color:var(--intergalactic-border-critical-active, #d1002f)}.___SControl_1r6as_gg_{position:absolute;clip:rect(1px,1px,1px,1px)}.___SControl_1r6as_gg_:checked~.___SValue_1r6as_gg_._size_m_1r6as_gg_::after{width:6px;height:6px}.___SControl_1r6as_gg_:checked~.___SValue_1r6as_gg_._size_l_1r6as_gg_::after{width:8px;height:8px}.___SControl_1r6as_gg_:focus-visible+.___SValue_1r6as_gg_._state_normal_1r6as_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_1r6as_gg_:checked:focus-visible~.___SValue_1r6as_gg_::before,.___SControl_1r6as_gg_:checked~.___SValue_1r6as_gg_::before{border-color:var(--intergalactic-control-primary-info, #008ff8);background-color:var(--intergalactic-control-primary-info, #008ff8)}.___SControl_1r6as_gg_:focus-visible+.___SValue_1r6as_gg_._state_invalid_1r6as_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_1r6as_gg_:checked~.___SValue_1r6as_gg_.__theme_1r6as_gg_::before{border-color:var(--theme_1r6as);background-color:var(--theme_1r6as)}.___SValue_1r6as_gg_._state_normal_1r6as_gg_.__theme_1r6as_gg_::before{border-color:var(--theme_1r6as)}.___SInvalidPattern_1r6as_gg_{background:0 0;overflow:hidden}.___SInvalidPattern_1r6as_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__*/"1r6as_gg_"),
28
28
  /*__reshadow_css_end__*/
29
29
  {
30
- "__SRadio": "___SRadio_1ifzo_gg_",
31
- "_disabled": "__disabled_1ifzo_gg_",
32
- "__SValue": "___SValue_1ifzo_gg_",
33
- "_state_normal": "_state_normal_1ifzo_gg_",
34
- "_state_invalid": "_state_invalid_1ifzo_gg_",
35
- "__SControl": "___SControl_1ifzo_gg_",
36
- "_size_m": "_size_m_1ifzo_gg_",
37
- "_size_l": "_size_l_1ifzo_gg_",
38
- "_theme": "__theme_1ifzo_gg_",
39
- "--theme": "--theme_1ifzo",
40
- "__SText": "___SText_1ifzo_gg_",
41
- "_color": "__color_1ifzo_gg_",
42
- "--color": "--color_1ifzo",
43
- "__SInvalidPattern": "___SInvalidPattern_1ifzo_gg_"
30
+ "__SRadio": "___SRadio_1r6as_gg_",
31
+ "_disabled": "__disabled_1r6as_gg_",
32
+ "__SValue": "___SValue_1r6as_gg_",
33
+ "_state_normal": "_state_normal_1r6as_gg_",
34
+ "_state_invalid": "_state_invalid_1r6as_gg_",
35
+ "__SControl": "___SControl_1r6as_gg_",
36
+ "_size_m": "_size_m_1r6as_gg_",
37
+ "_size_l": "_size_l_1r6as_gg_",
38
+ "_theme": "__theme_1r6as_gg_",
39
+ "--theme": "--theme_1r6as",
40
+ "__SText": "___SText_1r6as_gg_",
41
+ "_color": "__color_1r6as_gg_",
42
+ "--color": "--color_1r6as",
43
+ "__SInvalidPattern": "___SInvalidPattern_1r6as_gg_"
44
44
  });
45
45
  const RadioContext = /*#__PURE__*/_react.default.createContext({});
46
46
  class RadioGroupRoot extends _core.Component {
@@ -291,7 +291,6 @@ function Control(props) {
291
291
  }, _ref3)
292
292
  }));
293
293
  }
294
- ;
295
294
  Control.displayName = 'Control';
296
295
  function RadioMark(props) {
297
296
  var _ref4 = arguments[0],
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.js","names":["_core","require","_baseComponents","_assignProps6","_resolveColorEnhance","_interopRequireDefault","_inputProps","_interopRequireWildcard","_logger","_useColorResolver","_typography","_react","style","sstyled","insert","RadioContext","React","createContext","RadioGroupRoot","Component","uncontrolledProps","value","setContext","theme","size","name","onChange","disabled","asProps","render","_ref","Children","default","createElement","Flex","assignProps","_defineProperty2","defaultValue","RadioGroup","exports","createComponent","context","RadioRoot","constructor","args","hoistedDisabled","undefined","logger","warn","setState","getTextProps","label","state","textProps","children","hoistDisabled","rootDisabled","props","getValueProps","checked","_ref2","_ref6","SRadio","Box","styles","hasChildren","cn","Fragment","Radio","Value","Text","ValueRoot","e","target","getControlProps","currentValue","forwardRef","includeInputProps","commonControlProps","getInputProps","inputValue","ref","callAllEventHandlers","bindHandlerChange","getRadioMarkProps","keyboardFocused","tag","resolveColor","other","onClick","radioMarkProps","componentDidUpdate","componentDidMount","_ref8","_ref7","Control","RadioMark","inputProps","defaultChecked","resolveColorEnhance","_ref3","arguments[0]","_ref9","SControl","displayName","_ref4","_ref0","SValue","SInvalidPattern","InvalidStateBox","_ref5","_ref1","SText","TypographyText","color","useEffect","useColorResolver","wrapRadioGroup","wrapper","_default"],"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 IntergalacticR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C;EACF,CAAC,EAAE,CAAC8B,KAAK,CAACD,YAAY,EAAEC,KAAK,CAAC9B,QAAQ,EAAE8B,KAAK,CAACF,aAAa,CAAC,CAAC;EAC7D,MAAMgC,YAAY,GAAG,IAAA6B,kCAAgB,EAAC,CAAC;EAEvC,OAAAL,KAAA,GAAO,IAAAlG,aAAO,EAACmD,MAAM,CAAC,eACpBrD,MAAA,CAAAqB,OAAA,CAAAC,aAAA,CAAC+E,KAAK,EAAAD,KAAA,CAAA7C,EAAA;IAAA,OAAAlE,KAAA,CAAAmC,WAAA;MAAA,OAA6B,MAAM;MAAA,aAAYoD,YAAY,CAAC2B,KAAK;IAAC,GAAAJ,KAAA;EAAA,EAAG,CAAC;AAEhF;AACAxC,IAAI,CAACkC,WAAW,GAAG,MAAM;AAEzB,MAAMnC,KAAK,GAAG,IAAA7B,qBAAe,EAAC+B,SAAS,EAAE;EACvCwB,OAAO;EACPC;AACF,CAAC,CAAwB;AAEzB,MAAM5B,KAAK,GAAG,IAAA5B,qBAAe,EAACE,SAAS,EAAE;EACvC4B,IAAI;EACJD;AACF,CAAC,CAAmB;AAEb,MAAMgD,cAAc,GAA+BC,OAKtC,IAAKA,OAA2D;AAAC/E,OAAA,CAAA8E,cAAA,GAAAA,cAAA;AAAA,IAAAE,QAAA,GAAAhF,OAAA,CAAAP,OAAA,GAItEoC,KAAK","ignoreList":[]}
1
+ {"version":3,"file":"Radio.js","names":["_core","require","_baseComponents","_assignProps6","_resolveColorEnhance","_interopRequireDefault","_inputProps","_interopRequireWildcard","_logger","_useColorResolver","_typography","_react","style","sstyled","insert","RadioContext","React","createContext","RadioGroupRoot","Component","uncontrolledProps","value","setContext","theme","size","name","onChange","disabled","asProps","render","_ref","Children","default","createElement","Flex","assignProps","_defineProperty2","defaultValue","RadioGroup","exports","createComponent","context","RadioRoot","constructor","args","hoistedDisabled","undefined","logger","warn","setState","getTextProps","label","state","textProps","children","hoistDisabled","rootDisabled","props","getValueProps","checked","_ref2","_ref6","SRadio","Box","styles","hasChildren","cn","Fragment","Radio","Value","Text","ValueRoot","e","target","getControlProps","currentValue","forwardRef","includeInputProps","commonControlProps","getInputProps","inputValue","ref","callAllEventHandlers","bindHandlerChange","getRadioMarkProps","keyboardFocused","tag","resolveColor","other","onClick","radioMarkProps","componentDidUpdate","componentDidMount","_ref8","_ref7","Control","RadioMark","inputProps","defaultChecked","resolveColorEnhance","_ref3","arguments[0]","_ref9","SControl","displayName","_ref4","_ref0","SValue","SInvalidPattern","InvalidStateBox","_ref5","_ref1","SText","TypographyText","color","useEffect","useColorResolver","wrapRadioGroup","wrapper","_default"],"sources":["../../src/Radio.tsx"],"sourcesContent":["import { Flex, Box, InvalidStateBox } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport getInputProps, { inputProps } from '@semcore/core/lib/utils/inputProps';\nimport logger from '@semcore/core/lib/utils/logger';\nimport { useColorResolver } from '@semcore/core/lib/utils/use/useColorResolver';\nimport { Text as TypographyText } from '@semcore/typography';\nimport React from 'react';\n\nimport type { NSRadio } from './Radio.type';\nimport style from './style/radio.shadow.css';\n\nconst RadioContext = React.createContext<{\n onChange?: NSRadio.Group.Props['onChange'];\n value?: NSRadio.Group.Props['value'];\n theme?: NSRadio.Group.Props['theme'];\n size?: NSRadio.Group.Props['size'];\n name?: NSRadio.Group.Props['name'];\n disabled?: NSRadio.Group.Props['disabled'];\n}>({});\n\nclass RadioGroupRoot extends Component<\n Intergalactic.InternalTypings.InferComponentProps<NSRadio.Group.Component>,\n [],\n { value: null }\n> {\n static displayName = 'RadioGroup';\n\n static defaultProps = {\n defaultValue: null,\n };\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n setContext() {\n const { theme, size, name, value, onChange, disabled } = this.asProps;\n\n return {\n onChange,\n value,\n theme,\n size,\n name,\n disabled,\n };\n }\n\n render() {\n const { Children } = this.asProps;\n\n return (\n <Root render={Flex} direction='column' role='group' __excludeProps={['onChange']}>\n <Children />\n </Root>\n );\n }\n}\n\nconst RadioGroup = createComponent(RadioGroupRoot, {}, { context: RadioContext }) as unknown as NSRadio.Group.Component;\n\nclass RadioRoot extends Component<Intergalactic.InternalTypings.InferComponentProps<NSRadio.Component>> {\n static displayName = 'Radio';\n static style = style;\n static contextType = RadioContext;\n\n context: React.ContextType<typeof RadioContext> = {};\n\n state = {\n hoistedDisabled: undefined,\n };\n\n hoistDisabled = (disabled: NSRadio.Props['disabled']) => {\n logger.warn(\n true,\n `Don't set disabled on Radio.Value or Radio.Text, set it on Radio or on RadioGroup (for all items) instead. Otherwise it will produce wrong SSR output.`,\n this.asProps['data-ui-name'],\n );\n this.setState({ hoistedDisabled: disabled });\n };\n\n getTextProps() {\n const { size = this.context.size ?? 'm', disabled = this.context.disabled, label } = this.asProps;\n\n const { hoistedDisabled } = this.state;\n\n const textProps = {\n size: size === 'm' ? 200 : 300,\n children: label,\n disabled: disabled ?? hoistedDisabled,\n hoistDisabled: this.hoistDisabled,\n rootDisabled: this.props.disabled,\n };\n\n return textProps;\n }\n\n getValueProps() {\n const {\n state = 'normal',\n size = this.context.size ?? 'm',\n theme = this.context.theme,\n disabled = this.context.disabled,\n name = this.context.name,\n } = this.asProps;\n\n const { value, checked } = this.asProps;\n const { hoistedDisabled } = this.state;\n\n return {\n size: this.props.size ?? size,\n disabled: disabled ?? hoistedDisabled,\n state: state,\n theme,\n value,\n checked,\n name,\n hoistDisabled: this.hoistDisabled,\n rootDisabled: this.props.disabled,\n };\n }\n\n render() {\n const SRadio = Root;\n const { styles, Children, children: hasChildren } = this.asProps;\n\n return sstyled(styles)(\n <SRadio render={Box} tag='label' __excludeProps={['onChange', 'label', 'disabled']}>\n {hasChildren\n ? (\n <Children />\n )\n : (\n <>\n <Radio.Value />\n <Radio.Text />\n </>\n )}\n </SRadio>,\n );\n }\n}\n\nclass ValueRoot extends Component<\n Intergalactic.InternalTypings.InferChildComponentProps<NSRadio.Value.Component, typeof RadioRoot, 'Value'>,\n typeof ValueRoot.enhance,\n { checked: (e: React.ChangeEvent<HTMLInputElement>) => boolean }\n> {\n context: React.ContextType<typeof RadioContext> = {};\n\n static defaultProps = {\n includeInputProps: inputProps,\n defaultChecked: false,\n };\n\n static enhance = [resolveColorEnhance()] as const;\n static displayName = 'Value';\n static contextType = RadioContext;\n static style = style;\n\n bindHandlerChange = (value: NSRadio.Props['value']) => (e: React.ChangeEvent<HTMLInputElement>) => {\n if (typeof this.context.onChange === 'function' && value !== undefined) {\n this.context.onChange(value, e);\n }\n };\n\n uncontrolledProps() {\n return {\n checked: (e: React.ChangeEvent<HTMLInputElement>) => e.target.checked,\n };\n }\n\n getControlProps() {\n const { value: currentValue } = this.context;\n const { forwardRef, includeInputProps, state, value } = this.asProps;\n const { onChange } = this.props;\n\n const [commonControlProps] = getInputProps(this.asProps, includeInputProps);\n const inputValue = value ?? '';\n\n return {\n ref: forwardRef,\n state,\n ...commonControlProps,\n value: inputValue,\n ...(currentValue !== undefined\n ? {\n checked: currentValue === inputValue,\n onChange: callAllEventHandlers(onChange, this.bindHandlerChange(inputValue)),\n }\n : {}),\n };\n }\n\n getRadioMarkProps() {\n const { value: currentValue } = this.context;\n const {\n size,\n state,\n theme,\n keyboardFocused,\n value,\n tag,\n disabled,\n includeInputProps,\n resolveColor,\n children,\n Children,\n ...other\n } = this.asProps;\n const { onClick } = this.props;\n const [commonControlProps, radioMarkProps] = getInputProps(other, includeInputProps);\n const inputValue = value ?? '';\n\n return {\n theme,\n size,\n state,\n keyboardFocused,\n disabled,\n resolveColor,\n checked: commonControlProps.checked,\n ...radioMarkProps,\n ...(currentValue !== undefined && tag !== 'label'\n ? {\n onClick: callAllEventHandlers(onClick, this.bindHandlerChange(inputValue)),\n }\n : {}),\n };\n }\n\n componentDidUpdate() {\n if (this.asProps.rootDisabled !== this.asProps.disabled) {\n this.asProps.hoistDisabled(this.asProps.disabled);\n }\n }\n\n componentDidMount() {\n if (this.asProps.rootDisabled !== this.asProps.disabled) {\n this.asProps.hoistDisabled(this.asProps.disabled);\n }\n }\n\n render() {\n const { styles, children: hasChildren, Children } = this.asProps;\n\n if (!hasChildren) {\n return sstyled(styles)(\n <>\n <Radio.Value.Control />\n <Radio.Value.RadioMark />\n </>,\n );\n }\n\n return sstyled(styles)(<Children />);\n }\n}\n\nfunction Control(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSRadio.Value.Control.Component,\n typeof ValueRoot,\n 'Control'\n >,\n) {\n const SControl = Root;\n const { styles, state } = props;\n\n return sstyled(styles)(<SControl render={Box} tag='input' type='radio' aria-invalid={state === 'invalid'} />);\n}\nControl.displayName = 'Control';\n\nfunction RadioMark(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSRadio.Value.Mark.Component,\n typeof ValueRoot,\n 'RadioMark'\n >,\n) {\n const SValue = Root;\n const SInvalidPattern = InvalidStateBox;\n const { theme, styles, resolveColor, state, checked } = props;\n\n return sstyled(styles)(\n <SValue render={Box} tag='div' use:theme={resolveColor(theme)} aria-hidden={true}>\n {state === 'invalid' && !checked && <SInvalidPattern />}\n </SValue>,\n );\n}\nRadioMark.displayName = 'RadioMark';\n\nfunction Text(\n props: Intergalactic.InternalTypings.InferChildComponentProps<NSRadio.Text.Component, typeof RadioRoot, 'Text'>,\n) {\n const SText = Root;\n const { styles, color } = props;\n\n React.useEffect(() => {\n if (props.rootDisabled !== props.disabled) {\n props.hoistDisabled(props.disabled);\n }\n }, [props.rootDisabled, props.disabled, props.hoistDisabled]);\n const resolveColor = useColorResolver();\n\n return sstyled(styles)(<SText render={TypographyText} tag='span' use:color={resolveColor(color)} />);\n}\nText.displayName = 'Text';\n\nconst Value = createComponent(ValueRoot, {\n Control,\n RadioMark,\n}) as NSRadio.Value.Component;\n\nconst Radio = createComponent(RadioRoot, {\n Text,\n Value,\n}) as NSRadio.Component;\n\nexport const wrapRadioGroup = <PropsExtending extends {}>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<NSRadio.Group.Component>\n > &\n PropsExtending,\n ) => React.ReactNode,\n) => wrapper as NSRadio.Group.Component<PropsExtending>;\n\nexport { inputProps, RadioGroup };\n\nexport default Radio;\n"],"mappings":";;;;;;;;;;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAFA,IAAAC,eAAA,GAAAD,OAAA;AAGA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAC,uBAAA,CAAAN,OAAA;AACA,IAAAO,OAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,iBAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAN,sBAAA,CAAAJ,OAAA;AAA0B;AAAA,MAAAW,KAAA,8BAAAZ,KAAA,CAAAa,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAK1B,MAAMC,YAAY,gBAAGC,cAAK,CAACC,aAAa,CAOrC,CAAC,CAAC,CAAC;AAEN,MAAMC,cAAc,SAASC,eAAS,CAIpC;EAOAC,iBAAiBA,CAAA,EAAG;IAClB,OAAO;MACLC,KAAK,EAAE;IACT,CAAC;EACH;EAEAC,UAAUA,CAAA,EAAG;IACX,MAAM;MAAEC,KAAK;MAAEC,IAAI;MAAEC,IAAI;MAAEJ,KAAK;MAAEK,QAAQ;MAAEC;IAAS,CAAC,GAAG,IAAI,CAACC,OAAO;IAErE,OAAO;MACLF,QAAQ;MACRL,KAAK;MACLE,KAAK;MACLC,IAAI;MACJC,IAAI;MACJE;IACF,CAAC;EACH;EAEAE,MAAMA,CAAA,EAAG;I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,SAAS,CAAC,MAAM;IACpB,IAAI1D,KAAK,CAACD,YAAY,KAAKC,KAAK,CAAC9B,QAAQ,EAAE;MACzC8B,KAAK,CAACF,aAAa,CAACE,KAAK,CAAC9B,QAAQ,CAAC;IACrC;EACF,CAAC,EAAE,CAAC8B,KAAK,CAACD,YAAY,EAAEC,KAAK,CAAC9B,QAAQ,EAAE8B,KAAK,CAACF,aAAa,CAAC,CAAC;EAC7D,MAAMgC,YAAY,GAAG,IAAA6B,kCAAgB,EAAC,CAAC;EAEvC,OAAAL,KAAA,GAAO,IAAAlG,aAAO,EAACmD,MAAM,CAAC,eAACrD,MAAA,CAAAqB,OAAA,CAAAC,aAAA,CAAC+E,KAAK,EAAAD,KAAA,CAAA7C,EAAA;IAAA,OAAAlE,KAAA,CAAAmC,WAAA;MAAA,OAA6B,MAAM;MAAA,aAAYoD,YAAY,CAAC2B,KAAK;IAAC,GAAAJ,KAAA;EAAA,EAAG,CAAC;AACrG;AACAxC,IAAI,CAACkC,WAAW,GAAG,MAAM;AAEzB,MAAMnC,KAAK,GAAG,IAAA7B,qBAAe,EAAC+B,SAAS,EAAE;EACvCwB,OAAO;EACPC;AACF,CAAC,CAA4B;AAE7B,MAAM5B,KAAK,GAAG,IAAA5B,qBAAe,EAACE,SAAS,EAAE;EACvC4B,IAAI;EACJD;AACF,CAAC,CAAsB;AAEhB,MAAMgD,cAAc,GACzBC,OAKoB,IACjBA,OAAkD;AAAC/E,OAAA,CAAA8E,cAAA,GAAAA,cAAA;AAAA,IAAAE,QAAA,GAAAhF,OAAA,CAAAP,OAAA,GAIzCoC,KAAK","ignoreList":[]}
@@ -1 +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":[]}
1
+ {"version":3,"file":"Radio.type.js","names":[],"sources":["../../src/Radio.type.ts"],"sourcesContent":["import type { Flex, BoxProps } from '@semcore/base-components';\nimport type { Intergalactic, PropGetterFn } from '@semcore/core';\nimport type { NSText } from '@semcore/typography';\n\ndeclare namespace NSRadio {\n type Size = 'm' | 'l';\n type State = 'normal' | 'invalid';\n type Value = string | number | boolean;\n type Props = BoxProps & {\n /** Radio item value **/\n value?: NSRadio.Value;\n /** Radio item checked flag **/\n checked?: boolean;\n /**\n * The value displaying the state of the component\n * @default normal\n */\n state?: NSRadio.State;\n /**\n * Radio button size\n * @default m\n **/\n size?: NSRadio.Size;\n /** The theme of the radio button that you can send your color to */\n theme?: string;\n /** Radio item text **/\n label?: string;\n /** Blocks access and changes to the radio item **/\n disabled?: boolean;\n };\n type Ctx = {\n getValueProps: PropGetterFn;\n getTextProps: PropGetterFn;\n };\n namespace Value {\n type Props = BoxProps & {\n /** List of elements that can be put on a hidden input */\n includeInputProps?: string[];\n };\n namespace Control {\n type Props = {};\n type Component = Intergalactic.Component<'input', Props>;\n }\n\n namespace Mark {\n type Props = {};\n type Component = Intergalactic.Component<'input', Props>;\n }\n\n type Component = Intergalactic.Component<'input', Props> & {\n Control: Control.Component;\n RadioMark: Mark.Component;\n };\n }\n\n namespace Text {\n type Props = NSText.Props;\n type Component = Intergalactic.Component<'span', Props>;\n }\n\n namespace Group {\n type Props<T extends NSRadio.Value = NSRadio.Value> = {\n /** Radio group name */\n name?: string;\n /** Active default value */\n defaultValue?: T;\n /** Active value */\n value?: T;\n /** Called when the selected element is changed */\n onChange?:\n | ((value: T, e?: React.SyntheticEvent<HTMLInputElement>) => void)\n | React.Dispatch<React.SetStateAction<T>>;\n /** Radio button size */\n size?: NSRadio.Size;\n /** The theme of the radio button that you can send your color to */\n theme?: string;\n /** Blocks access and changes to the form field */\n disabled?: boolean;\n };\n type Component<PropsExtending = {}> = (<V extends Value, Tag extends Intergalactic.Tag = 'div'>(\n props: Intergalactic.InternalTypings.ComponentProps<Tag, typeof Flex, Props<V>> & PropsExtending,\n ) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<'div', typeof Flex, Props>;\n }\n type Component = Intergalactic.Component<'label', Props, Ctx> & {\n Value: Value.Component;\n Text: Text.Component;\n };\n}\n\n/** @deprecated It will be removed in v18. */\nexport type RadioSize = NSRadio.Size;\n/** @deprecated It will be removed in v18. */\nexport type RadioState = NSRadio.State;\n/** @deprecated It will be removed in v18. */\nexport type RadioValue = NSRadio.Value;\n/** @deprecated It will be removed in v18. */\nexport type RadioProps = NSRadio.Props;\n/** @deprecated It will be removed in v18. */\nexport type RadioGroupProps<T extends RadioValue = RadioValue> = NSRadio.Group.Props<T>;\n/** @deprecated It will be removed in v18. */\nexport type RadioValueProps = NSRadio.Value.Props;\n/** @deprecated It will be removed in v18. */\nexport type RadioCtx = NSRadio.Ctx;\n/** @deprecated It will be removed in v18. */\nexport type RadioValueControlProps = NSRadio.Value.Control.Props;\n/** @deprecated It will be removed in v18. */\nexport type RadioValueMarkProps = NSRadio.Value.Mark.Props;\n\nexport type { NSRadio };\n"],"mappings":"","ignoreList":[]}
package/lib/es6/Radio.js CHANGED
@@ -15,23 +15,23 @@ 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_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_"),
18
+ const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SRadio_1r6as_gg_{display:inline-flex;align-items:flex-start;cursor:pointer}.___SRadio_1r6as_gg_ .___SText_1r6as_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);color:var(--intergalactic-text-primary, #191b23)}.___SRadio_1r6as_gg_ .___SText_1r6as_gg_.__color_1r6as_gg_{color:var(--color_1r6as)}.___SRadio_1r6as_gg_.__disabled_1r6as_gg_{pointer-events:none}.___SValue_1r6as_gg_{position:relative;flex-shrink:0;padding:0;outline:0;z-index:0;margin-top:var(--intergalactic-spacing-05x, 2px)}.___SValue_1r6as_gg_::after,.___SValue_1r6as_gg_::before{content:\"\";position:absolute;right:0;bottom:0;border-radius:50%;background:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SValue_1r6as_gg_::before{top:0;left:0;border:1px solid;transition:calc(var(--intergalactic-duration-control, 200)*1ms) all ease-in-out}.___SValue_1r6as_gg_::after{top:50%;left:50%;transform:translate(-50%,-50%);width:0;height:0}.___SValue_1r6as_gg_.__disabled_1r6as_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_1r6as_gg_._size_m_1r6as_gg_{width:16px;height:16px}.___SValue_1r6as_gg_._size_m_1r6as_gg_ .___SInvalidPattern_1r6as_gg_:before{width:14px;height:14px}.___SValue_1r6as_gg_._size_l_1r6as_gg_{width:20px;height:20px}.___SValue_1r6as_gg_._size_l_1r6as_gg_ .___SInvalidPattern_1r6as_gg_:before{width:18px;height:18px}.___SValue_1r6as_gg_._state_normal_1r6as_gg_::before{border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SValue_1r6as_gg_._state_invalid_1r6as_gg_::before{border-color:var(--intergalactic-border-critical-active, #d1002f)}.___SControl_1r6as_gg_{position:absolute;clip:rect(1px,1px,1px,1px)}.___SControl_1r6as_gg_:checked~.___SValue_1r6as_gg_._size_m_1r6as_gg_::after{width:6px;height:6px}.___SControl_1r6as_gg_:checked~.___SValue_1r6as_gg_._size_l_1r6as_gg_::after{width:8px;height:8px}.___SControl_1r6as_gg_:focus-visible+.___SValue_1r6as_gg_._state_normal_1r6as_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_1r6as_gg_:checked:focus-visible~.___SValue_1r6as_gg_::before,.___SControl_1r6as_gg_:checked~.___SValue_1r6as_gg_::before{border-color:var(--intergalactic-control-primary-info, #008ff8);background-color:var(--intergalactic-control-primary-info, #008ff8)}.___SControl_1r6as_gg_:focus-visible+.___SValue_1r6as_gg_._state_invalid_1r6as_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_1r6as_gg_:checked~.___SValue_1r6as_gg_.__theme_1r6as_gg_::before{border-color:var(--theme_1r6as);background-color:var(--theme_1r6as)}.___SValue_1r6as_gg_._state_normal_1r6as_gg_.__theme_1r6as_gg_::before{border-color:var(--theme_1r6as)}.___SInvalidPattern_1r6as_gg_{background:0 0;overflow:hidden}.___SInvalidPattern_1r6as_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__*/"1r6as_gg_"),
19
19
  /*__reshadow_css_end__*/
20
20
  {
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_"
21
+ "__SRadio": "___SRadio_1r6as_gg_",
22
+ "_disabled": "__disabled_1r6as_gg_",
23
+ "__SValue": "___SValue_1r6as_gg_",
24
+ "_state_normal": "_state_normal_1r6as_gg_",
25
+ "_state_invalid": "_state_invalid_1r6as_gg_",
26
+ "__SControl": "___SControl_1r6as_gg_",
27
+ "_size_m": "_size_m_1r6as_gg_",
28
+ "_size_l": "_size_l_1r6as_gg_",
29
+ "_theme": "__theme_1r6as_gg_",
30
+ "--theme": "--theme_1r6as",
31
+ "__SText": "___SText_1r6as_gg_",
32
+ "_color": "__color_1r6as_gg_",
33
+ "--color": "--color_1r6as",
34
+ "__SInvalidPattern": "___SInvalidPattern_1r6as_gg_"
35
35
  });
36
36
  const RadioContext = /*#__PURE__*/React.createContext({});
37
37
  class RadioGroupRoot extends Component {
@@ -282,7 +282,6 @@ function Control(props) {
282
282
  }, _ref3)
283
283
  }));
284
284
  }
285
- ;
286
285
  Control.displayName = 'Control';
287
286
  function RadioMark(props) {
288
287
  var _ref4 = arguments[0],
@@ -1 +1 @@
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,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;AAe1B,MAAMC,YAAY,gBAAGJ,KAAK,CAACK,aAAa,CAOrC,CAAC,CAAC,CAAC;AAEN,MAAMC,cAAc,SAASjB,SAAS,CAA2G;EAO/IkB,iBAAiBA,CAAA,EAAG;IAClB,OAAO;MACLC,KAAK,EAAE;IACT,CAAC;EACH;EAEAC,UAAUA,CAAA,EAAG;I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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":[]}
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 { NSRadio } from './Radio.type';\nimport style from './style/radio.shadow.css';\n\nconst RadioContext = React.createContext<{\n onChange?: NSRadio.Group.Props['onChange'];\n value?: NSRadio.Group.Props['value'];\n theme?: NSRadio.Group.Props['theme'];\n size?: NSRadio.Group.Props['size'];\n name?: NSRadio.Group.Props['name'];\n disabled?: NSRadio.Group.Props['disabled'];\n}>({});\n\nclass RadioGroupRoot extends Component<\n Intergalactic.InternalTypings.InferComponentProps<NSRadio.Group.Component>,\n [],\n { value: null }\n> {\n static displayName = 'RadioGroup';\n\n static defaultProps = {\n defaultValue: null,\n };\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n setContext() {\n const { theme, size, name, value, onChange, disabled } = this.asProps;\n\n return {\n onChange,\n value,\n theme,\n size,\n name,\n disabled,\n };\n }\n\n render() {\n const { Children } = this.asProps;\n\n return (\n <Root render={Flex} direction='column' role='group' __excludeProps={['onChange']}>\n <Children />\n </Root>\n );\n }\n}\n\nconst RadioGroup = createComponent(RadioGroupRoot, {}, { context: RadioContext }) as unknown as NSRadio.Group.Component;\n\nclass RadioRoot extends Component<Intergalactic.InternalTypings.InferComponentProps<NSRadio.Component>> {\n static displayName = 'Radio';\n static style = style;\n static contextType = RadioContext;\n\n context: React.ContextType<typeof RadioContext> = {};\n\n state = {\n hoistedDisabled: undefined,\n };\n\n hoistDisabled = (disabled: NSRadio.Props['disabled']) => {\n logger.warn(\n true,\n `Don't set disabled on Radio.Value or Radio.Text, set it on Radio or on RadioGroup (for all items) instead. Otherwise it will produce wrong SSR output.`,\n this.asProps['data-ui-name'],\n );\n this.setState({ hoistedDisabled: disabled });\n };\n\n getTextProps() {\n const { size = this.context.size ?? 'm', disabled = this.context.disabled, label } = this.asProps;\n\n const { hoistedDisabled } = this.state;\n\n const textProps = {\n size: size === 'm' ? 200 : 300,\n children: label,\n disabled: disabled ?? hoistedDisabled,\n hoistDisabled: this.hoistDisabled,\n rootDisabled: this.props.disabled,\n };\n\n return textProps;\n }\n\n getValueProps() {\n const {\n state = 'normal',\n size = this.context.size ?? 'm',\n theme = this.context.theme,\n disabled = this.context.disabled,\n name = this.context.name,\n } = this.asProps;\n\n const { value, checked } = this.asProps;\n const { hoistedDisabled } = this.state;\n\n return {\n size: this.props.size ?? size,\n disabled: disabled ?? hoistedDisabled,\n state: state,\n theme,\n value,\n checked,\n name,\n hoistDisabled: this.hoistDisabled,\n rootDisabled: this.props.disabled,\n };\n }\n\n render() {\n const SRadio = Root;\n const { styles, Children, children: hasChildren } = this.asProps;\n\n return sstyled(styles)(\n <SRadio render={Box} tag='label' __excludeProps={['onChange', 'label', 'disabled']}>\n {hasChildren\n ? (\n <Children />\n )\n : (\n <>\n <Radio.Value />\n <Radio.Text />\n </>\n )}\n </SRadio>,\n );\n }\n}\n\nclass ValueRoot extends Component<\n Intergalactic.InternalTypings.InferChildComponentProps<NSRadio.Value.Component, typeof RadioRoot, 'Value'>,\n typeof ValueRoot.enhance,\n { checked: (e: React.ChangeEvent<HTMLInputElement>) => boolean }\n> {\n context: React.ContextType<typeof RadioContext> = {};\n\n static defaultProps = {\n includeInputProps: inputProps,\n defaultChecked: false,\n };\n\n static enhance = [resolveColorEnhance()] as const;\n static displayName = 'Value';\n static contextType = RadioContext;\n static style = style;\n\n bindHandlerChange = (value: NSRadio.Props['value']) => (e: React.ChangeEvent<HTMLInputElement>) => {\n if (typeof this.context.onChange === 'function' && value !== undefined) {\n this.context.onChange(value, e);\n }\n };\n\n uncontrolledProps() {\n return {\n checked: (e: React.ChangeEvent<HTMLInputElement>) => e.target.checked,\n };\n }\n\n getControlProps() {\n const { value: currentValue } = this.context;\n const { forwardRef, includeInputProps, state, value } = this.asProps;\n const { onChange } = this.props;\n\n const [commonControlProps] = getInputProps(this.asProps, includeInputProps);\n const inputValue = value ?? '';\n\n return {\n ref: forwardRef,\n state,\n ...commonControlProps,\n value: inputValue,\n ...(currentValue !== undefined\n ? {\n checked: currentValue === inputValue,\n onChange: callAllEventHandlers(onChange, this.bindHandlerChange(inputValue)),\n }\n : {}),\n };\n }\n\n getRadioMarkProps() {\n const { value: currentValue } = this.context;\n const {\n size,\n state,\n theme,\n keyboardFocused,\n value,\n tag,\n disabled,\n includeInputProps,\n resolveColor,\n children,\n Children,\n ...other\n } = this.asProps;\n const { onClick } = this.props;\n const [commonControlProps, radioMarkProps] = getInputProps(other, includeInputProps);\n const inputValue = value ?? '';\n\n return {\n theme,\n size,\n state,\n keyboardFocused,\n disabled,\n resolveColor,\n checked: commonControlProps.checked,\n ...radioMarkProps,\n ...(currentValue !== undefined && tag !== 'label'\n ? {\n onClick: callAllEventHandlers(onClick, this.bindHandlerChange(inputValue)),\n }\n : {}),\n };\n }\n\n componentDidUpdate() {\n if (this.asProps.rootDisabled !== this.asProps.disabled) {\n this.asProps.hoistDisabled(this.asProps.disabled);\n }\n }\n\n componentDidMount() {\n if (this.asProps.rootDisabled !== this.asProps.disabled) {\n this.asProps.hoistDisabled(this.asProps.disabled);\n }\n }\n\n render() {\n const { styles, children: hasChildren, Children } = this.asProps;\n\n if (!hasChildren) {\n return sstyled(styles)(\n <>\n <Radio.Value.Control />\n <Radio.Value.RadioMark />\n </>,\n );\n }\n\n return sstyled(styles)(<Children />);\n }\n}\n\nfunction Control(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSRadio.Value.Control.Component,\n typeof ValueRoot,\n 'Control'\n >,\n) {\n const SControl = Root;\n const { styles, state } = props;\n\n return sstyled(styles)(<SControl render={Box} tag='input' type='radio' aria-invalid={state === 'invalid'} />);\n}\nControl.displayName = 'Control';\n\nfunction RadioMark(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSRadio.Value.Mark.Component,\n typeof ValueRoot,\n 'RadioMark'\n >,\n) {\n const SValue = Root;\n const SInvalidPattern = InvalidStateBox;\n const { theme, styles, resolveColor, state, checked } = props;\n\n return sstyled(styles)(\n <SValue render={Box} tag='div' use:theme={resolveColor(theme)} aria-hidden={true}>\n {state === 'invalid' && !checked && <SInvalidPattern />}\n </SValue>,\n );\n}\nRadioMark.displayName = 'RadioMark';\n\nfunction Text(\n props: Intergalactic.InternalTypings.InferChildComponentProps<NSRadio.Text.Component, typeof RadioRoot, 'Text'>,\n) {\n const SText = Root;\n const { styles, color } = props;\n\n React.useEffect(() => {\n if (props.rootDisabled !== props.disabled) {\n props.hoistDisabled(props.disabled);\n }\n }, [props.rootDisabled, props.disabled, props.hoistDisabled]);\n const resolveColor = useColorResolver();\n\n return sstyled(styles)(<SText render={TypographyText} tag='span' use:color={resolveColor(color)} />);\n}\nText.displayName = 'Text';\n\nconst Value = createComponent(ValueRoot, {\n Control,\n RadioMark,\n}) as NSRadio.Value.Component;\n\nconst Radio = createComponent(RadioRoot, {\n Text,\n Value,\n}) as NSRadio.Component;\n\nexport const wrapRadioGroup = <PropsExtending extends {}>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<NSRadio.Group.Component>\n > &\n PropsExtending,\n ) => React.ReactNode,\n) => wrapper as NSRadio.Group.Component<PropsExtending>;\n\nexport { inputProps, RadioGroup };\n\nexport default Radio;\n"],"mappings":";;;;;;;AAAA,SAASA,IAAI,EAAEC,GAAG,EAAEC,eAAe,QAAQ,0BAA0B;AAErE,SAASC,eAAe,EAAEC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AACzE,SAASC,oBAAoB,QAAQ,qCAAqC;AAC1E,OAAOC,mBAAmB,MAAM,sDAAsD;AACtF,OAAOC,aAAa,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AAM;IAAE8C,MAAM;IAAE8C;EAAM,CAAC,GAAGpD,KAAK;EAE/BvC,KAAK,CAAC4F,SAAS,CAAC,MAAM;IACpB,IAAIrD,KAAK,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,eAAC7C,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;AACrG;AACA1F,IAAI,CAACoF,WAAW,GAAG,MAAM;AAEzB,MAAM/B,KAAK,GAAG/D,eAAe,CAACgE,SAAS,EAAE;EACvCsB,OAAO;EACPC;AACF,CAAC,CAA4B;AAE7B,MAAMzB,KAAK,GAAG9D,eAAe,CAACqC,SAAS,EAAE;EACvC3B,IAAI;EACJqD;AACF,CAAC,CAAsB;AAEvB,OAAO,MAAM2C,cAAc,GACzBC,OAKoB,IACjBA,OAAkD;AAEvD,SAASpG,UAAU,EAAE4B,UAAU;AAE/B,eAAe2B,KAAK","ignoreList":[]}
@@ -1 +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":[]}
1
+ {"version":3,"file":"Radio.type.js","names":[],"sources":["../../src/Radio.type.ts"],"sourcesContent":["import type { Flex, BoxProps } from '@semcore/base-components';\nimport type { Intergalactic, PropGetterFn } from '@semcore/core';\nimport type { NSText } from '@semcore/typography';\n\ndeclare namespace NSRadio {\n type Size = 'm' | 'l';\n type State = 'normal' | 'invalid';\n type Value = string | number | boolean;\n type Props = BoxProps & {\n /** Radio item value **/\n value?: NSRadio.Value;\n /** Radio item checked flag **/\n checked?: boolean;\n /**\n * The value displaying the state of the component\n * @default normal\n */\n state?: NSRadio.State;\n /**\n * Radio button size\n * @default m\n **/\n size?: NSRadio.Size;\n /** The theme of the radio button that you can send your color to */\n theme?: string;\n /** Radio item text **/\n label?: string;\n /** Blocks access and changes to the radio item **/\n disabled?: boolean;\n };\n type Ctx = {\n getValueProps: PropGetterFn;\n getTextProps: PropGetterFn;\n };\n namespace Value {\n type Props = BoxProps & {\n /** List of elements that can be put on a hidden input */\n includeInputProps?: string[];\n };\n namespace Control {\n type Props = {};\n type Component = Intergalactic.Component<'input', Props>;\n }\n\n namespace Mark {\n type Props = {};\n type Component = Intergalactic.Component<'input', Props>;\n }\n\n type Component = Intergalactic.Component<'input', Props> & {\n Control: Control.Component;\n RadioMark: Mark.Component;\n };\n }\n\n namespace Text {\n type Props = NSText.Props;\n type Component = Intergalactic.Component<'span', Props>;\n }\n\n namespace Group {\n type Props<T extends NSRadio.Value = NSRadio.Value> = {\n /** Radio group name */\n name?: string;\n /** Active default value */\n defaultValue?: T;\n /** Active value */\n value?: T;\n /** Called when the selected element is changed */\n onChange?:\n | ((value: T, e?: React.SyntheticEvent<HTMLInputElement>) => void)\n | React.Dispatch<React.SetStateAction<T>>;\n /** Radio button size */\n size?: NSRadio.Size;\n /** The theme of the radio button that you can send your color to */\n theme?: string;\n /** Blocks access and changes to the form field */\n disabled?: boolean;\n };\n type Component<PropsExtending = {}> = (<V extends Value, Tag extends Intergalactic.Tag = 'div'>(\n props: Intergalactic.InternalTypings.ComponentProps<Tag, typeof Flex, Props<V>> & PropsExtending,\n ) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<'div', typeof Flex, Props>;\n }\n type Component = Intergalactic.Component<'label', Props, Ctx> & {\n Value: Value.Component;\n Text: Text.Component;\n };\n}\n\n/** @deprecated It will be removed in v18. */\nexport type RadioSize = NSRadio.Size;\n/** @deprecated It will be removed in v18. */\nexport type RadioState = NSRadio.State;\n/** @deprecated It will be removed in v18. */\nexport type RadioValue = NSRadio.Value;\n/** @deprecated It will be removed in v18. */\nexport type RadioProps = NSRadio.Props;\n/** @deprecated It will be removed in v18. */\nexport type RadioGroupProps<T extends RadioValue = RadioValue> = NSRadio.Group.Props<T>;\n/** @deprecated It will be removed in v18. */\nexport type RadioValueProps = NSRadio.Value.Props;\n/** @deprecated It will be removed in v18. */\nexport type RadioCtx = NSRadio.Ctx;\n/** @deprecated It will be removed in v18. */\nexport type RadioValueControlProps = NSRadio.Value.Control.Props;\n/** @deprecated It will be removed in v18. */\nexport type RadioValueMarkProps = NSRadio.Value.Mark.Props;\n\nexport type { NSRadio };\n"],"mappings":"","ignoreList":[]}
package/lib/esm/Radio.mjs CHANGED
@@ -9,29 +9,30 @@ import logger from "@semcore/core/lib/utils/logger";
9
9
  import { useColorResolver } from "@semcore/core/lib/utils/use/useColorResolver";
10
10
  import { Text as Text$1 } from "@semcore/typography";
11
11
  import React from "react";
12
+ /*!__reshadow-styles__:"./style/radio.shadow.css"*/
12
13
  const style = (
13
14
  /*__reshadow_css_start__*/
14
15
  (sstyled.insert(
15
16
  /*__inner_css_start__*/
16
- '.___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)}',
17
+ '.___SRadio_1r6as_gg_{display:inline-flex;align-items:flex-start;cursor:pointer}.___SRadio_1r6as_gg_ .___SText_1r6as_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);color:var(--intergalactic-text-primary, #191b23)}.___SRadio_1r6as_gg_ .___SText_1r6as_gg_.__color_1r6as_gg_{color:var(--color_1r6as)}.___SRadio_1r6as_gg_.__disabled_1r6as_gg_{pointer-events:none}.___SValue_1r6as_gg_{position:relative;flex-shrink:0;padding:0;outline:0;z-index:0;margin-top:var(--intergalactic-spacing-05x, 2px)}.___SValue_1r6as_gg_::after,.___SValue_1r6as_gg_::before{content:"";position:absolute;right:0;bottom:0;border-radius:50%;background:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SValue_1r6as_gg_::before{top:0;left:0;border:1px solid;transition:calc(var(--intergalactic-duration-control, 200)*1ms) all ease-in-out}.___SValue_1r6as_gg_::after{top:50%;left:50%;transform:translate(-50%,-50%);width:0;height:0}.___SValue_1r6as_gg_.__disabled_1r6as_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_1r6as_gg_._size_m_1r6as_gg_{width:16px;height:16px}.___SValue_1r6as_gg_._size_m_1r6as_gg_ .___SInvalidPattern_1r6as_gg_:before{width:14px;height:14px}.___SValue_1r6as_gg_._size_l_1r6as_gg_{width:20px;height:20px}.___SValue_1r6as_gg_._size_l_1r6as_gg_ .___SInvalidPattern_1r6as_gg_:before{width:18px;height:18px}.___SValue_1r6as_gg_._state_normal_1r6as_gg_::before{border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SValue_1r6as_gg_._state_invalid_1r6as_gg_::before{border-color:var(--intergalactic-border-critical-active, #d1002f)}.___SControl_1r6as_gg_{position:absolute;clip:rect(1px,1px,1px,1px)}.___SControl_1r6as_gg_:checked~.___SValue_1r6as_gg_._size_m_1r6as_gg_::after{width:6px;height:6px}.___SControl_1r6as_gg_:checked~.___SValue_1r6as_gg_._size_l_1r6as_gg_::after{width:8px;height:8px}.___SControl_1r6as_gg_:focus-visible+.___SValue_1r6as_gg_._state_normal_1r6as_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_1r6as_gg_:checked:focus-visible~.___SValue_1r6as_gg_::before,.___SControl_1r6as_gg_:checked~.___SValue_1r6as_gg_::before{border-color:var(--intergalactic-control-primary-info, #008ff8);background-color:var(--intergalactic-control-primary-info, #008ff8)}.___SControl_1r6as_gg_:focus-visible+.___SValue_1r6as_gg_._state_invalid_1r6as_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_1r6as_gg_:checked~.___SValue_1r6as_gg_.__theme_1r6as_gg_::before{border-color:var(--theme_1r6as);background-color:var(--theme_1r6as)}.___SValue_1r6as_gg_._state_normal_1r6as_gg_.__theme_1r6as_gg_::before{border-color:var(--theme_1r6as)}.___SInvalidPattern_1r6as_gg_{background:0 0;overflow:hidden}.___SInvalidPattern_1r6as_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
18
  /*__inner_css_end__*/
18
- "1ifzo_gg_"
19
+ "1r6as_gg_"
19
20
  ), /*__reshadow_css_end__*/
20
21
  {
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_"
22
+ "__SRadio": "___SRadio_1r6as_gg_",
23
+ "_disabled": "__disabled_1r6as_gg_",
24
+ "__SValue": "___SValue_1r6as_gg_",
25
+ "_state_normal": "_state_normal_1r6as_gg_",
26
+ "_state_invalid": "_state_invalid_1r6as_gg_",
27
+ "__SControl": "___SControl_1r6as_gg_",
28
+ "_size_m": "_size_m_1r6as_gg_",
29
+ "_size_l": "_size_l_1r6as_gg_",
30
+ "_theme": "__theme_1r6as_gg_",
31
+ "--theme": "--theme_1r6as",
32
+ "__SText": "___SText_1r6as_gg_",
33
+ "_color": "__color_1r6as_gg_",
34
+ "--color": "--color_1r6as",
35
+ "__SInvalidPattern": "___SInvalidPattern_1r6as_gg_"
35
36
  })
36
37
  );
37
38
  const RadioContext = /* @__PURE__ */ React.createContext({});
@@ -281,7 +282,6 @@ function Control(props) {
281
282
  }, _ref3)
282
283
  }));
283
284
  }
284
- ;
285
285
  Control.displayName = "Control";
286
286
  function RadioMark(props) {
287
287
  var _ref4 = arguments[0], _ref0;
@@ -1,9 +1,9 @@
1
1
  import type { Intergalactic } from '@semcore/core';
2
2
  import { inputProps } from '@semcore/core/lib/utils/inputProps';
3
3
  import React from 'react';
4
- import type { IntergalacticRadioGroupComponent, RadioComponent } from './Radio.type';
5
- declare const RadioGroup: IntergalacticRadioGroupComponent;
6
- declare const Radio: RadioComponent;
7
- export declare const wrapRadioGroup: <PropsExtending extends {}>(wrapper: (props: Intergalactic.InternalTypings.UntypeRefAndTag<Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticRadioGroupComponent>> & PropsExtending) => React.ReactNode) => IntergalacticRadioGroupComponent<PropsExtending>;
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
8
  export { inputProps, RadioGroup };
9
9
  export default Radio;
@@ -1,69 +1,98 @@
1
- import type { Box, BoxProps, Flex } from '@semcore/base-components';
2
- import type { PropGetterFn, Intergalactic } from '@semcore/core';
3
- import type { Text, TextProps } from '@semcore/typography';
4
- import type React from 'react';
5
- export type RadioSize = 'm' | 'l';
6
- export type RadioState = 'normal' | 'invalid';
7
- export type RadioValue = string | number | boolean;
8
- export type RadioProps = BoxProps & {
9
- /** Radio item value **/
10
- value?: RadioValue;
11
- /** Radio item checked flag **/
12
- checked?: boolean;
13
- /**
14
- * The value displaying the state of the component
15
- * @default normal
16
- */
17
- state?: RadioState;
18
- /**
19
- * Radio button size
20
- * @default m
21
- **/
22
- size?: RadioSize;
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
- export type RadioGroupProps<T extends RadioValue = RadioValue> = {
31
- /** Radio group name */
32
- name?: string;
33
- /** Active default value */
34
- defaultValue?: T;
35
- /** Active value */
36
- value?: T;
37
- /** Called when the selected element is changed */
38
- onChange?: ((value: T, e?: React.SyntheticEvent<HTMLInputElement>) => void) | React.Dispatch<React.SetStateAction<T>>;
39
- /** Radio button size */
40
- size?: RadioSize;
41
- /** The theme of the radio button that you can send your color to */
42
- theme?: string;
43
- /** Blocks access and changes to the form field */
44
- disabled?: boolean;
45
- };
46
- export type RadioValueProps = BoxProps & {
47
- /** List of elements that can be put on a hidden input */
48
- includeInputProps?: string[];
49
- };
50
- export type RadioCtx = {
51
- getValueProps: PropGetterFn;
52
- getTextProps: PropGetterFn;
53
- };
54
- export type IntergalacticRadioGroupComponent<PropsExtending = {}> = (<Value extends RadioValue, Tag extends Intergalactic.Tag = typeof Flex>(props: Intergalactic.InternalTypings.ComponentProps<Tag, typeof Flex, RadioGroupProps<Value>> & PropsExtending) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', typeof Flex, RadioGroupProps>;
55
- export type RadioValueControlProps = {};
56
- export type RadioValueMarkProps = {};
57
- export type RadioTextProps = TextProps;
58
- export type RadioValueControlComponent = Intergalactic.Component<'input', RadioValueControlProps>;
59
- export type RadioValueRadioMarkComponent = Intergalactic.Component<typeof Box, RadioValueMarkProps>;
60
- export type RadioValueComponent = Intergalactic.Component<'input', RadioValueProps> & {
61
- Control: RadioValueControlComponent;
62
- RadioMark: RadioValueRadioMarkComponent;
63
- };
64
- export type RadioTextComponent = typeof Text;
65
- export type RadioRootComponent = Intergalactic.Component<'label', RadioProps, RadioCtx>;
66
- export type RadioComponent = RadioRootComponent & {
67
- Value: RadioValueComponent;
68
- Text: RadioTextComponent;
69
- };
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 };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/radio",
3
3
  "description": "Semrush Radio Component",
4
- "version": "17.0.0",
4
+ "version": "17.0.2-prerelease.0",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -14,10 +14,10 @@
14
14
  "require": "./lib/cjs/index.js"
15
15
  },
16
16
  "dependencies": {
17
- "@semcore/typography": "^17.0.0"
17
+ "@semcore/typography": "^17.0.2-prerelease.0"
18
18
  },
19
19
  "peerDependencies": {
20
- "@semcore/base-components": "^17.0.0 || ^17.0.0-0"
20
+ "@semcore/base-components": "^17.0.2"
21
21
  },
22
22
  "repository": {
23
23
  "type": "git",
@@ -25,9 +25,9 @@
25
25
  "directory": "semcore/radio"
26
26
  },
27
27
  "devDependencies": {
28
+ "@semcore/base-components": "17.0.2-prerelease.0",
28
29
  "@semcore/testing-utils": "1.0.0",
29
- "@semcore/base-components": "17.0.0",
30
- "@semcore/core": "17.0.0"
30
+ "@semcore/core": "17.0.1"
31
31
  },
32
32
  "scripts": {
33
33
  "build": "pnpm semcore-builder && pnpm vite build"