@cloudscape-design/components 3.0.1055 → 3.0.1056
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/checkbox/index.js +11 -11
- package/checkbox/interfaces.d.ts +44 -0
- package/checkbox/interfaces.d.ts.map +1 -1
- package/checkbox/interfaces.js.map +1 -1
- package/checkbox/internal-do-not-use-core.js +18 -0
- package/checkbox/internal.d.ts.map +1 -1
- package/checkbox/internal.js +3 -2
- package/checkbox/internal.js.map +1 -1
- package/checkbox/style.d.ts +3 -0
- package/checkbox/style.d.ts.map +1 -0
- package/checkbox/style.js +41 -0
- package/checkbox/style.js.map +1 -0
- package/checkbox/styles.css.js +3 -3
- package/checkbox/styles.scoped.css +11 -10
- package/checkbox/styles.selectors.js +3 -3
- package/internal/base-component/styles.scoped.css +1 -1
- package/internal/components/abstract-switch/index.d.ts +17 -0
- package/internal/components/abstract-switch/index.d.ts.map +1 -1
- package/internal/components/abstract-switch/index.js +10 -4
- package/internal/components/abstract-switch/index.js.map +1 -1
- package/internal/components/checkbox-icon/index.d.ts +10 -0
- package/internal/components/checkbox-icon/index.d.ts.map +1 -1
- package/internal/components/checkbox-icon/index.js +4 -3
- package/internal/components/checkbox-icon/index.js.map +1 -1
- package/internal/environment.js +2 -2
- package/internal/environment.json +2 -2
- package/internal/manifest.json +1 -1
- package/internal/utils/style.d.ts +1 -0
- package/internal/utils/style.d.ts.map +1 -0
- package/internal/utils/style.js +22 -0
- package/internal/utils/style.js.map +1 -0
- package/package.json +1 -1
- package/radio-group/index.js +10 -15
- package/radio-group/interfaces.d.ts +47 -0
- package/radio-group/interfaces.d.ts.map +1 -1
- package/radio-group/interfaces.js.map +1 -1
- package/radio-group/internal-do-not-use-core.js +23 -0
- package/radio-group/internal.d.ts.map +1 -1
- package/radio-group/internal.js +2 -2
- package/radio-group/internal.js.map +1 -1
- package/radio-group/radio-button.d.ts +1 -0
- package/radio-group/radio-button.d.ts.map +1 -1
- package/radio-group/radio-button.js +5 -4
- package/radio-group/radio-button.js.map +1 -1
- package/radio-group/style.d.ts +10 -0
- package/radio-group/style.d.ts.map +1 -0
- package/radio-group/style.js +50 -0
- package/radio-group/style.js.map +1 -0
- package/radio-group/styles.css.js +10 -10
- package/radio-group/styles.scoped.css +22 -21
- package/radio-group/styles.selectors.js +10 -10
- package/toggle/index.js +10 -6
- package/toggle/interfaces.d.ts +35 -0
- package/toggle/interfaces.d.ts.map +1 -1
- package/toggle/interfaces.js.map +1 -1
- package/toggle/internal-do-not-use-core.js +14 -0
- package/toggle/internal.d.ts.map +1 -1
- package/toggle/internal.js +3 -2
- package/toggle/internal.js.map +1 -1
- package/toggle/style.d.ts +3 -0
- package/toggle/style.d.ts.map +1 -0
- package/toggle/style.js +37 -0
- package/toggle/style.js.map +1 -0
- package/toggle/styles.css.js +10 -10
- package/toggle/styles.scoped.css +23 -22
- package/toggle/styles.selectors.js +10 -10
- /package/checkbox/{index.js.map → internal-do-not-use-core.js.map} +0 -0
- /package/radio-group/{index.js.map → internal-do-not-use-core.js.map} +0 -0
- /package/toggle/{index.js.map → internal-do-not-use-core.js.map} +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export function getComputedAbstractSwitchState(checked, disabled, readOnly, indeterminate, defaultValue = 'default') {
|
|
4
|
+
let computedState;
|
|
5
|
+
if (disabled) {
|
|
6
|
+
computedState = 'disabled';
|
|
7
|
+
}
|
|
8
|
+
else if (readOnly) {
|
|
9
|
+
computedState = 'readOnly';
|
|
10
|
+
}
|
|
11
|
+
else if (indeterminate) {
|
|
12
|
+
computedState = 'indeterminate';
|
|
13
|
+
}
|
|
14
|
+
else if (checked) {
|
|
15
|
+
computedState = 'checked';
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
computedState = defaultValue;
|
|
19
|
+
}
|
|
20
|
+
return computedState;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../../../src/internal/utils/style.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,MAAM,UAAU,8BAA8B,CAC5C,OAA4B,EAC5B,QAA6B,EAC7B,QAA6B,EAC7B,aAAkC,EAClC,eAAuB,SAAS;IAEhC,IAAI,aAAa,CAAC;IAElB,IAAI,QAAQ,EAAE;QACZ,aAAa,GAAG,UAAU,CAAC;KAC5B;SAAM,IAAI,QAAQ,EAAE;QACnB,aAAa,GAAG,UAAU,CAAC;KAC5B;SAAM,IAAI,aAAa,EAAE;QACxB,aAAa,GAAG,eAAe,CAAC;KACjC;SAAM,IAAI,OAAO,EAAE;QAClB,aAAa,GAAG,SAAS,CAAC;KAC3B;SAAM;QACL,aAAa,GAAG,YAAY,CAAC;KAC9B;IAED,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport function getComputedAbstractSwitchState(\n checked: boolean | undefined,\n disabled: boolean | undefined,\n readOnly: boolean | undefined,\n indeterminate: boolean | undefined,\n defaultValue: string = 'default'\n) {\n let computedState;\n\n if (disabled) {\n computedState = 'disabled';\n } else if (readOnly) {\n computedState = 'readOnly';\n } else if (indeterminate) {\n computedState = 'indeterminate';\n } else if (checked) {\n computedState = 'checked';\n } else {\n computedState = defaultValue;\n }\n\n return computedState;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
"./internal/base-component/index.js",
|
|
151
151
|
"./internal/base-component/styles.css.js"
|
|
152
152
|
],
|
|
153
|
-
"version": "3.0.
|
|
153
|
+
"version": "3.0.1056",
|
|
154
154
|
"repository": {
|
|
155
155
|
"type": "git",
|
|
156
156
|
"url": "https://github.com/cloudscape-design/components.git"
|
package/radio-group/index.js
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
'use client';
|
|
4
3
|
import React from 'react';
|
|
5
|
-
|
|
6
|
-
import
|
|
4
|
+
|
|
5
|
+
import CoreComponent from './internal-do-not-use-core';
|
|
7
6
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
8
|
-
import
|
|
7
|
+
import { validateProps } from '@cloudscape-design/component-toolkit/internal';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
9
11
|
const RadioGroup = React.forwardRef((props, ref) => {
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
component: {
|
|
13
|
-
name: 'awsui.RadioGroup',
|
|
14
|
-
label: { root: 'self' },
|
|
15
|
-
properties: {
|
|
16
|
-
value: `${props.value}`,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
}))));
|
|
12
|
+
validateProps('RadioGroup', props, ["style"], {}, 'console');
|
|
13
|
+
return React.createElement(CoreComponent, {ref,...props});
|
|
20
14
|
});
|
|
15
|
+
|
|
16
|
+
|
|
21
17
|
applyDisplayName(RadioGroup, 'RadioGroup');
|
|
22
18
|
export default RadioGroup;
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -51,6 +51,10 @@ export interface RadioGroupProps extends BaseComponentProps, FormFieldControlPro
|
|
|
51
51
|
* being included in a form submission. A read-only control is still focusable.
|
|
52
52
|
*/
|
|
53
53
|
readOnly?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Specifies an object of selectors and properties that are used to apply custom styles.
|
|
56
|
+
* @awsuiSystem core
|
|
57
|
+
*/
|
|
54
58
|
}
|
|
55
59
|
export declare namespace RadioGroupProps {
|
|
56
60
|
interface RadioButtonDefinition {
|
|
@@ -69,4 +73,47 @@ export declare namespace RadioGroupProps {
|
|
|
69
73
|
*/
|
|
70
74
|
focus(): void;
|
|
71
75
|
}
|
|
76
|
+
interface Style {
|
|
77
|
+
input?: {
|
|
78
|
+
fill?: {
|
|
79
|
+
checked?: string;
|
|
80
|
+
default?: string;
|
|
81
|
+
disabled?: string;
|
|
82
|
+
readOnly?: string;
|
|
83
|
+
};
|
|
84
|
+
stroke?: {
|
|
85
|
+
default?: string;
|
|
86
|
+
disabled?: string;
|
|
87
|
+
readOnly?: string;
|
|
88
|
+
};
|
|
89
|
+
circle?: {
|
|
90
|
+
fill?: {
|
|
91
|
+
checked?: string;
|
|
92
|
+
disabled?: string;
|
|
93
|
+
readOnly?: string;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
focusRing?: {
|
|
97
|
+
borderColor?: string;
|
|
98
|
+
borderRadius?: string;
|
|
99
|
+
borderWidth?: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
label?: {
|
|
103
|
+
color?: {
|
|
104
|
+
checked?: string;
|
|
105
|
+
default?: string;
|
|
106
|
+
disabled?: string;
|
|
107
|
+
readOnly?: string;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
description?: {
|
|
111
|
+
color?: {
|
|
112
|
+
checked?: string;
|
|
113
|
+
default?: string;
|
|
114
|
+
disabled?: string;
|
|
115
|
+
readOnly?: string;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
}
|
|
72
119
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/radio-group/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,eAAgB,SAAQ,kBAAkB,EAAE,qBAAqB;I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CAAC,EAAE,MAAM,CAAC;gBACtB,WAAW,CAAC,EAAE,MAAM,CAAC;aACtB,CAAC;SACH,CAAC;QACF,KAAK,CAAC,EAAE;YACN,KAAK,CAAC,EAAE;gBACN,OAAO,CAAC,EAAE,MAAM,CAAC;gBACjB,OAAO,CAAC,EAAE,MAAM,CAAC;gBACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;aACnB,CAAC;SACH,CAAC;QACF,WAAW,CAAC,EAAE;YACZ,KAAK,CAAC,EAAE;gBACN,OAAO,CAAC,EAAE,MAAM,CAAC;gBACjB,OAAO,CAAC,EAAE,MAAM,CAAC;gBACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;aACnB,CAAC;SACH,CAAC;KACH;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/radio-group/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface RadioGroupProps extends BaseComponentProps, FormFieldControlProps {\n /**\n * Specify a custom name for the radio buttons. If not provided, the radio group generates a random name.\n */\n name?: string;\n\n /**\n * Sets the value of the selected radio button.\n * If you want to clear the selection, use `null`.\n */\n value: string | null;\n\n /**\n * Specifies an array of radio buttons to display. Each of these objects have the following properties:\n *\n * - `value` (string) - Sets the value of the radio button. Assigned to the radio group when a user selects the radio button.\n * - `label` (ReactNode) - Specifies a label for the radio button.\n * - `description` (ReactNode) - (Optional) Specifies descriptive text that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the radio button is disabled, which prevents the user from selecting it.\n * - `controlId` (string) - (Optional) Sets the ID of the internal input. You can use it to relate a label element's `for` attribute to this control.\n * In general it's not recommended to set this because the ID is automatically set by the radio group component.\n */\n items?: ReadonlyArray<RadioGroupProps.RadioButtonDefinition>;\n\n /**\n * Adds `aria-label` to the group. If you are using this form element within a form field,\n * don't set this property because the form field component automatically sets the correct labels to make the component accessible.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-required` to the group.\n */\n ariaRequired?: boolean;\n\n /**\n * Adds `aria-controls` attribute to the radio group.\n * If the radio group controls any secondary content (for example, another form field), use this to provide an ID referring to the secondary content.\n */\n ariaControls?: string;\n\n /**\n * Called when the user selects a different radio button. The event `detail` contains the current `value`.\n */\n onChange?: NonCancelableEventHandler<RadioGroupProps.ChangeDetail>;\n\n /**\n * @deprecated Has no effect.\n */\n controlId?: string;\n\n /**\n * Specifies if the whole group is read-only, which prevents the\n * user from modifying the value, but does not prevent the value from\n * being included in a form submission. A read-only control is still focusable.\n */\n readOnly?: boolean;\n}\n\nexport namespace RadioGroupProps {\n export interface RadioButtonDefinition {\n value: string;\n label: React.ReactNode;\n description?: React.ReactNode;\n disabled?: boolean;\n controlId?: string;\n }\n\n export interface ChangeDetail {\n value: string;\n }\n\n export interface Ref {\n /**\n * Sets input focus onto the UI control.\n */\n focus(): void;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/radio-group/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface RadioGroupProps extends BaseComponentProps, FormFieldControlProps {\n /**\n * Specify a custom name for the radio buttons. If not provided, the radio group generates a random name.\n */\n name?: string;\n\n /**\n * Sets the value of the selected radio button.\n * If you want to clear the selection, use `null`.\n */\n value: string | null;\n\n /**\n * Specifies an array of radio buttons to display. Each of these objects have the following properties:\n *\n * - `value` (string) - Sets the value of the radio button. Assigned to the radio group when a user selects the radio button.\n * - `label` (ReactNode) - Specifies a label for the radio button.\n * - `description` (ReactNode) - (Optional) Specifies descriptive text that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the radio button is disabled, which prevents the user from selecting it.\n * - `controlId` (string) - (Optional) Sets the ID of the internal input. You can use it to relate a label element's `for` attribute to this control.\n * In general it's not recommended to set this because the ID is automatically set by the radio group component.\n */\n items?: ReadonlyArray<RadioGroupProps.RadioButtonDefinition>;\n\n /**\n * Adds `aria-label` to the group. If you are using this form element within a form field,\n * don't set this property because the form field component automatically sets the correct labels to make the component accessible.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-required` to the group.\n */\n ariaRequired?: boolean;\n\n /**\n * Adds `aria-controls` attribute to the radio group.\n * If the radio group controls any secondary content (for example, another form field), use this to provide an ID referring to the secondary content.\n */\n ariaControls?: string;\n\n /**\n * Called when the user selects a different radio button. The event `detail` contains the current `value`.\n */\n onChange?: NonCancelableEventHandler<RadioGroupProps.ChangeDetail>;\n\n /**\n * @deprecated Has no effect.\n */\n controlId?: string;\n\n /**\n * Specifies if the whole group is read-only, which prevents the\n * user from modifying the value, but does not prevent the value from\n * being included in a form submission. A read-only control is still focusable.\n */\n readOnly?: boolean;\n\n /**\n * Specifies an object of selectors and properties that are used to apply custom styles.\n * @awsuiSystem core\n */\n style?: RadioGroupProps.Style;\n}\n\nexport namespace RadioGroupProps {\n export interface RadioButtonDefinition {\n value: string;\n label: React.ReactNode;\n description?: React.ReactNode;\n disabled?: boolean;\n controlId?: string;\n }\n\n export interface ChangeDetail {\n value: string;\n }\n\n export interface Ref {\n /**\n * Sets input focus onto the UI control.\n */\n focus(): void;\n }\n\n export interface Style {\n input?: {\n fill?: {\n checked?: string;\n default?: string;\n disabled?: string;\n readOnly?: string;\n };\n stroke?: {\n default?: string;\n disabled?: string;\n readOnly?: string;\n };\n circle?: {\n fill?: {\n checked?: string;\n disabled?: string;\n readOnly?: string;\n };\n };\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n label?: {\n color?: {\n checked?: string;\n default?: string;\n disabled?: string;\n readOnly?: string;\n };\n };\n description?: {\n color?: {\n checked?: string;\n default?: string;\n disabled?: string;\n readOnly?: string;\n };\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
6
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
7
|
+
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
8
|
+
import InternalRadioGroup from './internal';
|
|
9
|
+
const RadioGroup = React.forwardRef((props, ref) => {
|
|
10
|
+
const baseComponentProps = useBaseComponent('RadioGroup', { props: { readOnly: props.readOnly } });
|
|
11
|
+
return (React.createElement(InternalRadioGroup, Object.assign({ ref: ref }, props, baseComponentProps, getAnalyticsMetadataAttribute({
|
|
12
|
+
component: {
|
|
13
|
+
name: 'awsui.RadioGroup',
|
|
14
|
+
label: { root: 'self' },
|
|
15
|
+
properties: {
|
|
16
|
+
value: `${props.value}`,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
}))));
|
|
20
|
+
});
|
|
21
|
+
applyDisplayName(RadioGroup, 'RadioGroup');
|
|
22
|
+
export default RadioGroup;
|
|
23
|
+
//# sourceMappingURL=internal-do-not-use-core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/radio-group/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAO/C,QAAA,MAAM,kBAAkB,+
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/radio-group/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAO/C,QAAA,MAAM,kBAAkB,+HAkEvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
package/radio-group/internal.js
CHANGED
|
@@ -11,13 +11,13 @@ import useRadioGroupForwardFocus from '../internal/hooks/forward-focus/radio-gro
|
|
|
11
11
|
import RadioButton from './radio-button';
|
|
12
12
|
import styles from './styles.css.js';
|
|
13
13
|
const InternalRadioGroup = React.forwardRef((_a, ref) => {
|
|
14
|
-
var { name, value, items, ariaLabel, ariaRequired, ariaControls, onChange, readOnly, __internalRootRef = null } = _a, props = __rest(_a, ["name", "value", "items", "ariaLabel", "ariaRequired", "ariaControls", "onChange", "readOnly", "__internalRootRef"]);
|
|
14
|
+
var { name, value, items, ariaLabel, ariaRequired, ariaControls, onChange, readOnly, style, __internalRootRef = null } = _a, props = __rest(_a, ["name", "value", "items", "ariaLabel", "ariaRequired", "ariaControls", "onChange", "readOnly", "style", "__internalRootRef"]);
|
|
15
15
|
const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(props);
|
|
16
16
|
const baseProps = getBaseProps(props);
|
|
17
17
|
const generatedName = useUniqueId('awsui-radio-');
|
|
18
18
|
const [radioButtonRef, radioButtonRefIndex] = useRadioGroupForwardFocus(ref, items, value);
|
|
19
19
|
return (React.createElement("div", Object.assign({ role: "radiogroup", "aria-labelledby": ariaLabelledby, "aria-label": ariaLabel, "aria-describedby": ariaDescribedby, "aria-required": ariaRequired, "aria-controls": ariaControls, "aria-readonly": readOnly ? 'true' : undefined }, baseProps, { className: clsx(baseProps.className, styles.root), ref: __internalRootRef }), items &&
|
|
20
|
-
items.map((item, index) => (React.createElement(RadioButton, Object.assign({ key: item.value, ref: index === radioButtonRefIndex ? radioButtonRef : undefined, checked: item.value === value, name: name || generatedName, value: item.value, label: item.label, description: item.description, disabled: item.disabled, onChange: onChange, controlId: item.controlId, readOnly: readOnly }, getAnalyticsMetadataAttribute(!item.disabled && !readOnly
|
|
20
|
+
items.map((item, index) => (React.createElement(RadioButton, Object.assign({ key: item.value, ref: index === radioButtonRefIndex ? radioButtonRef : undefined, checked: item.value === value, name: name || generatedName, value: item.value, label: item.label, description: item.description, disabled: item.disabled, onChange: onChange, controlId: item.controlId, readOnly: readOnly, style: style }, getAnalyticsMetadataAttribute(!item.disabled && !readOnly
|
|
21
21
|
? {
|
|
22
22
|
detail: {
|
|
23
23
|
position: `${index + 1}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/radio-group/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,yBAAyB,MAAM,6CAA6C,CAAC;AAIpF,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,kBAAkB,GAAG,KAAK,CAAC,UAAU,CACzC,CACE,
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/radio-group/internal.tsx"],"names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AE,MAAM,CAAC,IAAI,CAAC,EACjD,GAAG,EAAE,iBAAiB,KAErB,KAAK;QACJ,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CACzB,oBAAC,WAAW,kBACV,GAAG,EAAE,IAAI,CAAC,KAAK,EACf,GAAG,EAAE,KAAK,KAAK,mBAAmB,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,EAC/D,OAAO,EAAE,IAAI,CAAC,KAAK,KAAK,KAAK,EAC7B,IAAI,EAAE,IAAI,IAAI,aAAa,EAC3B,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,IACR,6BAA6B,CAC/B,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ;YACzB,CAAC,CAAC;gBACE,MAAM,EAAE;oBACN,QAAQ,EAAE,GAAG,KAAK,GAAG,CAAC,EAAE;oBACxB,KAAK,EAAE,IAAI,CAAC,KAAK;iBAC+C;aACnE;YACH,CAAC,CAAC,EAAE,CACP,EACD,CACH,CAAC,CACA,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport useRadioGroupForwardFocus from '../internal/hooks/forward-focus/radio-group';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { GeneratedAnalyticsMetadataRadioGroupSelect } from './analytics-metadata/interfaces';\nimport { RadioGroupProps } from './interfaces';\nimport RadioButton from './radio-button';\n\nimport styles from './styles.css.js';\n\ntype InternalRadioGroupProps = RadioGroupProps & InternalBaseComponentProps;\n\nconst InternalRadioGroup = React.forwardRef(\n (\n {\n name,\n value,\n items,\n ariaLabel,\n ariaRequired,\n ariaControls,\n onChange,\n readOnly,\n style,\n __internalRootRef = null,\n ...props\n }: InternalRadioGroupProps,\n ref: React.Ref<RadioGroupProps.Ref>\n ) => {\n const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(props);\n const baseProps = getBaseProps(props);\n const generatedName = useUniqueId('awsui-radio-');\n\n const [radioButtonRef, radioButtonRefIndex] = useRadioGroupForwardFocus(ref, items, value);\n\n return (\n <div\n role=\"radiogroup\"\n aria-labelledby={ariaLabelledby}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-required={ariaRequired}\n aria-controls={ariaControls}\n aria-readonly={readOnly ? 'true' : undefined}\n {...baseProps}\n className={clsx(baseProps.className, styles.root)}\n ref={__internalRootRef}\n >\n {items &&\n items.map((item, index) => (\n <RadioButton\n key={item.value}\n ref={index === radioButtonRefIndex ? radioButtonRef : undefined}\n checked={item.value === value}\n name={name || generatedName}\n value={item.value}\n label={item.label}\n description={item.description}\n disabled={item.disabled}\n onChange={onChange}\n controlId={item.controlId}\n readOnly={readOnly}\n style={style}\n {...getAnalyticsMetadataAttribute(\n !item.disabled && !readOnly\n ? {\n detail: {\n position: `${index + 1}`,\n value: item.value,\n } as Partial<GeneratedAnalyticsMetadataRadioGroupSelect['detail']>,\n }\n : {}\n )}\n />\n ))}\n </div>\n );\n }\n);\n\nexport default InternalRadioGroup;\n"]}
|
|
@@ -7,6 +7,7 @@ interface RadioButtonProps extends RadioGroupProps.RadioButtonDefinition {
|
|
|
7
7
|
onChange?: NonCancelableEventHandler<RadioGroupProps.ChangeDetail>;
|
|
8
8
|
readOnly?: boolean;
|
|
9
9
|
className?: string;
|
|
10
|
+
style?: RadioGroupProps.Style;
|
|
10
11
|
}
|
|
11
12
|
declare const _default: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<HTMLInputElement>>;
|
|
12
13
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-button.d.ts","sourceRoot":"","sources":["../../../src/radio-group/radio-button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAQtC,OAAO,EAA0B,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"radio-button.d.ts","sourceRoot":"","sources":["../../../src/radio-group/radio-button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAQtC,OAAO,EAA0B,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAK/C,UAAU,gBAAiB,SAAQ,eAAe,CAAC,qBAAqB;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC;CAC/B;;AAED,wBAoFG"}
|
|
@@ -8,13 +8,14 @@ import { copyAnalyticsMetadataAttribute } from '@cloudscape-design/component-too
|
|
|
8
8
|
import AbstractSwitch from '../internal/components/abstract-switch';
|
|
9
9
|
import { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';
|
|
10
10
|
import { fireNonCancelableEvent } from '../internal/events';
|
|
11
|
+
import { getAbstractSwitchStyles, getInnerCircleStyle, getOuterCircleStyle } from './style';
|
|
11
12
|
import styles from './styles.css.js';
|
|
12
13
|
export default React.forwardRef(function RadioButton(_a, ref) {
|
|
13
|
-
var { name, label, value, checked, description, disabled, controlId, onChange, readOnly, className } = _a, rest = __rest(_a, ["name", "label", "value", "checked", "description", "disabled", "controlId", "onChange", "readOnly", "className"]);
|
|
14
|
+
var { name, label, value, checked, description, disabled, controlId, onChange, readOnly, className, style } = _a, rest = __rest(_a, ["name", "label", "value", "checked", "description", "disabled", "controlId", "onChange", "readOnly", "className", "style"]);
|
|
14
15
|
const radioButtonRef = useRef(null);
|
|
15
16
|
const mergedRefs = useMergeRefs(radioButtonRef, ref);
|
|
16
17
|
const { tabIndex } = useSingleTabStopNavigation(radioButtonRef);
|
|
17
|
-
return (React.createElement(AbstractSwitch, Object.assign({ className: clsx(styles.radio, description && styles['radio--has-description'], className), controlClassName: styles['radio-control'], outlineClassName: styles.outline, label: label, description: description, disabled: disabled, readOnly: readOnly, controlId: controlId }, copyAnalyticsMetadataAttribute(rest), { nativeControl: nativeControlProps => (React.createElement("input", Object.assign({}, nativeControlProps, { tabIndex: tabIndex, type: "radio", ref: mergedRefs, name: name, value: value, checked: checked, "aria-disabled": readOnly && !disabled ? 'true' : undefined,
|
|
18
|
+
return (React.createElement(AbstractSwitch, Object.assign({ className: clsx(styles.radio, description && styles['radio--has-description'], className), controlClassName: styles['radio-control'], outlineClassName: styles.outline, label: label, description: description, disabled: disabled, readOnly: readOnly, controlId: controlId, style: getAbstractSwitchStyles(style, checked, disabled, readOnly) }, copyAnalyticsMetadataAttribute(rest), { nativeControl: nativeControlProps => (React.createElement("input", Object.assign({}, nativeControlProps, { tabIndex: tabIndex, type: "radio", ref: mergedRefs, name: name, value: value, checked: checked, "aria-disabled": readOnly && !disabled ? 'true' : undefined,
|
|
18
19
|
// empty handler to suppress React controllability warning
|
|
19
20
|
onChange: () => { } }))), onClick: () => {
|
|
20
21
|
var _a;
|
|
@@ -27,11 +28,11 @@ export default React.forwardRef(function RadioButton(_a, ref) {
|
|
|
27
28
|
React.createElement("circle", { className: clsx(styles['styled-circle-border'], {
|
|
28
29
|
[styles['styled-circle-disabled']]: disabled,
|
|
29
30
|
[styles['styled-circle-readonly']]: readOnly,
|
|
30
|
-
}), strokeWidth: 6.25, cx: 50, cy: 50, r: 46 }),
|
|
31
|
+
}), strokeWidth: 6.25, cx: 50, cy: 50, r: 46, style: getOuterCircleStyle(style, checked, disabled, readOnly) }),
|
|
31
32
|
React.createElement("circle", { className: clsx(styles['styled-circle-fill'], {
|
|
32
33
|
[styles['styled-circle-disabled']]: disabled,
|
|
33
34
|
[styles['styled-circle-checked']]: checked,
|
|
34
35
|
[styles['styled-circle-readonly']]: readOnly,
|
|
35
|
-
}), strokeWidth: 30, cx: 50, cy: 50, r: 35 })) })));
|
|
36
|
+
}), strokeWidth: 30, cx: 50, cy: 50, r: 35, style: getInnerCircleStyle(style, checked, disabled, readOnly) })) })));
|
|
36
37
|
});
|
|
37
38
|
//# sourceMappingURL=radio-button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-button.js","sourceRoot":"","sources":["../../../src/radio-group/radio-button.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAC7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,kEAAkE,CAAC;AAElH,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAA6B,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"radio-button.js","sourceRoot":"","sources":["../../../src/radio-group/radio-button.tsx"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,CAAC,MAAM,CAAC,oBAAoB,CAAC,EAAE;oBAC5C,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,EAAE,QAAQ;oBAC5C,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC,EAAE,OAAO;oBAC1C,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,EAAE,QAAQ;iBAC7C,CAAC,EACF,WAAW,EAAE,EAAE,EACf,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,EACN,CAAC,EAAE,EAAE,EACL,KAAK,EAAE,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAC9D,CACE,IAER,CACH,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\nimport { copyAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport AbstractSwitch from '../internal/components/abstract-switch';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events';\nimport { RadioGroupProps } from './interfaces';\nimport { getAbstractSwitchStyles, getInnerCircleStyle, getOuterCircleStyle } from './style';\n\nimport styles from './styles.css.js';\n\ninterface RadioButtonProps extends RadioGroupProps.RadioButtonDefinition {\n name: string;\n checked: boolean;\n onChange?: NonCancelableEventHandler<RadioGroupProps.ChangeDetail>;\n readOnly?: boolean;\n className?: string;\n style?: RadioGroupProps.Style;\n}\n\nexport default React.forwardRef(function RadioButton(\n {\n name,\n label,\n value,\n checked,\n description,\n disabled,\n controlId,\n onChange,\n readOnly,\n className,\n style,\n ...rest\n }: RadioButtonProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const radioButtonRef = useRef<HTMLInputElement>(null);\n const mergedRefs = useMergeRefs(radioButtonRef, ref);\n\n const { tabIndex } = useSingleTabStopNavigation(radioButtonRef);\n\n return (\n <AbstractSwitch\n className={clsx(styles.radio, description && styles['radio--has-description'], className)}\n controlClassName={styles['radio-control']}\n outlineClassName={styles.outline}\n label={label}\n description={description}\n disabled={disabled}\n readOnly={readOnly}\n controlId={controlId}\n style={getAbstractSwitchStyles(style, checked, disabled, readOnly)}\n {...copyAnalyticsMetadataAttribute(rest)}\n nativeControl={nativeControlProps => (\n <input\n {...nativeControlProps}\n tabIndex={tabIndex}\n type=\"radio\"\n ref={mergedRefs}\n name={name}\n value={value}\n checked={checked}\n aria-disabled={readOnly && !disabled ? 'true' : undefined}\n // empty handler to suppress React controllability warning\n onChange={() => {}}\n />\n )}\n onClick={() => {\n radioButtonRef.current?.focus();\n if (checked) {\n return;\n }\n fireNonCancelableEvent(onChange, { value });\n }}\n styledControl={\n <svg viewBox=\"0 0 100 100\" focusable=\"false\" aria-hidden=\"true\">\n <circle\n className={clsx(styles['styled-circle-border'], {\n [styles['styled-circle-disabled']]: disabled,\n [styles['styled-circle-readonly']]: readOnly,\n })}\n strokeWidth={6.25}\n cx={50}\n cy={50}\n r={46}\n style={getOuterCircleStyle(style, checked, disabled, readOnly)}\n />\n <circle\n className={clsx(styles['styled-circle-fill'], {\n [styles['styled-circle-disabled']]: disabled,\n [styles['styled-circle-checked']]: checked,\n [styles['styled-circle-readonly']]: readOnly,\n })}\n strokeWidth={30}\n cx={50}\n cy={50}\n r={35}\n style={getInnerCircleStyle(style, checked, disabled, readOnly)}\n />\n </svg>\n }\n />\n );\n});\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RadioGroupProps } from './interfaces';
|
|
2
|
+
export declare function getOuterCircleStyle(style: RadioGroupProps.Style | undefined, checked: boolean | undefined, disabled: boolean | undefined, readOnly: boolean | undefined): {
|
|
3
|
+
fill: string | undefined;
|
|
4
|
+
stroke: string | undefined;
|
|
5
|
+
} | undefined;
|
|
6
|
+
export declare function getInnerCircleStyle(style: RadioGroupProps.Style | undefined, checked: boolean | undefined, disabled: boolean | undefined, readOnly: boolean | undefined): {
|
|
7
|
+
fill: string | undefined;
|
|
8
|
+
stroke: string | undefined;
|
|
9
|
+
} | undefined;
|
|
10
|
+
export declare function getAbstractSwitchStyles(style: RadioGroupProps.Style | undefined, checked: boolean | undefined, disabled: boolean | undefined, readOnly: boolean | undefined): {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/radio-group/style.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,eAAe,CAAC,KAAK,GAAG,SAAS,EACxC,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,QAAQ,EAAE,OAAO,GAAG,SAAS,EAC7B,QAAQ,EAAE,OAAO,GAAG,SAAS;;;cAc9B;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,eAAe,CAAC,KAAK,GAAG,SAAS,EACxC,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,QAAQ,EAAE,OAAO,GAAG,SAAS,EAC7B,QAAQ,EAAE,OAAO,GAAG,SAAS;;;cAc9B;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,eAAe,CAAC,KAAK,GAAG,SAAS,EACxC,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,QAAQ,EAAE,OAAO,GAAG,SAAS,EAC7B,QAAQ,EAAE,OAAO,GAAG,SAAS,MAwB9B"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { SYSTEM } from '../internal/environment';
|
|
4
|
+
import { getComputedAbstractSwitchState } from '../internal/utils/style';
|
|
5
|
+
export function getOuterCircleStyle(style, checked, disabled, readOnly) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
let properties;
|
|
8
|
+
if (SYSTEM === 'core' && (style === null || style === void 0 ? void 0 : style.input)) {
|
|
9
|
+
const computedState = getComputedAbstractSwitchState(checked, disabled, readOnly, undefined);
|
|
10
|
+
properties = {
|
|
11
|
+
fill: ((_a = style.input) === null || _a === void 0 ? void 0 : _a.fill) && style.input.fill[computedState],
|
|
12
|
+
stroke: ((_b = style.input) === null || _b === void 0 ? void 0 : _b.stroke) && style.input.stroke[computedState],
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return properties;
|
|
16
|
+
}
|
|
17
|
+
export function getInnerCircleStyle(style, checked, disabled, readOnly) {
|
|
18
|
+
var _a, _b, _c;
|
|
19
|
+
let properties;
|
|
20
|
+
if (SYSTEM === 'core' && (style === null || style === void 0 ? void 0 : style.input)) {
|
|
21
|
+
const computedState = getComputedAbstractSwitchState(checked, disabled, readOnly, undefined);
|
|
22
|
+
properties = {
|
|
23
|
+
fill: ((_b = (_a = style.input) === null || _a === void 0 ? void 0 : _a.circle) === null || _b === void 0 ? void 0 : _b.fill) && style.input.circle.fill[computedState],
|
|
24
|
+
stroke: ((_c = style.input) === null || _c === void 0 ? void 0 : _c.fill) && style.input.fill[computedState],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return properties;
|
|
28
|
+
}
|
|
29
|
+
export function getAbstractSwitchStyles(style, checked, disabled, readOnly) {
|
|
30
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
31
|
+
let properties = {};
|
|
32
|
+
if (SYSTEM === 'core' && ((style === null || style === void 0 ? void 0 : style.label) || (style === null || style === void 0 ? void 0 : style.description) || (style === null || style === void 0 ? void 0 : style.input))) {
|
|
33
|
+
const computedState = getComputedAbstractSwitchState(checked, disabled, readOnly, undefined);
|
|
34
|
+
properties = {
|
|
35
|
+
label: {
|
|
36
|
+
color: ((_a = style === null || style === void 0 ? void 0 : style.label) === null || _a === void 0 ? void 0 : _a.color) && style.label.color[computedState],
|
|
37
|
+
},
|
|
38
|
+
description: {
|
|
39
|
+
color: ((_b = style === null || style === void 0 ? void 0 : style.description) === null || _b === void 0 ? void 0 : _b.color) && style.description.color[computedState],
|
|
40
|
+
},
|
|
41
|
+
focusRing: {
|
|
42
|
+
borderColor: (_d = (_c = style === null || style === void 0 ? void 0 : style.input) === null || _c === void 0 ? void 0 : _c.focusRing) === null || _d === void 0 ? void 0 : _d.borderColor,
|
|
43
|
+
borderRadius: (_f = (_e = style === null || style === void 0 ? void 0 : style.input) === null || _e === void 0 ? void 0 : _e.focusRing) === null || _f === void 0 ? void 0 : _f.borderRadius,
|
|
44
|
+
borderWidth: (_h = (_g = style === null || style === void 0 ? void 0 : style.input) === null || _g === void 0 ? void 0 : _g.focusRing) === null || _h === void 0 ? void 0 : _h.borderWidth,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return properties;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/radio-group/style.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AAGzE,MAAM,UAAU,mBAAmB,CACjC,KAAwC,EACxC,OAA4B,EAC5B,QAA6B,EAC7B,QAA6B;;IAE7B,IAAI,UAAU,CAAC;IAEf,IAAI,MAAM,KAAK,MAAM,KAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,CAAA,EAAE;QACrC,MAAM,aAAa,GAAG,8BAA8B,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QAE7F,UAAU,GAAG;YACX,IAAI,EAAE,CAAA,MAAA,KAAK,CAAC,KAAK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A8B,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QAE7F,UAAU,GAAG;YACX,KAAK,EAAE;gBACL,KAAK,EAAE,CAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,0CAAE,KAAK,KAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,aAA+C,CAAC;aACjG;YACD,WAAW,EAAE;gBACX,KAAK,EACH,CAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,0CAAE,KAAK,KAAI,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,aAAqD,CAAC;aAC9G;YACD,SAAS,EAAE;gBACT,WAAW,EAAE,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,0CAAE,SAAS,0CAAE,WAAW;gBACjD,YAAY,EAAE,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,0CAAE,SAAS,0CAAE,YAAY;gBACnD,WAAW,EAAE,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,0CAAE,SAAS,0CAAE,WAAW;aAClD;SACF,CAAC;KACH;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { SYSTEM } from '../internal/environment';\nimport { getComputedAbstractSwitchState } from '../internal/utils/style';\nimport { RadioGroupProps } from './interfaces';\n\nexport function getOuterCircleStyle(\n style: RadioGroupProps.Style | undefined,\n checked: boolean | undefined,\n disabled: boolean | undefined,\n readOnly: boolean | undefined\n) {\n let properties;\n\n if (SYSTEM === 'core' && style?.input) {\n const computedState = getComputedAbstractSwitchState(checked, disabled, readOnly, undefined);\n\n properties = {\n fill: style.input?.fill && style.input.fill[computedState as keyof typeof style.input.fill],\n stroke: style.input?.stroke && style.input.stroke[computedState as keyof typeof style.input.stroke],\n };\n }\n\n return properties;\n}\n\nexport function getInnerCircleStyle(\n style: RadioGroupProps.Style | undefined,\n checked: boolean | undefined,\n disabled: boolean | undefined,\n readOnly: boolean | undefined\n) {\n let properties;\n\n if (SYSTEM === 'core' && style?.input) {\n const computedState = getComputedAbstractSwitchState(checked, disabled, readOnly, undefined);\n\n properties = {\n fill: style.input?.circle?.fill && style.input.circle.fill[computedState as keyof typeof style.input.circle.fill],\n stroke: style.input?.fill && style.input.fill[computedState as keyof typeof style.input.fill],\n };\n }\n\n return properties;\n}\n\nexport function getAbstractSwitchStyles(\n style: RadioGroupProps.Style | undefined,\n checked: boolean | undefined,\n disabled: boolean | undefined,\n readOnly: boolean | undefined\n) {\n let properties = {};\n\n if (SYSTEM === 'core' && (style?.label || style?.description || style?.input)) {\n const computedState = getComputedAbstractSwitchState(checked, disabled, readOnly, undefined);\n\n properties = {\n label: {\n color: style?.label?.color && style.label.color[computedState as keyof typeof style.label.color],\n },\n description: {\n color:\n style?.description?.color && style.description.color[computedState as keyof typeof style.description.color],\n },\n focusRing: {\n borderColor: style?.input?.focusRing?.borderColor,\n borderRadius: style?.input?.focusRing?.borderRadius,\n borderWidth: style?.input?.focusRing?.borderWidth,\n },\n };\n }\n\n return properties;\n}\n"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"root": "
|
|
5
|
-
"radio": "
|
|
6
|
-
"radio--has-description": "awsui_radio--has-
|
|
7
|
-
"radio-control": "awsui_radio-
|
|
8
|
-
"outline": "
|
|
9
|
-
"styled-circle-border": "awsui_styled-circle-
|
|
10
|
-
"styled-circle-disabled": "awsui_styled-circle-
|
|
11
|
-
"styled-circle-readonly": "awsui_styled-circle-
|
|
12
|
-
"styled-circle-fill": "awsui_styled-circle-
|
|
13
|
-
"styled-circle-checked": "awsui_styled-circle-
|
|
4
|
+
"root": "awsui_root_1mabk_lk9st_145",
|
|
5
|
+
"radio": "awsui_radio_1mabk_lk9st_178",
|
|
6
|
+
"radio--has-description": "awsui_radio--has-description_1mabk_lk9st_186",
|
|
7
|
+
"radio-control": "awsui_radio-control_1mabk_lk9st_190",
|
|
8
|
+
"outline": "awsui_outline_1mabk_lk9st_198",
|
|
9
|
+
"styled-circle-border": "awsui_styled-circle-border_1mabk_lk9st_221",
|
|
10
|
+
"styled-circle-disabled": "awsui_styled-circle-disabled_1mabk_lk9st_225",
|
|
11
|
+
"styled-circle-readonly": "awsui_styled-circle-readonly_1mabk_lk9st_225",
|
|
12
|
+
"styled-circle-fill": "awsui_styled-circle-fill_1mabk_lk9st_230",
|
|
13
|
+
"styled-circle-checked": "awsui_styled-circle-checked_1mabk_lk9st_246"
|
|
14
14
|
};
|
|
15
15
|
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
*/
|
|
143
143
|
/* Style used for links in slots/components that are text heavy, to help links stand out among
|
|
144
144
|
surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
|
|
145
|
-
.
|
|
145
|
+
.awsui_root_1mabk_lk9st_145:not(#\9) {
|
|
146
146
|
border-collapse: separate;
|
|
147
147
|
border-spacing: 0;
|
|
148
148
|
box-sizing: border-box;
|
|
@@ -175,19 +175,19 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
175
175
|
display: block;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
.
|
|
178
|
+
.awsui_radio_1mabk_lk9st_178:not(#\9) {
|
|
179
179
|
/*used in test-utils*/
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
.
|
|
182
|
+
.awsui_radio_1mabk_lk9st_178 + .awsui_radio_1mabk_lk9st_178:not(#\9) {
|
|
183
183
|
margin-block-start: var(--space-scaled-xxs-pfm1nx, 4px);
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
.awsui_radio--has-
|
|
186
|
+
.awsui_radio--has-description_1mabk_lk9st_186 + .awsui_radio_1mabk_lk9st_178:not(#\9) {
|
|
187
187
|
margin-block-start: var(--space-scaled-xs-xwoogq, 8px);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
.awsui_radio-
|
|
190
|
+
.awsui_radio-control_1mabk_lk9st_190:not(#\9) {
|
|
191
191
|
margin-block-start: calc((var(--line-height-body-m-2mh3ke, 20px) - var(--size-control-adm93y, 16px)) / 2);
|
|
192
192
|
min-block-size: var(--size-control-adm93y, 16px);
|
|
193
193
|
min-inline-size: var(--size-control-adm93y, 16px);
|
|
@@ -195,14 +195,15 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
195
195
|
inline-size: var(--size-control-adm93y, 16px);
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
.
|
|
198
|
+
.awsui_outline_1mabk_lk9st_198:not(#\9) {
|
|
199
|
+
--awsui-style-focus-ring-box-shadow-kcc2gu: 0 0 0 var(--awsui-style-focus-ring-border-width-kcc2gu, 2px) var(--awsui-style-focus-ring-border-color-kcc2gu, var(--color-border-item-focused-uk47pl, #006ce0));
|
|
199
200
|
position: relative;
|
|
200
201
|
}
|
|
201
|
-
.
|
|
202
|
+
.awsui_outline_1mabk_lk9st_198:not(#\9) {
|
|
202
203
|
outline: 2px dotted transparent;
|
|
203
204
|
outline-offset: calc(2px - 1px);
|
|
204
205
|
}
|
|
205
|
-
.
|
|
206
|
+
.awsui_outline_1mabk_lk9st_198:not(#\9)::before {
|
|
206
207
|
content: " ";
|
|
207
208
|
display: block;
|
|
208
209
|
position: absolute;
|
|
@@ -210,46 +211,46 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
210
211
|
inset-block-start: calc(-1 * 2px);
|
|
211
212
|
inline-size: calc(100% + 2px + 2px);
|
|
212
213
|
block-size: calc(100% + 2px + 2px);
|
|
213
|
-
border-start-start-radius: var(--border-radius-control-circular-focus-ring-yjhscw, 4px);
|
|
214
|
-
border-start-end-radius: var(--border-radius-control-circular-focus-ring-yjhscw, 4px);
|
|
215
|
-
border-end-start-radius: var(--border-radius-control-circular-focus-ring-yjhscw, 4px);
|
|
216
|
-
border-end-end-radius: var(--border-radius-control-circular-focus-ring-yjhscw, 4px);
|
|
217
|
-
box-shadow:
|
|
214
|
+
border-start-start-radius: var(--awsui-style-focus-ring-border-radius-kcc2gu, var(--border-radius-control-circular-focus-ring-yjhscw, 4px));
|
|
215
|
+
border-start-end-radius: var(--awsui-style-focus-ring-border-radius-kcc2gu, var(--border-radius-control-circular-focus-ring-yjhscw, 4px));
|
|
216
|
+
border-end-start-radius: var(--awsui-style-focus-ring-border-radius-kcc2gu, var(--border-radius-control-circular-focus-ring-yjhscw, 4px));
|
|
217
|
+
border-end-end-radius: var(--awsui-style-focus-ring-border-radius-kcc2gu, var(--border-radius-control-circular-focus-ring-yjhscw, 4px));
|
|
218
|
+
box-shadow: var(--awsui-style-focus-ring-box-shadow-kcc2gu);
|
|
218
219
|
}
|
|
219
220
|
|
|
220
|
-
.awsui_styled-circle-
|
|
221
|
+
.awsui_styled-circle-border_1mabk_lk9st_221:not(#\9) {
|
|
221
222
|
stroke: var(--color-border-control-default-sh3548, #8c8c94);
|
|
222
223
|
fill: var(--color-background-control-default-4jb21l, #ffffff);
|
|
223
224
|
}
|
|
224
|
-
.awsui_styled-circle-
|
|
225
|
+
.awsui_styled-circle-border_1mabk_lk9st_221.awsui_styled-circle-disabled_1mabk_lk9st_225:not(#\9), .awsui_styled-circle-border_1mabk_lk9st_221.awsui_styled-circle-readonly_1mabk_lk9st_225:not(#\9) {
|
|
225
226
|
fill: var(--color-background-control-disabled-1f3718, #dedee3);
|
|
226
227
|
stroke: var(--color-background-control-disabled-1f3718, #dedee3);
|
|
227
228
|
}
|
|
228
229
|
|
|
229
|
-
.awsui_styled-circle-
|
|
230
|
+
.awsui_styled-circle-fill_1mabk_lk9st_230:not(#\9) {
|
|
230
231
|
stroke: var(--color-background-control-checked-ka7kc2, #006ce0);
|
|
231
232
|
fill: var(--color-foreground-control-default-eto4wy, #ffffff);
|
|
232
233
|
opacity: 0;
|
|
233
234
|
transition: opacity var(--motion-duration-transition-quick-mcm2y0, 90ms) var(--motion-easing-transition-quick-qxak3i, linear);
|
|
234
235
|
}
|
|
235
236
|
@media (prefers-reduced-motion: reduce) {
|
|
236
|
-
.awsui_styled-circle-
|
|
237
|
+
.awsui_styled-circle-fill_1mabk_lk9st_230:not(#\9) {
|
|
237
238
|
animation: none;
|
|
238
239
|
transition: none;
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
|
-
.awsui-motion-disabled .awsui_styled-circle-
|
|
242
|
+
.awsui-motion-disabled .awsui_styled-circle-fill_1mabk_lk9st_230:not(#\9), .awsui-mode-entering .awsui_styled-circle-fill_1mabk_lk9st_230:not(#\9) {
|
|
242
243
|
animation: none;
|
|
243
244
|
transition: none;
|
|
244
245
|
}
|
|
245
|
-
.awsui_styled-circle-
|
|
246
|
+
.awsui_styled-circle-fill_1mabk_lk9st_230.awsui_styled-circle-checked_1mabk_lk9st_246:not(#\9) {
|
|
246
247
|
opacity: 1;
|
|
247
248
|
}
|
|
248
|
-
.awsui_styled-circle-
|
|
249
|
+
.awsui_styled-circle-fill_1mabk_lk9st_230.awsui_styled-circle-disabled_1mabk_lk9st_225:not(#\9) {
|
|
249
250
|
fill: var(--color-foreground-control-disabled-txi6cf, #ffffff);
|
|
250
251
|
stroke: var(--color-background-control-disabled-1f3718, #dedee3);
|
|
251
252
|
}
|
|
252
|
-
.awsui_styled-circle-
|
|
253
|
+
.awsui_styled-circle-fill_1mabk_lk9st_230.awsui_styled-circle-readonly_1mabk_lk9st_225:not(#\9) {
|
|
253
254
|
fill: var(--color-foreground-control-read-only-7ydvuj, #656871);
|
|
254
255
|
stroke: var(--color-background-control-disabled-1f3718, #dedee3);
|
|
255
256
|
}
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"radio": "
|
|
7
|
-
"radio--has-description": "awsui_radio--has-
|
|
8
|
-
"radio-control": "awsui_radio-
|
|
9
|
-
"outline": "
|
|
10
|
-
"styled-circle-border": "awsui_styled-circle-
|
|
11
|
-
"styled-circle-disabled": "awsui_styled-circle-
|
|
12
|
-
"styled-circle-readonly": "awsui_styled-circle-
|
|
13
|
-
"styled-circle-fill": "awsui_styled-circle-
|
|
14
|
-
"styled-circle-checked": "awsui_styled-circle-
|
|
5
|
+
"root": "awsui_root_1mabk_lk9st_145",
|
|
6
|
+
"radio": "awsui_radio_1mabk_lk9st_178",
|
|
7
|
+
"radio--has-description": "awsui_radio--has-description_1mabk_lk9st_186",
|
|
8
|
+
"radio-control": "awsui_radio-control_1mabk_lk9st_190",
|
|
9
|
+
"outline": "awsui_outline_1mabk_lk9st_198",
|
|
10
|
+
"styled-circle-border": "awsui_styled-circle-border_1mabk_lk9st_221",
|
|
11
|
+
"styled-circle-disabled": "awsui_styled-circle-disabled_1mabk_lk9st_225",
|
|
12
|
+
"styled-circle-readonly": "awsui_styled-circle-readonly_1mabk_lk9st_225",
|
|
13
|
+
"styled-circle-fill": "awsui_styled-circle-fill_1mabk_lk9st_230",
|
|
14
|
+
"styled-circle-checked": "awsui_styled-circle-checked_1mabk_lk9st_246"
|
|
15
15
|
};
|
|
16
16
|
|
package/toggle/index.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
'use client';
|
|
4
3
|
import React from 'react';
|
|
5
|
-
|
|
4
|
+
|
|
5
|
+
import CoreComponent from './internal-do-not-use-core';
|
|
6
6
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
-
import
|
|
7
|
+
import { validateProps } from '@cloudscape-design/component-toolkit/internal';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
8
11
|
const Toggle = React.forwardRef((props, ref) => {
|
|
9
|
-
|
|
10
|
-
return React.createElement(
|
|
12
|
+
validateProps('Toggle', props, ["style"], {}, 'console');
|
|
13
|
+
return React.createElement(CoreComponent, {ref,...props});
|
|
11
14
|
});
|
|
15
|
+
|
|
16
|
+
|
|
12
17
|
applyDisplayName(Toggle, 'Toggle');
|
|
13
18
|
export default Toggle;
|
|
14
|
-
//# sourceMappingURL=index.js.map
|