@cocoar/vue-ui 3.1.0 → 3.2.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/checkbox/CoarCheckbox.vue.d.ts +1 -1
- package/dist/components/checkbox/CoarCheckbox.vue.d.ts.map +1 -1
- package/dist/components/code-block/CoarCodeBlock.vue.d.ts +1 -1
- package/dist/components/code-block/CoarCodeBlock.vue.d.ts.map +1 -1
- package/dist/components/data-list/CoarDataList.vue.d.ts +158 -0
- package/dist/components/data-list/CoarDataList.vue.d.ts.map +1 -0
- package/dist/components/data-list/CoarDataListToolbar.vue.d.ts +30 -0
- package/dist/components/data-list/CoarDataListToolbar.vue.d.ts.map +1 -0
- package/dist/components/data-list/data-list-builder.d.ts +288 -0
- package/dist/components/data-list/data-list-builder.d.ts.map +1 -0
- package/dist/components/data-list/index.d.ts +12 -0
- package/dist/components/data-list/index.d.ts.map +1 -0
- package/dist/components/data-list/internal/compare.d.ts +14 -0
- package/dist/components/data-list/internal/compare.d.ts.map +1 -0
- package/dist/components/data-list/internal/reorder-core.d.ts +46 -0
- package/dist/components/data-list/internal/reorder-core.d.ts.map +1 -0
- package/dist/components/data-list/internal/search.d.ts +16 -0
- package/dist/components/data-list/internal/search.d.ts.map +1 -0
- package/dist/components/data-list/internal/useDataListLines.d.ts +92 -0
- package/dist/components/data-list/internal/useDataListLines.d.ts.map +1 -0
- package/dist/components/data-list/internal/useDataListReorder.d.ts +68 -0
- package/dist/components/data-list/internal/useDataListReorder.d.ts.map +1 -0
- package/dist/components/data-list/internal/useSearchHighlight.d.ts +19 -0
- package/dist/components/data-list/internal/useSearchHighlight.d.ts.map +1 -0
- package/dist/components/data-list/types.d.ts +185 -0
- package/dist/components/data-list/types.d.ts.map +1 -0
- package/dist/components/data-list/useDataListModel.d.ts +79 -0
- package/dist/components/data-list/useDataListModel.d.ts.map +1 -0
- package/dist/components/date-time/_shared/maskito-config.d.ts +7 -2
- package/dist/components/date-time/_shared/maskito-config.d.ts.map +1 -1
- package/dist/components/date-time/_shared/time-helpers.d.ts +11 -4
- package/dist/components/date-time/_shared/time-helpers.d.ts.map +1 -1
- package/dist/components/date-time/_shared/use-date-picker-base.d.ts +1 -1
- package/dist/components/date-time/plain-date-picker/CoarPlainDatePicker.vue.d.ts +1 -1
- package/dist/components/date-time/plain-date-picker/CoarPlainDatePicker.vue.d.ts.map +1 -1
- package/dist/components/date-time/plain-date-time-picker/CoarPlainDateTimePicker.vue.d.ts +1 -1
- package/dist/components/date-time/plain-date-time-picker/CoarPlainDateTimePicker.vue.d.ts.map +1 -1
- package/dist/components/date-time/zoned-date-time-picker/CoarZonedDateTimePicker.vue.d.ts +1 -1
- package/dist/components/date-time/zoned-date-time-picker/CoarZonedDateTimePicker.vue.d.ts.map +1 -1
- package/dist/components/dual-listbox/CoarDualListbox.vue.d.ts +3 -0
- package/dist/components/dual-listbox/CoarDualListbox.vue.d.ts.map +1 -1
- package/dist/components/form-field/CoarFormField.vue.d.ts +1 -1
- package/dist/components/form-field/CoarFormField.vue.d.ts.map +1 -1
- package/dist/components/icon/CoarIcon.vue.d.ts +2 -2
- package/dist/components/icon/CoarIcon.vue.d.ts.map +1 -1
- package/dist/components/listbox/CoarListbox.vue.d.ts +7 -0
- package/dist/components/listbox/CoarListbox.vue.d.ts.map +1 -1
- package/dist/components/number-input/CoarNumberInput.vue.d.ts +1 -1
- package/dist/components/number-input/CoarNumberInput.vue.d.ts.map +1 -1
- package/dist/components/otp-input/CoarOtpInput.vue.d.ts +1 -1
- package/dist/components/otp-input/CoarOtpInput.vue.d.ts.map +1 -1
- package/dist/components/password-input/CoarPasswordInput.vue.d.ts +1 -1
- package/dist/components/password-input/CoarPasswordInput.vue.d.ts.map +1 -1
- package/dist/components/switch/CoarSwitch.vue.d.ts +1 -1
- package/dist/components/switch/CoarSwitch.vue.d.ts.map +1 -1
- package/dist/components/text-input/CoarTextInput.vue.d.ts +1 -1
- package/dist/components/text-input/CoarTextInput.vue.d.ts.map +1 -1
- package/dist/composables/dragRegistry.d.ts +12 -0
- package/dist/composables/dragRegistry.d.ts.map +1 -1
- package/dist/composables/index.d.ts +2 -2
- package/dist/composables/index.d.ts.map +1 -1
- package/dist/composables/useDragDrop.d.ts +62 -6
- package/dist/composables/useDragDrop.d.ts.map +1 -1
- package/dist/composables/useVirtualList.d.ts +21 -1
- package/dist/composables/useVirtualList.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4508 -2039
- package/package.json +5 -3
- package/skills/cocoar-vue-ui/SKILL.md +244 -0
- package/skills/cocoar-vue-ui/references/components/avatar.md +178 -0
- package/skills/cocoar-vue-ui/references/components/badge.md +290 -0
- package/skills/cocoar-vue-ui/references/components/breadcrumb.md +238 -0
- package/skills/cocoar-vue-ui/references/components/button.md +252 -0
- package/skills/cocoar-vue-ui/references/components/calendar/agenda-view.md +353 -0
- package/skills/cocoar-vue-ui/references/components/calendar/coar-calendar.md +1645 -0
- package/skills/cocoar-vue-ui/references/components/calendar/day-view.md +361 -0
- package/skills/cocoar-vue-ui/references/components/calendar/index.md +312 -0
- package/skills/cocoar-vue-ui/references/components/calendar/month-view.md +475 -0
- package/skills/cocoar-vue-ui/references/components/calendar/performance.md +186 -0
- package/skills/cocoar-vue-ui/references/components/calendar/timeline-view.md +301 -0
- package/skills/cocoar-vue-ui/references/components/calendar/week-view.md +382 -0
- package/skills/cocoar-vue-ui/references/components/calendar/work-week-view.md +145 -0
- package/skills/cocoar-vue-ui/references/components/calendar/year-view.md +63 -0
- package/skills/cocoar-vue-ui/references/components/card.md +151 -0
- package/skills/cocoar-vue-ui/references/components/checkbox-group.md +103 -0
- package/skills/cocoar-vue-ui/references/components/checkbox.md +279 -0
- package/skills/cocoar-vue-ui/references/components/code-block.md +241 -0
- package/skills/cocoar-vue-ui/references/components/context-menu.md +355 -0
- package/skills/cocoar-vue-ui/references/components/data-grid/checkbox.md +213 -0
- package/skills/cocoar-vue-ui/references/components/data-grid/date-columns.md +272 -0
- package/skills/cocoar-vue-ui/references/components/data-grid/editing.md +236 -0
- package/skills/cocoar-vue-ui/references/components/data-grid/multi-select.md +193 -0
- package/skills/cocoar-vue-ui/references/components/data-grid/number.md +147 -0
- package/skills/cocoar-vue-ui/references/components/data-grid/select.md +202 -0
- package/skills/cocoar-vue-ui/references/components/data-grid/text.md +127 -0
- package/skills/cocoar-vue-ui/references/components/data-grid.md +1225 -0
- package/skills/cocoar-vue-ui/references/components/data-list.md +2121 -0
- package/skills/cocoar-vue-ui/references/components/date-or-time-picker.md +200 -0
- package/skills/cocoar-vue-ui/references/components/date-picker.md +203 -0
- package/skills/cocoar-vue-ui/references/components/date-time-picker.md +154 -0
- package/skills/cocoar-vue-ui/references/components/date-views.md +212 -0
- package/skills/cocoar-vue-ui/references/components/dialog.md +148 -0
- package/skills/cocoar-vue-ui/references/components/divider.md +157 -0
- package/skills/cocoar-vue-ui/references/components/document-viewer/annotations.md +400 -0
- package/skills/cocoar-vue-ui/references/components/document-viewer/coar-document-viewer.md +327 -0
- package/skills/cocoar-vue-ui/references/components/document-viewer/index.md +234 -0
- package/skills/cocoar-vue-ui/references/components/document-viewer/toolbar.md +221 -0
- package/skills/cocoar-vue-ui/references/components/drag-drop.md +267 -0
- package/skills/cocoar-vue-ui/references/components/dual-listbox.md +449 -0
- package/skills/cocoar-vue-ui/references/components/file-explorer/asset-store.md +327 -0
- package/skills/cocoar-vue-ui/references/components/file-explorer/in-memory-store.md +176 -0
- package/skills/cocoar-vue-ui/references/components/file-explorer/index.md +311 -0
- package/skills/cocoar-vue-ui/references/components/file-explorer/use-file-explorer.md +300 -0
- package/skills/cocoar-vue-ui/references/components/form-field.md +1025 -0
- package/skills/cocoar-vue-ui/references/components/fragment-parser.md +298 -0
- package/skills/cocoar-vue-ui/references/components/link.md +235 -0
- package/skills/cocoar-vue-ui/references/components/listbox.md +575 -0
- package/skills/cocoar-vue-ui/references/components/map/editor.md +448 -0
- package/skills/cocoar-vue-ui/references/components/map/index.md +351 -0
- package/skills/cocoar-vue-ui/references/components/markdown-diagrams.md +210 -0
- package/skills/cocoar-vue-ui/references/components/markdown-editor.md +1478 -0
- package/skills/cocoar-vue-ui/references/components/markdown-embeds.md +387 -0
- package/skills/cocoar-vue-ui/references/components/markdown-form.md +447 -0
- package/skills/cocoar-vue-ui/references/components/markdown.md +276 -0
- package/skills/cocoar-vue-ui/references/components/menu.md +380 -0
- package/skills/cocoar-vue-ui/references/components/mermaid.md +172 -0
- package/skills/cocoar-vue-ui/references/components/navbar.md +147 -0
- package/skills/cocoar-vue-ui/references/components/note.md +96 -0
- package/skills/cocoar-vue-ui/references/components/notice.md +131 -0
- package/skills/cocoar-vue-ui/references/components/number-input.md +215 -0
- package/skills/cocoar-vue-ui/references/components/otp-input.md +324 -0
- package/skills/cocoar-vue-ui/references/components/page-builder/authoring-contract.md +271 -0
- package/skills/cocoar-vue-ui/references/components/page-builder/coar-page-builder.md +476 -0
- package/skills/cocoar-vue-ui/references/components/page-builder/coar-page-renderer.md +677 -0
- package/skills/cocoar-vue-ui/references/components/page-builder/custom-elements.md +441 -0
- package/skills/cocoar-vue-ui/references/components/page-builder/idp-integration.md +122 -0
- package/skills/cocoar-vue-ui/references/components/page-builder/index.md +573 -0
- package/skills/cocoar-vue-ui/references/components/pagination.md +150 -0
- package/skills/cocoar-vue-ui/references/components/panel-layout.md +372 -0
- package/skills/cocoar-vue-ui/references/components/password-input.md +175 -0
- package/skills/cocoar-vue-ui/references/components/popconfirm.md +186 -0
- package/skills/cocoar-vue-ui/references/components/popover.md +173 -0
- package/skills/cocoar-vue-ui/references/components/progress-bar.md +178 -0
- package/skills/cocoar-vue-ui/references/components/radio-group.md +225 -0
- package/skills/cocoar-vue-ui/references/components/script-editor.md +1271 -0
- package/skills/cocoar-vue-ui/references/components/segmented-control.md +238 -0
- package/skills/cocoar-vue-ui/references/components/select.md +463 -0
- package/skills/cocoar-vue-ui/references/components/sidebar.md +421 -0
- package/skills/cocoar-vue-ui/references/components/spinner.md +132 -0
- package/skills/cocoar-vue-ui/references/components/switch.md +195 -0
- package/skills/cocoar-vue-ui/references/components/table.md +170 -0
- package/skills/cocoar-vue-ui/references/components/tabs.md +382 -0
- package/skills/cocoar-vue-ui/references/components/tag.md +178 -0
- package/skills/cocoar-vue-ui/references/components/text-input.md +256 -0
- package/skills/cocoar-vue-ui/references/components/toast.md +160 -0
- package/skills/cocoar-vue-ui/references/components/tooltip.md +121 -0
- package/skills/cocoar-vue-ui/references/components/transitions.md +193 -0
- package/skills/cocoar-vue-ui/references/components/tree.md +2388 -0
- package/skills/cocoar-vue-ui/references/components/virtual-list.md +212 -0
- package/skills/cocoar-vue-ui/references/components/wizard.md +251 -0
- package/skills/cocoar-vue-ui/references/components/zoned-date-time-picker.md +177 -0
- package/skills/cocoar-vue-ui/references/foundations/colors.md +708 -0
- package/skills/cocoar-vue-ui/references/foundations/design-principles.md +115 -0
- package/skills/cocoar-vue-ui/references/foundations/icons.md +381 -0
- package/skills/cocoar-vue-ui/references/foundations/localization/formatting.md +530 -0
- package/skills/cocoar-vue-ui/references/foundations/localization/setup.md +86 -0
- package/skills/cocoar-vue-ui/references/foundations/localization/timezones.md +182 -0
- package/skills/cocoar-vue-ui/references/foundations/localization/translations.md +305 -0
- package/skills/cocoar-vue-ui/references/foundations/motion.md +549 -0
- package/skills/cocoar-vue-ui/references/foundations/spacing.md +330 -0
- package/skills/cocoar-vue-ui/references/foundations/theming.md +140 -0
- package/skills/cocoar-vue-ui/references/foundations/typography.md +206 -0
- package/skills/cocoar-vue-ui/references/guide/error-handling.md +162 -0
- package/skills/cocoar-vue-ui/references/guide/getting-started.md +119 -0
- package/skills/cocoar-vue-ui/references/guide/migration-page-builder-3.md +207 -0
- package/skills/cocoar-vue-ui/references/guide/migration.md +140 -0
- package/skills/cocoar-vue-ui/references/guide/theming.md +98 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
<!-- Generated from apps/docs/components/date-views.md by apps/docs/scripts/sync-skill.mjs. Do not edit; edit the docs page. -->
|
|
2
|
+
|
|
3
|
+
# Date Views (New in 2.0)
|
|
4
|
+
|
|
5
|
+
The read-only display siblings of the picker family. When you have a `Temporal.PlainDate` / `Temporal.PlainDateTime` / `Temporal.ZonedDateTime` value and just want to show it (no editor, no panel) — use these.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import {
|
|
9
|
+
CoarPlainDateView,
|
|
10
|
+
CoarPlainDateTimeView,
|
|
11
|
+
CoarZonedDateTimeView,
|
|
12
|
+
} from '@cocoar/vue-ui';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
| | Value type | Renders |
|
|
16
|
+
|--|--|--|
|
|
17
|
+
| **`CoarPlainDateView`** | `Temporal.PlainDate \| null` | `12.05.2026` (locale-resolved format) |
|
|
18
|
+
| **`CoarPlainDateTimeView`** | `Temporal.PlainDateTime \| null` | `12.05.2026 14:30` (locale + 12h/24h auto) |
|
|
19
|
+
| **`CoarZonedDateTimeView`** | `Temporal.ZonedDateTime \| null` | `12.05.2026 14:30 GMT+2` (+ short zone label) |
|
|
20
|
+
|
|
21
|
+
Each view mirrors its picker's `formatValue` logic exactly — same `useDatePickerBase` for locale + date-format resolution, same `coarFormatPlainDate` + `coarFormatTime` helpers. A read-only display and the editor's resting state look identical.
|
|
22
|
+
|
|
23
|
+
## Basic Usage
|
|
24
|
+
|
|
25
|
+
**Demo — `date-views/demos/BasicDateViews.vue`**
|
|
26
|
+
|
|
27
|
+
```vue
|
|
28
|
+
<template>
|
|
29
|
+
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
30
|
+
<div>
|
|
31
|
+
<div style="font-size: 12px; color: #64748b; margin-bottom: 4px;">CoarPlainDateView</div>
|
|
32
|
+
<CoarPlainDateView :value="date" />
|
|
33
|
+
</div>
|
|
34
|
+
<div>
|
|
35
|
+
<div style="font-size: 12px; color: #64748b; margin-bottom: 4px;">CoarPlainDateTimeView</div>
|
|
36
|
+
<CoarPlainDateTimeView :value="dateTime" />
|
|
37
|
+
</div>
|
|
38
|
+
<div>
|
|
39
|
+
<div style="font-size: 12px; color: #64748b; margin-bottom: 4px;">CoarZonedDateTimeView</div>
|
|
40
|
+
<CoarZonedDateTimeView :value="zoned" />
|
|
41
|
+
</div>
|
|
42
|
+
<div>
|
|
43
|
+
<div style="font-size: 12px; color: #64748b; margin-bottom: 4px;">Empty value with placeholder</div>
|
|
44
|
+
<CoarPlainDateView :value="null" placeholder="No date set" />
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script setup lang="ts">
|
|
50
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
51
|
+
import {
|
|
52
|
+
CoarPlainDateView,
|
|
53
|
+
CoarPlainDateTimeView,
|
|
54
|
+
CoarZonedDateTimeView,
|
|
55
|
+
} from '@cocoar/vue-ui';
|
|
56
|
+
|
|
57
|
+
const date = Temporal.PlainDate.from('2026-05-12');
|
|
58
|
+
const dateTime = Temporal.PlainDateTime.from('2026-05-12T14:30:00');
|
|
59
|
+
const zoned = Temporal.ZonedDateTime.from('2026-05-12T14:30:00[Europe/Vienna]');
|
|
60
|
+
</script>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Pass a `Temporal` value via `:value`. `null` renders the placeholder text (empty string by default). Use anywhere you'd show a date without an editor — cards, dialogs, list rows, table cells. The `@cocoar/vue-data-grid` date columns wrap these viewers internally.
|
|
64
|
+
|
|
65
|
+
## Locale resolution
|
|
66
|
+
|
|
67
|
+
The display format reacts to the consumer-app locale via `useL10n()` — switching language at runtime updates the view automatically. Pass `:locale="..."` to override per-instance.
|
|
68
|
+
|
|
69
|
+
**Demo — `date-views/demos/DateViewsLocale.vue`**
|
|
70
|
+
|
|
71
|
+
```vue
|
|
72
|
+
<template>
|
|
73
|
+
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
74
|
+
<div style="display: flex; gap: 8px; align-items: center;">
|
|
75
|
+
<span style="font-size: 13px; color: #64748b;">Locale:</span>
|
|
76
|
+
<CoarSegmentedControl v-model="locale" :options="locales" size="s" />
|
|
77
|
+
</div>
|
|
78
|
+
<div style="display: grid; grid-template-columns: 200px 1fr; gap: 8px 16px; font-size: 14px;">
|
|
79
|
+
<span style="color: #64748b;">PlainDate</span>
|
|
80
|
+
<CoarPlainDateView :value="date" :locale="locale" />
|
|
81
|
+
<span style="color: #64748b;">PlainDateTime (24h auto)</span>
|
|
82
|
+
<CoarPlainDateTimeView :value="dateTime" :locale="locale" />
|
|
83
|
+
<span style="color: #64748b;">ZonedDateTime</span>
|
|
84
|
+
<CoarZonedDateTimeView :value="zoned" :locale="locale" />
|
|
85
|
+
</div>
|
|
86
|
+
<div style="font-size: 12px; color: #64748b;">
|
|
87
|
+
The format pattern (DD.MM.YYYY vs MM/DD/YYYY) and the 12h/24h clock are both derived from the locale via <code>useDatePickerBase</code> — same resolution chain the editor pickers use.
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<script setup lang="ts">
|
|
93
|
+
import { ref } from 'vue';
|
|
94
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
95
|
+
import {
|
|
96
|
+
CoarPlainDateView,
|
|
97
|
+
CoarPlainDateTimeView,
|
|
98
|
+
CoarZonedDateTimeView,
|
|
99
|
+
CoarSegmentedControl,
|
|
100
|
+
} from '@cocoar/vue-ui';
|
|
101
|
+
|
|
102
|
+
const locale = ref('de-AT');
|
|
103
|
+
const locales = [
|
|
104
|
+
{ value: 'de-AT', label: 'de-AT' },
|
|
105
|
+
{ value: 'de-DE', label: 'de-DE' },
|
|
106
|
+
{ value: 'en-US', label: 'en-US' },
|
|
107
|
+
{ value: 'en-GB', label: 'en-GB' },
|
|
108
|
+
{ value: 'fr-FR', label: 'fr-FR' },
|
|
109
|
+
];
|
|
110
|
+
|
|
111
|
+
const date = Temporal.PlainDate.from('2026-05-12');
|
|
112
|
+
const dateTime = Temporal.PlainDateTime.from('2026-05-12T14:30:00');
|
|
113
|
+
const zoned = Temporal.ZonedDateTime.from('2026-05-12T14:30:00[Europe/Vienna]');
|
|
114
|
+
</script>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Cross-zone projection
|
|
118
|
+
|
|
119
|
+
By default, each `CoarZonedDateTimeView` renders its value **in that value's own zone** — a Tokyo event shows Tokyo wallclock, a Vienna event shows Vienna wallclock. Pass `displayTimeZone="..."` to project every value into a single zone (useful for cross-zone coordination views like "show every team's meeting in my zone").
|
|
120
|
+
|
|
121
|
+
**Demo — `date-views/demos/DateViewsCrossZone.vue`**
|
|
122
|
+
|
|
123
|
+
```vue
|
|
124
|
+
<template>
|
|
125
|
+
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
126
|
+
<div>
|
|
127
|
+
<div style="font-size: 13px; color: #64748b; margin-bottom: 8px;">
|
|
128
|
+
Each row's value lives in its own zone — the view renders each in its own zone by default:
|
|
129
|
+
</div>
|
|
130
|
+
<div style="display: grid; grid-template-columns: 100px 1fr; gap: 6px 16px; font-size: 14px;">
|
|
131
|
+
<span style="color: #64748b;">EU sync</span>
|
|
132
|
+
<CoarZonedDateTimeView :value="eu" />
|
|
133
|
+
<span style="color: #64748b;">US sync</span>
|
|
134
|
+
<CoarZonedDateTimeView :value="us" />
|
|
135
|
+
<span style="color: #64748b;">AP sync</span>
|
|
136
|
+
<CoarZonedDateTimeView :value="ap" />
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
<div>
|
|
140
|
+
<div style="display: flex; gap: 8px; align-items: center; margin-bottom: 8px;">
|
|
141
|
+
<span style="font-size: 13px; color: #64748b;">…or project everything into one zone via <code>displayTimeZone</code>:</span>
|
|
142
|
+
<CoarSegmentedControl v-model="projectInto" :options="zones" size="s" />
|
|
143
|
+
</div>
|
|
144
|
+
<div style="display: grid; grid-template-columns: 100px 1fr; gap: 6px 16px; font-size: 14px;">
|
|
145
|
+
<span style="color: #64748b;">EU sync</span>
|
|
146
|
+
<CoarZonedDateTimeView :value="eu" :display-time-zone="projectInto" />
|
|
147
|
+
<span style="color: #64748b;">US sync</span>
|
|
148
|
+
<CoarZonedDateTimeView :value="us" :display-time-zone="projectInto" />
|
|
149
|
+
<span style="color: #64748b;">AP sync</span>
|
|
150
|
+
<CoarZonedDateTimeView :value="ap" :display-time-zone="projectInto" />
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
<div style="font-size: 12px; color: #64748b;">
|
|
154
|
+
All three values point at the same wallclock-in-its-own-zone (10:00 / 15:00 / 09:00), but the underlying instants differ. Projecting into one zone shows the comparable wallclock for that observer.
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
</template>
|
|
158
|
+
|
|
159
|
+
<script setup lang="ts">
|
|
160
|
+
import { ref } from 'vue';
|
|
161
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
162
|
+
import { CoarZonedDateTimeView, CoarSegmentedControl } from '@cocoar/vue-ui';
|
|
163
|
+
|
|
164
|
+
const eu = Temporal.ZonedDateTime.from('2026-05-13T10:00:00[Europe/Vienna]');
|
|
165
|
+
const us = Temporal.ZonedDateTime.from('2026-05-13T15:00:00[America/New_York]');
|
|
166
|
+
const ap = Temporal.ZonedDateTime.from('2026-05-14T09:00:00[Asia/Tokyo]');
|
|
167
|
+
|
|
168
|
+
const projectInto = ref('Europe/Vienna');
|
|
169
|
+
const zones = [
|
|
170
|
+
{ value: 'Europe/Vienna', label: 'Vienna' },
|
|
171
|
+
{ value: 'America/New_York', label: 'New York' },
|
|
172
|
+
{ value: 'Asia/Tokyo', label: 'Tokyo' },
|
|
173
|
+
];
|
|
174
|
+
</script>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Use `:show-time-zone="false"` to hide the trailing zone label entirely (compact contexts where the zone is already clear from surrounding UI).
|
|
178
|
+
|
|
179
|
+
## Cross-realm safety
|
|
180
|
+
|
|
181
|
+
All three views check the value's type via `Symbol.toStringTag` (matched against `"Temporal.PlainDate"` etc.), not `instanceof Temporal.X`. Why this matters: under pnpm's isolated dependency tree, two packages can resolve different physical copies of `@js-temporal/polyfill` — a `Temporal.PlainDate` instance constructed against one copy fails `instanceof Temporal.PlainDate` checked against another copy. The `Symbol.toStringTag` is part of the Temporal spec and identical across copies (and would be identical against the native `Temporal` once browsers ship it), so the views render correctly no matter which package created the value.
|
|
182
|
+
|
|
183
|
+
Non-matching values (e.g. an ISO string, a `Date`, or a `PlainDateTime` passed into a `CoarPlainDateView`) render as the placeholder. Convert at your data layer — the views are strict by design.
|
|
184
|
+
|
|
185
|
+
## API
|
|
186
|
+
|
|
187
|
+
### `CoarPlainDateView`
|
|
188
|
+
|
|
189
|
+
| Prop | Type | Default | Description |
|
|
190
|
+
|---|---|---|---|
|
|
191
|
+
| `value` | `Temporal.PlainDate \| null` | `null` | The value to display |
|
|
192
|
+
| `locale` | `string` | _consumer locale_ | BCP-47 tag override |
|
|
193
|
+
| `dateFormat` | `DateFormatConfig` | _resolved_ | Format pattern override |
|
|
194
|
+
| `placeholder` | `string` | `''` | Shown when value is null / wrong type |
|
|
195
|
+
| `size` | `'xs' \| 's' \| 'm' \| 'l'` | `'m'` | Font-size token |
|
|
196
|
+
|
|
197
|
+
### `CoarPlainDateTimeView`
|
|
198
|
+
|
|
199
|
+
Same as `CoarPlainDateView` plus:
|
|
200
|
+
|
|
201
|
+
| Prop | Type | Default | Description |
|
|
202
|
+
|---|---|---|---|
|
|
203
|
+
| `use24Hour` | `boolean \| 'auto'` | `'auto'` | 12h/24h clock; `'auto'` derives from locale |
|
|
204
|
+
|
|
205
|
+
### `CoarZonedDateTimeView`
|
|
206
|
+
|
|
207
|
+
Same as `CoarPlainDateTimeView` plus:
|
|
208
|
+
|
|
209
|
+
| Prop | Type | Default | Description |
|
|
210
|
+
|---|---|---|---|
|
|
211
|
+
| `displayTimeZone` | `string` | _value's own zone_ | IANA zone to project every value into |
|
|
212
|
+
| `showTimeZone` | `boolean` | `true` | Append the `GMT+1`-style zone label |
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<!-- Generated from apps/docs/components/dialog.md by apps/docs/scripts/sync-skill.mjs. Do not edit; edit the docs page. -->
|
|
2
|
+
|
|
3
|
+
# Dialog
|
|
4
|
+
|
|
5
|
+
Modal dialogs demand attention. They block interaction with the rest of the page until the user makes a decision, making them the right choice for destructive actions, important confirmations, and messages that must be acknowledged before proceeding. Use them sparingly -- when the stakes are high enough to justify interrupting the user's flow.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { useDialog } from '@cocoar/vue-ui';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Confirm Dialog
|
|
12
|
+
|
|
13
|
+
Use `dialog.confirm()` when you need an explicit yes-or-no decision before proceeding. The returned promise resolves with `true` (confirmed) or `false` / `undefined` (cancelled / dismissed).
|
|
14
|
+
|
|
15
|
+
**Demo — `dialog/demos/ConfirmDialog.vue`**
|
|
16
|
+
|
|
17
|
+
```vue
|
|
18
|
+
<template>
|
|
19
|
+
<div style="display: flex; flex-wrap: wrap; gap: 8px; align-items: center;">
|
|
20
|
+
<CoarButton variant="danger" icon-start="trash-2" @click="openConfirm">Delete Item</CoarButton>
|
|
21
|
+
<CoarButton variant="primary" @click="openConfirmPrimary">Publish Changes</CoarButton>
|
|
22
|
+
<CoarButton variant="secondary" @click="openLarge">Terms & Conditions</CoarButton>
|
|
23
|
+
</div>
|
|
24
|
+
<p style="margin-top: 8px; font-size: 13px; color: var(--coar-text-neutral-secondary);">
|
|
25
|
+
Last result: {{ lastResult || 'none' }}
|
|
26
|
+
</p>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script setup lang="ts">
|
|
30
|
+
import { ref } from 'vue';
|
|
31
|
+
import { CoarButton, useDialog } from '@cocoar/vue-ui';
|
|
32
|
+
|
|
33
|
+
const dialog = useDialog();
|
|
34
|
+
const lastResult = ref('');
|
|
35
|
+
|
|
36
|
+
function openConfirm() {
|
|
37
|
+
dialog.confirm({
|
|
38
|
+
title: 'Delete item?',
|
|
39
|
+
message: 'This action cannot be undone. Are you sure you want to delete this item?',
|
|
40
|
+
confirmText: 'Delete',
|
|
41
|
+
cancelText: 'Cancel',
|
|
42
|
+
confirmVariant: 'danger',
|
|
43
|
+
}).result.then((confirmed) => {
|
|
44
|
+
lastResult.value = confirmed ? 'deleted' : 'cancelled';
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function openConfirmPrimary() {
|
|
49
|
+
dialog.confirm({
|
|
50
|
+
title: 'Publish changes?',
|
|
51
|
+
message: 'This will make your changes visible to all users.',
|
|
52
|
+
confirmText: 'Publish',
|
|
53
|
+
cancelText: 'Not yet',
|
|
54
|
+
confirmVariant: 'primary',
|
|
55
|
+
}).result.then((confirmed) => {
|
|
56
|
+
lastResult.value = confirmed ? 'published' : 'kept draft';
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function openLarge() {
|
|
61
|
+
dialog.confirm({
|
|
62
|
+
title: 'Terms & Conditions',
|
|
63
|
+
message: 'By continuing, you agree to our Terms of Service and Privacy Policy. Please review the full terms before accepting. This agreement governs your use of the platform and all associated services.',
|
|
64
|
+
confirmText: 'I Agree',
|
|
65
|
+
cancelText: 'Decline',
|
|
66
|
+
size: 'm',
|
|
67
|
+
}).result.then((confirmed) => {
|
|
68
|
+
lastResult.value = confirmed ? 'agreed' : 'declined';
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
</script>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Alert Dialog
|
|
75
|
+
|
|
76
|
+
Use `dialog.alert()` for one-way messages that require acknowledgement -- session expirations, permission errors, or completion notices. The user can only dismiss it; there is no secondary action.
|
|
77
|
+
|
|
78
|
+
**Demo — `dialog/demos/AlertDialog.vue`**
|
|
79
|
+
|
|
80
|
+
```vue
|
|
81
|
+
<template>
|
|
82
|
+
<CoarButton variant="secondary" @click="openAlert">Show Alert</CoarButton>
|
|
83
|
+
</template>
|
|
84
|
+
|
|
85
|
+
<script setup lang="ts">
|
|
86
|
+
import { CoarButton, useDialog } from '@cocoar/vue-ui';
|
|
87
|
+
|
|
88
|
+
const dialog = useDialog();
|
|
89
|
+
|
|
90
|
+
function openAlert() {
|
|
91
|
+
dialog.alert('Session expired', 'Your session has expired. Please sign in again to continue.');
|
|
92
|
+
}
|
|
93
|
+
</script>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Setup
|
|
97
|
+
|
|
98
|
+
Register the overlay plugin once in your app entry point:
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
// main.ts
|
|
102
|
+
import { CoarOverlayPlugin } from '@cocoar/vue-ui';
|
|
103
|
+
|
|
104
|
+
createApp(App)
|
|
105
|
+
.use(CoarOverlayPlugin)
|
|
106
|
+
.mount('#app');
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
> **Warning: Dialog vs Popconfirm**
|
|
110
|
+
>
|
|
111
|
+
> Use **Dialog** for modal confirmations that block the entire UI. Use **Popconfirm** for lightweight inline confirmations anchored near the trigger element. Dialogs are appropriate for higher-stakes, less frequent actions.
|
|
112
|
+
|
|
113
|
+
## API
|
|
114
|
+
|
|
115
|
+
### `useDialog()` Methods
|
|
116
|
+
|
|
117
|
+
| Method | Parameters | Returns | Description |
|
|
118
|
+
|--------|-----------|---------|-------------|
|
|
119
|
+
| `dialog.confirm(options)` | `ConfirmOptions` | `DialogRef<boolean>` | Show a confirm/cancel dialog |
|
|
120
|
+
| `dialog.alert(title, message)` | `string, string` | `DialogRef<void>` | Show an acknowledgement dialog |
|
|
121
|
+
| `dialog.open(component, config?, props?)` | `Component, DialogConfig?, Record?` | `DialogRef<T>` | Open a custom component inside the dialog |
|
|
122
|
+
|
|
123
|
+
### `ConfirmOptions`
|
|
124
|
+
|
|
125
|
+
| Option | Type | Default | Description |
|
|
126
|
+
|--------|------|---------|-------------|
|
|
127
|
+
| `title` | `string` | — | Dialog title |
|
|
128
|
+
| `message` | `string` | — | Confirmation message body |
|
|
129
|
+
| `confirmText` | `string` | `'Confirm'` | Confirm button label |
|
|
130
|
+
| `cancelText` | `string` | `'Cancel'` | Cancel button label |
|
|
131
|
+
| `confirmVariant` | `'primary' \| 'danger'` | `'primary'` | Confirm button color variant |
|
|
132
|
+
| `size` | `'s' \| 'm' \| 'l'` | `'s'` | Dialog width |
|
|
133
|
+
|
|
134
|
+
### `DialogRef`
|
|
135
|
+
|
|
136
|
+
| Property | Type | Description |
|
|
137
|
+
|----------|------|-------------|
|
|
138
|
+
| `result` | `Promise<T \| undefined>` | Resolves when the dialog closes |
|
|
139
|
+
| `close(result?)` | `(val?: T) => void` | Programmatically close the dialog |
|
|
140
|
+
|
|
141
|
+
## i18n Keys
|
|
142
|
+
|
|
143
|
+
These keys can be translated via [`@cocoar/vue-localization`](../foundations/localization/translations.md).
|
|
144
|
+
|
|
145
|
+
| Key | Default (English) | Used as |
|
|
146
|
+
|-----|-------------------|---------|
|
|
147
|
+
| `coar.ui.dialog.close` | `'Close dialog'` | Close button `aria-label` |
|
|
148
|
+
| `coar.ui.dialog.dialog` | `'Dialog'` | Fallback dialog `aria-label` (when no title) |
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<!-- Generated from apps/docs/components/divider.md by apps/docs/scripts/sync-skill.mjs. Do not edit; edit the docs page. -->
|
|
2
|
+
|
|
3
|
+
# Divider
|
|
4
|
+
|
|
5
|
+
Dividers create clear visual breaks between sections of content. They're especially useful in forms, settings panels, and feeds where distinct groups of information sit close together. Add an optional text label to give the break semantic meaning.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { CoarDivider } from '@cocoar/vue-ui';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Divider
|
|
12
|
+
|
|
13
|
+
A clean horizontal line that separates content blocks. Drop it between any two sections to improve scannability.
|
|
14
|
+
|
|
15
|
+
**Demo — `divider/demos/DividerBasic.vue`**
|
|
16
|
+
|
|
17
|
+
```vue
|
|
18
|
+
<template>
|
|
19
|
+
<div>
|
|
20
|
+
<p style="margin: 0 0 8px; font-size: 14px;">Content above the divider</p>
|
|
21
|
+
<CoarDivider />
|
|
22
|
+
<p style="margin: 8px 0 0; font-size: 14px;">Content below the divider</p>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script setup lang="ts">
|
|
27
|
+
import { CoarDivider } from '@cocoar/vue-ui';
|
|
28
|
+
</script>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## With Content
|
|
32
|
+
|
|
33
|
+
Embed text directly in the divider line via the default slot -- common in forms ("or continue with") and settings pages.
|
|
34
|
+
|
|
35
|
+
**Demo — `divider/demos/DividerLabel.vue`**
|
|
36
|
+
|
|
37
|
+
```vue
|
|
38
|
+
<template>
|
|
39
|
+
<div style="display: flex; flex-direction: column; gap: 12px;">
|
|
40
|
+
<CoarDivider>Or continue with</CoarDivider>
|
|
41
|
+
<CoarDivider>Section Title</CoarDivider>
|
|
42
|
+
<CoarDivider>More options</CoarDivider>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script setup lang="ts">
|
|
47
|
+
import { CoarDivider } from '@cocoar/vue-ui';
|
|
48
|
+
</script>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Alignment
|
|
52
|
+
|
|
53
|
+
Position the content to the `left`, `center`, or `right` of the line to match your layout's reading flow.
|
|
54
|
+
|
|
55
|
+
**Demo — `divider/demos/DividerAlignment.vue`**
|
|
56
|
+
|
|
57
|
+
```vue
|
|
58
|
+
<template>
|
|
59
|
+
<div style="display: flex; flex-direction: column; gap: 12px;">
|
|
60
|
+
<CoarDivider align="left">Left</CoarDivider>
|
|
61
|
+
<CoarDivider align="center">Center (default)</CoarDivider>
|
|
62
|
+
<CoarDivider align="right">Right</CoarDivider>
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<script setup lang="ts">
|
|
67
|
+
import { CoarDivider } from '@cocoar/vue-ui';
|
|
68
|
+
</script>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Variants
|
|
72
|
+
|
|
73
|
+
Two visual weights: `subtle` (the default) for light separation within a card, and `strong` for more prominent visual breaks.
|
|
74
|
+
|
|
75
|
+
**Demo — `divider/demos/DividerVariants.vue`**
|
|
76
|
+
|
|
77
|
+
```vue
|
|
78
|
+
<template>
|
|
79
|
+
<div style="display: flex; flex-direction: column; gap: 12px;">
|
|
80
|
+
<CoarDivider>Subtle (default)</CoarDivider>
|
|
81
|
+
<CoarDivider variant="strong">Strong</CoarDivider>
|
|
82
|
+
</div>
|
|
83
|
+
</template>
|
|
84
|
+
|
|
85
|
+
<script setup lang="ts">
|
|
86
|
+
import { CoarDivider } from '@cocoar/vue-ui';
|
|
87
|
+
</script>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Real-world Usage
|
|
91
|
+
|
|
92
|
+
A classic login form pattern where a labeled divider separates OAuth sign-in buttons from the traditional email/password fields.
|
|
93
|
+
|
|
94
|
+
**Demo — `divider/demos/DividerRealWorld.vue`**
|
|
95
|
+
|
|
96
|
+
```vue
|
|
97
|
+
<template>
|
|
98
|
+
<div style="display: flex; flex-direction: column; gap: 8px; max-width: 360px;">
|
|
99
|
+
<button class="oauth-btn">Continue with Google</button>
|
|
100
|
+
<button class="oauth-btn">Continue with GitHub</button>
|
|
101
|
+
<CoarDivider>or sign in with email</CoarDivider>
|
|
102
|
+
<div style="display: flex; flex-direction: column; gap: 4px;">
|
|
103
|
+
<label style="font-size: 14px;">Email</label>
|
|
104
|
+
<input type="email" placeholder="you@example.com" class="native-input" />
|
|
105
|
+
</div>
|
|
106
|
+
<div style="display: flex; flex-direction: column; gap: 4px;">
|
|
107
|
+
<label style="font-size: 14px;">Password</label>
|
|
108
|
+
<input type="password" placeholder="••••••••" class="native-input" />
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</template>
|
|
112
|
+
|
|
113
|
+
<script setup lang="ts">
|
|
114
|
+
import { CoarDivider } from '@cocoar/vue-ui';
|
|
115
|
+
</script>
|
|
116
|
+
|
|
117
|
+
<style scoped>
|
|
118
|
+
.oauth-btn {
|
|
119
|
+
padding: 8px 16px;
|
|
120
|
+
border: 1px solid var(--coar-border-neutral-secondary);
|
|
121
|
+
border-radius: 6px;
|
|
122
|
+
background: var(--coar-background-neutral-primary);
|
|
123
|
+
color: var(--coar-text-neutral-primary);
|
|
124
|
+
font-size: 14px;
|
|
125
|
+
cursor: pointer;
|
|
126
|
+
}
|
|
127
|
+
.oauth-btn:hover {
|
|
128
|
+
background: var(--coar-background-neutral-tertiary);
|
|
129
|
+
}
|
|
130
|
+
.native-input {
|
|
131
|
+
padding: 6px 10px;
|
|
132
|
+
border: 1px solid var(--coar-border-neutral-secondary);
|
|
133
|
+
border-radius: 6px;
|
|
134
|
+
background: var(--coar-background-neutral-primary);
|
|
135
|
+
color: var(--coar-text-neutral-primary);
|
|
136
|
+
font-size: 14px;
|
|
137
|
+
}
|
|
138
|
+
</style>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## API
|
|
142
|
+
|
|
143
|
+
### Props
|
|
144
|
+
|
|
145
|
+
| Prop | Type | Default | Description |
|
|
146
|
+
|------|------|---------|-------------|
|
|
147
|
+
| `align` | `'left' \| 'center' \| 'right'` | `'center'` | Content alignment |
|
|
148
|
+
| `variant` | `'subtle' \| 'strong'` | `'subtle'` | Line visual weight |
|
|
149
|
+
| `width` | `number` | `90` | Divider width as a percentage (0–100) |
|
|
150
|
+
| `spacingTop` | `number` | `0` | Top spacing in pixels |
|
|
151
|
+
| `spacingBottom` | `number` | `0` | Bottom spacing in pixels |
|
|
152
|
+
|
|
153
|
+
### Slots
|
|
154
|
+
|
|
155
|
+
| Slot | Description |
|
|
156
|
+
|------|-------------|
|
|
157
|
+
| `default` | Optional content displayed centered on the line |
|