@oscarpalmer/oui 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/popover.css +15 -19
- package/dist/css/reset.css +16 -4
- package/dist/css/tooltip.css +23 -19
- package/dist/js/focus-trap/embedded.d.mts +2 -2
- package/dist/js/focus-trap/embedded.mjs +5 -1
- package/dist/js/focus-trap/standalone.mjs +2 -6
- package/dist/js/index.d.mts +3 -47
- package/dist/js/index.mjs +7 -2537
- package/dist/js/internal/floatable.d.mts +12 -20
- package/dist/js/internal/floatable.mjs +32 -152
- package/dist/js/popover.d.mts +1 -20
- package/dist/js/popover.mjs +53 -82
- package/dist/js/tooltip.d.mts +1 -1
- package/dist/js/tooltip.mjs +101 -126
- package/package.json +6 -6
- package/src/css/mixins.scss +14 -12
- package/src/css/popover.scss +1 -9
- package/src/css/reset.scss +16 -4
- package/src/css/tooltip.scss +9 -7
- package/src/js/focus-trap/embedded.ts +6 -1
- package/src/js/focus-trap/standalone.ts +2 -7
- package/src/js/index.ts +2 -1
- package/src/js/internal/floatable.ts +44 -299
- package/src/js/popover.ts +69 -131
- package/src/js/tooltip.ts +135 -180
package/dist/css/popover.css
CHANGED
|
@@ -1,34 +1,30 @@
|
|
|
1
1
|
|
|
2
2
|
:where([oui-popover-content]) {
|
|
3
3
|
box-shadow: inset 0 1px 0 0 transparent, 0 0 0 1px rgba(0, 0, 0, 0.05), 0 1px 2px -0.5px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.05), 0 4px 8px -2px rgba(0, 0, 0, 0.05), 0 8px 16px -4px rgba(0, 0, 0, 0.05), 0 16px 32px -8px rgba(0, 0, 0, 0.05), 0 32px 64px -16px rgba(0, 0, 0, 0.05), 0 64px 128px -32px rgba(0, 0, 0, 0.05);
|
|
4
|
-
--margin-
|
|
5
|
-
--margin-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
--margin-bottom: 0.5em;
|
|
5
|
+
--margin-left: 0.5em;
|
|
6
|
+
--margin-right: 0.5em;
|
|
7
|
+
--margin-top: 0.5em;
|
|
8
|
+
inset-block: var(--margin-top) var(--margin-bottom);
|
|
9
|
+
inset-inline: var(--margin-left) var(--margin-right);
|
|
8
10
|
}
|
|
9
|
-
:where([oui-popover-content])[oui-position
|
|
10
|
-
margin: 0
|
|
11
|
+
:where([oui-popover-content])[oui-position$=bottom] {
|
|
12
|
+
--margin-bottom: 0;
|
|
11
13
|
}
|
|
12
|
-
:where([oui-popover-content])[oui-position
|
|
13
|
-
margin: 0
|
|
14
|
+
:where([oui-popover-content])[oui-position$=end] {
|
|
15
|
+
--margin-right: 0;
|
|
14
16
|
}
|
|
15
|
-
:where([oui-popover-content])[oui-position
|
|
16
|
-
margin: 0
|
|
17
|
+
:where([oui-popover-content])[oui-position$=start] {
|
|
18
|
+
--margin-left: 0;
|
|
17
19
|
}
|
|
18
|
-
:where([oui-popover-content])[oui-position
|
|
19
|
-
margin: 0
|
|
20
|
+
:where([oui-popover-content])[oui-position$=top] {
|
|
21
|
+
--margin-top: 0;
|
|
20
22
|
}
|
|
21
23
|
:where([oui-popover-content]) {
|
|
22
24
|
padding: 1rem;
|
|
23
|
-
overscroll-behavior: contain;
|
|
24
25
|
background-color: var(--oui-absolute);
|
|
26
|
+
border: none;
|
|
25
27
|
border-radius: 0.25rem;
|
|
26
28
|
}
|
|
27
|
-
:where([oui-popover-content]):focus {
|
|
28
|
-
outline: none;
|
|
29
|
-
}
|
|
30
|
-
:where([oui-popover-content]) * {
|
|
31
|
-
overscroll-behavior: contain;
|
|
32
|
-
}
|
|
33
29
|
|
|
34
30
|
|
package/dist/css/reset.css
CHANGED
|
@@ -367,6 +367,14 @@ summary) {
|
|
|
367
367
|
/**
|
|
368
368
|
* Attributes
|
|
369
369
|
*/
|
|
370
|
+
:where([aria-busy=true i]) {
|
|
371
|
+
cursor: progress;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
:where([aria-controls]) {
|
|
375
|
+
cursor: pointer;
|
|
376
|
+
}
|
|
377
|
+
|
|
370
378
|
:where([disabled], [aria-disabled=true i]) {
|
|
371
379
|
cursor: default;
|
|
372
380
|
}
|
|
@@ -375,12 +383,16 @@ summary) {
|
|
|
375
383
|
display: none !important;
|
|
376
384
|
}
|
|
377
385
|
|
|
378
|
-
:where([
|
|
379
|
-
|
|
386
|
+
:where([popover]) {
|
|
387
|
+
display: none !important;
|
|
388
|
+
overflow: visible;
|
|
389
|
+
overscroll-behavior: contain;
|
|
390
|
+
border: none;
|
|
391
|
+
color: currentcolor;
|
|
380
392
|
}
|
|
381
393
|
|
|
382
|
-
:where([
|
|
383
|
-
|
|
394
|
+
:where([popover]:popover-open) {
|
|
395
|
+
display: inherit !important;
|
|
384
396
|
}
|
|
385
397
|
|
|
386
398
|
/**
|
package/dist/css/tooltip.css
CHANGED
|
@@ -27,62 +27,66 @@ var)) {
|
|
|
27
27
|
|
|
28
28
|
:where([oui-tooltip-content]) {
|
|
29
29
|
box-shadow: inset 0 1px 0 0 transparent, 0 0 0 1px rgba(0, 0, 0, 0.05), 0 1px 2px -0.5px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.05), 0 4px 8px -2px rgba(0, 0, 0, 0.05), 0 8px 16px -4px rgba(0, 0, 0, 0.05), 0 16px 32px -8px rgba(0, 0, 0, 0.05), 0 32px 64px -16px rgba(0, 0, 0, 0.05), 0 64px 128px -32px rgba(0, 0, 0, 0.05);
|
|
30
|
-
--margin-
|
|
31
|
-
--margin-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
--margin-bottom: 0.5em;
|
|
31
|
+
--margin-left: 0.5em;
|
|
32
|
+
--margin-right: 0.5em;
|
|
33
|
+
--margin-top: 0.5em;
|
|
34
|
+
inset-block: var(--margin-top) var(--margin-bottom);
|
|
35
|
+
inset-inline: var(--margin-left) var(--margin-right);
|
|
34
36
|
}
|
|
35
|
-
:where([oui-tooltip-content])[oui-position
|
|
36
|
-
margin: 0
|
|
37
|
+
:where([oui-tooltip-content])[oui-position$=bottom] {
|
|
38
|
+
--margin-bottom: 0;
|
|
37
39
|
}
|
|
38
|
-
:where([oui-tooltip-content])[oui-position
|
|
39
|
-
margin: 0
|
|
40
|
+
:where([oui-tooltip-content])[oui-position$=end] {
|
|
41
|
+
--margin-right: 0;
|
|
40
42
|
}
|
|
41
|
-
:where([oui-tooltip-content])[oui-position
|
|
42
|
-
margin: 0
|
|
43
|
+
:where([oui-tooltip-content])[oui-position$=start] {
|
|
44
|
+
--margin-left: 0;
|
|
43
45
|
}
|
|
44
|
-
:where([oui-tooltip-content])[oui-position
|
|
45
|
-
margin: 0
|
|
46
|
+
:where([oui-tooltip-content])[oui-position$=top] {
|
|
47
|
+
--margin-top: 0;
|
|
46
48
|
}
|
|
47
49
|
:where([oui-tooltip-content]) {
|
|
48
50
|
max-width: 48ch;
|
|
49
51
|
padding: 0.75em 1em;
|
|
52
|
+
overflow: visible;
|
|
50
53
|
opacity: 0;
|
|
51
54
|
background-color: var(--oui-absolute);
|
|
52
55
|
border-radius: 0.25rem;
|
|
53
56
|
font-size: 0.875rem;
|
|
54
57
|
pointer-events: none;
|
|
55
|
-
transition: opacity 0.125s ease-in-out;
|
|
58
|
+
transition: opacity 0.125s ease-in-out 0s;
|
|
59
|
+
transition-behavior: allow-discrete;
|
|
56
60
|
}
|
|
57
61
|
:where([oui-tooltip-content])::after {
|
|
58
62
|
content: "";
|
|
59
|
-
|
|
63
|
+
display: block;
|
|
60
64
|
position: absolute;
|
|
61
65
|
}
|
|
62
66
|
:where([oui-tooltip-content])[oui-position^=above]::after, :where([oui-tooltip-content])[oui-position^=below]::after, :where([oui-tooltip-content])[oui-position^=bottom]::after, :where([oui-tooltip-content])[oui-position^=top]::after {
|
|
63
67
|
width: 100%;
|
|
64
|
-
height:
|
|
68
|
+
height: 1em;
|
|
65
69
|
}
|
|
66
70
|
:where([oui-tooltip-content])[oui-position^=above]::after, :where([oui-tooltip-content])[oui-position^=top]::after {
|
|
67
|
-
inset: 100% 0 0;
|
|
71
|
+
inset: calc(100% - 0.5em) 0 0;
|
|
68
72
|
}
|
|
69
73
|
:where([oui-tooltip-content])[oui-position^=below]::after, :where([oui-tooltip-content])[oui-position^=bottom]::after {
|
|
70
74
|
inset: -0.5em 0 0;
|
|
71
75
|
}
|
|
72
76
|
:where([oui-tooltip-content])[oui-position^=end]::after, :where([oui-tooltip-content])[oui-position^=left]::after, :where([oui-tooltip-content])[oui-position^=right]::after, :where([oui-tooltip-content])[oui-position^=start]::after {
|
|
73
|
-
width:
|
|
77
|
+
width: 1em;
|
|
74
78
|
height: 100%;
|
|
75
79
|
}
|
|
76
80
|
:where([oui-tooltip-content])[oui-position^=end]::after, :where([oui-tooltip-content])[oui-position^=right]::after {
|
|
77
81
|
inset: 0 0 0 -0.5em;
|
|
78
82
|
}
|
|
79
83
|
:where([oui-tooltip-content])[oui-position^=left]::after, :where([oui-tooltip-content])[oui-position^=start]::after {
|
|
80
|
-
inset: 0 0 0 100
|
|
84
|
+
inset: 0 0 0 calc(100% - 0.5em);
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
:where([oui-tooltip-content][oui-tooltip-content-active]) {
|
|
84
88
|
opacity: 1;
|
|
85
|
-
pointer-events:
|
|
89
|
+
pointer-events: all;
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
|
|
@@ -18,9 +18,9 @@ type Options = {
|
|
|
18
18
|
noescape: boolean;
|
|
19
19
|
};
|
|
20
20
|
declare function createFocusTrap(element: HTMLElement, options?: Options): FocusTrap;
|
|
21
|
+
declare function removeFocusTrap(element: HTMLElement): void;
|
|
21
22
|
declare const FOCUS_TRAP_SELECTOR = "oui-focus-trap";
|
|
22
23
|
declare const FOCUS_TRAP_CONTAIN = "oui-focus-trap-contain";
|
|
23
24
|
declare const FOCUS_TRAP_NOESCAPE = "oui-focus-trap-noescape";
|
|
24
|
-
declare const FOCUSTRAPS_ALL: WeakMap<HTMLElement, FocusTrap>;
|
|
25
25
|
//#endregion
|
|
26
|
-
export {
|
|
26
|
+
export { FOCUS_TRAP_CONTAIN, FOCUS_TRAP_NOESCAPE, FOCUS_TRAP_SELECTOR, FocusTrap, createFocusTrap, removeFocusTrap };
|
|
@@ -96,6 +96,10 @@ function onTab(event) {
|
|
|
96
96
|
if (index === -1 || elements.length === 0) tabToTrap(focusTrap, elements, element);
|
|
97
97
|
else tabToElement(focusTrap, elements, index, event.shiftKey ? -1 : 1);
|
|
98
98
|
}
|
|
99
|
+
function removeFocusTrap(element) {
|
|
100
|
+
FOCUSTRAPS_ALL.get(element)?.destroy();
|
|
101
|
+
FOCUSTRAPS_ALL.delete(element);
|
|
102
|
+
}
|
|
99
103
|
function setConnected(focusTrap, value) {
|
|
100
104
|
if (!focusTrap.embedded || focusTrap.connected === value) return;
|
|
101
105
|
focusTrap.connected = value;
|
|
@@ -149,4 +153,4 @@ on(document, "keydown", onKeydown, EVENT_OPTIONS);
|
|
|
149
153
|
on(document, "mousedown", onPointerdown, EVENT_OPTIONS);
|
|
150
154
|
on(document, "touchstart", onPointerdown, EVENT_OPTIONS);
|
|
151
155
|
//#endregion
|
|
152
|
-
export {
|
|
156
|
+
export { FOCUS_TRAP_CONTAIN, FOCUS_TRAP_NOESCAPE, FOCUS_TRAP_SELECTOR, FocusTrap, createFocusTrap, removeFocusTrap };
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { attributable } from "../internal/attributable.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { FOCUS_TRAP_SELECTOR, createFocusTrap, removeFocusTrap } from "./embedded.mjs";
|
|
3
3
|
//#region src/js/focus-trap/standalone.ts
|
|
4
|
-
|
|
5
|
-
FOCUSTRAPS_ALL.get(element)?.destroy();
|
|
6
|
-
FOCUSTRAPS_ALL.delete(element);
|
|
7
|
-
}
|
|
8
|
-
attributable(FOCUS_TRAP_SELECTOR, createFocusTrap, removeFocusTraps);
|
|
4
|
+
attributable(FOCUS_TRAP_SELECTOR, createFocusTrap, removeFocusTrap);
|
|
9
5
|
//#endregion
|
|
10
6
|
export {};
|
package/dist/js/index.d.mts
CHANGED
|
@@ -1,47 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
'oui-popover': OuiPopoverElement;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
declare class OuiPopoverElement extends HTMLElement {
|
|
8
|
-
#private;
|
|
9
|
-
constructor();
|
|
10
|
-
close(): void;
|
|
11
|
-
connectedCallback(): void;
|
|
12
|
-
disconnectedCallback(): void;
|
|
13
|
-
hidePopover(): void;
|
|
14
|
-
open(): void;
|
|
15
|
-
showPopover(): void;
|
|
16
|
-
toggle(): void;
|
|
17
|
-
togglePopover(options?: boolean): boolean;
|
|
18
|
-
}
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region src/js/splitter.d.ts
|
|
21
|
-
declare global {
|
|
22
|
-
interface HTMLElementTagNameMap {
|
|
23
|
-
[SELECTOR]: OuiSplitterElement;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
declare class OuiSplitterElement extends HTMLElement {
|
|
27
|
-
#private;
|
|
28
|
-
static readonly observedAttributes: string[];
|
|
29
|
-
get max(): number;
|
|
30
|
-
set max(value: number);
|
|
31
|
-
get min(): number;
|
|
32
|
-
set min(value: number);
|
|
33
|
-
get size(): number;
|
|
34
|
-
set size(value: number);
|
|
35
|
-
get type(): string;
|
|
36
|
-
set type(value: string);
|
|
37
|
-
constructor();
|
|
38
|
-
connectedCallback(): void;
|
|
39
|
-
disconnectedCallback(): void;
|
|
40
|
-
attributeChangedCallback(name: string): void;
|
|
41
|
-
}
|
|
42
|
-
declare const SELECTOR = "oui-splitter";
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/js/tooltip.d.ts
|
|
45
|
-
declare function setTooltipDelay(open?: number, close?: number): void;
|
|
46
|
-
//#endregion
|
|
47
|
-
export { OuiPopoverElement, OuiSplitterElement, setTooltipDelay };
|
|
1
|
+
import { OuiSplitterElement } from "./splitter.mjs";
|
|
2
|
+
import { setTooltipDelay } from "./tooltip.mjs";
|
|
3
|
+
export { OuiSplitterElement, setTooltipDelay };
|