@ankhorage/zora 4.3.0 → 4.4.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.
- package/CHANGELOG.md +12 -0
- package/dist/components/card/meta.d.ts +1 -1
- package/dist/components/radio/RadioGroup.d.ts.map +1 -1
- package/dist/components/radio/RadioGroup.js +27 -7
- package/dist/components/radio/RadioGroup.js.map +1 -1
- package/dist/components/radio/meta.d.ts +203 -4
- package/dist/components/radio/meta.d.ts.map +1 -1
- package/dist/components/radio/meta.js +168 -4
- package/dist/components/radio/meta.js.map +1 -1
- package/dist/components/radio/resolveRadioGroupThemeRecipe.d.ts +20 -0
- package/dist/components/radio/resolveRadioGroupThemeRecipe.d.ts.map +1 -0
- package/dist/components/radio/resolveRadioGroupThemeRecipe.js +34 -0
- package/dist/components/radio/resolveRadioGroupThemeRecipe.js.map +1 -0
- package/dist/components/radio/themeRecipeMeta.d.ts +26 -0
- package/dist/components/radio/themeRecipeMeta.d.ts.map +1 -0
- package/dist/components/radio/themeRecipeMeta.js +27 -0
- package/dist/components/radio/themeRecipeMeta.js.map +1 -0
- package/dist/components/radio/types.d.ts +1 -0
- package/dist/components/radio/types.d.ts.map +1 -1
- package/dist/components/radio/types.js.map +1 -1
- package/dist/foundation/meta.d.ts +4 -4
- package/dist/layout/screen/meta.d.ts +1 -1
- package/dist/layout/screen-section/meta.d.ts +1 -1
- package/dist/metadata/allowedChildren.d.ts +3 -3
- package/dist/metadata/allowedChildren.d.ts.map +1 -1
- package/dist/metadata/allowedChildren.js +1 -0
- package/dist/metadata/allowedChildren.js.map +1 -1
- package/dist/metadata/bindableComponentMeta.d.ts +2 -2
- package/dist/metadata/themeRecipeMeta.d.ts.map +1 -1
- package/dist/metadata/themeRecipeMeta.js +2 -0
- package/dist/metadata/themeRecipeMeta.js.map +1 -1
- package/dist/patterns/message-bubble/meta.d.ts +1 -1
- package/dist/patterns/notice/meta.d.ts +1 -1
- package/dist/patterns/panel/meta.d.ts +1 -1
- package/dist/patterns/post-card/meta.d.ts +1 -1
- package/dist/patterns/reader/meta.d.ts +2 -2
- package/dist/patterns/scanner/meta.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/radio/RadioGroup.test.ts +31 -0
- package/src/components/radio/RadioGroup.tsx +45 -8
- package/src/components/radio/meta.ts +170 -4
- package/src/components/radio/resolveRadioGroupThemeRecipe.ts +45 -0
- package/src/components/radio/themeRecipeMeta.ts +28 -0
- package/src/components/radio/types.ts +1 -0
- package/src/metadata/allowedChildren.ts +1 -0
- package/src/metadata/componentMeta.test.ts +21 -0
- package/src/metadata/radioGroupReachability.test.ts +20 -0
- package/src/metadata/themeRecipeMeta.test.ts +4 -0
- package/src/metadata/themeRecipeMeta.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0349716: Allow manifest-authorable RadioGroup nodes inside the canonical screen and container composition contract.
|
|
8
|
+
|
|
9
|
+
## 4.4.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 037b931: Make RadioGroup manifest-authorable with normalized value bindings and events, and add a card-style presentation that preserves single-choice radio semantics.
|
|
14
|
+
|
|
3
15
|
## 4.3.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -2,7 +2,7 @@ export declare const cardMeta: {
|
|
|
2
2
|
readonly name: "Card";
|
|
3
3
|
readonly category: "component";
|
|
4
4
|
readonly directManifestNode: true;
|
|
5
|
-
readonly allowedChildren: readonly ["Box", "Stack", "Grid", "Container", "Divider", "Text", "Heading", "Icon", "Image", "Button", "ButtonGroup", "ThemeModeToggle", "Input", "Textarea", "FormField", "Card", "Panel", "Notice", "EmptyState", "SectionHeader", "SettingsRow", "PostCard", "ChatListItem", "MessageBubble", "ProgressRing", "ReaderSurface", "ContentRail", "MissingElement"];
|
|
5
|
+
readonly allowedChildren: readonly ["Box", "Stack", "Grid", "Container", "Divider", "Text", "Heading", "Icon", "Image", "Button", "ButtonGroup", "RadioGroup", "ThemeModeToggle", "Input", "Textarea", "FormField", "Card", "Panel", "Notice", "EmptyState", "SectionHeader", "SettingsRow", "PostCard", "ChatListItem", "MessageBubble", "ProgressRing", "ReaderSurface", "ContentRail", "MissingElement"];
|
|
6
6
|
readonly blueprint: {
|
|
7
7
|
readonly label: "Card";
|
|
8
8
|
readonly defaultProps: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../../src/components/radio/RadioGroup.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../../src/components/radio/RadioGroup.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,KAAK,EAAoB,eAAe,EAAE,MAAM,SAAS,CAAC;AA6DjE;;GAEG;AACH,eAAO,MAAM,UAAU,GA3DE,MAAM,SAAS,MAAM,8DA2De,CAAC"}
|
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
import { Radio } from '@ankhorage/surface';
|
|
1
|
+
import { Radio, useTheme } from '@ankhorage/surface';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { View } from 'react-native';
|
|
4
4
|
import { Stack } from '../../foundation';
|
|
5
|
+
import { useZoraThemeRecipe } from '../../theme/useZoraThemeRecipe';
|
|
5
6
|
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
6
7
|
import { Text } from '../text';
|
|
7
|
-
|
|
8
|
+
import { resolveRadioGroupThemeRecipe } from './resolveRadioGroupThemeRecipe';
|
|
9
|
+
/***
|
|
10
|
+
* Resolves the themed radio-group presentation within the active ZORA scope.
|
|
11
|
+
*/
|
|
12
|
+
function RadioGroupInner({ themeId: _themeId, mode: _mode, value, onValueChange, options, orientation = 'vertical', gap, presentation = 'inline', color, size, invalid = false, readOnly = false, disabled = false, testID, interactionPolicy, }) {
|
|
8
13
|
const isHorizontal = orientation === 'horizontal';
|
|
14
|
+
const themeFields = useZoraThemeRecipe('RadioGroup');
|
|
15
|
+
const recipe = resolveRadioGroupThemeRecipe({ gap, color, size, themeFields });
|
|
9
16
|
return (<View testID={testID} accessibilityRole="radiogroup" style={{
|
|
10
17
|
flexDirection: isHorizontal ? 'row' : 'column',
|
|
11
18
|
flexWrap: isHorizontal ? 'wrap' : 'nowrap',
|
|
12
19
|
}}>
|
|
13
|
-
<Stack direction={isHorizontal ? 'row' : 'column'} gap={gap} wrap={isHorizontal ? 'wrap' : 'nowrap'}>
|
|
14
|
-
{options.map((option) => (<RadioGroupItem key={option.value} option={option} checked={value === option.value} disabled={disabled || option.disabled === true} invalid={invalid} readOnly={readOnly} size={size} color={color} onSelect={onValueChange} interactionPolicy={interactionPolicy}/>))}
|
|
20
|
+
<Stack direction={isHorizontal ? 'row' : 'column'} gap={recipe.gap} wrap={isHorizontal ? 'wrap' : 'nowrap'}>
|
|
21
|
+
{options.map((option) => (<RadioGroupItem key={option.value} option={option} checked={value === option.value} disabled={disabled || option.disabled === true} invalid={invalid} readOnly={readOnly} size={recipe.size} color={recipe.color} orientation={orientation} presentation={presentation} onSelect={onValueChange} interactionPolicy={interactionPolicy}/>))}
|
|
15
22
|
</Stack>
|
|
16
23
|
</View>);
|
|
17
24
|
}
|
|
@@ -19,16 +26,29 @@ function RadioGroupInner({ themeId: _themeId, mode: _mode, value, onValueChange,
|
|
|
19
26
|
* Renders a group of radio options for selecting a single value.
|
|
20
27
|
*/
|
|
21
28
|
export const RadioGroup = withZoraThemeScope(RadioGroupInner);
|
|
22
|
-
|
|
29
|
+
/***
|
|
30
|
+
* Renders one option through the single Surface Radio interaction boundary.
|
|
31
|
+
*/
|
|
32
|
+
function RadioGroupItem({ option, checked, disabled, invalid, readOnly, size, color, orientation, presentation, onSelect, interactionPolicy, }) {
|
|
33
|
+
const { theme } = useTheme();
|
|
23
34
|
const passive = interactionPolicy === 'passive';
|
|
24
|
-
|
|
35
|
+
const isCard = presentation === 'card';
|
|
36
|
+
return (<Radio interactionPolicy={interactionPolicy} checked={checked} disabled={disabled} invalid={invalid} readOnly={readOnly} size={size} color={color} testID={option.testID} bg={isCard
|
|
37
|
+
? checked
|
|
38
|
+
? theme.semantics.selection.background
|
|
39
|
+
: theme.semantics.surface.default
|
|
40
|
+
: undefined} borderColor={isCard
|
|
41
|
+
? checked
|
|
42
|
+
? theme.semantics.selection.border
|
|
43
|
+
: theme.semantics.border.default
|
|
44
|
+
: undefined} borderWidth={isCard ? 1 : undefined} p={isCard ? 'm' : undefined} radius={isCard ? 'l' : undefined} width={isCard && orientation === 'vertical' ? '100%' : undefined} onCheckedChange={(nextChecked) => {
|
|
25
45
|
if (passive)
|
|
26
46
|
return;
|
|
27
47
|
if (nextChecked)
|
|
28
48
|
onSelect(option.value);
|
|
29
49
|
}}>
|
|
30
50
|
<Stack gap="xs">
|
|
31
|
-
<Text>{option.label}</Text>
|
|
51
|
+
<Text weight={isCard ? 'semiBold' : undefined}>{option.label}</Text>
|
|
32
52
|
{option.description ? (<Text emphasis="muted" variant="caption">
|
|
33
53
|
{option.description}
|
|
34
54
|
</Text>) : null}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","sourceRoot":"","sources":["../../../src/components/radio/RadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"RadioGroup.js","sourceRoot":"","sources":["../../../src/components/radio/RadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,cA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C1C,CAAC,CAAC,CAEF;MAAA,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CACb;QAAA,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,CACnE;QAAA,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CACpB,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CACtC;YAAA,CAAC,MAAM,CAAC,WAAW,CACrB;UAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,IAAI,CACV;MAAA,EAAE,KAAK,CACT;IAAA,EAAE,KAAK,CAAC,CACT,CAAC;AACJ,CAAC","sourcesContent":["import { Radio, useTheme } from '@ankhorage/surface';\nimport React from 'react';\nimport { View } from 'react-native';\n\nimport { Stack } from '../../foundation';\nimport { useZoraThemeRecipe } from '../../theme/useZoraThemeRecipe';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { Text } from '../text';\nimport { resolveRadioGroupThemeRecipe } from './resolveRadioGroupThemeRecipe';\nimport type { RadioGroupOption, RadioGroupProps } from './types';\n\n/***\n * Resolves the themed radio-group presentation within the active ZORA scope.\n */\nfunction RadioGroupInner<TValue extends string>({\n themeId: _themeId,\n mode: _mode,\n value,\n onValueChange,\n options,\n orientation = 'vertical',\n gap,\n presentation = 'inline',\n color,\n size,\n invalid = false,\n readOnly = false,\n disabled = false,\n testID,\n interactionPolicy,\n}: RadioGroupProps<TValue>) {\n const isHorizontal = orientation === 'horizontal';\n const themeFields = useZoraThemeRecipe('RadioGroup');\n const recipe = resolveRadioGroupThemeRecipe({ gap, color, size, themeFields });\n\n return (\n <View\n testID={testID}\n accessibilityRole=\"radiogroup\"\n style={{\n flexDirection: isHorizontal ? 'row' : 'column',\n flexWrap: isHorizontal ? 'wrap' : 'nowrap',\n }}\n >\n <Stack\n direction={isHorizontal ? 'row' : 'column'}\n gap={recipe.gap}\n wrap={isHorizontal ? 'wrap' : 'nowrap'}\n >\n {options.map((option) => (\n <RadioGroupItem\n key={option.value}\n option={option}\n checked={value === option.value}\n disabled={disabled || option.disabled === true}\n invalid={invalid}\n readOnly={readOnly}\n size={recipe.size}\n color={recipe.color}\n orientation={orientation}\n presentation={presentation}\n onSelect={onValueChange}\n interactionPolicy={interactionPolicy}\n />\n ))}\n </Stack>\n </View>\n );\n}\n\n/***\n * Renders a group of radio options for selecting a single value.\n */\nexport const RadioGroup = withZoraThemeScope(RadioGroupInner);\n\n/***\n * Renders one option through the single Surface Radio interaction boundary.\n */\nfunction RadioGroupItem<TValue extends string>({\n option,\n checked,\n disabled,\n invalid,\n readOnly,\n size,\n color,\n orientation,\n presentation,\n onSelect,\n interactionPolicy,\n}: {\n option: RadioGroupOption<TValue>;\n checked: boolean;\n disabled: boolean;\n invalid: boolean;\n readOnly: boolean;\n size: NonNullable<RadioGroupProps<TValue>['size']>;\n color: NonNullable<RadioGroupProps<TValue>['color']>;\n orientation: NonNullable<RadioGroupProps<TValue>['orientation']>;\n presentation: NonNullable<RadioGroupProps<TValue>['presentation']>;\n onSelect: (value: TValue) => void;\n interactionPolicy: RadioGroupProps<TValue>['interactionPolicy'];\n}) {\n const { theme } = useTheme();\n const passive = interactionPolicy === 'passive';\n const isCard = presentation === 'card';\n\n return (\n <Radio\n interactionPolicy={interactionPolicy}\n checked={checked}\n disabled={disabled}\n invalid={invalid}\n readOnly={readOnly}\n size={size}\n color={color}\n testID={option.testID}\n bg={\n isCard\n ? checked\n ? theme.semantics.selection.background\n : theme.semantics.surface.default\n : undefined\n }\n borderColor={\n isCard\n ? checked\n ? theme.semantics.selection.border\n : theme.semantics.border.default\n : undefined\n }\n borderWidth={isCard ? 1 : undefined}\n p={isCard ? 'm' : undefined}\n radius={isCard ? 'l' : undefined}\n width={isCard && orientation === 'vertical' ? '100%' : undefined}\n onCheckedChange={(nextChecked) => {\n if (passive) return;\n if (nextChecked) onSelect(option.value);\n }}\n >\n <Stack gap=\"xs\">\n <Text weight={isCard ? 'semiBold' : undefined}>{option.label}</Text>\n {option.description ? (\n <Text emphasis=\"muted\" variant=\"caption\">\n {option.description}\n </Text>\n ) : null}\n </Stack>\n </Radio>\n );\n}\n"]}
|
|
@@ -3,15 +3,214 @@ export declare const radioMeta: {
|
|
|
3
3
|
readonly category: "component";
|
|
4
4
|
readonly directManifestNode: false;
|
|
5
5
|
readonly allowedChildren: readonly [];
|
|
6
|
-
readonly note: "
|
|
6
|
+
readonly note: "Composition-level radio control; author repeated single-choice UI through RadioGroup.";
|
|
7
7
|
readonly props: {};
|
|
8
8
|
};
|
|
9
9
|
export declare const radioGroupMeta: {
|
|
10
10
|
readonly name: "RadioGroup";
|
|
11
11
|
readonly category: "component";
|
|
12
|
-
readonly
|
|
12
|
+
readonly description: "Single-choice group with inline or card presentation while preserving radio semantics.";
|
|
13
|
+
readonly directManifestNode: true;
|
|
13
14
|
readonly allowedChildren: readonly [];
|
|
14
|
-
readonly
|
|
15
|
-
|
|
15
|
+
readonly blueprint: {
|
|
16
|
+
readonly label: "Radio group";
|
|
17
|
+
readonly defaultProps: {
|
|
18
|
+
readonly value: "option-b";
|
|
19
|
+
readonly options: readonly [{
|
|
20
|
+
readonly value: "option-a";
|
|
21
|
+
readonly label: "First option";
|
|
22
|
+
readonly description: "Supporting detail";
|
|
23
|
+
}, {
|
|
24
|
+
readonly value: "option-b";
|
|
25
|
+
readonly label: "Second option";
|
|
26
|
+
readonly description: "Supporting detail";
|
|
27
|
+
}, {
|
|
28
|
+
readonly value: "option-c";
|
|
29
|
+
readonly label: "Third option";
|
|
30
|
+
readonly description: "Supporting detail";
|
|
31
|
+
}];
|
|
32
|
+
readonly orientation: "vertical";
|
|
33
|
+
readonly presentation: "inline";
|
|
34
|
+
readonly invalid: false;
|
|
35
|
+
readonly readOnly: false;
|
|
36
|
+
readonly disabled: false;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
readonly bindings: {
|
|
40
|
+
readonly props: {
|
|
41
|
+
readonly value: {
|
|
42
|
+
readonly label: "Value";
|
|
43
|
+
readonly description: "Currently selected option value.";
|
|
44
|
+
readonly value: {
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
};
|
|
47
|
+
readonly acceptsFallback: true;
|
|
48
|
+
readonly acceptsTransforms: true;
|
|
49
|
+
};
|
|
50
|
+
readonly disabled: {
|
|
51
|
+
readonly label: "Disabled";
|
|
52
|
+
readonly description: "Whether the complete radio group is disabled.";
|
|
53
|
+
readonly value: {
|
|
54
|
+
readonly type: "boolean";
|
|
55
|
+
};
|
|
56
|
+
readonly acceptsFallback: true;
|
|
57
|
+
readonly acceptsTransforms: true;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
readonly events: {
|
|
61
|
+
readonly valueChange: {
|
|
62
|
+
readonly label: "Value change";
|
|
63
|
+
readonly description: "Runs when the selected radio value changes.";
|
|
64
|
+
readonly payload: {
|
|
65
|
+
readonly eventType: "radioGroup.valueChange";
|
|
66
|
+
readonly fields: readonly [{
|
|
67
|
+
readonly path: "value";
|
|
68
|
+
readonly type: "string";
|
|
69
|
+
readonly label: "Value";
|
|
70
|
+
}];
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
readonly events: {
|
|
76
|
+
readonly valueChange: {
|
|
77
|
+
readonly label: "Value change";
|
|
78
|
+
readonly eventType: "radioGroup.valueChange";
|
|
79
|
+
readonly description: "Emitted when the selected radio value changes.";
|
|
80
|
+
readonly payloadFields: readonly [{
|
|
81
|
+
readonly path: "value";
|
|
82
|
+
readonly type: "string";
|
|
83
|
+
readonly label: "Value";
|
|
84
|
+
}];
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
readonly props: {
|
|
88
|
+
readonly value: {
|
|
89
|
+
readonly type: "string";
|
|
90
|
+
readonly category: "State";
|
|
91
|
+
readonly label: "Value";
|
|
92
|
+
readonly authoring: {
|
|
93
|
+
readonly authority: "instance";
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
readonly options: {
|
|
97
|
+
readonly type: "array";
|
|
98
|
+
readonly category: "Content";
|
|
99
|
+
readonly label: "Options";
|
|
100
|
+
readonly itemSchema: readonly [{
|
|
101
|
+
readonly key: "value";
|
|
102
|
+
readonly schema: {
|
|
103
|
+
readonly type: "string";
|
|
104
|
+
readonly category: "Content";
|
|
105
|
+
readonly label: "Value";
|
|
106
|
+
};
|
|
107
|
+
}, {
|
|
108
|
+
readonly key: "label";
|
|
109
|
+
readonly schema: {
|
|
110
|
+
readonly type: "string";
|
|
111
|
+
readonly category: "Content";
|
|
112
|
+
readonly label: "Label";
|
|
113
|
+
};
|
|
114
|
+
}, {
|
|
115
|
+
readonly key: "description";
|
|
116
|
+
readonly schema: {
|
|
117
|
+
readonly type: "string";
|
|
118
|
+
readonly category: "Content";
|
|
119
|
+
readonly label: "Description";
|
|
120
|
+
};
|
|
121
|
+
}, {
|
|
122
|
+
readonly key: "disabled";
|
|
123
|
+
readonly schema: {
|
|
124
|
+
readonly type: "boolean";
|
|
125
|
+
readonly category: "State";
|
|
126
|
+
readonly label: "Disabled";
|
|
127
|
+
readonly default: false;
|
|
128
|
+
};
|
|
129
|
+
}];
|
|
130
|
+
readonly authoring: {
|
|
131
|
+
readonly authority: "instance";
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
readonly orientation: {
|
|
135
|
+
readonly type: "enum";
|
|
136
|
+
readonly category: "Layout";
|
|
137
|
+
readonly label: "Orientation";
|
|
138
|
+
readonly enum: readonly ["horizontal", "vertical"];
|
|
139
|
+
readonly default: "vertical";
|
|
140
|
+
readonly authoring: {
|
|
141
|
+
readonly authority: "instance";
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
readonly gap: {
|
|
145
|
+
readonly type: "enum";
|
|
146
|
+
readonly category: "Layout";
|
|
147
|
+
readonly label: "Gap";
|
|
148
|
+
readonly enum: readonly ["xs", "s", "m", "l"];
|
|
149
|
+
readonly authoring: {
|
|
150
|
+
readonly authority: "theme";
|
|
151
|
+
readonly scope: "component";
|
|
152
|
+
readonly allowInstanceOverride: true;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
readonly presentation: {
|
|
156
|
+
readonly type: "enum";
|
|
157
|
+
readonly category: "Style";
|
|
158
|
+
readonly label: "Presentation";
|
|
159
|
+
readonly enum: readonly ["inline", "card"];
|
|
160
|
+
readonly default: "inline";
|
|
161
|
+
readonly authoring: {
|
|
162
|
+
readonly authority: "instance";
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
readonly color: {
|
|
166
|
+
readonly type: "enum";
|
|
167
|
+
readonly category: "Style";
|
|
168
|
+
readonly label: "Color";
|
|
169
|
+
readonly enum: readonly ["primary", "secondary", "tertiary", "quaternary", "neutral", "success", "warning", "error", "info", "danger"];
|
|
170
|
+
readonly authoring: {
|
|
171
|
+
readonly authority: "theme";
|
|
172
|
+
readonly scope: "component";
|
|
173
|
+
readonly allowInstanceOverride: true;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
readonly size: {
|
|
177
|
+
readonly type: "enum";
|
|
178
|
+
readonly category: "Style";
|
|
179
|
+
readonly label: "Size";
|
|
180
|
+
readonly enum: readonly ["s", "m", "l"];
|
|
181
|
+
readonly authoring: {
|
|
182
|
+
readonly authority: "theme";
|
|
183
|
+
readonly scope: "component";
|
|
184
|
+
readonly allowInstanceOverride: true;
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
readonly invalid: {
|
|
188
|
+
readonly type: "boolean";
|
|
189
|
+
readonly category: "State";
|
|
190
|
+
readonly label: "Invalid";
|
|
191
|
+
readonly default: false;
|
|
192
|
+
readonly authoring: {
|
|
193
|
+
readonly authority: "instance";
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
readonly readOnly: {
|
|
197
|
+
readonly type: "boolean";
|
|
198
|
+
readonly category: "State";
|
|
199
|
+
readonly label: "Read only";
|
|
200
|
+
readonly default: false;
|
|
201
|
+
readonly authoring: {
|
|
202
|
+
readonly authority: "instance";
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
readonly disabled: {
|
|
206
|
+
readonly type: "boolean";
|
|
207
|
+
readonly category: "State";
|
|
208
|
+
readonly label: "Disabled";
|
|
209
|
+
readonly default: false;
|
|
210
|
+
readonly authoring: {
|
|
211
|
+
readonly authority: "instance";
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
};
|
|
16
215
|
};
|
|
17
216
|
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/components/radio/meta.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/components/radio/meta.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,SAAS;;;;;;;CAOgB,CAAC;AAEvC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsKW,CAAC"}
|
|
@@ -1,17 +1,181 @@
|
|
|
1
|
+
import { ZORA_COLORS } from '../../internal/colorModel';
|
|
2
|
+
const themeAuthoring = {
|
|
3
|
+
authority: 'theme',
|
|
4
|
+
scope: 'component',
|
|
5
|
+
allowInstanceOverride: true,
|
|
6
|
+
};
|
|
1
7
|
export const radioMeta = {
|
|
2
8
|
name: 'Radio',
|
|
3
9
|
category: 'component',
|
|
4
10
|
directManifestNode: false,
|
|
5
11
|
allowedChildren: [],
|
|
6
|
-
note: '
|
|
12
|
+
note: 'Composition-level radio control; author repeated single-choice UI through RadioGroup.',
|
|
7
13
|
props: {},
|
|
8
14
|
};
|
|
9
15
|
export const radioGroupMeta = {
|
|
10
16
|
name: 'RadioGroup',
|
|
11
17
|
category: 'component',
|
|
12
|
-
|
|
18
|
+
description: 'Single-choice group with inline or card presentation while preserving radio semantics.',
|
|
19
|
+
directManifestNode: true,
|
|
13
20
|
allowedChildren: [],
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
blueprint: {
|
|
22
|
+
label: 'Radio group',
|
|
23
|
+
defaultProps: {
|
|
24
|
+
value: 'option-b',
|
|
25
|
+
options: [
|
|
26
|
+
{ value: 'option-a', label: 'First option', description: 'Supporting detail' },
|
|
27
|
+
{ value: 'option-b', label: 'Second option', description: 'Supporting detail' },
|
|
28
|
+
{ value: 'option-c', label: 'Third option', description: 'Supporting detail' },
|
|
29
|
+
],
|
|
30
|
+
orientation: 'vertical',
|
|
31
|
+
presentation: 'inline',
|
|
32
|
+
invalid: false,
|
|
33
|
+
readOnly: false,
|
|
34
|
+
disabled: false,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
bindings: {
|
|
38
|
+
props: {
|
|
39
|
+
value: {
|
|
40
|
+
label: 'Value',
|
|
41
|
+
description: 'Currently selected option value.',
|
|
42
|
+
value: { type: 'string' },
|
|
43
|
+
acceptsFallback: true,
|
|
44
|
+
acceptsTransforms: true,
|
|
45
|
+
},
|
|
46
|
+
disabled: {
|
|
47
|
+
label: 'Disabled',
|
|
48
|
+
description: 'Whether the complete radio group is disabled.',
|
|
49
|
+
value: { type: 'boolean' },
|
|
50
|
+
acceptsFallback: true,
|
|
51
|
+
acceptsTransforms: true,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
events: {
|
|
55
|
+
valueChange: {
|
|
56
|
+
label: 'Value change',
|
|
57
|
+
description: 'Runs when the selected radio value changes.',
|
|
58
|
+
payload: {
|
|
59
|
+
eventType: 'radioGroup.valueChange',
|
|
60
|
+
fields: [{ path: 'value', type: 'string', label: 'Value' }],
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
events: {
|
|
66
|
+
valueChange: {
|
|
67
|
+
label: 'Value change',
|
|
68
|
+
eventType: 'radioGroup.valueChange',
|
|
69
|
+
description: 'Emitted when the selected radio value changes.',
|
|
70
|
+
payloadFields: [{ path: 'value', type: 'string', label: 'Value' }],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
props: {
|
|
74
|
+
value: {
|
|
75
|
+
type: 'string',
|
|
76
|
+
category: 'State',
|
|
77
|
+
label: 'Value',
|
|
78
|
+
authoring: { authority: 'instance' },
|
|
79
|
+
},
|
|
80
|
+
options: {
|
|
81
|
+
type: 'array',
|
|
82
|
+
category: 'Content',
|
|
83
|
+
label: 'Options',
|
|
84
|
+
itemSchema: [
|
|
85
|
+
{
|
|
86
|
+
key: 'value',
|
|
87
|
+
schema: {
|
|
88
|
+
type: 'string',
|
|
89
|
+
category: 'Content',
|
|
90
|
+
label: 'Value',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
key: 'label',
|
|
95
|
+
schema: {
|
|
96
|
+
type: 'string',
|
|
97
|
+
category: 'Content',
|
|
98
|
+
label: 'Label',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
key: 'description',
|
|
103
|
+
schema: {
|
|
104
|
+
type: 'string',
|
|
105
|
+
category: 'Content',
|
|
106
|
+
label: 'Description',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
key: 'disabled',
|
|
111
|
+
schema: {
|
|
112
|
+
type: 'boolean',
|
|
113
|
+
category: 'State',
|
|
114
|
+
label: 'Disabled',
|
|
115
|
+
default: false,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
authoring: { authority: 'instance' },
|
|
120
|
+
},
|
|
121
|
+
orientation: {
|
|
122
|
+
type: 'enum',
|
|
123
|
+
category: 'Layout',
|
|
124
|
+
label: 'Orientation',
|
|
125
|
+
enum: ['horizontal', 'vertical'],
|
|
126
|
+
default: 'vertical',
|
|
127
|
+
authoring: { authority: 'instance' },
|
|
128
|
+
},
|
|
129
|
+
gap: {
|
|
130
|
+
type: 'enum',
|
|
131
|
+
category: 'Layout',
|
|
132
|
+
label: 'Gap',
|
|
133
|
+
enum: ['xs', 's', 'm', 'l'],
|
|
134
|
+
authoring: themeAuthoring,
|
|
135
|
+
},
|
|
136
|
+
presentation: {
|
|
137
|
+
type: 'enum',
|
|
138
|
+
category: 'Style',
|
|
139
|
+
label: 'Presentation',
|
|
140
|
+
enum: ['inline', 'card'],
|
|
141
|
+
default: 'inline',
|
|
142
|
+
authoring: { authority: 'instance' },
|
|
143
|
+
},
|
|
144
|
+
color: {
|
|
145
|
+
type: 'enum',
|
|
146
|
+
category: 'Style',
|
|
147
|
+
label: 'Color',
|
|
148
|
+
enum: [...ZORA_COLORS],
|
|
149
|
+
authoring: themeAuthoring,
|
|
150
|
+
},
|
|
151
|
+
size: {
|
|
152
|
+
type: 'enum',
|
|
153
|
+
category: 'Style',
|
|
154
|
+
label: 'Size',
|
|
155
|
+
enum: ['s', 'm', 'l'],
|
|
156
|
+
authoring: themeAuthoring,
|
|
157
|
+
},
|
|
158
|
+
invalid: {
|
|
159
|
+
type: 'boolean',
|
|
160
|
+
category: 'State',
|
|
161
|
+
label: 'Invalid',
|
|
162
|
+
default: false,
|
|
163
|
+
authoring: { authority: 'instance' },
|
|
164
|
+
},
|
|
165
|
+
readOnly: {
|
|
166
|
+
type: 'boolean',
|
|
167
|
+
category: 'State',
|
|
168
|
+
label: 'Read only',
|
|
169
|
+
default: false,
|
|
170
|
+
authoring: { authority: 'instance' },
|
|
171
|
+
},
|
|
172
|
+
disabled: {
|
|
173
|
+
type: 'boolean',
|
|
174
|
+
category: 'State',
|
|
175
|
+
label: 'Disabled',
|
|
176
|
+
default: false,
|
|
177
|
+
authoring: { authority: 'instance' },
|
|
178
|
+
},
|
|
179
|
+
},
|
|
16
180
|
};
|
|
17
181
|
//# sourceMappingURL=meta.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/components/radio/meta.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/components/radio/meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,MAAM,cAAc,GAAG;IACrB,SAAS,EAAE,OAAO;IAClB,KAAK,EAAE,WAAW;IAClB,qBAAqB,EAAE,IAAI;CACnB,CAAC;AAEX,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,IAAI,EAAE,OAAO;IACb,QAAQ,EAAE,WAAW;IACrB,kBAAkB,EAAE,KAAK;IACzB,eAAe,EAAE,EAAE;IACnB,IAAI,EAAE,uFAAuF;IAC7F,KAAK,EAAE,EAAE;CAC2B,CAAC;AAEvC,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,YAAY;IAClB,QAAQ,EAAE,WAAW;IACrB,WAAW,EACT,wFAAwF;IAC1F,kBAAkB,EAAE,IAAI;IACxB,eAAe,EAAE,EAAE;IACnB,SAAS,EAAE;QACT,KAAK,EAAE,aAAa;QACpB,YAAY,EAAE;YACZ,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,mBAAmB,EAAE;gBAC9E,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,mBAAmB,EAAE;gBAC/E,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,mBAAmB,EAAE;aAC/E;YACD,WAAW,EAAE,UAAU;YACvB,YAAY,EAAE,QAAQ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AAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,KAAK,EAAE;YACL,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC;YACtB,SAAS,EAAE,cAAc;SAC1B;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,MAAM;YACb,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;YACrB,SAAS,EAAE,cAAc;SAC1B;QACD,OAAO,EAAE;YACP,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,WAAW;YAClB,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;KACF;CACmC,CAAC","sourcesContent":["import { ZORA_COLORS } from '../../internal/colorModel';\nimport type { ZoraComponentMeta } from '../../metadata';\n\nconst themeAuthoring = {\n authority: 'theme',\n scope: 'component',\n allowInstanceOverride: true,\n} as const;\n\nexport const radioMeta = {\n name: 'Radio',\n category: 'component',\n directManifestNode: false,\n allowedChildren: [],\n note: 'Composition-level radio control; author repeated single-choice UI through RadioGroup.',\n props: {},\n} as const satisfies ZoraComponentMeta;\n\nexport const radioGroupMeta = {\n name: 'RadioGroup',\n category: 'component',\n description:\n 'Single-choice group with inline or card presentation while preserving radio semantics.',\n directManifestNode: true,\n allowedChildren: [],\n blueprint: {\n label: 'Radio group',\n defaultProps: {\n value: 'option-b',\n options: [\n { value: 'option-a', label: 'First option', description: 'Supporting detail' },\n { value: 'option-b', label: 'Second option', description: 'Supporting detail' },\n { value: 'option-c', label: 'Third option', description: 'Supporting detail' },\n ],\n orientation: 'vertical',\n presentation: 'inline',\n invalid: false,\n readOnly: false,\n disabled: false,\n },\n },\n bindings: {\n props: {\n value: {\n label: 'Value',\n description: 'Currently selected option value.',\n value: { type: 'string' },\n acceptsFallback: true,\n acceptsTransforms: true,\n },\n disabled: {\n label: 'Disabled',\n description: 'Whether the complete radio group is disabled.',\n value: { type: 'boolean' },\n acceptsFallback: true,\n acceptsTransforms: true,\n },\n },\n events: {\n valueChange: {\n label: 'Value change',\n description: 'Runs when the selected radio value changes.',\n payload: {\n eventType: 'radioGroup.valueChange',\n fields: [{ path: 'value', type: 'string', label: 'Value' }],\n },\n },\n },\n },\n events: {\n valueChange: {\n label: 'Value change',\n eventType: 'radioGroup.valueChange',\n description: 'Emitted when the selected radio value changes.',\n payloadFields: [{ path: 'value', type: 'string', label: 'Value' }],\n },\n },\n props: {\n value: {\n type: 'string',\n category: 'State',\n label: 'Value',\n authoring: { authority: 'instance' },\n },\n options: {\n type: 'array',\n category: 'Content',\n label: 'Options',\n itemSchema: [\n {\n key: 'value',\n schema: {\n type: 'string',\n category: 'Content',\n label: 'Value',\n },\n },\n {\n key: 'label',\n schema: {\n type: 'string',\n category: 'Content',\n label: 'Label',\n },\n },\n {\n key: 'description',\n schema: {\n type: 'string',\n category: 'Content',\n label: 'Description',\n },\n },\n {\n key: 'disabled',\n schema: {\n type: 'boolean',\n category: 'State',\n label: 'Disabled',\n default: false,\n },\n },\n ],\n authoring: { authority: 'instance' },\n },\n orientation: {\n type: 'enum',\n category: 'Layout',\n label: 'Orientation',\n enum: ['horizontal', 'vertical'],\n default: 'vertical',\n authoring: { authority: 'instance' },\n },\n gap: {\n type: 'enum',\n category: 'Layout',\n label: 'Gap',\n enum: ['xs', 's', 'm', 'l'],\n authoring: themeAuthoring,\n },\n presentation: {\n type: 'enum',\n category: 'Style',\n label: 'Presentation',\n enum: ['inline', 'card'],\n default: 'inline',\n authoring: { authority: 'instance' },\n },\n color: {\n type: 'enum',\n category: 'Style',\n label: 'Color',\n enum: [...ZORA_COLORS],\n authoring: themeAuthoring,\n },\n size: {\n type: 'enum',\n category: 'Style',\n label: 'Size',\n enum: ['s', 'm', 'l'],\n authoring: themeAuthoring,\n },\n invalid: {\n type: 'boolean',\n category: 'State',\n label: 'Invalid',\n default: false,\n authoring: { authority: 'instance' },\n },\n readOnly: {\n type: 'boolean',\n category: 'State',\n label: 'Read only',\n default: false,\n authoring: { authority: 'instance' },\n },\n disabled: {\n type: 'boolean',\n category: 'State',\n label: 'Disabled',\n default: false,\n authoring: { authority: 'instance' },\n },\n },\n} as const satisfies ZoraComponentMeta;\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ThemeRecipeOverrideValue } from '@ankhorage/contracts';
|
|
2
|
+
import type { ZoraColor } from '../../internal/colorModel';
|
|
3
|
+
import type { RadioGroupProps } from './types';
|
|
4
|
+
type RadioGroupGap = NonNullable<RadioGroupProps<string>['gap']>;
|
|
5
|
+
type RadioGroupSize = NonNullable<RadioGroupProps<string>['size']>;
|
|
6
|
+
/***
|
|
7
|
+
* Resolves RadioGroup presentation props from instance overrides and the active theme recipe.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveRadioGroupThemeRecipe(input: {
|
|
10
|
+
readonly gap?: RadioGroupGap;
|
|
11
|
+
readonly color?: ZoraColor;
|
|
12
|
+
readonly size?: RadioGroupSize;
|
|
13
|
+
readonly themeFields: Readonly<Record<string, ThemeRecipeOverrideValue>>;
|
|
14
|
+
}): {
|
|
15
|
+
readonly gap: RadioGroupGap;
|
|
16
|
+
readonly color: "primary" | "secondary" | "tertiary" | "quaternary" | "neutral" | "error" | "success" | "warning" | "info" | "danger";
|
|
17
|
+
readonly size: RadioGroupSize;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=resolveRadioGroupThemeRecipe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveRadioGroupThemeRecipe.d.ts","sourceRoot":"","sources":["../../../src/components/radio/resolveRadioGroupThemeRecipe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,KAAK,aAAa,GAAG,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AACjE,KAAK,cAAc,GAAG,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAEnE;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE;IAClD,QAAQ,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC,CAAC;CAC1E;;;;EAMA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/***
|
|
2
|
+
* Resolves RadioGroup presentation props from instance overrides and the active theme recipe.
|
|
3
|
+
*/
|
|
4
|
+
export function resolveRadioGroupThemeRecipe(input) {
|
|
5
|
+
return {
|
|
6
|
+
gap: input.gap ?? readGap(input.themeFields.gap) ?? 's',
|
|
7
|
+
color: input.color ?? readColor(input.themeFields.color) ?? 'primary',
|
|
8
|
+
size: input.size ?? readSize(input.themeFields.size) ?? 'm',
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/*** Reads a valid RadioGroup gap from a theme recipe value. */
|
|
12
|
+
function readGap(value) {
|
|
13
|
+
if (value === 'xs' || value === 's' || value === 'm' || value === 'l')
|
|
14
|
+
return value;
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
/*** Reads a valid ZORA color from a theme recipe value. */
|
|
18
|
+
function readColor(value) {
|
|
19
|
+
if (value === 'primary' || value === 'secondary' || value === 'tertiary')
|
|
20
|
+
return value;
|
|
21
|
+
if (value === 'quaternary' || value === 'neutral' || value === 'danger')
|
|
22
|
+
return value;
|
|
23
|
+
if (value === 'success' || value === 'warning' || value === 'error' || value === 'info') {
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
/*** Reads a valid RadioGroup control size from a theme recipe value. */
|
|
29
|
+
function readSize(value) {
|
|
30
|
+
if (value === 's' || value === 'm' || value === 'l')
|
|
31
|
+
return value;
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=resolveRadioGroupThemeRecipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveRadioGroupThemeRecipe.js","sourceRoot":"","sources":["../../../src/components/radio/resolveRadioGroupThemeRecipe.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAK5C;IACC,OAAO;QACL,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,GAAG;QACvD,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,SAAS;QACrE,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,GAAG;KACnD,CAAC;AACb,CAAC;AAED,+DAA+D;AAC/D,SAAS,OAAO,CAAC,KAA2C;IAC1D,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,GAAG;QAAE,OAAO,KAAK,CAAC;IACpF,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,2DAA2D;AAC3D,SAAS,SAAS,CAAC,KAA2C;IAC5D,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,UAAU;QAAE,OAAO,KAAK,CAAC;IACvF,IAAI,KAAK,KAAK,YAAY,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtF,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;QACxF,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,wEAAwE;AACxE,SAAS,QAAQ,CAAC,KAA2C;IAC3D,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,GAAG;QAAE,OAAO,KAAK,CAAC;IAClE,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import type { ThemeRecipeOverrideValue } from '@ankhorage/contracts';\n\nimport type { ZoraColor } from '../../internal/colorModel';\nimport type { RadioGroupProps } from './types';\n\ntype RadioGroupGap = NonNullable<RadioGroupProps<string>['gap']>;\ntype RadioGroupSize = NonNullable<RadioGroupProps<string>['size']>;\n\n/***\n * Resolves RadioGroup presentation props from instance overrides and the active theme recipe.\n */\nexport function resolveRadioGroupThemeRecipe(input: {\n readonly gap?: RadioGroupGap;\n readonly color?: ZoraColor;\n readonly size?: RadioGroupSize;\n readonly themeFields: Readonly<Record<string, ThemeRecipeOverrideValue>>;\n}) {\n return {\n gap: input.gap ?? readGap(input.themeFields.gap) ?? 's',\n color: input.color ?? readColor(input.themeFields.color) ?? 'primary',\n size: input.size ?? readSize(input.themeFields.size) ?? 'm',\n } as const;\n}\n\n/*** Reads a valid RadioGroup gap from a theme recipe value. */\nfunction readGap(value: ThemeRecipeOverrideValue | undefined): RadioGroupGap | undefined {\n if (value === 'xs' || value === 's' || value === 'm' || value === 'l') return value;\n return undefined;\n}\n\n/*** Reads a valid ZORA color from a theme recipe value. */\nfunction readColor(value: ThemeRecipeOverrideValue | undefined): ZoraColor | undefined {\n if (value === 'primary' || value === 'secondary' || value === 'tertiary') return value;\n if (value === 'quaternary' || value === 'neutral' || value === 'danger') return value;\n if (value === 'success' || value === 'warning' || value === 'error' || value === 'info') {\n return value;\n }\n return undefined;\n}\n\n/*** Reads a valid RadioGroup control size from a theme recipe value. */\nfunction readSize(value: ThemeRecipeOverrideValue | undefined): RadioGroupSize | undefined {\n if (value === 's' || value === 'm' || value === 'l') return value;\n return undefined;\n}\n"]}
|