@db-ux/v-core-components 5.5.0 → 5.6.1

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/agent/Icon.md +14 -13
  3. package/agent/LoadingIndicator.md +57 -0
  4. package/agent/_instructions.md +1 -0
  5. package/dist/components/control-panel-navigation-item-group/model.d.ts +25 -0
  6. package/dist/components/dialog/dialog.vue.d.ts +30 -0
  7. package/dist/components/dialog/index.d.ts +1 -0
  8. package/dist/components/dialog/model.d.ts +36 -0
  9. package/dist/components/dialog-footer/dialog-footer.vue.d.ts +18 -0
  10. package/dist/components/dialog-footer/index.d.ts +1 -0
  11. package/dist/components/dialog-footer/model.d.ts +5 -0
  12. package/dist/components/dialog-header/dialog-header.vue.d.ts +26 -0
  13. package/dist/components/dialog-header/index.d.ts +1 -0
  14. package/dist/components/dialog-header/model.d.ts +10 -0
  15. package/dist/components/drawer/drawer.vue.d.ts +3 -0
  16. package/dist/components/drawer/model.d.ts +11 -9
  17. package/dist/components/drawer-header/model.d.ts +3 -2
  18. package/dist/components/loading-indicator/examples/_timeout.data.d.ts +6 -0
  19. package/dist/components/loading-indicator/index.d.ts +1 -0
  20. package/dist/components/loading-indicator/loading-indicator.vue.d.ts +41 -0
  21. package/dist/components/loading-indicator/model.d.ts +93 -0
  22. package/dist/components/pagination/index.d.ts +1 -0
  23. package/dist/components/pagination/model.d.ts +117 -0
  24. package/dist/components/pagination/pagination.vue.d.ts +31 -0
  25. package/dist/components/pagination-item/index.d.ts +1 -0
  26. package/dist/components/pagination-item/model.d.ts +5 -0
  27. package/dist/components/pagination-item/pagination-item.vue.d.ts +14 -0
  28. package/dist/components/popover/popover.vue.d.ts +1 -1
  29. package/dist/components/tooltip/tooltip.vue.d.ts +1 -1
  30. package/dist/db-ux.es.js +2243 -1495
  31. package/dist/db-ux.umd.js +1 -1
  32. package/dist/index.d.ts +15 -0
  33. package/dist/shared/constants.d.ts +4 -0
  34. package/dist/shared/model.d.ts +43 -4
  35. package/dist/utils/dialog/index.d.ts +77 -0
  36. package/dist/utils/dialog/ponyfill.d.ts +55 -0
  37. package/dist/utils/document-keydown-listener.d.ts +8 -0
  38. package/package.json +8 -8
package/dist/index.d.ts CHANGED
@@ -44,6 +44,12 @@ export * from './components/custom-select-list-item/index.js';
44
44
  export * from './components/custom-select-list-item/model.js';
45
45
  export * from './components/custom-select-list/model.js';
46
46
  export * from './components/custom-select/model.js';
47
+ export * from './components/dialog/index.js';
48
+ export * from './components/dialog-footer/index.js';
49
+ export * from './components/dialog-footer/model.js';
50
+ export * from './components/dialog-header/index.js';
51
+ export * from './components/dialog-header/model.js';
52
+ export * from './components/dialog/model.js';
47
53
  export * from './components/divider/index.js';
48
54
  export * from './components/divider/model.js';
49
55
  export * from './components/drawer/index.js';
@@ -70,6 +76,8 @@ export * from './components/input/index.js';
70
76
  export * from './components/input/model.js';
71
77
  export * from './components/link/index.js';
72
78
  export * from './components/link/model.js';
79
+ export * from './components/loading-indicator/index.js';
80
+ export * from './components/loading-indicator/model.js';
73
81
  export * from './components/navigation/index.js';
74
82
  export * from './components/navigation-item/index.js';
75
83
  export * from './components/navigation-item/model.js';
@@ -78,6 +86,10 @@ export * from './components/notification/index.js';
78
86
  export * from './components/notification/model.js';
79
87
  export * from './components/page/index.js';
80
88
  export * from './components/page/model.js';
89
+ export * from './components/pagination/index.js';
90
+ export * from './components/pagination-item/index.js';
91
+ export * from './components/pagination-item/model.js';
92
+ export * from './components/pagination/model.js';
81
93
  export * from './components/popover/index.js';
82
94
  export * from './components/popover/model.js';
83
95
  export * from './components/radio/index.js';
@@ -128,7 +140,10 @@ export * from './components/tooltip/index.js';
128
140
  export * from './components/tooltip/model.js';
129
141
  export * from './shared/constants.js';
130
142
  export * from './shared/model.js';
143
+ export * from './utils/dialog/index.js';
144
+ export * from './utils/dialog/ponyfill.js';
131
145
  export * from './utils/document-click-listener.js';
146
+ export * from './utils/document-keydown-listener.js';
132
147
  export * from './utils/document-scroll-listener.js';
133
148
  export * from './utils/floating-components.js';
134
149
  export * from './utils/index.js';
@@ -3,12 +3,14 @@ export declare const DEFAULT_LABEL: string;
3
3
  export declare const DEFAULT_PLACEHOLDER: string;
4
4
  export declare const DEFAULT_MESSAGE: string;
5
5
  export declare const DEFAULT_LABEL_ID_SUFFIX: string;
6
+ export declare const DEFAULT_HEADING_ID_SUFFIX: string;
6
7
  export declare const DEFAULT_SELECT_ID_SUFFIX: string;
7
8
  export declare const DEFAULT_MESSAGE_ID_SUFFIX: string;
8
9
  export declare const DEFAULT_VALID_MESSAGE_ID_SUFFIX: string;
9
10
  export declare const DEFAULT_INVALID_MESSAGE_ID_SUFFIX: string;
10
11
  export declare const DEFAULT_PLACEHOLDER_ID_SUFFIX: string;
11
12
  export declare const DEFAULT_DATALIST_ID_SUFFIX: string;
13
+ export declare const DEFAULT_PROGRESS_ID_SUFFIX: string;
12
14
  export declare const DEFAULT_VALID_MESSAGE: string;
13
15
  export declare const DEFAULT_INVALID_MESSAGE: string;
14
16
  export declare const DEFAULT_REMOVE: string;
@@ -21,6 +23,8 @@ export declare const DEFAULT_SCROLL_RIGHT: string;
21
23
  export declare const DEFAULT_ICON: string;
22
24
  export declare const DEFAULT_BURGER_MENU: string;
23
25
  export declare const DEFAULT_ROWS: number;
26
+ export declare const DEFAULT_LOADING_TIMEOUT_ACTIVE: number;
27
+ export declare const DEFAULT_LOADING_TIMEOUT: number;
24
28
  export declare const DEFAULT_CLOSE_BUTTON: string;
25
29
  export declare const MAIN_CONTENT_ID: string;
26
30
  export declare const DENSITY_CONST: string;
@@ -178,10 +178,6 @@ export type PopoverDelayType = (typeof PopoverDelayList)[number];
178
178
  export declare const PopoverWidthList: readonly ["auto", "fixed"];
179
179
  export type PopoverWidthType = (typeof PopoverWidthList)[number];
180
180
  export type PopoverProps = {
181
- /**
182
- * Add a delay before showing the tooltip
183
- */
184
- delay?: PopoverDelayType;
185
181
  /**
186
182
  * Disable animation
187
183
  */
@@ -194,6 +190,12 @@ export type PopoverProps = {
194
190
  * If the floating element is inside a fixed container we might need to force absolute position
195
191
  */
196
192
  forceAbsolute?: boolean | string;
193
+ } & DelayProps;
194
+ export type DelayProps = {
195
+ /**
196
+ * Add a delay before showing the component
197
+ */
198
+ delay?: PopoverDelayType;
197
199
  };
198
200
  export type NameProps = {
199
201
  /**
@@ -486,6 +488,43 @@ export type CloseEventProps<T> = {
486
488
  export type CloseEventState<T> = {
487
489
  handleClose: (event?: T | void, forceClose?: boolean) => void;
488
490
  };
491
+ export type CancelEventProps<T> = {
492
+ /**
493
+ * Called when the native cancel event fires (e.g. Escape key on a dialog).
494
+ * Call event.preventDefault() to veto the native close.
495
+ */
496
+ onCancel?: (event: GeneralEvent<T>) => void;
497
+ /**
498
+ * Called when the native cancel event fires (e.g. Escape key on a dialog).
499
+ * Call event.preventDefault() to veto the native close.
500
+ */
501
+ cancel?: (event: GeneralEvent<T>) => void;
502
+ };
503
+ /**
504
+ * Shared internal state for the native `<dialog>`-based components (DBDialog and
505
+ * DBDrawer). Both drive the same open/click/cancel handlers and the id fallback,
506
+ * so they extend this instead of duplicating the shape. The Escape-close fallback
507
+ * is registered at document scope (id held in `_documentKeydownListenerCallbackId`)
508
+ * rather than via an element `keydown` handler, so a non-modal dialog (which does
509
+ * not trap focus) still dismisses on Escape from an element outside it.
510
+ */
511
+ export type DialogDrawerDefaultState = {
512
+ resetId: () => void;
513
+ /**
514
+ * Syncs the native `<dialog>` open state to `props.open` via
515
+ * `syncDialogOpenState`, opening modally (`showModal()`) or non-modally
516
+ * (`show()`) per `isNotModal()`. Runs from an effect that observes `open`
517
+ * only: modality is an open-time decision of the native `<dialog>` and cannot
518
+ * be switched while open without a close()+reopen (which flickers, resets
519
+ * focus and fires an extra close/cancel), so a `backdrop` change on an open
520
+ * dialog updates only its appearance until the consumer closes and reopens.
521
+ */
522
+ handleDialogOpen: () => void;
523
+ handleClick: (event: ClickEvent<HTMLDialogElement> | any) => void;
524
+ handleCancel: (event: GeneralEvent<HTMLDialogElement> | any) => void;
525
+ isNotModal: () => boolean;
526
+ _documentKeydownListenerCallbackId?: string;
527
+ };
489
528
  export declare const AlignmentList: readonly ["start", "center", "end"];
490
529
  export type AlignmentType = (typeof AlignmentList)[number];
491
530
  export type AlignmentProps = {
@@ -0,0 +1,77 @@
1
+ /**
2
+ * @public
3
+ * Keeps the open state of a native `<dialog>` element in sync with a requested state.
4
+ * Calls `showModal()`, `show()` or `close()` only when the current state differs from
5
+ * the requested one. A requested state of `undefined`/`null` leaves the element unchanged.
6
+ *
7
+ * @param dialog The `<dialog>` element, may be unresolved
8
+ * @param open The requested open state, already converted via `getBoolean`
9
+ * @param notModal `true` opens the dialog via `show()` instead of `showModal()`
10
+ */
11
+ export declare const syncDialogOpenState: (dialog?: HTMLDialogElement | null, open?: boolean, notModal?: boolean) => void;
12
+ /**
13
+ * @public
14
+ * Resolves the closest `<dialog>` ancestor of an element without modifying it.
15
+ */
16
+ export declare const resolveClosestDialog: (element?: HTMLElement | null) => HTMLDialogElement | undefined;
17
+ /**
18
+ * @public
19
+ * Adds the header's heading id to the dialog's `aria-labelledby` token list so
20
+ * the visible heading is part of the accessible name, while preserving any ids the
21
+ * consumer added (`aria-labelledby` is a space-separated list of one or more
22
+ * referenced elements). The heading id is appended once (idempotent), so a consumer
23
+ * value composes with it rather than being clobbered.
24
+ *
25
+ * Keeps the reference out of the way when the consumer set an explicit
26
+ * `aria-label`: the accessible-name computation evaluates `aria-labelledby` before
27
+ * `aria-label`, so our reference would win and silently defeat the label. While an
28
+ * `aria-label` is present it removes only our own token (leaving consumer ids), and
29
+ * adds it back once the label is cleared - so the naming override works whether the
30
+ * `aria-label` was set before mount or added dynamically afterwards.
31
+ */
32
+ export declare const setDialogAriaLabelledBy: (dialog: HTMLDialogElement | undefined | null, headingId: string | undefined) => void;
33
+ /**
34
+ * @public
35
+ * Removes only the header's heading id from the dialog's `aria-labelledby` token
36
+ * list, leaving any consumer-supplied ids intact; clears the attribute entirely
37
+ * when no tokens remain. Takes the dialog element resolved at mount (held in the
38
+ * header's state) rather than re-resolving it, so cleanup works even when the
39
+ * header is already detached from the DOM (e.g. during React effect cleanup) and
40
+ * regardless of whether the dialog has an `id`.
41
+ *
42
+ * `headingId` is the id of the heading element the header itself renders (the
43
+ * `<h2>` wrapper), so removing it on unmount is correct even when the consumer's
44
+ * `aria-labelledby` already contained that exact token: the referenced element is
45
+ * removed together with the header, and a token pointing at a now-missing id
46
+ * contributes nothing to the accessible name. Ids are unique per document, so this
47
+ * token can only ever refer to the header's heading, never to an independent
48
+ * consumer element - those keep a different id and are preserved by the filter.
49
+ */
50
+ export declare const removeDialogAriaLabelledBy: (dialog: HTMLDialogElement | undefined | null, headingId: string | undefined) => void;
51
+ /**
52
+ * @public
53
+ * Points the dialog's own built-in close button at the dialog via `commandfor`,
54
+ * so the native command resolves to the correct element even when the consumer
55
+ * supplied no `id` (the dialog then carries a generated one). Wired from the
56
+ * dialog/drawer rather than the header, which mounts before the dialog id is set.
57
+ * No-op until both the dialog and its close button are resolved.
58
+ *
59
+ * Selects the built-in dismiss control by its `data-dialog-close-button` marker
60
+ * (set by DBDialogHeader / DBDrawerHeader), NOT by `[command="request-close"]`
61
+ * alone: a consumer may place their own request-close control in the header's
62
+ * `startSlot`/`endSlot` (or the content) that intentionally targets a different
63
+ * dialog, and a broad query would overwrite its `commandfor` and hijack it. A
64
+ * `data-*` marker (not a class) is used because Mitosis forwards data attributes
65
+ * uniformly across all four targets, whereas a `className` passed to the nested
66
+ * DBButton is dropped in the Vue output.
67
+ *
68
+ * DBDialog / DBDrawer call this from BOTH `onMount` and the effect on `_id`, and
69
+ * both calls are required - they are not a redundant double-wire. The `onMount`
70
+ * call covers Vue and Stencil, whose watchers (`watch`, `@Watch`) are lazy and do
71
+ * not fire for the initial `_id` transition on mount; the `_id` effect covers
72
+ * React (whose effect runs on mount) and every later id change. Being idempotent,
73
+ * the extra call on React mount is a harmless no-op, so do not "optimize" either
74
+ * call away - dropping the `onMount` one leaves Vue/Stencil unwired at mount
75
+ * (the close button gets no `commandfor`).
76
+ */
77
+ export declare const connectCloseButton: (dialog?: HTMLDialogElement | null) => void;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Ponyfill for two features that the project Browserslist does not cover yet:
3
+ * - the `closedby` attribute on `<dialog>`: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dialog#closedby
4
+ * - Invoker Commands (`command` / `commandfor`): https://caniuse.com/mdn-html_elements_button_commandfor
5
+ * Support matrix: packages/foundations/docs/BrowserSupport.md
6
+ * Delete this file, packages/components/src/styles/internal/_dialog-ponyfill.scss
7
+ * and the marked call sites in dialog.lite.tsx / drawer.lite.tsx once every target
8
+ * in .browserslistrc supports both features (currently blocked by Firefox ESR).
9
+ */
10
+ /**
11
+ * @public
12
+ * Feature-detects whether the browser supports the `closedby` attribute
13
+ * on `<dialog>` elements (i.e. native light-dismiss via ESC and backdrop click).
14
+ * Result is cached after the first call.
15
+ */
16
+ export declare const supportsClosedBy: () => boolean;
17
+ /**
18
+ * @public
19
+ * Feature-detects whether the browser supports the `commandfor`/`command`
20
+ * HTML attributes for declarative button-to-element commands.
21
+ * Result is cached after the first call.
22
+ */
23
+ export declare const supportsCommandFor: () => boolean;
24
+ /**
25
+ * @public
26
+ * Marks the dialog for the CSS backdrop-click fallback, which extends the close button's hit area. Supporting browsers stay clean.
27
+ */
28
+ export declare const markClosedByFallback: (dialog?: HTMLDialogElement | null) => void;
29
+ /**
30
+ * @public
31
+ * Closes the dialog a request-close button targets when the native command cannot do it:
32
+ * no commandfor support, or a commandfor that does not resolve to an element. Honors the
33
+ * commandfor target rather than the closest dialog, and stays out of the way when the
34
+ * native command can resolve its target. Shared by DBDialog and DBDrawer. Resolves the
35
+ * target once per click, without retry.
36
+ *
37
+ * Bails on `event.defaultPrevented`, mirroring native command activation (which a
38
+ * consumer `preventDefault()` suppresses). Callers that also run a consumer `onClick`
39
+ * must invoke it before this fallback so that veto is honored.
40
+ */
41
+ export declare const commandForCloseFallback: (event: any, dialog?: HTMLDialogElement | null) => void;
42
+ /**
43
+ * @public
44
+ * Dismisses a non-modal dialog on Escape when the browser ignores
45
+ * `closedby="closerequest"`. Modal dialogs (opened via showModal) close on
46
+ * Escape natively, so this only steps in for non-modal ones (backdrop="none",
47
+ * opened via show). No-op when closedby is supported, the key is not Escape, or
48
+ * the event was already canceled (a consumer handler ran first and vetoed it).
49
+ *
50
+ * Registered at document scope (via DocumentKeydownListener) while the dialog is
51
+ * open: a non-modal dialog does not trap focus, so an Escape can be dispatched to
52
+ * an element outside the dialog and would never reach an element-scoped listener.
53
+ * Shared by DBDialog and DBDrawer.
54
+ */
55
+ export declare const escapeCloseFallback: (event: any, dialog?: HTMLDialogElement | null) => void;
@@ -0,0 +1,8 @@
1
+ import { AbstractDocumentListener } from './abstract-document-listener.js';
2
+ export declare class DocumentKeydownListener extends AbstractDocumentListener {
3
+ private static callbacks;
4
+ private static _instance;
5
+ private static runCallbacks;
6
+ constructor();
7
+ protected getCallbacks(): Record<string, (event: any) => void>;
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@db-ux/v-core-components",
3
- "version": "5.5.0",
3
+ "version": "5.6.1",
4
4
  "type": "module",
5
5
  "description": "Vue components for @db-ux/core-components",
6
6
  "repository": {
@@ -28,20 +28,20 @@
28
28
  "dist/"
29
29
  ],
30
30
  "dependencies": {
31
- "@db-ux/core-components": "5.5.0",
32
- "@db-ux/core-foundations": "5.5.0"
31
+ "@db-ux/core-components": "5.6.1",
32
+ "@db-ux/core-foundations": "5.6.1"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@playwright/experimental-ct-vue": "1.62.1",
36
- "@vitejs/plugin-vue": "6.0.8",
37
- "@vue/compiler-dom": "3.5.42",
36
+ "@vitejs/plugin-vue": "6.0.9",
37
+ "@vue/compiler-dom": "3.5.43",
38
38
  "cpy-cli": "7.0.0",
39
39
  "npm-run-all2": "9.0.3",
40
40
  "replace-in-file": "9.0.0",
41
- "tsx": "4.23.13",
41
+ "tsx": "4.23.15",
42
42
  "typescript": "5.9.3",
43
- "vite": "8.3.0",
44
- "vue": "3.5.42",
43
+ "vite": "8.3.1",
44
+ "vue": "3.5.43",
45
45
  "vue-tsc": "3.3.11"
46
46
  },
47
47
  "publishConfig": {