@nascentdigital/funnel-ui 4.5.2 → 4.5.4
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/Tailwind.d.ts +1 -1
- package/dist/Tailwind.js +70 -24
- package/dist/client/hooks/breakpoint/BreakpointContainer.d.ts +1 -1
- package/dist/client/hooks/breakpoint/BreakpointContainer.js +3 -1
- package/dist/client/interaction/Carousel.d.ts +1 -1
- package/dist/client/interaction/Carousel.js +28 -30
- package/dist/client/interaction/index.d.ts +0 -6
- package/dist/client/interaction/index.js +0 -6
- package/dist/server/Page.d.ts +15 -0
- package/dist/server/Page.js +70 -0
- package/dist/server/blocks/Block.d.ts +4 -2
- package/dist/server/blocks/Block.js +10 -3
- package/dist/server/blocks/Editorial.d.ts +2 -2
- package/dist/server/blocks/Editorial.js +4 -4
- package/dist/server/blocks/Form.d.ts +2 -2
- package/dist/server/blocks/Form.js +3 -3
- package/dist/server/blocks/Message.js +2 -1
- package/dist/server/blocks/Projects.d.ts +29 -37
- package/dist/server/blocks/Projects.js +13 -84
- package/dist/server/blocks/RelatedPages.d.ts +58 -0
- package/dist/server/blocks/RelatedPages.js +99 -0
- package/dist/server/blocks/Stats.d.ts +19 -31
- package/dist/server/blocks/Stats.js +13 -57
- package/dist/server/blocks/Testimonial.d.ts +2 -2
- package/dist/server/blocks/Testimonial.js +17 -14
- package/dist/server/blocks/Testimonials.d.ts +35 -35
- package/dist/server/blocks/Testimonials.js +21 -66
- package/dist/server/blocks/index.d.ts +2 -0
- package/dist/server/blocks/index.js +2 -0
- package/dist/server/entities/previews/MessagePreview.d.ts +2 -2
- package/dist/server/entities/previews/MessagePreview.js +1 -1
- package/dist/server/fields/CallToActions.d.ts +12 -0
- package/dist/server/fields/CallToActions.js +27 -0
- package/dist/server/fields/Caption.js +3 -2
- package/dist/server/fields/Description.js +1 -1
- package/dist/server/fields/FreeFormContent.js +1 -1
- package/dist/server/fields/Headline.js +1 -1
- package/dist/server/fields/Quote.js +1 -1
- package/dist/server/fields/RichText.js +1 -0
- package/dist/server/fields/index.d.ts +1 -0
- package/dist/server/fields/index.js +1 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +2 -0
- package/dist/server/layouts/BentoLayout.d.ts +289 -0
- package/dist/server/layouts/BentoLayout.js +25 -0
- package/dist/server/layouts/index.d.ts +1 -0
- package/dist/server/layouts/index.js +1 -0
- package/dist/server/panels/BlockPanel.js +1 -3
- package/dist/server/panels/ListPanel.d.ts +4 -4
- package/dist/server/panels/ListPanel.js +13 -2
- package/dist/server/panels/MessagePanel.d.ts +2 -6
- package/dist/server/panels/MessagePanel.js +2 -12
- package/dist/server/panels/TestimonialPanel.d.ts +44 -18
- package/dist/server/panels/TestimonialPanel.js +44 -19
- package/dist/server/panels/VisualPanel.d.ts +1 -1
- package/dist/server/panels/VisualPanel.js +0 -2
- package/dist/server/schema/Anchor.d.ts +1 -1
- package/dist/server/schema/Anchor.js +2 -2
- package/dist/server/schema/BlockConfig.js +1 -1
- package/dist/server/schema/ListPanelLayout.d.ts +6 -0
- package/dist/server/schema/ListPanelLayout.js +3 -0
- package/dist/server/utils/ReactUtils.d.ts +6 -0
- package/dist/server/utils/ReactUtils.js +25 -0
- package/dist/server/utils/index.d.ts +1 -0
- package/dist/{client/interaction/modal → server/utils}/index.js +1 -2
- package/dist/styles/Page.css +5 -0
- package/dist/styles/Section.css +52 -0
- package/dist/styles/blocks/Block-spacing.css +31 -38
- package/dist/styles/blocks/Block-theming.css +2 -4
- package/dist/styles/blocks/MediaLayout.css +16 -0
- package/dist/styles/blocks/Projects.css +0 -9
- package/dist/styles/blocks/RelatedPages.css +13 -0
- package/dist/styles/blocks/Stats.css +1 -30
- package/dist/styles/components/Carousel.css +128 -0
- package/dist/styles/components/_index.css +2 -1
- package/dist/styles/entities/Person.css +4 -4
- package/dist/styles/entities/Project.css +8 -2
- package/dist/styles/entities/UniqueSellingPoint.css +3 -3
- package/dist/styles/fields/Caption.css +2 -2
- package/dist/styles/fields/Description.css +2 -2
- package/dist/styles/fields/Icon.css +1 -1
- package/dist/styles/fields/Link.css +1 -1
- package/dist/styles/fields/Quote.css +2 -2
- package/dist/styles/fields/Title.css +1 -1
- package/dist/styles/index.css +2 -0
- package/dist/styles/layouts/BentoLayout.css +41 -0
- package/dist/styles/layouts/_index.css +1 -0
- package/dist/styles/panels/TestimonialPanel.css +4 -0
- package/package.json +2 -3
- package/dist/client/interaction/Popup.d.ts +0 -36
- package/dist/client/interaction/Popup.js +0 -244
- package/dist/client/interaction/Tooltip.d.ts +0 -16
- package/dist/client/interaction/Tooltip.js +0 -122
- package/dist/client/interaction/UILevel.d.ts +0 -1
- package/dist/client/interaction/UILevel.js +0 -2
- package/dist/client/interaction/backdrop/BackdropContainer.d.ts +0 -5
- package/dist/client/interaction/backdrop/BackdropContainer.js +0 -114
- package/dist/client/interaction/backdrop/BackdropContext.d.ts +0 -8
- package/dist/client/interaction/backdrop/BackdropContext.js +0 -6
- package/dist/client/interaction/backdrop/BackdropEvent.d.ts +0 -64
- package/dist/client/interaction/backdrop/BackdropEvent.js +0 -92
- package/dist/client/interaction/backdrop/index.d.ts +0 -4
- package/dist/client/interaction/backdrop/index.js +0 -20
- package/dist/client/interaction/backdrop/useBackdrop.d.ts +0 -13
- package/dist/client/interaction/backdrop/useBackdrop.js +0 -58
- package/dist/client/interaction/backdrop/useBackdropClick.d.ts +0 -2
- package/dist/client/interaction/backdrop/useBackdropClick.js +0 -21
- package/dist/client/interaction/backdrop/useBackdropVisible.d.ts +0 -1
- package/dist/client/interaction/backdrop/useBackdropVisible.js +0 -30
- package/dist/client/interaction/focus/FocusArea.d.ts +0 -10
- package/dist/client/interaction/focus/FocusArea.js +0 -38
- package/dist/client/interaction/focus/FocusContext.d.ts +0 -7
- package/dist/client/interaction/focus/FocusContext.js +0 -7
- package/dist/client/interaction/focus/FocusController.d.ts +0 -9
- package/dist/client/interaction/focus/FocusController.js +0 -40
- package/dist/client/interaction/focus/FocusService.d.ts +0 -20
- package/dist/client/interaction/focus/FocusService.js +0 -204
- package/dist/client/interaction/focus/LinkedList.d.ts +0 -18
- package/dist/client/interaction/focus/LinkedList.js +0 -122
- package/dist/client/interaction/focus/index.d.ts +0 -2
- package/dist/client/interaction/focus/index.js +0 -18
- package/dist/client/interaction/focus/useFocusService.d.ts +0 -2
- package/dist/client/interaction/focus/useFocusService.js +0 -14
- package/dist/client/interaction/modal/Modal.d.ts +0 -29
- package/dist/client/interaction/modal/Modal.js +0 -136
- package/dist/client/interaction/modal/ModalContainer.d.ts +0 -5
- package/dist/client/interaction/modal/ModalContainer.js +0 -104
- package/dist/client/interaction/modal/ModalContext.d.ts +0 -8
- package/dist/client/interaction/modal/ModalContext.js +0 -6
- package/dist/client/interaction/modal/ModalEvent.d.ts +0 -39
- package/dist/client/interaction/modal/ModalEvent.js +0 -53
- package/dist/client/interaction/modal/index.d.ts +0 -2
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes } from 'react';
|
|
2
|
-
import { HTMLElements } from '../../../types';
|
|
3
|
-
export declare function FocusController<T extends FocusController.Tag>({ children, as, ...props }: FocusController.Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export declare namespace FocusController {
|
|
5
|
-
type Props<T extends Tag> = Omit<HTMLAttributes<HTMLElements.Standard[T]>, 'tabIndex'> & {
|
|
6
|
-
as: T;
|
|
7
|
-
};
|
|
8
|
-
type Tag = HTMLElements.Standard.Container;
|
|
9
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.FocusController = FocusController;
|
|
15
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
-
const react_1 = require("react");
|
|
17
|
-
const hooks_1 = require("../../hooks");
|
|
18
|
-
const FocusContext_1 = require("./FocusContext");
|
|
19
|
-
const FocusService_1 = require("./FocusService");
|
|
20
|
-
function FocusController(_a) {
|
|
21
|
-
var { children, as } = _a, props = __rest(_a, ["children", "as"]);
|
|
22
|
-
// bind state/hooks
|
|
23
|
-
const [ref, rootElement] = (0, hooks_1.useRefElement)();
|
|
24
|
-
const [lastGuardRef, lastGuardElement] = (0, hooks_1.useRefElement)();
|
|
25
|
-
const focusService = (0, react_1.useMemo)(() => new FocusService_1.FocusService(), []);
|
|
26
|
-
const context = (0, react_1.useMemo)(() => ({ focusService }), [focusService]);
|
|
27
|
-
// bind service
|
|
28
|
-
(0, react_1.useEffect)(() => {
|
|
29
|
-
// ignore until element is ready
|
|
30
|
-
if (!rootElement || !lastGuardElement) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
// initialize new service
|
|
34
|
-
focusService.initialize(rootElement, lastGuardElement);
|
|
35
|
-
// unregister in unmount
|
|
36
|
-
return () => focusService.finalize();
|
|
37
|
-
}, [focusService, rootElement, lastGuardElement]);
|
|
38
|
-
// render
|
|
39
|
-
return ((0, jsx_runtime_1.jsx)(FocusContext_1.FocusContext.Provider, { value: context, children: (0, react_1.createElement)(as, Object.assign({ ref, tabIndex: '0' }, props), (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [children, (0, jsx_runtime_1.jsx)("div", { ref: lastGuardRef, className: "outline-none", "aria-hidden": true, tabIndex: 0 })] })) }));
|
|
40
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare class FocusService {
|
|
2
|
-
private _rootElement?;
|
|
3
|
-
private _lastGuardElement?;
|
|
4
|
-
private readonly _areaNodes;
|
|
5
|
-
private _focusedAreaNode?;
|
|
6
|
-
constructor();
|
|
7
|
-
initialize(root: HTMLElement, lastGuard: HTMLElement): void;
|
|
8
|
-
finalize(): void;
|
|
9
|
-
bindArea(area: HTMLElement, { order }?: FocusService.AreaOptions): void;
|
|
10
|
-
unbindArea(area: HTMLElement): void;
|
|
11
|
-
private onRootFocus;
|
|
12
|
-
private onAreaFocus;
|
|
13
|
-
private onLastGuardFocus;
|
|
14
|
-
private focusOutside;
|
|
15
|
-
}
|
|
16
|
-
export declare namespace FocusService {
|
|
17
|
-
type AreaOptions = {
|
|
18
|
-
order?: number;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FocusService = void 0;
|
|
4
|
-
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
5
|
-
const LinkedList_1 = require("./LinkedList");
|
|
6
|
-
class FocusService {
|
|
7
|
-
constructor() {
|
|
8
|
-
// instance variables
|
|
9
|
-
this._areaNodes = new LinkedList_1.SortedLinkedList();
|
|
10
|
-
// bind methods
|
|
11
|
-
this.onAreaFocus = this.onAreaFocus.bind(this);
|
|
12
|
-
this.onRootFocus = this.onRootFocus.bind(this);
|
|
13
|
-
this.onLastGuardFocus = this.onLastGuardFocus.bind(this);
|
|
14
|
-
}
|
|
15
|
-
initialize(root, lastGuard) {
|
|
16
|
-
// capture root and last guard
|
|
17
|
-
this._rootElement = root;
|
|
18
|
-
this._lastGuardElement = lastGuard;
|
|
19
|
-
// bind listeners
|
|
20
|
-
this._rootElement.addEventListener('focusin', this.onRootFocus);
|
|
21
|
-
this._lastGuardElement.addEventListener('focusin', this.onLastGuardFocus);
|
|
22
|
-
}
|
|
23
|
-
finalize() {
|
|
24
|
-
var _a, _b;
|
|
25
|
-
// clear listeners
|
|
26
|
-
(_a = this._rootElement) === null || _a === void 0 ? void 0 : _a.removeEventListener('focusin', this.onRootFocus);
|
|
27
|
-
(_b = this._lastGuardElement) === null || _b === void 0 ? void 0 : _b.removeEventListener('focusin', this.onLastGuardFocus);
|
|
28
|
-
// remove root
|
|
29
|
-
delete this._rootElement;
|
|
30
|
-
delete this._lastGuardElement;
|
|
31
|
-
}
|
|
32
|
-
bindArea(area, { order = 0 } = {}) {
|
|
33
|
-
// ensure area isn't already bound
|
|
34
|
-
let pointer = this._areaNodes.head;
|
|
35
|
-
while (pointer) {
|
|
36
|
-
if (pointer.area === area) {
|
|
37
|
-
console.warn('[FocusService.ts]: area is already bound');
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
pointer = pointer.next;
|
|
41
|
-
}
|
|
42
|
-
// update the node links
|
|
43
|
-
this._areaNodes.insert(new AreaNode(area, order));
|
|
44
|
-
// initialize area
|
|
45
|
-
area.addEventListener('focusin', this.onAreaFocus);
|
|
46
|
-
area.tabIndex = 0;
|
|
47
|
-
}
|
|
48
|
-
unbindArea(area) {
|
|
49
|
-
// find element (or skip)
|
|
50
|
-
const { _areaNodes } = this;
|
|
51
|
-
const node = _areaNodes.find(node => node.area === area);
|
|
52
|
-
if (!node) {
|
|
53
|
-
console.warn('[FocusService]: area not found to unbind');
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
// unregister listeners
|
|
57
|
-
area.removeEventListener('focusin', this.onAreaFocus);
|
|
58
|
-
// remove the element from list
|
|
59
|
-
_areaNodes.remove(node);
|
|
60
|
-
}
|
|
61
|
-
onRootFocus(e) {
|
|
62
|
-
var _a;
|
|
63
|
-
// skip events bubbled up from the children
|
|
64
|
-
if (e.target !== e.currentTarget) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
// skip if not focused through keyboard
|
|
68
|
-
// TODO: handle mouse click focus
|
|
69
|
-
const element = e.target;
|
|
70
|
-
if (!element.matches(':focus-visible')) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
// focus the first tab-able element
|
|
74
|
-
const focusedArea = (_a = this._areaNodes.head) === null || _a === void 0 ? void 0 : _a.focusNext(true);
|
|
75
|
-
if (focusedArea) {
|
|
76
|
-
this._focusedAreaNode = focusedArea;
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
// else, focus outside the container
|
|
80
|
-
this.focusOutside('forward');
|
|
81
|
-
}
|
|
82
|
-
onAreaFocus(e) {
|
|
83
|
-
var _a, _b, _c;
|
|
84
|
-
// skip events bubbled up from the children
|
|
85
|
-
if (e.target !== e.currentTarget) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
// skip if not focused through keyboard
|
|
89
|
-
// TODO: handle mouse click focus
|
|
90
|
-
const element = e.target;
|
|
91
|
-
if (!element.matches(':focus-visible')) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
// determine tab direction
|
|
95
|
-
// if focused on the same area as current focused area node, it means moving backward
|
|
96
|
-
// otherwise, moving forward
|
|
97
|
-
const tabDirection = ((_a = this._focusedAreaNode) === null || _a === void 0 ? void 0 : _a.area) === e.target ? 'backward' : 'forward';
|
|
98
|
-
const focusedArea = tabDirection === 'forward' ?
|
|
99
|
-
(_b = this._focusedAreaNode) === null || _b === void 0 ? void 0 : _b.focusNext() :
|
|
100
|
-
(_c = this._focusedAreaNode) === null || _c === void 0 ? void 0 : _c.focusPrevious();
|
|
101
|
-
if (focusedArea) {
|
|
102
|
-
this._focusedAreaNode = focusedArea;
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
this.focusOutside(tabDirection);
|
|
106
|
-
}
|
|
107
|
-
onLastGuardFocus(e) {
|
|
108
|
-
var _a;
|
|
109
|
-
// skip events bubbled up from the children
|
|
110
|
-
if (e.target !== e.currentTarget) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
// if there is no focused area context, it means focus is moving backwards
|
|
114
|
-
// therefore, focus the first tab-able element from the back
|
|
115
|
-
if (!this._focusedAreaNode) {
|
|
116
|
-
const focusedAreaContext = (_a = this._areaNodes.tail) === null || _a === void 0 ? void 0 : _a.focusPrevious(true);
|
|
117
|
-
// set focusedAreaContext if found
|
|
118
|
-
if (focusedAreaContext) {
|
|
119
|
-
this._focusedAreaNode = focusedAreaContext;
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
// otherwise, focusOutside
|
|
123
|
-
this.focusOutside('backward');
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
const focusedArea = this._focusedAreaNode.focusNext();
|
|
127
|
-
if (focusedArea) {
|
|
128
|
-
this._focusedAreaNode = focusedArea;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
focusOutside(tabDirection) {
|
|
132
|
-
// get all focusable elements
|
|
133
|
-
const focusableElements = Array.from(document.querySelectorAll(tabbableQuerySelector));
|
|
134
|
-
// if forward, focus the element after the last guard element
|
|
135
|
-
if (tabDirection === 'forward') {
|
|
136
|
-
const lastGuardElementIndex = focusableElements.findIndex(focusableElement => focusableElement === this._lastGuardElement);
|
|
137
|
-
const newElementIndex = lastGuardElementIndex + 1;
|
|
138
|
-
// focus if within boundary
|
|
139
|
-
if (lastGuardElementIndex > 0 && lastGuardElementIndex < focusableElements.length) {
|
|
140
|
-
focusableElements[newElementIndex].focus();
|
|
141
|
-
}
|
|
142
|
-
this._focusedAreaNode = undefined;
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
// otherwise, focus on the element before the root element
|
|
146
|
-
const rootElementIndex = focusableElements.findIndex(focusableElement => focusableElement === this._rootElement);
|
|
147
|
-
const newElementIndex = rootElementIndex - 1;
|
|
148
|
-
// focus if within boundary
|
|
149
|
-
if (newElementIndex >= 0 && newElementIndex < focusableElements.length) {
|
|
150
|
-
focusableElements[newElementIndex].focus();
|
|
151
|
-
}
|
|
152
|
-
this._focusedAreaNode = undefined;
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
exports.FocusService = FocusService;
|
|
157
|
-
const tabbableQuerySelector = funnel_core_1.Browser.Element.tabbable.join(',');
|
|
158
|
-
// create AreaNode
|
|
159
|
-
class AreaNode {
|
|
160
|
-
constructor(area, ordinal) {
|
|
161
|
-
this.area = area;
|
|
162
|
-
this.ordinal = ordinal;
|
|
163
|
-
}
|
|
164
|
-
focusNext(inclusive = false) {
|
|
165
|
-
// pointer
|
|
166
|
-
let current = inclusive ? this : this.next;
|
|
167
|
-
// traverse the list forward
|
|
168
|
-
while (current) {
|
|
169
|
-
const focusAbleElement = current.area.querySelector(tabbableQuerySelector);
|
|
170
|
-
// if focus-able element found, focus and return the area node
|
|
171
|
-
if (focusAbleElement) {
|
|
172
|
-
focusAbleElement.focus();
|
|
173
|
-
return current;
|
|
174
|
-
}
|
|
175
|
-
// otherwise, keep traversing
|
|
176
|
-
current = current.next;
|
|
177
|
-
}
|
|
178
|
-
return undefined;
|
|
179
|
-
}
|
|
180
|
-
focusPrevious(inclusive = false) {
|
|
181
|
-
// pointer
|
|
182
|
-
let current = inclusive ? this : this.prev;
|
|
183
|
-
// traverse the list backward
|
|
184
|
-
while (current) {
|
|
185
|
-
const focusAbleElements = Array.from(current.area.querySelectorAll(tabbableQuerySelector));
|
|
186
|
-
const focusAbleElement = focusAbleElements.pop();
|
|
187
|
-
// if focus-able element found, focus and return the area node
|
|
188
|
-
if (focusAbleElement) {
|
|
189
|
-
focusAbleElement.focus();
|
|
190
|
-
return current;
|
|
191
|
-
}
|
|
192
|
-
// otherwise, keep traversing
|
|
193
|
-
current = current.prev;
|
|
194
|
-
}
|
|
195
|
-
return undefined;
|
|
196
|
-
}
|
|
197
|
-
compareTo(that) {
|
|
198
|
-
return this.ordinal === that.ordinal
|
|
199
|
-
? 0
|
|
200
|
-
: this.ordinal < that.ordinal
|
|
201
|
-
? -1
|
|
202
|
-
: 1;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Transform } from '@nascentdigital/funnel-core';
|
|
2
|
-
export declare class SortedLinkedList<T extends SortedLinkedList.Node<T>> {
|
|
3
|
-
constructor(list?: SortedLinkedList<T>);
|
|
4
|
-
private _head?;
|
|
5
|
-
get head(): T | undefined;
|
|
6
|
-
private _tail?;
|
|
7
|
-
get tail(): T | undefined;
|
|
8
|
-
find(matches: Transform<T, boolean>): T | undefined;
|
|
9
|
-
insert(node: T): void;
|
|
10
|
-
remove(node: T): void;
|
|
11
|
-
}
|
|
12
|
-
export declare namespace SortedLinkedList {
|
|
13
|
-
interface Node<T> {
|
|
14
|
-
prev?: Node<T>;
|
|
15
|
-
next?: Node<T>;
|
|
16
|
-
compareTo(that: Node<T>): number;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SortedLinkedList = void 0;
|
|
4
|
-
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
5
|
-
// class
|
|
6
|
-
class SortedLinkedList {
|
|
7
|
-
constructor(list) {
|
|
8
|
-
// initialize instance variables
|
|
9
|
-
this._head = list === null || list === void 0 ? void 0 : list._head;
|
|
10
|
-
this._tail = list === null || list === void 0 ? void 0 : list._tail;
|
|
11
|
-
}
|
|
12
|
-
get head() {
|
|
13
|
-
return this._head;
|
|
14
|
-
}
|
|
15
|
-
get tail() {
|
|
16
|
-
return this._tail;
|
|
17
|
-
}
|
|
18
|
-
find(matches) {
|
|
19
|
-
// find the closest match
|
|
20
|
-
let node = this._head;
|
|
21
|
-
while (node && !matches(node)) {
|
|
22
|
-
node = node.next;
|
|
23
|
-
}
|
|
24
|
-
// return result
|
|
25
|
-
return node;
|
|
26
|
-
}
|
|
27
|
-
insert(node) {
|
|
28
|
-
// blow up if node is already connected
|
|
29
|
-
if (node.prev || node.next) {
|
|
30
|
-
throw new funnel_core_1.InvalidOperationError('Cannot connect node that is already bound to a list - call remove() first');
|
|
31
|
-
}
|
|
32
|
-
// find insertion target (node that comes AFTER the new node)
|
|
33
|
-
const { _head, _tail } = this;
|
|
34
|
-
let target = _head;
|
|
35
|
-
while (target && node.compareTo(target) > 0) {
|
|
36
|
-
target = target.next;
|
|
37
|
-
}
|
|
38
|
-
// handle case if we're at an extremity
|
|
39
|
-
if (!target) {
|
|
40
|
-
// make root if there's no head
|
|
41
|
-
if (!_head) {
|
|
42
|
-
this._head = node;
|
|
43
|
-
this._tail = node;
|
|
44
|
-
}
|
|
45
|
-
// or make the new tail
|
|
46
|
-
else if (_tail) {
|
|
47
|
-
_tail.next = node;
|
|
48
|
-
node.prev = _tail;
|
|
49
|
-
this._tail = node;
|
|
50
|
-
}
|
|
51
|
-
// or fail if the list is broken
|
|
52
|
-
else {
|
|
53
|
-
throw new funnel_core_1.IllegalStateError('[LinkedList.ts] list is broken');
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
// add before the first node if this is the new root
|
|
57
|
-
else if (!target.prev) {
|
|
58
|
-
target.prev = node;
|
|
59
|
-
node.next = target;
|
|
60
|
-
this._head = node;
|
|
61
|
-
}
|
|
62
|
-
// or add in between the list
|
|
63
|
-
else {
|
|
64
|
-
target.prev.next = node;
|
|
65
|
-
node.prev = target.prev;
|
|
66
|
-
target.prev = node;
|
|
67
|
-
node.next = target;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
remove(node) {
|
|
71
|
-
var _a, _b;
|
|
72
|
-
const { _head, _tail } = this;
|
|
73
|
-
// blow up if the list is empty
|
|
74
|
-
if (!_head || !_tail) {
|
|
75
|
-
throw new funnel_core_1.InvalidOperationError('Cannot delete node from an empty list - call insert() first');
|
|
76
|
-
}
|
|
77
|
-
// handle if there is only one item in the list
|
|
78
|
-
if (_head === _tail) {
|
|
79
|
-
if (node === _head) {
|
|
80
|
-
delete this._head;
|
|
81
|
-
delete this._tail;
|
|
82
|
-
}
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
// find deletion target
|
|
86
|
-
let target = this._head;
|
|
87
|
-
// traverse the list
|
|
88
|
-
while (target) {
|
|
89
|
-
if (target === node) {
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
target = target.next;
|
|
93
|
-
}
|
|
94
|
-
if (!target) {
|
|
95
|
-
console.warn('[LinkedList]: Unable to find the node');
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
// handle case if we're at an extremity
|
|
99
|
-
if (target === _head) {
|
|
100
|
-
this._head = (_a = this.head) === null || _a === void 0 ? void 0 : _a.next;
|
|
101
|
-
// if head is a node set the previous to undefined
|
|
102
|
-
if (this._head) {
|
|
103
|
-
delete this._head.prev;
|
|
104
|
-
}
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
if (target === _tail) {
|
|
108
|
-
this._tail = (_b = this.tail) === null || _b === void 0 ? void 0 : _b.prev;
|
|
109
|
-
delete this._tail.next;
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
// or remove from in between the list
|
|
113
|
-
if (!target.prev || !target.next) {
|
|
114
|
-
throw new funnel_core_1.IllegalStateError('Node is not in between the list');
|
|
115
|
-
}
|
|
116
|
-
target.prev.next = target.next;
|
|
117
|
-
target.next.prev = target.prev;
|
|
118
|
-
delete target.next;
|
|
119
|
-
delete target.prev;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
exports.SortedLinkedList = SortedLinkedList;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./FocusController"), exports);
|
|
18
|
-
__exportStar(require("./FocusArea"), exports);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useFocusService = useFocusService;
|
|
4
|
-
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const FocusContext_1 = require("./FocusContext");
|
|
7
|
-
function useFocusService() {
|
|
8
|
-
const focusContext = (0, react_1.useContext)(FocusContext_1.FocusContext);
|
|
9
|
-
// throw if trying to access focus service outside the focus context
|
|
10
|
-
if (!focusContext.focusService) {
|
|
11
|
-
throw new funnel_core_1.IllegalStateError('[useFocusService] FocusService must be accessed within focus context');
|
|
12
|
-
}
|
|
13
|
-
return focusContext.focusService;
|
|
14
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Callback } from '@nascentdigital/funnel-core';
|
|
2
|
-
import { Variant } from 'framer-motion';
|
|
3
|
-
import { PropsWithChildren } from 'react';
|
|
4
|
-
import { BackdropEvent } from '../backdrop/BackdropEvent';
|
|
5
|
-
import { UILevel } from '../UILevel';
|
|
6
|
-
export declare function Modal({ className, level, animation, open, onOpened: onOpenedRaw, onActiveChanged: onActiveChangedRaw, onClose, onClosed: onClosedRaw, disableDismiss, children }: Modal.Props): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
-
export declare namespace Modal {
|
|
8
|
-
type Id = BackdropEvent.DependantId;
|
|
9
|
-
type Props = PropsWithChildren & {
|
|
10
|
-
className?: string;
|
|
11
|
-
level?: UILevel;
|
|
12
|
-
animation?: Animation;
|
|
13
|
-
open?: boolean;
|
|
14
|
-
onOpened?: Callback.Void;
|
|
15
|
-
onActiveChanged?: Callback<boolean>;
|
|
16
|
-
onClose?: Callback.Void;
|
|
17
|
-
onClosed?: Callback.Void;
|
|
18
|
-
disableDismiss?: boolean;
|
|
19
|
-
};
|
|
20
|
-
type Animation = {
|
|
21
|
-
initial: Variant;
|
|
22
|
-
open: Variant;
|
|
23
|
-
close: Variant;
|
|
24
|
-
};
|
|
25
|
-
namespace Animation {
|
|
26
|
-
type Variant = keyof Animation;
|
|
27
|
-
const slideUp: Animation;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Modal = Modal;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
9
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
10
|
-
const framer_motion_1 = require("framer-motion");
|
|
11
|
-
const react_1 = require("react");
|
|
12
|
-
const react_dom_1 = require("react-dom");
|
|
13
|
-
const rxjs_1 = require("rxjs");
|
|
14
|
-
const backdrop_1 = require("../backdrop");
|
|
15
|
-
const ClickObserver_1 = require("../ClickObserver");
|
|
16
|
-
const ModalContext_1 = require("./ModalContext");
|
|
17
|
-
const ModalEvent_1 = require("./ModalEvent");
|
|
18
|
-
// component
|
|
19
|
-
function Modal({ className, level = 'l1', animation = Modal.Animation.slideUp, open = false, onOpened: onOpenedRaw = funnel_core_1.Fn.NoOp, onActiveChanged: onActiveChangedRaw = funnel_core_1.Fn.NoOp, onClose = funnel_core_1.Fn.NoOp, onClosed: onClosedRaw = funnel_core_1.Fn.NoOp, disableDismiss = false, children }) {
|
|
20
|
-
// bind context
|
|
21
|
-
const [active, setActive] = (0, react_1.useState)(false);
|
|
22
|
-
const { eventBus } = (0, react_1.useContext)(ModalContext_1.ModalContext);
|
|
23
|
-
const backdrop = (0, backdrop_1.useBackdrop)();
|
|
24
|
-
const openRef = (0, react_1.useRef)(false);
|
|
25
|
-
const onOpenedRef = (0, react_1.useRef)(onOpenedRaw);
|
|
26
|
-
onOpenedRef.current = onOpenedRaw;
|
|
27
|
-
const onActiveChangedRef = (0, react_1.useRef)(onActiveChangedRaw);
|
|
28
|
-
onActiveChangedRef.current = onActiveChangedRaw;
|
|
29
|
-
const onClosedRef = (0, react_1.useRef)(onClosedRaw);
|
|
30
|
-
onClosedRef.current = onClosedRaw;
|
|
31
|
-
// show/hide based on open change
|
|
32
|
-
(0, react_1.useEffect)(() => {
|
|
33
|
-
// raise open event
|
|
34
|
-
const { id } = backdrop;
|
|
35
|
-
if (open) {
|
|
36
|
-
// update ref
|
|
37
|
-
openRef.current = true;
|
|
38
|
-
// raise event
|
|
39
|
-
eventBus.next(ModalEvent_1.ModalEvent.Open.create(id, disableDismiss));
|
|
40
|
-
// raise backdrop event
|
|
41
|
-
backdrop.show({ level });
|
|
42
|
-
// activate
|
|
43
|
-
setActive(true);
|
|
44
|
-
}
|
|
45
|
-
// raise or close event (if it was actually opened)
|
|
46
|
-
else if (openRef.current) {
|
|
47
|
-
// deactivate
|
|
48
|
-
setActive(false);
|
|
49
|
-
// update ref
|
|
50
|
-
openRef.current = false;
|
|
51
|
-
// raise event
|
|
52
|
-
eventBus.next({
|
|
53
|
-
id,
|
|
54
|
-
action: 'close'
|
|
55
|
-
});
|
|
56
|
-
// raise backdrop event
|
|
57
|
-
backdrop.hide();
|
|
58
|
-
}
|
|
59
|
-
}, [eventBus, backdrop, level, open, disableDismiss]);
|
|
60
|
-
// listen to activations or dismiss
|
|
61
|
-
(0, react_1.useEffect)(() => {
|
|
62
|
-
// listen for events
|
|
63
|
-
const subscription = eventBus
|
|
64
|
-
// filter only relevant events
|
|
65
|
-
.pipe((0, rxjs_1.filter)(({ id, action }) => id === backdrop.id
|
|
66
|
-
&& (action === 'activate' || action === 'deactivate' || action === 'dismiss')))
|
|
67
|
-
.subscribe(({ action }) => {
|
|
68
|
-
// close on dismiss
|
|
69
|
-
if (action === 'dismiss') {
|
|
70
|
-
onClose();
|
|
71
|
-
}
|
|
72
|
-
// or activate/deactivate
|
|
73
|
-
else {
|
|
74
|
-
setActive(action === 'activate');
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
// unsubscribe on unmount
|
|
78
|
-
return () => subscription.unsubscribe();
|
|
79
|
-
}, [eventBus, backdrop, onClose]);
|
|
80
|
-
// raise activated event
|
|
81
|
-
(0, react_1.useEffect)(() => {
|
|
82
|
-
onActiveChangedRef.current(active);
|
|
83
|
-
}, [active]);
|
|
84
|
-
// skip for SSR
|
|
85
|
-
if (!funnel_core_1.Browser.available) {
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
// helpers
|
|
89
|
-
const onAnimationComplete = (definition) => {
|
|
90
|
-
if (definition === 'open') {
|
|
91
|
-
onOpenedRef.current();
|
|
92
|
-
}
|
|
93
|
-
else if (definition === 'close') {
|
|
94
|
-
onClosedRef.current();
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
// render
|
|
98
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { mode: "wait", children: open &&
|
|
99
|
-
(0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { id: backdrop.id, className: (0, classnames_1.default)('Modal-wrap', {
|
|
100
|
-
'Modal-l1': level === 'l1',
|
|
101
|
-
'Modal-l2': level === 'l2',
|
|
102
|
-
'Modal-l3': level === 'l3',
|
|
103
|
-
}), variants: animation, initial: "initial", animate: "open", exit: "close", onAnimationComplete: definition => onAnimationComplete(definition), children: (0, jsx_runtime_1.jsx)(ClickObserver_1.ClickObserver, { disabled: disableDismiss, onClickOutside: onClose, children: (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(className, 'Modal-root'), children: children }) }) }, backdrop.id) }), document.body) }));
|
|
104
|
-
}
|
|
105
|
-
// extension
|
|
106
|
-
(function (Modal) {
|
|
107
|
-
let Animation;
|
|
108
|
-
(function (Animation) {
|
|
109
|
-
// slide up
|
|
110
|
-
Animation.slideUp = {
|
|
111
|
-
initial: {
|
|
112
|
-
opacity: 0,
|
|
113
|
-
y: 100
|
|
114
|
-
},
|
|
115
|
-
open: {
|
|
116
|
-
opacity: 1,
|
|
117
|
-
y: 0,
|
|
118
|
-
transition: {
|
|
119
|
-
ease: 'easeIn',
|
|
120
|
-
duration: 0.3,
|
|
121
|
-
when: 'beforeChildren'
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
close: {
|
|
125
|
-
opacity: 0,
|
|
126
|
-
y: 50,
|
|
127
|
-
transition: {
|
|
128
|
-
ease: 'easeOut',
|
|
129
|
-
duration: 0.15,
|
|
130
|
-
bounce: 0,
|
|
131
|
-
when: 'afterChildren'
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
})(Animation = Modal.Animation || (Modal.Animation = {}));
|
|
136
|
-
})(Modal || (exports.Modal = Modal = {}));
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
export declare function ModalContainer({ children }: ModalContainer.Props): string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
3
|
-
export declare namespace ModalContainer {
|
|
4
|
-
type Props = PropsWithChildren;
|
|
5
|
-
}
|