diff --git a/packages/components/src/toggle-group-control/stories/index.tsx b/packages/components/src/toggle-group-control/stories/index.tsx index b949531025ca1c..7a39597f192581 100644 --- a/packages/components/src/toggle-group-control/stories/index.tsx +++ b/packages/components/src/toggle-group-control/stories/index.tsx @@ -124,11 +124,11 @@ WithIcons.args = { }; /** - * A borderless style may be preferred in some contexts. + * When the `isDeselectable` prop is true, the option can be deselected by clicking on it again. */ -export const Borderless: ComponentStory< typeof ToggleGroupControl > = +export const Deselectable: ComponentStory< typeof ToggleGroupControl > = Template.bind( {} ); -Borderless.args = { +Deselectable.args = { ...WithIcons.args, - __experimentalIsBorderless: true, + isDeselectable: true, }; diff --git a/packages/components/src/toggle-group-control/test/__snapshots__/index.tsx.snap b/packages/components/src/toggle-group-control/test/__snapshots__/index.tsx.snap index 51b1f8b9100cf9..0a709494f49758 100644 --- a/packages/components/src/toggle-group-control/test/__snapshots__/index.tsx.snap +++ b/packages/components/src/toggle-group-control/test/__snapshots__/index.tsx.snap @@ -41,7 +41,6 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = ` .emotion-8 { background: #fff; border: 1px solid transparent; - border-radius: 2px; display: -webkit-inline-box; display: -webkit-inline-flex; display: -ms-inline-flexbox; @@ -53,6 +52,7 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = ` transition: transform 100ms linear; min-height: 36px; border-color: #757575; + border-radius: 2px; } @media ( prefers-reduced-motion: reduce ) { @@ -61,6 +61,10 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = ` } } +.emotion-8:hover { + border-color: #757575; +} + .emotion-8:focus-within { border-color: var( --wp-admin-theme-color-darker-10, #006ba1); box-shadow: 0 0 0 0.5px var( --wp-admin-theme-color, #007cba); @@ -68,14 +72,9 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = ` z-index: 1; } -.emotion-8:hover { - border-color: #757575; -} - .emotion-10 { background: #1e1e1e; border-radius: 2px; - box-shadow: transparent; left: 0; position: absolute; top: 2px; @@ -142,6 +141,12 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = ` user-select: none; width: 100%; z-index: 2; + color: #1e1e1e; + width: 30px; + height: 30px; + padding-left: 0; + padding-right: 0; + color: #fff; } @media ( prefers-reduced-motion: reduce ) { @@ -158,24 +163,72 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = ` background: #fff; } +.emotion-14:active { + background: transparent; +} + .emotion-15 { + font-size: 13px; + line-height: 1; +} + +.emotion-19 { + -webkit-align-items: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + appearance: none; + background: transparent; + border: none; + border-radius: 2px; + color: #757575; + fill: currentColor; + cursor: pointer; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + font-family: inherit; + height: 100%; + -webkit-box-pack: center; + -ms-flex-pack: center; + -webkit-justify-content: center; + justify-content: center; + line-height: 100%; + outline: none; + padding: 0 12px; + position: relative; + text-align: center; + -webkit-transition: background 160ms linear,color 160ms linear,font-weight 60ms linear; + transition: background 160ms linear,color 160ms linear,font-weight 60ms linear; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + width: 100%; + z-index: 2; color: #1e1e1e; width: 30px; + height: 30px; padding-left: 0; padding-right: 0; } -.emotion-16 { - color: #fff; +@media ( prefers-reduced-motion: reduce ) { + .emotion-19 { + transition-duration: 0ms; + } } -.emotion-16:active { - background: transparent; +.emotion-19::-moz-focus-inner { + border: 0; } -.emotion-17 { - font-size: 13px; - line-height: 1; +.emotion-19:active { + background: #fff; }