@octanejs/base-ui 0.1.30 → 0.1.32
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/cjs/accordion.cjs +497 -0
- package/dist/cjs/alert-dialog.cjs +65 -0
- package/dist/cjs/avatar.cjs +234 -0
- package/dist/cjs/button.cjs +54 -0
- package/dist/cjs/checkbox-group.cjs +165 -0
- package/dist/cjs/checkbox.cjs +475 -0
- package/dist/cjs/collapsible.cjs +700 -0
- package/dist/cjs/context-menu.cjs +257 -0
- package/dist/cjs/csp-provider.cjs +40 -0
- package/dist/cjs/dialog.cjs +741 -0
- package/dist/cjs/direction-provider.cjs +35 -0
- package/dist/cjs/field.cjs +559 -0
- package/dist/cjs/fieldset.cjs +101 -0
- package/dist/cjs/form.cjs +177 -0
- package/dist/cjs/index.cjs +133 -0
- package/dist/cjs/input.cjs +32 -0
- package/dist/cjs/internal.cjs +51 -0
- package/dist/cjs/menu.cjs +2420 -0
- package/dist/cjs/menubar.cjs +132 -0
- package/dist/cjs/merge-props.cjs +34 -0
- package/dist/cjs/meter.cjs +169 -0
- package/dist/cjs/number-field.cjs +812 -0
- package/dist/cjs/popover.cjs +966 -0
- package/dist/cjs/preview-card.cjs +632 -0
- package/dist/cjs/progress.cjs +206 -0
- package/dist/cjs/radio-group.cjs +264 -0
- package/dist/cjs/radio.cjs +327 -0
- package/dist/cjs/separator.cjs +44 -0
- package/dist/cjs/slider.cjs +1384 -0
- package/dist/cjs/switch.cjs +306 -0
- package/dist/cjs/tabs.cjs +727 -0
- package/dist/cjs/toast.cjs +1766 -0
- package/dist/cjs/toggle-group.cjs +118 -0
- package/dist/cjs/toggle.cjs +121 -0
- package/dist/cjs/tooltip.cjs +835 -0
- package/dist/cjs/unstable-use-media-query.cjs +79 -0
- package/dist/cjs/use-render.cjs +40 -0
- package/dist/cjs/utils/CSPContext.cjs +38 -0
- package/dist/cjs/utils/CheckboxGroupContext.cjs +40 -0
- package/dist/cjs/utils/CompositeRootContext.cjs +40 -0
- package/dist/cjs/utils/ContextMenuRootContext.cjs +42 -0
- package/dist/cjs/utils/DirectionContext.cjs +34 -0
- package/dist/cjs/utils/FloatingPortalLite.cjs +47 -0
- package/dist/cjs/utils/InternalBackdrop.cjs +49 -0
- package/dist/cjs/utils/MenubarContext.cjs +40 -0
- package/dist/cjs/utils/RadioGroupContext.cjs +34 -0
- package/dist/cjs/utils/RequestQueue.cjs +111 -0
- package/dist/cjs/utils/TimeoutManager.cjs +50 -0
- package/dist/cjs/utils/ToggleGroupContext.cjs +40 -0
- package/dist/cjs/utils/adaptiveOriginMiddleware.cjs +94 -0
- package/dist/cjs/utils/addEventListener.cjs +33 -0
- package/dist/cjs/utils/areArraysEqual.cjs +30 -0
- package/dist/cjs/utils/clamp.cjs +30 -0
- package/dist/cjs/utils/closePart.cjs +70 -0
- package/dist/cjs/utils/collapsibleOpenStateMapping.cjs +42 -0
- package/dist/cjs/utils/composeRefs.cjs +68 -0
- package/dist/cjs/utils/composite/CompositeItem.cjs +59 -0
- package/dist/cjs/utils/composite/CompositeList.cjs +177 -0
- package/dist/cjs/utils/composite/CompositeListContext.cjs +43 -0
- package/dist/cjs/utils/composite/CompositeRoot.cjs +118 -0
- package/dist/cjs/utils/composite/grid-utils.cjs +343 -0
- package/dist/cjs/utils/composite/gridNavigation.cjs +92 -0
- package/dist/cjs/utils/composite/keys.cjs +174 -0
- package/dist/cjs/utils/composite/list-utils.cjs +90 -0
- package/dist/cjs/utils/composite/useCompositeItem.cjs +63 -0
- package/dist/cjs/utils/composite/useCompositeListItem.cjs +104 -0
- package/dist/cjs/utils/composite/useCompositeRoot.cjs +263 -0
- package/dist/cjs/utils/constants.cjs +56 -0
- package/dist/cjs/utils/contains.cjs +46 -0
- package/dist/cjs/utils/createChangeEventDetails.cjs +92 -0
- package/dist/cjs/utils/dom.cjs +35 -0
- package/dist/cjs/utils/empty.cjs +34 -0
- package/dist/cjs/utils/field/FieldItemContext.cjs +34 -0
- package/dist/cjs/utils/field/FieldRootContext.cjs +80 -0
- package/dist/cjs/utils/field/FormContext.cjs +41 -0
- package/dist/cjs/utils/field/LabelableContext.cjs +43 -0
- package/dist/cjs/utils/field/LabelableProvider.cjs +115 -0
- package/dist/cjs/utils/field/constants.cjs +68 -0
- package/dist/cjs/utils/field/getCombinedFieldValidityData.cjs +36 -0
- package/dist/cjs/utils/field/useAriaLabelledBy.cjs +87 -0
- package/dist/cjs/utils/field/useFieldControlRegistration.cjs +165 -0
- package/dist/cjs/utils/field/useFieldValidation.cjs +285 -0
- package/dist/cjs/utils/field/useLabel.cjs +99 -0
- package/dist/cjs/utils/field/useLabelableId.cjs +105 -0
- package/dist/cjs/utils/field/useRegisterFieldControl.cjs +60 -0
- package/dist/cjs/utils/findRootOwnerId.cjs +37 -0
- package/dist/cjs/utils/floating/FloatingDelayGroup.cjs +219 -0
- package/dist/cjs/utils/floating/FloatingFocusManager.cjs +685 -0
- package/dist/cjs/utils/floating/FloatingPortal.cjs +230 -0
- package/dist/cjs/utils/floating/FloatingRootStore.cjs +87 -0
- package/dist/cjs/utils/floating/FloatingTree.cjs +86 -0
- package/dist/cjs/utils/floating/FloatingTreeStore.cjs +41 -0
- package/dist/cjs/utils/floating/FocusGuard.cjs +54 -0
- package/dist/cjs/utils/floating/composite.cjs +42 -0
- package/dist/cjs/utils/floating/constants.cjs +34 -0
- package/dist/cjs/utils/floating/createAttribute.cjs +30 -0
- package/dist/cjs/utils/floating/createEventEmitter.cjs +44 -0
- package/dist/cjs/utils/floating/element.cjs +103 -0
- package/dist/cjs/utils/floating/enqueueFocus.cjs +51 -0
- package/dist/cjs/utils/floating/event.cjs +65 -0
- package/dist/cjs/utils/floating/getEmptyRootContext.cjs +42 -0
- package/dist/cjs/utils/floating/gridNavigation.cjs +45 -0
- package/dist/cjs/utils/floating/markOthers.cjs +181 -0
- package/dist/cjs/utils/floating/nodes.cjs +48 -0
- package/dist/cjs/utils/floating/safePolygon.cjs +301 -0
- package/dist/cjs/utils/floating/tabbable.cjs +242 -0
- package/dist/cjs/utils/floating/types.cjs +16 -0
- package/dist/cjs/utils/floating/useClick.cjs +153 -0
- package/dist/cjs/utils/floating/useClientPoint.cjs +225 -0
- package/dist/cjs/utils/floating/useDismiss.cjs +506 -0
- package/dist/cjs/utils/floating/useFloating.cjs +186 -0
- package/dist/cjs/utils/floating/useFloatingRootContext.cjs +75 -0
- package/dist/cjs/utils/floating/useFocus.cjs +184 -0
- package/dist/cjs/utils/floating/useHoverFloatingInteraction.cjs +231 -0
- package/dist/cjs/utils/floating/useHoverInteractionSharedState.cjs +113 -0
- package/dist/cjs/utils/floating/useHoverReferenceInteraction.cjs +380 -0
- package/dist/cjs/utils/floating/useHoverShared.cjs +65 -0
- package/dist/cjs/utils/floating/useListNavigation.cjs +665 -0
- package/dist/cjs/utils/floating/useSyncedFloatingRootContext.cjs +91 -0
- package/dist/cjs/utils/floating/useTypeahead.cjs +187 -0
- package/dist/cjs/utils/formatNumber.cjs +60 -0
- package/dist/cjs/utils/generateId.cjs +32 -0
- package/dist/cjs/utils/getCssDimensions.cjs +42 -0
- package/dist/cjs/utils/getDefaultFormSubmitter.cjs +42 -0
- package/dist/cjs/utils/getDisabledMountTransitionStyles.cjs +32 -0
- package/dist/cjs/utils/getElementRef.cjs +35 -0
- package/dist/cjs/utils/getPseudoElementBounds.cjs +56 -0
- package/dist/cjs/utils/getStateAttributesProps.cjs +46 -0
- package/dist/cjs/utils/hideMiddleware.cjs +42 -0
- package/dist/cjs/utils/inertValue.cjs +30 -0
- package/dist/cjs/utils/matchesFocusVisible.cjs +38 -0
- package/dist/cjs/utils/mergeCleanups.cjs +37 -0
- package/dist/cjs/utils/mergeObjects.cjs +39 -0
- package/dist/cjs/utils/mergeProps.cjs +182 -0
- package/dist/cjs/utils/noop.cjs +29 -0
- package/dist/cjs/utils/number/constants.cjs +34 -0
- package/dist/cjs/utils/number/parse.cjs +258 -0
- package/dist/cjs/utils/number/types.cjs +16 -0
- package/dist/cjs/utils/number/validate.cjs +104 -0
- package/dist/cjs/utils/owner.cjs +35 -0
- package/dist/cjs/utils/platform.cjs +83 -0
- package/dist/cjs/utils/popupStateMapping.cjs +74 -0
- package/dist/cjs/utils/popups/index.cjs +39 -0
- package/dist/cjs/utils/popups/inlineRect.cjs +218 -0
- package/dist/cjs/utils/popups/popupStoreUtils.cjs +379 -0
- package/dist/cjs/utils/popups/popupTriggerMap.cjs +76 -0
- package/dist/cjs/utils/popups/store.cjs +118 -0
- package/dist/cjs/utils/popups/useTriggerFocusGuards.cjs +72 -0
- package/dist/cjs/utils/resolveAriaLabelledBy.cjs +35 -0
- package/dist/cjs/utils/resolveClassName.cjs +30 -0
- package/dist/cjs/utils/resolveRef.cjs +33 -0
- package/dist/cjs/utils/resolveStyle.cjs +30 -0
- package/dist/cjs/utils/serializeValue.cjs +40 -0
- package/dist/cjs/utils/slider/asc.cjs +30 -0
- package/dist/cjs/utils/slider/getMidpoint.cjs +34 -0
- package/dist/cjs/utils/slider/getPushedThumbValues.cjs +73 -0
- package/dist/cjs/utils/slider/getSliderValue.cjs +42 -0
- package/dist/cjs/utils/slider/replaceArrayItemAtIndex.cjs +33 -0
- package/dist/cjs/utils/slider/resolveThumbCollision.cjs +155 -0
- package/dist/cjs/utils/slider/roundValueToStep.cjs +45 -0
- package/dist/cjs/utils/slider/validateMinimumDistance.cjs +40 -0
- package/dist/cjs/utils/slider/valueArrayToPercentages.cjs +36 -0
- package/dist/cjs/utils/store/ReactStore.cjs +135 -0
- package/dist/cjs/utils/store/Store.cjs +83 -0
- package/dist/cjs/utils/store/createSelector.cjs +74 -0
- package/dist/cjs/utils/store/useStore.cjs +51 -0
- package/dist/cjs/utils/stringifyLocale.cjs +36 -0
- package/dist/cjs/utils/useAnchorPositioning.cjs +421 -0
- package/dist/cjs/utils/useAnchoredPopupScrollLock.cjs +59 -0
- package/dist/cjs/utils/useAnimationFrame.cjs +93 -0
- package/dist/cjs/utils/useAnimationsFinished.cjs +98 -0
- package/dist/cjs/utils/useBaseUiId.cjs +36 -0
- package/dist/cjs/utils/useButton.cjs +177 -0
- package/dist/cjs/utils/useCheckboxGroupParent.cjs +114 -0
- package/dist/cjs/utils/useControlled.cjs +47 -0
- package/dist/cjs/utils/useEnhancedClickHandler.cjs +60 -0
- package/dist/cjs/utils/useFocusableWhenDisabled.cjs +77 -0
- package/dist/cjs/utils/useForcedRerendering.cjs +35 -0
- package/dist/cjs/utils/useIsHydrating.cjs +44 -0
- package/dist/cjs/utils/useMixedToggleClickHandler.cjs +66 -0
- package/dist/cjs/utils/useOnFirstRender.cjs +35 -0
- package/dist/cjs/utils/useOnMount.cjs +36 -0
- package/dist/cjs/utils/useOpenChangeComplete.cjs +57 -0
- package/dist/cjs/utils/useOpenInteractionType.cjs +69 -0
- package/dist/cjs/utils/usePopupAutoResize.cjs +191 -0
- package/dist/cjs/utils/usePopupViewport.cjs +283 -0
- package/dist/cjs/utils/usePositioner.cjs +53 -0
- package/dist/cjs/utils/usePressAndHold.cjs +51 -0
- package/dist/cjs/utils/usePreviousValue.cjs +47 -0
- package/dist/cjs/utils/useRefWithInit.cjs +41 -0
- package/dist/cjs/utils/useRegisteredLabelId.cjs +48 -0
- package/dist/cjs/utils/useRenderElement.cjs +106 -0
- package/dist/cjs/utils/useScrollLock.cjs +232 -0
- package/dist/cjs/utils/useStableCallback.cjs +41 -0
- package/dist/cjs/utils/useTimeout.cjs +66 -0
- package/dist/cjs/utils/useTransitionStatus.cjs +116 -0
- package/dist/cjs/utils/useValueAsRef.cjs +43 -0
- package/dist/cjs/utils/useValueChanged.cjs +55 -0
- package/dist/cjs/utils/valueToPercent.cjs +30 -0
- package/dist/cjs/utils/visuallyHidden.cjs +49 -0
- package/package.json +20 -8
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var inertValue_exports = {};
|
|
20
|
+
__export(inertValue_exports, {
|
|
21
|
+
inertValue: () => inertValue
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(inertValue_exports);
|
|
24
|
+
function inertValue(value) {
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
inertValue
|
|
30
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var matchesFocusVisible_exports = {};
|
|
20
|
+
__export(matchesFocusVisible_exports, {
|
|
21
|
+
matchesFocusVisible: () => matchesFocusVisible
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(matchesFocusVisible_exports);
|
|
24
|
+
const isJSDOM = typeof navigator !== "undefined" && /jsdom/i.test(navigator.userAgent);
|
|
25
|
+
function matchesFocusVisible(element) {
|
|
26
|
+
if (!element || isJSDOM) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
return element.matches(":focus-visible");
|
|
31
|
+
} catch {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
matchesFocusVisible
|
|
38
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var mergeCleanups_exports = {};
|
|
20
|
+
__export(mergeCleanups_exports, {
|
|
21
|
+
mergeCleanups: () => mergeCleanups
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(mergeCleanups_exports);
|
|
24
|
+
function mergeCleanups(...cleanups) {
|
|
25
|
+
return () => {
|
|
26
|
+
for (let i = 0; i < cleanups.length; i += 1) {
|
|
27
|
+
const cleanup = cleanups[i];
|
|
28
|
+
if (cleanup) {
|
|
29
|
+
cleanup();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
mergeCleanups
|
|
37
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var mergeObjects_exports = {};
|
|
20
|
+
__export(mergeObjects_exports, {
|
|
21
|
+
mergeObjects: () => mergeObjects
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(mergeObjects_exports);
|
|
24
|
+
function mergeObjects(a, b) {
|
|
25
|
+
if (a && !b) {
|
|
26
|
+
return a;
|
|
27
|
+
}
|
|
28
|
+
if (!a && b) {
|
|
29
|
+
return b;
|
|
30
|
+
}
|
|
31
|
+
if (a || b) {
|
|
32
|
+
return { ...a, ...b };
|
|
33
|
+
}
|
|
34
|
+
return void 0;
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
mergeObjects
|
|
39
|
+
});
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var mergeProps_exports = {};
|
|
20
|
+
__export(mergeProps_exports, {
|
|
21
|
+
makeEventPreventable: () => makeEventPreventable,
|
|
22
|
+
mergeClassNames: () => mergeClassNames,
|
|
23
|
+
mergeProps: () => mergeProps,
|
|
24
|
+
mergePropsN: () => mergePropsN
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(mergeProps_exports);
|
|
27
|
+
var import_mergeObjects = require("./mergeObjects.cjs");
|
|
28
|
+
const EMPTY_PROPS = {};
|
|
29
|
+
function mergeProps(a, b, c, d, e) {
|
|
30
|
+
if (!c && !d && !e && !a) {
|
|
31
|
+
return createInitialMergedProps(b);
|
|
32
|
+
}
|
|
33
|
+
let merged = createInitialMergedProps(a);
|
|
34
|
+
if (b) {
|
|
35
|
+
merged = mergeInto(merged, b);
|
|
36
|
+
}
|
|
37
|
+
if (c) {
|
|
38
|
+
merged = mergeInto(merged, c);
|
|
39
|
+
}
|
|
40
|
+
if (d) {
|
|
41
|
+
merged = mergeInto(merged, d);
|
|
42
|
+
}
|
|
43
|
+
if (e) {
|
|
44
|
+
merged = mergeInto(merged, e);
|
|
45
|
+
}
|
|
46
|
+
return merged;
|
|
47
|
+
}
|
|
48
|
+
function mergePropsN(props) {
|
|
49
|
+
if (props.length === 0) {
|
|
50
|
+
return EMPTY_PROPS;
|
|
51
|
+
}
|
|
52
|
+
if (props.length === 1) {
|
|
53
|
+
return createInitialMergedProps(props[0]);
|
|
54
|
+
}
|
|
55
|
+
let merged = createInitialMergedProps(props[0]);
|
|
56
|
+
for (let i = 1; i < props.length; i += 1) {
|
|
57
|
+
merged = mergeInto(merged, props[i]);
|
|
58
|
+
}
|
|
59
|
+
return merged;
|
|
60
|
+
}
|
|
61
|
+
function createInitialMergedProps(inputProps) {
|
|
62
|
+
if (isPropsGetter(inputProps)) {
|
|
63
|
+
return { ...resolvePropsGetter(inputProps, EMPTY_PROPS) };
|
|
64
|
+
}
|
|
65
|
+
return copyInitialProps(inputProps);
|
|
66
|
+
}
|
|
67
|
+
function mergeInto(merged, inputProps) {
|
|
68
|
+
if (isPropsGetter(inputProps)) {
|
|
69
|
+
return resolvePropsGetter(inputProps, merged);
|
|
70
|
+
}
|
|
71
|
+
return mutablyMergeInto(merged, inputProps);
|
|
72
|
+
}
|
|
73
|
+
function copyInitialProps(inputProps) {
|
|
74
|
+
const copiedProps = { ...inputProps };
|
|
75
|
+
for (const propName in copiedProps) {
|
|
76
|
+
const propValue = copiedProps[propName];
|
|
77
|
+
if (isEventHandler(propName, propValue)) {
|
|
78
|
+
copiedProps[propName] = wrapEventHandler(propValue);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return copiedProps;
|
|
82
|
+
}
|
|
83
|
+
function mutablyMergeInto(mergedProps, externalProps) {
|
|
84
|
+
if (!externalProps) {
|
|
85
|
+
return mergedProps;
|
|
86
|
+
}
|
|
87
|
+
for (const propName in externalProps) {
|
|
88
|
+
const externalPropValue = externalProps[propName];
|
|
89
|
+
switch (propName) {
|
|
90
|
+
case "style": {
|
|
91
|
+
mergedProps[propName] = (0, import_mergeObjects.mergeObjects)(mergedProps.style, externalPropValue);
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
case "className": {
|
|
95
|
+
mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
default: {
|
|
99
|
+
if (isEventHandler(propName, externalPropValue)) {
|
|
100
|
+
mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
|
|
101
|
+
} else {
|
|
102
|
+
mergedProps[propName] = externalPropValue;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return mergedProps;
|
|
108
|
+
}
|
|
109
|
+
function isEventHandler(key, value) {
|
|
110
|
+
const code0 = key.charCodeAt(0);
|
|
111
|
+
const code1 = key.charCodeAt(1);
|
|
112
|
+
const code2 = key.charCodeAt(2);
|
|
113
|
+
return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
|
|
114
|
+
}
|
|
115
|
+
function isPropsGetter(inputProps) {
|
|
116
|
+
return typeof inputProps === "function";
|
|
117
|
+
}
|
|
118
|
+
function resolvePropsGetter(inputProps, previousProps) {
|
|
119
|
+
if (isPropsGetter(inputProps)) {
|
|
120
|
+
return inputProps(previousProps);
|
|
121
|
+
}
|
|
122
|
+
return inputProps ?? EMPTY_PROPS;
|
|
123
|
+
}
|
|
124
|
+
function isPreventableEvent(event) {
|
|
125
|
+
return event != null && typeof event === "object";
|
|
126
|
+
}
|
|
127
|
+
function mergeEventHandlers(ourHandler, theirHandler) {
|
|
128
|
+
if (!theirHandler) {
|
|
129
|
+
return ourHandler;
|
|
130
|
+
}
|
|
131
|
+
if (!ourHandler) {
|
|
132
|
+
return wrapEventHandler(theirHandler);
|
|
133
|
+
}
|
|
134
|
+
return (...args) => {
|
|
135
|
+
const event = args[0];
|
|
136
|
+
if (isPreventableEvent(event)) {
|
|
137
|
+
makeEventPreventable(event);
|
|
138
|
+
const result2 = theirHandler(...args);
|
|
139
|
+
if (!event.baseUIHandlerPrevented) {
|
|
140
|
+
ourHandler(...args);
|
|
141
|
+
}
|
|
142
|
+
return result2;
|
|
143
|
+
}
|
|
144
|
+
const result = theirHandler(...args);
|
|
145
|
+
ourHandler(...args);
|
|
146
|
+
return result;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function wrapEventHandler(handler) {
|
|
150
|
+
if (!handler) {
|
|
151
|
+
return handler;
|
|
152
|
+
}
|
|
153
|
+
return (...args) => {
|
|
154
|
+
const event = args[0];
|
|
155
|
+
if (isPreventableEvent(event)) {
|
|
156
|
+
makeEventPreventable(event);
|
|
157
|
+
}
|
|
158
|
+
return handler(...args);
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function makeEventPreventable(event) {
|
|
162
|
+
event.preventBaseUIHandler = () => {
|
|
163
|
+
event.baseUIHandlerPrevented = true;
|
|
164
|
+
};
|
|
165
|
+
return event;
|
|
166
|
+
}
|
|
167
|
+
function mergeClassNames(ourClassName, theirClassName) {
|
|
168
|
+
if (theirClassName) {
|
|
169
|
+
if (ourClassName) {
|
|
170
|
+
return theirClassName + " " + ourClassName;
|
|
171
|
+
}
|
|
172
|
+
return theirClassName;
|
|
173
|
+
}
|
|
174
|
+
return ourClassName;
|
|
175
|
+
}
|
|
176
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
177
|
+
0 && (module.exports = {
|
|
178
|
+
makeEventPreventable,
|
|
179
|
+
mergeClassNames,
|
|
180
|
+
mergeProps,
|
|
181
|
+
mergePropsN
|
|
182
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var noop_exports = {};
|
|
20
|
+
__export(noop_exports, {
|
|
21
|
+
NOOP: () => NOOP
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(noop_exports);
|
|
24
|
+
function NOOP() {
|
|
25
|
+
}
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
NOOP
|
|
29
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var constants_exports = {};
|
|
20
|
+
__export(constants_exports, {
|
|
21
|
+
CHANGE_VALUE_TICK_DELAY: () => CHANGE_VALUE_TICK_DELAY,
|
|
22
|
+
SCROLLING_POINTER_MOVE_DISTANCE: () => SCROLLING_POINTER_MOVE_DISTANCE,
|
|
23
|
+
START_AUTO_CHANGE_DELAY: () => START_AUTO_CHANGE_DELAY
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(constants_exports);
|
|
26
|
+
const CHANGE_VALUE_TICK_DELAY = 60;
|
|
27
|
+
const START_AUTO_CHANGE_DELAY = 400;
|
|
28
|
+
const SCROLLING_POINTER_MOVE_DISTANCE = 8;
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
CHANGE_VALUE_TICK_DELAY,
|
|
32
|
+
SCROLLING_POINTER_MOVE_DISTANCE,
|
|
33
|
+
START_AUTO_CHANGE_DELAY
|
|
34
|
+
});
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var parse_exports = {};
|
|
20
|
+
__export(parse_exports, {
|
|
21
|
+
ANY_MINUS_DETECT_RE: () => ANY_MINUS_DETECT_RE,
|
|
22
|
+
ANY_MINUS_RE: () => ANY_MINUS_RE,
|
|
23
|
+
ANY_PLUS_DETECT_RE: () => ANY_PLUS_DETECT_RE,
|
|
24
|
+
ANY_PLUS_RE: () => ANY_PLUS_RE,
|
|
25
|
+
ARABIC_DETECT_RE: () => ARABIC_DETECT_RE,
|
|
26
|
+
ARABIC_NUMERALS: () => ARABIC_NUMERALS,
|
|
27
|
+
ARABIC_RE: () => ARABIC_RE,
|
|
28
|
+
BASE_NON_NUMERIC_SYMBOLS: () => BASE_NON_NUMERIC_SYMBOLS,
|
|
29
|
+
FULLWIDTH_DECIMAL: () => FULLWIDTH_DECIMAL,
|
|
30
|
+
FULLWIDTH_DETECT_RE: () => FULLWIDTH_DETECT_RE,
|
|
31
|
+
FULLWIDTH_GROUP: () => FULLWIDTH_GROUP,
|
|
32
|
+
FULLWIDTH_NUMERALS: () => FULLWIDTH_NUMERALS,
|
|
33
|
+
FULLWIDTH_RE: () => FULLWIDTH_RE,
|
|
34
|
+
HAN_DETECT_RE: () => HAN_DETECT_RE,
|
|
35
|
+
HAN_NUMERALS: () => HAN_NUMERALS,
|
|
36
|
+
HAN_NUMERAL_TO_DIGIT: () => HAN_NUMERAL_TO_DIGIT,
|
|
37
|
+
HAN_RE: () => HAN_RE,
|
|
38
|
+
MINUS_SIGNS_WITH_ASCII: () => MINUS_SIGNS_WITH_ASCII,
|
|
39
|
+
PERCENTAGES: () => PERCENTAGES,
|
|
40
|
+
PERCENT_RE: () => PERCENT_RE,
|
|
41
|
+
PERMILLE: () => PERMILLE,
|
|
42
|
+
PERMILLE_RE: () => PERMILLE_RE,
|
|
43
|
+
PERSIAN_DETECT_RE: () => PERSIAN_DETECT_RE,
|
|
44
|
+
PERSIAN_NUMERALS: () => PERSIAN_NUMERALS,
|
|
45
|
+
PERSIAN_RE: () => PERSIAN_RE,
|
|
46
|
+
PLUS_SIGNS_WITH_ASCII: () => PLUS_SIGNS_WITH_ASCII,
|
|
47
|
+
SPACE_SEPARATOR_RE: () => SPACE_SEPARATOR_RE,
|
|
48
|
+
UNICODE_MINUS_SIGNS: () => UNICODE_MINUS_SIGNS,
|
|
49
|
+
UNICODE_PLUS_SIGNS: () => UNICODE_PLUS_SIGNS,
|
|
50
|
+
getNumberLocaleDetails: () => getNumberLocaleDetails,
|
|
51
|
+
isNumeralChar: () => isNumeralChar,
|
|
52
|
+
parseNumber: () => parseNumber
|
|
53
|
+
});
|
|
54
|
+
module.exports = __toCommonJS(parse_exports);
|
|
55
|
+
var import_formatNumber = require("../formatNumber.cjs");
|
|
56
|
+
const HAN_NUMERALS = ["\u96F6", "\u3007", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D", "\u4E03", "\u516B", "\u4E5D"];
|
|
57
|
+
const HAN_NUMERAL_TO_DIGIT = {
|
|
58
|
+
\u96F6: "0",
|
|
59
|
+
"\u3007": "0",
|
|
60
|
+
\u4E00: "1",
|
|
61
|
+
\u4E8C: "2",
|
|
62
|
+
\u4E09: "3",
|
|
63
|
+
\u56DB: "4",
|
|
64
|
+
\u4E94: "5",
|
|
65
|
+
\u516D: "6",
|
|
66
|
+
\u4E03: "7",
|
|
67
|
+
\u516B: "8",
|
|
68
|
+
\u4E5D: "9"
|
|
69
|
+
};
|
|
70
|
+
const ARABIC_NUMERALS = ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"];
|
|
71
|
+
const PERSIAN_NUMERALS = ["\u06F0", "\u06F1", "\u06F2", "\u06F3", "\u06F4", "\u06F5", "\u06F6", "\u06F7", "\u06F8", "\u06F9"];
|
|
72
|
+
const FULLWIDTH_NUMERALS = ["\uFF10", "\uFF11", "\uFF12", "\uFF13", "\uFF14", "\uFF15", "\uFF16", "\uFF17", "\uFF18", "\uFF19"];
|
|
73
|
+
const PERCENTAGES = ["%", "\u066A", "\uFF05", "\uFE6A"];
|
|
74
|
+
const PERMILLE = ["\u2030", "\u0609"];
|
|
75
|
+
const UNICODE_MINUS_SIGNS = ["\u2212", "\uFF0D", "\u2012", "\u2013", "\u2014", "\uFE63"];
|
|
76
|
+
const UNICODE_PLUS_SIGNS = ["\uFF0B", "\uFE62"];
|
|
77
|
+
const FULLWIDTH_DECIMAL = "\uFF0E";
|
|
78
|
+
const FULLWIDTH_GROUP = "\uFF0C";
|
|
79
|
+
const ARABIC_RE = new RegExp(`[${ARABIC_NUMERALS.join("")}]`, "g");
|
|
80
|
+
const PERSIAN_RE = new RegExp(`[${PERSIAN_NUMERALS.join("")}]`, "g");
|
|
81
|
+
const FULLWIDTH_RE = new RegExp(`[${FULLWIDTH_NUMERALS.join("")}]`, "g");
|
|
82
|
+
const HAN_RE = new RegExp(`[${HAN_NUMERALS.join("")}]`, "g");
|
|
83
|
+
const PERCENT_RE = new RegExp(`[${PERCENTAGES.join("")}]`);
|
|
84
|
+
const PERMILLE_RE = new RegExp(`[${PERMILLE.join("")}]`);
|
|
85
|
+
const PERCENT_GLOBAL_RE = new RegExp(PERCENT_RE.source, "g");
|
|
86
|
+
const PERMILLE_GLOBAL_RE = new RegExp(PERMILLE_RE.source, "g");
|
|
87
|
+
const ARABIC_DETECT_RE = new RegExp(`[${ARABIC_NUMERALS.join("")}]`);
|
|
88
|
+
const PERSIAN_DETECT_RE = new RegExp(`[${PERSIAN_NUMERALS.join("")}]`);
|
|
89
|
+
const HAN_DETECT_RE = new RegExp(`[${HAN_NUMERALS.join("")}]`);
|
|
90
|
+
const FULLWIDTH_DETECT_RE = new RegExp(`[${FULLWIDTH_NUMERALS.join("")}]`);
|
|
91
|
+
function isNumeralChar(char) {
|
|
92
|
+
return char >= "0" && char <= "9" || ARABIC_DETECT_RE.test(char) || PERSIAN_DETECT_RE.test(char) || HAN_DETECT_RE.test(char) || FULLWIDTH_DETECT_RE.test(char);
|
|
93
|
+
}
|
|
94
|
+
const BASE_NON_NUMERIC_SYMBOLS = [
|
|
95
|
+
".",
|
|
96
|
+
",",
|
|
97
|
+
FULLWIDTH_DECIMAL,
|
|
98
|
+
FULLWIDTH_GROUP,
|
|
99
|
+
"\u066B",
|
|
100
|
+
"\u066C"
|
|
101
|
+
];
|
|
102
|
+
const SPACE_SEPARATOR_RE = new RegExp("\\p{Zs}", "u");
|
|
103
|
+
const PLUS_SIGNS_WITH_ASCII = ["+", ...UNICODE_PLUS_SIGNS];
|
|
104
|
+
const MINUS_SIGNS_WITH_ASCII = ["-", ...UNICODE_MINUS_SIGNS];
|
|
105
|
+
const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
106
|
+
const escapeClassChar = (s) => s.replace(/[-\\\]^]/g, (m) => `\\${m}`);
|
|
107
|
+
function shiftDecimal(value, exponentDelta) {
|
|
108
|
+
const [coefficient, exponent = "0"] = String(value).split("e");
|
|
109
|
+
return Number(`${coefficient}e${Number(exponent) + exponentDelta}`);
|
|
110
|
+
}
|
|
111
|
+
const charClassFrom = (chars) => `[${chars.map(escapeClassChar).join("")}]`;
|
|
112
|
+
const ANY_MINUS_CLASS = charClassFrom(["-"].concat(UNICODE_MINUS_SIGNS));
|
|
113
|
+
const ANY_PLUS_CLASS = charClassFrom(["+"].concat(UNICODE_PLUS_SIGNS));
|
|
114
|
+
const ANY_MINUS_RE = new RegExp(ANY_MINUS_CLASS, "gu");
|
|
115
|
+
const ANY_PLUS_RE = new RegExp(ANY_PLUS_CLASS, "gu");
|
|
116
|
+
const ANY_MINUS_DETECT_RE = new RegExp(ANY_MINUS_CLASS);
|
|
117
|
+
const ANY_PLUS_DETECT_RE = new RegExp(ANY_PLUS_CLASS);
|
|
118
|
+
function getNumberLocaleDetails(locale, options) {
|
|
119
|
+
const parts = (0, import_formatNumber.getFormatter)(locale, options).formatToParts(11111.1);
|
|
120
|
+
const result = {};
|
|
121
|
+
parts.forEach((part) => {
|
|
122
|
+
result[part.type] = part.value;
|
|
123
|
+
});
|
|
124
|
+
(0, import_formatNumber.getFormatter)(locale).formatToParts(0.1).forEach((part) => {
|
|
125
|
+
if (part.type === "decimal") {
|
|
126
|
+
result[part.type] = part.value;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
return result;
|
|
130
|
+
}
|
|
131
|
+
function parseNumber(formattedNumber, locale, options) {
|
|
132
|
+
if (formattedNumber == null) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
let input = String(formattedNumber).replace(new RegExp("\\p{Cf}", "gu"), "").trim();
|
|
136
|
+
input = input.replace(ANY_MINUS_RE, "-").replace(ANY_PLUS_RE, "+");
|
|
137
|
+
let isNegative = false;
|
|
138
|
+
const trailing = input.match(/([+-])\s*$/);
|
|
139
|
+
if (trailing) {
|
|
140
|
+
if (trailing[1] === "-") {
|
|
141
|
+
isNegative = true;
|
|
142
|
+
}
|
|
143
|
+
input = input.replace(/([+-])\s*$/, "");
|
|
144
|
+
}
|
|
145
|
+
const leading = input.match(/^\s*([+-])/);
|
|
146
|
+
if (leading) {
|
|
147
|
+
if (leading[1] === "-") {
|
|
148
|
+
isNegative = true;
|
|
149
|
+
}
|
|
150
|
+
input = input.replace(/^\s*[+-]/, "");
|
|
151
|
+
}
|
|
152
|
+
let computedLocale = locale;
|
|
153
|
+
if (computedLocale === void 0) {
|
|
154
|
+
if (ARABIC_DETECT_RE.test(input) || PERSIAN_DETECT_RE.test(input)) {
|
|
155
|
+
computedLocale = "ar";
|
|
156
|
+
} else if (HAN_DETECT_RE.test(input)) {
|
|
157
|
+
computedLocale = "zh";
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const { group, decimal, currency, exponentSeparator } = getNumberLocaleDetails(
|
|
161
|
+
computedLocale,
|
|
162
|
+
options
|
|
163
|
+
);
|
|
164
|
+
const unitParts = (0, import_formatNumber.getFormatter)(computedLocale, options).formatToParts(1).filter((p) => p.type === "unit").map((p) => escapeRegExp(p.value));
|
|
165
|
+
const unitRegex = unitParts.length ? new RegExp(unitParts.join("|"), "g") : null;
|
|
166
|
+
let groupRegex = null;
|
|
167
|
+
if (group) {
|
|
168
|
+
const isSpaceGroup = new RegExp("\\p{Zs}", "u").test(group);
|
|
169
|
+
const isApostropheGroup = group === "'" || group === "\u2019";
|
|
170
|
+
if (isSpaceGroup) {
|
|
171
|
+
groupRegex = new RegExp("\\p{Zs}", "gu");
|
|
172
|
+
} else if (isApostropheGroup) {
|
|
173
|
+
groupRegex = /['’]/g;
|
|
174
|
+
} else {
|
|
175
|
+
groupRegex = new RegExp(escapeRegExp(group), "g");
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
const replacements = [
|
|
179
|
+
{ regex: groupRegex, replacement: "" },
|
|
180
|
+
{ regex: decimal ? new RegExp(escapeRegExp(decimal), "g") : null, replacement: "." },
|
|
181
|
+
{ regex: /./g, replacement: "." },
|
|
182
|
+
{ regex: /,/g, replacement: "" },
|
|
183
|
+
{ regex: /٫/g, replacement: "." },
|
|
184
|
+
{ regex: /٬/g, replacement: "" },
|
|
185
|
+
{ regex: currency ? new RegExp(escapeRegExp(currency), "g") : null, replacement: "" },
|
|
186
|
+
{ regex: unitRegex, replacement: "" },
|
|
187
|
+
{ regex: PERCENT_GLOBAL_RE, replacement: "" },
|
|
188
|
+
{ regex: PERMILLE_GLOBAL_RE, replacement: "" },
|
|
189
|
+
{
|
|
190
|
+
regex: exponentSeparator ? new RegExp(escapeRegExp(exponentSeparator), "g") : null,
|
|
191
|
+
replacement: "e"
|
|
192
|
+
},
|
|
193
|
+
{ regex: ARABIC_RE, replacement: (ch) => String(ARABIC_NUMERALS.indexOf(ch)) },
|
|
194
|
+
{ regex: PERSIAN_RE, replacement: (ch) => String(PERSIAN_NUMERALS.indexOf(ch)) },
|
|
195
|
+
{ regex: FULLWIDTH_RE, replacement: (ch) => String(FULLWIDTH_NUMERALS.indexOf(ch)) },
|
|
196
|
+
{ regex: HAN_RE, replacement: (ch) => HAN_NUMERAL_TO_DIGIT[ch] }
|
|
197
|
+
];
|
|
198
|
+
let unformatted = replacements.reduce((acc, { regex, replacement }) => {
|
|
199
|
+
return regex ? acc.replace(regex, replacement) : acc;
|
|
200
|
+
}, input);
|
|
201
|
+
const lastDot = unformatted.lastIndexOf(".");
|
|
202
|
+
if (lastDot !== -1) {
|
|
203
|
+
unformatted = `${unformatted.slice(0, lastDot).replace(/\./g, "")}.${unformatted.slice(lastDot + 1).replace(/\./g, "")}`;
|
|
204
|
+
}
|
|
205
|
+
if (/^[-+]?Infinity$/i.test(input) || input.includes("\u221E")) {
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
const parseTarget = (isNegative ? "-" : "") + unformatted;
|
|
209
|
+
let num = parseFloat(parseTarget);
|
|
210
|
+
const style = options?.style;
|
|
211
|
+
const isUnitPercent = style === "unit" && options?.unit === "percent";
|
|
212
|
+
const hasPercentSymbol = PERCENT_RE.test(formattedNumber) || style === "percent";
|
|
213
|
+
const hasPermilleSymbol = PERMILLE_RE.test(formattedNumber);
|
|
214
|
+
if (hasPermilleSymbol) {
|
|
215
|
+
num = shiftDecimal(num, -3);
|
|
216
|
+
} else if (!isUnitPercent && hasPercentSymbol) {
|
|
217
|
+
num = shiftDecimal(num, -2);
|
|
218
|
+
}
|
|
219
|
+
if (!Number.isFinite(num)) {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
return num;
|
|
223
|
+
}
|
|
224
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
225
|
+
0 && (module.exports = {
|
|
226
|
+
ANY_MINUS_DETECT_RE,
|
|
227
|
+
ANY_MINUS_RE,
|
|
228
|
+
ANY_PLUS_DETECT_RE,
|
|
229
|
+
ANY_PLUS_RE,
|
|
230
|
+
ARABIC_DETECT_RE,
|
|
231
|
+
ARABIC_NUMERALS,
|
|
232
|
+
ARABIC_RE,
|
|
233
|
+
BASE_NON_NUMERIC_SYMBOLS,
|
|
234
|
+
FULLWIDTH_DECIMAL,
|
|
235
|
+
FULLWIDTH_DETECT_RE,
|
|
236
|
+
FULLWIDTH_GROUP,
|
|
237
|
+
FULLWIDTH_NUMERALS,
|
|
238
|
+
FULLWIDTH_RE,
|
|
239
|
+
HAN_DETECT_RE,
|
|
240
|
+
HAN_NUMERALS,
|
|
241
|
+
HAN_NUMERAL_TO_DIGIT,
|
|
242
|
+
HAN_RE,
|
|
243
|
+
MINUS_SIGNS_WITH_ASCII,
|
|
244
|
+
PERCENTAGES,
|
|
245
|
+
PERCENT_RE,
|
|
246
|
+
PERMILLE,
|
|
247
|
+
PERMILLE_RE,
|
|
248
|
+
PERSIAN_DETECT_RE,
|
|
249
|
+
PERSIAN_NUMERALS,
|
|
250
|
+
PERSIAN_RE,
|
|
251
|
+
PLUS_SIGNS_WITH_ASCII,
|
|
252
|
+
SPACE_SEPARATOR_RE,
|
|
253
|
+
UNICODE_MINUS_SIGNS,
|
|
254
|
+
UNICODE_PLUS_SIGNS,
|
|
255
|
+
getNumberLocaleDetails,
|
|
256
|
+
isNumeralChar,
|
|
257
|
+
parseNumber
|
|
258
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|