Skip to content

Commit 65a4e60

Browse files
committed
Adds the LabelMixin to add the prop.
Flows the label prop down into the UUI-button for the aria-label for the uui-button used inside uui-copy
1 parent 3c1fc10 commit 65a4e60

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

packages/uui-copy/lib/uui-copy.element.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { property } from 'lit/decorators.js';
44
import { UUIButtonElement } from '@umbraco-ui/uui-button/lib';
55
import { UUICopyEvent } from './UUICopyEvent';
66
import { demandCustomElement } from '@umbraco-ui/uui-base/lib/utils';
7+
import { LabelMixin } from '@umbraco-ui/uui-base';
78

89
/**
910
* @summary A button to trigger text content to be copied to the clipboard
@@ -15,7 +16,7 @@ import { demandCustomElement } from '@umbraco-ui/uui-base/lib/utils';
1516
* @slot - Use to replace the default content of 'Copy' and the copy icon
1617
*/
1718
@defineElement('uui-copy')
18-
export class UUICopyElement extends LitElement {
19+
export class UUICopyElement extends LabelMixin('', LitElement) {
1920
/**
2021
* Set a string you wish to copy to the clipboard
2122
* @type {string}
@@ -30,7 +31,7 @@ export class UUICopyElement extends LitElement {
3031
* @attr
3132
* @default false
3233
*/
33-
@property({ type: Boolean, reflect: true })
34+
@property({ type: Boolean })
3435
disabled = false;
3536

3637
/**
@@ -144,6 +145,7 @@ export class UUICopyElement extends LitElement {
144145
.look=${this.look}
145146
.disabled=${this.disabled}
146147
.compact=${this.compact}
148+
.label=${this.label}
147149
@click=${this.#onClick}>
148150
<slot> <uui-icon name="copy"></uui-icon> Copy </slot>
149151
</uui-button>`;

packages/uui-copy/lib/uui-copy.story.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ export const Overview: Story = {
3535
},
3636
};
3737

38+
export const WithLabelSet: Story = {
39+
name: 'Simple Copy with an A11y Label set',
40+
args: {
41+
value: 'Hey stop copying me 🥸',
42+
disabled: false,
43+
label: 'This is my A11y label I want',
44+
},
45+
parameters: {
46+
docs: {
47+
source: {
48+
code: `<uui-copy value="Hey stop copying me 🥸" label="This is my A11y label I want"></uui-copy>`,
49+
},
50+
},
51+
},
52+
};
53+
3854
export const Disabled: Story = {
3955
name: 'Disabled State',
4056
args: {

0 commit comments

Comments
 (0)