diff --git a/.changeset/healthy-moles-smash.md b/.changeset/healthy-moles-smash.md new file mode 100644 index 00000000000..70e8d8103b0 --- /dev/null +++ b/.changeset/healthy-moles-smash.md @@ -0,0 +1,12 @@ +--- +"@aws-amplify/ui-react-native": patch +"@aws-amplify/ui-react": patch +"@aws-amplify/ui": patch +--- + +feat(react): Add `colorTheme` prop to Button + +The Button React primitive now accepts the `colorTheme` prop which allows for more color variants. Usage: +``` + +``` diff --git a/docs/src/pages/[platform]/components/button/demo.tsx b/docs/src/pages/[platform]/components/button/demo.tsx index 46cfd7b40ab..6f6e209b40a 100644 --- a/docs/src/pages/[platform]/components/button/demo.tsx +++ b/docs/src/pages/[platform]/components/button/demo.tsx @@ -4,6 +4,7 @@ import { Button, ButtonSizes, ButtonVariations, + ButtonColorTheme, ButtonProps, Flex, SwitchField, @@ -22,6 +23,9 @@ const propsToCode = (props) => { (props.variation ? `\n variation=${JSON.stringify(props.variation)}` : '') + + (props.colorTheme + ? `\n colorTheme=${JSON.stringify(props.colorTheme)}` + : '') + (props.size ? `\n size=${JSON.stringify(props.size)}` : '') + ` loadingText=${JSON.stringify(props.loadingText)} @@ -41,15 +45,34 @@ const PropControls = (props) => { id="variation" label="Variation" value={props.variation} - onChange={(event) => - props.setVariation(event.target.value as ButtonVariations) - } + onChange={(event) => { + event.target.value !== '' + ? props.setVariation(event.target.value as ButtonVariations) + : props.setVariation(undefined); + }} > + + + { + event.target.value !== '' + ? props.setColorTheme(event.target.value as ButtonColorTheme) + : props.setColorTheme(undefined); + }} + > + + + - + + { const [loadingText, setLoadingText] = React.useState(''); const [ariaLabel, setAriaLabel] = React.useState(''); const [variation, setVariation] = React.useState(); + const [colorTheme, setColorTheme] = React.useState(); const [size, setSize] = React.useState(); const props = { @@ -123,6 +147,7 @@ export const ButtonDemo = () => { fullWidth, loadingText, ariaLabel, + colorTheme, variation, size, }; @@ -134,8 +159,10 @@ export const ButtonDemo = () => { setLoadingText, setAriaLabel, setVariation, + setColorTheme, setSize, }; + return ( { isLoading={loading} loadingText={loadingText} variation={variation} + colorTheme={colorTheme} size={size} onClick={() => alert('hello')} ariaLabel={ariaLabel} diff --git a/docs/src/pages/[platform]/components/button/examples/ButtonThemeExample.tsx b/docs/src/pages/[platform]/components/button/examples/ButtonThemeExample.tsx index a86262b1600..2d00a696b78 100644 --- a/docs/src/pages/[platform]/components/button/examples/ButtonThemeExample.tsx +++ b/docs/src/pages/[platform]/components/button/examples/ButtonThemeExample.tsx @@ -13,6 +13,14 @@ const theme: Theme = { button: { // this will affect the font weight of all button variants fontWeight: { value: '{fontWeights.extrabold}' }, + + outlined: { + info: { + borderColor: '{colors.purple.60}', + color: '{colors.purple.90}', + }, + }, + // style the primary variation primary: { backgroundColor: { value: '{colors.blue.60}' }, @@ -25,6 +33,23 @@ const theme: Theme = { _active: { backgroundColor: { value: '{colors.blue.90}' }, }, + _disabled: { + backgroundColor: { value: 'transparent' }, + borderColor: { value: '{colors.neutral.30}' }, + }, + error: { + backgroundColor: { value: '{colors.pink.10}' }, + color: { value: '{colors.red.80}' }, + _hover: { + backgroundColor: { value: '#a51b34' }, + }, + _focus: { + backgroundColor: { value: '#9a0c26' }, + }, + _active: { + backgroundColor: { value: '#9a0c26' }, + }, + }, }, }, }, @@ -35,6 +60,13 @@ export const ButtonThemeExample = () => ( + + + ); diff --git a/docs/src/pages/[platform]/components/button/react.mdx b/docs/src/pages/[platform]/components/button/react.mdx index 8d681fa9d03..f53ad84bc53 100644 --- a/docs/src/pages/[platform]/components/button/react.mdx +++ b/docs/src/pages/[platform]/components/button/react.mdx @@ -79,24 +79,86 @@ Use the `size` prop to change the Button size. Available options are `small`, `l Use the `variation` prop to change the Button variation. Available options are `primary`, `link`, `menu`, `warning`, `destructive` and none (default). - + + - - - - - + + ```jsx + - - - +``` + + + + +### Color themes + +Use the `colorTheme` prop to change the Button's color theme. Available options are `error`, `info`, `warning`, `success`, and `overlay`. + + + + + + + + + + + + + +```jsx + + + + + +``` + + + + +The `colorTheme` prop can be combined with `variation` to provide more Button options. + + + + + + + + + + + + + + + + + + + +```jsx +// Primary variation with color themes + + + + + + +// Link variation with color themes + + + + + ``` diff --git a/docs/tests/__snapshots__/cssvars-table.test.ts.snap b/docs/tests/__snapshots__/cssvars-table.test.ts.snap index 0d6c8a83c7d..3ab3d410475 100644 --- a/docs/tests/__snapshots__/cssvars-table.test.ts.snap +++ b/docs/tests/__snapshots__/cssvars-table.test.ts.snap @@ -318,6 +318,10 @@ exports[`CSS Variables Table 1`] = ` \\"variable\\": \\"--amplify-colors-overlay-40\\", \\"value\\": \\"hsla(0, 0%, 0%, 0.4)\\" }, + { + \\"variable\\": \\"--amplify-colors-overlay-5\\", + \\"value\\": \\"hsla(0, 0%, 0%, 0.05)\\" + }, { \\"variable\\": \\"--amplify-colors-overlay-50\\", \\"value\\": \\"hsla(0, 0%, 0%, 0.5)\\" @@ -1120,7 +1124,7 @@ exports[`CSS Variables Table 1`] = ` }, { \\"variable\\": \\"--amplify-components-button-link-border-width\\", - \\"value\\": \\"var(--amplify-space-zero)\\" + \\"value\\": \\"var(--amplify-border-widths-small)\\" }, { \\"variable\\": \\"--amplify-components-button-link-color\\", @@ -1138,6 +1142,58 @@ exports[`CSS Variables Table 1`] = ` \\"variable\\": \\"--amplify-components-button-link-disabled-color\\", \\"value\\": \\"var(--amplify-colors-font-disabled)\\" }, + { + \\"variable\\": \\"--amplify-components-button-link-error-active-background-color\\", + \\"value\\": \\"var(--amplify-colors-red-20)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-error-active-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-error-active-color\\", + \\"value\\": \\"var(--amplify-colors-red-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-error-background-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-error-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-error-color\\", + \\"value\\": \\"var(--amplify-colors-red-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-error-focus-background-color\\", + \\"value\\": \\"var(--amplify-colors-red-10)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-error-focus-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-error-focus-box-shadow\\", + \\"value\\": \\"0px 0px 0px 1px var(--amplify-colors-red-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-error-focus-color\\", + \\"value\\": \\"var(--amplify-colors-red-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-error-hover-background-color\\", + \\"value\\": \\"var(--amplify-colors-red-10)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-error-hover-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-error-hover-color\\", + \\"value\\": \\"var(--amplify-colors-red-90)\\" + }, { \\"variable\\": \\"--amplify-components-button-link-focus-background-color\\", \\"value\\": \\"var(--amplify-colors-brand-primary-10)\\" @@ -1166,6 +1222,58 @@ exports[`CSS Variables Table 1`] = ` \\"variable\\": \\"--amplify-components-button-link-hover-color\\", \\"value\\": \\"var(--amplify-colors-font-hover)\\" }, + { + \\"variable\\": \\"--amplify-components-button-link-info-active-background-color\\", + \\"value\\": \\"var(--amplify-colors-blue-20)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-info-active-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-info-active-color\\", + \\"value\\": \\"var(--amplify-colors-blue-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-info-background-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-info-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-info-color\\", + \\"value\\": \\"var(--amplify-colors-blue-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-info-focus-background-color\\", + \\"value\\": \\"var(--amplify-colors-blue-10)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-info-focus-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-info-focus-box-shadow\\", + \\"value\\": \\"0px 0px 0px 1px var(--amplify-colors-blue-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-info-focus-color\\", + \\"value\\": \\"var(--amplify-colors-blue-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-info-hover-background-color\\", + \\"value\\": \\"var(--amplify-colors-blue-10)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-info-hover-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-info-hover-color\\", + \\"value\\": \\"var(--amplify-colors-blue-90)\\" + }, { \\"variable\\": \\"--amplify-components-button-link-loading-background-color\\", \\"value\\": \\"transparent\\" @@ -1178,6 +1286,162 @@ exports[`CSS Variables Table 1`] = ` \\"variable\\": \\"--amplify-components-button-link-loading-color\\", \\"value\\": \\"var(--amplify-colors-font-disabled)\\" }, + { + \\"variable\\": \\"--amplify-components-button-link-overlay-active-background-color\\", + \\"value\\": \\"var(--amplify-colors-overlay-10)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-overlay-active-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-overlay-active-color\\", + \\"value\\": \\"var(--amplify-colors-overlay-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-overlay-background-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-overlay-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-overlay-color\\", + \\"value\\": \\"var(--amplify-colors-neutral-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-overlay-focus-background-color\\", + \\"value\\": \\"var(--amplify-colors-overlay-5)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-overlay-focus-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-overlay-focus-box-shadow\\", + \\"value\\": \\"0px 0px 0px 1px var(--amplify-colors-overlay-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-overlay-focus-color\\", + \\"value\\": \\"var(--amplify-colors-overlay-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-overlay-hover-background-color\\", + \\"value\\": \\"var(--amplify-colors-overlay-5)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-overlay-hover-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-overlay-hover-color\\", + \\"value\\": \\"var(--amplify-colors-overlay-80)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-success-active-background-color\\", + \\"value\\": \\"var(--amplify-colors-green-20)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-success-active-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-success-active-color\\", + \\"value\\": \\"var(--amplify-colors-green-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-success-background-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-success-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-success-color\\", + \\"value\\": \\"var(--amplify-colors-green-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-success-focus-background-color\\", + \\"value\\": \\"var(--amplify-colors-green-10)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-success-focus-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-success-focus-box-shadow\\", + \\"value\\": \\"0px 0px 0px 1px var(--amplify-colors-green-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-success-focus-color\\", + \\"value\\": \\"var(--amplify-colors-green-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-success-hover-background-color\\", + \\"value\\": \\"var(--amplify-colors-green-10)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-success-hover-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-success-hover-color\\", + \\"value\\": \\"var(--amplify-colors-green-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-warning-active-background-color\\", + \\"value\\": \\"var(--amplify-colors-orange-20)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-warning-active-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-warning-active-color\\", + \\"value\\": \\"var(--amplify-colors-orange-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-warning-background-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-warning-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-warning-color\\", + \\"value\\": \\"var(--amplify-colors-orange-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-warning-focus-background-color\\", + \\"value\\": \\"var(--amplify-colors-orange-10)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-warning-focus-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-warning-focus-box-shadow\\", + \\"value\\": \\"0px 0px 0px 1px var(--amplify-colors-orange-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-warning-focus-color\\", + \\"value\\": \\"var(--amplify-colors-orange-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-warning-hover-background-color\\", + \\"value\\": \\"var(--amplify-colors-orange-10)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-warning-hover-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-link-warning-hover-color\\", + \\"value\\": \\"var(--amplify-colors-orange-90)\\" + }, { \\"variable\\": \\"--amplify-components-button-loader-wrapper-align-items\\", \\"value\\": \\"center\\" @@ -1239,104 +1503,624 @@ exports[`CSS Variables Table 1`] = ` \\"value\\": \\"start\\" }, { - \\"variable\\": \\"--amplify-components-button-padding-block-end\\", - \\"value\\": \\"var(--amplify-components-fieldcontrol-padding-block-end)\\" + \\"variable\\": \\"--amplify-components-button-outlined-error-active-background-color\\", + \\"value\\": \\"var(--amplify-colors-red-20)\\" }, { - \\"variable\\": \\"--amplify-components-button-padding-block-start\\", - \\"value\\": \\"var(--amplify-components-fieldcontrol-padding-block-start)\\" + \\"variable\\": \\"--amplify-components-button-outlined-error-active-border-color\\", + \\"value\\": \\"var(--amplify-colors-red-100)\\" }, { - \\"variable\\": \\"--amplify-components-button-padding-inline-end\\", - \\"value\\": \\"var(--amplify-components-fieldcontrol-padding-inline-end)\\" + \\"variable\\": \\"--amplify-components-button-outlined-error-active-color\\", + \\"value\\": \\"var(--amplify-colors-red-100)\\" }, { - \\"variable\\": \\"--amplify-components-button-padding-inline-start\\", - \\"value\\": \\"var(--amplify-components-fieldcontrol-padding-inline-start)\\" + \\"variable\\": \\"--amplify-components-button-outlined-error-background-color\\", + \\"value\\": \\"transparent\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-active-background-color\\", - \\"value\\": \\"var(--amplify-colors-brand-primary-100)\\" + \\"variable\\": \\"--amplify-components-button-outlined-error-border-color\\", + \\"value\\": \\"var(--amplify-colors-red-60)\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-active-border-color\\", - \\"value\\": \\"transparent\\" + \\"variable\\": \\"--amplify-components-button-outlined-error-color\\", + \\"value\\": \\"var(--amplify-colors-red-100)\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-active-color\\", - \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + \\"variable\\": \\"--amplify-components-button-outlined-error-focus-background-color\\", + \\"value\\": \\"var(--amplify-colors-red-10)\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-background-color\\", - \\"value\\": \\"var(--amplify-colors-brand-primary-80)\\" + \\"variable\\": \\"--amplify-components-button-outlined-error-focus-border-color\\", + \\"value\\": \\"var(--amplify-colors-red-100)\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-border-color\\", - \\"value\\": \\"transparent\\" + \\"variable\\": \\"--amplify-components-button-outlined-error-focus-box-shadow\\", + \\"value\\": \\"0px 0px 0px 1px var(--amplify-colors-red-100)\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-border-style\\", - \\"value\\": \\"solid\\" + \\"variable\\": \\"--amplify-components-button-outlined-error-focus-color\\", + \\"value\\": \\"var(--amplify-colors-red-100)\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-border-width\\", - \\"value\\": \\"var(--amplify-border-widths-small)\\" + \\"variable\\": \\"--amplify-components-button-outlined-error-hover-background-color\\", + \\"value\\": \\"var(--amplify-colors-red-10)\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-color\\", - \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + \\"variable\\": \\"--amplify-components-button-outlined-error-hover-border-color\\", + \\"value\\": \\"var(--amplify-colors-red-60)\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-disabled-background-color\\", - \\"value\\": \\"var(--amplify-colors-background-disabled)\\" + \\"variable\\": \\"--amplify-components-button-outlined-error-hover-color\\", + \\"value\\": \\"var(--amplify-colors-red-100)\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-disabled-border-color\\", - \\"value\\": \\"transparent\\" + \\"variable\\": \\"--amplify-components-button-outlined-info-active-background-color\\", + \\"value\\": \\"var(--amplify-colors-blue-20)\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-disabled-color\\", - \\"value\\": \\"var(--amplify-colors-font-disabled)\\" + \\"variable\\": \\"--amplify-components-button-outlined-info-active-border-color\\", + \\"value\\": \\"var(--amplify-colors-blue-100)\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-focus-background-color\\", - \\"value\\": \\"var(--amplify-colors-brand-primary-90)\\" + \\"variable\\": \\"--amplify-components-button-outlined-info-active-color\\", + \\"value\\": \\"var(--amplify-colors-blue-100)\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-focus-border-color\\", + \\"variable\\": \\"--amplify-components-button-outlined-info-background-color\\", \\"value\\": \\"transparent\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-focus-box-shadow\\", - \\"value\\": \\"var(--amplify-components-fieldcontrol-focus-box-shadow)\\" + \\"variable\\": \\"--amplify-components-button-outlined-info-border-color\\", + \\"value\\": \\"var(--amplify-colors-blue-60)\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-focus-color\\", - \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + \\"variable\\": \\"--amplify-components-button-outlined-info-color\\", + \\"value\\": \\"var(--amplify-colors-blue-100)\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-hover-background-color\\", - \\"value\\": \\"var(--amplify-colors-brand-primary-90)\\" + \\"variable\\": \\"--amplify-components-button-outlined-info-focus-background-color\\", + \\"value\\": \\"var(--amplify-colors-blue-10)\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-hover-border-color\\", - \\"value\\": \\"transparent\\" + \\"variable\\": \\"--amplify-components-button-outlined-info-focus-border-color\\", + \\"value\\": \\"var(--amplify-colors-blue-100)\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-hover-color\\", - \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + \\"variable\\": \\"--amplify-components-button-outlined-info-focus-box-shadow\\", + \\"value\\": \\"0px 0px 0px 1px var(--amplify-colors-blue-100)\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-loading-background-color\\", - \\"value\\": \\"var(--amplify-colors-background-disabled)\\" + \\"variable\\": \\"--amplify-components-button-outlined-info-focus-color\\", + \\"value\\": \\"var(--amplify-colors-blue-100)\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-loading-border-color\\", + \\"variable\\": \\"--amplify-components-button-outlined-info-hover-background-color\\", + \\"value\\": \\"var(--amplify-colors-blue-10)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-info-hover-border-color\\", + \\"value\\": \\"var(--amplify-colors-blue-60)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-info-hover-color\\", + \\"value\\": \\"var(--amplify-colors-blue-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-overlay-active-background-color\\", + \\"value\\": \\"var(--amplify-colors-overlay-10)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-overlay-active-border-color\\", + \\"value\\": \\"var(--amplify-colors-overlay-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-overlay-active-color\\", + \\"value\\": \\"var(--amplify-colors-neutral-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-overlay-background-color\\", \\"value\\": \\"transparent\\" }, { - \\"variable\\": \\"--amplify-components-button-primary-loading-color\\", - \\"value\\": \\"var(--amplify-colors-font-disabled)\\" + \\"variable\\": \\"--amplify-components-button-outlined-overlay-border-color\\", + \\"value\\": \\"var(--amplify-colors-overlay-60)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-overlay-color\\", + \\"value\\": \\"var(--amplify-colors-font-primary)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-overlay-focus-background-color\\", + \\"value\\": \\"var(--amplify-colors-overlay-5)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-overlay-focus-border-color\\", + \\"value\\": \\"var(--amplify-colors-overlay-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-overlay-focus-box-shadow\\", + \\"value\\": \\"0px 0px 0px 1px var(--amplify-colors-overlay-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-overlay-focus-color\\", + \\"value\\": \\"var(--amplify-colors-neutral-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-overlay-hover-background-color\\", + \\"value\\": \\"var(--amplify-colors-overlay-5)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-overlay-hover-border-color\\", + \\"value\\": \\"var(--amplify-colors-overlay-60)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-overlay-hover-color\\", + \\"value\\": \\"var(--amplify-colors-neutral-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-success-active-background-color\\", + \\"value\\": \\"var(--amplify-colors-green-20)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-success-active-border-color\\", + \\"value\\": \\"var(--amplify-colors-green-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-success-active-color\\", + \\"value\\": \\"var(--amplify-colors-green-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-success-background-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-success-border-color\\", + \\"value\\": \\"var(--amplify-colors-green-60)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-success-color\\", + \\"value\\": \\"var(--amplify-colors-green-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-success-focus-background-color\\", + \\"value\\": \\"var(--amplify-colors-green-10)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-success-focus-border-color\\", + \\"value\\": \\"var(--amplify-colors-green-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-success-focus-box-shadow\\", + \\"value\\": \\"0px 0px 0px 1px var(--amplify-colors-green-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-success-focus-color\\", + \\"value\\": \\"var(--amplify-colors-green-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-success-hover-background-color\\", + \\"value\\": \\"var(--amplify-colors-green-10)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-success-hover-border-color\\", + \\"value\\": \\"var(--amplify-colors-green-60)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-success-hover-color\\", + \\"value\\": \\"var(--amplify-colors-green-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-warning-active-background-color\\", + \\"value\\": \\"var(--amplify-colors-orange-20)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-warning-active-border-color\\", + \\"value\\": \\"var(--amplify-colors-orange-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-warning-active-color\\", + \\"value\\": \\"var(--amplify-colors-orange-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-warning-background-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-warning-border-color\\", + \\"value\\": \\"var(--amplify-colors-orange-60)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-warning-color\\", + \\"value\\": \\"var(--amplify-colors-orange-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-warning-focus-background-color\\", + \\"value\\": \\"var(--amplify-colors-orange-10)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-warning-focus-border-color\\", + \\"value\\": \\"var(--amplify-colors-orange-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-warning-focus-box-shadow\\", + \\"value\\": \\"0px 0px 0px 1px var(--amplify-colors-orange-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-warning-focus-color\\", + \\"value\\": \\"var(--amplify-colors-orange-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-warning-hover-background-color\\", + \\"value\\": \\"var(--amplify-colors-orange-10)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-warning-hover-border-color\\", + \\"value\\": \\"var(--amplify-colors-orange-60)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-outlined-warning-hover-color\\", + \\"value\\": \\"var(--amplify-colors-orange-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-padding-block-end\\", + \\"value\\": \\"var(--amplify-components-fieldcontrol-padding-block-end)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-padding-block-start\\", + \\"value\\": \\"var(--amplify-components-fieldcontrol-padding-block-start)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-padding-inline-end\\", + \\"value\\": \\"var(--amplify-components-fieldcontrol-padding-inline-end)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-padding-inline-start\\", + \\"value\\": \\"var(--amplify-components-fieldcontrol-padding-inline-start)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-active-background-color\\", + \\"value\\": \\"var(--amplify-colors-brand-primary-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-active-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-active-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-background-color\\", + \\"value\\": \\"var(--amplify-colors-brand-primary-80)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-border-style\\", + \\"value\\": \\"solid\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-border-width\\", + \\"value\\": \\"var(--amplify-border-widths-small)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-disabled-background-color\\", + \\"value\\": \\"var(--amplify-colors-background-disabled)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-disabled-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-disabled-color\\", + \\"value\\": \\"var(--amplify-colors-font-disabled)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-error-active-background-color\\", + \\"value\\": \\"var(--amplify-colors-red-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-error-active-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-error-active-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-error-background-color\\", + \\"value\\": \\"var(--amplify-colors-red-80)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-error-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-error-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-error-focus-background-color\\", + \\"value\\": \\"var(--amplify-colors-red-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-error-focus-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-error-focus-box-shadow\\", + \\"value\\": \\"0px 0px 0px 1px var(--amplify-colors-red-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-error-focus-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-error-hover-background-color\\", + \\"value\\": \\"var(--amplify-colors-red-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-error-hover-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-error-hover-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-focus-background-color\\", + \\"value\\": \\"var(--amplify-colors-brand-primary-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-focus-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-focus-box-shadow\\", + \\"value\\": \\"var(--amplify-components-fieldcontrol-focus-box-shadow)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-focus-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-hover-background-color\\", + \\"value\\": \\"var(--amplify-colors-brand-primary-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-hover-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-hover-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-info-active-background-color\\", + \\"value\\": \\"var(--amplify-colors-blue-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-info-active-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-info-active-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-info-background-color\\", + \\"value\\": \\"var(--amplify-colors-blue-80)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-info-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-info-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-info-focus-background-color\\", + \\"value\\": \\"var(--amplify-colors-blue-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-info-focus-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-info-focus-box-shadow\\", + \\"value\\": \\"0px 0px 0px 1px var(--amplify-colors-blue-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-info-focus-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-info-hover-background-color\\", + \\"value\\": \\"var(--amplify-colors-blue-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-info-hover-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-info-hover-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-loading-background-color\\", + \\"value\\": \\"var(--amplify-colors-background-disabled)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-loading-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-loading-color\\", + \\"value\\": \\"var(--amplify-colors-font-disabled)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-overlay-active-background-color\\", + \\"value\\": \\"var(--amplify-colors-overlay-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-overlay-active-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-overlay-active-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-overlay-background-color\\", + \\"value\\": \\"var(--amplify-colors-overlay-70)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-overlay-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-overlay-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-overlay-focus-background-color\\", + \\"value\\": \\"var(--amplify-colors-overlay-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-overlay-focus-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-overlay-focus-box-shadow\\", + \\"value\\": \\"0px 0px 0px 1px var(--amplify-colors-overlay-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-overlay-focus-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-overlay-hover-background-color\\", + \\"value\\": \\"var(--amplify-colors-overlay-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-overlay-hover-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-overlay-hover-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-success-active-background-color\\", + \\"value\\": \\"var(--amplify-colors-green-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-success-active-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-success-active-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-success-background-color\\", + \\"value\\": \\"var(--amplify-colors-green-80)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-success-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-success-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-success-focus-background-color\\", + \\"value\\": \\"var(--amplify-colors-green-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-success-focus-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-success-focus-box-shadow\\", + \\"value\\": \\"0px 0px 0px 1px var(--amplify-colors-green-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-success-focus-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-success-hover-background-color\\", + \\"value\\": \\"var(--amplify-colors-green-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-success-hover-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-success-hover-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-warning-active-background-color\\", + \\"value\\": \\"var(--amplify-colors-orange-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-warning-active-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-warning-active-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-warning-background-color\\", + \\"value\\": \\"var(--amplify-colors-orange-80)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-warning-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-warning-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-warning-focus-background-color\\", + \\"value\\": \\"var(--amplify-colors-orange-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-warning-focus-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-warning-focus-box-shadow\\", + \\"value\\": \\"0px 0px 0px 1px var(--amplify-colors-orange-100)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-warning-focus-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-warning-hover-background-color\\", + \\"value\\": \\"var(--amplify-colors-orange-90)\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-warning-hover-border-color\\", + \\"value\\": \\"transparent\\" + }, + { + \\"variable\\": \\"--amplify-components-button-primary-warning-hover-color\\", + \\"value\\": \\"var(--amplify-colors-font-inverse)\\" }, { \\"variable\\": \\"--amplify-components-button-small-font-size\\", diff --git a/docs/tests/__snapshots__/props-table.test.ts.snap b/docs/tests/__snapshots__/props-table.test.ts.snap index 170bbff9b5d..9e963c65130 100644 --- a/docs/tests/__snapshots__/props-table.test.ts.snap +++ b/docs/tests/__snapshots__/props-table.test.ts.snap @@ -1575,6 +1575,13 @@ exports[`Props Table 1`] = ` \\"category\\": \\"BaseComponentProps\\", \\"isOptional\\": true }, + \\"colorTheme\\": { + \\"name\\": \\"colorTheme\\", + \\"type\\": \\"| 'info'\\\\n | 'error'\\\\n | 'warning'\\\\n | 'success'\\\\n | 'overlay'\\", + \\"description\\": \\"Changes the color scheme of the button\\", + \\"category\\": \\"BaseButtonProps\\", + \\"isOptional\\": true + }, \\"isDisabled\\": { \\"name\\": \\"isDisabled\\", \\"type\\": \\"boolean | undefined\\", @@ -5165,13 +5172,6 @@ exports[`Props Table 1`] = ` \\"MenuButton\\": [ { \\"Main\\": { - \\"id\\": { - \\"name\\": \\"id\\", - \\"type\\": \\"string | undefined\\", - \\"description\\": \\"Unique identifier\\", - \\"category\\": \\"BaseComponentProps\\", - \\"isOptional\\": true - }, \\"children\\": { \\"name\\": \\"children\\", \\"type\\": \\"React.ReactNode\\", @@ -5179,6 +5179,13 @@ exports[`Props Table 1`] = ` \\"category\\": \\"BaseComponentProps\\", \\"isOptional\\": true }, + \\"id\\": { + \\"name\\": \\"id\\", + \\"type\\": \\"string | undefined\\", + \\"description\\": \\"Unique identifier\\", + \\"category\\": \\"BaseComponentProps\\", + \\"isOptional\\": true + }, \\"className\\": { \\"name\\": \\"className\\", \\"type\\": \\"string | undefined\\", @@ -5200,20 +5207,6 @@ exports[`Props Table 1`] = ` \\"category\\": \\"BaseComponentProps\\", \\"isOptional\\": true }, - \\"isDisabled\\": { - \\"name\\": \\"isDisabled\\", - \\"type\\": \\"boolean | undefined\\", - \\"description\\": \\"If \`true\`, the button will be disabled.\\", - \\"category\\": \\"BaseButtonProps\\", - \\"isOptional\\": true - }, - \\"isFullWidth\\": { - \\"name\\": \\"isFullWidth\\", - \\"type\\": \\"boolean | undefined\\", - \\"description\\": \\"If \`true\`, the button will take up the full width of its container.\\", - \\"category\\": \\"BaseButtonProps\\", - \\"isOptional\\": true - }, \\"isLoading\\": { \\"name\\": \\"isLoading\\", \\"type\\": \\"boolean | undefined\\", @@ -5221,10 +5214,10 @@ exports[`Props Table 1`] = ` \\"category\\": \\"BaseButtonProps\\", \\"isOptional\\": true }, - \\"loadingText\\": { - \\"name\\": \\"loadingText\\", - \\"type\\": \\"string | undefined\\", - \\"description\\": \\"The label to show in the button when \`loading\` is true\\\\nIf no text is passed, it only shows the spinner\\", + \\"isDisabled\\": { + \\"name\\": \\"isDisabled\\", + \\"type\\": \\"boolean | undefined\\", + \\"description\\": \\"If \`true\`, the button will be disabled.\\", \\"category\\": \\"BaseButtonProps\\", \\"isOptional\\": true }, @@ -5235,13 +5228,6 @@ exports[`Props Table 1`] = ` \\"category\\": \\"BaseButtonProps\\", \\"isOptional\\": true }, - \\"size\\": { - \\"name\\": \\"size\\", - \\"type\\": \\"'small' | 'large'\\", - \\"description\\": \\"Changes the size of the button. Default: \\\\\\"medium\\\\\\"\\", - \\"category\\": \\"BaseButtonProps\\", - \\"isOptional\\": true - }, \\"type\\": { \\"name\\": \\"type\\", \\"type\\": \\"'button' | 'reset' | 'submit'\\", @@ -5249,6 +5235,13 @@ exports[`Props Table 1`] = ` \\"category\\": \\"BaseButtonProps\\", \\"isOptional\\": true }, + \\"size\\": { + \\"name\\": \\"size\\", + \\"type\\": \\"'small' | 'large'\\", + \\"description\\": \\"Changes the size of the button. Default: \\\\\\"medium\\\\\\"\\", + \\"category\\": \\"BaseButtonProps\\", + \\"isOptional\\": true + }, \\"variation\\": { \\"name\\": \\"variation\\", \\"type\\": \\"| 'primary'\\\\n | 'link'\\\\n | 'menu'\\\\n | 'warning'\\\\n | 'destructive'\\", @@ -5256,6 +5249,20 @@ exports[`Props Table 1`] = ` \\"category\\": \\"BaseButtonProps\\", \\"isOptional\\": true }, + \\"isFullWidth\\": { + \\"name\\": \\"isFullWidth\\", + \\"type\\": \\"boolean | undefined\\", + \\"description\\": \\"If \`true\`, the button will take up the full width of its container.\\", + \\"category\\": \\"BaseButtonProps\\", + \\"isOptional\\": true + }, + \\"loadingText\\": { + \\"name\\": \\"loadingText\\", + \\"type\\": \\"string | undefined\\", + \\"description\\": \\"The label to show in the button when \`loading\` is true\\\\nIf no text is passed, it only shows the spinner\\", + \\"category\\": \\"BaseButtonProps\\", + \\"isOptional\\": true + }, \\"style\\": { \\"name\\": \\"style\\", \\"type\\": \\"React.CSSProperties | undefined\\", @@ -5309,13 +5316,6 @@ exports[`Props Table 1`] = ` \\"category\\": \\"CSSLayoutStyleProps\\", \\"isOptional\\": true }, - \\"direction\\": { - \\"name\\": \\"direction\\", - \\"type\\": \\"ResponsiveStyle | undefined\\", - \\"description\\": \\"Sets how flex items are placed in the flex container defining the main axis\\\\nand the direction (normal or reversed). (maps to flex-direction CSS property)\\", - \\"category\\": \\"FlexContainerStyleProps\\", - \\"isOptional\\": true - }, \\"wrap\\": { \\"name\\": \\"wrap\\", \\"type\\": \\"ResponsiveStyle | undefined\\", @@ -5323,6 +5323,13 @@ exports[`Props Table 1`] = ` \\"category\\": \\"FlexContainerStyleProps\\", \\"isOptional\\": true }, + \\"direction\\": { + \\"name\\": \\"direction\\", + \\"type\\": \\"ResponsiveStyle | undefined\\", + \\"description\\": \\"Sets how flex items are placed in the flex container defining the main axis\\\\nand the direction (normal or reversed). (maps to flex-direction CSS property)\\", + \\"category\\": \\"FlexContainerStyleProps\\", + \\"isOptional\\": true + }, \\"flex\\": { \\"name\\": \\"flex\\", \\"type\\": \\"ResponsiveStyle> | undefined\\", @@ -5358,10 +5365,10 @@ exports[`Props Table 1`] = ` \\"category\\": \\"FlexItemStyleProps\\", \\"isOptional\\": true }, - \\"area\\": { - \\"name\\": \\"area\\", - \\"type\\": \\"ResponsiveStyle | undefined\\", - \\"description\\": \\"Specifies a grid item's size and location within a grid by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the edges of its grid area. See: [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-area)\\", + \\"row\\": { + \\"name\\": \\"row\\", + \\"type\\": \\"ResponsiveStyle | undefined\\", + \\"description\\": \\"Specifies a grid item's size and location within the grid row by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-start and inline-end edge of its grid area. See: [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row)\\", \\"category\\": \\"GridItemStyleProps\\", \\"isOptional\\": true }, @@ -5372,6 +5379,13 @@ exports[`Props Table 1`] = ` \\"category\\": \\"GridItemStyleProps\\", \\"isOptional\\": true }, + \\"area\\": { + \\"name\\": \\"area\\", + \\"type\\": \\"ResponsiveStyle | undefined\\", + \\"description\\": \\"Specifies a grid item's size and location within a grid by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the edges of its grid area. See: [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-area)\\", + \\"category\\": \\"GridItemStyleProps\\", + \\"isOptional\\": true + }, \\"columnEnd\\": { \\"name\\": \\"columnEnd\\", \\"type\\": \\"ResponsiveStyle | undefined\\", @@ -5393,13 +5407,6 @@ exports[`Props Table 1`] = ` \\"category\\": \\"GridItemStyleProps\\", \\"isOptional\\": true }, - \\"row\\": { - \\"name\\": \\"row\\", - \\"type\\": \\"ResponsiveStyle | undefined\\", - \\"description\\": \\"Specifies a grid item's size and location within the grid row by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-start and inline-end edge of its grid area. See: [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row)\\", - \\"category\\": \\"GridItemStyleProps\\", - \\"isOptional\\": true - }, \\"rowEnd\\": { \\"name\\": \\"rowEnd\\", \\"type\\": \\"ResponsiveStyle | undefined\\", @@ -5462,20 +5469,6 @@ exports[`Props Table 1`] = ` \\"category\\": \\"BaseMenuItemProps\\", \\"isOptional\\": true }, - \\"isDisabled\\": { - \\"name\\": \\"isDisabled\\", - \\"type\\": \\"boolean | undefined\\", - \\"description\\": \\"If \`true\`, the button will be disabled.\\", - \\"category\\": \\"BaseButtonProps\\", - \\"isOptional\\": true - }, - \\"isFullWidth\\": { - \\"name\\": \\"isFullWidth\\", - \\"type\\": \\"boolean | undefined\\", - \\"description\\": \\"If \`true\`, the button will take up the full width of its container.\\", - \\"category\\": \\"BaseButtonProps\\", - \\"isOptional\\": true - }, \\"isLoading\\": { \\"name\\": \\"isLoading\\", \\"type\\": \\"boolean | undefined\\", @@ -5483,10 +5476,10 @@ exports[`Props Table 1`] = ` \\"category\\": \\"BaseButtonProps\\", \\"isOptional\\": true }, - \\"loadingText\\": { - \\"name\\": \\"loadingText\\", - \\"type\\": \\"string | undefined\\", - \\"description\\": \\"The label to show in the button when \`loading\` is true\\\\nIf no text is passed, it only shows the spinner\\", + \\"isDisabled\\": { + \\"name\\": \\"isDisabled\\", + \\"type\\": \\"boolean | undefined\\", + \\"description\\": \\"If \`true\`, the button will be disabled.\\", \\"category\\": \\"BaseButtonProps\\", \\"isOptional\\": true }, @@ -5497,13 +5490,6 @@ exports[`Props Table 1`] = ` \\"category\\": \\"BaseButtonProps\\", \\"isOptional\\": true }, - \\"size\\": { - \\"name\\": \\"size\\", - \\"type\\": \\"'small' | 'large'\\", - \\"description\\": \\"Changes the size of the button. Default: \\\\\\"medium\\\\\\"\\", - \\"category\\": \\"BaseButtonProps\\", - \\"isOptional\\": true - }, \\"type\\": { \\"name\\": \\"type\\", \\"type\\": \\"'button' | 'reset' | 'submit'\\", @@ -5511,6 +5497,13 @@ exports[`Props Table 1`] = ` \\"category\\": \\"BaseButtonProps\\", \\"isOptional\\": true }, + \\"size\\": { + \\"name\\": \\"size\\", + \\"type\\": \\"'small' | 'large'\\", + \\"description\\": \\"Changes the size of the button. Default: \\\\\\"medium\\\\\\"\\", + \\"category\\": \\"BaseButtonProps\\", + \\"isOptional\\": true + }, \\"variation\\": { \\"name\\": \\"variation\\", \\"type\\": \\"| 'primary'\\\\n | 'link'\\\\n | 'menu'\\\\n | 'warning'\\\\n | 'destructive'\\", @@ -5518,6 +5511,20 @@ exports[`Props Table 1`] = ` \\"category\\": \\"BaseButtonProps\\", \\"isOptional\\": true }, + \\"isFullWidth\\": { + \\"name\\": \\"isFullWidth\\", + \\"type\\": \\"boolean | undefined\\", + \\"description\\": \\"If \`true\`, the button will take up the full width of its container.\\", + \\"category\\": \\"BaseButtonProps\\", + \\"isOptional\\": true + }, + \\"loadingText\\": { + \\"name\\": \\"loadingText\\", + \\"type\\": \\"string | undefined\\", + \\"description\\": \\"The label to show in the button when \`loading\` is true\\\\nIf no text is passed, it only shows the spinner\\", + \\"category\\": \\"BaseButtonProps\\", + \\"isOptional\\": true + }, \\"style\\": { \\"name\\": \\"style\\", \\"type\\": \\"React.CSSProperties | undefined\\", @@ -5571,13 +5578,6 @@ exports[`Props Table 1`] = ` \\"category\\": \\"CSSLayoutStyleProps\\", \\"isOptional\\": true }, - \\"direction\\": { - \\"name\\": \\"direction\\", - \\"type\\": \\"ResponsiveStyle | undefined\\", - \\"description\\": \\"Sets how flex items are placed in the flex container defining the main axis\\\\nand the direction (normal or reversed). (maps to flex-direction CSS property)\\", - \\"category\\": \\"FlexContainerStyleProps\\", - \\"isOptional\\": true - }, \\"wrap\\": { \\"name\\": \\"wrap\\", \\"type\\": \\"ResponsiveStyle | undefined\\", @@ -5585,6 +5585,13 @@ exports[`Props Table 1`] = ` \\"category\\": \\"FlexContainerStyleProps\\", \\"isOptional\\": true }, + \\"direction\\": { + \\"name\\": \\"direction\\", + \\"type\\": \\"ResponsiveStyle | undefined\\", + \\"description\\": \\"Sets how flex items are placed in the flex container defining the main axis\\\\nand the direction (normal or reversed). (maps to flex-direction CSS property)\\", + \\"category\\": \\"FlexContainerStyleProps\\", + \\"isOptional\\": true + }, \\"flex\\": { \\"name\\": \\"flex\\", \\"type\\": \\"ResponsiveStyle> | undefined\\", @@ -5620,10 +5627,10 @@ exports[`Props Table 1`] = ` \\"category\\": \\"FlexItemStyleProps\\", \\"isOptional\\": true }, - \\"area\\": { - \\"name\\": \\"area\\", - \\"type\\": \\"ResponsiveStyle | undefined\\", - \\"description\\": \\"Specifies a grid item's size and location within a grid by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the edges of its grid area. See: [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-area)\\", + \\"row\\": { + \\"name\\": \\"row\\", + \\"type\\": \\"ResponsiveStyle | undefined\\", + \\"description\\": \\"Specifies a grid item's size and location within the grid row by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-start and inline-end edge of its grid area. See: [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row)\\", \\"category\\": \\"GridItemStyleProps\\", \\"isOptional\\": true }, @@ -5634,6 +5641,13 @@ exports[`Props Table 1`] = ` \\"category\\": \\"GridItemStyleProps\\", \\"isOptional\\": true }, + \\"area\\": { + \\"name\\": \\"area\\", + \\"type\\": \\"ResponsiveStyle | undefined\\", + \\"description\\": \\"Specifies a grid item's size and location within a grid by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the edges of its grid area. See: [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-area)\\", + \\"category\\": \\"GridItemStyleProps\\", + \\"isOptional\\": true + }, \\"columnEnd\\": { \\"name\\": \\"columnEnd\\", \\"type\\": \\"ResponsiveStyle | undefined\\", @@ -5655,13 +5669,6 @@ exports[`Props Table 1`] = ` \\"category\\": \\"GridItemStyleProps\\", \\"isOptional\\": true }, - \\"row\\": { - \\"name\\": \\"row\\", - \\"type\\": \\"ResponsiveStyle | undefined\\", - \\"description\\": \\"Specifies a grid item's size and location within the grid row by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-start and inline-end edge of its grid area. See: [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row)\\", - \\"category\\": \\"GridItemStyleProps\\", - \\"isOptional\\": true - }, \\"rowEnd\\": { \\"name\\": \\"rowEnd\\", \\"type\\": \\"ResponsiveStyle | undefined\\", @@ -12356,13 +12363,6 @@ exports[`Props Table 1`] = ` \\"ToggleButton\\": [ { \\"Main\\": { - \\"id\\": { - \\"name\\": \\"id\\", - \\"type\\": \\"string | undefined\\", - \\"description\\": \\"Unique identifier\\", - \\"category\\": \\"BaseComponentProps\\", - \\"isOptional\\": true - }, \\"children\\": { \\"name\\": \\"children\\", \\"type\\": \\"React.ReactNode\\", @@ -12370,6 +12370,13 @@ exports[`Props Table 1`] = ` \\"category\\": \\"BaseComponentProps\\", \\"isOptional\\": true }, + \\"id\\": { + \\"name\\": \\"id\\", + \\"type\\": \\"string | undefined\\", + \\"description\\": \\"Unique identifier\\", + \\"category\\": \\"BaseComponentProps\\", + \\"isOptional\\": true + }, \\"className\\": { \\"name\\": \\"className\\", \\"type\\": \\"string | undefined\\", @@ -12419,20 +12426,6 @@ exports[`Props Table 1`] = ` \\"category\\": \\"BaseToggleButtonProps\\", \\"isOptional\\": true }, - \\"isDisabled\\": { - \\"name\\": \\"isDisabled\\", - \\"type\\": \\"boolean | undefined\\", - \\"description\\": \\"If \`true\`, the button will be disabled.\\", - \\"category\\": \\"BaseButtonProps\\", - \\"isOptional\\": true - }, - \\"isFullWidth\\": { - \\"name\\": \\"isFullWidth\\", - \\"type\\": \\"boolean | undefined\\", - \\"description\\": \\"If \`true\`, the button will take up the full width of its container.\\", - \\"category\\": \\"BaseButtonProps\\", - \\"isOptional\\": true - }, \\"isLoading\\": { \\"name\\": \\"isLoading\\", \\"type\\": \\"boolean | undefined\\", @@ -12440,10 +12433,10 @@ exports[`Props Table 1`] = ` \\"category\\": \\"BaseButtonProps\\", \\"isOptional\\": true }, - \\"loadingText\\": { - \\"name\\": \\"loadingText\\", - \\"type\\": \\"string | undefined\\", - \\"description\\": \\"The label to show in the button when \`loading\` is true\\\\nIf no text is passed, it only shows the spinner\\", + \\"isDisabled\\": { + \\"name\\": \\"isDisabled\\", + \\"type\\": \\"boolean | undefined\\", + \\"description\\": \\"If \`true\`, the button will be disabled.\\", \\"category\\": \\"BaseButtonProps\\", \\"isOptional\\": true }, @@ -12454,13 +12447,6 @@ exports[`Props Table 1`] = ` \\"category\\": \\"BaseButtonProps\\", \\"isOptional\\": true }, - \\"size\\": { - \\"name\\": \\"size\\", - \\"type\\": \\"'small' | 'large'\\", - \\"description\\": \\"Changes the size of the button. Default: \\\\\\"medium\\\\\\"\\", - \\"category\\": \\"BaseButtonProps\\", - \\"isOptional\\": true - }, \\"type\\": { \\"name\\": \\"type\\", \\"type\\": \\"'button' | 'reset' | 'submit'\\", @@ -12468,6 +12454,13 @@ exports[`Props Table 1`] = ` \\"category\\": \\"BaseButtonProps\\", \\"isOptional\\": true }, + \\"size\\": { + \\"name\\": \\"size\\", + \\"type\\": \\"'small' | 'large'\\", + \\"description\\": \\"Changes the size of the button. Default: \\\\\\"medium\\\\\\"\\", + \\"category\\": \\"BaseButtonProps\\", + \\"isOptional\\": true + }, \\"variation\\": { \\"name\\": \\"variation\\", \\"type\\": \\"| 'primary'\\\\n | 'link'\\\\n | 'menu'\\\\n | 'warning'\\\\n | 'destructive'\\", @@ -12475,6 +12468,20 @@ exports[`Props Table 1`] = ` \\"category\\": \\"BaseButtonProps\\", \\"isOptional\\": true }, + \\"isFullWidth\\": { + \\"name\\": \\"isFullWidth\\", + \\"type\\": \\"boolean | undefined\\", + \\"description\\": \\"If \`true\`, the button will take up the full width of its container.\\", + \\"category\\": \\"BaseButtonProps\\", + \\"isOptional\\": true + }, + \\"loadingText\\": { + \\"name\\": \\"loadingText\\", + \\"type\\": \\"string | undefined\\", + \\"description\\": \\"The label to show in the button when \`loading\` is true\\\\nIf no text is passed, it only shows the spinner\\", + \\"category\\": \\"BaseButtonProps\\", + \\"isOptional\\": true + }, \\"style\\": { \\"name\\": \\"style\\", \\"type\\": \\"React.CSSProperties | undefined\\", @@ -12528,13 +12535,6 @@ exports[`Props Table 1`] = ` \\"category\\": \\"CSSLayoutStyleProps\\", \\"isOptional\\": true }, - \\"direction\\": { - \\"name\\": \\"direction\\", - \\"type\\": \\"ResponsiveStyle | undefined\\", - \\"description\\": \\"Sets how flex items are placed in the flex container defining the main axis\\\\nand the direction (normal or reversed). (maps to flex-direction CSS property)\\", - \\"category\\": \\"FlexContainerStyleProps\\", - \\"isOptional\\": true - }, \\"wrap\\": { \\"name\\": \\"wrap\\", \\"type\\": \\"ResponsiveStyle | undefined\\", @@ -12542,6 +12542,13 @@ exports[`Props Table 1`] = ` \\"category\\": \\"FlexContainerStyleProps\\", \\"isOptional\\": true }, + \\"direction\\": { + \\"name\\": \\"direction\\", + \\"type\\": \\"ResponsiveStyle | undefined\\", + \\"description\\": \\"Sets how flex items are placed in the flex container defining the main axis\\\\nand the direction (normal or reversed). (maps to flex-direction CSS property)\\", + \\"category\\": \\"FlexContainerStyleProps\\", + \\"isOptional\\": true + }, \\"flex\\": { \\"name\\": \\"flex\\", \\"type\\": \\"ResponsiveStyle> | undefined\\", @@ -12577,10 +12584,10 @@ exports[`Props Table 1`] = ` \\"category\\": \\"FlexItemStyleProps\\", \\"isOptional\\": true }, - \\"area\\": { - \\"name\\": \\"area\\", - \\"type\\": \\"ResponsiveStyle | undefined\\", - \\"description\\": \\"Specifies a grid item's size and location within a grid by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the edges of its grid area. See: [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-area)\\", + \\"row\\": { + \\"name\\": \\"row\\", + \\"type\\": \\"ResponsiveStyle | undefined\\", + \\"description\\": \\"Specifies a grid item's size and location within the grid row by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-start and inline-end edge of its grid area. See: [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row)\\", \\"category\\": \\"GridItemStyleProps\\", \\"isOptional\\": true }, @@ -12591,6 +12598,13 @@ exports[`Props Table 1`] = ` \\"category\\": \\"GridItemStyleProps\\", \\"isOptional\\": true }, + \\"area\\": { + \\"name\\": \\"area\\", + \\"type\\": \\"ResponsiveStyle | undefined\\", + \\"description\\": \\"Specifies a grid item's size and location within a grid by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the edges of its grid area. See: [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-area)\\", + \\"category\\": \\"GridItemStyleProps\\", + \\"isOptional\\": true + }, \\"columnEnd\\": { \\"name\\": \\"columnEnd\\", \\"type\\": \\"ResponsiveStyle | undefined\\", @@ -12612,13 +12626,6 @@ exports[`Props Table 1`] = ` \\"category\\": \\"GridItemStyleProps\\", \\"isOptional\\": true }, - \\"row\\": { - \\"name\\": \\"row\\", - \\"type\\": \\"ResponsiveStyle | undefined\\", - \\"description\\": \\"Specifies a grid item's size and location within the grid row by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-start and inline-end edge of its grid area. See: [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row)\\", - \\"category\\": \\"GridItemStyleProps\\", - \\"isOptional\\": true - }, \\"rowEnd\\": { \\"name\\": \\"rowEnd\\", \\"type\\": \\"ResponsiveStyle | undefined\\", diff --git a/packages/react-native/src/theme/__tests__/__snapshots__/useTheme.spec.tsx.snap b/packages/react-native/src/theme/__tests__/__snapshots__/useTheme.spec.tsx.snap index 41e3648610f..9f39247d625 100644 --- a/packages/react-native/src/theme/__tests__/__snapshots__/useTheme.spec.tsx.snap +++ b/packages/react-native/src/theme/__tests__/__snapshots__/useTheme.spec.tsx.snap @@ -105,6 +105,7 @@ Object { "20": "hsla(0, 0%, 0%, 0.2)", "30": "hsla(0, 0%, 0%, 0.3)", "40": "hsla(0, 0%, 0%, 0.4)", + "5": "hsla(0, 0%, 0%, 0.05)", "50": "hsla(0, 0%, 0%, 0.5)", "60": "hsla(0, 0%, 0%, 0.6)", "70": "hsla(0, 0%, 0%, 0.7)", diff --git a/packages/react/__tests__/__snapshots__/exports.ts.snap b/packages/react/__tests__/__snapshots__/exports.ts.snap index 5365b18f153..6fb37e4e013 100644 --- a/packages/react/__tests__/__snapshots__/exports.ts.snap +++ b/packages/react/__tests__/__snapshots__/exports.ts.snap @@ -1335,6 +1335,9 @@ Object { "color": Object { "type": "string", }, + "colorTheme": Object { + "type": "string", + }, "column": Object { "type": "string", }, diff --git a/packages/react/src/primitives/Button/Button.tsx b/packages/react/src/primitives/Button/Button.tsx index 4ec176d5d21..58e29afc57c 100644 --- a/packages/react/src/primitives/Button/Button.tsx +++ b/packages/react/src/primitives/Button/Button.tsx @@ -13,10 +13,15 @@ import { Flex } from '../Flex'; import { Loader } from '../Loader'; import { View } from '../View'; +// These variations support colorThemes. 'undefined' accounts for our +// 'default' variation which is not named. +const supportedVariations = ['link', 'primary', undefined]; + const ButtonPrimitive: Primitive = ( { className, children, + colorTheme, isFullWidth = false, isDisabled, isLoading, @@ -28,10 +33,18 @@ const ButtonPrimitive: Primitive = ( }, ref ) => { + // Creates our colorTheme modifier string based on if the variation + // supports colorThemes and a colorTheme is used. + const colorThemeModifier = + supportedVariations.includes(variation) && colorTheme + ? `${variation ?? 'outlined'}--${colorTheme}` + : undefined; + const componentClasses = classNames( ComponentClassNames.Button, ComponentClassNames.FieldGroupControl, classNameModifier(ComponentClassNames.Button, variation), + classNameModifier(ComponentClassNames.Button, colorThemeModifier), classNameModifier(ComponentClassNames.Button, size), classNameModifierByFlag( ComponentClassNames.Button, diff --git a/packages/react/src/primitives/Button/__tests__/Button.test.tsx b/packages/react/src/primitives/Button/__tests__/Button.test.tsx index ba2bb637d4e..f75d30284f6 100644 --- a/packages/react/src/primitives/Button/__tests__/Button.test.tsx +++ b/packages/react/src/primitives/Button/__tests__/Button.test.tsx @@ -3,8 +3,17 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { Button } from '../Button'; +import { ButtonColorTheme } from '../../types'; import { ComponentClassNames } from '../../shared'; +const SUPPORTED_COLOR_THEMES: ButtonColorTheme[] = [ + 'info', + 'success', + 'warning', + 'error', + 'overlay', +]; + describe('Button test suite', () => { it('should render button variations', async () => { render( @@ -46,6 +55,81 @@ describe('Button test suite', () => { expect(menu.classList).toContain(`${ComponentClassNames['Button']}--menu`); }); + it.each(SUPPORTED_COLOR_THEMES)( + 'should render the %s color theme for the default variation', + async (colorTheme) => { + const testId = `default-${colorTheme}-ColorTheme`; + render( + + + + ); + const warningWarning = await screen.findByTestId('warningWarning'); + const destructiveWarning = await screen.findByTestId('destructiveWarning'); + const menuWarning = await screen.findByTestId('menuWarning'); + + expect(warningWarning.classList).not.toContain( + 'amplify-button--warning--warning' + ); + expect(destructiveWarning.classList).not.toContain( + 'amplify-button--destructive--warning' + ); + expect(menuWarning.classList).not.toContain( + 'amplify-button--menu--warning' + ); + }); + it('should add the disabled class with the disabled attribute', async () => { render(