@chromvoid/uikit 0.1.0 → 0.2.0
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/LICENSE +19 -6
- package/README.md +1 -0
- package/dist/components/cv-accordion-item.d.ts +1 -1
- package/dist/components/cv-accordion.d.ts +1 -1
- package/dist/components/cv-accordion.js +2 -1
- package/dist/components/cv-alert-dialog.d.ts +1 -1
- package/dist/components/cv-alert-dialog.js +17 -2
- package/dist/components/cv-alert.d.ts +1 -1
- package/dist/components/cv-alert.js +2 -1
- package/dist/components/cv-badge.d.ts +1 -1
- package/dist/components/cv-badge.js +2 -1
- package/dist/components/cv-bottom-sheet.d.ts +127 -0
- package/dist/components/cv-bottom-sheet.js +513 -0
- package/dist/components/cv-breadcrumb-item.d.ts +1 -1
- package/dist/components/cv-breadcrumb-item.js +1 -1
- package/dist/components/cv-breadcrumb.d.ts +1 -1
- package/dist/components/cv-breadcrumb.js +2 -1
- package/dist/components/cv-button.d.ts +23 -1
- package/dist/components/cv-button.js +194 -37
- package/dist/components/cv-callout.d.ts +8 -1
- package/dist/components/cv-callout.js +18 -1
- package/dist/components/cv-card.d.ts +1 -1
- package/dist/components/cv-card.js +2 -2
- package/dist/components/cv-carousel-slide.d.ts +1 -1
- package/dist/components/cv-carousel.d.ts +1 -1
- package/dist/components/cv-carousel.js +2 -1
- package/dist/components/cv-checkbox.d.ts +1 -1
- package/dist/components/cv-combobox-group.d.ts +1 -1
- package/dist/components/cv-combobox-option.d.ts +1 -1
- package/dist/components/cv-combobox-option.js +2 -2
- package/dist/components/cv-combobox.d.ts +3 -1
- package/dist/components/cv-combobox.js +49 -8
- package/dist/components/cv-command-item.d.ts +1 -1
- package/dist/components/cv-command-item.js +2 -2
- package/dist/components/cv-command-palette.d.ts +1 -1
- package/dist/components/cv-command-palette.js +21 -1
- package/dist/components/cv-context-menu.d.ts +1 -1
- package/dist/components/cv-context-menu.js +2 -1
- package/dist/components/cv-copy-button.d.ts +37 -9
- package/dist/components/cv-copy-button.js +129 -41
- package/dist/components/cv-date-picker.d.ts +1 -1
- package/dist/components/cv-date-picker.js +20 -1
- package/dist/components/cv-dialog.d.ts +44 -2
- package/dist/components/cv-dialog.js +686 -74
- package/dist/components/cv-disclosure.d.ts +1 -1
- package/dist/components/cv-disclosure.js +2 -1
- package/dist/components/cv-drawer.d.ts +29 -1
- package/dist/components/cv-drawer.js +229 -4
- package/dist/components/cv-feed-article.d.ts +1 -1
- package/dist/components/cv-feed-article.js +2 -1
- package/dist/components/cv-feed.d.ts +1 -1
- package/dist/components/cv-feed.js +2 -1
- package/dist/components/cv-grid-cell.d.ts +1 -1
- package/dist/components/cv-grid-cell.js +3 -3
- package/dist/components/cv-grid-column.d.ts +1 -1
- package/dist/components/cv-grid-column.js +1 -1
- package/dist/components/cv-grid-row.d.ts +1 -1
- package/dist/components/cv-grid.d.ts +1 -1
- package/dist/components/cv-grid.js +2 -1
- package/dist/components/cv-guidance-anchor.d.ts +47 -0
- package/dist/components/cv-guidance-anchor.js +113 -0
- package/dist/components/cv-guidance-panel.d.ts +29 -0
- package/dist/components/cv-guidance-panel.js +245 -0
- package/dist/components/cv-icon.d.ts +2 -1
- package/dist/components/cv-icon.js +28 -3
- package/dist/components/cv-input.d.ts +7 -1
- package/dist/components/cv-input.js +33 -1
- package/dist/components/cv-landmark.d.ts +1 -1
- package/dist/components/cv-landmark.js +2 -1
- package/dist/components/cv-link.d.ts +1 -1
- package/dist/components/cv-link.js +2 -1
- package/dist/components/cv-listbox-group.d.ts +1 -1
- package/dist/components/cv-listbox.d.ts +1 -1
- package/dist/components/cv-listbox.js +2 -1
- package/dist/components/cv-menu-button.d.ts +24 -1
- package/dist/components/cv-menu-button.js +226 -18
- package/dist/components/cv-menu-group.d.ts +1 -1
- package/dist/components/cv-menu-item.d.ts +1 -1
- package/dist/components/cv-menu-item.js +6 -2
- package/dist/components/cv-menu.d.ts +1 -1
- package/dist/components/cv-menu.js +21 -1
- package/dist/components/cv-meter.d.ts +1 -1
- package/dist/components/cv-meter.js +6 -22
- package/dist/components/cv-number.d.ts +1 -1
- package/dist/components/cv-option.d.ts +1 -1
- package/dist/components/cv-option.js +3 -9
- package/dist/components/cv-popover-positioning.d.ts +22 -0
- package/dist/components/cv-popover-positioning.js +112 -0
- package/dist/components/cv-popover.d.ts +45 -8
- package/dist/components/cv-popover.js +395 -113
- package/dist/components/cv-progress-ring.d.ts +1 -1
- package/dist/components/cv-progress-ring.js +2 -1
- package/dist/components/cv-progress.d.ts +8 -1
- package/dist/components/cv-progress.js +41 -10
- package/dist/components/cv-radio-group.d.ts +1 -1
- package/dist/components/cv-radio.d.ts +1 -1
- package/dist/components/cv-radio.js +1 -1
- package/dist/components/cv-select-group.d.ts +1 -1
- package/dist/components/cv-select-option.d.ts +1 -1
- package/dist/components/cv-select-option.js +2 -2
- package/dist/components/cv-select.d.ts +1 -1
- package/dist/components/cv-select.js +28 -1
- package/dist/components/cv-sidebar-item.d.ts +1 -1
- package/dist/components/cv-sidebar.d.ts +1 -1
- package/dist/components/cv-sidebar.js +3 -2
- package/dist/components/cv-slider-multi-thumb.d.ts +1 -1
- package/dist/components/cv-slider-multi-thumb.js +2 -1
- package/dist/components/cv-slider.d.ts +17 -4
- package/dist/components/cv-slider.js +63 -21
- package/dist/components/cv-spinbutton.d.ts +1 -1
- package/dist/components/cv-spinner.d.ts +1 -1
- package/dist/components/cv-spinner.js +2 -1
- package/dist/components/cv-switch.d.ts +1 -1
- package/dist/components/cv-tab-panel.d.ts +1 -1
- package/dist/components/cv-tab.d.ts +1 -1
- package/dist/components/cv-table-cell.d.ts +1 -1
- package/dist/components/cv-table-cell.js +1 -1
- package/dist/components/cv-table-column.d.ts +1 -1
- package/dist/components/cv-table-column.js +1 -1
- package/dist/components/cv-table-row.d.ts +1 -1
- package/dist/components/cv-table-row.js +1 -4
- package/dist/components/cv-table.d.ts +1 -3
- package/dist/components/cv-table.js +4 -11
- package/dist/components/cv-tabs.d.ts +1 -1
- package/dist/components/cv-tabs.js +3 -2
- package/dist/components/cv-textarea.d.ts +11 -1
- package/dist/components/cv-textarea.js +33 -0
- package/dist/components/cv-toast-region.d.ts +1 -1
- package/dist/components/cv-toast-region.js +2 -1
- package/dist/components/cv-toast.d.ts +1 -1
- package/dist/components/cv-toast.js +20 -27
- package/dist/components/cv-toolbar-item.d.ts +1 -1
- package/dist/components/cv-toolbar-separator.d.ts +1 -1
- package/dist/components/cv-toolbar.d.ts +1 -1
- package/dist/components/cv-toolbar.js +2 -1
- package/dist/components/cv-tooltip.d.ts +1 -1
- package/dist/components/cv-tooltip.js +2 -1
- package/dist/components/cv-treegrid-cell.d.ts +1 -1
- package/dist/components/cv-treegrid-cell.js +1 -1
- package/dist/components/cv-treegrid-column.d.ts +1 -1
- package/dist/components/cv-treegrid-column.js +1 -1
- package/dist/components/cv-treegrid-row.d.ts +1 -1
- package/dist/components/cv-treegrid-row.js +1 -1
- package/dist/components/cv-treegrid.d.ts +1 -1
- package/dist/components/cv-treegrid.js +4 -3
- package/dist/components/cv-treeitem.d.ts +1 -1
- package/dist/components/cv-treeitem.js +2 -2
- package/dist/components/cv-treeview.d.ts +1 -1
- package/dist/components/cv-treeview.js +2 -1
- package/dist/components/cv-window-splitter.d.ts +1 -1
- package/dist/components/cv-window-splitter.js +2 -1
- package/dist/components/index.d.ts +7 -0
- package/dist/components/index.js +3 -0
- package/dist/dialog/create-dialog-controller.d.ts +12 -4
- package/dist/dialog/create-dialog-controller.js +84 -22
- package/dist/dialog/index.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/reatom-lit/ReatomLitElement.d.ts +6 -3
- package/dist/reatom-lit/ReatomLitElement.js +18 -8
- package/dist/reatom-lit/createAfterRenderScheduler.d.ts +10 -0
- package/dist/reatom-lit/createAfterRenderScheduler.js +33 -0
- package/dist/reatom-lit/index.d.ts +2 -0
- package/dist/reatom-lit/index.js +1 -0
- package/dist/reatom-lit/watch.d.ts +1 -1
- package/dist/reatom-lit/withReatomElement.js +16 -2
- package/dist/register.js +4 -1
- package/dist/styles/component-styles.js +4 -0
- package/dist/styles/uno-generated.d.ts +2 -0
- package/dist/styles/uno-generated.js +1 -0
- package/dist/styles/uno-utilities.d.ts +5 -0
- package/dist/styles/uno-utilities.js +7 -0
- package/dist/theme/cv-theme-provider.d.ts +1 -1
- package/dist/theme/cv-theme-provider.js +2 -2
- package/dist/theme/tokens.css +619 -162
- package/package.json +9 -5
- package/specs/components/bottom-sheet.md +93 -0
- package/specs/components/button.md +8 -0
- package/specs/components/callout.md +8 -0
- package/specs/components/copy-button.md +54 -17
- package/specs/components/dialog.md +72 -43
- package/specs/components/drawer.md +18 -13
- package/specs/components/guidance-anchor.md +64 -0
- package/specs/components/guidance-panel.md +92 -0
- package/specs/components/input.md +7 -0
- package/specs/components/menu.md +8 -0
- package/specs/components/option.md +9 -9
- package/specs/components/progress.md +11 -0
- package/specs/components/sidebar.md +12 -12
- package/specs/components/table.md +13 -13
- package/specs/components/theme.md +13 -13
- package/specs/components/treegrid.md +15 -15
- package/specs/components/treeview.md +10 -10
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chromvoid/uikit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Thin Lit UI kit on top of @chromvoid/headless-ui",
|
|
5
5
|
"homepage": "https://github.com/chromvoid/uikit#readme",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/chromvoid/uikit/issues"
|
|
8
8
|
},
|
|
9
|
-
"license": "
|
|
9
|
+
"license": "MIT",
|
|
10
10
|
"author": "ChromVoid Team",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
@@ -98,6 +98,10 @@
|
|
|
98
98
|
"access": "public"
|
|
99
99
|
},
|
|
100
100
|
"scripts": {
|
|
101
|
+
"generate:uno": "node ./scripts/generate-uno-inline.mjs",
|
|
102
|
+
"prebuild": "npm run generate:uno",
|
|
103
|
+
"pretest:unit": "npm run generate:uno",
|
|
104
|
+
"prelint": "npm run generate:uno",
|
|
101
105
|
"build": "rm -rf dist && tsc -p tsconfig.build.json && node ./scripts/postbuild.mjs",
|
|
102
106
|
"check:bundle": "npm run build && node ./scripts/check-bundle-contract.mjs",
|
|
103
107
|
"check:entry-imports": "node ./scripts/check-entry-imports.mjs",
|
|
@@ -120,8 +124,8 @@
|
|
|
120
124
|
"test:unit": "vitest run --config ./vitest.config.ts"
|
|
121
125
|
},
|
|
122
126
|
"dependencies": {
|
|
123
|
-
"@chromvoid/headless-ui": "0.
|
|
124
|
-
"@reatom/core": "^
|
|
127
|
+
"@chromvoid/headless-ui": "0.2.0",
|
|
128
|
+
"@reatom/core": "^1001.0.0"
|
|
125
129
|
},
|
|
126
130
|
"devDependencies": {
|
|
127
131
|
"@types/node": "^24.11.0",
|
|
@@ -131,7 +135,7 @@
|
|
|
131
135
|
"lit": "^3.3.1",
|
|
132
136
|
"oxfmt": "^0.41.0",
|
|
133
137
|
"oxlint": "^1.51.0",
|
|
134
|
-
"typescript": "^
|
|
138
|
+
"typescript": "^6.0.2",
|
|
135
139
|
"unocss": "^66.6.7",
|
|
136
140
|
"vite": "^7.1.0",
|
|
137
141
|
"vitepress": "^1.6.3",
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# cv-bottom-sheet
|
|
2
|
+
|
|
3
|
+
Mobile modal sheet primitive that reuses `cv-dialog` for modal state, focus management, scroll lock, backdrop dismissal, Escape handling, and lifecycle events.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<cv-bottom-sheet open no-header>
|
|
9
|
+
<span slot="title">Player</span>
|
|
10
|
+
<div>Sheet content</div>
|
|
11
|
+
</cv-bottom-sheet>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Anatomy
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
<cv-bottom-sheet> (host)
|
|
18
|
+
└── <cv-dialog exportparts="...">
|
|
19
|
+
└── <button part="handle">
|
|
20
|
+
└── <span part="grabber">
|
|
21
|
+
└── <slot>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The underlying dialog exports `trigger`, `overlay`, `content`, `header`, `title`, `description`, `header-close`, `body`, and `footer` parts. `cv-bottom-sheet` adds `handle` and `grabber`.
|
|
25
|
+
|
|
26
|
+
## Attributes
|
|
27
|
+
|
|
28
|
+
| Attribute | Type | Default | Description |
|
|
29
|
+
| -------------------------- | ------- | -------------- | ---------------------------------------------------------- |
|
|
30
|
+
| `open` | Boolean | `false` | Whether the sheet is visible |
|
|
31
|
+
| `modal` | Boolean | `true` | Enables dialog modal behavior |
|
|
32
|
+
| `type` | String | `"dialog"` | ARIA role type: `dialog` \| `alertdialog` |
|
|
33
|
+
| `close-on-escape` | Boolean | `true` | Whether Escape closes the sheet |
|
|
34
|
+
| `close-on-outside-pointer` | Boolean | `true` | Whether backdrop pointer/click closes the sheet |
|
|
35
|
+
| `close-on-outside-focus` | Boolean | `true` | Whether outside focus closes the sheet |
|
|
36
|
+
| `initial-focus-id` | String | --- | Id of element to focus when the sheet opens |
|
|
37
|
+
| `no-header` | Boolean | `false` | Hides the dialog header |
|
|
38
|
+
| `show-handle` | Boolean | `true` | Renders the drag affordance |
|
|
39
|
+
| `drag-to-close` | Boolean | `true` | Enables pull-down close from the handle |
|
|
40
|
+
| `detents` | String | `""` | Space/comma-separated detents: `collapsed middle expanded` |
|
|
41
|
+
| `detent` | String | `expanded` | Active detent: `collapsed` \| `middle` \| `expanded` |
|
|
42
|
+
| `handle-label` | String | `Resize sheet` | Accessible label for the handle button |
|
|
43
|
+
|
|
44
|
+
## Slots
|
|
45
|
+
|
|
46
|
+
| Slot | Description |
|
|
47
|
+
| -------------- | ----------------------------------------------- |
|
|
48
|
+
| `(default)` | Sheet body content |
|
|
49
|
+
| `title` | Accessible title forwarded to `cv-dialog` |
|
|
50
|
+
| `description` | Accessible description forwarded to `cv-dialog` |
|
|
51
|
+
| `header-close` | Header close icon forwarded to `cv-dialog` |
|
|
52
|
+
| `footer` | Footer content forwarded to `cv-dialog` |
|
|
53
|
+
|
|
54
|
+
## CSS Custom Properties
|
|
55
|
+
|
|
56
|
+
| Property | Default | Description |
|
|
57
|
+
| ------------------------------------ | --------------------------------- | -------------------------------- |
|
|
58
|
+
| `--cv-bottom-sheet-z-index` | `40` | Overlay stack level |
|
|
59
|
+
| `--cv-bottom-sheet-width` | `100%` | Sheet inline size |
|
|
60
|
+
| `--cv-bottom-sheet-max-width` | `100%` | Sheet maximum inline size |
|
|
61
|
+
| `--cv-bottom-sheet-max-height` | `min(82dvh, calc(100dvh - 32px))` | Sheet maximum block size |
|
|
62
|
+
| `--cv-bottom-sheet-collapsed-height` | `148px` | Collapsed detent height |
|
|
63
|
+
| `--cv-bottom-sheet-middle-height` | `min(52dvh, 440px)` | Middle detent height |
|
|
64
|
+
| `--cv-bottom-sheet-expanded-height` | `min(92dvh, calc(100dvh - 32px))` | Expanded detent height |
|
|
65
|
+
| `--cv-bottom-sheet-overlay-color` | `var(--cv-color-overlay)` | Backdrop color |
|
|
66
|
+
| `--cv-bottom-sheet-border-radius` | top corners rounded | Sheet corner radius |
|
|
67
|
+
| `--cv-bottom-sheet-grabber-color` | `var(--cv-color-border-strong)` | Grabber color |
|
|
68
|
+
| `--cv-bottom-sheet-dismiss-duration` | `180ms` | Drag dismiss transition duration |
|
|
69
|
+
|
|
70
|
+
When available, the app-level `--visual-viewport-block-size` token supplies the visible viewport
|
|
71
|
+
height used for sheet sizing while software keyboards are open. Keyboard clearance still flows
|
|
72
|
+
through `--cv-bottom-sheet-keyboard-inset` / `--visual-viewport-bottom-inset`.
|
|
73
|
+
|
|
74
|
+
`cv-bottom-sheet` composes with `cv-dialog` presence state by overriding dialog content motion variables. The sheet uses bottom-up `translateY(...)` transforms for open, close, drag, detent, and dismiss states instead of the centered dialog scale transform.
|
|
75
|
+
|
|
76
|
+
## Events
|
|
77
|
+
|
|
78
|
+
Matches `cv-dialog`: `cv-input`, `cv-change`, `cv-show`, `cv-after-show`, `cv-hide`, and `cv-after-hide`.
|
|
79
|
+
|
|
80
|
+
`cv-after-show` and `cv-after-hide` follow the underlying `cv-dialog` presence transition. Reduced-motion and zero-duration paths complete immediately.
|
|
81
|
+
|
|
82
|
+
`cv-input` and `cv-change` fire for dialog user interactions, successful drag-to-close, and user-driven detent changes. Programmatic `open` / `detent` changes do not emit input/change.
|
|
83
|
+
|
|
84
|
+
When `detents` is set, event detail is `{open, detent}`. In default open-close mode, event detail remains `{open}`.
|
|
85
|
+
|
|
86
|
+
## Interaction Rules
|
|
87
|
+
|
|
88
|
+
- Backdrop pointer/click and Escape are delegated to `cv-dialog`.
|
|
89
|
+
- Drag starts only from `part="handle"`.
|
|
90
|
+
- Without `detents`, drag closes at `96px` downward movement or `0.75px/ms` downward velocity.
|
|
91
|
+
- With `detents`, upward/downward drags snap one detent at a time; dragging down from the smallest detent dismisses when `drag-to-close` is enabled.
|
|
92
|
+
- Tapping the handle advances to the next larger detent when one exists.
|
|
93
|
+
- Below-threshold drags snap back without changing `open` or `detent`.
|
|
@@ -27,6 +27,7 @@ Interactive element that triggers an action or toggles a pressed state.
|
|
|
27
27
|
| `pressed` | Boolean | `false` | Pressed state (only meaningful when `toggle` is `true`) |
|
|
28
28
|
| `loading` | Boolean | `false` | Shows spinner and blocks interaction |
|
|
29
29
|
| `variant` | String | `"default"` | Visual variant: `default` \| `primary` \| `danger` \| `ghost` |
|
|
30
|
+
| `preset` | String | — | Semantic preset: `action-primary` \| `action-primary-subtle` |
|
|
30
31
|
| `outline` | Boolean | `false` | Outlined appearance (transparent background, visible border) |
|
|
31
32
|
| `pill` | Boolean | `false` | Fully rounded edges (`border-radius: 999px`) |
|
|
32
33
|
| `size` | String | `"medium"` | Size: `small` \| `medium` \| `large` |
|
|
@@ -53,6 +54,13 @@ Interactive element that triggers an action or toggles a pressed state.
|
|
|
53
54
|
|
|
54
55
|
The `outline` boolean modifier can be combined with any variant to produce an outlined appearance (transparent background, visible border tinted by variant color).
|
|
55
56
|
|
|
57
|
+
## Presets
|
|
58
|
+
|
|
59
|
+
| Preset | Description |
|
|
60
|
+
| ----------------------- | ----------------------------------------------------- |
|
|
61
|
+
| `action-primary` | Strong primary action surface for form/footer actions |
|
|
62
|
+
| `action-primary-subtle` | Softer primary action surface for inline edit actions |
|
|
63
|
+
|
|
56
64
|
## Sizes
|
|
57
65
|
|
|
58
66
|
| Size | `--cv-button-min-height` | `--cv-button-padding-inline` | `--cv-button-padding-block` | `--cv-button-font-size` |
|
|
@@ -21,6 +21,7 @@ Static supplementary content block that highlights important information using `
|
|
|
21
21
|
| Attribute | Type | Default | Description |
|
|
22
22
|
| ---------- | ------- | -------- | ----------------------------------------------------------------------------------- |
|
|
23
23
|
| `variant` | String | `"info"` | Visual variant: `"info"` \| `"success"` \| `"warning"` \| `"danger"` \| `"neutral"` |
|
|
24
|
+
| `density` | String | — | Density preset: `compact` \| `dense` |
|
|
24
25
|
| `closable` | Boolean | `false` | Renders a dismiss button and enables the `cv-close` event |
|
|
25
26
|
| `open` | Boolean | `true` | Controls visibility of the callout |
|
|
26
27
|
|
|
@@ -34,6 +35,13 @@ Static supplementary content block that highlights important information using `
|
|
|
34
35
|
| `danger` | Danger-tinted background and border using `--cv-color-danger` |
|
|
35
36
|
| `neutral` | Muted style with surface background and border |
|
|
36
37
|
|
|
38
|
+
## Densities
|
|
39
|
+
|
|
40
|
+
| Density | Description |
|
|
41
|
+
| --------- | ----------------------------------------------- |
|
|
42
|
+
| `compact` | Reduced padding/radius for route-level callouts |
|
|
43
|
+
| `dense` | Smallest density for status and inline callouts |
|
|
44
|
+
|
|
37
45
|
## Slots
|
|
38
46
|
|
|
39
47
|
| Slot | Description |
|
|
@@ -20,12 +20,23 @@ Button that copies a value to the system clipboard with three-state visual feedb
|
|
|
20
20
|
|
|
21
21
|
## Attributes
|
|
22
22
|
|
|
23
|
-
| Attribute | Type | Default
|
|
24
|
-
| ------------------- | ------- |
|
|
25
|
-
| `value` | String | `''`
|
|
26
|
-
| `disabled` | Boolean | `false`
|
|
27
|
-
| `feedback-duration` | Number | `1500`
|
|
28
|
-
| `size` | String | `"medium"`
|
|
23
|
+
| Attribute | Type | Default | Description |
|
|
24
|
+
| ------------------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
25
|
+
| `value` | String | `''` | Text to copy. Property also accepts `(() => Promise<string>)` for lazy/sensitive values (property-only, not reflected as attribute for security) |
|
|
26
|
+
| `disabled` | Boolean | `false` | Prevents interaction |
|
|
27
|
+
| `feedback-duration` | Number | `1500` | Milliseconds to show success/error feedback before reverting to idle |
|
|
28
|
+
| `size` | String | `"medium"` | Size: `small` \| `medium` \| `large` |
|
|
29
|
+
| `appearance` | String | `"default"` | Appearance: `default` \| `plain` |
|
|
30
|
+
| `success-label` | String | `"Copied"` | Text used for success `aria-label` and live-region feedback |
|
|
31
|
+
| `error-label` | String | `"Copy failed"` | Text used for error `aria-label` and live-region feedback |
|
|
32
|
+
| `aria-label` | String | unset | Accessible label used while idle |
|
|
33
|
+
|
|
34
|
+
Property-only options:
|
|
35
|
+
|
|
36
|
+
| Property | Type | Description |
|
|
37
|
+
| ----------- | -------------------------------------------- | ----------------------------------------------------------------------------------------- |
|
|
38
|
+
| `value` | `string \| (() => Promise<string>)` | Text or async getter to copy; never reflected as an attribute |
|
|
39
|
+
| `clipboard` | `{ writeText(text: string): Promise<void> }` | Injectable clipboard adapter for app-specific clipboard policies such as domain auto-wipe |
|
|
29
40
|
|
|
30
41
|
## Sizes
|
|
31
42
|
|
|
@@ -55,12 +66,23 @@ Button that copies a value to the system clipboard with three-state visual feedb
|
|
|
55
66
|
|
|
56
67
|
## CSS Custom Properties
|
|
57
68
|
|
|
58
|
-
| Property
|
|
59
|
-
|
|
|
60
|
-
| `--cv-copy-button-size`
|
|
61
|
-
| `--cv-copy-button-border-radius`
|
|
62
|
-
| `--cv-copy-button-success-color`
|
|
63
|
-
| `--cv-copy-button-error-color`
|
|
69
|
+
| Property | Default | Description |
|
|
70
|
+
| ------------------------------------------- | ------------------------------------- | -------------------------------------- |
|
|
71
|
+
| `--cv-copy-button-size` | `36px` | Overall button size (width and height) |
|
|
72
|
+
| `--cv-copy-button-border-radius` | `var(--cv-radius-sm, 6px)` | Border radius for button shape |
|
|
73
|
+
| `--cv-copy-button-success-color` | `var(--cv-color-success, #4ade80)` | Color applied during success state |
|
|
74
|
+
| `--cv-copy-button-error-color` | `var(--cv-color-danger, #ff7d86)` | Color applied during error state |
|
|
75
|
+
| `--cv-copy-button-background` | `var(--cv-color-surface)` | Base background |
|
|
76
|
+
| `--cv-copy-button-border-color` | `var(--cv-color-border)` | Base border color |
|
|
77
|
+
| `--cv-copy-button-color` | `var(--cv-color-text)` | Base text/icon color |
|
|
78
|
+
| `--cv-copy-button-hover-background` | `--cv-copy-button-background` | Hover background |
|
|
79
|
+
| `--cv-copy-button-hover-border-color` | `var(--cv-color-primary)` | Hover border color |
|
|
80
|
+
| `--cv-copy-button-hover-color` | `--cv-copy-button-color` | Hover text/icon color |
|
|
81
|
+
| `--cv-copy-button-plain-background` | `transparent` | Plain appearance background |
|
|
82
|
+
| `--cv-copy-button-plain-border-color` | `transparent` | Plain appearance border |
|
|
83
|
+
| `--cv-copy-button-plain-hover-background` | `--cv-copy-button-hover-background` | Plain hover background |
|
|
84
|
+
| `--cv-copy-button-plain-hover-border-color` | `--cv-copy-button-plain-border-color` | Plain hover border |
|
|
85
|
+
| `--cv-copy-button-plain-hover-color` | `--cv-copy-button-hover-color` | Plain hover text/icon color |
|
|
64
86
|
|
|
65
87
|
Additionally, component styles depend on theme tokens through fallback values:
|
|
66
88
|
|
|
@@ -93,11 +115,15 @@ Additionally, component styles depend on theme tokens through fallback values:
|
|
|
93
115
|
|
|
94
116
|
### UIKit properties to headless actions
|
|
95
117
|
|
|
96
|
-
| UIKit Property | Direction
|
|
97
|
-
| ------------------- |
|
|
98
|
-
| `disabled` | attr -> action
|
|
99
|
-
| `feedback-duration` | attr -> action
|
|
100
|
-
| `value` | prop -> action
|
|
118
|
+
| UIKit Property | Direction | Headless Binding |
|
|
119
|
+
| ------------------- | -------------------- | --------------------------------------------------- |
|
|
120
|
+
| `disabled` | attr -> action | `actions.setDisabled(value)` |
|
|
121
|
+
| `feedback-duration` | attr -> action | `actions.setFeedbackDuration(value)` |
|
|
122
|
+
| `value` | prop -> action | `actions.setValue(value)` |
|
|
123
|
+
| `clipboard` | prop -> model option | Recreates the model with the injected adapter |
|
|
124
|
+
| `aria-label` | attr -> model option | Recreates the model with the idle label |
|
|
125
|
+
| `success-label` | attr -> model option | Recreates the model with localized success feedback |
|
|
126
|
+
| `error-label` | attr -> model option | Recreates the model with localized error feedback |
|
|
101
127
|
|
|
102
128
|
### Headless state to DOM reflection
|
|
103
129
|
|
|
@@ -125,12 +151,16 @@ Additionally, component styles depend on theme tokens through fallback values:
|
|
|
125
151
|
| `feedback-duration` | `feedbackDuration` | Numeric attribute, defaults to `1500` |
|
|
126
152
|
| `disabled` | `isDisabled` | Boolean attribute |
|
|
127
153
|
| `aria-label` | `ariaLabel` | Standard ARIA labeling |
|
|
154
|
+
| `success-label` | `successLabel` | Localized success feedback label |
|
|
155
|
+
| `error-label` | `errorLabel` | Localized error feedback label |
|
|
156
|
+
| `clipboard` | `clipboard` | Property-only injectable clipboard adapter |
|
|
128
157
|
|
|
129
158
|
### UIKit-only concerns (not in headless)
|
|
130
159
|
|
|
131
160
|
- Icon rendering via slotted content (`copy-icon`, `success-icon`, `error-icon` slots with default SVG icons)
|
|
132
161
|
- CSS custom properties for sizing and colors (`--cv-copy-button-*`)
|
|
133
162
|
- `size` attribute controlling icon/button dimensions
|
|
163
|
+
- `appearance` attribute controlling default or plain visual treatment
|
|
134
164
|
- `cv-copy` and `cv-error` custom events dispatched on the host element
|
|
135
165
|
- Pulse/scale animation on copy activation
|
|
136
166
|
|
|
@@ -170,6 +200,13 @@ Events are dispatched by the UIKit adapter by providing `onCopy` and `onError` c
|
|
|
170
200
|
<!-- Custom feedback duration (3 seconds) -->
|
|
171
201
|
<cv-copy-button value="hello" feedback-duration="3000"></cv-copy-button>
|
|
172
202
|
|
|
203
|
+
<!-- Domain-specific clipboard adapter and localized feedback -->
|
|
204
|
+
<cv-copy-button
|
|
205
|
+
aria-label="Copy password"
|
|
206
|
+
success-label="Copied"
|
|
207
|
+
error-label="Failed to copy"
|
|
208
|
+
></cv-copy-button>
|
|
209
|
+
|
|
173
210
|
<!-- Custom icons via slots -->
|
|
174
211
|
<cv-copy-button value="hello">
|
|
175
212
|
<svg
|
|
@@ -8,21 +8,30 @@ Modal or non-modal dialog overlay for presenting focused content, confirmations,
|
|
|
8
8
|
|
|
9
9
|
```
|
|
10
10
|
<cv-dialog> (host)
|
|
11
|
-
├── <button part="trigger">
|
|
11
|
+
├── <button part="trigger"> (legacy, deprecated)
|
|
12
12
|
│ └── <slot name="trigger">
|
|
13
|
-
└──
|
|
14
|
-
└── <
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
└── modal=true:
|
|
14
|
+
└── <dialog class="portal-shell"> (top layer)
|
|
15
|
+
└── <div part="overlay">
|
|
16
|
+
└── <section part="content" role="dialog|alertdialog">
|
|
17
|
+
├── <header part="header">
|
|
18
|
+
│ ├── <h2 part="title" id="...">
|
|
19
|
+
│ │ └── <slot name="title">
|
|
20
|
+
│ ├── <p part="description" id="...">
|
|
21
|
+
│ │ └── <slot name="description">
|
|
22
|
+
│ └── <button part="header-close" aria-label="Close">
|
|
23
|
+
│ └── <slot name="header-close">
|
|
24
|
+
├── <div part="body">
|
|
25
|
+
│ └── <slot>
|
|
26
|
+
└── <footer part="footer">
|
|
27
|
+
└── <slot name="footer">
|
|
28
|
+
└── modal=false:
|
|
29
|
+
└── <div class="portal-shell popover-shell" popover="manual"> (top layer)
|
|
30
|
+
└── <div part="overlay">
|
|
31
|
+
└── <section part="content" role="dialog|alertdialog">
|
|
32
|
+
├── <header part="header">
|
|
33
|
+
├── <div part="body">
|
|
34
|
+
└── <footer part="footer">
|
|
26
35
|
```
|
|
27
36
|
|
|
28
37
|
## Attributes
|
|
@@ -40,20 +49,20 @@ Modal or non-modal dialog overlay for presenting focused content, confirmations,
|
|
|
40
49
|
|
|
41
50
|
## Slots
|
|
42
51
|
|
|
43
|
-
| Slot | Description
|
|
44
|
-
| -------------- |
|
|
45
|
-
| `(default)` | Dialog body content
|
|
46
|
-
| `trigger` |
|
|
47
|
-
| `title` | Dialog title text
|
|
48
|
-
| `description` | Description text below the title
|
|
49
|
-
| `header-close` | Icon content for the header close button (defaults to X)
|
|
50
|
-
| `footer` | Footer content (action buttons, etc.)
|
|
52
|
+
| Slot | Description |
|
|
53
|
+
| -------------- | --------------------------------------------------------- |
|
|
54
|
+
| `(default)` | Dialog body content |
|
|
55
|
+
| `trigger` | Deprecated legacy content for the built-in trigger button |
|
|
56
|
+
| `title` | Dialog title text |
|
|
57
|
+
| `description` | Description text below the title |
|
|
58
|
+
| `header-close` | Icon content for the header close button (defaults to X) |
|
|
59
|
+
| `footer` | Footer content (action buttons, etc.) |
|
|
51
60
|
|
|
52
61
|
## CSS Parts
|
|
53
62
|
|
|
54
63
|
| Part | Element | Description |
|
|
55
64
|
| -------------- | ----------- | ----------------------------------------------------------------- |
|
|
56
|
-
| `trigger` | `<button>` |
|
|
65
|
+
| `trigger` | `<button>` | Deprecated built-in trigger button |
|
|
57
66
|
| `overlay` | `<div>` | Backdrop/overlay container |
|
|
58
67
|
| `content` | `<section>` | Dialog content panel with `role="dialog"` or `role="alertdialog"` |
|
|
59
68
|
| `header` | `<header>` | Header area containing title, description, and close button |
|
|
@@ -65,25 +74,36 @@ Modal or non-modal dialog overlay for presenting focused content, confirmations,
|
|
|
65
74
|
|
|
66
75
|
## CSS Custom Properties
|
|
67
76
|
|
|
68
|
-
| Property
|
|
69
|
-
|
|
|
70
|
-
| `--cv-dialog-width`
|
|
71
|
-
| `--cv-dialog-
|
|
72
|
-
| `--cv-dialog-
|
|
73
|
-
| `--cv-dialog-
|
|
74
|
-
| `--cv-dialog-
|
|
75
|
-
| `--cv-dialog-
|
|
76
|
-
| `--cv-dialog-
|
|
77
|
+
| Property | Default | Description |
|
|
78
|
+
| -------------------------------------- | ---------------------------------------------------------- | ------------------------------------ |
|
|
79
|
+
| `--cv-dialog-width` | `var(--cv-dialog-width-m, min(560px, calc(100vw - 32px)))` | Preferred dialog inline size |
|
|
80
|
+
| `--cv-dialog-width-s` | app/theme provided | Standard small dialog inline size |
|
|
81
|
+
| `--cv-dialog-width-m` | app/theme provided | Standard medium dialog inline size |
|
|
82
|
+
| `--cv-dialog-width-l` | app/theme provided | Standard large dialog inline size |
|
|
83
|
+
| `--cv-dialog-width-xl` | app/theme provided | Standard extra-large dialog size |
|
|
84
|
+
| `--cv-dialog-max-height` | `calc(100dvh - 32px)` | Maximum block size before scrolling |
|
|
85
|
+
| `--cv-dialog-header-spacing` | `var(--cv-space-4, 16px)` | Header padding |
|
|
86
|
+
| `--cv-dialog-body-spacing` | `var(--cv-space-4, 16px)` | Body padding |
|
|
87
|
+
| `--cv-dialog-footer-spacing` | `var(--cv-space-4, 16px)` | Footer padding |
|
|
88
|
+
| `--cv-dialog-overlay-color` | `var(--cv-color-overlay)` | Backdrop overlay color |
|
|
89
|
+
| `--cv-dialog-border-radius` | `var(--cv-radius-lg, 14px)` | Panel border radius |
|
|
90
|
+
| `--cv-dialog-transition-duration` | `var(--cv-duration-fast, 120ms)` | Presence transition duration |
|
|
91
|
+
| `--cv-dialog-transition-easing-open` | `var(--cv-easing-decelerate)` | Opening transition easing |
|
|
92
|
+
| `--cv-dialog-transition-easing-close` | `var(--cv-easing-accelerate)` | Closing transition easing |
|
|
93
|
+
| `--cv-dialog-content-closed-transform` | `translate3d(0, 8px, 0) scale(0.98)` | Panel transform while closed/closing |
|
|
94
|
+
| `--cv-dialog-content-open-transform` | `translate3d(0, 0, 0) scale(1)` | Panel transform while open |
|
|
77
95
|
|
|
78
96
|
## Visual States
|
|
79
97
|
|
|
80
98
|
| Host selector | Description |
|
|
81
99
|
| ----------------------------- | ----------------------------------------------------- |
|
|
82
|
-
| `:host([open])` | Dialog
|
|
100
|
+
| `:host([open])` | Dialog logical state is open |
|
|
83
101
|
| `:host([modal])` | Modal mode active (focus trap, scroll lock, backdrop) |
|
|
84
102
|
| `:host([type="alertdialog"])` | Alert dialog mode with `role="alertdialog"` |
|
|
85
103
|
| `:host([no-header])` | Header section hidden |
|
|
86
104
|
|
|
105
|
+
The top-layer shell, overlay, and content expose `data-state="closed|opening|open|closing"` internally. The shell remains mounted during `closing` so the exit transition can finish before native dialog/popover cleanup.
|
|
106
|
+
|
|
87
107
|
## Events
|
|
88
108
|
|
|
89
109
|
| Event | Detail | Description |
|
|
@@ -97,6 +117,8 @@ Modal or non-modal dialog overlay for presenting focused content, confirmations,
|
|
|
97
117
|
|
|
98
118
|
`cv-input` and `cv-change` fire only for user-initiated state changes (trigger click, Escape, outside pointer, outside focus, header close). Programmatic `open` attribute changes do not emit these events.
|
|
99
119
|
|
|
120
|
+
`cv-after-show` and `cv-after-hide` fire after the presence transition completes. Reduced-motion and zero-duration paths complete immediately.
|
|
121
|
+
|
|
100
122
|
## Reactive State Mapping
|
|
101
123
|
|
|
102
124
|
`cv-dialog` is a visual adapter over headless `createDialog`.
|
|
@@ -129,15 +151,17 @@ Modal or non-modal dialog overlay for presenting focused content, confirmations,
|
|
|
129
151
|
- `contracts.getDescriptionProps()` is spread onto `[part="description"]` to apply the `id` for `aria-describedby`.
|
|
130
152
|
- `contracts.getHeaderCloseButtonProps()` is spread onto `[part="header-close"]` to apply `role`, `tabindex`, `aria-label: 'Close'`, and click handler.
|
|
131
153
|
- UIKit dispatches `cv-input` and `cv-change` events by observing `isOpen` changes triggered by user interaction (not by controlled `open` attribute changes).
|
|
132
|
-
- UIKit dispatches `cv-show`/`cv-after-show`/`cv-
|
|
154
|
+
- UIKit dispatches `cv-show`/`cv-hide` immediately and `cv-after-show`/`cv-after-hide` after presence transitions.
|
|
155
|
+
- UIKit renders the visible dialog through native top-layer primitives (`<dialog>` for modal, popover root for non-modal) so it is not clipped by ancestor `overflow`, `contain`, `transform`, or `isolation`.
|
|
133
156
|
- UIKit owns scroll lock implementation, focus trap implementation, focus restoration, backdrop rendering, and CSS transitions — headless provides signals, UIKit applies side effects.
|
|
157
|
+
- UIKit keeps modal scroll lock and native top-layer presence active during the close transition, then restores focus after the shell has closed.
|
|
134
158
|
|
|
135
159
|
## Usage
|
|
136
160
|
|
|
137
161
|
```html
|
|
138
|
-
<!--
|
|
139
|
-
<
|
|
140
|
-
|
|
162
|
+
<!-- Controlled dialog -->
|
|
163
|
+
<button type="button" onclick="dialog.open = true">Open</button>
|
|
164
|
+
<cv-dialog id="dialog">
|
|
141
165
|
<span slot="title">Confirm action</span>
|
|
142
166
|
<span slot="description">Are you sure you want to proceed?</span>
|
|
143
167
|
<p>This action cannot be undone.</p>
|
|
@@ -148,8 +172,8 @@ Modal or non-modal dialog overlay for presenting focused content, confirmations,
|
|
|
148
172
|
</cv-dialog>
|
|
149
173
|
|
|
150
174
|
<!-- Alert dialog -->
|
|
151
|
-
<
|
|
152
|
-
|
|
175
|
+
<button type="button" onclick="alertDialog.open = true">Delete</button>
|
|
176
|
+
<cv-dialog id="alertDialog" type="alertdialog">
|
|
153
177
|
<span slot="title">Delete item?</span>
|
|
154
178
|
<span slot="description">This will permanently delete the item.</span>
|
|
155
179
|
<div slot="footer">
|
|
@@ -159,15 +183,14 @@ Modal or non-modal dialog overlay for presenting focused content, confirmations,
|
|
|
159
183
|
</cv-dialog>
|
|
160
184
|
|
|
161
185
|
<!-- Non-modal dialog -->
|
|
162
|
-
<
|
|
163
|
-
|
|
186
|
+
<button type="button" onclick="infoDialog.open = true">Show info</button>
|
|
187
|
+
<cv-dialog id="infoDialog" modal="false">
|
|
164
188
|
<span slot="title">Information</span>
|
|
165
189
|
<p>This dialog does not block the page.</p>
|
|
166
190
|
</cv-dialog>
|
|
167
191
|
|
|
168
192
|
<!-- Without header -->
|
|
169
193
|
<cv-dialog no-header>
|
|
170
|
-
<span slot="trigger">Quick action</span>
|
|
171
194
|
<p>Minimal dialog with body content only.</p>
|
|
172
195
|
<div slot="footer">
|
|
173
196
|
<cv-button variant="primary">OK</cv-button>
|
|
@@ -176,9 +199,15 @@ Modal or non-modal dialog overlay for presenting focused content, confirmations,
|
|
|
176
199
|
|
|
177
200
|
<!-- Custom header close icon -->
|
|
178
201
|
<cv-dialog>
|
|
179
|
-
<span slot="trigger">Open</span>
|
|
180
202
|
<span slot="title">Settings</span>
|
|
181
203
|
<icon-close slot="header-close"></icon-close>
|
|
182
204
|
<p>Dialog content here.</p>
|
|
183
205
|
</cv-dialog>
|
|
206
|
+
|
|
207
|
+
<!-- Legacy built-in trigger (deprecated) -->
|
|
208
|
+
<cv-dialog>
|
|
209
|
+
<span slot="trigger">Open</span>
|
|
210
|
+
<span slot="title">Legacy trigger</span>
|
|
211
|
+
<p>Prefer external triggers with controlled .open.</p>
|
|
212
|
+
</cv-dialog>
|
|
184
213
|
```
|
|
@@ -38,6 +38,7 @@ Slide-out panel dialog anchored to a viewport edge, used for navigation, forms,
|
|
|
38
38
|
| `close-on-outside-focus` | Boolean | `true` | Whether focusing outside closes the drawer |
|
|
39
39
|
| `initial-focus-id` | String | --- | Id of element to focus when drawer opens |
|
|
40
40
|
| `no-header` | Boolean | `false` | Hides the header (title, description, header close button) |
|
|
41
|
+
| `drag-to-close` | Boolean | `false` | Enables touch drag dismissal in the drawer's closing direction |
|
|
41
42
|
|
|
42
43
|
## Slots
|
|
43
44
|
|
|
@@ -66,19 +67,22 @@ Slide-out panel dialog anchored to a viewport edge, used for navigation, forms,
|
|
|
66
67
|
|
|
67
68
|
## CSS Custom Properties
|
|
68
69
|
|
|
69
|
-
| Property | Default
|
|
70
|
-
| ----------------------------------------- |
|
|
71
|
-
| `--cv-drawer-z-index` | `40`
|
|
72
|
-
| `--cv-drawer-size` | `360px`
|
|
73
|
-
| `--cv-drawer-max-size` | `calc(100dvh - 32px)`
|
|
74
|
-
| `--cv-drawer-header-spacing` | `var(--cv-space-4, 16px)`
|
|
75
|
-
| `--cv-drawer-body-spacing` | `var(--cv-space-4, 16px)`
|
|
76
|
-
| `--cv-drawer-footer-spacing` | `var(--cv-space-4, 16px)`
|
|
77
|
-
| `--cv-drawer-overlay-color` | `color-
|
|
78
|
-
| `--cv-drawer-overlay-transition-duration` | `0ms`
|
|
79
|
-
| `--cv-drawer-overlay-closed-opacity` | `1`
|
|
80
|
-
| `--cv-drawer-border-radius` | `var(--cv-radius-lg, 14px)`
|
|
81
|
-
| `--cv-drawer-transition-duration` | `250ms`
|
|
70
|
+
| Property | Default | Description |
|
|
71
|
+
| ----------------------------------------- | --------------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
72
|
+
| `--cv-drawer-z-index` | `40` | Z-index of the overlay layer |
|
|
73
|
+
| `--cv-drawer-size` | `360px` | Inline size (for `start`/`end`) or block size (for `top`/`bottom`) of the panel |
|
|
74
|
+
| `--cv-drawer-max-size` | `calc(100dvh - 32px)` | Maximum size before internal scrolling (block axis for `top`/`bottom`, inline axis for `start`/`end`) |
|
|
75
|
+
| `--cv-drawer-header-spacing` | `var(--cv-space-4, 16px)` | Header padding |
|
|
76
|
+
| `--cv-drawer-body-spacing` | `var(--cv-space-4, 16px)` | Body padding |
|
|
77
|
+
| `--cv-drawer-footer-spacing` | `var(--cv-space-4, 16px)` | Footer padding |
|
|
78
|
+
| `--cv-drawer-overlay-color` | `var(--cv-color-overlay)` | Backdrop overlay color |
|
|
79
|
+
| `--cv-drawer-overlay-transition-duration` | `0ms` | Overlay opacity transition duration |
|
|
80
|
+
| `--cv-drawer-overlay-closed-opacity` | `1` | Overlay opacity while the panel is animating out or before the panel animates in |
|
|
81
|
+
| `--cv-drawer-border-radius` | `var(--cv-radius-lg, 14px)` | Panel border radius (applied to the inward edge only) |
|
|
82
|
+
| `--cv-drawer-transition-duration` | `250ms` | Slide transition duration |
|
|
83
|
+
| `--cv-drawer-drag-offset-x` | `0px` | Internal horizontal drag offset applied while touch dragging |
|
|
84
|
+
| `--cv-drawer-drag-offset-y` | `0px` | Internal vertical drag offset applied while touch dragging |
|
|
85
|
+
| `--cv-drawer-drag-overlay-opacity` | `1` | Internal overlay opacity applied while touch dragging |
|
|
82
86
|
|
|
83
87
|
## Visual States
|
|
84
88
|
|
|
@@ -92,6 +96,7 @@ Slide-out panel dialog anchored to a viewport edge, used for navigation, forms,
|
|
|
92
96
|
| `:host([placement="end"])` | Panel anchored to the inline-end edge (right in LTR, left in RTL) |
|
|
93
97
|
| `:host([placement="top"])` | Panel anchored to the top edge |
|
|
94
98
|
| `:host([placement="bottom"])` | Panel anchored to the bottom edge |
|
|
99
|
+
| `:host([drag-to-close])` | Touch drag dismissal is enabled |
|
|
95
100
|
|
|
96
101
|
### Placement layout rules
|
|
97
102
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# cv-guidance-anchor
|
|
2
|
+
|
|
3
|
+
Lightweight semantic anchor wrapper for product guidance registration.
|
|
4
|
+
|
|
5
|
+
`cv-guidance-anchor` is a registration primitive only. It does not render guidance UI, own guidance progress, compute eligibility, or import app-layer guidance models. The wrapper host itself is the registered target element.
|
|
6
|
+
|
|
7
|
+
## Anatomy
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
<cv-guidance-anchor> (host)
|
|
11
|
+
└── <slot>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Attributes
|
|
15
|
+
|
|
16
|
+
| Attribute | Type | Default | Description |
|
|
17
|
+
| ----------- | ------ | ------- | ----------------------------------------------------- |
|
|
18
|
+
| `anchor-id` | String | `""` | Stable semantic identifier for the UI action or area. |
|
|
19
|
+
| `surface` | String | `""` | Product surface where the anchor is available. |
|
|
20
|
+
| `owner` | String | `""` | Owning feature or team metadata. |
|
|
21
|
+
|
|
22
|
+
## Slots
|
|
23
|
+
|
|
24
|
+
| Slot | Description |
|
|
25
|
+
| ----------- | ------------------------------------------------- |
|
|
26
|
+
| `(default)` | Action or content visually associated with anchor |
|
|
27
|
+
|
|
28
|
+
## CSS Parts
|
|
29
|
+
|
|
30
|
+
None.
|
|
31
|
+
|
|
32
|
+
## CSS Custom Properties
|
|
33
|
+
|
|
34
|
+
None. `cv-guidance-anchor` is a light wrapper with `display: contents` by default.
|
|
35
|
+
|
|
36
|
+
## Visual States
|
|
37
|
+
|
|
38
|
+
| Host selector | Description |
|
|
39
|
+
| ----------------- | -------------------------------------------- |
|
|
40
|
+
| `:host` | Uses `display: contents` for wrapper layout. |
|
|
41
|
+
| `:host([hidden])` | Hides the wrapper and its slotted content. |
|
|
42
|
+
|
|
43
|
+
## Events
|
|
44
|
+
|
|
45
|
+
| Event | When | Detail |
|
|
46
|
+
| ---------------------------- | ------------------------------ | ------------------------------------- |
|
|
47
|
+
| `guidance-anchor-register` | On connect and semantic update | `{anchorId, surface, owner, element}` |
|
|
48
|
+
| `guidance-anchor-unregister` | On disconnect | `{anchorId, surface, owner, element}` |
|
|
49
|
+
|
|
50
|
+
Both events bubble and are composed so an app-level guidance host can observe anchors across shadow boundaries. `detail.element` is always the `cv-guidance-anchor` host.
|
|
51
|
+
|
|
52
|
+
## Behavior
|
|
53
|
+
|
|
54
|
+
- Re-dispatches `guidance-anchor-register` when `anchor-id`, `surface`, or `owner` changes.
|
|
55
|
+
- Does not query slotted children, child shadow roots, global document selectors, translated text, or coordinates.
|
|
56
|
+
- Complex components whose real target is inside Shadow DOM should dispatch the same events manually with the actual `HTMLElement`.
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
```html
|
|
61
|
+
<cv-guidance-anchor anchor-id="files.create-or-upload" surface="files" owner="files">
|
|
62
|
+
<button type="button">Upload</button>
|
|
63
|
+
</cv-guidance-anchor>
|
|
64
|
+
```
|