@timeax/form-palette 0.1.27 → 0.1.29
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-74nd0n1e.d.mts} +17 -13
- package/dist/{core-DDFFngF0.d.ts → core-B8Htm7S-.d.ts} +17 -13
- package/dist/extra.d.mts +2 -2
- package/dist/extra.d.ts +2 -2
- package/dist/extra.js +385 -913
- package/dist/extra.js.map +1 -1
- package/dist/extra.mjs +385 -913
- 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 +965 -1492
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +889 -1416
- 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";
|
|
@@ -9259,7 +9259,9 @@ function CoreProvider(props) {
|
|
|
9259
9259
|
return anyField.onSubmit(value);
|
|
9260
9260
|
}
|
|
9261
9261
|
if (formatFileValue && item.variant == "file") {
|
|
9262
|
-
return toArray(value).map(
|
|
9262
|
+
return toArray(value).map(
|
|
9263
|
+
formatFileValue
|
|
9264
|
+
);
|
|
9263
9265
|
}
|
|
9264
9266
|
return value;
|
|
9265
9267
|
};
|
|
@@ -9347,8 +9349,7 @@ function CoreProvider(props) {
|
|
|
9347
9349
|
const finish = () => {
|
|
9348
9350
|
if (finished) return;
|
|
9349
9351
|
finished = true;
|
|
9350
|
-
if (uncaughtRef.current.length)
|
|
9351
|
-
setHasUncaughtErrors(hasUncaughtErrors + 1);
|
|
9352
|
+
if (uncaughtRef.current.length) setHasUncaughtErrors((e4) => e4 + 1);
|
|
9352
9353
|
setButtonLoading(false);
|
|
9353
9354
|
};
|
|
9354
9355
|
if (!ignoreForm) {
|
|
@@ -9725,7 +9726,7 @@ function CoreProvider(props) {
|
|
|
9725
9726
|
return uncaughtRef.current;
|
|
9726
9727
|
}
|
|
9727
9728
|
};
|
|
9728
|
-
|
|
9729
|
+
React66.useEffect(() => {
|
|
9729
9730
|
if (!props.formRef) return;
|
|
9730
9731
|
props.formRef.current = context;
|
|
9731
9732
|
return () => {
|
|
@@ -9734,7 +9735,7 @@ function CoreProvider(props) {
|
|
|
9734
9735
|
}
|
|
9735
9736
|
};
|
|
9736
9737
|
}, [context]);
|
|
9737
|
-
|
|
9738
|
+
React66.useEffect(() => {
|
|
9738
9739
|
if (props.init) {
|
|
9739
9740
|
props.init(context);
|
|
9740
9741
|
}
|
|
@@ -10170,9 +10171,9 @@ function ErrorStrip(props) {
|
|
|
10170
10171
|
} = props;
|
|
10171
10172
|
const ctxFromHook = useCore();
|
|
10172
10173
|
const form = formProp != null ? formProp : ctxFromHook;
|
|
10173
|
-
const [isVisible, setIsVisible] =
|
|
10174
|
+
const [isVisible, setIsVisible] = React66.useState(true);
|
|
10174
10175
|
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
|
-
|
|
10176
|
+
React66.useEffect(() => {
|
|
10176
10177
|
if (messages.length > 0) {
|
|
10177
10178
|
setIsVisible(true);
|
|
10178
10179
|
}
|
|
@@ -10236,7 +10237,7 @@ function ErrorStrip(props) {
|
|
|
10236
10237
|
function CoreRoot(props) {
|
|
10237
10238
|
const { noErrorStrip, onSubmitForm, children, ...rest } = props;
|
|
10238
10239
|
const form = useCore();
|
|
10239
|
-
const handleSubmit =
|
|
10240
|
+
const handleSubmit = React66.useCallback(
|
|
10240
10241
|
(event) => {
|
|
10241
10242
|
event.preventDefault();
|
|
10242
10243
|
if (form.props.activateButtonOnChange && !form.isDirty()) return;
|
|
@@ -10284,16 +10285,16 @@ function CoreShell(props) {
|
|
|
10284
10285
|
function useButton(options) {
|
|
10285
10286
|
const form = useCoreContext();
|
|
10286
10287
|
const { name, disabled: disabledProp = false } = options;
|
|
10287
|
-
const [loading, setLoadingState] =
|
|
10288
|
-
const [disabled, setDisabledState] =
|
|
10288
|
+
const [loading, setLoadingState] = React66.useState(false);
|
|
10289
|
+
const [disabled, setDisabledState] = React66.useState(
|
|
10289
10290
|
Boolean(disabledProp)
|
|
10290
10291
|
);
|
|
10291
|
-
const ref =
|
|
10292
|
-
const optsRef =
|
|
10293
|
-
|
|
10292
|
+
const ref = React66.useRef(null);
|
|
10293
|
+
const optsRef = React66.useRef(options);
|
|
10294
|
+
React66.useEffect(() => {
|
|
10294
10295
|
optsRef.current = options;
|
|
10295
10296
|
}, [options]);
|
|
10296
|
-
const buttonRef =
|
|
10297
|
+
const buttonRef = React66.useRef(null);
|
|
10297
10298
|
if (!buttonRef.current) {
|
|
10298
10299
|
const btn = {
|
|
10299
10300
|
name,
|
|
@@ -10323,11 +10324,11 @@ function useButton(options) {
|
|
|
10323
10324
|
};
|
|
10324
10325
|
buttonRef.current = btn;
|
|
10325
10326
|
}
|
|
10326
|
-
|
|
10327
|
+
React66.useEffect(() => {
|
|
10327
10328
|
if (!buttonRef.current) return;
|
|
10328
10329
|
buttonRef.current.name = name;
|
|
10329
10330
|
}, [name]);
|
|
10330
|
-
|
|
10331
|
+
React66.useEffect(() => {
|
|
10331
10332
|
if (!buttonRef.current) return;
|
|
10332
10333
|
form.button = buttonRef.current;
|
|
10333
10334
|
return () => {
|
|
@@ -10394,41 +10395,41 @@ function useField(options) {
|
|
|
10394
10395
|
onValueChange,
|
|
10395
10396
|
onSubmit
|
|
10396
10397
|
} = options;
|
|
10397
|
-
const ref =
|
|
10398
|
-
const stateRef =
|
|
10398
|
+
const ref = React66.useRef(null);
|
|
10399
|
+
const stateRef = React66.useRef({
|
|
10399
10400
|
value: defaultValue,
|
|
10400
10401
|
error: "",
|
|
10401
10402
|
loading: false,
|
|
10402
10403
|
original: getOriginalValue ? getOriginalValue(defaultValue) : defaultValue
|
|
10403
10404
|
});
|
|
10404
|
-
const [valueState, setValueState] =
|
|
10405
|
+
const [valueState, setValueState] = React66.useState(
|
|
10405
10406
|
stateRef.current.value
|
|
10406
10407
|
);
|
|
10407
10408
|
const isControlled = valueProp !== void 0;
|
|
10408
10409
|
const value = isControlled ? valueProp : valueState;
|
|
10409
|
-
|
|
10410
|
+
React66.useEffect(() => {
|
|
10410
10411
|
if (isControlled && valueProp !== stateRef.current.value) {
|
|
10411
10412
|
stateRef.current.value = valueProp;
|
|
10412
10413
|
setValueState(valueProp);
|
|
10413
10414
|
}
|
|
10414
10415
|
}, [isControlled, valueProp]);
|
|
10415
|
-
const [error, setErrorState] =
|
|
10416
|
+
const [error, setErrorState] = React66.useState(
|
|
10416
10417
|
stateRef.current.error
|
|
10417
10418
|
);
|
|
10418
|
-
const [loading, setLoadingState] =
|
|
10419
|
+
const [loading, setLoadingState] = React66.useState(
|
|
10419
10420
|
stateRef.current.loading
|
|
10420
10421
|
);
|
|
10421
|
-
const [required, setRequired] =
|
|
10422
|
+
const [required, setRequired] = React66.useState(
|
|
10422
10423
|
Boolean(requiredProp)
|
|
10423
10424
|
);
|
|
10424
|
-
const [disabled, setDisabled] =
|
|
10425
|
+
const [disabled, setDisabled] = React66.useState(
|
|
10425
10426
|
Boolean(disabledProp)
|
|
10426
10427
|
);
|
|
10427
|
-
const [readOnly, setReadOnly] =
|
|
10428
|
+
const [readOnly, setReadOnly] = React66.useState(
|
|
10428
10429
|
Boolean(readOnlyProp)
|
|
10429
10430
|
);
|
|
10430
|
-
const id =
|
|
10431
|
-
const keyRef =
|
|
10431
|
+
const id = React66.useId();
|
|
10432
|
+
const keyRef = React66.useRef(
|
|
10432
10433
|
(() => {
|
|
10433
10434
|
if (rawName && rawName.trim()) return `${rawName.trim()}-${id}`;
|
|
10434
10435
|
if (rawBindId && rawBindId.trim())
|
|
@@ -10436,10 +10437,10 @@ function useField(options) {
|
|
|
10436
10437
|
return `field-${Math.random().toString(36).slice(2)}-${id}`;
|
|
10437
10438
|
})()
|
|
10438
10439
|
);
|
|
10439
|
-
const bindIdRef =
|
|
10440
|
+
const bindIdRef = React66.useRef(
|
|
10440
10441
|
rawBindId && rawBindId.trim() || keyRef.current
|
|
10441
10442
|
);
|
|
10442
|
-
const fieldRef =
|
|
10443
|
+
const fieldRef = React66.useRef(null);
|
|
10443
10444
|
if (!fieldRef.current) {
|
|
10444
10445
|
const key = keyRef.current;
|
|
10445
10446
|
const bindId = bindIdRef.current;
|
|
@@ -10542,19 +10543,19 @@ function useField(options) {
|
|
|
10542
10543
|
fieldRef.current = f2;
|
|
10543
10544
|
}
|
|
10544
10545
|
const field = fieldRef.current;
|
|
10545
|
-
|
|
10546
|
+
React66.useEffect(() => {
|
|
10546
10547
|
setRequired(requiredProp);
|
|
10547
10548
|
if (field) {
|
|
10548
10549
|
field.required = requiredProp;
|
|
10549
10550
|
}
|
|
10550
10551
|
}, [requiredProp, field]);
|
|
10551
|
-
|
|
10552
|
+
React66.useEffect(() => {
|
|
10552
10553
|
setDisabled(disabledProp);
|
|
10553
10554
|
}, [disabledProp]);
|
|
10554
|
-
|
|
10555
|
+
React66.useEffect(() => {
|
|
10555
10556
|
setReadOnly(readOnlyProp);
|
|
10556
10557
|
}, [readOnlyProp]);
|
|
10557
|
-
|
|
10558
|
+
React66.useEffect(() => {
|
|
10558
10559
|
if (!field) return;
|
|
10559
10560
|
form.addField(field);
|
|
10560
10561
|
return () => {
|
|
@@ -10669,25 +10670,25 @@ function useOptionalField(options) {
|
|
|
10669
10670
|
getOriginalValue,
|
|
10670
10671
|
onValueChange
|
|
10671
10672
|
} = options;
|
|
10672
|
-
const ref =
|
|
10673
|
-
const [valueState, setValueState] =
|
|
10673
|
+
const ref = React66.useRef(null);
|
|
10674
|
+
const [valueState, setValueState] = React66.useState(defaultValue);
|
|
10674
10675
|
const isControlled = valueProp !== void 0;
|
|
10675
10676
|
const value = isControlled ? valueProp : valueState;
|
|
10676
|
-
|
|
10677
|
+
React66.useEffect(() => {
|
|
10677
10678
|
if (isControlled) {
|
|
10678
10679
|
setValueState(valueProp);
|
|
10679
10680
|
}
|
|
10680
10681
|
}, [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 =
|
|
10682
|
+
const [error, setErrorState] = React66.useState("");
|
|
10683
|
+
const [loading, setLoadingState] = React66.useState(false);
|
|
10684
|
+
const [required, setRequired] = React66.useState(requiredProp);
|
|
10685
|
+
const [disabled, setDisabled] = React66.useState(disabledProp);
|
|
10686
|
+
const [readOnly, setReadOnly] = React66.useState(readOnlyProp);
|
|
10687
|
+
const originalRef = React66.useRef(
|
|
10687
10688
|
getOriginalValue ? getOriginalValue(defaultValue) : defaultValue
|
|
10688
10689
|
);
|
|
10689
|
-
const id =
|
|
10690
|
-
const keyRef =
|
|
10690
|
+
const id = React66.useId();
|
|
10691
|
+
const keyRef = React66.useRef("");
|
|
10691
10692
|
if (!keyRef.current) {
|
|
10692
10693
|
if (rawName && rawName.trim()) {
|
|
10693
10694
|
keyRef.current = `${rawName.trim()}-${id}`;
|
|
@@ -10697,17 +10698,17 @@ function useOptionalField(options) {
|
|
|
10697
10698
|
keyRef.current = `field-${Math.random().toString(36).slice(2)}-${id}`;
|
|
10698
10699
|
}
|
|
10699
10700
|
}
|
|
10700
|
-
const bindIdRef =
|
|
10701
|
+
const bindIdRef = React66.useRef("");
|
|
10701
10702
|
if (!bindIdRef.current) {
|
|
10702
10703
|
bindIdRef.current = rawBindId && rawBindId.trim() || keyRef.current;
|
|
10703
10704
|
}
|
|
10704
|
-
|
|
10705
|
+
React66.useEffect(() => {
|
|
10705
10706
|
setRequired(requiredProp);
|
|
10706
10707
|
}, [requiredProp]);
|
|
10707
|
-
|
|
10708
|
+
React66.useEffect(() => {
|
|
10708
10709
|
setDisabled(disabledProp);
|
|
10709
10710
|
}, [disabledProp]);
|
|
10710
|
-
|
|
10711
|
+
React66.useEffect(() => {
|
|
10711
10712
|
setReadOnly(readOnlyProp);
|
|
10712
10713
|
}, [readOnlyProp]);
|
|
10713
10714
|
function setValue(next, variant = "direct") {
|
|
@@ -10805,17 +10806,17 @@ var focusEl = (el) => {
|
|
|
10805
10806
|
}
|
|
10806
10807
|
};
|
|
10807
10808
|
function useUpdateEffect(effect, deps) {
|
|
10808
|
-
const mounted =
|
|
10809
|
-
|
|
10809
|
+
const mounted = React66.useRef(false);
|
|
10810
|
+
React66.useEffect(() => {
|
|
10810
10811
|
if (mounted.current) {
|
|
10811
10812
|
return effect();
|
|
10812
10813
|
}
|
|
10813
10814
|
mounted.current = true;
|
|
10814
10815
|
}, deps);
|
|
10815
10816
|
}
|
|
10816
|
-
var InputMask =
|
|
10817
|
-
|
|
10818
|
-
const props =
|
|
10817
|
+
var InputMask = React66.memo(
|
|
10818
|
+
React66.forwardRef((inProps, ref) => {
|
|
10819
|
+
const props = React66.useMemo(
|
|
10819
10820
|
() => ({
|
|
10820
10821
|
autoClear: true,
|
|
10821
10822
|
autoFocus: false,
|
|
@@ -10830,20 +10831,20 @@ var InputMask = React11.memo(
|
|
|
10830
10831
|
}),
|
|
10831
10832
|
[inProps]
|
|
10832
10833
|
);
|
|
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 =
|
|
10834
|
+
const elementRef = React66.useRef(null);
|
|
10835
|
+
const firstNonMaskPos = React66.useRef(null);
|
|
10836
|
+
const lastRequiredNonMaskPos = React66.useRef(0);
|
|
10837
|
+
const tests = React66.useRef([]);
|
|
10838
|
+
const buffer = React66.useRef([]);
|
|
10839
|
+
const len = React66.useRef(0);
|
|
10840
|
+
const oldVal = React66.useRef(null);
|
|
10841
|
+
const focus = React66.useRef(false);
|
|
10842
|
+
const focusText = React66.useRef(null);
|
|
10843
|
+
const isValueChecked = React66.useRef(null);
|
|
10844
|
+
const partialPosition = React66.useRef(null);
|
|
10845
|
+
const defaultBuffer = React66.useRef(null);
|
|
10846
|
+
const caretTimeoutId = React66.useRef(null);
|
|
10847
|
+
const androidChrome = React66.useRef(false);
|
|
10847
10848
|
const caret = (first, last) => {
|
|
10848
10849
|
var _a, _b;
|
|
10849
10850
|
let range;
|
|
@@ -10878,7 +10879,7 @@ var InputMask = React11.memo(
|
|
|
10878
10879
|
}
|
|
10879
10880
|
return { begin, end };
|
|
10880
10881
|
};
|
|
10881
|
-
const getPlaceholder =
|
|
10882
|
+
const getPlaceholder = React66.useCallback(
|
|
10882
10883
|
(i4) => {
|
|
10883
10884
|
var _a;
|
|
10884
10885
|
const slotChar2 = (_a = props.slotChar) != null ? _a : "_";
|
|
@@ -11148,7 +11149,7 @@ var InputMask = React11.memo(
|
|
|
11148
11149
|
});
|
|
11149
11150
|
}
|
|
11150
11151
|
};
|
|
11151
|
-
const getUnmaskedValue =
|
|
11152
|
+
const getUnmaskedValue = React66.useCallback(() => {
|
|
11152
11153
|
const unmaskedBuffer = [];
|
|
11153
11154
|
for (let i4 = 0; i4 < buffer.current.length; i4++) {
|
|
11154
11155
|
const c2 = buffer.current[i4];
|
|
@@ -11203,7 +11204,7 @@ var InputMask = React11.memo(
|
|
|
11203
11204
|
}
|
|
11204
11205
|
return pos;
|
|
11205
11206
|
};
|
|
11206
|
-
const isValueUpdated =
|
|
11207
|
+
const isValueUpdated = React66.useCallback(() => {
|
|
11207
11208
|
var _a, _b, _c, _d;
|
|
11208
11209
|
const elVal = (_b = (_a = elementRef.current) == null ? void 0 : _a.value) != null ? _b : "";
|
|
11209
11210
|
return props.unmask ? ((_c = props.value) != null ? _c : "") !== getUnmaskedValue() : defaultBuffer.current !== elVal && elVal !== ((_d = props.value) != null ? _d : "");
|
|
@@ -11303,7 +11304,7 @@ var InputMask = React11.memo(
|
|
|
11303
11304
|
const onInput = (event) => {
|
|
11304
11305
|
androidChrome.current ? handleAndroidInput(event) : handleInputChange(event);
|
|
11305
11306
|
};
|
|
11306
|
-
|
|
11307
|
+
React66.useImperativeHandle(
|
|
11307
11308
|
ref,
|
|
11308
11309
|
() => ({
|
|
11309
11310
|
focus: () => focusEl(elementRef.current),
|
|
@@ -11311,10 +11312,10 @@ var InputMask = React11.memo(
|
|
|
11311
11312
|
}),
|
|
11312
11313
|
[]
|
|
11313
11314
|
);
|
|
11314
|
-
|
|
11315
|
+
React66.useEffect(() => {
|
|
11315
11316
|
if (!elementRef.current) return;
|
|
11316
11317
|
}, []);
|
|
11317
|
-
|
|
11318
|
+
React66.useEffect(() => {
|
|
11318
11319
|
init();
|
|
11319
11320
|
updateValue();
|
|
11320
11321
|
}, []);
|
|
@@ -11462,7 +11463,7 @@ function resolveSizeDensityClasses(size, density) {
|
|
|
11462
11463
|
}
|
|
11463
11464
|
return { heightCls, textCls, densityCls };
|
|
11464
11465
|
}
|
|
11465
|
-
var Input =
|
|
11466
|
+
var Input = React66.forwardRef(
|
|
11466
11467
|
function Input2(rawProps, forwardedRef) {
|
|
11467
11468
|
const {
|
|
11468
11469
|
// base
|
|
@@ -11525,8 +11526,8 @@ var Input = React11.forwardRef(
|
|
|
11525
11526
|
const sizeKey = size != null ? size : "md";
|
|
11526
11527
|
const densityKey = density != null ? density : "normal";
|
|
11527
11528
|
const isMasked = Boolean(mask);
|
|
11528
|
-
const innerRef =
|
|
11529
|
-
|
|
11529
|
+
const innerRef = React66.useRef(null);
|
|
11530
|
+
React66.useImperativeHandle(
|
|
11530
11531
|
forwardedRef,
|
|
11531
11532
|
() => innerRef.current,
|
|
11532
11533
|
[]
|
|
@@ -11547,11 +11548,11 @@ var Input = React11.forwardRef(
|
|
|
11547
11548
|
const baseIconGap = iconGap != null ? iconGap : 4;
|
|
11548
11549
|
const leadingGap = leadingIconSpacing != null ? leadingIconSpacing : baseIconGap;
|
|
11549
11550
|
const trailingGap = trailingIconSpacing != null ? trailingIconSpacing : baseIconGap;
|
|
11550
|
-
const leadingIconsRef =
|
|
11551
|
-
const trailingIconsRef =
|
|
11552
|
-
const [leadingIconsWidth, setLeadingIconsWidth] =
|
|
11553
|
-
const [trailingIconsWidth, setTrailingIconsWidth] =
|
|
11554
|
-
|
|
11551
|
+
const leadingIconsRef = React66.useRef(null);
|
|
11552
|
+
const trailingIconsRef = React66.useRef(null);
|
|
11553
|
+
const [leadingIconsWidth, setLeadingIconsWidth] = React66.useState(0);
|
|
11554
|
+
const [trailingIconsWidth, setTrailingIconsWidth] = React66.useState(0);
|
|
11555
|
+
React66.useLayoutEffect(() => {
|
|
11555
11556
|
if (typeof window === "undefined") return;
|
|
11556
11557
|
if (typeof ResizeObserver === "undefined") return;
|
|
11557
11558
|
const leadingEl = leadingIconsRef.current;
|
|
@@ -11626,7 +11627,7 @@ var Input = React11.forwardRef(
|
|
|
11626
11627
|
inputClassName
|
|
11627
11628
|
);
|
|
11628
11629
|
const maskMode = unmask === true || unmask === "raw" ? "raw" : "masked";
|
|
11629
|
-
const handleFocus =
|
|
11630
|
+
const handleFocus = React66.useCallback(
|
|
11630
11631
|
(event) => {
|
|
11631
11632
|
onFocus == null ? void 0 : onFocus(event);
|
|
11632
11633
|
if (!prefix && !suffix) return;
|
|
@@ -11654,7 +11655,7 @@ var Input = React11.forwardRef(
|
|
|
11654
11655
|
const placeholder = typeof mask === "string" && mask ? mask : rest.placeholder;
|
|
11655
11656
|
const hasCustomPadding = typeof px === "number" || typeof py === "number" || typeof ps === "number" || typeof pe2 === "number" || typeof pb === "number";
|
|
11656
11657
|
const hasKeyFilter = !!keyFilter;
|
|
11657
|
-
const handleKeyDownWrapped =
|
|
11658
|
+
const handleKeyDownWrapped = React66.useCallback(
|
|
11658
11659
|
(event) => {
|
|
11659
11660
|
if (hasKeyFilter && keyFilterOn === "keydown" && !event.ctrlKey && !event.metaKey && !event.altKey && event.key && event.key.length === 1) {
|
|
11660
11661
|
const inputEl = event.currentTarget;
|
|
@@ -11671,7 +11672,7 @@ var Input = React11.forwardRef(
|
|
|
11671
11672
|
},
|
|
11672
11673
|
[hasKeyFilter, keyFilterOn, keyFilter, onKeyDown]
|
|
11673
11674
|
);
|
|
11674
|
-
const handleKeyPressWrapped =
|
|
11675
|
+
const handleKeyPressWrapped = React66.useCallback(
|
|
11675
11676
|
(event) => {
|
|
11676
11677
|
if (hasKeyFilter && keyFilterOn === "keypress" && !event.ctrlKey && !event.metaKey && !event.altKey && event.key && event.key.length === 1) {
|
|
11677
11678
|
const inputEl = event.currentTarget;
|
|
@@ -11688,7 +11689,7 @@ var Input = React11.forwardRef(
|
|
|
11688
11689
|
},
|
|
11689
11690
|
[hasKeyFilter, keyFilterOn, keyFilter, onKeyPress]
|
|
11690
11691
|
);
|
|
11691
|
-
const handleBeforeInputWrapped =
|
|
11692
|
+
const handleBeforeInputWrapped = React66.useCallback(
|
|
11692
11693
|
(event) => {
|
|
11693
11694
|
if (hasKeyFilter && keyFilterOn === "beforeinput" && (event == null ? void 0 : event.nativeEvent)) {
|
|
11694
11695
|
const inputEl = event.currentTarget;
|
|
@@ -11709,7 +11710,7 @@ var Input = React11.forwardRef(
|
|
|
11709
11710
|
},
|
|
11710
11711
|
[hasKeyFilter, keyFilterOn, keyFilter, onBeforeInput]
|
|
11711
11712
|
);
|
|
11712
|
-
const handlePasteWrapped =
|
|
11713
|
+
const handlePasteWrapped = React66.useCallback(
|
|
11713
11714
|
(event) => {
|
|
11714
11715
|
var _a, _b;
|
|
11715
11716
|
if (hasKeyFilter && keyFilterOnPaste) {
|
|
@@ -11847,7 +11848,11 @@ var Input = React11.forwardRef(
|
|
|
11847
11848
|
children: [
|
|
11848
11849
|
renderBaseInput({
|
|
11849
11850
|
inner: false,
|
|
11850
|
-
className: cx(
|
|
11851
|
+
className: cx(
|
|
11852
|
+
baseBoxClasses,
|
|
11853
|
+
boxPaddingClasses,
|
|
11854
|
+
className
|
|
11855
|
+
),
|
|
11851
11856
|
style: varsStyle
|
|
11852
11857
|
}),
|
|
11853
11858
|
hasLeadingIcons && /* @__PURE__ */ jsx(
|
|
@@ -11951,7 +11956,7 @@ var Input = React11.forwardRef(
|
|
|
11951
11956
|
className: "absolute inset-y-0 left-0 flex items-center cursor-pointer",
|
|
11952
11957
|
style: {
|
|
11953
11958
|
gap: leadingGap,
|
|
11954
|
-
paddingLeft: `${pxDefault}px`
|
|
11959
|
+
paddingLeft: hasLeadingControl ? void 0 : `${pxDefault}px`
|
|
11955
11960
|
},
|
|
11956
11961
|
"data-slot": "leading-icons",
|
|
11957
11962
|
onMouseDown: handleIconMouseDown,
|
|
@@ -11972,7 +11977,7 @@ var Input = React11.forwardRef(
|
|
|
11972
11977
|
className: "absolute inset-y-0 right-0 flex items-center cursor-pointer",
|
|
11973
11978
|
style: {
|
|
11974
11979
|
gap: trailingGap,
|
|
11975
|
-
paddingRight: `${pxDefault}px`
|
|
11980
|
+
paddingRight: hasTrailingControl ? void 0 : `${pxDefault}px`
|
|
11976
11981
|
},
|
|
11977
11982
|
"data-slot": "trailing-icons",
|
|
11978
11983
|
onMouseDown: handleIconMouseDown,
|
|
@@ -12097,7 +12102,7 @@ var Input = React11.forwardRef(
|
|
|
12097
12102
|
] });
|
|
12098
12103
|
}
|
|
12099
12104
|
);
|
|
12100
|
-
var ShadcnTextVariant =
|
|
12105
|
+
var ShadcnTextVariant = React66.forwardRef(function ShadcnTextVariant2(props, forwardedRef) {
|
|
12101
12106
|
const {
|
|
12102
12107
|
// form-level props
|
|
12103
12108
|
value,
|
|
@@ -12145,7 +12150,7 @@ var ShadcnTextVariant = React11.forwardRef(function ShadcnTextVariant2(props, fo
|
|
|
12145
12150
|
...rest
|
|
12146
12151
|
} = props;
|
|
12147
12152
|
const isMasked = Boolean(mask);
|
|
12148
|
-
const handlePlainChange =
|
|
12153
|
+
const handlePlainChange = React66.useCallback(
|
|
12149
12154
|
(e4) => {
|
|
12150
12155
|
var _a;
|
|
12151
12156
|
const displayed = (_a = e4.target.value) != null ? _a : "";
|
|
@@ -12176,7 +12181,7 @@ var ShadcnTextVariant = React11.forwardRef(function ShadcnTextVariant2(props, fo
|
|
|
12176
12181
|
},
|
|
12177
12182
|
[onValue, prefix, suffix, stripPrefix, stripSuffix]
|
|
12178
12183
|
);
|
|
12179
|
-
const handleMaskedChange =
|
|
12184
|
+
const handleMaskedChange = React66.useCallback(
|
|
12180
12185
|
(e4) => {
|
|
12181
12186
|
var _a, _b, _c;
|
|
12182
12187
|
const maskedValue = (_a = e4.value) != null ? _a : "";
|
|
@@ -12296,9 +12301,98 @@ var textVariant = {
|
|
|
12296
12301
|
tags: ["text", "input", "string"]
|
|
12297
12302
|
}
|
|
12298
12303
|
};
|
|
12299
|
-
|
|
12300
|
-
|
|
12301
|
-
|
|
12304
|
+
function clampToLimits(n3, min2, max2) {
|
|
12305
|
+
let out = n3;
|
|
12306
|
+
if (min2 != null && out < min2) out = min2;
|
|
12307
|
+
if (max2 != null && out > max2) out = max2;
|
|
12308
|
+
return out;
|
|
12309
|
+
}
|
|
12310
|
+
function isFiniteNumber(n3) {
|
|
12311
|
+
return typeof n3 === "number" && Number.isFinite(n3);
|
|
12312
|
+
}
|
|
12313
|
+
function resolveLocale(explicit) {
|
|
12314
|
+
if (explicit) return explicit;
|
|
12315
|
+
if (typeof navigator !== "undefined" && navigator.language)
|
|
12316
|
+
return navigator.language;
|
|
12317
|
+
return "en-US";
|
|
12318
|
+
}
|
|
12319
|
+
function getDecimalSeparator(locale) {
|
|
12320
|
+
const s3 = new Intl.NumberFormat(locale, { useGrouping: false }).format(1.1);
|
|
12321
|
+
const m2 = s3.match(/1(.?)1/);
|
|
12322
|
+
return (m2 == null ? void 0 : m2[1]) || ".";
|
|
12323
|
+
}
|
|
12324
|
+
function stripAffixes(text, prefix, suffix) {
|
|
12325
|
+
let t4 = text != null ? text : "";
|
|
12326
|
+
if (prefix && t4.startsWith(prefix)) t4 = t4.slice(prefix.length);
|
|
12327
|
+
if (suffix && t4.endsWith(suffix)) t4 = t4.slice(0, -suffix.length);
|
|
12328
|
+
return t4;
|
|
12329
|
+
}
|
|
12330
|
+
function stripGrouping(text, locale) {
|
|
12331
|
+
const group = new Intl.NumberFormat(locale, { useGrouping: true }).format(1e6).replace(/[0-9]/g, "").trim().charAt(0);
|
|
12332
|
+
if (!group) return text;
|
|
12333
|
+
const re3 = new RegExp(`\\${group}`, "g");
|
|
12334
|
+
return text.replace(re3, "");
|
|
12335
|
+
}
|
|
12336
|
+
function parseEditable(editable, locale, decimalSep) {
|
|
12337
|
+
const t4 = editable.trim();
|
|
12338
|
+
if (!t4 || t4 === "-" || t4 === decimalSep) return null;
|
|
12339
|
+
const noGroup = stripGrouping(t4, locale);
|
|
12340
|
+
const normalized = decimalSep === "." ? noGroup : noGroup.replace(decimalSep, ".");
|
|
12341
|
+
const cleaned = normalized.endsWith(".") ? normalized.slice(0, -1) : normalized;
|
|
12342
|
+
if (!cleaned || cleaned === "-") return null;
|
|
12343
|
+
const n3 = Number(cleaned);
|
|
12344
|
+
return Number.isFinite(n3) ? n3 : null;
|
|
12345
|
+
}
|
|
12346
|
+
function formatDisplayNumber(n3, locale, opts, prefix, suffix) {
|
|
12347
|
+
const f2 = new Intl.NumberFormat(locale, opts).format(n3);
|
|
12348
|
+
return `${prefix != null ? prefix : ""}${f2}${suffix != null ? suffix : ""}`;
|
|
12349
|
+
}
|
|
12350
|
+
function applyFractionLimitReplace(next, prev, locale, decimalSep, maxFractionDigits, inputEl) {
|
|
12351
|
+
var _a, _b, _c;
|
|
12352
|
+
if (maxFractionDigits == null)
|
|
12353
|
+
return { text: next, caret: (_a = inputEl.selectionStart) != null ? _a : next.length };
|
|
12354
|
+
const selStart = (_b = inputEl.selectionStart) != null ? _b : 0;
|
|
12355
|
+
const selEnd = (_c = inputEl.selectionEnd) != null ? _c : selStart;
|
|
12356
|
+
const decIndex = next.indexOf(decimalSep);
|
|
12357
|
+
if (decIndex === -1) return { text: next, caret: selStart };
|
|
12358
|
+
const frac = next.slice(decIndex + 1);
|
|
12359
|
+
if (frac.length <= maxFractionDigits)
|
|
12360
|
+
return { text: next, caret: selStart };
|
|
12361
|
+
if (selEnd > selStart) {
|
|
12362
|
+
const trimmed2 = next.slice(0, decIndex + 1 + maxFractionDigits);
|
|
12363
|
+
const caret2 = Math.min(selStart, trimmed2.length);
|
|
12364
|
+
return { text: trimmed2, caret: caret2 };
|
|
12365
|
+
}
|
|
12366
|
+
const caret = selStart;
|
|
12367
|
+
const fracStart = decIndex + 1;
|
|
12368
|
+
const fracEnd = fracStart + maxFractionDigits;
|
|
12369
|
+
const trimmed = next.slice(0, fracEnd);
|
|
12370
|
+
const clampedCaret = Math.min(caret, trimmed.length);
|
|
12371
|
+
return { text: trimmed, caret: clampedCaret };
|
|
12372
|
+
}
|
|
12373
|
+
function normalizeEditable(raw, locale, decimalSep, allowMinus) {
|
|
12374
|
+
let t4 = raw;
|
|
12375
|
+
t4 = stripGrouping(t4, locale);
|
|
12376
|
+
const allowed = new RegExp(`[^0-9\\${decimalSep}\\-]`, "g");
|
|
12377
|
+
t4 = t4.replace(allowed, "");
|
|
12378
|
+
const minusCount = (t4.match(/\-/g) || []).length;
|
|
12379
|
+
if (minusCount) {
|
|
12380
|
+
t4 = t4.replace(/\-/g, "");
|
|
12381
|
+
if (allowMinus) t4 = "-" + t4;
|
|
12382
|
+
}
|
|
12383
|
+
const firstDec = t4.indexOf(decimalSep);
|
|
12384
|
+
if (firstDec !== -1) {
|
|
12385
|
+
const before = t4.slice(0, firstDec + 1);
|
|
12386
|
+
const after = t4.slice(firstDec + 1).replace(new RegExp(`\\${decimalSep}`, "g"), "");
|
|
12387
|
+
t4 = before + after;
|
|
12388
|
+
}
|
|
12389
|
+
if (t4 === "-" + decimalSep) t4 = "-0" + decimalSep;
|
|
12390
|
+
if (t4 === decimalSep) t4 = "0" + decimalSep;
|
|
12391
|
+
return t4;
|
|
12392
|
+
}
|
|
12393
|
+
var InputNumber = React66.memo(
|
|
12394
|
+
React66.forwardRef((inProps, ref) => {
|
|
12395
|
+
var _a;
|
|
12302
12396
|
const props = {
|
|
12303
12397
|
allowEmpty: true,
|
|
12304
12398
|
autoFocus: false,
|
|
@@ -12312,35 +12406,19 @@ var InputNumber = React11.memo(
|
|
|
12312
12406
|
type: "text",
|
|
12313
12407
|
...inProps
|
|
12314
12408
|
};
|
|
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(() => {
|
|
12409
|
+
const locale = React66.useMemo(
|
|
12410
|
+
() => resolveLocale(props.locale),
|
|
12411
|
+
[props.locale]
|
|
12412
|
+
);
|
|
12413
|
+
const decimalSep = React66.useMemo(
|
|
12414
|
+
() => getDecimalSeparator(locale),
|
|
12415
|
+
[locale]
|
|
12416
|
+
);
|
|
12417
|
+
const allowMinus = React66.useMemo(
|
|
12418
|
+
() => props.min == null || props.min < 0,
|
|
12419
|
+
[props.min]
|
|
12420
|
+
);
|
|
12421
|
+
const fmtOptions = React66.useMemo(() => {
|
|
12344
12422
|
return {
|
|
12345
12423
|
localeMatcher: props.localeMatcher,
|
|
12346
12424
|
style: props.mode,
|
|
@@ -12361,262 +12439,27 @@ var InputNumber = React11.memo(
|
|
|
12361
12439
|
props.maxFractionDigits,
|
|
12362
12440
|
props.roundingMode
|
|
12363
12441
|
]);
|
|
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();
|
|
12442
|
+
const inputRef = React66.useRef(null);
|
|
12443
|
+
React66.useImperativeHandle(ref, () => inputRef.current);
|
|
12444
|
+
const [display, setDisplay] = React66.useState("");
|
|
12445
|
+
const [focused, setFocused] = React66.useState(false);
|
|
12446
|
+
const toEditableFromNumber = React66.useCallback(
|
|
12447
|
+
(n3) => {
|
|
12448
|
+
const s3 = String(n3);
|
|
12449
|
+
return decimalSep === "." ? s3 : s3.replace(".", decimalSep);
|
|
12465
12450
|
},
|
|
12466
|
-
[
|
|
12451
|
+
[decimalSep]
|
|
12467
12452
|
);
|
|
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
|
-
[]
|
|
12453
|
+
const clampModel = React66.useCallback(
|
|
12454
|
+
(n3) => clampToLimits(n3, props.min, props.max),
|
|
12455
|
+
[props.min, props.max]
|
|
12493
12456
|
);
|
|
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({
|
|
12457
|
+
const emit = React66.useCallback(
|
|
12458
|
+
(event, value2) => {
|
|
12459
|
+
var _a2, _b, _c;
|
|
12460
|
+
(_c = props.onValueChange) == null ? void 0 : _c.call(props, {
|
|
12618
12461
|
originalEvent: event,
|
|
12619
|
-
value:
|
|
12462
|
+
value: value2,
|
|
12620
12463
|
stopPropagation() {
|
|
12621
12464
|
event == null ? void 0 : event.stopPropagation();
|
|
12622
12465
|
},
|
|
@@ -12625,600 +12468,160 @@ var InputNumber = React11.memo(
|
|
|
12625
12468
|
},
|
|
12626
12469
|
target: {
|
|
12627
12470
|
name: (_a2 = props.name) != null ? _a2 : null,
|
|
12628
|
-
id: (
|
|
12629
|
-
value:
|
|
12471
|
+
id: (_b = props.id) != null ? _b : null,
|
|
12472
|
+
value: value2
|
|
12630
12473
|
}
|
|
12631
12474
|
});
|
|
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;
|
|
12475
|
+
if (props.onChange && event) {
|
|
12476
|
+
props.onChange({ originalEvent: event, value: value2 });
|
|
12660
12477
|
}
|
|
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);
|
|
12478
|
+
},
|
|
12479
|
+
[props]
|
|
12480
|
+
);
|
|
12481
|
+
const setCaret = (pos) => {
|
|
12482
|
+
const el = inputRef.current;
|
|
12483
|
+
if (!el) return;
|
|
12484
|
+
queueMicrotask(() => {
|
|
12485
|
+
try {
|
|
12486
|
+
el.setSelectionRange(pos, pos);
|
|
12487
|
+
} catch {
|
|
12805
12488
|
}
|
|
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);
|
|
12489
|
+
});
|
|
12823
12490
|
};
|
|
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);
|
|
12491
|
+
const formatFromModel = React66.useCallback(
|
|
12492
|
+
(n3) => {
|
|
12493
|
+
if (n3 == null) return "";
|
|
12494
|
+
if (!props.format) return toEditableFromNumber(n3);
|
|
12495
|
+
const formatted = formatDisplayNumber(
|
|
12496
|
+
n3,
|
|
12497
|
+
locale,
|
|
12498
|
+
fmtOptions,
|
|
12499
|
+
props.prefix,
|
|
12500
|
+
props.suffix
|
|
12501
|
+
);
|
|
12502
|
+
return formatted;
|
|
12503
|
+
},
|
|
12504
|
+
[
|
|
12505
|
+
props.format,
|
|
12506
|
+
props.prefix,
|
|
12507
|
+
props.suffix,
|
|
12508
|
+
locale,
|
|
12509
|
+
fmtOptions,
|
|
12510
|
+
toEditableFromNumber
|
|
12511
|
+
]
|
|
12512
|
+
);
|
|
12513
|
+
const getModelFromDisplay = React66.useCallback(
|
|
12514
|
+
(text) => {
|
|
12515
|
+
const stripped = stripAffixes(text, props.prefix, props.suffix);
|
|
12516
|
+
const withoutGroup = stripGrouping(stripped, locale);
|
|
12517
|
+
const candidate = decimalSep !== "." ? withoutGroup.replace(".", decimalSep) : withoutGroup;
|
|
12518
|
+
const n3 = parseEditable(candidate, locale, decimalSep);
|
|
12519
|
+
if (n3 == null) return null;
|
|
12520
|
+
const clamped = clampModel(n3);
|
|
12521
|
+
return clamped;
|
|
12522
|
+
},
|
|
12523
|
+
[props.prefix, props.suffix, locale, decimalSep, clampModel]
|
|
12524
|
+
);
|
|
12525
|
+
const syncFromPropsValue = React66.useCallback(
|
|
12526
|
+
(v2) => {
|
|
12527
|
+
if (v2 == null) {
|
|
12528
|
+
setDisplay("");
|
|
12529
|
+
return;
|
|
12876
12530
|
}
|
|
12877
|
-
|
|
12878
|
-
|
|
12879
|
-
|
|
12531
|
+
const clamped = clampModel(v2);
|
|
12532
|
+
setDisplay(
|
|
12533
|
+
focused ? toEditableFromNumber(clamped) : formatFromModel(clamped)
|
|
12534
|
+
);
|
|
12535
|
+
},
|
|
12536
|
+
[clampModel, focused, toEditableFromNumber, formatFromModel]
|
|
12537
|
+
);
|
|
12538
|
+
React66.useEffect(() => {
|
|
12880
12539
|
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) => {
|
|
12540
|
+
syncFromPropsValue((_a2 = props.value) != null ? _a2 : null);
|
|
12541
|
+
}, []);
|
|
12542
|
+
React66.useEffect(() => {
|
|
12936
12543
|
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) => {
|
|
12544
|
+
if (focused) return;
|
|
12545
|
+
syncFromPropsValue((_a2 = props.value) != null ? _a2 : null);
|
|
12546
|
+
}, [props.value, focused, syncFromPropsValue]);
|
|
12547
|
+
const onFocus = (e4) => {
|
|
13139
12548
|
var _a2;
|
|
13140
|
-
|
|
13141
|
-
(_a2 = props.onFocus) == null ? void 0 : _a2.call(props,
|
|
13142
|
-
|
|
13143
|
-
|
|
13144
|
-
|
|
13145
|
-
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
12549
|
+
setFocused(true);
|
|
12550
|
+
(_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e4);
|
|
12551
|
+
const model = isFiniteNumber(props.value) ? clampModel(props.value) : getModelFromDisplay(display);
|
|
12552
|
+
const editable = model == null ? stripAffixes(display, props.prefix, props.suffix) : toEditableFromNumber(model);
|
|
12553
|
+
const normalized = normalizeEditable(
|
|
12554
|
+
editable,
|
|
12555
|
+
locale,
|
|
12556
|
+
decimalSep,
|
|
12557
|
+
allowMinus
|
|
12558
|
+
);
|
|
12559
|
+
setDisplay(normalized);
|
|
12560
|
+
queueMicrotask(() => {
|
|
12561
|
+
var _a3, _b;
|
|
12562
|
+
setCaret(((_b = (_a3 = inputRef.current) == null ? void 0 : _a3.value) != null ? _b : "").length);
|
|
12563
|
+
});
|
|
13149
12564
|
};
|
|
13150
|
-
const
|
|
13151
|
-
var _a2,
|
|
13152
|
-
|
|
13153
|
-
|
|
13154
|
-
|
|
13155
|
-
|
|
13156
|
-
|
|
13157
|
-
|
|
13158
|
-
|
|
13159
|
-
|
|
13160
|
-
|
|
13161
|
-
|
|
13162
|
-
|
|
12565
|
+
const onBlur = (e4) => {
|
|
12566
|
+
var _a2, _b;
|
|
12567
|
+
setFocused(false);
|
|
12568
|
+
const el = e4.currentTarget;
|
|
12569
|
+
const raw = stripAffixes(el.value, props.prefix, props.suffix);
|
|
12570
|
+
const normalized = normalizeEditable(
|
|
12571
|
+
raw,
|
|
12572
|
+
locale,
|
|
12573
|
+
decimalSep,
|
|
12574
|
+
allowMinus
|
|
12575
|
+
);
|
|
12576
|
+
const parsed = parseEditable(normalized, locale, decimalSep);
|
|
12577
|
+
let model = parsed == null ? null : clampModel(parsed);
|
|
12578
|
+
if (model == null && props.allowEmpty === false) {
|
|
12579
|
+
const fallback = (_a2 = props.min) != null ? _a2 : 0;
|
|
12580
|
+
model = clampModel(fallback);
|
|
12581
|
+
}
|
|
12582
|
+
setDisplay(formatFromModel(model));
|
|
12583
|
+
emit(e4, model);
|
|
12584
|
+
(_b = props.onBlur) == null ? void 0 : _b.call(props, e4);
|
|
13163
12585
|
};
|
|
13164
|
-
const
|
|
13165
|
-
|
|
13166
|
-
|
|
13167
|
-
const
|
|
13168
|
-
|
|
13169
|
-
|
|
12586
|
+
const onChangeText = (e4) => {
|
|
12587
|
+
var _a2, _b;
|
|
12588
|
+
if (props.disabled || props.readOnly) return;
|
|
12589
|
+
const el = e4.currentTarget;
|
|
12590
|
+
const caretBefore = (_a2 = el.selectionStart) != null ? _a2 : el.value.length;
|
|
12591
|
+
const stripped = stripAffixes(el.value, props.prefix, props.suffix);
|
|
12592
|
+
let next = normalizeEditable(
|
|
12593
|
+
stripped,
|
|
12594
|
+
locale,
|
|
12595
|
+
decimalSep,
|
|
12596
|
+
allowMinus
|
|
12597
|
+
);
|
|
12598
|
+
const fracLimit = props.maxFractionDigits;
|
|
12599
|
+
if (fracLimit != null) {
|
|
12600
|
+
const applied = applyFractionLimitReplace(
|
|
12601
|
+
next,
|
|
12602
|
+
display,
|
|
12603
|
+
locale,
|
|
12604
|
+
decimalSep,
|
|
12605
|
+
fracLimit,
|
|
12606
|
+
el
|
|
12607
|
+
);
|
|
12608
|
+
next = applied.text;
|
|
12609
|
+
setDisplay(next);
|
|
12610
|
+
setCaret(applied.caret);
|
|
12611
|
+
} else {
|
|
12612
|
+
setDisplay(next);
|
|
12613
|
+
setCaret(caretBefore);
|
|
13170
12614
|
}
|
|
12615
|
+
const parsed = parseEditable(next, locale, decimalSep);
|
|
12616
|
+
const model = parsed == null ? null : clampModel(parsed);
|
|
12617
|
+
const finalModel = model == null && props.allowEmpty === false ? clampModel((_b = props.min) != null ? _b : 0) : model;
|
|
12618
|
+
emit(e4, finalModel);
|
|
13171
12619
|
};
|
|
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]);
|
|
12620
|
+
const inputMode = props.inputMode || (props.mode === "decimal" && props.maxFractionDigits == null && props.minFractionDigits == null ? "numeric" : "decimal");
|
|
13217
12621
|
const inputClassName = [
|
|
13218
12622
|
props.inputClassName,
|
|
13219
12623
|
props.invalid ? "p-invalid" : void 0
|
|
13220
12624
|
].filter(Boolean).join(" ");
|
|
13221
|
-
const valueToRender = formattedValue((_a = props.value) != null ? _a : null);
|
|
13222
12625
|
const {
|
|
13223
12626
|
inputId,
|
|
13224
12627
|
inputStyle,
|
|
@@ -13229,34 +12632,32 @@ var InputNumber = React11.memo(
|
|
|
13229
12632
|
value,
|
|
13230
12633
|
icon,
|
|
13231
12634
|
iconGap,
|
|
13232
|
-
// anything you *don’t* want to pass down can be pulled out here too
|
|
13233
|
-
// e.g. internal-only props
|
|
13234
12635
|
...passThroughProps
|
|
13235
|
-
// everything else goes straight to ShadcnTextVariant
|
|
13236
12636
|
} = props;
|
|
13237
12637
|
return (
|
|
13238
12638
|
//@ts-ignore
|
|
13239
12639
|
/* @__PURE__ */ jsx(
|
|
13240
12640
|
Input,
|
|
13241
12641
|
{
|
|
13242
|
-
|
|
13243
|
-
|
|
12642
|
+
ref: (node) => {
|
|
12643
|
+
inputRef.current = node;
|
|
12644
|
+
if (typeof props.inputRef === "function")
|
|
12645
|
+
props.inputRef(node);
|
|
12646
|
+
else if (props.inputRef && typeof props.inputRef === "object") {
|
|
12647
|
+
props.inputRef.current = node;
|
|
12648
|
+
}
|
|
12649
|
+
},
|
|
13244
12650
|
...passThroughProps,
|
|
13245
12651
|
id: inputId != null ? inputId : props.id,
|
|
13246
12652
|
style: inputStyle != null ? inputStyle : props.style,
|
|
13247
12653
|
role: "spinbutton",
|
|
13248
12654
|
className: inputClassName || props.className,
|
|
13249
|
-
|
|
13250
|
-
type: (_b = props.type) != null ? _b : "text",
|
|
12655
|
+
type: (_a = props.type) != null ? _a : "text",
|
|
13251
12656
|
inputMode,
|
|
13252
|
-
|
|
13253
|
-
|
|
13254
|
-
|
|
13255
|
-
|
|
13256
|
-
onPointerDown: onInputPointerDown,
|
|
13257
|
-
onBlur: onInputBlur,
|
|
13258
|
-
onFocus: onInputFocus,
|
|
13259
|
-
onPaste,
|
|
12657
|
+
value: display,
|
|
12658
|
+
onFocus,
|
|
12659
|
+
onBlur,
|
|
12660
|
+
onChange: onChangeText,
|
|
13260
12661
|
leadingControl,
|
|
13261
12662
|
trailingControl,
|
|
13262
12663
|
leadingControlClassName,
|
|
@@ -13269,7 +12670,7 @@ var InputNumber = React11.memo(
|
|
|
13269
12670
|
})
|
|
13270
12671
|
);
|
|
13271
12672
|
InputNumber.displayName = "InputNumber";
|
|
13272
|
-
var ShadcnNumberVariant =
|
|
12673
|
+
var ShadcnNumberVariant = React66__default.forwardRef(function ShadcnNumberVariant2(props, forwardedRef) {
|
|
13273
12674
|
const {
|
|
13274
12675
|
showButtons,
|
|
13275
12676
|
buttonLayout = "stacked",
|
|
@@ -13287,7 +12688,7 @@ var ShadcnNumberVariant = React11__default.forwardRef(function ShadcnNumberVaria
|
|
|
13287
12688
|
id,
|
|
13288
12689
|
inputId
|
|
13289
12690
|
} = rest;
|
|
13290
|
-
const handleChange =
|
|
12691
|
+
const handleChange = React66__default.useCallback(
|
|
13291
12692
|
(e4) => {
|
|
13292
12693
|
if (onValueChange) {
|
|
13293
12694
|
onValueChange(e4.value, {
|
|
@@ -13299,7 +12700,7 @@ var ShadcnNumberVariant = React11__default.forwardRef(function ShadcnNumberVaria
|
|
|
13299
12700
|
},
|
|
13300
12701
|
[onValueChange]
|
|
13301
12702
|
);
|
|
13302
|
-
const handleStep =
|
|
12703
|
+
const handleStep = React66__default.useCallback(
|
|
13303
12704
|
(direction, originalEvent) => {
|
|
13304
12705
|
var _a;
|
|
13305
12706
|
if (disabled) return;
|
|
@@ -13810,7 +13211,7 @@ var CountrySelect = ({
|
|
|
13810
13211
|
}) })
|
|
13811
13212
|
] }) });
|
|
13812
13213
|
};
|
|
13813
|
-
var ShadcnPhoneVariant =
|
|
13214
|
+
var ShadcnPhoneVariant = React66.forwardRef(function ShadcnPhoneVariant2(props, ref) {
|
|
13814
13215
|
const {
|
|
13815
13216
|
countries: countriesProp,
|
|
13816
13217
|
defaultCountry,
|
|
@@ -13835,8 +13236,8 @@ var ShadcnPhoneVariant = React11.forwardRef(function ShadcnPhoneVariant2(props,
|
|
|
13835
13236
|
} = props;
|
|
13836
13237
|
let DEFAULT_COUNTRIES2 = getGlobalCountryList();
|
|
13837
13238
|
const defaultCountries = countriesProp && countriesProp.length > 0 ? countriesProp : DEFAULT_COUNTRIES2;
|
|
13838
|
-
const [countries, setLoadedCountries] =
|
|
13839
|
-
|
|
13239
|
+
const [countries, setLoadedCountries] = React66.useState(defaultCountries);
|
|
13240
|
+
React66.useEffect(() => {
|
|
13840
13241
|
if (countriesProp == null ? void 0 : countriesProp.length) return;
|
|
13841
13242
|
const list = getPaletteUtil("countries");
|
|
13842
13243
|
if (list == null ? void 0 : list.length) {
|
|
@@ -13849,7 +13250,7 @@ var ShadcnPhoneVariant = React11.forwardRef(function ShadcnPhoneVariant2(props,
|
|
|
13849
13250
|
});
|
|
13850
13251
|
}
|
|
13851
13252
|
}, []);
|
|
13852
|
-
const [country, setCountry] =
|
|
13253
|
+
const [country, setCountry] = React66.useState(() => {
|
|
13853
13254
|
var _a;
|
|
13854
13255
|
if (defaultCountry) {
|
|
13855
13256
|
const found = countries.find((c2) => c2.code === defaultCountry);
|
|
@@ -13857,7 +13258,7 @@ var ShadcnPhoneVariant = React11.forwardRef(function ShadcnPhoneVariant2(props,
|
|
|
13857
13258
|
}
|
|
13858
13259
|
return (_a = countries[0]) != null ? _a : DEFAULT_COUNTRIES2[0];
|
|
13859
13260
|
});
|
|
13860
|
-
|
|
13261
|
+
React66.useEffect(() => {
|
|
13861
13262
|
setCountry((prev) => {
|
|
13862
13263
|
var _a;
|
|
13863
13264
|
if (defaultCountry) {
|
|
@@ -13868,13 +13269,13 @@ var ShadcnPhoneVariant = React11.forwardRef(function ShadcnPhoneVariant2(props,
|
|
|
13868
13269
|
return (_a = stillThere != null ? stillThere : countries[0]) != null ? _a : prev;
|
|
13869
13270
|
});
|
|
13870
13271
|
}, [countries, defaultCountry]);
|
|
13871
|
-
const [local, setLocal] =
|
|
13272
|
+
const [local, setLocal] = React66.useState(
|
|
13872
13273
|
() => computeDisplayFromValue(value, country, keepCharPositions)
|
|
13873
13274
|
);
|
|
13874
|
-
|
|
13275
|
+
React66.useEffect(() => {
|
|
13875
13276
|
setLocal(computeDisplayFromValue(value, country, keepCharPositions));
|
|
13876
13277
|
}, [value, country, keepCharPositions]);
|
|
13877
|
-
const handleInputChange =
|
|
13278
|
+
const handleInputChange = React66.useCallback(
|
|
13878
13279
|
(event) => {
|
|
13879
13280
|
var _a;
|
|
13880
13281
|
const rawInput = (_a = event.target.value) != null ? _a : "";
|
|
@@ -13900,7 +13301,7 @@ var ShadcnPhoneVariant = React11.forwardRef(function ShadcnPhoneVariant2(props,
|
|
|
13900
13301
|
},
|
|
13901
13302
|
[country, valueMode, keepCharPositions, onValue]
|
|
13902
13303
|
);
|
|
13903
|
-
const handleCountryChange =
|
|
13304
|
+
const handleCountryChange = React66.useCallback(
|
|
13904
13305
|
(nextCode) => {
|
|
13905
13306
|
var _a;
|
|
13906
13307
|
const nextCountry = (_a = countries.find((c2) => c2.code === nextCode)) != null ? _a : countries[0];
|
|
@@ -13987,7 +13388,7 @@ function normalizeColorForPicker(value) {
|
|
|
13987
13388
|
}
|
|
13988
13389
|
return "#000000";
|
|
13989
13390
|
}
|
|
13990
|
-
var ShadcnColorVariant =
|
|
13391
|
+
var ShadcnColorVariant = React66.forwardRef(function ShadcnColorVariant2(props, ref) {
|
|
13991
13392
|
const {
|
|
13992
13393
|
// variant contract
|
|
13993
13394
|
value,
|
|
@@ -14008,22 +13409,22 @@ var ShadcnColorVariant = React11.forwardRef(function ShadcnColorVariant2(props,
|
|
|
14008
13409
|
// everything else → Input (size, density, className, icons, etc.)
|
|
14009
13410
|
...restTextProps
|
|
14010
13411
|
} = props;
|
|
14011
|
-
const [local, setLocal] =
|
|
14012
|
-
const [pickerOpen, setPickerOpen] =
|
|
14013
|
-
|
|
13412
|
+
const [local, setLocal] = React66.useState(value != null ? value : "");
|
|
13413
|
+
const [pickerOpen, setPickerOpen] = React66.useState(false);
|
|
13414
|
+
React66.useEffect(() => {
|
|
14014
13415
|
setLocal(value != null ? value : "");
|
|
14015
13416
|
}, [value]);
|
|
14016
|
-
const pickerRef =
|
|
13417
|
+
const pickerRef = React66.useRef(null);
|
|
14017
13418
|
const effectiveColor = normalizeColorForPicker(local || value);
|
|
14018
13419
|
const showError = Boolean(error);
|
|
14019
|
-
const openSystemPicker =
|
|
13420
|
+
const openSystemPicker = React66.useCallback(() => {
|
|
14020
13421
|
setPickerOpen(true);
|
|
14021
13422
|
window.setTimeout(() => {
|
|
14022
13423
|
var _a;
|
|
14023
13424
|
(_a = pickerRef.current) == null ? void 0 : _a.click();
|
|
14024
13425
|
}, 0);
|
|
14025
13426
|
}, []);
|
|
14026
|
-
const handleTextChange =
|
|
13427
|
+
const handleTextChange = React66.useCallback(
|
|
14027
13428
|
(event) => {
|
|
14028
13429
|
var _a;
|
|
14029
13430
|
const next = (_a = event.target.value) != null ? _a : "";
|
|
@@ -14040,7 +13441,7 @@ var ShadcnColorVariant = React11.forwardRef(function ShadcnColorVariant2(props,
|
|
|
14040
13441
|
},
|
|
14041
13442
|
[onValue]
|
|
14042
13443
|
);
|
|
14043
|
-
const handlePickerChange =
|
|
13444
|
+
const handlePickerChange = React66.useCallback(
|
|
14044
13445
|
(event) => {
|
|
14045
13446
|
var _a;
|
|
14046
13447
|
const next = (_a = event.target.value) != null ? _a : "";
|
|
@@ -14058,7 +13459,7 @@ var ShadcnColorVariant = React11.forwardRef(function ShadcnColorVariant2(props,
|
|
|
14058
13459
|
},
|
|
14059
13460
|
[onValue]
|
|
14060
13461
|
);
|
|
14061
|
-
const handlePickerBlur =
|
|
13462
|
+
const handlePickerBlur = React66.useCallback(() => {
|
|
14062
13463
|
setPickerOpen(false);
|
|
14063
13464
|
}, []);
|
|
14064
13465
|
const leadingControl = showPreview ? /* @__PURE__ */ jsx(
|
|
@@ -14360,7 +13761,7 @@ function meterColor(score) {
|
|
|
14360
13761
|
if (score === 3) return "bg-amber-500";
|
|
14361
13762
|
return "bg-emerald-500";
|
|
14362
13763
|
}
|
|
14363
|
-
var ShadcnPasswordVariant =
|
|
13764
|
+
var ShadcnPasswordVariant = React66.forwardRef(function ShadcnPasswordVariant2(props, ref) {
|
|
14364
13765
|
var _a, _b;
|
|
14365
13766
|
const {
|
|
14366
13767
|
// base variant bits
|
|
@@ -14396,18 +13797,18 @@ var ShadcnPasswordVariant = React11.forwardRef(function ShadcnPasswordVariant2(p
|
|
|
14396
13797
|
// everything else from Shadcn text UI
|
|
14397
13798
|
...restTextProps
|
|
14398
13799
|
} = props;
|
|
14399
|
-
const [revealed, setRevealed] =
|
|
13800
|
+
const [revealed, setRevealed] = React66.useState(
|
|
14400
13801
|
Boolean(defaultRevealed)
|
|
14401
13802
|
);
|
|
14402
|
-
const normalizedStrength =
|
|
13803
|
+
const normalizedStrength = React66.useMemo(
|
|
14403
13804
|
() => normalizeStrengthOptions(strengthMeter),
|
|
14404
13805
|
[strengthMeter]
|
|
14405
13806
|
);
|
|
14406
|
-
const effectiveRuleDefinitions =
|
|
13807
|
+
const effectiveRuleDefinitions = React66.useMemo(
|
|
14407
13808
|
() => getMergedRuleDefinitions(ruleDefinitions),
|
|
14408
13809
|
[ruleDefinitions]
|
|
14409
13810
|
);
|
|
14410
|
-
const meterState =
|
|
13811
|
+
const meterState = React66.useMemo(() => {
|
|
14411
13812
|
if (!normalizedStrength) return null;
|
|
14412
13813
|
const v2 = value != null ? value : "";
|
|
14413
13814
|
return computeMeterState(
|
|
@@ -14417,14 +13818,14 @@ var ShadcnPasswordVariant = React11.forwardRef(function ShadcnPasswordVariant2(p
|
|
|
14417
13818
|
ruleUses
|
|
14418
13819
|
);
|
|
14419
13820
|
}, [normalizedStrength, value, ruleUses, effectiveRuleDefinitions]);
|
|
14420
|
-
const handleToggleReveal =
|
|
13821
|
+
const handleToggleReveal = React66.useCallback(() => {
|
|
14421
13822
|
setRevealed((prev) => {
|
|
14422
13823
|
const next = !prev;
|
|
14423
13824
|
onRevealChange == null ? void 0 : onRevealChange(next);
|
|
14424
13825
|
return next;
|
|
14425
13826
|
});
|
|
14426
13827
|
}, [onRevealChange]);
|
|
14427
|
-
const handleChange =
|
|
13828
|
+
const handleChange = React66.useCallback(
|
|
14428
13829
|
(event) => {
|
|
14429
13830
|
var _a2;
|
|
14430
13831
|
const next = (_a2 = event.target.value) != null ? _a2 : "";
|
|
@@ -17074,38 +16475,38 @@ __export(custom_components_exports, {
|
|
|
17074
16475
|
YearsDropdown: () => YearsDropdown
|
|
17075
16476
|
});
|
|
17076
16477
|
function Button(props) {
|
|
17077
|
-
return
|
|
16478
|
+
return React66__default.createElement("button", { ...props });
|
|
17078
16479
|
}
|
|
17079
16480
|
function CaptionLabel(props) {
|
|
17080
|
-
return
|
|
16481
|
+
return React66__default.createElement("span", { ...props });
|
|
17081
16482
|
}
|
|
17082
16483
|
function Chevron(props) {
|
|
17083
16484
|
const { size = 24, orientation = "left", className } = props;
|
|
17084
16485
|
return (
|
|
17085
16486
|
// biome-ignore lint/a11y/noSvgWithoutTitle: handled by the parent component
|
|
17086
|
-
|
|
16487
|
+
React66__default.createElement(
|
|
17087
16488
|
"svg",
|
|
17088
16489
|
{ className, width: size, height: size, viewBox: "0 0 24 24" },
|
|
17089
|
-
orientation === "up" &&
|
|
17090
|
-
orientation === "down" &&
|
|
17091
|
-
orientation === "left" &&
|
|
17092
|
-
orientation === "right" &&
|
|
16490
|
+
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" }),
|
|
16491
|
+
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" }),
|
|
16492
|
+
orientation === "left" && React66__default.createElement("polygon", { points: "16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20" }),
|
|
16493
|
+
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
16494
|
)
|
|
17094
16495
|
);
|
|
17095
16496
|
}
|
|
17096
16497
|
function Day(props) {
|
|
17097
16498
|
const { day, modifiers, ...tdProps } = props;
|
|
17098
|
-
return
|
|
16499
|
+
return React66__default.createElement("td", { ...tdProps });
|
|
17099
16500
|
}
|
|
17100
16501
|
function DayButton(props) {
|
|
17101
16502
|
const { day, modifiers, ...buttonProps } = props;
|
|
17102
|
-
const ref =
|
|
17103
|
-
|
|
16503
|
+
const ref = React66__default.useRef(null);
|
|
16504
|
+
React66__default.useEffect(() => {
|
|
17104
16505
|
var _a;
|
|
17105
16506
|
if (modifiers.focused)
|
|
17106
16507
|
(_a = ref.current) == null ? void 0 : _a.focus();
|
|
17107
16508
|
}, [modifiers.focused]);
|
|
17108
|
-
return
|
|
16509
|
+
return React66__default.createElement("button", { ref, ...buttonProps });
|
|
17109
16510
|
}
|
|
17110
16511
|
|
|
17111
16512
|
// ../../node_modules/react-day-picker/dist/esm/UI.js
|
|
@@ -17168,37 +16569,37 @@ function Dropdown(props) {
|
|
|
17168
16569
|
const { options, className, components, classNames, ...selectProps } = props;
|
|
17169
16570
|
const cssClassSelect = [classNames[UI.Dropdown], className].join(" ");
|
|
17170
16571
|
const selectedOption = options == null ? void 0 : options.find(({ value }) => value === selectProps.value);
|
|
17171
|
-
return
|
|
16572
|
+
return React66__default.createElement(
|
|
17172
16573
|
"span",
|
|
17173
16574
|
{ "data-disabled": selectProps.disabled, className: classNames[UI.DropdownRoot] },
|
|
17174
|
-
|
|
17175
|
-
|
|
16575
|
+
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))),
|
|
16576
|
+
React66__default.createElement(
|
|
17176
16577
|
"span",
|
|
17177
16578
|
{ className: classNames[UI.CaptionLabel], "aria-hidden": true },
|
|
17178
16579
|
selectedOption == null ? void 0 : selectedOption.label,
|
|
17179
|
-
|
|
16580
|
+
React66__default.createElement(components.Chevron, { orientation: "down", size: 18, className: classNames[UI.Chevron] })
|
|
17180
16581
|
)
|
|
17181
16582
|
);
|
|
17182
16583
|
}
|
|
17183
16584
|
function DropdownNav(props) {
|
|
17184
|
-
return
|
|
16585
|
+
return React66__default.createElement("div", { ...props });
|
|
17185
16586
|
}
|
|
17186
16587
|
function Footer(props) {
|
|
17187
|
-
return
|
|
16588
|
+
return React66__default.createElement("div", { ...props });
|
|
17188
16589
|
}
|
|
17189
16590
|
function Month(props) {
|
|
17190
16591
|
const { calendarMonth, displayIndex, ...divProps } = props;
|
|
17191
|
-
return
|
|
16592
|
+
return React66__default.createElement("div", { ...divProps }, props.children);
|
|
17192
16593
|
}
|
|
17193
16594
|
function MonthCaption(props) {
|
|
17194
16595
|
const { calendarMonth, displayIndex, ...divProps } = props;
|
|
17195
|
-
return
|
|
16596
|
+
return React66__default.createElement("div", { ...divProps });
|
|
17196
16597
|
}
|
|
17197
16598
|
function MonthGrid(props) {
|
|
17198
|
-
return
|
|
16599
|
+
return React66__default.createElement("table", { ...props });
|
|
17199
16600
|
}
|
|
17200
16601
|
function Months(props) {
|
|
17201
|
-
return
|
|
16602
|
+
return React66__default.createElement("div", { ...props });
|
|
17202
16603
|
}
|
|
17203
16604
|
var dayPickerContext = createContext(void 0);
|
|
17204
16605
|
function useDayPicker() {
|
|
@@ -17212,7 +16613,7 @@ function useDayPicker() {
|
|
|
17212
16613
|
// ../../node_modules/react-day-picker/dist/esm/components/MonthsDropdown.js
|
|
17213
16614
|
function MonthsDropdown(props) {
|
|
17214
16615
|
const { components } = useDayPicker();
|
|
17215
|
-
return
|
|
16616
|
+
return React66__default.createElement(components.Dropdown, { ...props });
|
|
17216
16617
|
}
|
|
17217
16618
|
function Nav(props) {
|
|
17218
16619
|
const { onPreviousClick, onNextClick, previousMonth, nextMonth, ...navProps } = props;
|
|
@@ -17227,66 +16628,66 @@ function Nav(props) {
|
|
|
17227
16628
|
onPreviousClick == null ? void 0 : onPreviousClick(e4);
|
|
17228
16629
|
}
|
|
17229
16630
|
}, [previousMonth, onPreviousClick]);
|
|
17230
|
-
return
|
|
16631
|
+
return React66__default.createElement(
|
|
17231
16632
|
"nav",
|
|
17232
16633
|
{ ...navProps },
|
|
17233
|
-
|
|
16634
|
+
React66__default.createElement(
|
|
17234
16635
|
components.PreviousMonthButton,
|
|
17235
16636
|
{ type: "button", className: classNames[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick },
|
|
17236
|
-
|
|
16637
|
+
React66__default.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], orientation: "left" })
|
|
17237
16638
|
),
|
|
17238
|
-
|
|
16639
|
+
React66__default.createElement(
|
|
17239
16640
|
components.NextMonthButton,
|
|
17240
16641
|
{ type: "button", className: classNames[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick },
|
|
17241
|
-
|
|
16642
|
+
React66__default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, orientation: "right", className: classNames[UI.Chevron] })
|
|
17242
16643
|
)
|
|
17243
16644
|
);
|
|
17244
16645
|
}
|
|
17245
16646
|
function NextMonthButton(props) {
|
|
17246
16647
|
const { components } = useDayPicker();
|
|
17247
|
-
return
|
|
16648
|
+
return React66__default.createElement(components.Button, { ...props });
|
|
17248
16649
|
}
|
|
17249
16650
|
function Option(props) {
|
|
17250
|
-
return
|
|
16651
|
+
return React66__default.createElement("option", { ...props });
|
|
17251
16652
|
}
|
|
17252
16653
|
function PreviousMonthButton(props) {
|
|
17253
16654
|
const { components } = useDayPicker();
|
|
17254
|
-
return
|
|
16655
|
+
return React66__default.createElement(components.Button, { ...props });
|
|
17255
16656
|
}
|
|
17256
16657
|
function Root3(props) {
|
|
17257
16658
|
const { rootRef, ...rest } = props;
|
|
17258
|
-
return
|
|
16659
|
+
return React66__default.createElement("div", { ...rest, ref: rootRef });
|
|
17259
16660
|
}
|
|
17260
16661
|
function Select2(props) {
|
|
17261
|
-
return
|
|
16662
|
+
return React66__default.createElement("select", { ...props });
|
|
17262
16663
|
}
|
|
17263
16664
|
function Week(props) {
|
|
17264
16665
|
const { week, ...trProps } = props;
|
|
17265
|
-
return
|
|
16666
|
+
return React66__default.createElement("tr", { ...trProps });
|
|
17266
16667
|
}
|
|
17267
16668
|
function Weekday(props) {
|
|
17268
|
-
return
|
|
16669
|
+
return React66__default.createElement("th", { ...props });
|
|
17269
16670
|
}
|
|
17270
16671
|
function Weekdays(props) {
|
|
17271
|
-
return
|
|
16672
|
+
return React66__default.createElement(
|
|
17272
16673
|
"thead",
|
|
17273
16674
|
{ "aria-hidden": true },
|
|
17274
|
-
|
|
16675
|
+
React66__default.createElement("tr", { ...props })
|
|
17275
16676
|
);
|
|
17276
16677
|
}
|
|
17277
16678
|
function WeekNumber(props) {
|
|
17278
16679
|
const { week, ...thProps } = props;
|
|
17279
|
-
return
|
|
16680
|
+
return React66__default.createElement("th", { ...thProps });
|
|
17280
16681
|
}
|
|
17281
16682
|
function WeekNumberHeader(props) {
|
|
17282
|
-
return
|
|
16683
|
+
return React66__default.createElement("th", { ...props });
|
|
17283
16684
|
}
|
|
17284
16685
|
function Weeks(props) {
|
|
17285
|
-
return
|
|
16686
|
+
return React66__default.createElement("tbody", { ...props });
|
|
17286
16687
|
}
|
|
17287
16688
|
function YearsDropdown(props) {
|
|
17288
16689
|
const { components } = useDayPicker();
|
|
17289
|
-
return
|
|
16690
|
+
return React66__default.createElement(components.Dropdown, { ...props });
|
|
17290
16691
|
}
|
|
17291
16692
|
|
|
17292
16693
|
// ../../node_modules/react-day-picker/dist/esm/utils/rangeIncludesDate.js
|
|
@@ -18773,18 +18174,18 @@ function DayPicker(initialProps) {
|
|
|
18773
18174
|
labels,
|
|
18774
18175
|
formatters: formatters2
|
|
18775
18176
|
};
|
|
18776
|
-
return
|
|
18177
|
+
return React66__default.createElement(
|
|
18777
18178
|
dayPickerContext.Provider,
|
|
18778
18179
|
{ value: contextValue },
|
|
18779
|
-
|
|
18180
|
+
React66__default.createElement(
|
|
18780
18181
|
components.Root,
|
|
18781
18182
|
{ 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
|
-
|
|
18183
|
+
React66__default.createElement(
|
|
18783
18184
|
components.Months,
|
|
18784
18185
|
{ className: classNames[UI.Months], style: styles == null ? void 0 : styles[UI.Months] },
|
|
18785
|
-
!props.hideNavigation && !navLayout &&
|
|
18186
|
+
!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
18187
|
months.map((calendarMonth, displayIndex) => {
|
|
18787
|
-
return
|
|
18188
|
+
return React66__default.createElement(
|
|
18788
18189
|
components.Month,
|
|
18789
18190
|
{
|
|
18790
18191
|
"data-animated-month": props.animate ? "true" : void 0,
|
|
@@ -18795,21 +18196,21 @@ function DayPicker(initialProps) {
|
|
|
18795
18196
|
displayIndex,
|
|
18796
18197
|
calendarMonth
|
|
18797
18198
|
},
|
|
18798
|
-
navLayout === "around" && !props.hideNavigation && displayIndex === 0 &&
|
|
18199
|
+
navLayout === "around" && !props.hideNavigation && displayIndex === 0 && React66__default.createElement(
|
|
18799
18200
|
components.PreviousMonthButton,
|
|
18800
18201
|
{ 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
|
-
|
|
18202
|
+
React66__default.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], orientation: props.dir === "rtl" ? "right" : "left" })
|
|
18802
18203
|
),
|
|
18803
|
-
|
|
18204
|
+
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
18205
|
components.DropdownNav,
|
|
18805
18206
|
{ className: classNames[UI.Dropdowns], style: styles == null ? void 0 : styles[UI.Dropdowns] },
|
|
18806
18207
|
(() => {
|
|
18807
|
-
const monthControl = captionLayout === "dropdown" || captionLayout === "dropdown-months" ?
|
|
18808
|
-
const yearControl = captionLayout === "dropdown" || captionLayout === "dropdown-years" ?
|
|
18208
|
+
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));
|
|
18209
|
+
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
18210
|
const controls = dateLib.getMonthYearOrder() === "year-first" ? [yearControl, monthControl] : [monthControl, yearControl];
|
|
18810
18211
|
return controls;
|
|
18811
18212
|
})(),
|
|
18812
|
-
|
|
18213
|
+
React66__default.createElement("span", { role: "status", "aria-live": "polite", style: {
|
|
18813
18214
|
border: 0,
|
|
18814
18215
|
clip: "rect(0 0 0 0)",
|
|
18815
18216
|
height: "1px",
|
|
@@ -18821,27 +18222,27 @@ function DayPicker(initialProps) {
|
|
|
18821
18222
|
whiteSpace: "nowrap",
|
|
18822
18223
|
wordWrap: "normal"
|
|
18823
18224
|
} }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))
|
|
18824
|
-
) :
|
|
18825
|
-
navLayout === "around" && !props.hideNavigation && displayIndex === numberOfMonths - 1 &&
|
|
18225
|
+
) : React66__default.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))),
|
|
18226
|
+
navLayout === "around" && !props.hideNavigation && displayIndex === numberOfMonths - 1 && React66__default.createElement(
|
|
18826
18227
|
components.NextMonthButton,
|
|
18827
18228
|
{ 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
|
-
|
|
18229
|
+
React66__default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, className: classNames[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" })
|
|
18829
18230
|
),
|
|
18830
|
-
displayIndex === numberOfMonths - 1 && navLayout === "after" && !props.hideNavigation &&
|
|
18831
|
-
|
|
18231
|
+
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 }),
|
|
18232
|
+
React66__default.createElement(
|
|
18832
18233
|
components.MonthGrid,
|
|
18833
18234
|
{ 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 &&
|
|
18235
|
+
!props.hideWeekdays && React66__default.createElement(
|
|
18835
18236
|
components.Weekdays,
|
|
18836
18237
|
{ "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) =>
|
|
18238
|
+
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()),
|
|
18239
|
+
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
18240
|
),
|
|
18840
|
-
|
|
18841
|
-
return
|
|
18241
|
+
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) => {
|
|
18242
|
+
return React66__default.createElement(
|
|
18842
18243
|
components.Week,
|
|
18843
18244
|
{ className: classNames[UI.Week], key: week.weekNumber, style: styles == null ? void 0 : styles[UI.Week], week },
|
|
18844
|
-
showWeekNumber &&
|
|
18245
|
+
showWeekNumber && React66__default.createElement(components.WeekNumber, { week, style: styles == null ? void 0 : styles[UI.WeekNumber], "aria-label": labelWeekNumber2(week.weekNumber, {
|
|
18845
18246
|
locale
|
|
18846
18247
|
}), className: classNames[UI.WeekNumber], scope: "row", role: "rowheader" }, formatWeekNumber2(week.weekNumber, dateLib)),
|
|
18847
18248
|
week.days.map((day) => {
|
|
@@ -18858,7 +18259,7 @@ function DayPicker(initialProps) {
|
|
|
18858
18259
|
const style2 = getStyleForModifiers(modifiers, styles, props.modifiersStyles);
|
|
18859
18260
|
const className2 = getClassNamesForModifiers(modifiers, classNames, props.modifiersClassNames);
|
|
18860
18261
|
const ariaLabel = !isInteractive && !modifiers.hidden ? labelGridcell2(date, modifiers, dateLib.options, dateLib) : void 0;
|
|
18861
|
-
return
|
|
18262
|
+
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
18263
|
})
|
|
18863
18264
|
);
|
|
18864
18265
|
}))
|
|
@@ -18866,7 +18267,7 @@ function DayPicker(initialProps) {
|
|
|
18866
18267
|
);
|
|
18867
18268
|
})
|
|
18868
18269
|
),
|
|
18869
|
-
props.footer &&
|
|
18270
|
+
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
18271
|
)
|
|
18871
18272
|
);
|
|
18872
18273
|
}
|
|
@@ -19109,8 +18510,8 @@ function CalendarDayButton({
|
|
|
19109
18510
|
...props
|
|
19110
18511
|
}) {
|
|
19111
18512
|
const defaultClassNames = getDefaultClassNames();
|
|
19112
|
-
const ref =
|
|
19113
|
-
|
|
18513
|
+
const ref = React66.useRef(null);
|
|
18514
|
+
React66.useEffect(() => {
|
|
19114
18515
|
var _a;
|
|
19115
18516
|
if (modifiers.focused) (_a = ref.current) == null ? void 0 : _a.focus();
|
|
19116
18517
|
}, [modifiers.focused]);
|
|
@@ -19187,15 +18588,15 @@ var TimeDropdowns = (props) => {
|
|
|
19187
18588
|
triggerClassName,
|
|
19188
18589
|
density = "normal"
|
|
19189
18590
|
} = props;
|
|
19190
|
-
const minuteOptions =
|
|
18591
|
+
const minuteOptions = React66.useMemo(
|
|
19191
18592
|
() => buildMinuteOptions(minuteStep),
|
|
19192
18593
|
[minuteStep]
|
|
19193
18594
|
);
|
|
19194
|
-
const secondOptions =
|
|
18595
|
+
const secondOptions = React66.useMemo(
|
|
19195
18596
|
() => buildSecondOptions(secondStep),
|
|
19196
18597
|
[secondStep]
|
|
19197
18598
|
);
|
|
19198
|
-
const hourOptions =
|
|
18599
|
+
const hourOptions = React66.useMemo(
|
|
19199
18600
|
() => use12Hour ? buildHourOptions12() : buildHourOptions24(),
|
|
19200
18601
|
[use12Hour]
|
|
19201
18602
|
);
|
|
@@ -19534,7 +18935,7 @@ function parseRawToDate(rawDigits, kind) {
|
|
|
19534
18935
|
function meterSafeDigits(masked) {
|
|
19535
18936
|
return masked.replace(/\D+/g, "");
|
|
19536
18937
|
}
|
|
19537
|
-
var ShadcnDateVariant =
|
|
18938
|
+
var ShadcnDateVariant = React66.forwardRef(function ShadcnDateVariant2(props, ref) {
|
|
19538
18939
|
const {
|
|
19539
18940
|
// variant base bits
|
|
19540
18941
|
value,
|
|
@@ -19567,10 +18968,10 @@ var ShadcnDateVariant = React11.forwardRef(function ShadcnDateVariant2(props, re
|
|
|
19567
18968
|
const resolvedMask = inputMask != null ? inputMask : kindConfig.mask;
|
|
19568
18969
|
const defaultShowCalendar = kind === "date" || kind === "datetime";
|
|
19569
18970
|
const showCalendar = typeof showCalendarProp === "boolean" ? showCalendarProp : defaultShowCalendar;
|
|
19570
|
-
const [internalOpen, setInternalOpen] =
|
|
18971
|
+
const [internalOpen, setInternalOpen] = React66.useState(false);
|
|
19571
18972
|
const isControlledOpen = open !== void 0;
|
|
19572
18973
|
const currentOpen = isControlledOpen ? !!open : internalOpen;
|
|
19573
|
-
const handleOpenChange =
|
|
18974
|
+
const handleOpenChange = React66.useCallback(
|
|
19574
18975
|
(next) => {
|
|
19575
18976
|
if (!isControlledOpen) {
|
|
19576
18977
|
setInternalOpen(next);
|
|
@@ -19580,7 +18981,7 @@ var ShadcnDateVariant = React11.forwardRef(function ShadcnDateVariant2(props, re
|
|
|
19580
18981
|
[isControlledOpen, onOpenChange]
|
|
19581
18982
|
);
|
|
19582
18983
|
const { single, range } = normalizeValueForMode(value, mode);
|
|
19583
|
-
const displayValue =
|
|
18984
|
+
const displayValue = React66.useMemo(() => {
|
|
19584
18985
|
if (mode === "single") {
|
|
19585
18986
|
return formatDisplaySingle(single, singlePattern);
|
|
19586
18987
|
}
|
|
@@ -19591,12 +18992,12 @@ var ShadcnDateVariant = React11.forwardRef(function ShadcnDateVariant2(props, re
|
|
|
19591
18992
|
rangeSeparator
|
|
19592
18993
|
);
|
|
19593
18994
|
}, [mode, single, range, singlePattern, formatRange, rangeSeparator]);
|
|
19594
|
-
const [localText, setLocalText] =
|
|
19595
|
-
|
|
18995
|
+
const [localText, setLocalText] = React66.useState(displayValue);
|
|
18996
|
+
React66.useEffect(() => {
|
|
19596
18997
|
setLocalText(displayValue);
|
|
19597
18998
|
}, [displayValue]);
|
|
19598
18999
|
const showTimeDropdowns = mode === "single" && (kind === "datetime" || kind === "time" || kind === "hour");
|
|
19599
|
-
const handleSelect =
|
|
19000
|
+
const handleSelect = React66.useCallback(
|
|
19600
19001
|
(next) => {
|
|
19601
19002
|
let nextValue;
|
|
19602
19003
|
let nextRange;
|
|
@@ -19646,7 +19047,7 @@ var ShadcnDateVariant = React11.forwardRef(function ShadcnDateVariant2(props, re
|
|
|
19646
19047
|
},
|
|
19647
19048
|
[mode, stayOpenOnSelect, onValue, handleOpenChange, kind, single]
|
|
19648
19049
|
);
|
|
19649
|
-
const handleTimeChange =
|
|
19050
|
+
const handleTimeChange = React66.useCallback(
|
|
19650
19051
|
(next) => {
|
|
19651
19052
|
if (!next) {
|
|
19652
19053
|
const detail2 = {
|
|
@@ -19677,7 +19078,7 @@ var ShadcnDateVariant = React11.forwardRef(function ShadcnDateVariant2(props, re
|
|
|
19677
19078
|
},
|
|
19678
19079
|
[mode, kind, onValue]
|
|
19679
19080
|
);
|
|
19680
|
-
const handleClear =
|
|
19081
|
+
const handleClear = React66.useCallback(
|
|
19681
19082
|
(ev) => {
|
|
19682
19083
|
ev.preventDefault();
|
|
19683
19084
|
ev.stopPropagation();
|
|
@@ -19696,7 +19097,7 @@ var ShadcnDateVariant = React11.forwardRef(function ShadcnDateVariant2(props, re
|
|
|
19696
19097
|
);
|
|
19697
19098
|
const hasValue = hasSelection(value);
|
|
19698
19099
|
const placeholderText = typeof placeholder === "string" ? placeholder : mode === "range" ? "Select date range" : "Select date";
|
|
19699
|
-
const handleInputChange =
|
|
19100
|
+
const handleInputChange = React66.useCallback(
|
|
19700
19101
|
(event) => {
|
|
19701
19102
|
var _a, _b, _c;
|
|
19702
19103
|
if (mode !== "single") return;
|
|
@@ -19883,7 +19284,7 @@ function resolveBasePadding2(size, density) {
|
|
|
19883
19284
|
}
|
|
19884
19285
|
return { px, py };
|
|
19885
19286
|
}
|
|
19886
|
-
var Textarea =
|
|
19287
|
+
var Textarea = React66.forwardRef(
|
|
19887
19288
|
function Textarea2(rawProps, forwardedRef) {
|
|
19888
19289
|
const {
|
|
19889
19290
|
// layout wrapper
|
|
@@ -19931,8 +19332,8 @@ var Textarea = React11.forwardRef(
|
|
|
19931
19332
|
} = rawProps;
|
|
19932
19333
|
const sizeKey = size != null ? size : "md";
|
|
19933
19334
|
const densityKey = density != null ? density : "normal";
|
|
19934
|
-
const innerRef =
|
|
19935
|
-
|
|
19335
|
+
const innerRef = React66.useRef(null);
|
|
19336
|
+
React66.useImperativeHandle(
|
|
19936
19337
|
forwardedRef,
|
|
19937
19338
|
() => innerRef.current,
|
|
19938
19339
|
[]
|
|
@@ -19953,11 +19354,11 @@ var Textarea = React11.forwardRef(
|
|
|
19953
19354
|
const baseIconGap = iconGap != null ? iconGap : 1;
|
|
19954
19355
|
const leadingGap = leadingIconSpacing != null ? leadingIconSpacing : baseIconGap;
|
|
19955
19356
|
const trailingGap = trailingIconSpacing != null ? trailingIconSpacing : baseIconGap;
|
|
19956
|
-
const leadingIconsRef =
|
|
19957
|
-
const trailingIconsRef =
|
|
19958
|
-
const [leadingIconsWidth, setLeadingIconsWidth] =
|
|
19959
|
-
const [trailingIconsWidth, setTrailingIconsWidth] =
|
|
19960
|
-
const measureIconWidths =
|
|
19357
|
+
const leadingIconsRef = React66.useRef(null);
|
|
19358
|
+
const trailingIconsRef = React66.useRef(null);
|
|
19359
|
+
const [leadingIconsWidth, setLeadingIconsWidth] = React66.useState(0);
|
|
19360
|
+
const [trailingIconsWidth, setTrailingIconsWidth] = React66.useState(0);
|
|
19361
|
+
const measureIconWidths = React66.useCallback(() => {
|
|
19961
19362
|
if (typeof window === "undefined") return;
|
|
19962
19363
|
const lead = leadingIconsRef.current;
|
|
19963
19364
|
const trail = trailingIconsRef.current;
|
|
@@ -19974,7 +19375,7 @@ var Textarea = React11.forwardRef(
|
|
|
19974
19375
|
setTrailingIconsWidth(0);
|
|
19975
19376
|
}
|
|
19976
19377
|
}, []);
|
|
19977
|
-
|
|
19378
|
+
React66.useLayoutEffect(() => {
|
|
19978
19379
|
if (typeof window === "undefined" || typeof MutationObserver === "undefined") {
|
|
19979
19380
|
measureIconWidths();
|
|
19980
19381
|
return;
|
|
@@ -20003,10 +19404,10 @@ var Textarea = React11.forwardRef(
|
|
|
20003
19404
|
measureIconWidths();
|
|
20004
19405
|
return () => observers.forEach((o3) => o3.disconnect());
|
|
20005
19406
|
}, [measureIconWidths, hasLeadingIcons, hasTrailingIcons]);
|
|
20006
|
-
const [rowHeight, setRowHeight] =
|
|
19407
|
+
const [rowHeight, setRowHeight] = React66.useState(null);
|
|
20007
19408
|
const baseMinRows = Math.max(minRowsProp != null ? minRowsProp : 1, 1);
|
|
20008
|
-
const [rows, setRows] =
|
|
20009
|
-
|
|
19409
|
+
const [rows, setRows] = React66.useState(baseMinRows);
|
|
19410
|
+
React66.useLayoutEffect(() => {
|
|
20010
19411
|
if (typeof window === "undefined") return;
|
|
20011
19412
|
const el = innerRef.current;
|
|
20012
19413
|
if (!el) return;
|
|
@@ -20022,7 +19423,7 @@ var Textarea = React11.forwardRef(
|
|
|
20022
19423
|
setRows(baseMinRows);
|
|
20023
19424
|
}
|
|
20024
19425
|
}, [sizeKey, densityKey, baseMinRows]);
|
|
20025
|
-
const recomputeHeight =
|
|
19426
|
+
const recomputeHeight = React66.useCallback(() => {
|
|
20026
19427
|
if (!autoResize) return;
|
|
20027
19428
|
if (!innerRef.current) return;
|
|
20028
19429
|
if (!rowHeight) return;
|
|
@@ -20044,7 +19445,7 @@ var Textarea = React11.forwardRef(
|
|
|
20044
19445
|
el.style.height = `${nextHeight}px`;
|
|
20045
19446
|
setRows(nextRows);
|
|
20046
19447
|
}, [autoResize, rowHeight, baseMinRows, maxRows]);
|
|
20047
|
-
|
|
19448
|
+
React66.useLayoutEffect(() => {
|
|
20048
19449
|
recomputeHeight();
|
|
20049
19450
|
}, [recomputeHeight, rest.value, rest.defaultValue]);
|
|
20050
19451
|
const { px: pxDefault, py: pyDefault } = resolveBasePadding2(size, density);
|
|
@@ -20114,19 +19515,19 @@ var Textarea = React11.forwardRef(
|
|
|
20114
19515
|
const focusTextarea = () => {
|
|
20115
19516
|
if (innerRef.current) innerRef.current.focus();
|
|
20116
19517
|
};
|
|
20117
|
-
const handleFocus =
|
|
19518
|
+
const handleFocus = React66.useCallback(
|
|
20118
19519
|
(event) => {
|
|
20119
19520
|
onFocus == null ? void 0 : onFocus(event);
|
|
20120
19521
|
},
|
|
20121
19522
|
[onFocus]
|
|
20122
19523
|
);
|
|
20123
|
-
const handleBlur =
|
|
19524
|
+
const handleBlur = React66.useCallback(
|
|
20124
19525
|
(event) => {
|
|
20125
19526
|
onBlur == null ? void 0 : onBlur(event);
|
|
20126
19527
|
},
|
|
20127
19528
|
[onBlur]
|
|
20128
19529
|
);
|
|
20129
|
-
const handleChange =
|
|
19530
|
+
const handleChange = React66.useCallback(
|
|
20130
19531
|
(event) => {
|
|
20131
19532
|
onChange == null ? void 0 : onChange(event);
|
|
20132
19533
|
recomputeHeight();
|
|
@@ -20303,7 +19704,7 @@ function splitIntoTokens(raw, sep) {
|
|
|
20303
19704
|
}
|
|
20304
19705
|
return acc.map((t4) => t4.trim()).filter((t4) => t4.length > 0);
|
|
20305
19706
|
}
|
|
20306
|
-
var ShadcnChipsVariant =
|
|
19707
|
+
var ShadcnChipsVariant = React66.forwardRef(function ShadcnChipsVariant2(props, ref) {
|
|
20307
19708
|
var _a;
|
|
20308
19709
|
const {
|
|
20309
19710
|
// variant base bits
|
|
@@ -20339,10 +19740,10 @@ var ShadcnChipsVariant = React11.forwardRef(function ShadcnChipsVariant2(props,
|
|
|
20339
19740
|
// rest of text UI bits (size, density, icons, etc.)
|
|
20340
19741
|
...restTextProps
|
|
20341
19742
|
} = props;
|
|
20342
|
-
const chips =
|
|
19743
|
+
const chips = React66.useMemo(() => value != null ? value : [], [value]);
|
|
20343
19744
|
const hasChips = chips.length > 0;
|
|
20344
|
-
const [inputText, setInputText] =
|
|
20345
|
-
const emitChange =
|
|
19745
|
+
const [inputText, setInputText] = React66.useState("");
|
|
19746
|
+
const emitChange = React66.useCallback(
|
|
20346
19747
|
(nextChips, meta) => {
|
|
20347
19748
|
const detail = {
|
|
20348
19749
|
source: "variant",
|
|
@@ -20357,7 +19758,7 @@ var ShadcnChipsVariant = React11.forwardRef(function ShadcnChipsVariant2(props,
|
|
|
20357
19758
|
},
|
|
20358
19759
|
[onValue]
|
|
20359
19760
|
);
|
|
20360
|
-
const commitFromRaw =
|
|
19761
|
+
const commitFromRaw = React66.useCallback(
|
|
20361
19762
|
(raw) => {
|
|
20362
19763
|
const tokens = splitIntoTokens(raw, separators);
|
|
20363
19764
|
if (!tokens.length) return;
|
|
@@ -20378,7 +19779,7 @@ var ShadcnChipsVariant = React11.forwardRef(function ShadcnChipsVariant2(props,
|
|
|
20378
19779
|
},
|
|
20379
19780
|
[chips, separators, allowDuplicates, maxChips, emitChange, onAddChips]
|
|
20380
19781
|
);
|
|
20381
|
-
const handleRemoveAt =
|
|
19782
|
+
const handleRemoveAt = React66.useCallback(
|
|
20382
19783
|
(index) => {
|
|
20383
19784
|
if (index < 0 || index >= chips.length) return;
|
|
20384
19785
|
const removed = [chips[index]];
|
|
@@ -20388,7 +19789,7 @@ var ShadcnChipsVariant = React11.forwardRef(function ShadcnChipsVariant2(props,
|
|
|
20388
19789
|
},
|
|
20389
19790
|
[chips, emitChange, onRemoveChips]
|
|
20390
19791
|
);
|
|
20391
|
-
const handleClear =
|
|
19792
|
+
const handleClear = React66.useCallback(
|
|
20392
19793
|
(ev) => {
|
|
20393
19794
|
ev == null ? void 0 : ev.preventDefault();
|
|
20394
19795
|
ev == null ? void 0 : ev.stopPropagation();
|
|
@@ -20399,7 +19800,7 @@ var ShadcnChipsVariant = React11.forwardRef(function ShadcnChipsVariant2(props,
|
|
|
20399
19800
|
},
|
|
20400
19801
|
[chips, emitChange, onRemoveChips]
|
|
20401
19802
|
);
|
|
20402
|
-
const handleEntryChange =
|
|
19803
|
+
const handleEntryChange = React66.useCallback(
|
|
20403
19804
|
(event) => {
|
|
20404
19805
|
var _a2;
|
|
20405
19806
|
const next = (_a2 = event.target.value) != null ? _a2 : "";
|
|
@@ -20407,7 +19808,7 @@ var ShadcnChipsVariant = React11.forwardRef(function ShadcnChipsVariant2(props,
|
|
|
20407
19808
|
},
|
|
20408
19809
|
[]
|
|
20409
19810
|
);
|
|
20410
|
-
const handleEntryKeyDown =
|
|
19811
|
+
const handleEntryKeyDown = React66.useCallback(
|
|
20411
19812
|
(event) => {
|
|
20412
19813
|
const key = event.key;
|
|
20413
19814
|
if (key === "Enter" && addOnEnter) {
|
|
@@ -20438,7 +19839,7 @@ var ShadcnChipsVariant = React11.forwardRef(function ShadcnChipsVariant2(props,
|
|
|
20438
19839
|
handleRemoveAt
|
|
20439
19840
|
]
|
|
20440
19841
|
);
|
|
20441
|
-
const handleEntryBlur =
|
|
19842
|
+
const handleEntryBlur = React66.useCallback(
|
|
20442
19843
|
(event) => {
|
|
20443
19844
|
if (addOnBlur && inputText.trim().length) {
|
|
20444
19845
|
commitFromRaw(inputText);
|
|
@@ -20463,7 +19864,7 @@ var ShadcnChipsVariant = React11.forwardRef(function ShadcnChipsVariant2(props,
|
|
|
20463
19864
|
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
19865
|
const chipNodes = visibleChips.map((chip, index) => {
|
|
20465
19866
|
if (renderChip) {
|
|
20466
|
-
return /* @__PURE__ */ jsx(
|
|
19867
|
+
return /* @__PURE__ */ jsx(React66.Fragment, { children: renderChip(chip, index, {
|
|
20467
19868
|
remove: () => handleRemoveAt(index),
|
|
20468
19869
|
chips
|
|
20469
19870
|
}) }, `${chip}-${index}`);
|
|
@@ -20530,7 +19931,7 @@ var ShadcnChipsVariant = React11.forwardRef(function ShadcnChipsVariant2(props,
|
|
|
20530
19931
|
);
|
|
20531
19932
|
const node = (_a = renderOverflowChip == null ? void 0 : renderOverflowChip(hiddenCount, chips)) != null ? _a : defaultOverflow;
|
|
20532
19933
|
chipNodes.push(
|
|
20533
|
-
/* @__PURE__ */ jsx(
|
|
19934
|
+
/* @__PURE__ */ jsx(React66.Fragment, { children: node }, "__overflow")
|
|
20534
19935
|
);
|
|
20535
19936
|
}
|
|
20536
19937
|
const effectivePlacement = textareaMode ? placement != null ? placement : "inline" : placement != null ? placement : "inline";
|
|
@@ -20724,7 +20125,7 @@ var chipVariant = {
|
|
|
20724
20125
|
tags: ["chips", "multi-select", "tags"]
|
|
20725
20126
|
}
|
|
20726
20127
|
};
|
|
20727
|
-
var ShadcnTextareaVariant =
|
|
20128
|
+
var ShadcnTextareaVariant = React66.forwardRef(function ShadcnTextareaVariant2(props, ref) {
|
|
20728
20129
|
const {
|
|
20729
20130
|
value,
|
|
20730
20131
|
onValue,
|
|
@@ -20732,7 +20133,7 @@ var ShadcnTextareaVariant = React11.forwardRef(function ShadcnTextareaVariant2(p
|
|
|
20732
20133
|
// everything else goes straight to the UI Textarea
|
|
20733
20134
|
...rest
|
|
20734
20135
|
} = props;
|
|
20735
|
-
const handleChange =
|
|
20136
|
+
const handleChange = React66.useCallback(
|
|
20736
20137
|
(event) => {
|
|
20737
20138
|
var _a;
|
|
20738
20139
|
const next = (_a = event.target.value) != null ? _a : "";
|
|
@@ -20827,7 +20228,7 @@ function switchThumbSize(size) {
|
|
|
20827
20228
|
if (size === "lg") return "size-5";
|
|
20828
20229
|
return "size-4";
|
|
20829
20230
|
}
|
|
20830
|
-
var ShadcnToggleVariant =
|
|
20231
|
+
var ShadcnToggleVariant = React66.forwardRef(function ShadcnToggleVariant2(props, _ref) {
|
|
20831
20232
|
const {
|
|
20832
20233
|
// variant bits
|
|
20833
20234
|
value,
|
|
@@ -20849,7 +20250,7 @@ var ShadcnToggleVariant = React11.forwardRef(function ShadcnToggleVariant2(props
|
|
|
20849
20250
|
...restSwitchProps
|
|
20850
20251
|
} = props;
|
|
20851
20252
|
const checked = !!value;
|
|
20852
|
-
const handleToggle =
|
|
20253
|
+
const handleToggle = React66.useCallback(
|
|
20853
20254
|
(next) => {
|
|
20854
20255
|
const nextVal = Boolean(next);
|
|
20855
20256
|
const detail = {
|
|
@@ -21224,17 +20625,21 @@ function normalizeItems(items, mappers, optionValueKey, optionLabelKey) {
|
|
|
21224
20625
|
label: mappers.getLabel(item, index),
|
|
21225
20626
|
description: mappers.getDescription ? mappers.getDescription(item, index) : void 0,
|
|
21226
20627
|
disabled: mappers.isDisabled ? mappers.isDisabled(item, index) : false,
|
|
21227
|
-
key: mappers.getKey ? mappers.getKey(item, index) : index
|
|
20628
|
+
key: mappers.getKey ? mappers.getKey(item, index) : index,
|
|
20629
|
+
raw: item
|
|
21228
20630
|
}));
|
|
21229
20631
|
}
|
|
21230
20632
|
if (optionValueKey || optionLabelKey) {
|
|
21231
20633
|
return items.map((item, index) => {
|
|
21232
|
-
return
|
|
21233
|
-
|
|
21234
|
-
|
|
21235
|
-
|
|
21236
|
-
|
|
21237
|
-
|
|
20634
|
+
return {
|
|
20635
|
+
...globalNormalizeCheckBasedOptions(
|
|
20636
|
+
item,
|
|
20637
|
+
index,
|
|
20638
|
+
optionLabelKey,
|
|
20639
|
+
optionValueKey
|
|
20640
|
+
),
|
|
20641
|
+
raw: item
|
|
20642
|
+
};
|
|
21238
20643
|
});
|
|
21239
20644
|
}
|
|
21240
20645
|
return items.map((item, index) => {
|
|
@@ -21245,7 +20650,8 @@ function normalizeItems(items, mappers, optionValueKey, optionLabelKey) {
|
|
|
21245
20650
|
label: String(item),
|
|
21246
20651
|
description: void 0,
|
|
21247
20652
|
disabled: false,
|
|
21248
|
-
key: index
|
|
20653
|
+
key: index,
|
|
20654
|
+
raw: item
|
|
21249
20655
|
};
|
|
21250
20656
|
}
|
|
21251
20657
|
return item;
|
|
@@ -21290,7 +20696,7 @@ var InnerShadcnRadioVariant = (props, ref) => {
|
|
|
21290
20696
|
...restGroupProps
|
|
21291
20697
|
} = props;
|
|
21292
20698
|
const hasError = !!error;
|
|
21293
|
-
const normalized =
|
|
20699
|
+
const normalized = React66.useMemo(
|
|
21294
20700
|
() => normalizeItems(
|
|
21295
20701
|
items != null ? items : options,
|
|
21296
20702
|
mappers,
|
|
@@ -21300,19 +20706,20 @@ var InnerShadcnRadioVariant = (props, ref) => {
|
|
|
21300
20706
|
),
|
|
21301
20707
|
[items, options, mappers, optionValue, optionLabel]
|
|
21302
20708
|
);
|
|
21303
|
-
const selectedString =
|
|
20709
|
+
const selectedString = React66.useMemo(() => {
|
|
21304
20710
|
if (value === void 0) return void 0;
|
|
21305
20711
|
const found = normalized.find(
|
|
21306
20712
|
(item) => isEqualValue(item.value, value)
|
|
21307
20713
|
);
|
|
21308
20714
|
return found ? String(found.value) : void 0;
|
|
21309
20715
|
}, [normalized, value]);
|
|
21310
|
-
const handleSelect =
|
|
21311
|
-
(next) => {
|
|
20716
|
+
const handleSelect = React66.useCallback(
|
|
20717
|
+
(next, selectedRaw) => {
|
|
21312
20718
|
if (!onValue || disabled) return;
|
|
21313
20719
|
const detail = {
|
|
21314
20720
|
source: "variant",
|
|
21315
|
-
raw: next,
|
|
20721
|
+
raw: selectedRaw != null ? selectedRaw : next,
|
|
20722
|
+
selectedOptions: [selectedRaw != null ? selectedRaw : next],
|
|
21316
20723
|
nativeEvent: void 0,
|
|
21317
20724
|
meta: void 0
|
|
21318
20725
|
};
|
|
@@ -21320,11 +20727,12 @@ var InnerShadcnRadioVariant = (props, ref) => {
|
|
|
21320
20727
|
},
|
|
21321
20728
|
[onValue, disabled]
|
|
21322
20729
|
);
|
|
21323
|
-
const handleRadioChange =
|
|
20730
|
+
const handleRadioChange = React66.useCallback(
|
|
21324
20731
|
(raw) => {
|
|
20732
|
+
var _a;
|
|
21325
20733
|
const found = normalized.find((item) => String(item.value) === raw);
|
|
21326
20734
|
if (!found) return;
|
|
21327
|
-
handleSelect(found.value);
|
|
20735
|
+
handleSelect(found.value, (_a = found.raw) != null ? _a : found.value);
|
|
21328
20736
|
},
|
|
21329
20737
|
[normalized, handleSelect]
|
|
21330
20738
|
);
|
|
@@ -21443,7 +20851,7 @@ var InnerShadcnRadioVariant = (props, ref) => {
|
|
|
21443
20851
|
}
|
|
21444
20852
|
);
|
|
21445
20853
|
};
|
|
21446
|
-
var ShadcnRadioVariant =
|
|
20854
|
+
var ShadcnRadioVariant = React66.forwardRef(
|
|
21447
20855
|
InnerShadcnRadioVariant
|
|
21448
20856
|
);
|
|
21449
20857
|
|
|
@@ -21570,7 +20978,8 @@ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
|
|
|
21570
20978
|
description: mappers.getDescription ? mappers.getDescription(item, index) : void 0,
|
|
21571
20979
|
disabled: mappers.isDisabled ? mappers.isDisabled(item, index) : false,
|
|
21572
20980
|
key: mappers.getKey ? mappers.getKey(item, index) : index,
|
|
21573
|
-
tristate: mappers.getTristate ? mappers.getTristate(item, index) : void 0
|
|
20981
|
+
tristate: mappers.getTristate ? mappers.getTristate(item, index) : void 0,
|
|
20982
|
+
raw: item
|
|
21574
20983
|
}));
|
|
21575
20984
|
}
|
|
21576
20985
|
if (optionValueKey || optionLabelKey) {
|
|
@@ -21585,7 +20994,8 @@ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
|
|
|
21585
20994
|
const tristate = anyItem.tristate;
|
|
21586
20995
|
return {
|
|
21587
20996
|
...normalised,
|
|
21588
|
-
tristate
|
|
20997
|
+
tristate,
|
|
20998
|
+
raw: item
|
|
21589
20999
|
};
|
|
21590
21000
|
});
|
|
21591
21001
|
}
|
|
@@ -21598,7 +21008,8 @@ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
|
|
|
21598
21008
|
description: void 0,
|
|
21599
21009
|
disabled: false,
|
|
21600
21010
|
key: index,
|
|
21601
|
-
tristate: void 0
|
|
21011
|
+
tristate: void 0,
|
|
21012
|
+
raw: item
|
|
21602
21013
|
};
|
|
21603
21014
|
}
|
|
21604
21015
|
return item;
|
|
@@ -21609,7 +21020,17 @@ function isEqualValue2(a3, b2) {
|
|
|
21609
21020
|
}
|
|
21610
21021
|
function asGroupValue(value) {
|
|
21611
21022
|
if (!value) return void 0;
|
|
21612
|
-
if (Array.isArray(value))
|
|
21023
|
+
if (Array.isArray(value)) {
|
|
21024
|
+
if (value.length === 0) return void 0;
|
|
21025
|
+
const first = value[0];
|
|
21026
|
+
if (first && typeof first === "object" && "value" in first && "state" in first) {
|
|
21027
|
+
return value;
|
|
21028
|
+
}
|
|
21029
|
+
return value.map((item) => ({
|
|
21030
|
+
value: item,
|
|
21031
|
+
state: true
|
|
21032
|
+
}));
|
|
21033
|
+
}
|
|
21613
21034
|
if (typeof value == "object")
|
|
21614
21035
|
return Object.keys(value).map(
|
|
21615
21036
|
(key) => ({
|
|
@@ -21665,11 +21086,21 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
21665
21086
|
} = props;
|
|
21666
21087
|
const hasError = !!error;
|
|
21667
21088
|
const isSingle = !!single;
|
|
21089
|
+
const normalized = React66.useMemo(
|
|
21090
|
+
() => normalizeItems2(
|
|
21091
|
+
items != null ? items : options,
|
|
21092
|
+
mappers,
|
|
21093
|
+
optionValue,
|
|
21094
|
+
optionLabel
|
|
21095
|
+
),
|
|
21096
|
+
[items, options, mappers, optionValue, optionLabel]
|
|
21097
|
+
);
|
|
21668
21098
|
if (isSingle) {
|
|
21669
21099
|
const singleVal = asSingleValue(value);
|
|
21670
21100
|
const effectiveTristate = !!tristateDefault;
|
|
21671
21101
|
const internalState = effectiveTristate ? singleVal != null ? singleVal : "none" : !!singleVal;
|
|
21672
21102
|
const handleSingleChange = (next) => {
|
|
21103
|
+
var _a;
|
|
21673
21104
|
if (!onValue || disabled) return;
|
|
21674
21105
|
let nextPublic;
|
|
21675
21106
|
if (effectiveTristate) {
|
|
@@ -21680,6 +21111,7 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
21680
21111
|
const detail = {
|
|
21681
21112
|
source: "variant",
|
|
21682
21113
|
raw: nextPublic,
|
|
21114
|
+
selectedOptions: nextPublic === true ? normalized[0] ? [(_a = normalized[0].raw) != null ? _a : normalized[0].value] : [] : [],
|
|
21683
21115
|
nativeEvent: void 0,
|
|
21684
21116
|
meta: void 0
|
|
21685
21117
|
};
|
|
@@ -21738,15 +21170,6 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
21738
21170
|
);
|
|
21739
21171
|
}
|
|
21740
21172
|
const groupValue = asGroupValue(value);
|
|
21741
|
-
const normalized = React11.useMemo(
|
|
21742
|
-
() => normalizeItems2(
|
|
21743
|
-
items != null ? items : options,
|
|
21744
|
-
mappers,
|
|
21745
|
-
optionValue,
|
|
21746
|
-
optionLabel
|
|
21747
|
-
),
|
|
21748
|
-
[items, options, mappers, optionValue, optionLabel]
|
|
21749
|
-
);
|
|
21750
21173
|
const {
|
|
21751
21174
|
groupStyle,
|
|
21752
21175
|
groupClasses,
|
|
@@ -21766,14 +21189,21 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
21766
21189
|
labelTextSizeClass: labelTextSize2(size),
|
|
21767
21190
|
descriptionTextSizeClass: descriptionTextSize2(size)
|
|
21768
21191
|
});
|
|
21769
|
-
const
|
|
21192
|
+
const hasAnyTristate = React66.useMemo(
|
|
21193
|
+
() => normalized.some((item) => {
|
|
21194
|
+
var _a, _b;
|
|
21195
|
+
return (_b = (_a = item.tristate) != null ? _a : tristateDefault) != null ? _b : false;
|
|
21196
|
+
}),
|
|
21197
|
+
[normalized, tristateDefault]
|
|
21198
|
+
);
|
|
21199
|
+
const findEntryIndex = React66.useCallback(
|
|
21770
21200
|
(val) => {
|
|
21771
21201
|
if (!groupValue) return -1;
|
|
21772
21202
|
return groupValue.findIndex((e4) => isEqualValue2(e4.value, val));
|
|
21773
21203
|
},
|
|
21774
21204
|
[groupValue]
|
|
21775
21205
|
);
|
|
21776
|
-
const getEntryState =
|
|
21206
|
+
const getEntryState = React66.useCallback(
|
|
21777
21207
|
(val) => {
|
|
21778
21208
|
const idx = findEntryIndex(val);
|
|
21779
21209
|
if (!groupValue || idx === -1) return "none";
|
|
@@ -21781,7 +21211,7 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
21781
21211
|
},
|
|
21782
21212
|
[groupValue, findEntryIndex]
|
|
21783
21213
|
);
|
|
21784
|
-
const updateGroupValue =
|
|
21214
|
+
const updateGroupValue = React66.useCallback(
|
|
21785
21215
|
(itemValue, nextInternal, effectiveTristate) => {
|
|
21786
21216
|
if (!onValue || disabled) return;
|
|
21787
21217
|
const currentList = groupValue ? [...groupValue] : [];
|
|
@@ -21838,14 +21268,28 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
21838
21268
|
const detail = {
|
|
21839
21269
|
source: "variant",
|
|
21840
21270
|
raw: nextList,
|
|
21271
|
+
selectedOptions: nextList.map(
|
|
21272
|
+
(entry) => {
|
|
21273
|
+
var _a, _b;
|
|
21274
|
+
return (_b = (_a = normalized.find(
|
|
21275
|
+
(item) => isEqualValue2(item.value, entry.value)
|
|
21276
|
+
)) == null ? void 0 : _a.raw) != null ? _b : entry.value;
|
|
21277
|
+
}
|
|
21278
|
+
),
|
|
21841
21279
|
nativeEvent: void 0,
|
|
21842
21280
|
meta: void 0
|
|
21843
21281
|
};
|
|
21844
|
-
|
|
21845
|
-
|
|
21846
|
-
|
|
21282
|
+
if (hasAnyTristate) {
|
|
21283
|
+
const value2 = {};
|
|
21284
|
+
nextList.forEach(
|
|
21285
|
+
(item) => value2[item.value] = item.state
|
|
21286
|
+
);
|
|
21287
|
+
onValue(value2, detail);
|
|
21288
|
+
return;
|
|
21289
|
+
}
|
|
21290
|
+
onValue(nextList.map((item) => item.value), detail);
|
|
21847
21291
|
},
|
|
21848
|
-
[onValue, disabled, groupValue]
|
|
21292
|
+
[onValue, disabled, groupValue, normalized, hasAnyTristate]
|
|
21849
21293
|
);
|
|
21850
21294
|
return /* @__PURE__ */ jsx(
|
|
21851
21295
|
"div",
|
|
@@ -21975,7 +21419,7 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
21975
21419
|
}
|
|
21976
21420
|
);
|
|
21977
21421
|
};
|
|
21978
|
-
var ShadcnCheckboxVariant =
|
|
21422
|
+
var ShadcnCheckboxVariant = React66.forwardRef(
|
|
21979
21423
|
InnerShadcnCheckboxVariant
|
|
21980
21424
|
);
|
|
21981
21425
|
|
|
@@ -22022,7 +21466,7 @@ function triggerPadding(density) {
|
|
|
22022
21466
|
return "py-1.5";
|
|
22023
21467
|
}
|
|
22024
21468
|
}
|
|
22025
|
-
var ShadcnSelectVariant =
|
|
21469
|
+
var ShadcnSelectVariant = React66.forwardRef(function ShadcnSelectVariant2(props, _ref) {
|
|
22026
21470
|
var _a, _b;
|
|
22027
21471
|
const {
|
|
22028
21472
|
value,
|
|
@@ -22073,9 +21517,9 @@ var ShadcnSelectVariant = React11.forwardRef(function ShadcnSelectVariant2(props
|
|
|
22073
21517
|
virtualScroll = true
|
|
22074
21518
|
} = props;
|
|
22075
21519
|
const isButtonMode = mode === "button";
|
|
22076
|
-
const [open, setOpen] =
|
|
22077
|
-
const [query, setQuery] =
|
|
22078
|
-
const items =
|
|
21520
|
+
const [open, setOpen] = React66.useState(false);
|
|
21521
|
+
const [query, setQuery] = React66.useState("");
|
|
21522
|
+
const items = React66.useMemo(
|
|
22079
21523
|
() => normalizeOptions(options != null ? options : [], {
|
|
22080
21524
|
autoCap,
|
|
22081
21525
|
optionLabel,
|
|
@@ -22097,7 +21541,7 @@ var ShadcnSelectVariant = React11.forwardRef(function ShadcnSelectVariant2(props
|
|
|
22097
21541
|
]
|
|
22098
21542
|
);
|
|
22099
21543
|
const normalizedValue = value === "" || value == null ? void 0 : value;
|
|
22100
|
-
const valueMap =
|
|
21544
|
+
const valueMap = React66.useMemo(() => {
|
|
22101
21545
|
const map = /* @__PURE__ */ new Map();
|
|
22102
21546
|
for (const item of items) {
|
|
22103
21547
|
map.set(String(item.value), item.value);
|
|
@@ -22107,7 +21551,7 @@ var ShadcnSelectVariant = React11.forwardRef(function ShadcnSelectVariant2(props
|
|
|
22107
21551
|
const selectedItem = normalizedValue == null ? null : (_a = items.find(
|
|
22108
21552
|
(it) => String(it.value) === String(normalizedValue)
|
|
22109
21553
|
)) != null ? _a : null;
|
|
22110
|
-
const filteredItems =
|
|
21554
|
+
const filteredItems = React66.useMemo(() => {
|
|
22111
21555
|
if (!query) return items;
|
|
22112
21556
|
const q2 = query.toLowerCase();
|
|
22113
21557
|
return items.filter((it) => it.labelText.toLowerCase().includes(q2));
|
|
@@ -22119,15 +21563,16 @@ var ShadcnSelectVariant = React11.forwardRef(function ShadcnSelectVariant2(props
|
|
|
22119
21563
|
listMaxHeight,
|
|
22120
21564
|
Math.max(estimatedRowHeight, filteredItems.length * estimatedRowHeight)
|
|
22121
21565
|
);
|
|
22122
|
-
const handleChange =
|
|
21566
|
+
const handleChange = React66.useCallback(
|
|
22123
21567
|
(rawKey) => {
|
|
22124
|
-
var _a2, _b2, _c;
|
|
21568
|
+
var _a2, _b2, _c, _d;
|
|
22125
21569
|
if (!onValue || rawKey === "") return;
|
|
22126
21570
|
const primitive = (_a2 = valueMap.get(rawKey)) != null ? _a2 : rawKey;
|
|
22127
21571
|
const item = (_b2 = items.find((it) => String(it.value) === String(primitive))) != null ? _b2 : null;
|
|
22128
21572
|
const detail = {
|
|
22129
21573
|
source: "variant",
|
|
22130
21574
|
raw: (_c = item == null ? void 0 : item.raw) != null ? _c : primitive,
|
|
21575
|
+
selectedOptions: [(_d = item == null ? void 0 : item.raw) != null ? _d : primitive],
|
|
22131
21576
|
nativeEvent: void 0,
|
|
22132
21577
|
meta: void 0
|
|
22133
21578
|
};
|
|
@@ -22167,7 +21612,7 @@ var ShadcnSelectVariant = React11.forwardRef(function ShadcnSelectVariant2(props
|
|
|
22167
21612
|
"focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",
|
|
22168
21613
|
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive"
|
|
22169
21614
|
);
|
|
22170
|
-
const ButtonModeTrigger =
|
|
21615
|
+
const ButtonModeTrigger = React66.useMemo(() => {
|
|
22171
21616
|
if (!isButtonMode) return null;
|
|
22172
21617
|
const selectedValue = value;
|
|
22173
21618
|
const renderable = button != null ? button : children;
|
|
@@ -22229,6 +21674,7 @@ var ShadcnSelectVariant = React11.forwardRef(function ShadcnSelectVariant2(props
|
|
|
22229
21674
|
const detail = {
|
|
22230
21675
|
source: "variant",
|
|
22231
21676
|
raw: void 0,
|
|
21677
|
+
selectedOptions: [],
|
|
22232
21678
|
nativeEvent: void 0,
|
|
22233
21679
|
meta: { action: "clear" }
|
|
22234
21680
|
};
|
|
@@ -22577,10 +22023,10 @@ var SelectionSummary = ({
|
|
|
22577
22023
|
placeholder,
|
|
22578
22024
|
onRemoveValue
|
|
22579
22025
|
}) => {
|
|
22580
|
-
const containerRef =
|
|
22581
|
-
const [visibleCount, setVisibleCount] =
|
|
22582
|
-
const [moreOpen, setMoreOpen] =
|
|
22583
|
-
|
|
22026
|
+
const containerRef = React66.useRef(null);
|
|
22027
|
+
const [visibleCount, setVisibleCount] = React66.useState(0);
|
|
22028
|
+
const [moreOpen, setMoreOpen] = React66.useState(false);
|
|
22029
|
+
React66.useLayoutEffect(() => {
|
|
22584
22030
|
const el = containerRef.current;
|
|
22585
22031
|
if (!el) return;
|
|
22586
22032
|
const computeVisibleItems = () => {
|
|
@@ -22628,7 +22074,7 @@ var SelectionSummary = ({
|
|
|
22628
22074
|
ref: containerRef,
|
|
22629
22075
|
className: "flex items-center w-full overflow-hidden whitespace-nowrap",
|
|
22630
22076
|
children: [
|
|
22631
|
-
visibleItems.map((item, index) => /* @__PURE__ */ jsxs(
|
|
22077
|
+
visibleItems.map((item, index) => /* @__PURE__ */ jsxs(React66.Fragment, { children: [
|
|
22632
22078
|
/* @__PURE__ */ jsx("span", { className: "truncate flex-shrink-0", children: item.labelNode }),
|
|
22633
22079
|
index < visibleItems.length - 1 && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground mr-1", children: "," })
|
|
22634
22080
|
] }, item.key)),
|
|
@@ -22735,7 +22181,7 @@ function triggerPadding2(density) {
|
|
|
22735
22181
|
return "py-1.5";
|
|
22736
22182
|
}
|
|
22737
22183
|
}
|
|
22738
|
-
var ShadcnMultiSelectVariant =
|
|
22184
|
+
var ShadcnMultiSelectVariant = React66.forwardRef(function ShadcnMultiSelectVariant2(props, _ref) {
|
|
22739
22185
|
var _a;
|
|
22740
22186
|
const {
|
|
22741
22187
|
value,
|
|
@@ -22791,9 +22237,9 @@ var ShadcnMultiSelectVariant = React11.forwardRef(function ShadcnMultiSelectVari
|
|
|
22791
22237
|
selectedBadgeClassName,
|
|
22792
22238
|
selectedBadgePlacement = "end"
|
|
22793
22239
|
} = props;
|
|
22794
|
-
const [open, setOpen] =
|
|
22795
|
-
const [query, setQuery] =
|
|
22796
|
-
const { items, keyedItems } =
|
|
22240
|
+
const [open, setOpen] = React66.useState(false);
|
|
22241
|
+
const [query, setQuery] = React66.useState("");
|
|
22242
|
+
const { items, keyedItems } = React66.useMemo(() => {
|
|
22797
22243
|
const items2 = normalizeOptions2(options != null ? options : [], {
|
|
22798
22244
|
autoCap,
|
|
22799
22245
|
optionLabel,
|
|
@@ -22814,24 +22260,24 @@ var ShadcnMultiSelectVariant = React11.forwardRef(function ShadcnMultiSelectVari
|
|
|
22814
22260
|
optionKey,
|
|
22815
22261
|
optionIcon
|
|
22816
22262
|
]);
|
|
22817
|
-
const selectedValues =
|
|
22263
|
+
const selectedValues = React66.useMemo(
|
|
22818
22264
|
() => new Set(value != null ? value : []),
|
|
22819
22265
|
[value]
|
|
22820
22266
|
);
|
|
22821
|
-
const selectedItems =
|
|
22267
|
+
const selectedItems = React66.useMemo(
|
|
22822
22268
|
() => items.filter((it) => selectedValues.has(it.value)),
|
|
22823
22269
|
[items, selectedValues]
|
|
22824
22270
|
);
|
|
22825
|
-
const filteredItems =
|
|
22271
|
+
const filteredItems = React66.useMemo(() => {
|
|
22826
22272
|
if (!query) return items;
|
|
22827
22273
|
const q2 = query.toLowerCase();
|
|
22828
22274
|
return items.filter((it) => it.labelText.toLowerCase().includes(q2));
|
|
22829
22275
|
}, [items, query]);
|
|
22830
|
-
const selectableItems =
|
|
22276
|
+
const selectableItems = React66.useMemo(
|
|
22831
22277
|
() => items.filter((it) => !it.disabled),
|
|
22832
22278
|
[items]
|
|
22833
22279
|
);
|
|
22834
|
-
const allSelectableValues =
|
|
22280
|
+
const allSelectableValues = React66.useMemo(
|
|
22835
22281
|
() => new Set(selectableItems.map((it) => it.value)),
|
|
22836
22282
|
[selectableItems]
|
|
22837
22283
|
);
|
|
@@ -22851,7 +22297,7 @@ var ShadcnMultiSelectVariant = React11.forwardRef(function ShadcnMultiSelectVari
|
|
|
22851
22297
|
filteredItems.length * estimatedRowHeight + headerHeight + footerHeight
|
|
22852
22298
|
)
|
|
22853
22299
|
);
|
|
22854
|
-
const handleToggleValue =
|
|
22300
|
+
const handleToggleValue = React66.useCallback(
|
|
22855
22301
|
(primitive) => {
|
|
22856
22302
|
if (!onValue || disabled || readOnly) return;
|
|
22857
22303
|
const current = value != null ? value : [];
|
|
@@ -22863,7 +22309,12 @@ var ShadcnMultiSelectVariant = React11.forwardRef(function ShadcnMultiSelectVari
|
|
|
22863
22309
|
next = [...current, primitive];
|
|
22864
22310
|
}
|
|
22865
22311
|
const final = next.length ? next : void 0;
|
|
22866
|
-
const values = next == null ? void 0 : next.map(
|
|
22312
|
+
const values = next == null ? void 0 : next.map(
|
|
22313
|
+
(item) => {
|
|
22314
|
+
var _a2, _b;
|
|
22315
|
+
return (_b = (_a2 = keyedItems[item]) == null ? void 0 : _a2.raw) != null ? _b : item;
|
|
22316
|
+
}
|
|
22317
|
+
);
|
|
22867
22318
|
const detail = {
|
|
22868
22319
|
source: "variant",
|
|
22869
22320
|
raw: {
|
|
@@ -22872,14 +22323,15 @@ var ShadcnMultiSelectVariant = React11.forwardRef(function ShadcnMultiSelectVari
|
|
|
22872
22323
|
next: final,
|
|
22873
22324
|
values
|
|
22874
22325
|
},
|
|
22326
|
+
selectedOptions: values != null ? values : [],
|
|
22875
22327
|
nativeEvent: void 0,
|
|
22876
22328
|
meta: void 0
|
|
22877
22329
|
};
|
|
22878
22330
|
onValue(final, detail);
|
|
22879
22331
|
},
|
|
22880
|
-
[onValue, value, disabled, readOnly]
|
|
22332
|
+
[onValue, value, disabled, readOnly, keyedItems]
|
|
22881
22333
|
);
|
|
22882
|
-
const handleSelectAll =
|
|
22334
|
+
const handleSelectAll = React66.useCallback(() => {
|
|
22883
22335
|
if (!onValue || disabled || readOnly) return;
|
|
22884
22336
|
const current = value != null ? value : [];
|
|
22885
22337
|
const allSelectableArr = Array.from(allSelectableValues);
|
|
@@ -22893,7 +22345,10 @@ var ShadcnMultiSelectVariant = React11.forwardRef(function ShadcnMultiSelectVari
|
|
|
22893
22345
|
next = Array.from(merged);
|
|
22894
22346
|
}
|
|
22895
22347
|
const final = next.length ? next : void 0;
|
|
22896
|
-
const values = next.map((item) =>
|
|
22348
|
+
const values = next.map((item) => {
|
|
22349
|
+
var _a2, _b;
|
|
22350
|
+
return (_b = (_a2 = keyedItems[item]) == null ? void 0 : _a2.raw) != null ? _b : item;
|
|
22351
|
+
});
|
|
22897
22352
|
const detail = {
|
|
22898
22353
|
source: "variant",
|
|
22899
22354
|
raw: {
|
|
@@ -22901,6 +22356,7 @@ var ShadcnMultiSelectVariant = React11.forwardRef(function ShadcnMultiSelectVari
|
|
|
22901
22356
|
next: final,
|
|
22902
22357
|
values
|
|
22903
22358
|
},
|
|
22359
|
+
selectedOptions: values,
|
|
22904
22360
|
nativeEvent: void 0,
|
|
22905
22361
|
meta: {
|
|
22906
22362
|
allSelected: !currentlyAllSelected
|
|
@@ -22913,15 +22369,17 @@ var ShadcnMultiSelectVariant = React11.forwardRef(function ShadcnMultiSelectVari
|
|
|
22913
22369
|
disabled,
|
|
22914
22370
|
readOnly,
|
|
22915
22371
|
allSelectableValues,
|
|
22916
|
-
selectedValues
|
|
22372
|
+
selectedValues,
|
|
22373
|
+
keyedItems
|
|
22917
22374
|
]);
|
|
22918
|
-
const handleClearAll =
|
|
22375
|
+
const handleClearAll = React66.useCallback(() => {
|
|
22919
22376
|
if (!onValue || disabled || readOnly) return;
|
|
22920
22377
|
const detail = {
|
|
22921
22378
|
source: "variant",
|
|
22922
22379
|
raw: {
|
|
22923
22380
|
type: "clear"
|
|
22924
22381
|
},
|
|
22382
|
+
selectedOptions: [],
|
|
22925
22383
|
nativeEvent: void 0,
|
|
22926
22384
|
meta: void 0
|
|
22927
22385
|
};
|
|
@@ -22937,9 +22395,14 @@ var ShadcnMultiSelectVariant = React11.forwardRef(function ShadcnMultiSelectVari
|
|
|
22937
22395
|
selectedValues,
|
|
22938
22396
|
item.value
|
|
22939
22397
|
);
|
|
22398
|
+
const selectedOptions = (updated != null ? updated : []).map((value2) => {
|
|
22399
|
+
var _a2, _b;
|
|
22400
|
+
return (_b = (_a2 = keyedItems[value2]) == null ? void 0 : _a2.raw) != null ? _b : value2;
|
|
22401
|
+
});
|
|
22940
22402
|
const detail = {
|
|
22941
22403
|
source: "variant",
|
|
22942
22404
|
raw: item,
|
|
22405
|
+
selectedOptions,
|
|
22943
22406
|
nativeEvent: void 0,
|
|
22944
22407
|
meta: { action: "remove", removed: value }
|
|
22945
22408
|
};
|
|
@@ -22961,7 +22424,7 @@ var ShadcnMultiSelectVariant = React11.forwardRef(function ShadcnMultiSelectVari
|
|
|
22961
22424
|
const hasLeadingControl = !!leadingControl;
|
|
22962
22425
|
const hasTrailingControl = !!trailingControl;
|
|
22963
22426
|
const hasControls = hasLeadingControl || hasTrailingControl;
|
|
22964
|
-
const makeCheckboxNode =
|
|
22427
|
+
const makeCheckboxNode = React66.useCallback(
|
|
22965
22428
|
(opts) => {
|
|
22966
22429
|
if (renderCheckbox) {
|
|
22967
22430
|
return renderCheckbox(opts);
|
|
@@ -23057,7 +22520,7 @@ var ShadcnMultiSelectVariant = React11.forwardRef(function ShadcnMultiSelectVari
|
|
|
23057
22520
|
] })
|
|
23058
22521
|
}
|
|
23059
22522
|
);
|
|
23060
|
-
const ButtonModeTrigger =
|
|
22523
|
+
const ButtonModeTrigger = React66.useMemo(() => {
|
|
23061
22524
|
if (mode !== "button") return null;
|
|
23062
22525
|
const selectedCount = selectedItems.length;
|
|
23063
22526
|
const content = (() => {
|
|
@@ -23403,7 +22866,7 @@ function Slider({
|
|
|
23403
22866
|
max: max2 = 100,
|
|
23404
22867
|
...props
|
|
23405
22868
|
}) {
|
|
23406
|
-
const _values =
|
|
22869
|
+
const _values = React66.useMemo(
|
|
23407
22870
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min2, max2],
|
|
23408
22871
|
[value, defaultValue, min2, max2]
|
|
23409
22872
|
);
|
|
@@ -23482,7 +22945,7 @@ function clampToRange(v2, min2, max2) {
|
|
|
23482
22945
|
if (v2 > max2) return max2;
|
|
23483
22946
|
return v2;
|
|
23484
22947
|
}
|
|
23485
|
-
var ShadcnSliderVariant =
|
|
22948
|
+
var ShadcnSliderVariant = React66.forwardRef(function ShadcnSliderVariant2(props, _ref) {
|
|
23486
22949
|
const {
|
|
23487
22950
|
value,
|
|
23488
22951
|
onValue,
|
|
@@ -23521,7 +22984,7 @@ var ShadcnSliderVariant = React11.forwardRef(function ShadcnSliderVariant2(props
|
|
|
23521
22984
|
} = props;
|
|
23522
22985
|
const numericValue = typeof value === "number" ? value : min2;
|
|
23523
22986
|
const isDisabled = !!(disabled || readOnly);
|
|
23524
|
-
const handleChange =
|
|
22987
|
+
const handleChange = React66.useCallback(
|
|
23525
22988
|
(vals) => {
|
|
23526
22989
|
if (!onValue) return;
|
|
23527
22990
|
const next = clampToRange(vals[0], min2, max2);
|
|
@@ -23536,7 +22999,7 @@ var ShadcnSliderVariant = React11.forwardRef(function ShadcnSliderVariant2(props
|
|
|
23536
22999
|
[onValue, min2, max2]
|
|
23537
23000
|
);
|
|
23538
23001
|
const stepAmount = controlStep != null ? controlStep : step;
|
|
23539
|
-
const applyStep =
|
|
23002
|
+
const applyStep = React66.useCallback(
|
|
23540
23003
|
(direction) => {
|
|
23541
23004
|
if (!onValue || isDisabled) return;
|
|
23542
23005
|
const current = typeof value === "number" ? value : min2;
|
|
@@ -23994,7 +23457,7 @@ function getGapPx(el) {
|
|
|
23994
23457
|
const g2 = cs.columnGap && cs.columnGap !== "normal" ? cs.columnGap : cs.gap;
|
|
23995
23458
|
return parsePx(g2);
|
|
23996
23459
|
}
|
|
23997
|
-
var ShadcnKeyValueVariant =
|
|
23460
|
+
var ShadcnKeyValueVariant = React66.forwardRef(function ShadcnKeyValueVariant2(props, _ref) {
|
|
23998
23461
|
const {
|
|
23999
23462
|
value,
|
|
24000
23463
|
onValue,
|
|
@@ -24019,14 +23482,14 @@ var ShadcnKeyValueVariant = React11.forwardRef(function ShadcnKeyValueVariant2(p
|
|
|
24019
23482
|
renderChip
|
|
24020
23483
|
} = props;
|
|
24021
23484
|
const isDisabled = disabled || readOnly;
|
|
24022
|
-
const items =
|
|
24023
|
-
const [dialogOpen, setDialogOpen] =
|
|
24024
|
-
const [editingIndex, setEditingIndex] =
|
|
24025
|
-
const [draft, setDraft] =
|
|
23485
|
+
const items = React66.useMemo(() => mapToItems(value), [value]);
|
|
23486
|
+
const [dialogOpen, setDialogOpen] = React66.useState(false);
|
|
23487
|
+
const [editingIndex, setEditingIndex] = React66.useState(null);
|
|
23488
|
+
const [draft, setDraft] = React66.useState({ key: "", value: "" });
|
|
24026
23489
|
const canAdd = items.length < max2;
|
|
24027
23490
|
const canDelete = items.length > min2;
|
|
24028
23491
|
const hasItems = items.length > 0;
|
|
24029
|
-
const commitItems =
|
|
23492
|
+
const commitItems = React66.useCallback(
|
|
24030
23493
|
(next, meta) => {
|
|
24031
23494
|
if (!onValue) return;
|
|
24032
23495
|
const nextMap = itemsToMap(next);
|
|
@@ -24040,13 +23503,13 @@ var ShadcnKeyValueVariant = React11.forwardRef(function ShadcnKeyValueVariant2(p
|
|
|
24040
23503
|
},
|
|
24041
23504
|
[onValue]
|
|
24042
23505
|
);
|
|
24043
|
-
const openForNew =
|
|
23506
|
+
const openForNew = React66.useCallback(() => {
|
|
24044
23507
|
if (isDisabled || !canAdd) return;
|
|
24045
23508
|
setEditingIndex(null);
|
|
24046
23509
|
setDraft({ key: "", value: "" });
|
|
24047
23510
|
setDialogOpen(true);
|
|
24048
23511
|
}, [isDisabled, canAdd]);
|
|
24049
|
-
const openForEdit =
|
|
23512
|
+
const openForEdit = React66.useCallback(
|
|
24050
23513
|
(index) => {
|
|
24051
23514
|
if (isDisabled) return;
|
|
24052
23515
|
const item = items[index];
|
|
@@ -24057,7 +23520,7 @@ var ShadcnKeyValueVariant = React11.forwardRef(function ShadcnKeyValueVariant2(p
|
|
|
24057
23520
|
},
|
|
24058
23521
|
[isDisabled, items]
|
|
24059
23522
|
);
|
|
24060
|
-
const handleDelete =
|
|
23523
|
+
const handleDelete = React66.useCallback(() => {
|
|
24061
23524
|
if (editingIndex == null) return;
|
|
24062
23525
|
if (!canDelete) return;
|
|
24063
23526
|
const next = items.slice();
|
|
@@ -24068,7 +23531,7 @@ var ShadcnKeyValueVariant = React11.forwardRef(function ShadcnKeyValueVariant2(p
|
|
|
24068
23531
|
index: editingIndex
|
|
24069
23532
|
});
|
|
24070
23533
|
}, [editingIndex, items, canDelete, commitItems]);
|
|
24071
|
-
const handleSubmit =
|
|
23534
|
+
const handleSubmit = React66.useCallback(() => {
|
|
24072
23535
|
const trimmedKey = draft.key.trim();
|
|
24073
23536
|
const trimmedValue = draft.value;
|
|
24074
23537
|
if (!trimmedKey) return;
|
|
@@ -24090,7 +23553,7 @@ var ShadcnKeyValueVariant = React11.forwardRef(function ShadcnKeyValueVariant2(p
|
|
|
24090
23553
|
index: editingIndex != null ? editingIndex : next.length - 1
|
|
24091
23554
|
});
|
|
24092
23555
|
}, [draft, items, editingIndex, canAdd, commitItems]);
|
|
24093
|
-
const handleQuickRemove =
|
|
23556
|
+
const handleQuickRemove = React66.useCallback(
|
|
24094
23557
|
(index) => {
|
|
24095
23558
|
if (isDisabled || !canDelete) return;
|
|
24096
23559
|
const next = items.slice();
|
|
@@ -24099,21 +23562,21 @@ var ShadcnKeyValueVariant = React11.forwardRef(function ShadcnKeyValueVariant2(p
|
|
|
24099
23562
|
},
|
|
24100
23563
|
[isDisabled, canDelete, items, commitItems]
|
|
24101
23564
|
);
|
|
24102
|
-
const [listOpen, setListOpen] =
|
|
24103
|
-
const openList =
|
|
23565
|
+
const [listOpen, setListOpen] = React66.useState(false);
|
|
23566
|
+
const openList = React66.useCallback(() => {
|
|
24104
23567
|
if (isDisabled) return;
|
|
24105
23568
|
setListOpen(true);
|
|
24106
23569
|
}, [isDisabled]);
|
|
24107
|
-
const wrapRef =
|
|
24108
|
-
const leftRef =
|
|
24109
|
-
const moreMeasureRef =
|
|
24110
|
-
const chipRefs =
|
|
23570
|
+
const wrapRef = React66.useRef(null);
|
|
23571
|
+
const leftRef = React66.useRef(null);
|
|
23572
|
+
const moreMeasureRef = React66.useRef(null);
|
|
23573
|
+
const chipRefs = React66.useRef([]);
|
|
24111
23574
|
chipRefs.current = items.map((_2, i3) => {
|
|
24112
23575
|
var _a;
|
|
24113
23576
|
return (_a = chipRefs.current[i3]) != null ? _a : null;
|
|
24114
23577
|
});
|
|
24115
|
-
const [visibleCount, setVisibleCount] =
|
|
24116
|
-
const recomputeVisible =
|
|
23578
|
+
const [visibleCount, setVisibleCount] = React66.useState(() => items.length);
|
|
23579
|
+
const recomputeVisible = React66.useCallback(() => {
|
|
24117
23580
|
var _a, _b;
|
|
24118
23581
|
const leftEl = leftRef.current;
|
|
24119
23582
|
if (!leftEl) {
|
|
@@ -24162,10 +23625,10 @@ var ShadcnKeyValueVariant = React11.forwardRef(function ShadcnKeyValueVariant2(p
|
|
|
24162
23625
|
}
|
|
24163
23626
|
setVisibleCount(best);
|
|
24164
23627
|
}, [items.length]);
|
|
24165
|
-
|
|
23628
|
+
React66.useLayoutEffect(() => {
|
|
24166
23629
|
recomputeVisible();
|
|
24167
23630
|
}, [recomputeVisible, items, size, density, showValue]);
|
|
24168
|
-
|
|
23631
|
+
React66.useEffect(() => {
|
|
24169
23632
|
const el = leftRef.current;
|
|
24170
23633
|
if (!el) return;
|
|
24171
23634
|
const ro = new ResizeObserver(() => recomputeVisible());
|
|
@@ -24555,7 +24018,7 @@ var keyValueModule = {
|
|
|
24555
24018
|
label: ""
|
|
24556
24019
|
}
|
|
24557
24020
|
};
|
|
24558
|
-
var ShadcnCustomVariant =
|
|
24021
|
+
var ShadcnCustomVariant = React66.forwardRef(function ShadcnCustomVariant2(props, ref) {
|
|
24559
24022
|
const {
|
|
24560
24023
|
// Variant base props we care about:
|
|
24561
24024
|
value,
|
|
@@ -24591,7 +24054,7 @@ var ShadcnCustomVariant = React11.forwardRef(function ShadcnCustomVariant2(props
|
|
|
24591
24054
|
}
|
|
24592
24055
|
const isDisabled = !!disabled;
|
|
24593
24056
|
const isReadOnly = !!readOnly;
|
|
24594
|
-
const handleChange =
|
|
24057
|
+
const handleChange = React66.useCallback(
|
|
24595
24058
|
(...args) => {
|
|
24596
24059
|
var _a;
|
|
24597
24060
|
if (!onValue) return;
|
|
@@ -24696,7 +24159,7 @@ function triggerHeight3(size) {
|
|
|
24696
24159
|
return "min-h-9 text-sm";
|
|
24697
24160
|
}
|
|
24698
24161
|
}
|
|
24699
|
-
var ShadcnTreeSelectVariant =
|
|
24162
|
+
var ShadcnTreeSelectVariant = React66.forwardRef(function ShadcnTreeSelectVariant2(props, ref) {
|
|
24700
24163
|
const {
|
|
24701
24164
|
value,
|
|
24702
24165
|
onValue,
|
|
@@ -24749,14 +24212,14 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
24749
24212
|
selectedBadgeClassName,
|
|
24750
24213
|
selectedBadgePlacement = "corner"
|
|
24751
24214
|
} = props;
|
|
24752
|
-
const [open, setOpen] =
|
|
24753
|
-
const [query, setQuery] =
|
|
24215
|
+
const [open, setOpen] = React66.useState(false);
|
|
24216
|
+
const [query, setQuery] = React66.useState("");
|
|
24754
24217
|
const isDisabled = disabled || readOnly;
|
|
24755
|
-
const d =
|
|
24218
|
+
const d = React66.useMemo(
|
|
24756
24219
|
() => densityClasses(density),
|
|
24757
24220
|
[density]
|
|
24758
24221
|
);
|
|
24759
|
-
const tree =
|
|
24222
|
+
const tree = React66.useMemo(
|
|
24760
24223
|
() => normalizeTree(options != null ? options : [], {
|
|
24761
24224
|
autoCap,
|
|
24762
24225
|
optionLabel,
|
|
@@ -24777,8 +24240,8 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
24777
24240
|
optionKey
|
|
24778
24241
|
]
|
|
24779
24242
|
);
|
|
24780
|
-
const allNodesFlat =
|
|
24781
|
-
const computedInitialExpanded =
|
|
24243
|
+
const allNodesFlat = React66.useMemo(() => flattenTree(tree), [tree]);
|
|
24244
|
+
const computedInitialExpanded = React66.useMemo(() => {
|
|
24782
24245
|
if (expandAll) {
|
|
24783
24246
|
return new Set(
|
|
24784
24247
|
allNodesFlat.filter((n3) => n3.hasChildren).map((n3) => n3.value)
|
|
@@ -24789,13 +24252,13 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
24789
24252
|
}
|
|
24790
24253
|
return /* @__PURE__ */ new Set();
|
|
24791
24254
|
}, [expandAll, defaultExpandedValues, allNodesFlat]);
|
|
24792
|
-
const [expanded, setExpanded] =
|
|
24255
|
+
const [expanded, setExpanded] = React66.useState(
|
|
24793
24256
|
computedInitialExpanded
|
|
24794
24257
|
);
|
|
24795
|
-
|
|
24258
|
+
React66.useEffect(() => {
|
|
24796
24259
|
setExpanded(computedInitialExpanded);
|
|
24797
24260
|
}, [computedInitialExpanded]);
|
|
24798
|
-
const toggleExpanded =
|
|
24261
|
+
const toggleExpanded = React66.useCallback((key) => {
|
|
24799
24262
|
setExpanded((prev) => {
|
|
24800
24263
|
const next = new Set(prev);
|
|
24801
24264
|
if (next.has(key)) next.delete(key);
|
|
@@ -24803,7 +24266,7 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
24803
24266
|
return next;
|
|
24804
24267
|
});
|
|
24805
24268
|
}, []);
|
|
24806
|
-
const displayedNodes =
|
|
24269
|
+
const displayedNodes = React66.useMemo(() => {
|
|
24807
24270
|
if (query) {
|
|
24808
24271
|
const q2 = query.toLowerCase();
|
|
24809
24272
|
const matchSet = /* @__PURE__ */ new Set();
|
|
@@ -24837,19 +24300,19 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
24837
24300
|
displayedNodes.length * estimatedRowHeight
|
|
24838
24301
|
)
|
|
24839
24302
|
);
|
|
24840
|
-
const selectedValues =
|
|
24303
|
+
const selectedValues = React66.useMemo(() => {
|
|
24841
24304
|
if (value === void 0 || value === null) return [];
|
|
24842
24305
|
if (Array.isArray(value)) {
|
|
24843
24306
|
return multiple ? value : value.length ? [value[0]] : [];
|
|
24844
24307
|
}
|
|
24845
24308
|
return [value];
|
|
24846
24309
|
}, [value, multiple]);
|
|
24847
|
-
const selectedItems =
|
|
24310
|
+
const selectedItems = React66.useMemo(
|
|
24848
24311
|
() => allNodesFlat.filter((node) => selectedValues.includes(node.value)),
|
|
24849
24312
|
[allNodesFlat, selectedValues]
|
|
24850
24313
|
);
|
|
24851
24314
|
const selectedCount = selectedItems.length;
|
|
24852
|
-
const handleToggleValue =
|
|
24315
|
+
const handleToggleValue = React66.useCallback(
|
|
24853
24316
|
(item) => {
|
|
24854
24317
|
if (isDisabled) return;
|
|
24855
24318
|
if (leafOnly && item.hasChildren) {
|
|
@@ -24864,9 +24327,16 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
24864
24327
|
setOpen(false);
|
|
24865
24328
|
}
|
|
24866
24329
|
const nextSelectedValues = Array.isArray(nextValue) ? nextValue : nextValue !== void 0 && nextValue !== null ? [nextValue] : [];
|
|
24330
|
+
const nextSelectedOptions = nextSelectedValues.map(
|
|
24331
|
+
(val) => {
|
|
24332
|
+
var _a, _b;
|
|
24333
|
+
return (_b = (_a = allNodesFlat.find((node) => node.value === val)) == null ? void 0 : _a.raw) != null ? _b : val;
|
|
24334
|
+
}
|
|
24335
|
+
);
|
|
24867
24336
|
const detail = {
|
|
24868
24337
|
source: "variant",
|
|
24869
24338
|
raw: item.raw,
|
|
24339
|
+
selectedOptions: nextSelectedOptions,
|
|
24870
24340
|
nativeEvent: void 0,
|
|
24871
24341
|
meta: {
|
|
24872
24342
|
toggled: item.value,
|
|
@@ -24881,14 +24351,16 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
24881
24351
|
multiple,
|
|
24882
24352
|
selectedValues,
|
|
24883
24353
|
onValue,
|
|
24884
|
-
toggleExpanded
|
|
24354
|
+
toggleExpanded,
|
|
24355
|
+
allNodesFlat
|
|
24885
24356
|
]
|
|
24886
24357
|
);
|
|
24887
|
-
const handleClear =
|
|
24358
|
+
const handleClear = React66.useCallback(() => {
|
|
24888
24359
|
if (!onValue) return;
|
|
24889
24360
|
const detail = {
|
|
24890
24361
|
source: "variant",
|
|
24891
24362
|
raw: void 0,
|
|
24363
|
+
selectedOptions: [],
|
|
24892
24364
|
nativeEvent: void 0,
|
|
24893
24365
|
meta: { action: "clear" }
|
|
24894
24366
|
};
|
|
@@ -24991,7 +24463,7 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
24991
24463
|
] })
|
|
24992
24464
|
}
|
|
24993
24465
|
);
|
|
24994
|
-
const ButtonModeTrigger =
|
|
24466
|
+
const ButtonModeTrigger = React66.useMemo(() => {
|
|
24995
24467
|
if (mode !== "button") return null;
|
|
24996
24468
|
const ctx = { open, selectedItems, selectedCount };
|
|
24997
24469
|
const triggerNode = typeof button === "function" ? button(ctx) : button != null ? button : typeof children === "function" ? children(ctx) : children;
|
|
@@ -25021,7 +24493,7 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
25021
24493
|
badgeEl
|
|
25022
24494
|
] });
|
|
25023
24495
|
};
|
|
25024
|
-
if (
|
|
24496
|
+
if (React66.isValidElement(triggerNode)) {
|
|
25025
24497
|
return wrapWithBadge(triggerNode);
|
|
25026
24498
|
}
|
|
25027
24499
|
return wrapWithBadge(
|
|
@@ -25129,7 +24601,7 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
25129
24601
|
);
|
|
25130
24602
|
const renderer = (_a = item.render) != null ? _a : renderOption;
|
|
25131
24603
|
if (!renderer) {
|
|
25132
|
-
return /* @__PURE__ */ jsx(
|
|
24604
|
+
return /* @__PURE__ */ jsx(React66.Fragment, { children: optionNode }, item.key);
|
|
25133
24605
|
}
|
|
25134
24606
|
const rendered = renderer({
|
|
25135
24607
|
item,
|
|
@@ -25140,7 +24612,7 @@ var ShadcnTreeSelectVariant = React11.forwardRef(function ShadcnTreeSelectVarian
|
|
|
25140
24612
|
if (!item.disabled) handleToggleValue(item);
|
|
25141
24613
|
}
|
|
25142
24614
|
});
|
|
25143
|
-
return /* @__PURE__ */ jsx(
|
|
24615
|
+
return /* @__PURE__ */ jsx(React66.Fragment, { children: rendered }, item.key);
|
|
25144
24616
|
}
|
|
25145
24617
|
}
|
|
25146
24618
|
)
|
|
@@ -25465,8 +24937,8 @@ function mergeHandlers(a3, b2) {
|
|
|
25465
24937
|
};
|
|
25466
24938
|
}
|
|
25467
24939
|
var FileThumbnail = ({ item }) => {
|
|
25468
|
-
const [preview, setPreview] =
|
|
25469
|
-
|
|
24940
|
+
const [preview, setPreview] = React66.useState(null);
|
|
24941
|
+
React66.useEffect(() => {
|
|
25470
24942
|
var _a;
|
|
25471
24943
|
const isImage2 = ((_a = item.type) == null ? void 0 : _a.startsWith("image/")) || item.name.match(/\.(jpg|jpeg|png|gif|webp)$/i);
|
|
25472
24944
|
if (!isImage2) return;
|
|
@@ -25488,7 +24960,7 @@ var FileThumbnail = ({ item }) => {
|
|
|
25488
24960
|
}
|
|
25489
24961
|
) : /* @__PURE__ */ jsx(File2, { className: "h-4 w-4 text-muted-foreground/50" }) });
|
|
25490
24962
|
};
|
|
25491
|
-
var ShadcnFileVariant =
|
|
24963
|
+
var ShadcnFileVariant = React66.forwardRef(function ShadcnFileVariant2(props, ref) {
|
|
25492
24964
|
const {
|
|
25493
24965
|
value,
|
|
25494
24966
|
onValue,
|
|
@@ -25542,18 +25014,18 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25542
25014
|
} = props;
|
|
25543
25015
|
const joinControls = mode === "default" ? joinControlsProp != null ? joinControlsProp : true : false;
|
|
25544
25016
|
const extendBoxToControls = mode === "default" ? extendBoxToControlsProp != null ? extendBoxToControlsProp : true : false;
|
|
25545
|
-
const items =
|
|
25017
|
+
const items = React66.useMemo(() => {
|
|
25546
25018
|
var _a;
|
|
25547
25019
|
const raw = (_a = toArray(value)) != null ? _a : [];
|
|
25548
25020
|
return raw.map(normaliseFileLike);
|
|
25549
25021
|
}, [value]);
|
|
25550
25022
|
const isDisabled = Boolean(disabled || readOnly);
|
|
25551
|
-
const [dragOver, setDragOver] =
|
|
25552
|
-
const [selectedIds, setSelectedIds] =
|
|
25023
|
+
const [dragOver, setDragOver] = React66.useState(false);
|
|
25024
|
+
const [selectedIds, setSelectedIds] = React66.useState(
|
|
25553
25025
|
() => /* @__PURE__ */ new Set()
|
|
25554
25026
|
);
|
|
25555
|
-
const [popoverOpen, setPopoverOpen] =
|
|
25556
|
-
const fileInputRef =
|
|
25027
|
+
const [popoverOpen, setPopoverOpen] = React66.useState(false);
|
|
25028
|
+
const fileInputRef = React66.useRef(null);
|
|
25557
25029
|
const den = densityTokens(density);
|
|
25558
25030
|
const heightCls = triggerHeight4(size);
|
|
25559
25031
|
const chipHeightCls = chipHeight(size);
|
|
@@ -25562,7 +25034,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25562
25034
|
const resolvedTrailingIcons = (trailingIcons == null ? void 0 : trailingIcons.length) ? trailingIcons : [];
|
|
25563
25035
|
const hasExternalControls = !!leadingControl || !!trailingControl;
|
|
25564
25036
|
const COLLAPSE_LIMIT = 2;
|
|
25565
|
-
const emitChange =
|
|
25037
|
+
const emitChange = React66.useCallback(
|
|
25566
25038
|
(nextItems, meta) => {
|
|
25567
25039
|
var _a;
|
|
25568
25040
|
const nextValues = nextItems.map(fileItemToValue);
|
|
@@ -25576,7 +25048,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25576
25048
|
},
|
|
25577
25049
|
[multiple, onValue]
|
|
25578
25050
|
);
|
|
25579
|
-
const handleAddItems =
|
|
25051
|
+
const handleAddItems = React66.useCallback(
|
|
25580
25052
|
(incoming, from) => {
|
|
25581
25053
|
if (isDisabled) return;
|
|
25582
25054
|
let next = multiple ? [...items] : [];
|
|
@@ -25613,7 +25085,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25613
25085
|
onFilesAdded
|
|
25614
25086
|
]
|
|
25615
25087
|
);
|
|
25616
|
-
const handleRemove =
|
|
25088
|
+
const handleRemove = React66.useCallback(
|
|
25617
25089
|
(id) => {
|
|
25618
25090
|
const next = items.filter((i3) => i3.id !== id);
|
|
25619
25091
|
emitChange(next, { action: "remove", id });
|
|
@@ -25625,7 +25097,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25625
25097
|
},
|
|
25626
25098
|
[emitChange, items, selectedIds]
|
|
25627
25099
|
);
|
|
25628
|
-
const handleBulkRemove =
|
|
25100
|
+
const handleBulkRemove = React66.useCallback(() => {
|
|
25629
25101
|
const next = items.filter((i3) => !selectedIds.has(i3.id));
|
|
25630
25102
|
emitChange(next, {
|
|
25631
25103
|
action: "bulk-remove",
|
|
@@ -25633,7 +25105,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25633
25105
|
});
|
|
25634
25106
|
setSelectedIds(/* @__PURE__ */ new Set());
|
|
25635
25107
|
}, [emitChange, items, selectedIds]);
|
|
25636
|
-
const openPicker =
|
|
25108
|
+
const openPicker = React66.useCallback(async () => {
|
|
25637
25109
|
var _a;
|
|
25638
25110
|
if (isDisabled) return;
|
|
25639
25111
|
let resolvedLoader = customLoader != null ? customLoader : custom && getPaletteUtil("customLoader");
|
|
@@ -25672,14 +25144,14 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25672
25144
|
mergeMode,
|
|
25673
25145
|
multiple
|
|
25674
25146
|
]);
|
|
25675
|
-
const onDragOver =
|
|
25147
|
+
const onDragOver = React66.useCallback(
|
|
25676
25148
|
(e4) => {
|
|
25677
25149
|
e4.preventDefault();
|
|
25678
25150
|
if (!isDisabled) setDragOver(true);
|
|
25679
25151
|
},
|
|
25680
25152
|
[isDisabled]
|
|
25681
25153
|
);
|
|
25682
|
-
const onDrop =
|
|
25154
|
+
const onDrop = React66.useCallback(
|
|
25683
25155
|
(e4) => {
|
|
25684
25156
|
var _a;
|
|
25685
25157
|
e4.preventDefault();
|
|
@@ -25697,15 +25169,15 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25697
25169
|
}
|
|
25698
25170
|
e4.target.value = "";
|
|
25699
25171
|
};
|
|
25700
|
-
const FileChip =
|
|
25172
|
+
const FileChip = React66.useCallback(
|
|
25701
25173
|
({
|
|
25702
25174
|
item,
|
|
25703
25175
|
condensed = false
|
|
25704
25176
|
}) => {
|
|
25705
25177
|
const name = formatFileName ? formatFileName(item) : item.name;
|
|
25706
|
-
const [preview, setPreview] =
|
|
25707
|
-
const [isOpen, setIsOpen] =
|
|
25708
|
-
|
|
25178
|
+
const [preview, setPreview] = React66.useState(null);
|
|
25179
|
+
const [isOpen, setIsOpen] = React66.useState(false);
|
|
25180
|
+
React66.useEffect(() => {
|
|
25709
25181
|
var _a;
|
|
25710
25182
|
const isImage2 = ((_a = item.type) == null ? void 0 : _a.startsWith("image/")) || item.name.match(/\.(jpg|jpeg|png|gif|webp)$/i);
|
|
25711
25183
|
if (!isImage2) {
|
|
@@ -25812,7 +25284,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25812
25284
|
]
|
|
25813
25285
|
);
|
|
25814
25286
|
const selectedCount = items.length;
|
|
25815
|
-
const resolveButtonTriggerElement =
|
|
25287
|
+
const resolveButtonTriggerElement = React66.useCallback(() => {
|
|
25816
25288
|
const ctx = {
|
|
25817
25289
|
open: popoverOpen,
|
|
25818
25290
|
items,
|
|
@@ -25842,7 +25314,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25842
25314
|
);
|
|
25843
25315
|
const child = el.props.children;
|
|
25844
25316
|
if (selectedBadgePlacement === "end") {
|
|
25845
|
-
return
|
|
25317
|
+
return React66.cloneElement(el, {
|
|
25846
25318
|
className: nextClass,
|
|
25847
25319
|
children: /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2", children: [
|
|
25848
25320
|
/* @__PURE__ */ jsx("span", { className: "min-w-0", children: child }),
|
|
@@ -25850,7 +25322,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25850
25322
|
] })
|
|
25851
25323
|
});
|
|
25852
25324
|
}
|
|
25853
|
-
return
|
|
25325
|
+
return React66.cloneElement(el, {
|
|
25854
25326
|
className: nextClass,
|
|
25855
25327
|
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25856
25328
|
child,
|
|
@@ -25858,7 +25330,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25858
25330
|
] })
|
|
25859
25331
|
});
|
|
25860
25332
|
};
|
|
25861
|
-
const withDnD = (el) =>
|
|
25333
|
+
const withDnD = (el) => React66.cloneElement(el, {
|
|
25862
25334
|
onDragOver: mergeHandlers(
|
|
25863
25335
|
el.props.onDragOver,
|
|
25864
25336
|
onDragOver
|
|
@@ -25869,7 +25341,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25869
25341
|
),
|
|
25870
25342
|
onDrop: mergeHandlers(el.props.onDrop, onDrop)
|
|
25871
25343
|
});
|
|
25872
|
-
if (
|
|
25344
|
+
if (React66.isValidElement(rawNode)) {
|
|
25873
25345
|
return withDnD(injectBadgeIntoElement(rawNode));
|
|
25874
25346
|
}
|
|
25875
25347
|
const fallback = /* @__PURE__ */ jsxs(
|
|
@@ -25925,7 +25397,7 @@ var ShadcnFileVariant = React11.forwardRef(function ShadcnFileVariant2(props, re
|
|
|
25925
25397
|
selectedCount,
|
|
25926
25398
|
triggerClassName
|
|
25927
25399
|
]);
|
|
25928
|
-
const TriggerRegion =
|
|
25400
|
+
const TriggerRegion = React66.useMemo(() => {
|
|
25929
25401
|
if (showDropArea) {
|
|
25930
25402
|
if (renderDropArea)
|
|
25931
25403
|
return renderDropArea({ openPicker, isDragging: dragOver });
|
|
@@ -26385,7 +25857,7 @@ var toggleVariants = cva(
|
|
|
26385
25857
|
}
|
|
26386
25858
|
}
|
|
26387
25859
|
);
|
|
26388
|
-
var ToggleGroupContext =
|
|
25860
|
+
var ToggleGroupContext = React66.createContext({
|
|
26389
25861
|
size: "default",
|
|
26390
25862
|
variant: "default",
|
|
26391
25863
|
spacing: 0
|
|
@@ -26422,7 +25894,7 @@ function ToggleGroupItem({
|
|
|
26422
25894
|
size,
|
|
26423
25895
|
...props
|
|
26424
25896
|
}) {
|
|
26425
|
-
const context =
|
|
25897
|
+
const context = React66.useContext(ToggleGroupContext);
|
|
26426
25898
|
return /* @__PURE__ */ jsx(
|
|
26427
25899
|
ToggleGroupPrimitive.Item,
|
|
26428
25900
|
{
|
|
@@ -26586,7 +26058,7 @@ function normalizeOption(input, {
|
|
|
26586
26058
|
raw: input
|
|
26587
26059
|
};
|
|
26588
26060
|
}
|
|
26589
|
-
var ShadcnToggleVariant3 =
|
|
26061
|
+
var ShadcnToggleVariant3 = React66.forwardRef(function ShadcnToggleVariant4(props, ref) {
|
|
26590
26062
|
const {
|
|
26591
26063
|
value,
|
|
26592
26064
|
onValue,
|
|
@@ -26616,7 +26088,7 @@ var ShadcnToggleVariant3 = React11.forwardRef(function ShadcnToggleVariant4(prop
|
|
|
26616
26088
|
const isDisabled = Boolean(disabled || readOnly);
|
|
26617
26089
|
const toggleSize = mapSizeToToggleSize(size);
|
|
26618
26090
|
const currentValue = normalizeValue(value, multiple);
|
|
26619
|
-
const normalizedOptions =
|
|
26091
|
+
const normalizedOptions = React66.useMemo(
|
|
26620
26092
|
() => options.map(
|
|
26621
26093
|
(opt) => normalizeOption(
|
|
26622
26094
|
opt,
|
|
@@ -26642,7 +26114,7 @@ var ShadcnToggleVariant3 = React11.forwardRef(function ShadcnToggleVariant4(prop
|
|
|
26642
26114
|
autoCap
|
|
26643
26115
|
]
|
|
26644
26116
|
);
|
|
26645
|
-
const handleChange =
|
|
26117
|
+
const handleChange = React66.useCallback(
|
|
26646
26118
|
(val) => {
|
|
26647
26119
|
if (readOnly) return;
|
|
26648
26120
|
if (!onValue) return;
|
|
@@ -26662,6 +26134,7 @@ var ShadcnToggleVariant3 = React11.forwardRef(function ShadcnToggleVariant4(prop
|
|
|
26662
26134
|
source: "variant",
|
|
26663
26135
|
raw: rawSelection,
|
|
26664
26136
|
// original item(s)
|
|
26137
|
+
selectedOptions: Array.isArray(rawSelection) ? rawSelection : rawSelection === void 0 ? [] : [rawSelection],
|
|
26665
26138
|
nativeEvent: void 0,
|
|
26666
26139
|
meta: { action: "toggle" }
|
|
26667
26140
|
};
|
|
@@ -26679,7 +26152,7 @@ var ShadcnToggleVariant3 = React11.forwardRef(function ShadcnToggleVariant4(prop
|
|
|
26679
26152
|
className
|
|
26680
26153
|
);
|
|
26681
26154
|
console.log(layoutClasses, fullWidth, autoCap);
|
|
26682
|
-
const groupStyle =
|
|
26155
|
+
const groupStyle = React66.useMemo(() => {
|
|
26683
26156
|
const style = {};
|
|
26684
26157
|
if (layout === "grid") {
|
|
26685
26158
|
style.gridTemplateColumns = `repeat(${gridCols}, minmax(0, 1fr))`;
|
|
@@ -26777,29 +26250,29 @@ function ShadcnEditorVariant(props) {
|
|
|
26777
26250
|
toolbar = "default",
|
|
26778
26251
|
pastePlainText = false
|
|
26779
26252
|
} = props;
|
|
26780
|
-
const mountRef =
|
|
26781
|
-
const editorRef =
|
|
26782
|
-
const formatRef =
|
|
26783
|
-
const onValueRef =
|
|
26784
|
-
const syncingRef =
|
|
26785
|
-
const loadedRef =
|
|
26253
|
+
const mountRef = React66.useRef(null);
|
|
26254
|
+
const editorRef = React66.useRef(null);
|
|
26255
|
+
const formatRef = React66.useRef(format2);
|
|
26256
|
+
const onValueRef = React66.useRef(onValue);
|
|
26257
|
+
const syncingRef = React66.useRef(false);
|
|
26258
|
+
const loadedRef = React66.useRef(false);
|
|
26786
26259
|
formatRef.current = format2;
|
|
26787
26260
|
onValueRef.current = onValue;
|
|
26788
26261
|
const effectiveReadOnly = Boolean(disabled || readOnly);
|
|
26789
|
-
const readContent =
|
|
26262
|
+
const readContent = React66.useCallback((ed) => {
|
|
26790
26263
|
var _a, _b;
|
|
26791
26264
|
return formatRef.current === "markdown" ? (_a = ed.getMarkdown()) != null ? _a : "" : (_b = ed.getHTML()) != null ? _b : "";
|
|
26792
26265
|
}, []);
|
|
26793
|
-
const emit =
|
|
26266
|
+
const emit = React66.useCallback((next) => {
|
|
26794
26267
|
var _a;
|
|
26795
26268
|
const detail = { source: "user", raw: next };
|
|
26796
26269
|
(_a = onValueRef.current) == null ? void 0 : _a.call(onValueRef, next, detail);
|
|
26797
26270
|
}, []);
|
|
26798
|
-
const structuralKey =
|
|
26271
|
+
const structuralKey = React66.useMemo(() => {
|
|
26799
26272
|
const hideModeSwitch = toolbar === "none" || pastePlainText;
|
|
26800
26273
|
return JSON.stringify({ toolbar, useCommandShortcut, hideModeSwitch });
|
|
26801
26274
|
}, [toolbar, useCommandShortcut, pastePlainText]);
|
|
26802
|
-
|
|
26275
|
+
React66.useEffect(() => {
|
|
26803
26276
|
const el = mountRef.current;
|
|
26804
26277
|
if (!el) return;
|
|
26805
26278
|
if (editorRef.current) {
|
|
@@ -26866,29 +26339,29 @@ function ShadcnEditorVariant(props) {
|
|
|
26866
26339
|
editorRef.current = null;
|
|
26867
26340
|
};
|
|
26868
26341
|
}, [structuralKey]);
|
|
26869
|
-
|
|
26342
|
+
React66.useEffect(() => {
|
|
26870
26343
|
const ed = editorRef.current;
|
|
26871
26344
|
if (!ed) return;
|
|
26872
26345
|
if (typeof ed.setHeight === "function") ed.setHeight(height);
|
|
26873
26346
|
}, [height]);
|
|
26874
|
-
|
|
26347
|
+
React66.useEffect(() => {
|
|
26875
26348
|
const ed = editorRef.current;
|
|
26876
26349
|
if (!ed) return;
|
|
26877
26350
|
if (typeof ed.setPlaceholder === "function")
|
|
26878
26351
|
ed.setPlaceholder(placeholder);
|
|
26879
26352
|
}, [placeholder]);
|
|
26880
|
-
|
|
26353
|
+
React66.useEffect(() => {
|
|
26881
26354
|
const ed = editorRef.current;
|
|
26882
26355
|
if (!ed) return;
|
|
26883
26356
|
if (typeof ed.changeMode === "function") ed.changeMode(editType);
|
|
26884
26357
|
}, [editType]);
|
|
26885
|
-
|
|
26358
|
+
React66.useEffect(() => {
|
|
26886
26359
|
const ed = editorRef.current;
|
|
26887
26360
|
if (!ed) return;
|
|
26888
26361
|
if (typeof ed.changePreviewStyle === "function")
|
|
26889
26362
|
ed.changePreviewStyle(previewStyle);
|
|
26890
26363
|
}, [previewStyle]);
|
|
26891
|
-
|
|
26364
|
+
React66.useEffect(() => {
|
|
26892
26365
|
var _a, _b, _c, _d;
|
|
26893
26366
|
const ed = editorRef.current;
|
|
26894
26367
|
if (!ed) return;
|
|
@@ -26905,7 +26378,7 @@ function ShadcnEditorVariant(props) {
|
|
|
26905
26378
|
syncingRef.current = false;
|
|
26906
26379
|
});
|
|
26907
26380
|
}, [value, format2]);
|
|
26908
|
-
|
|
26381
|
+
React66.useEffect(() => {
|
|
26909
26382
|
if (!pastePlainText) return;
|
|
26910
26383
|
const host = mountRef.current;
|
|
26911
26384
|
if (!host) return;
|
|
@@ -27407,10 +26880,10 @@ function JsonEditorMain(props) {
|
|
|
27407
26880
|
className,
|
|
27408
26881
|
contentClassName
|
|
27409
26882
|
} = props;
|
|
27410
|
-
const directChildPaths =
|
|
26883
|
+
const directChildPaths = React66.useMemo(() => {
|
|
27411
26884
|
return getDirectChildPaths(route, allPaths);
|
|
27412
26885
|
}, [route, allPaths]);
|
|
27413
|
-
const rows =
|
|
26886
|
+
const rows = React66.useMemo(() => {
|
|
27414
26887
|
return resolveLayoutForParent({
|
|
27415
26888
|
parent: route,
|
|
27416
26889
|
childPaths: directChildPaths,
|
|
@@ -27418,7 +26891,7 @@ function JsonEditorMain(props) {
|
|
|
27418
26891
|
filters
|
|
27419
26892
|
});
|
|
27420
26893
|
}, [route, directChildPaths, layout, filters]);
|
|
27421
|
-
const effectiveRows =
|
|
26894
|
+
const effectiveRows = React66.useMemo(() => {
|
|
27422
26895
|
const hasAny = rows.some((r5) => {
|
|
27423
26896
|
var _a;
|
|
27424
26897
|
return (_a = r5.fields) == null ? void 0 : _a.length;
|
|
@@ -28594,7 +28067,7 @@ function JsonEditorRawPanel(props) {
|
|
|
28594
28067
|
const canEditRaw = (_b = permissions == null ? void 0 : permissions.canEditRaw) != null ? _b : false;
|
|
28595
28068
|
if (!canViewRaw) return null;
|
|
28596
28069
|
const viewOnly = !!disabled || !!readOnly || !canEditRaw;
|
|
28597
|
-
const onCopy =
|
|
28070
|
+
const onCopy = React66.useCallback(async () => {
|
|
28598
28071
|
try {
|
|
28599
28072
|
await navigator.clipboard.writeText(
|
|
28600
28073
|
JSON.stringify(root != null ? root : {}, null, 2)
|
|
@@ -28688,17 +28161,17 @@ function collectAllPaths(value, prefix = "", out = []) {
|
|
|
28688
28161
|
}
|
|
28689
28162
|
function useControllable(opts) {
|
|
28690
28163
|
const { value, defaultValue, onChange } = opts;
|
|
28691
|
-
const [inner, setInner] =
|
|
28164
|
+
const [inner, setInner] = React66.useState(defaultValue);
|
|
28692
28165
|
const isControlled = value !== void 0;
|
|
28693
28166
|
const state = isControlled ? value : inner;
|
|
28694
|
-
const setState =
|
|
28167
|
+
const setState = React66.useCallback(
|
|
28695
28168
|
(next) => {
|
|
28696
28169
|
if (!isControlled) setInner(next);
|
|
28697
28170
|
onChange == null ? void 0 : onChange(next);
|
|
28698
28171
|
},
|
|
28699
28172
|
[isControlled, onChange]
|
|
28700
28173
|
);
|
|
28701
|
-
|
|
28174
|
+
React66.useEffect(() => {
|
|
28702
28175
|
if (!isControlled) return;
|
|
28703
28176
|
setInner(value);
|
|
28704
28177
|
}, [isControlled]);
|
|
@@ -28713,7 +28186,7 @@ function callCallbacks(callbacks, action, nextRoot, ctx) {
|
|
|
28713
28186
|
const meta = { action, route: ctx.route, path, parent, key };
|
|
28714
28187
|
(_b = callbacks.onEdit) == null ? void 0 : _b.call(callbacks, nextRoot, meta);
|
|
28715
28188
|
}
|
|
28716
|
-
var JsonEditor =
|
|
28189
|
+
var JsonEditor = React66.forwardRef(function JsonEditorEditor(props, ref) {
|
|
28717
28190
|
var _a, _b;
|
|
28718
28191
|
const {
|
|
28719
28192
|
root,
|
|
@@ -28743,16 +28216,16 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28743
28216
|
} = props;
|
|
28744
28217
|
const canViewRaw = (_a = permissions == null ? void 0 : permissions.canViewRaw) != null ? _a : true;
|
|
28745
28218
|
const canEditRaw = (_b = permissions == null ? void 0 : permissions.canEditRaw) != null ? _b : false;
|
|
28746
|
-
const routes =
|
|
28219
|
+
const routes = React66.useMemo(
|
|
28747
28220
|
() => buildJsonRoutes(root, void 0, filters),
|
|
28748
28221
|
[root, filters]
|
|
28749
28222
|
);
|
|
28750
|
-
const allPaths =
|
|
28223
|
+
const allPaths = React66.useMemo(() => {
|
|
28751
28224
|
const list = collectAllPaths(root, "", []);
|
|
28752
28225
|
const seen = /* @__PURE__ */ new Set();
|
|
28753
28226
|
return list.filter((p2) => seen.has(p2) ? false : (seen.add(p2), true));
|
|
28754
28227
|
}, [root]);
|
|
28755
|
-
const computedInitialRoute =
|
|
28228
|
+
const computedInitialRoute = React66.useMemo(() => {
|
|
28756
28229
|
var _a2, _b2;
|
|
28757
28230
|
const explicit = routeProp != null ? routeProp : defaultRoute;
|
|
28758
28231
|
if (explicit !== void 0) return explicit;
|
|
@@ -28768,25 +28241,25 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28768
28241
|
defaultValue: defaultViewMode,
|
|
28769
28242
|
onChange: onViewModeChange
|
|
28770
28243
|
});
|
|
28771
|
-
|
|
28244
|
+
React66.useEffect(() => {
|
|
28772
28245
|
if (!canViewRaw && (viewMode === "raw" || viewMode === "split")) {
|
|
28773
28246
|
setViewMode("visual");
|
|
28774
28247
|
}
|
|
28775
28248
|
}, [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 =
|
|
28249
|
+
const fileInputRef = React66.useRef(null);
|
|
28250
|
+
const contentRef = React66.useRef(null);
|
|
28251
|
+
const [rawWidth, setRawWidth] = React66.useState(420);
|
|
28252
|
+
const [isResizing, setIsResizing] = React66.useState(false);
|
|
28253
|
+
const startXRef = React66.useRef(0);
|
|
28254
|
+
const startWRef = React66.useRef(0);
|
|
28255
|
+
const clampRawWidth = React66.useCallback((w2) => {
|
|
28783
28256
|
var _a2, _b2;
|
|
28784
28257
|
const containerW = (_b2 = (_a2 = contentRef.current) == null ? void 0 : _a2.getBoundingClientRect().width) != null ? _b2 : 0;
|
|
28785
28258
|
const min2 = 260;
|
|
28786
28259
|
const max2 = containerW ? Math.max(min2, Math.min(900, containerW - 240)) : 900;
|
|
28787
28260
|
return Math.max(min2, Math.min(max2, w2));
|
|
28788
28261
|
}, []);
|
|
28789
|
-
const onResizePointerDown =
|
|
28262
|
+
const onResizePointerDown = React66.useCallback(
|
|
28790
28263
|
(e4) => {
|
|
28791
28264
|
if (e4.button !== 0 && e4.pointerType === "mouse") return;
|
|
28792
28265
|
setIsResizing(true);
|
|
@@ -28798,7 +28271,7 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28798
28271
|
},
|
|
28799
28272
|
[rawWidth]
|
|
28800
28273
|
);
|
|
28801
|
-
const onResizePointerMove =
|
|
28274
|
+
const onResizePointerMove = React66.useCallback(
|
|
28802
28275
|
(e4) => {
|
|
28803
28276
|
if (!isResizing) return;
|
|
28804
28277
|
const dx = e4.clientX - startXRef.current;
|
|
@@ -28807,7 +28280,7 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28807
28280
|
},
|
|
28808
28281
|
[clampRawWidth, isResizing]
|
|
28809
28282
|
);
|
|
28810
|
-
const stopResizing =
|
|
28283
|
+
const stopResizing = React66.useCallback(
|
|
28811
28284
|
(e4) => {
|
|
28812
28285
|
if (!isResizing) return;
|
|
28813
28286
|
setIsResizing(false);
|
|
@@ -28818,14 +28291,14 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28818
28291
|
},
|
|
28819
28292
|
[isResizing]
|
|
28820
28293
|
);
|
|
28821
|
-
const loadFile =
|
|
28294
|
+
const loadFile = React66.useCallback(() => {
|
|
28822
28295
|
var _a2;
|
|
28823
28296
|
(_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
|
|
28824
28297
|
}, []);
|
|
28825
|
-
const close =
|
|
28298
|
+
const close = React66.useCallback(() => {
|
|
28826
28299
|
onClose == null ? void 0 : onClose();
|
|
28827
28300
|
}, [onClose]);
|
|
28828
|
-
const onFilePicked =
|
|
28301
|
+
const onFilePicked = React66.useCallback(
|
|
28829
28302
|
async (e4) => {
|
|
28830
28303
|
var _a2;
|
|
28831
28304
|
const file = (_a2 = e4.target.files) == null ? void 0 : _a2[0];
|
|
@@ -28845,7 +28318,7 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28845
28318
|
},
|
|
28846
28319
|
[callbacks, onRoot, route]
|
|
28847
28320
|
);
|
|
28848
|
-
const breadcrumb =
|
|
28321
|
+
const breadcrumb = React66.useMemo(() => {
|
|
28849
28322
|
const segs = splitPath(route);
|
|
28850
28323
|
const parts = [];
|
|
28851
28324
|
const rootNode = {
|
|
@@ -28872,7 +28345,7 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28872
28345
|
}) : prettifyLabel2(s3);
|
|
28873
28346
|
parts.push({ path: acc, label });
|
|
28874
28347
|
}
|
|
28875
|
-
return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 text-sm text-muted-foreground", children: parts.map((p2, idx) => /* @__PURE__ */ jsxs(
|
|
28348
|
+
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
28349
|
/* @__PURE__ */ jsx(
|
|
28877
28350
|
Button2,
|
|
28878
28351
|
{
|
|
@@ -28887,7 +28360,7 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28887
28360
|
idx < parts.length - 1 ? /* @__PURE__ */ jsx("span", { className: "opacity-60", children: "/" }) : null
|
|
28888
28361
|
] }, p2.path || "root")) });
|
|
28889
28362
|
}, [route, routes, renderRouteLabel, setRoute]);
|
|
28890
|
-
const routeTitle =
|
|
28363
|
+
const routeTitle = React66.useMemo(() => {
|
|
28891
28364
|
if (!route) return "Config.json";
|
|
28892
28365
|
const key = lastSegment(route);
|
|
28893
28366
|
if (renderRouteLabel) {
|
|
@@ -28903,7 +28376,7 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28903
28376
|
}
|
|
28904
28377
|
return prettifyLabel2(key);
|
|
28905
28378
|
}, [route, renderRouteLabel]);
|
|
28906
|
-
const viewControls =
|
|
28379
|
+
const viewControls = React66.useMemo(() => {
|
|
28907
28380
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 rounded-md border p-1", children: [
|
|
28908
28381
|
/* @__PURE__ */ jsxs(
|
|
28909
28382
|
Button2,
|
|
@@ -28946,7 +28419,7 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28946
28419
|
) : null
|
|
28947
28420
|
] });
|
|
28948
28421
|
}, [canViewRaw, setViewMode, viewMode]);
|
|
28949
|
-
const header =
|
|
28422
|
+
const header = React66.useMemo(() => {
|
|
28950
28423
|
const ctx = {
|
|
28951
28424
|
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
28425
|
viewControls,
|
|
@@ -28998,7 +28471,7 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
28998
28471
|
showClose,
|
|
28999
28472
|
viewControls
|
|
29000
28473
|
]);
|
|
29001
|
-
const onVisualRoot =
|
|
28474
|
+
const onVisualRoot = React66.useCallback(
|
|
29002
28475
|
(nextRoot, detail) => {
|
|
29003
28476
|
onRoot(nextRoot, detail);
|
|
29004
28477
|
const d = detail;
|
|
@@ -29010,14 +28483,14 @@ var JsonEditor = React11.forwardRef(function JsonEditorEditor(props, ref) {
|
|
|
29010
28483
|
},
|
|
29011
28484
|
[callbacks, onRoot, route]
|
|
29012
28485
|
);
|
|
29013
|
-
const onRawRoot =
|
|
28486
|
+
const onRawRoot = React66.useCallback(
|
|
29014
28487
|
(nextRoot, detail) => {
|
|
29015
28488
|
onRoot(nextRoot, detail);
|
|
29016
28489
|
callCallbacks(callbacks, "edit-raw", nextRoot, { route, path: "" });
|
|
29017
28490
|
},
|
|
29018
28491
|
[callbacks, onRoot, route]
|
|
29019
28492
|
);
|
|
29020
|
-
|
|
28493
|
+
React66.useImperativeHandle(
|
|
29021
28494
|
ref,
|
|
29022
28495
|
() => ({
|
|
29023
28496
|
loadFile,
|
|
@@ -29139,7 +28612,7 @@ function triggerHeightCls(size) {
|
|
|
29139
28612
|
return "h-9 text-sm";
|
|
29140
28613
|
}
|
|
29141
28614
|
}
|
|
29142
|
-
var ShadcnJsonEditorVariant =
|
|
28615
|
+
var ShadcnJsonEditorVariant = React66.forwardRef(function ShadcnJsonEditorVariant2(props, ref) {
|
|
29143
28616
|
var _a;
|
|
29144
28617
|
const {
|
|
29145
28618
|
mode = "popover",
|
|
@@ -29186,15 +28659,15 @@ var ShadcnJsonEditorVariant = React11.forwardRef(function ShadcnJsonEditorVarian
|
|
|
29186
28659
|
extendBoxToControls = true,
|
|
29187
28660
|
triggerClassName
|
|
29188
28661
|
} = props;
|
|
29189
|
-
const editorRef =
|
|
29190
|
-
const root =
|
|
28662
|
+
const editorRef = React66.useRef(null);
|
|
28663
|
+
const root = React66.useMemo(() => {
|
|
29191
28664
|
if ("root" in props) return props.root;
|
|
29192
28665
|
const v2 = props.value;
|
|
29193
28666
|
if (isPlainObject6(v2)) return v2;
|
|
29194
28667
|
if (v2 == null) return {};
|
|
29195
28668
|
return {};
|
|
29196
28669
|
}, [props]);
|
|
29197
|
-
const emitRoot =
|
|
28670
|
+
const emitRoot = React66.useCallback(
|
|
29198
28671
|
(nextRoot, detail) => {
|
|
29199
28672
|
var _a2, _b;
|
|
29200
28673
|
if ("onRoot" in props) {
|
|
@@ -29205,9 +28678,9 @@ var ShadcnJsonEditorVariant = React11.forwardRef(function ShadcnJsonEditorVarian
|
|
|
29205
28678
|
},
|
|
29206
28679
|
[props]
|
|
29207
28680
|
);
|
|
29208
|
-
const [openInner, setOpenInner] =
|
|
28681
|
+
const [openInner, setOpenInner] = React66.useState(false);
|
|
29209
28682
|
const open = openProp != null ? openProp : openInner;
|
|
29210
|
-
const setOpen =
|
|
28683
|
+
const setOpen = React66.useCallback(
|
|
29211
28684
|
(next) => {
|
|
29212
28685
|
if (openProp === void 0) setOpenInner(next);
|
|
29213
28686
|
onOpenChange == null ? void 0 : onOpenChange(next);
|
|
@@ -29215,11 +28688,11 @@ var ShadcnJsonEditorVariant = React11.forwardRef(function ShadcnJsonEditorVarian
|
|
|
29215
28688
|
},
|
|
29216
28689
|
[openProp, onOpenChange, onClose]
|
|
29217
28690
|
);
|
|
29218
|
-
const close =
|
|
29219
|
-
const doOpen =
|
|
29220
|
-
const toggle =
|
|
29221
|
-
const [expanded, setExpanded] =
|
|
29222
|
-
|
|
28691
|
+
const close = React66.useCallback(() => setOpen(false), [setOpen]);
|
|
28692
|
+
const doOpen = React66.useCallback(() => setOpen(true), [setOpen]);
|
|
28693
|
+
const toggle = React66.useCallback(() => setOpen(!open), [setOpen, open]);
|
|
28694
|
+
const [expanded, setExpanded] = React66.useState();
|
|
28695
|
+
React66.useImperativeHandle(
|
|
29223
28696
|
ref,
|
|
29224
28697
|
() => ({
|
|
29225
28698
|
open: doOpen,
|
|
@@ -30616,19 +30089,19 @@ function createListerRuntime(opts) {
|
|
|
30616
30089
|
selectors
|
|
30617
30090
|
};
|
|
30618
30091
|
}
|
|
30619
|
-
var ListerContext =
|
|
30092
|
+
var ListerContext = React66.createContext(
|
|
30620
30093
|
null
|
|
30621
30094
|
);
|
|
30622
30095
|
function ListerProvider({
|
|
30623
30096
|
children,
|
|
30624
30097
|
...opts
|
|
30625
30098
|
}) {
|
|
30626
|
-
const runtimeRef =
|
|
30627
|
-
const [, forceUpdate] =
|
|
30099
|
+
const runtimeRef = React66.useRef(null);
|
|
30100
|
+
const [, forceUpdate] = React66.useReducer((x2) => x2 + 1, 0);
|
|
30628
30101
|
if (!runtimeRef.current) {
|
|
30629
30102
|
runtimeRef.current = createListerRuntime(opts);
|
|
30630
30103
|
}
|
|
30631
|
-
|
|
30104
|
+
React66.useEffect(() => {
|
|
30632
30105
|
const runtime = runtimeRef.current;
|
|
30633
30106
|
if (!runtime) return;
|
|
30634
30107
|
const unsub = runtime.subscribe(() => {
|
|
@@ -30639,7 +30112,7 @@ function ListerProvider({
|
|
|
30639
30112
|
return /* @__PURE__ */ jsx(ListerContext.Provider, { value: runtimeRef.current, children });
|
|
30640
30113
|
}
|
|
30641
30114
|
function useListerRuntime() {
|
|
30642
|
-
const ctx =
|
|
30115
|
+
const ctx = React66.useContext(ListerContext);
|
|
30643
30116
|
if (!ctx)
|
|
30644
30117
|
throw new Error(
|
|
30645
30118
|
"useListerRuntime must be used within <ListerProvider>"
|
|
@@ -30676,14 +30149,14 @@ function ListerFiltersButton(props) {
|
|
|
30676
30149
|
const hasFilters = options.length > 0;
|
|
30677
30150
|
if (!hasFilters) return null;
|
|
30678
30151
|
const ctx = actions.getFilterCtx(id);
|
|
30679
|
-
const [openGroups, setOpenGroups] =
|
|
30152
|
+
const [openGroups, setOpenGroups] = React66.useState(
|
|
30680
30153
|
{}
|
|
30681
30154
|
);
|
|
30682
30155
|
const toggleGroup = (key) => {
|
|
30683
30156
|
setOpenGroups((m2) => ({ ...m2, [key]: !m2[key] }));
|
|
30684
30157
|
};
|
|
30685
30158
|
const selectedIds = asArray(session == null ? void 0 : session.selectedFilterValues);
|
|
30686
|
-
const appliedCount =
|
|
30159
|
+
const appliedCount = React66.useMemo(() => {
|
|
30687
30160
|
var _a2;
|
|
30688
30161
|
const patch = (_a2 = session == null ? void 0 : session.filtersPatch) != null ? _a2 : {};
|
|
30689
30162
|
return Object.keys(patch).length;
|
|
@@ -31194,7 +30667,7 @@ function normalizeIconifyInput(icon) {
|
|
|
31194
30667
|
}
|
|
31195
30668
|
function OptionIcon(props) {
|
|
31196
30669
|
const { icon, className } = props;
|
|
31197
|
-
if (
|
|
30670
|
+
if (React66.isValidElement(icon)) {
|
|
31198
30671
|
return /* @__PURE__ */ jsx("span", { className: cn("shrink-0", className), children: icon });
|
|
31199
30672
|
}
|
|
31200
30673
|
if (isSvgSnippetString(icon)) {
|
|
@@ -31247,7 +30720,7 @@ function OptionList(props) {
|
|
|
31247
30720
|
const options = (_a = selectors.visibleOptions(id)) != null ? _a : [];
|
|
31248
30721
|
const draft = s3 == null ? void 0 : s3.draftValue;
|
|
31249
30722
|
const isMulti = (s3 == null ? void 0 : s3.mode) === "multiple";
|
|
31250
|
-
const isSelected =
|
|
30723
|
+
const isSelected = React66.useCallback(
|
|
31251
30724
|
(value) => {
|
|
31252
30725
|
if (isMulti) return Array.isArray(draft) && draft.includes(value);
|
|
31253
30726
|
return draft === value;
|
|
@@ -31314,13 +30787,13 @@ function OptionList(props) {
|
|
|
31314
30787
|
}
|
|
31315
30788
|
function useLister() {
|
|
31316
30789
|
const runtime = useListerRuntime();
|
|
31317
|
-
const [state, setState] =
|
|
31318
|
-
|
|
30790
|
+
const [state, setState] = React66.useState(runtime.getState());
|
|
30791
|
+
React66.useEffect(() => {
|
|
31319
30792
|
return runtime.subscribe(() => {
|
|
31320
30793
|
setState(runtime.getState());
|
|
31321
30794
|
});
|
|
31322
30795
|
}, [runtime]);
|
|
31323
|
-
return
|
|
30796
|
+
return React66.useMemo(
|
|
31324
30797
|
() => ({
|
|
31325
30798
|
api: runtime.api,
|
|
31326
30799
|
actions: runtime.actions,
|
|
@@ -31659,25 +31132,25 @@ function ListerInner(props) {
|
|
|
31659
31132
|
panelClassName
|
|
31660
31133
|
} = props;
|
|
31661
31134
|
const { api, actions, store } = useLister();
|
|
31662
|
-
const ownerKeyRef =
|
|
31135
|
+
const ownerKeyRef = React66.useRef(
|
|
31663
31136
|
(_a = openOptions == null ? void 0 : openOptions.ownerKey) != null ? _a : createRuntimeKey("lister_owner")
|
|
31664
31137
|
);
|
|
31665
|
-
|
|
31138
|
+
React66.useEffect(() => {
|
|
31666
31139
|
const next = openOptions == null ? void 0 : openOptions.ownerKey;
|
|
31667
31140
|
if (next) ownerKeyRef.current = next;
|
|
31668
31141
|
}, [openOptions]);
|
|
31669
31142
|
const session = findSessionByOwner(store, ownerKeyRef.current);
|
|
31670
31143
|
const sessionId = session == null ? void 0 : session.sessionId;
|
|
31671
31144
|
const isOpen = !!(session == null ? void 0 : session.isOpen);
|
|
31672
|
-
const [selectedOptions, setSelectedOptions] =
|
|
31145
|
+
const [selectedOptions, setSelectedOptions] = React66.useState(
|
|
31673
31146
|
null
|
|
31674
31147
|
);
|
|
31675
|
-
const openingRef =
|
|
31148
|
+
const openingRef = React66.useRef(false);
|
|
31676
31149
|
const mode = modeProp != null ? modeProp : "single";
|
|
31677
31150
|
const confirm = mode === "multiple" ? true : !!confirmProp;
|
|
31678
31151
|
const disabledTrigger = !!(disabled || readOnly);
|
|
31679
31152
|
const hasValue = mode === "multiple" ? Array.isArray(value) && value.length > 0 : value != null && value !== "";
|
|
31680
|
-
|
|
31153
|
+
React66.useEffect(() => {
|
|
31681
31154
|
if (!hasValue) {
|
|
31682
31155
|
setSelectedOptions(null);
|
|
31683
31156
|
return;
|
|
@@ -31713,7 +31186,7 @@ function ListerInner(props) {
|
|
|
31713
31186
|
alive = false;
|
|
31714
31187
|
};
|
|
31715
31188
|
}, [api, def, filters, mode, value, hasValue]);
|
|
31716
|
-
const openSession =
|
|
31189
|
+
const openSession = React66.useCallback(async () => {
|
|
31717
31190
|
var _a2, _b2;
|
|
31718
31191
|
console.log(openingRef.current);
|
|
31719
31192
|
if (disabledTrigger) return;
|
|
@@ -31754,7 +31227,7 @@ function ListerInner(props) {
|
|
|
31754
31227
|
permissions,
|
|
31755
31228
|
value
|
|
31756
31229
|
]);
|
|
31757
|
-
const clear =
|
|
31230
|
+
const clear = React66.useCallback(() => {
|
|
31758
31231
|
if (disabledTrigger) return;
|
|
31759
31232
|
onValue(void 0, {
|
|
31760
31233
|
action: "clear",
|
|
@@ -31762,7 +31235,7 @@ function ListerInner(props) {
|
|
|
31762
31235
|
});
|
|
31763
31236
|
setSelectedOptions(null);
|
|
31764
31237
|
}, [disabledTrigger, onValue]);
|
|
31765
|
-
const display =
|
|
31238
|
+
const display = React66.useMemo(() => {
|
|
31766
31239
|
return buildLabelsFromOptions({
|
|
31767
31240
|
mode,
|
|
31768
31241
|
value,
|
|
@@ -31771,7 +31244,7 @@ function ListerInner(props) {
|
|
|
31771
31244
|
maxItems: maxDisplayItems
|
|
31772
31245
|
});
|
|
31773
31246
|
}, [maxDisplayItems, mode, placeholder, selectedOptions, value]);
|
|
31774
|
-
const triggerCtx =
|
|
31247
|
+
const triggerCtx = React66.useMemo(
|
|
31775
31248
|
() => ({
|
|
31776
31249
|
mode,
|
|
31777
31250
|
value,
|
|
@@ -31897,7 +31370,7 @@ function ListerInner(props) {
|
|
|
31897
31370
|
}
|
|
31898
31371
|
);
|
|
31899
31372
|
const userTriggerEl = renderTrigger ? renderTrigger(triggerCtx) : null;
|
|
31900
|
-
const TriggerNode = renderTrigger &&
|
|
31373
|
+
const TriggerNode = renderTrigger && React66.isValidElement(userTriggerEl) ? React66.cloneElement(userTriggerEl, {
|
|
31901
31374
|
className: cn(
|
|
31902
31375
|
(_b = userTriggerEl.props) == null ? void 0 : _b.className,
|
|
31903
31376
|
className
|
|
@@ -32123,11 +31596,11 @@ function ListerResolvedInner(props) {
|
|
|
32123
31596
|
} = props;
|
|
32124
31597
|
const isStandaloneInline = !def && endpoint != null;
|
|
32125
31598
|
const shouldInferOptionValue = isStandaloneInline && optionValue === void 0;
|
|
32126
|
-
const [resolvedOptionValue, setResolvedOptionValue] =
|
|
32127
|
-
|
|
31599
|
+
const [resolvedOptionValue, setResolvedOptionValue] = React66.useState(() => optionValue != null ? optionValue : "id");
|
|
31600
|
+
React66.useEffect(() => {
|
|
32128
31601
|
if (optionValue !== void 0) setResolvedOptionValue(optionValue);
|
|
32129
31602
|
}, [optionValue]);
|
|
32130
|
-
|
|
31603
|
+
React66.useEffect(() => {
|
|
32131
31604
|
if (!shouldInferOptionValue) return;
|
|
32132
31605
|
if (!endpoint) return;
|
|
32133
31606
|
let alive = true;
|
|
@@ -32179,7 +31652,7 @@ function ListerResolvedInner(props) {
|
|
|
32179
31652
|
const inlineExists = endpoint !== void 0 || method !== void 0 || buildRequest !== void 0 || selector !== void 0 || resolvedOptionValue !== void 0 || // ✅ KEEP THIS (your rule)
|
|
32180
31653
|
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
31654
|
search !== void 0;
|
|
32182
|
-
const finalDef =
|
|
31655
|
+
const finalDef = React66.useMemo(() => {
|
|
32183
31656
|
const baseDef = def;
|
|
32184
31657
|
if (!inlineExists) return baseDef;
|
|
32185
31658
|
if (!baseDef) {
|
|
@@ -32234,7 +31707,7 @@ function ListerResolvedInner(props) {
|
|
|
32234
31707
|
optionMeta,
|
|
32235
31708
|
search
|
|
32236
31709
|
]);
|
|
32237
|
-
const openOptions =
|
|
31710
|
+
const openOptions = React66.useMemo(() => {
|
|
32238
31711
|
return {
|
|
32239
31712
|
title,
|
|
32240
31713
|
searchMode,
|
|
@@ -32488,24 +31961,24 @@ function IconPickerPanel(props) {
|
|
|
32488
31961
|
maxRender = 2500
|
|
32489
31962
|
} = props;
|
|
32490
31963
|
const den = densityTokens2(density);
|
|
32491
|
-
const groups =
|
|
31964
|
+
const groups = React66.useMemo(() => {
|
|
32492
31965
|
const base = groupsProp != null ? groupsProp : [];
|
|
32493
31966
|
if (!(allowedGroupIds == null ? void 0 : allowedGroupIds.length)) return base;
|
|
32494
31967
|
const allowed = base.filter((g2) => allowedGroupIds.includes(g2.id));
|
|
32495
31968
|
return allowed.length ? allowed : base;
|
|
32496
31969
|
}, [allowedGroupIds, groupsProp]);
|
|
32497
|
-
const prefixes =
|
|
31970
|
+
const prefixes = React66.useMemo(() => {
|
|
32498
31971
|
return uniq2(groups.flatMap((g2) => g2.prefixes).filter(Boolean));
|
|
32499
31972
|
}, [groups]);
|
|
32500
|
-
const [selectedGroupId, setSelectedGroupId] =
|
|
31973
|
+
const [selectedGroupId, setSelectedGroupId] = React66.useState(() => {
|
|
32501
31974
|
var _a;
|
|
32502
31975
|
return (_a = groups[0]) == null ? void 0 : _a.id;
|
|
32503
31976
|
});
|
|
32504
|
-
const [searchQuery, setSearchQuery] =
|
|
32505
|
-
const [loading, setLoading] =
|
|
32506
|
-
const [error, setError] =
|
|
32507
|
-
const [allIcons, setAllIcons] =
|
|
32508
|
-
|
|
31977
|
+
const [searchQuery, setSearchQuery] = React66.useState("");
|
|
31978
|
+
const [loading, setLoading] = React66.useState(false);
|
|
31979
|
+
const [error, setError] = React66.useState(null);
|
|
31980
|
+
const [allIcons, setAllIcons] = React66.useState([]);
|
|
31981
|
+
React66.useEffect(() => {
|
|
32509
31982
|
setSelectedGroupId((prev) => {
|
|
32510
31983
|
var _a, _b;
|
|
32511
31984
|
if (!prev) return (_a = groups[0]) == null ? void 0 : _a.id;
|
|
@@ -32513,7 +31986,7 @@ function IconPickerPanel(props) {
|
|
|
32513
31986
|
return exists ? prev : (_b = groups[0]) == null ? void 0 : _b.id;
|
|
32514
31987
|
});
|
|
32515
31988
|
}, [groups]);
|
|
32516
|
-
|
|
31989
|
+
React66.useEffect(() => {
|
|
32517
31990
|
const controller = new AbortController();
|
|
32518
31991
|
let mounted = true;
|
|
32519
31992
|
const load = async () => {
|
|
@@ -32555,15 +32028,15 @@ function IconPickerPanel(props) {
|
|
|
32555
32028
|
controller.abort();
|
|
32556
32029
|
};
|
|
32557
32030
|
}, [prefixes, url]);
|
|
32558
|
-
const selectedGroup =
|
|
32031
|
+
const selectedGroup = React66.useMemo(
|
|
32559
32032
|
() => groups.find((g2) => g2.id === selectedGroupId),
|
|
32560
32033
|
[groups, selectedGroupId]
|
|
32561
32034
|
);
|
|
32562
|
-
const selectedGroupPrefixes =
|
|
32035
|
+
const selectedGroupPrefixes = React66.useMemo(() => {
|
|
32563
32036
|
if (!selectedGroup) return void 0;
|
|
32564
32037
|
return new Set(selectedGroup.prefixes);
|
|
32565
32038
|
}, [selectedGroup]);
|
|
32566
|
-
const filteredIcons =
|
|
32039
|
+
const filteredIcons = React66.useMemo(() => {
|
|
32567
32040
|
const q2 = searchQuery.trim().toLowerCase();
|
|
32568
32041
|
let list = allIcons;
|
|
32569
32042
|
if (selectedGroupPrefixes) {
|
|
@@ -32579,7 +32052,7 @@ function IconPickerPanel(props) {
|
|
|
32579
32052
|
}
|
|
32580
32053
|
return list;
|
|
32581
32054
|
}, [allIcons, searchQuery, selectedGroupPrefixes]);
|
|
32582
|
-
const limitedIcons =
|
|
32055
|
+
const limitedIcons = React66.useMemo(() => {
|
|
32583
32056
|
if (filteredIcons.length <= maxRender) return filteredIcons;
|
|
32584
32057
|
return filteredIcons.slice(0, maxRender);
|
|
32585
32058
|
}, [filteredIcons, maxRender]);
|
|
@@ -32593,7 +32066,7 @@ function IconPickerPanel(props) {
|
|
|
32593
32066
|
value.includes(iconName) ? value.filter((x2) => x2 !== iconName) : [...value, iconName]
|
|
32594
32067
|
);
|
|
32595
32068
|
};
|
|
32596
|
-
const GridComponents =
|
|
32069
|
+
const GridComponents = React66.useMemo(
|
|
32597
32070
|
() => ({
|
|
32598
32071
|
List: (p2) => /* @__PURE__ */ jsx(
|
|
32599
32072
|
"div",
|
|
@@ -32606,7 +32079,7 @@ function IconPickerPanel(props) {
|
|
|
32606
32079
|
}),
|
|
32607
32080
|
[]
|
|
32608
32081
|
);
|
|
32609
|
-
const gridHeightStyle =
|
|
32082
|
+
const gridHeightStyle = React66.useMemo(
|
|
32610
32083
|
() => ({ height: "50vh" }),
|
|
32611
32084
|
[]
|
|
32612
32085
|
);
|
|
@@ -32731,7 +32204,7 @@ function IconPickerPanel(props) {
|
|
|
32731
32204
|
)
|
|
32732
32205
|
] });
|
|
32733
32206
|
}
|
|
32734
|
-
var ShadcnIconVariant =
|
|
32207
|
+
var ShadcnIconVariant = React66.forwardRef(function ShadcnIconVariant2(props, ref) {
|
|
32735
32208
|
var _a, _b;
|
|
32736
32209
|
const {
|
|
32737
32210
|
value,
|
|
@@ -32783,12 +32256,12 @@ var ShadcnIconVariant = React11.forwardRef(function ShadcnIconVariant2(props, re
|
|
|
32783
32256
|
const resolvedLeadingIcons = (leadingIcons == null ? void 0 : leadingIcons.length) ? leadingIcons : icon ? [icon] : [];
|
|
32784
32257
|
const resolvedTrailingIcons = (trailingIcons == null ? void 0 : trailingIcons.length) ? trailingIcons : [];
|
|
32785
32258
|
const hasExternalControls = !!leadingControl || !!trailingControl;
|
|
32786
|
-
const [popoverOpen, setPopoverOpen] =
|
|
32787
|
-
const selected =
|
|
32259
|
+
const [popoverOpen, setPopoverOpen] = React66.useState(false);
|
|
32260
|
+
const selected = React66.useMemo(() => {
|
|
32788
32261
|
if (multiple) return Array.isArray(value) ? value.filter(Boolean) : [];
|
|
32789
32262
|
return typeof value === "string" && value ? [value] : [];
|
|
32790
32263
|
}, [multiple, value]);
|
|
32791
|
-
const emit =
|
|
32264
|
+
const emit = React66.useCallback(
|
|
32792
32265
|
(nextArr, meta) => {
|
|
32793
32266
|
var _a2, _b2;
|
|
32794
32267
|
if (!onValue) return;
|
|
@@ -32810,7 +32283,7 @@ var ShadcnIconVariant = React11.forwardRef(function ShadcnIconVariant2(props, re
|
|
|
32810
32283
|
},
|
|
32811
32284
|
[multiple, onValue]
|
|
32812
32285
|
);
|
|
32813
|
-
const Chip =
|
|
32286
|
+
const Chip = React66.useCallback(
|
|
32814
32287
|
({ iconName }) => {
|
|
32815
32288
|
var _a2;
|
|
32816
32289
|
const short = (_a2 = iconName.split(":")[1]) != null ? _a2 : iconName;
|
|
@@ -32873,7 +32346,7 @@ var ShadcnIconVariant = React11.forwardRef(function ShadcnIconVariant2(props, re
|
|
|
32873
32346
|
[chipHeightCls, den.chipGap, den.chipPad, emit, selected]
|
|
32874
32347
|
);
|
|
32875
32348
|
const selectedCount = selected.length;
|
|
32876
|
-
const resolveButtonTriggerElement =
|
|
32349
|
+
const resolveButtonTriggerElement = React66.useCallback(() => {
|
|
32877
32350
|
const ctx = {
|
|
32878
32351
|
open: popoverOpen,
|
|
32879
32352
|
items: selected,
|
|
@@ -32903,7 +32376,7 @@ var ShadcnIconVariant = React11.forwardRef(function ShadcnIconVariant2(props, re
|
|
|
32903
32376
|
);
|
|
32904
32377
|
const child = el.props.children;
|
|
32905
32378
|
if (selectedBadgePlacement === "end") {
|
|
32906
|
-
return
|
|
32379
|
+
return React66.cloneElement(el, {
|
|
32907
32380
|
className: nextClass,
|
|
32908
32381
|
children: /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2", children: [
|
|
32909
32382
|
/* @__PURE__ */ jsx("span", { className: "min-w-0", children: child }),
|
|
@@ -32911,7 +32384,7 @@ var ShadcnIconVariant = React11.forwardRef(function ShadcnIconVariant2(props, re
|
|
|
32911
32384
|
] })
|
|
32912
32385
|
});
|
|
32913
32386
|
}
|
|
32914
|
-
return
|
|
32387
|
+
return React66.cloneElement(el, {
|
|
32915
32388
|
className: nextClass,
|
|
32916
32389
|
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
32917
32390
|
child,
|
|
@@ -32919,7 +32392,7 @@ var ShadcnIconVariant = React11.forwardRef(function ShadcnIconVariant2(props, re
|
|
|
32919
32392
|
] })
|
|
32920
32393
|
});
|
|
32921
32394
|
};
|
|
32922
|
-
const withNoopDnD = (el) =>
|
|
32395
|
+
const withNoopDnD = (el) => React66.cloneElement(el, {
|
|
32923
32396
|
// keep event-merging parity with file variant (no-op, but safe)
|
|
32924
32397
|
onDragOver: mergeHandlers2(
|
|
32925
32398
|
el.props.onDragOver,
|
|
@@ -32936,7 +32409,7 @@ var ShadcnIconVariant = React11.forwardRef(function ShadcnIconVariant2(props, re
|
|
|
32936
32409
|
}
|
|
32937
32410
|
)
|
|
32938
32411
|
});
|
|
32939
|
-
if (
|
|
32412
|
+
if (React66.isValidElement(rawNode))
|
|
32940
32413
|
return withNoopDnD(injectBadgeIntoElement(rawNode));
|
|
32941
32414
|
const fallback = /* @__PURE__ */ jsxs(
|
|
32942
32415
|
"button",
|
|
@@ -32984,7 +32457,7 @@ var ShadcnIconVariant = React11.forwardRef(function ShadcnIconVariant2(props, re
|
|
|
32984
32457
|
triggerClassName
|
|
32985
32458
|
]);
|
|
32986
32459
|
const COLLAPSE_LIMIT = 2;
|
|
32987
|
-
const TriggerRegion =
|
|
32460
|
+
const TriggerRegion = React66.useMemo(() => {
|
|
32988
32461
|
const hasItems = selected.length > 0;
|
|
32989
32462
|
const visibleItems = selected.slice(0, COLLAPSE_LIMIT);
|
|
32990
32463
|
const hiddenCount = selected.length - COLLAPSE_LIMIT;
|
|
@@ -33072,7 +32545,7 @@ var ShadcnIconVariant = React11.forwardRef(function ShadcnIconVariant2(props, re
|
|
|
33072
32545
|
PopoverContent,
|
|
33073
32546
|
{
|
|
33074
32547
|
className: cn(
|
|
33075
|
-
"w-(--radix-popover-trigger-width) p-0",
|
|
32548
|
+
"w-(--radix-popover-trigger-width) p-0 max-h-(--radix-popper-available-height)",
|
|
33076
32549
|
popoverClassName
|
|
33077
32550
|
),
|
|
33078
32551
|
align: "start",
|
|
@@ -33356,8 +32829,8 @@ function isFileLikeString(s3) {
|
|
|
33356
32829
|
return FILE_EXT_RE.test(v2);
|
|
33357
32830
|
}
|
|
33358
32831
|
function useImagePreview(value) {
|
|
33359
|
-
const [src, setSrc] =
|
|
33360
|
-
|
|
32832
|
+
const [src, setSrc] = React66.useState(null);
|
|
32833
|
+
React66.useEffect(() => {
|
|
33361
32834
|
if (!value) {
|
|
33362
32835
|
setSrc(null);
|
|
33363
32836
|
return;
|
|
@@ -33375,7 +32848,7 @@ var ImageThumb = ({ image }) => {
|
|
|
33375
32848
|
const src = useImagePreview(image);
|
|
33376
32849
|
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
32850
|
};
|
|
33378
|
-
var ShadcnImageIconVariant =
|
|
32851
|
+
var ShadcnImageIconVariant = React66.forwardRef(function ShadcnImageIconVariant2(props, ref) {
|
|
33379
32852
|
const {
|
|
33380
32853
|
value,
|
|
33381
32854
|
onValue,
|
|
@@ -33432,7 +32905,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33432
32905
|
const regIcon = getPaletteUtil("iconPicker");
|
|
33433
32906
|
const resolvedIconUrl = iconUrl != null ? iconUrl : regIcon == null ? void 0 : regIcon.url;
|
|
33434
32907
|
const resolvedIconGroups = iconGroups != null ? iconGroups : regIcon == null ? void 0 : regIcon.groups;
|
|
33435
|
-
const effectiveIconGroups =
|
|
32908
|
+
const effectiveIconGroups = React66.useMemo(() => {
|
|
33436
32909
|
const groups = resolvedIconGroups != null ? resolvedIconGroups : DEFAULT_GROUPS;
|
|
33437
32910
|
const allowed = toArray(allowedIconGroupIds).filter(
|
|
33438
32911
|
Boolean
|
|
@@ -33441,7 +32914,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33441
32914
|
const filtered = groups.filter((g2) => allowed.includes(g2.id));
|
|
33442
32915
|
return filtered.length ? filtered : groups;
|
|
33443
32916
|
}, [resolvedIconGroups, allowedIconGroupIds]);
|
|
33444
|
-
const allowedIconPrefixes =
|
|
32917
|
+
const allowedIconPrefixes = React66.useMemo(() => {
|
|
33445
32918
|
var _a;
|
|
33446
32919
|
const set = /* @__PURE__ */ new Set();
|
|
33447
32920
|
for (const g2 of effectiveIconGroups) {
|
|
@@ -33449,7 +32922,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33449
32922
|
}
|
|
33450
32923
|
return set;
|
|
33451
32924
|
}, [effectiveIconGroups]);
|
|
33452
|
-
const isIconString =
|
|
32925
|
+
const isIconString = React66.useCallback(
|
|
33453
32926
|
(raw) => {
|
|
33454
32927
|
var _a;
|
|
33455
32928
|
const s3 = raw.trim();
|
|
@@ -33461,7 +32934,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33461
32934
|
},
|
|
33462
32935
|
[allowedIconPrefixes]
|
|
33463
32936
|
);
|
|
33464
|
-
const normaliseImageIconInput =
|
|
32937
|
+
const normaliseImageIconInput = React66.useCallback(
|
|
33465
32938
|
(v2) => {
|
|
33466
32939
|
var _a;
|
|
33467
32940
|
if (v2 == null) return null;
|
|
@@ -33502,25 +32975,25 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33502
32975
|
const resolvedLeadingIcons = (leadingIcons == null ? void 0 : leadingIcons.length) ? leadingIcons : icon ? [icon] : [];
|
|
33503
32976
|
const resolvedTrailingIcons = (trailingIcons == null ? void 0 : trailingIcons.length) ? trailingIcons : [];
|
|
33504
32977
|
const hasExternalControls = !!leadingControl || !!trailingControl;
|
|
33505
|
-
const [popoverOpen, setPopoverOpen] =
|
|
33506
|
-
const [tab, setTab] =
|
|
33507
|
-
const list =
|
|
32978
|
+
const [popoverOpen, setPopoverOpen] = React66.useState(false);
|
|
32979
|
+
const [tab, setTab] = React66.useState("icon");
|
|
32980
|
+
const list = React66.useMemo(() => {
|
|
33508
32981
|
const raw = multiple ? toArray(value) : value != null ? [value] : [];
|
|
33509
32982
|
return raw.map(normaliseImageIconInput).filter(Boolean);
|
|
33510
32983
|
}, [multiple, normaliseImageIconInput, value]);
|
|
33511
|
-
const iconsSelected =
|
|
32984
|
+
const iconsSelected = React66.useMemo(() => {
|
|
33512
32985
|
return list.filter((x2) => x2.kind === "icon").map((x2) => x2.icon);
|
|
33513
32986
|
}, [list]);
|
|
33514
|
-
const imagesSelected =
|
|
32987
|
+
const imagesSelected = React66.useMemo(() => {
|
|
33515
32988
|
return list.filter((x2) => x2.kind === "image");
|
|
33516
32989
|
}, [list]);
|
|
33517
|
-
const toFieldRaw =
|
|
32990
|
+
const toFieldRaw = React66.useCallback(
|
|
33518
32991
|
(x2) => {
|
|
33519
32992
|
return x2.kind === "icon" ? x2.icon : x2.image;
|
|
33520
32993
|
},
|
|
33521
32994
|
[]
|
|
33522
32995
|
);
|
|
33523
|
-
const emit =
|
|
32996
|
+
const emit = React66.useCallback(
|
|
33524
32997
|
(nextList, meta) => {
|
|
33525
32998
|
var _a, _b;
|
|
33526
32999
|
if (!onValue) return;
|
|
@@ -33549,7 +33022,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33549
33022
|
emit(next, { action: "remove", index: idx });
|
|
33550
33023
|
};
|
|
33551
33024
|
const clearAll = () => emit([], { action: "clear" });
|
|
33552
|
-
const Chip =
|
|
33025
|
+
const Chip = React66.useCallback(
|
|
33553
33026
|
({ item, index }) => {
|
|
33554
33027
|
var _a, _b, _c;
|
|
33555
33028
|
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 +33073,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33600
33073
|
[chipHeightCls, den.chipGap, den.chipPad, removeAt]
|
|
33601
33074
|
);
|
|
33602
33075
|
const selectedCount = list.length;
|
|
33603
|
-
const resolveButtonTriggerElement =
|
|
33076
|
+
const resolveButtonTriggerElement = React66.useCallback(() => {
|
|
33604
33077
|
const ctx = {
|
|
33605
33078
|
open: popoverOpen,
|
|
33606
33079
|
items: list,
|
|
@@ -33630,7 +33103,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33630
33103
|
);
|
|
33631
33104
|
const child = el.props.children;
|
|
33632
33105
|
if (selectedBadgePlacement === "end") {
|
|
33633
|
-
return
|
|
33106
|
+
return React66.cloneElement(el, {
|
|
33634
33107
|
className: nextClass,
|
|
33635
33108
|
children: /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2", children: [
|
|
33636
33109
|
/* @__PURE__ */ jsx("span", { className: "min-w-0", children: child }),
|
|
@@ -33638,7 +33111,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33638
33111
|
] })
|
|
33639
33112
|
});
|
|
33640
33113
|
}
|
|
33641
|
-
return
|
|
33114
|
+
return React66.cloneElement(el, {
|
|
33642
33115
|
className: nextClass,
|
|
33643
33116
|
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
33644
33117
|
child,
|
|
@@ -33646,7 +33119,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33646
33119
|
] })
|
|
33647
33120
|
});
|
|
33648
33121
|
};
|
|
33649
|
-
if (
|
|
33122
|
+
if (React66.isValidElement(rawNode))
|
|
33650
33123
|
return injectBadgeIntoElement(rawNode);
|
|
33651
33124
|
return /* @__PURE__ */ jsxs(
|
|
33652
33125
|
"button",
|
|
@@ -33678,12 +33151,12 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33678
33151
|
selectedCount,
|
|
33679
33152
|
triggerClassName
|
|
33680
33153
|
]);
|
|
33681
|
-
const [dragOver, setDragOver] =
|
|
33682
|
-
const fileInputRef =
|
|
33683
|
-
const [imgSelectedIds, setImgSelectedIds] =
|
|
33154
|
+
const [dragOver, setDragOver] = React66.useState(false);
|
|
33155
|
+
const fileInputRef = React66.useRef(null);
|
|
33156
|
+
const [imgSelectedIds, setImgSelectedIds] = React66.useState(
|
|
33684
33157
|
() => /* @__PURE__ */ new Set()
|
|
33685
33158
|
);
|
|
33686
|
-
const imageItems =
|
|
33159
|
+
const imageItems = React66.useMemo(() => {
|
|
33687
33160
|
return imagesSelected.map((x2) => normaliseFileLike2(x2.image));
|
|
33688
33161
|
}, [imagesSelected]);
|
|
33689
33162
|
const canAddMore = (nextCount) => {
|
|
@@ -33746,7 +33219,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33746
33219
|
setImagesFromItems(next, { from });
|
|
33747
33220
|
}
|
|
33748
33221
|
};
|
|
33749
|
-
const openImagePicker =
|
|
33222
|
+
const openImagePicker = React66.useCallback(async () => {
|
|
33750
33223
|
var _a;
|
|
33751
33224
|
if (isDisabled) return;
|
|
33752
33225
|
const resolvedLoader = typeof customLoader == "function" ? customLoader : customLoader ? getPaletteUtil("customLoader") : void 0;
|
|
@@ -33771,14 +33244,14 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33771
33244
|
}
|
|
33772
33245
|
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
33773
33246
|
}, [accept, customLoader, imageItems, isDisabled, mergeMode, multiple]);
|
|
33774
|
-
const onDragOver =
|
|
33247
|
+
const onDragOver = React66.useCallback(
|
|
33775
33248
|
(e4) => {
|
|
33776
33249
|
e4.preventDefault();
|
|
33777
33250
|
if (!isDisabled) setDragOver(true);
|
|
33778
33251
|
},
|
|
33779
33252
|
[isDisabled]
|
|
33780
33253
|
);
|
|
33781
|
-
const onDrop =
|
|
33254
|
+
const onDrop = React66.useCallback(
|
|
33782
33255
|
(e4) => {
|
|
33783
33256
|
var _a;
|
|
33784
33257
|
e4.preventDefault();
|
|
@@ -33827,7 +33300,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33827
33300
|
if (icons[0]) setPopoverOpen(false);
|
|
33828
33301
|
}
|
|
33829
33302
|
};
|
|
33830
|
-
const TriggerRegion =
|
|
33303
|
+
const TriggerRegion = React66.useMemo(() => {
|
|
33831
33304
|
const COLLAPSE_LIMIT = 2;
|
|
33832
33305
|
const hasItems = list.length > 0;
|
|
33833
33306
|
const visibleItems = list.slice(0, COLLAPSE_LIMIT);
|
|
@@ -33922,7 +33395,7 @@ var ShadcnImageIconVariant = React11.forwardRef(function ShadcnImageIconVariant2
|
|
|
33922
33395
|
PopoverContent,
|
|
33923
33396
|
{
|
|
33924
33397
|
className: cn(
|
|
33925
|
-
"w-(--radix-popover-trigger-width) p-0",
|
|
33398
|
+
"w-(--radix-popover-trigger-width) p-0 max-h-(--radix-popper-available-height)",
|
|
33926
33399
|
popoverClassName
|
|
33927
33400
|
),
|
|
33928
33401
|
align: "start",
|
|
@@ -34745,7 +34218,7 @@ function InputField(props) {
|
|
|
34745
34218
|
return null;
|
|
34746
34219
|
}
|
|
34747
34220
|
const classes = getClasses(props);
|
|
34748
|
-
const layout =
|
|
34221
|
+
const layout = React66.useMemo(() => {
|
|
34749
34222
|
var _a2;
|
|
34750
34223
|
const defaultsLayout = (_a2 = module2.defaults) == null ? void 0 : _a2.layout;
|
|
34751
34224
|
const overrides = {};
|
|
@@ -34793,7 +34266,7 @@ function InputField(props) {
|
|
|
34793
34266
|
]);
|
|
34794
34267
|
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
34268
|
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 =
|
|
34269
|
+
const validate = React66.useCallback(
|
|
34797
34270
|
(value2, field2, form, _report) => {
|
|
34798
34271
|
var _a2;
|
|
34799
34272
|
const messages = [];
|
|
@@ -34833,7 +34306,7 @@ function InputField(props) {
|
|
|
34833
34306
|
const { value: fieldValue, setValue, error, ref, key } = field;
|
|
34834
34307
|
const Variant = module2.Variant;
|
|
34835
34308
|
const visualError = (errorText != null ? errorText : error) || "";
|
|
34836
|
-
const handleValueChange =
|
|
34309
|
+
const handleValueChange = React66.useCallback(
|
|
34837
34310
|
(next, detail) => {
|
|
34838
34311
|
let finalValue = next;
|
|
34839
34312
|
let defaultPrevented = false;
|
|
@@ -34882,7 +34355,7 @@ function InputField(props) {
|
|
|
34882
34355
|
hostVariantClass,
|
|
34883
34356
|
classes == null ? void 0 : classes.variant
|
|
34884
34357
|
) || void 0;
|
|
34885
|
-
const tagsContent =
|
|
34358
|
+
const tagsContent = React66.useMemo(() => {
|
|
34886
34359
|
const items = tags != null ? tags : [];
|
|
34887
34360
|
if (!items.length) return null;
|
|
34888
34361
|
return /* @__PURE__ */ jsx(Fragment, { children: items.map((tag, index) => /* @__PURE__ */ jsxs(
|
|
@@ -34906,7 +34379,7 @@ function InputField(props) {
|
|
|
34906
34379
|
index
|
|
34907
34380
|
)) });
|
|
34908
34381
|
}, [tags, classes == null ? void 0 : classes.tag]);
|
|
34909
|
-
const graph =
|
|
34382
|
+
const graph = React66.useMemo(
|
|
34910
34383
|
() => buildLayoutGraph({
|
|
34911
34384
|
layout,
|
|
34912
34385
|
sublabel,
|
|
@@ -35045,7 +34518,7 @@ function InputField(props) {
|
|
|
35045
34518
|
hasStackedLabelBlock && hasLabelRowContent && "mt-0.5",
|
|
35046
34519
|
classes == null ? void 0 : classes.group
|
|
35047
34520
|
);
|
|
35048
|
-
const Element = contain ? "div" :
|
|
34521
|
+
const Element = contain ? "div" : React66.Fragment;
|
|
35049
34522
|
const attrs = (a3 = "l") => contain ? a3 === "l" ? { className: "p-4 border-b border-input" } : { className: "px-4 pt-2 pb-4" } : {};
|
|
35050
34523
|
return /* @__PURE__ */ jsx(
|
|
35051
34524
|
Field,
|