From 74abe7f4679ee70aff18dc872aa621a0f0489981 Mon Sep 17 00:00:00 2001 From: Slizhevsky Vladislav Date: Wed, 8 Apr 2026 12:02:44 +0200 Subject: [PATCH 1/6] [radio] attempt to use ns instead of atomic types --- semcore/radio/src/Radio.tsx | 105 ++++++------ semcore/radio/src/Radio.type.ts | 162 ++++++++++-------- .../components/radio/docs/Radio.stories.tsx | 2 +- .../examples/additional_props_for_input.tsx | 6 +- .../docs/examples/radiogroup_example.tsx | 6 +- .../radio/tests/examples/radio-props.tsx | 4 +- 6 files changed, 148 insertions(+), 137 deletions(-) diff --git a/semcore/radio/src/Radio.tsx b/semcore/radio/src/Radio.tsx index bbf66d0c84..f49a78784a 100644 --- a/semcore/radio/src/Radio.tsx +++ b/semcore/radio/src/Radio.tsx @@ -9,29 +9,23 @@ import { useColorResolver } from '@semcore/core/lib/utils/use/useColorResolver'; import { Text as TypographyText } from '@semcore/typography'; import React from 'react'; -import type { - IntergalacticRadioGroupComponent, - RadioProps, - RadioComponent, - RadioGroupProps, - RadioValueComponent, - RadioTextComponent, - RadioValueRadioMarkComponent, - RadioRootComponent, - RadioValueControlComponent, -} from './Radio.type'; +import type { NRadio } from './Radio.type'; import style from './style/radio.shadow.css'; const RadioContext = React.createContext<{ - onChange?: RadioGroupProps['onChange']; - value?: RadioGroupProps['value']; - theme?: RadioGroupProps['theme']; - size?: RadioGroupProps['size']; - name?: RadioGroupProps['name']; - disabled?: RadioGroupProps['disabled']; + onChange?: NRadio.Group.Props['onChange']; + value?: NRadio.Group.Props['value']; + theme?: NRadio.Group.Props['theme']; + size?: NRadio.Group.Props['size']; + name?: NRadio.Group.Props['name']; + disabled?: NRadio.Group.Props['disabled']; }>({}); -class RadioGroupRoot extends Component, [], { value: null }> { +class RadioGroupRoot extends Component< + Intergalactic.InternalTypings.InferComponentProps, + [], + { value: null } +> { static displayName = 'RadioGroup'; static defaultProps = { @@ -68,11 +62,9 @@ class RadioGroupRoot extends Component -> { +class RadioRoot extends Component> { static displayName = 'Radio'; static style = style; static contextType = RadioContext; @@ -83,7 +75,7 @@ class RadioRoot extends Component< hoistedDisabled: undefined, }; - hoistDisabled = (disabled: RadioProps['disabled']) => { + hoistDisabled = (disabled: NRadio.Props['disabled']) => { logger.warn( true, `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.`, @@ -93,11 +85,7 @@ class RadioRoot extends Component< }; getTextProps() { - const { - size = this.context.size ?? 'm', - disabled = this.context.disabled, - label, - } = this.asProps; + const { size = this.context.size ?? 'm', disabled = this.context.disabled, label } = this.asProps; const { hoistedDisabled } = this.state; @@ -159,7 +147,7 @@ class RadioRoot extends Component< } class ValueRoot extends Component< - Intergalactic.InternalTypings.InferChildComponentProps, + Intergalactic.InternalTypings.InferChildComponentProps, typeof ValueRoot.enhance, { checked: (e: React.ChangeEvent) => boolean } > { @@ -175,7 +163,7 @@ class ValueRoot extends Component< static contextType = RadioContext; static style = style; - bindHandlerChange = (value: RadioProps['value']) => (e: React.ChangeEvent) => { + bindHandlerChange = (value: NRadio.Props['value']) => (e: React.ChangeEvent) => { if (typeof this.context.onChange === 'function' && value !== undefined) { this.context.onChange(value, e); } @@ -205,8 +193,7 @@ class ValueRoot extends Component< checked: currentValue === inputValue, onChange: callAllEventHandlers(onChange, this.bindHandlerChange(inputValue)), } - : {} - ), + : {}), }; } @@ -243,9 +230,7 @@ class ValueRoot extends Component< ? { onClick: callAllEventHandlers(onClick, this.bindHandlerChange(inputValue)), } - : {} - - ), + : {}), }; } @@ -277,17 +262,27 @@ class ValueRoot extends Component< } } -function Control(props: Intergalactic.InternalTypings.InferChildComponentProps) { +function Control( + props: Intergalactic.InternalTypings.InferChildComponentProps< + NRadio.Value.Control.Component, + typeof ValueRoot, + 'Control' + >, +) { const SControl = Root; const { styles, state } = props; - return sstyled(styles)( - , - ); -}; + return sstyled(styles)(); +} Control.displayName = 'Control'; -function RadioMark(props: Intergalactic.InternalTypings.InferChildComponentProps) { +function RadioMark( + props: Intergalactic.InternalTypings.InferChildComponentProps< + NRadio.Value.Mark.Component, + typeof ValueRoot, + 'RadioMark' + >, +) { const SValue = Root; const SInvalidPattern = InvalidStateBox; const { theme, styles, resolveColor, state, checked } = props; @@ -300,7 +295,9 @@ function RadioMark(props: Intergalactic.InternalTypings.InferChildComponentProps } RadioMark.displayName = 'RadioMark'; -function Text(props: Intergalactic.InternalTypings.InferChildComponentProps) { +function Text( + props: Intergalactic.InternalTypings.InferChildComponentProps, +) { const SText = Root; const { styles, color } = props; @@ -311,28 +308,28 @@ function Text(props: Intergalactic.InternalTypings.InferChildComponentProps, - ); + return sstyled(styles)(); } Text.displayName = 'Text'; const Value = createComponent(ValueRoot, { Control, RadioMark, -}) as RadioValueComponent; +}) as NRadio.Value.Component; const Radio = createComponent(RadioRoot, { Text, Value, -}) as RadioComponent; - -export const wrapRadioGroup = (wrapper: ( - props: Intergalactic.InternalTypings.UntypeRefAndTag< - Intergalactic.InternalTypings.ComponentPropsNesting - > & - PropsExtending, -) => React.ReactNode) => wrapper as IntergalacticRadioGroupComponent; +}) as NRadio.Component; + +export const wrapRadioGroup = ( + wrapper: ( + props: Intergalactic.InternalTypings.UntypeRefAndTag< + Intergalactic.InternalTypings.ComponentPropsNesting + > & + PropsExtending, + ) => React.ReactNode, +) => wrapper as NRadio.Group.Component; export { inputProps, RadioGroup }; diff --git a/semcore/radio/src/Radio.type.ts b/semcore/radio/src/Radio.type.ts index c0beea4dfa..1acb63cef4 100644 --- a/semcore/radio/src/Radio.type.ts +++ b/semcore/radio/src/Radio.type.ts @@ -1,91 +1,105 @@ -import type { Box, BoxProps, Flex } from '@semcore/base-components'; -import type { PropGetterFn, Intergalactic } from '@semcore/core'; -import type { Text, TextProps } from '@semcore/typography'; -import type React from 'react'; +/* eslint-disable @typescript-eslint/no-namespace */ +import type { Flex, Box, BoxProps } from '@semcore/base-components'; +import type { Intergalactic, PropGetterFn } from '@semcore/core'; +import type { TextProps } from '@semcore/typography'; -export type RadioSize = 'm' | 'l'; -export type RadioState = 'normal' | 'invalid'; -export type RadioValue = string | number | boolean; +declare namespace NRadio { + type Size = 'm' | 'l'; + type State = 'normal' | 'invalid'; + type Value = string | number | boolean; -export type RadioProps = BoxProps & { - /** Radio item value **/ - value?: RadioValue; - - /** Radio item checked flag **/ - checked?: boolean; - - /** + export type Props = BoxProps & { + /** Radio item value **/ + value?: Value; + /** Radio item checked flag **/ + checked?: boolean; + /** * The value displaying the state of the component * @default normal */ - state?: RadioState; - /** + state?: State; + /** * Radio button size * @default m **/ - size?: RadioSize; - /** The theme of the radio button that you can send your color to */ - theme?: string; - /** Radio item text **/ - label?: string; - /** Blocks access and changes to the radio item **/ - disabled?: boolean; -}; + size?: Size; + /** The theme of the radio button that you can send your color to */ + theme?: string; + /** Radio item text **/ + label?: string; + /** Blocks access and changes to the radio item **/ + disabled?: boolean; + }; -export type RadioGroupProps = { - /** Radio group name */ - name?: string; - /** Active default value */ - defaultValue?: T; - /** Active value */ - value?: T; - /** Called when the selected element is changed */ - onChange?: - | ((value: T, e?: React.SyntheticEvent) => void) - | React.Dispatch>; - /** Radio button size */ - size?: RadioSize; - /** The theme of the radio button that you can send your color to */ - theme?: string; - /** Blocks access and changes to the form field */ - disabled?: boolean; -}; + export type Ctx = { + getValueProps: PropGetterFn; + getTextProps: PropGetterFn; + }; + + namespace Value { + export type Props = BoxProps & { + /** List of elements that can be put on a hidden input */ + includeInputProps?: string[]; + }; -export type RadioValueProps = BoxProps & { - /** List of elements that can be put on a hidden input */ - includeInputProps?: string[]; -}; + namespace Control { + export type Props = {}; -export type RadioCtx = { - getValueProps: PropGetterFn; - getTextProps: PropGetterFn; -}; + export type Component = Intergalactic.Component<'input', Props>; + } -export type IntergalacticRadioGroupComponent = (< - Value extends RadioValue, - Tag extends Intergalactic.Tag = typeof Flex, ->( - props: Intergalactic.InternalTypings.ComponentProps> & - PropsExtending, -) => Intergalactic.InternalTypings.ComponentRenderingResults) & -Intergalactic.InternalTypings.ComponentAdditive<'div', typeof Flex, RadioGroupProps>; + namespace Mark { + export type Props = {}; -export type RadioValueControlProps = {}; -export type RadioValueMarkProps = {}; -export type RadioTextProps = TextProps; + export type Component = Intergalactic.Component; + } -export type RadioValueControlComponent = Intergalactic.Component<'input', RadioValueControlProps>; -export type RadioValueRadioMarkComponent = Intergalactic.Component; + export type Component = Intergalactic.Component<'input', Props> & { + Control: Control.Component; + RadioMark: Mark.Component; + }; + } -export type RadioValueComponent = Intergalactic.Component<'input', RadioValueProps> & { - Control: RadioValueControlComponent; - RadioMark: RadioValueRadioMarkComponent; -}; + namespace Text { + export type Props = TextProps; + + export type Component = Intergalactic.Component<'span', Props>; + } + + export type Component = Intergalactic.Component<'label', Props, Ctx> & { + Value: Value.Component; + Text: Text.Component; + }; + + namespace Group { + export type Props = { + /** Radio group name */ + name?: string; + /** Active default value */ + defaultValue?: T; + /** Active value */ + value?: T; + /** Called when the selected element is changed */ + onChange?: + | ((value: T, e?: React.SyntheticEvent) => void) + | React.Dispatch>; + /** Radio button size */ + size?: Size; + /** The theme of the radio button that you can send your color to */ + theme?: string; + /** Blocks access and changes to the form field */ + disabled?: boolean; + }; -export type RadioTextComponent = typeof Text; + export type Component = (< + V extends Value, + Tag extends Intergalactic.Tag = 'div', + >( + props: Intergalactic.InternalTypings.ComponentProps> & + PropsExtending, + ) => Intergalactic.InternalTypings.ComponentRenderingResults) & + Intergalactic.InternalTypings.ComponentAdditive<'div', typeof Flex, Props>; + } +} -export type RadioRootComponent = Intergalactic.Component<'label', RadioProps, RadioCtx>; -export type RadioComponent = RadioRootComponent & { - Value: RadioValueComponent; - Text: RadioTextComponent; -}; +export type { NRadio }; diff --git a/stories/components/radio/docs/Radio.stories.tsx b/stories/components/radio/docs/Radio.stories.tsx index 0f170a29e9..12d114bce9 100644 --- a/stories/components/radio/docs/Radio.stories.tsx +++ b/stories/components/radio/docs/Radio.stories.tsx @@ -1,4 +1,4 @@ -import Radio, { RadioGroup } from '@semcore/ui/radio'; +import Radio from '@semcore/ui/radio'; import type { Meta, StoryObj } from '@storybook/react-vite'; import AdditionalPropsInputExample, { defaultAdditionalInputProps } from './examples/additional_props_for_input'; diff --git a/stories/components/radio/docs/examples/additional_props_for_input.tsx b/stories/components/radio/docs/examples/additional_props_for_input.tsx index 87914a4154..01f56a1fea 100644 --- a/stories/components/radio/docs/examples/additional_props_for_input.tsx +++ b/stories/components/radio/docs/examples/additional_props_for_input.tsx @@ -1,8 +1,8 @@ import Radio, { RadioGroup } from '@semcore/ui/radio'; -import type { RadioGroupProps } from '@semcore/ui/radio'; +import type { NRadio } from '@semcore/ui/radio'; import React from 'react'; -const Demo = (props: RadioGroupProps) => { +const Demo = (props: NRadio.Group.Props) => { return ( { ); }; -export const defaultAdditionalInputProps: RadioGroupProps = { +export const defaultAdditionalInputProps: NRadio.Group.Props = { size: 'm', theme: undefined, disabled: false, diff --git a/stories/components/radio/docs/examples/radiogroup_example.tsx b/stories/components/radio/docs/examples/radiogroup_example.tsx index f955be97af..dbcc86832b 100644 --- a/stories/components/radio/docs/examples/radiogroup_example.tsx +++ b/stories/components/radio/docs/examples/radiogroup_example.tsx @@ -1,10 +1,10 @@ import { Flex } from '@semcore/ui/base-components'; import Radio, { RadioGroup } from '@semcore/ui/radio'; -import type { RadioGroupProps } from '@semcore/ui/radio'; +import type { NRadio } from '@semcore/ui/radio'; import { Text } from '@semcore/ui/typography'; import React from 'react'; -const Demo = (props: RadioGroupProps) => { +const Demo = (props: NRadio.Group.Props) => { const [value, setValue] = React.useState('1'); return (
@@ -31,7 +31,7 @@ const Demo = (props: RadioGroupProps) => { ); }; -export const defaultProps: RadioGroupProps = { +export const defaultProps: NRadio.Group.Props = { size: 'm', theme: undefined, disabled: false, diff --git a/stories/components/radio/tests/examples/radio-props.tsx b/stories/components/radio/tests/examples/radio-props.tsx index 9714963eb4..27e42413e6 100644 --- a/stories/components/radio/tests/examples/radio-props.tsx +++ b/stories/components/radio/tests/examples/radio-props.tsx @@ -1,9 +1,9 @@ import { Flex } from '@semcore/ui/base-components'; import Radio from '@semcore/ui/radio'; -import type { RadioProps } from '@semcore/ui/radio'; +import type { NRadio } from '@semcore/ui/radio'; import React from 'react'; -type ExampleProps = RadioProps & { +type ExampleProps = NRadio.Props & { color?: string; }; From 57cd474b18001e78ddbdd275cdf5020e4f4e16cf Mon Sep 17 00:00:00 2001 From: Slizhevsky Vladislav Date: Wed, 8 Apr 2026 17:17:17 +0200 Subject: [PATCH 2/6] [radio] attempt to use ns instead of atomic types --- semcore/feature-highlight/src/components/radio/Radio.tsx | 4 ++-- .../feature-highlight/src/components/radio/Radio.type.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/semcore/feature-highlight/src/components/radio/Radio.tsx b/semcore/feature-highlight/src/components/radio/Radio.tsx index 92f42e59d2..e2ee9b0750 100644 --- a/semcore/feature-highlight/src/components/radio/Radio.tsx +++ b/semcore/feature-highlight/src/components/radio/Radio.tsx @@ -1,5 +1,5 @@ import { Component, createComponent, Root, sstyled, CONTEXT_COMPONENT } from '@semcore/core'; -import type { RadioProps } from '@semcore/radio'; +import type { NRadio } from '@semcore/radio'; import Radio, { RadioGroup } from '@semcore/radio'; import React from 'react'; @@ -7,7 +7,7 @@ import style from './radio.shadow.css'; import type { HighlightedRadioComponent } from './Radio.type'; import { AnimatedSparkles } from '../../inner-components/sparkle/AnimatedSparkles'; -class RadioFHRoot extends Component { +class RadioFHRoot extends Component { static displayName = 'RadioFH'; static style = style; // @ts-ignore diff --git a/semcore/feature-highlight/src/components/radio/Radio.type.ts b/semcore/feature-highlight/src/components/radio/Radio.type.ts index a65f314e2c..6d9cd4a06a 100644 --- a/semcore/feature-highlight/src/components/radio/Radio.type.ts +++ b/semcore/feature-highlight/src/components/radio/Radio.type.ts @@ -1,11 +1,11 @@ import type { Intergalactic } from '@semcore/core'; -import type { RadioCtx, RadioProps, RadioValueProps } from '@semcore/radio'; +import type { NRadio } from '@semcore/radio'; import type { Text } from '@semcore/typography'; import type { AnimatedSparklesProps } from '../../inner-components/sparkle/AnimatedSparkles'; -export type HighlightedRadioComponent = Intergalactic.Component<'label', RadioProps, RadioCtx> & { - Value: Intergalactic.Component<'input', RadioValueProps>; +export type HighlightedRadioComponent = Intergalactic.Component<'label', NRadio.Props, NRadio.Ctx> & { + Value: Intergalactic.Component<'input', NRadio.Value.Props>; Text: typeof Text; AnimatedSparkles: Intergalactic.Component<'div', AnimatedSparklesProps>; }; From da6a15637bee2c773a4bff04095537b1a5932b0c Mon Sep 17 00:00:00 2001 From: Slizhevsky Vladislav Date: Thu, 9 Apr 2026 16:41:19 +0200 Subject: [PATCH 3/6] [radio] return atomic types/deprecate atomic types/update types among the project --- eslint.config.mjs | 7 ++++ playground/entries/Radio.tsx | 4 +- .../src/components/radio/Radio.tsx | 4 +- .../src/components/radio/Radio.type.ts | 6 +-- semcore/radio/src/Radio.tsx | 40 +++++++++---------- semcore/radio/src/Radio.type.ts | 24 +++++++++-- .../tests/examples/radio.tsx | 4 +- .../examples/additional_props_for_input.tsx | 6 +-- .../docs/examples/radiogroup_example.tsx | 6 +-- .../radio/tests/examples/radio-props.tsx | 4 +- 10 files changed, 65 insertions(+), 40 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 46a4208721..db57827354 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -94,6 +94,13 @@ export default defineConfig([ 'no-console': 'error', + '@typescript-eslint/no-namespace': [ + 'error', + { + allowDeclarations: true, + }, + ], + // enable after migration '@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/no-unused-vars': 'off', diff --git a/playground/entries/Radio.tsx b/playground/entries/Radio.tsx index 624e2c272c..5b494eb556 100644 --- a/playground/entries/Radio.tsx +++ b/playground/entries/Radio.tsx @@ -1,4 +1,4 @@ -import type { RadioGroupProps, RadioProps } from '@semcore/ui/radio'; +import type { NSRadio } from '@semcore/ui/radio'; import Radio, { RadioGroup } from '@semcore/ui/radio'; import React from 'react'; @@ -6,7 +6,7 @@ import type { JSXProps } from '../types/JSXProps'; import type { PlaygroundEntry } from '../types/Playground'; import createGithubLink from '../utils/createGHLink'; -export type RadioJSXProps = JSXProps; +export type RadioJSXProps = JSXProps; function getJSX(props: RadioJSXProps) { return ( diff --git a/semcore/feature-highlight/src/components/radio/Radio.tsx b/semcore/feature-highlight/src/components/radio/Radio.tsx index e2ee9b0750..ad08e832ce 100644 --- a/semcore/feature-highlight/src/components/radio/Radio.tsx +++ b/semcore/feature-highlight/src/components/radio/Radio.tsx @@ -1,5 +1,5 @@ import { Component, createComponent, Root, sstyled, CONTEXT_COMPONENT } from '@semcore/core'; -import type { NRadio } from '@semcore/radio'; +import type { NSRadio } from '@semcore/radio'; import Radio, { RadioGroup } from '@semcore/radio'; import React from 'react'; @@ -7,7 +7,7 @@ import style from './radio.shadow.css'; import type { HighlightedRadioComponent } from './Radio.type'; import { AnimatedSparkles } from '../../inner-components/sparkle/AnimatedSparkles'; -class RadioFHRoot extends Component { +class RadioFHRoot extends Component { static displayName = 'RadioFH'; static style = style; // @ts-ignore diff --git a/semcore/feature-highlight/src/components/radio/Radio.type.ts b/semcore/feature-highlight/src/components/radio/Radio.type.ts index 6d9cd4a06a..9b395c2d94 100644 --- a/semcore/feature-highlight/src/components/radio/Radio.type.ts +++ b/semcore/feature-highlight/src/components/radio/Radio.type.ts @@ -1,11 +1,11 @@ import type { Intergalactic } from '@semcore/core'; -import type { NRadio } from '@semcore/radio'; +import type { NSRadio } from '@semcore/radio'; import type { Text } from '@semcore/typography'; import type { AnimatedSparklesProps } from '../../inner-components/sparkle/AnimatedSparkles'; -export type HighlightedRadioComponent = Intergalactic.Component<'label', NRadio.Props, NRadio.Ctx> & { - Value: Intergalactic.Component<'input', NRadio.Value.Props>; +export type HighlightedRadioComponent = Intergalactic.Component<'label', NSRadio.Props, NSRadio.Ctx> & { + Value: Intergalactic.Component<'input', NSRadio.Value.Props>; Text: typeof Text; AnimatedSparkles: Intergalactic.Component<'div', AnimatedSparklesProps>; }; diff --git a/semcore/radio/src/Radio.tsx b/semcore/radio/src/Radio.tsx index f49a78784a..abdde146da 100644 --- a/semcore/radio/src/Radio.tsx +++ b/semcore/radio/src/Radio.tsx @@ -9,20 +9,20 @@ import { useColorResolver } from '@semcore/core/lib/utils/use/useColorResolver'; import { Text as TypographyText } from '@semcore/typography'; import React from 'react'; -import type { NRadio } from './Radio.type'; +import type { NSRadio } from './Radio.type'; import style from './style/radio.shadow.css'; const RadioContext = React.createContext<{ - onChange?: NRadio.Group.Props['onChange']; - value?: NRadio.Group.Props['value']; - theme?: NRadio.Group.Props['theme']; - size?: NRadio.Group.Props['size']; - name?: NRadio.Group.Props['name']; - disabled?: NRadio.Group.Props['disabled']; + onChange?: NSRadio.Group.Props['onChange']; + value?: NSRadio.Group.Props['value']; + theme?: NSRadio.Group.Props['theme']; + size?: NSRadio.Group.Props['size']; + name?: NSRadio.Group.Props['name']; + disabled?: NSRadio.Group.Props['disabled']; }>({}); class RadioGroupRoot extends Component< - Intergalactic.InternalTypings.InferComponentProps, + Intergalactic.InternalTypings.InferComponentProps, [], { value: null } > { @@ -62,9 +62,9 @@ class RadioGroupRoot extends Component< } } -const RadioGroup = createComponent(RadioGroupRoot, {}, { context: RadioContext }) as unknown as NRadio.Group.Component; +const RadioGroup = createComponent(RadioGroupRoot, {}, { context: RadioContext }) as unknown as NSRadio.Group.Component; -class RadioRoot extends Component> { +class RadioRoot extends Component> { static displayName = 'Radio'; static style = style; static contextType = RadioContext; @@ -75,7 +75,7 @@ class RadioRoot extends Component { + hoistDisabled = (disabled: NSRadio.Props['disabled']) => { logger.warn( true, `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.`, @@ -147,7 +147,7 @@ class RadioRoot extends Component, + Intergalactic.InternalTypings.InferChildComponentProps, typeof ValueRoot.enhance, { checked: (e: React.ChangeEvent) => boolean } > { @@ -163,7 +163,7 @@ class ValueRoot extends Component< static contextType = RadioContext; static style = style; - bindHandlerChange = (value: NRadio.Props['value']) => (e: React.ChangeEvent) => { + bindHandlerChange = (value: NSRadio.Props['value']) => (e: React.ChangeEvent) => { if (typeof this.context.onChange === 'function' && value !== undefined) { this.context.onChange(value, e); } @@ -264,7 +264,7 @@ class ValueRoot extends Component< function Control( props: Intergalactic.InternalTypings.InferChildComponentProps< - NRadio.Value.Control.Component, + NSRadio.Value.Control.Component, typeof ValueRoot, 'Control' >, @@ -278,7 +278,7 @@ Control.displayName = 'Control'; function RadioMark( props: Intergalactic.InternalTypings.InferChildComponentProps< - NRadio.Value.Mark.Component, + NSRadio.Value.Mark.Component, typeof ValueRoot, 'RadioMark' >, @@ -296,7 +296,7 @@ function RadioMark( RadioMark.displayName = 'RadioMark'; function Text( - props: Intergalactic.InternalTypings.InferChildComponentProps, + props: Intergalactic.InternalTypings.InferChildComponentProps, ) { const SText = Root; const { styles, color } = props; @@ -315,21 +315,21 @@ Text.displayName = 'Text'; const Value = createComponent(ValueRoot, { Control, RadioMark, -}) as NRadio.Value.Component; +}) as NSRadio.Value.Component; const Radio = createComponent(RadioRoot, { Text, Value, -}) as NRadio.Component; +}) as NSRadio.Component; export const wrapRadioGroup = ( wrapper: ( props: Intergalactic.InternalTypings.UntypeRefAndTag< - Intergalactic.InternalTypings.ComponentPropsNesting + Intergalactic.InternalTypings.ComponentPropsNesting > & PropsExtending, ) => React.ReactNode, -) => wrapper as NRadio.Group.Component; +) => wrapper as NSRadio.Group.Component; export { inputProps, RadioGroup }; diff --git a/semcore/radio/src/Radio.type.ts b/semcore/radio/src/Radio.type.ts index 1acb63cef4..0017ade6e2 100644 --- a/semcore/radio/src/Radio.type.ts +++ b/semcore/radio/src/Radio.type.ts @@ -1,9 +1,8 @@ -/* eslint-disable @typescript-eslint/no-namespace */ import type { Flex, Box, BoxProps } from '@semcore/base-components'; import type { Intergalactic, PropGetterFn } from '@semcore/core'; import type { TextProps } from '@semcore/typography'; -declare namespace NRadio { +declare namespace NSRadio { type Size = 'm' | 'l'; type State = 'normal' | 'invalid'; type Value = string | number | boolean; @@ -102,4 +101,23 @@ declare namespace NRadio { } } -export type { NRadio }; +/** @deprecated It will be removed in v18. */ +export type RadioSize = NSRadio.Size; +/** @deprecated It will be removed in v18. */ +export type RadioState = NSRadio.State; +/** @deprecated It will be removed in v18. */ +export type RadioValue = NSRadio.Value; +/** @deprecated It will be removed in v18. */ +export type RadioProps = NSRadio.Props; +/** @deprecated It will be removed in v18. */ +export type RadioGroupProps = NSRadio.Group.Props; +/** @deprecated It will be removed in v18. */ +export type RadioValueProps = NSRadio.Value.Props; +/** @deprecated It will be removed in v18. */ +export type RadioCtx = NSRadio.Ctx; +/** @deprecated It will be removed in v18. */ +export type RadioValueControlProps = NSRadio.Value.Control.Props; +/** @deprecated It will be removed in v18. */ +export type RadioValueMarkProps = NSRadio.Value.Mark.Props; + +export type { NSRadio }; diff --git a/stories/components/feature-highlight/tests/examples/radio.tsx b/stories/components/feature-highlight/tests/examples/radio.tsx index 69c7587c7d..8c54239e6f 100644 --- a/stories/components/feature-highlight/tests/examples/radio.tsx +++ b/stories/components/feature-highlight/tests/examples/radio.tsx @@ -2,11 +2,11 @@ import SummaryAI from '@semcore/icon/SummaryAI/m'; import { Box, Flex, ScreenReaderOnly } from '@semcore/ui/base-components'; import { RadioFH, BadgeFH } from '@semcore/ui/feature-highlight'; import Radio, { RadioGroup } from '@semcore/ui/radio'; -import type { RadioProps } from '@semcore/ui/radio'; +import type { NSRadio } from '@semcore/ui/radio'; import { Text } from '@semcore/ui/typography'; import React from 'react'; -export type RadioFHAdvancedProps = RadioProps & { +export type RadioFHAdvancedProps = NSRadio.Props & { firstOptionText?: string; secondOptionText?: string; showBadge?: boolean; diff --git a/stories/components/radio/docs/examples/additional_props_for_input.tsx b/stories/components/radio/docs/examples/additional_props_for_input.tsx index 01f56a1fea..0fe125df10 100644 --- a/stories/components/radio/docs/examples/additional_props_for_input.tsx +++ b/stories/components/radio/docs/examples/additional_props_for_input.tsx @@ -1,8 +1,8 @@ import Radio, { RadioGroup } from '@semcore/ui/radio'; -import type { NRadio } from '@semcore/ui/radio'; +import type { NSRadio } from '@semcore/ui/radio'; import React from 'react'; -const Demo = (props: NRadio.Group.Props) => { +const Demo = (props: NSRadio.Group.Props) => { return ( { ); }; -export const defaultAdditionalInputProps: NRadio.Group.Props = { +export const defaultAdditionalInputProps: NSRadio.Group.Props = { size: 'm', theme: undefined, disabled: false, diff --git a/stories/components/radio/docs/examples/radiogroup_example.tsx b/stories/components/radio/docs/examples/radiogroup_example.tsx index dbcc86832b..49114bfff6 100644 --- a/stories/components/radio/docs/examples/radiogroup_example.tsx +++ b/stories/components/radio/docs/examples/radiogroup_example.tsx @@ -1,10 +1,10 @@ import { Flex } from '@semcore/ui/base-components'; import Radio, { RadioGroup } from '@semcore/ui/radio'; -import type { NRadio } from '@semcore/ui/radio'; +import type { NSRadio } from '@semcore/ui/radio'; import { Text } from '@semcore/ui/typography'; import React from 'react'; -const Demo = (props: NRadio.Group.Props) => { +const Demo = (props: NSRadio.Group.Props) => { const [value, setValue] = React.useState('1'); return (
@@ -31,7 +31,7 @@ const Demo = (props: NRadio.Group.Props) => { ); }; -export const defaultProps: NRadio.Group.Props = { +export const defaultProps: NSRadio.Group.Props = { size: 'm', theme: undefined, disabled: false, diff --git a/stories/components/radio/tests/examples/radio-props.tsx b/stories/components/radio/tests/examples/radio-props.tsx index 27e42413e6..a327df40a2 100644 --- a/stories/components/radio/tests/examples/radio-props.tsx +++ b/stories/components/radio/tests/examples/radio-props.tsx @@ -1,9 +1,9 @@ import { Flex } from '@semcore/ui/base-components'; import Radio from '@semcore/ui/radio'; -import type { NRadio } from '@semcore/ui/radio'; +import type { NSRadio } from '@semcore/ui/radio'; import React from 'react'; -type ExampleProps = NRadio.Props & { +type ExampleProps = NSRadio.Props & { color?: string; }; From f4e79a768a61186f8f48c709843e210a371d7338 Mon Sep 17 00:00:00 2001 From: Slizhevsky Vladislav Date: Thu, 9 Apr 2026 17:45:49 +0200 Subject: [PATCH 4/6] [radio] return atomic types/deprecate atomic types/update types among the project --- semcore/radio/src/Radio.tsx | 10 ++++---- semcore/radio/src/Radio.type.ts | 42 ++++++++++++++++++--------------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/semcore/radio/src/Radio.tsx b/semcore/radio/src/Radio.tsx index abdde146da..a9bdf1b02c 100644 --- a/semcore/radio/src/Radio.tsx +++ b/semcore/radio/src/Radio.tsx @@ -64,7 +64,7 @@ class RadioGroupRoot extends Component< const RadioGroup = createComponent(RadioGroupRoot, {}, { context: RadioContext }) as unknown as NSRadio.Group.Component; -class RadioRoot extends Component> { +class RadioRoot extends Component> { static displayName = 'Radio'; static style = style; static contextType = RadioContext; @@ -147,7 +147,7 @@ class RadioRoot extends Component, + Intergalactic.InternalTypings.InferChildComponentProps, typeof ValueRoot.enhance, { checked: (e: React.ChangeEvent) => boolean } > { @@ -264,7 +264,7 @@ class ValueRoot extends Component< function Control( props: Intergalactic.InternalTypings.InferChildComponentProps< - NSRadio.Value.Control.Component, + NSRadio.Value.Control.Root, typeof ValueRoot, 'Control' >, @@ -278,7 +278,7 @@ Control.displayName = 'Control'; function RadioMark( props: Intergalactic.InternalTypings.InferChildComponentProps< - NSRadio.Value.Mark.Component, + NSRadio.Value.Mark.Root, typeof ValueRoot, 'RadioMark' >, @@ -296,7 +296,7 @@ function RadioMark( RadioMark.displayName = 'RadioMark'; function Text( - props: Intergalactic.InternalTypings.InferChildComponentProps, + props: Intergalactic.InternalTypings.InferChildComponentProps, ) { const SText = Root; const { styles, color } = props; diff --git a/semcore/radio/src/Radio.type.ts b/semcore/radio/src/Radio.type.ts index 0017ade6e2..84f9128545 100644 --- a/semcore/radio/src/Radio.type.ts +++ b/semcore/radio/src/Radio.type.ts @@ -7,7 +7,7 @@ declare namespace NSRadio { type State = 'normal' | 'invalid'; type Value = string | number | boolean; - export type Props = BoxProps & { + type Props = BoxProps & { /** Radio item value **/ value?: Value; /** Radio item checked flag **/ @@ -30,48 +30,47 @@ declare namespace NSRadio { disabled?: boolean; }; - export type Ctx = { + type Ctx = { getValueProps: PropGetterFn; getTextProps: PropGetterFn; }; + type Root = Intergalactic.Component<'label', Props, Ctx>; + namespace Value { - export type Props = BoxProps & { + type Props = BoxProps & { /** List of elements that can be put on a hidden input */ includeInputProps?: string[]; }; + type Root = Intergalactic.Component<'input', Props>; + namespace Control { - export type Props = {}; + type Props = {}; - export type Component = Intergalactic.Component<'input', Props>; + type Root = Intergalactic.Component<'input', Props>; } namespace Mark { - export type Props = {}; + type Props = {}; - export type Component = Intergalactic.Component; + type Root = Intergalactic.Component; } - export type Component = Intergalactic.Component<'input', Props> & { - Control: Control.Component; - RadioMark: Mark.Component; + type Component = Root & { + Control: Control.Root; + RadioMark: Mark.Root; }; } namespace Text { - export type Props = TextProps; + type Props = TextProps; - export type Component = Intergalactic.Component<'span', Props>; + type Root = Intergalactic.Component<'span', Props>; } - export type Component = Intergalactic.Component<'label', Props, Ctx> & { - Value: Value.Component; - Text: Text.Component; - }; - namespace Group { - export type Props = { + type Props = { /** Radio group name */ name?: string; /** Active default value */ @@ -90,7 +89,7 @@ declare namespace NSRadio { disabled?: boolean; }; - export type Component = (< + type Component = (< V extends Value, Tag extends Intergalactic.Tag = 'div', >( @@ -99,6 +98,11 @@ declare namespace NSRadio { ) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', typeof Flex, Props>; } + + type Component = Root & { + Value: Value.Component; + Text: Text.Root; + }; } /** @deprecated It will be removed in v18. */ From 33257ac6af281ec91017ccfe46a676de0f6610cd Mon Sep 17 00:00:00 2001 From: Slizhevsky Vladislav Date: Wed, 15 Apr 2026 16:29:11 +0200 Subject: [PATCH 5/6] [radio] add handling namespaces as a reference for types --- semcore/radio/src/Radio.type.ts | 10 ++--- website/builder/typings/serializer.ts | 18 +++++++-- website/builder/typings/typeAliases.ts | 53 +++++++++++++++++++++++--- website/builder/typings/types.data.ts | 39 ++++++++++++++++++- 4 files changed, 104 insertions(+), 16 deletions(-) diff --git a/semcore/radio/src/Radio.type.ts b/semcore/radio/src/Radio.type.ts index 84f9128545..4b937a271c 100644 --- a/semcore/radio/src/Radio.type.ts +++ b/semcore/radio/src/Radio.type.ts @@ -9,19 +9,19 @@ declare namespace NSRadio { type Props = BoxProps & { /** Radio item value **/ - value?: Value; + value?: NSRadio.Value; /** Radio item checked flag **/ checked?: boolean; /** * The value displaying the state of the component * @default normal */ - state?: State; + state?: NSRadio.State; /** * Radio button size * @default m **/ - size?: Size; + size?: NSRadio.Size; /** The theme of the radio button that you can send your color to */ theme?: string; /** Radio item text **/ @@ -70,7 +70,7 @@ declare namespace NSRadio { } namespace Group { - type Props = { + type Props = { /** Radio group name */ name?: string; /** Active default value */ @@ -82,7 +82,7 @@ declare namespace NSRadio { | ((value: T, e?: React.SyntheticEvent) => void) | React.Dispatch>; /** Radio button size */ - size?: Size; + size?: NSRadio.Size; /** The theme of the radio button that you can send your color to */ theme?: string; /** Blocks access and changes to the form field */ diff --git a/website/builder/typings/serializer.ts b/website/builder/typings/serializer.ts index 818aa8acfb..2a6282491e 100644 --- a/website/builder/typings/serializer.ts +++ b/website/builder/typings/serializer.ts @@ -24,7 +24,12 @@ const computeTypingStringLength = (typingsParts) => 0, ); -export const serializeTsNode = (node: ts.Node, genericsMap = {}, minimizeMembersOf = []) => { +export const serializeTsNode = ( + node: ts.Node, + genericsMap = {}, + minimizeMembersOf = [], + nsRegistry: Record = {}, +) => { const traverse = (node: ts.Node) => { switch (node.kind) { case ts.SyntaxKind.NumberKeyword: @@ -280,7 +285,12 @@ export const serializeTsNode = (node: ts.Node, genericsMap = {}, minimizeMembers return result; } if (typeName.left && typeName.right) { - return [traverse(typeName.left), '.', traverse(typeName.right)]; + const qualifiedName: Array = [traverse(typeName.left), '.', traverse(typeName.right)]; + const nsTypeDecl = nsRegistry[qualifiedName.join('')]; + + if (!nsTypeDecl) return qualifiedName; + + return traverse(nsTypeDecl.type); } if (typeName.escapedText !== undefined) { const genericReference = genericsMap[typeName.escapedText]; @@ -368,10 +378,10 @@ const serializeJSDoc = (jsDoc: ts.JSDoc[], dependencies: string[], genericsMap) return { description, params }; }; -export const serializeProperty = (propertyDeclaration: ts.PropertySignature, genericsMap) => { +export const serializeProperty = (propertyDeclaration: ts.PropertySignature, genericsMap: Record, nsRegistry: Record = {}) => { const name = (propertyDeclaration as { name?: ts.Identifier }).name!.escapedText; const isOptional = propertyDeclaration.questionToken !== undefined; - const type = serializeTsNode(propertyDeclaration.type!, genericsMap, []); + const type = serializeTsNode(propertyDeclaration.type!, genericsMap, [], nsRegistry); const dependencies = extractDependenciesList(type); const jsDoc = (propertyDeclaration as { jsDoc?: ts.JSDoc[] }).jsDoc ?? []; diff --git a/website/builder/typings/typeAliases.ts b/website/builder/typings/typeAliases.ts index 064aa2fd98..e48518521c 100644 --- a/website/builder/typings/typeAliases.ts +++ b/website/builder/typings/typeAliases.ts @@ -2,15 +2,56 @@ import ts from 'typescript'; import { extractDependenciesList, serializeProperty, serializeTsNode } from './serializer'; -export const serializeTypeDeclaration = (typeDeclaration: ts.TypeAliasDeclaration) => { +const getQualifiedTypeName = (typeName: ts.TypeReferenceNode['typeName']): string => { + if (ts.isQualifiedName(typeName)) { + const left = getQualifiedTypeName(typeName.left); + const right = typeName.right.escapedText; + + return `${left}.${right}`; + } + + return typeName.text; +}; + +export const serializeTypeDeclaration = ( + typeDeclaration: ts.TypeAliasDeclaration, + nsRegistry: Record, + initialGenericsMap: Record = {}, +) => { const name = typeDeclaration.name.escapedText as string; - const genericsMap = {}; + + if (ts.isTypeReferenceNode(typeDeclaration.type)) { + const { type } = typeDeclaration; + const qualifiedName = getQualifiedTypeName(type.typeName); + + if (qualifiedName) { + const nsTypeDecl = nsRegistry[qualifiedName]; + + if (nsTypeDecl) { + const innerGenericMap: Record = {}; + + if (type.typeArguments) { + nsTypeDecl.typeParameters?.forEach((p, i) => { + const parameter = p.name.text; + innerGenericMap[parameter] = serializeTsNode(p); + }); + } + + return { + ...serializeTypeDeclaration(nsTypeDecl, nsRegistry, innerGenericMap), + name, + }; + } + } + } + + const genericsMap = { ...initialGenericsMap }; const properties = []; const dependencies = []; for (const typeParameter of typeDeclaration.typeParameters ?? []) { if (typeParameter.kind === ts.SyntaxKind.TypeParameter && typeParameter.constraint) { - const computedNode = serializeTsNode(typeParameter.constraint, genericsMap); + const computedNode = serializeTsNode(typeParameter.constraint, genericsMap, [], nsRegistry); dependencies.push(...extractDependenciesList(computedNode)); const { escapedText } = typeParameter.name as { escapedText: string }; genericsMap[escapedText] = computedNode; @@ -23,7 +64,7 @@ export const serializeTypeDeclaration = (typeDeclaration: ts.TypeAliasDeclaratio properties.push( ...members .filter((property) => property.kind === ts.SyntaxKind.PropertySignature) - .map((property) => serializeProperty(property as ts.PropertySignature, genericsMap)), + .map((property) => serializeProperty(property as ts.PropertySignature, genericsMap, nsRegistry)), ); } if ('types' in typeDeclaration.type) { @@ -35,7 +76,7 @@ export const serializeTypeDeclaration = (typeDeclaration: ts.TypeAliasDeclaratio properties.push( ...members .filter((property) => property.kind === ts.SyntaxKind.PropertySignature) - .map((property) => serializeProperty(property as ts.PropertySignature, genericsMap)), + .map((property) => serializeProperty(property as ts.PropertySignature, genericsMap, nsRegistry)), ); } } @@ -44,7 +85,7 @@ export const serializeTypeDeclaration = (typeDeclaration: ts.TypeAliasDeclaratio dependencies.push(...property.dependencies); } - const type = serializeTsNode(typeDeclaration.type, genericsMap, minimizeMembers); + const type = serializeTsNode(typeDeclaration.type, genericsMap, minimizeMembers, nsRegistry); dependencies.push(...extractDependenciesList(type)); return { diff --git a/website/builder/typings/types.data.ts b/website/builder/typings/types.data.ts index 8416ad0a39..b536cd9c4a 100644 --- a/website/builder/typings/types.data.ts +++ b/website/builder/typings/types.data.ts @@ -7,10 +7,40 @@ import { serializeClassDeclaration } from './classes'; import { serializeInterfaceDeclaration } from './interfaces'; import { serializeTypeDeclaration } from './typeAliases'; +function buildNSRegistry(ns: ts.ModuleDeclaration, rootName?: string) { + const { name: { text: nsName }, body } = ns; + + let registry: Record = {}; + + if (!body) return registry; + + body.forEachChild((child) => { + if (ts.isTypeAliasDeclaration(child)) { + const { name: { text: childKey } } = child; + + const key = rootName ? `${rootName}.${nsName}.${childKey}` : `${nsName}.${childKey}`; + + registry[key] = child; + } else if (ts.isModuleDeclaration(child)) { + const key = rootName ? `${rootName}.${nsName}` : nsName; + + registry = { + ...registry, + ...buildNSRegistry(child, key), + }; + } + }); + + return registry; +} + const serializeFileDeclaration = (fileDeclaration: ts.SourceFile, filepath: string) => { const interfaceDec: ts.InterfaceDeclaration[] = []; const typesDec: ts.TypeAliasDeclaration[] = []; const classesDec: ts.ClassDeclaration[] = []; + + let nsRegistry: Record = {}; + fileDeclaration.forEachChild((child) => { if (child.kind === ts.SyntaxKind.InterfaceDeclaration) { const isExported = child.modifiers?.some( @@ -39,9 +69,16 @@ const serializeFileDeclaration = (fileDeclaration: ts.SourceFile, filepath: stri classesDec.push(child as ts.ClassDeclaration); } } + + if (ts.isModuleDeclaration(child)) { + nsRegistry = { + ...nsRegistry, + ...buildNSRegistry(child), + }; + } }); - const types = typesDec.map((type) => serializeTypeDeclaration(type)); + const types = typesDec.map((type) => serializeTypeDeclaration(type, nsRegistry)); const interfaces = interfaceDec.map((int) => serializeInterfaceDeclaration(int)); const classes = classesDec.map((cls) => serializeClassDeclaration(cls)); From c920862f045c78f35fa8e17fa7a54a0728167074 Mon Sep 17 00:00:00 2001 From: Slizhevsky Vladislav Date: Wed, 15 Apr 2026 16:42:51 +0200 Subject: [PATCH 6/6] [radio] update types --- semcore/radio/src/Radio.tsx | 10 +++--- semcore/radio/src/Radio.type.ts | 55 ++++++++++++--------------------- 2 files changed, 24 insertions(+), 41 deletions(-) diff --git a/semcore/radio/src/Radio.tsx b/semcore/radio/src/Radio.tsx index a9bdf1b02c..abdde146da 100644 --- a/semcore/radio/src/Radio.tsx +++ b/semcore/radio/src/Radio.tsx @@ -64,7 +64,7 @@ class RadioGroupRoot extends Component< const RadioGroup = createComponent(RadioGroupRoot, {}, { context: RadioContext }) as unknown as NSRadio.Group.Component; -class RadioRoot extends Component> { +class RadioRoot extends Component> { static displayName = 'Radio'; static style = style; static contextType = RadioContext; @@ -147,7 +147,7 @@ class RadioRoot extends Component, + Intergalactic.InternalTypings.InferChildComponentProps, typeof ValueRoot.enhance, { checked: (e: React.ChangeEvent) => boolean } > { @@ -264,7 +264,7 @@ class ValueRoot extends Component< function Control( props: Intergalactic.InternalTypings.InferChildComponentProps< - NSRadio.Value.Control.Root, + NSRadio.Value.Control.Component, typeof ValueRoot, 'Control' >, @@ -278,7 +278,7 @@ Control.displayName = 'Control'; function RadioMark( props: Intergalactic.InternalTypings.InferChildComponentProps< - NSRadio.Value.Mark.Root, + NSRadio.Value.Mark.Component, typeof ValueRoot, 'RadioMark' >, @@ -296,7 +296,7 @@ function RadioMark( RadioMark.displayName = 'RadioMark'; function Text( - props: Intergalactic.InternalTypings.InferChildComponentProps, + props: Intergalactic.InternalTypings.InferChildComponentProps, ) { const SText = Root; const { styles, color } = props; diff --git a/semcore/radio/src/Radio.type.ts b/semcore/radio/src/Radio.type.ts index 4b937a271c..eae7095d91 100644 --- a/semcore/radio/src/Radio.type.ts +++ b/semcore/radio/src/Radio.type.ts @@ -6,21 +6,20 @@ declare namespace NSRadio { type Size = 'm' | 'l'; type State = 'normal' | 'invalid'; type Value = string | number | boolean; - type Props = BoxProps & { /** Radio item value **/ value?: NSRadio.Value; /** Radio item checked flag **/ checked?: boolean; /** - * The value displaying the state of the component - * @default normal - */ + * The value displaying the state of the component + * @default normal + */ state?: NSRadio.State; /** - * Radio button size - * @default m - **/ + * Radio button size + * @default m + **/ size?: NSRadio.Size; /** The theme of the radio button that you can send your color to */ theme?: string; @@ -29,44 +28,34 @@ declare namespace NSRadio { /** Blocks access and changes to the radio item **/ disabled?: boolean; }; - type Ctx = { getValueProps: PropGetterFn; getTextProps: PropGetterFn; }; - - type Root = Intergalactic.Component<'label', Props, Ctx>; - namespace Value { type Props = BoxProps & { - /** List of elements that can be put on a hidden input */ + /** List of elements that can be put on a hidden input */ includeInputProps?: string[]; }; - - type Root = Intergalactic.Component<'input', Props>; - namespace Control { type Props = {}; - - type Root = Intergalactic.Component<'input', Props>; + type Component = Intergalactic.Component<'input', Props>; } namespace Mark { type Props = {}; - - type Root = Intergalactic.Component; + type Component = Intergalactic.Component<'input', Props>; } - type Component = Root & { - Control: Control.Root; - RadioMark: Mark.Root; + type Component = Intergalactic.Component<'input', Props> & { + Control: Control.Component; + RadioMark: Mark.Component; }; } namespace Text { type Props = TextProps; - - type Root = Intergalactic.Component<'span', Props>; + type Component = Intergalactic.Component<'span', Props>; } namespace Group { @@ -79,8 +68,8 @@ declare namespace NSRadio { value?: T; /** Called when the selected element is changed */ onChange?: - | ((value: T, e?: React.SyntheticEvent) => void) - | React.Dispatch>; + | ((value: T, e?: React.SyntheticEvent) => void) + | React.Dispatch>; /** Radio button size */ size?: NSRadio.Size; /** The theme of the radio button that you can send your color to */ @@ -88,20 +77,14 @@ declare namespace NSRadio { /** Blocks access and changes to the form field */ disabled?: boolean; }; - - type Component = (< - V extends Value, - Tag extends Intergalactic.Tag = 'div', - >( - props: Intergalactic.InternalTypings.ComponentProps> & - PropsExtending, + type Component = (( + props: Intergalactic.InternalTypings.ComponentProps> & PropsExtending, ) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', typeof Flex, Props>; } - - type Component = Root & { + type Component = Intergalactic.Component<'label', Props, Ctx> & { Value: Value.Component; - Text: Text.Root; + Text: Text.Component; }; }