diff --git a/src/components/ButtonGroup/ButtonGroup.stories.tsx b/src/components/ButtonGroup/ButtonGroup.stories.tsx index 03ada3665..bf018e311 100644 --- a/src/components/ButtonGroup/ButtonGroup.stories.tsx +++ b/src/components/ButtonGroup/ButtonGroup.stories.tsx @@ -211,7 +211,15 @@ AudioVideoControls.parameters = { }, { children: [ - + +
Start Video
, @@ -261,7 +277,7 @@ AudioVideoControls.parameters = { { children: [ - +
Long Label Possibly German
, @@ -275,7 +291,7 @@ AudioVideoControls.parameters = { children: [
- +
Long Label Possibly German
, diff --git a/src/components/ButtonPill/ButtonPill.constants.ts b/src/components/ButtonPill/ButtonPill.constants.ts index 3eeb3652c..39e58d52d 100644 --- a/src/components/ButtonPill/ButtonPill.constants.ts +++ b/src/components/ButtonPill/ButtonPill.constants.ts @@ -3,6 +3,7 @@ const CLASS_PREFIX = 'md-button-pill'; const DEFAULTS = { COLOR: 'primary', DISABLED: false, + DISABLED_OUTLINE: false, SHALLOW_DISABLED: false, GHOST: false, GROWN: false, diff --git a/src/components/ButtonPill/ButtonPill.stories.args.ts b/src/components/ButtonPill/ButtonPill.stories.args.ts index 56952e4f7..d7a7b2637 100644 --- a/src/components/ButtonPill/ButtonPill.stories.args.ts +++ b/src/components/ButtonPill/ButtonPill.stories.args.ts @@ -62,6 +62,20 @@ export default { }, }, }, + disabledOutline: { + description: + 'Whether to render the `` with an outline even when disabled/shallowDisabled. Respects existing outline prop and will not display outline if outline is false.', + options: [true, false], + control: { type: 'boolean' }, + table: { + type: { + summary: 'boolean', + }, + defaultValue: { + summary: CONSTANTS.DEFAULTS.SHALLOW_DISABLED, + }, + }, + }, ghost: { description: 'Whether this component has a transparent background.', options: [true, false], diff --git a/src/components/ButtonPill/ButtonPill.style.scss b/src/components/ButtonPill/ButtonPill.style.scss index b2053a214..26043bc3d 100644 --- a/src/components/ButtonPill/ButtonPill.style.scss +++ b/src/components/ButtonPill/ButtonPill.style.scss @@ -225,6 +225,10 @@ cursor: auto; } + &[data-disabled-outline='true'] { + border-color: var(--mds-color-theme-outline-button-normal); + } + // C.1 color = join &[data-color='join'] { border-color: var(--mds-color-theme-outline-join-normal); @@ -397,6 +401,10 @@ cursor: auto; } + &[data-disabled-outline='true'] { + border-color: var(--mds-color-theme-outline-button-normal); + } + // E.2 color = join &[data-color='join'] { background-color: var(--mds-color-theme-button-secondary-normal); @@ -518,6 +526,10 @@ cursor: auto; } + &[data-disabled-outline='true'] { + border-color: var(--mds-color-theme-outline-button-normal); + } + // F.2 color = join &[data-color='join'] { background-color: var(--mds-color-theme-inverted-button-primary-normal); diff --git a/src/components/ButtonPill/ButtonPill.tsx b/src/components/ButtonPill/ButtonPill.tsx index 653492977..17679ac70 100644 --- a/src/components/ButtonPill/ButtonPill.tsx +++ b/src/components/ButtonPill/ButtonPill.tsx @@ -11,6 +11,7 @@ const ButtonPill = forwardRef((props: Props, providedRef: RefObject diff --git a/src/components/ButtonPill/ButtonPill.types.ts b/src/components/ButtonPill/ButtonPill.types.ts index 3c5f74534..24b38e1c8 100644 --- a/src/components/ButtonPill/ButtonPill.types.ts +++ b/src/components/ButtonPill/ButtonPill.types.ts @@ -17,6 +17,11 @@ export interface Props extends ButtonSimpleProps { */ disabled?: boolean; + /** + * Whether or not this ButtonPill has an outline even when disabled. Respects existing outline prop and will not display outline if outline is false. + */ + disabledOutline?: boolean; + /** * Whether or not this ButtonPill should look disabled, but allowing actions like onPress to be passed. */ diff --git a/src/components/ButtonPill/ButtonPill.unit.test.tsx b/src/components/ButtonPill/ButtonPill.unit.test.tsx index 5d7453e8d..85d464a7c 100644 --- a/src/components/ButtonPill/ButtonPill.unit.test.tsx +++ b/src/components/ButtonPill/ButtonPill.unit.test.tsx @@ -88,6 +88,32 @@ describe('', () => { expect(container).toMatchSnapshot(); }); + it('should match snapshot when disabledOutline', () => { + expect.assertions(1); + + const disabledOutline = !DEFAULTS.DISABLED_OUTLINE; + + container = mount(Example Text); + + expect(container).toMatchSnapshot(); + }); + + it('should match snapshot when disabledOutline and disabled and outline', () => { + expect.assertions(1); + + const disabledOutline = !DEFAULTS.DISABLED_OUTLINE; + const outline = !DEFAULTS.OUTLINE; + const disabled = !DEFAULTS.DISABLED; + + container = mount( + + Example Text + + ); + + expect(container).toMatchSnapshot(); + }); + it('should match snapshot when a ghost', () => { expect.assertions(1); @@ -232,6 +258,18 @@ describe('', () => { expect(element.getAttribute('aria-disabled')).toBe('true'); }); + it('should pass disabled outline prop', () => { + expect.assertions(1); + + const disabledOutline = !DEFAULTS.DISABLED_OUTLINE; + + const element = mount() + .find(ButtonPill) + .getDOMNode(); + + expect(element.getAttribute('data-disabled-outline')).toBe(`${disabledOutline}`); + }); + it('should pass ghost prop', () => { expect.assertions(1); diff --git a/src/components/ButtonPill/ButtonPill.unit.test.tsx.snap b/src/components/ButtonPill/ButtonPill.unit.test.tsx.snap index 51cf63004..3f4ee34e6 100644 --- a/src/components/ButtonPill/ButtonPill.unit.test.tsx.snap +++ b/src/components/ButtonPill/ButtonPill.unit.test.tsx.snap @@ -7,6 +7,7 @@ exports[` snapshot should match snapshot 1`] = ` className="md-button-pill-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -23,6 +24,7 @@ exports[` snapshot should match snapshot 1`] = ` className="md-button-pill-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -64,6 +66,7 @@ exports[` snapshot should match snapshot when a ghost 1`] = ` className="md-button-pill-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -80,6 +83,7 @@ exports[` snapshot should match snapshot when a ghost 1`] = ` className="md-button-pill-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -122,6 +126,7 @@ exports[` snapshot should match snapshot when a ghost and disabled className="md-button-pill-wrapper" data-color="primary" data-disabled={true} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -142,6 +147,7 @@ exports[` snapshot should match snapshot when a ghost and disabled className="md-button-pill-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={true} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -184,6 +190,7 @@ exports[` snapshot should match snapshot when color is outlined 1` className="md-button-pill-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -200,6 +207,7 @@ exports[` snapshot should match snapshot when color is outlined 1` className="md-button-pill-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -242,6 +250,7 @@ exports[` snapshot should match snapshot when color is outlined an className="md-button-pill-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={true} @@ -258,6 +267,7 @@ exports[` snapshot should match snapshot when color is outlined an className="md-button-pill-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={true} @@ -299,6 +309,7 @@ exports[` snapshot should match snapshot when disabled 1`] = ` className="md-button-pill-wrapper" data-color="primary" data-disabled={true} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -319,6 +330,7 @@ exports[` snapshot should match snapshot when disabled 1`] = ` className="md-button-pill-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={true} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -352,6 +364,131 @@ exports[` snapshot should match snapshot when disabled 1`] = ` `; +exports[` snapshot should match snapshot when disabledOutline 1`] = ` + + + + + + + + + +`; + +exports[` snapshot should match snapshot when disabledOutline and disabled and outline 1`] = ` + + + + + + + + + +`; + exports[` snapshot should match snapshot when shallow disabled 1`] = ` snapshot should match snapshot when shallow disabled 1`] className="md-button-pill-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -378,6 +516,7 @@ exports[` snapshot should match snapshot when shallow disabled 1`] className="md-button-pill-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -419,6 +558,7 @@ exports[` snapshot should match snapshot when width is grown 1`] = className="md-button-pill-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={true} data-inverted={false} @@ -435,6 +575,7 @@ exports[` snapshot should match snapshot when width is grown 1`] = className="md-button-pill-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={true} data-inverted={false} @@ -476,6 +617,7 @@ exports[` snapshot should match snapshot with className 1`] = ` className="md-button-pill-wrapper example-class" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -492,6 +634,7 @@ exports[` snapshot should match snapshot with className 1`] = ` className="md-button-pill-wrapper example-class md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -529,6 +672,7 @@ exports[` snapshot should match snapshot with color 1`] = ` className="md-button-pill-wrapper" data-color="message" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -545,6 +689,7 @@ exports[` snapshot should match snapshot with color 1`] = ` className="md-button-pill-wrapper md-button-simple-wrapper" data-color="message" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -586,6 +731,7 @@ exports[` snapshot should match snapshot with id 1`] = ` className="md-button-pill-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -603,6 +749,7 @@ exports[` snapshot should match snapshot with id 1`] = ` className="md-button-pill-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -641,6 +788,7 @@ exports[` snapshot should match snapshot with size 1`] = ` className="md-button-pill-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -657,6 +805,7 @@ exports[` snapshot should match snapshot with size 1`] = ` className="md-button-pill-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -702,6 +851,7 @@ exports[` snapshot should match snapshot with style 1`] = ` className="md-button-pill-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -723,6 +873,7 @@ exports[` snapshot should match snapshot with style 1`] = ` className="md-button-pill-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -765,6 +916,7 @@ exports[` snapshot should match snapshot with title 1`] = ` className="md-button-pill-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -782,6 +934,7 @@ exports[` snapshot should match snapshot with title 1`] = ` className="md-button-pill-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} diff --git a/src/components/ButtonPillToggle/ButtonPillToggle.unit.test.tsx.snap b/src/components/ButtonPillToggle/ButtonPillToggle.unit.test.tsx.snap index 487152c77..f02f19e48 100644 --- a/src/components/ButtonPillToggle/ButtonPillToggle.unit.test.tsx.snap +++ b/src/components/ButtonPillToggle/ButtonPillToggle.unit.test.tsx.snap @@ -17,6 +17,7 @@ exports[` snapshot should match snapshot 1`] = ` className="md-button-pill-wrapper md-button-pill-toggle-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -40,6 +41,7 @@ exports[` snapshot should match snapshot 1`] = ` className="md-button-pill-wrapper md-button-pill-toggle-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -92,6 +94,7 @@ exports[` snapshot should match snapshot with ariaStateKey b className="md-button-pill-wrapper md-button-pill-toggle-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -116,6 +119,7 @@ exports[` snapshot should match snapshot with ariaStateKey b className="md-button-pill-wrapper md-button-pill-toggle-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -168,6 +172,7 @@ exports[` snapshot should match snapshot with ariaStateKey b className="md-button-pill-wrapper md-button-pill-toggle-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -192,6 +197,7 @@ exports[` snapshot should match snapshot with ariaStateKey b className="md-button-pill-wrapper md-button-pill-toggle-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -242,6 +248,7 @@ exports[` snapshot should match snapshot with ghost being fa className="md-button-pill-wrapper md-button-pill-toggle-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -265,6 +272,7 @@ exports[` snapshot should match snapshot with ghost being fa className="md-button-pill-wrapper md-button-pill-toggle-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={false} data-grown={false} data-inverted={false} @@ -315,6 +323,7 @@ exports[` snapshot should match snapshot with ghost being tr className="md-button-pill-wrapper md-button-pill-toggle-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -338,6 +347,7 @@ exports[` snapshot should match snapshot with ghost being tr className="md-button-pill-wrapper md-button-pill-toggle-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -389,6 +399,7 @@ exports[` snapshot should match snapshot with isSelected bei className="md-button-pill-wrapper md-button-pill-toggle-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -413,6 +424,7 @@ exports[` snapshot should match snapshot with isSelected bei className="md-button-pill-wrapper md-button-pill-toggle-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -464,6 +476,7 @@ exports[` snapshot should match snapshot with isSelected bei className="md-button-pill-wrapper md-button-pill-toggle-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -488,6 +501,7 @@ exports[` snapshot should match snapshot with isSelected bei className="md-button-pill-wrapper md-button-pill-toggle-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -539,6 +553,7 @@ exports[` snapshot should match snapshot with outline being className="md-button-pill-wrapper md-button-pill-toggle-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -562,6 +577,7 @@ exports[` snapshot should match snapshot with outline being className="md-button-pill-wrapper md-button-pill-toggle-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -613,6 +629,7 @@ exports[` snapshot should match snapshot with outline being className="md-button-pill-wrapper md-button-pill-toggle-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false} @@ -636,6 +653,7 @@ exports[` snapshot should match snapshot with outline being className="md-button-pill-wrapper md-button-pill-toggle-wrapper md-button-simple-wrapper" data-color="primary" data-disabled={false} + data-disabled-outline={false} data-ghost={true} data-grown={false} data-inverted={false}