Skip to content

Commit

Permalink
docs(VConfirmEdit): add basic docs page
Browse files Browse the repository at this point in the history
  • Loading branch information
johnleider committed Apr 11, 2024
1 parent 1789724 commit 92c777b
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/api-generator/src/locale/en/VConfirmEdit.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"props": {
"cancelText": "Text for the cancel button",
"okText": "Text for the ok button"
},
"events": {
"ok": "The event emitted when the user clicks the OK button",
"cancel": "The event emitted when the user clicks the Cancel button"
}
}
4 changes: 4 additions & 0 deletions packages/docs/src/data/nav.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@
"title": "calendars",
"subfolder": "components"
},
{
"title": "confirm-edit",
"subfolder": "components"
},
{
"title": "empty-states",
"subfolder": "components"
Expand Down
1 change: 1 addition & 0 deletions packages/docs/src/data/page-to-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"components/chip-groups": ["VChip", "VChipGroup"],
"components/chips": ["VChip", "VChipGroup"],
"components/color-pickers": ["VColorPicker"],
"components/confirm-edit": ["VConfirmEdit"],
"components/combobox": ["VCombobox"],
"components/data-iterators": ["VDataIterator"],
"components/data-tables": [
Expand Down
24 changes: 24 additions & 0 deletions packages/docs/src/examples/v-confirm-edit/misc-date-picker.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<template>
<v-card
class="mx-auto"
max-width="328"
rounded="lg"
border
>
<v-confirm-edit v-model="date">
<template v-slot:default="{ model: proxyModel, actions }">
<v-date-picker v-model="proxyModel.value">
<template v-slot:actions>
<component :is="actions"></component>
</template>
</v-date-picker>
</template>
</v-confirm-edit>
</v-card>
</template>

<script setup>
import { shallowRef } from 'vue'
const date = shallowRef()
</script>
92 changes: 92 additions & 0 deletions packages/docs/src/examples/v-confirm-edit/usage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<template>
<ExamplesUsageExample
v-model="model"
:code="code"
:options="options"
:script="script"
name="v-avatar"
>
<div>
<v-confirm-edit v-model="value" v-bind="props">
<template v-slot:default="{ model: proxyModel, actions }">
<v-card
class="mx-auto"
max-width="320"
title="Update Field"
>
<template v-slot:text>
<v-text-field
v-model="proxyModel.value"
messages="Modify my value"
></v-text-field>
</template>

<template v-slot:actions>
<v-spacer></v-spacer>

<component :is="actions"></component>
</template>
</v-card>
</template>
</v-confirm-edit>
</div>

<template v-slot:configuration>
<v-text-field v-model="okText" label="Ok text"></v-text-field>
<v-text-field v-model="cancelText" label="Cancel text"></v-text-field>
</template>
</ExamplesUsageExample>
</template>

<script setup>
const model = ref('default')
const options = []
const value = ref('Egg Plant')
const okText = ref('Ok')
const cancelText = ref('Cancel')
const props = computed(() => {
return {
'ok-text': okText.value === 'Ok' ? undefined : okText.value,
'cancel-text': cancelText.value === 'Cancel' ? undefined : cancelText.value,
'v-model': 'model',
}
})
const slots = computed(() => {
return `
<template v-slot:default="{ model: proxyModel, actions }">
<v-card
class="mx-auto"
max-width="320"
title="Update Field"
>
<template v-slot:text>
<v-text-field
v-model="proxyModel.value"
messages="Modify my value"
></v-text-field>
</template>
<template v-slot:actions>
<v-spacer></v-spacer>
<component :is="actions"></component>
</template>
</v-card>
</template>
`
})
const script = computed(() => {
return `<script setup>
import { shallowRef } from 'vue'
const model = shallowRef('Egg plant')
<` + '/script>'
})
const code = computed(() => {
return `<v-confirm-edit${propsToString(props.value)}>${slots.value}</v-confirm-edit>`
})
</script>
48 changes: 48 additions & 0 deletions packages/docs/src/pages/en/components/confirm-edit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
emphasized: true
meta:
nav: Confirm Edit
title: Confirm Edit
description: The confirm edit component is used to allow the user to verify their changes before they are committed. This is useful when you want to prevent accidental changes or to allow the user to cancel their changes.
keywords: v-confirm-edit, confirm edit, vuetify confirm edit, vuetify confirm edit component, vuetify confirm edit examples
related:
- /components/avatars/
- /components/icons/
- /components/toolbars/
features:
github: /labs/VConfirmEdit/
label: 'C: VConfirmEdit'
report: true
---

# Confirm edit

The `v-confirm-edit` component is used to allow the user to verify their changes before they are committed.

![Badge Entry](https://cdn.vuetifyjs.com/docs/images/components-temp/v-badge/v-badge-entry.png)

<PageFeatures />

## Usage

<ExamplesUsage name="v-confirm-edit" />

<PromotedEntry />

## API

| Component | Description |
| - | - |
| [v-confirm-edit](/api/v-confirm-edit/) | Primary Component |

<ApiInline hide-links />

## Guide

The `v-confirm-edit` component is an intuitive way to capture a model's changes before they are committed. This is useful when you want to prevent accidental changes or to allow the user to cancel their changes.

### Pickers

It's easy to integrate pickers into the `v-confirm-edit` component. This allows you to provide a more user-friendly experience when selecting dates, times, or colors.

<ExamplesExample file="v-confirm-edit/misc-date-picker" />
2 changes: 1 addition & 1 deletion packages/docs/src/pages/en/introduction/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The following is a list of all planned components for the year 2024.
| [v-empty-state](/components/empty-states/) | *️⃣ | April 2024 |
| [v-sparkline](/components/sparklines/) | *️⃣ | April 2024 |
| [v-speed-dial](/components/speed-dials/) | *️⃣ | April 2024 |
| v-confirm-edit | *️⃣ | April 2024 |
| [v-confirm-edit](/components/confirm-edit/) | *️⃣ | April 2024 |
| [v3.7 (Odyssey)](https://github.com/vuetifyjs/vuetify/milestone/73) | | { .bg-surface-light } |
| [v-treeview](/components/treeview/) | *️⃣ | July 2024 |
| [v-number-input](/components/number-inputs/) | *️⃣ | July 2024 |
Expand Down

0 comments on commit 92c777b

Please sign in to comment.