@cocoar/vue-ui 3.4.0-beta.8 → 4.0.0-beta.44
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/compact-fonts.d.ts +1 -0
- package/dist/compact-fonts.d.ts.map +1 -0
- package/dist/compact-fonts.js +4 -0
- package/dist/components/_internal/keyboardInset.d.ts +9 -0
- package/dist/components/_internal/keyboardInset.d.ts.map +1 -0
- package/dist/components/_internal/pageScrollLock.d.ts +17 -0
- package/dist/components/_internal/pageScrollLock.d.ts.map +1 -0
- package/dist/components/_internal/useFocusTrap.d.ts +9 -0
- package/dist/components/_internal/useFocusTrap.d.ts.map +1 -0
- package/dist/components/_internal/useVisualViewport.d.ts +26 -0
- package/dist/components/_internal/useVisualViewport.d.ts.map +1 -0
- package/dist/components/badge/CoarBadge.vue.d.ts.map +1 -1
- package/dist/components/card/CoarCard.vue.d.ts.map +1 -1
- package/dist/components/checkbox/CoarCheckbox.vue.d.ts +2 -2
- 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.map +1 -1
- package/dist/components/date-time/_shared/use-plain-date-picker.d.ts +95 -0
- package/dist/components/date-time/_shared/use-plain-date-picker.d.ts.map +1 -0
- package/dist/components/date-time/_shared/use-plain-date-time-picker.d.ts +113 -0
- package/dist/components/date-time/_shared/use-plain-date-time-picker.d.ts.map +1 -0
- package/dist/components/date-time/_shared/use-zoned-date-time-picker.d.ts +132 -0
- package/dist/components/date-time/_shared/use-zoned-date-time-picker.d.ts.map +1 -0
- package/dist/components/date-time/plain-date-picker/CoarPlainDatePicker.vue.d.ts +23 -6
- package/dist/components/date-time/plain-date-picker/CoarPlainDatePicker.vue.d.ts.map +1 -1
- package/dist/components/date-time/plain-date-time-or-date-picker/CoarPlainDateTimeOrDatePicker.vue.d.ts +4 -0
- package/dist/components/date-time/plain-date-time-or-date-picker/CoarPlainDateTimeOrDatePicker.vue.d.ts.map +1 -1
- package/dist/components/date-time/plain-date-time-picker/CoarPlainDateTimePicker.vue.d.ts +23 -6
- package/dist/components/date-time/plain-date-time-picker/CoarPlainDateTimePicker.vue.d.ts.map +1 -1
- package/dist/components/date-time/scrollable-calendar/CoarScrollableCalendar.vue.d.ts.map +1 -1
- package/dist/components/date-time/time-picker/CoarTimePicker.vue.d.ts.map +1 -1
- package/dist/components/date-time/zoned-date-time-or-date-picker/CoarZonedDateTimeOrDatePicker.vue.d.ts +4 -0
- package/dist/components/date-time/zoned-date-time-or-date-picker/CoarZonedDateTimeOrDatePicker.vue.d.ts.map +1 -1
- package/dist/components/date-time/zoned-date-time-picker/CoarZonedDateTimePicker.vue.d.ts +23 -6
- package/dist/components/date-time/zoned-date-time-picker/CoarZonedDateTimePicker.vue.d.ts.map +1 -1
- package/dist/components/date-time/zoned-date-time-picker/CoarZonedDateTimePickerPanel.vue.d.ts.map +1 -1
- package/dist/components/dialog/CoarDialogFooter.vue.d.ts +20 -0
- package/dist/components/dialog/CoarDialogFooter.vue.d.ts.map +1 -0
- package/dist/components/dialog/CoarDialogShell.vue.d.ts +2 -0
- package/dist/components/dialog/CoarDialogShell.vue.d.ts.map +1 -1
- package/dist/components/dialog/CoarSheetShell.vue.d.ts +50 -0
- package/dist/components/dialog/CoarSheetShell.vue.d.ts.map +1 -0
- package/dist/components/dialog/dialog-types.d.ts +27 -0
- package/dist/components/dialog/dialog-types.d.ts.map +1 -1
- package/dist/components/dialog/dialogFooter.d.ts +21 -0
- package/dist/components/dialog/dialogFooter.d.ts.map +1 -0
- package/dist/components/dialog/index.d.ts +2 -1
- package/dist/components/dialog/index.d.ts.map +1 -1
- package/dist/components/dialog/useDialog.d.ts +6 -15
- package/dist/components/dialog/useDialog.d.ts.map +1 -1
- package/dist/components/dialog/useSheetDrag.d.ts +46 -0
- package/dist/components/dialog/useSheetDrag.d.ts.map +1 -0
- package/dist/components/form-field/CoarFormField.vue.d.ts +2 -2
- package/dist/components/form-field/CoarFormField.vue.d.ts.map +1 -1
- package/dist/components/form-field/constants.d.ts +6 -0
- package/dist/components/form-field/constants.d.ts.map +1 -1
- package/dist/components/icon/CoarIcon.vue.d.ts +3 -3
- package/dist/components/icon/CoarIcon.vue.d.ts.map +1 -1
- package/dist/components/icon/core-icons.d.ts +2 -0
- package/dist/components/icon/core-icons.d.ts.map +1 -1
- package/dist/components/input-frame/CoarInputFrame.vue.d.ts +17 -6
- package/dist/components/input-frame/CoarInputFrame.vue.d.ts.map +1 -1
- package/dist/components/input-frame/CoarInputFrameButton.vue.d.ts.map +1 -1
- package/dist/components/input-frame/types.d.ts +9 -0
- package/dist/components/input-frame/types.d.ts.map +1 -0
- package/dist/components/listbox/CoarListbox.vue.d.ts.map +1 -1
- package/dist/components/menu/CoarContextMenu.vue.d.ts.map +1 -1
- package/dist/components/menu/CoarMenuItem.vue.d.ts.map +1 -1
- package/dist/components/menu/CoarSubExpand.vue.d.ts.map +1 -1
- package/dist/components/menu/CoarSubFlyout.vue.d.ts.map +1 -1
- package/dist/components/menu/useContextMenu.d.ts +7 -20
- package/dist/components/menu/useContextMenu.d.ts.map +1 -1
- package/dist/components/number-input/CoarNumberInput.vue.d.ts +16 -1
- package/dist/components/number-input/CoarNumberInput.vue.d.ts.map +1 -1
- package/dist/components/otp-input/CoarOtpInput.vue.d.ts +2 -2
- package/dist/components/otp-input/CoarOtpInput.vue.d.ts.map +1 -1
- package/dist/components/overlay/CoarOverlayOutlet.vue.d.ts.map +1 -1
- package/dist/components/overlay/compact-context.d.ts +10 -0
- package/dist/components/overlay/compact-context.d.ts.map +1 -0
- package/dist/components/overlay/index.d.ts +3 -1
- package/dist/components/overlay/index.d.ts.map +1 -1
- package/dist/components/overlay/overlay-presets.d.ts +9 -0
- package/dist/components/overlay/overlay-presets.d.ts.map +1 -1
- package/dist/components/overlay/overlay-service.d.ts +12 -0
- package/dist/components/overlay/overlay-service.d.ts.map +1 -1
- package/dist/components/overlay/overlay-types.d.ts +6 -0
- package/dist/components/overlay/overlay-types.d.ts.map +1 -1
- package/dist/components/overlay/useCompactPresentationContext.d.ts +33 -0
- package/dist/components/overlay/useCompactPresentationContext.d.ts.map +1 -0
- package/dist/components/pagination/CoarPagination.vue.d.ts.map +1 -1
- package/dist/components/panel-layout/internal/CoarPaneDivider.vue.d.ts.map +1 -1
- package/dist/components/password-input/CoarPasswordInput.vue.d.ts +5 -1
- package/dist/components/password-input/CoarPasswordInput.vue.d.ts.map +1 -1
- package/dist/components/scrollbar/index.d.ts +1 -1
- package/dist/components/scrollbar/index.d.ts.map +1 -1
- package/dist/components/scrollbar/vScrollbar.d.ts +9 -0
- package/dist/components/scrollbar/vScrollbar.d.ts.map +1 -1
- package/dist/components/segmented-control/CoarSegmentedControl.vue.d.ts.map +1 -1
- package/dist/components/select/CoarMultiSelect.vue.d.ts.map +1 -1
- package/dist/components/select/CoarMultiSelectDropdownPanel.vue.d.ts.map +1 -1
- package/dist/components/select/CoarSelect.vue.d.ts +17 -3
- package/dist/components/select/CoarSelect.vue.d.ts.map +1 -1
- package/dist/components/select/CoarSelectDropdownPanel.vue.d.ts +7 -4
- package/dist/components/select/CoarSelectDropdownPanel.vue.d.ts.map +1 -1
- package/dist/components/select/CoarTagSelect.vue.d.ts.map +1 -1
- package/dist/components/select/CoarTagSelectDropdownPanel.vue.d.ts.map +1 -1
- package/dist/components/select/index.d.ts +1 -1
- package/dist/components/select/index.d.ts.map +1 -1
- package/dist/components/select/types.d.ts +13 -0
- package/dist/components/select/types.d.ts.map +1 -1
- package/dist/components/select/useSelectBase.d.ts +2 -1
- package/dist/components/select/useSelectBase.d.ts.map +1 -1
- package/dist/components/sidebar/CoarSidebarGroup.vue.d.ts.map +1 -1
- package/dist/components/switch/CoarSwitch.vue.d.ts +2 -2
- package/dist/components/switch/CoarSwitch.vue.d.ts.map +1 -1
- package/dist/components/tabs/CoarTabGroup.vue.d.ts.map +1 -1
- package/dist/components/tag/CoarTag.vue.d.ts.map +1 -1
- package/dist/components/text-input/CoarTextInput.vue.d.ts +16 -2
- package/dist/components/text-input/CoarTextInput.vue.d.ts.map +1 -1
- package/dist/components/theme-editor/CoarPaletteEditor.vue.d.ts +8 -2
- package/dist/components/theme-editor/CoarPaletteEditor.vue.d.ts.map +1 -1
- package/dist/components/theme-editor/color-preview.d.ts +22 -0
- package/dist/components/theme-editor/color-preview.d.ts.map +1 -0
- package/dist/components/theme-editor/font-preview.d.ts +46 -0
- package/dist/components/theme-editor/font-preview.d.ts.map +1 -0
- package/dist/components/theme-editor/scheme-values.d.ts +12 -0
- package/dist/components/theme-editor/scheme-values.d.ts.map +1 -0
- package/dist/components/theme-editor/theme-editor-state.d.ts +199 -183
- package/dist/components/theme-editor/theme-editor-state.d.ts.map +1 -1
- package/dist/components/theme-scope/CoarThemeScope.vue.d.ts.map +1 -1
- package/dist/components/tree/CoarTreeNode.vue.d.ts.map +1 -1
- package/dist/composables/useDragDrop.d.ts.map +1 -1
- package/dist/composables/useDragImage.d.ts +2 -14
- package/dist/composables/useDragImage.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6768 -4523
- package/dist/onest-fonts.d.ts +1 -0
- package/dist/onest-fonts.d.ts.map +1 -0
- package/dist/onest-fonts.js +4 -0
- package/dist/theme/color-contrast.d.ts +10 -0
- package/dist/theme/color-contrast.d.ts.map +1 -0
- package/dist/theme/compact-packages/calendar.d.ts +8 -0
- package/dist/theme/compact-packages/calendar.d.ts.map +1 -0
- package/dist/theme/compact-packages/data-grid.d.ts +8 -0
- package/dist/theme/compact-packages/data-grid.d.ts.map +1 -0
- package/dist/theme/compact-packages/document-viewer.d.ts +8 -0
- package/dist/theme/compact-packages/document-viewer.d.ts.map +1 -0
- package/dist/theme/compact-packages/map.d.ts +11 -0
- package/dist/theme/compact-packages/map.d.ts.map +1 -0
- package/dist/theme/compact-packages/markdown-editor.d.ts +8 -0
- package/dist/theme/compact-packages/markdown-editor.d.ts.map +1 -0
- package/dist/theme/compact-packages/markdown.d.ts +14 -0
- package/dist/theme/compact-packages/markdown.d.ts.map +1 -0
- package/dist/theme/compact-packages/mermaid.d.ts +8 -0
- package/dist/theme/compact-packages/mermaid.d.ts.map +1 -0
- package/dist/theme/compact-packages/page-builder.d.ts +8 -0
- package/dist/theme/compact-packages/page-builder.d.ts.map +1 -0
- package/dist/theme/compact-packages/script-editor.d.ts +8 -0
- package/dist/theme/compact-packages/script-editor.d.ts.map +1 -0
- package/dist/theme/compact-theme.d.ts +11 -0
- package/dist/theme/compact-theme.d.ts.map +1 -0
- package/dist/theme/enterprise-packages/calendar.d.ts +3 -0
- package/dist/theme/enterprise-packages/calendar.d.ts.map +1 -0
- package/dist/theme/enterprise-packages/document-viewer.d.ts +3 -0
- package/dist/theme/enterprise-packages/document-viewer.d.ts.map +1 -0
- package/dist/theme/enterprise-packages/map.d.ts +3 -0
- package/dist/theme/enterprise-packages/map.d.ts.map +1 -0
- package/dist/theme/enterprise-packages/markdown.d.ts +7 -0
- package/dist/theme/enterprise-packages/markdown.d.ts.map +1 -0
- package/dist/theme/enterprise-packages/mermaid.d.ts +3 -0
- package/dist/theme/enterprise-packages/mermaid.d.ts.map +1 -0
- package/dist/theme/enterprise-packages/page-builder.d.ts +3 -0
- package/dist/theme/enterprise-packages/page-builder.d.ts.map +1 -0
- package/dist/theme/enterprise-packages/script-editor.d.ts +7 -0
- package/dist/theme/enterprise-packages/script-editor.d.ts.map +1 -0
- package/dist/theme/enterprise-theme.d.ts +8 -0
- package/dist/theme/enterprise-theme.d.ts.map +1 -0
- package/dist/theme/palette-inputs.d.ts +34 -0
- package/dist/theme/palette-inputs.d.ts.map +1 -0
- package/dist/theme/role-derived-tokens.d.ts +3 -0
- package/dist/theme/role-derived-tokens.d.ts.map +1 -0
- package/dist/theme/role-input-defaults.d.ts +5 -0
- package/dist/theme/role-input-defaults.d.ts.map +1 -0
- package/dist/theme/role-theme-contract.d.ts +8 -0
- package/dist/theme/role-theme-contract.d.ts.map +1 -0
- package/dist/theme/role-theme.d.ts +40 -0
- package/dist/theme/role-theme.d.ts.map +1 -0
- package/package.json +15 -4
- package/skills/cocoar-vue-ui/SKILL.md +8 -1
- package/skills/cocoar-vue-ui/references/components/calendar/board.md +212 -0
- package/skills/cocoar-vue-ui/references/components/calendar/coar-calendar.md +32 -1
- package/skills/cocoar-vue-ui/references/components/calendar/day-view.md +21 -0
- package/skills/cocoar-vue-ui/references/components/calendar/index.md +26 -1
- package/skills/cocoar-vue-ui/references/components/calendar/mini-month.md +59 -0
- package/skills/cocoar-vue-ui/references/components/calendar/month-view.md +48 -1
- package/skills/cocoar-vue-ui/references/components/context-menu.md +1 -0
- package/skills/cocoar-vue-ui/references/components/data-grid.md +4 -0
- package/skills/cocoar-vue-ui/references/components/date-or-time-picker.md +30 -1
- package/skills/cocoar-vue-ui/references/components/date-picker.md +32 -1
- package/skills/cocoar-vue-ui/references/components/date-time-picker.md +28 -1
- package/skills/cocoar-vue-ui/references/components/dialog.md +188 -2
- package/skills/cocoar-vue-ui/references/components/document-viewer/coar-document-viewer.md +4 -0
- package/skills/cocoar-vue-ui/references/components/form-field.md +10 -6
- package/skills/cocoar-vue-ui/references/components/listbox.md +3 -1
- package/skills/cocoar-vue-ui/references/components/map/index.md +5 -1
- package/skills/cocoar-vue-ui/references/components/markdown-editor.md +10 -0
- package/skills/cocoar-vue-ui/references/components/markdown-form.md +9 -0
- package/skills/cocoar-vue-ui/references/components/markdown.md +10 -0
- package/skills/cocoar-vue-ui/references/components/menu.md +1 -1
- package/skills/cocoar-vue-ui/references/components/mermaid.md +11 -0
- package/skills/cocoar-vue-ui/references/components/number-input.md +81 -0
- package/skills/cocoar-vue-ui/references/components/object-editor.md +737 -0
- package/skills/cocoar-vue-ui/references/components/otp-input.md +1 -1
- package/skills/cocoar-vue-ui/references/components/pagination.md +1 -1
- package/skills/cocoar-vue-ui/references/components/password-input.md +32 -0
- package/skills/cocoar-vue-ui/references/components/script-editor.md +10 -0
- package/skills/cocoar-vue-ui/references/components/segmented-control.md +1 -1
- package/skills/cocoar-vue-ui/references/components/select.md +136 -2
- package/skills/cocoar-vue-ui/references/components/tabs.md +1 -1
- package/skills/cocoar-vue-ui/references/components/tag.md +1 -1
- package/skills/cocoar-vue-ui/references/components/text-input.md +189 -0
- package/skills/cocoar-vue-ui/references/components/zoned-date-time-picker.md +42 -1
- package/skills/cocoar-vue-ui/references/foundations/colors.md +32 -3
- package/skills/cocoar-vue-ui/references/foundations/compact-presentation.md +248 -0
- package/skills/cocoar-vue-ui/references/foundations/theming.md +98 -11
- package/skills/cocoar-vue-ui/references/foundations/typography.md +3 -0
- package/skills/cocoar-vue-ui/references/guide/getting-started.md +2 -2
- package/skills/cocoar-vue-ui/references/guide/migration-color-roles.md +28 -0
- package/skills/cocoar-vue-ui/references/guide/migration-object-editor-values.md +40 -0
- package/skills/cocoar-vue-ui/references/guide/mobile.md +126 -27
- package/skills/cocoar-vue-ui/references/guide/theming.md +25 -0
- package/styles/tokens/all.css +6 -0
- package/styles/tokens/code-block.css +2 -2
- package/styles/tokens/colors-primitives-dark.css +50 -50
- package/styles/tokens/colors-primitives-light.css +50 -50
- package/styles/tokens/colors-usage.css +132 -111
- package/styles/tokens/compact.css +4442 -0
- package/styles/tokens/components-shared.css +4 -4
- package/styles/tokens/derived.css +525 -0
- package/styles/tokens/menu.css +21 -21
- package/styles/tokens/mobile.css +2 -0
- package/styles/tokens/new-components.css +42 -33
- package/styles/tokens/select-overlay.css +12 -12
- package/styles/tokens/sidebar.css +12 -12
- package/styles/tokens/theme-none.css +99 -93
- package/styles/tokens/tooltip.css +4 -4
- package/styles/tokens/typography.css +19 -19
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# DateTime Picker
|
|
4
4
|
|
|
5
|
-
**Devices:** desktop ready · tablet ready · phone
|
|
5
|
+
**Devices:** desktop ready · tablet ready · phone partial — Mobile field sizes under .coar-mobile (Preview); the panel keeps its desktop layout, a phone sheet is planned.
|
|
6
6
|
|
|
7
7
|
Combines a calendar date picker with a time input and returns a `Temporal.PlainDateTime` -- a date and time without any timezone attached. Use this when the timezone is implicit (the user's local time) or irrelevant (an alarm, a reminder). If you need timezone awareness, reach for the [Zoned DateTime Picker](./zoned-date-time-picker.md) instead.
|
|
8
8
|
|
|
@@ -100,6 +100,31 @@ import { CoarPlainDateTimePicker, CoarFormField } from '@cocoar/vue-ui';
|
|
|
100
100
|
>
|
|
101
101
|
> **PlainDateTime vs ZonedDateTime:** Choose `PlainDateTime` when the timezone is always the user's local time or when it simply does not matter (alarm clocks, recurring events). Choose `ZonedDateTime` when you need to pin a specific instant in time and derive UTC for storage or sharing across timezones.
|
|
102
102
|
|
|
103
|
+
## Inline (Preview) {#inline}
|
|
104
|
+
|
|
105
|
+
`appearance` and `width` work as on the [Date Picker](./date-picker.md#inline): only the date and time show
|
|
106
|
+
until the field is hovered, edited or its panel is open, and `width="content"` fits the field to them.
|
|
107
|
+
|
|
108
|
+
**Demo — `date-time-picker/demos/DateTimePickerInline.vue`**
|
|
109
|
+
|
|
110
|
+
```vue
|
|
111
|
+
<template>
|
|
112
|
+
<p style="margin: 0; line-height: 2.4;">
|
|
113
|
+
Reminder on
|
|
114
|
+
<CoarPlainDateTimePicker v-model="at" appearance="inline" width="content" />
|
|
115
|
+
for the whole team.
|
|
116
|
+
</p>
|
|
117
|
+
</template>
|
|
118
|
+
|
|
119
|
+
<script setup lang="ts">
|
|
120
|
+
import { ref } from 'vue';
|
|
121
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
122
|
+
import { CoarPlainDateTimePicker } from '@cocoar/vue-ui';
|
|
123
|
+
|
|
124
|
+
const at = ref<Temporal.PlainDateTime | null>(Temporal.PlainDateTime.from('2026-12-01T09:30'));
|
|
125
|
+
</script>
|
|
126
|
+
```
|
|
127
|
+
|
|
103
128
|
## Accessibility
|
|
104
129
|
|
|
105
130
|
### Keyboard Navigation
|
|
@@ -147,6 +172,8 @@ These keys can be translated via [`@cocoar/vue-localization`](../foundations/loc
|
|
|
147
172
|
| `v-model` | `Temporal.PlainDateTime \| null` | `null` | Selected date+time |
|
|
148
173
|
| `placeholder` | `string` | `''` | Placeholder text |
|
|
149
174
|
| `size` | `'xs' \| 's' \| 'm' \| 'l'` | `'m'` | Input size |
|
|
175
|
+
| `appearance` (Preview) | `'outline' \| 'inline'` | `'outline'` | `inline`: no border or surface until hovered or edited, see [Inline](#inline) |
|
|
176
|
+
| `width` (Preview) | `'fill' \| 'content'` | `'fill'` | `content`: as wide as the shown value or placeholder |
|
|
150
177
|
| `disabled` | `boolean` | `false` | Disable the picker |
|
|
151
178
|
| `readonly` | `boolean` | `false` | Make read-only |
|
|
152
179
|
| `required` | `boolean` | `false` | Mark as required |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Dialog
|
|
4
4
|
|
|
5
|
-
**Devices:** desktop ready · tablet ready · phone
|
|
5
|
+
**Devices:** desktop ready · tablet ready · phone partial — Phone: use the bottom sheet (Preview); overlay-keyboard hosts need a native inset adapter. Android's back button does not close it.
|
|
6
6
|
|
|
7
7
|
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.
|
|
8
8
|
|
|
@@ -95,6 +95,163 @@ function openAlert() {
|
|
|
95
95
|
</script>
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
+
## Bottom sheet (Preview) {#sheet}
|
|
99
|
+
|
|
100
|
+
With `presentation: 'sheet'` a dialog opens as a sheet docked to the bottom of the screen,
|
|
101
|
+
closer to the thumb on a phone. It works for `open`, `confirm` and `alert`:
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
dialog.open(EditContact, { title: 'Contact', presentation: 'sheet' });
|
|
105
|
+
dialog.confirm({ title: 'Delete the entry?', message: '…', confirmVariant: 'danger', presentation: 'sheet' });
|
|
106
|
+
dialog.alert('Saved', '…', { presentation: 'sheet' });
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Demo — `dialog/demos/SheetDialog.vue`**
|
|
110
|
+
|
|
111
|
+
```vue
|
|
112
|
+
<template>
|
|
113
|
+
<div style="display: flex; flex-wrap: wrap; gap: 8px; align-items: center;">
|
|
114
|
+
<CoarButton variant="danger" icon-start="trash-2" @click="confirmDelete">Delete as sheet</CoarButton>
|
|
115
|
+
<CoarButton variant="secondary" @click="editContact">Edit contact as sheet</CoarButton>
|
|
116
|
+
</div>
|
|
117
|
+
<p style="margin-top: 8px; font-size: 13px; color: var(--coar-text-neutral-secondary);">
|
|
118
|
+
Last result: {{ lastResult || 'none' }}
|
|
119
|
+
</p>
|
|
120
|
+
</template>
|
|
121
|
+
|
|
122
|
+
<script setup lang="ts">
|
|
123
|
+
import { defineComponent, h, ref } from 'vue';
|
|
124
|
+
import { CoarButton, CoarDialogFooter, CoarFormField, CoarTextInput, useDialog } from '@cocoar/vue-ui';
|
|
125
|
+
|
|
126
|
+
const dialog = useDialog();
|
|
127
|
+
const lastResult = ref('');
|
|
128
|
+
|
|
129
|
+
function confirmDelete() {
|
|
130
|
+
dialog.confirm({
|
|
131
|
+
title: 'Delete item?',
|
|
132
|
+
message: 'This action cannot be undone.',
|
|
133
|
+
confirmText: 'Delete',
|
|
134
|
+
cancelText: 'Keep',
|
|
135
|
+
confirmVariant: 'danger',
|
|
136
|
+
presentation: 'sheet',
|
|
137
|
+
}).result.then((confirmed) => {
|
|
138
|
+
lastResult.value = confirmed ? 'deleted' : 'kept';
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// The body of the form sheet. In an app this is usually an SFC of its own; its buttons go into
|
|
143
|
+
// <CoarDialogFooter> so they stay in the sheet's fixed footer while the fields scroll.
|
|
144
|
+
const ContactForm = defineComponent({
|
|
145
|
+
props: { close: { type: Function, required: true } },
|
|
146
|
+
setup(props) {
|
|
147
|
+
const name = ref('Anna Berger');
|
|
148
|
+
const email = ref('anna@example.com');
|
|
149
|
+
const phone = ref('+43 1 234 567');
|
|
150
|
+
const field = (label: string, model: typeof name) =>
|
|
151
|
+
h(CoarFormField, { label }, () =>
|
|
152
|
+
h(CoarTextInput, { modelValue: model.value, 'onUpdate:modelValue': (v: string) => (model.value = v) }),
|
|
153
|
+
);
|
|
154
|
+
return () =>
|
|
155
|
+
h('div', { style: 'display: grid; gap: 16px;' }, [
|
|
156
|
+
field('Name', name),
|
|
157
|
+
field('E-mail', email),
|
|
158
|
+
field('Phone', phone),
|
|
159
|
+
h(CoarDialogFooter, null, () => [
|
|
160
|
+
h(CoarButton, { variant: 'secondary', onClick: () => props.close() }, () => 'Cancel'),
|
|
161
|
+
h(CoarButton, { onClick: () => props.close(name.value) }, () => 'Save'),
|
|
162
|
+
]),
|
|
163
|
+
]);
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
function editContact() {
|
|
168
|
+
dialog.open<string>(ContactForm, { title: 'Edit contact', presentation: 'sheet' }).result.then((saved) => {
|
|
169
|
+
lastResult.value = saved ? `saved ${saved}` : 'cancelled';
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
</script>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
In phone size, with a form longer than the screen:
|
|
176
|
+
|
|
177
|
+
Live demo in phone size: [Dialogs as bottom sheets](https://docs.cocoar.dev/cocoar-ui-vue/mobile/#/sheet)
|
|
178
|
+
|
|
179
|
+
The presentation is chosen per call and never derived from `coar-mobile` or the window
|
|
180
|
+
width: without `presentation` a dialog stays the centered dialog. Under `coar-mobile` the
|
|
181
|
+
sheet's buttons and fields get the mobile sizes, like any other overlay.
|
|
182
|
+
|
|
183
|
+
What the sheet does:
|
|
184
|
+
|
|
185
|
+
- **Layout**: full width, rounded top corners, as high as its content and at most the visible
|
|
186
|
+
height minus the top safe-area inset (`env(safe-area-inset-top)`) and a 24 px gap, keeping
|
|
187
|
+
the handle and close button below the system bar. From a 640 px wide window on it keeps
|
|
188
|
+
the width of its `size`, centered. A drag handle and the header (title, close button) on top;
|
|
189
|
+
the content scrolls inside; the footer stays put. If a landscape keyboard leaves too little
|
|
190
|
+
height for the header, footer and a field, the whole sheet scrolls instead: fields and
|
|
191
|
+
buttons remain reachable rather than being clipped. The fixed footer returns when space allows.
|
|
192
|
+
- **Buttons**: the footer buttons span the full width, stacked with the confirming one on top,
|
|
193
|
+
clear of the home indicator (`env(safe-area-inset-bottom)`).
|
|
194
|
+
- **On-screen keyboard**: the sheet follows `window.visualViewport`. It sits above the keyboard,
|
|
195
|
+
shrinks with it, and the focused field is scrolled into the visible part. Native hosts whose
|
|
196
|
+
overlay keyboard leaves the viewport unchanged report its occlusion as described below.
|
|
197
|
+
- **Page behind**: does not scroll while a sheet is open. The centered dialog does not lock the
|
|
198
|
+
page.
|
|
199
|
+
- **Closing**: the close button, a tap on the backdrop, Escape, and dragging down — the same
|
|
200
|
+
switches as the dialog (`closeOnBackdropClick`, `closeOnEscape`, `showCloseButton`) plus
|
|
201
|
+
`dragToClose`.
|
|
202
|
+
- **Drag**: only at the handle and the header, with finger, pen or mouse. Released after more
|
|
203
|
+
than 30 % of its height or with a flick down, it closes; otherwise it springs back. Dragging
|
|
204
|
+
the content scrolls it and never closes the sheet.
|
|
205
|
+
- **Focus**: trapped inside and returned on close, `role="dialog"` with `aria-modal`, as in the
|
|
206
|
+
dialog. It slides in from below, without animation under `prefers-reduced-motion`.
|
|
207
|
+
|
|
208
|
+
### Native overlay keyboards (Preview)
|
|
209
|
+
|
|
210
|
+
For a browser or a WebView that resizes above the keyboard, no adapter is needed. A native
|
|
211
|
+
host that draws its keyboard **over** an unchanged page calls `setCoarKeyboardInset()` from
|
|
212
|
+
its own keyboard listener:
|
|
213
|
+
|
|
214
|
+
```ts
|
|
215
|
+
import { setCoarKeyboardInset } from '@cocoar/vue-ui';
|
|
216
|
+
|
|
217
|
+
// The part of the current layout viewport covered at its bottom, in CSS pixels.
|
|
218
|
+
setCoarKeyboardInset(328);
|
|
219
|
+
// On dismissal, when the WebView resizes clear of the keyboard, or on adapter cleanup:
|
|
220
|
+
setCoarKeyboardInset(0);
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
The value is not a device-pixel height or an extra padding token. Convert the native
|
|
224
|
+
keyboard rectangle to the WebView's CSS coordinates and report only its overlap with the
|
|
225
|
+
bottom of the **current** layout viewport. A resized WebView has no overlap: report 0.
|
|
226
|
+
Update it on keyboard and orientation changes, including when no sheet is open. The
|
|
227
|
+
current value also applies to sheets opened later. Insets must be finite and non-negative;
|
|
228
|
+
invalid values throw `RangeError`. Browser and native occlusion are combined, not added,
|
|
229
|
+
so a shrinking visual viewport is not counted twice. Pinch zoom keeps the CSS-only layout.
|
|
230
|
+
The library has no dependency on a particular host or native bridge.
|
|
231
|
+
|
|
232
|
+
### `CoarDialogFooter` (Preview)
|
|
233
|
+
|
|
234
|
+
The buttons of a body component opened with `dialog.open()` go into `<CoarDialogFooter>`. It
|
|
235
|
+
moves them into the fixed footer of the dialog or sheet, so they stay visible while the content
|
|
236
|
+
scrolls; in a sheet they get the full width and the safe-area spacing of the confirm buttons.
|
|
237
|
+
Put the confirming button last. Outside a dialog or sheet it renders its content in place.
|
|
238
|
+
|
|
239
|
+
```vue
|
|
240
|
+
<script setup lang="ts">
|
|
241
|
+
import { CoarButton, CoarDialogFooter } from '@cocoar/vue-ui';
|
|
242
|
+
|
|
243
|
+
const props = defineProps<{ close: (result?: string) => void }>();
|
|
244
|
+
</script>
|
|
245
|
+
|
|
246
|
+
<template>
|
|
247
|
+
<!-- fields … -->
|
|
248
|
+
<CoarDialogFooter>
|
|
249
|
+
<CoarButton variant="secondary" @click="props.close()">Cancel</CoarButton>
|
|
250
|
+
<CoarButton @click="props.close('saved')">Save</CoarButton>
|
|
251
|
+
</CoarDialogFooter>
|
|
252
|
+
</template>
|
|
253
|
+
```
|
|
254
|
+
|
|
98
255
|
## Setup
|
|
99
256
|
|
|
100
257
|
Register the overlay plugin once in your app entry point:
|
|
@@ -119,9 +276,22 @@ createApp(App)
|
|
|
119
276
|
| Method | Parameters | Returns | Description |
|
|
120
277
|
|--------|-----------|---------|-------------|
|
|
121
278
|
| `dialog.confirm(options)` | `ConfirmOptions` | `DialogRef<boolean>` | Show a confirm/cancel dialog |
|
|
122
|
-
| `dialog.alert(title, message)` | `string, string
|
|
279
|
+
| `dialog.alert(title, message, config?)` | `string, string, { context?: Element, presentation?: DialogPresentation }?` | `DialogRef<void>` | Show an acknowledgement dialog. `config.context` and `config.presentation` (Preview): see [context](#context), [Bottom sheet](#sheet) |
|
|
123
280
|
| `dialog.open(component, config?, props?)` | `Component, DialogConfig?, Record?` | `DialogRef<T>` | Open a custom component inside the dialog |
|
|
124
281
|
|
|
282
|
+
### `DialogConfig`
|
|
283
|
+
|
|
284
|
+
| Option | Type | Default | Description |
|
|
285
|
+
|--------|------|---------|-------------|
|
|
286
|
+
| `title` | `string` | `''` | Dialog title |
|
|
287
|
+
| `size` | `'s' \| 'm' \| 'l' \| 'xl'` | `'m'` | Dialog width |
|
|
288
|
+
| `closeOnBackdropClick` | `boolean` | `true` | Close when the backdrop is clicked |
|
|
289
|
+
| `closeOnEscape` | `boolean` | `true` | Close on Escape |
|
|
290
|
+
| `showCloseButton` | `boolean` | `true` | Show the close (×) button |
|
|
291
|
+
| `context` (Preview) | `Element` | the calling component | Element the dialog belongs to, see [context](#context) |
|
|
292
|
+
| `presentation` (Preview) | `'dialog' \| 'sheet'` | `'dialog'` | Centered dialog or [bottom sheet](#sheet). With `'sheet'`, `size` only caps the width from a 640 px window on |
|
|
293
|
+
| `dragToClose` (Preview) | `boolean` | `closeOnBackdropClick` | Sheet only: whether dragging it down closes it |
|
|
294
|
+
|
|
125
295
|
### `ConfirmOptions`
|
|
126
296
|
|
|
127
297
|
| Option | Type | Default | Description |
|
|
@@ -132,6 +302,8 @@ createApp(App)
|
|
|
132
302
|
| `cancelText` | `string` | `'Cancel'` | Cancel button label |
|
|
133
303
|
| `confirmVariant` | `'primary' \| 'danger'` | `'primary'` | Confirm button color variant |
|
|
134
304
|
| `size` | `'s' \| 'm' \| 'l'` | `'s'` | Dialog width |
|
|
305
|
+
| `context` (Preview) | `Element` | the calling component | Element the dialog belongs to, see [context](#context) |
|
|
306
|
+
| `presentation` (Preview) | `'dialog' \| 'sheet'` | `'dialog'` | Centered dialog or [bottom sheet](#sheet); a confirm sheet can always be dragged away |
|
|
135
307
|
|
|
136
308
|
### `DialogRef`
|
|
137
309
|
|
|
@@ -140,6 +312,20 @@ createApp(App)
|
|
|
140
312
|
| `result` | `Promise<T \| undefined>` | Resolves when the dialog closes |
|
|
141
313
|
| `close(result?)` | `(val?: T) => void` | Programmatically close the dialog |
|
|
142
314
|
|
|
315
|
+
### `context` (Preview) {#context}
|
|
316
|
+
|
|
317
|
+
A dialog opened from a local `coar-mobile` area keeps the mobile presentation
|
|
318
|
+
of that area (see [Overlays from a local area](../guide/mobile.md#overlays)). Called
|
|
319
|
+
in a component's `setup()`, `useDialog()` uses that component's element as the
|
|
320
|
+
context. Outside `setup()` (stores, plain functions) pass it yourself:
|
|
321
|
+
|
|
322
|
+
```ts
|
|
323
|
+
useDialog().open(Body, { title: 'Edit', context: someEl });
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
An explicit `context` always wins. A local `CoarThemeScope` is not taken over
|
|
327
|
+
through `context`.
|
|
328
|
+
|
|
143
329
|
## i18n Keys
|
|
144
330
|
|
|
145
331
|
These keys can be translated via [`@cocoar/vue-localization`](../foundations/localization/translations.md).
|
|
@@ -263,6 +263,10 @@ The viewer fills 100% of its parent and uses internal flexbox to allocate space
|
|
|
263
263
|
|
|
264
264
|
Splitters between the columns are draggable — users can resize the left rail (thumbnails) and right rail (annotations panel) on the fly.
|
|
265
265
|
|
|
266
|
+
## Compact presentation (Preview)
|
|
267
|
+
|
|
268
|
+
Inside the experimental `.coar-compact` profile — on an ancestor or on the viewer — the chrome (toolbar, sidebar, annotations panel, search bar, annotation popover) follows the semantic color tokens in light and dark, uses the library's UI, caption and field text sizes, and gets 28px buttons and inputs (44px buttons, 36px inputs and 48px headers with `.coar-mobile`). The annotation popover, teleported to `body`, takes the profile of its viewer. The page itself — canvas, rendered content, annotations, search highlights — is document content and keeps its colors. `--coar-color-*` overrides you set still win; outside the profile nothing changes.
|
|
269
|
+
|
|
266
270
|
## Position memory example
|
|
267
271
|
|
|
268
272
|
```vue
|
|
@@ -46,6 +46,8 @@ const name = ref('');
|
|
|
46
46
|
|
|
47
47
|
`CoarFormField` can place its label before or after any control, either stacked or inline. All four combinations have a visible effect. Inline layouts are especially useful when the field label is the only label of a checkbox or switch; leave the control's own `label` unset in that case.
|
|
48
48
|
|
|
49
|
+
Each example below has its own value. The two checkboxes demonstrate label-after and label-before independently; in Compact, the inline label stays beside its control.
|
|
50
|
+
|
|
49
51
|
**Demo — `form-field/demos/FormFieldLayouts.vue`**
|
|
50
52
|
|
|
51
53
|
```vue
|
|
@@ -59,7 +61,7 @@ const name = ref('');
|
|
|
59
61
|
layout="inline"
|
|
60
62
|
label-position="after"
|
|
61
63
|
>
|
|
62
|
-
<CoarCheckbox v-model="
|
|
64
|
+
<CoarCheckbox v-model="activeAfter" />
|
|
63
65
|
</CoarFormField>
|
|
64
66
|
</section>
|
|
65
67
|
|
|
@@ -71,7 +73,7 @@ const name = ref('');
|
|
|
71
73
|
layout="inline"
|
|
72
74
|
label-position="before"
|
|
73
75
|
>
|
|
74
|
-
<CoarCheckbox v-model="
|
|
76
|
+
<CoarCheckbox v-model="activeBefore" />
|
|
75
77
|
</CoarFormField>
|
|
76
78
|
</section>
|
|
77
79
|
|
|
@@ -83,7 +85,7 @@ const name = ref('');
|
|
|
83
85
|
layout="inline"
|
|
84
86
|
label-position="after"
|
|
85
87
|
>
|
|
86
|
-
<CoarTextInput v-model="
|
|
88
|
+
<CoarTextInput v-model="inlineName" placeholder="Ada Lovelace" />
|
|
87
89
|
</CoarFormField>
|
|
88
90
|
</section>
|
|
89
91
|
|
|
@@ -95,7 +97,7 @@ const name = ref('');
|
|
|
95
97
|
layout="stacked"
|
|
96
98
|
label-position="after"
|
|
97
99
|
>
|
|
98
|
-
<CoarTextInput v-model="
|
|
100
|
+
<CoarTextInput v-model="stackedName" placeholder="Ada Lovelace" />
|
|
99
101
|
</CoarFormField>
|
|
100
102
|
</section>
|
|
101
103
|
</div>
|
|
@@ -105,8 +107,10 @@ const name = ref('');
|
|
|
105
107
|
import { ref } from 'vue';
|
|
106
108
|
import { CoarCheckbox, CoarFormField, CoarTextInput } from '@cocoar/vue-ui';
|
|
107
109
|
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
+
const activeAfter = ref(false);
|
|
111
|
+
const activeBefore = ref(false);
|
|
112
|
+
const inlineName = ref('');
|
|
113
|
+
const stackedName = ref('');
|
|
110
114
|
</script>
|
|
111
115
|
|
|
112
116
|
<style scoped>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Listbox
|
|
4
4
|
|
|
5
|
-
**Devices:** desktop ready · tablet partial · phone
|
|
5
|
+
**Devices:** desktop ready · tablet partial · phone partial — Rows touch-sized under .coar-mobile (Preview), not in virtual mode; multi-highlight needs Ctrl/Shift.
|
|
6
6
|
|
|
7
7
|
A single-column list of selectable items with grouping, search, custom renderers, and multi-select highlighting. Use it as a form control (v-model of highlighted values), as a display-only roster, or as the foundation for [`CoarDualListbox`](./dual-listbox.md).
|
|
8
8
|
|
|
@@ -15,6 +15,8 @@ import type { CoarListboxOption } from '@cocoar/vue-ui';
|
|
|
15
15
|
|
|
16
16
|
Multi-select highlight via click, `Ctrl+Click`, `Shift+Click`, and keyboard (arrows, `Space`, `Ctrl+A`). Double-click (or `Enter`) emits `item-activate` — wire this up to move items, open a detail view, etc.
|
|
17
17
|
|
|
18
|
+
In Compact, the scrollbar track stays transparent so the list's rounded border remains visible when its contents overflow.
|
|
19
|
+
|
|
18
20
|
**Demo — `listbox/demos/BasicListbox.vue`**
|
|
19
21
|
|
|
20
22
|
```vue
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Map (Preview)
|
|
4
4
|
|
|
5
|
-
**Devices:** desktop ready · tablet ready · phone partial —
|
|
5
|
+
**Devices:** desktop ready · tablet ready · phone partial — Touch pan/zoom; compact mobile enlarges zoom and list controls. Dense pins and vertices retain small spatial targets.
|
|
6
6
|
|
|
7
7
|
An interactive [Leaflet](https://leafletjs.com/) map for Vue 3. `<CoarMap>` is
|
|
8
8
|
**standalone and data-driven**: you feed it resolved `MapData` + `MapConfig` and
|
|
@@ -317,6 +317,10 @@ Until the map hydrates — and if Leaflet ever fails to load, or with JS off —
|
|
|
317
317
|
crawlable `<ol>` of the named points is shown and then hidden once the map is
|
|
318
318
|
live. The map container's height is `--coar-map-height` (default `360px`).
|
|
319
319
|
|
|
320
|
+
## Compact presentation (Preview)
|
|
321
|
+
|
|
322
|
+
Inside the experimental `.coar-compact` profile — on an ancestor or on the map — Leaflet's own controls, popups, tooltips and attribution use the library's text, radii and semantic colors (light and dark), and the selection ring follows the accent. With `.coar-mobile` as well, zoom buttons and the point list's drag handle get a 44px touch target. Pins and editor vertices keep their real hit geometry: expanded invisible targets would intercept neighbouring markers. Dense map markers therefore do not meet the same touch-target floor; the point list is an alternative for selecting pins. Map data — tiles, the route, shape dots, category colors, pin size — is not themed. `--coar-map-*` variables you set still win; outside the profile nothing changes.
|
|
323
|
+
|
|
320
324
|
## Security
|
|
321
325
|
|
|
322
326
|
Point text (`label`, `note`, `icon`) is treated as untrusted: popups are built
|
|
@@ -1318,6 +1318,16 @@ If you embed the editor next to a viewer pane (the playground's "viewer pane" to
|
|
|
1318
1318
|
| `--coar-markdown-link` | `var(--coar-text-brand-primary)` | Link color (also applied to inline code). |
|
|
1319
1319
|
| `--coar-markdown-border` | `var(--coar-border-neutral-tertiary)` | Used by tables, blockquote, `<hr>`. |
|
|
1320
1320
|
|
|
1321
|
+
## Compact presentation (Preview)
|
|
1322
|
+
|
|
1323
|
+
Inside an element with the class `coar-compact` (the experimental compact profile, working title) the
|
|
1324
|
+
editor follows the compact document layout of [`CoarMarkdown`](./markdown.md#theming) and tightens its
|
|
1325
|
+
own chrome: field-sized writing text (14 px, 16 px with `coar-mobile` so iOS does not zoom), a toolbar
|
|
1326
|
+
strip of one interactive row (36 px, 44 px with `coar-mobile`), 28 px floating-toolbar buttons (44 px
|
|
1327
|
+
with `coar-mobile`, wrapping within the viewport) and caption-sized text in the table and color
|
|
1328
|
+
pickers. The floating toolbar and the table handles are teleported to `<body>`; they carry the
|
|
1329
|
+
profile classes of the editor they belong to. Without `coar-compact` nothing changes.
|
|
1330
|
+
|
|
1321
1331
|
## Toolbar layout (`tools`)
|
|
1322
1332
|
|
|
1323
1333
|
Pass a `tools` array to control which buttons the **sidebar** toolbar exposes and
|
|
@@ -325,6 +325,15 @@ can still be typed, but formatting commands are not shown.
|
|
|
325
325
|
- `readonly` formats the values as a finished document. No field is editable.
|
|
326
326
|
- Fixed Markdown is never editable in either mode.
|
|
327
327
|
|
|
328
|
+
## Compact presentation (Preview)
|
|
329
|
+
|
|
330
|
+
Inside an element with the class `coar-compact` (the experimental compact profile, working title), the
|
|
331
|
+
form reads its colors from the semantic tokens instead of fixed light values, so it follows dark mode
|
|
332
|
+
and the accent: input-colored block frames with the control radius, the focus color on focus,
|
|
333
|
+
semantic error colors and 12 px error text, filled-in readonly values at weight 600 instead of 700, and
|
|
334
|
+
`design: 'basic'` controls with field-sized text and the height of the Cocoar inputs. Without the
|
|
335
|
+
class nothing changes.
|
|
336
|
+
|
|
328
337
|
## Validation
|
|
329
338
|
|
|
330
339
|
Validation is always calculated, while `show-errors` controls its visual
|
|
@@ -276,3 +276,13 @@ The markdown component uses CSS custom properties for theming:
|
|
|
276
276
|
--coar-markdown-border: var(--coar-border-neutral);
|
|
277
277
|
}
|
|
278
278
|
```
|
|
279
|
+
|
|
280
|
+
### Compact presentation (Preview)
|
|
281
|
+
|
|
282
|
+
Inside an element with the class `coar-compact` (the experimental compact profile, working title), the
|
|
283
|
+
shared stylesheet uses a denser reading layout: 14 px reading text (15 px with `coar-mobile`), headings
|
|
284
|
+
24 / 18 / 16 px at weight 600, 12 / 24 px block and section spacing, sentence-case table headers, inline
|
|
285
|
+
code as a quiet chip and legible frontmatter. Without the class nothing changes. The values are
|
|
286
|
+
`--coar-markdown-*` roles (`--coar-markdown-font-size`, `--coar-markdown-h1-font-size`,
|
|
287
|
+
`--coar-markdown-table-cell-padding`, …) that you can override inside the profile. Colors set in the
|
|
288
|
+
document (`<span style="color: …">`) are kept as they are.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Menu
|
|
4
4
|
|
|
5
|
-
**Devices:** desktop ready · tablet ready · phone
|
|
5
|
+
**Devices:** desktop ready · tablet ready · phone partial — Touch-sized rows under .coar-mobile; the mobile presentation is still Preview.
|
|
6
6
|
|
|
7
7
|
Build context menus, action lists, and navigation panels with full keyboard support. Menus group related actions together, making them easy to discover and interact with. They support nested submenus, icons, section headings, and danger variants for destructive actions.
|
|
8
8
|
|
|
@@ -166,6 +166,17 @@ exported as pure functions if you need to build your own Mermaid config:
|
|
|
166
166
|
| `readCssTokens(el?)` | `getComputedStyle`-backed token getter. |
|
|
167
167
|
| `makeCssColorResolver()` | Canvas-backed CSS-color → sRGB resolver (handles `oklch(...)`). |
|
|
168
168
|
|
|
169
|
+
### Compact presentation (Preview)
|
|
170
|
+
|
|
171
|
+
Inside an element with the class `coar-compact` (the experimental compact profile, working title), the
|
|
172
|
+
zoom viewport and its controls take the panel radius, the zoom buttons are 28 px (44 px with
|
|
173
|
+
`coar-mobile`, since they are the only way to zoom on touch), and the loading and error states use the
|
|
174
|
+
UI text size. The diagram itself keeps Mermaid's sizes.
|
|
175
|
+
|
|
176
|
+
Mermaid's configuration is global to the page. A page that uses one profile initializes Mermaid once,
|
|
177
|
+
as before; when a diagram of the other profile renders, Mermaid is initialized again with that
|
|
178
|
+
diagram's tokens.
|
|
179
|
+
|
|
169
180
|
## In markdown
|
|
170
181
|
|
|
171
182
|
To render diagrams from ` ```mermaid ` fences inside `<CoarMarkdown>`, don't wire
|
|
@@ -163,6 +163,76 @@ import { CoarNumberInput, CoarFormField } from '@cocoar/vue-ui';
|
|
|
163
163
|
</script>
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
+
## Inline (Preview) {#inline}
|
|
167
|
+
|
|
168
|
+
`appearance="inline"` shows only the value until the field is hovered or edited, and `width="content"` fits the
|
|
169
|
+
field to its value with its prefix, suffix and steppers. How both behave and how to change the fills:
|
|
170
|
+
[Text Input](./text-input.md#inline).
|
|
171
|
+
|
|
172
|
+
**Demo — `number-input/demos/NumberInputInline.vue`**
|
|
173
|
+
|
|
174
|
+
```vue
|
|
175
|
+
<template>
|
|
176
|
+
<p style="margin: 0; line-height: 2.4;">
|
|
177
|
+
Order
|
|
178
|
+
<CoarNumberInput v-model="quantity" appearance="inline" width="content" :min="1" stepper-buttons="both" />
|
|
179
|
+
units at
|
|
180
|
+
<CoarNumberInput v-model="price" appearance="inline" width="content" :decimals="2" suffix="EUR" />
|
|
181
|
+
each.
|
|
182
|
+
</p>
|
|
183
|
+
</template>
|
|
184
|
+
|
|
185
|
+
<script setup lang="ts">
|
|
186
|
+
import { ref } from 'vue';
|
|
187
|
+
import { CoarNumberInput } from '@cocoar/vue-ui';
|
|
188
|
+
|
|
189
|
+
const quantity = ref<number | null>(3);
|
|
190
|
+
const price = ref<number | null>(49.9);
|
|
191
|
+
</script>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Prefix & Suffix Actions (Preview) {#actions}
|
|
195
|
+
|
|
196
|
+
`#prefixAction` and `#suffixAction` hold interactive content at the outer edges of the field, such as an inline
|
|
197
|
+
select for the currency of an amount. Unlike `prefix` and `suffix`, which show muted text, an action keeps the text
|
|
198
|
+
style of the field, and an inline select there runs to the edge, its fill following the field's corner. Both slots
|
|
199
|
+
get `{ disabled, readonly }` of the field.
|
|
200
|
+
|
|
201
|
+
**Demo — `number-input/demos/NumberInputCurrency.vue`**
|
|
202
|
+
|
|
203
|
+
```vue
|
|
204
|
+
<template>
|
|
205
|
+
<CoarFormField label="Price" style="max-width: 260px;">
|
|
206
|
+
<CoarNumberInput v-model="amount" :decimals="2" placeholder="0.00">
|
|
207
|
+
<template #suffixAction="{ disabled, readonly }">
|
|
208
|
+
<CoarSelect
|
|
209
|
+
v-model="currency"
|
|
210
|
+
:options="currencies"
|
|
211
|
+
aria-label="Currency"
|
|
212
|
+
appearance="inline"
|
|
213
|
+
width="content"
|
|
214
|
+
:disabled="disabled"
|
|
215
|
+
:readonly="readonly"
|
|
216
|
+
/>
|
|
217
|
+
</template>
|
|
218
|
+
</CoarNumberInput>
|
|
219
|
+
</CoarFormField>
|
|
220
|
+
</template>
|
|
221
|
+
|
|
222
|
+
<script setup lang="ts">
|
|
223
|
+
import { ref } from 'vue';
|
|
224
|
+
import { CoarFormField, CoarNumberInput, CoarSelect } from '@cocoar/vue-ui';
|
|
225
|
+
|
|
226
|
+
const amount = ref<number | null>(129.9);
|
|
227
|
+
const currency = ref<string | null>('EUR');
|
|
228
|
+
const currencies = ['EUR', 'USD', 'CHF'].map((value) => ({ value, label: value }));
|
|
229
|
+
</script>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
An action is a field of its own: a select in it does not take the label, hint or error of the surrounding
|
|
233
|
+
`CoarFormField`, so give it its own name with `aria-label`. The same slots exist on
|
|
234
|
+
[Text Input](./text-input.md#actions).
|
|
235
|
+
|
|
166
236
|
## Accessibility
|
|
167
237
|
|
|
168
238
|
### Keyboard Navigation
|
|
@@ -211,7 +281,18 @@ These keys can be translated via [`@cocoar/vue-localization`](../foundations/loc
|
|
|
211
281
|
| `stepperButtons` | `'none' \| 'increment' \| 'decrement' \| 'both'` | `'none'` | Stepper button mode |
|
|
212
282
|
| `clearable` | `boolean` | `false` | Show clear button when input has value |
|
|
213
283
|
| `size` | `'xs' \| 's' \| 'm' \| 'l'` | `'m'` | Input size |
|
|
284
|
+
| `appearance` (Preview) | `'outline' \| 'inline'` | `'outline'` | `inline`: no border or surface until hovered or edited, see [Inline](#inline) |
|
|
285
|
+
| `width` (Preview) | `'fill' \| 'content'` | `'fill'` | `content`: as wide as the shown value or placeholder |
|
|
214
286
|
| `disabled` | `boolean` | `false` | Disable the input |
|
|
215
287
|
| `readonly` | `boolean` | `false` | Make read-only |
|
|
216
288
|
| `required` | `boolean` | `false` | Mark as required |
|
|
217
289
|
| `error` | `boolean` | `false` | Error state (auto-injected from `CoarFormField`) |
|
|
290
|
+
|
|
291
|
+
### Slots
|
|
292
|
+
|
|
293
|
+
| Slot | Scope | Description |
|
|
294
|
+
|------|-------|-------------|
|
|
295
|
+
| `prefix` | — | Muted content before the value |
|
|
296
|
+
| `suffix` | — | Muted content after the value |
|
|
297
|
+
| `prefixAction` (Preview) | `{ disabled: boolean, readonly: boolean }` | Interactive content at the start edge, see [Actions](#actions) |
|
|
298
|
+
| `suffixAction` (Preview) | `{ disabled: boolean, readonly: boolean }` | Interactive content at the end edge, see [Actions](#actions) |
|