@semcore/radio 17.1.0-prerelease.3 → 17.2.0-prerelease.3
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 +6 -0
- package/lib/cjs/Radio.js +38 -18
- package/lib/cjs/Radio.js.map +1 -1
- package/lib/cjs/Radio.type.js.map +1 -1
- package/lib/es6/Radio.js +38 -18
- package/lib/es6/Radio.js.map +1 -1
- package/lib/es6/Radio.type.js.map +1 -1
- package/lib/esm/Radio.mjs +22 -20
- package/lib/types/Radio.d.ts +11 -1
- package/lib/types/Radio.type.d.ts +10 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
package/lib/cjs/Radio.js
CHANGED
|
@@ -24,29 +24,29 @@ 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__*/".
|
|
27
|
+
const style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SRadio_1pqxj_gg_{display:inline-flex;align-items:flex-start;cursor:pointer}.___SRadio_1pqxj_gg_ .___SText_1pqxj_gg_{margin-left:var(--intergalactic-spacing-2x,8px);color:var(--intergalactic-text-primary,#010500e5)}.___SRadio_1pqxj_gg_ .___SText_1pqxj_gg_.__color_1pqxj_gg_{color:var(--color_1pqxj)}.___SRadio_1pqxj_gg_.__disabled_1pqxj_gg_{pointer-events:none}.___SValue_1pqxj_gg_{position:relative;flex-shrink:0;padding:0;outline:none;z-index:0;margin-top:var(--intergalactic-spacing-05x,2px)}.___SValue_1pqxj_gg_:before{top:0;left:0;border:1px solid;transition:calc(var(--intergalactic-duration-control, 200)*1ms) all ease-in-out}.___SValue_1pqxj_gg_:after,.___SValue_1pqxj_gg_:before{content:\"\";position:absolute;right:0;bottom:0;background:var(--intergalactic-bg-primary-neutral,#fff);border-radius:50%}.___SValue_1pqxj_gg_:after{top:50%;left:50%;transform:translate(-50%,-50%);width:0;height:0}.___SValue_1pqxj_gg_.__disabled_1pqxj_gg_{opacity:var(--intergalactic-disabled-opacity,.4);cursor:default;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SValue_1pqxj_gg_._size_m_1pqxj_gg_{width:16px;height:16px}.___SValue_1pqxj_gg_._size_m_1pqxj_gg_ .___SInvalidPattern_1pqxj_gg_:before{width:14px;height:14px}.___SValue_1pqxj_gg_._size_l_1pqxj_gg_{width:20px;height:20px}.___SValue_1pqxj_gg_._size_l_1pqxj_gg_ .___SInvalidPattern_1pqxj_gg_:before{width:18px;height:18px}.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_:before{border-color:var(--intergalactic-border-primary,#000c0829)}@supports (color:color(display-p3 0 0 0%)){.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_:before{border-color:var(--intergalactic-border-primary,#000c0829)}@media (color-gamut:p3){.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_:before{border-color:var(--intergalactic-border-primary,color(display-p3 .00798 .04498 .03219/.161))}}}.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{border-color:var(--intergalactic-border-critical-active,#ff6364)}@supports (color:color(display-p3 0 0 0%)){.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{border-color:var(--intergalactic-border-critical-active,#ff6364)}@media (color-gamut:p3){.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{border-color:var(--intergalactic-border-critical-active,color(display-p3 .95478 .398 .38923))}}}.___SControl_1pqxj_gg_{position:absolute;clip:rect(1px,1px,1px,1px)}.___SControl_1pqxj_gg_:checked~.___SValue_1pqxj_gg_._size_m_1pqxj_gg_:after{width:6px;height:6px}.___SControl_1pqxj_gg_:checked~.___SValue_1pqxj_gg_._size_l_1pqxj_gg_:after{width:8px;height:8px}.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_:before{border-color:var(--intergalactic-border-info-active,#8796ef);outline-color:var(--intergalactic-keyboard-focus-outline,#0020dd78);outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset}@supports (color:color(display-p3 0 0 0%)){.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_:before{outline-color:var(--intergalactic-keyboard-focus-outline,#0020dd78)}@media (color-gamut:p3){.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_:before{outline-color:var(--intergalactic-keyboard-focus-outline,color(display-p3 .03256 .12227 .83249/.469))}}}.___SControl_1pqxj_gg_:checked:focus-visible~.___SValue_1pqxj_gg_:before,.___SControl_1pqxj_gg_:checked~.___SValue_1pqxj_gg_:before{border-color:var(--intergalactic-control-primary-info,#1a1e1a);background-color:var(--intergalactic-control-primary-info,#1a1e1a)}.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{border-color:var(--intergalactic-border-critical-active,#ff6364);outline-color:var(--intergalactic-keyboard-focus-outline,#0020dd78);outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset}@supports (color:color(display-p3 0 0 0%)){.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{border-color:var(--intergalactic-border-critical-active,#ff6364);outline-color:var(--intergalactic-keyboard-focus-outline,#0020dd78)}@media (color-gamut:p3){.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{border-color:var(--intergalactic-border-critical-active,color(display-p3 .95478 .398 .38923));outline-color:var(--intergalactic-keyboard-focus-outline,color(display-p3 .03256 .12227 .83249/.469))}}}@supports (color:oklab(0% 0 0%)){.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{outline-color:var(--intergalactic-keyboard-focus-invalid-outline,oklch(.628 .257 28.9/.652))}}.___SControl_1pqxj_gg_:checked~.___SValue_1pqxj_gg_.__theme_1pqxj_gg_:before{border-color:var(--theme_1pqxj);background-color:var(--theme_1pqxj)}.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_.__theme_1pqxj_gg_:before{border-color:var(--theme_1pqxj)}.___SInvalidPattern_1pqxj_gg_{background:#0000;overflow:hidden}.___SInvalidPattern_1pqxj_gg_:before{content:\"\";position:absolute;top:1px;left:1px;border-radius:50%;background-image:var(--intergalactic-border-critical-pattern,repeating-linear-gradient(315deg,#ff6364 0,#ff6364 1px,#0000 0,#0000 50%));background-size:6px 6px;background-color:var(--intergalactic-bg-primary-neutral,#fff)}@supports (color:color(display-p3 0 0 0%)){.___SInvalidPattern_1pqxj_gg_:before{background-image:var(--intergalactic-border-critical-pattern,repeating-linear-gradient(315deg,#ff6364 0,#ff6364 1px,#0000 0,#0000 50%))}@media (color-gamut:p3){.___SInvalidPattern_1pqxj_gg_:before{background-image:var(--intergalactic-border-critical-pattern,repeating-linear-gradient(315deg,color(display-p3 .95478 .398 .38923) 0,color(display-p3 .95478 .398 .38923) 1px,#0000 0,#0000 50%))}}}", /*__inner_css_end__*/"1pqxj_gg_"),
|
|
28
28
|
/*__reshadow_css_end__*/
|
|
29
29
|
{
|
|
30
|
-
"__SRadio": "
|
|
31
|
-
"_disabled": "
|
|
32
|
-
"__SValue": "
|
|
33
|
-
"_state_normal": "
|
|
34
|
-
"_state_invalid": "
|
|
35
|
-
"__SControl": "
|
|
36
|
-
"_size_m": "
|
|
37
|
-
"_size_l": "
|
|
38
|
-
"_theme": "
|
|
39
|
-
"--theme": "--
|
|
40
|
-
"__SText": "
|
|
41
|
-
"_color": "
|
|
42
|
-
"--color": "--
|
|
43
|
-
"__SInvalidPattern": "
|
|
30
|
+
"__SRadio": "___SRadio_1pqxj_gg_",
|
|
31
|
+
"_disabled": "__disabled_1pqxj_gg_",
|
|
32
|
+
"__SValue": "___SValue_1pqxj_gg_",
|
|
33
|
+
"_state_normal": "_state_normal_1pqxj_gg_",
|
|
34
|
+
"_state_invalid": "_state_invalid_1pqxj_gg_",
|
|
35
|
+
"__SControl": "___SControl_1pqxj_gg_",
|
|
36
|
+
"_size_m": "_size_m_1pqxj_gg_",
|
|
37
|
+
"_size_l": "_size_l_1pqxj_gg_",
|
|
38
|
+
"_theme": "__theme_1pqxj_gg_",
|
|
39
|
+
"--theme": "--theme_1pqxj",
|
|
40
|
+
"__SText": "___SText_1pqxj_gg_",
|
|
41
|
+
"_color": "__color_1pqxj_gg_",
|
|
42
|
+
"--color": "--color_1pqxj",
|
|
43
|
+
"__SInvalidPattern": "___SInvalidPattern_1pqxj_gg_"
|
|
44
44
|
});
|
|
45
45
|
const RadioContext = /*#__PURE__*/_react.default.createContext({});
|
|
46
46
|
class RadioGroupRoot extends _core.Component {
|
|
47
47
|
uncontrolledProps() {
|
|
48
48
|
return {
|
|
49
|
-
value:
|
|
49
|
+
value: ''
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
setContext() {
|
|
@@ -70,18 +70,26 @@ class RadioGroupRoot extends _core.Component {
|
|
|
70
70
|
render() {
|
|
71
71
|
var _ref = this.asProps;
|
|
72
72
|
const {
|
|
73
|
-
Children
|
|
73
|
+
Children,
|
|
74
|
+
value
|
|
74
75
|
} = this.asProps;
|
|
75
76
|
return /*#__PURE__*/_react.default.createElement(_baseComponents.Flex, (0, _core.assignProps)({
|
|
76
77
|
"direction": 'column',
|
|
77
78
|
"role": 'group',
|
|
79
|
+
"use:value": value || undefined,
|
|
78
80
|
"__excludeProps": ['onChange']
|
|
79
81
|
}, _ref), /*#__PURE__*/_react.default.createElement(Children, null));
|
|
80
82
|
}
|
|
81
83
|
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* RadioGroup
|
|
87
|
+
*
|
|
88
|
+
* {@link https://developer.semrush.com/intergalactic/components/radio/radio-api/|API} | {@link https://developer.semrush.com/intergalactic/components/radio/radio-code/|Examples}
|
|
89
|
+
*/
|
|
82
90
|
(0, _defineProperty2.default)(RadioGroupRoot, "displayName", 'RadioGroup');
|
|
83
91
|
(0, _defineProperty2.default)(RadioGroupRoot, "defaultProps", {
|
|
84
|
-
defaultValue:
|
|
92
|
+
defaultValue: ''
|
|
85
93
|
});
|
|
86
94
|
const RadioGroup = exports.RadioGroup = (0, _core.createComponent)(RadioGroupRoot, {}, {
|
|
87
95
|
context: RadioContext
|
|
@@ -335,10 +343,22 @@ function Text(props) {
|
|
|
335
343
|
}));
|
|
336
344
|
}
|
|
337
345
|
Text.displayName = 'Text';
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Value
|
|
349
|
+
*
|
|
350
|
+
* {@link https://developer.semrush.com/intergalactic/components/radio/radio-api/|API} | {@link https://developer.semrush.com/intergalactic/components/radio/radio-code/|Examples}
|
|
351
|
+
*/
|
|
338
352
|
const Value = (0, _core.createComponent)(ValueRoot, {
|
|
339
353
|
Control,
|
|
340
354
|
RadioMark
|
|
341
355
|
});
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Radio
|
|
359
|
+
*
|
|
360
|
+
* {@link https://developer.semrush.com/intergalactic/components/radio/radio-api/|API} | {@link https://developer.semrush.com/intergalactic/components/radio/radio-code/|Examples}
|
|
361
|
+
*/
|
|
342
362
|
const Radio = (0, _core.createComponent)(RadioRoot, {
|
|
343
363
|
Text,
|
|
344
364
|
Value
|
package/lib/cjs/Radio.js.map
CHANGED
|
@@ -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 { 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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AAP,OAAA,GAIzCoC,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","undefined","_defineProperty2","defaultValue","RadioGroup","exports","createComponent","context","RadioRoot","constructor","args","hoistedDisabled","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: string },\n {},\n {},\n NSRadio.Group.DefaultProps\n> {\n static displayName = 'RadioGroup';\n\n static defaultProps = {\n defaultValue: '',\n } as const;\n\n uncontrolledProps() {\n return {\n value: '',\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, value } = this.asProps;\n\n return (\n <Root render={Flex} direction='column' role='group' use:value={value || undefined} __excludeProps={['onChange']}>\n <Children />\n </Root>\n );\n }\n}\n\n/**\n * RadioGroup\n *\n * {@link https://developer.semrush.com/intergalactic/components/radio/radio-api/|API} | {@link https://developer.semrush.com/intergalactic/components/radio/radio-code/|Examples}\n */\nconst RadioGroup = createComponent<\n NSRadio.Group.Component,\n typeof RadioGroupRoot\n>(RadioGroupRoot, {}, { context: RadioContext });\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 NSRadio.Value.Handlers,\n {},\n {},\n NSRadio.Value.DefaultProps\n> {\n context: React.ContextType<typeof RadioContext> = {};\n\n static defaultProps = {\n includeInputProps: inputProps,\n defaultChecked: false,\n } as const;\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\n/**\n * Value\n *\n * {@link https://developer.semrush.com/intergalactic/components/radio/radio-api/|API} | {@link https://developer.semrush.com/intergalactic/components/radio/radio-code/|Examples}\n */\nconst Value = createComponent<\n NSRadio.Value.Component,\n typeof ValueRoot\n>(ValueRoot, {\n Control,\n RadioMark,\n});\n\n/**\n * Radio\n *\n * {@link https://developer.semrush.com/intergalactic/components/radio/radio-api/|API} | {@link https://developer.semrush.com/intergalactic/components/radio/radio-code/|Examples}\n */\nconst Radio = createComponent<\n NSRadio.Component,\n typeof RadioRoot\n>(RadioRoot, {\n Text,\n Value,\n});\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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AC;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;AACA;AACA;AACA;AACA;AACA,MAAMnC,KAAK,GAAG,IAAA5B,qBAAe,EAG3B8B,SAAS,EAAE;EACXwB,OAAO;EACPC;AACF,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA,MAAM5B,KAAK,GAAG,IAAA3B,qBAAe,EAG3BE,SAAS,EAAE;EACX2B,IAAI;EACJD;AACF,CAAC,CAAC;AAEK,MAAMgD,cAAc,GACzBC,OAKoB,IACjBA,OAAkD;AAAC9E,OAAA,CAAA6E,cAAA,GAAAA,cAAA;AAAA,IAAAE,QAAA,GAAA/E,OAAA,CAAAR,OAAA,GAIzCoC,KAAK","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.type.js","names":[],"sources":["../../src/Radio.type.ts"],"sourcesContent":["import type { Flex, BoxProps } from '@semcore/base-components';\nimport type { Intergalactic, PropGetterFn } from '@semcore/core';\nimport type { NSText } from '@semcore/typography';\n\ndeclare namespace NSRadio {\n type Size = 'm' | 'l';\n type State = 'normal' | 'invalid';\n type Value = string | number | boolean;\n type Props = BoxProps & {\n /** Radio item value **/\n value?: NSRadio.Value;\n /** Radio item checked flag **/\n checked?: boolean;\n /**\n * The value displaying the state of the component\n * @default normal\n */\n state?: NSRadio.State;\n /**\n * Radio button size\n * @default m\n **/\n size?: NSRadio.Size;\n /** The theme of the radio button that you can send your color to */\n theme?: string;\n /** Radio item text **/\n label?: string;\n /** Blocks access and changes to the radio item **/\n disabled?: boolean;\n };\n type Ctx = {\n getValueProps: PropGetterFn;\n getTextProps: PropGetterFn;\n };\n namespace Value {\n type Props = BoxProps & {\n /** List of elements that can be put on a hidden input */\n includeInputProps?: string[];\n };\n namespace Control {\n type Props = {};\n type Component = Intergalactic.Component<'input', Props>;\n }\n\n namespace Mark {\n type Props = {};\n type Component = Intergalactic.Component<'input', Props>;\n }\n\n type Component = Intergalactic.Component<'input', Props> & {\n Control: Control.Component;\n RadioMark: Mark.Component;\n };\n }\n\n namespace Text {\n type Props = NSText.Props;\n type Component = Intergalactic.Component<'span', Props>;\n }\n\n namespace Group {\n type Props<T extends NSRadio.Value = NSRadio.Value> = {\n /** Radio group name */\n name?: string;\n /** Active default value */\n defaultValue?: T;\n /** Active value */\n value?: T;\n /** Called when the selected element is changed */\n onChange?:\n | ((value: T, e?: React.SyntheticEvent<HTMLInputElement>) => void)\n | React.Dispatch<React.SetStateAction<T>>;\n /** Radio button size */\n size?: NSRadio.Size;\n /** The theme of the radio button that you can send your color to */\n theme?: string;\n /** Blocks access and changes to the form field */\n disabled?: boolean;\n };\n type Component<PropsExtending = {}> = (<V extends Value, Tag extends Intergalactic.Tag = 'div'>(\n props: Intergalactic.InternalTypings.ComponentProps<Tag, typeof Flex, Props<V>> & PropsExtending,\n ) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<'div', typeof Flex, Props>;\n }\n type Component = Intergalactic.Component<'label', Props, Ctx> & {\n Value: Value.Component;\n Text: Text.Component;\n };\n}\n\n/** @deprecated It will be removed in v18. */\nexport type RadioSize = NSRadio.Size;\n/** @deprecated It will be removed in v18. */\nexport type RadioState = NSRadio.State;\n/** @deprecated It will be removed in v18. */\nexport type RadioValue = NSRadio.Value;\n/** @deprecated It will be removed in v18. */\nexport type RadioProps = NSRadio.Props;\n/** @deprecated It will be removed in v18. */\nexport type RadioGroupProps<T extends RadioValue = RadioValue> = NSRadio.Group.Props<T>;\n/** @deprecated It will be removed in v18. */\nexport type RadioValueProps = NSRadio.Value.Props;\n/** @deprecated It will be removed in v18. */\nexport type RadioCtx = NSRadio.Ctx;\n/** @deprecated It will be removed in v18. */\nexport type RadioValueControlProps = NSRadio.Value.Control.Props;\n/** @deprecated It will be removed in v18. */\nexport type RadioValueMarkProps = NSRadio.Value.Mark.Props;\n\nexport type { NSRadio };\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"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 Handlers = {\n checked: (e: React.ChangeEvent<HTMLInputElement>) => boolean;\n };\n type Props = BoxProps & {\n /** List of elements that can be put on a hidden input */\n includeInputProps?: string[];\n };\n type DefaultProps = {\n includeInputProps: Props['includeInputProps'];\n defaultChecked: false;\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 DefaultProps = {\n defaultValue: '';\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,29 +15,29 @@ 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__*/".
|
|
18
|
+
const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SRadio_1pqxj_gg_{display:inline-flex;align-items:flex-start;cursor:pointer}.___SRadio_1pqxj_gg_ .___SText_1pqxj_gg_{margin-left:var(--intergalactic-spacing-2x,8px);color:var(--intergalactic-text-primary,#010500e5)}.___SRadio_1pqxj_gg_ .___SText_1pqxj_gg_.__color_1pqxj_gg_{color:var(--color_1pqxj)}.___SRadio_1pqxj_gg_.__disabled_1pqxj_gg_{pointer-events:none}.___SValue_1pqxj_gg_{position:relative;flex-shrink:0;padding:0;outline:none;z-index:0;margin-top:var(--intergalactic-spacing-05x,2px)}.___SValue_1pqxj_gg_:before{top:0;left:0;border:1px solid;transition:calc(var(--intergalactic-duration-control, 200)*1ms) all ease-in-out}.___SValue_1pqxj_gg_:after,.___SValue_1pqxj_gg_:before{content:\"\";position:absolute;right:0;bottom:0;background:var(--intergalactic-bg-primary-neutral,#fff);border-radius:50%}.___SValue_1pqxj_gg_:after{top:50%;left:50%;transform:translate(-50%,-50%);width:0;height:0}.___SValue_1pqxj_gg_.__disabled_1pqxj_gg_{opacity:var(--intergalactic-disabled-opacity,.4);cursor:default;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SValue_1pqxj_gg_._size_m_1pqxj_gg_{width:16px;height:16px}.___SValue_1pqxj_gg_._size_m_1pqxj_gg_ .___SInvalidPattern_1pqxj_gg_:before{width:14px;height:14px}.___SValue_1pqxj_gg_._size_l_1pqxj_gg_{width:20px;height:20px}.___SValue_1pqxj_gg_._size_l_1pqxj_gg_ .___SInvalidPattern_1pqxj_gg_:before{width:18px;height:18px}.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_:before{border-color:var(--intergalactic-border-primary,#000c0829)}@supports (color:color(display-p3 0 0 0%)){.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_:before{border-color:var(--intergalactic-border-primary,#000c0829)}@media (color-gamut:p3){.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_:before{border-color:var(--intergalactic-border-primary,color(display-p3 .00798 .04498 .03219/.161))}}}.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{border-color:var(--intergalactic-border-critical-active,#ff6364)}@supports (color:color(display-p3 0 0 0%)){.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{border-color:var(--intergalactic-border-critical-active,#ff6364)}@media (color-gamut:p3){.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{border-color:var(--intergalactic-border-critical-active,color(display-p3 .95478 .398 .38923))}}}.___SControl_1pqxj_gg_{position:absolute;clip:rect(1px,1px,1px,1px)}.___SControl_1pqxj_gg_:checked~.___SValue_1pqxj_gg_._size_m_1pqxj_gg_:after{width:6px;height:6px}.___SControl_1pqxj_gg_:checked~.___SValue_1pqxj_gg_._size_l_1pqxj_gg_:after{width:8px;height:8px}.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_:before{border-color:var(--intergalactic-border-info-active,#8796ef);outline-color:var(--intergalactic-keyboard-focus-outline,#0020dd78);outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset}@supports (color:color(display-p3 0 0 0%)){.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_:before{outline-color:var(--intergalactic-keyboard-focus-outline,#0020dd78)}@media (color-gamut:p3){.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_:before{outline-color:var(--intergalactic-keyboard-focus-outline,color(display-p3 .03256 .12227 .83249/.469))}}}.___SControl_1pqxj_gg_:checked:focus-visible~.___SValue_1pqxj_gg_:before,.___SControl_1pqxj_gg_:checked~.___SValue_1pqxj_gg_:before{border-color:var(--intergalactic-control-primary-info,#1a1e1a);background-color:var(--intergalactic-control-primary-info,#1a1e1a)}.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{border-color:var(--intergalactic-border-critical-active,#ff6364);outline-color:var(--intergalactic-keyboard-focus-outline,#0020dd78);outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset}@supports (color:color(display-p3 0 0 0%)){.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{border-color:var(--intergalactic-border-critical-active,#ff6364);outline-color:var(--intergalactic-keyboard-focus-outline,#0020dd78)}@media (color-gamut:p3){.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{border-color:var(--intergalactic-border-critical-active,color(display-p3 .95478 .398 .38923));outline-color:var(--intergalactic-keyboard-focus-outline,color(display-p3 .03256 .12227 .83249/.469))}}}@supports (color:oklab(0% 0 0%)){.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{outline-color:var(--intergalactic-keyboard-focus-invalid-outline,oklch(.628 .257 28.9/.652))}}.___SControl_1pqxj_gg_:checked~.___SValue_1pqxj_gg_.__theme_1pqxj_gg_:before{border-color:var(--theme_1pqxj);background-color:var(--theme_1pqxj)}.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_.__theme_1pqxj_gg_:before{border-color:var(--theme_1pqxj)}.___SInvalidPattern_1pqxj_gg_{background:#0000;overflow:hidden}.___SInvalidPattern_1pqxj_gg_:before{content:\"\";position:absolute;top:1px;left:1px;border-radius:50%;background-image:var(--intergalactic-border-critical-pattern,repeating-linear-gradient(315deg,#ff6364 0,#ff6364 1px,#0000 0,#0000 50%));background-size:6px 6px;background-color:var(--intergalactic-bg-primary-neutral,#fff)}@supports (color:color(display-p3 0 0 0%)){.___SInvalidPattern_1pqxj_gg_:before{background-image:var(--intergalactic-border-critical-pattern,repeating-linear-gradient(315deg,#ff6364 0,#ff6364 1px,#0000 0,#0000 50%))}@media (color-gamut:p3){.___SInvalidPattern_1pqxj_gg_:before{background-image:var(--intergalactic-border-critical-pattern,repeating-linear-gradient(315deg,color(display-p3 .95478 .398 .38923) 0,color(display-p3 .95478 .398 .38923) 1px,#0000 0,#0000 50%))}}}", /*__inner_css_end__*/"1pqxj_gg_"),
|
|
19
19
|
/*__reshadow_css_end__*/
|
|
20
20
|
{
|
|
21
|
-
"__SRadio": "
|
|
22
|
-
"_disabled": "
|
|
23
|
-
"__SValue": "
|
|
24
|
-
"_state_normal": "
|
|
25
|
-
"_state_invalid": "
|
|
26
|
-
"__SControl": "
|
|
27
|
-
"_size_m": "
|
|
28
|
-
"_size_l": "
|
|
29
|
-
"_theme": "
|
|
30
|
-
"--theme": "--
|
|
31
|
-
"__SText": "
|
|
32
|
-
"_color": "
|
|
33
|
-
"--color": "--
|
|
34
|
-
"__SInvalidPattern": "
|
|
21
|
+
"__SRadio": "___SRadio_1pqxj_gg_",
|
|
22
|
+
"_disabled": "__disabled_1pqxj_gg_",
|
|
23
|
+
"__SValue": "___SValue_1pqxj_gg_",
|
|
24
|
+
"_state_normal": "_state_normal_1pqxj_gg_",
|
|
25
|
+
"_state_invalid": "_state_invalid_1pqxj_gg_",
|
|
26
|
+
"__SControl": "___SControl_1pqxj_gg_",
|
|
27
|
+
"_size_m": "_size_m_1pqxj_gg_",
|
|
28
|
+
"_size_l": "_size_l_1pqxj_gg_",
|
|
29
|
+
"_theme": "__theme_1pqxj_gg_",
|
|
30
|
+
"--theme": "--theme_1pqxj",
|
|
31
|
+
"__SText": "___SText_1pqxj_gg_",
|
|
32
|
+
"_color": "__color_1pqxj_gg_",
|
|
33
|
+
"--color": "--color_1pqxj",
|
|
34
|
+
"__SInvalidPattern": "___SInvalidPattern_1pqxj_gg_"
|
|
35
35
|
});
|
|
36
36
|
const RadioContext = /*#__PURE__*/React.createContext({});
|
|
37
37
|
class RadioGroupRoot extends Component {
|
|
38
38
|
uncontrolledProps() {
|
|
39
39
|
return {
|
|
40
|
-
value:
|
|
40
|
+
value: ''
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
setContext() {
|
|
@@ -61,18 +61,26 @@ class RadioGroupRoot extends Component {
|
|
|
61
61
|
render() {
|
|
62
62
|
var _ref = this.asProps;
|
|
63
63
|
const {
|
|
64
|
-
Children
|
|
64
|
+
Children,
|
|
65
|
+
value
|
|
65
66
|
} = this.asProps;
|
|
66
67
|
return /*#__PURE__*/React.createElement(Flex, _assignProps({
|
|
67
68
|
"direction": 'column',
|
|
68
69
|
"role": 'group',
|
|
70
|
+
"use:value": value || undefined,
|
|
69
71
|
"__excludeProps": ['onChange']
|
|
70
72
|
}, _ref), /*#__PURE__*/React.createElement(Children, null));
|
|
71
73
|
}
|
|
72
74
|
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* RadioGroup
|
|
78
|
+
*
|
|
79
|
+
* {@link https://developer.semrush.com/intergalactic/components/radio/radio-api/|API} | {@link https://developer.semrush.com/intergalactic/components/radio/radio-code/|Examples}
|
|
80
|
+
*/
|
|
73
81
|
_defineProperty(RadioGroupRoot, "displayName", 'RadioGroup');
|
|
74
82
|
_defineProperty(RadioGroupRoot, "defaultProps", {
|
|
75
|
-
defaultValue:
|
|
83
|
+
defaultValue: ''
|
|
76
84
|
});
|
|
77
85
|
const RadioGroup = createComponent(RadioGroupRoot, {}, {
|
|
78
86
|
context: RadioContext
|
|
@@ -326,10 +334,22 @@ function Text(props) {
|
|
|
326
334
|
}));
|
|
327
335
|
}
|
|
328
336
|
Text.displayName = 'Text';
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Value
|
|
340
|
+
*
|
|
341
|
+
* {@link https://developer.semrush.com/intergalactic/components/radio/radio-api/|API} | {@link https://developer.semrush.com/intergalactic/components/radio/radio-code/|Examples}
|
|
342
|
+
*/
|
|
329
343
|
const Value = createComponent(ValueRoot, {
|
|
330
344
|
Control,
|
|
331
345
|
RadioMark
|
|
332
346
|
});
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Radio
|
|
350
|
+
*
|
|
351
|
+
* {@link https://developer.semrush.com/intergalactic/components/radio/radio-api/|API} | {@link https://developer.semrush.com/intergalactic/components/radio/radio-code/|Examples}
|
|
352
|
+
*/
|
|
333
353
|
const Radio = createComponent(RadioRoot, {
|
|
334
354
|
Text,
|
|
335
355
|
Value
|
package/lib/es6/Radio.js.map
CHANGED
|
@@ -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 { 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,m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EACA,MAAMC,KAAK,GAU2B3F,cAAc;EATpD,MAAM;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
|
+
{"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","undefined","_defineProperty","defaultValue","RadioGroup","context","RadioRoot","constructor","args","hoistedDisabled","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: string },\n {},\n {},\n NSRadio.Group.DefaultProps\n> {\n static displayName = 'RadioGroup';\n\n static defaultProps = {\n defaultValue: '',\n } as const;\n\n uncontrolledProps() {\n return {\n value: '',\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, value } = this.asProps;\n\n return (\n <Root render={Flex} direction='column' role='group' use:value={value || undefined} __excludeProps={['onChange']}>\n <Children />\n </Root>\n );\n }\n}\n\n/**\n * RadioGroup\n *\n * {@link https://developer.semrush.com/intergalactic/components/radio/radio-api/|API} | {@link https://developer.semrush.com/intergalactic/components/radio/radio-code/|Examples}\n */\nconst RadioGroup = createComponent<\n NSRadio.Group.Component,\n typeof RadioGroupRoot\n>(RadioGroupRoot, {}, { context: RadioContext });\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 NSRadio.Value.Handlers,\n {},\n {},\n NSRadio.Value.DefaultProps\n> {\n context: React.ContextType<typeof RadioContext> = {};\n\n static defaultProps = {\n includeInputProps: inputProps,\n defaultChecked: false,\n } as const;\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\n/**\n * Value\n *\n * {@link https://developer.semrush.com/intergalactic/components/radio/radio-api/|API} | {@link https://developer.semrush.com/intergalactic/components/radio/radio-code/|Examples}\n */\nconst Value = createComponent<\n NSRadio.Value.Component,\n typeof ValueRoot\n>(ValueRoot, {\n Control,\n RadioMark,\n});\n\n/**\n * Radio\n *\n * {@link https://developer.semrush.com/intergalactic/components/radio/radio-api/|API} | {@link https://developer.semrush.com/intergalactic/components/radio/radio-code/|Examples}\n */\nconst Radio = createComponent<\n NSRadio.Component,\n typeof RadioRoot\n>(RadioRoot, {\n Text,\n Value,\n});\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,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,Q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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;AACA;AACA;AACA;AACA;AACA,MAAM/B,KAAK,GAAG/D,eAAe,CAG3BgE,SAAS,EAAE;EACXsB,OAAO;EACPC;AACF,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA,MAAMzB,KAAK,GAAG9D,eAAe,CAG3BsC,SAAS,EAAE;EACX5B,IAAI;EACJqD;AACF,CAAC,CAAC;AAEF,OAAO,MAAM2C,cAAc,GACzBC,OAKoB,IACjBA,OAAkD;AAEvD,SAASpG,UAAU,EAAE6B,UAAU;AAE/B,eAAe0B,KAAK","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.type.js","names":[],"sources":["../../src/Radio.type.ts"],"sourcesContent":["import type { Flex, BoxProps } from '@semcore/base-components';\nimport type { Intergalactic, PropGetterFn } from '@semcore/core';\nimport type { NSText } from '@semcore/typography';\n\ndeclare namespace NSRadio {\n type Size = 'm' | 'l';\n type State = 'normal' | 'invalid';\n type Value = string | number | boolean;\n type Props = BoxProps & {\n /** Radio item value **/\n value?: NSRadio.Value;\n /** Radio item checked flag **/\n checked?: boolean;\n /**\n * The value displaying the state of the component\n * @default normal\n */\n state?: NSRadio.State;\n /**\n * Radio button size\n * @default m\n **/\n size?: NSRadio.Size;\n /** The theme of the radio button that you can send your color to */\n theme?: string;\n /** Radio item text **/\n label?: string;\n /** Blocks access and changes to the radio item **/\n disabled?: boolean;\n };\n type Ctx = {\n getValueProps: PropGetterFn;\n getTextProps: PropGetterFn;\n };\n namespace Value {\n type Props = BoxProps & {\n /** List of elements that can be put on a hidden input */\n includeInputProps?: string[];\n };\n namespace Control {\n type Props = {};\n type Component = Intergalactic.Component<'input', Props>;\n }\n\n namespace Mark {\n type Props = {};\n type Component = Intergalactic.Component<'input', Props>;\n }\n\n type Component = Intergalactic.Component<'input', Props> & {\n Control: Control.Component;\n RadioMark: Mark.Component;\n };\n }\n\n namespace Text {\n type Props = NSText.Props;\n type Component = Intergalactic.Component<'span', Props>;\n }\n\n namespace Group {\n type Props<T extends NSRadio.Value = NSRadio.Value> = {\n /** Radio group name */\n name?: string;\n /** Active default value */\n defaultValue?: T;\n /** Active value */\n value?: T;\n /** Called when the selected element is changed */\n onChange?:\n | ((value: T, e?: React.SyntheticEvent<HTMLInputElement>) => void)\n | React.Dispatch<React.SetStateAction<T>>;\n /** Radio button size */\n size?: NSRadio.Size;\n /** The theme of the radio button that you can send your color to */\n theme?: string;\n /** Blocks access and changes to the form field */\n disabled?: boolean;\n };\n type Component<PropsExtending = {}> = (<V extends Value, Tag extends Intergalactic.Tag = 'div'>(\n props: Intergalactic.InternalTypings.ComponentProps<Tag, typeof Flex, Props<V>> & PropsExtending,\n ) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<'div', typeof Flex, Props>;\n }\n type Component = Intergalactic.Component<'label', Props, Ctx> & {\n Value: Value.Component;\n Text: Text.Component;\n };\n}\n\n/** @deprecated It will be removed in v18. */\nexport type RadioSize = NSRadio.Size;\n/** @deprecated It will be removed in v18. */\nexport type RadioState = NSRadio.State;\n/** @deprecated It will be removed in v18. */\nexport type RadioValue = NSRadio.Value;\n/** @deprecated It will be removed in v18. */\nexport type RadioProps = NSRadio.Props;\n/** @deprecated It will be removed in v18. */\nexport type RadioGroupProps<T extends RadioValue = RadioValue> = NSRadio.Group.Props<T>;\n/** @deprecated It will be removed in v18. */\nexport type RadioValueProps = NSRadio.Value.Props;\n/** @deprecated It will be removed in v18. */\nexport type RadioCtx = NSRadio.Ctx;\n/** @deprecated It will be removed in v18. */\nexport type RadioValueControlProps = NSRadio.Value.Control.Props;\n/** @deprecated It will be removed in v18. */\nexport type RadioValueMarkProps = NSRadio.Value.Mark.Props;\n\nexport type { NSRadio };\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"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 Handlers = {\n checked: (e: React.ChangeEvent<HTMLInputElement>) => boolean;\n };\n type Props = BoxProps & {\n /** List of elements that can be put on a hidden input */\n includeInputProps?: string[];\n };\n type DefaultProps = {\n includeInputProps: Props['includeInputProps'];\n defaultChecked: false;\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 DefaultProps = {\n defaultValue: '';\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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { sstyled, Component, assignProps, createComponent } from "@semcore/core";
|
|
3
3
|
import { Flex, Box, InvalidStateBox } from "@semcore/base-components";
|
|
4
4
|
import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
|
|
@@ -14,32 +14,32 @@ const style = (
|
|
|
14
14
|
/*__reshadow_css_start__*/
|
|
15
15
|
(sstyled.insert(
|
|
16
16
|
/*__inner_css_start__*/
|
|
17
|
-
'.
|
|
17
|
+
'.___SRadio_1pqxj_gg_{display:inline-flex;align-items:flex-start;cursor:pointer}.___SRadio_1pqxj_gg_ .___SText_1pqxj_gg_{margin-left:var(--intergalactic-spacing-2x,8px);color:var(--intergalactic-text-primary,#010500e5)}.___SRadio_1pqxj_gg_ .___SText_1pqxj_gg_.__color_1pqxj_gg_{color:var(--color_1pqxj)}.___SRadio_1pqxj_gg_.__disabled_1pqxj_gg_{pointer-events:none}.___SValue_1pqxj_gg_{position:relative;flex-shrink:0;padding:0;outline:none;z-index:0;margin-top:var(--intergalactic-spacing-05x,2px)}.___SValue_1pqxj_gg_:before{top:0;left:0;border:1px solid;transition:calc(var(--intergalactic-duration-control, 200)*1ms) all ease-in-out}.___SValue_1pqxj_gg_:after,.___SValue_1pqxj_gg_:before{content:"";position:absolute;right:0;bottom:0;background:var(--intergalactic-bg-primary-neutral,#fff);border-radius:50%}.___SValue_1pqxj_gg_:after{top:50%;left:50%;transform:translate(-50%,-50%);width:0;height:0}.___SValue_1pqxj_gg_.__disabled_1pqxj_gg_{opacity:var(--intergalactic-disabled-opacity,.4);cursor:default;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SValue_1pqxj_gg_._size_m_1pqxj_gg_{width:16px;height:16px}.___SValue_1pqxj_gg_._size_m_1pqxj_gg_ .___SInvalidPattern_1pqxj_gg_:before{width:14px;height:14px}.___SValue_1pqxj_gg_._size_l_1pqxj_gg_{width:20px;height:20px}.___SValue_1pqxj_gg_._size_l_1pqxj_gg_ .___SInvalidPattern_1pqxj_gg_:before{width:18px;height:18px}.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_:before{border-color:var(--intergalactic-border-primary,#000c0829)}@supports (color:color(display-p3 0 0 0%)){.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_:before{border-color:var(--intergalactic-border-primary,#000c0829)}@media (color-gamut:p3){.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_:before{border-color:var(--intergalactic-border-primary,color(display-p3 .00798 .04498 .03219/.161))}}}.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{border-color:var(--intergalactic-border-critical-active,#ff6364)}@supports (color:color(display-p3 0 0 0%)){.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{border-color:var(--intergalactic-border-critical-active,#ff6364)}@media (color-gamut:p3){.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{border-color:var(--intergalactic-border-critical-active,color(display-p3 .95478 .398 .38923))}}}.___SControl_1pqxj_gg_{position:absolute;clip:rect(1px,1px,1px,1px)}.___SControl_1pqxj_gg_:checked~.___SValue_1pqxj_gg_._size_m_1pqxj_gg_:after{width:6px;height:6px}.___SControl_1pqxj_gg_:checked~.___SValue_1pqxj_gg_._size_l_1pqxj_gg_:after{width:8px;height:8px}.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_:before{border-color:var(--intergalactic-border-info-active,#8796ef);outline-color:var(--intergalactic-keyboard-focus-outline,#0020dd78);outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset}@supports (color:color(display-p3 0 0 0%)){.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_:before{outline-color:var(--intergalactic-keyboard-focus-outline,#0020dd78)}@media (color-gamut:p3){.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_:before{outline-color:var(--intergalactic-keyboard-focus-outline,color(display-p3 .03256 .12227 .83249/.469))}}}.___SControl_1pqxj_gg_:checked:focus-visible~.___SValue_1pqxj_gg_:before,.___SControl_1pqxj_gg_:checked~.___SValue_1pqxj_gg_:before{border-color:var(--intergalactic-control-primary-info,#1a1e1a);background-color:var(--intergalactic-control-primary-info,#1a1e1a)}.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{border-color:var(--intergalactic-border-critical-active,#ff6364);outline-color:var(--intergalactic-keyboard-focus-outline,#0020dd78);outline-style:solid;outline-width:2px;outline-offset:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset}@supports (color:color(display-p3 0 0 0%)){.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{border-color:var(--intergalactic-border-critical-active,#ff6364);outline-color:var(--intergalactic-keyboard-focus-outline,#0020dd78)}@media (color-gamut:p3){.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{border-color:var(--intergalactic-border-critical-active,color(display-p3 .95478 .398 .38923));outline-color:var(--intergalactic-keyboard-focus-outline,color(display-p3 .03256 .12227 .83249/.469))}}}@supports (color:oklab(0% 0 0%)){.___SControl_1pqxj_gg_:focus-visible+.___SValue_1pqxj_gg_._state_invalid_1pqxj_gg_:before{outline-color:var(--intergalactic-keyboard-focus-invalid-outline,oklch(.628 .257 28.9/.652))}}.___SControl_1pqxj_gg_:checked~.___SValue_1pqxj_gg_.__theme_1pqxj_gg_:before{border-color:var(--theme_1pqxj);background-color:var(--theme_1pqxj)}.___SValue_1pqxj_gg_._state_normal_1pqxj_gg_.__theme_1pqxj_gg_:before{border-color:var(--theme_1pqxj)}.___SInvalidPattern_1pqxj_gg_{background:#0000;overflow:hidden}.___SInvalidPattern_1pqxj_gg_:before{content:"";position:absolute;top:1px;left:1px;border-radius:50%;background-image:var(--intergalactic-border-critical-pattern,repeating-linear-gradient(315deg,#ff6364 0,#ff6364 1px,#0000 0,#0000 50%));background-size:6px 6px;background-color:var(--intergalactic-bg-primary-neutral,#fff)}@supports (color:color(display-p3 0 0 0%)){.___SInvalidPattern_1pqxj_gg_:before{background-image:var(--intergalactic-border-critical-pattern,repeating-linear-gradient(315deg,#ff6364 0,#ff6364 1px,#0000 0,#0000 50%))}@media (color-gamut:p3){.___SInvalidPattern_1pqxj_gg_:before{background-image:var(--intergalactic-border-critical-pattern,repeating-linear-gradient(315deg,color(display-p3 .95478 .398 .38923) 0,color(display-p3 .95478 .398 .38923) 1px,#0000 0,#0000 50%))}}}',
|
|
18
18
|
/*__inner_css_end__*/
|
|
19
|
-
"
|
|
19
|
+
"1pqxj_gg_"
|
|
20
20
|
), /*__reshadow_css_end__*/
|
|
21
21
|
{
|
|
22
|
-
"__SRadio": "
|
|
23
|
-
"_disabled": "
|
|
24
|
-
"__SValue": "
|
|
25
|
-
"_state_normal": "
|
|
26
|
-
"_state_invalid": "
|
|
27
|
-
"__SControl": "
|
|
28
|
-
"_size_m": "
|
|
29
|
-
"_size_l": "
|
|
30
|
-
"_theme": "
|
|
31
|
-
"--theme": "--
|
|
32
|
-
"__SText": "
|
|
33
|
-
"_color": "
|
|
34
|
-
"--color": "--
|
|
35
|
-
"__SInvalidPattern": "
|
|
22
|
+
"__SRadio": "___SRadio_1pqxj_gg_",
|
|
23
|
+
"_disabled": "__disabled_1pqxj_gg_",
|
|
24
|
+
"__SValue": "___SValue_1pqxj_gg_",
|
|
25
|
+
"_state_normal": "_state_normal_1pqxj_gg_",
|
|
26
|
+
"_state_invalid": "_state_invalid_1pqxj_gg_",
|
|
27
|
+
"__SControl": "___SControl_1pqxj_gg_",
|
|
28
|
+
"_size_m": "_size_m_1pqxj_gg_",
|
|
29
|
+
"_size_l": "_size_l_1pqxj_gg_",
|
|
30
|
+
"_theme": "__theme_1pqxj_gg_",
|
|
31
|
+
"--theme": "--theme_1pqxj",
|
|
32
|
+
"__SText": "___SText_1pqxj_gg_",
|
|
33
|
+
"_color": "__color_1pqxj_gg_",
|
|
34
|
+
"--color": "--color_1pqxj",
|
|
35
|
+
"__SInvalidPattern": "___SInvalidPattern_1pqxj_gg_"
|
|
36
36
|
})
|
|
37
37
|
);
|
|
38
38
|
const RadioContext = /* @__PURE__ */ React.createContext({});
|
|
39
39
|
class RadioGroupRoot extends Component {
|
|
40
40
|
uncontrolledProps() {
|
|
41
41
|
return {
|
|
42
|
-
value:
|
|
42
|
+
value: ""
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
setContext() {
|
|
@@ -63,18 +63,20 @@ class RadioGroupRoot extends Component {
|
|
|
63
63
|
render() {
|
|
64
64
|
var _ref = this.asProps;
|
|
65
65
|
const {
|
|
66
|
-
Children
|
|
66
|
+
Children,
|
|
67
|
+
value
|
|
67
68
|
} = this.asProps;
|
|
68
69
|
return /* @__PURE__ */ React.createElement(Flex, assignProps({
|
|
69
70
|
"direction": "column",
|
|
70
71
|
"role": "group",
|
|
72
|
+
"use:value": value || void 0,
|
|
71
73
|
"__excludeProps": ["onChange"]
|
|
72
74
|
}, _ref), /* @__PURE__ */ React.createElement(Children, null));
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
_defineProperty(RadioGroupRoot, "displayName", "RadioGroup");
|
|
76
78
|
_defineProperty(RadioGroupRoot, "defaultProps", {
|
|
77
|
-
defaultValue:
|
|
79
|
+
defaultValue: ""
|
|
78
80
|
});
|
|
79
81
|
const RadioGroup = createComponent(RadioGroupRoot, {}, {
|
|
80
82
|
context: RadioContext
|
package/lib/types/Radio.d.ts
CHANGED
|
@@ -2,7 +2,17 @@ import type { Intergalactic } from '@semcore/core';
|
|
|
2
2
|
import { inputProps } from '@semcore/core/lib/utils/inputProps';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import type { NSRadio } from './Radio.type';
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* RadioGroup
|
|
7
|
+
*
|
|
8
|
+
* {@link https://developer.semrush.com/intergalactic/components/radio/radio-api/|API} | {@link https://developer.semrush.com/intergalactic/components/radio/radio-code/|Examples}
|
|
9
|
+
*/
|
|
10
|
+
declare const RadioGroup: NSRadio.Group.Component<{}>;
|
|
11
|
+
/**
|
|
12
|
+
* Radio
|
|
13
|
+
*
|
|
14
|
+
* {@link https://developer.semrush.com/intergalactic/components/radio/radio-api/|API} | {@link https://developer.semrush.com/intergalactic/components/radio/radio-code/|Examples}
|
|
15
|
+
*/
|
|
6
16
|
declare const Radio: NSRadio.Component;
|
|
7
17
|
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
18
|
export { inputProps, RadioGroup };
|
|
@@ -32,10 +32,17 @@ declare namespace NSRadio {
|
|
|
32
32
|
getTextProps: PropGetterFn;
|
|
33
33
|
};
|
|
34
34
|
namespace Value {
|
|
35
|
+
type Handlers = {
|
|
36
|
+
checked: (e: React.ChangeEvent<HTMLInputElement>) => boolean;
|
|
37
|
+
};
|
|
35
38
|
type Props = BoxProps & {
|
|
36
39
|
/** List of elements that can be put on a hidden input */
|
|
37
40
|
includeInputProps?: string[];
|
|
38
41
|
};
|
|
42
|
+
type DefaultProps = {
|
|
43
|
+
includeInputProps: Props['includeInputProps'];
|
|
44
|
+
defaultChecked: false;
|
|
45
|
+
};
|
|
39
46
|
namespace Control {
|
|
40
47
|
type Props = {};
|
|
41
48
|
type Component = Intergalactic.Component<'input', Props>;
|
|
@@ -70,6 +77,9 @@ declare namespace NSRadio {
|
|
|
70
77
|
/** Blocks access and changes to the form field */
|
|
71
78
|
disabled?: boolean;
|
|
72
79
|
};
|
|
80
|
+
type DefaultProps = {
|
|
81
|
+
defaultValue: '';
|
|
82
|
+
};
|
|
73
83
|
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
84
|
}
|
|
75
85
|
type Component = Intergalactic.Component<'label', Props, Ctx> & {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/radio",
|
|
3
3
|
"description": "Semrush Radio Component",
|
|
4
|
-
"version": "17.
|
|
4
|
+
"version": "17.2.0-prerelease.3",
|
|
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.
|
|
17
|
+
"@semcore/typography": "^17.2.0-prerelease.3"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@semcore/base-components": "^17.0
|
|
20
|
+
"@semcore/base-components": "^17.2.0"
|
|
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/core": "17.
|
|
29
|
-
"@semcore/
|
|
30
|
-
"@semcore/
|
|
28
|
+
"@semcore/core": "17.2.0-prerelease.3",
|
|
29
|
+
"@semcore/base-components": "17.2.0-prerelease.3",
|
|
30
|
+
"@semcore/testing-utils": "1.0.0"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "pnpm semcore-builder && pnpm vite build"
|