cx 22.7.0 → 22.8.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.
- package/dist/manifest.js +539 -539
- package/dist/ui.js +17 -13
- package/dist/widgets.css +2 -2
- package/dist/widgets.js +63 -38
- package/package.json +1 -1
- package/src/core.d.ts +9 -1
- package/src/ui/FocusManager.js +12 -4
- package/src/widgets/Button.d.ts +2 -2
- package/src/widgets/Sandbox.d.ts +8 -10
- package/src/widgets/Sandbox.js +23 -20
- package/src/widgets/form/Slider.js +18 -12
- package/src/widgets/form/Slider.scss +1 -1
- package/src/widgets/nav/Menu.js +3 -8
- package/src/widgets/nav/MenuItem.js +2 -1
- package/src/widgets/overlay/Dropdown.js +15 -6
- package/src/widgets/overlay/Overlay.js +21 -11
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Widget, VDOM } from "../../ui/Widget";
|
|
2
|
-
import { Overlay } from "./Overlay";
|
|
3
|
-
import { findFirst, isFocusable, getFocusedElement } from "../../util/DOM";
|
|
4
|
-
import { isTouchDevice } from "../../util/isTouchDevice";
|
|
5
|
-
import { ResizeManager } from "../../ui/ResizeManager";
|
|
6
1
|
import { Localization } from "../../ui/Localization";
|
|
7
|
-
import {
|
|
2
|
+
import { ResizeManager } from "../../ui/ResizeManager";
|
|
3
|
+
import { Widget, VDOM } from "../../ui/Widget";
|
|
8
4
|
import { calculateNaturalElementHeight } from "../../util/calculateNaturalElementHeight";
|
|
5
|
+
import { closestParent, findFirst, isFocusable } from "../../util/DOM";
|
|
6
|
+
import { getTopLevelBoundingClientRect } from "../../util/getTopLevelBoundingClientRect";
|
|
7
|
+
import { isTouchDevice } from "../../util/isTouchDevice";
|
|
8
|
+
import { Overlay } from "./Overlay";
|
|
9
9
|
|
|
10
10
|
/*
|
|
11
11
|
Dropdown specific features:
|
|
@@ -568,6 +568,15 @@ export class Dropdown extends Overlay {
|
|
|
568
568
|
}
|
|
569
569
|
return [beacon, instance.relatedElement && super.render(context, instance, key)];
|
|
570
570
|
}
|
|
571
|
+
|
|
572
|
+
getOverlayContainer() {
|
|
573
|
+
// this should be instance.relatedElement
|
|
574
|
+
if (this.relatedElement) {
|
|
575
|
+
let container = closestParent(this.relatedElement, (el) => el.dataset && el.dataset.focusableOverlayContainer);
|
|
576
|
+
if (container) return container;
|
|
577
|
+
}
|
|
578
|
+
return super.getOverlayContainer();
|
|
579
|
+
}
|
|
571
580
|
}
|
|
572
581
|
|
|
573
582
|
Dropdown.prototype.offset = 0;
|
|
@@ -143,9 +143,14 @@ export class Overlay extends Container {
|
|
|
143
143
|
if (this.onMouseEnter) instance.invoke("onMouseEnter", instance, component);
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
getOverlayContainer() {
|
|
147
|
+
return document.body;
|
|
148
|
+
}
|
|
149
|
+
|
|
146
150
|
containerFactory() {
|
|
147
151
|
let el = document.createElement("div");
|
|
148
|
-
|
|
152
|
+
let container = this.getOverlayContainer();
|
|
153
|
+
container.appendChild(el);
|
|
149
154
|
el.style.position = "absolute";
|
|
150
155
|
if (this.containerStyle) Object.assign(el.style, parseStyle(this.containerStyle));
|
|
151
156
|
return el;
|
|
@@ -255,6 +260,7 @@ class OverlayContent extends VDOM.Component {
|
|
|
255
260
|
onMouseEnter={this.props.onMouseEnter}
|
|
256
261
|
onMouseLeave={this.props.onMouseLeave}
|
|
257
262
|
onClick={this.props.onClick}
|
|
263
|
+
data-focusable-overlay-container={this.props.focusableOverlayContainer}
|
|
258
264
|
>
|
|
259
265
|
{this.props.children}
|
|
260
266
|
</div>
|
|
@@ -320,15 +326,8 @@ export class OverlayComponent extends VDOM.Component {
|
|
|
320
326
|
onMouseEnter={this.onMouseEnter.bind(this)}
|
|
321
327
|
onClick={this.onClick.bind(this)}
|
|
322
328
|
onDidUpdate={this.overlayDidUpdate.bind(this)}
|
|
329
|
+
focusableOverlayContainer={widget.dismissOnFocusOut}
|
|
323
330
|
>
|
|
324
|
-
{widget.modal ||
|
|
325
|
-
(widget.backdrop && (
|
|
326
|
-
<div
|
|
327
|
-
key="backdrop"
|
|
328
|
-
className={CSS.element(baseClass, "modal-backdrop")}
|
|
329
|
-
onClick={this.onBackdropClick.bind(this)}
|
|
330
|
-
/>
|
|
331
|
-
))}
|
|
332
331
|
{this.renderOverlayBody()}
|
|
333
332
|
</OverlayContent>
|
|
334
333
|
);
|
|
@@ -349,6 +348,13 @@ export class OverlayComponent extends VDOM.Component {
|
|
|
349
348
|
})}
|
|
350
349
|
style={parseStyle(data.shadowStyle)}
|
|
351
350
|
>
|
|
351
|
+
{widget.backdrop && (
|
|
352
|
+
<div
|
|
353
|
+
key="backdrop"
|
|
354
|
+
className={CSS.element("overlay", "modal-backdrop")}
|
|
355
|
+
onClick={this.onBackdropClick.bind(this)}
|
|
356
|
+
/>
|
|
357
|
+
)}
|
|
352
358
|
{content}
|
|
353
359
|
</div>
|
|
354
360
|
);
|
|
@@ -419,7 +425,11 @@ export class OverlayComponent extends VDOM.Component {
|
|
|
419
425
|
}
|
|
420
426
|
|
|
421
427
|
onMouseDown(e) {
|
|
422
|
-
let {
|
|
428
|
+
let { instance } = this.props;
|
|
429
|
+
let { widget, data } = instance;
|
|
430
|
+
|
|
431
|
+
if (widget.onMouseDown && instance.invoke("onMouseDown", e, instance) === false) return;
|
|
432
|
+
|
|
423
433
|
let prefix = this.getResizePrefix(e);
|
|
424
434
|
if (prefix) {
|
|
425
435
|
//e.preventDefault();
|
|
@@ -437,7 +447,7 @@ export class OverlayComponent extends VDOM.Component {
|
|
|
437
447
|
} else if (data.draggable) {
|
|
438
448
|
ddMouseDown(e);
|
|
439
449
|
}
|
|
440
|
-
e.stopPropagation();
|
|
450
|
+
//e.stopPropagation();
|
|
441
451
|
}
|
|
442
452
|
|
|
443
453
|
onBackdropClick(e) {
|