diff --git a/.changeset/famous-stingrays-change.md b/.changeset/famous-stingrays-change.md new file mode 100644 index 00000000000..6323d5ea810 --- /dev/null +++ b/.changeset/famous-stingrays-change.md @@ -0,0 +1,5 @@ +--- +'@shopify/polaris': minor +--- + +Deprecate connectedDisclosure prop on button diff --git a/polaris-react/src/components/Button/Button.scss b/polaris-react/src/components/Button/Button.scss index 8c020c7ed3c..ca2adbe6ceb 100644 --- a/polaris-react/src/components/Button/Button.scss +++ b/polaris-react/src/components/Button/Button.scss @@ -1441,6 +1441,7 @@ } > :first-child .Button, + > :first-child .Button::before, > :first-child .Button::after { border-radius: 0; border-top-left-radius: var(--p-border-radius-1); @@ -1453,6 +1454,7 @@ } > :last-child .Button, + > :last-child .Button::before, > :last-child .Button::after { border-radius: 0; border-top-right-radius: var(--p-border-radius-1); @@ -1476,11 +1478,13 @@ [data-buttongroup-connected-top='true'] { > :first-child .Button, + > :first-child .Button::before, > :first-child .Button::after { border-top-left-radius: 0; } > :last-child .Button, + > :last-child .Button::before, > :last-child .Button::after { border-top-right-radius: 0; } diff --git a/polaris-react/src/components/Button/Button.stories.tsx b/polaris-react/src/components/Button/Button.stories.tsx index 476f1837dd7..410383ec470 100644 --- a/polaris-react/src/components/Button/Button.stories.tsx +++ b/polaris-react/src/components/Button/Button.stories.tsx @@ -8,12 +8,16 @@ import { VerticalStack, Text, Box, + Popover, + ActionList, + Divider, } from '@shopify/polaris'; import { PlusMinor, DeleteMinor, CancelSmallMinor, EditMajor, + ChevronDownMinor, } from '@shopify/polaris-icons'; export default { @@ -717,17 +721,57 @@ export function SelectDisclosure() { } export function Split() { + const [active, setActive] = React.useState(false); return (
- + + + +
+ + setActive(true)} + icon={ChevronDownMinor} + accessibilityLabel="Other save actions" + /> + } + autofocusTarget="first-node" + onClose={() => setActive(false)} + > + + + + + + + + setActive(true)} + icon={ChevronDownMinor} + accessibilityLabel="Other save actions" + /> + } + autofocusTarget="first-node" + onClose={() => setActive(false)} + > + + +
); } diff --git a/polaris-react/src/components/Button/Button.tsx b/polaris-react/src/components/Button/Button.tsx index 850ae4b1cf5..469bf4c6a2b 100644 --- a/polaris-react/src/components/Button/Button.tsx +++ b/polaris-react/src/components/Button/Button.tsx @@ -51,7 +51,7 @@ export interface ButtonProps extends BaseButton { removeUnderline?: boolean; /** Icon to display to the left of the button content */ icon?: React.ReactElement | IconSource; - /** Disclosure button connected right of the button. Toggles a popover action list. */ + /** @deprecated See the split example to replicate this prop */ connectedDisclosure?: ConnectedDisclosure; /** Indicates whether or not the button is the primary navigation link when rendered inside of an `IndexTable.Row` */ dataPrimaryLink?: boolean; diff --git a/polaris.shopify.com/pages/examples/button-split.tsx b/polaris.shopify.com/pages/examples/button-split.tsx index 6f2f800677f..b51427f0025 100644 --- a/polaris.shopify.com/pages/examples/button-split.tsx +++ b/polaris.shopify.com/pages/examples/button-split.tsx @@ -1,19 +1,57 @@ -import {Button} from '@shopify/polaris'; +import {ActionList, Button, ButtonGroup, Popover} from '@shopify/polaris'; import React from 'react'; import {withPolarisExample} from '../../src/components/PolarisExampleWrapper'; +import {ChevronDownMinor} from '@shopify/polaris-icons'; function ButtonExample() { + const [active, setActive] = React.useState(false); return (
- + + +
+ setActive(true)} + icon={ChevronDownMinor} + accessibilityLabel="Other save actions" + /> + } + autofocusTarget="first-node" + onClose={() => setActive(false)} + > + + + + + + + setActive(true)} + icon={ChevronDownMinor} + accessibilityLabel="Other save actions" + /> + } + autofocusTarget="first-node" + onClose={() => setActive(false)} + > + + +
); }