@cscfi/csc-ui 4.0.0-alpha.15 → 4.0.0-alpha.16
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/csc-ui.js +5978 -5951
- package/dist/docs/c-autocomplete/usage.md +9 -9
- package/dist/docs/c-select/usage.md +9 -9
- package/dist/docs/c-tree-select/usage.md +9 -9
- package/dist/web-types.json +1 -1
- package/dist-types/shared/useAnchoredPanel.d.ts +14 -10
- package/dist-types/shared/visualViewport.d.ts +29 -13
- package/package.json +1 -1
|
@@ -163,15 +163,15 @@ c-autocomplete::part(list) {
|
|
|
163
163
|
## Narrow viewports
|
|
164
164
|
|
|
165
165
|
On a viewport narrower than 760px the panel opens as a **fullscreen panel**
|
|
166
|
-
instead of anchoring under the field: a heading row with the field's `label` and
|
|
167
|
-
close button, the search input beneath it, then the options filling the rest
|
|
168
|
-
the screen. The
|
|
169
|
-
keyboard is open; the close button and
|
|
170
|
-
the page behind the panel is inert until
|
|
171
|
-
half-row cut — the screen edge is the cue. The
|
|
172
|
-
width, never the field's, so a narrow field on a
|
|
173
|
-
panel. The close button's label is the `closePanel`
|
|
174
|
-
parts are `heading-row`, `heading` and `close`:
|
|
166
|
+
instead of anchoring under the field: a heading row with the field's `label` and
|
|
167
|
+
a close button, the search input beneath it, then the options filling the rest
|
|
168
|
+
of the screen. The panel keeps covering the screen and the rows above the
|
|
169
|
+
options stay in view while the on-screen keyboard is open; the close button and
|
|
170
|
+
Escape both return focus to the field; the page behind the panel is inert until
|
|
171
|
+
it closes, and the list has no half-row cut — the screen edge is the cue. The
|
|
172
|
+
threshold is the viewport's width, never the field's, so a narrow field on a
|
|
173
|
+
desktop keeps its anchored panel. The close button's label is the `closePanel`
|
|
174
|
+
text, and the row's parts are `heading-row`, `heading` and `close`:
|
|
175
175
|
|
|
176
176
|
```css
|
|
177
177
|
c-autocomplete::part(heading-row) {
|
|
@@ -110,15 +110,15 @@ c-select::part(list) {
|
|
|
110
110
|
## Narrow viewports
|
|
111
111
|
|
|
112
112
|
On a viewport narrower than 760px the panel opens as a **fullscreen panel**
|
|
113
|
-
instead of dropping under the field: a heading row with the field's `label` and
|
|
114
|
-
close button, the field itself beneath it, then the options filling the rest
|
|
115
|
-
the screen. The
|
|
116
|
-
keyboard is open; the close button and
|
|
117
|
-
the page behind the panel is inert until
|
|
118
|
-
half-row cut — the screen edge is the cue. The
|
|
119
|
-
width, never the field's, so a narrow field on a
|
|
120
|
-
panel. The close button's label is the `closePanel`
|
|
121
|
-
parts are `heading-row`, `heading` and `close`:
|
|
113
|
+
instead of dropping under the field: a heading row with the field's `label` and
|
|
114
|
+
a close button, the field itself beneath it, then the options filling the rest
|
|
115
|
+
of the screen. The panel keeps covering the screen and the rows above the
|
|
116
|
+
options stay in view while the on-screen keyboard is open; the close button and
|
|
117
|
+
Escape both return focus to the field; the page behind the panel is inert until
|
|
118
|
+
it closes, and the list has no half-row cut — the screen edge is the cue. The
|
|
119
|
+
threshold is the viewport's width, never the field's, so a narrow field on a
|
|
120
|
+
desktop keeps its anchored panel. The close button's label is the `closePanel`
|
|
121
|
+
text, and the row's parts are `heading-row`, `heading` and `close`:
|
|
122
122
|
|
|
123
123
|
```css
|
|
124
124
|
c-select::part(heading-row) {
|
|
@@ -130,15 +130,15 @@ c-tree-select::part(list) {
|
|
|
130
130
|
## Narrow viewports
|
|
131
131
|
|
|
132
132
|
On a viewport narrower than 760px the panel opens as a **fullscreen panel**
|
|
133
|
-
instead of anchoring under the field: a heading row with the field's `label` and
|
|
134
|
-
close button, the search input beneath it, then the items filling the rest of
|
|
135
|
-
the screen. The
|
|
136
|
-
keyboard is open; the close button and Escape
|
|
137
|
-
the page behind the panel is inert until it
|
|
138
|
-
half-row cut — the screen edge is the cue. The
|
|
139
|
-
width, never the field's, so a narrow field on a
|
|
140
|
-
panel. The close button's label is the `closePanel`
|
|
141
|
-
parts are `heading-row`, `heading` and `close`:
|
|
133
|
+
instead of anchoring under the field: a heading row with the field's `label` and
|
|
134
|
+
a close button, the search input beneath it, then the items filling the rest of
|
|
135
|
+
the screen. The panel keeps covering the screen and the rows above the items
|
|
136
|
+
stay in view while the on-screen keyboard is open; the close button and Escape
|
|
137
|
+
both return focus to the field; the page behind the panel is inert until it
|
|
138
|
+
closes, and the list has no half-row cut — the screen edge is the cue. The
|
|
139
|
+
threshold is the viewport's width, never the field's, so a narrow field on a
|
|
140
|
+
desktop keeps its anchored panel. The close button's label is the `closePanel`
|
|
141
|
+
text, and the row's parts are `heading-row`, `heading` and `close`:
|
|
142
142
|
|
|
143
143
|
```css
|
|
144
144
|
c-tree-select::part(heading-row) {
|
package/dist/web-types.json
CHANGED
|
@@ -19,11 +19,13 @@
|
|
|
19
19
|
* back with a negative block-start margin;
|
|
20
20
|
* - the fullscreen layout: chosen at `open()` from the `fullscreen`
|
|
21
21
|
* predicate and kept for the whole open (crossing the threshold while open
|
|
22
|
-
* closes the panel). The panel drops anchor positioning and
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
22
|
+
* closes the panel). The panel drops anchor positioning and becomes the
|
|
23
|
+
* surface — `position: fixed; inset: 0`, the layout viewport, which the
|
|
24
|
+
* on-screen keyboard overlays but never shrinks — while the card inside it
|
|
25
|
+
* follows the *visual* viewport (`visualViewport` resize / scroll while
|
|
26
|
+
* open; `cardStyle`), so the heading row and search input stay above the
|
|
27
|
+
* keyboard and the page never shows beside them. The page behind it is
|
|
28
|
+
* locked (`pageLock.ts`: inert except toasts, no document scroll);
|
|
27
29
|
* - open / close through `showPopover()` / `hidePopover()` on a
|
|
28
30
|
* `popover="manual"` panel, with the native `toggle` event as the single
|
|
29
31
|
* source of truth for `isOpen` (browser-initiated closes included);
|
|
@@ -37,10 +39,10 @@
|
|
|
37
39
|
* `--c-field-panel-above-left` flip rules and `position-try-fallbacks` —
|
|
38
40
|
* per-shadow-root escape-hatch CSS (ADR-0007; each element type has its own
|
|
39
41
|
* adopted sheet, so the block is copy-identical in every consumer) — the
|
|
40
|
-
* fullscreen `tv` variant (
|
|
41
|
-
*
|
|
42
|
-
* announcement), run from
|
|
43
|
-
* handler.
|
|
42
|
+
* fullscreen `tv` variant (the panel paints the surface, the card sheds its
|
|
43
|
+
* anchored chrome, the list takes the rest, the heading row) and the open
|
|
44
|
+
* sequence (peek cap, focus, highlight seed, announcement), run from
|
|
45
|
+
* `onOpened` synchronously inside the `toggle` handler.
|
|
44
46
|
*/
|
|
45
47
|
import { type ComputedRef, type MaybeRefOrGetter, type Ref } from 'vue';
|
|
46
48
|
/**
|
|
@@ -51,6 +53,8 @@ export declare const FIELD_PANEL_ANCHOR = "--c-field-panel-anchor";
|
|
|
51
53
|
export interface AnchoredPanel {
|
|
52
54
|
/** Inline style for the anchor wrapper: `anchor-name: --c-field-panel-anchor`. */
|
|
53
55
|
anchorStyle: string;
|
|
56
|
+
/** Inline style for the card inside the panel: empty while anchored; fullscreen — the visual viewport's box inside the surface (the whole surface with no API). */
|
|
57
|
+
cardStyle: ComputedRef<string>;
|
|
54
58
|
/** Hide the panel; `returnFocus` moves focus to `returnFocusTo` once the `toggle` event confirms the close. */
|
|
55
59
|
close(returnFocus?: boolean): void;
|
|
56
60
|
/** Open state — written only by the native `toggle` event (single source of truth, browser-initiated closes included). */
|
|
@@ -61,7 +65,7 @@ export interface AnchoredPanel {
|
|
|
61
65
|
onToggle(event: Event): void;
|
|
62
66
|
/** Choose the layout, measure (anchored: the anchor width and the field's message height), then `showPopover()`. */
|
|
63
67
|
open(): void;
|
|
64
|
-
/** Inline style for the panel: anchored — `position-anchor`, `position-area: bottom span-right`, `inset: auto`, the pinned width and the message pull-back; fullscreen — the
|
|
68
|
+
/** Inline style for the panel: anchored — `position-anchor`, `position-area: bottom span-right`, `inset: auto`, the pinned width and the message pull-back; fullscreen — the surface, the layout viewport's box. */
|
|
65
69
|
panelStyle: ComputedRef<string>;
|
|
66
70
|
}
|
|
67
71
|
/** The two layouts one field panel takes (CONTEXT.md "Fullscreen panel"). */
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Visual viewport tracking for the **fullscreen panel** (CONTEXT.md,
|
|
3
|
-
* ADR-0050).
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
3
|
+
* ADR-0050). Two layers. The *surface* — the panel element itself,
|
|
4
|
+
* `position: fixed; inset: 0` — spans the layout viewport, which the
|
|
5
|
+
* on-screen keyboard overlays but never shrinks, so it covers everything
|
|
6
|
+
* visible whatever the keyboard does. The *content box* inside it (heading
|
|
7
|
+
* row, search input, list) follows `visualViewport` — the only API that sees
|
|
8
|
+
* the iOS keyboard — so it ends above the keyboard. A late or wrong box then
|
|
9
|
+
* shows more surface, never the page. Both fullscreen implementations (the
|
|
10
|
+
* anchored-panel composable and `c-dropdown`'s dialog) go through this one
|
|
11
|
+
* helper while they are open.
|
|
8
12
|
*/
|
|
9
13
|
/** Stop following the visual viewport. Idempotent. */
|
|
10
14
|
export type StopTracking = () => void;
|
|
@@ -15,7 +19,7 @@ export interface ViewportBox {
|
|
|
15
19
|
top: number;
|
|
16
20
|
width: number;
|
|
17
21
|
}
|
|
18
|
-
/** The current visual viewport box; `null` where the API is missing (then
|
|
22
|
+
/** The current visual viewport box; `null` where the API is missing (then the content box fills the surface). */
|
|
19
23
|
export declare const readVisualViewport: () => null | ViewportBox;
|
|
20
24
|
/**
|
|
21
25
|
* Report the visual viewport's box now and on every resize / scroll of it
|
|
@@ -25,11 +29,23 @@ export declare const readVisualViewport: () => null | ViewportBox;
|
|
|
25
29
|
*/
|
|
26
30
|
export declare const trackVisualViewport: (onBox: (box: null | ViewportBox) => void) => StopTracking;
|
|
27
31
|
/**
|
|
28
|
-
* Inline declarations that make a
|
|
29
|
-
* viewport's box
|
|
30
|
-
*
|
|
31
|
-
* auto margins).
|
|
32
|
+
* Inline declarations that make a top-layer element the surface: the layout
|
|
33
|
+
* viewport's box. Overrides the UA popover / dialog defaults (`inset: 0` is
|
|
34
|
+
* theirs too, but with fit-content sizing and auto margins).
|
|
32
35
|
*/
|
|
33
|
-
export declare const
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
+
export declare const FULLSCREEN_SURFACE_STYLE = "position:fixed;inset:0;margin:0;width:auto;height:auto;";
|
|
37
|
+
/**
|
|
38
|
+
* Inline declarations placing the content box inside the surface on the
|
|
39
|
+
* visual viewport's box; with no box (no API) it fills the surface.
|
|
40
|
+
*/
|
|
41
|
+
export declare const contentBoxStyle: (box: null | ViewportBox) => string;
|
|
42
|
+
/**
|
|
43
|
+
* `FULLSCREEN_SURFACE_STYLE` written straight onto an element's inline style,
|
|
44
|
+
* for a surface whose placement is imperative (`c-dropdown`'s dialog). Margins
|
|
45
|
+
* are left to its classes.
|
|
46
|
+
*/
|
|
47
|
+
export declare const applyFullscreenSurface: (el: HTMLElement) => void;
|
|
48
|
+
/** `contentBoxStyle(box)` written straight onto an element's inline style. */
|
|
49
|
+
export declare const applyContentBox: (el: HTMLElement, box: null | ViewportBox) => void;
|
|
50
|
+
/** Remove exactly what `applyContentBox` set. */
|
|
51
|
+
export declare const clearContentBox: (el: HTMLElement) => void;
|
package/package.json
CHANGED