@moda/om 20.1.0 → 21.0.0-next.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/index.cjs.js +25 -316
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +24 -315
- package/dist/index.esm.js.map +1 -1
- package/dist/src/components/Clickable/Clickable.d.ts +7 -2
- package/dist/src/components/NavigationPreventer/NavigationPreventer.d.ts +1 -2
- package/dist/src/components/Select/Select.d.ts +1 -0
- package/dist/src/index.d.ts +0 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -5
- package/src/components/Button/Button.stories.tsx +5 -8
- package/src/components/Clickable/Clickable.stories.tsx +3 -6
- package/src/components/Clickable/Clickable.tsx +6 -3
- package/src/components/ControlLink/ControlLink.stories.tsx +6 -11
- package/src/components/NavigationPreventer/NavigationPreventer.tsx +5 -5
- package/src/components/Select/Select.scss +2 -2
- package/src/components/Select/Select.stories.tsx +17 -4
- package/src/components/Select/Select.tsx +8 -3
- package/src/components/Select/SelectOption.scss +13 -0
- package/src/components/Select/SelectOption.tsx +17 -6
- package/src/components/Select/SelectOptions.tsx +4 -3
- package/src/index.ts +0 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var
|
|
4
|
+
var Link = require('next/link');
|
|
5
5
|
var require$$1 = require('react-dom');
|
|
6
6
|
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
|
@@ -27,304 +27,6 @@ function getDefaultExportFromCjs (x) {
|
|
|
27
27
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
var focusVisible$1 = {exports: {}};
|
|
31
|
-
|
|
32
|
-
var focusVisible = focusVisible$1.exports;
|
|
33
|
-
var hasRequiredFocusVisible;
|
|
34
|
-
function requireFocusVisible() {
|
|
35
|
-
if (hasRequiredFocusVisible) return focusVisible$1.exports;
|
|
36
|
-
hasRequiredFocusVisible = 1;
|
|
37
|
-
(function (module, exports) {
|
|
38
|
-
(function (global, factory) {
|
|
39
|
-
factory() ;
|
|
40
|
-
})(focusVisible, function () {
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Applies the :focus-visible polyfill at the given scope.
|
|
44
|
-
* A scope in this case is either the top-level Document or a Shadow Root.
|
|
45
|
-
*
|
|
46
|
-
* @param {(Document|ShadowRoot)} scope
|
|
47
|
-
* @see https://github.com/WICG/focus-visible
|
|
48
|
-
*/
|
|
49
|
-
function applyFocusVisiblePolyfill(scope) {
|
|
50
|
-
var hadKeyboardEvent = true;
|
|
51
|
-
var hadFocusVisibleRecently = false;
|
|
52
|
-
var hadFocusVisibleRecentlyTimeout = null;
|
|
53
|
-
var inputTypesAllowlist = {
|
|
54
|
-
text: true,
|
|
55
|
-
search: true,
|
|
56
|
-
url: true,
|
|
57
|
-
tel: true,
|
|
58
|
-
email: true,
|
|
59
|
-
password: true,
|
|
60
|
-
number: true,
|
|
61
|
-
date: true,
|
|
62
|
-
month: true,
|
|
63
|
-
week: true,
|
|
64
|
-
time: true,
|
|
65
|
-
datetime: true,
|
|
66
|
-
'datetime-local': true
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Helper function for legacy browsers and iframes which sometimes focus
|
|
71
|
-
* elements like document, body, and non-interactive SVG.
|
|
72
|
-
* @param {Element} el
|
|
73
|
-
*/
|
|
74
|
-
function isValidFocusTarget(el) {
|
|
75
|
-
if (el && el !== document && el.nodeName !== 'HTML' && el.nodeName !== 'BODY' && 'classList' in el && 'contains' in el.classList) {
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Computes whether the given element should automatically trigger the
|
|
83
|
-
* `focus-visible` class being added, i.e. whether it should always match
|
|
84
|
-
* `:focus-visible` when focused.
|
|
85
|
-
* @param {Element} el
|
|
86
|
-
* @return {boolean}
|
|
87
|
-
*/
|
|
88
|
-
function focusTriggersKeyboardModality(el) {
|
|
89
|
-
var type = el.type;
|
|
90
|
-
var tagName = el.tagName;
|
|
91
|
-
if (tagName === 'INPUT' && inputTypesAllowlist[type] && !el.readOnly) {
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
if (tagName === 'TEXTAREA' && !el.readOnly) {
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
if (el.isContentEditable) {
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Add the `focus-visible` class to the given element if it was not added by
|
|
105
|
-
* the author.
|
|
106
|
-
* @param {Element} el
|
|
107
|
-
*/
|
|
108
|
-
function addFocusVisibleClass(el) {
|
|
109
|
-
if (el.classList.contains('focus-visible')) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
el.classList.add('focus-visible');
|
|
113
|
-
el.setAttribute('data-focus-visible-added', '');
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Remove the `focus-visible` class from the given element if it was not
|
|
118
|
-
* originally added by the author.
|
|
119
|
-
* @param {Element} el
|
|
120
|
-
*/
|
|
121
|
-
function removeFocusVisibleClass(el) {
|
|
122
|
-
if (!el.hasAttribute('data-focus-visible-added')) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
el.classList.remove('focus-visible');
|
|
126
|
-
el.removeAttribute('data-focus-visible-added');
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* If the most recent user interaction was via the keyboard;
|
|
131
|
-
* and the key press did not include a meta, alt/option, or control key;
|
|
132
|
-
* then the modality is keyboard. Otherwise, the modality is not keyboard.
|
|
133
|
-
* Apply `focus-visible` to any current active element and keep track
|
|
134
|
-
* of our keyboard modality state with `hadKeyboardEvent`.
|
|
135
|
-
* @param {KeyboardEvent} e
|
|
136
|
-
*/
|
|
137
|
-
function onKeyDown(e) {
|
|
138
|
-
if (e.metaKey || e.altKey || e.ctrlKey) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
if (isValidFocusTarget(scope.activeElement)) {
|
|
142
|
-
addFocusVisibleClass(scope.activeElement);
|
|
143
|
-
}
|
|
144
|
-
hadKeyboardEvent = true;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* If at any point a user clicks with a pointing device, ensure that we change
|
|
149
|
-
* the modality away from keyboard.
|
|
150
|
-
* This avoids the situation where a user presses a key on an already focused
|
|
151
|
-
* element, and then clicks on a different element, focusing it with a
|
|
152
|
-
* pointing device, while we still think we're in keyboard modality.
|
|
153
|
-
* @param {Event} e
|
|
154
|
-
*/
|
|
155
|
-
function onPointerDown(e) {
|
|
156
|
-
hadKeyboardEvent = false;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* On `focus`, add the `focus-visible` class to the target if:
|
|
161
|
-
* - the target received focus as a result of keyboard navigation, or
|
|
162
|
-
* - the event target is an element that will likely require interaction
|
|
163
|
-
* via the keyboard (e.g. a text box)
|
|
164
|
-
* @param {Event} e
|
|
165
|
-
*/
|
|
166
|
-
function onFocus(e) {
|
|
167
|
-
// Prevent IE from focusing the document or HTML element.
|
|
168
|
-
if (!isValidFocusTarget(e.target)) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
if (hadKeyboardEvent || focusTriggersKeyboardModality(e.target)) {
|
|
172
|
-
addFocusVisibleClass(e.target);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* On `blur`, remove the `focus-visible` class from the target.
|
|
178
|
-
* @param {Event} e
|
|
179
|
-
*/
|
|
180
|
-
function onBlur(e) {
|
|
181
|
-
if (!isValidFocusTarget(e.target)) {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
if (e.target.classList.contains('focus-visible') || e.target.hasAttribute('data-focus-visible-added')) {
|
|
185
|
-
// To detect a tab/window switch, we look for a blur event followed
|
|
186
|
-
// rapidly by a visibility change.
|
|
187
|
-
// If we don't see a visibility change within 100ms, it's probably a
|
|
188
|
-
// regular focus change.
|
|
189
|
-
hadFocusVisibleRecently = true;
|
|
190
|
-
window.clearTimeout(hadFocusVisibleRecentlyTimeout);
|
|
191
|
-
hadFocusVisibleRecentlyTimeout = window.setTimeout(function () {
|
|
192
|
-
hadFocusVisibleRecently = false;
|
|
193
|
-
}, 100);
|
|
194
|
-
removeFocusVisibleClass(e.target);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* If the user changes tabs, keep track of whether or not the previously
|
|
200
|
-
* focused element had .focus-visible.
|
|
201
|
-
* @param {Event} e
|
|
202
|
-
*/
|
|
203
|
-
function onVisibilityChange(e) {
|
|
204
|
-
if (document.visibilityState === 'hidden') {
|
|
205
|
-
// If the tab becomes active again, the browser will handle calling focus
|
|
206
|
-
// on the element (Safari actually calls it twice).
|
|
207
|
-
// If this tab change caused a blur on an element with focus-visible,
|
|
208
|
-
// re-apply the class when the user switches back to the tab.
|
|
209
|
-
if (hadFocusVisibleRecently) {
|
|
210
|
-
hadKeyboardEvent = true;
|
|
211
|
-
}
|
|
212
|
-
addInitialPointerMoveListeners();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Add a group of listeners to detect usage of any pointing devices.
|
|
218
|
-
* These listeners will be added when the polyfill first loads, and anytime
|
|
219
|
-
* the window is blurred, so that they are active when the window regains
|
|
220
|
-
* focus.
|
|
221
|
-
*/
|
|
222
|
-
function addInitialPointerMoveListeners() {
|
|
223
|
-
document.addEventListener('mousemove', onInitialPointerMove);
|
|
224
|
-
document.addEventListener('mousedown', onInitialPointerMove);
|
|
225
|
-
document.addEventListener('mouseup', onInitialPointerMove);
|
|
226
|
-
document.addEventListener('pointermove', onInitialPointerMove);
|
|
227
|
-
document.addEventListener('pointerdown', onInitialPointerMove);
|
|
228
|
-
document.addEventListener('pointerup', onInitialPointerMove);
|
|
229
|
-
document.addEventListener('touchmove', onInitialPointerMove);
|
|
230
|
-
document.addEventListener('touchstart', onInitialPointerMove);
|
|
231
|
-
document.addEventListener('touchend', onInitialPointerMove);
|
|
232
|
-
}
|
|
233
|
-
function removeInitialPointerMoveListeners() {
|
|
234
|
-
document.removeEventListener('mousemove', onInitialPointerMove);
|
|
235
|
-
document.removeEventListener('mousedown', onInitialPointerMove);
|
|
236
|
-
document.removeEventListener('mouseup', onInitialPointerMove);
|
|
237
|
-
document.removeEventListener('pointermove', onInitialPointerMove);
|
|
238
|
-
document.removeEventListener('pointerdown', onInitialPointerMove);
|
|
239
|
-
document.removeEventListener('pointerup', onInitialPointerMove);
|
|
240
|
-
document.removeEventListener('touchmove', onInitialPointerMove);
|
|
241
|
-
document.removeEventListener('touchstart', onInitialPointerMove);
|
|
242
|
-
document.removeEventListener('touchend', onInitialPointerMove);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* When the polfyill first loads, assume the user is in keyboard modality.
|
|
247
|
-
* If any event is received from a pointing device (e.g. mouse, pointer,
|
|
248
|
-
* touch), turn off keyboard modality.
|
|
249
|
-
* This accounts for situations where focus enters the page from the URL bar.
|
|
250
|
-
* @param {Event} e
|
|
251
|
-
*/
|
|
252
|
-
function onInitialPointerMove(e) {
|
|
253
|
-
// Work around a Safari quirk that fires a mousemove on <html> whenever the
|
|
254
|
-
// window blurs, even if you're tabbing out of the page. ¯\_(ツ)_/¯
|
|
255
|
-
if (e.target.nodeName && e.target.nodeName.toLowerCase() === 'html') {
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
hadKeyboardEvent = false;
|
|
259
|
-
removeInitialPointerMoveListeners();
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
// For some kinds of state, we are interested in changes at the global scope
|
|
263
|
-
// only. For example, global pointer input, global key presses and global
|
|
264
|
-
// visibility change should affect the state at every scope:
|
|
265
|
-
document.addEventListener('keydown', onKeyDown, true);
|
|
266
|
-
document.addEventListener('mousedown', onPointerDown, true);
|
|
267
|
-
document.addEventListener('pointerdown', onPointerDown, true);
|
|
268
|
-
document.addEventListener('touchstart', onPointerDown, true);
|
|
269
|
-
document.addEventListener('visibilitychange', onVisibilityChange, true);
|
|
270
|
-
addInitialPointerMoveListeners();
|
|
271
|
-
|
|
272
|
-
// For focus and blur, we specifically care about state changes in the local
|
|
273
|
-
// scope. This is because focus / blur events that originate from within a
|
|
274
|
-
// shadow root are not re-dispatched from the host element if it was already
|
|
275
|
-
// the active element in its own scope:
|
|
276
|
-
scope.addEventListener('focus', onFocus, true);
|
|
277
|
-
scope.addEventListener('blur', onBlur, true);
|
|
278
|
-
|
|
279
|
-
// We detect that a node is a ShadowRoot by ensuring that it is a
|
|
280
|
-
// DocumentFragment and also has a host property. This check covers native
|
|
281
|
-
// implementation and polyfill implementation transparently. If we only cared
|
|
282
|
-
// about the native implementation, we could just check if the scope was
|
|
283
|
-
// an instance of a ShadowRoot.
|
|
284
|
-
if (scope.nodeType === Node.DOCUMENT_FRAGMENT_NODE && scope.host) {
|
|
285
|
-
// Since a ShadowRoot is a special kind of DocumentFragment, it does not
|
|
286
|
-
// have a root element to add a class to. So, we add this attribute to the
|
|
287
|
-
// host element instead:
|
|
288
|
-
scope.host.setAttribute('data-js-focus-visible', '');
|
|
289
|
-
} else if (scope.nodeType === Node.DOCUMENT_NODE) {
|
|
290
|
-
document.documentElement.classList.add('js-focus-visible');
|
|
291
|
-
document.documentElement.setAttribute('data-js-focus-visible', '');
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// It is important to wrap all references to global window and document in
|
|
296
|
-
// these checks to support server-side rendering use cases
|
|
297
|
-
// @see https://github.com/WICG/focus-visible/issues/199
|
|
298
|
-
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
299
|
-
// Make the polyfill helper globally available. This can be used as a signal
|
|
300
|
-
// to interested libraries that wish to coordinate with the polyfill for e.g.,
|
|
301
|
-
// applying the polyfill to a shadow root:
|
|
302
|
-
window.applyFocusVisiblePolyfill = applyFocusVisiblePolyfill;
|
|
303
|
-
|
|
304
|
-
// Notify interested libraries of the polyfill's presence, in case the
|
|
305
|
-
// polyfill was loaded lazily:
|
|
306
|
-
var event;
|
|
307
|
-
try {
|
|
308
|
-
event = new CustomEvent('focus-visible-polyfill-ready');
|
|
309
|
-
} catch (error) {
|
|
310
|
-
// IE11 does not support using CustomEvent as a constructor directly:
|
|
311
|
-
event = document.createEvent('CustomEvent');
|
|
312
|
-
event.initCustomEvent('focus-visible-polyfill-ready', false, false, {});
|
|
313
|
-
}
|
|
314
|
-
window.dispatchEvent(event);
|
|
315
|
-
}
|
|
316
|
-
if (typeof document !== 'undefined') {
|
|
317
|
-
// Apply the polyfill to the global document, so that no JavaScript
|
|
318
|
-
// coordination is required to use the polyfill in the top-level document:
|
|
319
|
-
applyFocusVisiblePolyfill(document);
|
|
320
|
-
}
|
|
321
|
-
});
|
|
322
|
-
})();
|
|
323
|
-
return focusVisible$1.exports;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
requireFocusVisible();
|
|
327
|
-
|
|
328
30
|
var dist$4 = {};
|
|
329
31
|
|
|
330
32
|
var colors = {};
|
|
@@ -5558,7 +5260,8 @@ var Clickable = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
5558
5260
|
}, className),
|
|
5559
5261
|
disabled: disabled
|
|
5560
5262
|
});
|
|
5561
|
-
if (isLink(props)) return /*#__PURE__*/React.createElement(
|
|
5263
|
+
if (isLink(props)) return /*#__PURE__*/React.createElement(Link, _extends$1({}, props, {
|
|
5264
|
+
href: props.to,
|
|
5562
5265
|
ref: ref
|
|
5563
5266
|
}));
|
|
5564
5267
|
if (isAnchor(props)) return /*#__PURE__*/React.createElement("a", _extends$1({}, props, {
|
|
@@ -10594,14 +10297,18 @@ var SelectOption = function SelectOption(_ref) {
|
|
|
10594
10297
|
var active = _ref.active,
|
|
10595
10298
|
selected = _ref.selected,
|
|
10596
10299
|
option = _ref.option,
|
|
10300
|
+
_ref$option = _ref.option,
|
|
10301
|
+
disabled = _ref$option.disabled,
|
|
10302
|
+
colorSwatch = _ref$option.colorSwatch,
|
|
10303
|
+
label = _ref$option.label,
|
|
10597
10304
|
onClick = _ref.onClick,
|
|
10598
10305
|
className = _ref.className,
|
|
10599
10306
|
dataTestId = _ref.dataTestId;
|
|
10600
10307
|
var ref = React.useRef(null);
|
|
10601
10308
|
var handleClick = React.useCallback(function (event) {
|
|
10602
10309
|
event.preventDefault();
|
|
10603
|
-
if (!
|
|
10604
|
-
}, [onClick, option]);
|
|
10310
|
+
if (!disabled) onClick(option);
|
|
10311
|
+
}, [disabled, onClick, option]);
|
|
10605
10312
|
React.useEffect(function () {
|
|
10606
10313
|
if (active && ref.current) {
|
|
10607
10314
|
e(ref.current, {
|
|
@@ -10615,14 +10322,19 @@ var SelectOption = function SelectOption(_ref) {
|
|
|
10615
10322
|
className: classNames('SelectOption', className, {
|
|
10616
10323
|
'SelectOption--active': active,
|
|
10617
10324
|
'SelectOption--selected': selected,
|
|
10618
|
-
'SelectOption--disabled':
|
|
10325
|
+
'SelectOption--disabled': disabled
|
|
10619
10326
|
}),
|
|
10620
10327
|
onClick: handleClick,
|
|
10621
|
-
"data-test-id": dataTestId ? "".concat(dataTestId, "--").concat(
|
|
10622
|
-
"aria-label":
|
|
10328
|
+
"data-test-id": dataTestId ? "".concat(dataTestId, "--").concat(label.replace(' ', '-')) : undefined,
|
|
10329
|
+
"aria-label": label,
|
|
10623
10330
|
"aria-selected": selected,
|
|
10624
10331
|
role: "option"
|
|
10625
|
-
},
|
|
10332
|
+
}, colorSwatch && /*#__PURE__*/React.createElement("div", {
|
|
10333
|
+
className: "SelectOption__color-swatch",
|
|
10334
|
+
style: {
|
|
10335
|
+
backgroundColor: distExports$4.colors.all[colorSwatch]
|
|
10336
|
+
}
|
|
10337
|
+
}), label);
|
|
10626
10338
|
};
|
|
10627
10339
|
|
|
10628
10340
|
var _excluded$k = ["idRef", "searchable", "autoFocus", "options", "selectedOption", "onSelect", "onFocus", "className", "dataTestId"];
|
|
@@ -10695,7 +10407,7 @@ var SelectOptions = function SelectOptions(_ref) {
|
|
|
10695
10407
|
active: (activeOption === null || activeOption === void 0 ? void 0 : activeOption.value) === option.value,
|
|
10696
10408
|
selected: (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value,
|
|
10697
10409
|
onClick: onSelect
|
|
10698
|
-
}
|
|
10410
|
+
});
|
|
10699
10411
|
})), options.length === 0 && /*#__PURE__*/React.createElement(Text, {
|
|
10700
10412
|
className: "SelectOptions__none",
|
|
10701
10413
|
color: "cement"
|
|
@@ -10907,12 +10619,12 @@ var Select = function Select(_ref) {
|
|
|
10907
10619
|
idRef: idRef,
|
|
10908
10620
|
label: label || (selected === undefined ? placeholder : undefined),
|
|
10909
10621
|
hasValue: focused != null || selected != null
|
|
10910
|
-
}),
|
|
10622
|
+
}), colorSwatch && /*#__PURE__*/React.createElement("div", {
|
|
10911
10623
|
className: "Select__selected-color",
|
|
10912
10624
|
style: {
|
|
10913
10625
|
backgroundColor: distExports$4.colors.all[colorSwatch]
|
|
10914
10626
|
}
|
|
10915
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
10627
|
+
}), (_ref2 = focused !== null && focused !== void 0 ? focused : selected) === null || _ref2 === void 0 ? void 0 : _ref2.label, /*#__PURE__*/React.createElement("span", {
|
|
10916
10628
|
className: classNames('Select__icon', {
|
|
10917
10629
|
'Select__icon--shifted': shiftIconLeftwards
|
|
10918
10630
|
})
|
|
@@ -12064,14 +11776,11 @@ var usePreventNavigation = function usePreventNavigation() {
|
|
|
12064
11776
|
|
|
12065
11777
|
var NavigationPreventer = function NavigationPreventer(_ref) {
|
|
12066
11778
|
var _ref$enabled = _ref.enabled,
|
|
12067
|
-
enabled = _ref$enabled === void 0 ? false : _ref$enabled
|
|
12068
|
-
_ref$message = _ref.message,
|
|
12069
|
-
message = _ref$message === void 0 ? 'Changes that you made may not be saved.' : _ref$message;
|
|
11779
|
+
enabled = _ref$enabled === void 0 ? false : _ref$enabled;
|
|
12070
11780
|
usePreventNavigation(enabled);
|
|
12071
|
-
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
});
|
|
11781
|
+
|
|
11782
|
+
// TODO: implement this with next.js https://github.com/vercel/next.js/discussions/32231
|
|
11783
|
+
return null;
|
|
12075
11784
|
};
|
|
12076
11785
|
|
|
12077
11786
|
var __assign$1 = undefined && undefined.__assign || function () {
|