Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .claude/rules/vue-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ paths:
## Events

- `update:modelValue` for v-model.
- `update:open` for Popover, Collapsible, ImageViewer, FilterPill.
- `update:show` for Modal, Tooltip, Toast (legacy — don't change existing, use `update:open` for new).
- `update:open` for Modal, Tooltip, Toast, Popover, Collapsible, ImageViewer, FilterPill.

## Slots

Expand Down
3 changes: 1 addition & 2 deletions .claude/skills/vue-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ Detailed rules are applied automatically via path-scoped rules when editing comp
| Prop validation | `validator` (NEVER `validate` — Vue silently ignores it) |
| Constants | Export from `*_constants.js`, import in component + tests |
| v-model event | `update:modelValue` |
| Open/close (new) | `update:open` (Popover, Collapsible, ImageViewer, FilterPill) |
| Open/close (legacy) | `update:show` (Modal, Tooltip, Toast — don't change) |
| Open/close | `update:open` (Modal, Tooltip, Toast, Popover, Collapsible, ImageViewer, FilterPill) |
| Overlay slots | `headerContent` / `footerContent` |
| Structural slots | `header` / `footer` |
| Sizes (interactive) | `xs`, `sm`, `md`, `lg`, `xl` |
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ chore: NO-JIRA update dependencies
- **New components**: Composition API with `<script setup lang="ts">`
- **Existing components**: Options API with `compatConfig: { MODE: 3 }` — do NOT convert unless explicitly asked
- **Props**: Use `validator` (NOT `validate` — Vue silently ignores `validate`)
- **Events**: `update:modelValue` for v-model; `update:open` for new overlays; `update:show` for legacy Modal/Tooltip/Toast
- **Events**: `update:modelValue` for v-model; `update:open` for all overlay visibility (Modal, Tooltip, Toast, Popover, Dropdown, etc.)

Detailed conventions are in path-scoped rules (`.claude/rules/vue-components.md`) that activate automatically when editing component files.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<dt-modal
title="Example title"
:show="isOpen"
:open="isOpen"
:banner-title="bannerTitle"
:banner-kind="bannerKind"
:fixed-header-footer="fixedHeaderFooter"
:size="size"
:copy="copy"
@update:show="isOpen = $event"
@update:open="isOpen = $event"
>
<template
#footer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<aside :class="['d-toast-wrapper', { 'd-ps-fixed': fixed }]">
<dt-toast
:title="title"
:show="show"
:open="open"
:important="important"
:duration="duration"
:kind="kind"
@close="$emit('close')"
@update:show="$emit('update:show', $event)"
@update:open="$emit('update:open', $event)"
>
Message body with
<dt-link
Expand Down Expand Up @@ -38,7 +38,7 @@ export default {
default: '',
},

show: {
open: {
type: Boolean,
default: false,
},
Expand All @@ -64,7 +64,7 @@ export default {
},
},

emits: ['close', 'update:show'],
emits: ['close', 'update:open'],
computed: {
linkClass () {
if (this.kind === 'warning' && this.important) return 'd-fc-neutral-black';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@
</dt-empty-state>
<dt-modal
v-if="selectedIcon"
:show="isModalOpen"
:open="isModalOpen"
size="full"
content-class="d-wmx100p d-pie-400"
@update:show="isModalOpen = false"
@update:open="isModalOpen = false"
>
<template #header>
<span
Expand Down
34 changes: 17 additions & 17 deletions apps/dialtone-documentation/docs/components/modal.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ Although highly versatile, this doesn't mean modal dialogs are fit for all purpo
<!-- @code -->
<dt-modal
title="Example title"
:show="isOpen"
@update:show="updateShow"
:open="isOpen"
@update:open="updateOpen"
copy="Lorem ipsum ..."
>
<template
Expand Down Expand Up @@ -110,8 +110,8 @@ This is the default behavior that adds the scroll automatically in the modal con
<!-- @code -->
<dt-modal
title="Example title"
:show="isOpen"
@update:show="updateShow"
:open="isOpen"
@update:open="updateOpen"
:showFooter="true"
:fixed-header-footer="true"
copy="Sed at orci quis nunc finibus gravida eget vitae est..."
Expand Down Expand Up @@ -150,10 +150,10 @@ A modal style for destructive or irreversible actions.
<!-- @code -->
<dt-modal
title="Example title"
:show="isOpen"
:open="isOpen"
kind="danger"
copy="Sed at orci quis nunc finibus gravida eget vitae est..."
@update:show="updateShow"
@update:open="updateOpen"
>
<template
#footer
Expand Down Expand Up @@ -190,10 +190,10 @@ To make this modal take up as much of the screen as possible.
<!-- @code -->
<dt-modal
title="Example title"
:show="isOpen"
:open="isOpen"
size="full"
copy="Sed at orci quis nunc finibus gravida eget vitae est..."
@update:show="updateShow"
@update:open="updateOpen"
>
<template
#footer
Expand Down Expand Up @@ -237,11 +237,11 @@ When there is a need of more context information regarding the content of the Mo
<!-- @code -->
<dt-modal
title="Example title"
:show="isOpen"
:open="isOpen"
banner-title="This banner can have different kinds."
:bannerKind="selectedBannerKind"
copy="Sed at orci quis nunc finibus gravida eget vitae est..."
@update:show="updateShow"
@update:open="updateOpen"
>
<template
#footer
Expand Down Expand Up @@ -279,8 +279,8 @@ In addition to the footer, custom elements can be inserted into the header and b
```vue demo
<div>
<dt-modal
:show="isOpen"
@update:show="updateShow"
:open="isOpen"
@update:open="updateOpen"
>
<template #header>
<dt-stack direction="row" align="center" justify="center" class="d-p-150 d-bgc-purple-100">
Expand All @@ -299,8 +299,8 @@ In addition to the footer, custom elements can be inserted into the header and b
</div>
<!-- @code -->
<dt-modal
:show="isOpen"
@update:show="updateShow"
:open="isOpen"
@update:open="updateOpen"
>
<template #header>
<dt-stack direction="row" align="center" justify="center" class="d-p-150 d-bgc-purple-100">
Expand All @@ -324,8 +324,8 @@ Modal content renders outside the DOM tree. Use the `contentMode` prop to apply
content-mode="invert"
title="Inverted Modal"
copy="This modal's content is in the inverted mode."
:show="invertedModalOpen"
@update:show="invertedModalOpen = $event"
:open="invertedModalOpen"
@update:open="invertedModalOpen = $event"
/>
</div>
<!-- @code -->
Expand Down Expand Up @@ -361,7 +361,7 @@ At minimum, modals contain a title and one button. They could also contain body
isOpen.value = true;
};

const updateShow = (value) => {
const updateOpen = (value) => {
if (!value) isOpen.value = false;
};

Expand Down
14 changes: 7 additions & 7 deletions apps/dialtone-documentation/docs/components/toast.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ keywords: ["notification", "snackbar", "alert", "message", "d-toast", "DtToast",
<!-- @code -->
<dt-toast
title="Title"
:show="showToast"
:open="showToast"
:important="important"
:kind="selectedKind"
@close="closeEvent"
Expand All @@ -47,7 +47,7 @@ keywords: ["notification", "snackbar", "alert", "message", "d-toast", "DtToast",

<example-toast
class="d-zi-notification"
:show="showToast"
:open="showToast"
title="Title"
:important="important"
:kind="selectedKind"
Expand All @@ -63,16 +63,16 @@ If the duration is not provided the toast won't disappear automatically.
<dt-button @click="toggleDurationToast(true)">Show Example</dt-button>
<example-toast
class="d-zi-notification"
:show="showDurationToast"
:open="showDurationToast"
title="Title"
@close="toggleDurationToast(false)"
@update:show="updateShow"
@update:open="updateOpen"
:duration="6000"
/>
<!-- @code -->
<dt-toast
title="Title"
:show="showDurationToast"
:open="showDurationToast"
@close="closeEvent"
:duration="7500"
>
Expand Down Expand Up @@ -101,7 +101,7 @@ If you need to self-position the toast at the top center, use the `d-toast-wrapp
<dt-toast
:title="title"
:message="message"
:show="isShown"
:open="isShown"
></dt-toast>
</aside>
```
Expand Down Expand Up @@ -158,7 +158,7 @@ function toggleToast () {
function toggleDurationToast (value) {
showDurationToast.value = value;
}
const updateShow = (value) => {
const updateOpen = (value) => {
if (!value) showDurationToast.value = false;
};

Expand Down
26 changes: 13 additions & 13 deletions apps/dialtone-documentation/docs/scratch.md
Original file line number Diff line number Diff line change
Expand Up @@ -925,25 +925,25 @@ const checkRadioDisabled = ref(false);
<div class="d-d-grid d-g-400 d-g-cols2">
<dt-stack gap="100">
<dt-text as="h3" kind="headline" :size="300">Default</dt-text>
<dt-toast :show="true" kind="info" title="Info toast" message="Informational message." :duration="null" />
<dt-toast :show="true" kind="success" title="Success toast" message="Action completed." :duration="null" />
<dt-toast :show="true" kind="warning" title="Warning toast" message="Review before proceeding." :duration="null" />
<dt-toast :show="true" kind="error" title="Error toast" message="Something went wrong." :duration="null" />
<dt-toast :show="true" kind="base" title="Base toast" message="Neutral notification." :duration="null" />
<dt-toast :open="true" kind="info" title="Info toast" message="Informational message." :duration="null" />
<dt-toast :open="true" kind="success" title="Success toast" message="Action completed." :duration="null" />
<dt-toast :open="true" kind="warning" title="Warning toast" message="Review before proceeding." :duration="null" />
<dt-toast :open="true" kind="error" title="Error toast" message="Something went wrong." :duration="null" />
<dt-toast :open="true" kind="base" title="Base toast" message="Neutral notification." :duration="null" />
</dt-stack>
<dt-stack gap="100">
<dt-text as="h3" kind="headline" :size="300">Important</dt-text>
<dt-toast :show="true" kind="info" title="Info toast" message="Informational message." :important="true" :duration="null" />
<dt-toast :show="true" kind="success" title="Success toast" message="Action completed." :important="true" :duration="null" />
<dt-toast :show="true" kind="warning" title="Warning toast" message="Review before proceeding." :important="true" :duration="null" />
<dt-toast :show="true" kind="error" title="Error toast" message="Something went wrong." :important="true" :duration="null" />
<dt-toast :show="true" kind="base" title="Base toast" message="Neutral notification." :important="true" :duration="null" />
<dt-toast :open="true" kind="info" title="Info toast" message="Informational message." :important="true" :duration="null" />
<dt-toast :open="true" kind="success" title="Success toast" message="Action completed." :important="true" :duration="null" />
<dt-toast :open="true" kind="warning" title="Warning toast" message="Review before proceeding." :important="true" :duration="null" />
<dt-toast :open="true" kind="error" title="Error toast" message="Something went wrong." :important="true" :duration="null" />
<dt-toast :open="true" kind="base" title="Base toast" message="Neutral notification." :important="true" :duration="null" />
</dt-stack>
<dt-stack gap="100">
<dt-text as="h3" kind="headline" :size="300">Alignment per internal parts</dt-text>
<dt-toast :show="true" kind="info" title="Title only" :duration="null" />
<dt-toast :show="true" kind="info" message="Action completed." :duration="null" />
<dt-toast :show="true" kind="info" title="Title and message" message="Review before proceeding." :duration="null" />
<dt-toast :open="true" kind="info" title="Title only" :duration="null" />
<dt-toast :open="true" kind="info" message="Action completed." :duration="null" />
<dt-toast :open="true" kind="info" title="Title and message" message="Review before proceeding." :duration="null" />
</dt-stack>
</div>
</dt-stack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,15 @@ All form components implement Vue 3 v-model via `modelValue` prop + `update:mode
| DtSelectMenu | `String \| Number` | |
| DtToggle | `Boolean \| String` | Supports `'mixed'` for indeterminate state |

Visibility-toggle components use `update:show` instead:
Visibility-toggle components use `update:open`:

| Component | Emit |
|-----------|------|
| DtModal | `update:show` |
| DtTooltip | `update:show` |
| DtModal | `update:open` |
| DtTooltip | `update:open` |
| DtToast | `update:open` |
| DtPopover | `update:open` |
| DtDropdown | `update:open` |

## Event Naming

Expand All @@ -90,7 +93,7 @@ Custom events use the `update:{prop}` convention to stay compatible with `v-mode

```
update:modelValue — value changed
update:show — visibility changed
update:open — visibility changed
update:length — input length changed (DtInput)
update:invalid — validation state changed (DtInput)
```
Expand Down
8 changes: 4 additions & 4 deletions packages/dialtone-vue/components/modal/modal.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ maximus ipsum ex. Curabitur elementum luctus augue, quis eleifend tortor feugiat
Maecenas maximus, ipsum et laoreet congue, diam massa aliquam libero, at pellentesque \
orci ipsum et velit.`,
title: 'Example Title',
onClose: action('update:show'),
onClose: action('update:open'),
};

export const argTypesData = {
Expand Down Expand Up @@ -103,7 +103,7 @@ export const argTypesData = {
type: 'boolean',
},
},
show: {
open: {
control: {
type: 'boolean',
},
Expand All @@ -116,7 +116,7 @@ export const argTypesData = {
},

// Events
'update:show': {
'update:open': {
description: `The modal will emit a "false" boolean value for this event when the \
user performs a modal-closing action. Parent components can sync on this value to create \
a 2-way binding to control modal visibility.`,
Expand Down Expand Up @@ -151,7 +151,7 @@ export const Default = {
parameters: {
percy: {
args: {
show: true,
open: true,
},
},
},
Expand Down
8 changes: 4 additions & 4 deletions packages/dialtone-vue/components/modal/modal.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DtModal, MODAL_BANNER_KINDS } from '@/components/modal';
import { mount } from '@vue/test-utils';

const SYNC_EVENT_NAME = 'update:show';
const SYNC_EVENT_NAME = 'update:open';

const MOCK_MODAL_COPY = 'test modal copy';
const MOCK_MODAL_TITLE = 'test modal title';
Expand All @@ -14,7 +14,7 @@ const baseProps = {
title: MOCK_MODAL_TITLE,
copy: MOCK_MODAL_COPY,
bannerTitle: MOCK_MODAL_BANNER,
show: true,
open: true,
};

const baseSlots = {};
Expand Down Expand Up @@ -222,7 +222,7 @@ describe('DtModal Tests', () => {
const bannerTitle = 'title';

await wrapper.setProps({
show: true,
open: true,
bannerTitle,
bannerClass,
});
Expand All @@ -234,7 +234,7 @@ describe('DtModal Tests', () => {

it('Should apply banner kind', async () => {
await wrapper.setProps({
show: true,
open: true,
bannerKind: 'info',
bannerTitle: 'title',
});
Expand Down
Loading
Loading