11import type { Meta , StoryObj } from '@storybook/web-components' ;
22import { html } from 'lit' ;
33
4- import './uui-text-copy.element' ;
5- import type { UUITextCopyElement } from './uui-text-copy.element' ;
4+ import './uui-text-copy.element.js' ;
5+ import { UUICopyTextEvent } from './UUICopyTextEvent' ;
6+ import type { UUIButtonCopyTextElement } from './uui-button-copy-text.element.js' ;
67import readme from '../README.md?raw' ;
78
89// For the story to show the example of using inside an uui-input
@@ -11,12 +12,10 @@ import '@umbraco-ui/uui-input/lib';
1112import '@umbraco-ui/uui-button/lib' ;
1213import '@umbraco-ui/uui-loader-circle/lib' ;
1314
14- import { UUITextCopyEvent } from './UUITextCopyEvent' ;
15-
16- const meta : Meta < UUITextCopyElement > = {
17- id : 'uui-text-copy' ,
18- title : 'Buttons/Text Copy' ,
19- component : 'uui-text-copy' ,
15+ const meta : Meta < UUIButtonCopyTextElement > = {
16+ id : 'uui-button-copy-text' ,
17+ title : 'Buttons/Copy text' ,
18+ component : 'uui-button-copy-text' ,
2019 parameters : {
2120 readme : { markdown : readme } ,
2221 } ,
@@ -38,7 +37,7 @@ const meta: Meta<UUITextCopyElement> = {
3837} ;
3938
4039export default meta ;
41- type Story = StoryObj < UUITextCopyElement > ;
40+ type Story = StoryObj < UUIButtonCopyTextElement > ;
4241
4342export const Overview : Story = {
4443 name : 'Simple Copy' ,
@@ -48,7 +47,7 @@ export const Overview: Story = {
4847 parameters : {
4948 docs : {
5049 source : {
51- code : `<uui-text -copy value="Hey stop copying me 🥸"></uui-text -copy>` ,
50+ code : `<uui-button -copy-text value="Hey stop copying me 🥸"></uui-button -copy-text >` ,
5251 } ,
5352 } ,
5453 } ,
@@ -64,7 +63,7 @@ export const WithLabelSet: Story = {
6463 parameters : {
6564 docs : {
6665 source : {
67- code : `<uui-text -copy value="Hey stop copying me 🥸" label="This is my A11y label I want"></uui-text -copy>` ,
66+ code : `<uui-button -copy-text value="Hey stop copying me 🥸" label="This is my A11y label I want"></uui-button -copy-text >` ,
6867 } ,
6968 } ,
7069 } ,
@@ -79,7 +78,7 @@ export const Disabled: Story = {
7978 parameters : {
8079 docs : {
8180 source : {
82- code : `<uui-text -copy value="You cannot copy this" disabled></uui-text -copy>` ,
81+ code : `<uui-button -copy-text value="You cannot copy this" disabled></uui-button -copy-text >` ,
8382 } ,
8483 } ,
8584 } ,
@@ -91,12 +90,14 @@ export const CustomSlotContent: Story = {
9190 value : 'Custom slot content' ,
9291 } ,
9392 render : args => html `
94- < uui-text-copy .value =${ args . value } > Custom Copy Text </ uui-text-copy >
93+ < uui-button-copy-text .value =${ args . value } >
94+ Custom Copy Text
95+ </ uui-button-copy-text >
9596 ` ,
9697 parameters : {
9798 docs : {
9899 source : {
99- code : `<uui-text -copy value="Custom slot content">Custom Copy Text</uui-text -copy>` ,
100+ code : `<uui-button -copy-text value="Custom slot content">Custom Copy Text</uui-button -copy-text >` ,
100101 } ,
101102 } ,
102103 } ,
@@ -109,19 +110,11 @@ export const ColorAndLook: Story = {
109110 color : 'positive' ,
110111 look : 'primary' ,
111112 } ,
112- render : args => html `
113- < uui-text-copy
114- .value =${ args . value }
115- .color =${ args . color || 'default' }
116- .look=${ args . look || 'default' } >
117- < uui-icon name ="copy "> </ uui-icon > Copy
118- </ uui-text-copy >
119- ` ,
120113 parameters : {
121114 docs : {
122115 source : {
123116 code : `
124- <uui-text -copy value="I have the same look and color props as UUI-Button" color="positive" look="primary"></uui-text -copy>
117+ <uui-button -copy-text value="I have the same look and color props as UUI-Button" color="positive" look="primary"></uui-button -copy-text >
125118 ` ,
126119 } ,
127120 } ,
@@ -134,19 +127,19 @@ export const CopiedEvent: Story = {
134127 value : 'Copy this text' ,
135128 } ,
136129 render : args => html `
137- < uui-text -copy
130+ < uui-button -copy-text
138131 .value =${ args . value }
139- @copied =${ ( event : UUITextCopyEvent ) => {
132+ @copied =${ ( event : UUICopyTextEvent ) => {
140133 alert ( `Copied text: ${ event . detail . text } ` ) ;
141- } } > </ uui-text -copy >
134+ } } > </ uui-button -copy-text >
142135 ` ,
143136 parameters : {
144137 docs : {
145138 source : {
146139 code : `
147- <uui-text -copy value="Copy this text"></uui-text -copy>
140+ <uui-button -copy-text value="Copy this text"></uui-button -copy-text >
148141<script>
149- document.querySelector('uui-text -copy').addEventListener('copied', (event) => {
142+ document.querySelector('uui-button -copy-text ').addEventListener('copied', (event) => {
150143 alert(\`Copied text: \${event.detail.text}\`);
151144 });
152145</script>
@@ -164,7 +157,7 @@ export const ModifyClipboardContent: Story = {
164157 render : args => html `
165158 < uui-text-copy
166159 .value =${ args . value }
167- @copying =${ ( event : UUITextCopyEvent ) => {
160+ @copying =${ ( event : UUICopyTextEvent ) => {
168161 event . detail . text += ' - Modified before copying' ;
169162 } } > </ uui-text-copy >
170163 ` ,
@@ -189,9 +182,6 @@ export const EmptyValueErrorState: Story = {
189182 args : {
190183 copyFrom : 'idSelectorDoesNotExist' ,
191184 } ,
192- render : args => html `
193- < uui-text-copy .copyFrom =${ args . copyFrom } > </ uui-text-copy >
194- ` ,
195185 parameters : {
196186 docs : {
197187 source : {
0 commit comments