From 8b551e8a83e9cd1d00e5ff83e22d28e4078715c7 Mon Sep 17 00:00:00 2001 From: Christie Molloy Date: Fri, 3 Apr 2020 13:54:37 -0400 Subject: [PATCH 1/5] fix(clipboardcopy): replace copy button with button component --- .../clipboard-copy-group-copy.hbs | 9 --- .../ClipboardCopy/clipboard-copy.scss | 57 ------------------- .../ClipboardCopy/examples/ClipboardCopy.md | 43 +++++++------- 3 files changed, 24 insertions(+), 85 deletions(-) delete mode 100644 src/patternfly/components/ClipboardCopy/clipboard-copy-group-copy.hbs diff --git a/src/patternfly/components/ClipboardCopy/clipboard-copy-group-copy.hbs b/src/patternfly/components/ClipboardCopy/clipboard-copy-group-copy.hbs deleted file mode 100644 index 1c0e1f1c8a..0000000000 --- a/src/patternfly/components/ClipboardCopy/clipboard-copy-group-copy.hbs +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/src/patternfly/components/ClipboardCopy/clipboard-copy.scss b/src/patternfly/components/ClipboardCopy/clipboard-copy.scss index 93aee2a8f7..fed46a3f31 100644 --- a/src/patternfly/components/ClipboardCopy/clipboard-copy.scss +++ b/src/patternfly/components/ClipboardCopy/clipboard-copy.scss @@ -20,20 +20,6 @@ --pf-c-clipboard-copy__group-toggle-icon--Transition: .2s ease-in 0s; --pf-c-clipboard-copy--m-expanded__group-toggle-icon--Transform: rotate(90deg); - // Clipboard copy copy - --pf-c-clipboard-copy__group-copy--PaddingRight: var(--pf-global--spacer--md); - --pf-c-clipboard-copy__group-copy--PaddingLeft: var(--pf-global--spacer--md); - --pf-c-clipboard-copy__group-copy--BorderWidth: var(--pf-global--BorderWidth--sm); - --pf-c-clipboard-copy__group-copy--BorderTopColor: var(--pf-global--BorderColor--300); - --pf-c-clipboard-copy__group-copy--BorderRightColor: var(--pf-global--BorderColor--300); - --pf-c-clipboard-copy__group-copy--BorderBottomColor: var(--pf-global--BorderColor--200); - --pf-c-clipboard-copy__group-copy--BorderLeftColor: var(--pf-global--BorderColor--300); - --pf-c-clipboard-copy__group-copy--hover--BorderBottomColor: var(--pf-global--active-color--100); - --pf-c-clipboard-copy__group-copy--active--BorderBottomWidth: var(--pf-global--BorderWidth--md); - --pf-c-clipboard-copy__group-copy--active--BorderBottomColor: var(--pf-global--active-color--100); - --pf-c-clipboard-copy__group-copy--focus--BorderBottomWidth: var(--pf-global--BorderWidth--md); - --pf-c-clipboard-copy__group-copy--focus--BorderBottomColor: var(--pf-global--active-color--100); - // Clipboard copy expanded content --pf-c-clipboard-copy__expandable-content--PaddingTop: var(--pf-global--spacer--md); --pf-c-clipboard-copy__expandable-content--PaddingRight: var(--pf-global--spacer--md); @@ -119,49 +105,6 @@ } } -.pf-c-clipboard-copy__group-copy { - position: relative; - padding-right: var(--pf-c-clipboard-copy__group-copy--PaddingRight); - padding-left: var(--pf-c-clipboard-copy__group-copy--PaddingLeft); - border: none; - - &::before { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - content: ""; - border: var(--pf-c-clipboard-copy__group-copy--BorderWidth) solid; - border-color: var(--pf-c-clipboard-copy__group-copy--BorderTopColor) var(--pf-c-clipboard-copy__group-copy--BorderRightColor) var(--pf-c-clipboard-copy__group-copy--BorderBottomColor) var(--pf-c-clipboard-copy__group-copy--BorderLeftColor); - } - - &:hover, - &.pf-m-hover { - &::before { - --pf-c-clipboard-copy__group-copy--BorderBottomColor: var(--pf-c-clipboard-copy__group-copy--hover--BorderBottomColor); - } - } - - &:active, - &.pf-m-active { - &::before { - --pf-c-clipboard-copy__group-copy--BorderBottomColor: var(--pf-c-clipboard-copy__group-copy--active--BorderBottomColor); - - border-bottom-width: var(--pf-c-clipboard-copy__group-copy--active--BorderBottomWidth); - } - } - - &:focus, - &.pf-m-focus { - &::before { - --pf-c-clipboard-copy__group-copy--BorderBottomColor: var(--pf-c-clipboard-copy__group-copy--focus--BorderBottomColor); - - border-bottom-width: var(--pf-c-clipboard-copy__group-copy--focus--BorderBottomWidth); - } - } -} - .pf-c-clipboard-copy__expandable-content { padding: var(--pf-c-clipboard-copy__expandable-content--PaddingTop) var(--pf-c-clipboard-copy__expandable-content--PaddingRight) var(--pf-c-clipboard-copy__expandable-content--PaddingBottom) var(--pf-c-clipboard-copy__expandable-content--PaddingLeft); word-wrap: break-word; diff --git a/src/patternfly/components/ClipboardCopy/examples/ClipboardCopy.md b/src/patternfly/components/ClipboardCopy/examples/ClipboardCopy.md index 14f0b6696b..a0ce6fb2c3 100644 --- a/src/patternfly/components/ClipboardCopy/examples/ClipboardCopy.md +++ b/src/patternfly/components/ClipboardCopy/examples/ClipboardCopy.md @@ -10,8 +10,9 @@ cssPrefix: pf-c-clipboard-copy {{#> clipboard-copy-group}} {{#> form-control controlType="input" input="true" form-control--attribute=(concat 'type="text" value="This is editable" id="text-input-' clipboard-copy--id '" aria-label="Copyable input"')}} {{/form-control}} - {{#> clipboard-copy-group-copy clipboard-copy-group-copy--attribute=(concat 'id="copy-button-' clipboard-copy--id '" aria-labelledby="copy-button-' clipboard-copy--id ' text-input-' clipboard-copy--id '"')}} - {{/clipboard-copy-group-copy}} + {{#> button button--modifier="pf-m-control" button--attribute=(concat 'aria-label="Copy to clipboard" id="copy-button-' clipboard-copy--id '" aria-labelledby="copy-button-' clipboard-copy--id ' text-input-' clipboard-copy--id '"')}} + + {{/button}} {{/clipboard-copy-group}} {{/clipboard-copy}}
@@ -19,8 +20,9 @@ cssPrefix: pf-c-clipboard-copy {{#> clipboard-copy-group}} {{#> form-control controlType="input" input="true" form-control--attribute=(concat 'readonly type="text" value="This is read-only" id="text-input-' clipboard-copy--id '" aria-label="Copyable input"')}} {{/form-control}} - {{#> clipboard-copy-group-copy clipboard-copy-group-copy--attribute=(concat 'id="copy-button-' clipboard-copy--id '" aria-labelledby="copy-button-' clipboard-copy--id ' text-input-' clipboard-copy--id '"')}} - {{/clipboard-copy-group-copy}} + {{#> button button--modifier="pf-m-control" button--attribute=(concat 'aria-label="Copy to clipboard" id="copy-button-' clipboard-copy--id '" aria-labelledby="copy-button-' clipboard-copy--id ' text-input-' clipboard-copy--id '"')}} + + {{/button}} {{/clipboard-copy-group}} {{/clipboard-copy}} ``` @@ -33,8 +35,9 @@ cssPrefix: pf-c-clipboard-copy {{/clipboard-copy-group-toggle}} {{#> form-control controlType="input" input="true" form-control--attribute=(concat 'type="text" value="This is an editable version of the Copy to Clipboard Component that has an expandable section. Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting expansion." id="text-input-' clipboard-copy--id '" aria-label="Copyable input"')}} {{/form-control}} - {{#> clipboard-copy-group-copy clipboard-copy-group-copy--attribute=(concat 'id="copy-button-' clipboard-copy--id '" aria-labelledby="copy-button-' clipboard-copy--id ' text-input-' clipboard-copy--id '"')}} - {{/clipboard-copy-group-copy}} + {{#> button button--modifier="pf-m-control" button--attribute=(concat 'aria-label="Copy to clipboard" id="copy-button-' clipboard-copy--id '" aria-labelledby="copy-button-' clipboard-copy--id ' text-input-' clipboard-copy--id '"')}} + + {{/button}} {{/clipboard-copy-group}} {{#> clipboard-copy-expandable-content clipboard-copy-expandable-content--attribute=(concat 'id="content-' clipboard-copy--id '"')}} This is an editable version of the Copy to Clipboard Component that has an expandable section. Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting expansion. @@ -47,8 +50,9 @@ cssPrefix: pf-c-clipboard-copy {{/clipboard-copy-group-toggle}} {{#> form-control controlType="input" input="true" form-control--attribute=(concat 'readonly type="text" value="This is an editable version of the Copy to Clipboard Component that has an expandable section. Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting expansion." id="text-input-' clipboard-copy--id '" aria-label="Copyable input"')}} {{/form-control}} - {{#> clipboard-copy-group-copy clipboard-copy-group-copy--attribute=(concat 'id="copy-button-' clipboard-copy--id '" aria-labelledby="copy-button-' clipboard-copy--id ' text-input-' clipboard-copy--id '"')}} - {{/clipboard-copy-group-copy}} + {{#> button button--modifier="pf-m-control" button--attribute=(concat 'aria-label="Copy to clipboard" id="copy-button-' clipboard-copy--id '" aria-labelledby="copy-button-' clipboard-copy--id ' text-input-' clipboard-copy--id '"')}} + + {{/button}} {{/clipboard-copy-group}} {{#> clipboard-copy-expandable-content clipboard-copy-expandable-content--attribute=(concat 'contenteditable="true" id="content-' clipboard-copy--id '"')}} This is an editable version of the Copy to Clipboard Component that has an expandable section. Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting expansion. @@ -62,8 +66,9 @@ cssPrefix: pf-c-clipboard-copy {{/clipboard-copy-group-toggle}} {{#> form-control controlType="input" input="true" form-control--attribute=(concat 'readonly type="text" value="This is an editable version of the Copy to Clipboard Component that has an expandable section. Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting expansion." id="text-input-' clipboard-copy--id '" aria-label="Copyable input"')}} {{/form-control}} - {{#> clipboard-copy-group-copy clipboard-copy-group-copy--attribute=(concat 'id="copy-button-' clipboard-copy--id '" aria-labelledby="copy-button-' clipboard-copy--id ' text-input-' clipboard-copy--id '"')}} - {{/clipboard-copy-group-copy}} + {{#> button button--modifier="pf-m-control" button--attribute=(concat 'aria-label="Copy to clipboard" id="copy-button-' clipboard-copy--id '" aria-labelledby="copy-button-' clipboard-copy--id ' text-input-' clipboard-copy--id '"')}} + + {{/button}} {{/clipboard-copy-group}} {{#> clipboard-copy-expandable-content clipboard-copy-expandable-content--attribute=(concat 'id="content-' clipboard-copy--id '"')}} This is an editable version of the Copy to Clipboard Component that has an expandable section. Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting expansion. @@ -76,8 +81,9 @@ cssPrefix: pf-c-clipboard-copy {{/clipboard-copy-group-toggle}} {{#> form-control controlType="input" input="true" form-control--attribute=(concat 'readonly type="text" value="This is an editable version of the Copy to Clipboard Component that has an expandable section. Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting expansion." id="text-input-' clipboard-copy--id '" aria-label="Copyable input"')}} {{/form-control}} - {{#> clipboard-copy-group-copy clipboard-copy-group-copy--attribute=(concat 'id="copy-button-' clipboard-copy--id '" aria-labelledby="copy-button-' clipboard-copy--id ' text-input-' clipboard-copy--id '"')}} - {{/clipboard-copy-group-copy}} + {{#> button button--modifier="pf-m-control" button--attribute=(concat 'aria-label="Copy to clipboard" id="copy-button-' clipboard-copy--id '" aria-labelledby="copy-button-' clipboard-copy--id ' text-input-' clipboard-copy--id '"')}} + + {{/button}} {{/clipboard-copy-group}} {{#> clipboard-copy-expandable-content clipboard-copy-expandable-content--attribute=(concat 'id="content-' clipboard-copy--id '"')}} This is an editable version of the Copy to Clipboard Component that has an expandable section. Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting expansion. @@ -90,15 +96,15 @@ cssPrefix: pf-c-clipboard-copy | Attribute | Applied to | Outcome | | -- | -- | -- | | `aria-label="Show content"` | `.pf-c-clipboard-copy__group-toggle` | Provides an accessible name for the button when an icon is used instead of text. **Required when an icon is used with no supporting text.** | -| `aria-label="Copy to clipboard"` | `.pf-c-clipboard-copy__group-copy` | Provides an accessible name for the button when an icon is used instead of text. **Required when an icon is used with no supporting text.** | +| `aria-label="Copy to clipboard"` | `.pf-c-button.pf-m-control` | Provides an accessible name for the button when an icon is used instead of text. **Required when an icon is used with no supporting text.** | | `aria-label="[input label text]"` | `.pf-c-form-control` | Provides an accessible label for the input. Provide a label that describes the contents in the input. **Required** | | `aria-hidden="true"` | `` | Hides the icon from assistive technologies. | `aria-controls="[id of expandable element]"` | `.pf-c-clipboard-copy__group-toggle` | Identifies the element controlled by the toggle button. **Required** | | `aria-expanded="true"` | `.pf-c-clipboard-copy__group-toggle` | Indicates that the expandable content is visible. | | `aria-expanded="false"` | `.pf-c-clipboard-copy__group-toggle` | Indicates that the expandable content is hidden. | | `hidden` | `.pf-c-clipboard-copy__expandable-content` | Indicates that the expandable content is hidden so that it isn't visible in the UI and isn't accessed by assistive technologies. | -| `aria-labelledby="[id of button] [id of input label]"` | `.pf-c-clipboard-copy__group-copy`, `.pf-c-clipboard-copy__group-toggle` | Provides an accessible name that is unique and communicates context of the button. Required when more than one ClipboardCopy component exists on the page. **Important:** If the label is defined on the `` using `aria-label`, then use the `id` of the ``. If the label is defined in a `