@timeax/form-palette 0.1.27 → 0.1.28
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/{core-BxK4PLut.d.mts → core-BS2fNt2O.d.mts} +4 -11
- package/dist/{core-DDFFngF0.d.ts → core-CtnF6uJt.d.ts} +4 -11
- package/dist/extra.d.mts +2 -2
- package/dist/extra.d.ts +2 -2
- package/dist/extra.js +277 -877
- package/dist/extra.js.map +1 -1
- package/dist/extra.mjs +277 -877
- package/dist/extra.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +854 -1454
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +778 -1378
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as React66 from 'react';
|
|
2
|
+
import React66__default, { forwardRef, createElement, createContext, useMemo, useCallback, useRef, useState, useEffect, useLayoutEffect, useContext } from 'react';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
5
5
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
@@ -5594,7 +5594,7 @@ function getAdapter(key) {
|
|
|
5594
5594
|
function hasAdapter(key) {
|
|
5595
5595
|
return typeof registry[key] === "function";
|
|
5596
5596
|
}
|
|
5597
|
-
var CoreContextReact =
|
|
5597
|
+
var CoreContextReact = React66__default.createContext(
|
|
5598
5598
|
null
|
|
5599
5599
|
);
|
|
5600
5600
|
|
|
@@ -9175,16 +9175,16 @@ function deepEqual(a3, b2) {
|
|
|
9175
9175
|
}
|
|
9176
9176
|
function CoreProvider(props) {
|
|
9177
9177
|
var _a, _b;
|
|
9178
|
-
const registryRef =
|
|
9179
|
-
const bucketRef =
|
|
9180
|
-
const uncaughtRef =
|
|
9181
|
-
const errorsRef =
|
|
9182
|
-
const buttonRef =
|
|
9183
|
-
const activeButtonNameRef =
|
|
9184
|
-
const [hasUncaughtErrors, setHasUncaughtErrors] =
|
|
9185
|
-
const originalRef =
|
|
9186
|
-
const propsRef =
|
|
9187
|
-
|
|
9178
|
+
const registryRef = React66.useRef(new FieldRegistry());
|
|
9179
|
+
const bucketRef = React66.useRef({});
|
|
9180
|
+
const uncaughtRef = React66.useRef([]);
|
|
9181
|
+
const errorsRef = React66.useRef(null);
|
|
9182
|
+
const buttonRef = React66.useRef(null);
|
|
9183
|
+
const activeButtonNameRef = React66.useRef(null);
|
|
9184
|
+
const [hasUncaughtErrors, setHasUncaughtErrors] = React66.useState(0);
|
|
9185
|
+
const originalRef = React66.useRef(null);
|
|
9186
|
+
const propsRef = React66.useRef(props);
|
|
9187
|
+
React66.useEffect(() => {
|
|
9188
9188
|
propsRef.current = props;
|
|
9189
9189
|
}, [props]);
|
|
9190
9190
|
const adapterKey = (_a = props.adapter) != null ? _a : "local";
|
|
@@ -9725,7 +9725,7 @@ function CoreProvider(props) {
|
|
|
9725
9725
|
return uncaughtRef.current;
|
|
9726
9726
|
}
|
|
9727
9727
|
};
|
|
9728
|
-
|
|
9728
|
+
React66.useEffect(() => {
|
|
9729
9729
|
if (!props.formRef) return;
|
|
9730
9730
|
props.formRef.current = context;
|
|
9731
9731
|
return () => {
|
|
@@ -9734,7 +9734,7 @@ function CoreProvider(props) {
|
|
|
9734
9734
|
}
|
|
9735
9735
|
};
|
|
9736
9736
|
}, [context]);
|
|
9737
|
-
|
|
9737
|
+
React66.useEffect(() => {
|
|
9738
9738
|
if (props.init) {
|
|
9739
9739
|
props.init(context);
|
|
9740
9740
|
}
|
|
@@ -10170,9 +10170,9 @@ function ErrorStrip(props) {
|
|
|
10170
10170
|
} = props;
|
|
10171
10171
|
const ctxFromHook = useCore();
|
|
10172
10172
|
const form = formProp != null ? formProp : ctxFromHook;
|
|
10173
|
-
const [isVisible, setIsVisible] =
|
|
10173
|
+
const [isVisible, setIsVisible] = React66.useState(true);
|
|
10174
10174
|
const messages = messagesProp ? messagesProp : (_b = (form == null ? void 0 : form.hasUncaughtErrors) ? (_a = form == null ? void 0 : form.getUncaught) == null ? void 0 : _a.call(form) : []) != null ? _b : [];
|
|
10175
|
-
|
|
10175
|
+
React66.useEffect(() => {
|
|
10176
10176
|
if (messages.length > 0) {
|
|
10177
10177
|
setIsVisible(true);
|
|
10178
10178
|
}
|
|
@@ -10236,7 +10236,7 @@ function ErrorStrip(props) {
|
|
|
10236
10236
|
function CoreRoot(props) {
|
|
10237
10237
|
const { noErrorStrip, onSubmitForm, children, ...rest } = props;
|
|
10238
10238
|
const form = useCore();
|
|
10239
|
-
const handleSubmit =
|
|
10239
|
+
const handleSubmit = React66.useCallback(
|
|
10240
10240
|
(event) => {
|
|
10241
10241
|
event.preventDefault();
|
|
10242
10242
|
if (form.props.activateButtonOnChange && !form.isDirty()) return;
|
|
@@ -10284,16 +10284,16 @@ function CoreShell(props) {
|
|
|
10284
10284
|
function useButton(options) {
|
|
10285
10285
|
const form = useCoreContext();
|
|
10286
10286
|
const { name, disabled: disabledProp = false } = options;
|
|
10287
|
-
const [loading, setLoadingState] =
|
|
10288
|
-
const [disabled, setDisabledState] =
|
|
10287
|
+
const [loading, setLoadingState] = React66.useState(false);
|
|
10288
|
+
const [disabled, setDisabledState] = React66.useState(
|
|
10289
10289
|
Boolean(disabledProp)
|
|
10290
10290
|
);
|
|
10291
|
-
const ref =
|
|
10292
|
-
const optsRef =
|
|
10293
|
-
|
|
10291
|
+
const ref = React66.useRef(null);
|
|
10292
|
+
const optsRef = React66.useRef(options);
|
|
10293
|
+
React66.useEffect(() => {
|
|
10294
10294
|
optsRef.current = options;
|
|
10295
10295
|
}, [options]);
|
|
10296
|
-
const buttonRef =
|
|
10296
|
+
const buttonRef = React66.useRef(null);
|
|
10297
10297
|
if (!buttonRef.current) {
|
|
10298
10298
|
const btn = {
|
|
10299
10299
|
name,
|
|
@@ -10323,11 +10323,11 @@ function useButton(options) {
|
|
|
10323
10323
|
};
|
|
10324
10324
|
buttonRef.current = btn;
|
|
10325
10325
|
}
|
|
10326
|
-
|
|
10326
|
+
React66.useEffect(() => {
|
|
10327
10327
|
if (!buttonRef.current) return;
|
|
10328
10328
|
buttonRef.current.name = name;
|
|
10329
10329
|
}, [name]);
|
|
10330
|
-
|
|
10330
|
+
React66.useEffect(() => {
|
|
10331
10331
|
if (!buttonRef.current) return;
|
|
10332
10332
|
form.button = buttonRef.current;
|
|
10333
10333
|
return () => {
|
|
@@ -10394,41 +10394,41 @@ function useField(options) {
|
|
|
10394
10394
|
onValueChange,
|
|
10395
10395
|
onSubmit
|
|
10396
10396
|
} = options;
|
|
10397
|
-
const ref =
|
|
10398
|
-
const stateRef =
|
|
10397
|
+
const ref = React66.useRef(null);
|
|
10398
|
+
const stateRef = React66.useRef({
|
|
10399
10399
|
value: defaultValue,
|
|
10400
10400
|
error: "",
|
|
10401
10401
|
loading: false,
|
|
10402
10402
|
original: getOriginalValue ? getOriginalValue(defaultValue) : defaultValue
|
|
10403
10403
|
});
|
|
10404
|
-
const [valueState, setValueState] =
|
|
10404
|
+
const [valueState, setValueState] = React66.useState(
|
|
10405
10405
|
stateRef.current.value
|
|
10406
10406
|
);
|
|
10407
10407
|
const isControlled = valueProp !== void 0;
|
|
10408
10408
|
const value = isControlled ? valueProp : valueState;
|
|
10409
|
-
|
|
10409
|
+
React66.useEffect(() => {
|
|
10410
10410
|
if (isControlled && valueProp !== stateRef.current.value) {
|
|
10411
10411
|
stateRef.current.value = valueProp;
|
|
10412
10412
|
setValueState(valueProp);
|
|
10413
10413
|
}
|
|
10414
10414
|
}, [isControlled, valueProp]);
|
|
10415
|
-
const [error, setErrorState] =
|
|
10415
|
+
const [error, setErrorState] = React66.useState(
|
|
10416
10416
|
stateRef.current.error
|
|
10417
10417
|
);
|
|
10418
|
-
const [loading, setLoadingState] =
|
|
10418
|
+
const [loading, setLoadingState] = React66.useState(
|
|
10419
10419
|
stateRef.current.loading
|
|
10420
10420
|
);
|
|
10421
|
-
const [required, setRequired] =
|
|
10421
|
+
const [required, setRequired] = React66.useState(
|
|
10422
10422
|
Boolean(requiredProp)
|
|
10423
10423
|
);
|
|
10424
|
-
const [disabled, setDisabled] =
|
|
10424
|
+
const [disabled, setDisabled] = React66.useState(
|
|
10425
10425
|
Boolean(disabledProp)
|
|
10426
10426
|
);
|
|
10427
|
-
const [readOnly, setReadOnly] =
|
|
10427
|
+
const [readOnly, setReadOnly] = React66.useState(
|
|
10428
10428
|
Boolean(readOnlyProp)
|
|
10429
10429
|
);
|
|
10430
|
-
const id =
|
|
10431
|
-
const keyRef =
|
|
10430
|
+
const id = React66.useId();
|
|
10431
|
+
const keyRef = React66.useRef(
|
|
10432
10432
|
(() => {
|
|
10433
10433
|
if (rawName && rawName.trim()) return `${rawName.trim()}-${id}`;
|
|
10434
10434
|
if (rawBindId && rawBindId.trim())
|
|
@@ -10436,10 +10436,10 @@ function useField(options) {
|
|
|
10436
10436
|
return `field-${Math.random().toString(36).slice(2)}-${id}`;
|
|
10437
10437
|
})()
|
|
10438
10438
|
);
|
|
10439
|
-
const bindIdRef =
|
|
10439
|
+
const bindIdRef = React66.useRef(
|
|
10440
10440
|
rawBindId && rawBindId.trim() || keyRef.current
|
|
10441
10441
|
);
|
|
10442
|
-
const fieldRef =
|
|
10442
|
+
const fieldRef = React66.useRef(null);
|
|
10443
10443
|
if (!fieldRef.current) {
|
|
10444
10444
|
const key = keyRef.current;
|
|
10445
10445
|
const bindId = bindIdRef.current;
|
|
@@ -10542,19 +10542,19 @@ function useField(options) {
|
|
|
10542
10542
|
fieldRef.current = f2;
|
|
10543
10543
|
}
|
|
10544
10544
|
const field = fieldRef.current;
|
|
10545
|
-
|
|
10545
|
+
React66.useEffect(() => {
|
|
10546
10546
|
setRequired(requiredProp);
|
|
10547
10547
|
if (field) {
|
|
10548
10548
|
field.required = requiredProp;
|
|
10549
10549
|
}
|
|
10550
10550
|
}, [requiredProp, field]);
|
|
10551
|
-
|
|
10551
|
+
React66.useEffect(() => {
|
|
10552
10552
|
setDisabled(disabledProp);
|
|
10553
10553
|
}, [disabledProp]);
|
|
10554
|
-
|
|
10554
|
+
React66.useEffect(() => {
|
|
10555
10555
|
setReadOnly(readOnlyProp);
|
|
10556
10556
|
}, [readOnlyProp]);
|
|
10557
|
-
|
|
10557
|
+
React66.useEffect(() => {
|
|
10558
10558
|
if (!field) return;
|
|
10559
10559
|
form.addField(field);
|
|
10560
10560
|
return () => {
|
|
@@ -10669,25 +10669,25 @@ function useOptionalField(options) {
|
|
|
10669
10669
|
getOriginalValue,
|
|
10670
10670
|
onValueChange
|
|
10671
10671
|
} = options;
|
|
10672
|
-
const ref =
|
|
10673
|
-
const [valueState, setValueState] =
|
|
10672
|
+
const ref = React66.useRef(null);
|
|
10673
|
+
const [valueState, setValueState] = React66.useState(defaultValue);
|
|
10674
10674
|
const isControlled = valueProp !== void 0;
|
|
10675
10675
|
const value = isControlled ? valueProp : valueState;
|
|
10676
|
-
|
|
10676
|
+
React66.useEffect(() => {
|
|
10677
10677
|
if (isControlled) {
|
|
10678
10678
|
setValueState(valueProp);
|
|
10679
10679
|
}
|
|
10680
10680
|
}, [isControlled, valueProp]);
|
|
10681
|
-
const [error, setErrorState] =
|
|
10682
|
-
const [loading, setLoadingState] =
|
|
10683
|
-
const [required, setRequired] =
|
|
10684
|
-
const [disabled, setDisabled] =
|
|
10685
|
-
const [readOnly, setReadOnly] =
|
|
10686
|
-
const originalRef =
|
|
10681
|
+
const [error, setErrorState] = React66.useState("");
|
|
10682
|
+
const [loading, setLoadingState] = React66.useState(false);
|
|
10683
|
+
const [required, setRequired] = React66.useState(requiredProp);
|
|
10684
|
+
const [disabled, setDisabled] = React66.useState(disabledProp);
|
|
10685
|
+
const [readOnly, setReadOnly] = React66.useState(readOnlyProp);
|
|
10686
|
+
const originalRef = React66.useRef(
|
|
10687
10687
|
getOriginalValue ? getOriginalValue(defaultValue) : defaultValue
|
|
10688
10688
|
);
|
|
10689
|
-
const id =
|
|
10690
|
-
const keyRef =
|
|
10689
|
+
const id = React66.useId();
|
|
10690
|
+
const keyRef = React66.useRef("");
|
|
10691
10691
|
if (!keyRef.current) {
|
|
10692
10692
|
if (rawName && rawName.trim()) {
|
|
10693
10693
|
keyRef.current = `${rawName.trim()}-${id}`;
|
|
@@ -10697,17 +10697,17 @@ function useOptionalField(options) {
|
|
|
10697
10697
|
keyRef.current = `field-${Math.random().toString(36).slice(2)}-${id}`;
|
|
10698
10698
|
}
|
|
10699
10699
|
}
|
|
10700
|
-
const bindIdRef =
|
|
10700
|
+
const bindIdRef = React66.useRef("");
|
|
10701
10701
|
if (!bindIdRef.current) {
|
|
10702
10702
|
bindIdRef.current = rawBindId && rawBindId.trim() || keyRef.current;
|
|
10703
10703
|
}
|
|
10704
|
-
|
|
10704
|
+
React66.useEffect(() => {
|
|
10705
10705
|
setRequired(requiredProp);
|
|
10706
10706
|
}, [requiredProp]);
|
|
10707
|
-
|
|
10707
|
+
React66.useEffect(() => {
|
|
10708
10708
|
setDisabled(disabledProp);
|
|
10709
10709
|
}, [disabledProp]);
|
|
10710
|
-
|
|
10710
|
+
React66.useEffect(() => {
|
|
10711
10711
|
setReadOnly(readOnlyProp);
|
|
10712
10712
|
}, [readOnlyProp]);
|
|
10713
10713
|
function setValue(next, variant = "direct") {
|
|
@@ -10805,17 +10805,17 @@ var focusEl = (el) => {
|
|
|
10805
10805
|
}
|
|
10806
10806
|
};
|
|
10807
10807
|
function useUpdateEffect(effect, deps) {
|
|
10808
|
-
const mounted =
|
|
10809
|
-
|
|
10808
|
+
const mounted = React66.useRef(false);
|
|
10809
|
+
React66.useEffect(() => {
|
|
10810
10810
|
if (mounted.current) {
|
|
10811
10811
|
return effect();
|
|
10812
10812
|
}
|
|
10813
10813
|
mounted.current = true;
|
|
10814
10814
|
}, deps);
|
|
10815
10815
|
}
|
|
10816
|
-
var InputMask =
|
|
10817
|
-
|
|
10818
|
-
const props =
|
|
10816
|
+
var InputMask = React66.memo(
|
|
10817
|
+
React66.forwardRef((inProps, ref) => {
|
|
10818
|
+
const props = React66.useMemo(
|
|
10819
10819
|
() => ({
|
|
10820
10820
|
autoClear: true,
|
|
10821
10821
|
autoFocus: false,
|
|
@@ -10830,20 +10830,20 @@ var InputMask = React11.memo(
|
|
|
10830
10830
|
}),
|
|
10831
10831
|
[inProps]
|
|
10832
10832
|
);
|
|
10833
|
-
const elementRef =
|
|
10834
|
-
const firstNonMaskPos =
|
|
10835
|
-
const lastRequiredNonMaskPos =
|
|
10836
|
-
const tests =
|
|
10837
|
-
const buffer =
|
|
10838
|
-
const len =
|
|
10839
|
-
const oldVal =
|
|
10840
|
-
const focus =
|
|
10841
|
-
const focusText =
|
|
10842
|
-
const isValueChecked =
|
|
10843
|
-
const partialPosition =
|
|
10844
|
-
const defaultBuffer =
|
|
10845
|
-
const caretTimeoutId =
|
|
10846
|
-
const androidChrome =
|
|
10833
|
+
const elementRef = React66.useRef(null);
|
|
10834
|
+
const firstNonMaskPos = React66.useRef(null);
|
|
10835
|
+
const lastRequiredNonMaskPos = React66.useRef(0);
|
|
10836
|
+
const tests = React66.useRef([]);
|
|
10837
|
+
const buffer = React66.useRef([]);
|
|
10838
|
+
const len = React66.useRef(0);
|
|
10839
|
+
const oldVal = React66.useRef(null);
|
|
10840
|
+
const focus = React66.useRef(false);
|
|
10841
|
+
const focusText = React66.useRef(null);
|
|
10842
|
+
const isValueChecked = React66.useRef(null);
|
|
10843
|
+
const partialPosition = React66.useRef(null);
|
|
10844
|
+
const defaultBuffer = React66.useRef(null);
|
|
10845
|
+
const caretTimeoutId = React66.useRef(null);
|
|
10846
|
+
const androidChrome = React66.useRef(false);
|
|
10847
10847
|
const caret = (first, last) => {
|
|
10848
10848
|
var _a, _b;
|
|
10849
10849
|
let range;
|
|
@@ -10878,7 +10878,7 @@ var InputMask = React11.memo(
|
|
|
10878
10878
|
}
|
|
10879
10879
|
return { begin, end };
|
|
10880
10880
|
};
|
|
10881
|
-
const getPlaceholder =
|
|
10881
|
+
const getPlaceholder = React66.useCallback(
|
|
10882
10882
|
(i4) => {
|
|
10883
10883
|
var _a;
|
|
10884
10884
|
const slotChar2 = (_a = props.slotChar) != null ? _a : "_";
|
|
@@ -11148,7 +11148,7 @@ var InputMask = React11.memo(
|
|
|
11148
11148
|
});
|
|
11149
11149
|
}
|
|
11150
11150
|
};
|
|
11151
|
-
const getUnmaskedValue =
|
|
11151
|
+
const getUnmaskedValue = React66.useCallback(() => {
|
|
11152
11152
|
const unmaskedBuffer = [];
|
|
11153
11153
|
for (let i4 = 0; i4 < buffer.current.length; i4++) {
|
|
11154
11154
|
const c2 = buffer.current[i4];
|
|
@@ -11203,7 +11203,7 @@ var InputMask = React11.memo(
|
|
|
11203
11203
|
}
|
|
11204
11204
|
return pos;
|
|
11205
11205
|
};
|
|
11206
|
-
const isValueUpdated =
|
|
11206
|
+
const isValueUpdated = React66.useCallback(() => {
|
|
11207
11207
|
var _a, _b, _c, _d;
|
|
11208
11208
|
const elVal = (_b = (_a = elementRef.current) == null ? void 0 : _a.value) != null ? _b : "";
|
|
11209
11209
|
return props.unmask ? ((_c = props.value) != null ? _c : "") !== getUnmaskedValue() : defaultBuffer.current !== elVal && elVal !== ((_d = props.value) != null ? _d : "");
|
|
@@ -11303,7 +11303,7 @@ var InputMask = React11.memo(
|
|
|
11303
11303
|
const onInput = (event) => {
|
|
11304
11304
|
androidChrome.current ? handleAndroidInput(event) : handleInputChange(event);
|
|
11305
11305
|
};
|
|
11306
|
-
|
|
11306
|
+
React66.useImperativeHandle(
|
|
11307
11307
|
ref,
|
|
11308
11308
|
() => ({
|
|
11309
11309
|
focus: () => focusEl(elementRef.current),
|
|
@@ -11311,10 +11311,10 @@ var InputMask = React11.memo(
|
|
|
11311
11311
|
}),
|
|
11312
11312
|
[]
|
|
11313
11313
|
);
|
|
11314
|
-
|
|
11314
|
+
React66.useEffect(() => {
|
|
11315
11315
|
if (!elementRef.current) return;
|
|
11316
11316
|
}, []);
|
|
11317
|
-
|
|
11317
|
+
React66.useEffect(() => {
|
|
11318
11318
|
init();
|
|
11319
11319
|
updateValue();
|
|
11320
11320
|
}, []);
|
|
@@ -11462,7 +11462,7 @@ function resolveSizeDensityClasses(size, density) {
|
|
|
11462
11462
|
}
|
|
11463
11463
|
return { heightCls, textCls, densityCls };
|
|
11464
11464
|
}
|
|
11465
|
-
var Input =
|
|
11465
|
+
var Input = React66.forwardRef(
|
|
11466
11466
|
function Input2(rawProps, forwardedRef) {
|
|
11467
11467
|
const {
|
|
11468
11468
|
// base
|
|
@@ -11525,8 +11525,8 @@ var Input = React11.forwardRef(
|
|
|
11525
11525
|
const sizeKey = size != null ? size : "md";
|
|
11526
11526
|
const densityKey = density != null ? density : "normal";
|
|
11527
11527
|
const isMasked = Boolean(mask);
|
|
11528
|
-
const innerRef =
|
|
11529
|
-
|
|
11528
|
+
const innerRef = React66.useRef(null);
|
|
11529
|
+
React66.useImperativeHandle(
|
|
11530
11530
|
forwardedRef,
|
|
11531
11531
|
() => innerRef.current,
|
|
11532
11532
|
[]
|
|
@@ -11547,11 +11547,11 @@ var Input = React11.forwardRef(
|
|
|
11547
11547
|
const baseIconGap = iconGap != null ? iconGap : 4;
|
|
11548
11548
|
const leadingGap = leadingIconSpacing != null ? leadingIconSpacing : baseIconGap;
|
|
11549
11549
|
const trailingGap = trailingIconSpacing != null ? trailingIconSpacing : baseIconGap;
|
|
11550
|
-
const leadingIconsRef =
|
|
11551
|
-
const trailingIconsRef =
|
|
11552
|
-
const [leadingIconsWidth, setLeadingIconsWidth] =
|
|
11553
|
-
const [trailingIconsWidth, setTrailingIconsWidth] =
|
|
11554
|
-
|
|
11550
|
+
const leadingIconsRef = React66.useRef(null);
|
|
11551
|
+
const trailingIconsRef = React66.useRef(null);
|
|
11552
|
+
const [leadingIconsWidth, setLeadingIconsWidth] = React66.useState(0);
|
|
11553
|
+
const [trailingIconsWidth, setTrailingIconsWidth] = React66.useState(0);
|
|
11554
|
+
React66.useLayoutEffect(() => {
|
|
11555
11555
|
if (typeof window === "undefined") return;
|
|
11556
11556
|
if (typeof ResizeObserver === "undefined") return;
|
|
11557
11557
|
const leadingEl = leadingIconsRef.current;
|
|
@@ -11626,7 +11626,7 @@ var Input = React11.forwardRef(
|
|
|
11626
11626
|
inputClassName
|
|
11627
11627
|
);
|
|
11628
11628
|
const maskMode = unmask === true || unmask === "raw" ? "raw" : "masked";
|
|
11629
|
-
const handleFocus =
|
|
11629
|
+
const handleFocus = React66.useCallback(
|
|
11630
11630
|
(event) => {
|
|
11631
11631
|
onFocus == null ? void 0 : onFocus(event);
|
|
11632
11632
|
if (!prefix && !suffix) return;
|
|
@@ -11654,7 +11654,7 @@ var Input = React11.forwardRef(
|
|
|
11654
11654
|
const placeholder = typeof mask === "string" && mask ? mask : rest.placeholder;
|
|
11655
11655
|
const hasCustomPadding = typeof px === "number" || typeof py === "number" || typeof ps === "number" || typeof pe2 === "number" || typeof pb === "number";
|
|
11656
11656
|
const hasKeyFilter = !!keyFilter;
|
|
11657
|
-
const handleKeyDownWrapped =
|
|
11657
|
+
const handleKeyDownWrapped = React66.useCallback(
|
|
11658
11658
|
(event) => {
|
|
11659
11659
|
if (hasKeyFilter && keyFilterOn === "keydown" && !event.ctrlKey && !event.metaKey && !event.altKey && event.key && event.key.length === 1) {
|
|
11660
11660
|
const inputEl = event.currentTarget;
|
|
@@ -11671,7 +11671,7 @@ var Input = React11.forwardRef(
|
|
|
11671
11671
|
},
|
|
11672
11672
|
[hasKeyFilter, keyFilterOn, keyFilter, onKeyDown]
|
|
11673
11673
|
);
|
|
11674
|
-
const handleKeyPressWrapped =
|
|
11674
|
+
const handleKeyPressWrapped = React66.useCallback(
|
|
11675
11675
|
(event) => {
|
|
11676
11676
|
if (hasKeyFilter && keyFilterOn === "keypress" && !event.ctrlKey && !event.metaKey && !event.altKey && event.key && event.key.length === 1) {
|
|
11677
11677
|
const inputEl = event.currentTarget;
|
|
@@ -11688,7 +11688,7 @@ var Input = React11.forwardRef(
|
|
|
11688
11688
|
},
|
|
11689
11689
|
[hasKeyFilter, keyFilterOn, keyFilter, onKeyPress]
|
|
11690
11690
|
);
|
|
11691
|
-
const handleBeforeInputWrapped =
|
|
11691
|
+
const handleBeforeInputWrapped = React66.useCallback(
|
|
11692
11692
|
(event) => {
|
|
11693
11693
|
if (hasKeyFilter && keyFilterOn === "beforeinput" && (event == null ? void 0 : event.nativeEvent)) {
|
|
11694
11694
|
const inputEl = event.currentTarget;
|
|
@@ -11709,7 +11709,7 @@ var Input = React11.forwardRef(
|
|
|
11709
11709
|
},
|
|
11710
11710
|
[hasKeyFilter, keyFilterOn, keyFilter, onBeforeInput]
|
|
11711
11711
|
);
|
|
11712
|
-
const handlePasteWrapped =
|
|
11712
|
+
const handlePasteWrapped = React66.useCallback(
|
|
11713
11713
|
(event) => {
|
|
11714
11714
|
var _a, _b;
|
|
11715
11715
|
if (hasKeyFilter && keyFilterOnPaste) {
|
|
@@ -11847,7 +11847,11 @@ var Input = React11.forwardRef(
|
|
|
11847
11847
|
children: [
|
|
11848
11848
|
renderBaseInput({
|
|
11849
11849
|
inner: false,
|
|
11850
|
-
className: cx(
|
|
11850
|
+
className: cx(
|
|
11851
|
+
baseBoxClasses,
|
|
11852
|
+
boxPaddingClasses,
|
|
11853
|
+
className
|
|
11854
|
+
),
|
|
11851
11855
|
style: varsStyle
|
|
11852
11856
|
}),
|
|
11853
11857
|
hasLeadingIcons && /* @__PURE__ */ jsx(
|
|
@@ -11951,7 +11955,7 @@ var Input = React11.forwardRef(
|
|
|
11951
11955
|
className: "absolute inset-y-0 left-0 flex items-center cursor-pointer",
|
|
11952
11956
|
style: {
|
|
11953
11957
|
gap: leadingGap,
|
|
11954
|
-
paddingLeft: `${pxDefault}px`
|
|
11958
|
+
paddingLeft: hasLeadingControl ? void 0 : `${pxDefault}px`
|
|
11955
11959
|
},
|
|
11956
11960
|
"data-slot": "leading-icons",
|
|
11957
11961
|
onMouseDown: handleIconMouseDown,
|
|
@@ -11972,7 +11976,7 @@ var Input = React11.forwardRef(
|
|
|
11972
11976
|
className: "absolute inset-y-0 right-0 flex items-center cursor-pointer",
|
|
11973
11977
|
style: {
|
|
11974
11978
|
gap: trailingGap,
|
|
11975
|
-
paddingRight: `${pxDefault}px`
|
|
11979
|
+
paddingRight: hasTrailingControl ? void 0 : `${pxDefault}px`
|
|
11976
11980
|
},
|
|
11977
11981
|
"data-slot": "trailing-icons",
|
|
11978
11982
|
onMouseDown: handleIconMouseDown,
|
|
@@ -12097,7 +12101,7 @@ var Input = React11.forwardRef(
|
|
|
12097
12101
|
] });
|
|
12098
12102
|
}
|
|
12099
12103
|
);
|
|
12100
|
-
var ShadcnTextVariant =
|
|
12104
|
+
var ShadcnTextVariant = React66.forwardRef(function ShadcnTextVariant2(props, forwardedRef) {
|
|
12101
12105
|
const {
|
|
12102
12106
|
// form-level props
|
|
12103
12107
|
value,
|
|
@@ -12145,7 +12149,7 @@ var ShadcnTextVariant = React11.forwardRef(function ShadcnTextVariant2(props, fo
|
|
|
12145
12149
|
...rest
|
|
12146
12150
|
} = props;
|
|
12147
12151
|
const isMasked = Boolean(mask);
|
|
12148
|
-
const handlePlainChange =
|
|
12152
|
+
const handlePlainChange = React66.useCallback(
|
|
12149
12153
|
(e4) => {
|
|
12150
12154
|
var _a;
|
|
12151
12155
|
const displayed = (_a = e4.target.value) != null ? _a : "";
|
|
@@ -12176,7 +12180,7 @@ var ShadcnTextVariant = React11.forwardRef(function ShadcnTextVariant2(props, fo
|
|
|
12176
12180
|
},
|
|
12177
12181
|
[onValue, prefix, suffix, stripPrefix, stripSuffix]
|
|
12178
12182
|
);
|
|
12179
|
-
const handleMaskedChange =
|
|
12183
|
+
const handleMaskedChange = React66.useCallback(
|
|
12180
12184
|
(e4) => {
|
|
12181
12185
|
var _a, _b, _c;
|
|
12182
12186
|
const maskedValue = (_a = e4.value) != null ? _a : "";
|
|
@@ -12296,9 +12300,98 @@ var textVariant = {
|
|
|
12296
12300
|
tags: ["text", "input", "string"]
|
|
12297
12301
|
}
|
|
12298
12302
|
};
|
|
12299
|
-
|
|
12300
|
-
|
|
12301
|
-
|
|
12303
|
+
function clampToLimits(n3, min2, max2) {
|
|
12304
|
+
let out = n3;
|
|
12305
|
+
if (min2 != null && out < min2) out = min2;
|
|
12306
|
+
if (max2 != null && out > max2) out = max2;
|
|
12307
|
+
return out;
|
|
12308
|
+
}
|
|
12309
|
+
function isFiniteNumber(n3) {
|
|
12310
|
+
return typeof n3 === "number" && Number.isFinite(n3);
|
|
12311
|
+
}
|
|
12312
|
+
function resolveLocale(explicit) {
|
|
12313
|
+
if (explicit) return explicit;
|
|
12314
|
+
if (typeof navigator !== "undefined" && navigator.language)
|
|
12315
|
+
return navigator.language;
|
|
12316
|
+
return "en-US";
|
|
12317
|
+
}
|
|
12318
|
+
function getDecimalSeparator(locale) {
|
|
12319
|
+
const s3 = new Intl.NumberFormat(locale, { useGrouping: false }).format(1.1);
|
|
12320
|
+
const m2 = s3.match(/1(.?)1/);
|
|
12321
|
+
return (m2 == null ? void 0 : m2[1]) || ".";
|
|
12322
|
+
}
|
|
12323
|
+
function stripAffixes(text, prefix, suffix) {
|
|
12324
|
+
let t4 = text != null ? text : "";
|
|
12325
|
+
if (prefix && t4.startsWith(prefix)) t4 = t4.slice(prefix.length);
|
|
12326
|
+
if (suffix && t4.endsWith(suffix)) t4 = t4.slice(0, -suffix.length);
|
|
12327
|
+
return t4;
|
|
12328
|
+
}
|
|
12329
|
+
function stripGrouping(text, locale) {
|
|
12330
|
+
const group = new Intl.NumberFormat(locale, { useGrouping: true }).format(1e6).replace(/[0-9]/g, "").trim().charAt(0);
|
|
12331
|
+
if (!group) return text;
|
|
12332
|
+
const re3 = new RegExp(`\\${group}`, "g");
|
|
12333
|
+
return text.replace(re3, "");
|
|
12334
|
+
}
|
|
12335
|
+
function parseEditable(editable, locale, decimalSep) {
|
|
12336
|
+
const t4 = editable.trim();
|
|
12337
|
+
if (!t4 || t4 === "-" || t4 === decimalSep) return null;
|
|
12338
|
+
const noGroup = stripGrouping(t4, locale);
|
|
12339
|
+
const normalized = decimalSep === "." ? noGroup : noGroup.replace(decimalSep, ".");
|
|
12340
|
+
const cleaned = normalized.endsWith(".") ? normalized.slice(0, -1) : normalized;
|
|
12341
|
+
if (!cleaned || cleaned === "-") return null;
|
|
12342
|
+
const n3 = Number(cleaned);
|
|
12343
|
+
return Number.isFinite(n3) ? n3 : null;
|
|
12344
|
+
}
|
|
12345
|
+
function formatDisplayNumber(n3, locale, opts, prefix, suffix) {
|
|
12346
|
+
const f2 = new Intl.NumberFormat(locale, opts).format(n3);
|
|
12347
|
+
return `${prefix != null ? prefix : ""}${f2}${suffix != null ? suffix : ""}`;
|
|
12348
|
+
}
|
|
12349
|
+
function applyFractionLimitReplace(next, prev, locale, decimalSep, maxFractionDigits, inputEl) {
|
|
12350
|
+
var _a, _b, _c;
|
|
12351
|
+
if (maxFractionDigits == null)
|
|
12352
|
+
return { text: next, caret: (_a = inputEl.selectionStart) != null ? _a : next.length };
|
|
12353
|
+
const selStart = (_b = inputEl.selectionStart) != null ? _b : 0;
|
|
12354
|
+
const selEnd = (_c = inputEl.selectionEnd) != null ? _c : selStart;
|
|
12355
|
+
const decIndex = next.indexOf(decimalSep);
|
|
12356
|
+
if (decIndex === -1) return { text: next, caret: selStart };
|
|
12357
|
+
const frac = next.slice(decIndex + 1);
|
|
12358
|
+
if (frac.length <= maxFractionDigits)
|
|
12359
|
+
return { text: next, caret: selStart };
|
|
12360
|
+
if (selEnd > selStart) {
|
|
12361
|
+
const trimmed2 = next.slice(0, decIndex + 1 + maxFractionDigits);
|
|
12362
|
+
const caret2 = Math.min(selStart, trimmed2.length);
|
|
12363
|
+
return { text: trimmed2, caret: caret2 };
|
|
12364
|
+
}
|
|
12365
|
+
const caret = selStart;
|
|
12366
|
+
const fracStart = decIndex + 1;
|
|
12367
|
+
const fracEnd = fracStart + maxFractionDigits;
|
|
12368
|
+
const trimmed = next.slice(0, fracEnd);
|
|
12369
|
+
const clampedCaret = Math.min(caret, trimmed.length);
|
|
12370
|
+
return { text: trimmed, caret: clampedCaret };
|
|
12371
|
+
}
|
|
12372
|
+
function normalizeEditable(raw, locale, decimalSep, allowMinus) {
|
|
12373
|
+
let t4 = raw;
|
|
12374
|
+
t4 = stripGrouping(t4, locale);
|
|
12375
|
+
const allowed = new RegExp(`[^0-9\\${decimalSep}\\-]`, "g");
|
|
12376
|
+
t4 = t4.replace(allowed, "");
|
|
12377
|
+
const minusCount = (t4.match(/\-/g) || []).length;
|
|
12378
|
+
if (minusCount) {
|
|
12379
|
+
t4 = t4.replace(/\-/g, "");
|
|
12380
|
+
if (allowMinus) t4 = "-" + t4;
|
|
12381
|
+
}
|
|
12382
|
+
const firstDec = t4.indexOf(decimalSep);
|
|
12383
|
+
if (firstDec !== -1) {
|
|
12384
|
+
const before = t4.slice(0, firstDec + 1);
|
|
12385
|
+
const after = t4.slice(firstDec + 1).replace(new RegExp(`\\${decimalSep}`, "g"), "");
|
|
12386
|
+
t4 = before + after;
|
|
12387
|
+
}
|
|
12388
|
+
if (t4 === "-" + decimalSep) t4 = "-0" + decimalSep;
|
|
12389
|
+
if (t4 === decimalSep) t4 = "0" + decimalSep;
|
|
12390
|
+
return t4;
|
|
12391
|
+
}
|
|
12392
|
+
var InputNumber = React66.memo(
|
|
12393
|
+
React66.forwardRef((inProps, ref) => {
|
|
12394
|
+
var _a;
|
|
12302
12395
|
const props = {
|
|
12303
12396
|
allowEmpty: true,
|
|
12304
12397
|
autoFocus: false,
|
|
@@ -12312,35 +12405,19 @@ var InputNumber = React11.memo(
|
|
|
12312
12405
|
type: "text",
|
|
12313
12406
|
...inProps
|
|
12314
12407
|
};
|
|
12315
|
-
const
|
|
12316
|
-
|
|
12317
|
-
|
|
12318
|
-
|
|
12319
|
-
const
|
|
12320
|
-
|
|
12321
|
-
|
|
12322
|
-
|
|
12323
|
-
const
|
|
12324
|
-
|
|
12325
|
-
|
|
12326
|
-
|
|
12327
|
-
const
|
|
12328
|
-
const _decimal = React11.useRef(null);
|
|
12329
|
-
const _decimalSeparator = React11.useRef(".");
|
|
12330
|
-
const _suffix = React11.useRef(null);
|
|
12331
|
-
const _prefix = React11.useRef(null);
|
|
12332
|
-
const _index = React11.useRef(() => 0);
|
|
12333
|
-
const isFocusedByClick = React11.useRef(false);
|
|
12334
|
-
const resolveLocale = React11.useCallback(() => {
|
|
12335
|
-
if (props.locale) return props.locale;
|
|
12336
|
-
if (typeof navigator !== "undefined" && navigator.language) {
|
|
12337
|
-
return navigator.language;
|
|
12338
|
-
}
|
|
12339
|
-
return "en-US";
|
|
12340
|
-
}, [props.locale]);
|
|
12341
|
-
const _locale = resolveLocale();
|
|
12342
|
-
const inputMode = props.inputMode || (props.mode === "decimal" && !props.minFractionDigits && !props.maxFractionDigits ? "numeric" : "decimal");
|
|
12343
|
-
const getOptions = React11.useCallback(() => {
|
|
12408
|
+
const locale = React66.useMemo(
|
|
12409
|
+
() => resolveLocale(props.locale),
|
|
12410
|
+
[props.locale]
|
|
12411
|
+
);
|
|
12412
|
+
const decimalSep = React66.useMemo(
|
|
12413
|
+
() => getDecimalSeparator(locale),
|
|
12414
|
+
[locale]
|
|
12415
|
+
);
|
|
12416
|
+
const allowMinus = React66.useMemo(
|
|
12417
|
+
() => props.min == null || props.min < 0,
|
|
12418
|
+
[props.min]
|
|
12419
|
+
);
|
|
12420
|
+
const fmtOptions = React66.useMemo(() => {
|
|
12344
12421
|
return {
|
|
12345
12422
|
localeMatcher: props.localeMatcher,
|
|
12346
12423
|
style: props.mode,
|
|
@@ -12361,262 +12438,27 @@ var InputNumber = React11.memo(
|
|
|
12361
12438
|
props.maxFractionDigits,
|
|
12362
12439
|
props.roundingMode
|
|
12363
12440
|
]);
|
|
12364
|
-
const
|
|
12365
|
-
|
|
12366
|
-
|
|
12367
|
-
|
|
12368
|
-
|
|
12369
|
-
|
|
12370
|
-
|
|
12371
|
-
|
|
12372
|
-
_numeral.current = new RegExp("[" + numerals.join("") + "]", "g");
|
|
12373
|
-
_index.current = (d) => {
|
|
12374
|
-
var _a2;
|
|
12375
|
-
return (_a2 = index.get(d)) != null ? _a2 : 0;
|
|
12376
|
-
};
|
|
12377
|
-
const formatterGroup = new Intl.NumberFormat(loc, { useGrouping: true });
|
|
12378
|
-
groupChar.current = formatterGroup.format(1e6).trim().replace(_numeral.current, "").charAt(0);
|
|
12379
|
-
_group.current = new RegExp("[" + groupChar.current + "]", "g");
|
|
12380
|
-
const formatterMinus = new Intl.NumberFormat(loc, { useGrouping: false });
|
|
12381
|
-
const minusString = formatterMinus.format(-1).trim().replace(_numeral.current, "");
|
|
12382
|
-
_minusSign.current = new RegExp("[" + minusString + "]", "g");
|
|
12383
|
-
if (props.currency) {
|
|
12384
|
-
const formatterCurrency = new Intl.NumberFormat(loc, {
|
|
12385
|
-
style: "currency",
|
|
12386
|
-
currency: props.currency,
|
|
12387
|
-
currencyDisplay: props.currencyDisplay,
|
|
12388
|
-
minimumFractionDigits: 0,
|
|
12389
|
-
maximumFractionDigits: 0,
|
|
12390
|
-
roundingMode: props.roundingMode
|
|
12391
|
-
});
|
|
12392
|
-
_currency.current = new RegExp(
|
|
12393
|
-
"[" + formatterCurrency.format(1).replace(/\s/g, "").replace(_numeral.current, "").replace(_group.current, "") + "]",
|
|
12394
|
-
"g"
|
|
12395
|
-
);
|
|
12396
|
-
} else {
|
|
12397
|
-
_currency.current = new RegExp("[]", "g");
|
|
12398
|
-
}
|
|
12399
|
-
const formatterDecimal = new Intl.NumberFormat(loc, {
|
|
12400
|
-
useGrouping: false
|
|
12401
|
-
});
|
|
12402
|
-
const decSample = formatterDecimal.format(1.1).trim().replace(_numeral.current, "");
|
|
12403
|
-
_decimalSeparator.current = decSample || ".";
|
|
12404
|
-
const formatterDecOptions = new Intl.NumberFormat(loc, {
|
|
12405
|
-
...getOptions(),
|
|
12406
|
-
useGrouping: false
|
|
12407
|
-
});
|
|
12408
|
-
_decimal.current = new RegExp(
|
|
12409
|
-
"[" + formatterDecOptions.format(1.1).replace(_currency.current, "").trim().replace(_numeral.current, "") + "]",
|
|
12410
|
-
"g"
|
|
12411
|
-
);
|
|
12412
|
-
if (props.prefix) {
|
|
12413
|
-
prefixChar.current = props.prefix;
|
|
12414
|
-
} else {
|
|
12415
|
-
const formatterPrefix = new Intl.NumberFormat(loc, {
|
|
12416
|
-
style: props.mode,
|
|
12417
|
-
currency: props.currency,
|
|
12418
|
-
currencyDisplay: props.currencyDisplay
|
|
12419
|
-
});
|
|
12420
|
-
prefixChar.current = formatterPrefix.format(1).split("1")[0];
|
|
12421
|
-
}
|
|
12422
|
-
_prefix.current = new RegExp(escapeRegExp(prefixChar.current || ""), "g");
|
|
12423
|
-
if (props.suffix) {
|
|
12424
|
-
suffixChar.current = props.suffix;
|
|
12425
|
-
} else {
|
|
12426
|
-
const formatterSuffix = new Intl.NumberFormat(loc, {
|
|
12427
|
-
style: props.mode,
|
|
12428
|
-
currency: props.currency,
|
|
12429
|
-
currencyDisplay: props.currencyDisplay,
|
|
12430
|
-
minimumFractionDigits: 0,
|
|
12431
|
-
maximumFractionDigits: 0,
|
|
12432
|
-
roundingMode: props.roundingMode
|
|
12433
|
-
});
|
|
12434
|
-
suffixChar.current = formatterSuffix.format(1).split("1")[1];
|
|
12435
|
-
}
|
|
12436
|
-
_suffix.current = new RegExp(escapeRegExp(suffixChar.current || ""), "g");
|
|
12437
|
-
}, [
|
|
12438
|
-
_locale,
|
|
12439
|
-
getOptions,
|
|
12440
|
-
props.currency,
|
|
12441
|
-
props.currencyDisplay,
|
|
12442
|
-
props.mode,
|
|
12443
|
-
props.prefix,
|
|
12444
|
-
props.roundingMode,
|
|
12445
|
-
props.suffix
|
|
12446
|
-
]);
|
|
12447
|
-
const formatValue = React11.useCallback(
|
|
12448
|
-
(value2) => {
|
|
12449
|
-
if (value2 == null) return "";
|
|
12450
|
-
if (value2 === "-") return "-";
|
|
12451
|
-
const numeric = typeof value2 === "number" ? value2 : typeof value2 === "string" ? Number(value2) : Number.NaN;
|
|
12452
|
-
if (Number.isNaN(numeric)) return "";
|
|
12453
|
-
if (props.format) {
|
|
12454
|
-
const formatter = numberFormat.current || new Intl.NumberFormat(_locale, getOptions());
|
|
12455
|
-
let formatted = formatter.format(numeric);
|
|
12456
|
-
if (props.prefix) {
|
|
12457
|
-
formatted = props.prefix + formatted;
|
|
12458
|
-
}
|
|
12459
|
-
if (props.suffix) {
|
|
12460
|
-
formatted = formatted + props.suffix;
|
|
12461
|
-
}
|
|
12462
|
-
return formatted;
|
|
12463
|
-
}
|
|
12464
|
-
return numeric.toString();
|
|
12441
|
+
const inputRef = React66.useRef(null);
|
|
12442
|
+
React66.useImperativeHandle(ref, () => inputRef.current);
|
|
12443
|
+
const [display, setDisplay] = React66.useState("");
|
|
12444
|
+
const [focused, setFocused] = React66.useState(false);
|
|
12445
|
+
const toEditableFromNumber = React66.useCallback(
|
|
12446
|
+
(n3) => {
|
|
12447
|
+
const s3 = String(n3);
|
|
12448
|
+
return decimalSep === "." ? s3 : s3.replace(".", decimalSep);
|
|
12465
12449
|
},
|
|
12466
|
-
[
|
|
12450
|
+
[decimalSep]
|
|
12467
12451
|
);
|
|
12468
|
-
const
|
|
12469
|
-
(
|
|
12470
|
-
|
|
12471
|
-
let filteredText = text;
|
|
12472
|
-
if (_suffix.current) {
|
|
12473
|
-
filteredText = filteredText.replace(_suffix.current, "");
|
|
12474
|
-
}
|
|
12475
|
-
if (_prefix.current) {
|
|
12476
|
-
filteredText = filteredText.replace(_prefix.current, "");
|
|
12477
|
-
}
|
|
12478
|
-
filteredText = filteredText.trim().replace(/\s/g, "").replace(_currency.current, "").replace(_group.current, "").replace(_minusSign.current, "-").replace(_decimal.current, ".").replace(
|
|
12479
|
-
_numeral.current,
|
|
12480
|
-
(d) => {
|
|
12481
|
-
var _a2;
|
|
12482
|
-
return String((_a2 = _index.current(d)) != null ? _a2 : "");
|
|
12483
|
-
}
|
|
12484
|
-
);
|
|
12485
|
-
if (!filteredText) return null;
|
|
12486
|
-
if (filteredText === "-") {
|
|
12487
|
-
return "-";
|
|
12488
|
-
}
|
|
12489
|
-
const parsedValue = +filteredText;
|
|
12490
|
-
return Number.isNaN(parsedValue) ? null : parsedValue;
|
|
12491
|
-
},
|
|
12492
|
-
[]
|
|
12452
|
+
const clampModel = React66.useCallback(
|
|
12453
|
+
(n3) => clampToLimits(n3, props.min, props.max),
|
|
12454
|
+
[props.min, props.max]
|
|
12493
12455
|
);
|
|
12494
|
-
const
|
|
12495
|
-
|
|
12496
|
-
|
|
12497
|
-
|
|
12498
|
-
timer.current = void 0;
|
|
12499
|
-
}
|
|
12500
|
-
};
|
|
12501
|
-
const allowMinusSign = () => props.min == null || props.min < 0;
|
|
12502
|
-
const isMinusSign = (ch) => {
|
|
12503
|
-
if (_minusSign.current && _minusSign.current.test(ch) || ch === "-") {
|
|
12504
|
-
_minusSign.current && (_minusSign.current.lastIndex = 0);
|
|
12505
|
-
return true;
|
|
12506
|
-
}
|
|
12507
|
-
return false;
|
|
12508
|
-
};
|
|
12509
|
-
const isDecimalMode = () => props.mode === "decimal";
|
|
12510
|
-
const isFloat = (val) => {
|
|
12511
|
-
const formatter = new Intl.NumberFormat(_locale, getOptions());
|
|
12512
|
-
const parsed = parseValue(formatter.format(val));
|
|
12513
|
-
if (parsed === null || typeof parsed !== "number") {
|
|
12514
|
-
return false;
|
|
12515
|
-
}
|
|
12516
|
-
return parsed % 1 !== 0;
|
|
12517
|
-
};
|
|
12518
|
-
const replaceDecimalSeparator = (val) => {
|
|
12519
|
-
if (typeof val === "number" && isFloat(val)) {
|
|
12520
|
-
return val.toString().replace(/\.(?=[^.]*$)/, _decimalSeparator.current);
|
|
12521
|
-
}
|
|
12522
|
-
return val;
|
|
12523
|
-
};
|
|
12524
|
-
const isDecimalSign = (ch) => {
|
|
12525
|
-
if (_decimal.current && (_decimal.current.test(ch) || isFloat(Number(ch)))) {
|
|
12526
|
-
_decimal.current.lastIndex = 0;
|
|
12527
|
-
return true;
|
|
12528
|
-
}
|
|
12529
|
-
return false;
|
|
12530
|
-
};
|
|
12531
|
-
const getDecimalCharIndexes = (val) => {
|
|
12532
|
-
let decimalCharIndex = -1;
|
|
12533
|
-
let decimalCharIndexWithoutPrefix = -1;
|
|
12534
|
-
if (_decimal.current) {
|
|
12535
|
-
decimalCharIndex = val.search(_decimal.current);
|
|
12536
|
-
_decimal.current.lastIndex = 0;
|
|
12537
|
-
let filteredVal = val;
|
|
12538
|
-
if (_prefix.current) {
|
|
12539
|
-
filteredVal = filteredVal.replace(_prefix.current, "");
|
|
12540
|
-
}
|
|
12541
|
-
filteredVal = filteredVal.trim().replace(/\s/g, "").replace(_currency.current, "");
|
|
12542
|
-
decimalCharIndexWithoutPrefix = filteredVal.search(_decimal.current);
|
|
12543
|
-
_decimal.current.lastIndex = 0;
|
|
12544
|
-
}
|
|
12545
|
-
return { decimalCharIndex, decimalCharIndexWithoutPrefix };
|
|
12546
|
-
};
|
|
12547
|
-
const getCharIndexes = (val) => {
|
|
12548
|
-
let decimalCharIndex = -1;
|
|
12549
|
-
let minusCharIndex = -1;
|
|
12550
|
-
let suffixCharIndex = -1;
|
|
12551
|
-
let currencyCharIndex = -1;
|
|
12552
|
-
if (_decimal.current) {
|
|
12553
|
-
decimalCharIndex = val.search(_decimal.current);
|
|
12554
|
-
_decimal.current.lastIndex = 0;
|
|
12555
|
-
}
|
|
12556
|
-
if (_minusSign.current) {
|
|
12557
|
-
minusCharIndex = val.search(_minusSign.current);
|
|
12558
|
-
_minusSign.current.lastIndex = 0;
|
|
12559
|
-
}
|
|
12560
|
-
if (_suffix.current) {
|
|
12561
|
-
suffixCharIndex = val.search(_suffix.current);
|
|
12562
|
-
_suffix.current.lastIndex = 0;
|
|
12563
|
-
}
|
|
12564
|
-
if (_currency.current) {
|
|
12565
|
-
currencyCharIndex = val.search(_currency.current);
|
|
12566
|
-
if (currencyCharIndex === 0 && prefixChar.current && prefixChar.current.length > 1) {
|
|
12567
|
-
currencyCharIndex = prefixChar.current.trim().length;
|
|
12568
|
-
}
|
|
12569
|
-
_currency.current.lastIndex = 0;
|
|
12570
|
-
}
|
|
12571
|
-
return { decimalCharIndex, minusCharIndex, suffixCharIndex, currencyCharIndex };
|
|
12572
|
-
};
|
|
12573
|
-
const resetRegex = () => {
|
|
12574
|
-
if (_numeral.current) _numeral.current.lastIndex = 0;
|
|
12575
|
-
if (_decimal.current) _decimal.current.lastIndex = 0;
|
|
12576
|
-
if (_group.current) _group.current.lastIndex = 0;
|
|
12577
|
-
if (_minusSign.current) _minusSign.current.lastIndex = 0;
|
|
12578
|
-
};
|
|
12579
|
-
const isNumeralChar = (ch) => {
|
|
12580
|
-
if (ch.length === 1 && (_numeral.current && _numeral.current.test(ch) || _decimal.current && _decimal.current.test(ch) || _group.current && _group.current.test(ch) || _minusSign.current && _minusSign.current.test(ch))) {
|
|
12581
|
-
resetRegex();
|
|
12582
|
-
return true;
|
|
12583
|
-
}
|
|
12584
|
-
return false;
|
|
12585
|
-
};
|
|
12586
|
-
const evaluateEmpty = (newValue) => {
|
|
12587
|
-
var _a2;
|
|
12588
|
-
if ((newValue == null || newValue === "") && !props.allowEmpty) {
|
|
12589
|
-
return (_a2 = props.min) != null ? _a2 : 0;
|
|
12590
|
-
}
|
|
12591
|
-
return newValue;
|
|
12592
|
-
};
|
|
12593
|
-
const validateValueByLimit = (value2) => {
|
|
12594
|
-
if (value2 === "-" || value2 === null || value2 === "") {
|
|
12595
|
-
return null;
|
|
12596
|
-
}
|
|
12597
|
-
let num = typeof value2 === "number" ? value2 : Number(value2);
|
|
12598
|
-
if (Number.isNaN(num)) {
|
|
12599
|
-
return null;
|
|
12600
|
-
}
|
|
12601
|
-
if (props.min != null && num < props.min) num = props.min;
|
|
12602
|
-
if (props.max != null && num > props.max) num = props.max;
|
|
12603
|
-
return num;
|
|
12604
|
-
};
|
|
12605
|
-
const validateValue = (value2) => {
|
|
12606
|
-
if (value2 === "-") return null;
|
|
12607
|
-
return validateValueByLimit(value2);
|
|
12608
|
-
};
|
|
12609
|
-
const formattedValue = (val) => {
|
|
12610
|
-
const newVal = evaluateEmpty(val);
|
|
12611
|
-
return formatValue(newVal);
|
|
12612
|
-
};
|
|
12613
|
-
const updateModel = (event, value2) => {
|
|
12614
|
-
var _a2, _b2;
|
|
12615
|
-
const finalValue = value2;
|
|
12616
|
-
if (props.onValueChange) {
|
|
12617
|
-
props.onValueChange({
|
|
12456
|
+
const emit = React66.useCallback(
|
|
12457
|
+
(event, value2) => {
|
|
12458
|
+
var _a2, _b, _c;
|
|
12459
|
+
(_c = props.onValueChange) == null ? void 0 : _c.call(props, {
|
|
12618
12460
|
originalEvent: event,
|
|
12619
|
-
value:
|
|
12461
|
+
value: value2,
|
|
12620
12462
|
stopPropagation() {
|
|
12621
12463
|
event == null ? void 0 : event.stopPropagation();
|
|
12622
12464
|
},
|
|
@@ -12625,600 +12467,160 @@ var InputNumber = React11.memo(
|
|
|
12625
12467
|
},
|
|
12626
12468
|
target: {
|
|
12627
12469
|
name: (_a2 = props.name) != null ? _a2 : null,
|
|
12628
|
-
id: (
|
|
12629
|
-
value:
|
|
12470
|
+
id: (_b = props.id) != null ? _b : null,
|
|
12471
|
+
value: value2
|
|
12630
12472
|
}
|
|
12631
12473
|
});
|
|
12632
|
-
|
|
12633
|
-
|
|
12634
|
-
props.onChange({ originalEvent: event, value: finalValue });
|
|
12635
|
-
}
|
|
12636
|
-
};
|
|
12637
|
-
const handleOnChange = (event, currentValue, newValue) => {
|
|
12638
|
-
if (!props.onChange) return;
|
|
12639
|
-
const parsedCurrent = typeof currentValue === "string" ? parseValue(currentValue) : null;
|
|
12640
|
-
const changed = newValue !== parsedCurrent;
|
|
12641
|
-
if (changed) {
|
|
12642
|
-
props.onChange({ originalEvent: event, value: newValue });
|
|
12643
|
-
}
|
|
12644
|
-
};
|
|
12645
|
-
const concatValues = (val1, val2) => {
|
|
12646
|
-
if (val1 && val2) {
|
|
12647
|
-
const decimalCharIndex = val2.search(_decimal.current);
|
|
12648
|
-
_decimal.current.lastIndex = 0;
|
|
12649
|
-
const newVal1 = replaceDecimalSeparator(val1);
|
|
12650
|
-
const base = newVal1.split(_decimal.current)[0].replace(_suffix.current, "").trim();
|
|
12651
|
-
return decimalCharIndex !== -1 ? base + val2.slice(decimalCharIndex) : val1;
|
|
12652
|
-
}
|
|
12653
|
-
return val1;
|
|
12654
|
-
};
|
|
12655
|
-
const getDecimalLength = (value2) => {
|
|
12656
|
-
if (value2) {
|
|
12657
|
-
const valueSplit = value2.split(_decimal.current);
|
|
12658
|
-
if (valueSplit.length === 2) {
|
|
12659
|
-
return valueSplit[1].replace(_suffix.current, "").length;
|
|
12474
|
+
if (props.onChange && event) {
|
|
12475
|
+
props.onChange({ originalEvent: event, value: value2 });
|
|
12660
12476
|
}
|
|
12661
|
-
}
|
|
12662
|
-
|
|
12663
|
-
|
|
12664
|
-
const
|
|
12665
|
-
|
|
12666
|
-
|
|
12667
|
-
|
|
12668
|
-
|
|
12669
|
-
|
|
12670
|
-
|
|
12671
|
-
}
|
|
12672
|
-
return value2.slice(0, start) + value2.slice(end);
|
|
12673
|
-
};
|
|
12674
|
-
const replaceSuffix = (value2) => value2 ? value2.replace(_suffix.current, "").trim().replace(/\s/g, "").replace(_currency.current, "") : value2;
|
|
12675
|
-
const insertText = (value2, text, start, end) => {
|
|
12676
|
-
const textSplit = isDecimalSign(text) ? text : text.split(_decimal.current);
|
|
12677
|
-
if (textSplit.length === 2) {
|
|
12678
|
-
const local = value2.slice(start, end);
|
|
12679
|
-
const decimalCharIndex = local.search(_decimal.current);
|
|
12680
|
-
_decimal.current.lastIndex = 0;
|
|
12681
|
-
return decimalCharIndex > 0 ? value2.slice(0, start) + formatValue(text) + replaceSuffix(value2).slice(end) : value2 || formatValue(text);
|
|
12682
|
-
}
|
|
12683
|
-
if (isDecimalSign(text) && value2.length === 0) {
|
|
12684
|
-
return formatValue("0.");
|
|
12685
|
-
}
|
|
12686
|
-
if (end - start === value2.length) {
|
|
12687
|
-
return formatValue(text);
|
|
12688
|
-
}
|
|
12689
|
-
if (start === 0) {
|
|
12690
|
-
const suffix = /[A-Za-z]$/.test(value2[end]) ? end - 1 : end;
|
|
12691
|
-
return text + value2.slice(suffix);
|
|
12692
|
-
}
|
|
12693
|
-
if (end === value2.length) {
|
|
12694
|
-
return value2.slice(0, start) + text;
|
|
12695
|
-
}
|
|
12696
|
-
const selectionValue = value2.slice(start, end);
|
|
12697
|
-
const space = /\s$/.test(selectionValue) ? " " : "";
|
|
12698
|
-
return value2.slice(0, start) + text + space + value2.slice(end);
|
|
12699
|
-
};
|
|
12700
|
-
const evaluateEmptyForUpdate = (newValue) => evaluateEmpty(newValue);
|
|
12701
|
-
const updateInput = (value2, insertedValueStr, operation, valueStr) => {
|
|
12702
|
-
var _a2, _b2;
|
|
12703
|
-
insertedValueStr = insertedValueStr || "";
|
|
12704
|
-
const inputEl = inputRef.current;
|
|
12705
|
-
if (!inputEl) return;
|
|
12706
|
-
const inputValue = inputEl.value;
|
|
12707
|
-
let newValue = formatValue(value2);
|
|
12708
|
-
const currentLength = inputValue.length;
|
|
12709
|
-
if (newValue !== valueStr && valueStr != null) {
|
|
12710
|
-
newValue = concatValues(newValue, valueStr);
|
|
12711
|
-
}
|
|
12712
|
-
if (currentLength === 0) {
|
|
12713
|
-
inputEl.value = newValue;
|
|
12714
|
-
inputEl.setSelectionRange(0, 0);
|
|
12715
|
-
const index = initCursor();
|
|
12716
|
-
const selectionEnd = index + insertedValueStr.length + (isDecimalSign(insertedValueStr) ? 1 : 0);
|
|
12717
|
-
inputEl.setSelectionRange(selectionEnd, selectionEnd);
|
|
12718
|
-
} else {
|
|
12719
|
-
let selectionStart = (_a2 = inputEl.selectionStart) != null ? _a2 : 0;
|
|
12720
|
-
let selectionEnd = (_b2 = inputEl.selectionEnd) != null ? _b2 : 0;
|
|
12721
|
-
if (props.maxLength && props.maxLength < newValue.length) {
|
|
12722
|
-
return;
|
|
12723
|
-
}
|
|
12724
|
-
inputEl.value = newValue;
|
|
12725
|
-
const newLength = newValue.length;
|
|
12726
|
-
if (operation === "range-insert") {
|
|
12727
|
-
const startValue = parseValue((inputValue || "").slice(0, selectionStart));
|
|
12728
|
-
const startValueStr = startValue != null ? String(startValue) : "";
|
|
12729
|
-
const startExpr = startValueStr.split("").join("(" + groupChar.current + ")?");
|
|
12730
|
-
const sRegex = new RegExp(startExpr, "g");
|
|
12731
|
-
sRegex.test(newValue);
|
|
12732
|
-
const tExpr = insertedValueStr.split("").join("(" + groupChar.current + ")?");
|
|
12733
|
-
const tRegex = new RegExp(tExpr, "g");
|
|
12734
|
-
tRegex.test(newValue.slice(sRegex.lastIndex));
|
|
12735
|
-
selectionEnd = sRegex.lastIndex + tRegex.lastIndex;
|
|
12736
|
-
inputEl.setSelectionRange(selectionEnd, selectionEnd);
|
|
12737
|
-
} else if (newLength === currentLength) {
|
|
12738
|
-
if (operation === "insert" || operation === "delete-back-single") {
|
|
12739
|
-
let newSelectionEnd = selectionEnd;
|
|
12740
|
-
if (insertedValueStr === "0") {
|
|
12741
|
-
newSelectionEnd = selectionEnd + 1;
|
|
12742
|
-
} else {
|
|
12743
|
-
newSelectionEnd = newSelectionEnd + Number(isDecimalSign(value2) || isDecimalSign(insertedValueStr));
|
|
12744
|
-
}
|
|
12745
|
-
inputEl.setSelectionRange(newSelectionEnd, newSelectionEnd);
|
|
12746
|
-
} else if (operation === "delete-single") {
|
|
12747
|
-
inputEl.setSelectionRange(selectionEnd - 1, selectionEnd - 1);
|
|
12748
|
-
} else if (operation === "delete-range" || operation === "spin") {
|
|
12749
|
-
inputEl.setSelectionRange(selectionEnd, selectionEnd);
|
|
12750
|
-
}
|
|
12751
|
-
} else if (operation === "delete-back-single") {
|
|
12752
|
-
const prevChar = inputValue.charAt(selectionEnd - 1);
|
|
12753
|
-
const nextChar = inputValue.charAt(selectionEnd);
|
|
12754
|
-
const diff = currentLength - newLength;
|
|
12755
|
-
const isGroupChar = _group.current.test(nextChar);
|
|
12756
|
-
if (isGroupChar && diff === 1) {
|
|
12757
|
-
selectionEnd = selectionEnd + 1;
|
|
12758
|
-
} else if (!isGroupChar && isNumeralChar(prevChar)) {
|
|
12759
|
-
selectionEnd = selectionEnd + (-1 * diff + 1);
|
|
12760
|
-
}
|
|
12761
|
-
_group.current.lastIndex = 0;
|
|
12762
|
-
inputEl.setSelectionRange(selectionEnd, selectionEnd);
|
|
12763
|
-
} else if (inputValue === "-" && operation === "insert") {
|
|
12764
|
-
inputEl.setSelectionRange(0, 0);
|
|
12765
|
-
const idx = initCursor();
|
|
12766
|
-
const end = idx + insertedValueStr.length + 1;
|
|
12767
|
-
inputEl.setSelectionRange(end, end);
|
|
12768
|
-
} else {
|
|
12769
|
-
selectionEnd = selectionEnd + (newLength - currentLength);
|
|
12770
|
-
inputEl.setSelectionRange(selectionEnd, selectionEnd);
|
|
12771
|
-
}
|
|
12772
|
-
}
|
|
12773
|
-
inputEl.setAttribute("aria-valuenow", value2 == null ? "" : String(value2));
|
|
12774
|
-
};
|
|
12775
|
-
const updateInputValue = (newValue) => {
|
|
12776
|
-
const evaluated = evaluateEmptyForUpdate(newValue);
|
|
12777
|
-
const inputEl = inputRef.current;
|
|
12778
|
-
if (!inputEl) return;
|
|
12779
|
-
const current = inputEl.value;
|
|
12780
|
-
const formatted = formattedValue(evaluated);
|
|
12781
|
-
if (current !== formatted) {
|
|
12782
|
-
inputEl.value = formatted;
|
|
12783
|
-
inputEl.setAttribute("aria-valuenow", evaluated == null ? "" : String(evaluated));
|
|
12784
|
-
}
|
|
12785
|
-
};
|
|
12786
|
-
const isValueChanged = (currentValue, newValue) => {
|
|
12787
|
-
if (newValue == null && currentValue != null) return true;
|
|
12788
|
-
if (newValue != null) {
|
|
12789
|
-
const parsedCurrent = typeof currentValue === "string" ? parseValue(currentValue) : null;
|
|
12790
|
-
return newValue !== parsedCurrent;
|
|
12791
|
-
}
|
|
12792
|
-
return false;
|
|
12793
|
-
};
|
|
12794
|
-
const updateValue = (event, valueStr, insertedValueStr, operation) => {
|
|
12795
|
-
const inputEl = inputRef.current;
|
|
12796
|
-
if (!inputEl) return;
|
|
12797
|
-
const currentValue = inputEl.value;
|
|
12798
|
-
if (valueStr != null) {
|
|
12799
|
-
const parsed = parseValue(valueStr);
|
|
12800
|
-
evaluateEmpty(parsed);
|
|
12801
|
-
const limited = validateValueByLimit(parsed);
|
|
12802
|
-
updateInput(limited, insertedValueStr, operation, valueStr);
|
|
12803
|
-
if (event && typeof currentValue === "string" && typeof limited === "number" && isValueChanged(currentValue, limited)) {
|
|
12804
|
-
handleOnChange(event, currentValue, limited);
|
|
12477
|
+
},
|
|
12478
|
+
[props]
|
|
12479
|
+
);
|
|
12480
|
+
const setCaret = (pos) => {
|
|
12481
|
+
const el = inputRef.current;
|
|
12482
|
+
if (!el) return;
|
|
12483
|
+
queueMicrotask(() => {
|
|
12484
|
+
try {
|
|
12485
|
+
el.setSelectionRange(pos, pos);
|
|
12486
|
+
} catch {
|
|
12805
12487
|
}
|
|
12806
|
-
|
|
12807
|
-
}
|
|
12808
|
-
};
|
|
12809
|
-
const spin = (event, dir) => {
|
|
12810
|
-
var _a2, _b2;
|
|
12811
|
-
const inputEl = inputRef.current;
|
|
12812
|
-
if (!inputEl) return;
|
|
12813
|
-
const step = ((_a2 = props.step) != null ? _a2 : 1) * dir;
|
|
12814
|
-
const currentValue = (_b2 = parseValue(inputEl.value)) != null ? _b2 : 0;
|
|
12815
|
-
const newValue = validateValue(addWithPrecision(currentValue, step));
|
|
12816
|
-
if (newValue == null) return;
|
|
12817
|
-
if (props.maxLength && props.maxLength < formatValue(newValue).length) {
|
|
12818
|
-
return;
|
|
12819
|
-
}
|
|
12820
|
-
handleOnChange(event, inputEl.value, newValue);
|
|
12821
|
-
updateInput(newValue, null, "spin");
|
|
12822
|
-
updateModel(event, newValue);
|
|
12488
|
+
});
|
|
12823
12489
|
};
|
|
12824
|
-
const
|
|
12825
|
-
|
|
12826
|
-
|
|
12827
|
-
|
|
12828
|
-
|
|
12829
|
-
|
|
12830
|
-
|
|
12831
|
-
|
|
12832
|
-
|
|
12833
|
-
|
|
12834
|
-
|
|
12835
|
-
|
|
12836
|
-
|
|
12837
|
-
|
|
12838
|
-
|
|
12839
|
-
|
|
12840
|
-
|
|
12841
|
-
|
|
12842
|
-
|
|
12843
|
-
|
|
12844
|
-
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
|
|
12850
|
-
|
|
12851
|
-
|
|
12852
|
-
|
|
12853
|
-
|
|
12854
|
-
|
|
12855
|
-
|
|
12856
|
-
|
|
12857
|
-
|
|
12858
|
-
|
|
12859
|
-
|
|
12860
|
-
|
|
12861
|
-
|
|
12862
|
-
|
|
12863
|
-
}
|
|
12864
|
-
}
|
|
12865
|
-
} else {
|
|
12866
|
-
const operation = selectionStart !== selectionEnd ? "range-insert" : "insert";
|
|
12867
|
-
if (decimalCharIndex > 0 && selectionStart > decimalCharIndex) {
|
|
12868
|
-
if (selectionStart + text.length - (decimalCharIndex + 1) <= maxFractionDigits) {
|
|
12869
|
-
const charIndex = currencyCharIndex >= selectionStart ? currencyCharIndex - 1 : suffixCharIndex >= selectionStart ? suffixCharIndex : inputValue.length;
|
|
12870
|
-
newValueStr = inputValue.slice(0, selectionStart) + text + inputValue.slice(selectionStart + text.length, charIndex) + inputValue.slice(charIndex);
|
|
12871
|
-
updateValue(event, newValueStr, text, operation);
|
|
12872
|
-
}
|
|
12873
|
-
} else {
|
|
12874
|
-
newValueStr = insertText(inputValue, text, selectionStart, selectionEnd);
|
|
12875
|
-
updateValue(event, newValueStr, text, operation);
|
|
12490
|
+
const formatFromModel = React66.useCallback(
|
|
12491
|
+
(n3) => {
|
|
12492
|
+
if (n3 == null) return "";
|
|
12493
|
+
if (!props.format) return toEditableFromNumber(n3);
|
|
12494
|
+
const formatted = formatDisplayNumber(
|
|
12495
|
+
n3,
|
|
12496
|
+
locale,
|
|
12497
|
+
fmtOptions,
|
|
12498
|
+
props.prefix,
|
|
12499
|
+
props.suffix
|
|
12500
|
+
);
|
|
12501
|
+
return formatted;
|
|
12502
|
+
},
|
|
12503
|
+
[
|
|
12504
|
+
props.format,
|
|
12505
|
+
props.prefix,
|
|
12506
|
+
props.suffix,
|
|
12507
|
+
locale,
|
|
12508
|
+
fmtOptions,
|
|
12509
|
+
toEditableFromNumber
|
|
12510
|
+
]
|
|
12511
|
+
);
|
|
12512
|
+
const getModelFromDisplay = React66.useCallback(
|
|
12513
|
+
(text) => {
|
|
12514
|
+
const stripped = stripAffixes(text, props.prefix, props.suffix);
|
|
12515
|
+
const withoutGroup = stripGrouping(stripped, locale);
|
|
12516
|
+
const candidate = decimalSep !== "." ? withoutGroup.replace(".", decimalSep) : withoutGroup;
|
|
12517
|
+
const n3 = parseEditable(candidate, locale, decimalSep);
|
|
12518
|
+
if (n3 == null) return null;
|
|
12519
|
+
const clamped = clampModel(n3);
|
|
12520
|
+
return clamped;
|
|
12521
|
+
},
|
|
12522
|
+
[props.prefix, props.suffix, locale, decimalSep, clampModel]
|
|
12523
|
+
);
|
|
12524
|
+
const syncFromPropsValue = React66.useCallback(
|
|
12525
|
+
(v2) => {
|
|
12526
|
+
if (v2 == null) {
|
|
12527
|
+
setDisplay("");
|
|
12528
|
+
return;
|
|
12876
12529
|
}
|
|
12877
|
-
|
|
12878
|
-
|
|
12879
|
-
|
|
12530
|
+
const clamped = clampModel(v2);
|
|
12531
|
+
setDisplay(
|
|
12532
|
+
focused ? toEditableFromNumber(clamped) : formatFromModel(clamped)
|
|
12533
|
+
);
|
|
12534
|
+
},
|
|
12535
|
+
[clampModel, focused, toEditableFromNumber, formatFromModel]
|
|
12536
|
+
);
|
|
12537
|
+
React66.useEffect(() => {
|
|
12880
12538
|
var _a2;
|
|
12881
|
-
|
|
12882
|
-
|
|
12883
|
-
|
|
12884
|
-
let inputValue = inputEl.value;
|
|
12885
|
-
const valueLength = inputValue.length;
|
|
12886
|
-
let index = null;
|
|
12887
|
-
const prefixLength = (prefixChar.current || "").length;
|
|
12888
|
-
inputValue = inputValue.replace(_prefix.current, "");
|
|
12889
|
-
selectionStart = selectionStart - prefixLength;
|
|
12890
|
-
let ch = inputValue.charAt(selectionStart);
|
|
12891
|
-
if (isNumeralChar(ch)) {
|
|
12892
|
-
return selectionStart + prefixLength;
|
|
12893
|
-
}
|
|
12894
|
-
let i3 = selectionStart - 1;
|
|
12895
|
-
while (i3 >= 0) {
|
|
12896
|
-
ch = inputValue.charAt(i3);
|
|
12897
|
-
if (isNumeralChar(ch)) {
|
|
12898
|
-
index = i3 + prefixLength;
|
|
12899
|
-
break;
|
|
12900
|
-
}
|
|
12901
|
-
i3--;
|
|
12902
|
-
}
|
|
12903
|
-
if (index != null) {
|
|
12904
|
-
inputEl.setSelectionRange(index + 1, index + 1);
|
|
12905
|
-
} else {
|
|
12906
|
-
i3 = selectionStart;
|
|
12907
|
-
while (i3 < valueLength) {
|
|
12908
|
-
ch = inputValue.charAt(i3);
|
|
12909
|
-
if (isNumeralChar(ch)) {
|
|
12910
|
-
index = i3 + prefixLength;
|
|
12911
|
-
break;
|
|
12912
|
-
}
|
|
12913
|
-
i3++;
|
|
12914
|
-
}
|
|
12915
|
-
if (index != null) {
|
|
12916
|
-
inputEl.setSelectionRange(index, index);
|
|
12917
|
-
}
|
|
12918
|
-
}
|
|
12919
|
-
return index != null ? index : 0;
|
|
12920
|
-
};
|
|
12921
|
-
const onInputPointerDown = () => {
|
|
12922
|
-
isFocusedByClick.current = true;
|
|
12923
|
-
};
|
|
12924
|
-
const onInputClick = () => {
|
|
12925
|
-
initCursor();
|
|
12926
|
-
};
|
|
12927
|
-
const onInput = (event) => {
|
|
12928
|
-
if (props.disabled || props.readOnly) return;
|
|
12929
|
-
if (utilsIsSpecialChar.current) {
|
|
12930
|
-
event.currentTarget.value = lastValue.current;
|
|
12931
|
-
utilsIsSpecialChar.current = false;
|
|
12932
|
-
}
|
|
12933
|
-
};
|
|
12934
|
-
const utilsIsSpecialChar = React11.useRef(false);
|
|
12935
|
-
const onInputAndroidKey = (event) => {
|
|
12539
|
+
syncFromPropsValue((_a2 = props.value) != null ? _a2 : null);
|
|
12540
|
+
}, []);
|
|
12541
|
+
React66.useEffect(() => {
|
|
12936
12542
|
var _a2;
|
|
12937
|
-
|
|
12938
|
-
|
|
12939
|
-
|
|
12940
|
-
|
|
12941
|
-
const code = event.which || event.keyCode;
|
|
12942
|
-
if (code !== 13) {
|
|
12943
|
-
event.preventDefault();
|
|
12944
|
-
}
|
|
12945
|
-
const ch = String.fromCharCode(code);
|
|
12946
|
-
const decimal = isDecimalSign(ch);
|
|
12947
|
-
const minus = isMinusSign(ch);
|
|
12948
|
-
if (code >= 48 && code <= 57 || minus || decimal) {
|
|
12949
|
-
insert(event, ch, { isDecimalSign: decimal, isMinusSign: minus });
|
|
12950
|
-
} else {
|
|
12951
|
-
const inputVal = event.target.value;
|
|
12952
|
-
updateValue(event, inputVal, null, "delete-single");
|
|
12953
|
-
}
|
|
12954
|
-
};
|
|
12955
|
-
const onInputKeyDown = (event) => {
|
|
12956
|
-
var _a2, _b2, _c;
|
|
12957
|
-
if (props.disabled || props.readOnly) return;
|
|
12958
|
-
if (event.altKey || event.ctrlKey || event.metaKey) {
|
|
12959
|
-
if (event.key.toLowerCase() === "x" && (event.ctrlKey || event.metaKey)) {
|
|
12960
|
-
utilsIsSpecialChar.current = false;
|
|
12961
|
-
} else {
|
|
12962
|
-
utilsIsSpecialChar.current = true;
|
|
12963
|
-
}
|
|
12964
|
-
return;
|
|
12965
|
-
}
|
|
12966
|
-
(_a2 = props.onKeyDown) == null ? void 0 : _a2.call(props, event);
|
|
12967
|
-
if (event.defaultPrevented) return;
|
|
12968
|
-
const inputEl = event.currentTarget;
|
|
12969
|
-
lastValue.current = inputEl.value;
|
|
12970
|
-
const isAndroid2 = /Android/i.test(navigator.userAgent);
|
|
12971
|
-
if (isAndroid2) return;
|
|
12972
|
-
let selectionStart = (_b2 = inputEl.selectionStart) != null ? _b2 : 0;
|
|
12973
|
-
let selectionEnd = (_c = inputEl.selectionEnd) != null ? _c : 0;
|
|
12974
|
-
const inputValue = inputEl.value;
|
|
12975
|
-
let newValueStr = null;
|
|
12976
|
-
switch (event.code) {
|
|
12977
|
-
case "ArrowUp":
|
|
12978
|
-
spin(event, 1);
|
|
12979
|
-
event.preventDefault();
|
|
12980
|
-
break;
|
|
12981
|
-
case "ArrowDown":
|
|
12982
|
-
spin(event, -1);
|
|
12983
|
-
event.preventDefault();
|
|
12984
|
-
break;
|
|
12985
|
-
case "ArrowLeft": {
|
|
12986
|
-
const charPrev = inputValue.charAt(selectionStart - 1);
|
|
12987
|
-
if (!isNumeralChar(charPrev)) {
|
|
12988
|
-
event.preventDefault();
|
|
12989
|
-
}
|
|
12990
|
-
break;
|
|
12991
|
-
}
|
|
12992
|
-
case "ArrowRight": {
|
|
12993
|
-
const charNext = inputValue.charAt(selectionStart);
|
|
12994
|
-
if (!isNumeralChar(charNext)) {
|
|
12995
|
-
event.preventDefault();
|
|
12996
|
-
}
|
|
12997
|
-
break;
|
|
12998
|
-
}
|
|
12999
|
-
case "Tab":
|
|
13000
|
-
case "Enter":
|
|
13001
|
-
case "NumpadEnter": {
|
|
13002
|
-
const parsedVal = validateValue(parseValue(inputValue));
|
|
13003
|
-
inputRef.current.value = formatValue(parsedVal);
|
|
13004
|
-
inputRef.current.setAttribute("aria-valuenow", parsedVal == null ? "" : String(parsedVal));
|
|
13005
|
-
updateModel(event, parsedVal);
|
|
13006
|
-
break;
|
|
13007
|
-
}
|
|
13008
|
-
case "Backspace": {
|
|
13009
|
-
event.preventDefault();
|
|
13010
|
-
if (selectionStart === selectionEnd) {
|
|
13011
|
-
const deleteChar = inputValue.charAt(selectionStart - 1);
|
|
13012
|
-
if (isNumeralChar(deleteChar)) {
|
|
13013
|
-
const {
|
|
13014
|
-
decimalCharIndex,
|
|
13015
|
-
decimalCharIndexWithoutPrefix
|
|
13016
|
-
} = getDecimalCharIndexes(inputValue);
|
|
13017
|
-
const decimalLength = getDecimalLength(inputValue);
|
|
13018
|
-
if (_group.current.test(deleteChar)) {
|
|
13019
|
-
_group.current.lastIndex = 0;
|
|
13020
|
-
newValueStr = inputValue.slice(0, selectionStart - 2) + inputValue.slice(selectionStart - 1);
|
|
13021
|
-
} else if (_decimal.current.test(deleteChar)) {
|
|
13022
|
-
_decimal.current.lastIndex = 0;
|
|
13023
|
-
if (decimalLength) {
|
|
13024
|
-
inputRef.current.setSelectionRange(selectionStart - 1, selectionStart - 1);
|
|
13025
|
-
} else {
|
|
13026
|
-
newValueStr = inputValue.slice(0, selectionStart - 1) + inputValue.slice(selectionStart);
|
|
13027
|
-
}
|
|
13028
|
-
} else if (decimalCharIndex > 0 && selectionStart > decimalCharIndex) {
|
|
13029
|
-
const insertedText = isDecimalMode() && (props.minFractionDigits || 0) < decimalLength ? "" : "0";
|
|
13030
|
-
newValueStr = inputValue.slice(0, selectionStart - 1) + insertedText + inputValue.slice(selectionStart);
|
|
13031
|
-
} else if (decimalCharIndexWithoutPrefix === 1) {
|
|
13032
|
-
newValueStr = inputValue.slice(0, selectionStart - 1) + "0" + inputValue.slice(selectionStart);
|
|
13033
|
-
newValueStr = parseValue(newValueStr) > 0 ? newValueStr : "";
|
|
13034
|
-
} else {
|
|
13035
|
-
newValueStr = inputValue.slice(0, selectionStart - 1) + inputValue.slice(selectionStart);
|
|
13036
|
-
}
|
|
13037
|
-
} else if (_currency.current.test(deleteChar)) {
|
|
13038
|
-
const {
|
|
13039
|
-
minusCharIndex,
|
|
13040
|
-
currencyCharIndex
|
|
13041
|
-
} = getCharIndexes(inputValue);
|
|
13042
|
-
if (minusCharIndex === currencyCharIndex - 1) {
|
|
13043
|
-
newValueStr = inputValue.slice(0, minusCharIndex) + inputValue.slice(selectionStart);
|
|
13044
|
-
}
|
|
13045
|
-
}
|
|
13046
|
-
updateValue(event, newValueStr, null, "delete-single");
|
|
13047
|
-
} else {
|
|
13048
|
-
newValueStr = deleteRange(inputValue, selectionStart, selectionEnd);
|
|
13049
|
-
updateValue(event, newValueStr, null, "delete-range");
|
|
13050
|
-
}
|
|
13051
|
-
break;
|
|
13052
|
-
}
|
|
13053
|
-
case "Delete": {
|
|
13054
|
-
event.preventDefault();
|
|
13055
|
-
if (selectionStart === selectionEnd) {
|
|
13056
|
-
const deleteChar = inputValue.charAt(selectionStart);
|
|
13057
|
-
const {
|
|
13058
|
-
decimalCharIndex,
|
|
13059
|
-
decimalCharIndexWithoutPrefix
|
|
13060
|
-
} = getDecimalCharIndexes(inputValue);
|
|
13061
|
-
if (isNumeralChar(deleteChar)) {
|
|
13062
|
-
const decimalLength = getDecimalLength(inputValue);
|
|
13063
|
-
if (_group.current.test(deleteChar)) {
|
|
13064
|
-
_group.current.lastIndex = 0;
|
|
13065
|
-
newValueStr = inputValue.slice(0, selectionStart) + inputValue.slice(selectionStart + 2);
|
|
13066
|
-
} else if (_decimal.current.test(deleteChar)) {
|
|
13067
|
-
_decimal.current.lastIndex = 0;
|
|
13068
|
-
if (decimalLength) {
|
|
13069
|
-
inputRef.current.setSelectionRange(selectionStart + 1, selectionStart + 1);
|
|
13070
|
-
} else {
|
|
13071
|
-
newValueStr = inputValue.slice(0, selectionStart) + inputValue.slice(selectionStart + 1);
|
|
13072
|
-
}
|
|
13073
|
-
} else if (decimalCharIndex > 0 && selectionStart > decimalCharIndex) {
|
|
13074
|
-
const insertedText = isDecimalMode() && (props.minFractionDigits || 0) < decimalLength ? "" : "0";
|
|
13075
|
-
newValueStr = inputValue.slice(0, selectionStart) + insertedText + inputValue.slice(selectionStart + 1);
|
|
13076
|
-
} else if (decimalCharIndexWithoutPrefix === 1) {
|
|
13077
|
-
newValueStr = inputValue.slice(0, selectionStart) + "0" + inputValue.slice(selectionStart + 1);
|
|
13078
|
-
newValueStr = parseValue(newValueStr) > 0 ? newValueStr : "";
|
|
13079
|
-
} else {
|
|
13080
|
-
newValueStr = inputValue.slice(0, selectionStart) + inputValue.slice(selectionStart + 1);
|
|
13081
|
-
}
|
|
13082
|
-
}
|
|
13083
|
-
updateValue(event, newValueStr, null, "delete-back-single");
|
|
13084
|
-
} else {
|
|
13085
|
-
newValueStr = deleteRange(inputValue, selectionStart, selectionEnd);
|
|
13086
|
-
updateValue(event, newValueStr, null, "delete-range");
|
|
13087
|
-
}
|
|
13088
|
-
break;
|
|
13089
|
-
}
|
|
13090
|
-
case "End":
|
|
13091
|
-
event.preventDefault();
|
|
13092
|
-
if (props.max != null) {
|
|
13093
|
-
updateModel(event, props.max);
|
|
13094
|
-
updateInputValue(props.max);
|
|
13095
|
-
}
|
|
13096
|
-
break;
|
|
13097
|
-
case "Home":
|
|
13098
|
-
event.preventDefault();
|
|
13099
|
-
if (props.min != null) {
|
|
13100
|
-
updateModel(event, props.min);
|
|
13101
|
-
updateInputValue(props.min);
|
|
13102
|
-
}
|
|
13103
|
-
break;
|
|
13104
|
-
default: {
|
|
13105
|
-
event.preventDefault();
|
|
13106
|
-
let ch = event.key;
|
|
13107
|
-
if (!ch) break;
|
|
13108
|
-
if (ch === ".") {
|
|
13109
|
-
ch = _decimalSeparator.current;
|
|
13110
|
-
}
|
|
13111
|
-
const decimal = isDecimalSign(ch);
|
|
13112
|
-
const minus = isMinusSign(ch);
|
|
13113
|
-
if (ch >= "0" && ch <= "9" || minus || decimal) {
|
|
13114
|
-
insert(event, ch, { isDecimalSign: decimal, isMinusSign: minus });
|
|
13115
|
-
}
|
|
13116
|
-
break;
|
|
13117
|
-
}
|
|
13118
|
-
}
|
|
13119
|
-
};
|
|
13120
|
-
const onPaste = (event) => {
|
|
13121
|
-
event.preventDefault();
|
|
13122
|
-
if (props.disabled || props.readOnly) return;
|
|
13123
|
-
const data = (event.clipboardData || window.clipboardData).getData("Text");
|
|
13124
|
-
if (!data) return;
|
|
13125
|
-
const filteredData = parseValue(data);
|
|
13126
|
-
if (filteredData != null) {
|
|
13127
|
-
if (typeof filteredData === "number" && isFloat(filteredData)) {
|
|
13128
|
-
const formatted = formatValue(filteredData);
|
|
13129
|
-
if (inputRef.current) {
|
|
13130
|
-
inputRef.current.value = formatted;
|
|
13131
|
-
}
|
|
13132
|
-
updateModel(event, filteredData);
|
|
13133
|
-
} else {
|
|
13134
|
-
insert(event, String(filteredData));
|
|
13135
|
-
}
|
|
13136
|
-
}
|
|
13137
|
-
};
|
|
13138
|
-
const onInputFocus = (event) => {
|
|
12543
|
+
if (focused) return;
|
|
12544
|
+
syncFromPropsValue((_a2 = props.value) != null ? _a2 : null);
|
|
12545
|
+
}, [props.value, focused, syncFromPropsValue]);
|
|
12546
|
+
const onFocus = (e4) => {
|
|
13139
12547
|
var _a2;
|
|
13140
|
-
|
|
13141
|
-
(_a2 = props.onFocus) == null ? void 0 : _a2.call(props,
|
|
13142
|
-
|
|
13143
|
-
|
|
13144
|
-
|
|
13145
|
-
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
12548
|
+
setFocused(true);
|
|
12549
|
+
(_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e4);
|
|
12550
|
+
const model = isFiniteNumber(props.value) ? clampModel(props.value) : getModelFromDisplay(display);
|
|
12551
|
+
const editable = model == null ? stripAffixes(display, props.prefix, props.suffix) : toEditableFromNumber(model);
|
|
12552
|
+
const normalized = normalizeEditable(
|
|
12553
|
+
editable,
|
|
12554
|
+
locale,
|
|
12555
|
+
decimalSep,
|
|
12556
|
+
allowMinus
|
|
12557
|
+
);
|
|
12558
|
+
setDisplay(normalized);
|
|
12559
|
+
queueMicrotask(() => {
|
|
12560
|
+
var _a3, _b;
|
|
12561
|
+
setCaret(((_b = (_a3 = inputRef.current) == null ? void 0 : _a3.value) != null ? _b : "").length);
|
|
12562
|
+
});
|
|
13149
12563
|
};
|
|
13150
|
-
const
|
|
13151
|
-
var _a2,
|
|
13152
|
-
|
|
13153
|
-
|
|
13154
|
-
|
|
13155
|
-
|
|
13156
|
-
|
|
13157
|
-
|
|
13158
|
-
|
|
13159
|
-
|
|
13160
|
-
|
|
13161
|
-
|
|
13162
|
-
|
|
12564
|
+
const onBlur = (e4) => {
|
|
12565
|
+
var _a2, _b;
|
|
12566
|
+
setFocused(false);
|
|
12567
|
+
const el = e4.currentTarget;
|
|
12568
|
+
const raw = stripAffixes(el.value, props.prefix, props.suffix);
|
|
12569
|
+
const normalized = normalizeEditable(
|
|
12570
|
+
raw,
|
|
12571
|
+
locale,
|
|
12572
|
+
decimalSep,
|
|
12573
|
+
allowMinus
|
|
12574
|
+
);
|
|
12575
|
+
const parsed = parseEditable(normalized, locale, decimalSep);
|
|
12576
|
+
let model = parsed == null ? null : clampModel(parsed);
|
|
12577
|
+
if (model == null && props.allowEmpty === false) {
|
|
12578
|
+
const fallback = (_a2 = props.min) != null ? _a2 : 0;
|
|
12579
|
+
model = clampModel(fallback);
|
|
12580
|
+
}
|
|
12581
|
+
setDisplay(formatFromModel(model));
|
|
12582
|
+
emit(e4, model);
|
|
12583
|
+
(_b = props.onBlur) == null ? void 0 : _b.call(props, e4);
|
|
13163
12584
|
};
|
|
13164
|
-
const
|
|
13165
|
-
|
|
13166
|
-
|
|
13167
|
-
const
|
|
13168
|
-
|
|
13169
|
-
|
|
12585
|
+
const onChangeText = (e4) => {
|
|
12586
|
+
var _a2, _b;
|
|
12587
|
+
if (props.disabled || props.readOnly) return;
|
|
12588
|
+
const el = e4.currentTarget;
|
|
12589
|
+
const caretBefore = (_a2 = el.selectionStart) != null ? _a2 : el.value.length;
|
|
12590
|
+
const stripped = stripAffixes(el.value, props.prefix, props.suffix);
|
|
12591
|
+
let next = normalizeEditable(
|
|
12592
|
+
stripped,
|
|
12593
|
+
locale,
|
|
12594
|
+
decimalSep,
|
|
12595
|
+
allowMinus
|
|
12596
|
+
);
|
|
12597
|
+
const fracLimit = props.maxFractionDigits;
|
|
12598
|
+
if (fracLimit != null) {
|
|
12599
|
+
const applied = applyFractionLimitReplace(
|
|
12600
|
+
next,
|
|
12601
|
+
display,
|
|
12602
|
+
locale,
|
|
12603
|
+
decimalSep,
|
|
12604
|
+
fracLimit,
|
|
12605
|
+
el
|
|
12606
|
+
);
|
|
12607
|
+
next = applied.text;
|
|
12608
|
+
setDisplay(next);
|
|
12609
|
+
setCaret(applied.caret);
|
|
12610
|
+
} else {
|
|
12611
|
+
setDisplay(next);
|
|
12612
|
+
setCaret(caretBefore);
|
|
13170
12613
|
}
|
|
12614
|
+
const parsed = parseEditable(next, locale, decimalSep);
|
|
12615
|
+
const model = parsed == null ? null : clampModel(parsed);
|
|
12616
|
+
const finalModel = model == null && props.allowEmpty === false ? clampModel((_b = props.min) != null ? _b : 0) : model;
|
|
12617
|
+
emit(e4, finalModel);
|
|
13171
12618
|
};
|
|
13172
|
-
|
|
13173
|
-
React11.useEffect(() => {
|
|
13174
|
-
if (props.inputRef) {
|
|
13175
|
-
if (typeof props.inputRef === "function") {
|
|
13176
|
-
props.inputRef(inputRef.current);
|
|
13177
|
-
} else {
|
|
13178
|
-
props.inputRef.current = inputRef.current;
|
|
13179
|
-
}
|
|
13180
|
-
}
|
|
13181
|
-
}, [props.inputRef]);
|
|
13182
|
-
React11.useEffect(
|
|
13183
|
-
() => () => {
|
|
13184
|
-
clearTimer();
|
|
13185
|
-
},
|
|
13186
|
-
[]
|
|
13187
|
-
);
|
|
13188
|
-
React11.useEffect(() => {
|
|
13189
|
-
constructParser();
|
|
13190
|
-
const newValue = validateValue(props.value);
|
|
13191
|
-
if (props.value != null && props.value !== newValue) {
|
|
13192
|
-
updateModel(null, newValue);
|
|
13193
|
-
}
|
|
13194
|
-
}, []);
|
|
13195
|
-
React11.useEffect(() => {
|
|
13196
|
-
constructParser();
|
|
13197
|
-
changeValue();
|
|
13198
|
-
}, [
|
|
13199
|
-
_locale,
|
|
13200
|
-
props.locale,
|
|
13201
|
-
props.localeMatcher,
|
|
13202
|
-
props.mode,
|
|
13203
|
-
props.currency,
|
|
13204
|
-
props.currencyDisplay,
|
|
13205
|
-
props.useGrouping,
|
|
13206
|
-
props.minFractionDigits,
|
|
13207
|
-
props.maxFractionDigits,
|
|
13208
|
-
props.suffix,
|
|
13209
|
-
props.prefix
|
|
13210
|
-
]);
|
|
13211
|
-
React11.useEffect(() => {
|
|
13212
|
-
changeValue();
|
|
13213
|
-
}, [props.value]);
|
|
13214
|
-
React11.useEffect(() => {
|
|
13215
|
-
if (props.disabled) clearTimer();
|
|
13216
|
-
}, [props.disabled]);
|
|
12619
|
+
const inputMode = props.inputMode || (props.mode === "decimal" && props.maxFractionDigits == null && props.minFractionDigits == null ? "numeric" : "decimal");
|
|
13217
12620
|
const inputClassName = [
|
|
13218
12621
|
props.inputClassName,
|
|
13219
12622
|
props.invalid ? "p-invalid" : void 0
|
|
13220
12623
|
].filter(Boolean).join(" ");
|
|
13221
|
-
const valueToRender = formattedValue((_a = props.value) != null ? _a : null);
|
|
13222
12624
|
const {
|
|
13223
12625
|
inputId,
|
|
13224
12626
|
inputStyle,
|
|
@@ -13229,34 +12631,32 @@ var InputNumber = React11.memo(
|
|
|
13229
12631
|
value,
|
|
13230
12632
|
icon,
|
|
13231
12633
|
iconGap,
|
|
13232
|
-
// anything you *don’t* want to pass down can be pulled out here too
|
|
13233
|
-
// e.g. internal-only props
|
|
13234
12634
|
...passThroughProps
|
|
13235
|
-
// everything else goes straight to ShadcnTextVariant
|
|
13236
12635
|
} = props;
|
|
13237
12636
|
return (
|
|
13238
12637
|
//@ts-ignore
|
|
13239
12638
|
/* @__PURE__ */ jsx(
|
|
13240
12639
|
Input,
|
|
13241
12640
|
{
|
|
13242
|
-
|
|
13243
|
-
|
|
12641
|
+
ref: (node) => {
|
|
12642
|
+
inputRef.current = node;
|
|
12643
|
+
if (typeof props.inputRef === "function")
|
|
12644
|
+
props.inputRef(node);
|
|
12645
|
+
else if (props.inputRef && typeof props.inputRef === "object") {
|
|
12646
|
+
props.inputRef.current = node;
|
|
12647
|
+
}
|
|
12648
|
+
},
|
|
13244
12649
|
...passThroughProps,
|
|
13245
12650
|
id: inputId != null ? inputId : props.id,
|
|
13246
12651
|
style: inputStyle != null ? inputStyle : props.style,
|
|
13247
12652
|
role: "spinbutton",
|
|
13248
12653
|
className: inputClassName || props.className,
|
|
13249
|
-
|
|
13250
|
-
type: (_b = props.type) != null ? _b : "text",
|
|
12654
|
+
type: (_a = props.type) != null ? _a : "text",
|
|
13251
12655
|
inputMode,
|
|
13252
|
-
|
|
13253
|
-
|
|
13254
|
-
|
|
13255
|
-
|
|
13256
|
-
onPointerDown: onInputPointerDown,
|
|
13257
|
-
onBlur: onInputBlur,
|
|
13258
|
-
onFocus: onInputFocus,
|
|
13259
|
-
onPaste,
|
|
12656
|
+
value: display,
|
|
12657
|
+
onFocus,
|
|
12658
|
+
onBlur,
|
|
12659
|
+
onChange: onChangeText,
|
|
13260
12660
|
leadingControl,
|
|
13261
12661
|
trailingControl,
|
|
13262
12662
|
leadingControlClassName,
|
|
@@ -13269,7 +12669,7 @@ var InputNumber = React11.memo(
|
|
|
13269
12669
|
})
|
|
13270
12670
|
);
|
|
13271
12671
|
InputNumber.displayName = "InputNumber";
|
|
13272
|
-
var ShadcnNumberVariant =
|
|
12672
|
+
var ShadcnNumberVariant = React66__default.forwardRef(function ShadcnNumberVariant2(props, forwardedRef) {
|
|
13273
12673
|
const {
|
|
13274
12674
|
showButtons,
|
|
13275
12675
|
buttonLayout = "stacked",
|
|
@@ -13287,7 +12687,7 @@ var ShadcnNumberVariant = React11__default.forwardRef(function ShadcnNumberVaria
|
|
|
13287
12687
|
id,
|
|
13288
12688
|
inputId
|
|
13289
12689
|
} = rest;
|
|
13290
|
-
const handleChange =
|
|
12690
|
+
const handleChange = React66__default.useCallback(
|
|
13291
12691
|
(e4) => {
|
|
13292
12692
|
if (onValueChange) {
|
|
13293
12693
|
onValueChange(e4.value, {
|
|
@@ -13299,7 +12699,7 @@ var ShadcnNumberVariant = React11__default.forwardRef(function ShadcnNumberVaria
|
|
|
13299
12699
|
},
|
|
13300
12700
|
[onValueChange]
|
|
13301
12701
|
);
|
|
13302
|
-
const handleStep =
|
|
12702
|
+
const handleStep = React66__default.useCallback(
|
|
13303
12703
|
(direction, originalEvent) => {
|
|
13304
12704
|
var _a;
|
|
13305
12705
|
if (disabled) return;
|
|
@@ -13810,7 +13210,7 @@ var CountrySelect = ({
|
|
|
13810
13210
|
}) })
|
|
13811
13211
|
] }) });
|
|
13812
13212
|
};
|
|
13813
|
-
var ShadcnPhoneVariant =
|
|
13213
|
+
var ShadcnPhoneVariant = React66.forwardRef(function ShadcnPhoneVariant2(props, ref) {
|
|
13814
13214
|
const {
|
|
13815
13215
|
countries: countriesProp,
|
|
13816
13216
|
defaultCountry,
|
|
@@ -13835,8 +13235,8 @@ var ShadcnPhoneVariant = React11.forwardRef(function ShadcnPhoneVariant2(props,
|
|
|
13835
13235
|
} = props;
|
|
13836
13236
|
let DEFAULT_COUNTRIES2 = getGlobalCountryList();
|
|
13837
13237
|
const defaultCountries = countriesProp && countriesProp.length > 0 ? countriesProp : DEFAULT_COUNTRIES2;
|
|
13838
|
-
const [countries, setLoadedCountries] =
|
|
13839
|
-
|
|
13238
|
+
const [countries, setLoadedCountries] = React66.useState(defaultCountries);
|
|
13239
|
+
React66.useEffect(() => {
|
|
13840
13240
|
if (countriesProp == null ? void 0 : countriesProp.length) return;
|
|
13841
13241
|
const list = getPaletteUtil("countries");
|
|
13842
13242
|
if (list == null ? void 0 : list.length) {
|
|
@@ -13849,7 +13249,7 @@ var ShadcnPhoneVariant = React11.forwardRef(function ShadcnPhoneVariant2(props,
|
|
|
13849
13249
|
});
|
|
13850
13250
|
}
|
|
13851
13251
|
}, []);
|
|
13852
|
-
const [country, setCountry] =
|
|
13252
|
+
const [country, setCountry] = React66.useState(() => {
|
|
13853
13253
|
var _a;
|
|
13854
13254
|
if (defaultCountry) {
|
|
13855
13255
|
const found = countries.find((c2) => c2.code === defaultCountry);
|
|
@@ -13857,7 +13257,7 @@ var ShadcnPhoneVariant = React11.forwardRef(function ShadcnPhoneVariant2(props,
|
|
|
13857
13257
|
}
|
|
13858
13258
|
return (_a = countries[0]) != null ? _a : DEFAULT_COUNTRIES2[0];
|
|
13859
13259
|
});
|
|
13860
|
-
|
|
13260
|
+
React66.useEffect(() => {
|
|
13861
13261
|
setCountry((prev) => {
|
|
13862
13262
|
var _a;
|
|
13863
13263
|
if (defaultCountry) {
|
|
@@ -13868,13 +13268,13 @@ var ShadcnPhoneVariant = React11.forwardRef(function ShadcnPhoneVariant2(props,
|
|
|
13868
13268
|
return (_a = stillThere != null ? stillThere : countries[0]) != null ? _a : prev;
|
|
13869
13269
|
});
|
|
13870
13270
|
}, [countries, defaultCountry]);
|
|
13871
|
-
const [local, setLocal] =
|
|
13271
|
+
const [local, setLocal] = React66.useState(
|
|
13872
13272
|
() => computeDisplayFromValue(value, country, keepCharPositions)
|
|
13873
13273
|
);
|
|
13874
|
-
|
|
13274
|
+
React66.useEffect(() => {
|
|
13875
13275
|
setLocal(computeDisplayFromValue(value, country, keepCharPositions));
|
|
13876
13276
|
}, [value, country, keepCharPositions]);
|
|
13877
|
-
const handleInputChange =
|
|
13277
|
+
const handleInputChange = React66.useCallback(
|
|
13878
13278
|
(event) => {
|
|
13879
13279
|
var _a;
|
|
13880
13280
|
const rawInput = (_a = event.target.value) != null ? _a : "";
|
|
@@ -13900,7 +13300,7 @@ var ShadcnPhoneVariant = React11.forwardRef(function ShadcnPhoneVariant2(props,
|
|
|
13900
13300
|
},
|
|
13901
13301
|
[country, valueMode, keepCharPositions, onValue]
|
|
13902
13302
|
);
|
|
13903
|
-
const handleCountryChange =
|
|
13303
|
+
const handleCountryChange = React66.useCallback(
|
|
13904
13304
|
(nextCode) => {
|
|
13905
13305
|
var _a;
|
|
13906
13306
|
const nextCountry = (_a = countries.find((c2) => c2.code === nextCode)) != null ? _a : countries[0];
|
|
@@ -13987,7 +13387,7 @@ function normalizeColorForPicker(value) {
|
|
|
13987
13387
|
}
|
|
13988
13388
|
return "#000000";
|
|
13989
13389
|
}
|
|
13990
|
-
var ShadcnColorVariant =
|
|
13390
|
+
var ShadcnColorVariant = React66.forwardRef(function ShadcnColorVariant2(props, ref) {
|
|
13991
13391
|
const {
|
|
13992
13392
|
// variant contract
|
|
13993
13393
|
value,
|
|
@@ -14008,22 +13408,22 @@ var ShadcnColorVariant = React11.forwardRef(function ShadcnColorVariant2(props,
|
|
|
14008
13408
|
// everything else → Input (size, density, className, icons, etc.)
|
|
14009
13409
|
...restTextProps
|
|
14010
13410
|
} = props;
|
|
14011
|
-
const [local, setLocal] =
|
|
14012
|
-
const [pickerOpen, setPickerOpen] =
|
|
14013
|
-
|
|
13411
|
+
const [local, setLocal] = React66.useState(value != null ? value : "");
|
|
13412
|
+
const [pickerOpen, setPickerOpen] = React66.useState(false);
|
|
13413
|
+
React66.useEffect(() => {
|
|
14014
13414
|
setLocal(value != null ? value : "");
|
|
14015
13415
|
}, [value]);
|
|
14016
|
-
const pickerRef =
|
|
13416
|
+
const pickerRef = React66.useRef(null);
|
|
14017
13417
|
const effectiveColor = normalizeColorForPicker(local || value);
|
|
14018
13418
|
const showError = Boolean(error);
|
|
14019
|
-
const openSystemPicker =
|
|
13419
|
+
const openSystemPicker = React66.useCallback(() => {
|
|
14020
13420
|
setPickerOpen(true);
|
|
14021
13421
|
window.setTimeout(() => {
|
|
14022
13422
|
var _a;
|
|
14023
13423
|
(_a = pickerRef.current) == null ? void 0 : _a.click();
|
|
14024
13424
|
}, 0);
|
|
14025
13425
|
}, []);
|
|
14026
|
-
const handleTextChange =
|
|
13426
|
+
const handleTextChange = React66.useCallback(
|
|
14027
13427
|
(event) => {
|
|
14028
13428
|
var _a;
|
|
14029
13429
|
const next = (_a = event.target.value) != null ? _a : "";
|
|
@@ -14040,7 +13440,7 @@ var ShadcnColorVariant = React11.forwardRef(function ShadcnColorVariant2(props,
|
|
|
14040
13440
|
},
|
|
14041
13441
|
[onValue]
|
|
14042
13442
|
);
|
|
14043
|
-
const handlePickerChange =
|
|
13443
|
+
const handlePickerChange = React66.useCallback(
|
|
14044
13444
|
(event) => {
|
|
14045
13445
|
var _a;
|
|
14046
13446
|
const next = (_a = event.target.value) != null ? _a : "";
|
|
@@ -14058,7 +13458,7 @@ var ShadcnColorVariant = React11.forwardRef(function ShadcnColorVariant2(props,
|
|
|
14058
13458
|
},
|
|
14059
13459
|
[onValue]
|
|
14060
13460
|
);
|
|
14061
|
-
const handlePickerBlur =
|
|
13461
|
+
const handlePickerBlur = React66.useCallback(() => {
|
|
14062
13462
|
setPickerOpen(false);
|
|
14063
13463
|
}, []);
|
|
14064
13464
|
const leadingControl = showPreview ? /* @__PURE__ */ jsx(
|
|
@@ -14360,7 +13760,7 @@ function meterColor(score) {
|
|
|
14360
13760
|
if (score === 3) return "bg-amber-500";
|
|
14361
13761
|
return "bg-emerald-500";
|
|
14362
13762
|
}
|
|
14363
|
-
var ShadcnPasswordVariant =
|
|
13763
|
+
var ShadcnPasswordVariant = React66.forwardRef(function ShadcnPasswordVariant2(props, ref) {
|
|
14364
13764
|
var _a, _b;
|
|
14365
13765
|
const {
|
|
14366
13766
|
// base variant bits
|
|
@@ -14396,18 +13796,18 @@ var ShadcnPasswordVariant = React11.forwardRef(function ShadcnPasswordVariant2(p
|
|
|
14396
13796
|
// everything else from Shadcn text UI
|
|
14397
13797
|
...restTextProps
|
|
14398
13798
|
} = props;
|
|
14399
|
-
const [revealed, setRevealed] =
|
|
13799
|
+
const [revealed, setRevealed] = React66.useState(
|
|
14400
13800
|
Boolean(defaultRevealed)
|
|
14401
13801
|
);
|
|
14402
|
-
const normalizedStrength =
|
|
13802
|
+
const normalizedStrength = React66.useMemo(
|
|
14403
13803
|
() => normalizeStrengthOptions(strengthMeter),
|
|
14404
13804
|
[strengthMeter]
|
|
14405
13805
|
);
|
|
14406
|
-
const effectiveRuleDefinitions =
|
|
13806
|
+
const effectiveRuleDefinitions = React66.useMemo(
|
|
14407
13807
|
() => getMergedRuleDefinitions(ruleDefinitions),
|
|
14408
13808
|
[ruleDefinitions]
|
|
14409
13809
|
);
|
|
14410
|
-
const meterState =
|
|
13810
|
+
const meterState = React66.useMemo(() => {
|
|
14411
13811
|
if (!normalizedStrength) return null;
|
|
14412
13812
|
const v2 = value != null ? value : "";
|
|
14413
13813
|
return computeMeterState(
|
|
@@ -14417,14 +13817,14 @@ var ShadcnPasswordVariant = React11.forwardRef(function ShadcnPasswordVariant2(p
|
|
|
14417
13817
|
ruleUses
|
|
14418
13818
|
);
|
|
14419
13819
|
}, [normalizedStrength, value, ruleUses, effectiveRuleDefinitions]);
|
|
14420
|
-
const handleToggleReveal =
|
|
13820
|
+
const handleToggleReveal = React66.useCallback(() => {
|
|
14421
13821
|
setRevealed((prev) => {
|
|
14422
13822
|
const next = !prev;
|
|
14423
13823
|
onRevealChange == null ? void 0 : onRevealChange(next);
|
|
14424
13824
|
return next;
|
|
14425
13825
|
});
|
|
14426
13826
|
}, [onRevealChange]);
|
|
14427
|
-
const handleChange =
|
|
13827
|
+
const handleChange = React66.useCallback(
|
|
14428
13828
|
(event) => {
|
|
14429
13829
|
var _a2;
|
|
14430
13830
|
const next = (_a2 = event.target.value) != null ? _a2 : "";
|
|
@@ -17074,38 +16474,38 @@ __export(custom_components_exports, {
|
|
|
17074
16474
|
YearsDropdown: () => YearsDropdown
|
|
17075
16475
|
});
|
|
17076
16476
|
function Button(props) {
|
|
17077
|
-
return
|
|
16477
|
+
return React66__default.createElement("button", { ...props });
|
|
17078
16478
|
}
|
|
17079
16479
|
function CaptionLabel(props) {
|
|
17080
|
-
return
|
|
16480
|
+
return React66__default.createElement("span", { ...props });
|
|
17081
16481
|
}
|
|
17082
16482
|
function Chevron(props) {
|
|
17083
16483
|
const { size = 24, orientation = "left", className } = props;
|
|
17084
16484
|
return (
|
|
17085
16485
|
// biome-ignore lint/a11y/noSvgWithoutTitle: handled by the parent component
|
|
17086
|
-
|
|
16486
|
+
React66__default.createElement(
|
|
17087
16487
|
"svg",
|
|
17088
16488
|
{ className, width: size, height: size, viewBox: "0 0 24 24" },
|
|
17089
|
-
orientation === "up" &&
|
|
17090
|
-
orientation === "down" &&
|
|
17091
|
-
orientation === "left" &&
|
|
17092
|
-
orientation === "right" &&
|
|
16489
|
+
orientation === "up" && React66__default.createElement("polygon", { points: "6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28" }),
|
|
16490
|
+
orientation === "down" && React66__default.createElement("polygon", { points: "6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72" }),
|
|
16491
|
+
orientation === "left" && React66__default.createElement("polygon", { points: "16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20" }),
|
|
16492
|
+
orientation === "right" && React66__default.createElement("polygon", { points: "8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20" })
|
|
17093
16493
|
)
|
|
17094
16494
|
);
|
|
17095
16495
|
}
|
|
17096
16496
|
function Day(props) {
|
|
17097
16497
|
const { day, modifiers, ...tdProps } = props;
|
|
17098
|
-
return
|
|
16498
|
+
return React66__default.createElement("td", { ...tdProps });
|
|
17099
16499
|
}
|
|
17100
16500
|
function DayButton(props) {
|
|
17101
16501
|
const { day, modifiers, ...buttonProps } = props;
|
|
17102
|
-
const ref =
|
|
17103
|
-
|
|
16502
|
+
const ref = React66__default.useRef(null);
|
|
16503
|
+
React66__default.useEffect(() => {
|
|
17104
16504
|
var _a;
|
|
17105
16505
|
if (modifiers.focused)
|
|
17106
16506
|
(_a = ref.current) == null ? void 0 : _a.focus();
|
|
17107
16507
|
}, [modifiers.focused]);
|
|
17108
|
-
return
|
|
16508
|
+
return React66__default.createElement("button", { ref, ...buttonProps });
|
|
17109
16509
|
}
|
|
17110
16510
|
|
|
17111
16511
|
// ../../node_modules/react-day-picker/dist/esm/UI.js
|
|
@@ -17168,37 +16568,37 @@ function Dropdown(props) {
|
|
|
17168
16568
|
const { options, className, components, classNames, ...selectProps } = props;
|
|
17169
16569
|
const cssClassSelect = [classNames[UI.Dropdown], className].join(" ");
|
|
17170
16570
|
const selectedOption = options == null ? void 0 : options.find(({ value }) => value === selectProps.value);
|
|
17171
|
-
return
|
|
16571
|
+
return React66__default.createElement(
|
|
17172
16572
|
"span",
|
|
17173
16573
|
{ "data-disabled": selectProps.disabled, className: classNames[UI.DropdownRoot] },
|
|
17174
|
-
|
|
17175
|
-
|
|
16574
|
+
React66__default.createElement(components.Select, { className: cssClassSelect, ...selectProps }, options == null ? void 0 : options.map(({ value, label, disabled }) => React66__default.createElement(components.Option, { key: value, value, disabled }, label))),
|
|
16575
|
+
React66__default.createElement(
|
|
17176
16576
|
"span",
|
|
17177
16577
|
{ className: classNames[UI.CaptionLabel], "aria-hidden": true },
|
|
17178
16578
|
selectedOption == null ? void 0 : selectedOption.label,
|
|
17179
|
-
|
|
16579
|
+
React66__default.createElement(components.Chevron, { orientation: "down", size: 18, className: classNames[UI.Chevron] })
|
|
17180
16580
|
)
|
|
17181
16581
|
);
|
|
17182
16582
|
}
|
|
17183
16583
|
function DropdownNav(props) {
|
|
17184
|
-
return
|
|
16584
|
+
return React66__default.createElement("div", { ...props });
|
|
17185
16585
|
}
|
|
17186
16586
|
function Footer(props) {
|
|
17187
|
-
return
|
|
16587
|
+
return React66__default.createElement("div", { ...props });
|
|
17188
16588
|
}
|
|
17189
16589
|
function Month(props) {
|
|
17190
16590
|
const { calendarMonth, displayIndex, ...divProps } = props;
|
|
17191
|
-
return
|
|
16591
|
+
return React66__default.createElement("div", { ...divProps }, props.children);
|
|
17192
16592
|
}
|
|
17193
16593
|
function MonthCaption(props) {
|
|
17194
16594
|
const { calendarMonth, displayIndex, ...divProps } = props;
|
|
17195
|
-
return
|
|
16595
|
+
return React66__default.createElement("div", { ...divProps });
|
|
17196
16596
|
}
|
|
17197
16597
|
function MonthGrid(props) {
|
|
17198
|
-
return
|
|
16598
|
+
return React66__default.createElement("table", { ...props });
|
|
17199
16599
|
}
|
|
17200
16600
|
function Months(props) {
|
|
17201
|
-
return
|
|
16601
|
+
return React66__default.createElement("div", { ...props });
|
|
17202
16602
|
}
|
|
17203
16603
|
var dayPickerContext = createContext(void 0);
|
|
17204
16604
|
function useDayPicker() {
|
|
@@ -17212,7 +16612,7 @@ function useDayPicker() {
|
|
|
17212
16612
|
// ../../node_modules/react-day-picker/dist/esm/components/MonthsDropdown.js
|
|
17213
16613
|
function MonthsDropdown(props) {
|
|
17214
16614
|
const { components } = useDayPicker();
|
|
17215
|
-
return
|
|
16615
|
+
return React66__default.createElement(components.Dropdown, { ...props });
|
|
17216
16616
|
}
|
|
17217
16617
|
function Nav(props) {
|
|
17218
16618
|
const { onPreviousClick, onNextClick, previousMonth, nextMonth, ...navProps } = props;
|
|
@@ -17227,66 +16627,66 @@ function Nav(props) {
|
|
|
17227
16627
|
onPreviousClick == null ? void 0 : onPreviousClick(e4);
|
|
17228
16628
|
}
|
|
17229
16629
|
}, [previousMonth, onPreviousClick]);
|
|
17230
|
-
return
|
|
16630
|
+
return React66__default.createElement(
|
|
17231
16631
|
"nav",
|
|
17232
16632
|
{ ...navProps },
|
|
17233
|
-
|
|
16633
|
+
React66__default.createElement(
|
|
17234
16634
|
components.PreviousMonthButton,
|
|
17235
16635
|
{ type: "button", className: classNames[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick },
|
|
17236
|
-
|
|
16636
|
+
React66__default.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], orientation: "left" })
|
|
17237
16637
|
),
|
|
17238
|
-
|
|
16638
|
+
React66__default.createElement(
|
|
17239
16639
|
components.NextMonthButton,
|
|
17240
16640
|
{ type: "button", className: classNames[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick },
|
|
17241
|
-
|
|
16641
|
+
React66__default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, orientation: "right", className: classNames[UI.Chevron] })
|
|
17242
16642
|
)
|
|
17243
16643
|
);
|
|
17244
16644
|
}
|
|
17245
16645
|
function NextMonthButton(props) {
|
|
17246
16646
|
const { components } = useDayPicker();
|
|
17247
|
-
return
|
|
16647
|
+
return React66__default.createElement(components.Button, { ...props });
|
|
17248
16648
|
}
|
|
17249
16649
|
function Option(props) {
|
|
17250
|
-
return
|
|
16650
|
+
return React66__default.createElement("option", { ...props });
|
|
17251
16651
|
}
|
|
17252
16652
|
function PreviousMonthButton(props) {
|
|
17253
16653
|
const { components } = useDayPicker();
|
|
17254
|
-
return
|
|
16654
|
+
return React66__default.createElement(components.Button, { ...props });
|
|
17255
16655
|
}
|
|
17256
16656
|
function Root3(props) {
|
|
17257
16657
|
const { rootRef, ...rest } = props;
|
|
17258
|
-
return
|
|
16658
|
+
return React66__default.createElement("div", { ...rest, ref: rootRef });
|
|
17259
16659
|
}
|
|
17260
16660
|
function Select2(props) {
|
|
17261
|
-
return
|
|
16661
|
+
return React66__default.createElement("select", { ...props });
|
|
17262
16662
|
}
|
|
17263
16663
|
function Week(props) {
|
|
17264
16664
|
const { week, ...trProps } = props;
|
|
17265
|
-
return
|
|
16665
|
+
return React66__default.createElement("tr", { ...trProps });
|
|
17266
16666
|
}
|
|
17267
16667
|
function Weekday(props) {
|
|
17268
|
-
return
|
|
16668
|
+
return React66__default.createElement("th", { ...props });
|
|
17269
16669
|
}
|
|
17270
16670
|
function Weekdays(props) {
|
|
17271
|
-
return
|
|
16671
|
+
return React66__default.createElement(
|
|
17272
16672
|
"thead",
|
|
17273
16673
|
{ "aria-hidden": true },
|
|
17274
|
-
|
|
16674
|
+
React66__default.createElement("tr", { ...props })
|
|
17275
16675
|
);
|
|
17276
16676
|
}
|
|
17277
16677
|
function WeekNumber(props) {
|
|
17278
16678
|
const { week, ...thProps } = props;
|
|
17279
|
-
return
|
|
16679
|
+
return React66__default.createElement("th", { ...thProps });
|
|
17280
16680
|
}
|
|
17281
16681
|
function WeekNumberHeader(props) {
|
|
17282
|
-
return
|
|
16682
|
+
return React66__default.createElement("th", { ...props });
|
|
17283
16683
|
}
|
|
17284
16684
|
function Weeks(props) {
|
|
17285
|
-
return
|
|
16685
|
+
return React66__default.createElement("tbody", { ...props });
|
|
17286
16686
|
}
|
|
17287
16687
|
function YearsDropdown(props) {
|
|
17288
16688
|
const { components } = useDayPicker();
|
|
17289
|
-
return
|
|
16689
|
+
return React66__default.createElement(components.Dropdown, { ...props });
|
|
17290
16690
|
}
|
|
17291
16691
|
|
|
17292
16692
|
// ../../node_modules/react-day-picker/dist/esm/utils/rangeIncludesDate.js
|
|
@@ -18773,18 +18173,18 @@ function DayPicker(initialProps) {
|
|
|
18773
18173
|
labels,
|
|
18774
18174
|
formatters: formatters2
|
|
18775
18175
|
};
|
|
18776
|
-
return
|
|
18176
|
+
return React66__default.createElement(
|
|
18777
18177
|
dayPickerContext.Provider,
|
|
18778
18178
|
{ value: contextValue },
|
|
18779
|
-
|
|
18179
|
+
React66__default.createElement(
|
|
18780
18180
|
components.Root,
|
|
18781
18181
|
{ rootRef: props.animate ? rootElRef : void 0, className, style, dir: props.dir, id: props.id, lang: props.lang, nonce: props.nonce, title: props.title, role: props.role, "aria-label": props["aria-label"], "aria-labelledby": props["aria-labelledby"], ...dataAttributes },
|
|
18782
|
-
|
|
18182
|
+
React66__default.createElement(
|
|
18783
18183
|
components.Months,
|
|
18784
18184
|
{ className: classNames[UI.Months], style: styles == null ? void 0 : styles[UI.Months] },
|
|
18785
|
-
!props.hideNavigation && !navLayout &&
|
|
18185
|
+
!props.hideNavigation && !navLayout && React66__default.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : void 0, className: classNames[UI.Nav], style: styles == null ? void 0 : styles[UI.Nav], "aria-label": labelNav2(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth, nextMonth }),
|
|
18786
18186
|
months.map((calendarMonth, displayIndex) => {
|
|
18787
|
-
return
|
|
18187
|
+
return React66__default.createElement(
|
|
18788
18188
|
components.Month,
|
|
18789
18189
|
{
|
|
18790
18190
|
"data-animated-month": props.animate ? "true" : void 0,
|
|
@@ -18795,21 +18195,21 @@ function DayPicker(initialProps) {
|
|
|
18795
18195
|
displayIndex,
|
|
18796
18196
|
calendarMonth
|
|
18797
18197
|
},
|
|
18798
|
-
navLayout === "around" && !props.hideNavigation && displayIndex === 0 &&
|
|
18198
|
+
navLayout === "around" && !props.hideNavigation && displayIndex === 0 && React66__default.createElement(
|
|
18799
18199
|
components.PreviousMonthButton,
|
|
18800
18200
|
{ type: "button", className: classNames[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick, "data-animated-button": props.animate ? "true" : void 0 },
|
|
18801
|
-
|
|
18201
|
+
React66__default.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], orientation: props.dir === "rtl" ? "right" : "left" })
|
|
18802
18202
|
),
|
|
18803
|
-
|
|
18203
|
+
React66__default.createElement(components.MonthCaption, { "data-animated-caption": props.animate ? "true" : void 0, className: classNames[UI.MonthCaption], style: styles == null ? void 0 : styles[UI.MonthCaption], calendarMonth, displayIndex }, (captionLayout == null ? void 0 : captionLayout.startsWith("dropdown")) ? React66__default.createElement(
|
|
18804
18204
|
components.DropdownNav,
|
|
18805
18205
|
{ className: classNames[UI.Dropdowns], style: styles == null ? void 0 : styles[UI.Dropdowns] },
|
|
18806
18206
|
(() => {
|
|
18807
|
-
const monthControl = captionLayout === "dropdown" || captionLayout === "dropdown-months" ?
|
|
18808
|
-
const yearControl = captionLayout === "dropdown" || captionLayout === "dropdown-years" ?
|
|
18207
|
+
const monthControl = captionLayout === "dropdown" || captionLayout === "dropdown-months" ? React66__default.createElement(components.MonthsDropdown, { key: "month", className: classNames[UI.MonthsDropdown], "aria-label": labelMonthDropdown2(), classNames, components, disabled: Boolean(props.disableNavigation), onChange: handleMonthChange(calendarMonth.date), options: getMonthOptions(calendarMonth.date, navStart, navEnd, formatters2, dateLib), style: styles == null ? void 0 : styles[UI.Dropdown], value: dateLib.getMonth(calendarMonth.date) }) : React66__default.createElement("span", { key: "month" }, formatMonthDropdown2(calendarMonth.date, dateLib));
|
|
18208
|
+
const yearControl = captionLayout === "dropdown" || captionLayout === "dropdown-years" ? React66__default.createElement(components.YearsDropdown, { key: "year", className: classNames[UI.YearsDropdown], "aria-label": labelYearDropdown2(dateLib.options), classNames, components, disabled: Boolean(props.disableNavigation), onChange: handleYearChange(calendarMonth.date), options: getYearOptions(navStart, navEnd, formatters2, dateLib, Boolean(props.reverseYears)), style: styles == null ? void 0 : styles[UI.Dropdown], value: dateLib.getYear(calendarMonth.date) }) : React66__default.createElement("span", { key: "year" }, formatYearDropdown2(calendarMonth.date, dateLib));
|
|
18809
18209
|
const controls = dateLib.getMonthYearOrder() === "year-first" ? [yearControl, monthControl] : [monthControl, yearControl];
|
|
18810
18210
|
return controls;
|
|
18811
18211
|
})(),
|
|
18812
|
-
|
|
18212
|
+
React66__default.createElement("span", { role: "status", "aria-live": "polite", style: {
|
|
18813
18213
|
border: 0,
|
|
18814
18214
|
clip: "rect(0 0 0 0)",
|
|
18815
18215
|
height: "1px",
|
|
@@ -18821,27 +18221,27 @@ function DayPicker(initialProps) {
|
|
|
18821
18221
|
whiteSpace: "nowrap",
|
|
18822
18222
|
wordWrap: "normal"
|
|
18823
18223
|
} }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))
|
|
18824
|
-
) :
|
|
18825
|
-
navLayout === "around" && !props.hideNavigation && displayIndex === numberOfMonths - 1 &&
|
|
18224
|
+
) : React66__default.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))),
|
|
18225
|
+
navLayout === "around" && !props.hideNavigation && displayIndex === numberOfMonths - 1 && React66__default.createElement(
|
|
18826
18226
|
components.NextMonthButton,
|
|
18827
18227
|
{ type: "button", className: classNames[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick, "data-animated-button": props.animate ? "true" : void 0 },
|
|
18828
|
-
|
|
18228
|
+
React66__default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, className: classNames[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" })
|
|
18829
18229
|
),
|
|
18830
|
-
displayIndex === numberOfMonths - 1 && navLayout === "after" && !props.hideNavigation &&
|
|
18831
|
-
|
|
18230
|
+
displayIndex === numberOfMonths - 1 && navLayout === "after" && !props.hideNavigation && React66__default.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : void 0, className: classNames[UI.Nav], style: styles == null ? void 0 : styles[UI.Nav], "aria-label": labelNav2(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth, nextMonth }),
|
|
18231
|
+
React66__default.createElement(
|
|
18832
18232
|
components.MonthGrid,
|
|
18833
18233
|
{ role: "grid", "aria-multiselectable": mode === "multiple" || mode === "range", "aria-label": labelGrid2(calendarMonth.date, dateLib.options, dateLib) || void 0, className: classNames[UI.MonthGrid], style: styles == null ? void 0 : styles[UI.MonthGrid] },
|
|
18834
|
-
!props.hideWeekdays &&
|
|
18234
|
+
!props.hideWeekdays && React66__default.createElement(
|
|
18835
18235
|
components.Weekdays,
|
|
18836
18236
|
{ "data-animated-weekdays": props.animate ? "true" : void 0, className: classNames[UI.Weekdays], style: styles == null ? void 0 : styles[UI.Weekdays] },
|
|
18837
|
-
showWeekNumber &&
|
|
18838
|
-
weekdays.map((weekday) =>
|
|
18237
|
+
showWeekNumber && React66__default.createElement(components.WeekNumberHeader, { "aria-label": labelWeekNumberHeader2(dateLib.options), className: classNames[UI.WeekNumberHeader], style: styles == null ? void 0 : styles[UI.WeekNumberHeader], scope: "col" }, formatWeekNumberHeader2()),
|
|
18238
|
+
weekdays.map((weekday) => React66__default.createElement(components.Weekday, { "aria-label": labelWeekday2(weekday, dateLib.options, dateLib), className: classNames[UI.Weekday], key: String(weekday), style: styles == null ? void 0 : styles[UI.Weekday], scope: "col" }, formatWeekdayName2(weekday, dateLib.options, dateLib)))
|
|
18839
18239
|
),
|
|
18840
|
-
|
|
18841
|
-
return
|
|
18240
|
+
React66__default.createElement(components.Weeks, { "data-animated-weeks": props.animate ? "true" : void 0, className: classNames[UI.Weeks], style: styles == null ? void 0 : styles[UI.Weeks] }, calendarMonth.weeks.map((week) => {
|
|
18241
|
+
return React66__default.createElement(
|
|
18842
18242
|
components.Week,
|
|
18843
18243
|
{ className: classNames[UI.Week], key: week.weekNumber, style: styles == null ? void 0 : styles[UI.Week], week },
|
|
18844
|
-
showWeekNumber &&
|
|
18244
|
+
showWeekNumber && React66__default.createElement(components.WeekNumber, { week, style: styles == null ? void 0 : styles[UI.WeekNumber], "aria-label": labelWeekNumber2(week.weekNumber, {
|
|
18845
18245
|
locale
|
|
18846
18246
|
}), className: classNames[UI.WeekNumber], scope: "row", role: "rowheader" }, formatWeekNumber2(week.weekNumber, dateLib)),
|
|
18847
18247
|
week.days.map((day) => {
|
|
@@ -18858,7 +18258,7 @@ function DayPicker(initialProps) {
|
|
|
18858
18258
|
const style2 = getStyleForModifiers(modifiers, styles, props.modifiersStyles);
|
|
18859
18259
|
const className2 = getClassNamesForModifiers(modifiers, classNames, props.modifiersClassNames);
|
|
18860
18260
|
const ariaLabel = !isInteractive && !modifiers.hidden ? labelGridcell2(date, modifiers, dateLib.options, dateLib) : void 0;
|
|
18861
|
-
return
|
|
18261
|
+
return React66__default.createElement(components.Day, { key: `${day.isoDate}_${day.displayMonthId}`, day, modifiers, className: className2.join(" "), style: style2, role: "gridcell", "aria-selected": modifiers.selected || void 0, "aria-label": ariaLabel, "data-day": day.isoDate, "data-month": day.outside ? day.dateMonthId : void 0, "data-selected": modifiers.selected || void 0, "data-disabled": modifiers.disabled || void 0, "data-hidden": modifiers.hidden || void 0, "data-outside": day.outside || void 0, "data-focused": modifiers.focused || void 0, "data-today": modifiers.today || void 0 }, !modifiers.hidden && isInteractive ? React66__default.createElement(components.DayButton, { className: classNames[UI.DayButton], style: styles == null ? void 0 : styles[UI.DayButton], type: "button", day, modifiers, disabled: !modifiers.focused && modifiers.disabled || void 0, "aria-disabled": modifiers.focused && modifiers.disabled || void 0, tabIndex: isFocusTarget(day) ? 0 : -1, "aria-label": labelDayButton2(date, modifiers, dateLib.options, dateLib), onClick: handleDayClick(day, modifiers), onBlur: handleDayBlur(day, modifiers), onFocus: handleDayFocus(day, modifiers), onKeyDown: handleDayKeyDown(day, modifiers), onMouseEnter: handleDayMouseEnter(day, modifiers), onMouseLeave: handleDayMouseLeave(day, modifiers) }, formatDay2(date, dateLib.options, dateLib)) : !modifiers.hidden && formatDay2(day.date, dateLib.options, dateLib));
|
|
18862
18262
|
})
|
|
18863
18263
|
);
|
|
18864
18264
|
}))
|
|
@@ -18866,7 +18266,7 @@ function DayPicker(initialProps) {
|
|
|
18866
18266
|
);
|
|
18867
18267
|
})
|
|
18868
18268
|
),
|
|
18869
|
-
props.footer &&
|
|
18269
|
+
props.footer && React66__default.createElement(components.Footer, { className: classNames[UI.Footer], style: styles == null ? void 0 : styles[UI.Footer], role: "status", "aria-live": "polite" }, props.footer)
|
|
18870
18270
|
)
|
|
18871
18271
|
);
|
|
18872
18272
|
}
|
|
@@ -19109,8 +18509,8 @@ function CalendarDayButton({
|
|
|
19109
18509
|
...props
|
|
19110
18510
|
}) {
|
|
19111
18511
|
const defaultClassNames = getDefaultClassNames();
|
|
19112
|
-
const ref =
|
|
19113
|
-
|
|
18512
|
+
const ref = React66.useRef(null);
|
|
18513
|
+
React66.useEffect(() => {
|
|
19114
18514
|
var _a;
|
|
19115
18515
|
if (modifiers.focused) (_a = ref.current) == null ? void 0 : _a.focus();
|
|
19116
18516
|
}, [modifiers.focused]);
|
|
@@ -19187,15 +18587,15 @@ var TimeDropdowns = (props) => {
|
|
|
19187
18587
|
triggerClassName,
|
|
19188
18588
|
density = "normal"
|
|
19189
18589
|
} = props;
|
|
19190
|
-
const minuteOptions =
|
|
18590
|
+
const minuteOptions = React66.useMemo(
|
|
19191
18591
|
() => buildMinuteOptions(minuteStep),
|
|
19192
18592
|
[minuteStep]
|
|
19193
18593
|
);
|
|
19194
|
-
const secondOptions =
|
|
18594
|
+
const secondOptions = React66.useMemo(
|
|
19195
18595
|
() => buildSecondOptions(secondStep),
|
|
19196
18596
|
[secondStep]
|
|
19197
18597
|
);
|
|
19198
|
-
const hourOptions =
|
|
18598
|
+
const hourOptions = React66.useMemo(
|
|
19199
18599
|
() => use12Hour ? buildHourOptions12() : buildHourOptions24(),
|
|
19200
18600
|
[use12Hour]
|
|
19201
18601
|
);
|
|
@@ -19534,7 +18934,7 @@ function parseRawToDate(rawDigits, kind) {
|
|
|
19534
18934
|
function meterSafeDigits(masked) {
|
|
19535
18935
|
return masked.replace(/\D+/g, "");
|
|
19536
18936
|
}
|
|
19537
|
-
var ShadcnDateVariant =
|
|
18937
|
+
var ShadcnDateVariant = React66.forwardRef(function ShadcnDateVariant2(props, ref) {
|
|
19538
18938
|
const {
|
|
19539
18939
|
// variant base bits
|
|
19540
18940
|
value,
|
|
@@ -19567,10 +18967,10 @@ var ShadcnDateVariant = React11.forwardRef(function ShadcnDateVariant2(props, re
|
|
|
19567
18967
|
const resolvedMask = inputMask != null ? inputMask : kindConfig.mask;
|
|
19568
18968
|
const defaultShowCalendar = kind === "date" || kind === "datetime";
|
|
19569
18969
|
const showCalendar = typeof showCalendarProp === "boolean" ? showCalendarProp : defaultShowCalendar;
|
|
19570
|
-
const [internalOpen, setInternalOpen] =
|
|
18970
|
+
const [internalOpen, setInternalOpen] = React66.useState(false);
|
|
19571
18971
|
const isControlledOpen = open !== void 0;
|
|
19572
18972
|
const currentOpen = isControlledOpen ? !!open : internalOpen;
|
|
19573
|
-
const handleOpenChange =
|
|
18973
|
+
const handleOpenChange = React66.useCallback(
|
|
19574
18974
|
(next) => {
|
|
19575
18975
|
if (!isControlledOpen) {
|
|
19576
18976
|
setInternalOpen(next);
|
|
@@ -19580,7 +18980,7 @@ var ShadcnDateVariant = React11.forwardRef(function ShadcnDateVariant2(props, re
|
|
|
19580
18980
|
[isControlledOpen, onOpenChange]
|
|
19581
18981
|
);
|
|
19582
18982
|
const { single, range } = normalizeValueForMode(value, mode);
|
|
19583
|
-
const displayValue =
|
|
18983
|
+
const displayValue = React66.useMemo(() => {
|
|
19584
18984
|
if (mode === "single") {
|
|
19585
18985
|
return formatDisplaySingle(single, singlePattern);
|
|
19586
18986
|
}
|
|
@@ -19591,12 +18991,12 @@ var ShadcnDateVariant = React11.forwardRef(function ShadcnDateVariant2(props, re
|
|
|
19591
18991
|
rangeSeparator
|
|
19592
18992
|
);
|
|
19593
18993
|
}, [mode, single, range, singlePattern, formatRange, rangeSeparator]);
|
|
19594
|
-
const [localText, setLocalText] =
|
|
19595
|
-
|
|
18994
|
+
const [localText, setLocalText] = React66.useState(displayValue);
|
|
18995
|
+
React66.useEffect(() => {
|
|
19596
18996
|
setLocalText(displayValue);
|
|
19597
18997
|
}, [displayValue]);
|
|
19598
18998
|
const showTimeDropdowns = mode === "single" && (kind === "datetime" || kind === "time" || kind === "hour");
|
|
19599
|
-
const handleSelect =
|
|
18999
|
+
const handleSelect = React66.useCallback(
|
|
19600
19000
|
(next) => {
|
|
19601
19001
|
let nextValue;
|
|
19602
19002
|
let nextRange;
|
|
@@ -19646,7 +19046,7 @@ var ShadcnDateVariant = React11.forwardRef(function ShadcnDateVariant2(props, re
|
|
|
19646
19046
|
},
|
|
19647
19047
|
[mode, stayOpenOnSelect, onValue, handleOpenChange, kind, single]
|
|
19648
19048
|
);
|
|
19649
|
-
const handleTimeChange =
|
|
19049
|
+
const handleTimeChange = React66.useCallback(
|
|
19650
19050
|
(next) => {
|
|
19651
19051
|
if (!next) {
|
|
19652
19052
|
const detail2 = {
|
|
@@ -19677,7 +19077,7 @@ var ShadcnDateVariant = React11.forwardRef(function ShadcnDateVariant2(props, re
|
|
|
19677
19077
|
},
|
|
19678
19078
|
[mode, kind, onValue]
|
|
19679
19079
|
);
|
|
19680
|
-
const handleClear =
|
|
19080
|
+
const handleClear = React66.useCallback(
|
|
19681
19081
|
(ev) => {
|
|
19682
19082
|
ev.preventDefault();
|
|
19683
19083
|
ev.stopPropagation();
|
|
@@ -19696,7 +19096,7 @@ var ShadcnDateVariant = React11.forwardRef(function ShadcnDateVariant2(props, re
|
|
|
19696
19096
|
);
|
|
19697
19097
|
const hasValue = hasSelection(value);
|
|
19698
19098
|
const placeholderText = typeof placeholder === "string" ? placeholder : mode === "range" ? "Select date range" : "Select date";
|
|
19699
|
-
const handleInputChange =
|
|
19099
|
+
const handleInputChange = React66.useCallback(
|
|
19700
19100
|
(event) => {
|
|
19701
19101
|
var _a, _b, _c;
|
|
19702
19102
|
if (mode !== "single") return;
|
|
@@ -19883,7 +19283,7 @@ function resolveBasePadding2(size, density) {
|
|
|
19883
19283
|
}
|
|
19884
19284
|
return { px, py };
|
|
19885
19285
|
}
|
|
19886
|
-
var Textarea =
|
|
19286
|
+
var Textarea = React66.forwardRef(
|
|
19887
19287
|
function Textarea2(rawProps, forwardedRef) {
|
|
19888
19288
|
const {
|
|
19889
19289
|
// layout wrapper
|
|
@@ -19931,8 +19331,8 @@ var Textarea = React11.forwardRef(
|
|
|
19931
19331
|
} = rawProps;
|
|
19932
19332
|
const sizeKey = size != null ? size : "md";
|
|
19933
19333
|
const densityKey = density != null ? density : "normal";
|
|
19934
|
-
const innerRef =
|
|
19935
|
-
|
|
19334
|
+
const innerRef = React66.useRef(null);
|
|
19335
|
+
React66.useImperativeHandle(
|
|
19936
19336
|
forwardedRef,
|
|
19937
19337
|
() => innerRef.current,
|
|
19938
19338
|
[]
|
|
@@ -19953,11 +19353,11 @@ var Textarea = React11.forwardRef(
|
|
|
19953
19353
|
const baseIconGap = iconGap != null ? iconGap : 1;
|
|
19954
19354
|
const leadingGap = leadingIconSpacing != null ? leadingIconSpacing : baseIconGap;
|
|
19955
19355
|
const trailingGap = trailingIconSpacing != null ? trailingIconSpacing : baseIconGap;
|
|
19956
|
-
const leadingIconsRef =
|
|
19957
|
-
const trailingIconsRef =
|
|
19958
|
-
const [leadingIconsWidth, setLeadingIconsWidth] =
|
|
19959
|
-
const [trailingIconsWidth, setTrailingIconsWidth] =
|
|
19960
|
-
const measureIconWidths =
|
|
19356
|
+
const leadingIconsRef = React66.useRef(null);
|
|
19357
|
+
const trailingIconsRef = React66.useRef(null);
|
|
19358
|
+
const [leadingIconsWidth, setLeadingIconsWidth] = React66.useState(0);
|
|
19359
|
+
const [trailingIconsWidth, setTrailingIconsWidth] = React66.useState(0);
|
|
19360
|
+
const measureIconWidths = React66.useCallback(() => {
|
|
19961
19361
|
if (typeof window === "undefined") return;
|
|
19962
19362
|
const lead = leadingIconsRef.current;
|
|
19963
19363
|
const trail = trailingIconsRef.current;
|
|
@@ -19974,7 +19374,7 @@ var Textarea = React11.forwardRef(
|
|
|
19974
19374
|
setTrailingIconsWidth(0);
|
|
19975
19375
|
}
|
|
19976
19376
|
}, []);
|
|
19977
|
-
|
|
19377
|
+
React66.useLayoutEffect(() => {
|
|
19978
19378
|
if (typeof window === "undefined" || typeof MutationObserver === "undefined") {
|
|
19979
19379
|
measureIconWidths();
|
|
19980
19380
|
return;
|
|
@@ -20003,10 +19403,10 @@ var Textarea = React11.forwardRef(
|
|
|
20003
19403
|
measureIconWidths();
|
|
20004
19404
|
return () => observers.forEach((o3) => o3.disconnect());
|
|
20005
19405
|
}, [measureIconWidths, hasLeadingIcons, hasTrailingIcons]);
|
|
20006
|
-
const [rowHeight, setRowHeight] =
|
|
19406
|
+
const [rowHeight, setRowHeight] = React66.useState(null);
|
|
20007
19407
|
const baseMinRows = Math.max(minRowsProp != null ? minRowsProp : 1, 1);
|
|
20008
|
-
const [rows, setRows] =
|
|
20009
|
-
|
|
19408
|
+
const [rows, setRows] = React66.useState(baseMinRows);
|
|
19409
|
+
React66.useLayoutEffect(() => {
|
|
20010
19410
|
if (typeof window === "undefined") return;
|
|
20011
19411
|
const el = innerRef.current;
|
|
20012
19412
|
if (!el) return;
|
|
@@ -20022,7 +19422,7 @@ var Textarea = React11.forwardRef(
|
|
|
20022
19422
|
setRows(baseMinRows);
|
|
20023
19423
|
}
|
|
20024
19424
|
}, [sizeKey, densityKey, baseMinRows]);
|
|
20025
|
-
const recomputeHeight =
|
|
19425
|
+
const recomputeHeight = React66.useCallback(() => {
|
|
20026
19426
|
if (!autoResize) return;
|
|
20027
19427
|
if (!innerRef.current) return;
|
|
20028
19428
|
if (!rowHeight) return;
|
|
@@ -20044,7 +19444,7 @@ var Textarea = React11.forwardRef(
|
|
|
20044
19444
|
el.style.height = `${nextHeight}px`;
|
|
20045
19445
|
setRows(nextRows);
|
|
20046
19446
|
}, [autoResize, rowHeight, baseMinRows, maxRows]);
|
|
20047
|
-
|
|
19447
|
+
React66.useLayoutEffect(() => {
|
|
20048
19448
|
recomputeHeight();
|
|
20049
19449
|
}, [recomputeHeight, rest.value, rest.defaultValue]);
|
|
20050
19450
|
const { px: pxDefault, py: pyDefault } = resolveBasePadding2(size, density);
|
|
@@ -20114,19 +19514,19 @@ var Textarea = React11.forwardRef(
|
|
|
20114
19514
|
const focusTextarea = () => {
|
|
20115
19515
|
if (innerRef.current) innerRef.current.focus();
|
|
20116
19516
|
};
|
|
20117
|
-
const handleFocus =
|
|
19517
|
+
const handleFocus = React66.useCallback(
|
|
20118
19518
|
(event) => {
|
|
20119
19519
|
onFocus == null ? void 0 : onFocus(event);
|
|
20120
19520
|
},
|
|
20121
19521
|
[onFocus]
|
|
20122
19522
|
);
|
|
20123
|
-
const handleBlur =
|
|
19523
|
+
const handleBlur = React66.useCallback(
|
|
20124
19524
|
(event) => {
|
|
20125
19525
|
onBlur == null ? void 0 : onBlur(event);
|
|
20126
19526
|
},
|
|
20127
19527
|
[onBlur]
|
|
20128
19528
|
);
|
|
20129
|
-
const handleChange =
|
|
19529
|
+
const handleChange = React66.useCallback(
|
|
20130
19530
|
(event) => {
|
|
20131
19531
|
onChange == null ? void 0 : onChange(event);
|
|
20132
19532
|
recomputeHeight();
|
|
@@ -20303,7 +19703,7 @@ function splitIntoTokens(raw, sep) {
|
|
|
20303
19703
|
}
|
|
20304
19704
|
return acc.map((t4) => t4.trim()).filter((t4) => t4.length > 0);
|
|
20305
19705
|
}
|
|
20306
|
-
var ShadcnChipsVariant =
|
|
19706
|
+
var ShadcnChipsVariant = React66.forwardRef(function ShadcnChipsVariant2(props, ref) {
|
|
20307
19707
|
var _a;
|
|
20308
19708
|
const {
|
|
20309
19709
|
// variant base bits
|
|
@@ -20339,10 +19739,10 @@ var ShadcnChipsVariant = React11.forwardRef(function ShadcnChipsVariant2(props,
|
|
|
20339
19739
|
// rest of text UI bits (size, density, icons, etc.)
|
|
20340
19740
|
...restTextProps
|
|
20341
19741
|
} = props;
|
|
20342
|
-
const chips =
|
|
19742
|
+
const chips = React66.useMemo(() => value != null ? value : [], [value]);
|
|
20343
19743
|
const hasChips = chips.length > 0;
|
|
20344
|
-
const [inputText, setInputText] =
|
|
20345
|
-
const emitChange =
|
|
19744
|
+
const [inputText, setInputText] = React66.useState("");
|
|
19745
|
+
const emitChange = React66.useCallback(
|
|
20346
19746
|
(nextChips, meta) => {
|
|
20347
19747
|
const detail = {
|
|
20348
19748
|
source: "variant",
|
|
@@ -20357,7 +19757,7 @@ var ShadcnChipsVariant = React11.forwardRef(function ShadcnChipsVariant2(props,
|
|
|
20357
19757
|
},
|
|
20358
19758
|
[onValue]
|
|
20359
19759
|
);
|
|
20360
|
-
const commitFromRaw =
|
|
19760
|
+
const commitFromRaw = React66.useCallback(
|
|
20361
19761
|
(raw) => {
|
|
20362
19762
|
const tokens = splitIntoTokens(raw, separators);
|
|
20363
19763
|
if (!tokens.length) return;
|
|
@@ -20378,7 +19778,7 @@ var ShadcnChipsVariant = React11.forwardRef(function ShadcnChipsVariant2(props,
|
|
|
20378
19778
|
},
|
|
20379
19779
|
[chips, separators, allowDuplicates, maxChips, emitChange, onAddChips]
|
|
20380
19780
|
);
|
|
20381
|
-
const handleRemoveAt =
|
|
19781
|
+
const handleRemoveAt = React66.useCallback(
|
|
20382
19782
|
(index) => {
|
|
20383
19783
|
if (index < 0 || index >= chips.length) return;
|
|
20384
19784
|
const removed = [chips[index]];
|
|
@@ -20388,7 +19788,7 @@ var ShadcnChipsVariant = React11.forwardRef(function ShadcnChipsVariant2(props,
|
|
|
20388
19788
|
},
|
|
20389
19789
|
[chips, emitChange, onRemoveChips]
|
|
20390
19790
|
);
|
|
20391
|
-
const handleClear =
|
|
19791
|
+
const handleClear = React66.useCallback(
|
|
20392
19792
|
(ev) => {
|
|
20393
19793
|
ev == null ? void 0 : ev.preventDefault();
|
|
20394
19794
|
ev == null ? void 0 : ev.stopPropagation();
|
|
@@ -20399,7 +19799,7 @@ var ShadcnChipsVariant = React11.forwardRef(function ShadcnChipsVariant2(props,
|
|
|
20399
19799
|
},
|
|
20400
19800
|
[chips, emitChange, onRemoveChips]
|
|
20401
19801
|
);
|
|
20402
|
-
const handleEntryChange =
|
|
19802
|
+
const handleEntryChange = React66.useCallback(
|
|
20403
19803
|
(event) => {
|
|
20404
19804
|
var _a2;
|
|
20405
19805
|
const next = (_a2 = event.target.value) != null ? _a2 : "";
|
|
@@ -20407,7 +19807,7 @@ var ShadcnChipsVariant = React11.forwardRef(function ShadcnChipsVariant2(props,
|
|
|
20407
19807
|
},
|
|
20408
19808
|
[]
|
|
20409
19809
|
);
|
|
20410
|
-
const handleEntryKeyDown =
|
|
19810
|
+
const handleEntryKeyDown = React66.useCallback(
|
|
20411
19811
|
(event) => {
|
|
20412
19812
|
const key = event.key;
|
|
20413
19813
|
if (key === "Enter" && addOnEnter) {
|
|
@@ -20438,7 +19838,7 @@ var ShadcnChipsVariant = React11.forwardRef(function ShadcnChipsVariant2(props,
|
|
|
20438
19838
|
handleRemoveAt
|
|
20439
19839
|
]
|
|
20440
19840
|
);
|
|
20441
|
-
const handleEntryBlur =
|
|
19841
|
+
const handleEntryBlur = React66.useCallback(
|
|
20442
19842
|
(event) => {
|
|
20443
19843
|
if (addOnBlur && inputText.trim().length) {
|
|
20444
19844
|
commitFromRaw(inputText);
|
|
@@ -20463,7 +19863,7 @@ var ShadcnChipsVariant = React11.forwardRef(function ShadcnChipsVariant2(props,
|
|
|
20463
19863
|
const baseRemoveClasses = textareaMode ? "cursor-pointer text-[16px] opacity-70 hover:opacity-100 mt-0.5" : "cursor-pointer text-[16px] opacity-70 hover:opacity-100";
|
|
20464
19864
|
const chipNodes = visibleChips.map((chip, index) => {
|
|
20465
19865
|
if (renderChip) {
|
|
20466
|
-
return /* @__PURE__ */ jsx(
|
|
19866
|
+
return /* @__PURE__ */ jsx(React66.Fragment, { children: renderChip(chip, index, {
|
|
20467
19867
|
remove: () => handleRemoveAt(index),
|
|
20468
19868
|
chips
|
|
20469
19869
|
}) }, `${chip}-${index}`);
|
|
@@ -20530,7 +19930,7 @@ var ShadcnChipsVariant = React11.forwardRef(function ShadcnChipsVariant2(props,
|
|
|
20530
19930
|
);
|
|
20531
19931
|
const node = (_a = renderOverflowChip == null ? void 0 : renderOverflowChip(hiddenCount, chips)) != null ? _a : defaultOverflow;
|
|
20532
19932
|
chipNodes.push(
|
|
20533
|
-
/* @__PURE__ */ jsx(
|
|
19933
|
+
/* @__PURE__ */ jsx(React66.Fragment, { children: node }, "__overflow")
|
|
20534
19934
|
);
|
|
20535
19935
|
}
|
|
20536
19936
|
const effectivePlacement = textareaMode ? placement != null ? placement : "inline" : placement != null ? placement : "inline";
|
|
@@ -20724,7 +20124,7 @@ var chipVariant = {
|
|
|
20724
20124
|
tags: ["chips", "multi-select", "tags"]
|
|
20725
20125
|
}
|
|
20726
20126
|
};
|
|
20727
|
-
var ShadcnTextareaVariant =
|
|
20127
|
+
var ShadcnTextareaVariant = React66.forwardRef(function ShadcnTextareaVariant2(props, ref) {
|
|
20728
20128
|
const {
|
|
20729
20129
|
value,
|
|
20730
20130
|
onValue,
|
|
@@ -20732,7 +20132,7 @@ var ShadcnTextareaVariant = React11.forwardRef(function ShadcnTextareaVariant2(p
|
|
|
20732
20132
|
// everything else goes straight to the UI Textarea
|
|
20733
20133
|
...rest
|
|
20734
20134
|
} = props;
|
|
20735
|
-
const handleChange =
|
|
20135
|
+
const handleChange = React66.useCallback(
|
|
20736
20136
|
(event) => {
|
|
20737
20137
|
var _a;
|
|
20738
20138
|
const next = (_a = event.target.value) != null ? _a : "";
|
|
@@ -20827,7 +20227,7 @@ function switchThumbSize(size) {
|
|
|
20827
20227
|
if (size === "lg") return "size-5";
|
|
20828
20228
|
return "size-4";
|
|
20829
20229
|
}
|
|
20830
|
-
var ShadcnToggleVariant =
|
|
20230
|
+
var ShadcnToggleVariant = React66.forwardRef(function ShadcnToggleVariant2(props, _ref) {
|
|
20831
20231
|
const {
|
|
20832
20232
|
// variant bits
|
|
20833
20233
|
value,
|
|
@@ -20849,7 +20249,7 @@ var ShadcnToggleVariant = React11.forwardRef(function ShadcnToggleVariant2(props
|
|
|
20849
20249
|
...restSwitchProps
|
|
20850
20250
|
} = props;
|
|
20851
20251
|
const checked = !!value;
|
|
20852
|
-
const handleToggle =
|
|
20252
|
+
const handleToggle = React66.useCallback(
|
|
20853
20253
|
(next) => {
|
|
20854
20254
|
const nextVal = Boolean(next);
|
|
20855
20255
|
const detail = {
|
|
@@ -21290,7 +20690,7 @@ var InnerShadcnRadioVariant = (props, ref) => {
|
|
|
21290
20690
|
...restGroupProps
|
|
21291
20691
|
} = props;
|
|
21292
20692
|
const hasError = !!error;
|
|
21293
|
-
const normalized =
|
|
20693
|
+
const normalized = React66.useMemo(
|
|
21294
20694
|
() => normalizeItems(
|
|
21295
20695
|
items != null ? items : options,
|
|
21296
20696
|
mappers,
|
|
@@ -21300,14 +20700,14 @@ var InnerShadcnRadioVariant = (props, ref) => {
|
|
|
21300
20700
|
),
|
|
21301
20701
|
[items, options, mappers, optionValue, optionLabel]
|
|
21302
20702
|
);
|
|
21303
|
-
const selectedString =
|
|
20703
|
+
const selectedString = React66.useMemo(() => {
|
|
21304
20704
|
if (value === void 0) return void 0;
|
|
21305
20705
|
const found = normalized.find(
|
|
21306
20706
|
(item) => isEqualValue(item.value, value)
|
|
21307
20707
|
);
|
|
21308
20708
|
return found ? String(found.value) : void 0;
|
|
21309
20709
|
}, [normalized, value]);
|
|
21310
|
-
const handleSelect =
|
|
20710
|
+
const handleSelect = React66.useCallback(
|
|
21311
20711
|
(next) => {
|
|
21312
20712
|
if (!onValue || disabled) return;
|
|
21313
20713
|
const detail = {
|
|
@@ -21320,7 +20720,7 @@ var InnerShadcnRadioVariant = (props, ref) => {
|
|
|
21320
20720
|
},
|
|
21321
20721
|
[onValue, disabled]
|
|
21322
20722
|
);
|
|
21323
|
-
const handleRadioChange =
|
|
20723
|
+
const handleRadioChange = React66.useCallback(
|
|
21324
20724
|
(raw) => {
|
|
21325
20725
|
const found = normalized.find((item) => String(item.value) === raw);
|
|
21326
20726
|
if (!found) return;
|
|
@@ -21443,7 +20843,7 @@ var InnerShadcnRadioVariant = (props, ref) => {
|
|
|
21443
20843
|
}
|
|
21444
20844
|
);
|
|
21445
20845
|
};
|
|
21446
|
-
var ShadcnRadioVariant =
|
|
20846
|
+
var ShadcnRadioVariant = React66.forwardRef(
|
|
21447
20847
|
InnerShadcnRadioVariant
|
|
21448
20848
|
);
|
|
21449
20849
|
|
|
@@ -21738,7 +21138,7 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
21738
21138
|
);
|
|
21739
21139
|
}
|
|
21740
21140
|
const groupValue = asGroupValue(value);
|
|
21741
|
-
const normalized =
|
|
21141
|
+
const normalized = React66.useMemo(
|
|
21742
21142
|
() => normalizeItems2(
|
|
21743
21143
|
items != null ? items : options,
|
|
21744
21144
|
mappers,
|
|
@@ -21766,14 +21166,14 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
21766
21166
|
labelTextSizeClass: labelTextSize2(size),
|
|
21767
21167
|
descriptionTextSizeClass: descriptionTextSize2(size)
|
|
21768
21168
|
});
|
|
21769
|
-
const findEntryIndex =
|
|
21169
|
+
const findEntryIndex = React66.useCallback(
|
|
21770
21170
|
(val) => {
|
|
21771
21171
|
if (!groupValue) return -1;
|
|
21772
21172
|
return groupValue.findIndex((e4) => isEqualValue2(e4.value, val));
|
|
21773
21173
|
},
|
|
21774
21174
|
[groupValue]
|
|
21775
21175
|
);
|
|
21776
|
-
const getEntryState =
|
|
21176
|
+
const getEntryState = React66.useCallback(
|
|
21777
21177
|
(val) => {
|
|
21778
21178
|
const idx = findEntryIndex(val);
|
|
21779
21179
|
if (!groupValue || idx === -1) return "none";
|
|
@@ -21781,7 +21181,7 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
21781
21181
|
},
|
|
21782
21182
|
[groupValue, findEntryIndex]
|
|
21783
21183
|
);
|
|
21784
|
-
const updateGroupValue =
|
|
21184
|
+
const updateGroupValue = React66.useCallback(
|
|
21785
21185
|
(itemValue, nextInternal, effectiveTristate) => {
|
|
21786
21186
|
if (!onValue || disabled) return;
|
|
21787
21187
|
const currentList = groupValue ? [...groupValue] : [];
|
|
@@ -21975,7 +21375,7 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
21975
21375
|
}
|
|
21976
21376
|
);
|
|
21977
21377
|
};
|
|
21978
|
-
var ShadcnCheckboxVariant =
|
|
21378
|
+
var ShadcnCheckboxVariant = React66.forwardRef(
|
|
21979
21379
|
InnerShadcnCheckboxVariant
|
|
21980
21380
|
);
|
|
21981
21381
|
|
|
@@ -22022,7 +21422,7 @@ function triggerPadding(density) {
|
|
|
22022
21422
|
return "py-1.5";
|
|
22023
21423
|
}
|
|
22024
21424
|
}
|
|
22025
|
-
var ShadcnSelectVariant =
|
|
21425
|
+
var ShadcnSelectVariant = React66.forwardRef(function ShadcnSelectVariant2(props, _ref) {
|
|
22026
21426
|
var _a, _b;
|
|
22027
21427
|
const {
|
|
22028
21428
|
value,
|
|
@@ -22073,9 +21473,9 @@ var ShadcnSelectVariant = React11.forwardRef(function ShadcnSelectVariant2(props
|
|
|
22073
21473
|
virtualScroll = true
|
|
22074
21474
|
} = props;
|
|
22075
21475
|
const isButtonMode = mode === "button";
|
|
22076
|
-
const [open, setOpen] =
|
|
22077
|
-
const [query, setQuery] =
|
|
22078
|
-
const items =
|
|
21476
|
+
const [open, setOpen] = React66.useState(false);
|
|
21477
|
+
const [query, setQuery] = React66.useState("");
|
|
21478
|
+
const items = React66.useMemo(
|
|
22079
21479
|
() => normalizeOptions(options != null ? options : [], {
|
|
22080
21480
|
autoCap,
|
|
22081
21481
|
optionLabel,
|
|
@@ -22097,7 +21497,7 @@ var ShadcnSelectVariant = React11.forwardRef(function ShadcnSelectVariant2(props
|
|
|
22097
21497
|
]
|
|
22098
21498
|
);
|
|
22099
21499
|
const normalizedValue = value === "" || value == null ? void 0 : value;
|
|
22100
|
-
const valueMap =
|
|
21500
|
+
const valueMap = React66.useMemo(() => {
|
|
22101
21501
|
const map = /* @__PURE__ */ new Map();
|
|
22102
21502
|
for (const item of items) {
|
|
22103
21503
|
map.set(String(item.value), item.value);
|
|
@@ -22107,7 +21507,7 @@ var ShadcnSelectVariant = React11.forwardRef(function ShadcnSelectVariant2(props
|
|
|
22107
21507
|
const selectedItem = normalizedValue == null ? null : (_a = items.find(
|
|
22108
21508
|
(it) => String(it.value) === String(normalizedValue)
|
|
22109
21509
|
)) != null ? _a : null;
|
|
22110
|
-
const filteredItems =
|
|
21510
|
+
const filteredItems = React66.useMemo(() => {
|
|
22111
21511
|
if (!query) return items;
|
|
22112
21512
|
const q2 = query.toLowerCase();
|
|
22113
21513
|
return items.filter((it) => it.labelText.toLowerCase().includes(q2));
|
|
@@ -22119,7 +21519,7 @@ var ShadcnSelectVariant = React11.forwardRef(function ShadcnSelectVariant2(props
|
|
|
22119
21519
|
listMaxHeight,
|
|
22120
21520
|
Math.max(estimatedRowHeight, filteredItems.length * estimatedRowHeight)
|
|
22121
21521
|
);
|
|
22122
|
-
const handleChange =
|
|
21522
|
+
const handleChange = React66.useCallback(
|
|
22123
21523
|
(rawKey) => {
|
|
22124
21524
|
var _a2, _b2, _c;
|
|
22125
21525
|
if (!onValue || rawKey === "") return;
|
|
@@ -22167,7 +21567,7 @@ var ShadcnSelectVariant = React11.forwardRef(function ShadcnSelectVariant2(props
|
|
|
22167
21567
|
"focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",
|
|
22168
21568
|
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive"
|
|
22169
21569
|
);
|
|
22170
|
-
const ButtonModeTrigger =
|
|
21570
|
+
const ButtonModeTrigger = React66.useMemo(() => {
|
|
22171
21571
|
if (!isButtonMode) return null;
|
|
22172
21572
|
const selectedValue = value;
|
|
22173
21573
|
const renderable = button != null ? button : children;
|
|
@@ -22577,10 +21977,10 @@ var SelectionSummary = ({
|
|
|
22577
21977
|
placeholder,
|
|
22578
21978
|
onRemoveValue
|
|
22579
21979
|
}) => {
|
|
22580
|
-
const containerRef =
|
|
22581
|
-
const [visibleCount, setVisibleCount] =
|
|
22582
|
-
const [moreOpen, setMoreOpen] =
|
|
22583
|
-
|
|
21980
|
+
const containerRef = React66.useRef(null);
|
|
21981
|
+
const [visibleCount, setVisibleCount] = React66.useState(0);
|
|
21982
|
+
const [moreOpen, setMoreOpen] = React66.useState(false);
|
|
21983
|
+
React66.useLayoutEffect(() => {
|
|
22584
21984
|
const el = containerRef.current;
|
|
22585
21985
|
if (!el) return;
|
|
22586
21986
|
const computeVisibleItems = () => {
|
|
@@ -22628,7 +22028,7 @@ var SelectionSummary = ({
|
|
|
22628
22028
|
ref: containerRef,
|
|
22629
22029
|
className: "flex items-center w-full overflow-hidden whitespace-nowrap",
|
|
22630
22030
|
children: [
|
|
22631
|
-
visibleItems.map((item, index) => /* @__PURE__ */ jsxs(
|
|
22031
|
+
visibleItems.map((item, index) => /* @__PURE__ */ jsxs(React66.Fragment, { children: [
|
|
22632
22032
|
/* @__PURE__ */ jsx("span", { className: "truncate flex-shrink-0", children: item.labelNode }),
|
|
22633
22033
|
index < visibleItems.length - 1 && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground mr-1", children: "," })
|
|
22634
22034
|
] }, item.key)),
|
|
@@ -22735,7 +22135,7 @@ function triggerPadding2(density) {
|
|
|
22735
22135
|
return "py-1.5";
|
|
22736
22136
|
}
|
|
22737
22137
|
}
|
|
22738
|
-
var ShadcnMultiSelectVariant =
|
|
22138
|
+
var ShadcnMultiSelectVariant = React66.forwardRef(function ShadcnMultiSelectVariant2(props, _ref) {
|
|
22739
22139
|
var _a;
|
|
22740
22140
|
const {
|
|
22741
22141
|
value,
|
|
@@ -22791,9 +22191,9 @@ var ShadcnMultiSelectVariant = React11.forwardRef(function ShadcnMultiSelectVari
|
|
|
22791
22191
|
selectedBadgeClassName,
|
|
22792
22192
|
selectedBadgePlacement = "end"
|
|
22793
22193
|
} = props;
|
|
22794
|
-
const [open, setOpen] =
|
|
22795
|
-
const [query, setQuery] =
|
|
22796
|
-
const { items, keyedItems } =
|
|
22194
|
+
const [open, setOpen] = React66.useState(false);
|
|
22195
|
+
const [query, setQuery] = React66.useState("");
|
|
22196
|
+
const { items, keyedItems } = React66.useMemo(() => {
|
|
22797
22197
|
const items2 = normalizeOptions2(options != null ? options : [], {
|
|
22798
22198
|
autoCap,
|
|
22799
22199
|
optionLabel,
|
|
@@ -22814,24 +22214,24 @@ var ShadcnMultiSelectVariant = React11.forwardRef(function ShadcnMultiSelectVari
|
|
|
22814
22214
|
optionKey,
|
|
22815
22215
|
optionIcon
|
|
22816
22216
|
]);
|
|
22817
|
-
const selectedValues =
|
|
22217
|
+
const selectedValues = React66.useMemo(
|
|
22818
22218
|
() => new Set(value != null ? value : []),
|
|
22819
22219
|
[value]
|
|
22820
22220
|
);
|
|
22821
|
-
const selectedItems =
|
|
22221
|
+
const selectedItems = React66.useMemo(
|
|
22822
22222
|
() => items.filter((it) => selectedValues.has(it.value)),
|
|
22823
22223
|
[items, selectedValues]
|
|
22824
22224
|
);
|
|
22825
|
-
const filteredItems =
|
|
22225
|
+
const filteredItems = React66.useMemo(() => {
|
|
22826
22226
|
if (!query) return items;
|
|
22827
22227
|
const q2 = query.toLowerCase();
|
|
22828
22228
|
return items.filter((it) => it.labelText.toLowerCase().includes(q2));
|
|
22829
22229
|
}, [items, query]);
|
|
22830
|
-
const selectableItems =
|
|
22230
|
+
const selectableItems = React66.useMemo(
|
|
22831
22231
|
() => items.filter((it) => !it.disabled),
|
|
22832
22232
|
[items]
|
|
22833
22233
|
);
|
|
22834
|
-
const allSelectableValues =
|
|
22234
|
+
const allSelectableValues = React66.useMemo(
|
|
22835
22235
|
() => new Set(selectableItems.map((it) => it.value)),
|
|
22836
22236
|
[selectableItems]
|
|
22837
22237
|
);
|
|
@@ -22851,7 +22251,7 @@ var ShadcnMultiSelectVariant = React11.forwardRef(function ShadcnMultiSelectVari
|
|
|
22851
22251
|
filteredItems.length * estimatedRowHeight + headerHeight + footerHeight
|
|
22852
22252
|
)
|
|
22853
22253
|
);
|
|
22854
|
-
const handleToggleValue =
|
|
22254
|
+
const handleToggleValue = React66.useCallback(
|
|
22855
22255
|
(primitive) => {
|
|
22856
22256
|
if (!onValue || disabled || readOnly) return;
|
|
22857
22257
|
const current = value != null ? value : [];
|
|
@@ -22879,7 +22279,7 @@ var ShadcnMultiSelectVariant = React11.forwardRef(function ShadcnMultiSelectVari
|
|
|
22879
22279
|
},
|
|
22880
22280
|
[onValue, value, disabled, readOnly]
|
|
22881
22281
|
);
|
|
22882
|
-
const handleSelectAll =
|
|
22282
|
+
const handleSelectAll = React66.useCallback(() => {
|
|
22883
22283
|
if (!onValue || disabled || readOnly) return;
|
|
22884
22284
|
const current = value != null ? value : [];
|
|
22885
22285
|
const allSelectableArr = Array.from(allSelectableValues);
|
|
@@ -22915,7 +22315,7 @@ var ShadcnMultiSelectVariant = React11.forwardRef(function ShadcnMultiSelectVari
|
|
|
22915
22315
|
allSelectableValues,
|
|
22916
22316
|
selectedValues
|
|
22917
22317
|
]);
|
|
22918
|
-
const handleClearAll =
|
|
22318
|
+
const handleClearAll = React66.useCallback(() => {
|
|
22919
22319
|
if (!onValue || disabled || readOnly) return;
|
|
22920
22320
|
const detail = {
|
|
22921
22321
|
source: "variant",
|
|
@@ -22961,7 +22361,7 @@ var ShadcnMultiSelectVariant = React11.forwardRef(function ShadcnMultiSelectVari
|
|
|
22961
22361
|
const hasLeadingControl = !!leadingControl;
|
|
22962
22362
|
const hasTrailingControl = !!trailingControl;
|
|
22963
22363
|
const hasControls = hasLeadingControl || hasTrailingControl;
|
|
22964
|
-
const makeCheckboxNode =
|
|
22364
|
+
const makeCheckboxNode = React66.useCallback(
|
|
22965
22365
|
(opts) => {
|
|
22966
22366
|
if (renderCheckbox) {
|
|
22967
22367
|
return renderCheckbox(opts);
|
|
@@ -23057,7 +22457,7 @@ var ShadcnMultiSelectVariant = React11.forwardRef(function ShadcnMultiSelectVari
|
|
|
23057
22457
|
] })
|
|
23058
22458
|
}
|
|
23059
22459
|
);
|
|
23060
|
-
const ButtonModeTrigger =
|
|
22460
|
+
const ButtonModeTrigger = React66.useMemo(() => {
|
|
23061
22461
|
if (mode !== "button") return null;
|
|
23062
22462
|
const selectedCount = selectedItems.length;
|
|
23063
22463
|
const content = (() => {
|
|
@@ -23403,7 +22803,7 @@ function Slider({
|
|
|
23403
22803
|
max: max2 = 100,
|
|
23404
22804
|
...props
|
|
23405
22805
|
}) {
|
|
23406
|
-
const _values =
|
|
22806
|
+
const _values = React66.useMemo(
|
|
23407
22807
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min2, max2],
|
|
23408
22808
|
[value, defaultValue, min2, max2]
|
|
23409
22809
|
);
|
|
@@ -23482,7 +22882,7 @@ function clampToRange(v2, min2, max2) {
|
|
|
23482
22882
|
if (v2 > max2) return max2;
|
|
23483
22883
|
return v2;
|
|
23484
22884
|
}
|
|
23485
|
-
var ShadcnSliderVariant =
|
|
22885
|
+
var ShadcnSliderVariant = React66.forwardRef(function ShadcnSliderVariant2(props, _ref) {
|
|
23486
22886
|
const {
|
|
23487
22887
|
value,
|
|
23488
22888
|
onValue,
|
|
@@ -23521,7 +22921,7 @@ var ShadcnSliderVariant = React11.forwardRef(function ShadcnSliderVariant2(props
|
|
|
23521
22921
|
} = props;
|
|
23522
22922
|
const numericValue = typeof value === "number" ? value : min2;
|
|
23523
22923
|
const isDisabled = !!(disabled || readOnly);
|
|
23524
|
-
const handleChange =
|
|
22924
|
+
const handleChange = React66.useCallback(
|
|
23525
22925
|
(vals) => {
|
|
23526
22926
|
if (!onValue) return;
|
|
23527
22927
|
const next = clampToRange(vals[0], min2, max2);
|
|
@@ -23536,7 +22936,7 @@ var ShadcnSliderVariant = React11.forwardRef(function ShadcnSliderVariant2(props
|
|
|
23536
22936
|
[onValue, min2, max2]
|
|
23537
22937
|
);
|
|
23538
22938
|
const stepAmount = controlStep != null ? controlStep : step;
|
|
23539
|
-
const applyStep =
|
|
22939
|
+
const applyStep = React66.useCallback(
|
|
23540
22940
|
(direction) => {
|
|
23541
22941
|
if (!onValue || isDisabled) return;
|
|
23542
22942
|
const current = typeof value === "number" ? value : min2;
|
|
@@ -23994,7 +23394,7 @@ function getGapPx(el) {
|
|
|
23994
23394
|
const g2 = cs.columnGap && cs.columnGap !== "normal" ? cs.columnGap : cs.gap;
|
|
23995
23395
|
return parsePx(g2);
|
|
23996
23396
|
}
|
|
23997
|
-
var ShadcnKeyValueVariant =
|
|
23397
|
+
var ShadcnKeyValueVariant = React66.forwardRef(function ShadcnKeyValueVariant2(props, _ref) {
|
|
23998
23398
|
const {
|
|
23999
23399
|
value,
|
|
24000
23400
|
onValue,
|
|
@@ -24019,14 +23419,14 @@ var ShadcnKeyValueVariant = React11.forwardRef(function ShadcnKeyValueVariant2(p
|
|
|
24019
23419
|
renderChip
|
|
24020
23420
|
} = props;
|
|
24021
23421
|
const isDisabled = disabled || readOnly;
|
|
24022
|
-
const items =
|
|
24023
|
-
const [dialogOpen, setDialogOpen] =
|
|
24024
|
-
const [editingIndex, setEditingIndex] =
|
|
24025
|
-
const [draft, setDraft] =
|
|
23422
|
+
const items = React66.useMemo(() => mapToItems(value), [value]);
|
|
23423
|
+
const [dialogOpen, setDialogOpen] = React66.useState(false);
|
|
23424
|
+
const [editingIndex, setEditingIndex] = React66.useState(null);
|
|
23425
|
+
const [draft, setDraft] = React66.useState({ key: "", value: "" });
|
|
24026
23426
|
const canAdd = items.length < max2;
|
|
24027
23427
|
const canDelete = items.length > min2;
|
|
24028
23428
|
const hasItems = items.length > 0;
|
|
24029
|
-
const commitItems =
|
|
23429
|
+
const commitItems = React66.useCallback(
|
|
24030
23430
|
(next, meta) => {
|
|
24031
23431
|
if (!onValue) return;
|
|
24032
23432
|
const nextMap = itemsToMap(next);
|
|
@@ -24040,13 +23440,13 @@ var ShadcnKeyValueVariant = React11.forwardRef(function ShadcnKeyValueVariant2(p
|
|
|
24040
23440
|
},
|
|
24041
23441
|
[onValue]
|
|
24042
23442
|
);
|
|
24043
|
-
const openForNew =
|
|
23443
|
+
const openForNew = React66.useCallback(() => {
|
|
24044
23444
|
if (isDisabled || !canAdd) return;
|
|
24045
23445
|
setEditingIndex(null);
|
|
24046
23446
|
setDraft({ key: "", value: "" });
|
|
24047
23447
|
setDialogOpen(true);
|
|
24048
23448
|
}, [isDisabled, canAdd]);
|
|
24049
|
-
const openForEdit =
|
|
23449
|
+
const openForEdit = React66.useCallback(
|
|
24050
23450
|
(index) => {
|
|
24051
23451
|
if (isDisabled) return;
|
|
24052
23452
|
const item = items[index];
|
|
@@ -24057,7 +23457,7 @@ var ShadcnKeyValueVariant = React11.forwardRef(function ShadcnKeyValueVariant2(p
|
|
|
24057
23457
|
},
|
|
24058
23458
|
[isDisabled, items]
|
|
24059
23459
|
);
|
|
24060
|
-
const handleDelete =
|
|
23460
|
+
const handleDelete = React66.useCallback(() => {
|
|
24061
23461
|
if (editingIndex == null) return;
|
|
24062
23462
|
if (!canDelete) return;
|
|
24063
23463
|
const next = items.slice();
|
|
@@ -24068,7 +23468,7 @@ var ShadcnKeyValueVariant = React11.forwardRef(function ShadcnKeyValueVariant2(p
|
|
|
24068
23468
|
index: editingIndex
|
|
24069
23469
|
});
|
|
24070
23470
|
}, [editingIndex, items, canDelete, commitItems]);
|
|
24071
|
-
const handleSubmit =
|
|
23471
|
+
const handleSubmit = React66.useCallback(() => {
|
|
24072
23472
|
const trimmedKey = draft.key.trim();
|
|
24073
23473
|
const trimmedValue = draft.value;
|
|
24074
23474
|
if (!trimmedKey) return;
|
|
@@ -24090,7 +23490,7 @@ var ShadcnKeyValueVariant = React11.forwardRef(function ShadcnKeyValueVariant2(p
|
|
|
24090
23490
|
index: editingIndex != null ? editingIndex : next.length - 1
|
|
24091
23491
|
});
|
|
24092
23492
|
}, [draft, items, editingIndex, canAdd, commitItems]);
|
|
24093
|
-
const handleQuickRemove =
|
|
23493
|
+
const handleQuickRemove = React66.useCallback(
|
|
24094
23494
|
(index) => {
|
|
24095
23495
|
if (isDisabled || !canDelete) return;
|
|
24096
23496
|
const next = items.slice();
|
|
@@ -24099,21 +23499,21 @@ var ShadcnKeyValueVariant = React11.forwardRef(function ShadcnKeyValueVariant2(p
|
|
|
24099
23499
|
},
|
|
24100
23500
|
[isDisabled, canDelete, items, commitItems]
|
|
24101
23501
|
);
|
|
24102
|
-
const [listOpen, setListOpen] =
|
|
24103
|
-
const openList =
|
|
23502
|
+
const [listOpen, setListOpen] = React66.useState(false);
|
|
23503
|
+
const openList = React66.useCallback(() => {
|
|
24104
23504
|
if (isDisabled) return;
|
|
24105
23505
|
setListOpen(true);
|
|
24106
23506
|
}, [isDisabled]);
|
|
24107
|
-
const wrapRef =
|
|
24108
|
-
const leftRef =
|
|
24109
|
-
const moreMeasureRef =
|
|
24110
|
-
const chipRefs =
|
|
23507
|
+
const wrapRef = React66.useRef(null);
|
|
23508
|
+
const leftRef = React66.useRef(null);
|
|
23509
|
+
const moreMeasureRef = React66.useRef(null);
|
|
23510
|
+
const chipRefs = React66.useRef([]);
|
|
24111
23511
|
chipRefs.current = items.map((_2, i3) => {
|
|
24112
23512
|
var _a;
|
|
24113
23513
|
return (_a = chipRefs.current[i3]) != null ? _a : null;
|
|
24114
23514
|
});
|
|
24115
|
-
const [visibleCount, setVisibleCount] =
|
|
24116
|
-
const recomputeVisible =
|
|
23515
|
+
const [visibleCount, setVisibleCount] = React66.useState(() => items.length);
|
|
23516
|
+
const recomputeVisible = React66.useCallback(() => {
|
|
24117
23517
|
var _a, _b;
|
|
24118
23518
|
const leftEl = leftRef.current;
|
|
24119
23519
|
if (!leftEl) {
|
|
@@ -24162,10 +23562,10 @@ var ShadcnKeyValueVariant = React11.forwardRef(function ShadcnKeyValueVariant2(p
|
|
|
24162
23562
|
}
|
|
24163
23563
|
setVisibleCount(best);
|
|
24164
23564
|
}, [items.length]);
|
|
24165
|
-
|
|
23565
|
+
React66.useLayoutEffect(() => {
|
|
24166
23566
|
recomputeVisible();
|
|
24167
23567
|
}, [recomputeVisible, items, size, density, showValue]);
|
|
24168
|
-
|
|
23568
|
+
React66.useEffect(() => {
|
|
24169
23569
|
const el = leftRef.current;
|
|
24170
23570
|
if (!el) return;
|
|
24171
23571
|
const ro = new ResizeObserver(() => recomputeVisible());
|
|
@@ -24555,7 +23955,7 @@ var keyValueModule = {
|
|
|
24555
23955
|
label: ""
|
|
24556
23956
|
}
|
|
24557
23957
|
};
|
|
24558
|
-
var ShadcnCustomVariant =
|
|
23958
|
+
var ShadcnCustomVariant = React66.forwardRef(function ShadcnCustomVariant2(props, ref) {
|
|
24559
23959
|
const {
|
|
24560
23960
|
// Variant base props we care about:
|
|
24561
23961
|
value,
|
|
@@ -24591,7 +23991,7 @@ var ShadcnCustomVariant = React11.forwardRef(function ShadcnCustomVariant2(props
|
|
|
24591
23991
|
}
|
|
24592
23992
|
const isDisabled = !!disabled;
|
|
24593
23993
|
const isReadOnly = !!readOnly;
|
|
24594
|
-
const handleChange =
|
|
23994
|
+
const handleChange = React66.useCallback(
|
|
24595
23995
|
(...args) => {
|
|
24596
23996
|
var _a;
|
|
24597
23997
|
if (!onValue) return;
|
|
@@ -24696,7 +24096,7 @@ function triggerHeight3(size) {
|
|
|
24696
24096
|
return "min-h-9 text-sm";
|
|
24697
24097
|
}
|
|
24698
24098
|
}
|
|
24699
|
-
var ShadcnTreeSelectVariant =
|
|
24099
|
+
var ShadcnTreeSelectVariant = React66.forwardRef(function ShadcnTreeSelectVariant2(props, ref) {
|
|
24700
24100
|
const {
|
|
24701
24101
|
value,
|
|
24702
24102
|
onValue,
|
|
@@ -24749,14 +24149,14 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
24749
24149
|
selectedBadgeClassName,
|
|
24750
24150
|
selectedBadgePlacement = "corner"
|
|
24751
24151
|
} = props;
|
|
24752
|
-
const [open, setOpen] =
|
|
24753
|
-
const [query, setQuery] =
|
|
24152
|
+
const [open, setOpen] = React66.useState(false);
|
|
24153
|
+
const [query, setQuery] = React66.useState("");
|
|
24754
24154
|
const isDisabled = disabled || readOnly;
|
|
24755
|
-
const d =
|
|
24155
|
+
const d = React66.useMemo(
|
|
24756
24156
|
() => densityClasses(density),
|
|
24757
24157
|
[density]
|
|
24758
24158
|
);
|
|
24759
|
-
const tree =
|
|
24159
|
+
const tree = React66.useMemo(
|
|
24760
24160
|
() => normalizeTree(options != null ? options : [], {
|
|
24761
24161
|
autoCap,
|
|
24762
24162
|
optionLabel,
|
|
@@ -24777,8 +24177,8 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
24777
24177
|
optionKey
|
|
24778
24178
|
]
|
|
24779
24179
|
);
|
|
24780
|
-
const allNodesFlat =
|
|
24781
|
-
const computedInitialExpanded =
|
|
24180
|
+
const allNodesFlat = React66.useMemo(() => flattenTree(tree), [tree]);
|
|
24181
|
+
const computedInitialExpanded = React66.useMemo(() => {
|
|
24782
24182
|
if (expandAll) {
|
|
24783
24183
|
return new Set(
|
|
24784
24184
|
allNodesFlat.filter((n3) => n3.hasChildren).map((n3) => n3.value)
|
|
@@ -24789,13 +24189,13 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
24789
24189
|
}
|
|
24790
24190
|
return /* @__PURE__ */ new Set();
|
|
24791
24191
|
}, [expandAll, defaultExpandedValues, allNodesFlat]);
|
|
24792
|
-
const [expanded, setExpanded] =
|
|
24192
|
+
const [expanded, setExpanded] = React66.useState(
|
|
24793
24193
|
computedInitialExpanded
|
|
24794
24194
|
);
|
|
24795
|
-
|
|
24195
|
+
React66.useEffect(() => {
|
|
24796
24196
|
setExpanded(computedInitialExpanded);
|
|
24797
24197
|
}, [computedInitialExpanded]);
|
|
24798
|
-
const toggleExpanded =
|
|
24198
|
+
const toggleExpanded = React66.useCallback((key) => {
|
|
24799
24199
|
setExpanded((prev) => {
|
|
24800
24200
|
const next = new Set(prev);
|
|
24801
24201
|
if (next.has(key)) next.delete(key);
|
|
@@ -24803,7 +24203,7 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
24803
24203
|
return next;
|
|
24804
24204
|
});
|
|
24805
24205
|
}, []);
|
|
24806
|
-
const displayedNodes =
|
|
24206
|
+
const displayedNodes = React66.useMemo(() => {
|
|
24807
24207
|
if (query) {
|
|
24808
24208
|
const q2 = query.toLowerCase();
|
|
24809
24209
|
const matchSet = /* @__PURE__ */ new Set();
|
|
@@ -24837,19 +24237,19 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
24837
24237
|
displayedNodes.length * estimatedRowHeight
|
|
24838
24238
|
)
|
|
24839
24239
|
);
|
|
24840
|
-
const selectedValues =
|
|
24240
|
+
const selectedValues = React66.useMemo(() => {
|
|
24841
24241
|
if (value === void 0 || value === null) return [];
|
|
24842
24242
|
if (Array.isArray(value)) {
|
|
24843
24243
|
return multiple ? value : value.length ? [value[0]] : [];
|
|
24844
24244
|
}
|
|
24845
24245
|
return [value];
|
|
24846
24246
|
}, [value, multiple]);
|
|
24847
|
-
const selectedItems =
|
|
24247
|
+
const selectedItems = React66.useMemo(
|
|
24848
24248
|
() => allNodesFlat.filter((node) => selectedValues.includes(node.value)),
|
|
24849
24249
|
[allNodesFlat, selectedValues]
|
|
24850
24250
|
);
|
|
24851
24251
|
const selectedCount = selectedItems.length;
|
|
24852
|
-
const handleToggleValue =
|
|
24252
|
+
const handleToggleValue = React66.useCallback(
|
|
24853
24253
|
(item) => {
|
|
24854
24254
|
if (isDisabled) return;
|
|
24855
24255
|
if (leafOnly && item.hasChildren) {
|
|
@@ -24884,7 +24284,7 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
24884
24284
|
toggleExpanded
|
|
24885
24285
|
]
|
|
24886
24286
|
);
|
|
24887
|
-
const handleClear =
|
|
24287
|
+
const handleClear = React66.useCallback(() => {
|
|
24888
24288
|
if (!onValue) return;
|
|
24889
24289
|
const detail = {
|
|
24890
24290
|
source: "variant",
|
|
@@ -24991,7 +24391,7 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
24991
24391
|
] })
|
|
24992
24392
|
}
|
|
24993
24393
|
);
|
|
24994
|
-
const ButtonModeTrigger =
|
|
24394
|
+
const ButtonModeTrigger = React66.useMemo(() => {
|
|
24995
24395
|
if (mode !== "button") return null;
|
|
24996
24396
|
const ctx = { open, selectedItems, selectedCount };
|
|
24997
24397
|
const triggerNode = typeof button === "function" ? button(ctx) : button != null ? button : typeof children === "function" ? children(ctx) : children;
|
|
@@ -25021,7 +24421,7 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
25021
24421
|
badgeEl
|
|
25022
24422
|
] });
|
|
25023
24423
|
};
|
|
25024
|
-
if (
|
|
24424
|
+
if (React66.isValidElement(triggerNode)) {
|
|
25025
24425
|
return wrapWithBadge(triggerNode);
|
|
25026
24426
|
}
|
|
25027
24427
|
return wrapWithBadge(
|
|
@@ -25129,7 +24529,7 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
25129
24529
|
);
|
|
25130
24530
|
const renderer = (_a = item.render) != null ? _a : renderOption;
|
|
25131
24531
|
if (!renderer) {
|
|
25132
|
-
return /* @__PURE__ */ jsx(
|
|
24532
|
+
return /* @__PURE__ */ jsx(React66.Fragment, { children: optionNode }, item.key);
|
|
25133
24533
|
}
|
|
25134
24534
|
const rendered = renderer({
|
|
25135
24535
|
item,
|
|
@@ -25140,7 +24540,7 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
25140
24540
|
if (!item.disabled) handleToggleValue(item);
|
|
25141
24541
|
}
|
|
25142
24542
|
});
|
|
25143
|
-
return /* @__PURE__ */ jsx(
|
|
24543
|
+
return /* @__PURE__ */ jsx(React66.Fragment, { children: rendered }, item.key);
|
|
25144
24544
|
}
|
|
25145
24545
|
}
|
|
25146
24546
|
)
|
|
@@ -25465,8 +24865,8 @@ function mergeHandlers(a3, b2) {
|
|
|
25465
24865
|
};
|
|
25466
24866
|
}
|
|
25467
24867
|
var FileThumbnail = ({ item }) => {
|
|
25468
|
-
const [preview, setPreview] =
|
|
25469
|
-
|
|
24868
|
+
const [preview, setPreview] = React66.useState(null);
|
|
24869
|
+
React66.useEffect(() => {
|
|
25470
24870
|
var _a;
|
|
25471
24871
|
const isImage2 = ((_a = item.type) == null ? void 0 : _a.startsWith("image/")) || item.name.match(/\.(jpg|jpeg|png|gif|webp)$/i);
|
|
25472
24872
|
if (!isImage2) return;
|
|
@@ -25488,7 +24888,7 @@ var FileThumbnail = ({ item }) => {
|
|
|
25488
24888
|
}
|
|
25489
24889
|
) : /* @__PURE__ */ jsx(File2, { className: "h-4 w-4 text-muted-foreground/50" }) });
|
|
25490
24890
|
};
|
|
25491
|
-
var ShadcnFileVariant =
|
|
24891
|
+
var ShadcnFileVariant = React66.forwardRef(function ShadcnFileVariant2(props, ref) {
|
|
25492
24892
|
const {
|
|
25493
24893
|
value,
|
|
25494
24894
|
onValue,
|
|
@@ -25542,18 +24942,18 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25542
24942
|
} = props;
|
|
25543
24943
|
const joinControls = mode === "default" ? joinControlsProp != null ? joinControlsProp : true : false;
|
|
25544
24944
|
const extendBoxToControls = mode === "default" ? extendBoxToControlsProp != null ? extendBoxToControlsProp : true : false;
|
|
25545
|
-
const items =
|
|
24945
|
+
const items = React66.useMemo(() => {
|
|
25546
24946
|
var _a;
|
|
25547
24947
|
const raw = (_a = toArray(value)) != null ? _a : [];
|
|
25548
24948
|
return raw.map(normaliseFileLike);
|
|
25549
24949
|
}, [value]);
|
|
25550
24950
|
const isDisabled = Boolean(disabled || readOnly);
|
|
25551
|
-
const [dragOver, setDragOver] =
|
|
25552
|
-
const [selectedIds, setSelectedIds] =
|
|
24951
|
+
const [dragOver, setDragOver] = React66.useState(false);
|
|
24952
|
+
const [selectedIds, setSelectedIds] = React66.useState(
|
|
25553
24953
|
() => /* @__PURE__ */ new Set()
|
|
25554
24954
|
);
|
|
25555
|
-
const [popoverOpen, setPopoverOpen] =
|
|
25556
|
-
const fileInputRef =
|
|
24955
|
+
const [popoverOpen, setPopoverOpen] = React66.useState(false);
|
|
24956
|
+
const fileInputRef = React66.useRef(null);
|
|
25557
24957
|
const den = densityTokens(density);
|
|
25558
24958
|
const heightCls = triggerHeight4(size);
|
|
25559
24959
|
const chipHeightCls = chipHeight(size);
|
|
@@ -25562,7 +24962,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25562
24962
|
const resolvedTrailingIcons = (trailingIcons == null ? void 0 : trailingIcons.length) ? trailingIcons : [];
|
|
25563
24963
|
const hasExternalControls = !!leadingControl || !!trailingControl;
|
|
25564
24964
|
const COLLAPSE_LIMIT = 2;
|
|
25565
|
-
const emitChange =
|
|
24965
|
+
const emitChange = React66.useCallback(
|
|
25566
24966
|
(nextItems, meta) => {
|
|
25567
24967
|
var _a;
|
|
25568
24968
|
const nextValues = nextItems.map(fileItemToValue);
|
|
@@ -25576,7 +24976,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25576
24976
|
},
|
|
25577
24977
|
[multiple, onValue]
|
|
25578
24978
|
);
|
|
25579
|
-
const handleAddItems =
|
|
24979
|
+
const handleAddItems = React66.useCallback(
|
|
25580
24980
|
(incoming, from) => {
|
|
25581
24981
|
if (isDisabled) return;
|
|
25582
24982
|
let next = multiple ? [...items] : [];
|
|
@@ -25613,7 +25013,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25613
25013
|
onFilesAdded
|
|
25614
25014
|
]
|
|
25615
25015
|
);
|
|
25616
|
-
const handleRemove =
|
|
25016
|
+
const handleRemove = React66.useCallback(
|
|
25617
25017
|
(id) => {
|
|
25618
25018
|
const next = items.filter((i3) => i3.id !== id);
|
|
25619
25019
|
emitChange(next, { action: "remove", id });
|
|
@@ -25625,7 +25025,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25625
25025
|
},
|
|
25626
25026
|
[emitChange, items, selectedIds]
|
|
25627
25027
|
);
|
|
25628
|
-
const handleBulkRemove =
|
|
25028
|
+
const handleBulkRemove = React66.useCallback(() => {
|
|
25629
25029
|
const next = items.filter((i3) => !selectedIds.has(i3.id));
|
|
25630
25030
|
emitChange(next, {
|
|
25631
25031
|
action: "bulk-remove",
|
|
@@ -25633,7 +25033,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25633
25033
|
});
|
|
25634
25034
|
setSelectedIds(/* @__PURE__ */ new Set());
|
|
25635
25035
|
}, [emitChange, items, selectedIds]);
|
|
25636
|
-
const openPicker =
|
|
25036
|
+
const openPicker = React66.useCallback(async () => {
|
|
25637
25037
|
var _a;
|
|
25638
25038
|
if (isDisabled) return;
|
|
25639
25039
|
let resolvedLoader = customLoader != null ? customLoader : custom && getPaletteUtil("customLoader");
|
|
@@ -25672,14 +25072,14 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25672
25072
|
mergeMode,
|
|
25673
25073
|
multiple
|
|
25674
25074
|
]);
|
|
25675
|
-
const onDragOver =
|
|
25075
|
+
const onDragOver = React66.useCallback(
|
|
25676
25076
|
(e4) => {
|
|
25677
25077
|
e4.preventDefault();
|
|
25678
25078
|
if (!isDisabled) setDragOver(true);
|
|
25679
25079
|
},
|
|
25680
25080
|
[isDisabled]
|
|
25681
25081
|
);
|
|
25682
|
-
const onDrop =
|
|
25082
|
+
const onDrop = React66.useCallback(
|
|
25683
25083
|
(e4) => {
|
|
25684
25084
|
var _a;
|
|
25685
25085
|
e4.preventDefault();
|
|
@@ -25697,15 +25097,15 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25697
25097
|
}
|
|
25698
25098
|
e4.target.value = "";
|
|
25699
25099
|
};
|
|
25700
|
-
const FileChip =
|
|
25100
|
+
const FileChip = React66.useCallback(
|
|
25701
25101
|
({
|
|
25702
25102
|
item,
|
|
25703
25103
|
condensed = false
|
|
25704
25104
|
}) => {
|
|
25705
25105
|
const name = formatFileName ? formatFileName(item) : item.name;
|
|
25706
|
-
const [preview, setPreview] =
|
|
25707
|
-
const [isOpen, setIsOpen] =
|
|
25708
|
-
|
|
25106
|
+
const [preview, setPreview] = React66.useState(null);
|
|
25107
|
+
const [isOpen, setIsOpen] = React66.useState(false);
|
|
25108
|
+
React66.useEffect(() => {
|
|
25709
25109
|
var _a;
|
|
25710
25110
|
const isImage2 = ((_a = item.type) == null ? void 0 : _a.startsWith("image/")) || item.name.match(/\.(jpg|jpeg|png|gif|webp)$/i);
|
|
25711
25111
|
if (!isImage2) {
|
|
@@ -25812,7 +25212,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25812
25212
|
]
|
|
25813
25213
|
);
|
|
25814
25214
|
const selectedCount = items.length;
|
|
25815
|
-
const resolveButtonTriggerElement =
|
|
25215
|
+
const resolveButtonTriggerElement = React66.useCallback(() => {
|
|
25816
25216
|
const ctx = {
|
|
25817
25217
|
open: popoverOpen,
|
|
25818
25218
|
items,
|
|
@@ -25842,7 +25242,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25842
25242
|
);
|
|
25843
25243
|
const child = el.props.children;
|
|
25844
25244
|
if (selectedBadgePlacement === "end") {
|
|
25845
|
-
return
|
|
25245
|
+
return React66.cloneElement(el, {
|
|
25846
25246
|
className: nextClass,
|
|
25847
25247
|
children: /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2", children: [
|
|
25848
25248
|
/* @__PURE__ */ jsx("span", { className: "min-w-0", children: child }),
|
|
@@ -25850,7 +25250,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25850
25250
|
] })
|
|
25851
25251
|
});
|
|
25852
25252
|
}
|
|
25853
|
-
return
|
|
25253
|
+
return React66.cloneElement(el, {
|
|
25854
25254
|
className: nextClass,
|
|
25855
25255
|
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25856
25256
|
child,
|
|
@@ -25858,7 +25258,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25858
25258
|
] })
|
|
25859
25259
|
});
|
|
25860
25260
|
};
|
|
25861
|
-
const withDnD = (el) =>
|
|
25261
|
+
const withDnD = (el) => React66.cloneElement(el, {
|
|
25862
25262
|
onDragOver: mergeHandlers(
|
|
25863
25263
|
el.props.onDragOver,
|
|
25864
25264
|
onDragOver
|
|
@@ -25869,7 +25269,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25869
25269
|
),
|
|
25870
25270
|
onDrop: mergeHandlers(el.props.onDrop, onDrop)
|
|
25871
25271
|
});
|
|
25872
|
-
if (
|
|
25272
|
+
if (React66.isValidElement(rawNode)) {
|
|
25873
25273
|
return withDnD(injectBadgeIntoElement(rawNode));
|
|
25874
25274
|
}
|
|
25875
25275
|
const fallback = /* @__PURE__ */ jsxs(
|
|
@@ -25925,7 +25325,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25925
25325
|
selectedCount,
|
|
25926
25326
|
triggerClassName
|
|
25927
25327
|
]);
|
|
25928
|
-
const TriggerRegion =
|
|
25328
|
+
const TriggerRegion = React66.useMemo(() => {
|
|
25929
25329
|
if (showDropArea) {
|
|
25930
25330
|
if (renderDropArea)
|
|
25931
25331
|
return renderDropArea({ openPicker, isDragging: dragOver });
|
|
@@ -26385,7 +25785,7 @@ var toggleVariants = cva(
|
|
|
26385
25785
|
}
|
|
26386
25786
|
}
|
|
26387
25787
|
);
|
|
26388
|
-
var ToggleGroupContext =
|
|
25788
|
+
var ToggleGroupContext = React66.createContext({
|
|
26389
25789
|
size: "default",
|
|
26390
25790
|
variant: "default",
|
|
26391
25791
|
spacing: 0
|
|
@@ -26422,7 +25822,7 @@ function ToggleGroupItem({
|
|
|
26422
25822
|
size,
|
|
26423
25823
|
...props
|
|
26424
25824
|
}) {
|
|
26425
|
-
const context =
|
|
25825
|
+
const context = React66.useContext(ToggleGroupContext);
|
|
26426
25826
|
return /* @__PURE__ */ jsx(
|
|
26427
25827
|
ToggleGroupPrimitive.Item,
|
|
26428
25828
|
{
|
|
@@ -26586,7 +25986,7 @@ function normalizeOption(input, {
|
|
|
26586
25986
|
raw: input
|
|
26587
25987
|
};
|
|
26588
25988
|
}
|
|
26589
|
-
var ShadcnToggleVariant3 =
|
|
25989
|
+
var ShadcnToggleVariant3 = React66.forwardRef(function ShadcnToggleVariant4(props, ref) {
|
|
26590
25990
|
const {
|
|
26591
25991
|
value,
|
|
26592
25992
|
onValue,
|
|
@@ -26616,7 +26016,7 @@ var ShadcnToggleVariant3 = React11.forwardRef(function ShadcnToggleVariant4(prop
|
|
|
26616
26016
|
const isDisabled = Boolean(disabled || readOnly);
|
|
26617
26017
|
const toggleSize = mapSizeToToggleSize(size);
|
|
26618
26018
|
const currentValue = normalizeValue(value, multiple);
|
|
26619
|
-
const normalizedOptions =
|
|
26019
|
+
const normalizedOptions = React66.useMemo(
|
|
26620
26020
|
() => options.map(
|
|
26621
26021
|
(opt) => normalizeOption(
|
|
26622
26022
|
opt,
|
|
@@ -26642,7 +26042,7 @@ var ShadcnToggleVariant3 = React11.forwardRef(function ShadcnToggleVariant4(prop
|
|
|
26642
26042
|
autoCap
|
|
26643
26043
|
]
|
|
26644
26044
|
);
|
|
26645
|
-
const handleChange =
|
|
26045
|
+
const handleChange = React66.useCallback(
|
|
26646
26046
|
(val) => {
|
|
26647
26047
|
if (readOnly) return;
|
|
26648
26048
|
if (!onValue) return;
|
|
@@ -26679,7 +26079,7 @@ var ShadcnToggleVariant3 = React11.forwardRef(function ShadcnToggleVariant4(prop
|
|
|
26679
26079
|
className
|
|
26680
26080
|
);
|
|
26681
26081
|
console.log(layoutClasses, fullWidth, autoCap);
|
|
26682
|
-
const groupStyle =
|
|
26082
|
+
const groupStyle = React66.useMemo(() => {
|
|
26683
26083
|
const style = {};
|
|
26684
26084
|
if (layout === "grid") {
|
|
26685
26085
|
style.gridTemplateColumns = `repeat(${gridCols}, minmax(0, 1fr))`;
|
|
@@ -26777,29 +26177,29 @@ function ShadcnEditorVariant(props) {
|
|
|
26777
26177
|
toolbar = "default",
|
|
26778
26178
|
pastePlainText = false
|
|
26779
26179
|
} = props;
|
|
26780
|
-
const mountRef =
|
|
26781
|
-
const editorRef =
|
|
26782
|
-
const formatRef =
|
|
26783
|
-
const onValueRef =
|
|
26784
|
-
const syncingRef =
|
|
26785
|
-
const loadedRef =
|
|
26180
|
+
const mountRef = React66.useRef(null);
|
|
26181
|
+
const editorRef = React66.useRef(null);
|
|
26182
|
+
const formatRef = React66.useRef(format2);
|
|
26183
|
+
const onValueRef = React66.useRef(onValue);
|
|
26184
|
+
const syncingRef = React66.useRef(false);
|
|
26185
|
+
const loadedRef = React66.useRef(false);
|
|
26786
26186
|
formatRef.current = format2;
|
|
26787
26187
|
onValueRef.current = onValue;
|
|
26788
26188
|
const effectiveReadOnly = Boolean(disabled || readOnly);
|
|
26789
|
-
const readContent =
|
|
26189
|
+
const readContent = React66.useCallback((ed) => {
|
|
26790
26190
|
var _a, _b;
|
|
26791
26191
|
return formatRef.current === "markdown" ? (_a = ed.getMarkdown()) != null ? _a : "" : (_b = ed.getHTML()) != null ? _b : "";
|
|
26792
26192
|
}, []);
|
|
26793
|
-
const emit =
|
|
26193
|
+
const emit = React66.useCallback((next) => {
|
|
26794
26194
|
var _a;
|
|
26795
26195
|
const detail = { source: "user", raw: next };
|
|
26796
26196
|
(_a = onValueRef.current) == null ? void 0 : _a.call(onValueRef, next, detail);
|
|
26797
26197
|
}, []);
|
|
26798
|
-
const structuralKey =
|
|
26198
|
+
const structuralKey = React66.useMemo(() => {
|
|
26799
26199
|
const hideModeSwitch = toolbar === "none" || pastePlainText;
|
|
26800
26200
|
return JSON.stringify({ toolbar, useCommandShortcut, hideModeSwitch });
|
|
26801
26201
|
}, [toolbar, useCommandShortcut, pastePlainText]);
|
|
26802
|
-
|
|
26202
|
+
React66.useEffect(() => {
|
|
26803
26203
|
const el = mountRef.current;
|
|
26804
26204
|
if (!el) return;
|
|
26805
26205
|
if (editorRef.current) {
|
|
@@ -26866,29 +26266,29 @@ function ShadcnEditorVariant(props) {
|
|
|
26866
26266
|
editorRef.current = null;
|
|
26867
26267
|
};
|
|
26868
26268
|
}, [structuralKey]);
|
|
26869
|
-
|
|
26269
|
+
React66.useEffect(() => {
|
|
26870
26270
|
const ed = editorRef.current;
|
|
26871
26271
|
if (!ed) return;
|
|
26872
26272
|
if (typeof ed.setHeight === "function") ed.setHeight(height);
|
|
26873
26273
|
}, [height]);
|
|
26874
|
-
|
|
26274
|
+
React66.useEffect(() => {
|
|
26875
26275
|
const ed = editorRef.current;
|
|
26876
26276
|
if (!ed) return;
|
|
26877
26277
|
if (typeof ed.setPlaceholder === "function")
|
|
26878
26278
|
ed.setPlaceholder(placeholder);
|
|
26879
26279
|
}, [placeholder]);
|
|
26880
|
-
|
|
26280
|
+
React66.useEffect(() => {
|
|
26881
26281
|
const ed = editorRef.current;
|
|
26882
26282
|
if (!ed) return;
|
|
26883
26283
|
if (typeof ed.changeMode === "function") ed.changeMode(editType);
|
|
26884
26284
|
}, [editType]);
|
|
26885
|
-
|
|
26285
|
+
React66.useEffect(() => {
|
|
26886
26286
|
const ed = editorRef.current;
|
|
26887
26287
|
if (!ed) return;
|
|
26888
26288
|
if (typeof ed.changePreviewStyle === "function")
|
|
26889
26289
|
ed.changePreviewStyle(previewStyle);
|
|
26890
26290
|
}, [previewStyle]);
|
|
26891
|
-
|
|
26291
|
+
React66.useEffect(() => {
|
|
26892
26292
|
var _a, _b, _c, _d;
|
|
26893
26293
|
const ed = editorRef.current;
|
|
26894
26294
|
if (!ed) return;
|
|
@@ -26905,7 +26305,7 @@ function ShadcnEditorVariant(props) {
|
|
|
26905
26305
|
syncingRef.current = false;
|
|
26906
26306
|
});
|
|
26907
26307
|
}, [value, format2]);
|
|
26908
|
-
|
|
26308
|
+
React66.useEffect(() => {
|
|
26909
26309
|
if (!pastePlainText) return;
|
|
26910
26310
|
const host = mountRef.current;
|
|
26911
26311
|
if (!host) return;
|
|
@@ -27407,10 +26807,10 @@ function JsonEditorMain(props) {
|
|
|
27407
26807
|
className,
|
|
27408
26808
|
contentClassName
|
|
27409
26809
|
} = props;
|
|
27410
|
-
const directChildPaths =
|
|
26810
|
+
const directChildPaths = React66.useMemo(() => {
|
|
27411
26811
|
return getDirectChildPaths(route, allPaths);
|
|
27412
26812
|
}, [route, allPaths]);
|
|
27413
|
-
const rows =
|
|
26813
|
+
const rows = React66.useMemo(() => {
|
|
27414
26814
|
return resolveLayoutForParent({
|
|
27415
26815
|
parent: route,
|
|
27416
26816
|
childPaths: directChildPaths,
|
|
@@ -27418,7 +26818,7 @@ function JsonEditorMain(props) {
|
|
|
27418
26818
|
filters
|
|
27419
26819
|
});
|
|
27420
26820
|
}, [route, directChildPaths, layout, filters]);
|
|
27421
|
-
const effectiveRows =
|
|
26821
|
+
const effectiveRows = React66.useMemo(() => {
|
|
27422
26822
|
const hasAny = rows.some((r5) => {
|
|
27423
26823
|
var _a;
|
|
27424
26824
|
return (_a = r5.fields) == null ? void 0 : _a.length;
|
|
@@ -28594,7 +27994,7 @@ function JsonEditorRawPanel(props) {
|
|
|
28594
27994
|
const canEditRaw = (_b = permissions == null ? void 0 : permissions.canEditRaw) != null ? _b : false;
|
|
28595
27995
|
if (!canViewRaw) return null;
|
|
28596
27996
|
const viewOnly = !!disabled || !!readOnly || !canEditRaw;
|
|
28597
|
-
const onCopy =
|
|
27997
|
+
const onCopy = React66.useCallback(async () => {
|
|
28598
27998
|
try {
|
|
28599
27999
|
await navigator.clipboard.writeText(
|
|
28600
28000
|
JSON.stringify(root != null ? root : {}, null, 2)
|
|
@@ -28688,17 +28088,17 @@ function collectAllPaths(value, prefix = "", out = []) {
|
|
|
28688
28088
|
}
|
|
28689
28089
|
function useControllable(opts) {
|
|
28690
28090
|
const { value, defaultValue, onChange } = opts;
|
|
28691
|
-
const [inner, setInner] =
|
|
28091
|
+
const [inner, setInner] = React66.useState(defaultValue);
|
|
28692
28092
|
const isControlled = value !== void 0;
|
|
28693
28093
|
const state = isControlled ? value : inner;
|
|
28694
|
-
const setState =
|
|
28094
|
+
const setState = React66.useCallback(
|
|
28695
28095
|
(next) => {
|
|
28696
28096
|
if (!isControlled) setInner(next);
|
|
28697
28097
|
onChange == null ? void 0 : onChange(next);
|
|
28698
28098
|
},
|
|
28699
28099
|
[isControlled, onChange]
|
|
28700
28100
|
);
|
|
28701
|
-
|
|
28101
|
+
React66.useEffect(() => {
|
|
28702
28102
|
if (!isControlled) return;
|
|
28703
28103
|
setInner(value);
|
|
28704
28104
|
}, [isControlled]);
|
|
@@ -28713,7 +28113,7 @@ function callCallbacks(callbacks, action, nextRoot, ctx) {
|
|
|
28713
28113
|
const meta = { action, route: ctx.route, path, parent, key };
|
|
28714
28114
|
(_b = callbacks.onEdit) == null ? void 0 : _b.call(callbacks, nextRoot, meta);
|
|
28715
28115
|
}
|
|
28716
|
-
var JsonEditor =
|
|
28116
|
+
var JsonEditor = React66.forwardRef(function JsonEditorEditor(props, ref) {
|
|
28717
28117
|
var _a, _b;
|
|
28718
28118
|
const {
|
|
28719
28119
|
root,
|
|
@@ -28743,16 +28143,16 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28743
28143
|
} = props;
|
|
28744
28144
|
const canViewRaw = (_a = permissions == null ? void 0 : permissions.canViewRaw) != null ? _a : true;
|
|
28745
28145
|
const canEditRaw = (_b = permissions == null ? void 0 : permissions.canEditRaw) != null ? _b : false;
|
|
28746
|
-
const routes =
|
|
28146
|
+
const routes = React66.useMemo(
|
|
28747
28147
|
() => buildJsonRoutes(root, void 0, filters),
|
|
28748
28148
|
[root, filters]
|
|
28749
28149
|
);
|
|
28750
|
-
const allPaths =
|
|
28150
|
+
const allPaths = React66.useMemo(() => {
|
|
28751
28151
|
const list = collectAllPaths(root, "", []);
|
|
28752
28152
|
const seen = /* @__PURE__ */ new Set();
|
|
28753
28153
|
return list.filter((p2) => seen.has(p2) ? false : (seen.add(p2), true));
|
|
28754
28154
|
}, [root]);
|
|
28755
|
-
const computedInitialRoute =
|
|
28155
|
+
const computedInitialRoute = React66.useMemo(() => {
|
|
28756
28156
|
var _a2, _b2;
|
|
28757
28157
|
const explicit = routeProp != null ? routeProp : defaultRoute;
|
|
28758
28158
|
if (explicit !== void 0) return explicit;
|
|
@@ -28768,25 +28168,25 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28768
28168
|
defaultValue: defaultViewMode,
|
|
28769
28169
|
onChange: onViewModeChange
|
|
28770
28170
|
});
|
|
28771
|
-
|
|
28171
|
+
React66.useEffect(() => {
|
|
28772
28172
|
if (!canViewRaw && (viewMode === "raw" || viewMode === "split")) {
|
|
28773
28173
|
setViewMode("visual");
|
|
28774
28174
|
}
|
|
28775
28175
|
}, [canViewRaw, setViewMode, viewMode]);
|
|
28776
|
-
const fileInputRef =
|
|
28777
|
-
const contentRef =
|
|
28778
|
-
const [rawWidth, setRawWidth] =
|
|
28779
|
-
const [isResizing, setIsResizing] =
|
|
28780
|
-
const startXRef =
|
|
28781
|
-
const startWRef =
|
|
28782
|
-
const clampRawWidth =
|
|
28176
|
+
const fileInputRef = React66.useRef(null);
|
|
28177
|
+
const contentRef = React66.useRef(null);
|
|
28178
|
+
const [rawWidth, setRawWidth] = React66.useState(420);
|
|
28179
|
+
const [isResizing, setIsResizing] = React66.useState(false);
|
|
28180
|
+
const startXRef = React66.useRef(0);
|
|
28181
|
+
const startWRef = React66.useRef(0);
|
|
28182
|
+
const clampRawWidth = React66.useCallback((w2) => {
|
|
28783
28183
|
var _a2, _b2;
|
|
28784
28184
|
const containerW = (_b2 = (_a2 = contentRef.current) == null ? void 0 : _a2.getBoundingClientRect().width) != null ? _b2 : 0;
|
|
28785
28185
|
const min2 = 260;
|
|
28786
28186
|
const max2 = containerW ? Math.max(min2, Math.min(900, containerW - 240)) : 900;
|
|
28787
28187
|
return Math.max(min2, Math.min(max2, w2));
|
|
28788
28188
|
}, []);
|
|
28789
|
-
const onResizePointerDown =
|
|
28189
|
+
const onResizePointerDown = React66.useCallback(
|
|
28790
28190
|
(e4) => {
|
|
28791
28191
|
if (e4.button !== 0 && e4.pointerType === "mouse") return;
|
|
28792
28192
|
setIsResizing(true);
|
|
@@ -28798,7 +28198,7 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28798
28198
|
},
|
|
28799
28199
|
[rawWidth]
|
|
28800
28200
|
);
|
|
28801
|
-
const onResizePointerMove =
|
|
28201
|
+
const onResizePointerMove = React66.useCallback(
|
|
28802
28202
|
(e4) => {
|
|
28803
28203
|
if (!isResizing) return;
|
|
28804
28204
|
const dx = e4.clientX - startXRef.current;
|
|
@@ -28807,7 +28207,7 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28807
28207
|
},
|
|
28808
28208
|
[clampRawWidth, isResizing]
|
|
28809
28209
|
);
|
|
28810
|
-
const stopResizing =
|
|
28210
|
+
const stopResizing = React66.useCallback(
|
|
28811
28211
|
(e4) => {
|
|
28812
28212
|
if (!isResizing) return;
|
|
28813
28213
|
setIsResizing(false);
|
|
@@ -28818,14 +28218,14 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28818
28218
|
},
|
|
28819
28219
|
[isResizing]
|
|
28820
28220
|
);
|
|
28821
|
-
const loadFile =
|
|
28221
|
+
const loadFile = React66.useCallback(() => {
|
|
28822
28222
|
var _a2;
|
|
28823
28223
|
(_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
|
|
28824
28224
|
}, []);
|
|
28825
|
-
const close =
|
|
28225
|
+
const close = React66.useCallback(() => {
|
|
28826
28226
|
onClose == null ? void 0 : onClose();
|
|
28827
28227
|
}, [onClose]);
|
|
28828
|
-
const onFilePicked =
|
|
28228
|
+
const onFilePicked = React66.useCallback(
|
|
28829
28229
|
async (e4) => {
|
|
28830
28230
|
var _a2;
|
|
28831
28231
|
const file = (_a2 = e4.target.files) == null ? void 0 : _a2[0];
|
|
@@ -28845,7 +28245,7 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28845
28245
|
},
|
|
28846
28246
|
[callbacks, onRoot, route]
|
|
28847
28247
|
);
|
|
28848
|
-
const breadcrumb =
|
|
28248
|
+
const breadcrumb = React66.useMemo(() => {
|
|
28849
28249
|
const segs = splitPath(route);
|
|
28850
28250
|
const parts = [];
|
|
28851
28251
|
const rootNode = {
|
|
@@ -28872,7 +28272,7 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28872
28272
|
}) : prettifyLabel2(s3);
|
|
28873
28273
|
parts.push({ path: acc, label });
|
|
28874
28274
|
}
|
|
28875
|
-
return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 text-sm text-muted-foreground", children: parts.map((p2, idx) => /* @__PURE__ */ jsxs(
|
|
28275
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 text-sm text-muted-foreground", children: parts.map((p2, idx) => /* @__PURE__ */ jsxs(React66.Fragment, { children: [
|
|
28876
28276
|
/* @__PURE__ */ jsx(
|
|
28877
28277
|
Button2,
|
|
28878
28278
|
{
|
|
@@ -28887,7 +28287,7 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28887
28287
|
idx < parts.length - 1 ? /* @__PURE__ */ jsx("span", { className: "opacity-60", children: "/" }) : null
|
|
28888
28288
|
] }, p2.path || "root")) });
|
|
28889
28289
|
}, [route, routes, renderRouteLabel, setRoute]);
|
|
28890
|
-
const routeTitle =
|
|
28290
|
+
const routeTitle = React66.useMemo(() => {
|
|
28891
28291
|
if (!route) return "Config.json";
|
|
28892
28292
|
const key = lastSegment(route);
|
|
28893
28293
|
if (renderRouteLabel) {
|
|
@@ -28903,7 +28303,7 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28903
28303
|
}
|
|
28904
28304
|
return prettifyLabel2(key);
|
|
28905
28305
|
}, [route, renderRouteLabel]);
|
|
28906
|
-
const viewControls =
|
|
28306
|
+
const viewControls = React66.useMemo(() => {
|
|
28907
28307
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 rounded-md border p-1", children: [
|
|
28908
28308
|
/* @__PURE__ */ jsxs(
|
|
28909
28309
|
Button2,
|
|
@@ -28946,7 +28346,7 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28946
28346
|
) : null
|
|
28947
28347
|
] });
|
|
28948
28348
|
}, [canViewRaw, setViewMode, viewMode]);
|
|
28949
|
-
const header =
|
|
28349
|
+
const header = React66.useMemo(() => {
|
|
28950
28350
|
const ctx = {
|
|
28951
28351
|
title: /* @__PURE__ */ jsx("div", { className: "min-w-0 flex items-center gap-2", children: /* @__PURE__ */ jsx("div", { className: "truncate font-medium", children: headerTitle != null ? headerTitle : "JSON Editor" }) }),
|
|
28952
28352
|
viewControls,
|
|
@@ -28998,7 +28398,7 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28998
28398
|
showClose,
|
|
28999
28399
|
viewControls
|
|
29000
28400
|
]);
|
|
29001
|
-
const onVisualRoot =
|
|
28401
|
+
const onVisualRoot = React66.useCallback(
|
|
29002
28402
|
(nextRoot, detail) => {
|
|
29003
28403
|
onRoot(nextRoot, detail);
|
|
29004
28404
|
const d = detail;
|
|
@@ -29010,14 +28410,14 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
29010
28410
|
},
|
|
29011
28411
|
[callbacks, onRoot, route]
|
|
29012
28412
|
);
|
|
29013
|
-
const onRawRoot =
|
|
28413
|
+
const onRawRoot = React66.useCallback(
|
|
29014
28414
|
(nextRoot, detail) => {
|
|
29015
28415
|
onRoot(nextRoot, detail);
|
|
29016
28416
|
callCallbacks(callbacks, "edit-raw", nextRoot, { route, path: "" });
|
|
29017
28417
|
},
|
|
29018
28418
|
[callbacks, onRoot, route]
|
|
29019
28419
|
);
|
|
29020
|
-
|
|
28420
|
+
React66.useImperativeHandle(
|
|
29021
28421
|
ref,
|
|
29022
28422
|
() => ({
|
|
29023
28423
|
loadFile,
|
|
@@ -29139,7 +28539,7 @@ function triggerHeightCls(size) {
|
|
|
29139
28539
|
return "h-9 text-sm";
|
|
29140
28540
|
}
|
|
29141
28541
|
}
|
|
29142
|
-
var ShadcnJsonEditorVariant =
|
|
28542
|
+
var ShadcnJsonEditorVariant = React66.forwardRef(function ShadcnJsonEditorVariant2(props, ref) {
|
|
29143
28543
|
var _a;
|
|
29144
28544
|
const {
|
|
29145
28545
|
mode = "popover",
|
|
@@ -29186,15 +28586,15 @@ var ShadcnJsonEditorVariant = React11.forwardRef(function ShadcnJsonEditorVarian
|
|
|
29186
28586
|
extendBoxToControls = true,
|
|
29187
28587
|
triggerClassName
|
|
29188
28588
|
} = props;
|
|
29189
|
-
const editorRef =
|
|
29190
|
-
const root =
|
|
28589
|
+
const editorRef = React66.useRef(null);
|
|
28590
|
+
const root = React66.useMemo(() => {
|
|
29191
28591
|
if ("root" in props) return props.root;
|
|
29192
28592
|
const v2 = props.value;
|
|
29193
28593
|
if (isPlainObject6(v2)) return v2;
|
|
29194
28594
|
if (v2 == null) return {};
|
|
29195
28595
|
return {};
|
|
29196
28596
|
}, [props]);
|
|
29197
|
-
const emitRoot =
|
|
28597
|
+
const emitRoot = React66.useCallback(
|
|
29198
28598
|
(nextRoot, detail) => {
|
|
29199
28599
|
var _a2, _b;
|
|
29200
28600
|
if ("onRoot" in props) {
|
|
@@ -29205,9 +28605,9 @@ var ShadcnJsonEditorVariant = React11.forwardRef(function ShadcnJsonEditorVarian
|
|
|
29205
28605
|
},
|
|
29206
28606
|
[props]
|
|
29207
28607
|
);
|
|
29208
|
-
const [openInner, setOpenInner] =
|
|
28608
|
+
const [openInner, setOpenInner] = React66.useState(false);
|
|
29209
28609
|
const open = openProp != null ? openProp : openInner;
|
|
29210
|
-
const setOpen =
|
|
28610
|
+
const setOpen = React66.useCallback(
|
|
29211
28611
|
(next) => {
|
|
29212
28612
|
if (openProp === void 0) setOpenInner(next);
|
|
29213
28613
|
onOpenChange == null ? void 0 : onOpenChange(next);
|
|
@@ -29215,11 +28615,11 @@ var ShadcnJsonEditorVariant = React11.forwardRef(function ShadcnJsonEditorVarian
|
|
|
29215
28615
|
},
|
|
29216
28616
|
[openProp, onOpenChange, onClose]
|
|
29217
28617
|
);
|
|
29218
|
-
const close =
|
|
29219
|
-
const doOpen =
|
|
29220
|
-
const toggle =
|
|
29221
|
-
const [expanded, setExpanded] =
|
|
29222
|
-
|
|
28618
|
+
const close = React66.useCallback(() => setOpen(false), [setOpen]);
|
|
28619
|
+
const doOpen = React66.useCallback(() => setOpen(true), [setOpen]);
|
|
28620
|
+
const toggle = React66.useCallback(() => setOpen(!open), [setOpen, open]);
|
|
28621
|
+
const [expanded, setExpanded] = React66.useState();
|
|
28622
|
+
React66.useImperativeHandle(
|
|
29223
28623
|
ref,
|
|
29224
28624
|
() => ({
|
|
29225
28625
|
open: doOpen,
|
|
@@ -30616,19 +30016,19 @@ function createListerRuntime(opts) {
|
|
|
30616
30016
|
selectors
|
|
30617
30017
|
};
|
|
30618
30018
|
}
|
|
30619
|
-
var ListerContext =
|
|
30019
|
+
var ListerContext = React66.createContext(
|
|
30620
30020
|
null
|
|
30621
30021
|
);
|
|
30622
30022
|
function ListerProvider({
|
|
30623
30023
|
children,
|
|
30624
30024
|
...opts
|
|
30625
30025
|
}) {
|
|
30626
|
-
const runtimeRef =
|
|
30627
|
-
const [, forceUpdate] =
|
|
30026
|
+
const runtimeRef = React66.useRef(null);
|
|
30027
|
+
const [, forceUpdate] = React66.useReducer((x2) => x2 + 1, 0);
|
|
30628
30028
|
if (!runtimeRef.current) {
|
|
30629
30029
|
runtimeRef.current = createListerRuntime(opts);
|
|
30630
30030
|
}
|
|
30631
|
-
|
|
30031
|
+
React66.useEffect(() => {
|
|
30632
30032
|
const runtime = runtimeRef.current;
|
|
30633
30033
|
if (!runtime) return;
|
|
30634
30034
|
const unsub = runtime.subscribe(() => {
|
|
@@ -30639,7 +30039,7 @@ function ListerProvider({
|
|
|
30639
30039
|
return /* @__PURE__ */ jsx(ListerContext.Provider, { value: runtimeRef.current, children });
|
|
30640
30040
|
}
|
|
30641
30041
|
function useListerRuntime() {
|
|
30642
|
-
const ctx =
|
|
30042
|
+
const ctx = React66.useContext(ListerContext);
|
|
30643
30043
|
if (!ctx)
|
|
30644
30044
|
throw new Error(
|
|
30645
30045
|
"useListerRuntime must be used within <ListerProvider>"
|
|
@@ -30676,14 +30076,14 @@ function ListerFiltersButton(props) {
|
|
|
30676
30076
|
const hasFilters = options.length > 0;
|
|
30677
30077
|
if (!hasFilters) return null;
|
|
30678
30078
|
const ctx = actions.getFilterCtx(id);
|
|
30679
|
-
const [openGroups, setOpenGroups] =
|
|
30079
|
+
const [openGroups, setOpenGroups] = React66.useState(
|
|
30680
30080
|
{}
|
|
30681
30081
|
);
|
|
30682
30082
|
const toggleGroup = (key) => {
|
|
30683
30083
|
setOpenGroups((m2) => ({ ...m2, [key]: !m2[key] }));
|
|
30684
30084
|
};
|
|
30685
30085
|
const selectedIds = asArray(session == null ? void 0 : session.selectedFilterValues);
|
|
30686
|
-
const appliedCount =
|
|
30086
|
+
const appliedCount = React66.useMemo(() => {
|
|
30687
30087
|
var _a2;
|
|
30688
30088
|
const patch = (_a2 = session == null ? void 0 : session.filtersPatch) != null ? _a2 : {};
|
|
30689
30089
|
return Object.keys(patch).length;
|
|
@@ -31194,7 +30594,7 @@ function normalizeIconifyInput(icon) {
|
|
|
31194
30594
|
}
|
|
31195
30595
|
function OptionIcon(props) {
|
|
31196
30596
|
const { icon, className } = props;
|
|
31197
|
-
if (
|
|
30597
|
+
if (React66.isValidElement(icon)) {
|
|
31198
30598
|
return /* @__PURE__ */ jsx("span", { className: cn("shrink-0", className), children: icon });
|
|
31199
30599
|
}
|
|
31200
30600
|
if (isSvgSnippetString(icon)) {
|
|
@@ -31247,7 +30647,7 @@ function OptionList(props) {
|
|
|
31247
30647
|
const options = (_a = selectors.visibleOptions(id)) != null ? _a : [];
|
|
31248
30648
|
const draft = s3 == null ? void 0 : s3.draftValue;
|
|
31249
30649
|
const isMulti = (s3 == null ? void 0 : s3.mode) === "multiple";
|
|
31250
|
-
const isSelected =
|
|
30650
|
+
const isSelected = React66.useCallback(
|
|
31251
30651
|
(value) => {
|
|
31252
30652
|
if (isMulti) return Array.isArray(draft) && draft.includes(value);
|
|
31253
30653
|
return draft === value;
|
|
@@ -31314,13 +30714,13 @@ function OptionList(props) {
|
|
|
31314
30714
|
}
|
|
31315
30715
|
function useLister() {
|
|
31316
30716
|
const runtime = useListerRuntime();
|
|
31317
|
-
const [state, setState] =
|
|
31318
|
-
|
|
30717
|
+
const [state, setState] = React66.useState(runtime.getState());
|
|
30718
|
+
React66.useEffect(() => {
|
|
31319
30719
|
return runtime.subscribe(() => {
|
|
31320
30720
|
setState(runtime.getState());
|
|
31321
30721
|
});
|
|
31322
30722
|
}, [runtime]);
|
|
31323
|
-
return
|
|
30723
|
+
return React66.useMemo(
|
|
31324
30724
|
() => ({
|
|
31325
30725
|
api: runtime.api,
|
|
31326
30726
|
actions: runtime.actions,
|
|
@@ -31659,25 +31059,25 @@ function ListerInner(props) {
|
|
|
31659
31059
|
panelClassName
|
|
31660
31060
|
} = props;
|
|
31661
31061
|
const { api, actions, store } = useLister();
|
|
31662
|
-
const ownerKeyRef =
|
|
31062
|
+
const ownerKeyRef = React66.useRef(
|
|
31663
31063
|
(_a = openOptions == null ? void 0 : openOptions.ownerKey) != null ? _a : createRuntimeKey("lister_owner")
|
|
31664
31064
|
);
|
|
31665
|
-
|
|
31065
|
+
React66.useEffect(() => {
|
|
31666
31066
|
const next = openOptions == null ? void 0 : openOptions.ownerKey;
|
|
31667
31067
|
if (next) ownerKeyRef.current = next;
|
|
31668
31068
|
}, [openOptions]);
|
|
31669
31069
|
const session = findSessionByOwner(store, ownerKeyRef.current);
|
|
31670
31070
|
const sessionId = session == null ? void 0 : session.sessionId;
|
|
31671
31071
|
const isOpen = !!(session == null ? void 0 : session.isOpen);
|
|
31672
|
-
const [selectedOptions, setSelectedOptions] =
|
|
31072
|
+
const [selectedOptions, setSelectedOptions] = React66.useState(
|
|
31673
31073
|
null
|
|
31674
31074
|
);
|
|
31675
|
-
const openingRef =
|
|
31075
|
+
const openingRef = React66.useRef(false);
|
|
31676
31076
|
const mode = modeProp != null ? modeProp : "single";
|
|
31677
31077
|
const confirm = mode === "multiple" ? true : !!confirmProp;
|
|
31678
31078
|
const disabledTrigger = !!(disabled || readOnly);
|
|
31679
31079
|
const hasValue = mode === "multiple" ? Array.isArray(value) && value.length > 0 : value != null && value !== "";
|
|
31680
|
-
|
|
31080
|
+
React66.useEffect(() => {
|
|
31681
31081
|
if (!hasValue) {
|
|
31682
31082
|
setSelectedOptions(null);
|
|
31683
31083
|
return;
|
|
@@ -31713,7 +31113,7 @@ function ListerInner(props) {
|
|
|
31713
31113
|
alive = false;
|
|
31714
31114
|
};
|
|
31715
31115
|
}, [api, def, filters, mode, value, hasValue]);
|
|
31716
|
-
const openSession =
|
|
31116
|
+
const openSession = React66.useCallback(async () => {
|
|
31717
31117
|
var _a2, _b2;
|
|
31718
31118
|
console.log(openingRef.current);
|
|
31719
31119
|
if (disabledTrigger) return;
|
|
@@ -31754,7 +31154,7 @@ function ListerInner(props) {
|
|
|
31754
31154
|
permissions,
|
|
31755
31155
|
value
|
|
31756
31156
|
]);
|
|
31757
|
-
const clear =
|
|
31157
|
+
const clear = React66.useCallback(() => {
|
|
31758
31158
|
if (disabledTrigger) return;
|
|
31759
31159
|
onValue(void 0, {
|
|
31760
31160
|
action: "clear",
|
|
@@ -31762,7 +31162,7 @@ function ListerInner(props) {
|
|
|
31762
31162
|
});
|
|
31763
31163
|
setSelectedOptions(null);
|
|
31764
31164
|
}, [disabledTrigger, onValue]);
|
|
31765
|
-
const display =
|
|
31165
|
+
const display = React66.useMemo(() => {
|
|
31766
31166
|
return buildLabelsFromOptions({
|
|
31767
31167
|
mode,
|
|
31768
31168
|
value,
|
|
@@ -31771,7 +31171,7 @@ function ListerInner(props) {
|
|
|
31771
31171
|
maxItems: maxDisplayItems
|
|
31772
31172
|
});
|
|
31773
31173
|
}, [maxDisplayItems, mode, placeholder, selectedOptions, value]);
|
|
31774
|
-
const triggerCtx =
|
|
31174
|
+
const triggerCtx = React66.useMemo(
|
|
31775
31175
|
() => ({
|
|
31776
31176
|
mode,
|
|
31777
31177
|
value,
|
|
@@ -31897,7 +31297,7 @@ function ListerInner(props) {
|
|
|
31897
31297
|
}
|
|
31898
31298
|
);
|
|
31899
31299
|
const userTriggerEl = renderTrigger ? renderTrigger(triggerCtx) : null;
|
|
31900
|
-
const TriggerNode = renderTrigger &&
|
|
31300
|
+
const TriggerNode = renderTrigger && React66.isValidElement(userTriggerEl) ? React66.cloneElement(userTriggerEl, {
|
|
31901
31301
|
className: cn(
|
|
31902
31302
|
(_b = userTriggerEl.props) == null ? void 0 : _b.className,
|
|
31903
31303
|
className
|
|
@@ -32123,11 +31523,11 @@ function ListerResolvedInner(props) {
|
|
|
32123
31523
|
} = props;
|
|
32124
31524
|
const isStandaloneInline = !def && endpoint != null;
|
|
32125
31525
|
const shouldInferOptionValue = isStandaloneInline && optionValue === void 0;
|
|
32126
|
-
const [resolvedOptionValue, setResolvedOptionValue] =
|
|
32127
|
-
|
|
31526
|
+
const [resolvedOptionValue, setResolvedOptionValue] = React66.useState(() => optionValue != null ? optionValue : "id");
|
|
31527
|
+
React66.useEffect(() => {
|
|
32128
31528
|
if (optionValue !== void 0) setResolvedOptionValue(optionValue);
|
|
32129
31529
|
}, [optionValue]);
|
|
32130
|
-
|
|
31530
|
+
React66.useEffect(() => {
|
|
32131
31531
|
if (!shouldInferOptionValue) return;
|
|
32132
31532
|
if (!endpoint) return;
|
|
32133
31533
|
let alive = true;
|
|
@@ -32179,7 +31579,7 @@ function ListerResolvedInner(props) {
|
|
|
32179
31579
|
const inlineExists = endpoint !== void 0 || method !== void 0 || buildRequest !== void 0 || selector !== void 0 || resolvedOptionValue !== void 0 || // ✅ KEEP THIS (your rule)
|
|
32180
31580
|
optionLabel !== void 0 || optionIcon !== void 0 || optionDescription !== void 0 || optionDisabled !== void 0 || optionGroup !== void 0 || optionMeta !== void 0 || // ✅ include search override as "inline patch" signal too
|
|
32181
31581
|
search !== void 0;
|
|
32182
|
-
const finalDef =
|
|
31582
|
+
const finalDef = React66.useMemo(() => {
|
|
32183
31583
|
const baseDef = def;
|
|
32184
31584
|
if (!inlineExists) return baseDef;
|
|
32185
31585
|
if (!baseDef) {
|
|
@@ -32234,7 +31634,7 @@ function ListerResolvedInner(props) {
|
|
|
32234
31634
|
optionMeta,
|
|
32235
31635
|
search
|
|
32236
31636
|
]);
|
|
32237
|
-
const openOptions =
|
|
31637
|
+
const openOptions = React66.useMemo(() => {
|
|
32238
31638
|
return {
|
|
32239
31639
|
title,
|
|
32240
31640
|
searchMode,
|
|
@@ -32488,24 +31888,24 @@ function IconPickerPanel(props) {
|
|
|
32488
31888
|
maxRender = 2500
|
|
32489
31889
|
} = props;
|
|
32490
31890
|
const den = densityTokens2(density);
|
|
32491
|
-
const groups =
|
|
31891
|
+
const groups = React66.useMemo(() => {
|
|
32492
31892
|
const base = groupsProp != null ? groupsProp : [];
|
|
32493
31893
|
if (!(allowedGroupIds == null ? void 0 : allowedGroupIds.length)) return base;
|
|
32494
31894
|
const allowed = base.filter((g2) => allowedGroupIds.includes(g2.id));
|
|
32495
31895
|
return allowed.length ? allowed : base;
|
|
32496
31896
|
}, [allowedGroupIds, groupsProp]);
|
|
32497
|
-
const prefixes =
|
|
31897
|
+
const prefixes = React66.useMemo(() => {
|
|
32498
31898
|
return uniq2(groups.flatMap((g2) => g2.prefixes).filter(Boolean));
|
|
32499
31899
|
}, [groups]);
|
|
32500
|
-
const [selectedGroupId, setSelectedGroupId] =
|
|
31900
|
+
const [selectedGroupId, setSelectedGroupId] = React66.useState(() => {
|
|
32501
31901
|
var _a;
|
|
32502
31902
|
return (_a = groups[0]) == null ? void 0 : _a.id;
|
|
32503
31903
|
});
|
|
32504
|
-
const [searchQuery, setSearchQuery] =
|
|
32505
|
-
const [loading, setLoading] =
|
|
32506
|
-
const [error, setError] =
|
|
32507
|
-
const [allIcons, setAllIcons] =
|
|
32508
|
-
|
|
31904
|
+
const [searchQuery, setSearchQuery] = React66.useState("");
|
|
31905
|
+
const [loading, setLoading] = React66.useState(false);
|
|
31906
|
+
const [error, setError] = React66.useState(null);
|
|
31907
|
+
const [allIcons, setAllIcons] = React66.useState([]);
|
|
31908
|
+
React66.useEffect(() => {
|
|
32509
31909
|
setSelectedGroupId((prev) => {
|
|
32510
31910
|
var _a, _b;
|
|
32511
31911
|
if (!prev) return (_a = groups[0]) == null ? void 0 : _a.id;
|
|
@@ -32513,7 +31913,7 @@ function IconPickerPanel(props) {
|
|
|
32513
31913
|
return exists ? prev : (_b = groups[0]) == null ? void 0 : _b.id;
|
|
32514
31914
|
});
|
|
32515
31915
|
}, [groups]);
|
|
32516
|
-
|
|
31916
|
+
React66.useEffect(() => {
|
|
32517
31917
|
const controller = new AbortController();
|
|
32518
31918
|
let mounted = true;
|
|
32519
31919
|
const load = async () => {
|
|
@@ -32555,15 +31955,15 @@ function IconPickerPanel(props) {
|
|
|
32555
31955
|
controller.abort();
|
|
32556
31956
|
};
|
|
32557
31957
|
}, [prefixes, url]);
|
|
32558
|
-
const selectedGroup =
|
|
31958
|
+
const selectedGroup = React66.useMemo(
|
|
32559
31959
|
() => groups.find((g2) => g2.id === selectedGroupId),
|
|
32560
31960
|
[groups, selectedGroupId]
|
|
32561
31961
|
);
|
|
32562
|
-
const selectedGroupPrefixes =
|
|
31962
|
+
const selectedGroupPrefixes = React66.useMemo(() => {
|
|
32563
31963
|
if (!selectedGroup) return void 0;
|
|
32564
31964
|
return new Set(selectedGroup.prefixes);
|
|
32565
31965
|
}, [selectedGroup]);
|
|
32566
|
-
const filteredIcons =
|
|
31966
|
+
const filteredIcons = React66.useMemo(() => {
|
|
32567
31967
|
const q2 = searchQuery.trim().toLowerCase();
|
|
32568
31968
|
let list = allIcons;
|
|
32569
31969
|
if (selectedGroupPrefixes) {
|
|
@@ -32579,7 +31979,7 @@ function IconPickerPanel(props) {
|
|
|
32579
31979
|
}
|
|
32580
31980
|
return list;
|
|
32581
31981
|
}, [allIcons, searchQuery, selectedGroupPrefixes]);
|
|
32582
|
-
const limitedIcons =
|
|
31982
|
+
const limitedIcons = React66.useMemo(() => {
|
|
32583
31983
|
if (filteredIcons.length <= maxRender) return filteredIcons;
|
|
32584
31984
|
return filteredIcons.slice(0, maxRender);
|
|
32585
31985
|
}, [filteredIcons, maxRender]);
|
|
@@ -32593,7 +31993,7 @@ function IconPickerPanel(props) {
|
|
|
32593
31993
|
value.includes(iconName) ? value.filter((x2) => x2 !== iconName) : [...value, iconName]
|
|
32594
31994
|
);
|
|
32595
31995
|
};
|
|
32596
|
-
const GridComponents =
|
|
31996
|
+
const GridComponents = React66.useMemo(
|
|
32597
31997
|
() => ({
|
|
32598
31998
|
List: (p2) => /* @__PURE__ */ jsx(
|
|
32599
31999
|
"div",
|
|
@@ -32606,7 +32006,7 @@ function IconPickerPanel(props) {
|
|
|
32606
32006
|
}),
|
|
32607
32007
|
[]
|
|
32608
32008
|
);
|
|
32609
|
-
const gridHeightStyle =
|
|
32009
|
+
const gridHeightStyle = React66.useMemo(
|
|
32610
32010
|
() => ({ height: "50vh" }),
|
|
32611
32011
|
[]
|
|
32612
32012
|
);
|
|
@@ -32731,7 +32131,7 @@ function IconPickerPanel(props) {
|
|
|
32731
32131
|
)
|
|
32732
32132
|
] });
|
|
32733
32133
|
}
|
|
32734
|
-
var ShadcnIconVariant =
|
|
32134
|
+
var ShadcnIconVariant = React66.forwardRef(function ShadcnIconVariant2(props, ref) {
|
|
32735
32135
|
var _a, _b;
|
|
32736
32136
|
const {
|
|
32737
32137
|
value,
|
|
@@ -32783,12 +32183,12 @@ var ShadcnIconVariant = React11.forwardRef(function ShadcnIconVariant2(props, re
|
|
|
32783
32183
|
const resolvedLeadingIcons = (leadingIcons == null ? void 0 : leadingIcons.length) ? leadingIcons : icon ? [icon] : [];
|
|
32784
32184
|
const resolvedTrailingIcons = (trailingIcons == null ? void 0 : trailingIcons.length) ? trailingIcons : [];
|
|
32785
32185
|
const hasExternalControls = !!leadingControl || !!trailingControl;
|
|
32786
|
-
const [popoverOpen, setPopoverOpen] =
|
|
32787
|
-
const selected =
|
|
32186
|
+
const [popoverOpen, setPopoverOpen] = React66.useState(false);
|
|
32187
|
+
const selected = React66.useMemo(() => {
|
|
32788
32188
|
if (multiple) return Array.isArray(value) ? value.filter(Boolean) : [];
|
|
32789
32189
|
return typeof value === "string" && value ? [value] : [];
|
|
32790
32190
|
}, [multiple, value]);
|
|
32791
|
-
const emit =
|
|
32191
|
+
const emit = React66.useCallback(
|
|
32792
32192
|
(nextArr, meta) => {
|
|
32793
32193
|
var _a2, _b2;
|
|
32794
32194
|
if (!onValue) return;
|
|
@@ -32810,7 +32210,7 @@ var ShadcnIconVariant = React11.forwardRef(function ShadcnIconVariant2(props, re
|
|
|
32810
32210
|
},
|
|
32811
32211
|
[multiple, onValue]
|
|
32812
32212
|
);
|
|
32813
|
-
const Chip =
|
|
32213
|
+
const Chip = React66.useCallback(
|
|
32814
32214
|
({ iconName }) => {
|
|
32815
32215
|
var _a2;
|
|
32816
32216
|
const short = (_a2 = iconName.split(":")[1]) != null ? _a2 : iconName;
|
|
@@ -32873,7 +32273,7 @@ var ShadcnIconVariant = React11.forwardRef(function ShadcnIconVariant2(props, re
|
|
|
32873
32273
|
[chipHeightCls, den.chipGap, den.chipPad, emit, selected]
|
|
32874
32274
|
);
|
|
32875
32275
|
const selectedCount = selected.length;
|
|
32876
|
-
const resolveButtonTriggerElement =
|
|
32276
|
+
const resolveButtonTriggerElement = React66.useCallback(() => {
|
|
32877
32277
|
const ctx = {
|
|
32878
32278
|
open: popoverOpen,
|
|
32879
32279
|
items: selected,
|
|
@@ -32903,7 +32303,7 @@ var ShadcnIconVariant = React11.forwardRef(function ShadcnIconVariant2(props, re
|
|
|
32903
32303
|
);
|
|
32904
32304
|
const child = el.props.children;
|
|
32905
32305
|
if (selectedBadgePlacement === "end") {
|
|
32906
|
-
return
|
|
32306
|
+
return React66.cloneElement(el, {
|
|
32907
32307
|
className: nextClass,
|
|
32908
32308
|
children: /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2", children: [
|
|
32909
32309
|
/* @__PURE__ */ jsx("span", { className: "min-w-0", children: child }),
|
|
@@ -32911,7 +32311,7 @@ var ShadcnIconVariant = React11.forwardRef(function ShadcnIconVariant2(props, re
|
|
|
32911
32311
|
] })
|
|
32912
32312
|
});
|
|
32913
32313
|
}
|
|
32914
|
-
return
|
|
32314
|
+
return React66.cloneElement(el, {
|
|
32915
32315
|
className: nextClass,
|
|
32916
32316
|
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
32917
32317
|
child,
|
|
@@ -32919,7 +32319,7 @@ var ShadcnIconVariant = React11.forwardRef(function ShadcnIconVariant2(props, re
|
|
|
32919
32319
|
] })
|
|
32920
32320
|
});
|
|
32921
32321
|
};
|
|
32922
|
-
const withNoopDnD = (el) =>
|
|
32322
|
+
const withNoopDnD = (el) => React66.cloneElement(el, {
|
|
32923
32323
|
// keep event-merging parity with file variant (no-op, but safe)
|
|
32924
32324
|
onDragOver: mergeHandlers2(
|
|
32925
32325
|
el.props.onDragOver,
|
|
@@ -32936,7 +32336,7 @@ var ShadcnIconVariant = React11.forwardRef(function ShadcnIconVariant2(props, re
|
|
|
32936
32336
|
}
|
|
32937
32337
|
)
|
|
32938
32338
|
});
|
|
32939
|
-
if (
|
|
32339
|
+
if (React66.isValidElement(rawNode))
|
|
32940
32340
|
return withNoopDnD(injectBadgeIntoElement(rawNode));
|
|
32941
32341
|
const fallback = /* @__PURE__ */ jsxs(
|
|
32942
32342
|
"button",
|
|
@@ -32984,7 +32384,7 @@ var ShadcnIconVariant = React11.forwardRef(function ShadcnIconVariant2(props, re
|
|
|
32984
32384
|
triggerClassName
|
|
32985
32385
|
]);
|
|
32986
32386
|
const COLLAPSE_LIMIT = 2;
|
|
32987
|
-
const TriggerRegion =
|
|
32387
|
+
const TriggerRegion = React66.useMemo(() => {
|
|
32988
32388
|
const hasItems = selected.length > 0;
|
|
32989
32389
|
const visibleItems = selected.slice(0, COLLAPSE_LIMIT);
|
|
32990
32390
|
const hiddenCount = selected.length - COLLAPSE_LIMIT;
|
|
@@ -33356,8 +32756,8 @@ function isFileLikeString(s3) {
|
|
|
33356
32756
|
return FILE_EXT_RE.test(v2);
|
|
33357
32757
|
}
|
|
33358
32758
|
function useImagePreview(value) {
|
|
33359
|
-
const [src, setSrc] =
|
|
33360
|
-
|
|
32759
|
+
const [src, setSrc] = React66.useState(null);
|
|
32760
|
+
React66.useEffect(() => {
|
|
33361
32761
|
if (!value) {
|
|
33362
32762
|
setSrc(null);
|
|
33363
32763
|
return;
|
|
@@ -33375,7 +32775,7 @@ var ImageThumb = ({ image }) => {
|
|
|
33375
32775
|
const src = useImagePreview(image);
|
|
33376
32776
|
return /* @__PURE__ */ jsx("div", { className: "relative flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-sm border bg-muted/50", children: src ? /* @__PURE__ */ jsx("img", { src, alt: "", className: "h-full w-full object-cover" }) : /* @__PURE__ */ jsx(Image, { className: "h-4 w-4 text-muted-foreground/50" }) });
|
|
33377
32777
|
};
|
|
33378
|
-
var ShadcnImageIconVariant =
|
|
32778
|
+
var ShadcnImageIconVariant = React66.forwardRef(function ShadcnImageIconVariant2(props, ref) {
|
|
33379
32779
|
const {
|
|
33380
32780
|
value,
|
|
33381
32781
|
onValue,
|
|
@@ -33432,7 +32832,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33432
32832
|
const regIcon = getPaletteUtil("iconPicker");
|
|
33433
32833
|
const resolvedIconUrl = iconUrl != null ? iconUrl : regIcon == null ? void 0 : regIcon.url;
|
|
33434
32834
|
const resolvedIconGroups = iconGroups != null ? iconGroups : regIcon == null ? void 0 : regIcon.groups;
|
|
33435
|
-
const effectiveIconGroups =
|
|
32835
|
+
const effectiveIconGroups = React66.useMemo(() => {
|
|
33436
32836
|
const groups = resolvedIconGroups != null ? resolvedIconGroups : DEFAULT_GROUPS;
|
|
33437
32837
|
const allowed = toArray(allowedIconGroupIds).filter(
|
|
33438
32838
|
Boolean
|
|
@@ -33441,7 +32841,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33441
32841
|
const filtered = groups.filter((g2) => allowed.includes(g2.id));
|
|
33442
32842
|
return filtered.length ? filtered : groups;
|
|
33443
32843
|
}, [resolvedIconGroups, allowedIconGroupIds]);
|
|
33444
|
-
const allowedIconPrefixes =
|
|
32844
|
+
const allowedIconPrefixes = React66.useMemo(() => {
|
|
33445
32845
|
var _a;
|
|
33446
32846
|
const set = /* @__PURE__ */ new Set();
|
|
33447
32847
|
for (const g2 of effectiveIconGroups) {
|
|
@@ -33449,7 +32849,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33449
32849
|
}
|
|
33450
32850
|
return set;
|
|
33451
32851
|
}, [effectiveIconGroups]);
|
|
33452
|
-
const isIconString =
|
|
32852
|
+
const isIconString = React66.useCallback(
|
|
33453
32853
|
(raw) => {
|
|
33454
32854
|
var _a;
|
|
33455
32855
|
const s3 = raw.trim();
|
|
@@ -33461,7 +32861,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33461
32861
|
},
|
|
33462
32862
|
[allowedIconPrefixes]
|
|
33463
32863
|
);
|
|
33464
|
-
const normaliseImageIconInput =
|
|
32864
|
+
const normaliseImageIconInput = React66.useCallback(
|
|
33465
32865
|
(v2) => {
|
|
33466
32866
|
var _a;
|
|
33467
32867
|
if (v2 == null) return null;
|
|
@@ -33502,25 +32902,25 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33502
32902
|
const resolvedLeadingIcons = (leadingIcons == null ? void 0 : leadingIcons.length) ? leadingIcons : icon ? [icon] : [];
|
|
33503
32903
|
const resolvedTrailingIcons = (trailingIcons == null ? void 0 : trailingIcons.length) ? trailingIcons : [];
|
|
33504
32904
|
const hasExternalControls = !!leadingControl || !!trailingControl;
|
|
33505
|
-
const [popoverOpen, setPopoverOpen] =
|
|
33506
|
-
const [tab, setTab] =
|
|
33507
|
-
const list =
|
|
32905
|
+
const [popoverOpen, setPopoverOpen] = React66.useState(false);
|
|
32906
|
+
const [tab, setTab] = React66.useState("icon");
|
|
32907
|
+
const list = React66.useMemo(() => {
|
|
33508
32908
|
const raw = multiple ? toArray(value) : value != null ? [value] : [];
|
|
33509
32909
|
return raw.map(normaliseImageIconInput).filter(Boolean);
|
|
33510
32910
|
}, [multiple, normaliseImageIconInput, value]);
|
|
33511
|
-
const iconsSelected =
|
|
32911
|
+
const iconsSelected = React66.useMemo(() => {
|
|
33512
32912
|
return list.filter((x2) => x2.kind === "icon").map((x2) => x2.icon);
|
|
33513
32913
|
}, [list]);
|
|
33514
|
-
const imagesSelected =
|
|
32914
|
+
const imagesSelected = React66.useMemo(() => {
|
|
33515
32915
|
return list.filter((x2) => x2.kind === "image");
|
|
33516
32916
|
}, [list]);
|
|
33517
|
-
const toFieldRaw =
|
|
32917
|
+
const toFieldRaw = React66.useCallback(
|
|
33518
32918
|
(x2) => {
|
|
33519
32919
|
return x2.kind === "icon" ? x2.icon : x2.image;
|
|
33520
32920
|
},
|
|
33521
32921
|
[]
|
|
33522
32922
|
);
|
|
33523
|
-
const emit =
|
|
32923
|
+
const emit = React66.useCallback(
|
|
33524
32924
|
(nextList, meta) => {
|
|
33525
32925
|
var _a, _b;
|
|
33526
32926
|
if (!onValue) return;
|
|
@@ -33549,7 +32949,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33549
32949
|
emit(next, { action: "remove", index: idx });
|
|
33550
32950
|
};
|
|
33551
32951
|
const clearAll = () => emit([], { action: "clear" });
|
|
33552
|
-
const Chip =
|
|
32952
|
+
const Chip = React66.useCallback(
|
|
33553
32953
|
({ item, index }) => {
|
|
33554
32954
|
var _a, _b, _c;
|
|
33555
32955
|
const label = item.kind === "icon" ? (_a = item.icon.split(":")[1]) != null ? _a : item.icon : (_c = item.name) != null ? _c : typeof item.image === "string" ? (_b = item.image.split(/[\\/]/).pop()) != null ? _b : item.image : item.image.name;
|
|
@@ -33600,7 +33000,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33600
33000
|
[chipHeightCls, den.chipGap, den.chipPad, removeAt]
|
|
33601
33001
|
);
|
|
33602
33002
|
const selectedCount = list.length;
|
|
33603
|
-
const resolveButtonTriggerElement =
|
|
33003
|
+
const resolveButtonTriggerElement = React66.useCallback(() => {
|
|
33604
33004
|
const ctx = {
|
|
33605
33005
|
open: popoverOpen,
|
|
33606
33006
|
items: list,
|
|
@@ -33630,7 +33030,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33630
33030
|
);
|
|
33631
33031
|
const child = el.props.children;
|
|
33632
33032
|
if (selectedBadgePlacement === "end") {
|
|
33633
|
-
return
|
|
33033
|
+
return React66.cloneElement(el, {
|
|
33634
33034
|
className: nextClass,
|
|
33635
33035
|
children: /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2", children: [
|
|
33636
33036
|
/* @__PURE__ */ jsx("span", { className: "min-w-0", children: child }),
|
|
@@ -33638,7 +33038,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33638
33038
|
] })
|
|
33639
33039
|
});
|
|
33640
33040
|
}
|
|
33641
|
-
return
|
|
33041
|
+
return React66.cloneElement(el, {
|
|
33642
33042
|
className: nextClass,
|
|
33643
33043
|
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
33644
33044
|
child,
|
|
@@ -33646,7 +33046,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33646
33046
|
] })
|
|
33647
33047
|
});
|
|
33648
33048
|
};
|
|
33649
|
-
if (
|
|
33049
|
+
if (React66.isValidElement(rawNode))
|
|
33650
33050
|
return injectBadgeIntoElement(rawNode);
|
|
33651
33051
|
return /* @__PURE__ */ jsxs(
|
|
33652
33052
|
"button",
|
|
@@ -33678,12 +33078,12 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33678
33078
|
selectedCount,
|
|
33679
33079
|
triggerClassName
|
|
33680
33080
|
]);
|
|
33681
|
-
const [dragOver, setDragOver] =
|
|
33682
|
-
const fileInputRef =
|
|
33683
|
-
const [imgSelectedIds, setImgSelectedIds] =
|
|
33081
|
+
const [dragOver, setDragOver] = React66.useState(false);
|
|
33082
|
+
const fileInputRef = React66.useRef(null);
|
|
33083
|
+
const [imgSelectedIds, setImgSelectedIds] = React66.useState(
|
|
33684
33084
|
() => /* @__PURE__ */ new Set()
|
|
33685
33085
|
);
|
|
33686
|
-
const imageItems =
|
|
33086
|
+
const imageItems = React66.useMemo(() => {
|
|
33687
33087
|
return imagesSelected.map((x2) => normaliseFileLike2(x2.image));
|
|
33688
33088
|
}, [imagesSelected]);
|
|
33689
33089
|
const canAddMore = (nextCount) => {
|
|
@@ -33746,7 +33146,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33746
33146
|
setImagesFromItems(next, { from });
|
|
33747
33147
|
}
|
|
33748
33148
|
};
|
|
33749
|
-
const openImagePicker =
|
|
33149
|
+
const openImagePicker = React66.useCallback(async () => {
|
|
33750
33150
|
var _a;
|
|
33751
33151
|
if (isDisabled) return;
|
|
33752
33152
|
const resolvedLoader = typeof customLoader == "function" ? customLoader : customLoader ? getPaletteUtil("customLoader") : void 0;
|
|
@@ -33771,14 +33171,14 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33771
33171
|
}
|
|
33772
33172
|
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
33773
33173
|
}, [accept, customLoader, imageItems, isDisabled, mergeMode, multiple]);
|
|
33774
|
-
const onDragOver =
|
|
33174
|
+
const onDragOver = React66.useCallback(
|
|
33775
33175
|
(e4) => {
|
|
33776
33176
|
e4.preventDefault();
|
|
33777
33177
|
if (!isDisabled) setDragOver(true);
|
|
33778
33178
|
},
|
|
33779
33179
|
[isDisabled]
|
|
33780
33180
|
);
|
|
33781
|
-
const onDrop =
|
|
33181
|
+
const onDrop = React66.useCallback(
|
|
33782
33182
|
(e4) => {
|
|
33783
33183
|
var _a;
|
|
33784
33184
|
e4.preventDefault();
|
|
@@ -33827,7 +33227,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33827
33227
|
if (icons[0]) setPopoverOpen(false);
|
|
33828
33228
|
}
|
|
33829
33229
|
};
|
|
33830
|
-
const TriggerRegion =
|
|
33230
|
+
const TriggerRegion = React66.useMemo(() => {
|
|
33831
33231
|
const COLLAPSE_LIMIT = 2;
|
|
33832
33232
|
const hasItems = list.length > 0;
|
|
33833
33233
|
const visibleItems = list.slice(0, COLLAPSE_LIMIT);
|
|
@@ -34745,7 +34145,7 @@ function InputField(props) {
|
|
|
34745
34145
|
return null;
|
|
34746
34146
|
}
|
|
34747
34147
|
const classes = getClasses(props);
|
|
34748
|
-
const layout =
|
|
34148
|
+
const layout = React66.useMemo(() => {
|
|
34749
34149
|
var _a2;
|
|
34750
34150
|
const defaultsLayout = (_a2 = module2.defaults) == null ? void 0 : _a2.layout;
|
|
34751
34151
|
const overrides = {};
|
|
@@ -34793,7 +34193,7 @@ function InputField(props) {
|
|
|
34793
34193
|
]);
|
|
34794
34194
|
const effectiveSize = (_c = size != null ? size : (_b = (_a = module2.defaults) == null ? void 0 : _a.layout) == null ? void 0 : _b.defaultSize) != null ? _c : void 0;
|
|
34795
34195
|
const effectiveDensity = (_f = density != null ? density : (_e = (_d = module2.defaults) == null ? void 0 : _d.layout) == null ? void 0 : _e.defaultDensity) != null ? _f : void 0;
|
|
34796
|
-
const validate =
|
|
34196
|
+
const validate = React66.useCallback(
|
|
34797
34197
|
(value2, field2, form, _report) => {
|
|
34798
34198
|
var _a2;
|
|
34799
34199
|
const messages = [];
|
|
@@ -34833,7 +34233,7 @@ function InputField(props) {
|
|
|
34833
34233
|
const { value: fieldValue, setValue, error, ref, key } = field;
|
|
34834
34234
|
const Variant = module2.Variant;
|
|
34835
34235
|
const visualError = (errorText != null ? errorText : error) || "";
|
|
34836
|
-
const handleValueChange =
|
|
34236
|
+
const handleValueChange = React66.useCallback(
|
|
34837
34237
|
(next, detail) => {
|
|
34838
34238
|
let finalValue = next;
|
|
34839
34239
|
let defaultPrevented = false;
|
|
@@ -34882,7 +34282,7 @@ function InputField(props) {
|
|
|
34882
34282
|
hostVariantClass,
|
|
34883
34283
|
classes == null ? void 0 : classes.variant
|
|
34884
34284
|
) || void 0;
|
|
34885
|
-
const tagsContent =
|
|
34285
|
+
const tagsContent = React66.useMemo(() => {
|
|
34886
34286
|
const items = tags != null ? tags : [];
|
|
34887
34287
|
if (!items.length) return null;
|
|
34888
34288
|
return /* @__PURE__ */ jsx(Fragment, { children: items.map((tag, index) => /* @__PURE__ */ jsxs(
|
|
@@ -34906,7 +34306,7 @@ function InputField(props) {
|
|
|
34906
34306
|
index
|
|
34907
34307
|
)) });
|
|
34908
34308
|
}, [tags, classes == null ? void 0 : classes.tag]);
|
|
34909
|
-
const graph =
|
|
34309
|
+
const graph = React66.useMemo(
|
|
34910
34310
|
() => buildLayoutGraph({
|
|
34911
34311
|
layout,
|
|
34912
34312
|
sublabel,
|
|
@@ -35045,7 +34445,7 @@ function InputField(props) {
|
|
|
35045
34445
|
hasStackedLabelBlock && hasLabelRowContent && "mt-0.5",
|
|
35046
34446
|
classes == null ? void 0 : classes.group
|
|
35047
34447
|
);
|
|
35048
|
-
const Element = contain ? "div" :
|
|
34448
|
+
const Element = contain ? "div" : React66.Fragment;
|
|
35049
34449
|
const attrs = (a3 = "l") => contain ? a3 === "l" ? { className: "p-4 border-b border-input" } : { className: "px-4 pt-2 pb-4" } : {};
|
|
35050
34450
|
return /* @__PURE__ */ jsx(
|
|
35051
34451
|
Field,
|