@eightshift/ui-components 1.6.1 → 1.7.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/Button-VbCAu4hd.js +185 -0
- package/dist/{intlStrings-BxJIrC6b.js → Color-BpLubxWI.js} +2394 -2394
- package/dist/{ColorSwatch-BNX2quma.js → ColorSwatch-CinC14s3.js} +4 -4
- package/dist/{Dialog-BdtBguys.js → Dialog-BN5EE7UH.js} +9 -9
- package/dist/{FieldError-ClB3-XvF.js → FieldError-BttM1Nxd.js} +2 -2
- package/dist/{FocusScope-B5L3qI3N.js → FocusScope-CtCX0OGo.js} +2 -2
- package/dist/{Group-ubPTwji_.js → Group-XzWUooix.js} +3 -3
- package/dist/{Heading-DGnF6JDc.js → Heading-DZelepHV.js} +1 -1
- package/dist/{Hidden-CupIZhlF.js → Hidden-CcFqOzrp.js} +1 -1
- package/dist/{Input-BoNEjaXM.js → Input-CV1qVS6t.js} +8 -8
- package/dist/{Label-BqW0M3HN.js → Label-BwqMVkuV.js} +2 -2
- package/dist/{ListBox-civ86c_v.js → ListBox-DuZPdnkk.js} +16 -12
- package/dist/{SelectionManager-Ctbzoj1E.js → SelectionManager-x27KqnAT.js} +67 -34
- package/dist/{Separator-CDhAddZc.js → Separator-BM58t3PP.js} +24 -26
- package/dist/{Slider-Dkj8Slw3.js → Slider-D9Cs6yKr.js} +162 -162
- package/dist/{Text-CdwRBXol.js → Text-BVIXT8qq.js} +1 -1
- package/dist/{VisuallyHidden-DsMLX-RC.js → VisuallyHidden-WhC7vZaL.js} +2 -2
- package/dist/assets/style.css +1 -1
- package/dist/components/animated-visibility/animated-visibility.js +92 -129
- package/dist/components/base-control/base-control.js +1 -1
- package/dist/components/button/button.js +6 -6
- package/dist/components/checkbox/checkbox.js +7 -7
- package/dist/components/color-pickers/color-picker.js +2 -2
- package/dist/components/color-pickers/color-swatch.js +3 -3
- package/dist/components/color-pickers/gradient-editor.js +2 -2
- package/dist/components/color-pickers/solid-color-picker.js +64 -64
- package/dist/components/component-toggle/component-toggle.js +1 -1
- package/dist/components/draggable/draggable-handle.js +2 -2
- package/dist/components/draggable/draggable.js +7 -4
- package/dist/components/draggable-list/draggable-list-item.js +2 -2
- package/dist/components/draggable-list/draggable-list.js +6 -3
- package/dist/components/expandable/expandable.js +3 -3
- package/dist/components/index.js +3 -1
- package/dist/components/input-field/input-field.js +7 -7
- package/dist/components/item-collection/item-collection.js +6 -1
- package/dist/components/link-input/link-input.js +40 -36
- package/dist/components/list-box/list-box.js +2 -2
- package/dist/components/matrix-align/matrix-align.js +2 -2
- package/dist/components/menu/menu.js +15 -15
- package/dist/components/modal/modal.js +6 -6
- package/dist/components/number-picker/number-picker.js +10 -10
- package/dist/components/option-select/option-select.js +1 -1
- package/dist/components/options-panel/options-panel.js +1 -1
- package/dist/components/placeholders/file-placeholder.js +1 -1
- package/dist/components/placeholders/media-placeholder.js +6 -5
- package/dist/components/popover/popover.js +2 -2
- package/dist/components/radio/radio.js +13 -13
- package/dist/components/repeater/repeater-item.js +1 -1
- package/dist/components/repeater/repeater.js +6 -3
- package/dist/components/responsive/mini-responsive.js +495 -0
- package/dist/components/responsive/responsive-legacy.js +2 -2
- package/dist/components/responsive/responsive.js +7 -3
- package/dist/components/responsive-preview/responsive-preview.js +1 -1
- package/dist/components/select/async-multi-select.js +1 -0
- package/dist/components/select/async-single-select.js +1 -0
- package/dist/components/select/multi-select.js +1 -0
- package/dist/components/select/single-select.js +1 -0
- package/dist/components/select/styles.js +1 -1
- package/dist/components/slider/column-config-slider.js +3 -3
- package/dist/components/slider/slider.js +3 -3
- package/dist/components/slider/utils.js +1 -1
- package/dist/components/spacer/spacer.js +3 -4
- package/dist/components/tabs/tabs.js +22 -17
- package/dist/components/toggle/switch.js +6 -6
- package/dist/components/toggle/toggle.js +1 -1
- package/dist/components/toggle-button/toggle-button.js +6 -6
- package/dist/components/tooltip/tooltip.js +3 -3
- package/dist/{context-kCEA3M_y.js → context-Cs-ZD1nu.js} +1 -1
- package/dist/{default-i18n-BqWys-1G.js → default-i18n-DRnM8y4w.js} +45 -21
- package/dist/{focusSafely-xMzk3syC.js → focusSafely-CgFLw4FA.js} +1 -1
- package/dist/icons/jsx-svg.js +1 -1
- package/dist/index.js +3 -1
- package/dist/{number-CHmNj-oR.js → number-GajL10e1.js} +2 -2
- package/dist/{react-jsx-parser.min-sPC96O_U.js → react-jsx-parser.min-B5HVwW_W.js} +103 -53
- package/dist/{textSelection-D5Bit8i8.js → textSelection-CvK0YHTZ.js} +1 -1
- package/dist/{tooltip-srrt1p-b.js → tooltip-eKaARDoV.js} +5 -5
- package/dist/{useButton-6H5k2W5N.js → useButton-Cy9eEev7.js} +3 -3
- package/dist/{useEvent-BY-3vfxa.js → useEvent-LZebwyrb.js} +1 -1
- package/dist/{useFocusRing-rz8eyzby.js → useFocusRing-BMOTWmOx.js} +1 -1
- package/dist/{useFocusable-Bu2Ovohk.js → useFocusable-ByyKSVQv.js} +2 -2
- package/dist/{useFormReset-fUHUaaR6.js → useFormReset-B8m1uz1J.js} +1 -1
- package/dist/{useFormValidationState-DAan_XbC.js → useFormValidationState-BjMhz_VI.js} +2 -2
- package/dist/{useLabel-Bk7iP__W.js → useLabel-B6uO0wVK.js} +2 -2
- package/dist/{useLabels-DmsOywGg.js → useLabels-5dFkeiXx.js} +1 -1
- package/dist/{useListState-GXSJsAgz.js → useListState-eKxv7HPC.js} +28 -16
- package/dist/{useLocalizedStringFormatter-m03yY3xi.js → useLocalizedStringFormatter-BaKmjFNp.js} +1 -1
- package/dist/{useMenuTrigger-CT2-BFLo.js → useMenuTrigger-4fwEmto8.js} +4 -4
- package/dist/{useNumberFieldState-CpmU88xz.js → useNumberField-DMMUTZ-h.js} +169 -169
- package/dist/{useNumberFormatter-B-20GQ2u.js → useNumberFormatter-Cyx5Dxkf.js} +1 -1
- package/dist/{usePress-Cs8K7gKw.js → usePress-D8nPoIQm.js} +22 -10
- package/dist/{useSingleSelectListState-C1ddMCq3.js → useSingleSelectListState-CABciySJ.js} +3 -2
- package/dist/{useToggle-Cn2nQUNS.js → useToggle-BmltE9Zr.js} +4 -4
- package/dist/{useToggleState-Dj0JhD9W.js → useToggleState-DZXLEnA_.js} +1 -1
- package/dist/{utils-Du2x3YVu.js → utils-BCJajCwh.js} +15 -7
- package/package.json +18 -18
- package/dist/Button-CYX0D6At.js +0 -55
- package/dist/LiveAnnouncer-D8h-3GrG.js +0 -63
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as $3ef42575df84b30b$export$9d1611c77c2fe928 } from "./utils-
|
|
1
|
+
import { c as $3ef42575df84b30b$export$9d1611c77c2fe928 } from "./utils-BCJajCwh.js";
|
|
2
2
|
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-EDDcM64A.js";
|
|
3
|
-
import { $ as $e6afbd83fe6ebbd2$export$4c014de7c8940b4c } from "./useFocusable-
|
|
4
|
-
import { $ as $f6c31cce2adf654f$export$45712eceda6fad21 } from "./usePress-
|
|
3
|
+
import { $ as $e6afbd83fe6ebbd2$export$4c014de7c8940b4c } from "./useFocusable-ByyKSVQv.js";
|
|
4
|
+
import { $ as $f6c31cce2adf654f$export$45712eceda6fad21 } from "./usePress-D8nPoIQm.js";
|
|
5
5
|
function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
|
|
6
6
|
let {
|
|
7
7
|
elementType = "button",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as $8ae05eaa5c114e9c$export$7f54fc3180508a52 } from "./utils-
|
|
1
|
+
import { f as $8ae05eaa5c114e9c$export$7f54fc3180508a52 } from "./utils-BCJajCwh.js";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
3
|
function $e9faafb641e167db$export$90fc3a17d93f704c(ref, event, handler, options) {
|
|
4
4
|
let handleEvent = $8ae05eaa5c114e9c$export$7f54fc3180508a52(handler);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as $507fabe10e71c6fb$export$b9b3dfddab17db27, b as $507fabe10e71c6fb$export$ec71b4b83ac08ec3, c as $a1ea59d68270f0dd$export$f8168d8dd8fd66e6, d as $9ab94262bd0047c7$export$420e68273165f4ec } from "./focusSafely-
|
|
1
|
+
import { a as $507fabe10e71c6fb$export$b9b3dfddab17db27, b as $507fabe10e71c6fb$export$ec71b4b83ac08ec3, c as $a1ea59d68270f0dd$export$f8168d8dd8fd66e6, d as $9ab94262bd0047c7$export$420e68273165f4ec } from "./focusSafely-CgFLw4FA.js";
|
|
2
2
|
import { useRef, useState, useCallback } from "react";
|
|
3
3
|
function $f7dceffc5ad7768b$export$4e328f61c538687f(props = {}) {
|
|
4
4
|
let { autoFocus = false, isTextInput, within } = props;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as $a1ea59d68270f0dd$export$f8168d8dd8fd66e6, h as $6a99195332edec8b$export$80f3e147d781571c, l as $e7801be82b4b2a53$export$4debdb1a3f0fa79e } from "./focusSafely-
|
|
2
|
-
import { l as $df56164dff5785e2$export$4338b53315abf666, c as $3ef42575df84b30b$export$9d1611c77c2fe928 } from "./utils-
|
|
1
|
+
import { c as $a1ea59d68270f0dd$export$f8168d8dd8fd66e6, h as $6a99195332edec8b$export$80f3e147d781571c, l as $e7801be82b4b2a53$export$4debdb1a3f0fa79e } from "./focusSafely-CgFLw4FA.js";
|
|
2
|
+
import { l as $df56164dff5785e2$export$4338b53315abf666, c as $3ef42575df84b30b$export$9d1611c77c2fe928 } from "./utils-BCJajCwh.js";
|
|
3
3
|
import React__default, { useRef, useEffect, useContext } from "react";
|
|
4
4
|
function $93925083ecbb358c$export$48d1ea6320830260(handler) {
|
|
5
5
|
if (!handler) return void 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as $8ae05eaa5c114e9c$export$7f54fc3180508a52 } from "./utils-
|
|
1
|
+
import { f as $8ae05eaa5c114e9c$export$7f54fc3180508a52 } from "./utils-BCJajCwh.js";
|
|
2
2
|
import { useRef, useEffect } from "react";
|
|
3
3
|
function $99facab73266f662$export$5add1d006293d136(ref, initialValue, onReset) {
|
|
4
4
|
let resetValue = useRef(initialValue);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as $507fabe10e71c6fb$export$8397ddfc504fdb9a } from "./focusSafely-
|
|
1
|
+
import { i as $507fabe10e71c6fb$export$8397ddfc504fdb9a } from "./focusSafely-CgFLw4FA.js";
|
|
2
2
|
import { useEffect, createContext, useMemo, useContext, useState, useRef } from "react";
|
|
3
|
-
import { j as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, f as $8ae05eaa5c114e9c$export$7f54fc3180508a52 } from "./utils-
|
|
3
|
+
import { j as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, f as $8ae05eaa5c114e9c$export$7f54fc3180508a52 } from "./utils-BCJajCwh.js";
|
|
4
4
|
function $e93e671b31057976$export$b8473d3665f3a75a(props, state, ref) {
|
|
5
5
|
let { validationBehavior, focus } = props;
|
|
6
6
|
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as $bdb11010cef70236$export$f680877a34711e37 } from "./utils-
|
|
2
|
-
import { $ as $313b98861ee5dd6c$export$d6875122194c7b44 } from "./useLabels-
|
|
1
|
+
import { e as $bdb11010cef70236$export$f680877a34711e37 } from "./utils-BCJajCwh.js";
|
|
2
|
+
import { $ as $313b98861ee5dd6c$export$d6875122194c7b44 } from "./useLabels-5dFkeiXx.js";
|
|
3
3
|
function $d191a55c9702f145$export$8467354a121f1b9f(props) {
|
|
4
4
|
let { id, label, "aria-labelledby": ariaLabelledby, "aria-label": ariaLabel, labelElementType = "label" } = props;
|
|
5
5
|
id = $bdb11010cef70236$export$f680877a34711e37(id);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as $bdb11010cef70236$export$f680877a34711e37 } from "./utils-
|
|
1
|
+
import { e as $bdb11010cef70236$export$f680877a34711e37 } from "./utils-BCJajCwh.js";
|
|
2
2
|
function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
|
|
3
3
|
let { id, "aria-label": label, "aria-labelledby": labelledBy } = props;
|
|
4
4
|
id = $bdb11010cef70236$export$f680877a34711e37(id);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as $7af3f5b51489e0b5$export$253fe78d46329472, a as $7613b1592d41b092$export$6cd28814d92fa9c9, b as $d496c0a20b6e58ec$export$6c8a5aaad13c9852 } from "./SelectionManager-
|
|
1
|
+
import { $ as $7af3f5b51489e0b5$export$253fe78d46329472, a as $7613b1592d41b092$export$6cd28814d92fa9c9, b as $d496c0a20b6e58ec$export$6c8a5aaad13c9852 } from "./SelectionManager-x27KqnAT.js";
|
|
2
2
|
import { useMemo, useCallback, useRef, useEffect } from "react";
|
|
3
3
|
class $a02d57049d202695$export$d085fb9e920b5ca7 {
|
|
4
4
|
*[Symbol.iterator]() {
|
|
@@ -12,11 +12,13 @@ class $a02d57049d202695$export$d085fb9e920b5ca7 {
|
|
|
12
12
|
}
|
|
13
13
|
getKeyBefore(key) {
|
|
14
14
|
let node = this.keyMap.get(key);
|
|
15
|
-
|
|
15
|
+
var _node_prevKey;
|
|
16
|
+
return node ? (_node_prevKey = node.prevKey) !== null && _node_prevKey !== void 0 ? _node_prevKey : null : null;
|
|
16
17
|
}
|
|
17
18
|
getKeyAfter(key) {
|
|
18
19
|
let node = this.keyMap.get(key);
|
|
19
|
-
|
|
20
|
+
var _node_nextKey;
|
|
21
|
+
return node ? (_node_nextKey = node.nextKey) !== null && _node_nextKey !== void 0 ? _node_nextKey : null : null;
|
|
20
22
|
}
|
|
21
23
|
getFirstKey() {
|
|
22
24
|
return this.firstKey;
|
|
@@ -25,7 +27,8 @@ class $a02d57049d202695$export$d085fb9e920b5ca7 {
|
|
|
25
27
|
return this.lastKey;
|
|
26
28
|
}
|
|
27
29
|
getItem(key) {
|
|
28
|
-
|
|
30
|
+
var _this_keyMap_get;
|
|
31
|
+
return (_this_keyMap_get = this.keyMap.get(key)) !== null && _this_keyMap_get !== void 0 ? _this_keyMap_get : null;
|
|
29
32
|
}
|
|
30
33
|
at(idx) {
|
|
31
34
|
const keys = [
|
|
@@ -39,13 +42,15 @@ class $a02d57049d202695$export$d085fb9e920b5ca7 {
|
|
|
39
42
|
}
|
|
40
43
|
constructor(nodes) {
|
|
41
44
|
this.keyMap = /* @__PURE__ */ new Map();
|
|
45
|
+
this.firstKey = null;
|
|
46
|
+
this.lastKey = null;
|
|
42
47
|
this.iterable = nodes;
|
|
43
48
|
let visit = (node) => {
|
|
44
49
|
this.keyMap.set(node.key, node);
|
|
45
50
|
if (node.childNodes && node.type === "section") for (let child of node.childNodes) visit(child);
|
|
46
51
|
};
|
|
47
52
|
for (let node of nodes) visit(node);
|
|
48
|
-
let last;
|
|
53
|
+
let last = null;
|
|
49
54
|
let index = 0;
|
|
50
55
|
for (let [key, node] of this.keyMap) {
|
|
51
56
|
if (last) {
|
|
@@ -59,11 +64,12 @@ class $a02d57049d202695$export$d085fb9e920b5ca7 {
|
|
|
59
64
|
last = node;
|
|
60
65
|
last.nextKey = void 0;
|
|
61
66
|
}
|
|
62
|
-
|
|
67
|
+
var _last_key;
|
|
68
|
+
this.lastKey = (_last_key = last === null || last === void 0 ? void 0 : last.key) !== null && _last_key !== void 0 ? _last_key : null;
|
|
63
69
|
}
|
|
64
70
|
}
|
|
65
71
|
function $e72dd72e1c76a225$export$2f645645f7bca764(props) {
|
|
66
|
-
let { filter } = props;
|
|
72
|
+
let { filter, layoutDelegate } = props;
|
|
67
73
|
let selectionState = $7af3f5b51489e0b5$export$253fe78d46329472(props);
|
|
68
74
|
let disabledKeys = useMemo(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
|
|
69
75
|
props.disabledKeys
|
|
@@ -77,29 +83,34 @@ function $e72dd72e1c76a225$export$2f645645f7bca764(props) {
|
|
|
77
83
|
props.suppressTextValueWarning
|
|
78
84
|
]);
|
|
79
85
|
let collection = $7613b1592d41b092$export$6cd28814d92fa9c9(props, factory, context);
|
|
80
|
-
let selectionManager = useMemo(() => new $d496c0a20b6e58ec$export$6c8a5aaad13c9852(collection, selectionState
|
|
86
|
+
let selectionManager = useMemo(() => new $d496c0a20b6e58ec$export$6c8a5aaad13c9852(collection, selectionState, {
|
|
87
|
+
layoutDelegate
|
|
88
|
+
}), [
|
|
81
89
|
collection,
|
|
82
|
-
selectionState
|
|
90
|
+
selectionState,
|
|
91
|
+
layoutDelegate
|
|
83
92
|
]);
|
|
84
93
|
const cachedCollection = useRef(null);
|
|
85
94
|
useEffect(() => {
|
|
86
|
-
if (selectionState.focusedKey != null && !collection.getItem(selectionState.focusedKey)) {
|
|
95
|
+
if (selectionState.focusedKey != null && !collection.getItem(selectionState.focusedKey) && cachedCollection.current) {
|
|
87
96
|
const startItem = cachedCollection.current.getItem(selectionState.focusedKey);
|
|
88
97
|
const cachedItemNodes = [
|
|
89
98
|
...cachedCollection.current.getKeys()
|
|
90
99
|
].map((key) => {
|
|
91
100
|
const itemNode = cachedCollection.current.getItem(key);
|
|
92
|
-
return itemNode.type === "item" ? itemNode : null;
|
|
101
|
+
return (itemNode === null || itemNode === void 0 ? void 0 : itemNode.type) === "item" ? itemNode : null;
|
|
93
102
|
}).filter((node) => node !== null);
|
|
94
103
|
const itemNodes = [
|
|
95
104
|
...collection.getKeys()
|
|
96
105
|
].map((key) => {
|
|
97
106
|
const itemNode = collection.getItem(key);
|
|
98
|
-
return itemNode.type === "item" ? itemNode : null;
|
|
107
|
+
return (itemNode === null || itemNode === void 0 ? void 0 : itemNode.type) === "item" ? itemNode : null;
|
|
99
108
|
}).filter((node) => node !== null);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
109
|
+
var _cachedItemNodes_length, _itemNodes_length;
|
|
110
|
+
const diff = ((_cachedItemNodes_length = cachedItemNodes === null || cachedItemNodes === void 0 ? void 0 : cachedItemNodes.length) !== null && _cachedItemNodes_length !== void 0 ? _cachedItemNodes_length : 0) - ((_itemNodes_length = itemNodes === null || itemNodes === void 0 ? void 0 : itemNodes.length) !== null && _itemNodes_length !== void 0 ? _itemNodes_length : 0);
|
|
111
|
+
var _startItem_index, _startItem_index1, _itemNodes_length1;
|
|
112
|
+
let index = Math.min(diff > 1 ? Math.max(((_startItem_index = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index !== void 0 ? _startItem_index : 0) - diff + 1, 0) : (_startItem_index1 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index1 !== void 0 ? _startItem_index1 : 0, ((_itemNodes_length1 = itemNodes === null || itemNodes === void 0 ? void 0 : itemNodes.length) !== null && _itemNodes_length1 !== void 0 ? _itemNodes_length1 : 0) - 1);
|
|
113
|
+
let newNode = null;
|
|
103
114
|
let isReverseSearching = false;
|
|
104
115
|
while (index >= 0) {
|
|
105
116
|
if (!selectionManager.isDisabled(itemNodes[index].key)) {
|
|
@@ -109,7 +120,8 @@ function $e72dd72e1c76a225$export$2f645645f7bca764(props) {
|
|
|
109
120
|
if (index < itemNodes.length - 1 && !isReverseSearching) index++;
|
|
110
121
|
else {
|
|
111
122
|
isReverseSearching = true;
|
|
112
|
-
|
|
123
|
+
var _startItem_index2, _startItem_index3;
|
|
124
|
+
if (index > ((_startItem_index2 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index2 !== void 0 ? _startItem_index2 : 0)) index = (_startItem_index3 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index3 !== void 0 ? _startItem_index3 : 0;
|
|
113
125
|
index--;
|
|
114
126
|
}
|
|
115
127
|
}
|
package/dist/{useLocalizedStringFormatter-m03yY3xi.js → useLocalizedStringFormatter-BaKmjFNp.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-
|
|
1
|
+
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-Cs-ZD1nu.js";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
const $5b160d28a433310d$var$localeSymbol = Symbol.for("react-aria.i18n.locale");
|
|
4
4
|
const $5b160d28a433310d$var$stringsSymbol = Symbol.for("react-aria.i18n.strings");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { e as $bdb11010cef70236$export$f680877a34711e37 } from "./utils-
|
|
2
|
-
import { $ as $fca6afa0e843324b$export$f12b703ca79dfbb1 } from "./useLocalizedStringFormatter-
|
|
3
|
-
import { n as $8a26561d2877236e$export$c24ed0104d07eab9 } from "./SelectionManager-
|
|
4
|
-
import { m as $628037886ba31236$export$f9d5c8beee7d008d } from "./Dialog-
|
|
1
|
+
import { e as $bdb11010cef70236$export$f680877a34711e37 } from "./utils-BCJajCwh.js";
|
|
2
|
+
import { $ as $fca6afa0e843324b$export$f12b703ca79dfbb1 } from "./useLocalizedStringFormatter-BaKmjFNp.js";
|
|
3
|
+
import { n as $8a26561d2877236e$export$c24ed0104d07eab9 } from "./SelectionManager-x27KqnAT.js";
|
|
4
|
+
import { m as $628037886ba31236$export$f9d5c8beee7d008d } from "./Dialog-BN5EE7UH.js";
|
|
5
5
|
var $c0398ad35c3639b7$exports = {};
|
|
6
6
|
$c0398ad35c3639b7$exports = {
|
|
7
7
|
"longPressMessage": `اضغط مطولاً أو اضغط على Alt + السهم لأسفل لفتح القائمة`
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ as $
|
|
3
|
-
import {
|
|
4
|
-
import { $ as $99facab73266f662$export$5add1d006293d136 } from "./useFormReset-fUHUaaR6.js";
|
|
5
|
-
import { useCallback, useEffect, useRef, useMemo, useState } from "react";
|
|
6
|
-
import { c as $e5be200c675c3b3a$export$a763b9476acd3eb, $ as $e5be200c675c3b3a$export$fc1a364ae1f3ff10 } from "./useFormValidationState-DAan_XbC.js";
|
|
7
|
-
import { $ as $e9faafb641e167db$export$90fc3a17d93f704c } from "./useEvent-BY-3vfxa.js";
|
|
8
|
-
import { b as $2d73ec29415bd339$export$712718f7aec83d5 } from "./Input-BoNEjaXM.js";
|
|
9
|
-
import { $ as $fca6afa0e843324b$export$f12b703ca79dfbb1 } from "./useLocalizedStringFormatter-m03yY3xi.js";
|
|
10
|
-
import { $ as $a916eb452884faea$export$b7a616150fdb9f44 } from "./useNumberFormatter-B-20GQ2u.js";
|
|
11
|
-
import { a as $319e236875307eab$export$d10ae4f68404609a, $ as $319e236875307eab$export$a9b970dcc4ae71a9 } from "./LiveAnnouncer-D8h-3GrG.js";
|
|
12
|
-
import { $ as $03deb23ff14920c4$export$4eaf04e54aa8eed6 } from "./textSelection-D5Bit8i8.js";
|
|
13
|
-
import { a as $9446cca9a3875146$export$cb6e0bb50bc19463, $ as $9446cca9a3875146$export$7d15b64cf5a3a4c4 } from "./number-CHmNj-oR.js";
|
|
1
|
+
import { e as $458b0a5536c1a7cf$export$40bfa8c7b0832715, c as $a1ea59d68270f0dd$export$f8168d8dd8fd66e6, d as $9ab94262bd0047c7$export$420e68273165f4ec, x as $c87311424ea30a05$export$186c6964ca17d99, v as $c87311424ea30a05$export$a11b0059900ceec8, j as $c87311424ea30a05$export$fedb369cb70207f1 } from "./focusSafely-CgFLw4FA.js";
|
|
2
|
+
import { $ as $9446cca9a3875146$export$cb6e0bb50bc19463, a as $9446cca9a3875146$export$7d15b64cf5a3a4c4 } from "./number-GajL10e1.js";
|
|
3
|
+
import { $ as $e5be200c675c3b3a$export$fc1a364ae1f3ff10, c as $e5be200c675c3b3a$export$a763b9476acd3eb } from "./useFormValidationState-BjMhz_VI.js";
|
|
14
4
|
import { $ as $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5 } from "./NumberFormatter-U_Gx0UDq.js";
|
|
5
|
+
import { useCallback, useState, useMemo, useEffect, useRef } from "react";
|
|
6
|
+
import { f as $8ae05eaa5c114e9c$export$7f54fc3180508a52, c as $3ef42575df84b30b$export$9d1611c77c2fe928, e as $bdb11010cef70236$export$f680877a34711e37, n as $ff5963eb1fccf552$export$e08e3b67e392101e } from "./utils-BCJajCwh.js";
|
|
7
|
+
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-EDDcM64A.js";
|
|
8
|
+
import { $ as $99facab73266f662$export$5add1d006293d136 } from "./useFormReset-B8m1uz1J.js";
|
|
9
|
+
import { $ as $e9faafb641e167db$export$90fc3a17d93f704c } from "./useEvent-LZebwyrb.js";
|
|
10
|
+
import { b as $2d73ec29415bd339$export$712718f7aec83d5 } from "./Input-CV1qVS6t.js";
|
|
11
|
+
import { $ as $fca6afa0e843324b$export$f12b703ca79dfbb1 } from "./useLocalizedStringFormatter-BaKmjFNp.js";
|
|
12
|
+
import { $ as $a916eb452884faea$export$b7a616150fdb9f44 } from "./useNumberFormatter-Cyx5Dxkf.js";
|
|
13
|
+
import { c as $319e236875307eab$export$d10ae4f68404609a, b as $319e236875307eab$export$a9b970dcc4ae71a9 } from "./Button-VbCAu4hd.js";
|
|
14
|
+
import { $ as $03deb23ff14920c4$export$4eaf04e54aa8eed6 } from "./textSelection-CvK0YHTZ.js";
|
|
15
15
|
function $7d0a636d7a4dcefd$export$2123ff2b87c81ca(props, ref) {
|
|
16
16
|
let { onScroll, isDisabled } = props;
|
|
17
17
|
let onScrollHandler = useCallback((e) => {
|
|
@@ -230,6 +230,162 @@ function $6c7bd7858deea686$var$replaceAll(str, find, replace) {
|
|
|
230
230
|
function $6c7bd7858deea686$var$escapeRegex(string) {
|
|
231
231
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
232
232
|
}
|
|
233
|
+
function $de67e98908f0c6ee$export$7f629e9dc1ecf37c(props) {
|
|
234
|
+
let { minValue, maxValue, step, formatOptions, value, defaultValue = NaN, onChange, locale, isDisabled, isReadOnly } = props;
|
|
235
|
+
if (value === null) value = NaN;
|
|
236
|
+
if (value !== void 0 && !isNaN(value)) {
|
|
237
|
+
if (step !== void 0 && !isNaN(step)) value = $9446cca9a3875146$export$cb6e0bb50bc19463(value, minValue, maxValue, step);
|
|
238
|
+
else value = $9446cca9a3875146$export$7d15b64cf5a3a4c4(value, minValue, maxValue);
|
|
239
|
+
}
|
|
240
|
+
if (!isNaN(defaultValue)) {
|
|
241
|
+
if (step !== void 0 && !isNaN(step)) defaultValue = $9446cca9a3875146$export$cb6e0bb50bc19463(defaultValue, minValue, maxValue, step);
|
|
242
|
+
else defaultValue = $9446cca9a3875146$export$7d15b64cf5a3a4c4(defaultValue, minValue, maxValue);
|
|
243
|
+
}
|
|
244
|
+
let [numberValue, setNumberValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, isNaN(defaultValue) ? NaN : defaultValue, onChange);
|
|
245
|
+
let [inputValue, setInputValue] = useState(() => isNaN(numberValue) ? "" : new $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5(locale, formatOptions).format(numberValue));
|
|
246
|
+
let numberParser = useMemo(() => new $6c7bd7858deea686$export$cd11ab140839f11d(locale, formatOptions), [
|
|
247
|
+
locale,
|
|
248
|
+
formatOptions
|
|
249
|
+
]);
|
|
250
|
+
let numberingSystem = useMemo(() => numberParser.getNumberingSystem(inputValue), [
|
|
251
|
+
numberParser,
|
|
252
|
+
inputValue
|
|
253
|
+
]);
|
|
254
|
+
let formatter = useMemo(() => new $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5(locale, {
|
|
255
|
+
...formatOptions,
|
|
256
|
+
numberingSystem
|
|
257
|
+
}), [
|
|
258
|
+
locale,
|
|
259
|
+
formatOptions,
|
|
260
|
+
numberingSystem
|
|
261
|
+
]);
|
|
262
|
+
let intlOptions = useMemo(() => formatter.resolvedOptions(), [
|
|
263
|
+
formatter
|
|
264
|
+
]);
|
|
265
|
+
let format = useCallback((value2) => isNaN(value2) || value2 === null ? "" : formatter.format(value2), [
|
|
266
|
+
formatter
|
|
267
|
+
]);
|
|
268
|
+
let validation = $e5be200c675c3b3a$export$fc1a364ae1f3ff10({
|
|
269
|
+
...props,
|
|
270
|
+
value: numberValue
|
|
271
|
+
});
|
|
272
|
+
let clampStep = step !== void 0 && !isNaN(step) ? step : 1;
|
|
273
|
+
if (intlOptions.style === "percent" && (step === void 0 || isNaN(step))) clampStep = 0.01;
|
|
274
|
+
let [prevValue, setPrevValue] = useState(numberValue);
|
|
275
|
+
let [prevLocale, setPrevLocale] = useState(locale);
|
|
276
|
+
let [prevFormatOptions, setPrevFormatOptions] = useState(formatOptions);
|
|
277
|
+
if (!Object.is(numberValue, prevValue) || locale !== prevLocale || formatOptions !== prevFormatOptions) {
|
|
278
|
+
setInputValue(format(numberValue));
|
|
279
|
+
setPrevValue(numberValue);
|
|
280
|
+
setPrevLocale(locale);
|
|
281
|
+
setPrevFormatOptions(formatOptions);
|
|
282
|
+
}
|
|
283
|
+
let parsedValue = useMemo(() => numberParser.parse(inputValue), [
|
|
284
|
+
numberParser,
|
|
285
|
+
inputValue
|
|
286
|
+
]);
|
|
287
|
+
let commit = () => {
|
|
288
|
+
if (!inputValue.length) {
|
|
289
|
+
setNumberValue(NaN);
|
|
290
|
+
setInputValue(value === void 0 ? "" : format(numberValue));
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
if (isNaN(parsedValue)) {
|
|
294
|
+
setInputValue(format(numberValue));
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
let clampedValue;
|
|
298
|
+
if (step === void 0 || isNaN(step)) clampedValue = $9446cca9a3875146$export$7d15b64cf5a3a4c4(parsedValue, minValue, maxValue);
|
|
299
|
+
else clampedValue = $9446cca9a3875146$export$cb6e0bb50bc19463(parsedValue, minValue, maxValue, step);
|
|
300
|
+
clampedValue = numberParser.parse(format(clampedValue));
|
|
301
|
+
setNumberValue(clampedValue);
|
|
302
|
+
setInputValue(format(value === void 0 ? clampedValue : numberValue));
|
|
303
|
+
};
|
|
304
|
+
let safeNextStep = (operation, minMax = 0) => {
|
|
305
|
+
let prev = parsedValue;
|
|
306
|
+
if (isNaN(prev)) {
|
|
307
|
+
let newValue = isNaN(minMax) ? 0 : minMax;
|
|
308
|
+
return $9446cca9a3875146$export$cb6e0bb50bc19463(newValue, minValue, maxValue, clampStep);
|
|
309
|
+
} else {
|
|
310
|
+
let newValue = $9446cca9a3875146$export$cb6e0bb50bc19463(prev, minValue, maxValue, clampStep);
|
|
311
|
+
if (operation === "+" && newValue > prev || operation === "-" && newValue < prev) return newValue;
|
|
312
|
+
return $9446cca9a3875146$export$cb6e0bb50bc19463($de67e98908f0c6ee$var$handleDecimalOperation(operation, prev, clampStep), minValue, maxValue, clampStep);
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
let increment = () => {
|
|
316
|
+
let newValue = safeNextStep("+", minValue);
|
|
317
|
+
if (newValue === numberValue) setInputValue(format(newValue));
|
|
318
|
+
setNumberValue(newValue);
|
|
319
|
+
validation.commitValidation();
|
|
320
|
+
};
|
|
321
|
+
let decrement = () => {
|
|
322
|
+
let newValue = safeNextStep("-", maxValue);
|
|
323
|
+
if (newValue === numberValue) setInputValue(format(newValue));
|
|
324
|
+
setNumberValue(newValue);
|
|
325
|
+
validation.commitValidation();
|
|
326
|
+
};
|
|
327
|
+
let incrementToMax = () => {
|
|
328
|
+
if (maxValue != null) {
|
|
329
|
+
setNumberValue($9446cca9a3875146$export$cb6e0bb50bc19463(maxValue, minValue, maxValue, clampStep));
|
|
330
|
+
validation.commitValidation();
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
let decrementToMin = () => {
|
|
334
|
+
if (minValue != null) {
|
|
335
|
+
setNumberValue(minValue);
|
|
336
|
+
validation.commitValidation();
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
let canIncrement = useMemo(() => !isDisabled && !isReadOnly && (isNaN(parsedValue) || maxValue === void 0 || isNaN(maxValue) || $9446cca9a3875146$export$cb6e0bb50bc19463(parsedValue, minValue, maxValue, clampStep) > parsedValue || $de67e98908f0c6ee$var$handleDecimalOperation("+", parsedValue, clampStep) <= maxValue), [
|
|
340
|
+
isDisabled,
|
|
341
|
+
isReadOnly,
|
|
342
|
+
minValue,
|
|
343
|
+
maxValue,
|
|
344
|
+
clampStep,
|
|
345
|
+
parsedValue
|
|
346
|
+
]);
|
|
347
|
+
let canDecrement = useMemo(() => !isDisabled && !isReadOnly && (isNaN(parsedValue) || minValue === void 0 || isNaN(minValue) || $9446cca9a3875146$export$cb6e0bb50bc19463(parsedValue, minValue, maxValue, clampStep) < parsedValue || $de67e98908f0c6ee$var$handleDecimalOperation("-", parsedValue, clampStep) >= minValue), [
|
|
348
|
+
isDisabled,
|
|
349
|
+
isReadOnly,
|
|
350
|
+
minValue,
|
|
351
|
+
maxValue,
|
|
352
|
+
clampStep,
|
|
353
|
+
parsedValue
|
|
354
|
+
]);
|
|
355
|
+
let validate = (value2) => numberParser.isValidPartialNumber(value2, minValue, maxValue);
|
|
356
|
+
return {
|
|
357
|
+
...validation,
|
|
358
|
+
validate,
|
|
359
|
+
increment,
|
|
360
|
+
incrementToMax,
|
|
361
|
+
decrement,
|
|
362
|
+
decrementToMin,
|
|
363
|
+
canIncrement,
|
|
364
|
+
canDecrement,
|
|
365
|
+
minValue,
|
|
366
|
+
maxValue,
|
|
367
|
+
numberValue: parsedValue,
|
|
368
|
+
setNumberValue,
|
|
369
|
+
setInputValue,
|
|
370
|
+
inputValue,
|
|
371
|
+
commit
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function $de67e98908f0c6ee$var$handleDecimalOperation(operator, value1, value2) {
|
|
375
|
+
let result = operator === "+" ? value1 + value2 : value1 - value2;
|
|
376
|
+
if (value1 % 1 !== 0 || value2 % 1 !== 0) {
|
|
377
|
+
const value1Decimal = value1.toString().split(".");
|
|
378
|
+
const value2Decimal = value2.toString().split(".");
|
|
379
|
+
const value1DecimalLength = value1Decimal[1] && value1Decimal[1].length || 0;
|
|
380
|
+
const value2DecimalLength = value2Decimal[1] && value2Decimal[1].length || 0;
|
|
381
|
+
const multiplier = Math.pow(10, Math.max(value1DecimalLength, value2DecimalLength));
|
|
382
|
+
value1 = Math.round(value1 * multiplier);
|
|
383
|
+
value2 = Math.round(value2 * multiplier);
|
|
384
|
+
result = operator === "+" ? value1 + value2 : value1 - value2;
|
|
385
|
+
result /= multiplier;
|
|
386
|
+
}
|
|
387
|
+
return result;
|
|
388
|
+
}
|
|
233
389
|
function $d841c8010a73d545$var$supportsNativeBeforeInputEvent() {
|
|
234
390
|
return typeof window !== "undefined" && window.InputEvent && // @ts-ignore
|
|
235
391
|
typeof InputEvent.prototype.getTargetRanges === "function";
|
|
@@ -1032,162 +1188,6 @@ function $81397a9303501bda$export$23f548e970bdf099(props, state, inputRef) {
|
|
|
1032
1188
|
validationDetails
|
|
1033
1189
|
};
|
|
1034
1190
|
}
|
|
1035
|
-
function $de67e98908f0c6ee$export$7f629e9dc1ecf37c(props) {
|
|
1036
|
-
let { minValue, maxValue, step, formatOptions, value, defaultValue = NaN, onChange, locale, isDisabled, isReadOnly } = props;
|
|
1037
|
-
if (value === null) value = NaN;
|
|
1038
|
-
if (value !== void 0 && !isNaN(value)) {
|
|
1039
|
-
if (step !== void 0 && !isNaN(step)) value = $9446cca9a3875146$export$cb6e0bb50bc19463(value, minValue, maxValue, step);
|
|
1040
|
-
else value = $9446cca9a3875146$export$7d15b64cf5a3a4c4(value, minValue, maxValue);
|
|
1041
|
-
}
|
|
1042
|
-
if (!isNaN(defaultValue)) {
|
|
1043
|
-
if (step !== void 0 && !isNaN(step)) defaultValue = $9446cca9a3875146$export$cb6e0bb50bc19463(defaultValue, minValue, maxValue, step);
|
|
1044
|
-
else defaultValue = $9446cca9a3875146$export$7d15b64cf5a3a4c4(defaultValue, minValue, maxValue);
|
|
1045
|
-
}
|
|
1046
|
-
let [numberValue, setNumberValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, isNaN(defaultValue) ? NaN : defaultValue, onChange);
|
|
1047
|
-
let [inputValue, setInputValue] = useState(() => isNaN(numberValue) ? "" : new $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5(locale, formatOptions).format(numberValue));
|
|
1048
|
-
let numberParser = useMemo(() => new $6c7bd7858deea686$export$cd11ab140839f11d(locale, formatOptions), [
|
|
1049
|
-
locale,
|
|
1050
|
-
formatOptions
|
|
1051
|
-
]);
|
|
1052
|
-
let numberingSystem = useMemo(() => numberParser.getNumberingSystem(inputValue), [
|
|
1053
|
-
numberParser,
|
|
1054
|
-
inputValue
|
|
1055
|
-
]);
|
|
1056
|
-
let formatter = useMemo(() => new $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5(locale, {
|
|
1057
|
-
...formatOptions,
|
|
1058
|
-
numberingSystem
|
|
1059
|
-
}), [
|
|
1060
|
-
locale,
|
|
1061
|
-
formatOptions,
|
|
1062
|
-
numberingSystem
|
|
1063
|
-
]);
|
|
1064
|
-
let intlOptions = useMemo(() => formatter.resolvedOptions(), [
|
|
1065
|
-
formatter
|
|
1066
|
-
]);
|
|
1067
|
-
let format = useCallback((value2) => isNaN(value2) || value2 === null ? "" : formatter.format(value2), [
|
|
1068
|
-
formatter
|
|
1069
|
-
]);
|
|
1070
|
-
let validation = $e5be200c675c3b3a$export$fc1a364ae1f3ff10({
|
|
1071
|
-
...props,
|
|
1072
|
-
value: numberValue
|
|
1073
|
-
});
|
|
1074
|
-
let clampStep = step !== void 0 && !isNaN(step) ? step : 1;
|
|
1075
|
-
if (intlOptions.style === "percent" && (step === void 0 || isNaN(step))) clampStep = 0.01;
|
|
1076
|
-
let [prevValue, setPrevValue] = useState(numberValue);
|
|
1077
|
-
let [prevLocale, setPrevLocale] = useState(locale);
|
|
1078
|
-
let [prevFormatOptions, setPrevFormatOptions] = useState(formatOptions);
|
|
1079
|
-
if (!Object.is(numberValue, prevValue) || locale !== prevLocale || formatOptions !== prevFormatOptions) {
|
|
1080
|
-
setInputValue(format(numberValue));
|
|
1081
|
-
setPrevValue(numberValue);
|
|
1082
|
-
setPrevLocale(locale);
|
|
1083
|
-
setPrevFormatOptions(formatOptions);
|
|
1084
|
-
}
|
|
1085
|
-
let parsedValue = useMemo(() => numberParser.parse(inputValue), [
|
|
1086
|
-
numberParser,
|
|
1087
|
-
inputValue
|
|
1088
|
-
]);
|
|
1089
|
-
let commit = () => {
|
|
1090
|
-
if (!inputValue.length) {
|
|
1091
|
-
setNumberValue(NaN);
|
|
1092
|
-
setInputValue(value === void 0 ? "" : format(numberValue));
|
|
1093
|
-
return;
|
|
1094
|
-
}
|
|
1095
|
-
if (isNaN(parsedValue)) {
|
|
1096
|
-
setInputValue(format(numberValue));
|
|
1097
|
-
return;
|
|
1098
|
-
}
|
|
1099
|
-
let clampedValue;
|
|
1100
|
-
if (step === void 0 || isNaN(step)) clampedValue = $9446cca9a3875146$export$7d15b64cf5a3a4c4(parsedValue, minValue, maxValue);
|
|
1101
|
-
else clampedValue = $9446cca9a3875146$export$cb6e0bb50bc19463(parsedValue, minValue, maxValue, step);
|
|
1102
|
-
clampedValue = numberParser.parse(format(clampedValue));
|
|
1103
|
-
setNumberValue(clampedValue);
|
|
1104
|
-
setInputValue(format(value === void 0 ? clampedValue : numberValue));
|
|
1105
|
-
};
|
|
1106
|
-
let safeNextStep = (operation, minMax = 0) => {
|
|
1107
|
-
let prev = parsedValue;
|
|
1108
|
-
if (isNaN(prev)) {
|
|
1109
|
-
let newValue = isNaN(minMax) ? 0 : minMax;
|
|
1110
|
-
return $9446cca9a3875146$export$cb6e0bb50bc19463(newValue, minValue, maxValue, clampStep);
|
|
1111
|
-
} else {
|
|
1112
|
-
let newValue = $9446cca9a3875146$export$cb6e0bb50bc19463(prev, minValue, maxValue, clampStep);
|
|
1113
|
-
if (operation === "+" && newValue > prev || operation === "-" && newValue < prev) return newValue;
|
|
1114
|
-
return $9446cca9a3875146$export$cb6e0bb50bc19463($de67e98908f0c6ee$var$handleDecimalOperation(operation, prev, clampStep), minValue, maxValue, clampStep);
|
|
1115
|
-
}
|
|
1116
|
-
};
|
|
1117
|
-
let increment = () => {
|
|
1118
|
-
let newValue = safeNextStep("+", minValue);
|
|
1119
|
-
if (newValue === numberValue) setInputValue(format(newValue));
|
|
1120
|
-
setNumberValue(newValue);
|
|
1121
|
-
validation.commitValidation();
|
|
1122
|
-
};
|
|
1123
|
-
let decrement = () => {
|
|
1124
|
-
let newValue = safeNextStep("-", maxValue);
|
|
1125
|
-
if (newValue === numberValue) setInputValue(format(newValue));
|
|
1126
|
-
setNumberValue(newValue);
|
|
1127
|
-
validation.commitValidation();
|
|
1128
|
-
};
|
|
1129
|
-
let incrementToMax = () => {
|
|
1130
|
-
if (maxValue != null) {
|
|
1131
|
-
setNumberValue($9446cca9a3875146$export$cb6e0bb50bc19463(maxValue, minValue, maxValue, clampStep));
|
|
1132
|
-
validation.commitValidation();
|
|
1133
|
-
}
|
|
1134
|
-
};
|
|
1135
|
-
let decrementToMin = () => {
|
|
1136
|
-
if (minValue != null) {
|
|
1137
|
-
setNumberValue(minValue);
|
|
1138
|
-
validation.commitValidation();
|
|
1139
|
-
}
|
|
1140
|
-
};
|
|
1141
|
-
let canIncrement = useMemo(() => !isDisabled && !isReadOnly && (isNaN(parsedValue) || maxValue === void 0 || isNaN(maxValue) || $9446cca9a3875146$export$cb6e0bb50bc19463(parsedValue, minValue, maxValue, clampStep) > parsedValue || $de67e98908f0c6ee$var$handleDecimalOperation("+", parsedValue, clampStep) <= maxValue), [
|
|
1142
|
-
isDisabled,
|
|
1143
|
-
isReadOnly,
|
|
1144
|
-
minValue,
|
|
1145
|
-
maxValue,
|
|
1146
|
-
clampStep,
|
|
1147
|
-
parsedValue
|
|
1148
|
-
]);
|
|
1149
|
-
let canDecrement = useMemo(() => !isDisabled && !isReadOnly && (isNaN(parsedValue) || minValue === void 0 || isNaN(minValue) || $9446cca9a3875146$export$cb6e0bb50bc19463(parsedValue, minValue, maxValue, clampStep) < parsedValue || $de67e98908f0c6ee$var$handleDecimalOperation("-", parsedValue, clampStep) >= minValue), [
|
|
1150
|
-
isDisabled,
|
|
1151
|
-
isReadOnly,
|
|
1152
|
-
minValue,
|
|
1153
|
-
maxValue,
|
|
1154
|
-
clampStep,
|
|
1155
|
-
parsedValue
|
|
1156
|
-
]);
|
|
1157
|
-
let validate = (value2) => numberParser.isValidPartialNumber(value2, minValue, maxValue);
|
|
1158
|
-
return {
|
|
1159
|
-
...validation,
|
|
1160
|
-
validate,
|
|
1161
|
-
increment,
|
|
1162
|
-
incrementToMax,
|
|
1163
|
-
decrement,
|
|
1164
|
-
decrementToMin,
|
|
1165
|
-
canIncrement,
|
|
1166
|
-
canDecrement,
|
|
1167
|
-
minValue,
|
|
1168
|
-
maxValue,
|
|
1169
|
-
numberValue: parsedValue,
|
|
1170
|
-
setNumberValue,
|
|
1171
|
-
setInputValue,
|
|
1172
|
-
inputValue,
|
|
1173
|
-
commit
|
|
1174
|
-
};
|
|
1175
|
-
}
|
|
1176
|
-
function $de67e98908f0c6ee$var$handleDecimalOperation(operator, value1, value2) {
|
|
1177
|
-
let result = operator === "+" ? value1 + value2 : value1 - value2;
|
|
1178
|
-
if (value1 % 1 !== 0 || value2 % 1 !== 0) {
|
|
1179
|
-
const value1Decimal = value1.toString().split(".");
|
|
1180
|
-
const value2Decimal = value2.toString().split(".");
|
|
1181
|
-
const value1DecimalLength = value1Decimal[1] && value1Decimal[1].length || 0;
|
|
1182
|
-
const value2DecimalLength = value2Decimal[1] && value2Decimal[1].length || 0;
|
|
1183
|
-
const multiplier = Math.pow(10, Math.max(value1DecimalLength, value2DecimalLength));
|
|
1184
|
-
value1 = Math.round(value1 * multiplier);
|
|
1185
|
-
value2 = Math.round(value2 * multiplier);
|
|
1186
|
-
result = operator === "+" ? value1 + value2 : value1 - value2;
|
|
1187
|
-
result /= multiplier;
|
|
1188
|
-
}
|
|
1189
|
-
return result;
|
|
1190
|
-
}
|
|
1191
1191
|
export {
|
|
1192
1192
|
$de67e98908f0c6ee$export$7f629e9dc1ecf37c as $,
|
|
1193
1193
|
$81397a9303501bda$export$23f548e970bdf099 as a,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-
|
|
1
|
+
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-Cs-ZD1nu.js";
|
|
2
2
|
import { $ as $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5 } from "./NumberFormatter-U_Gx0UDq.js";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
function $a916eb452884faea$export$b7a616150fdb9f44(options = {}) {
|