Skip to content

Commit 4970622

Browse files
committed
feat: Add radio button component to Core
1 parent 972aa7c commit 4970622

File tree

20 files changed

+608
-159
lines changed

20 files changed

+608
-159
lines changed

build-tools/utils/pluralize.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const pluralizationMap = {
5959
ProgressBar: 'ProgressBars',
6060
PromptInput: 'PromptInputs',
6161
PropertyFilter: 'PropertyFilters',
62+
RadioButton: 'RadioButtons',
6263
RadioGroup: 'RadioGroups',
6364
S3ResourceSelector: 'S3ResourceSelectors',
6465
SegmentedControl: 'SegmentedControls',

src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap

Lines changed: 323 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19469,6 +19469,324 @@ This is only shown when \`statusType\` is set to \`finished\` or not set at all.
1946919469
}
1947019470
`;
1947119471

19472+
exports[`Components definition for radio-button matches the snapshot: radio-button 1`] = `
19473+
{
19474+
"dashCaseName": "radio-button",
19475+
"events": [
19476+
{
19477+
"cancelable": false,
19478+
"detailInlineType": {
19479+
"name": "RadioButtonProps.ChangeDetail",
19480+
"properties": [
19481+
{
19482+
"name": "value",
19483+
"optional": false,
19484+
"type": "string",
19485+
},
19486+
],
19487+
"type": "object",
19488+
},
19489+
"detailType": "RadioButtonProps.ChangeDetail",
19490+
"name": "onChange",
19491+
},
19492+
],
19493+
"functions": [
19494+
{
19495+
"description": "Sets input focus onto the UI control.",
19496+
"name": "focus",
19497+
"parameters": [],
19498+
"returnType": "void",
19499+
},
19500+
],
19501+
"name": "RadioButton",
19502+
"properties": [
19503+
{
19504+
"name": "checked",
19505+
"optional": false,
19506+
"type": "boolean",
19507+
},
19508+
{
19509+
"deprecatedTag": "Custom CSS is not supported. For testing and other use cases, use [data attributes](https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes).",
19510+
"description": "Adds the specified classes to the root element of the component.",
19511+
"name": "className",
19512+
"optional": true,
19513+
"type": "string",
19514+
},
19515+
{
19516+
"name": "controlId",
19517+
"optional": true,
19518+
"type": "string",
19519+
},
19520+
{
19521+
"name": "disabled",
19522+
"optional": true,
19523+
"type": "boolean",
19524+
},
19525+
{
19526+
"deprecatedTag": "The usage of the \`id\` attribute is reserved for internal use cases. For testing and other use cases,
19527+
use [data attributes](https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes). If you must
19528+
use the \`id\` attribute, consider setting it on a parent element instead.",
19529+
"description": "Adds the specified ID to the root element of the component.",
19530+
"name": "id",
19531+
"optional": true,
19532+
"type": "string",
19533+
},
19534+
{
19535+
"name": "name",
19536+
"optional": false,
19537+
"type": "string",
19538+
},
19539+
{
19540+
"name": "readOnly",
19541+
"optional": true,
19542+
"type": "boolean",
19543+
},
19544+
{
19545+
"inlineType": {
19546+
"name": "RadioButtonProps.Style",
19547+
"properties": [
19548+
{
19549+
"inlineType": {
19550+
"name": "object",
19551+
"properties": [
19552+
{
19553+
"inlineType": {
19554+
"name": "object",
19555+
"properties": [
19556+
{
19557+
"name": "checked",
19558+
"optional": true,
19559+
"type": "string",
19560+
},
19561+
{
19562+
"name": "default",
19563+
"optional": true,
19564+
"type": "string",
19565+
},
19566+
{
19567+
"name": "disabled",
19568+
"optional": true,
19569+
"type": "string",
19570+
},
19571+
{
19572+
"name": "readOnly",
19573+
"optional": true,
19574+
"type": "string",
19575+
},
19576+
],
19577+
"type": "object",
19578+
},
19579+
"name": "color",
19580+
"optional": true,
19581+
"type": "{ checked?: string | undefined; default?: string | undefined; disabled?: string | undefined; readOnly?: string | undefined; }",
19582+
},
19583+
],
19584+
"type": "object",
19585+
},
19586+
"name": "description",
19587+
"optional": true,
19588+
"type": "{ color?: { checked?: string | undefined; default?: string | undefined; disabled?: string | undefined; readOnly?: string | undefined; } | undefined; }",
19589+
},
19590+
{
19591+
"inlineType": {
19592+
"name": "object",
19593+
"properties": [
19594+
{
19595+
"inlineType": {
19596+
"name": "object",
19597+
"properties": [
19598+
{
19599+
"inlineType": {
19600+
"name": "{ checked?: string | undefined; disabled?: string | undefined; readOnly?: string | undefined; }",
19601+
"properties": [
19602+
{
19603+
"name": "checked",
19604+
"optional": true,
19605+
"type": "string",
19606+
},
19607+
{
19608+
"name": "disabled",
19609+
"optional": true,
19610+
"type": "string",
19611+
},
19612+
{
19613+
"name": "readOnly",
19614+
"optional": true,
19615+
"type": "string",
19616+
},
19617+
],
19618+
"type": "object",
19619+
},
19620+
"name": "fill",
19621+
"optional": true,
19622+
"type": "{ checked?: string | undefined; disabled?: string | undefined; readOnly?: string | undefined; }",
19623+
},
19624+
],
19625+
"type": "object",
19626+
},
19627+
"name": "circle",
19628+
"optional": true,
19629+
"type": "{ fill?: { checked?: string | undefined; disabled?: string | undefined; readOnly?: string | undefined; } | undefined; }",
19630+
},
19631+
{
19632+
"inlineType": {
19633+
"name": "object",
19634+
"properties": [
19635+
{
19636+
"name": "checked",
19637+
"optional": true,
19638+
"type": "string",
19639+
},
19640+
{
19641+
"name": "default",
19642+
"optional": true,
19643+
"type": "string",
19644+
},
19645+
{
19646+
"name": "disabled",
19647+
"optional": true,
19648+
"type": "string",
19649+
},
19650+
{
19651+
"name": "readOnly",
19652+
"optional": true,
19653+
"type": "string",
19654+
},
19655+
],
19656+
"type": "object",
19657+
},
19658+
"name": "fill",
19659+
"optional": true,
19660+
"type": "{ checked?: string | undefined; default?: string | undefined; disabled?: string | undefined; readOnly?: string | undefined; }",
19661+
},
19662+
{
19663+
"inlineType": {
19664+
"name": "object",
19665+
"properties": [
19666+
{
19667+
"name": "borderColor",
19668+
"optional": true,
19669+
"type": "string",
19670+
},
19671+
{
19672+
"name": "borderRadius",
19673+
"optional": true,
19674+
"type": "string",
19675+
},
19676+
{
19677+
"name": "borderWidth",
19678+
"optional": true,
19679+
"type": "string",
19680+
},
19681+
],
19682+
"type": "object",
19683+
},
19684+
"name": "focusRing",
19685+
"optional": true,
19686+
"type": "{ borderColor?: string | undefined; borderRadius?: string | undefined; borderWidth?: string | undefined; }",
19687+
},
19688+
{
19689+
"inlineType": {
19690+
"name": "{ default?: string | undefined; disabled?: string | undefined; readOnly?: string | undefined; }",
19691+
"properties": [
19692+
{
19693+
"name": "default",
19694+
"optional": true,
19695+
"type": "string",
19696+
},
19697+
{
19698+
"name": "disabled",
19699+
"optional": true,
19700+
"type": "string",
19701+
},
19702+
{
19703+
"name": "readOnly",
19704+
"optional": true,
19705+
"type": "string",
19706+
},
19707+
],
19708+
"type": "object",
19709+
},
19710+
"name": "stroke",
19711+
"optional": true,
19712+
"type": "{ default?: string | undefined; disabled?: string | undefined; readOnly?: string | undefined; }",
19713+
},
19714+
],
19715+
"type": "object",
19716+
},
19717+
"name": "input",
19718+
"optional": true,
19719+
"type": "{ fill?: { checked?: string | undefined; default?: string | undefined; disabled?: string | undefined; readOnly?: string | undefined; } | undefined; stroke?: { default?: string | undefined; disabled?: string | undefined; readOnly?: string | undefined; } | undefined; circle?: { ...; } | undefined; focusRing?: { ...; }...",
19720+
},
19721+
{
19722+
"inlineType": {
19723+
"name": "object",
19724+
"properties": [
19725+
{
19726+
"inlineType": {
19727+
"name": "object",
19728+
"properties": [
19729+
{
19730+
"name": "checked",
19731+
"optional": true,
19732+
"type": "string",
19733+
},
19734+
{
19735+
"name": "default",
19736+
"optional": true,
19737+
"type": "string",
19738+
},
19739+
{
19740+
"name": "disabled",
19741+
"optional": true,
19742+
"type": "string",
19743+
},
19744+
{
19745+
"name": "readOnly",
19746+
"optional": true,
19747+
"type": "string",
19748+
},
19749+
],
19750+
"type": "object",
19751+
},
19752+
"name": "color",
19753+
"optional": true,
19754+
"type": "{ checked?: string | undefined; default?: string | undefined; disabled?: string | undefined; readOnly?: string | undefined; }",
19755+
},
19756+
],
19757+
"type": "object",
19758+
},
19759+
"name": "label",
19760+
"optional": true,
19761+
"type": "{ color?: { checked?: string | undefined; default?: string | undefined; disabled?: string | undefined; readOnly?: string | undefined; } | undefined; }",
19762+
},
19763+
],
19764+
"type": "object",
19765+
},
19766+
"name": "style",
19767+
"optional": true,
19768+
"type": "RadioButtonProps.Style",
19769+
},
19770+
{
19771+
"name": "value",
19772+
"optional": false,
19773+
"type": "string",
19774+
},
19775+
],
19776+
"regions": [
19777+
{
19778+
"isDefault": false,
19779+
"name": "description",
19780+
},
19781+
{
19782+
"isDefault": false,
19783+
"name": "label",
19784+
},
19785+
],
19786+
"releaseStatus": "stable",
19787+
}
19788+
`;
19789+
1947219790
exports[`Components definition for radio-group matches the snapshot: radio-group 1`] = `
1947319791
{
1947419792
"dashCaseName": "radio-group",
@@ -19477,7 +19795,7 @@ exports[`Components definition for radio-group matches the snapshot: radio-group
1947719795
"cancelable": false,
1947819796
"description": "Called when the user selects a different radio button. The event \`detail\` contains the current \`value\`.",
1947919797
"detailInlineType": {
19480-
"name": "RadioGroupProps.ChangeDetail",
19798+
"name": "RadioButtonProps.ChangeDetail",
1948119799
"properties": [
1948219800
{
1948319801
"name": "value",
@@ -19487,7 +19805,7 @@ exports[`Components definition for radio-group matches the snapshot: radio-group
1948719805
],
1948819806
"type": "object",
1948919807
},
19490-
"detailType": "RadioGroupProps.ChangeDetail",
19808+
"detailType": "RadioButtonProps.ChangeDetail",
1949119809
"name": "onChange",
1949219810
},
1949319811
],
@@ -19584,7 +19902,7 @@ use the \`id\` attribute, consider setting it on a parent element instead.",
1958419902
In general it's not recommended to set this because the ID is automatically set by the radio group component.",
1958519903
"name": "items",
1958619904
"optional": true,
19587-
"type": "ReadonlyArray<RadioGroupProps.RadioButtonDefinition>",
19905+
"type": "ReadonlyArray<RadioButtonProps.RadioButtonDefinition>",
1958819906
},
1958919907
{
1959019908
"description": "Specify a custom name for the radio buttons. If not provided, the radio group generates a random name.",
@@ -19602,7 +19920,7 @@ being included in a form submission. A read-only control is still focusable.",
1960219920
},
1960319921
{
1960419922
"inlineType": {
19605-
"name": "RadioGroupProps.Style",
19923+
"name": "RadioButtonProps.Style",
1960619924
"properties": [
1960719925
{
1960819926
"inlineType": {
@@ -19827,7 +20145,7 @@ being included in a form submission. A read-only control is still focusable.",
1982720145
"systemTags": [
1982820146
"core",
1982920147
],
19830-
"type": "RadioGroupProps.Style",
20148+
"type": "RadioButtonProps.Style",
1983120149
},
1983220150
{
1983320151
"description": "Sets the value of the selected radio button.

src/__tests__/snapshot-tests/__snapshots__/test-utils-selectors.test.tsx.snap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,11 @@ exports[`test-utils selectors 1`] = `
513513
"awsui_token-editor-token-add-actions_1heb1",
514514
"awsui_token-editor-token-remove-actions_1heb1",
515515
],
516+
"radio-button": [
517+
"awsui_root_n4fh9",
518+
],
516519
"radio-group": [
517-
"awsui_radio_1mabk",
518-
"awsui_root_1mabk",
520+
"awsui_root_1np5w",
519521
],
520522
"s3-resource-selector": [
521523
"awsui_alert_1u0yw",

0 commit comments

Comments
 (0)