@koide-labs/ui 0.0.15 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/-utils.d.ts +2 -2
- package/dist/-utils.js +1 -1
- package/dist/{Button-DrPFFzo7.js → Button-BmcVHRRW.js} +2 -2
- package/dist/{CompositeRoot-CVk5a-pR.js → CompositeRoot-CCgh2M64.js} +6 -6
- package/dist/{FloatingPortal-tWyuKRSN.js → FloatingPortal-BQsQhvIr.js} +27 -27
- package/dist/{FloatingPortalLite-DVyq6YhV.js → FloatingPortalLite-_ECdFE7b.js} +1 -1
- package/dist/{InternalBackdrop-jYAiOJ8v.js → InternalBackdrop-BSMKU-hc.js} +13 -13
- package/dist/{LabelableContext-BMvjVwor.js → LabelableContext-Be1u-eFg.js} +2 -2
- package/dist/accordion.css +1 -0
- package/dist/alert-dialog.css +1 -0
- package/dist/anchor.css +1 -0
- package/dist/avatar.css +1 -0
- package/dist/badge.css +1 -0
- package/dist/button.css +1 -0
- package/dist/checkbox.css +1 -0
- package/dist/code.css +1 -0
- package/dist/collapse.css +1 -0
- package/dist/command.css +1 -0
- package/dist/components/accordion/accordion.d.ts +19 -0
- package/dist/components/accordion/accordion.js +701 -0
- package/dist/components/accordion/index.d.ts +1 -12
- package/dist/components/accordion/index.js +2 -697
- package/dist/components/alert-dialog/alert-dialog.d.ts +36 -0
- package/dist/components/alert-dialog/alert-dialog.js +138 -0
- package/dist/components/alert-dialog/index.d.ts +1 -26
- package/dist/components/alert-dialog/index.js +2 -134
- package/dist/components/anchor/anchor.d.ts +12 -0
- package/dist/components/anchor/anchor.js +21 -0
- package/dist/components/anchor/index.d.ts +1 -8
- package/dist/components/anchor/index.js +2 -19
- package/dist/components/avatar/avatar.d.ts +25 -0
- package/dist/components/avatar/avatar.js +161 -0
- package/dist/components/avatar/index.d.ts +1 -21
- package/dist/components/avatar/index.js +2 -159
- package/dist/components/badge/badge.d.ts +20 -0
- package/dist/components/badge/badge.js +42 -0
- package/dist/components/badge/index.d.ts +1 -16
- package/dist/components/badge/index.js +2 -40
- package/dist/components/button/button.d.ts +27 -0
- package/dist/components/button/button.js +47 -0
- package/dist/components/button/index.d.ts +1 -24
- package/dist/components/button/index.js +2 -45
- package/dist/components/checkbox/checkbox.d.ts +13 -0
- package/dist/components/checkbox/checkbox.js +269 -0
- package/dist/components/checkbox/index.d.ts +1 -9
- package/dist/components/checkbox/index.js +2 -267
- package/dist/components/code/code.d.ts +13 -0
- package/dist/components/code/code.js +1206 -0
- package/dist/components/code/index.d.ts +1 -9
- package/dist/components/code/index.js +2 -1204
- package/dist/components/collapse/collapse.d.ts +14 -0
- package/dist/components/collapse/collapse.js +35 -0
- package/dist/components/collapse/index.d.ts +1 -11
- package/dist/components/collapse/index.js +2 -33
- package/dist/components/command/command.d.ts +36 -0
- package/dist/components/command/command.js +1695 -0
- package/dist/components/command/index.d.ts +1 -15
- package/dist/components/command/index.js +2 -1693
- package/dist/components/context-menu/context-menu.d.ts +82 -0
- package/dist/components/context-menu/context-menu.js +1445 -0
- package/dist/components/context-menu/index.d.ts +1 -42
- package/dist/components/context-menu/index.js +2 -1442
- package/dist/components/dialog/dialog.d.ts +22 -0
- package/dist/components/dialog/dialog.js +140 -0
- package/dist/components/dialog/dialog.types.d.ts +38 -0
- package/dist/components/dialog/index.d.ts +1 -48
- package/dist/components/dialog/index.js +2 -136
- package/dist/components/heading/heading.d.ts +25 -0
- package/dist/components/heading/heading.js +36 -0
- package/dist/components/heading/index.d.ts +1 -44
- package/dist/components/heading/index.js +2 -49
- package/dist/components/icon/icon.d.ts +28 -0
- package/dist/components/icon/icon.js +43 -0
- package/dist/components/icon/{icon-names.d.ts → icon.types.d.ts} +4 -0
- package/dist/components/icon/icon.types.js +1 -0
- package/dist/components/icon/index.d.ts +2 -24
- package/dist/components/icon/index.js +2 -41
- package/dist/components/icon-button/icon-button.d.ts +16 -0
- package/dist/components/icon-button/icon-button.js +46 -0
- package/dist/components/icon-button/index.d.ts +1 -12
- package/dist/components/icon-button/index.js +2 -44
- package/dist/components/inline-code/index.d.ts +1 -6
- package/dist/components/inline-code/index.js +2 -20
- package/dist/components/inline-code/inline-code.d.ts +10 -0
- package/dist/components/inline-code/inline-code.js +25 -0
- package/dist/components/input/index.d.ts +1 -3
- package/dist/components/input/index.js +2 -117
- package/dist/components/input/input.d.ts +9 -0
- package/dist/components/input/input.js +126 -0
- package/dist/components/meter/index.d.ts +1 -18
- package/dist/components/meter/index.js +2 -163
- package/dist/components/meter/meter.d.ts +22 -0
- package/dist/components/meter/meter.js +165 -0
- package/dist/components/multiline-input/index.d.ts +1 -6
- package/dist/components/multiline-input/index.js +2 -98
- package/dist/components/multiline-input/multiline-input.d.ts +10 -0
- package/dist/components/multiline-input/multiline-input.js +100 -0
- package/dist/components/number-input/index.d.ts +1 -10
- package/dist/components/number-input/index.js +2 -1167
- package/dist/components/number-input/number-input.d.ts +14 -0
- package/dist/components/number-input/number-input.js +1169 -0
- package/dist/components/password-input/index.d.ts +1 -2
- package/dist/components/password-input/index.js +2 -27
- package/dist/components/password-input/password-input.d.ts +7 -0
- package/dist/components/password-input/password-input.js +29 -0
- package/dist/components/pill/index.d.ts +1 -13
- package/dist/components/pill/index.js +2 -36
- package/dist/components/pill/pill.d.ts +17 -0
- package/dist/components/pill/pill.js +38 -0
- package/dist/components/popover/index.d.ts +1 -21
- package/dist/components/popover/index.js +2 -634
- package/dist/components/popover/popover.d.ts +22 -0
- package/dist/components/popover/popover.js +634 -0
- package/dist/components/preview-card/index.d.ts +1 -17
- package/dist/components/preview-card/index.js +2 -400
- package/dist/components/preview-card/preview-card.d.ts +21 -0
- package/dist/components/preview-card/preview-card.js +402 -0
- package/dist/components/radio-group/index.d.ts +1 -0
- package/dist/components/radio-group/index.js +5 -0
- package/dist/components/radio-group/radio-group.d.ts +25 -0
- package/dist/components/{radio/index.js → radio-group/radio-group.js} +91 -90
- package/dist/components/search-bar/index.d.ts +1 -12
- package/dist/components/search-bar/index.js +2 -46
- package/dist/components/search-bar/search-bar.d.ts +16 -0
- package/dist/components/search-bar/search-bar.js +43 -0
- package/dist/components/select/index.d.ts +1 -16
- package/dist/components/select/index.js +2 -1261
- package/dist/components/select/select.d.ts +22 -0
- package/dist/components/select/select.js +1263 -0
- package/dist/components/separator/index.d.ts +1 -7
- package/dist/components/separator/index.js +2 -4
- package/dist/components/separator/separator.d.ts +10 -0
- package/dist/components/separator/separator.js +6 -0
- package/dist/components/slider/index.d.ts +1 -5
- package/dist/components/slider/index.js +2 -900
- package/dist/components/slider/slider.d.ts +10 -0
- package/dist/components/slider/slider.js +899 -0
- package/dist/components/spinner/index.d.ts +1 -2
- package/dist/components/spinner/index.js +2 -11
- package/dist/components/spinner/spinner.d.ts +7 -0
- package/dist/components/spinner/spinner.js +13 -0
- package/dist/components/stacked-avatars/index.d.ts +1 -14
- package/dist/components/stacked-avatars/index.js +2 -90
- package/dist/components/stacked-avatars/stacked-avatars.d.ts +18 -0
- package/dist/components/stacked-avatars/stacked-avatars.js +92 -0
- package/dist/components/status-banner/index.d.ts +1 -17
- package/dist/components/status-banner/index.js +2 -69
- package/dist/components/status-banner/status-banner.d.ts +22 -0
- package/dist/components/status-banner/status-banner.js +71 -0
- package/dist/components/surface/index.d.ts +2 -27
- package/dist/components/surface/index.js +2 -39
- package/dist/components/surface/surface.d.ts +26 -0
- package/dist/components/surface/surface.js +36 -0
- package/dist/components/surface/surface.types.d.ts +1 -0
- package/dist/components/surface/surface.types.js +1 -0
- package/dist/components/switch/index.d.ts +1 -5
- package/dist/components/switch/index.js +2 -194
- package/dist/components/switch/switch.d.ts +10 -0
- package/dist/components/switch/switch.js +193 -0
- package/dist/components/tabs/index.d.ts +1 -18
- package/dist/components/tabs/index.js +2 -507
- package/dist/components/tabs/tabs.d.ts +28 -0
- package/dist/components/tabs/tabs.js +511 -0
- package/dist/components/text/index.d.ts +1 -26
- package/dist/components/text/index.js +2 -46
- package/dist/components/text/text.d.ts +29 -0
- package/dist/components/text/text.js +48 -0
- package/dist/components/theme-provider/index.d.ts +1 -1
- package/dist/components/theme-provider/theme-provider.d.ts +8 -4
- package/dist/components/theme-provider/theme-provider.js +3 -3
- package/dist/components/timestamp/index.d.ts +1 -23
- package/dist/components/timestamp/index.js +2 -1390
- package/dist/components/timestamp/timestamp.d.ts +26 -0
- package/dist/components/timestamp/timestamp.js +1391 -0
- package/dist/components/toaster/index.d.ts +2 -0
- package/dist/components/toaster/index.js +7 -0
- package/dist/components/toaster/toaster.d.ts +7 -0
- package/dist/components/toaster/toaster.js +923 -0
- package/dist/components/{toast → toaster}/use-toast-manager.d.ts +3 -3
- package/dist/components/tooltip/index.d.ts +1 -14
- package/dist/components/tooltip/index.js +2 -710
- package/dist/components/tooltip/tooltip.d.ts +24 -0
- package/dist/components/tooltip/tooltip.js +9 -0
- package/dist/components/view/index.d.ts +2 -30
- package/dist/components/view/index.js +2 -79
- package/dist/components/view/view.d.ts +31 -0
- package/dist/components/view/view.js +83 -0
- package/dist/components/view/view.types.d.ts +5 -0
- package/dist/components/view/view.types.js +1 -0
- package/dist/components/visually-hidden/index.d.ts +5 -1
- package/dist/{composite-Bx7Szd_T.js → composite-BZzP-LlG.js} +3 -3
- package/dist/{composite-C9L5QmZL.js → composite-BwEK5cWH.js} +1 -1
- package/dist/context-menu.css +1 -0
- package/dist/{createBaseUIEventDetails-D8M2Yl-a.js → createBaseUIEventDetails-CCSfZ2vM.js} +7 -7
- package/dist/{detectBrowser-I-s3yzIE.js → detectBrowser-Bl8Ki_1I.js} +2 -2
- package/dist/dialog.css +1 -1
- package/dist/{dialog.module-BeF-6XAo.js → dialog.module-DsbQRp-d.js} +55 -55
- package/dist/{element-CZEOj04G.js → element-u5WgOZX1.js} +7 -7
- package/dist/{event-CKoGyQEJ.js → event-B89-Ng5h.js} +4 -4
- package/dist/{floating-ui.utils-C7pRWMZ_.js → floating-ui.utils-DUVaIF3G.js} +7 -7
- package/dist/{floating-ui.utils.dom-C7FS5id0.js → floating-ui.utils.dom-cbi420Pg.js} +4 -4
- package/dist/{getDisabledMountTransitionStyles-YfHPge6T.js → getDisabledMountTransitionStyles-E2x-_lte.js} +7 -7
- package/dist/heading.css +1 -0
- package/dist/icon-button.css +1 -0
- package/dist/icon.css +1 -0
- package/dist/index.d.ts +10 -10
- package/dist/index.js +86 -104
- package/dist/{inertValue-BCYGsdmf.js → inertValue-BTpPjX30.js} +1 -1
- package/dist/inline-code.css +1 -0
- package/dist/input.css +1 -1
- package/dist/input.module-CtE19OH8.js +8 -0
- package/dist/integrations/react-markdown/index.js +12 -12
- package/dist/meter.css +1 -0
- package/dist/number-input.css +1 -0
- package/dist/password-input.css +1 -0
- package/dist/pill.css +1 -0
- package/dist/popover.css +1 -0
- package/dist/preview-card.css +1 -0
- package/dist/radio-group.css +1 -0
- package/dist/safePolygon-DnkzOIur.js +558 -0
- package/dist/search-bar.css +1 -0
- package/dist/select.css +1 -0
- package/dist/{index-DVjyPAD4.js → separator-fh_wDZNf.js} +7 -11
- package/dist/separator.css +1 -0
- package/dist/slider.css +1 -0
- package/dist/spinner.css +1 -0
- package/dist/stacked-avatars.css +1 -0
- package/dist/status-banner.css +1 -0
- package/dist/styles/core.css +1 -1
- package/dist/surface.css +1 -0
- package/dist/switch.css +1 -0
- package/dist/tabs.css +1 -0
- package/dist/text.css +1 -0
- package/dist/timestamp.css +1 -0
- package/dist/toaster.css +1 -0
- package/dist/tooltip-oCp-elli.js +765 -0
- package/dist/tooltip.css +1 -0
- package/dist/transitions.css +1 -1
- package/dist/{transitions.module-CWX8e5cx.js → transitions.module-D9mMAtfI.js} +11 -11
- package/dist/{useAnimationFrame-451ugS_6.js → useAnimationFrame-DvK1s63A.js} +1 -1
- package/dist/{useButton-DfIwsdb8.js → useButton-d3_JgBNr.js} +3 -3
- package/dist/{useCompositeListItem-OkcAim_1.js → useCompositeListItem-CZp9WTnF.js} +2 -2
- package/dist/{useLabelableId-Ci_jDvmv.js → useLabelableId-CX4tcfzK.js} +3 -3
- package/dist/{useOpenChangeComplete-Dse9kY9E.js → useOpenChangeComplete-BHd-N7Ig.js} +5 -5
- package/dist/{useRender-CLx7dR_1.js → useRender-C3vlzS3t.js} +1 -1
- package/dist/{useRenderElement-DwToLA61.js → useRenderElement-DngNDu_P.js} +2 -2
- package/dist/{useRole-oDBdbuwQ.js → useRole-BD3OL1rr.js} +3 -3
- package/dist/{useStableCallback-CkTrVkNX.js → useStableCallback-DKZHlUAT.js} +1 -1
- package/dist/{useSyncedFloatingRootContext-Dorsv-jf.js → useSyncedFloatingRootContext-BB1vwkV-.js} +20 -20
- package/dist/{useTimeout-CflX-kz3.js → useTimeout-BNni6aw5.js} +1 -1
- package/dist/{useTransitionStatus-CUfcuGAV.js → useTransitionStatus-CmMyUh74.js} +1 -1
- package/dist/{useTypeahead-D85V2IUx.js → useTypeahead-BiL5IAVb.js} +11 -11
- package/dist/{useValueAsRef-HURLzret.js → useValueAsRef-B4EriRsI.js} +1 -1
- package/dist/{useValueChanged-DL757-yD.js → useValueChanged-MJRmEWz1.js} +1 -1
- package/dist/view.css +1 -1
- package/dist/view.module-Dj7wj0kk.js +6 -0
- package/dist/view2.css +1 -0
- package/package.json +1 -1
- package/dist/components/radio/index.d.ts +0 -13
- package/dist/components/toast/index.d.ts +0 -2
- package/dist/components/toast/index.js +0 -8
- package/dist/components/toast/toast.d.ts +0 -2
- package/dist/components/toast/toast.js +0 -921
- package/dist/components/tooltip/tooltip-arrow.d.ts +0 -3
- package/dist/components/tooltip/tooltip-arrow.js +0 -6
- package/dist/index10.css +0 -1
- package/dist/index11.css +0 -1
- package/dist/index12.css +0 -1
- package/dist/index13.css +0 -1
- package/dist/index14.css +0 -1
- package/dist/index15.css +0 -1
- package/dist/index16.css +0 -1
- package/dist/index17.css +0 -1
- package/dist/index18.css +0 -1
- package/dist/index19.css +0 -1
- package/dist/index20.css +0 -1
- package/dist/index21.css +0 -1
- package/dist/index22.css +0 -1
- package/dist/index23.css +0 -1
- package/dist/index24.css +0 -1
- package/dist/index25.css +0 -1
- package/dist/index26.css +0 -1
- package/dist/index27.css +0 -1
- package/dist/index28.css +0 -1
- package/dist/index29.css +0 -1
- package/dist/index3.css +0 -1
- package/dist/index30.css +0 -1
- package/dist/index31.css +0 -1
- package/dist/index32.css +0 -1
- package/dist/index33.css +0 -1
- package/dist/index34.css +0 -1
- package/dist/index35.css +0 -1
- package/dist/index36.css +0 -1
- package/dist/index37.css +0 -1
- package/dist/index4.css +0 -1
- package/dist/index5.css +0 -1
- package/dist/index6.css +0 -1
- package/dist/index7.css +0 -1
- package/dist/index8.css +0 -1
- package/dist/index9.css +0 -1
- package/dist/input.module-DDQY_Ij6.js +0 -7
- package/dist/safePolygon-DWy1dGKJ.js +0 -308
- package/dist/toast.css +0 -1
- package/dist/tooltip-arrow-cs6vjjqZ.js +0 -24
- package/dist/tooltip-arrow.css +0 -1
- package/dist/useHoverReferenceInteraction-SfOBPoXM.js +0 -264
- package/dist/usePopupAutoResize-CNR6Ekmx.js +0 -85
- package/dist/view.module-DfDLgJE0.js +0 -6
- /package/dist/components/{icon/icon-names.js → dialog/dialog.types.js} +0 -0
- /package/dist/components/{toast → toaster}/use-toast-manager.js +0 -0
|
@@ -1,1170 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { c as Ot } from "../../clsx-OuTLNxxd.js";
|
|
4
|
-
import * as o from "react";
|
|
5
|
-
import { useId as Ut } from "react";
|
|
6
|
-
import { IconButton as tt } from "../icon-button/index.js";
|
|
7
|
-
import { Input as kt } from "../input/index.js";
|
|
8
|
-
import { S as Wt } from "../../index-DVjyPAD4.js";
|
|
9
|
-
import { Text as Ht } from "../text/index.js";
|
|
10
|
-
import { View as Gt } from "../view/index.js";
|
|
11
|
-
import { u as Bt } from "../../useControlled-Du4sJyMj.js";
|
|
12
|
-
import { u as de } from "../../useStableCallback-CkTrVkNX.js";
|
|
13
|
-
import { T as $t, u as Ke } from "../../useTimeout-CflX-kz3.js";
|
|
14
|
-
import { a as Kt, c as Yt, u as xe } from "../../useRenderElement-DwToLA61.js";
|
|
15
|
-
import { u as jt } from "../../useOnMount-VRW6CK2u.js";
|
|
16
|
-
import { u as Ge } from "../../useIsoLayoutEffect-CIDbvm3Q.js";
|
|
17
|
-
import { u as nt } from "../../useValueAsRef-HURLzret.js";
|
|
18
|
-
import { v as zt } from "../../visuallyHidden-CpJ-mhai.js";
|
|
19
|
-
import { o as Ye } from "../../owner-rKN292Q9.js";
|
|
20
|
-
import { c as qt, f as Xt, d as Zt } from "../../detectBrowser-I-s3yzIE.js";
|
|
21
|
-
import { f as Jt } from "../../formatErrorMessage-BqPuTBN-.js";
|
|
22
|
-
import { a as ft, c as Qt, u as en, b as tn, f as nn } from "../../LabelableContext-BMvjVwor.js";
|
|
23
|
-
import { u as rn } from "../../useLabelableId-Ci_jDvmv.js";
|
|
24
|
-
import { g as ke, f as Te, a as dt } from "../../formatNumber-1UNwjeqf.js";
|
|
25
|
-
import { c as sn } from "../../clamp-D0KDAQIz.js";
|
|
26
|
-
import { c as ce, h as _e, n as on, j as un, k as Ae, m as Be, p as rt, q as st, s as ot } from "../../createBaseUIEventDetails-D8M2Yl-a.js";
|
|
27
|
-
import { d as We } from "../../floating-ui.utils.dom-C7FS5id0.js";
|
|
28
|
-
import * as it from "react-dom";
|
|
29
|
-
import { u as an } from "../../useValueChanged-DL757-yD.js";
|
|
30
|
-
import { s as cn } from "../../event-CKoGyQEJ.js";
|
|
31
|
-
import { u as mt } from "../../useButton-DfIwsdb8.js";
|
|
32
|
-
import '../../index32.css';function ln() {
|
|
33
|
-
const [, n] = o.useState({});
|
|
34
|
-
return o.useCallback(() => {
|
|
35
|
-
n({});
|
|
36
|
-
}, []);
|
|
37
|
-
}
|
|
38
|
-
const ut = 0;
|
|
39
|
-
class qe extends $t {
|
|
40
|
-
static create() {
|
|
41
|
-
return new qe();
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Executes `fn` at `delay` interval, clearing any previously scheduled call.
|
|
45
|
-
*/
|
|
46
|
-
start(r, t) {
|
|
47
|
-
this.clear(), this.currentId = setInterval(() => {
|
|
48
|
-
t();
|
|
49
|
-
}, r);
|
|
50
|
-
}
|
|
51
|
-
clear = () => {
|
|
52
|
-
this.currentId !== ut && (clearInterval(this.currentId), this.currentId = ut);
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function fn() {
|
|
56
|
-
const n = Kt(qe.create).current;
|
|
57
|
-
return jt(n.disposeEffect), n;
|
|
58
|
-
}
|
|
59
|
-
const Xe = /* @__PURE__ */ o.createContext(void 0);
|
|
60
|
-
process.env.NODE_ENV !== "production" && (Xe.displayName = "NumberFieldRootContext");
|
|
61
|
-
function De() {
|
|
62
|
-
const n = o.useContext(Xe);
|
|
63
|
-
if (n === void 0)
|
|
64
|
-
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: NumberFieldRootContext is missing. NumberField parts must be placed within <NumberField.Root>." : Jt(43));
|
|
65
|
-
return n;
|
|
66
|
-
}
|
|
67
|
-
const ye = {
|
|
68
|
-
inputValue: () => null,
|
|
69
|
-
value: () => null
|
|
70
|
-
}, dn = ["零", "〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"], mn = {
|
|
71
|
-
零: "0",
|
|
72
|
-
"〇": "0",
|
|
73
|
-
一: "1",
|
|
74
|
-
二: "2",
|
|
75
|
-
三: "3",
|
|
76
|
-
四: "4",
|
|
77
|
-
五: "5",
|
|
78
|
-
六: "6",
|
|
79
|
-
七: "7",
|
|
80
|
-
八: "8",
|
|
81
|
-
九: "9"
|
|
82
|
-
}, pt = ["٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩"], gt = ["۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"], Ze = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], ht = ["%", "٪", "%", "﹪"], Et = ["‰", "؉"], bt = ["−", "-", "‒", "–", "—", "﹣"], Rt = ["+", "﹢"], pn = ".", gn = ",", hn = new RegExp(`[${pt.join("")}]`, "g"), En = new RegExp(`[${gt.join("")}]`, "g"), bn = new RegExp(`[${Ze.join("")}]`, "g"), Rn = new RegExp(`[${dn.join("")}]`, "g"), Nn = new RegExp(`[${ht.join("")}]`), Sn = new RegExp(`[${Et.join("")}]`), je = /[٠١٢٣٤٥٦٧٨٩]/, Nt = /[۰۱۲۳۴۵۶۷۸۹]/, ze = /[零〇一二三四五六七八九]/, at = new RegExp(`[${Ze.join("")}]`), _n = [".", ",", pn, gn, "٫", "٬"], ct = new RegExp("\\p{Zs}", "u"), xn = ["+", ...Rt], yn = ["-", ...bt], Le = (n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), Cn = (n) => n.replace(/[-\\\]^]/g, (r) => `\\${r}`), St = (n) => `[${n.map(Cn).join("")}]`, _t = St(["-"].concat(bt)), xt = St(["+"].concat(Rt)), yt = new RegExp(_t, "gu"), Ct = new RegExp(xt, "gu"), ve = new RegExp(_t), Oe = new RegExp(xt);
|
|
83
|
-
function Je(n, r) {
|
|
84
|
-
const t = ke(n, r).formatToParts(11111.1), s = {};
|
|
85
|
-
return t.forEach((a) => {
|
|
86
|
-
s[a.type] = a.value;
|
|
87
|
-
}), ke(n).formatToParts(0.1).forEach((a) => {
|
|
88
|
-
a.type === "decimal" && (s[a.type] = a.value);
|
|
89
|
-
}), s;
|
|
90
|
-
}
|
|
91
|
-
function Se(n, r, t) {
|
|
92
|
-
if (n == null)
|
|
93
|
-
return null;
|
|
94
|
-
let s = String(n).replace(new RegExp("\\p{Cf}", "gu"), "").trim();
|
|
95
|
-
s = s.replace(yt, "-").replace(Ct, "+");
|
|
96
|
-
let a = !1;
|
|
97
|
-
const f = s.match(/([+-])\s*$/);
|
|
98
|
-
f && (f[1] === "-" && (a = !0), s = s.replace(/([+-])\s*$/, ""));
|
|
99
|
-
const S = s.match(/^\s*([+-])/);
|
|
100
|
-
S && (S[1] === "-" && (a = !0), s = s.replace(/^\s*[+-]/, ""));
|
|
101
|
-
let p = r;
|
|
102
|
-
p === void 0 && (je.test(s) || Nt.test(s) ? p = "ar" : ze.test(s) && (p = "zh"));
|
|
103
|
-
const {
|
|
104
|
-
group: m,
|
|
105
|
-
decimal: _,
|
|
106
|
-
currency: b
|
|
107
|
-
} = Je(p, t), R = ke(p, t).formatToParts(1).filter((c) => c.type === "unit").map((c) => Le(c.value)), K = R.length ? new RegExp(R.join("|"), "g") : null;
|
|
108
|
-
let G = null;
|
|
109
|
-
m && (new RegExp("\\p{Zs}", "u").test(m) ? G = new RegExp("\\p{Zs}", "gu") : m === "'" || m === "’" ? G = /['’]/g : G = new RegExp(Le(m), "g"));
|
|
110
|
-
let w = [
|
|
111
|
-
{
|
|
112
|
-
regex: m ? G : null,
|
|
113
|
-
replacement: ""
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
regex: _ ? new RegExp(Le(_), "g") : null,
|
|
117
|
-
replacement: "."
|
|
118
|
-
},
|
|
119
|
-
// Fullwidth punctuation
|
|
120
|
-
{
|
|
121
|
-
regex: /./g,
|
|
122
|
-
replacement: "."
|
|
123
|
-
},
|
|
124
|
-
// FULLWIDTH_DECIMAL
|
|
125
|
-
{
|
|
126
|
-
regex: /,/g,
|
|
127
|
-
replacement: ""
|
|
128
|
-
},
|
|
129
|
-
// FULLWIDTH_GROUP
|
|
130
|
-
// Arabic punctuation
|
|
131
|
-
{
|
|
132
|
-
regex: /٫/g,
|
|
133
|
-
replacement: "."
|
|
134
|
-
},
|
|
135
|
-
// ARABIC DECIMAL SEPARATOR (U+066B)
|
|
136
|
-
{
|
|
137
|
-
regex: /٬/g,
|
|
138
|
-
replacement: ""
|
|
139
|
-
},
|
|
140
|
-
// ARABIC THOUSANDS SEPARATOR (U+066C)
|
|
141
|
-
// Currency & unit labels
|
|
142
|
-
{
|
|
143
|
-
regex: b ? new RegExp(Le(b), "g") : null,
|
|
144
|
-
replacement: ""
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
regex: K,
|
|
148
|
-
replacement: ""
|
|
149
|
-
},
|
|
150
|
-
// Numeral systems to ASCII digits
|
|
151
|
-
{
|
|
152
|
-
regex: hn,
|
|
153
|
-
replacement: (c) => String(pt.indexOf(c))
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
regex: En,
|
|
157
|
-
replacement: (c) => String(gt.indexOf(c))
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
regex: bn,
|
|
161
|
-
replacement: (c) => String(Ze.indexOf(c))
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
regex: Rn,
|
|
165
|
-
replacement: (c) => mn[c]
|
|
166
|
-
}
|
|
167
|
-
].reduce((c, {
|
|
168
|
-
regex: W,
|
|
169
|
-
replacement: x
|
|
170
|
-
}) => W ? c.replace(W, x) : c, s);
|
|
171
|
-
const O = w.lastIndexOf(".");
|
|
172
|
-
if (O !== -1 && (w = `${w.slice(0, O).replace(/\./g, "")}.${w.slice(O + 1).replace(/\./g, "")}`), /^[-+]?Infinity$/i.test(s) || /[∞]/.test(s))
|
|
173
|
-
return null;
|
|
174
|
-
const X = (a ? "-" : "") + w;
|
|
175
|
-
let V = parseFloat(X);
|
|
176
|
-
const g = t?.style, d = g === "unit" && t?.unit === "percent", k = Nn.test(n) || g === "percent";
|
|
177
|
-
return Sn.test(n) ? V /= 1e3 : !d && k && (V /= 100), Number.isNaN(V) ? null : V;
|
|
178
|
-
}
|
|
179
|
-
const In = 60, An = 400, vn = 50, Tn = 3, Pn = 8, Pe = 1, Dn = 1e-10;
|
|
180
|
-
function Vn(n) {
|
|
181
|
-
const r = ke("en-US").resolvedOptions(), t = n?.minimumFractionDigits ?? r.minimumFractionDigits ?? 0;
|
|
182
|
-
return {
|
|
183
|
-
maximumFractionDigits: Math.max(n?.maximumFractionDigits ?? r.maximumFractionDigits ?? 20, t),
|
|
184
|
-
minimumFractionDigits: t
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
function Fn(n, r) {
|
|
188
|
-
if (!Number.isFinite(n))
|
|
189
|
-
return n;
|
|
190
|
-
const t = Math.min(Math.max(r, 0), 20);
|
|
191
|
-
return Number(n.toFixed(t));
|
|
192
|
-
}
|
|
193
|
-
function $e(n, r) {
|
|
194
|
-
const {
|
|
195
|
-
maximumFractionDigits: t
|
|
196
|
-
} = Vn(r);
|
|
197
|
-
return Fn(n, t);
|
|
198
|
-
}
|
|
199
|
-
function wn(n, r, t, s = "directional") {
|
|
200
|
-
if (t === 0)
|
|
201
|
-
return n;
|
|
202
|
-
const a = Math.abs(t), f = Math.sign(t), S = a * Dn * f, p = s === "nearest" ? t : a, m = (n - r + S) / p;
|
|
203
|
-
let _;
|
|
204
|
-
return s === "nearest" ? _ = Math.round(m) : f > 0 ? _ = Math.floor(m) : _ = Math.ceil(m), r + _ * (s === "nearest" ? t : a);
|
|
205
|
-
}
|
|
206
|
-
function Mn(n, {
|
|
207
|
-
step: r,
|
|
208
|
-
minWithDefault: t,
|
|
209
|
-
maxWithDefault: s,
|
|
210
|
-
minWithZeroDefault: a,
|
|
211
|
-
format: f,
|
|
212
|
-
snapOnStep: S,
|
|
213
|
-
small: p
|
|
214
|
-
}) {
|
|
215
|
-
if (n === null)
|
|
216
|
-
return n;
|
|
217
|
-
const m = sn(n, t, s);
|
|
218
|
-
if (r != null && S) {
|
|
219
|
-
if (r === 0)
|
|
220
|
-
return $e(m, f);
|
|
221
|
-
let _ = a;
|
|
222
|
-
!p && t !== Number.MIN_SAFE_INTEGER && (_ = t);
|
|
223
|
-
const b = wn(m, _, r, p ? "nearest" : "directional");
|
|
224
|
-
return $e(b, f);
|
|
225
|
-
}
|
|
226
|
-
return $e(m, f);
|
|
227
|
-
}
|
|
228
|
-
const It = /* @__PURE__ */ o.forwardRef(function(r, t) {
|
|
229
|
-
const {
|
|
230
|
-
id: s,
|
|
231
|
-
min: a,
|
|
232
|
-
max: f,
|
|
233
|
-
smallStep: S = 0.1,
|
|
234
|
-
step: p = 1,
|
|
235
|
-
largeStep: m = 10,
|
|
236
|
-
required: _ = !1,
|
|
237
|
-
disabled: b = !1,
|
|
238
|
-
readOnly: R = !1,
|
|
239
|
-
name: K,
|
|
240
|
-
defaultValue: G,
|
|
241
|
-
value: h,
|
|
242
|
-
onValueChange: w,
|
|
243
|
-
onValueCommitted: O,
|
|
244
|
-
allowWheelScrub: X = !1,
|
|
245
|
-
snapOnStep: V = !1,
|
|
246
|
-
format: g,
|
|
247
|
-
locale: d,
|
|
248
|
-
render: k,
|
|
249
|
-
className: Y,
|
|
250
|
-
inputRef: c,
|
|
251
|
-
...W
|
|
252
|
-
} = r, {
|
|
253
|
-
setDirty: x,
|
|
254
|
-
validityData: H,
|
|
255
|
-
disabled: j,
|
|
256
|
-
setFilled: z,
|
|
257
|
-
invalid: v,
|
|
258
|
-
name: Q,
|
|
259
|
-
state: U,
|
|
260
|
-
validation: ee,
|
|
261
|
-
shouldValidateOnChange: i
|
|
262
|
-
} = ft(), I = j || b, q = Q ?? K, [M, N] = o.useState(!1), y = a ?? Number.MIN_SAFE_INTEGER, L = f ?? Number.MAX_SAFE_INTEGER, Z = a ?? 0, A = g?.style, e = o.useRef(null), u = Yt(c, ee.inputRef), T = rn({
|
|
263
|
-
id: s
|
|
264
|
-
}), [P, J] = Bt({
|
|
265
|
-
controlled: h,
|
|
266
|
-
default: G,
|
|
267
|
-
name: "NumberField",
|
|
268
|
-
state: "value"
|
|
269
|
-
}), l = P ?? null, oe = nt(l);
|
|
270
|
-
Ge(() => {
|
|
271
|
-
z(l !== null);
|
|
272
|
-
}, [z, l]);
|
|
273
|
-
const te = ln(), ie = nt(g), re = o.useRef(!1), ue = de((F, E) => {
|
|
274
|
-
re.current = !1, O?.(F, E);
|
|
275
|
-
}), fe = Ke(), ge = fn(), he = Ke(), Ve = o.useRef(!1), Fe = o.useRef(0), me = o.useRef(!0), Ee = o.useRef(null), pe = o.useRef(() => {
|
|
276
|
-
}), [D, le] = o.useState(() => h !== void 0 ? lt(l, d, g) : Te(l, d, g)), [we, wt] = o.useState("numeric"), Qe = de(() => {
|
|
277
|
-
const {
|
|
278
|
-
decimal: F,
|
|
279
|
-
group: E,
|
|
280
|
-
currency: B,
|
|
281
|
-
literal: $
|
|
282
|
-
} = Je(d, g), C = /* @__PURE__ */ new Set();
|
|
283
|
-
_n.forEach((ne) => C.add(ne)), F && C.add(F), E && (C.add(E), ct.test(E) && C.add(" "));
|
|
284
|
-
const ae = A === "percent" || A === "unit" && g?.unit === "percent", Ie = A === "percent" || A === "unit" && g?.unit === "permille";
|
|
285
|
-
return ae && ht.forEach((ne) => C.add(ne)), Ie && Et.forEach((ne) => C.add(ne)), A === "currency" && B && C.add(B), $ && (Array.from($).forEach((ne) => C.add(ne)), ct.test($) && C.add(" ")), xn.forEach((ne) => C.add(ne)), y < 0 && yn.forEach((ne) => C.add(ne)), C;
|
|
286
|
-
}), be = de((F) => F?.altKey ? S : F?.shiftKey ? m : p), Me = de((F, E) => {
|
|
287
|
-
const B = E.event, $ = E.direction, C = Mn(F, {
|
|
288
|
-
step: $ ? be(B) * $ : void 0,
|
|
289
|
-
format: ie.current,
|
|
290
|
-
minWithDefault: y,
|
|
291
|
-
maxWithDefault: L,
|
|
292
|
-
minWithZeroDefault: Z,
|
|
293
|
-
snapOnStep: V,
|
|
294
|
-
small: B?.altKey ?? !1
|
|
295
|
-
});
|
|
296
|
-
if (C !== l || F !== l || me.current === !1) {
|
|
297
|
-
if (Ee.current = C, w?.(C, E), E.isCanceled)
|
|
298
|
-
return;
|
|
299
|
-
J(C), x(C !== H.initialValue), re.current = !0;
|
|
300
|
-
}
|
|
301
|
-
me.current && le(Te(C, d, g)), te();
|
|
302
|
-
}), Ce = de((F, {
|
|
303
|
-
direction: E,
|
|
304
|
-
currentValue: B,
|
|
305
|
-
event: $,
|
|
306
|
-
reason: C
|
|
307
|
-
}) => {
|
|
308
|
-
const ae = B ?? oe.current, Ie = typeof ae == "number" ? ae + F * E : Math.max(0, a ?? 0);
|
|
309
|
-
Me(Ie, ce(C, $, void 0, {
|
|
310
|
-
direction: E
|
|
311
|
-
}));
|
|
312
|
-
}), Re = de(() => {
|
|
313
|
-
he.clear(), fe.clear(), ge.clear(), pe.current(), Fe.current = 0;
|
|
314
|
-
}), et = de((F, E) => {
|
|
315
|
-
if (Re(), !e.current)
|
|
316
|
-
return;
|
|
317
|
-
const B = We(e.current);
|
|
318
|
-
function $(ae) {
|
|
319
|
-
ae.preventDefault();
|
|
320
|
-
}
|
|
321
|
-
B.addEventListener("contextmenu", $), pe.current = () => {
|
|
322
|
-
B.removeEventListener("contextmenu", $);
|
|
323
|
-
}, B.addEventListener("pointerup", (ae) => {
|
|
324
|
-
Ve.current = !1, Re();
|
|
325
|
-
const Ie = Ee.current ?? oe.current;
|
|
326
|
-
ue(Ie, _e(F ? "increment" : "decrement", ae));
|
|
327
|
-
}, {
|
|
328
|
-
once: !0
|
|
329
|
-
});
|
|
330
|
-
function C() {
|
|
331
|
-
const ae = be(E) ?? Pe;
|
|
332
|
-
Ce(ae, {
|
|
333
|
-
direction: F ? 1 : -1,
|
|
334
|
-
event: E,
|
|
335
|
-
reason: F ? "increment-press" : "decrement-press"
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
C(), fe.start(An, () => {
|
|
339
|
-
ge.start(In, C);
|
|
340
|
-
});
|
|
341
|
-
});
|
|
342
|
-
Ge(function() {
|
|
343
|
-
if (!me.current)
|
|
344
|
-
return;
|
|
345
|
-
const E = h !== void 0 ? lt(l, d, g) : Te(l, d, g);
|
|
346
|
-
E !== D && le(E);
|
|
347
|
-
}), Ge(function() {
|
|
348
|
-
if (!qt)
|
|
349
|
-
return;
|
|
350
|
-
let E = "text";
|
|
351
|
-
y >= 0 && (E = "decimal"), wt(E);
|
|
352
|
-
}, [y, A]), o.useEffect(() => () => Re(), [Re]), o.useEffect(function() {
|
|
353
|
-
const E = e.current;
|
|
354
|
-
if (I || R || !X || !E)
|
|
355
|
-
return;
|
|
356
|
-
function B($) {
|
|
357
|
-
if (
|
|
358
|
-
// Allow pinch-zooming.
|
|
359
|
-
$.ctrlKey || Ye(e.current).activeElement !== e.current
|
|
360
|
-
)
|
|
361
|
-
return;
|
|
362
|
-
$.preventDefault();
|
|
363
|
-
const C = be($) ?? Pe;
|
|
364
|
-
Ce(C, {
|
|
365
|
-
direction: $.deltaY > 0 ? -1 : 1,
|
|
366
|
-
event: $,
|
|
367
|
-
reason: "wheel"
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
return E.addEventListener("wheel", B), () => {
|
|
371
|
-
E.removeEventListener("wheel", B);
|
|
372
|
-
};
|
|
373
|
-
}, [X, Ce, I, R, m, p, be]);
|
|
374
|
-
const He = o.useMemo(() => ({
|
|
375
|
-
...U,
|
|
376
|
-
disabled: I,
|
|
377
|
-
readOnly: R,
|
|
378
|
-
required: _,
|
|
379
|
-
value: l,
|
|
380
|
-
inputValue: D,
|
|
381
|
-
scrubbing: M
|
|
382
|
-
}), [U, I, R, _, l, D, M]), Mt = o.useMemo(() => ({
|
|
383
|
-
inputRef: e,
|
|
384
|
-
inputValue: D,
|
|
385
|
-
value: l,
|
|
386
|
-
startAutoChange: et,
|
|
387
|
-
stopAutoChange: Re,
|
|
388
|
-
minWithDefault: y,
|
|
389
|
-
maxWithDefault: L,
|
|
390
|
-
disabled: I,
|
|
391
|
-
readOnly: R,
|
|
392
|
-
id: T,
|
|
393
|
-
setValue: Me,
|
|
394
|
-
incrementValue: Ce,
|
|
395
|
-
getStepAmount: be,
|
|
396
|
-
allowInputSyncRef: me,
|
|
397
|
-
formatOptionsRef: ie,
|
|
398
|
-
valueRef: oe,
|
|
399
|
-
lastChangedValueRef: Ee,
|
|
400
|
-
hasPendingCommitRef: re,
|
|
401
|
-
isPressedRef: Ve,
|
|
402
|
-
intentionalTouchCheckTimeout: he,
|
|
403
|
-
movesAfterTouchRef: Fe,
|
|
404
|
-
name: q,
|
|
405
|
-
required: _,
|
|
406
|
-
invalid: v,
|
|
407
|
-
inputMode: we,
|
|
408
|
-
getAllowedNonNumericKeys: Qe,
|
|
409
|
-
min: a,
|
|
410
|
-
max: f,
|
|
411
|
-
setInputValue: le,
|
|
412
|
-
locale: d,
|
|
413
|
-
isScrubbing: M,
|
|
414
|
-
setIsScrubbing: N,
|
|
415
|
-
state: He,
|
|
416
|
-
onValueCommitted: ue
|
|
417
|
-
}), [e, D, l, et, Re, y, L, I, R, T, Me, Ce, be, ie, oe, he, q, _, v, we, Qe, a, f, le, d, M, He, ue]), Lt = xe("div", r, {
|
|
418
|
-
ref: t,
|
|
419
|
-
state: He,
|
|
420
|
-
props: W,
|
|
421
|
-
stateAttributesMapping: ye
|
|
422
|
-
});
|
|
423
|
-
return /* @__PURE__ */ Ue(Xe.Provider, {
|
|
424
|
-
value: Mt,
|
|
425
|
-
children: [Lt, /* @__PURE__ */ se("input", {
|
|
426
|
-
...ee.getInputValidationProps({
|
|
427
|
-
onChange(F) {
|
|
428
|
-
if (F.nativeEvent.defaultPrevented)
|
|
429
|
-
return;
|
|
430
|
-
const E = F.currentTarget.valueAsNumber, B = Number.isNaN(E) ? null : E, $ = ce(on, F.nativeEvent);
|
|
431
|
-
x(B !== H.initialValue), Me(B, $), i() && ee.commit(B);
|
|
432
|
-
}
|
|
433
|
-
}),
|
|
434
|
-
ref: u,
|
|
435
|
-
type: "number",
|
|
436
|
-
name: q,
|
|
437
|
-
value: l ?? "",
|
|
438
|
-
min: a,
|
|
439
|
-
max: f,
|
|
440
|
-
step: p,
|
|
441
|
-
disabled: I,
|
|
442
|
-
required: _,
|
|
443
|
-
"aria-hidden": !0,
|
|
444
|
-
tabIndex: -1,
|
|
445
|
-
style: zt
|
|
446
|
-
})]
|
|
447
|
-
});
|
|
448
|
-
});
|
|
449
|
-
process.env.NODE_ENV !== "production" && (It.displayName = "NumberFieldRoot");
|
|
450
|
-
function lt(n, r, t) {
|
|
451
|
-
return t?.maximumFractionDigits != null || t?.minimumFractionDigits != null ? Te(n, r, t) : dt(n, r, t);
|
|
452
|
-
}
|
|
453
|
-
const At = /* @__PURE__ */ o.forwardRef(function(r, t) {
|
|
454
|
-
const {
|
|
455
|
-
render: s,
|
|
456
|
-
className: a,
|
|
457
|
-
...f
|
|
458
|
-
} = r, {
|
|
459
|
-
state: S
|
|
460
|
-
} = De();
|
|
461
|
-
return xe("div", r, {
|
|
462
|
-
ref: t,
|
|
463
|
-
state: S,
|
|
464
|
-
props: [{
|
|
465
|
-
role: "group"
|
|
466
|
-
}, f],
|
|
467
|
-
stateAttributesMapping: ye
|
|
468
|
-
});
|
|
469
|
-
});
|
|
470
|
-
process.env.NODE_ENV !== "production" && (At.displayName = "NumberFieldGroup");
|
|
471
|
-
function vt(n) {
|
|
472
|
-
const {
|
|
473
|
-
allowInputSyncRef: r,
|
|
474
|
-
disabled: t,
|
|
475
|
-
formatOptionsRef: s,
|
|
476
|
-
getStepAmount: a,
|
|
477
|
-
id: f,
|
|
478
|
-
incrementValue: S,
|
|
479
|
-
inputRef: p,
|
|
480
|
-
inputValue: m,
|
|
481
|
-
intentionalTouchCheckTimeout: _,
|
|
482
|
-
isIncrement: b,
|
|
483
|
-
isPressedRef: R,
|
|
484
|
-
locale: K,
|
|
485
|
-
maxWithDefault: G,
|
|
486
|
-
minWithDefault: h,
|
|
487
|
-
movesAfterTouchRef: w,
|
|
488
|
-
readOnly: O,
|
|
489
|
-
setValue: X,
|
|
490
|
-
startAutoChange: V,
|
|
491
|
-
stopAutoChange: g,
|
|
492
|
-
value: d,
|
|
493
|
-
valueRef: k,
|
|
494
|
-
lastChangedValueRef: Y,
|
|
495
|
-
onValueCommitted: c
|
|
496
|
-
} = n, W = o.useRef({
|
|
497
|
-
x: 0,
|
|
498
|
-
y: 0
|
|
499
|
-
}), x = o.useRef(!1), H = o.useRef(!1), j = o.useRef(""), z = d != null && d <= h, v = d != null && d >= G, Q = b ? "increment-press" : "decrement-press";
|
|
500
|
-
function U(i) {
|
|
501
|
-
r.current = !0;
|
|
502
|
-
const I = Se(m, K, s.current);
|
|
503
|
-
I !== null && (k.current = I, X(I, ce(Q, i, void 0, {
|
|
504
|
-
direction: b ? 1 : -1
|
|
505
|
-
})));
|
|
506
|
-
}
|
|
507
|
-
return {
|
|
508
|
-
disabled: t || (b ? v : z),
|
|
509
|
-
"aria-readonly": O || void 0,
|
|
510
|
-
"aria-label": b ? "Increase" : "Decrease",
|
|
511
|
-
"aria-controls": f,
|
|
512
|
-
// Keyboard users shouldn't have access to the buttons, since they can use the input element
|
|
513
|
-
// to change the value. On the other hand, `aria-hidden` is not applied because touch screen
|
|
514
|
-
// readers should be able to use the buttons.
|
|
515
|
-
tabIndex: -1,
|
|
516
|
-
style: {
|
|
517
|
-
WebkitUserSelect: "none",
|
|
518
|
-
userSelect: "none"
|
|
519
|
-
},
|
|
520
|
-
onTouchStart() {
|
|
521
|
-
x.current = !0;
|
|
522
|
-
},
|
|
523
|
-
onTouchEnd() {
|
|
524
|
-
x.current = !1;
|
|
525
|
-
},
|
|
526
|
-
onClick(i) {
|
|
527
|
-
const I = t || O || (b ? v : z);
|
|
528
|
-
if (i.defaultPrevented || I || // If it's not a keyboard/virtual click, ignore.
|
|
529
|
-
(j.current === "touch" ? H.current : i.detail !== 0))
|
|
530
|
-
return;
|
|
531
|
-
U(i.nativeEvent);
|
|
532
|
-
const q = a(i) ?? Pe, M = k.current;
|
|
533
|
-
S(q, {
|
|
534
|
-
direction: b ? 1 : -1,
|
|
535
|
-
event: i.nativeEvent,
|
|
536
|
-
reason: Q
|
|
537
|
-
});
|
|
538
|
-
const N = Y.current ?? k.current;
|
|
539
|
-
N !== M && c(N, _e(Q, i.nativeEvent));
|
|
540
|
-
},
|
|
541
|
-
onPointerDown(i) {
|
|
542
|
-
const I = !i.button || i.button === 0, q = t || (b ? v : z);
|
|
543
|
-
i.defaultPrevented || O || !I || q || (j.current = i.pointerType, H.current = !1, R.current = !0, W.current = {
|
|
544
|
-
x: i.clientX,
|
|
545
|
-
y: i.clientY
|
|
546
|
-
}, U(i.nativeEvent), i.pointerType !== "touch" ? (i.preventDefault(), p.current?.focus(), V(b, i)) : _.start(vn, () => {
|
|
547
|
-
const M = w.current;
|
|
548
|
-
w.current = 0, R.current && M != null && M < Tn ? (V(b, i), H.current = !0) : (H.current = !1, g());
|
|
549
|
-
}));
|
|
550
|
-
},
|
|
551
|
-
onPointerUp(i) {
|
|
552
|
-
i.pointerType === "touch" && (R.current = !1);
|
|
553
|
-
},
|
|
554
|
-
onPointerMove(i) {
|
|
555
|
-
if (t || O || (b ? v : z) || i.pointerType !== "touch" || !R.current)
|
|
556
|
-
return;
|
|
557
|
-
w.current != null && (w.current += 1);
|
|
558
|
-
const {
|
|
559
|
-
x: q,
|
|
560
|
-
y: M
|
|
561
|
-
} = W.current, N = q - i.clientX, y = M - i.clientY;
|
|
562
|
-
N ** 2 + y ** 2 > Pn ** 2 && g();
|
|
563
|
-
},
|
|
564
|
-
onMouseEnter(i) {
|
|
565
|
-
const I = t || O || (b ? v : z);
|
|
566
|
-
i.defaultPrevented || I || !R.current || x.current || j.current === "touch" || V(b, i);
|
|
567
|
-
},
|
|
568
|
-
onMouseLeave() {
|
|
569
|
-
x.current || g();
|
|
570
|
-
},
|
|
571
|
-
onMouseUp() {
|
|
572
|
-
x.current || g();
|
|
573
|
-
}
|
|
574
|
-
};
|
|
575
|
-
}
|
|
576
|
-
const Tt = /* @__PURE__ */ o.forwardRef(function(r, t) {
|
|
577
|
-
const {
|
|
578
|
-
render: s,
|
|
579
|
-
className: a,
|
|
580
|
-
disabled: f = !1,
|
|
581
|
-
nativeButton: S = !0,
|
|
582
|
-
...p
|
|
583
|
-
} = r, {
|
|
584
|
-
allowInputSyncRef: m,
|
|
585
|
-
disabled: _,
|
|
586
|
-
formatOptionsRef: b,
|
|
587
|
-
getStepAmount: R,
|
|
588
|
-
id: K,
|
|
589
|
-
incrementValue: G,
|
|
590
|
-
inputRef: h,
|
|
591
|
-
inputValue: w,
|
|
592
|
-
intentionalTouchCheckTimeout: O,
|
|
593
|
-
isPressedRef: X,
|
|
594
|
-
locale: V,
|
|
595
|
-
maxWithDefault: g,
|
|
596
|
-
minWithDefault: d,
|
|
597
|
-
movesAfterTouchRef: k,
|
|
598
|
-
readOnly: Y,
|
|
599
|
-
setValue: c,
|
|
600
|
-
startAutoChange: W,
|
|
601
|
-
state: x,
|
|
602
|
-
stopAutoChange: H,
|
|
603
|
-
value: j,
|
|
604
|
-
valueRef: z,
|
|
605
|
-
lastChangedValueRef: v,
|
|
606
|
-
onValueCommitted: Q
|
|
607
|
-
} = De(), U = f || _, ee = vt({
|
|
608
|
-
isIncrement: !0,
|
|
609
|
-
inputRef: h,
|
|
610
|
-
startAutoChange: W,
|
|
611
|
-
stopAutoChange: H,
|
|
612
|
-
minWithDefault: d,
|
|
613
|
-
maxWithDefault: g,
|
|
614
|
-
value: j,
|
|
615
|
-
inputValue: w,
|
|
616
|
-
disabled: U,
|
|
617
|
-
readOnly: Y,
|
|
618
|
-
id: K,
|
|
619
|
-
setValue: c,
|
|
620
|
-
getStepAmount: R,
|
|
621
|
-
incrementValue: G,
|
|
622
|
-
allowInputSyncRef: m,
|
|
623
|
-
formatOptionsRef: b,
|
|
624
|
-
valueRef: z,
|
|
625
|
-
isPressedRef: X,
|
|
626
|
-
intentionalTouchCheckTimeout: O,
|
|
627
|
-
movesAfterTouchRef: k,
|
|
628
|
-
locale: V,
|
|
629
|
-
lastChangedValueRef: v,
|
|
630
|
-
onValueCommitted: Q
|
|
631
|
-
}), {
|
|
632
|
-
getButtonProps: i,
|
|
633
|
-
buttonRef: I
|
|
634
|
-
} = mt({
|
|
635
|
-
disabled: U,
|
|
636
|
-
native: S
|
|
637
|
-
}), q = o.useMemo(() => ({
|
|
638
|
-
...x,
|
|
639
|
-
disabled: U
|
|
640
|
-
}), [x, U]);
|
|
641
|
-
return xe("button", r, {
|
|
642
|
-
ref: [t, I],
|
|
643
|
-
state: q,
|
|
644
|
-
props: [ee, p, i],
|
|
645
|
-
stateAttributesMapping: ye
|
|
646
|
-
});
|
|
647
|
-
});
|
|
648
|
-
process.env.NODE_ENV !== "production" && (Tt.displayName = "NumberFieldIncrement");
|
|
649
|
-
const Pt = /* @__PURE__ */ o.forwardRef(function(r, t) {
|
|
650
|
-
const {
|
|
651
|
-
render: s,
|
|
652
|
-
className: a,
|
|
653
|
-
disabled: f = !1,
|
|
654
|
-
nativeButton: S = !0,
|
|
655
|
-
...p
|
|
656
|
-
} = r, {
|
|
657
|
-
allowInputSyncRef: m,
|
|
658
|
-
disabled: _,
|
|
659
|
-
formatOptionsRef: b,
|
|
660
|
-
getStepAmount: R,
|
|
661
|
-
id: K,
|
|
662
|
-
incrementValue: G,
|
|
663
|
-
inputRef: h,
|
|
664
|
-
inputValue: w,
|
|
665
|
-
intentionalTouchCheckTimeout: O,
|
|
666
|
-
isPressedRef: X,
|
|
667
|
-
maxWithDefault: V,
|
|
668
|
-
minWithDefault: g,
|
|
669
|
-
movesAfterTouchRef: d,
|
|
670
|
-
readOnly: k,
|
|
671
|
-
setValue: Y,
|
|
672
|
-
startAutoChange: c,
|
|
673
|
-
state: W,
|
|
674
|
-
stopAutoChange: x,
|
|
675
|
-
value: H,
|
|
676
|
-
valueRef: j,
|
|
677
|
-
locale: z,
|
|
678
|
-
lastChangedValueRef: v,
|
|
679
|
-
onValueCommitted: Q
|
|
680
|
-
} = De(), U = f || _, ee = vt({
|
|
681
|
-
isIncrement: !1,
|
|
682
|
-
inputRef: h,
|
|
683
|
-
startAutoChange: c,
|
|
684
|
-
stopAutoChange: x,
|
|
685
|
-
minWithDefault: g,
|
|
686
|
-
maxWithDefault: V,
|
|
687
|
-
value: H,
|
|
688
|
-
inputValue: w,
|
|
689
|
-
disabled: U,
|
|
690
|
-
readOnly: k,
|
|
691
|
-
id: K,
|
|
692
|
-
setValue: Y,
|
|
693
|
-
getStepAmount: R,
|
|
694
|
-
incrementValue: G,
|
|
695
|
-
allowInputSyncRef: m,
|
|
696
|
-
formatOptionsRef: b,
|
|
697
|
-
valueRef: j,
|
|
698
|
-
isPressedRef: X,
|
|
699
|
-
intentionalTouchCheckTimeout: O,
|
|
700
|
-
movesAfterTouchRef: d,
|
|
701
|
-
locale: z,
|
|
702
|
-
lastChangedValueRef: v,
|
|
703
|
-
onValueCommitted: Q
|
|
704
|
-
}), {
|
|
705
|
-
getButtonProps: i,
|
|
706
|
-
buttonRef: I
|
|
707
|
-
} = mt({
|
|
708
|
-
disabled: U,
|
|
709
|
-
native: S
|
|
710
|
-
}), q = o.useMemo(() => ({
|
|
711
|
-
...W,
|
|
712
|
-
disabled: U
|
|
713
|
-
}), [W, U]);
|
|
714
|
-
return xe("button", r, {
|
|
715
|
-
ref: [t, I],
|
|
716
|
-
state: q,
|
|
717
|
-
props: [ee, p, i],
|
|
718
|
-
stateAttributesMapping: ye
|
|
719
|
-
});
|
|
720
|
-
});
|
|
721
|
-
process.env.NODE_ENV !== "production" && (Pt.displayName = "NumberFieldDecrement");
|
|
722
|
-
const Ln = {
|
|
723
|
-
...nn,
|
|
724
|
-
...ye
|
|
725
|
-
}, On = /* @__PURE__ */ new Set(["Backspace", "Delete", "ArrowLeft", "ArrowRight", "Tab", "Enter", "Escape"]), Dt = /* @__PURE__ */ o.forwardRef(function(r, t) {
|
|
726
|
-
const {
|
|
727
|
-
render: s,
|
|
728
|
-
className: a,
|
|
729
|
-
...f
|
|
730
|
-
} = r, {
|
|
731
|
-
allowInputSyncRef: S,
|
|
732
|
-
disabled: p,
|
|
733
|
-
formatOptionsRef: m,
|
|
734
|
-
getAllowedNonNumericKeys: _,
|
|
735
|
-
getStepAmount: b,
|
|
736
|
-
id: R,
|
|
737
|
-
incrementValue: K,
|
|
738
|
-
inputMode: G,
|
|
739
|
-
inputValue: h,
|
|
740
|
-
max: w,
|
|
741
|
-
min: O,
|
|
742
|
-
name: X,
|
|
743
|
-
readOnly: V,
|
|
744
|
-
required: g,
|
|
745
|
-
setValue: d,
|
|
746
|
-
state: k,
|
|
747
|
-
setInputValue: Y,
|
|
748
|
-
locale: c,
|
|
749
|
-
inputRef: W,
|
|
750
|
-
value: x,
|
|
751
|
-
onValueCommitted: H,
|
|
752
|
-
lastChangedValueRef: j,
|
|
753
|
-
hasPendingCommitRef: z,
|
|
754
|
-
valueRef: v
|
|
755
|
-
} = De(), {
|
|
756
|
-
clearErrors: Q
|
|
757
|
-
} = Qt(), {
|
|
758
|
-
validationMode: U,
|
|
759
|
-
setTouched: ee,
|
|
760
|
-
setFocused: i,
|
|
761
|
-
invalid: I,
|
|
762
|
-
shouldValidateOnChange: q,
|
|
763
|
-
validation: M
|
|
764
|
-
} = ft(), {
|
|
765
|
-
labelId: N
|
|
766
|
-
} = en(), y = o.useRef(!1), L = o.useRef(!1);
|
|
767
|
-
return tn({
|
|
768
|
-
id: R,
|
|
769
|
-
commit: M.commit,
|
|
770
|
-
value: x,
|
|
771
|
-
controlRef: W,
|
|
772
|
-
name: X,
|
|
773
|
-
getValue: () => x ?? null
|
|
774
|
-
}), an(x, (e) => {
|
|
775
|
-
const u = q();
|
|
776
|
-
if (Q(X), u && M.commit(x), !(e === x || u)) {
|
|
777
|
-
if (L.current) {
|
|
778
|
-
L.current = !1;
|
|
779
|
-
return;
|
|
780
|
-
}
|
|
781
|
-
M.commit(x, !0);
|
|
782
|
-
}
|
|
783
|
-
}), xe("input", r, {
|
|
784
|
-
ref: [t, W],
|
|
785
|
-
state: k,
|
|
786
|
-
props: [{
|
|
787
|
-
id: R,
|
|
788
|
-
required: g,
|
|
789
|
-
disabled: p,
|
|
790
|
-
readOnly: V,
|
|
791
|
-
inputMode: G,
|
|
792
|
-
value: h,
|
|
793
|
-
type: "text",
|
|
794
|
-
autoComplete: "off",
|
|
795
|
-
autoCorrect: "off",
|
|
796
|
-
spellCheck: "false",
|
|
797
|
-
"aria-roledescription": "Number field",
|
|
798
|
-
"aria-invalid": I || void 0,
|
|
799
|
-
"aria-labelledby": N,
|
|
800
|
-
// If the server's locale does not match the client's locale, the formatting may not match,
|
|
801
|
-
// causing a hydration mismatch.
|
|
802
|
-
suppressHydrationWarning: !0,
|
|
803
|
-
onFocus(e) {
|
|
804
|
-
if (e.defaultPrevented || V || p || y.current)
|
|
805
|
-
return;
|
|
806
|
-
y.current = !0, i(!0);
|
|
807
|
-
const u = e.currentTarget, T = u.value.length;
|
|
808
|
-
u.setSelectionRange(T, T);
|
|
809
|
-
},
|
|
810
|
-
onBlur(e) {
|
|
811
|
-
if (e.defaultPrevented || V || p)
|
|
812
|
-
return;
|
|
813
|
-
ee(!0), i(!1);
|
|
814
|
-
const u = !S.current, T = z.current;
|
|
815
|
-
if (S.current = !0, h.trim() === "") {
|
|
816
|
-
d(null, ce(Be, e.nativeEvent)), U === "onBlur" && M.commit(null), H(null, _e(Be, e.nativeEvent));
|
|
817
|
-
return;
|
|
818
|
-
}
|
|
819
|
-
const P = m.current, J = Se(h, c, P);
|
|
820
|
-
if (J === null)
|
|
821
|
-
return;
|
|
822
|
-
const l = P?.maximumFractionDigits != null || P?.minimumFractionDigits != null, oe = P?.maximumFractionDigits, te = l && typeof oe == "number" ? Number(J.toFixed(oe)) : J, ie = _e(st, e.nativeEvent), re = x !== te, ue = u || re || T;
|
|
823
|
-
U === "onBlur" && M.commit(te), re && (L.current = !0, d(te, ce(st, e.nativeEvent))), ue && H(te, ie);
|
|
824
|
-
const fe = Te(te, c, P), ge = dt(J, c, P);
|
|
825
|
-
!(!l && J === x && h === ge) && h !== fe && Y(fe);
|
|
826
|
-
},
|
|
827
|
-
onChange(e) {
|
|
828
|
-
if (e.nativeEvent.defaultPrevented)
|
|
829
|
-
return;
|
|
830
|
-
S.current = !1;
|
|
831
|
-
const u = e.target.value;
|
|
832
|
-
if (u.trim() === "") {
|
|
833
|
-
Y(u), d(null, ce(Be, e.nativeEvent));
|
|
834
|
-
return;
|
|
835
|
-
}
|
|
836
|
-
const T = _();
|
|
837
|
-
if (!Array.from(u).every((l) => {
|
|
838
|
-
const oe = l >= "0" && l <= "9", te = je.test(l), ie = ze.test(l), re = Nt.test(l), ue = at.test(l), fe = ve.test(l);
|
|
839
|
-
return oe || te || ie || re || ue || fe || T.has(l);
|
|
840
|
-
}))
|
|
841
|
-
return;
|
|
842
|
-
if (e.isTrusted) {
|
|
843
|
-
Y(u);
|
|
844
|
-
const l = Se(u, c, m.current);
|
|
845
|
-
l !== null && d(l, ce(rt, e.nativeEvent));
|
|
846
|
-
return;
|
|
847
|
-
}
|
|
848
|
-
const J = Se(u, c, m.current);
|
|
849
|
-
J !== null && (Y(u), d(J, ce(rt, e.nativeEvent)));
|
|
850
|
-
},
|
|
851
|
-
onKeyDown(e) {
|
|
852
|
-
if (e.defaultPrevented || V || p)
|
|
853
|
-
return;
|
|
854
|
-
const u = e.nativeEvent;
|
|
855
|
-
S.current = !0;
|
|
856
|
-
const T = _();
|
|
857
|
-
let P = T.has(e.key);
|
|
858
|
-
const {
|
|
859
|
-
decimal: J,
|
|
860
|
-
currency: l,
|
|
861
|
-
percentSign: oe
|
|
862
|
-
} = Je(c, m.current), te = e.currentTarget.selectionStart, ie = e.currentTarget.selectionEnd, re = te === 0 && ie === h.length, ue = (D) => te != null && ie != null && D >= te && D < ie;
|
|
863
|
-
if (ve.test(e.key) && Array.from(T).some((D) => ve.test(D || ""))) {
|
|
864
|
-
const D = h.search(yt), le = D != null && D !== -1 && ue(D);
|
|
865
|
-
P = !(ve.test(h) || Oe.test(h)) || re || le;
|
|
866
|
-
}
|
|
867
|
-
if (Oe.test(e.key) && Array.from(T).some((D) => Oe.test(D || ""))) {
|
|
868
|
-
const D = h.search(Ct), le = D != null && D !== -1 && ue(D);
|
|
869
|
-
P = !(ve.test(h) || Oe.test(h)) || re || le;
|
|
870
|
-
}
|
|
871
|
-
[J, l, oe].forEach((D) => {
|
|
872
|
-
if (e.key === D) {
|
|
873
|
-
const le = h.indexOf(D), we = ue(le);
|
|
874
|
-
P = !h.includes(D) || re || we;
|
|
875
|
-
}
|
|
876
|
-
});
|
|
877
|
-
const fe = e.key >= "0" && e.key <= "9", ge = je.test(e.key), he = ze.test(e.key), Ve = at.test(e.key), Fe = On.has(e.key);
|
|
878
|
-
if (
|
|
879
|
-
// Allow composition events (e.g., pinyin)
|
|
880
|
-
// event.nativeEvent.isComposing does not work in Safari:
|
|
881
|
-
// https://bugs.webkit.org/show_bug.cgi?id=165004
|
|
882
|
-
e.which === 229 || e.altKey || e.ctrlKey || e.metaKey || P || fe || ge || Ve || he || Fe
|
|
883
|
-
)
|
|
884
|
-
return;
|
|
885
|
-
const me = Se(h, c, m.current), Ee = b(e) ?? Pe;
|
|
886
|
-
cn(e);
|
|
887
|
-
const pe = _e(Ae, u);
|
|
888
|
-
e.key === "ArrowUp" ? (K(Ee, {
|
|
889
|
-
direction: 1,
|
|
890
|
-
currentValue: me,
|
|
891
|
-
event: u,
|
|
892
|
-
reason: Ae
|
|
893
|
-
}), H(j.current ?? v.current, pe)) : e.key === "ArrowDown" ? (K(Ee, {
|
|
894
|
-
direction: -1,
|
|
895
|
-
currentValue: me,
|
|
896
|
-
event: u,
|
|
897
|
-
reason: Ae
|
|
898
|
-
}), H(j.current ?? v.current, pe)) : e.key === "Home" && O != null ? (d(O, ce(Ae, u)), H(j.current ?? v.current, pe)) : e.key === "End" && w != null && (d(w, ce(Ae, u)), H(j.current ?? v.current, pe));
|
|
899
|
-
},
|
|
900
|
-
onPaste(e) {
|
|
901
|
-
if (e.defaultPrevented || V || p)
|
|
902
|
-
return;
|
|
903
|
-
e.preventDefault();
|
|
904
|
-
const T = (e.clipboardData || window.Clipboard).getData("text/plain"), P = Se(T, c, m.current);
|
|
905
|
-
P !== null && (S.current = !1, d(P, ce(un, e.nativeEvent)), Y(T));
|
|
906
|
-
}
|
|
907
|
-
}, M.getValidationProps(), f],
|
|
908
|
-
stateAttributesMapping: Ln
|
|
909
|
-
});
|
|
910
|
-
});
|
|
911
|
-
process.env.NODE_ENV !== "production" && (Dt.displayName = "NumberFieldInput");
|
|
912
|
-
const Vt = /* @__PURE__ */ o.createContext(void 0);
|
|
913
|
-
process.env.NODE_ENV !== "production" && (Vt.displayName = "NumberFieldScrubAreaContext");
|
|
914
|
-
function Un(n, r) {
|
|
915
|
-
const t = We(r), s = r.getBoundingClientRect();
|
|
916
|
-
if (s && n != null)
|
|
917
|
-
return {
|
|
918
|
-
x: s.left - n / 2,
|
|
919
|
-
y: s.top - n / 2,
|
|
920
|
-
width: s.right + n / 2,
|
|
921
|
-
height: s.bottom + n / 2
|
|
922
|
-
};
|
|
923
|
-
const a = t.visualViewport;
|
|
924
|
-
return a ? {
|
|
925
|
-
x: a.offsetLeft,
|
|
926
|
-
y: a.offsetTop,
|
|
927
|
-
width: a.offsetLeft + a.width,
|
|
928
|
-
height: a.offsetTop + a.height
|
|
929
|
-
} : {
|
|
930
|
-
x: 0,
|
|
931
|
-
y: 0,
|
|
932
|
-
width: t.document.documentElement.clientWidth,
|
|
933
|
-
height: t.document.documentElement.clientHeight
|
|
934
|
-
};
|
|
935
|
-
}
|
|
936
|
-
function kn(n, r) {
|
|
937
|
-
const t = We(n).visualViewport;
|
|
938
|
-
if (!t)
|
|
939
|
-
return () => {
|
|
940
|
-
};
|
|
941
|
-
function s() {
|
|
942
|
-
t && (r.current = t.scale);
|
|
943
|
-
}
|
|
944
|
-
return s(), t.addEventListener("resize", s), () => {
|
|
945
|
-
t.removeEventListener("resize", s);
|
|
946
|
-
};
|
|
947
|
-
}
|
|
948
|
-
const Ft = /* @__PURE__ */ o.forwardRef(function(r, t) {
|
|
949
|
-
const {
|
|
950
|
-
render: s,
|
|
951
|
-
className: a,
|
|
952
|
-
direction: f = "horizontal",
|
|
953
|
-
pixelSensitivity: S = 2,
|
|
954
|
-
teleportDistance: p,
|
|
955
|
-
...m
|
|
956
|
-
} = r, {
|
|
957
|
-
state: _,
|
|
958
|
-
setIsScrubbing: b,
|
|
959
|
-
disabled: R,
|
|
960
|
-
readOnly: K,
|
|
961
|
-
inputRef: G,
|
|
962
|
-
incrementValue: h,
|
|
963
|
-
getStepAmount: w,
|
|
964
|
-
onValueCommitted: O,
|
|
965
|
-
lastChangedValueRef: X,
|
|
966
|
-
valueRef: V
|
|
967
|
-
} = De(), g = o.useRef(null), d = o.useRef(!1), k = o.useRef(null), Y = o.useRef({
|
|
968
|
-
x: 0,
|
|
969
|
-
y: 0
|
|
970
|
-
}), c = o.useRef(1), W = Ke(), [x, H] = o.useState(!1), [j, z] = o.useState(!1), [v, Q] = o.useState(!1);
|
|
971
|
-
o.useEffect(() => {
|
|
972
|
-
if (!(!v || !k.current))
|
|
973
|
-
return kn(k.current, c);
|
|
974
|
-
}, [v]);
|
|
975
|
-
function U(N, y) {
|
|
976
|
-
k.current && (k.current.style.transform = `translate3d(${N}px,${y}px,0) scale(${1 / c.current})`);
|
|
977
|
-
}
|
|
978
|
-
const ee = de(({
|
|
979
|
-
movementX: N,
|
|
980
|
-
movementY: y
|
|
981
|
-
}) => {
|
|
982
|
-
const L = k.current, Z = g.current;
|
|
983
|
-
if (!L || !Z)
|
|
984
|
-
return;
|
|
985
|
-
const A = Un(p, Z), e = Y.current, u = {
|
|
986
|
-
x: Math.round(e.x + N),
|
|
987
|
-
y: Math.round(e.y + y)
|
|
988
|
-
}, T = L.offsetWidth, P = L.offsetHeight;
|
|
989
|
-
u.x + T / 2 < A.x ? u.x = A.width - T / 2 : u.x + T / 2 > A.width && (u.x = A.x - T / 2), u.y + P / 2 < A.y ? u.y = A.height - P / 2 : u.y + P / 2 > A.height && (u.y = A.y - P / 2), Y.current = u, U(u.x, u.y);
|
|
990
|
-
}), i = de((N, {
|
|
991
|
-
clientX: y,
|
|
992
|
-
clientY: L
|
|
993
|
-
}) => {
|
|
994
|
-
it.flushSync(() => {
|
|
995
|
-
Q(N), b(N);
|
|
996
|
-
});
|
|
997
|
-
const Z = k.current;
|
|
998
|
-
if (!Z || !N)
|
|
999
|
-
return;
|
|
1000
|
-
const A = {
|
|
1001
|
-
x: y - Z.offsetWidth / 2,
|
|
1002
|
-
y: L - Z.offsetHeight / 2
|
|
1003
|
-
};
|
|
1004
|
-
Y.current = A, U(A.x, A.y);
|
|
1005
|
-
});
|
|
1006
|
-
o.useEffect(function() {
|
|
1007
|
-
if (!G.current || R || K || !v)
|
|
1008
|
-
return;
|
|
1009
|
-
let y = 0;
|
|
1010
|
-
function L(e) {
|
|
1011
|
-
function u() {
|
|
1012
|
-
try {
|
|
1013
|
-
Ye(g.current).exitPointerLock();
|
|
1014
|
-
} catch {
|
|
1015
|
-
} finally {
|
|
1016
|
-
d.current = !1, i(!1, e), O(X.current ?? V.current, _e(ot, e));
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
Xt ? W.start(20, u) : u();
|
|
1020
|
-
}
|
|
1021
|
-
function Z(e) {
|
|
1022
|
-
if (!d.current)
|
|
1023
|
-
return;
|
|
1024
|
-
e.preventDefault(), ee(e);
|
|
1025
|
-
const {
|
|
1026
|
-
movementX: u,
|
|
1027
|
-
movementY: T
|
|
1028
|
-
} = e;
|
|
1029
|
-
if (y += f === "vertical" ? T : u, Math.abs(y) >= S) {
|
|
1030
|
-
y = 0;
|
|
1031
|
-
const P = f === "vertical" ? -T : u, J = w(e) ?? Pe, l = P * J;
|
|
1032
|
-
l !== 0 && h(Math.abs(l), {
|
|
1033
|
-
direction: l >= 0 ? 1 : -1,
|
|
1034
|
-
event: e,
|
|
1035
|
-
reason: ot
|
|
1036
|
-
});
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
const A = We(G.current);
|
|
1040
|
-
return A.addEventListener("pointerup", L, !0), A.addEventListener("pointermove", Z, !0), () => {
|
|
1041
|
-
W.clear(), A.removeEventListener("pointerup", L, !0), A.removeEventListener("pointermove", Z, !0);
|
|
1042
|
-
};
|
|
1043
|
-
}, [R, K, h, v, w, G, i, ee, f, S, X, O, V, W]), o.useEffect(function() {
|
|
1044
|
-
const y = g.current;
|
|
1045
|
-
if (!y || R || K)
|
|
1046
|
-
return;
|
|
1047
|
-
function L(Z) {
|
|
1048
|
-
Z.touches.length === 1 && Z.preventDefault();
|
|
1049
|
-
}
|
|
1050
|
-
return y.addEventListener("touchstart", L), () => {
|
|
1051
|
-
y.removeEventListener("touchstart", L);
|
|
1052
|
-
};
|
|
1053
|
-
}, [R, K]);
|
|
1054
|
-
const q = xe("span", r, {
|
|
1055
|
-
ref: [t, g],
|
|
1056
|
-
state: _,
|
|
1057
|
-
props: [{
|
|
1058
|
-
role: "presentation",
|
|
1059
|
-
style: {
|
|
1060
|
-
touchAction: "none",
|
|
1061
|
-
WebkitUserSelect: "none",
|
|
1062
|
-
userSelect: "none"
|
|
1063
|
-
},
|
|
1064
|
-
async onPointerDown(N) {
|
|
1065
|
-
const y = !N.button || N.button === 0;
|
|
1066
|
-
if (N.defaultPrevented || K || !y || R)
|
|
1067
|
-
return;
|
|
1068
|
-
const L = N.pointerType === "touch";
|
|
1069
|
-
if (H(L), N.pointerType === "mouse" && (N.preventDefault(), G.current?.focus()), d.current = !0, i(!0, N.nativeEvent), !L && !Zt)
|
|
1070
|
-
try {
|
|
1071
|
-
await Ye(g.current).body.requestPointerLock(), z(!1);
|
|
1072
|
-
} catch {
|
|
1073
|
-
z(!0);
|
|
1074
|
-
} finally {
|
|
1075
|
-
d.current && it.flushSync(() => {
|
|
1076
|
-
i(!0, N.nativeEvent);
|
|
1077
|
-
});
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
}, m],
|
|
1081
|
-
stateAttributesMapping: ye
|
|
1082
|
-
}), M = o.useMemo(() => ({
|
|
1083
|
-
isScrubbing: v,
|
|
1084
|
-
isTouchInput: x,
|
|
1085
|
-
isPointerLockDenied: j,
|
|
1086
|
-
scrubAreaCursorRef: k,
|
|
1087
|
-
scrubAreaRef: g,
|
|
1088
|
-
direction: f,
|
|
1089
|
-
pixelSensitivity: S,
|
|
1090
|
-
teleportDistance: p
|
|
1091
|
-
}), [v, x, j, f, S, p]);
|
|
1092
|
-
return /* @__PURE__ */ se(Vt.Provider, {
|
|
1093
|
-
value: M,
|
|
1094
|
-
children: q
|
|
1095
|
-
});
|
|
1096
|
-
});
|
|
1097
|
-
process.env.NODE_ENV !== "production" && (Ft.displayName = "NumberFieldScrubArea");
|
|
1098
|
-
const Ne = {
|
|
1099
|
-
"number-input__root": "_number-input__root_12e9i_1",
|
|
1100
|
-
"number-input": "_number-input_12e9i_1",
|
|
1101
|
-
"number-input__scrub-area": "_number-input__scrub-area_12e9i_19",
|
|
1102
|
-
"number-input__group": "_number-input__group_12e9i_24",
|
|
1103
|
-
"number-input__controls": "_number-input__controls_12e9i_28",
|
|
1104
|
-
"number-input__separator": "_number-input__separator_12e9i_39"
|
|
1105
|
-
};
|
|
1106
|
-
function pr({
|
|
1107
|
-
label: n,
|
|
1108
|
-
/** Apply className to NumberField.Input */
|
|
1109
|
-
className: r,
|
|
1110
|
-
/** Apply style to NumberField.Input */
|
|
1111
|
-
style: t,
|
|
1112
|
-
...s
|
|
1113
|
-
}) {
|
|
1114
|
-
const a = Ut(), f = s.id || a;
|
|
1115
|
-
return /* @__PURE__ */ Ue(
|
|
1116
|
-
It,
|
|
1117
|
-
{
|
|
1118
|
-
id: f,
|
|
1119
|
-
className: Ne["number-input__root"],
|
|
1120
|
-
...s,
|
|
1121
|
-
children: [
|
|
1122
|
-
n ? /* @__PURE__ */ se(Ft, { className: Ne["number-input__scrub-area"], children: /* @__PURE__ */ se("label", { htmlFor: f, children: /* @__PURE__ */ se(Ht, { color: "dimmer", children: n }) }) }) : null,
|
|
1123
|
-
/* @__PURE__ */ Ue(At, { className: Ne["number-input__group"], children: [
|
|
1124
|
-
/* @__PURE__ */ se(
|
|
1125
|
-
kt,
|
|
1126
|
-
{
|
|
1127
|
-
render: /* @__PURE__ */ se(
|
|
1128
|
-
Dt,
|
|
1129
|
-
{
|
|
1130
|
-
className: Ot(Ne["number-input"], r),
|
|
1131
|
-
style: t
|
|
1132
|
-
}
|
|
1133
|
-
)
|
|
1134
|
-
}
|
|
1135
|
-
),
|
|
1136
|
-
/* @__PURE__ */ Ue(Gt, { className: Ne["number-input__controls"], children: [
|
|
1137
|
-
/* @__PURE__ */ se(
|
|
1138
|
-
tt,
|
|
1139
|
-
{
|
|
1140
|
-
size: "sm",
|
|
1141
|
-
alt: "Decrement",
|
|
1142
|
-
icon: "subtract-line",
|
|
1143
|
-
render: /* @__PURE__ */ se(Pt, {})
|
|
1144
|
-
}
|
|
1145
|
-
),
|
|
1146
|
-
/* @__PURE__ */ se(
|
|
1147
|
-
Wt,
|
|
1148
|
-
{
|
|
1149
|
-
orientation: "vertical",
|
|
1150
|
-
className: Ne["number-input__separator"]
|
|
1151
|
-
}
|
|
1152
|
-
),
|
|
1153
|
-
/* @__PURE__ */ se(
|
|
1154
|
-
tt,
|
|
1155
|
-
{
|
|
1156
|
-
size: "sm",
|
|
1157
|
-
alt: "Increment",
|
|
1158
|
-
icon: "add-line",
|
|
1159
|
-
render: /* @__PURE__ */ se(Tt, {})
|
|
1160
|
-
}
|
|
1161
|
-
)
|
|
1162
|
-
] })
|
|
1163
|
-
] })
|
|
1164
|
-
]
|
|
1165
|
-
}
|
|
1166
|
-
);
|
|
1167
|
-
}
|
|
2
|
+
import { NumberInput as t } from "./number-input.js";
|
|
1168
3
|
export {
|
|
1169
|
-
|
|
4
|
+
t as NumberInput
|
|
1170
5
|
};
|