@jobber/components 8.18.1 → 8.20.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/InputNumberExperimental-cjs.js +214 -87
- package/dist/InputNumberExperimental-es.js +215 -88
- package/dist/MenuSubmenuTrigger-cjs.js +41 -41
- package/dist/MenuSubmenuTrigger-es.js +2 -2
- package/dist/NumberFieldInput-cjs.js +81 -2
- package/dist/NumberFieldInput-es.js +81 -3
- package/dist/ScrollAreaViewport-cjs.js +50 -175
- package/dist/ScrollAreaViewport-es.js +3 -115
- package/dist/clamp-cjs.js +131 -2
- package/dist/clamp-es.js +114 -2
- package/dist/primitives/BottomSheet/index.cjs +1 -1
- package/dist/primitives/BottomSheet/index.mjs +1 -1
- package/dist/primitives/InputNumberExperimental/InputNumberExperimental.d.ts +51 -10
- package/dist/primitives/InputNumberExperimental/index.cjs +3 -3
- package/dist/primitives/InputNumberExperimental/index.d.ts +1 -1
- package/dist/primitives/InputNumberExperimental/index.mjs +3 -3
- package/dist/primitives/InputNumberExperimental/types.d.ts +83 -83
- package/dist/primitives/index.cjs +1 -1
- package/dist/primitives/index.mjs +1 -1
- package/dist/styles.css +2 -2
- package/dist/unstyledPrimitives/index.cjs +17 -95
- package/dist/unstyledPrimitives/index.mjs +3 -81
- package/package.json +2 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { f as formatErrorMessage, a as useRefWithInit, i as isReactVersionAtLeast, N as NOOP, u as useRenderElement, E as EMPTY_OBJECT, b as useMergedRefs } from './useRenderElement-es.js';
|
|
4
|
-
import { d as useIsoLayoutEffect, a as useStableCallback, X as
|
|
4
|
+
import { d as useIsoLayoutEffect, a as useStableCallback, a1 as ARROW_UP$1, X as ARROW_DOWN$1, C as stopEvent, Y as ARROW_LEFT$1, Z as ARROW_RIGHT$1, o as ownerDocument, L as contains, K as activeElement, N as isSafari, p as visuallyHidden, m as createChangeEventDetails, _ as focusOut, F as useId, V as isTypeableCombobox, k as useValueAsRef, b as useTimeout, aa as useAnimationFrame, U as getFloatingFocusElement, ab as resolveRef, R as triggerHover, a4 as outsidePress, $ as isVirtualClick, a0 as isVirtualPointerEvent, ac as isWebKit, G as isTypeableElement, g as getTarget, E as isMouseLikePointerType, ad as isClickLikeEvent, O as triggerPress, ae as isReactEvent, P as escapeKey, T as Timeout, af as isEventTargetWithin, ag as isRootElement, c as useTransitionStatus, f as useOpenChangeComplete, ah as FOCUSABLE_ATTRIBUTE, ai as ACTIVE_KEY, aj as SELECTED_KEY, l as isIOS, B as useValueChanged, ak as TransitionStatusDataAttributes, al as AnimationFrame, t as transitionStatusMapping, i as clamp, a7 as imperativeAction, u as useBaseUiId, A as useButton, j as useControlled, n as none, am as isAndroid, an as closeWatcher } from './clamp-es.js';
|
|
5
5
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
6
|
import { f as floor, t as tabbable, i as isTabbable, a as focusable } from './index.esm-es.js';
|
|
7
|
-
import {
|
|
7
|
+
import { f as getComputedStyle$1, i as isShadowRoot, g as getNodeName, c as isNode, a as isHTMLElement, k as getWindow, j as isWebKit$1, b as isElement, d as isLastTraversableNode, e as getParentNode, o as isOverflowElement } from './floating-ui.utils.dom-es.js';
|
|
8
8
|
import * as ReactDOM from 'react-dom';
|
|
9
9
|
|
|
10
10
|
function useOnFirstRender(fn) {
|
|
@@ -1363,118 +1363,6 @@ class ReactStore extends Store {
|
|
|
1363
1363
|
}
|
|
1364
1364
|
}
|
|
1365
1365
|
|
|
1366
|
-
const FOCUSABLE_ATTRIBUTE = 'data-base-ui-focusable';
|
|
1367
|
-
const ACTIVE_KEY = 'active';
|
|
1368
|
-
const SELECTED_KEY = 'selected';
|
|
1369
|
-
const TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled])," + "[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
|
|
1370
|
-
const ARROW_LEFT$1 = 'ArrowLeft';
|
|
1371
|
-
const ARROW_RIGHT$1 = 'ArrowRight';
|
|
1372
|
-
const ARROW_UP$1 = 'ArrowUp';
|
|
1373
|
-
const ARROW_DOWN$1 = 'ArrowDown';
|
|
1374
|
-
|
|
1375
|
-
function activeElement(doc) {
|
|
1376
|
-
let element = doc.activeElement;
|
|
1377
|
-
while (element?.shadowRoot?.activeElement != null) {
|
|
1378
|
-
element = element.shadowRoot.activeElement;
|
|
1379
|
-
}
|
|
1380
|
-
return element;
|
|
1381
|
-
}
|
|
1382
|
-
function contains(parent, child) {
|
|
1383
|
-
if (!parent || !child) {
|
|
1384
|
-
return false;
|
|
1385
|
-
}
|
|
1386
|
-
const rootNode = child.getRootNode?.();
|
|
1387
|
-
|
|
1388
|
-
// First, attempt with faster native method
|
|
1389
|
-
if (parent.contains(child)) {
|
|
1390
|
-
return true;
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
// then fallback to custom implementation with Shadow DOM support
|
|
1394
|
-
if (rootNode && isShadowRoot(rootNode)) {
|
|
1395
|
-
let next = child;
|
|
1396
|
-
while (next) {
|
|
1397
|
-
if (parent === next) {
|
|
1398
|
-
return true;
|
|
1399
|
-
}
|
|
1400
|
-
next = next.parentNode || next.host;
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
// Give up, the result is false
|
|
1405
|
-
return false;
|
|
1406
|
-
}
|
|
1407
|
-
function isTargetInsideEnabledTrigger(target, triggerElements) {
|
|
1408
|
-
if (!isElement(target)) {
|
|
1409
|
-
return false;
|
|
1410
|
-
}
|
|
1411
|
-
const targetElement = target;
|
|
1412
|
-
if (triggerElements.hasElement(targetElement)) {
|
|
1413
|
-
return !targetElement.hasAttribute('data-trigger-disabled');
|
|
1414
|
-
}
|
|
1415
|
-
for (const [, trigger] of triggerElements.entries()) {
|
|
1416
|
-
if (contains(trigger, targetElement)) {
|
|
1417
|
-
return !trigger.hasAttribute('data-trigger-disabled');
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
return false;
|
|
1421
|
-
}
|
|
1422
|
-
function getTarget(event) {
|
|
1423
|
-
if ('composedPath' in event) {
|
|
1424
|
-
return event.composedPath()[0];
|
|
1425
|
-
}
|
|
1426
|
-
|
|
1427
|
-
// TS thinks `event` is of type never as it assumes all browsers support
|
|
1428
|
-
// `composedPath()`, but browsers without shadow DOM don't.
|
|
1429
|
-
return event.target;
|
|
1430
|
-
}
|
|
1431
|
-
function isEventTargetWithin(event, node) {
|
|
1432
|
-
if (node == null) {
|
|
1433
|
-
return false;
|
|
1434
|
-
}
|
|
1435
|
-
if ('composedPath' in event) {
|
|
1436
|
-
return event.composedPath().includes(node);
|
|
1437
|
-
}
|
|
1438
|
-
|
|
1439
|
-
// TS thinks `event` is of type never as it assumes all browsers support composedPath, but browsers without shadow dom don't
|
|
1440
|
-
const eventAgain = event;
|
|
1441
|
-
return eventAgain.target != null && node.contains(eventAgain.target);
|
|
1442
|
-
}
|
|
1443
|
-
function isRootElement(element) {
|
|
1444
|
-
return element.matches('html,body');
|
|
1445
|
-
}
|
|
1446
|
-
function isTypeableElement(element) {
|
|
1447
|
-
return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
|
|
1448
|
-
}
|
|
1449
|
-
function isTypeableCombobox(element) {
|
|
1450
|
-
if (!element) {
|
|
1451
|
-
return false;
|
|
1452
|
-
}
|
|
1453
|
-
return element.getAttribute('role') === 'combobox' && isTypeableElement(element);
|
|
1454
|
-
}
|
|
1455
|
-
function matchesFocusVisible(element) {
|
|
1456
|
-
// We don't want to block focus from working with `visibleOnly`
|
|
1457
|
-
// (JSDOM doesn't match `:focus-visible` when the element has `:focus`)
|
|
1458
|
-
if (!element || isJSDOM) {
|
|
1459
|
-
return true;
|
|
1460
|
-
}
|
|
1461
|
-
try {
|
|
1462
|
-
return element.matches(':focus-visible');
|
|
1463
|
-
} catch (_e) {
|
|
1464
|
-
return true;
|
|
1465
|
-
}
|
|
1466
|
-
}
|
|
1467
|
-
function getFloatingFocusElement(floatingElement) {
|
|
1468
|
-
if (!floatingElement) {
|
|
1469
|
-
return null;
|
|
1470
|
-
}
|
|
1471
|
-
// Try to find the element that has `{...getFloatingProps()}` spread on it.
|
|
1472
|
-
// This indicates the floating element is acting as a positioning wrapper, and
|
|
1473
|
-
// so focus should be managed on the child element with the event handlers and
|
|
1474
|
-
// aria props.
|
|
1475
|
-
return floatingElement.hasAttribute(FOCUSABLE_ATTRIBUTE) ? floatingElement : floatingElement.querySelector(`[${FOCUSABLE_ATTRIBUTE}]`) || floatingElement;
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
1366
|
/* eslint-disable @typescript-eslint/no-loop-func */
|
|
1479
1367
|
|
|
1480
1368
|
function getNodeChildren(nodes, id, onlyOpenChildren = true) {
|
|
@@ -6818,4 +6706,4 @@ function mergeHiddenState(prevState, nextState) {
|
|
|
6818
6706
|
return nextState;
|
|
6819
6707
|
}
|
|
6820
6708
|
|
|
6821
|
-
export {
|
|
6709
|
+
export { useInteractions as $, FloatingPortal as A, POPUP_COLLISION_AVOIDANCE as B, COMPOSITE_KEYS as C, DrawerTrigger as D, inertValue as E, FloatingRootStore as F, FloatingNode as G, DROPDOWN_COLLISION_AVOIDANCE as H, InternalBackdrop as I, popupStoreSelectors as J, createSelector as K, createInitialPopupStoreState as L, FloatingTreeStore as M, fastComponent as N, useOnFirstRender as O, PopupTriggerMap as P, useFloatingNodeId as Q, ReactStore as R, ScrollAreaRoot as S, useOpenInteractionType as T, useImplicitActiveTrigger as U, useOpenStateTransitions as V, useScrollLock as W, useSyncedFloatingRootContext as X, useDismiss as Y, useRole as Z, TYPEAHEAD_RESET_MS as _, DrawerRoot as a, FloatingTree as a0, fastComponentRef as a1, useTriggerDataForwarding as a2, useClick as a3, getTabbableBeforeElement as a4, isOutsideEvent as a5, getTabbableAfterElement as a6, getNextTabbable as a7, pressableTriggerOpenStateMapping as a8, FocusGuard as a9, PATIENT_CLICK_THRESHOLD as aa, useTriggerRegistration as ab, triggerOpenStateMapping as ac, useStore as ad, Store as ae, useDrawerProviderContext as af, DrawerBackdropCssVars as ag, DrawerPopupCssVars as ah, DrawerProviderContext as ai, CommonPopupDataAttributes as aj, useDialogPortalContext as ak, DialogStore as al, useDrawerRootContext as am, DrawerPopupDataAttributes as an, useDrawerSnapPoints as ao, DrawerViewportContext as ap, BASE_UI_SWIPE_IGNORE_SELECTOR as aq, DRAWER_CONTENT_ATTRIBUTE as ar, useScrollAreaRootContext as as, getOffset as at, ScrollAreaRootCssVars as au, scrollAreaStateAttributesMapping as av, useScrollAreaViewportContext as aw, DrawerPortal as b, DrawerBackdrop as c, DrawerPopup as d, ScrollAreaViewport as e, DrawerContent as f, useFloatingTree as g, createAttribute as h, getNodeChildren as i, isIndexOutOfListBounds as j, getMinListIndex as k, getMaxListIndex as l, createGridCellMap as m, isListIndexDisabled as n, getGridNavigatedIndex as o, getGridCellIndices as p, getGridCellIndexOfCorner as q, findNonDisabledListIndex as r, enqueueFocus as s, isElementVisible as t, useFloatingParentNodeId as u, useDirection as v, DISABLED_TRANSITIONS_STYLE as w, useDialogRootContext as x, popupStateMapping as y, FloatingFocusManager as z };
|
package/dist/clamp-cjs.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var useRenderElement = require('./useRenderElement-cjs.js');
|
|
5
|
-
var ReactDOM = require('react-dom');
|
|
6
5
|
var floatingUi_utils_dom = require('./floating-ui.utils.dom-cjs.js');
|
|
6
|
+
var ReactDOM = require('react-dom');
|
|
7
7
|
|
|
8
8
|
function _interopNamespaceDefault(e) {
|
|
9
9
|
var n = Object.create(null);
|
|
@@ -362,6 +362,118 @@ function getPlatform() {
|
|
|
362
362
|
return navigator.platform ?? '';
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
+
const FOCUSABLE_ATTRIBUTE = 'data-base-ui-focusable';
|
|
366
|
+
const ACTIVE_KEY = 'active';
|
|
367
|
+
const SELECTED_KEY = 'selected';
|
|
368
|
+
const TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled])," + "[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
|
|
369
|
+
const ARROW_LEFT = 'ArrowLeft';
|
|
370
|
+
const ARROW_RIGHT = 'ArrowRight';
|
|
371
|
+
const ARROW_UP = 'ArrowUp';
|
|
372
|
+
const ARROW_DOWN = 'ArrowDown';
|
|
373
|
+
|
|
374
|
+
function activeElement(doc) {
|
|
375
|
+
let element = doc.activeElement;
|
|
376
|
+
while (element?.shadowRoot?.activeElement != null) {
|
|
377
|
+
element = element.shadowRoot.activeElement;
|
|
378
|
+
}
|
|
379
|
+
return element;
|
|
380
|
+
}
|
|
381
|
+
function contains(parent, child) {
|
|
382
|
+
if (!parent || !child) {
|
|
383
|
+
return false;
|
|
384
|
+
}
|
|
385
|
+
const rootNode = child.getRootNode?.();
|
|
386
|
+
|
|
387
|
+
// First, attempt with faster native method
|
|
388
|
+
if (parent.contains(child)) {
|
|
389
|
+
return true;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// then fallback to custom implementation with Shadow DOM support
|
|
393
|
+
if (rootNode && floatingUi_utils_dom.isShadowRoot(rootNode)) {
|
|
394
|
+
let next = child;
|
|
395
|
+
while (next) {
|
|
396
|
+
if (parent === next) {
|
|
397
|
+
return true;
|
|
398
|
+
}
|
|
399
|
+
next = next.parentNode || next.host;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// Give up, the result is false
|
|
404
|
+
return false;
|
|
405
|
+
}
|
|
406
|
+
function isTargetInsideEnabledTrigger(target, triggerElements) {
|
|
407
|
+
if (!floatingUi_utils_dom.isElement(target)) {
|
|
408
|
+
return false;
|
|
409
|
+
}
|
|
410
|
+
const targetElement = target;
|
|
411
|
+
if (triggerElements.hasElement(targetElement)) {
|
|
412
|
+
return !targetElement.hasAttribute('data-trigger-disabled');
|
|
413
|
+
}
|
|
414
|
+
for (const [, trigger] of triggerElements.entries()) {
|
|
415
|
+
if (contains(trigger, targetElement)) {
|
|
416
|
+
return !trigger.hasAttribute('data-trigger-disabled');
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
function getTarget(event) {
|
|
422
|
+
if ('composedPath' in event) {
|
|
423
|
+
return event.composedPath()[0];
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// TS thinks `event` is of type never as it assumes all browsers support
|
|
427
|
+
// `composedPath()`, but browsers without shadow DOM don't.
|
|
428
|
+
return event.target;
|
|
429
|
+
}
|
|
430
|
+
function isEventTargetWithin(event, node) {
|
|
431
|
+
if (node == null) {
|
|
432
|
+
return false;
|
|
433
|
+
}
|
|
434
|
+
if ('composedPath' in event) {
|
|
435
|
+
return event.composedPath().includes(node);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// TS thinks `event` is of type never as it assumes all browsers support composedPath, but browsers without shadow dom don't
|
|
439
|
+
const eventAgain = event;
|
|
440
|
+
return eventAgain.target != null && node.contains(eventAgain.target);
|
|
441
|
+
}
|
|
442
|
+
function isRootElement(element) {
|
|
443
|
+
return element.matches('html,body');
|
|
444
|
+
}
|
|
445
|
+
function isTypeableElement(element) {
|
|
446
|
+
return floatingUi_utils_dom.isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
|
|
447
|
+
}
|
|
448
|
+
function isTypeableCombobox(element) {
|
|
449
|
+
if (!element) {
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
452
|
+
return element.getAttribute('role') === 'combobox' && isTypeableElement(element);
|
|
453
|
+
}
|
|
454
|
+
function matchesFocusVisible(element) {
|
|
455
|
+
// We don't want to block focus from working with `visibleOnly`
|
|
456
|
+
// (JSDOM doesn't match `:focus-visible` when the element has `:focus`)
|
|
457
|
+
if (!element || isJSDOM) {
|
|
458
|
+
return true;
|
|
459
|
+
}
|
|
460
|
+
try {
|
|
461
|
+
return element.matches(':focus-visible');
|
|
462
|
+
} catch (_e) {
|
|
463
|
+
return true;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
function getFloatingFocusElement(floatingElement) {
|
|
467
|
+
if (!floatingElement) {
|
|
468
|
+
return null;
|
|
469
|
+
}
|
|
470
|
+
// Try to find the element that has `{...getFloatingProps()}` spread on it.
|
|
471
|
+
// This indicates the floating element is acting as a positioning wrapper, and
|
|
472
|
+
// so focus should be managed on the child element with the event handlers and
|
|
473
|
+
// aria props.
|
|
474
|
+
return floatingElement.hasAttribute(FOCUSABLE_ATTRIBUTE) ? floatingElement : floatingElement.querySelector(`[${FOCUSABLE_ATTRIBUTE}]`) || floatingElement;
|
|
475
|
+
}
|
|
476
|
+
|
|
365
477
|
function stopEvent(event) {
|
|
366
478
|
event.preventDefault();
|
|
367
479
|
event.stopPropagation();
|
|
@@ -1002,22 +1114,34 @@ function clamp(val, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER
|
|
|
1002
1114
|
return Math.max(min, Math.min(val, max));
|
|
1003
1115
|
}
|
|
1004
1116
|
|
|
1117
|
+
exports.ACTIVE_KEY = ACTIVE_KEY;
|
|
1118
|
+
exports.ARROW_DOWN = ARROW_DOWN;
|
|
1119
|
+
exports.ARROW_LEFT = ARROW_LEFT;
|
|
1120
|
+
exports.ARROW_RIGHT = ARROW_RIGHT;
|
|
1121
|
+
exports.ARROW_UP = ARROW_UP;
|
|
1005
1122
|
exports.AnimationFrame = AnimationFrame;
|
|
1123
|
+
exports.FOCUSABLE_ATTRIBUTE = FOCUSABLE_ATTRIBUTE;
|
|
1124
|
+
exports.SELECTED_KEY = SELECTED_KEY;
|
|
1006
1125
|
exports.SafeReact = SafeReact;
|
|
1126
|
+
exports.TYPEABLE_SELECTOR = TYPEABLE_SELECTOR;
|
|
1007
1127
|
exports.Timeout = Timeout;
|
|
1008
1128
|
exports.TransitionStatusDataAttributes = TransitionStatusDataAttributes;
|
|
1129
|
+
exports.activeElement = activeElement;
|
|
1009
1130
|
exports.cancelOpen = cancelOpen;
|
|
1010
1131
|
exports.chipRemovePress = chipRemovePress;
|
|
1011
1132
|
exports.clamp = clamp;
|
|
1012
1133
|
exports.clearPress = clearPress;
|
|
1013
1134
|
exports.closePress = closePress;
|
|
1014
1135
|
exports.closeWatcher = closeWatcher;
|
|
1136
|
+
exports.contains = contains;
|
|
1015
1137
|
exports.createChangeEventDetails = createChangeEventDetails;
|
|
1016
1138
|
exports.createGenericEventDetails = createGenericEventDetails;
|
|
1017
1139
|
exports.decrementPress = decrementPress;
|
|
1018
1140
|
exports.error = error;
|
|
1019
1141
|
exports.escapeKey = escapeKey;
|
|
1020
1142
|
exports.focusOut = focusOut;
|
|
1143
|
+
exports.getFloatingFocusElement = getFloatingFocusElement;
|
|
1144
|
+
exports.getTarget = getTarget;
|
|
1021
1145
|
exports.imperativeAction = imperativeAction;
|
|
1022
1146
|
exports.incrementPress = incrementPress;
|
|
1023
1147
|
exports.inputBlur = inputBlur;
|
|
@@ -1027,19 +1151,24 @@ exports.inputPaste = inputPaste;
|
|
|
1027
1151
|
exports.inputPress = inputPress;
|
|
1028
1152
|
exports.isAndroid = isAndroid;
|
|
1029
1153
|
exports.isClickLikeEvent = isClickLikeEvent;
|
|
1154
|
+
exports.isEventTargetWithin = isEventTargetWithin;
|
|
1030
1155
|
exports.isFirefox = isFirefox;
|
|
1031
1156
|
exports.isIOS = isIOS;
|
|
1032
|
-
exports.isJSDOM = isJSDOM;
|
|
1033
1157
|
exports.isMac = isMac;
|
|
1034
1158
|
exports.isMouseLikePointerType = isMouseLikePointerType;
|
|
1035
1159
|
exports.isReactEvent = isReactEvent;
|
|
1160
|
+
exports.isRootElement = isRootElement;
|
|
1036
1161
|
exports.isSafari = isSafari;
|
|
1162
|
+
exports.isTargetInsideEnabledTrigger = isTargetInsideEnabledTrigger;
|
|
1163
|
+
exports.isTypeableCombobox = isTypeableCombobox;
|
|
1164
|
+
exports.isTypeableElement = isTypeableElement;
|
|
1037
1165
|
exports.isVirtualClick = isVirtualClick;
|
|
1038
1166
|
exports.isVirtualPointerEvent = isVirtualPointerEvent;
|
|
1039
1167
|
exports.isWebKit = isWebKit;
|
|
1040
1168
|
exports.itemPress = itemPress;
|
|
1041
1169
|
exports.keyboard = keyboard;
|
|
1042
1170
|
exports.listNavigation = listNavigation;
|
|
1171
|
+
exports.matchesFocusVisible = matchesFocusVisible;
|
|
1043
1172
|
exports.none = none;
|
|
1044
1173
|
exports.outsidePress = outsidePress;
|
|
1045
1174
|
exports.ownerDocument = ownerDocument;
|
package/dist/clamp-es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { a as useRefWithInit, E as EMPTY_OBJECT, f as formatErrorMessage, m as mergeProps, c as makeEventPreventable } from './useRenderElement-es.js';
|
|
3
|
+
import { i as isShadowRoot, b as isElement, a as isHTMLElement } from './floating-ui.utils.dom-es.js';
|
|
3
4
|
import * as ReactDOM from 'react-dom';
|
|
4
|
-
import { a as isHTMLElement } from './floating-ui.utils.dom-es.js';
|
|
5
5
|
|
|
6
6
|
// https://github.com/mui/material-ui/issues/41190#issuecomment-2040873379
|
|
7
7
|
const useInsertionEffect = React[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0, -3)];
|
|
@@ -340,6 +340,118 @@ function getPlatform() {
|
|
|
340
340
|
return navigator.platform ?? '';
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
+
const FOCUSABLE_ATTRIBUTE = 'data-base-ui-focusable';
|
|
344
|
+
const ACTIVE_KEY = 'active';
|
|
345
|
+
const SELECTED_KEY = 'selected';
|
|
346
|
+
const TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled])," + "[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
|
|
347
|
+
const ARROW_LEFT = 'ArrowLeft';
|
|
348
|
+
const ARROW_RIGHT = 'ArrowRight';
|
|
349
|
+
const ARROW_UP = 'ArrowUp';
|
|
350
|
+
const ARROW_DOWN = 'ArrowDown';
|
|
351
|
+
|
|
352
|
+
function activeElement(doc) {
|
|
353
|
+
let element = doc.activeElement;
|
|
354
|
+
while (element?.shadowRoot?.activeElement != null) {
|
|
355
|
+
element = element.shadowRoot.activeElement;
|
|
356
|
+
}
|
|
357
|
+
return element;
|
|
358
|
+
}
|
|
359
|
+
function contains(parent, child) {
|
|
360
|
+
if (!parent || !child) {
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
const rootNode = child.getRootNode?.();
|
|
364
|
+
|
|
365
|
+
// First, attempt with faster native method
|
|
366
|
+
if (parent.contains(child)) {
|
|
367
|
+
return true;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// then fallback to custom implementation with Shadow DOM support
|
|
371
|
+
if (rootNode && isShadowRoot(rootNode)) {
|
|
372
|
+
let next = child;
|
|
373
|
+
while (next) {
|
|
374
|
+
if (parent === next) {
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
next = next.parentNode || next.host;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// Give up, the result is false
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
function isTargetInsideEnabledTrigger(target, triggerElements) {
|
|
385
|
+
if (!isElement(target)) {
|
|
386
|
+
return false;
|
|
387
|
+
}
|
|
388
|
+
const targetElement = target;
|
|
389
|
+
if (triggerElements.hasElement(targetElement)) {
|
|
390
|
+
return !targetElement.hasAttribute('data-trigger-disabled');
|
|
391
|
+
}
|
|
392
|
+
for (const [, trigger] of triggerElements.entries()) {
|
|
393
|
+
if (contains(trigger, targetElement)) {
|
|
394
|
+
return !trigger.hasAttribute('data-trigger-disabled');
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
function getTarget(event) {
|
|
400
|
+
if ('composedPath' in event) {
|
|
401
|
+
return event.composedPath()[0];
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// TS thinks `event` is of type never as it assumes all browsers support
|
|
405
|
+
// `composedPath()`, but browsers without shadow DOM don't.
|
|
406
|
+
return event.target;
|
|
407
|
+
}
|
|
408
|
+
function isEventTargetWithin(event, node) {
|
|
409
|
+
if (node == null) {
|
|
410
|
+
return false;
|
|
411
|
+
}
|
|
412
|
+
if ('composedPath' in event) {
|
|
413
|
+
return event.composedPath().includes(node);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// TS thinks `event` is of type never as it assumes all browsers support composedPath, but browsers without shadow dom don't
|
|
417
|
+
const eventAgain = event;
|
|
418
|
+
return eventAgain.target != null && node.contains(eventAgain.target);
|
|
419
|
+
}
|
|
420
|
+
function isRootElement(element) {
|
|
421
|
+
return element.matches('html,body');
|
|
422
|
+
}
|
|
423
|
+
function isTypeableElement(element) {
|
|
424
|
+
return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
|
|
425
|
+
}
|
|
426
|
+
function isTypeableCombobox(element) {
|
|
427
|
+
if (!element) {
|
|
428
|
+
return false;
|
|
429
|
+
}
|
|
430
|
+
return element.getAttribute('role') === 'combobox' && isTypeableElement(element);
|
|
431
|
+
}
|
|
432
|
+
function matchesFocusVisible(element) {
|
|
433
|
+
// We don't want to block focus from working with `visibleOnly`
|
|
434
|
+
// (JSDOM doesn't match `:focus-visible` when the element has `:focus`)
|
|
435
|
+
if (!element || isJSDOM) {
|
|
436
|
+
return true;
|
|
437
|
+
}
|
|
438
|
+
try {
|
|
439
|
+
return element.matches(':focus-visible');
|
|
440
|
+
} catch (_e) {
|
|
441
|
+
return true;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
function getFloatingFocusElement(floatingElement) {
|
|
445
|
+
if (!floatingElement) {
|
|
446
|
+
return null;
|
|
447
|
+
}
|
|
448
|
+
// Try to find the element that has `{...getFloatingProps()}` spread on it.
|
|
449
|
+
// This indicates the floating element is acting as a positioning wrapper, and
|
|
450
|
+
// so focus should be managed on the child element with the event handlers and
|
|
451
|
+
// aria props.
|
|
452
|
+
return floatingElement.hasAttribute(FOCUSABLE_ATTRIBUTE) ? floatingElement : floatingElement.querySelector(`[${FOCUSABLE_ATTRIBUTE}]`) || floatingElement;
|
|
453
|
+
}
|
|
454
|
+
|
|
343
455
|
function stopEvent(event) {
|
|
344
456
|
event.preventDefault();
|
|
345
457
|
event.stopPropagation();
|
|
@@ -980,4 +1092,4 @@ function clamp(val, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER
|
|
|
980
1092
|
return Math.max(min, Math.min(val, max));
|
|
981
1093
|
}
|
|
982
1094
|
|
|
983
|
-
export {
|
|
1095
|
+
export { isVirtualClick as $, useButton as A, useValueChanged as B, stopEvent as C, keyboard as D, isMouseLikePointerType as E, useId as F, isTypeableElement as G, matchesFocusVisible as H, isTargetInsideEnabledTrigger as I, triggerFocus as J, activeElement as K, contains as L, isMac as M, isSafari as N, triggerPress as O, escapeKey as P, TYPEABLE_SELECTOR as Q, triggerHover as R, SafeReact as S, Timeout as T, getFloatingFocusElement as U, isTypeableCombobox as V, listNavigation as W, ARROW_DOWN as X, ARROW_LEFT as Y, ARROW_RIGHT as Z, focusOut as _, useStableCallback as a, isVirtualPointerEvent as a0, ARROW_UP as a1, closePress as a2, itemPress as a3, outsidePress as a4, useAnimationsFinished as a5, siblingOpen as a6, imperativeAction as a7, useCompositeRootContext as a8, cancelOpen as a9, useAnimationFrame as aa, resolveRef as ab, isWebKit as ac, isClickLikeEvent as ad, isReactEvent as ae, isEventTargetWithin as af, isRootElement as ag, FOCUSABLE_ATTRIBUTE as ah, ACTIVE_KEY as ai, SELECTED_KEY as aj, TransitionStatusDataAttributes as ak, AnimationFrame as al, isAndroid as am, closeWatcher as an, inputPress as ao, pointer as ap, isFirefox as aq, clearPress as ar, swipe as as, chipRemovePress as at, scrub as au, useTimeout as b, useTransitionStatus as c, useIsoLayoutEffect as d, error as e, useOpenChangeComplete as f, getTarget as g, useOnMount as h, clamp as i, useControlled as j, useValueAsRef as k, isIOS as l, createChangeEventDetails as m, none as n, ownerDocument as o, visuallyHidden as p, inputChange as q, inputClear as r, inputBlur as s, transitionStatusMapping as t, useBaseUiId as u, visuallyHiddenInput as v, inputPaste as w, createGenericEventDetails as x, incrementPress as y, decrementPress as z };
|
|
@@ -12,8 +12,8 @@ require('../../Typography-cjs.js');
|
|
|
12
12
|
require('../../useRenderElement-cjs.js');
|
|
13
13
|
require('../../ScrollAreaViewport-cjs.js');
|
|
14
14
|
require('../../clamp-cjs.js');
|
|
15
|
-
require('react-dom');
|
|
16
15
|
require('../../floating-ui.utils.dom-cjs.js');
|
|
16
|
+
require('react-dom');
|
|
17
17
|
require('react/jsx-runtime');
|
|
18
18
|
require('../../index.esm-cjs.js');
|
|
19
19
|
|
|
@@ -10,7 +10,7 @@ import '../../Typography-es.js';
|
|
|
10
10
|
import '../../useRenderElement-es.js';
|
|
11
11
|
import '../../ScrollAreaViewport-es.js';
|
|
12
12
|
import '../../clamp-es.js';
|
|
13
|
-
import 'react-dom';
|
|
14
13
|
import '../../floating-ui.utils.dom-es.js';
|
|
14
|
+
import 'react-dom';
|
|
15
15
|
import 'react/jsx-runtime';
|
|
16
16
|
import '../../index.esm-es.js';
|
|
@@ -1,20 +1,61 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { InputNumberExperimentalAffixCompoundProps, InputNumberExperimentalInputProps, InputNumberExperimentalProps, InputNumberExperimentalRef,
|
|
3
|
-
declare function
|
|
4
|
-
declare namespace
|
|
2
|
+
import type { InputNumberExperimentalAffixCompoundProps, InputNumberExperimentalDescriptionProps, InputNumberExperimentalErrorProps, InputNumberExperimentalFooterProps, InputNumberExperimentalGroupProps, InputNumberExperimentalInputProps, InputNumberExperimentalLabelProps, InputNumberExperimentalLoadingProps, InputNumberExperimentalProps, InputNumberExperimentalRef, InputNumberExperimentalStepButtonProps, InputNumberExperimentalStepperProps, InputNumberExperimentalWrapperProps } from "./types";
|
|
3
|
+
declare function InputNumberExperimentalGroup({ children, className, style, }: InputNumberExperimentalGroupProps): React.JSX.Element;
|
|
4
|
+
declare namespace InputNumberExperimentalGroup {
|
|
5
5
|
var displayName: string;
|
|
6
6
|
}
|
|
7
|
-
declare function
|
|
8
|
-
declare namespace
|
|
7
|
+
declare function InputNumberExperimentalFooter({ children, className, style, }: InputNumberExperimentalFooterProps): React.JSX.Element;
|
|
8
|
+
declare namespace InputNumberExperimentalFooter {
|
|
9
|
+
var displayName: string;
|
|
10
|
+
}
|
|
11
|
+
declare function InputNumberExperimentalInput({ children, className, style, }: InputNumberExperimentalInputProps): React.JSX.Element;
|
|
12
|
+
declare namespace InputNumberExperimentalInput {
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
15
|
+
declare function InputNumberExperimentalLabel({ children, className, style, }: InputNumberExperimentalLabelProps): React.JSX.Element | null;
|
|
16
|
+
declare namespace InputNumberExperimentalLabel {
|
|
17
|
+
var displayName: string;
|
|
18
|
+
}
|
|
19
|
+
declare function InputNumberExperimentalDescription({ children, className, style, }: InputNumberExperimentalDescriptionProps): React.JSX.Element | null;
|
|
20
|
+
declare namespace InputNumberExperimentalDescription {
|
|
21
|
+
var displayName: string;
|
|
22
|
+
}
|
|
23
|
+
declare function InputNumberExperimentalError({ children, className, style, }: InputNumberExperimentalErrorProps): React.JSX.Element | null;
|
|
24
|
+
declare namespace InputNumberExperimentalError {
|
|
9
25
|
var displayName: string;
|
|
10
26
|
}
|
|
11
|
-
declare function
|
|
12
|
-
declare namespace
|
|
27
|
+
declare function InputNumberExperimentalLoading({ children, className, style, }: InputNumberExperimentalLoadingProps): React.JSX.Element;
|
|
28
|
+
declare namespace InputNumberExperimentalLoading {
|
|
29
|
+
var displayName: string;
|
|
30
|
+
}
|
|
31
|
+
declare function InputNumberExperimentalStepper({ children, incrementLabel, decrementLabel, className, style, }: InputNumberExperimentalStepperProps): React.JSX.Element | null;
|
|
32
|
+
declare namespace InputNumberExperimentalStepper {
|
|
33
|
+
var displayName: string;
|
|
34
|
+
}
|
|
35
|
+
declare function InputNumberExperimentalIncrement({ children, ariaLabel, className, style, }: InputNumberExperimentalStepButtonProps): React.JSX.Element;
|
|
36
|
+
declare namespace InputNumberExperimentalIncrement {
|
|
37
|
+
var displayName: string;
|
|
38
|
+
}
|
|
39
|
+
declare function InputNumberExperimentalDecrement({ children, ariaLabel, className, style, }: InputNumberExperimentalStepButtonProps): React.JSX.Element;
|
|
40
|
+
declare namespace InputNumberExperimentalDecrement {
|
|
41
|
+
var displayName: string;
|
|
42
|
+
}
|
|
43
|
+
declare function InputNumberExperimentalAffixCompound({ variation, label, icon, onClick, ariaLabel, children, className, style, }: InputNumberExperimentalAffixCompoundProps): React.JSX.Element | null;
|
|
44
|
+
declare namespace InputNumberExperimentalAffixCompound {
|
|
13
45
|
var displayName: string;
|
|
14
46
|
}
|
|
15
47
|
export declare const InputNumberExperimental: React.ForwardRefExoticComponent<InputNumberExperimentalProps & React.RefAttributes<InputNumberExperimentalRef>> & {
|
|
16
|
-
|
|
48
|
+
Wrapper: React.ForwardRefExoticComponent<InputNumberExperimentalWrapperProps & React.RefAttributes<InputNumberExperimentalRef>>;
|
|
49
|
+
Group: typeof InputNumberExperimentalGroup;
|
|
50
|
+
Footer: typeof InputNumberExperimentalFooter;
|
|
51
|
+
Input: typeof InputNumberExperimentalInput;
|
|
52
|
+
Label: typeof InputNumberExperimentalLabel;
|
|
53
|
+
Description: typeof InputNumberExperimentalDescription;
|
|
54
|
+
Error: typeof InputNumberExperimentalError;
|
|
55
|
+
Loading: typeof InputNumberExperimentalLoading;
|
|
56
|
+
Stepper: typeof InputNumberExperimentalStepper;
|
|
57
|
+
Increment: typeof InputNumberExperimentalIncrement;
|
|
58
|
+
Decrement: typeof InputNumberExperimentalDecrement;
|
|
17
59
|
Affix: typeof InputNumberExperimentalAffixCompound;
|
|
18
|
-
Stepper: typeof InputNumberExperimentalStepperCompound;
|
|
19
60
|
};
|
|
20
|
-
export type { InputNumberExperimentalAffix, InputNumberExperimentalProps, InputNumberExperimentalRef, InputNumberExperimentalSuffix, InputNumberExperimentalSuffixProp, } from "./types";
|
|
61
|
+
export type { InputNumberExperimentalAffix, InputNumberExperimentalProps, InputNumberExperimentalRef, InputNumberExperimentalSuffix, InputNumberExperimentalSuffixProp, InputNumberExperimentalWrapperProps, } from "./types";
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var InputNumberExperimental = require('../../InputNumberExperimental-cjs.js');
|
|
4
|
+
require('../../tslib.es6-cjs.js');
|
|
4
5
|
require('react');
|
|
5
6
|
require('classnames');
|
|
6
7
|
require('../../ActivityIndicator-cjs.js');
|
|
7
8
|
require('../../Button-cjs.js');
|
|
8
|
-
require('../../tslib.es6-cjs.js');
|
|
9
9
|
require('react-router-dom');
|
|
10
10
|
require('../../Icon-cjs.js');
|
|
11
11
|
require('@jobber/design');
|
|
12
12
|
require('../../Typography-cjs.js');
|
|
13
|
-
require('../../clamp-cjs.js');
|
|
14
13
|
require('../../useRenderElement-cjs.js');
|
|
15
|
-
require('
|
|
14
|
+
require('../../clamp-cjs.js');
|
|
16
15
|
require('../../floating-ui.utils.dom-cjs.js');
|
|
16
|
+
require('react-dom');
|
|
17
17
|
require('../../NumberFieldInput-cjs.js');
|
|
18
18
|
require('react/jsx-runtime');
|
|
19
19
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { InputNumberExperimental } from "./InputNumberExperimental";
|
|
2
|
-
export type { InputNumberExperimentalAffix, InputNumberExperimentalProps, InputNumberExperimentalRef, } from "./types";
|
|
2
|
+
export type { InputNumberExperimentalAffix, InputNumberExperimentalAutoComplete, InputNumberExperimentalDescriptionProps, InputNumberExperimentalErrorProps, InputNumberExperimentalFooterProps, InputNumberExperimentalGroupProps, InputNumberExperimentalInputProps, InputNumberExperimentalLabelProps, InputNumberExperimentalLoadingProps, InputNumberExperimentalProps, InputNumberExperimentalRef, InputNumberExperimentalStepButtonProps, InputNumberExperimentalStepperProps, InputNumberExperimentalSuffix, InputNumberExperimentalSuffixProp, InputNumberExperimentalWrapperProps, } from "./types";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export { I as InputNumberExperimental } from '../../InputNumberExperimental-es.js';
|
|
2
|
+
import '../../tslib.es6-es.js';
|
|
2
3
|
import 'react';
|
|
3
4
|
import 'classnames';
|
|
4
5
|
import '../../ActivityIndicator-es.js';
|
|
5
6
|
import '../../Button-es.js';
|
|
6
|
-
import '../../tslib.es6-es.js';
|
|
7
7
|
import 'react-router-dom';
|
|
8
8
|
import '../../Icon-es.js';
|
|
9
9
|
import '@jobber/design';
|
|
10
10
|
import '../../Typography-es.js';
|
|
11
|
-
import '../../clamp-es.js';
|
|
12
11
|
import '../../useRenderElement-es.js';
|
|
13
|
-
import '
|
|
12
|
+
import '../../clamp-es.js';
|
|
14
13
|
import '../../floating-ui.utils.dom-es.js';
|
|
14
|
+
import 'react-dom';
|
|
15
15
|
import '../../NumberFieldInput-es.js';
|
|
16
16
|
import 'react/jsx-runtime';
|