@ezeep/ezeep-js 1.0.294 → 1.0.306
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/cjs/ezeep.cjs.js +1 -1
- package/dist/cjs/{ezp-auth_15.cjs.entry.js → ezp-auth_16.cjs.entry.js} +674 -110
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/ezp-file-name/ezp-file-name.css +98 -0
- package/dist/collection/components/ezp-file-name/ezp-file-name.js +411 -0
- package/dist/collection/components/ezp-icon/ezp-icon.js +1 -1
- package/dist/collection/components/ezp-icon-button/ezp-icon-button.js +1 -1
- package/dist/collection/components/ezp-input/ezp-input.js +1 -1
- package/dist/collection/components/ezp-label/ezp-label.js +39 -1
- package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.css +31 -3
- package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.js +243 -90
- package/dist/collection/components/ezp-printing/ezp-printing.js +20 -2
- package/dist/collection/components/ezp-select/ezp-select.js +1 -1
- package/dist/collection/components/ezp-status/ezp-status.js +2 -2
- package/dist/collection/components/ezp-stepper/ezp-stepper.js +1 -1
- package/dist/collection/components/ezp-text-button/ezp-text-button.js +1 -1
- package/dist/collection/components/ezp-upload/ezp-upload.css +26 -1
- package/dist/collection/components/ezp-upload/ezp-upload.js +14 -3
- package/dist/collection/components/ezp-user-menu/ezp-user-menu.js +1 -1
- package/dist/collection/shared/storage.js +39 -9
- package/dist/collection/types/shared/types.d.ts +2 -0
- package/dist/collection/utils/printer.js +75 -1
- package/dist/collection/utils/utils.js +29 -0
- package/dist/components/auth.js +1 -1
- package/dist/components/ezp-file-name.d.ts +11 -0
- package/dist/components/ezp-file-name.js +1 -0
- package/dist/components/ezp-file-name2.js +1 -0
- package/dist/components/ezp-icon-button2.js +1 -1
- package/dist/components/ezp-icon2.js +1 -1
- package/dist/components/ezp-input2.js +1 -1
- package/dist/components/ezp-label2.js +1 -1
- package/dist/components/ezp-printer-selection2.js +1 -1
- package/dist/components/ezp-printing.js +1 -1
- package/dist/components/ezp-select2.js +1 -1
- package/dist/components/ezp-status2.js +1 -1
- package/dist/components/ezp-stepper2.js +1 -1
- package/dist/components/ezp-text-button2.js +1 -1
- package/dist/components/ezp-upload2.js +1 -1
- package/dist/components/ezp-user-menu2.js +1 -1
- package/dist/components/utils.js +1 -1
- package/dist/directives/proxies.ts +38 -4
- package/dist/esm/ezeep.js +1 -1
- package/dist/esm/{ezp-auth_15.entry.js → ezp-auth_16.entry.js} +674 -111
- package/dist/esm/loader.js +1 -1
- package/dist/esm-es5/ezeep.js +1 -1
- package/dist/esm-es5/{ezp-auth_15.entry.js → ezp-auth_16.entry.js} +2 -2
- package/dist/esm-es5/loader.js +1 -1
- package/dist/ezeep/ezeep.esm.js +1 -1
- package/dist/ezeep/p-646c1d42.entry.js +1 -0
- package/dist/ezeep/p-8e2d88a9.system.entry.js +7 -0
- package/dist/ezeep/p-DCznw2Ee.system.js +1 -1
- package/dist/ezeep/types/shared/types.d.ts +2 -0
- package/dist/types/components/ezp-file-name/ezp-file-name.d.ts +125 -0
- package/dist/types/components/ezp-label/ezp-label.d.ts +10 -0
- package/dist/types/components/ezp-printer-selection/ezp-printer-selection.d.ts +48 -2
- package/dist/types/components/ezp-printing/ezp-printing.d.ts +9 -2
- package/dist/types/components/ezp-upload/ezp-upload.d.ts +4 -0
- package/dist/types/components.d.ts +82 -3
- package/dist/types/shared/storage.d.ts +18 -4
- package/dist/types/shared/types.d.ts +2 -0
- package/dist/types/utils/printer.d.ts +18 -0
- package/dist/types/utils/utils.d.ts +20 -1
- package/package.json +1 -1
- package/www/build/ezeep.esm.js +1 -1
- package/www/build/p-646c1d42.entry.js +1 -0
- package/www/build/p-70951744.js +1 -0
- package/www/build/p-8e2d88a9.system.entry.js +7 -0
- package/www/build/p-DCznw2Ee.system.js +1 -1
- package/www/index.html +1 -1
- package/dist/ezeep/p-3ab5a223.entry.js +0 -1
- package/dist/ezeep/p-fe700ca4.system.entry.js +0 -7
- package/www/build/p-3ab5a223.entry.js +0 -1
- package/www/build/p-65242d5e.js +0 -1
- package/www/build/p-fe700ca4.system.entry.js +0 -7
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -6,7 +6,7 @@ var appGlobals = require('./app-globals-L_3XPZxT.js');
|
|
|
6
6
|
const defineCustomElements = async (win, options) => {
|
|
7
7
|
if (typeof window === 'undefined') return undefined;
|
|
8
8
|
await appGlobals.globalScripts();
|
|
9
|
-
return index.bootstrapLazy([["ezp-
|
|
9
|
+
return index.bootstrapLazy([["ezp-auth_16.cjs",[[257,"ezp-printing",{"clientid":[1],"redirecturi":[1],"filename":[1025],"fileurl":[1],"filetype":[1],"custom":[4],"hidelogin":[4],"hidemenu":[4],"hideheader":[4],"authapihosturl":[1],"printapihosturl":[1],"theme":[1],"fileid":[1],"appearance":[1],"trigger":[1],"language":[1],"code":[1],"filedata":[1],"seamless":[4],"printOpen":[32],"authOpen":[32],"onlyGetSasUri":[32],"noDocumentOpen":[32],"systemAppearance":[32],"files":[32],"open":[64],"logOut":[64],"getSasUri":[64],"getAuthUri":[64],"setAuthRefreshToken":[64],"checkAuth":[64]},[[0,"printCancel","listenPrintCancel"],[0,"printDismiss","listenPrintDismiss"],[0,"printSubmit","listenPrintSubmit"],[0,"authCancel","listenAuthCancel"],[0,"userCancel","listenUserCancel"],[0,"authSuccess","listenAuthSuccess"],[0,"uploadFile","listenUploadFile"],[0,"uploadContinue","listenUploadContinue"],[0,"dialogClose","listenDialogClose"],[0,"dialogAction","listenDialogAction"],[0,"logout","listenLogout"]],{"filedata":[{"watchFileData":0}],"filename":[{"watchFilename":0}],"fileurl":[{"watchFileUrl":0}],"language":[{"watchLanguage":0}]}],[1,"ezp-printer-selection",{"clientID":[1,"client-i-d"],"redirectURI":[1,"redirect-u-r-i"],"filename":[1025],"fileurl":[1],"filetype":[1025],"fileid":[1025],"files":[16],"hidemenu":[4],"hideheader":[4],"seamless":[4],"loading":[32],"printProcessing":[32],"pageRangeInvalid":[32],"uploading":[32],"preparingUpload":[32],"printSuccess":[32],"printFailed":[32],"printTimedOut":[32],"notSupported":[32],"noPrinters":[32],"hubDriverError":[32],"userMenuOpen":[32],"printStopped":[32],"firstVisibleFile":[32],"userName":[32],"printers":[32],"selectedPrinter":[32],"printerConfig":[32],"selectedPrinterConfig":[32],"selectedProperties":[32],"loadingPrinterConfig":[32],"paperid":[32],"currentFileIndex":[32],"totalFiles":[32],"failedFiles":[32],"successfulFiles":[32],"partialSuccess":[32]},[[0,"inputValueChanged","listenInputValueChanged"],[0,"selectSelection","listenSelectSelection"],[0,"stepperChanged","listenStepperChanged"],[0,"userMenuClosure","listenUserMenuClosure"],[0,"logoutEmitter","listenLogout"],[0,"statusCancel","listenStatusCancel"],[0,"statusClose","listenStatusClose"],[0,"statusRetry","listenStatusRetry"]]],[1,"ezp-auth",{"clientID":[1025,"client-i-d"],"redirectURI":[1025,"redirect-u-r-i"],"hidelogin":[4],"trigger":[1],"code":[1],"auth":[32],"authURI":[32],"accessToken":[32]},[[0,"dialogAction","listenDialogAction"],[0,"dialogClose","listenDialogClose"],[0,"statusCancel","listenStatusCancel"]]],[1,"ezp-upload",{"selectedFiles":[32],"dragging":[32],"firstVisibleFile":[32]},[[0,"dragenter","handleDragEnter"],[0,"dragover","handleDragOver"],[1,"dragleave","handleDragLeave"],[0,"drop","handleDrop"],[9,"drop","resetDrag"],[9,"dragend","resetDrag"],[4,"printCancel","listenPrintCancel"]]],[1,"ezp-dialog",{"heading":[1],"description":[1],"action":[1],"iconName":[1,"icon-name"],"iconSize":[1,"icon-size"],"iconFramed":[4,"icon-framed"],"instance":[1]},[[8,"keydown","handleKeydown"]]],[1,"ezp-user-menu",{"name":[1],"open":[1028]},null,{"open":[{"watchOpen":0}]}],[1,"ezp-select",{"icon":[1],"label":[1],"optionFlow":[1,"option-flow"],"options":[16],"placeholder":[1],"preSelected":[8,"pre-selected"],"toggleFlow":[1,"toggle-flow"],"disabled":[4],"expanded":[32],"selected":[32]},null,{"expanded":[{"watchExpanded":0}],"preSelected":[{"preSelectedChanged":0}]}],[1,"ezp-input",{"label":[1],"value":[1032],"type":[1],"icon":[1],"suffix":[513],"eventType":[1,"event-type"],"placeholder":[1],"focused":[32]}],[1,"ezp-stepper",{"icon":[1],"label":[1],"max":[2],"min":[2],"canDecrease":[32],"canIncrease":[32],"focused":[32],"value":[32]},null,{"value":[{"watchValue":0}]}],[1,"ezp-status",{"description":[1],"subtext":[1],"processing":[4],"instance":[1],"icon":[1],"cancel":[8],"close":[8],"retry":[8]}],[1,"ezp-file-name",{"name":[1],"level":[1],"weight":[1],"placement":[1],"anchor":[1],"expanded":[32],"tooltipOpen":[32]},[[10,"keydown","handleKeyDown"]],{"tooltipOpen":[{"watchTooltipOpen":0}]}],[1,"ezp-backdrop",{"visible":[1028]},[[0,"animationend","listenAnimationEnd"]]],[1,"ezp-icon-button",{"blank":[4],"disabled":[4],"href":[1],"icon":[1],"level":[1],"type":[1]}],[1,"ezp-text-button",{"blank":[4],"disabled":[4],"href":[1],"level":[1],"label":[1],"type":[1],"small":[4]}],[1,"ezp-icon",{"name":[1],"size":[1],"framed":[4]}],[1,"ezp-label",{"ellipsis":[4],"level":[1],"noWrap":[4,"no-wrap"],"text":[1],"weight":[1],"isTruncated":[64]}]]]], options);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
exports.setNonce = index.setNonce;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"components/ezp-auth/ezp-auth.js",
|
|
4
4
|
"components/ezp-backdrop/ezp-backdrop.js",
|
|
5
5
|
"components/ezp-dialog/ezp-dialog.js",
|
|
6
|
+
"components/ezp-file-name/ezp-file-name.js",
|
|
6
7
|
"components/ezp-icon/ezp-icon.js",
|
|
7
8
|
"components/ezp-icon-button/ezp-icon-button.js",
|
|
8
9
|
"components/ezp-input/ezp-input.js",
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Rules
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
/* Deliberately not a positioning context: the tooltip anchors to the nearest
|
|
8
|
+
positioned ancestor, so the consumer puts `position: relative` on the whole
|
|
9
|
+
row and the bubble may use its full width instead of the name column's. */
|
|
10
|
+
:host {
|
|
11
|
+
display: block;
|
|
12
|
+
min-width: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* The name is a button so the full text is reachable without a pointer: tap on
|
|
16
|
+
touch, Enter or Space on a keyboard. */
|
|
17
|
+
#trigger {
|
|
18
|
+
align-items: baseline;
|
|
19
|
+
appearance: none;
|
|
20
|
+
background: transparent;
|
|
21
|
+
border: 0;
|
|
22
|
+
border-radius: 4px;
|
|
23
|
+
color: inherit;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
display: flex;
|
|
26
|
+
font-family: inherit;
|
|
27
|
+
margin: 0;
|
|
28
|
+
max-width: 100%;
|
|
29
|
+
min-width: 0;
|
|
30
|
+
outline-color: var(--ezp-theme-solid);
|
|
31
|
+
outline-offset: 2px;
|
|
32
|
+
padding: 0;
|
|
33
|
+
text-align: left;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Everything but the last few characters, and the only part allowed to clip. */
|
|
37
|
+
.head {
|
|
38
|
+
flex: 0 1 auto;
|
|
39
|
+
min-width: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Held back from truncation, so a trailing `_DE` / `_EN` stays readable. */
|
|
43
|
+
.tail {
|
|
44
|
+
flex: 0 0 auto;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* The split can fall on a space — `Invoice (1).pdf`, `Document copy.pdf` — and
|
|
48
|
+
a space at the edge of a block collapses away, silently renaming the file on
|
|
49
|
+
screen. `pre` keeps it; the halves still cannot wrap, which is what the
|
|
50
|
+
ellipsis needs. */
|
|
51
|
+
:host(:not(.expanded)) .head,
|
|
52
|
+
:host(:not(.expanded)) .tail {
|
|
53
|
+
--ezp-label-whiteSpace: pre;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Expanded shows the whole name, so it has to wrap while keeping its spaces. */
|
|
57
|
+
:host(.expanded) .head {
|
|
58
|
+
--ezp-label-whiteSpace: pre-wrap;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:host(.expanded) #trigger {
|
|
62
|
+
/* Long names rarely carry spaces, so allow a break anywhere. */
|
|
63
|
+
word-break: break-all;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* Tooltip
|
|
69
|
+
*
|
|
70
|
+
*/
|
|
71
|
+
#tooltip {
|
|
72
|
+
background: var(--ezp-core-surface-tertiary);
|
|
73
|
+
border-radius: 8px;
|
|
74
|
+
box-shadow: 0 0 0 1px var(--ezp-core-outline), 0 16px 40px -16px var(--ezp-core-backdrop);
|
|
75
|
+
color: var(--ezp-core-foreground-primary);
|
|
76
|
+
font-size: 12px;
|
|
77
|
+
font-weight: 500;
|
|
78
|
+
left: 0;
|
|
79
|
+
line-height: 18px;
|
|
80
|
+
padding: var(--ezp-spacing-2) var(--ezp-spacing-3);
|
|
81
|
+
/* Stays hoverable so it can be read without it vanishing (WCAG 1.4.13); it
|
|
82
|
+
closes on its own mouseleave, so it only sits over the row while in use. */
|
|
83
|
+
pointer-events: auto;
|
|
84
|
+
position: absolute;
|
|
85
|
+
/* Spans the row it is anchored to: wide enough for most names to stay on one
|
|
86
|
+
line, and it covers the neighbouring row cleanly rather than half of it. */
|
|
87
|
+
right: 0;
|
|
88
|
+
word-break: break-all;
|
|
89
|
+
z-index: 10;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
:host(.place-top) #tooltip {
|
|
93
|
+
bottom: calc(100% + var(--ezp-spacing-2));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
:host(.place-bottom) #tooltip {
|
|
97
|
+
top: calc(100% + var(--ezp-spacing-2));
|
|
98
|
+
}
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { pickTooltipSide } from "../../utils/utils";
|
|
3
|
+
/**
|
|
4
|
+
* Characters kept at the end of a truncated name. Uploads often differ only in
|
|
5
|
+
* a suffix like `_DE.pdf`, which a plain end-ellipsis would be the first thing
|
|
6
|
+
* to hide, so that tail is held back and the middle gives way instead.
|
|
7
|
+
*/
|
|
8
|
+
const TAIL_LENGTH = 8;
|
|
9
|
+
/** Hovering across a list shouldn't flash a tooltip over every row in passing. */
|
|
10
|
+
const OPEN_DELAY_MS = 300;
|
|
11
|
+
/** Grace period for crossing the gap between the name and the bubble, so the
|
|
12
|
+
* tooltip can be hovered rather than vanishing on the way (WCAG 1.4.13). */
|
|
13
|
+
const CLOSE_DELAY_MS = 200;
|
|
14
|
+
export class EzpFileName {
|
|
15
|
+
constructor() {
|
|
16
|
+
/** Invalidates an in-flight open when the pointer leaves. */
|
|
17
|
+
this.openGeneration = 0;
|
|
18
|
+
/** Everything the open tooltip listens to for scrolling, to detach on close. */
|
|
19
|
+
this.scrollTargets = [];
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* Properties
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
/** The full file name. Always present in the DOM, so screen readers and
|
|
26
|
+
* copy-paste get it in full however it is truncated on screen. */
|
|
27
|
+
this.name = '';
|
|
28
|
+
/** Type scale of the rendered name, passed through to `ezp-label`. */
|
|
29
|
+
this.level = 'secondary';
|
|
30
|
+
/** Font weight of the rendered name, passed through to `ezp-label`. */
|
|
31
|
+
this.weight = 'soft';
|
|
32
|
+
/** Side the tooltip opens on. Consumers point it away from the edge their
|
|
33
|
+
* row sits against — `bottom` for the first row of a list, `top` below it. */
|
|
34
|
+
this.placement = 'top';
|
|
35
|
+
/** What the tooltip is placed against.
|
|
36
|
+
*
|
|
37
|
+
* `container`: the nearest positioned ancestor, by CSS alone. The consumer
|
|
38
|
+
* makes the row that ancestor, and the bubble opens at the row's edge.
|
|
39
|
+
*
|
|
40
|
+
* `parent`: the row the name sits in, measured when the tooltip opens — the
|
|
41
|
+
* closest ancestor marked `data-tooltip-row`, or else the name's parent
|
|
42
|
+
* element. For rows inside a scroll container, which would clip a bubble
|
|
43
|
+
* anchored to the row. The consumer puts the positioned ancestor outside the
|
|
44
|
+
* scroller instead, and the bubble spans that ancestor but lines up with
|
|
45
|
+
* the row. */
|
|
46
|
+
this.anchor = 'container';
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* States
|
|
50
|
+
*
|
|
51
|
+
*/
|
|
52
|
+
/** Set by tapping the name: shows it in full, wrapped over several lines.
|
|
53
|
+
* This is the touch counterpart of the tooltip, which needs a pointer. */
|
|
54
|
+
this.expanded = false;
|
|
55
|
+
this.tooltipOpen = false;
|
|
56
|
+
this.openTooltip = () => {
|
|
57
|
+
if (!this.hasHover || this.expanded)
|
|
58
|
+
return;
|
|
59
|
+
clearTimeout(this.openTimeout);
|
|
60
|
+
const generation = ++this.openGeneration;
|
|
61
|
+
this.openTimeout = setTimeout(async () => {
|
|
62
|
+
const clipped = await this.isClipped();
|
|
63
|
+
// Measuring yields, and the pointer may have moved on in the meantime —
|
|
64
|
+
// opening now would leave a tooltip behind with nothing to dismiss it.
|
|
65
|
+
if (clipped && generation === this.openGeneration)
|
|
66
|
+
this.tooltipOpen = true;
|
|
67
|
+
}, OPEN_DELAY_MS);
|
|
68
|
+
};
|
|
69
|
+
this.closeTooltip = () => {
|
|
70
|
+
this.openGeneration++;
|
|
71
|
+
clearTimeout(this.openTimeout);
|
|
72
|
+
clearTimeout(this.closeTimeout);
|
|
73
|
+
this.tooltipOpen = false;
|
|
74
|
+
};
|
|
75
|
+
/** Leaves the tooltip up briefly so the pointer can reach it. */
|
|
76
|
+
this.scheduleClose = () => {
|
|
77
|
+
clearTimeout(this.openTimeout);
|
|
78
|
+
clearTimeout(this.closeTimeout);
|
|
79
|
+
this.closeTimeout = setTimeout(this.closeTooltip, CLOSE_DELAY_MS);
|
|
80
|
+
};
|
|
81
|
+
this.cancelScheduledClose = () => {
|
|
82
|
+
clearTimeout(this.closeTimeout);
|
|
83
|
+
};
|
|
84
|
+
this.toggleExpanded = () => {
|
|
85
|
+
this.expanded = !this.expanded;
|
|
86
|
+
// The full name is on screen now; a tooltip repeating it is just in the way.
|
|
87
|
+
if (this.expanded)
|
|
88
|
+
this.closeTooltip();
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
* Lifecycle methods
|
|
94
|
+
*
|
|
95
|
+
*/
|
|
96
|
+
disconnectedCallback() {
|
|
97
|
+
// Closing also drops the listeners. A node that is moved comes back with
|
|
98
|
+
// its tooltip shut, rather than open with nothing left to close it.
|
|
99
|
+
this.closeTooltip();
|
|
100
|
+
this.stopWatchingScroll();
|
|
101
|
+
}
|
|
102
|
+
componentDidRender() {
|
|
103
|
+
if (this.tooltipOpen && this.anchor === 'parent')
|
|
104
|
+
this.placeTooltip();
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
*
|
|
108
|
+
* Watchers
|
|
109
|
+
*
|
|
110
|
+
*/
|
|
111
|
+
/** A measured bubble stays where it was put, so once the row scrolls away
|
|
112
|
+
* under it, it would point at the wrong name. Closing it is the honest fix. */
|
|
113
|
+
watchTooltipOpen(open) {
|
|
114
|
+
if (open && this.anchor === 'parent')
|
|
115
|
+
this.watchScroll();
|
|
116
|
+
else
|
|
117
|
+
this.stopWatchingScroll();
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
*
|
|
121
|
+
* Listeners
|
|
122
|
+
*
|
|
123
|
+
*/
|
|
124
|
+
/**
|
|
125
|
+
* Escape dismisses the tooltip, and only the tooltip.
|
|
126
|
+
*
|
|
127
|
+
* Listening globally catches the key however the tooltip was opened,
|
|
128
|
+
* including by hover, when nothing here has focus. It has to run in the
|
|
129
|
+
* capture phase: stopping propagation on the way back up happens after every
|
|
130
|
+
* ancestor has already seen the key, so a host app that closes its dialog on
|
|
131
|
+
* Escape would close it as the tooltip was dismissed.
|
|
132
|
+
*
|
|
133
|
+
* `window` rather than `document`, because dialog libraries capture on the
|
|
134
|
+
* document themselves — Radix's `DismissableLayer` does — and register before
|
|
135
|
+
* a component mounted inside them, so they would still see the key first.
|
|
136
|
+
* Capture runs window before document, so this transient layer consumes the
|
|
137
|
+
* key first, and only while it is actually open.
|
|
138
|
+
*/
|
|
139
|
+
handleKeyDown(event) {
|
|
140
|
+
if (event.key === 'Escape' && this.tooltipOpen) {
|
|
141
|
+
event.stopPropagation();
|
|
142
|
+
this.closeTooltip();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
*
|
|
147
|
+
* Private methods
|
|
148
|
+
*
|
|
149
|
+
*/
|
|
150
|
+
/** Tooltips need a pointer; touch devices get the tap-to-expand path instead.
|
|
151
|
+
* Tapping fires a synthetic `mouseenter` in most mobile browsers, so without
|
|
152
|
+
* this check a tooltip would open on every tap. */
|
|
153
|
+
get hasHover() {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
return (_b = (_a = window.matchMedia) === null || _a === void 0 ? void 0 : _a.call(window, '(hover: hover)').matches) !== null && _b !== void 0 ? _b : false;
|
|
156
|
+
}
|
|
157
|
+
/** Whether anything is actually hidden. A name that fits needs no tooltip —
|
|
158
|
+
* repeating text the reader can already see is just noise in the way. */
|
|
159
|
+
async isClipped() {
|
|
160
|
+
var _a, _b;
|
|
161
|
+
const head = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.head');
|
|
162
|
+
if (!head)
|
|
163
|
+
return false;
|
|
164
|
+
await ((_b = head.componentOnReady) === null || _b === void 0 ? void 0 : _b.call(head));
|
|
165
|
+
return head.isTruncated();
|
|
166
|
+
}
|
|
167
|
+
/** Lines the bubble up with the row the name sits in. Its containing block
|
|
168
|
+
* is somewhere further out, so `top: 0` shows where that block starts, and
|
|
169
|
+
* the offset is taken from there. Measurements are in screen pixels, which
|
|
170
|
+
* differ from CSS pixels when a host scales the dialog with a transform, so
|
|
171
|
+
* the offset is converted back before it is applied.
|
|
172
|
+
*
|
|
173
|
+
* `placement` is a preference here: a row near the edge of whatever clips
|
|
174
|
+
* the bubble may not have room on that side, so it opens on the other. */
|
|
175
|
+
placeTooltip() {
|
|
176
|
+
var _a, _b;
|
|
177
|
+
const tooltip = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#tooltip');
|
|
178
|
+
const row = (_b = this.host.closest('[data-tooltip-row]')) !== null && _b !== void 0 ? _b : this.host.parentElement;
|
|
179
|
+
if (!tooltip || !row)
|
|
180
|
+
return;
|
|
181
|
+
tooltip.style.bottom = 'auto';
|
|
182
|
+
tooltip.style.top = '0px';
|
|
183
|
+
const bubble = tooltip.getBoundingClientRect();
|
|
184
|
+
const scale = tooltip.offsetHeight > 0 ? bubble.height / tooltip.offsetHeight : 1;
|
|
185
|
+
const rowRect = row.getBoundingClientRect();
|
|
186
|
+
const gap = (parseFloat(getComputedStyle(tooltip).getPropertyValue('--ezp-spacing-2')) || 6) * scale;
|
|
187
|
+
const side = pickTooltipSide(this.placement, rowRect, bubble.height + gap, this.visibleArea(tooltip));
|
|
188
|
+
const top = side === 'top' ? rowRect.top - gap - bubble.height : rowRect.bottom + gap;
|
|
189
|
+
tooltip.style.top = `${(top - bubble.top) / (scale || 1)}px`;
|
|
190
|
+
}
|
|
191
|
+
/** The part of the screen the bubble can show in: the viewport, narrowed by
|
|
192
|
+
* every ancestor of its containing block that clips overflow — the host's
|
|
193
|
+
* scrolling body, say. The scroller the rows sit in isn't among them, as the
|
|
194
|
+
* bubble is anchored beyond it. */
|
|
195
|
+
visibleArea(tooltip) {
|
|
196
|
+
var _a;
|
|
197
|
+
let top = 0;
|
|
198
|
+
let bottom = window.innerHeight;
|
|
199
|
+
let node = tooltip.offsetParent;
|
|
200
|
+
while (node) {
|
|
201
|
+
if (getComputedStyle(node).overflowY !== 'visible') {
|
|
202
|
+
const rect = node.getBoundingClientRect();
|
|
203
|
+
top = Math.max(top, rect.top);
|
|
204
|
+
bottom = Math.min(bottom, rect.bottom);
|
|
205
|
+
}
|
|
206
|
+
node = (_a = node.parentElement) !== null && _a !== void 0 ? _a : (node.getRootNode().host || null);
|
|
207
|
+
}
|
|
208
|
+
return { top, bottom };
|
|
209
|
+
}
|
|
210
|
+
/** Scroll events don't bubble, so every ancestor is listened to directly —
|
|
211
|
+
* across shadow roots, since the scroll container is usually the consumer's.
|
|
212
|
+
* A window resize re-wraps the bubble just the same, so it closes it too. */
|
|
213
|
+
watchScroll() {
|
|
214
|
+
this.stopWatchingScroll();
|
|
215
|
+
const targets = [window];
|
|
216
|
+
let node = this.host.parentNode;
|
|
217
|
+
while (node) {
|
|
218
|
+
if (node.nodeType === Node.ELEMENT_NODE)
|
|
219
|
+
targets.push(node);
|
|
220
|
+
node = node instanceof ShadowRoot ? node.host : node.parentNode;
|
|
221
|
+
}
|
|
222
|
+
targets.forEach((target) => target.addEventListener('scroll', this.closeTooltip, { passive: true }));
|
|
223
|
+
window.addEventListener('resize', this.closeTooltip, { passive: true });
|
|
224
|
+
this.scrollTargets = targets;
|
|
225
|
+
}
|
|
226
|
+
stopWatchingScroll() {
|
|
227
|
+
this.scrollTargets.forEach((target) => target.removeEventListener('scroll', this.closeTooltip));
|
|
228
|
+
this.scrollTargets = [];
|
|
229
|
+
window.removeEventListener('resize', this.closeTooltip);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
*
|
|
233
|
+
* Render method
|
|
234
|
+
*
|
|
235
|
+
*/
|
|
236
|
+
render() {
|
|
237
|
+
// Splitting is a rendering device only: `head` holds everything but the last
|
|
238
|
+
// few characters and is the part CSS is allowed to clip, so the two labels
|
|
239
|
+
// together still spell out the whole name.
|
|
240
|
+
const split = !this.expanded && this.name.length > TAIL_LENGTH;
|
|
241
|
+
const head = split ? this.name.slice(0, -TAIL_LENGTH) : this.name;
|
|
242
|
+
const tail = split ? this.name.slice(-TAIL_LENGTH) : '';
|
|
243
|
+
return (h(Host, { key: '6fa83e22c07a31d2a56df34f2f12edf20e1eba15', class: { expanded: this.expanded, [`place-${this.placement}`]: true } }, h("button", { key: '07c2f0afc897be0ef1bd1622a486d7ff7ec73953', type: "button", id: "trigger", "aria-label": this.name, "aria-expanded": this.expanded ? 'true' : 'false', onClick: this.toggleExpanded, onMouseEnter: this.openTooltip, onMouseLeave: this.scheduleClose, onFocus: this.openTooltip, onBlur: this.closeTooltip }, h("ezp-label", { key: '7a8711a0ac21e2b7bf84a40492b0b193dd3dd29f', class: "head", ellipsis: split, level: this.level, weight: this.weight, text: head }), split && h("ezp-label", { key: 'be08c7a34cff7db6e5328627de26ff272415e27d', class: "tail", level: this.level, weight: this.weight, text: tail })), this.tooltipOpen && (h("div", { key: 'fe79f1aeced27b5ebf68e8a6cd3fcdd26e19c5eb', id: "tooltip", "aria-hidden": "true", onMouseEnter: this.cancelScheduledClose, onMouseLeave: this.closeTooltip }, this.name))));
|
|
244
|
+
}
|
|
245
|
+
static get is() { return "ezp-file-name"; }
|
|
246
|
+
static get encapsulation() { return "shadow"; }
|
|
247
|
+
static get originalStyleUrls() {
|
|
248
|
+
return {
|
|
249
|
+
"$": ["ezp-file-name.scss"]
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
static get styleUrls() {
|
|
253
|
+
return {
|
|
254
|
+
"$": ["ezp-file-name.css"]
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
static get properties() {
|
|
258
|
+
return {
|
|
259
|
+
"name": {
|
|
260
|
+
"type": "string",
|
|
261
|
+
"mutable": false,
|
|
262
|
+
"complexType": {
|
|
263
|
+
"original": "string",
|
|
264
|
+
"resolved": "string",
|
|
265
|
+
"references": {}
|
|
266
|
+
},
|
|
267
|
+
"required": false,
|
|
268
|
+
"optional": false,
|
|
269
|
+
"docs": {
|
|
270
|
+
"tags": [],
|
|
271
|
+
"text": "The full file name. Always present in the DOM, so screen readers and\ncopy-paste get it in full however it is truncated on screen."
|
|
272
|
+
},
|
|
273
|
+
"getter": false,
|
|
274
|
+
"setter": false,
|
|
275
|
+
"reflect": false,
|
|
276
|
+
"attribute": "name",
|
|
277
|
+
"defaultValue": "''"
|
|
278
|
+
},
|
|
279
|
+
"level": {
|
|
280
|
+
"type": "string",
|
|
281
|
+
"mutable": false,
|
|
282
|
+
"complexType": {
|
|
283
|
+
"original": "LabelLevelTypes",
|
|
284
|
+
"resolved": "\"primary\" | \"secondary\" | \"tertiary\"",
|
|
285
|
+
"references": {
|
|
286
|
+
"LabelLevelTypes": {
|
|
287
|
+
"location": "import",
|
|
288
|
+
"path": "../../shared/types",
|
|
289
|
+
"id": "src/shared/types.d.ts::LabelLevelTypes",
|
|
290
|
+
"referenceLocation": "LabelLevelTypes"
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
"required": false,
|
|
295
|
+
"optional": false,
|
|
296
|
+
"docs": {
|
|
297
|
+
"tags": [],
|
|
298
|
+
"text": "Type scale of the rendered name, passed through to `ezp-label`."
|
|
299
|
+
},
|
|
300
|
+
"getter": false,
|
|
301
|
+
"setter": false,
|
|
302
|
+
"reflect": false,
|
|
303
|
+
"attribute": "level",
|
|
304
|
+
"defaultValue": "'secondary'"
|
|
305
|
+
},
|
|
306
|
+
"weight": {
|
|
307
|
+
"type": "string",
|
|
308
|
+
"mutable": false,
|
|
309
|
+
"complexType": {
|
|
310
|
+
"original": "WeightTypes",
|
|
311
|
+
"resolved": "\"heavy\" | \"soft\" | \"strong\"",
|
|
312
|
+
"references": {
|
|
313
|
+
"WeightTypes": {
|
|
314
|
+
"location": "import",
|
|
315
|
+
"path": "../../shared/types",
|
|
316
|
+
"id": "src/shared/types.d.ts::WeightTypes",
|
|
317
|
+
"referenceLocation": "WeightTypes"
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
"required": false,
|
|
322
|
+
"optional": false,
|
|
323
|
+
"docs": {
|
|
324
|
+
"tags": [],
|
|
325
|
+
"text": "Font weight of the rendered name, passed through to `ezp-label`."
|
|
326
|
+
},
|
|
327
|
+
"getter": false,
|
|
328
|
+
"setter": false,
|
|
329
|
+
"reflect": false,
|
|
330
|
+
"attribute": "weight",
|
|
331
|
+
"defaultValue": "'soft'"
|
|
332
|
+
},
|
|
333
|
+
"placement": {
|
|
334
|
+
"type": "string",
|
|
335
|
+
"mutable": false,
|
|
336
|
+
"complexType": {
|
|
337
|
+
"original": "TooltipPlacementTypes",
|
|
338
|
+
"resolved": "\"bottom\" | \"top\"",
|
|
339
|
+
"references": {
|
|
340
|
+
"TooltipPlacementTypes": {
|
|
341
|
+
"location": "import",
|
|
342
|
+
"path": "../../shared/types",
|
|
343
|
+
"id": "src/shared/types.d.ts::TooltipPlacementTypes",
|
|
344
|
+
"referenceLocation": "TooltipPlacementTypes"
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
"required": false,
|
|
349
|
+
"optional": false,
|
|
350
|
+
"docs": {
|
|
351
|
+
"tags": [],
|
|
352
|
+
"text": "Side the tooltip opens on. Consumers point it away from the edge their\nrow sits against \u2014 `bottom` for the first row of a list, `top` below it."
|
|
353
|
+
},
|
|
354
|
+
"getter": false,
|
|
355
|
+
"setter": false,
|
|
356
|
+
"reflect": false,
|
|
357
|
+
"attribute": "placement",
|
|
358
|
+
"defaultValue": "'top'"
|
|
359
|
+
},
|
|
360
|
+
"anchor": {
|
|
361
|
+
"type": "string",
|
|
362
|
+
"mutable": false,
|
|
363
|
+
"complexType": {
|
|
364
|
+
"original": "TooltipAnchorTypes",
|
|
365
|
+
"resolved": "\"container\" | \"parent\"",
|
|
366
|
+
"references": {
|
|
367
|
+
"TooltipAnchorTypes": {
|
|
368
|
+
"location": "import",
|
|
369
|
+
"path": "../../shared/types",
|
|
370
|
+
"id": "src/shared/types.d.ts::TooltipAnchorTypes",
|
|
371
|
+
"referenceLocation": "TooltipAnchorTypes"
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
"required": false,
|
|
376
|
+
"optional": false,
|
|
377
|
+
"docs": {
|
|
378
|
+
"tags": [],
|
|
379
|
+
"text": "What the tooltip is placed against.\n\n`container`: the nearest positioned ancestor, by CSS alone. The consumer\nmakes the row that ancestor, and the bubble opens at the row's edge.\n\n`parent`: the row the name sits in, measured when the tooltip opens \u2014 the\nclosest ancestor marked `data-tooltip-row`, or else the name's parent\nelement. For rows inside a scroll container, which would clip a bubble\nanchored to the row. The consumer puts the positioned ancestor outside the\nscroller instead, and the bubble spans that ancestor but lines up with\nthe row."
|
|
380
|
+
},
|
|
381
|
+
"getter": false,
|
|
382
|
+
"setter": false,
|
|
383
|
+
"reflect": false,
|
|
384
|
+
"attribute": "anchor",
|
|
385
|
+
"defaultValue": "'container'"
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
static get states() {
|
|
390
|
+
return {
|
|
391
|
+
"expanded": {},
|
|
392
|
+
"tooltipOpen": {}
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
static get elementRef() { return "host"; }
|
|
396
|
+
static get watchers() {
|
|
397
|
+
return [{
|
|
398
|
+
"propName": "tooltipOpen",
|
|
399
|
+
"methodName": "watchTooltipOpen"
|
|
400
|
+
}];
|
|
401
|
+
}
|
|
402
|
+
static get listeners() {
|
|
403
|
+
return [{
|
|
404
|
+
"name": "keydown",
|
|
405
|
+
"method": "handleKeyDown",
|
|
406
|
+
"target": "window",
|
|
407
|
+
"capture": true,
|
|
408
|
+
"passive": false
|
|
409
|
+
}];
|
|
410
|
+
}
|
|
411
|
+
}
|
|
@@ -30,7 +30,7 @@ export class EzpIcon {
|
|
|
30
30
|
return (
|
|
31
31
|
// Decorative: icons here always sit next to a label or live-region text,
|
|
32
32
|
// so hide them from the accessibility tree to avoid double announcements.
|
|
33
|
-
h(Host, { key: '
|
|
33
|
+
h(Host, { key: 'f1a45d38b75ccf4e0c5e6200d9d04c7e5766bfbc', class: `${this.size} ${this.framed ? 'framed' : ''}`, "aria-hidden": "true" }, h("div", { key: '70f6963181d31089fefb662079e1e075540d2fe7', id: "glyph", innerHTML: this.glyph })));
|
|
34
34
|
}
|
|
35
35
|
static get is() { return "ezp-icon"; }
|
|
36
36
|
static get encapsulation() { return "shadow"; }
|
|
@@ -32,7 +32,7 @@ export class EzpIconButton {
|
|
|
32
32
|
// Icon-only control: derive an accessible name from the icon so screen
|
|
33
33
|
// readers announce something meaningful (e.g. "menu", "printer").
|
|
34
34
|
const label = this.icon.replace(/[-_]/g, ' ');
|
|
35
|
-
return (h(Host, { key: '
|
|
35
|
+
return (h(Host, { key: 'd67a43c2b91eaa4fa79dd8559824f3ffc23757b2', class: `${this.level}` }, h(TagType, Object.assign({ key: '3b11b4e0c40c8f900496ae03a4eee11f0980cd80', id: "button", "aria-label": label }, attributes), h("ezp-icon", { key: '14a35e8f779628197f7dd89219792d7809990631', name: this.icon }))));
|
|
36
36
|
}
|
|
37
37
|
static get is() { return "ezp-icon-button"; }
|
|
38
38
|
static get encapsulation() { return "shadow"; }
|
|
@@ -45,7 +45,7 @@ export class EzpInput {
|
|
|
45
45
|
}
|
|
46
46
|
render() {
|
|
47
47
|
const hasIcon = !!this.icon;
|
|
48
|
-
return (h(Host, { key: '
|
|
48
|
+
return (h(Host, { key: 'f36f5811ba4e86b0aa3f53be916220136a1d2443', class: { focused: this.focused, 'has-icon': hasIcon }, onClick: this.setFocus }, hasIcon ? h("ezp-icon", { id: "icon", name: this.icon }) : null, h("ezp-label", { key: '88f93411e1463b23ca4ae88d278a69df5038509d', id: "label", noWrap: true, level: "secondary", text: this.label }), h("input", { key: 'b23ba3c8fea465a559e9c6d7b3da50152b412a1c', id: "input", type: this.type, value: this.value, placeholder: this.placeholder, "aria-label": this.label, onInput: (event) => this.handleChange(event), ref: (input) => (this.input = input), onFocus: this.handleFocus, onBlur: this.handleBlur }), this.suffix ? h("ezp-label", { id: "suffix", level: "secondary", text: this.suffix }) : null));
|
|
49
49
|
}
|
|
50
50
|
static get is() { return "ezp-input"; }
|
|
51
51
|
static get encapsulation() { return "shadow"; }
|
|
@@ -17,13 +17,29 @@ export class EzpLabel {
|
|
|
17
17
|
/** Description... */
|
|
18
18
|
this.weight = 'soft';
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* Public methods
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
/** Whether the text is currently clipped — `ellipsis` only bites when the
|
|
26
|
+
* text outgrows the space it was given, which callers cannot tell from the
|
|
27
|
+
* props alone. Lets a caller offer the full text only when it is needed. */
|
|
28
|
+
async isTruncated() {
|
|
29
|
+
var _a;
|
|
30
|
+
const text = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#text');
|
|
31
|
+
if (!text)
|
|
32
|
+
return false;
|
|
33
|
+
// A pixel of slack: sub-pixel layout rounds scrollWidth up on its own.
|
|
34
|
+
return text.scrollWidth > text.clientWidth + 1;
|
|
35
|
+
}
|
|
20
36
|
/**
|
|
21
37
|
*
|
|
22
38
|
* Render method
|
|
23
39
|
*
|
|
24
40
|
*/
|
|
25
41
|
render() {
|
|
26
|
-
return (h(Host, { key: '
|
|
42
|
+
return (h(Host, { key: '42139679511e711132912a1f762d345951fd1774', class: `${this.level} ${this.weight} ${this.ellipsis ? 'ellipsis' : ''} ${this.noWrap ? 'no-wrap' : ''}` }, h("div", { key: '5e54e8142d274cacb375cce8d5ef52ccdeaeec84', id: "text" }, this.text)));
|
|
27
43
|
}
|
|
28
44
|
static get is() { return "ezp-label"; }
|
|
29
45
|
static get encapsulation() { return "shadow"; }
|
|
@@ -155,4 +171,26 @@ export class EzpLabel {
|
|
|
155
171
|
}
|
|
156
172
|
};
|
|
157
173
|
}
|
|
174
|
+
static get methods() {
|
|
175
|
+
return {
|
|
176
|
+
"isTruncated": {
|
|
177
|
+
"complexType": {
|
|
178
|
+
"signature": "() => Promise<boolean>",
|
|
179
|
+
"parameters": [],
|
|
180
|
+
"references": {
|
|
181
|
+
"Promise": {
|
|
182
|
+
"location": "global",
|
|
183
|
+
"id": "global::Promise"
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"return": "Promise<boolean>"
|
|
187
|
+
},
|
|
188
|
+
"docs": {
|
|
189
|
+
"text": "Whether the text is currently clipped \u2014 `ellipsis` only bites when the\ntext outgrows the space it was given, which callers cannot tell from the\nprops alone. Lets a caller offer the full text only when it is needed.",
|
|
190
|
+
"tags": []
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
static get elementRef() { return "host"; }
|
|
158
196
|
}
|