@semcore/radio 6.44.0-prerelease.0 → 6.44.0-prerelease.1

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.
@@ -17,6 +17,16 @@ SRadio[disabled] {
17
17
  pointer-events: none;
18
18
  }
19
19
 
20
+ SText[size='m'] {
21
+ font-size: var(--intergalactic-fs-200, 14px);
22
+ line-height: var(--intergalactic-lh-200, 142%);
23
+ }
24
+
25
+ SText[size='l'] {
26
+ font-size: var(--intergalactic-fs-300, 16px);
27
+ line-height: var(--intergalactic-lh-300, 150%);
28
+ }
29
+
20
30
  SValue {
21
31
  position: relative;
22
32
  flex-shrink: 0;
@@ -94,6 +104,11 @@ SControl {
94
104
  clip: rect(1px, 1px, 1px, 1px);
95
105
  }
96
106
 
107
+ SControl:checked~SValue::before {
108
+ border-color: var(--intergalactic-control-primary-info, oklch(0.23 0.01 140));
109
+ background-color: var(--intergalactic-control-primary-info, oklch(0.23 0.01 140));
110
+ }
111
+
97
112
  SControl:checked~SValue[size='m']::after {
98
113
  width: 6px;
99
114
  height: 6px;
@@ -104,21 +119,13 @@ SControl:checked~SValue[size='l']::after {
104
119
  height: 8px;
105
120
  }
106
121
 
107
- SControl:focus-visible+SValue[state='normal']::before {
122
+ SValue[state='normal'][keyboardFocused]::before {
123
+ box-shadow: var(--intergalactic-keyboard-focus, 0px 0px 0px 3px oklch(0.376 0.247 264.2 / 0.441));
108
124
  border-color: var(--intergalactic-border-info-active, oklch(0.382 0.248 264.2 / 0.386));
109
- @mixin focus-outline-mixin;
110
- }
111
-
112
- SControl:checked~SValue::before,
113
- SControl:checked:focus-visible~SValue::before {
114
- border-color: var(--intergalactic-control-primary-info, oklch(0.23 0.01 140));
115
- background-color: var(--intergalactic-control-primary-info, oklch(0.23 0.01 140));
116
125
  }
117
126
 
118
- SControl:focus-visible+SValue[state='invalid']::before {
119
- border-color: var(--intergalactic-border-critical-active, oklch(0.628 0.258 29 / 0.56));
120
- @mixin focus-outline-mixin;
121
- outline-color: var(--intergalactic-keyboard-focus-invalid-outline, oklch(0.628 0.257 28.9 / 0.652));
127
+ SValue[state='invalid'][keyboardFocused]::before {
128
+ box-shadow: var(--intergalactic-keyboard-focus-invalid, 0px 0px 0px 3px oklch(0.628 0.257 28.9 / 0.652));
122
129
  }
123
130
 
124
131
  SControl:checked~SValue[theme]::before {
@@ -1,2 +1,149 @@
1
- export { default, wrapRadioGroup, RadioGroup } from './Radio';
2
- export * from './Radio.type';
1
+ import React from 'react';
2
+ import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';
3
+ import { Box, BoxProps, Flex } from '@semcore/flex-box';
4
+ import { KeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
5
+ import { Text } from '@semcore/typography';
6
+
7
+ export type RadioSize = 'm' | 'l';
8
+ export type RadioState = 'normal' | 'invalid';
9
+ export type RadioValue = string | number | boolean;
10
+
11
+ /** @deprecated */
12
+ export interface IRadioProps extends RadioProps, UnknownProperties {}
13
+ export type RadioProps = BoxProps & {
14
+ /** Radio item value **/
15
+ value?: RadioValue;
16
+
17
+ /** Radio item checked flag **/
18
+ checked?: boolean;
19
+
20
+ /**
21
+ * The value displaying the state of the component
22
+ * @default normal
23
+ */
24
+ state?: RadioState;
25
+ /**
26
+ * Radio button size
27
+ * @default m
28
+ **/
29
+ size?: RadioSize;
30
+ /** The theme of the radio button that you can send your color to */
31
+ theme?: string;
32
+ /** Radio item text **/
33
+ label?: string;
34
+ /** Blocks access and changes to the radio item **/
35
+ disabled?: boolean;
36
+ };
37
+
38
+ /** @deprecated */
39
+ export interface IRadioGroupProps extends RadioGroupProps, UnknownProperties {
40
+ /**
41
+ * HTML tag name for the displayed item
42
+ */
43
+ tag?: React.ElementType | string;
44
+ }
45
+ export type RadioGroupProps<T extends RadioValue = RadioValue> = {
46
+ /** Radio group name */
47
+ name?: string;
48
+ /** Active default value */
49
+ defaultValue?: T;
50
+ /** Active value */
51
+ value?: T;
52
+ /** Called when the selected element is changed */
53
+ onChange?:
54
+ | ((value: T, e?: React.SyntheticEvent<HTMLInputElement>) => void)
55
+ | React.Dispatch<React.SetStateAction<T>>;
56
+ /** Radio button size */
57
+ size?: RadioSize;
58
+ /** The theme of the radio button that you can send your color to */
59
+ theme?: string;
60
+ /** Blocks access and changes to the form field */
61
+ disabled?: boolean;
62
+ };
63
+
64
+ /** @deprecated */
65
+ export interface IRadioValueProps extends RadioValueProps, UnknownProperties {}
66
+ export type RadioValueProps = BoxProps &
67
+ KeyboardFocusProps & {
68
+ /** List of elements that can be put on a hidden input */
69
+ includeInputProps?: string[];
70
+ /**
71
+ * @deprecated set `state` on root Radio instead
72
+ * The value displaying the state of the component
73
+ * @default normal
74
+ */
75
+ state?: RadioState;
76
+ /**
77
+ * @deprecated
78
+ * The theme of the radio button that you can send your color to
79
+ */
80
+ theme?: string;
81
+ /**
82
+ * @deprecated set `size` on root RadioGroup instead
83
+ * Radio button size
84
+ */
85
+ size?: RadioSize;
86
+ /**
87
+ * @deprecated set `value` on root Radio instead
88
+ * The element value is required for RadioGroup
89
+ */
90
+ value?: RadioValue;
91
+ /**
92
+ * @deprecated set `defaultValue` on root RadioGroup instead
93
+ * Default value if `value` property is not provided
94
+ */
95
+ defaultValue?: RadioValue;
96
+ /**
97
+ * @deprecated set `onChange` on root RadioGroup instead
98
+ * Called when the value changes
99
+ */
100
+ onChange?: (value: boolean, e?: React.SyntheticEvent<HTMLInputElement>) => void;
101
+ /**
102
+ * @deprecated set `disabled` on root Radio instead
103
+ * Blocks access and changes to the form field
104
+ */
105
+ disabled?: boolean;
106
+ };
107
+
108
+ /** @deprecated */
109
+ export interface IRadioCtx extends RadioCtx, UnknownProperties {}
110
+ export type RadioCtx = {
111
+ getValueProps: PropGetterFn;
112
+ getTextProps: PropGetterFn;
113
+ };
114
+
115
+ type IntergalacticRadioGroupComponent<PropsExtending = {}> = (<
116
+ Value extends RadioValue,
117
+ Tag extends Intergalactic.Tag = typeof Flex,
118
+ >(
119
+ props: Intergalactic.InternalTypings.ComponentProps<Tag, typeof Flex, RadioGroupProps<Value>> &
120
+ PropsExtending,
121
+ ) => Intergalactic.InternalTypings.ComponentRenderingResults) &
122
+ Intergalactic.InternalTypings.ComponentAdditive<'div', typeof Flex, RadioGroupProps>;
123
+
124
+ export type RadioValueControlProps = {};
125
+ export type RadioValueMarkProps = {};
126
+
127
+ declare const RadioGroup: IntergalacticRadioGroupComponent;
128
+
129
+ export { RadioGroup };
130
+
131
+ declare const Radio: Intergalactic.Component<'label', RadioProps, RadioCtx> & {
132
+ Value: Intergalactic.Component<'input', RadioValueProps> & {
133
+ Control: Intergalactic.Component<'input', RadioValueControlProps>;
134
+ RadioMark: Intergalactic.Component<typeof Box, RadioValueMarkProps>;
135
+ };
136
+ Text: typeof Text;
137
+ };
138
+
139
+ declare const wrapRadioGroup: <PropsExtending extends {}>(
140
+ wrapper: (
141
+ props: Intergalactic.InternalTypings.UntypeRefAndTag<
142
+ Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticRadioGroupComponent>
143
+ > &
144
+ PropsExtending,
145
+ ) => React.ReactNode,
146
+ ) => IntergalacticRadioGroupComponent<PropsExtending>;
147
+ export { wrapRadioGroup };
148
+
149
+ export default Radio;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/radio",
3
3
  "description": "Semrush Radio Component",
4
- "version": "6.44.0-prerelease.0",
4
+ "version": "6.44.0-prerelease.1",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -14,12 +14,12 @@
14
14
  "types": "./lib/types/index.d.ts"
15
15
  },
16
16
  "dependencies": {
17
- "@semcore/utils": "4.49.0-prerelease.0",
18
- "@semcore/flex-box": "5.42.0-prerelease.0",
19
- "@semcore/typography": "5.54.0-prerelease.0"
17
+ "@semcore/utils": "4.49.0-prerelease.1",
18
+ "@semcore/flex-box": "5.42.0-prerelease.1",
19
+ "@semcore/typography": "5.54.0-prerelease.1"
20
20
  },
21
21
  "peerDependencies": {
22
- "@semcore/core": "^2.40.0-prerelease.0",
22
+ "@semcore/core": "^2.40.0-prerelease.1",
23
23
  "react": "16.8 - 18",
24
24
  "react-dom": "16.8 - 18"
25
25
  },
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=Radio.type.js.map
@@ -1 +0,0 @@
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,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Radio.type.js.map
@@ -1 +0,0 @@
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 +0,0 @@
1
-
@@ -1,9 +0,0 @@
1
- import type { Intergalactic } from '@semcore/core';
2
- import { inputProps } from '@semcore/core/lib/utils/inputProps';
3
- import React from 'react';
4
- import type { NSRadio } from './Radio.type';
5
- declare const RadioGroup: NSRadio.Group.Component;
6
- declare const Radio: NSRadio.Component;
7
- export declare const wrapRadioGroup: <PropsExtending extends {}>(wrapper: (props: Intergalactic.InternalTypings.UntypeRefAndTag<Intergalactic.InternalTypings.ComponentPropsNesting<NSRadio.Group.Component>> & PropsExtending) => React.ReactNode) => NSRadio.Group.Component<PropsExtending>;
8
- export { inputProps, RadioGroup };
9
- export default Radio;
@@ -1,98 +0,0 @@
1
- import type { Flex, BoxProps } from '@semcore/base-components';
2
- import type { Intergalactic, PropGetterFn } from '@semcore/core';
3
- import type { NSText } from '@semcore/typography';
4
- declare namespace NSRadio {
5
- type Size = 'm' | 'l';
6
- type State = 'normal' | 'invalid';
7
- type Value = string | number | boolean;
8
- type Props = BoxProps & {
9
- /** Radio item value **/
10
- value?: NSRadio.Value;
11
- /** Radio item checked flag **/
12
- checked?: boolean;
13
- /**
14
- * The value displaying the state of the component
15
- * @default normal
16
- */
17
- state?: NSRadio.State;
18
- /**
19
- * Radio button size
20
- * @default m
21
- **/
22
- size?: NSRadio.Size;
23
- /** The theme of the radio button that you can send your color to */
24
- theme?: string;
25
- /** Radio item text **/
26
- label?: string;
27
- /** Blocks access and changes to the radio item **/
28
- disabled?: boolean;
29
- };
30
- type Ctx = {
31
- getValueProps: PropGetterFn;
32
- getTextProps: PropGetterFn;
33
- };
34
- namespace Value {
35
- type Props = BoxProps & {
36
- /** List of elements that can be put on a hidden input */
37
- includeInputProps?: string[];
38
- };
39
- namespace Control {
40
- type Props = {};
41
- type Component = Intergalactic.Component<'input', Props>;
42
- }
43
- namespace Mark {
44
- type Props = {};
45
- type Component = Intergalactic.Component<'input', Props>;
46
- }
47
- type Component = Intergalactic.Component<'input', Props> & {
48
- Control: Control.Component;
49
- RadioMark: Mark.Component;
50
- };
51
- }
52
- namespace Text {
53
- type Props = NSText.Props;
54
- type Component = Intergalactic.Component<'span', Props>;
55
- }
56
- namespace Group {
57
- type Props<T extends NSRadio.Value = NSRadio.Value> = {
58
- /** Radio group name */
59
- name?: string;
60
- /** Active default value */
61
- defaultValue?: T;
62
- /** Active value */
63
- value?: T;
64
- /** Called when the selected element is changed */
65
- onChange?: ((value: T, e?: React.SyntheticEvent<HTMLInputElement>) => void) | React.Dispatch<React.SetStateAction<T>>;
66
- /** Radio button size */
67
- size?: NSRadio.Size;
68
- /** The theme of the radio button that you can send your color to */
69
- theme?: string;
70
- /** Blocks access and changes to the form field */
71
- disabled?: boolean;
72
- };
73
- type Component<PropsExtending = {}> = (<V extends Value, Tag extends Intergalactic.Tag = 'div'>(props: Intergalactic.InternalTypings.ComponentProps<Tag, typeof Flex, Props<V>> & PropsExtending) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', typeof Flex, Props>;
74
- }
75
- type Component = Intergalactic.Component<'label', Props, Ctx> & {
76
- Value: Value.Component;
77
- Text: Text.Component;
78
- };
79
- }
80
- /** @deprecated It will be removed in v18. */
81
- export type RadioSize = NSRadio.Size;
82
- /** @deprecated It will be removed in v18. */
83
- export type RadioState = NSRadio.State;
84
- /** @deprecated It will be removed in v18. */
85
- export type RadioValue = NSRadio.Value;
86
- /** @deprecated It will be removed in v18. */
87
- export type RadioProps = NSRadio.Props;
88
- /** @deprecated It will be removed in v18. */
89
- export type RadioGroupProps<T extends RadioValue = RadioValue> = NSRadio.Group.Props<T>;
90
- /** @deprecated It will be removed in v18. */
91
- export type RadioValueProps = NSRadio.Value.Props;
92
- /** @deprecated It will be removed in v18. */
93
- export type RadioCtx = NSRadio.Ctx;
94
- /** @deprecated It will be removed in v18. */
95
- export type RadioValueControlProps = NSRadio.Value.Control.Props;
96
- /** @deprecated It will be removed in v18. */
97
- export type RadioValueMarkProps = NSRadio.Value.Mark.Props;
98
- export type { NSRadio };