Skip to content

Commit

Permalink
feat: add color-copy event
Browse files Browse the repository at this point in the history
Add a new event `copy-color` that is fired once a copy operation succeeded. Its event data is the same as that of the `color-change` event.
  • Loading branch information
kleinfreund committed Oct 20, 2024
1 parent 7935126 commit 910f12c
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 76 deletions.
27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,37 @@ You can also register the component and import the styles globally.
<template>
<ColorPicker
color="hsl(270 100% 50% / 0.8)"
@color-change="updateColor"
@color-change="colorChanged"
/>
</template>

<script setup>
import { ColorPicker } from 'vue-accessible-color-picker'

function updateColor (eventData) {
function colorChanged (eventData) {
console.log(eventData)
}
</script>
```

#### `color-copy`

- **Description**: The `color-copy` event is fired once a copy operation succeeded.
- **Data**: Emits the same event data as [the `color-change` event](#color-change).
- **Usage**:

```vue
<template>
<ColorPicker
color="hsl(270 100% 50% / 0.8)"
@color-copy="colorCopied"
/>
</template>

<script setup>
import { ColorPicker } from 'vue-accessible-color-picker'

function colorCopied (eventData) {
console.log(eventData)
}
</script>
Expand Down
2 changes: 2 additions & 0 deletions dist/ColorPicker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import { PublicProps } from 'vue';

declare const __VLS_component: DefineComponent<ColorPickerProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
"color-change": (data: ColorChangeDetail) => any;
"color-copy": (data: ColorChangeDetail) => any;
}, string, PublicProps, Readonly<ColorPickerProps> & Readonly<{
"onColor-change"?: ((data: ColorChangeDetail) => any) | undefined;
"onColor-copy"?: ((data: ColorChangeDetail) => any) | undefined;
}>, {
id: string;
color: string | ColorHsl | ColorHwb | ColorRgb;
Expand Down
Loading

0 comments on commit 910f12c

Please sign in to comment.