@cscfi/csc-ui 4.0.0-alpha.14 → 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 +7427 -7139
- package/dist/custom-elements.json +264 -56
- package/dist/docs/c-autocomplete/usage.md +25 -2
- package/dist/docs/c-button-group/usage.md +1 -1
- package/dist/docs/c-select/usage.md +25 -2
- package/dist/docs/c-tree-select/usage.md +25 -2
- package/dist/vscode.css-custom-data.json +48 -0
- package/dist/vscode.html-custom-data.json +14 -4
- package/dist/web-types.json +83 -15
- package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +32 -8
- package/dist-types/components/c-button/CButton.vue.d.ts +1 -1
- package/dist-types/components/c-button-group/CButtonGroup.vue.d.ts +1 -1
- package/dist-types/components/c-checkbox/CCheckbox.vue.d.ts +1 -1
- package/dist-types/components/c-data-table/CDataTable.vue.d.ts +5 -1
- package/dist-types/components/c-dropdown/CDropdown.vue.d.ts +24 -10
- package/dist-types/components/c-icon-button/CIconButton.vue.d.ts +1 -1
- package/dist-types/components/c-input/CInput.vue.d.ts +2 -2
- package/dist-types/components/c-otp-input/COtpInput.vue.d.ts +1 -1
- package/dist-types/components/c-pagination/CPagination.vue.d.ts +1 -1
- package/dist-types/components/c-radio-group/CRadioGroup.vue.d.ts +1 -1
- package/dist-types/components/c-select/CSelect.vue.d.ts +32 -8
- package/dist-types/components/c-switch/CSwitch.vue.d.ts +1 -1
- package/dist-types/components/c-tag/CTag.vue.d.ts +1 -1
- package/dist-types/components/c-text-field/CTextField.vue.d.ts +11 -4
- package/dist-types/components/c-tree-select/CTreeSelect.vue.d.ts +17 -3
- package/dist-types/index.d.ts +2 -0
- package/dist-types/shared/FormLabel.vue.d.ts +1 -1
- package/dist-types/shared/PanelHeadingRow.vue.d.ts +13 -0
- package/dist-types/shared/appDefaults.d.ts +75 -0
- package/dist-types/shared/defineElement.d.ts +1 -0
- package/dist-types/shared/lightDismiss.d.ts +35 -0
- package/dist-types/shared/modalStack.d.ts +4 -3
- package/dist-types/shared/pageLock.d.ts +26 -0
- package/dist-types/shared/popoverChain.d.ts +9 -6
- package/dist-types/shared/useAnchoredPanel.d.ts +34 -13
- package/dist-types/shared/useNarrowViewport.d.ts +19 -0
- package/dist-types/shared/visualViewport.d.ts +51 -0
- package/dist-types/tag-name-map.d.ts +36 -7
- package/package.json +13 -4
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Light dismiss (CONTEXT.md "Light dismiss", ADR-0050): the platform's rule
|
|
3
|
+
* for closing a transient surface from the pointer, shared by every surface
|
|
4
|
+
* that implements dismissal itself — the anchored field panels
|
|
5
|
+
* (`useAnchoredPanel`), the popover chain and `c-menu`, all of which are
|
|
6
|
+
* `popover="manual"` and so get nothing from the browser.
|
|
7
|
+
*
|
|
8
|
+
* A native `popover="auto"` does not close on `pointerdown`: the browser
|
|
9
|
+
* remembers where the press landed and dismisses on the matching `pointerup`
|
|
10
|
+
* only when *both* fell outside. A touch scroll begins with a `pointerdown`
|
|
11
|
+
* and turns into `pointercancel`, never `pointerup`, so scrolling the page
|
|
12
|
+
* under an open surface leaves it open. The hand-rolled `pointerdown`
|
|
13
|
+
* listeners this module replaces closed the panel on the first touch of every
|
|
14
|
+
* scroll — the bug that made `c-tree-select` unusable on a phone.
|
|
15
|
+
*
|
|
16
|
+
* Listeners are capture-phase on `document`, like the ones they replace, so a
|
|
17
|
+
* consumer's `stopPropagation()` cannot hide an outside press from them.
|
|
18
|
+
*/
|
|
19
|
+
/** Detach the listeners `attachPointerPair` / `attachLightDismiss` installed. Idempotent. */
|
|
20
|
+
export type Detach = () => void;
|
|
21
|
+
/**
|
|
22
|
+
* Report each completed primary-pointer press-and-release pair with both
|
|
23
|
+
* composed paths. A press that ends in `pointercancel` — a touch that became a
|
|
24
|
+
* scroll or a pan — is dropped, and a release with no press seen since attach
|
|
25
|
+
* (the gesture that opened the surface) is ignored.
|
|
26
|
+
*/
|
|
27
|
+
export declare const attachPointerPair: (onPair: (down: EventTarget[], up: EventTarget[]) => void) => Detach;
|
|
28
|
+
export interface LightDismissOptions {
|
|
29
|
+
/** True when a composed event path passes through the surface's own inside (host subtree, panel, designated trigger). */
|
|
30
|
+
isInside(path: EventTarget[]): boolean;
|
|
31
|
+
/** The press and its release both landed outside: close the surface. */
|
|
32
|
+
onDismiss(): void;
|
|
33
|
+
}
|
|
34
|
+
/** The single-surface case: dismiss when press and release both landed outside. */
|
|
35
|
+
export declare const attachLightDismiss: (options: LightDismissOptions) => Detach;
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
* below the toast band,
|
|
14
14
|
* - **backdrop visibility**: exactly one backdrop — the active modal's — is
|
|
15
15
|
* visible at a time,
|
|
16
|
-
* - **inertness
|
|
17
|
-
* `
|
|
18
|
-
* -
|
|
16
|
+
* - **inertness** and **scroll lock**, delegated to the shared page lock
|
|
17
|
+
* (`pageLock.ts`, ADR-0050): everything outside the active modal is
|
|
18
|
+
* `inert` except `c-toasts`, and the document stops scrolling while the
|
|
19
|
+
* stack is non-empty,
|
|
19
20
|
* - **Escape routing** to the active modal only, and
|
|
20
21
|
* - **focus restore** to the element focused when each modal opened.
|
|
21
22
|
*/
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Page lock (ADR-0014, ADR-0050): library-owned modality for surfaces that
|
|
3
|
+
* must own the page without entering the browser's modal top layer — which
|
|
4
|
+
* would inert the toasts. While any holder is registered, everything outside
|
|
5
|
+
* the *active* holder's host is `inert` (a `c-toasts` anywhere stays
|
|
6
|
+
* interactive) and document scroll is locked.
|
|
7
|
+
*
|
|
8
|
+
* Holders form a stack; the most recently locked host is the active one. The
|
|
9
|
+
* modal stack pushes each opening `c-modal` here, and a **fullscreen panel**
|
|
10
|
+
* pushes its field's host — so a select opened inside a modal on a phone
|
|
11
|
+
* inerts the modal's other content along with the page, and closing it hands
|
|
12
|
+
* the page back to the modal. Consumer-set `inert` is never touched.
|
|
13
|
+
*/
|
|
14
|
+
/** True while `host` holds the lock (active or below another holder). */
|
|
15
|
+
export declare const isPageLockedBy: (host: HTMLElement) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Register `host` as the active holder: everything outside it goes inert and
|
|
18
|
+
* the document stops scrolling. Idempotent for a host already holding.
|
|
19
|
+
*/
|
|
20
|
+
export declare const lockPage: (host: HTMLElement) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Release `host` (idempotent). The next holder down, if any, becomes active
|
|
23
|
+
* and the inert set is re-derived for it; with no holder left the page is
|
|
24
|
+
* fully interactive and scrolls again.
|
|
25
|
+
*/
|
|
26
|
+
export declare const unlockPage: (host: HTMLElement) => void;
|
|
@@ -11,12 +11,15 @@
|
|
|
11
11
|
* inside a popover listens on its own host (bubble), i.e. *after* this
|
|
12
12
|
* capture listener — that Escape closes both, exactly as it did when each
|
|
13
13
|
* popover owned its own capture listener.
|
|
14
|
-
* - **
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
14
|
+
* - **Light dismiss** (CONTEXT.md, ADR-0050) closes every popover that does
|
|
15
|
+
* not *logically* contain the pointer gesture. A press and its release are
|
|
16
|
+
* paired (`lightDismiss.ts` — a press alone, the start of every touch
|
|
17
|
+
* scroll, closes nothing); from the innermost down, everything above the
|
|
18
|
+
* deepest member whose own inside (host subtree, panel, designated
|
|
19
|
+
* trigger) contains either composed path is closed. Containment is
|
|
20
|
+
* logical, not DOM ancestry — a popover whose host lives elsewhere still
|
|
21
|
+
* shields its ancestors, because ancestry is recorded in the chain itself,
|
|
22
|
+
* not re-derived from the DOM.
|
|
20
23
|
* - **Opening** a popover whose trigger sits inside an open member joins the
|
|
21
24
|
* chain below it; one whose trigger is elsewhere replaces the chain.
|
|
22
25
|
* Siblings therefore never coexist.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anchored field panel (CONTEXT.md "Autocomplete", "Tree select", "Top
|
|
3
|
-
* layer"; ADR-0008, ADR-0009, ADR-0047): the
|
|
4
|
-
* value-selection fields that keep a readonly value
|
|
5
|
-
* native popover panel
|
|
6
|
-
* `c-tree-select`.
|
|
3
|
+
* layer", "Fullscreen panel"; ADR-0008, ADR-0009, ADR-0047, ADR-0050): the
|
|
4
|
+
* lifecycle shared by the value-selection fields that keep a readonly value
|
|
5
|
+
* field in place and open a native popover panel — `c-autocomplete` and
|
|
6
|
+
* `c-tree-select`. One panel, two layouts: **anchored** under the field, or
|
|
7
|
+
* — on a **narrow viewport** — a **fullscreen panel** covering the viewport.
|
|
7
8
|
*
|
|
8
9
|
* What it owns:
|
|
9
10
|
* - the anchor. CSS anchor names are tree-scoped, so the consumer wraps its
|
|
@@ -16,19 +17,31 @@
|
|
|
16
17
|
* `hide-details` is set). The panel must sit flush under the field
|
|
17
18
|
* itself, so the `[part='message']` height is measured on open and pulled
|
|
18
19
|
* back with a negative block-start margin;
|
|
20
|
+
* - the fullscreen layout: chosen at `open()` from the `fullscreen`
|
|
21
|
+
* predicate and kept for the whole open (crossing the threshold while open
|
|
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);
|
|
19
29
|
* - open / close through `showPopover()` / `hidePopover()` on a
|
|
20
30
|
* `popover="manual"` panel, with the native `toggle` event as the single
|
|
21
31
|
* source of truth for `isOpen` (browser-initiated closes included);
|
|
22
|
-
* - light dismiss
|
|
23
|
-
*
|
|
32
|
+
* - light dismiss (CONTEXT.md "Light dismiss", ADR-0050): a press and its
|
|
33
|
+
* release both outside the host close the panel; a press alone — the
|
|
34
|
+
* start of every touch scroll — never does (`lightDismiss.ts`);
|
|
24
35
|
* - focus return to the value field on `close(true)`;
|
|
25
|
-
* - the OddBird anchor polyfill kick-off on open (Firefox).
|
|
36
|
+
* - the OddBird anchor polyfill kick-off on an anchored open (Firefox).
|
|
26
37
|
*
|
|
27
38
|
* What stays in the consumer: the `@position-try --c-field-panel-above` /
|
|
28
39
|
* `--c-field-panel-above-left` flip rules and `position-try-fallbacks` —
|
|
29
40
|
* per-shadow-root escape-hatch CSS (ADR-0007; each element type has its own
|
|
30
|
-
* adopted sheet, so the block is copy-identical in every consumer) —
|
|
31
|
-
*
|
|
41
|
+
* adopted sheet, so the block is copy-identical in every consumer) — the
|
|
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
|
|
32
45
|
* `onOpened` synchronously inside the `toggle` handler.
|
|
33
46
|
*/
|
|
34
47
|
import { type ComputedRef, type MaybeRefOrGetter, type Ref } from 'vue';
|
|
@@ -40,17 +53,23 @@ export declare const FIELD_PANEL_ANCHOR = "--c-field-panel-anchor";
|
|
|
40
53
|
export interface AnchoredPanel {
|
|
41
54
|
/** Inline style for the anchor wrapper: `anchor-name: --c-field-panel-anchor`. */
|
|
42
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>;
|
|
43
58
|
/** Hide the panel; `returnFocus` moves focus to `returnFocusTo` once the `toggle` event confirms the close. */
|
|
44
59
|
close(returnFocus?: boolean): void;
|
|
45
60
|
/** Open state — written only by the native `toggle` event (single source of truth, browser-initiated closes included). */
|
|
46
61
|
isOpen: Readonly<Ref<boolean>>;
|
|
62
|
+
/** The layout of the current open, fixed at `open()` for its whole duration; `'anchored'` — the resting shape, no heading row — while closed. */
|
|
63
|
+
layout: ComputedRef<PanelLayout>;
|
|
47
64
|
/** Bind as the panel's `@toggle` handler. */
|
|
48
65
|
onToggle(event: Event): void;
|
|
49
|
-
/**
|
|
66
|
+
/** Choose the layout, measure (anchored: the anchor width and the field's message height), then `showPopover()`. */
|
|
50
67
|
open(): void;
|
|
51
|
-
/** Inline style for the panel: `position-anchor`, `position-area: bottom span-right`, `inset: auto`, the pinned width and the message pull-back. */
|
|
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. */
|
|
52
69
|
panelStyle: ComputedRef<string>;
|
|
53
70
|
}
|
|
71
|
+
/** The two layouts one field panel takes (CONTEXT.md "Fullscreen panel"). */
|
|
72
|
+
export type PanelLayout = 'anchored' | 'fullscreen';
|
|
54
73
|
export interface UseAnchoredPanelOptions {
|
|
55
74
|
/** Shadow-DOM wrapper around the value field; carries `anchor-name`, and its rect pins the panel width. */
|
|
56
75
|
anchor: Readonly<Ref<HTMLElement | null>>;
|
|
@@ -58,11 +77,13 @@ export interface UseAnchoredPanelOptions {
|
|
|
58
77
|
disabled?: () => boolean;
|
|
59
78
|
/** The inner `c-input` host: its `[part='message']` height is pulled back so the panel sits flush under the field box. */
|
|
60
79
|
field: Readonly<Ref<HTMLElement | null>>;
|
|
61
|
-
/**
|
|
80
|
+
/** Open as a fullscreen panel while true — the shared narrow-viewport predicate (`useNarrowViewport`). Absent: always anchored. */
|
|
81
|
+
fullscreen?: Readonly<Ref<boolean>>;
|
|
82
|
+
/** The custom element host: light dismiss keeps gestures whose composed path includes it; its shadow root is what the anchor polyfill runs against; it is what the page lock keeps interactive. */
|
|
62
83
|
host: HTMLElement | null;
|
|
63
84
|
/** Runs inside the native `toggle` handler once closed, before focus returns. */
|
|
64
85
|
onClosed?: () => void;
|
|
65
|
-
/** Runs inside the native `toggle` handler once open, after the polyfill kick-off and the dismiss listener — the consumer's open sequence goes here. */
|
|
86
|
+
/** Runs inside the native `toggle` handler once open, after the polyfill kick-off / page lock and the dismiss listener — the consumer's open sequence goes here. */
|
|
66
87
|
onOpened?: () => void;
|
|
67
88
|
/** The `popover="manual"` panel element. */
|
|
68
89
|
panel: Readonly<Ref<HTMLElement | null>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Narrow viewport (CONTEXT.md "Narrow viewport", ADR-0050): the one shared
|
|
3
|
+
* predicate under which a value-selection field opens a **fullscreen panel**
|
|
4
|
+
* instead of an anchored one. Measured on the window, never on a component's
|
|
5
|
+
* own box — the panel fills the viewport, so only the viewport is relevant.
|
|
6
|
+
* The 760px threshold is c-dropdown's Stencil-era media query, kept so
|
|
7
|
+
* existing `c-select` consumers see no behaviour change.
|
|
8
|
+
*/
|
|
9
|
+
import { type Ref } from 'vue';
|
|
10
|
+
/** The media query every fullscreen-panel switch evaluates. */
|
|
11
|
+
export declare const NARROW_VIEWPORT_QUERY = "(max-width: 760px)";
|
|
12
|
+
/** One-off read; `false` where there is no window (SSR). */
|
|
13
|
+
export declare const isNarrowViewport: () => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* A live `Ref` that follows the media query. Registers its listener for the
|
|
16
|
+
* lifetime of the current effect scope (a component's setup, or an
|
|
17
|
+
* `effectScope()` in a spec); with no scope the listener stays for the page.
|
|
18
|
+
*/
|
|
19
|
+
export declare const useNarrowViewport: () => Readonly<Ref<boolean>>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visual viewport tracking for the **fullscreen panel** (CONTEXT.md,
|
|
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.
|
|
12
|
+
*/
|
|
13
|
+
/** Stop following the visual viewport. Idempotent. */
|
|
14
|
+
export type StopTracking = () => void;
|
|
15
|
+
/** The visible box, in CSS px relative to the layout viewport. */
|
|
16
|
+
export interface ViewportBox {
|
|
17
|
+
height: number;
|
|
18
|
+
left: number;
|
|
19
|
+
top: number;
|
|
20
|
+
width: number;
|
|
21
|
+
}
|
|
22
|
+
/** The current visual viewport box; `null` where the API is missing (then the content box fills the surface). */
|
|
23
|
+
export declare const readVisualViewport: () => null | ViewportBox;
|
|
24
|
+
/**
|
|
25
|
+
* Report the visual viewport's box now and on every resize / scroll of it
|
|
26
|
+
* (the keyboard opening and closing, the address bar collapsing, the browser
|
|
27
|
+
* panning a focused input into view). With no API the callback runs once
|
|
28
|
+
* with `null` and nothing is listened to.
|
|
29
|
+
*/
|
|
30
|
+
export declare const trackVisualViewport: (onBox: (box: null | ViewportBox) => void) => StopTracking;
|
|
31
|
+
/**
|
|
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).
|
|
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;
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* Typed element interfaces for every registered custom element, plus the
|
|
6
6
|
* global `HTMLElementTagNameMap` augmentation that makes
|
|
7
7
|
* `document.createElement('c-button')` and `querySelector('c-button')`
|
|
8
|
-
* return the typed element.
|
|
8
|
+
* return the typed element. Also the `AppDefaults` map (tag → props a
|
|
9
|
+
* consumer may set app-wide with `applyDefaults()`) and its runtime twin
|
|
10
|
+
* `DEFAULTABLE_PROPS`, both derived from the `@defaultable` prop tags.
|
|
9
11
|
*/
|
|
10
12
|
import type { CAutocompleteFilter, CAutocompleteItem, CAutocompleteTexts, CAutocompleteValue } from './components/c-autocomplete/CAutocomplete.vue';
|
|
11
13
|
import type { CButtonGroupValue } from './components/c-button-group/CButtonGroup.vue';
|
|
@@ -523,6 +525,11 @@ export interface CDropdownElementEventMap {
|
|
|
523
525
|
* state.
|
|
524
526
|
*/
|
|
525
527
|
dropdownStateChange: CustomEvent<boolean>;
|
|
528
|
+
/**
|
|
529
|
+
* Fired when the select-all row is activated; the parent (c-select) toggles
|
|
530
|
+
* every listed enabled option.
|
|
531
|
+
*/
|
|
532
|
+
selectall: CustomEvent<void>;
|
|
526
533
|
/**
|
|
527
534
|
* Fired when the user selects an option row, carrying the option's name
|
|
528
535
|
* and value for the parent (c-select) to commit.
|
|
@@ -531,13 +538,10 @@ export interface CDropdownElementEventMap {
|
|
|
531
538
|
name: string;
|
|
532
539
|
value: number | string;
|
|
533
540
|
}>;
|
|
534
|
-
/**
|
|
535
|
-
* Fired when the select-all row is activated; the parent (c-select) toggles
|
|
536
|
-
* every listed enabled option.
|
|
537
|
-
*/
|
|
538
|
-
selectall: CustomEvent<void>;
|
|
539
541
|
}
|
|
540
|
-
export interface CDropdownElement extends Omit<HTMLElement, 'dropdownItemType' | 'hostId' | 'index' | 'items' | 'itemsPerPage' | 'multiple' | 'parent' | 'selectAllRow' | 'selected' | 'type'> {
|
|
542
|
+
export interface CDropdownElement extends Omit<HTMLElement, 'closeLabel' | 'dropdownItemType' | 'hostId' | 'index' | 'items' | 'itemsPerPage' | 'label' | 'multiple' | 'parent' | 'selectAllRow' | 'selected' | 'type'> {
|
|
543
|
+
/** Accessible label of the fullscreen panel's close button (narrow viewports) */
|
|
544
|
+
closeLabel?: string;
|
|
541
545
|
/** Whether items are <c-option> elements or plain objects */
|
|
542
546
|
dropdownItemType?: 'item' | 'option';
|
|
543
547
|
/** Id used to build option/announce element ids */
|
|
@@ -548,6 +552,8 @@ export interface CDropdownElement extends Omit<HTMLElement, 'dropdownItemType' |
|
|
|
548
552
|
items?: ArrayLike<DropdownItem>;
|
|
549
553
|
/** Items per page before adding scroll */
|
|
550
554
|
itemsPerPage?: number;
|
|
555
|
+
/** The parent field's label, shown as the fullscreen panel's heading (narrow viewports) */
|
|
556
|
+
label?: string;
|
|
551
557
|
/**
|
|
552
558
|
* Multi-select mode: rows toggle instead of committing, each carries a
|
|
553
559
|
* decorative checkbox indicator, and the listbox is `aria-multiselectable`
|
|
@@ -1806,6 +1812,29 @@ export interface CTreeSelectElement extends Omit<HTMLElement, 'allowBranch' | 'c
|
|
|
1806
1812
|
removeEventListener<K extends keyof CTreeSelectElementEventMap>(type: K, listener: (this: CTreeSelectElement, ev: CTreeSelectElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
1807
1813
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1808
1814
|
}
|
|
1815
|
+
/**
|
|
1816
|
+
* Props a consumer may set for every instance of a tag with
|
|
1817
|
+
* `applyDefaults()` (`@defaultable` in the manifest), typed as the
|
|
1818
|
+
* element's own members. An explicit per-instance attribute or property
|
|
1819
|
+
* always wins over an app default.
|
|
1820
|
+
*/
|
|
1821
|
+
export interface AppDefaults {
|
|
1822
|
+
'c-autocomplete'?: Partial<Pick<CAutocompleteElement, 'hideDetails' | 'itemsPerPage' | 'labelOnTop' | 'shadow' | 'size' | 'texts'>>;
|
|
1823
|
+
'c-data-table'?: Partial<Pick<CDataTableElement, 'texts'>>;
|
|
1824
|
+
'c-select'?: Partial<Pick<CSelectElement, 'hideDetails' | 'itemsPerPage' | 'labelOnTop' | 'shadow' | 'size' | 'texts'>>;
|
|
1825
|
+
'c-text-field'?: Partial<Pick<CTextFieldElement, 'hideDetails' | 'labelOnTop' | 'shadow' | 'size'>>;
|
|
1826
|
+
'c-tree-select'?: Partial<Pick<CTreeSelectElement, 'hideDetails' | 'itemsPerPage' | 'labelOnTop' | 'shadow' | 'size' | 'texts'>>;
|
|
1827
|
+
}
|
|
1828
|
+
/** Runtime allow-list behind `applyDefaults()` validation — the same data as `AppDefaults`. */
|
|
1829
|
+
export declare const DEFAULTABLE_PROPS: {
|
|
1830
|
+
readonly 'c-autocomplete': readonly ["hideDetails", "itemsPerPage", "labelOnTop", "shadow", "size", "texts"];
|
|
1831
|
+
readonly 'c-data-table': readonly ["texts"];
|
|
1832
|
+
readonly 'c-select': readonly ["hideDetails", "itemsPerPage", "labelOnTop", "shadow", "size", "texts"];
|
|
1833
|
+
readonly 'c-text-field': readonly ["hideDetails", "labelOnTop", "shadow", "size"];
|
|
1834
|
+
readonly 'c-tree-select': readonly ["hideDetails", "itemsPerPage", "labelOnTop", "shadow", "size", "texts"];
|
|
1835
|
+
};
|
|
1836
|
+
/** Tags dispatching the v-model contract event `update:value` — the value controls (CONTEXT.md). */
|
|
1837
|
+
export declare const VALUE_TAGS: readonly ["c-accordion", "c-autocomplete", "c-button-group", "c-checkbox", "c-modal", "c-otp-input", "c-pagination", "c-radio-group", "c-select", "c-slider", "c-switch", "c-tabs", "c-text-field", "c-tree-select"];
|
|
1809
1838
|
declare global {
|
|
1810
1839
|
interface HTMLElementTagNameMap {
|
|
1811
1840
|
'c-accordion': CAccordionElement;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cscfi/csc-ui",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.16",
|
|
4
4
|
"description": "Vue 3-based replacement for @cscfi/csc-ui — same custom element tag names, Vue v-model contract.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/csc-ui.js",
|
|
@@ -33,8 +33,9 @@
|
|
|
33
33
|
"@eslint/js": "^9.28.0",
|
|
34
34
|
"@stylistic/eslint-plugin": "^5.7.0",
|
|
35
35
|
"@tailwindcss/vite": "^4.3.1",
|
|
36
|
-
"@types/node": "^
|
|
36
|
+
"@types/node": "^24.0.0",
|
|
37
37
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
38
|
+
"@vitest/browser-playwright": "5.0.0",
|
|
38
39
|
"custom-element-jet-brains-integration": "^1.7.0",
|
|
39
40
|
"custom-element-vs-code-integration": "^1.5.0",
|
|
40
41
|
"eslint": "^9.28.0",
|
|
@@ -44,12 +45,14 @@
|
|
|
44
45
|
"eslint-plugin-prettier": "^5.5.6",
|
|
45
46
|
"eslint-plugin-vue": "^10.9.2",
|
|
46
47
|
"globals": "^17.7.0",
|
|
48
|
+
"playwright": "1.60.0",
|
|
47
49
|
"prettier": "^3.8.5",
|
|
48
50
|
"style-dictionary": "^3.9.0",
|
|
49
51
|
"tailwindcss": "^4.3.1",
|
|
50
52
|
"typescript": "^6.0.3",
|
|
51
53
|
"typescript-eslint": "^8.62.0",
|
|
52
54
|
"vite": "^8.1.0",
|
|
55
|
+
"vitest": "5.0.0",
|
|
53
56
|
"vue-tsc": "^3.3.5"
|
|
54
57
|
},
|
|
55
58
|
"license": "MIT",
|
|
@@ -67,10 +70,16 @@
|
|
|
67
70
|
"lint:a11y": "node scripts/check-host-attr-fallthrough.mjs",
|
|
68
71
|
"lint:contrast": "node scripts/audit-contrast.mjs",
|
|
69
72
|
"lint:ramp": "node scripts/check-ramp-parity.mjs",
|
|
70
|
-
"lint:tokens": "node scripts/check-palette-utilities.mjs",
|
|
73
|
+
"lint:tokens": "node scripts/check-palette-utilities.mjs --strict",
|
|
71
74
|
"style-dictionary:build": "style-dictionary build --config ./style-dictionary.config.cjs",
|
|
72
75
|
"type-check": "vue-tsc --build --force",
|
|
73
76
|
"chart:generate": "node scripts/generate-chart-data.mjs",
|
|
74
|
-
"lint:chart": "node scripts/check-chart-parity.mjs"
|
|
77
|
+
"lint:chart": "node scripts/check-chart-parity.mjs",
|
|
78
|
+
"lint": "pnpm run lint:tokens && pnpm run lint:a11y && pnpm run lint:ramp && pnpm run lint:chart",
|
|
79
|
+
"test": "pnpm run style-dictionary:build && vitest run",
|
|
80
|
+
"test:watch": "vitest",
|
|
81
|
+
"test:browser": "vitest run --project browser",
|
|
82
|
+
"test:node": "vitest run --project node",
|
|
83
|
+
"test:update": "pnpm run style-dictionary:build && vitest run --project browser --update"
|
|
75
84
|
}
|
|
76
85
|
}
|