base-ui-vue 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/button/ToolbarButton.cjs +6 -0
- package/dist/button/ToolbarButton.js +1 -1
- package/dist/content/ScrollAreaContent.cjs +168 -0
- package/dist/content/ScrollAreaContent.cjs.map +1 -0
- package/dist/content/ScrollAreaContent.js +133 -0
- package/dist/content/ScrollAreaContent.js.map +1 -0
- package/dist/control/SliderControl.js +2 -2
- package/dist/corner/ScrollAreaCorner.cjs +77 -0
- package/dist/corner/ScrollAreaCorner.cjs.map +1 -0
- package/dist/corner/ScrollAreaCorner.js +72 -0
- package/dist/corner/ScrollAreaCorner.js.map +1 -0
- package/dist/decrement/NumberFieldDecrement.cjs +861 -0
- package/dist/decrement/NumberFieldDecrement.cjs.map +1 -0
- package/dist/decrement/NumberFieldDecrement.js +700 -0
- package/dist/decrement/NumberFieldDecrement.js.map +1 -0
- package/dist/fallback/AvatarFallback.cjs +2 -46
- package/dist/fallback/AvatarFallback.cjs.map +1 -1
- package/dist/fallback/AvatarFallback.js +3 -41
- package/dist/fallback/AvatarFallback.js.map +1 -1
- package/dist/group/NumberFieldGroup.cjs +72 -0
- package/dist/group/NumberFieldGroup.cjs.map +1 -0
- package/dist/group/NumberFieldGroup.js +67 -0
- package/dist/group/NumberFieldGroup.js.map +1 -0
- package/dist/increment/NumberFieldIncrement.cjs +112 -0
- package/dist/increment/NumberFieldIncrement.cjs.map +1 -0
- package/dist/increment/NumberFieldIncrement.js +107 -0
- package/dist/increment/NumberFieldIncrement.js.map +1 -0
- package/dist/index.cjs +52 -0
- package/dist/index.d.cts +1761 -430
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1761 -430
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index2.cjs +4065 -60
- package/dist/index2.cjs.map +1 -1
- package/dist/index2.js +3955 -184
- package/dist/index2.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +6 -0
- package/src/input/Input.vue +37 -0
- package/src/input/InputDataAttributes.ts +30 -0
- package/src/input/index.ts +4 -0
- package/src/meter/index.ts +16 -0
- package/src/meter/indicator/MeterIndicator.vue +65 -0
- package/src/meter/label/MeterLabel.vue +63 -0
- package/src/meter/root/MeterRoot.vue +131 -0
- package/src/meter/root/MeterRootContext.ts +41 -0
- package/src/meter/track/MeterTrack.vue +46 -0
- package/src/meter/value/MeterValue.vue +85 -0
- package/src/number-field/decrement/NumberFieldDecrement.vue +109 -0
- package/src/number-field/group/NumberFieldGroup.vue +47 -0
- package/src/number-field/increment/NumberFieldIncrement.vue +109 -0
- package/src/number-field/index.ts +42 -0
- package/src/number-field/input/NumberFieldInput.vue +455 -0
- package/src/number-field/root/NumberFieldRoot.vue +626 -0
- package/src/number-field/root/NumberFieldRootContext.ts +94 -0
- package/src/number-field/root/useNumberFieldButton.ts +171 -0
- package/src/number-field/scrub-area/NumberFieldScrubArea.vue +359 -0
- package/src/number-field/scrub-area/NumberFieldScrubAreaContext.ts +26 -0
- package/src/number-field/scrub-area-cursor/NumberFieldScrubAreaCursor.vue +75 -0
- package/src/number-field/utils/constants.ts +4 -0
- package/src/number-field/utils/getViewportRect.ts +34 -0
- package/src/number-field/utils/parse.ts +248 -0
- package/src/number-field/utils/stateAttributesMapping.ts +9 -0
- package/src/number-field/utils/subscribeToVisualViewportResize.ts +27 -0
- package/src/number-field/utils/types.ts +24 -0
- package/src/number-field/utils/validate.ts +120 -0
- package/src/otp-field/index.ts +22 -0
- package/src/otp-field/input/OtpFieldInput.vue +336 -0
- package/src/otp-field/root/OtpFieldRoot.vue +583 -0
- package/src/otp-field/root/OtpFieldRootContext.ts +81 -0
- package/src/otp-field/utils/otp.ts +135 -0
- package/src/otp-field/utils/stateAttributesMapping.ts +16 -0
- package/src/progress/index.ts +23 -0
- package/src/progress/indicator/ProgressIndicator.vue +74 -0
- package/src/progress/label/ProgressLabel.vue +63 -0
- package/src/progress/root/ProgressRoot.vue +160 -0
- package/src/progress/root/ProgressRootContext.ts +51 -0
- package/src/progress/root/ProgressRootDataAttributes.ts +14 -0
- package/src/progress/root/stateAttributesMapping.ts +18 -0
- package/src/progress/track/ProgressTrack.vue +48 -0
- package/src/progress/value/ProgressValue.vue +92 -0
- package/src/scroll-area/constants.ts +2 -0
- package/src/scroll-area/content/ScrollAreaContent.vue +87 -0
- package/src/scroll-area/corner/ScrollAreaCorner.vue +64 -0
- package/src/scroll-area/index.ts +25 -0
- package/src/scroll-area/root/ScrollAreaRoot.vue +297 -0
- package/src/scroll-area/root/ScrollAreaRootContext.ts +89 -0
- package/src/scroll-area/root/ScrollAreaRootCssVars.ts +4 -0
- package/src/scroll-area/root/ScrollAreaRootDataAttributes.ts +9 -0
- package/src/scroll-area/root/stateAttributes.ts +14 -0
- package/src/scroll-area/scrollbar/ScrollAreaScrollbar.vue +263 -0
- package/src/scroll-area/scrollbar/ScrollAreaScrollbarContext.ts +20 -0
- package/src/scroll-area/scrollbar/ScrollAreaScrollbarCssVars.ts +4 -0
- package/src/scroll-area/scrollbar/ScrollAreaScrollbarDataAttributes.ts +11 -0
- package/src/scroll-area/thumb/ScrollAreaThumb.vue +120 -0
- package/src/scroll-area/thumb/ScrollAreaThumbDataAttributes.ts +3 -0
- package/src/scroll-area/utils/getOffset.ts +34 -0
- package/src/scroll-area/viewport/ScrollAreaViewport.vue +379 -0
- package/src/scroll-area/viewport/ScrollAreaViewportContext.ts +20 -0
- package/src/scroll-area/viewport/ScrollAreaViewportCssVars.ts +6 -0
- package/src/scroll-area/viewport/ScrollAreaViewportDataAttributes.ts +9 -0
- package/src/utils/detectBrowser.ts +15 -0
- package/src/utils/formatNumber.ts +60 -2
- package/src/utils/scrollEdges.ts +33 -0
- package/src/utils/styles.ts +28 -0
- package/src/utils/useInterval.ts +45 -0
- package/src/utils/usePressAndHold.ts +260 -0
- package/src/utils/useValueChanged.ts +21 -0
package/dist/index2.cjs
CHANGED
|
@@ -5,9 +5,11 @@ const require_checkbox_group_CheckboxGroup = require('./checkbox-group/CheckboxG
|
|
|
5
5
|
const require_button_ToolbarButton = require('./button/ToolbarButton.cjs');
|
|
6
6
|
const require_control_SliderControl = require('./control/SliderControl.cjs');
|
|
7
7
|
const require_composite_composite = require('./composite/composite.cjs');
|
|
8
|
+
const require_decrement_NumberFieldDecrement = require('./decrement/NumberFieldDecrement.cjs');
|
|
8
9
|
const require_fallback_AvatarFallback = require('./fallback/AvatarFallback.cjs');
|
|
9
10
|
const require_csp_provider_CSPContext = require('./csp-provider/CSPContext.cjs');
|
|
10
11
|
const require_control_FieldControl = require('./control/FieldControl.cjs');
|
|
12
|
+
const require_content_ScrollAreaContent = require('./content/ScrollAreaContent.cjs');
|
|
11
13
|
const require_composite_constants = require('./composite/constants.cjs');
|
|
12
14
|
let vue = require("vue");
|
|
13
15
|
let _floating_ui_utils_dom = require("@floating-ui/utils/dom");
|
|
@@ -822,7 +824,7 @@ var CompositeList_default = CompositeList_vue_vue_type_script_setup_true_lang_de
|
|
|
822
824
|
|
|
823
825
|
//#endregion
|
|
824
826
|
//#region src/accordion/root/stateAttributesMapping.ts
|
|
825
|
-
const rootStateAttributesMapping = { value: () => null };
|
|
827
|
+
const rootStateAttributesMapping$1 = { value: () => null };
|
|
826
828
|
|
|
827
829
|
//#endregion
|
|
828
830
|
//#region src/accordion/root/AccordionRoot.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -958,7 +960,7 @@ var AccordionRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
958
960
|
dir: direction.value,
|
|
959
961
|
role: "region"
|
|
960
962
|
})),
|
|
961
|
-
stateAttributesMapping: rootStateAttributesMapping,
|
|
963
|
+
stateAttributesMapping: rootStateAttributesMapping$1,
|
|
962
964
|
defaultTagName: "div"
|
|
963
965
|
});
|
|
964
966
|
return (_ctx, _cache) => {
|
|
@@ -2148,7 +2150,7 @@ function isOnlyValueMissing(state) {
|
|
|
2148
2150
|
function useFieldValidation(params) {
|
|
2149
2151
|
const { formRef, clearErrors } = require_checkbox_group_CheckboxGroup.useFormContext();
|
|
2150
2152
|
const { controlId, getDescriptionProps, setValidityData, validate, validityData, validationDebounceTime, invalid, markedDirtyRef, state, name, shouldValidateOnChange } = params;
|
|
2151
|
-
const timeout =
|
|
2153
|
+
const timeout = require_decrement_NumberFieldDecrement.useTimeout();
|
|
2152
2154
|
const inputRef = (0, vue.shallowRef)(null);
|
|
2153
2155
|
function setInputRef(element) {
|
|
2154
2156
|
inputRef.value = element;
|
|
@@ -2610,31 +2612,3586 @@ var FieldsetLegend_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
2610
2612
|
});
|
|
2611
2613
|
|
|
2612
2614
|
//#endregion
|
|
2613
|
-
//#region src/fieldset/legend/FieldsetLegend.vue
|
|
2614
|
-
var FieldsetLegend_default = FieldsetLegend_vue_vue_type_script_setup_true_lang_default;
|
|
2615
|
+
//#region src/fieldset/legend/FieldsetLegend.vue
|
|
2616
|
+
var FieldsetLegend_default = FieldsetLegend_vue_vue_type_script_setup_true_lang_default;
|
|
2617
|
+
|
|
2618
|
+
//#endregion
|
|
2619
|
+
//#region src/fieldset/root/FieldsetRoot.vue?vue&type=script&setup=true&lang.ts
|
|
2620
|
+
/**
|
|
2621
|
+
* Groups a shared legend with related controls.
|
|
2622
|
+
* Renders a \`<fieldset>\` element.
|
|
2623
|
+
*
|
|
2624
|
+
* Documentation: [Base UI Vue Fieldset](https://baseui-vue.com/components/fieldset)
|
|
2625
|
+
*/
|
|
2626
|
+
var FieldsetRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
2627
|
+
name: "FieldsetRoot",
|
|
2628
|
+
inheritAttrs: false,
|
|
2629
|
+
__name: "FieldsetRoot",
|
|
2630
|
+
props: {
|
|
2631
|
+
disabled: {
|
|
2632
|
+
type: Boolean,
|
|
2633
|
+
required: false,
|
|
2634
|
+
default: false
|
|
2635
|
+
},
|
|
2636
|
+
as: {
|
|
2637
|
+
type: null,
|
|
2638
|
+
required: false,
|
|
2639
|
+
default: "fieldset"
|
|
2640
|
+
},
|
|
2641
|
+
class: {
|
|
2642
|
+
type: Function,
|
|
2643
|
+
required: false,
|
|
2644
|
+
skipCheck: true
|
|
2645
|
+
},
|
|
2646
|
+
style: {
|
|
2647
|
+
type: [
|
|
2648
|
+
Boolean,
|
|
2649
|
+
null,
|
|
2650
|
+
String,
|
|
2651
|
+
Object,
|
|
2652
|
+
Array,
|
|
2653
|
+
Function
|
|
2654
|
+
],
|
|
2655
|
+
required: false,
|
|
2656
|
+
skipCheck: true
|
|
2657
|
+
}
|
|
2658
|
+
},
|
|
2659
|
+
setup(__props) {
|
|
2660
|
+
const props = __props;
|
|
2661
|
+
const attrs = (0, vue.useAttrs)();
|
|
2662
|
+
const legendId = (0, vue.ref)(void 0);
|
|
2663
|
+
function setLegendId(id) {
|
|
2664
|
+
legendId.value = id;
|
|
2665
|
+
}
|
|
2666
|
+
const disabled = (0, vue.computed)(() => props.disabled ?? false);
|
|
2667
|
+
const state = (0, vue.computed)(() => ({ disabled: disabled.value }));
|
|
2668
|
+
(0, vue.provide)(fieldsetRootContextKey, {
|
|
2669
|
+
legendId,
|
|
2670
|
+
setLegendId,
|
|
2671
|
+
disabled
|
|
2672
|
+
});
|
|
2673
|
+
const { tag, mergedProps, renderless } = require_button_Button.useRenderElement({
|
|
2674
|
+
componentProps: props,
|
|
2675
|
+
state,
|
|
2676
|
+
props: (0, vue.computed)(() => ({
|
|
2677
|
+
...attrs,
|
|
2678
|
+
"aria-labelledby": legendId.value
|
|
2679
|
+
})),
|
|
2680
|
+
defaultTagName: "fieldset"
|
|
2681
|
+
});
|
|
2682
|
+
return (_ctx, _cache) => {
|
|
2683
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
2684
|
+
key: 0,
|
|
2685
|
+
props: (0, vue.unref)(mergedProps),
|
|
2686
|
+
state: state.value
|
|
2687
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 1 }, (0, vue.unref)(mergedProps))), {
|
|
2688
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: state.value })]),
|
|
2689
|
+
_: 3
|
|
2690
|
+
}, 16));
|
|
2691
|
+
};
|
|
2692
|
+
}
|
|
2693
|
+
});
|
|
2694
|
+
|
|
2695
|
+
//#endregion
|
|
2696
|
+
//#region src/fieldset/root/FieldsetRoot.vue
|
|
2697
|
+
var FieldsetRoot_default = FieldsetRoot_vue_vue_type_script_setup_true_lang_default;
|
|
2698
|
+
|
|
2699
|
+
//#endregion
|
|
2700
|
+
//#region src/input/Input.vue?vue&type=script&setup=true&lang.ts
|
|
2701
|
+
/**
|
|
2702
|
+
* A native input element that automatically works with
|
|
2703
|
+
* [Field](https://baseui-vue.com/docs/components/field).
|
|
2704
|
+
* Renders an `<input>` element.
|
|
2705
|
+
*
|
|
2706
|
+
* Documentation: [Base UI Vue Input](https://baseui-vue.com/docs/components/input)
|
|
2707
|
+
*/
|
|
2708
|
+
var Input_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
2709
|
+
name: "BaseUIInput",
|
|
2710
|
+
inheritAttrs: false,
|
|
2711
|
+
__name: "Input",
|
|
2712
|
+
props: {
|
|
2713
|
+
id: {
|
|
2714
|
+
type: String,
|
|
2715
|
+
required: false
|
|
2716
|
+
},
|
|
2717
|
+
name: {
|
|
2718
|
+
type: String,
|
|
2719
|
+
required: false
|
|
2720
|
+
},
|
|
2721
|
+
disabled: {
|
|
2722
|
+
type: Boolean,
|
|
2723
|
+
required: false
|
|
2724
|
+
},
|
|
2725
|
+
value: {
|
|
2726
|
+
type: String,
|
|
2727
|
+
required: false
|
|
2728
|
+
},
|
|
2729
|
+
defaultValue: {
|
|
2730
|
+
type: String,
|
|
2731
|
+
required: false
|
|
2732
|
+
},
|
|
2733
|
+
autofocus: {
|
|
2734
|
+
type: Boolean,
|
|
2735
|
+
required: false
|
|
2736
|
+
},
|
|
2737
|
+
type: {
|
|
2738
|
+
type: String,
|
|
2739
|
+
required: false
|
|
2740
|
+
},
|
|
2741
|
+
required: {
|
|
2742
|
+
type: Boolean,
|
|
2743
|
+
required: false
|
|
2744
|
+
},
|
|
2745
|
+
pattern: {
|
|
2746
|
+
type: String,
|
|
2747
|
+
required: false
|
|
2748
|
+
},
|
|
2749
|
+
minlength: {
|
|
2750
|
+
type: Number,
|
|
2751
|
+
required: false
|
|
2752
|
+
},
|
|
2753
|
+
maxlength: {
|
|
2754
|
+
type: Number,
|
|
2755
|
+
required: false
|
|
2756
|
+
},
|
|
2757
|
+
min: {
|
|
2758
|
+
type: [String, Number],
|
|
2759
|
+
required: false
|
|
2760
|
+
},
|
|
2761
|
+
max: {
|
|
2762
|
+
type: [String, Number],
|
|
2763
|
+
required: false
|
|
2764
|
+
},
|
|
2765
|
+
step: {
|
|
2766
|
+
type: [String, Number],
|
|
2767
|
+
required: false
|
|
2768
|
+
},
|
|
2769
|
+
placeholder: {
|
|
2770
|
+
type: String,
|
|
2771
|
+
required: false
|
|
2772
|
+
},
|
|
2773
|
+
as: {
|
|
2774
|
+
type: null,
|
|
2775
|
+
required: false
|
|
2776
|
+
},
|
|
2777
|
+
class: {
|
|
2778
|
+
type: Function,
|
|
2779
|
+
required: false,
|
|
2780
|
+
skipCheck: true
|
|
2781
|
+
},
|
|
2782
|
+
style: {
|
|
2783
|
+
type: [
|
|
2784
|
+
Boolean,
|
|
2785
|
+
null,
|
|
2786
|
+
String,
|
|
2787
|
+
Object,
|
|
2788
|
+
Array,
|
|
2789
|
+
Function
|
|
2790
|
+
],
|
|
2791
|
+
required: false,
|
|
2792
|
+
skipCheck: true
|
|
2793
|
+
}
|
|
2794
|
+
},
|
|
2795
|
+
emits: ["valueChange"],
|
|
2796
|
+
setup(__props) {
|
|
2797
|
+
const props = __props;
|
|
2798
|
+
const attrs = (0, vue.useAttrs)();
|
|
2799
|
+
return (_ctx, _cache) => {
|
|
2800
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(require_control_FieldControl.FieldControl_default, (0, vue.mergeProps)({
|
|
2801
|
+
...props,
|
|
2802
|
+
...(0, vue.unref)(attrs)
|
|
2803
|
+
}, { onValueChange: _cache[0] || (_cache[0] = (v, e) => _ctx.$emit("valueChange", v, e)) }), (0, vue.createSlots)({ _: 2 }, [_ctx.$slots.default ? {
|
|
2804
|
+
name: "default",
|
|
2805
|
+
fn: (0, vue.withCtx)((slotProps) => [(0, vue.renderSlot)(_ctx.$slots, "default", (0, vue.normalizeProps)((0, vue.guardReactiveProps)(slotProps)))]),
|
|
2806
|
+
key: "0"
|
|
2807
|
+
} : void 0]), 1040);
|
|
2808
|
+
};
|
|
2809
|
+
}
|
|
2810
|
+
});
|
|
2811
|
+
|
|
2812
|
+
//#endregion
|
|
2813
|
+
//#region src/input/Input.vue
|
|
2814
|
+
var Input_default = Input_vue_vue_type_script_setup_true_lang_default;
|
|
2815
|
+
|
|
2816
|
+
//#endregion
|
|
2817
|
+
//#region src/input/InputDataAttributes.ts
|
|
2818
|
+
let InputDataAttributes = /* @__PURE__ */ function(InputDataAttributes) {
|
|
2819
|
+
/**
|
|
2820
|
+
* Present when the input is disabled.
|
|
2821
|
+
*/
|
|
2822
|
+
InputDataAttributes["disabled"] = "data-disabled";
|
|
2823
|
+
/**
|
|
2824
|
+
* Present when the input is in a valid state (when wrapped in FieldRoot).
|
|
2825
|
+
*/
|
|
2826
|
+
InputDataAttributes["valid"] = "data-valid";
|
|
2827
|
+
/**
|
|
2828
|
+
* Present when the input is in an invalid state (when wrapped in FieldRoot).
|
|
2829
|
+
*/
|
|
2830
|
+
InputDataAttributes["invalid"] = "data-invalid";
|
|
2831
|
+
/**
|
|
2832
|
+
* Present when the input has been touched (when wrapped in FieldRoot).
|
|
2833
|
+
*/
|
|
2834
|
+
InputDataAttributes["touched"] = "data-touched";
|
|
2835
|
+
/**
|
|
2836
|
+
* Present when the input's value has changed (when wrapped in FieldRoot).
|
|
2837
|
+
*/
|
|
2838
|
+
InputDataAttributes["dirty"] = "data-dirty";
|
|
2839
|
+
/**
|
|
2840
|
+
* Present when the input is filled (when wrapped in FieldRoot).
|
|
2841
|
+
*/
|
|
2842
|
+
InputDataAttributes["filled"] = "data-filled";
|
|
2843
|
+
/**
|
|
2844
|
+
* Present when the input is focused (when wrapped in FieldRoot).
|
|
2845
|
+
*/
|
|
2846
|
+
InputDataAttributes["focused"] = "data-focused";
|
|
2847
|
+
return InputDataAttributes;
|
|
2848
|
+
}({});
|
|
2849
|
+
|
|
2850
|
+
//#endregion
|
|
2851
|
+
//#region src/utils/valueToPercent.ts
|
|
2852
|
+
function valueToPercent(value, min, max) {
|
|
2853
|
+
if (max === min) return 0;
|
|
2854
|
+
return (value - min) * 100 / (max - min);
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2857
|
+
//#endregion
|
|
2858
|
+
//#region src/meter/root/MeterRootContext.ts
|
|
2859
|
+
const meterRootContextKey = Symbol("MeterRootContext");
|
|
2860
|
+
function useMeterRootContext(optional = false) {
|
|
2861
|
+
const context = (0, vue.inject)(meterRootContextKey, void 0);
|
|
2862
|
+
if (!context && !optional) throw new Error("Base UI Vue: MeterRootContext is missing. Meter parts must be placed within <MeterRoot>.");
|
|
2863
|
+
return context;
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2866
|
+
//#endregion
|
|
2867
|
+
//#region src/meter/indicator/MeterIndicator.vue?vue&type=script&setup=true&lang.ts
|
|
2868
|
+
/**
|
|
2869
|
+
* Visualizes the position of the value along the range.
|
|
2870
|
+
* Renders a `<div>` element.
|
|
2871
|
+
*
|
|
2872
|
+
* Documentation: [Base UI Vue Meter](https://baseui-vue.com/docs/components/meter)
|
|
2873
|
+
*/
|
|
2874
|
+
var MeterIndicator_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
2875
|
+
name: "MeterIndicator",
|
|
2876
|
+
inheritAttrs: false,
|
|
2877
|
+
__name: "MeterIndicator",
|
|
2878
|
+
props: {
|
|
2879
|
+
as: {
|
|
2880
|
+
type: null,
|
|
2881
|
+
required: false,
|
|
2882
|
+
default: "div"
|
|
2883
|
+
},
|
|
2884
|
+
class: {
|
|
2885
|
+
type: Function,
|
|
2886
|
+
required: false,
|
|
2887
|
+
skipCheck: true
|
|
2888
|
+
},
|
|
2889
|
+
style: {
|
|
2890
|
+
type: [
|
|
2891
|
+
Boolean,
|
|
2892
|
+
null,
|
|
2893
|
+
String,
|
|
2894
|
+
Object,
|
|
2895
|
+
Array,
|
|
2896
|
+
Function
|
|
2897
|
+
],
|
|
2898
|
+
required: false,
|
|
2899
|
+
skipCheck: true
|
|
2900
|
+
}
|
|
2901
|
+
},
|
|
2902
|
+
setup(__props) {
|
|
2903
|
+
const props = __props;
|
|
2904
|
+
const attrs = (0, vue.useAttrs)();
|
|
2905
|
+
const rootContext = useMeterRootContext();
|
|
2906
|
+
const percentageWidth = (0, vue.computed)(() => valueToPercent(rootContext.value.value, rootContext.min.value, rootContext.max.value));
|
|
2907
|
+
const state = (0, vue.computed)(() => ({}));
|
|
2908
|
+
const { tag, mergedProps, renderless } = require_button_Button.useRenderElement({
|
|
2909
|
+
componentProps: props,
|
|
2910
|
+
state,
|
|
2911
|
+
props: (0, vue.computed)(() => require_button_Button.mergeProps({ style: {
|
|
2912
|
+
insetInlineStart: 0,
|
|
2913
|
+
height: "inherit",
|
|
2914
|
+
width: `${percentageWidth.value}%`
|
|
2915
|
+
} }, attrs)),
|
|
2916
|
+
defaultTagName: "div"
|
|
2917
|
+
});
|
|
2918
|
+
return (_ctx, _cache) => {
|
|
2919
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
2920
|
+
key: 0,
|
|
2921
|
+
props: (0, vue.unref)(mergedProps),
|
|
2922
|
+
state: state.value
|
|
2923
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 1 }, (0, vue.unref)(mergedProps))), {
|
|
2924
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: state.value })]),
|
|
2925
|
+
_: 3
|
|
2926
|
+
}, 16));
|
|
2927
|
+
};
|
|
2928
|
+
}
|
|
2929
|
+
});
|
|
2930
|
+
|
|
2931
|
+
//#endregion
|
|
2932
|
+
//#region src/meter/indicator/MeterIndicator.vue
|
|
2933
|
+
var MeterIndicator_default = MeterIndicator_vue_vue_type_script_setup_true_lang_default;
|
|
2934
|
+
|
|
2935
|
+
//#endregion
|
|
2936
|
+
//#region src/meter/label/MeterLabel.vue?vue&type=script&setup=true&lang.ts
|
|
2937
|
+
/**
|
|
2938
|
+
* An accessible label for the meter.
|
|
2939
|
+
* Renders a `<span>` element.
|
|
2940
|
+
*
|
|
2941
|
+
* Documentation: [Base UI Vue Meter](https://baseui-vue.com/docs/components/meter)
|
|
2942
|
+
*/
|
|
2943
|
+
var MeterLabel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
2944
|
+
name: "MeterLabel",
|
|
2945
|
+
inheritAttrs: false,
|
|
2946
|
+
__name: "MeterLabel",
|
|
2947
|
+
props: {
|
|
2948
|
+
id: {
|
|
2949
|
+
type: String,
|
|
2950
|
+
required: false
|
|
2951
|
+
},
|
|
2952
|
+
as: {
|
|
2953
|
+
type: null,
|
|
2954
|
+
required: false,
|
|
2955
|
+
default: "span"
|
|
2956
|
+
},
|
|
2957
|
+
class: {
|
|
2958
|
+
type: Function,
|
|
2959
|
+
required: false,
|
|
2960
|
+
skipCheck: true
|
|
2961
|
+
},
|
|
2962
|
+
style: {
|
|
2963
|
+
type: [
|
|
2964
|
+
Boolean,
|
|
2965
|
+
null,
|
|
2966
|
+
String,
|
|
2967
|
+
Object,
|
|
2968
|
+
Array,
|
|
2969
|
+
Function
|
|
2970
|
+
],
|
|
2971
|
+
required: false,
|
|
2972
|
+
skipCheck: true
|
|
2973
|
+
}
|
|
2974
|
+
},
|
|
2975
|
+
setup(__props) {
|
|
2976
|
+
const props = __props;
|
|
2977
|
+
const attrs = (0, vue.useAttrs)();
|
|
2978
|
+
const { setLabelId } = useMeterRootContext();
|
|
2979
|
+
const id = useRegisteredLabelId(() => props.id, setLabelId);
|
|
2980
|
+
const state = (0, vue.computed)(() => ({}));
|
|
2981
|
+
const { tag, mergedProps, renderless } = require_button_Button.useRenderElement({
|
|
2982
|
+
componentProps: props,
|
|
2983
|
+
state,
|
|
2984
|
+
props: (0, vue.computed)(() => ({
|
|
2985
|
+
...attrs,
|
|
2986
|
+
id: id.value,
|
|
2987
|
+
role: "presentation"
|
|
2988
|
+
})),
|
|
2989
|
+
defaultTagName: "span"
|
|
2990
|
+
});
|
|
2991
|
+
return (_ctx, _cache) => {
|
|
2992
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
2993
|
+
key: 0,
|
|
2994
|
+
props: (0, vue.unref)(mergedProps),
|
|
2995
|
+
state: state.value
|
|
2996
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 1 }, (0, vue.unref)(mergedProps))), {
|
|
2997
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: state.value })]),
|
|
2998
|
+
_: 3
|
|
2999
|
+
}, 16));
|
|
3000
|
+
};
|
|
3001
|
+
}
|
|
3002
|
+
});
|
|
3003
|
+
|
|
3004
|
+
//#endregion
|
|
3005
|
+
//#region src/meter/label/MeterLabel.vue
|
|
3006
|
+
var MeterLabel_default = MeterLabel_vue_vue_type_script_setup_true_lang_default;
|
|
3007
|
+
|
|
3008
|
+
//#endregion
|
|
3009
|
+
//#region src/meter/root/MeterRoot.vue?vue&type=script&setup=true&lang.ts
|
|
3010
|
+
/**
|
|
3011
|
+
* Groups all parts of the meter and provides the value for screen readers.
|
|
3012
|
+
* Renders a `<div>` element.
|
|
3013
|
+
*
|
|
3014
|
+
* Documentation: [Base UI Vue Meter](https://baseui-vue.com/docs/components/meter)
|
|
3015
|
+
*/
|
|
3016
|
+
var MeterRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
3017
|
+
name: "MeterRoot",
|
|
3018
|
+
inheritAttrs: false,
|
|
3019
|
+
__name: "MeterRoot",
|
|
3020
|
+
props: {
|
|
3021
|
+
ariaValuetext: {
|
|
3022
|
+
type: String,
|
|
3023
|
+
required: false
|
|
3024
|
+
},
|
|
3025
|
+
format: {
|
|
3026
|
+
type: null,
|
|
3027
|
+
required: false
|
|
3028
|
+
},
|
|
3029
|
+
getAriaValueText: {
|
|
3030
|
+
type: Function,
|
|
3031
|
+
required: false
|
|
3032
|
+
},
|
|
3033
|
+
locale: {
|
|
3034
|
+
type: null,
|
|
3035
|
+
required: false
|
|
3036
|
+
},
|
|
3037
|
+
max: {
|
|
3038
|
+
type: Number,
|
|
3039
|
+
required: false,
|
|
3040
|
+
default: 100
|
|
3041
|
+
},
|
|
3042
|
+
min: {
|
|
3043
|
+
type: Number,
|
|
3044
|
+
required: false,
|
|
3045
|
+
default: 0
|
|
3046
|
+
},
|
|
3047
|
+
value: {
|
|
3048
|
+
type: Number,
|
|
3049
|
+
required: true
|
|
3050
|
+
},
|
|
3051
|
+
as: {
|
|
3052
|
+
type: null,
|
|
3053
|
+
required: false,
|
|
3054
|
+
default: "div"
|
|
3055
|
+
},
|
|
3056
|
+
class: {
|
|
3057
|
+
type: Function,
|
|
3058
|
+
required: false,
|
|
3059
|
+
skipCheck: true
|
|
3060
|
+
},
|
|
3061
|
+
style: {
|
|
3062
|
+
type: [
|
|
3063
|
+
Boolean,
|
|
3064
|
+
null,
|
|
3065
|
+
String,
|
|
3066
|
+
Object,
|
|
3067
|
+
Array,
|
|
3068
|
+
Function
|
|
3069
|
+
],
|
|
3070
|
+
required: false,
|
|
3071
|
+
skipCheck: true
|
|
3072
|
+
}
|
|
3073
|
+
},
|
|
3074
|
+
setup(__props) {
|
|
3075
|
+
const props = __props;
|
|
3076
|
+
const attrs = (0, vue.useAttrs)();
|
|
3077
|
+
const labelId = (0, vue.ref)(void 0);
|
|
3078
|
+
const formattedValue = (0, vue.computed)(() => require_decrement_NumberFieldDecrement.formatNumberValue(props.value, props.locale, props.format));
|
|
3079
|
+
const ariaValueText = (0, vue.computed)(() => {
|
|
3080
|
+
if (props.ariaValuetext !== void 0) return props.ariaValuetext;
|
|
3081
|
+
if (props.getAriaValueText) return props.getAriaValueText(formattedValue.value, props.value);
|
|
3082
|
+
if (props.format) return formattedValue.value;
|
|
3083
|
+
return `${props.value}%`;
|
|
3084
|
+
});
|
|
3085
|
+
(0, vue.provide)(meterRootContextKey, {
|
|
3086
|
+
formattedValue,
|
|
3087
|
+
max: (0, vue.computed)(() => props.max),
|
|
3088
|
+
min: (0, vue.computed)(() => props.min),
|
|
3089
|
+
value: (0, vue.computed)(() => props.value),
|
|
3090
|
+
setLabelId(id) {
|
|
3091
|
+
labelId.value = id;
|
|
3092
|
+
}
|
|
3093
|
+
});
|
|
3094
|
+
const state = (0, vue.computed)(() => ({}));
|
|
3095
|
+
const { tag, mergedProps, renderless } = require_button_Button.useRenderElement({
|
|
3096
|
+
componentProps: props,
|
|
3097
|
+
state,
|
|
3098
|
+
props: (0, vue.computed)(() => ({
|
|
3099
|
+
"role": "meter",
|
|
3100
|
+
"aria-labelledby": labelId.value,
|
|
3101
|
+
"aria-valuemax": props.max,
|
|
3102
|
+
"aria-valuemin": props.min,
|
|
3103
|
+
"aria-valuenow": props.value,
|
|
3104
|
+
"aria-valuetext": ariaValueText.value,
|
|
3105
|
+
...attrs
|
|
3106
|
+
})),
|
|
3107
|
+
defaultTagName: "div"
|
|
3108
|
+
});
|
|
3109
|
+
const visuallyHiddenStyle = require_checkbox_index.visuallyHidden;
|
|
3110
|
+
return (_ctx, _cache) => {
|
|
3111
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
3112
|
+
key: 0,
|
|
3113
|
+
props: (0, vue.unref)(mergedProps),
|
|
3114
|
+
state: state.value
|
|
3115
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 1 }, (0, vue.unref)(mergedProps))), {
|
|
3116
|
+
default: (0, vue.withCtx)(() => [
|
|
3117
|
+
(0, vue.renderSlot)(_ctx.$slots, "default", { state: state.value }),
|
|
3118
|
+
(0, vue.createCommentVNode)(" Force NVDA to read the label https://github.com/mui/base-ui/issues/4184 "),
|
|
3119
|
+
(0, vue.createElementVNode)("span", {
|
|
3120
|
+
role: "presentation",
|
|
3121
|
+
style: (0, vue.normalizeStyle)((0, vue.unref)(visuallyHiddenStyle))
|
|
3122
|
+
}, "x", 4)
|
|
3123
|
+
]),
|
|
3124
|
+
_: 3
|
|
3125
|
+
}, 16));
|
|
3126
|
+
};
|
|
3127
|
+
}
|
|
3128
|
+
});
|
|
3129
|
+
|
|
3130
|
+
//#endregion
|
|
3131
|
+
//#region src/meter/root/MeterRoot.vue
|
|
3132
|
+
var MeterRoot_default = MeterRoot_vue_vue_type_script_setup_true_lang_default;
|
|
3133
|
+
|
|
3134
|
+
//#endregion
|
|
3135
|
+
//#region src/meter/track/MeterTrack.vue?vue&type=script&setup=true&lang.ts
|
|
3136
|
+
/**
|
|
3137
|
+
* Contains the meter indicator and represents the entire range of the meter.
|
|
3138
|
+
* Renders a `<div>` element.
|
|
3139
|
+
*
|
|
3140
|
+
* Documentation: [Base UI Vue Meter](https://baseui-vue.com/docs/components/meter)
|
|
3141
|
+
*/
|
|
3142
|
+
var MeterTrack_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
3143
|
+
name: "MeterTrack",
|
|
3144
|
+
inheritAttrs: false,
|
|
3145
|
+
__name: "MeterTrack",
|
|
3146
|
+
props: {
|
|
3147
|
+
as: {
|
|
3148
|
+
type: null,
|
|
3149
|
+
required: false,
|
|
3150
|
+
default: "div"
|
|
3151
|
+
},
|
|
3152
|
+
class: {
|
|
3153
|
+
type: Function,
|
|
3154
|
+
required: false,
|
|
3155
|
+
skipCheck: true
|
|
3156
|
+
},
|
|
3157
|
+
style: {
|
|
3158
|
+
type: [
|
|
3159
|
+
Boolean,
|
|
3160
|
+
null,
|
|
3161
|
+
String,
|
|
3162
|
+
Object,
|
|
3163
|
+
Array,
|
|
3164
|
+
Function
|
|
3165
|
+
],
|
|
3166
|
+
required: false,
|
|
3167
|
+
skipCheck: true
|
|
3168
|
+
}
|
|
3169
|
+
},
|
|
3170
|
+
setup(__props) {
|
|
3171
|
+
const props = __props;
|
|
3172
|
+
const attrs = (0, vue.useAttrs)();
|
|
3173
|
+
const state = (0, vue.computed)(() => ({}));
|
|
3174
|
+
const { tag, mergedProps, renderless } = require_button_Button.useRenderElement({
|
|
3175
|
+
componentProps: props,
|
|
3176
|
+
state,
|
|
3177
|
+
props: (0, vue.computed)(() => ({ ...attrs })),
|
|
3178
|
+
defaultTagName: "div"
|
|
3179
|
+
});
|
|
3180
|
+
return (_ctx, _cache) => {
|
|
3181
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
3182
|
+
key: 0,
|
|
3183
|
+
props: (0, vue.unref)(mergedProps),
|
|
3184
|
+
state: state.value
|
|
3185
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 1 }, (0, vue.unref)(mergedProps))), {
|
|
3186
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: state.value })]),
|
|
3187
|
+
_: 3
|
|
3188
|
+
}, 16));
|
|
3189
|
+
};
|
|
3190
|
+
}
|
|
3191
|
+
});
|
|
3192
|
+
|
|
3193
|
+
//#endregion
|
|
3194
|
+
//#region src/meter/track/MeterTrack.vue
|
|
3195
|
+
var MeterTrack_default = MeterTrack_vue_vue_type_script_setup_true_lang_default;
|
|
3196
|
+
|
|
3197
|
+
//#endregion
|
|
3198
|
+
//#region src/meter/value/MeterValue.vue?vue&type=script&setup=true&lang.ts
|
|
3199
|
+
/**
|
|
3200
|
+
* A text element displaying the current value.
|
|
3201
|
+
* Renders a `<span>` element.
|
|
3202
|
+
*
|
|
3203
|
+
* Documentation: [Base UI Vue Meter](https://baseui-vue.com/docs/components/meter)
|
|
3204
|
+
*/
|
|
3205
|
+
var MeterValue_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
3206
|
+
name: "MeterValue",
|
|
3207
|
+
inheritAttrs: false,
|
|
3208
|
+
__name: "MeterValue",
|
|
3209
|
+
props: {
|
|
3210
|
+
as: {
|
|
3211
|
+
type: null,
|
|
3212
|
+
required: false,
|
|
3213
|
+
default: "span"
|
|
3214
|
+
},
|
|
3215
|
+
class: {
|
|
3216
|
+
type: Function,
|
|
3217
|
+
required: false,
|
|
3218
|
+
skipCheck: true
|
|
3219
|
+
},
|
|
3220
|
+
style: {
|
|
3221
|
+
type: [
|
|
3222
|
+
Boolean,
|
|
3223
|
+
null,
|
|
3224
|
+
String,
|
|
3225
|
+
Object,
|
|
3226
|
+
Array,
|
|
3227
|
+
Function
|
|
3228
|
+
],
|
|
3229
|
+
required: false,
|
|
3230
|
+
skipCheck: true
|
|
3231
|
+
}
|
|
3232
|
+
},
|
|
3233
|
+
setup(__props) {
|
|
3234
|
+
const props = __props;
|
|
3235
|
+
const attrs = (0, vue.useAttrs)();
|
|
3236
|
+
const { value, formattedValue } = useMeterRootContext();
|
|
3237
|
+
const state = (0, vue.computed)(() => ({}));
|
|
3238
|
+
const defaultDisplay = (0, vue.computed)(() => {
|
|
3239
|
+
if (formattedValue.value) return formattedValue.value;
|
|
3240
|
+
return value.value != null ? String(value.value) : "";
|
|
3241
|
+
});
|
|
3242
|
+
const { tag, mergedProps, renderless } = require_button_Button.useRenderElement({
|
|
3243
|
+
componentProps: props,
|
|
3244
|
+
state,
|
|
3245
|
+
props: (0, vue.computed)(() => ({
|
|
3246
|
+
"aria-hidden": true,
|
|
3247
|
+
...attrs
|
|
3248
|
+
})),
|
|
3249
|
+
defaultTagName: "span"
|
|
3250
|
+
});
|
|
3251
|
+
return (_ctx, _cache) => {
|
|
3252
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
3253
|
+
key: 0,
|
|
3254
|
+
props: (0, vue.unref)(mergedProps),
|
|
3255
|
+
state: state.value,
|
|
3256
|
+
formattedValue: (0, vue.unref)(formattedValue),
|
|
3257
|
+
value: (0, vue.unref)(value)
|
|
3258
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 1 }, (0, vue.unref)(mergedProps))), {
|
|
3259
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
3260
|
+
formattedValue: (0, vue.unref)(formattedValue),
|
|
3261
|
+
value: (0, vue.unref)(value)
|
|
3262
|
+
}, () => [(0, vue.createTextVNode)((0, vue.toDisplayString)(defaultDisplay.value), 1)])]),
|
|
3263
|
+
_: 3
|
|
3264
|
+
}, 16));
|
|
3265
|
+
};
|
|
3266
|
+
}
|
|
3267
|
+
});
|
|
3268
|
+
|
|
3269
|
+
//#endregion
|
|
3270
|
+
//#region src/meter/value/MeterValue.vue
|
|
3271
|
+
var MeterValue_default = MeterValue_vue_vue_type_script_setup_true_lang_default;
|
|
3272
|
+
|
|
3273
|
+
//#endregion
|
|
3274
|
+
//#region src/utils/useValueChanged.ts
|
|
3275
|
+
/**
|
|
3276
|
+
* Runs `onChange` whenever the watched value changes, passing the previous value.
|
|
3277
|
+
*
|
|
3278
|
+
* Mirrors the React `useValueChanged` helper: the callback fires after the DOM has
|
|
3279
|
+
* been updated (`flush: 'post'`), which makes it safe to read or move focus inside it.
|
|
3280
|
+
*/
|
|
3281
|
+
function useValueChanged(source, onChange) {
|
|
3282
|
+
(0, vue.watch)(source, (_newValue, previousValue) => {
|
|
3283
|
+
onChange(previousValue);
|
|
3284
|
+
}, { flush: "post" });
|
|
3285
|
+
}
|
|
3286
|
+
|
|
3287
|
+
//#endregion
|
|
3288
|
+
//#region src/number-field/utils/validate.ts
|
|
3289
|
+
const STEP_EPSILON_FACTOR = 1e-10;
|
|
3290
|
+
const DEFAULT_DIGITS = 3;
|
|
3291
|
+
function hasNumberFormatRoundingOptions(format) {
|
|
3292
|
+
return format?.maximumFractionDigits != null || format?.minimumFractionDigits != null || format?.maximumSignificantDigits != null || format?.minimumSignificantDigits != null || format?.roundingIncrement != null || format?.roundingMode != null || format?.roundingPriority != null;
|
|
3293
|
+
}
|
|
3294
|
+
function removeFloatingPointErrors(value, format) {
|
|
3295
|
+
if (!Number.isFinite(value)) return value;
|
|
3296
|
+
if (!hasNumberFormatRoundingOptions(format)) return Number(value.toFixed(DEFAULT_DIGITS));
|
|
3297
|
+
const formatter = require_decrement_NumberFieldDecrement.getFormatter("en-US", {
|
|
3298
|
+
...format,
|
|
3299
|
+
signDisplay: "auto",
|
|
3300
|
+
currencySign: "standard",
|
|
3301
|
+
notation: format.notation === "compact" ? "standard" : format.notation,
|
|
3302
|
+
useGrouping: false
|
|
3303
|
+
});
|
|
3304
|
+
const roundedText = formatter.format(value);
|
|
3305
|
+
const roundedValue = require_decrement_NumberFieldDecrement.parseNumber(roundedText, "en-US", format);
|
|
3306
|
+
if (roundedValue === null) return value;
|
|
3307
|
+
return formatter.format(roundedValue) === roundedText ? roundedValue : value;
|
|
3308
|
+
}
|
|
3309
|
+
function snapToStep(value, base, step, mode = "directional") {
|
|
3310
|
+
const stepSize = Math.abs(step);
|
|
3311
|
+
const direction = Math.sign(step);
|
|
3312
|
+
const tolerance = stepSize * STEP_EPSILON_FACTOR * direction;
|
|
3313
|
+
const rawSteps = value - base + tolerance;
|
|
3314
|
+
if (mode === "nearest") return base + Math.round(rawSteps / step) * step;
|
|
3315
|
+
return base + (direction > 0 ? Math.floor(rawSteps / stepSize) : Math.ceil(rawSteps / stepSize)) * stepSize;
|
|
3316
|
+
}
|
|
3317
|
+
function toValidatedNumber(value, { step, minWithDefault, maxWithDefault, minWithZeroDefault, format, snapOnStep, small, clamp: shouldClamp }) {
|
|
3318
|
+
if (value === null) return value;
|
|
3319
|
+
let nextValue = value;
|
|
3320
|
+
if (step != null && snapOnStep && step !== 0) {
|
|
3321
|
+
const base = small || minWithDefault === Number.MIN_SAFE_INTEGER ? minWithZeroDefault : minWithDefault;
|
|
3322
|
+
nextValue = snapToStep(nextValue, base, step, small ? "nearest" : "directional");
|
|
3323
|
+
}
|
|
3324
|
+
if (shouldClamp) nextValue = require_control_SliderControl.clamp(nextValue, minWithDefault, maxWithDefault);
|
|
3325
|
+
const roundedValue = removeFloatingPointErrors(nextValue, format);
|
|
3326
|
+
return shouldClamp ? require_control_SliderControl.clamp(roundedValue, minWithDefault, maxWithDefault) : roundedValue;
|
|
3327
|
+
}
|
|
3328
|
+
|
|
3329
|
+
//#endregion
|
|
3330
|
+
//#region src/number-field/input/NumberFieldInput.vue?vue&type=script&setup=true&lang.ts
|
|
3331
|
+
var NumberFieldInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
3332
|
+
name: "NumberFieldInput",
|
|
3333
|
+
inheritAttrs: false,
|
|
3334
|
+
__name: "NumberFieldInput",
|
|
3335
|
+
props: {
|
|
3336
|
+
as: {
|
|
3337
|
+
type: null,
|
|
3338
|
+
required: false
|
|
3339
|
+
},
|
|
3340
|
+
class: {
|
|
3341
|
+
type: Function,
|
|
3342
|
+
required: false,
|
|
3343
|
+
skipCheck: true
|
|
3344
|
+
},
|
|
3345
|
+
style: {
|
|
3346
|
+
type: [
|
|
3347
|
+
Boolean,
|
|
3348
|
+
null,
|
|
3349
|
+
String,
|
|
3350
|
+
Object,
|
|
3351
|
+
Array,
|
|
3352
|
+
Function
|
|
3353
|
+
],
|
|
3354
|
+
required: false,
|
|
3355
|
+
skipCheck: true
|
|
3356
|
+
}
|
|
3357
|
+
},
|
|
3358
|
+
setup(__props) {
|
|
3359
|
+
const props = __props;
|
|
3360
|
+
const attrsObject = (0, vue.useAttrs)();
|
|
3361
|
+
const NAVIGATE_KEYS = new Set([
|
|
3362
|
+
"Backspace",
|
|
3363
|
+
"Delete",
|
|
3364
|
+
"ArrowLeft",
|
|
3365
|
+
"ArrowRight",
|
|
3366
|
+
"Tab",
|
|
3367
|
+
"Enter",
|
|
3368
|
+
"Escape"
|
|
3369
|
+
]);
|
|
3370
|
+
const { allowInputSyncRef, disabled, formatOptionsRef, getAllowedNonNumericKeys, getStepAmount, id, incrementValue, inputMode, inputValue, max, min, name, readOnly, required, setValue, state, setInputValue, locale, inputRef, value, onValueCommitted, lastChangedValueRef, hasPendingCommitRef, valueRef } = require_decrement_NumberFieldDecrement.useNumberFieldRootContext();
|
|
3371
|
+
const { clearErrors } = require_checkbox_group_CheckboxGroup.useFormContext();
|
|
3372
|
+
const { validationMode, setTouched, setFocused, invalid, shouldValidateOnChange, validation } = require_checkbox_group_CheckboxGroup.useFieldRootContext();
|
|
3373
|
+
const { labelId } = require_checkbox_group_CheckboxGroup.useLabelableContext();
|
|
3374
|
+
let hasTouchedInput = false;
|
|
3375
|
+
let blockRevalidation = false;
|
|
3376
|
+
function setInputRef(el) {
|
|
3377
|
+
inputRef.value = el;
|
|
3378
|
+
}
|
|
3379
|
+
useValueChanged(value, () => {
|
|
3380
|
+
clearErrors(name.value);
|
|
3381
|
+
if (blockRevalidation && !shouldValidateOnChange()) {
|
|
3382
|
+
blockRevalidation = false;
|
|
3383
|
+
return;
|
|
3384
|
+
}
|
|
3385
|
+
validation.commit(value.value, true);
|
|
3386
|
+
});
|
|
3387
|
+
function onFocus(event) {
|
|
3388
|
+
if (event.defaultPrevented || readOnly.value || disabled.value) return;
|
|
3389
|
+
setFocused(true);
|
|
3390
|
+
if (hasTouchedInput) return;
|
|
3391
|
+
hasTouchedInput = true;
|
|
3392
|
+
const target = event.currentTarget;
|
|
3393
|
+
const length = target.value.length;
|
|
3394
|
+
target.setSelectionRange(length, length);
|
|
3395
|
+
}
|
|
3396
|
+
function onBlur(event) {
|
|
3397
|
+
if (event.defaultPrevented || readOnly.value || disabled.value) return;
|
|
3398
|
+
setTouched(true);
|
|
3399
|
+
setFocused(false);
|
|
3400
|
+
const hadManualInput = !allowInputSyncRef.value;
|
|
3401
|
+
const hadPendingProgrammaticChange = hasPendingCommitRef.value;
|
|
3402
|
+
allowInputSyncRef.value = true;
|
|
3403
|
+
if (inputValue.value.trim() === "") {
|
|
3404
|
+
setValue(null, require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.inputClear, event));
|
|
3405
|
+
if (validationMode.value === "onBlur") validation.commit(null);
|
|
3406
|
+
onValueCommitted(null, require_checkbox_index.createGenericEventDetails(require_checkbox_index.REASONS.inputClear, event));
|
|
3407
|
+
return;
|
|
3408
|
+
}
|
|
3409
|
+
const formatOptions = formatOptionsRef.value;
|
|
3410
|
+
const parsedValue = require_decrement_NumberFieldDecrement.parseNumber(inputValue.value, locale.value, formatOptions);
|
|
3411
|
+
if (parsedValue === null) return;
|
|
3412
|
+
const hasRoundingOptions = hasNumberFormatRoundingOptions(formatOptions);
|
|
3413
|
+
const committed = hasRoundingOptions ? removeFloatingPointErrors(parsedValue, formatOptions) : parsedValue;
|
|
3414
|
+
const nextEventDetails = require_checkbox_index.createGenericEventDetails(require_checkbox_index.REASONS.inputBlur, event);
|
|
3415
|
+
const shouldUpdateValue = value.value !== committed;
|
|
3416
|
+
const shouldCommit = hadManualInput || shouldUpdateValue || hadPendingProgrammaticChange;
|
|
3417
|
+
let committedValue = committed;
|
|
3418
|
+
if (shouldUpdateValue) {
|
|
3419
|
+
const changeDetails = require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.inputBlur, event);
|
|
3420
|
+
blockRevalidation = true;
|
|
3421
|
+
setValue(committed, changeDetails);
|
|
3422
|
+
if (changeDetails.isCanceled) {
|
|
3423
|
+
blockRevalidation = false;
|
|
3424
|
+
return;
|
|
3425
|
+
}
|
|
3426
|
+
committedValue = lastChangedValueRef.value ?? committed;
|
|
3427
|
+
}
|
|
3428
|
+
if (validationMode.value === "onBlur") validation.commit(committedValue);
|
|
3429
|
+
if (shouldCommit) onValueCommitted(committedValue, nextEventDetails);
|
|
3430
|
+
const canonicalText = require_decrement_NumberFieldDecrement.formatNumber(committedValue, locale.value, formatOptions);
|
|
3431
|
+
if (!(!hasRoundingOptions && parsedValue === value.value && inputValue.value === require_decrement_NumberFieldDecrement.formatNumberMaxPrecision(parsedValue, locale.value, formatOptions)) && inputValue.value !== canonicalText) setInputValue(canonicalText);
|
|
3432
|
+
}
|
|
3433
|
+
function onInput(event) {
|
|
3434
|
+
if (event.defaultPrevented) return;
|
|
3435
|
+
allowInputSyncRef.value = false;
|
|
3436
|
+
const targetValue = event.currentTarget.value;
|
|
3437
|
+
if (targetValue.trim() === "") {
|
|
3438
|
+
setInputValue(targetValue);
|
|
3439
|
+
setValue(null, require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.inputClear, event));
|
|
3440
|
+
return;
|
|
3441
|
+
}
|
|
3442
|
+
const allowedNonNumericKeys = getAllowedNonNumericKeys();
|
|
3443
|
+
if (!Array.from(targetValue).every((ch) => {
|
|
3444
|
+
const isAsciiDigit = ch >= "0" && ch <= "9";
|
|
3445
|
+
const isArabicNumeral = require_decrement_NumberFieldDecrement.ARABIC_DETECT_RE.test(ch);
|
|
3446
|
+
const isHanNumeral = require_decrement_NumberFieldDecrement.HAN_DETECT_RE.test(ch);
|
|
3447
|
+
const isPersianNumeral = require_decrement_NumberFieldDecrement.PERSIAN_DETECT_RE.test(ch);
|
|
3448
|
+
const isFullwidthNumeral = require_decrement_NumberFieldDecrement.FULLWIDTH_DETECT_RE.test(ch);
|
|
3449
|
+
const isMinus = require_decrement_NumberFieldDecrement.ANY_MINUS_DETECT_RE.test(ch);
|
|
3450
|
+
return isAsciiDigit || isArabicNumeral || isHanNumeral || isPersianNumeral || isFullwidthNumeral || isMinus || allowedNonNumericKeys.has(ch);
|
|
3451
|
+
})) return;
|
|
3452
|
+
const parsedValue = require_decrement_NumberFieldDecrement.parseNumber(targetValue, locale.value, formatOptionsRef.value);
|
|
3453
|
+
setInputValue(targetValue);
|
|
3454
|
+
if (parsedValue !== null) setValue(parsedValue, require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.inputChange, event));
|
|
3455
|
+
}
|
|
3456
|
+
function onKeydown(event) {
|
|
3457
|
+
if (event.defaultPrevented || readOnly.value || disabled.value) return;
|
|
3458
|
+
allowInputSyncRef.value = true;
|
|
3459
|
+
const allowedNonNumericKeys = getAllowedNonNumericKeys();
|
|
3460
|
+
let isAllowedNonNumericKey = allowedNonNumericKeys.has(event.key);
|
|
3461
|
+
const { decimal, currency, percentSign } = require_decrement_NumberFieldDecrement.getNumberLocaleDetails(locale.value, formatOptionsRef.value);
|
|
3462
|
+
const target = event.currentTarget;
|
|
3463
|
+
const selectionStart = target.selectionStart;
|
|
3464
|
+
const selectionEnd = target.selectionEnd;
|
|
3465
|
+
const isAllSelected = selectionStart === 0 && selectionEnd === inputValue.value.length;
|
|
3466
|
+
const selectionContainsIndex = (index) => selectionStart != null && selectionEnd != null && index >= selectionStart && index < selectionEnd;
|
|
3467
|
+
if (require_decrement_NumberFieldDecrement.ANY_MINUS_DETECT_RE.test(event.key) && Array.from(allowedNonNumericKeys).some((k) => require_decrement_NumberFieldDecrement.ANY_MINUS_DETECT_RE.test(k || ""))) {
|
|
3468
|
+
const existingIndex = inputValue.value.search(require_decrement_NumberFieldDecrement.ANY_MINUS_RE);
|
|
3469
|
+
const isReplacingExisting = existingIndex != null && existingIndex !== -1 && selectionContainsIndex(existingIndex);
|
|
3470
|
+
isAllowedNonNumericKey = !(require_decrement_NumberFieldDecrement.ANY_MINUS_DETECT_RE.test(inputValue.value) || require_decrement_NumberFieldDecrement.ANY_PLUS_DETECT_RE.test(inputValue.value)) || isAllSelected || isReplacingExisting;
|
|
3471
|
+
}
|
|
3472
|
+
if (require_decrement_NumberFieldDecrement.ANY_PLUS_DETECT_RE.test(event.key) && Array.from(allowedNonNumericKeys).some((k) => require_decrement_NumberFieldDecrement.ANY_PLUS_DETECT_RE.test(k || ""))) {
|
|
3473
|
+
const existingIndex = inputValue.value.search(require_decrement_NumberFieldDecrement.ANY_PLUS_RE);
|
|
3474
|
+
const isReplacingExisting = existingIndex != null && existingIndex !== -1 && selectionContainsIndex(existingIndex);
|
|
3475
|
+
isAllowedNonNumericKey = !(require_decrement_NumberFieldDecrement.ANY_MINUS_DETECT_RE.test(inputValue.value) || require_decrement_NumberFieldDecrement.ANY_PLUS_DETECT_RE.test(inputValue.value)) || isAllSelected || isReplacingExisting;
|
|
3476
|
+
}
|
|
3477
|
+
[
|
|
3478
|
+
decimal,
|
|
3479
|
+
currency,
|
|
3480
|
+
percentSign
|
|
3481
|
+
].forEach((symbol) => {
|
|
3482
|
+
if (event.key === symbol && symbol) {
|
|
3483
|
+
const isSymbolHighlighted = selectionContainsIndex(inputValue.value.indexOf(symbol));
|
|
3484
|
+
isAllowedNonNumericKey = !inputValue.value.includes(symbol) || isAllSelected || isSymbolHighlighted;
|
|
3485
|
+
}
|
|
3486
|
+
});
|
|
3487
|
+
const isAsciiDigit = event.key >= "0" && event.key <= "9";
|
|
3488
|
+
const isArabicNumeral = require_decrement_NumberFieldDecrement.ARABIC_DETECT_RE.test(event.key);
|
|
3489
|
+
const isHanNumeral = require_decrement_NumberFieldDecrement.HAN_DETECT_RE.test(event.key);
|
|
3490
|
+
const isPersianNumeral = require_decrement_NumberFieldDecrement.PERSIAN_DETECT_RE.test(event.key);
|
|
3491
|
+
const isFullwidthNumeral = require_decrement_NumberFieldDecrement.FULLWIDTH_DETECT_RE.test(event.key);
|
|
3492
|
+
const isNavigateKey = NAVIGATE_KEYS.has(event.key);
|
|
3493
|
+
const isStepKey = event.key === "ArrowUp" || event.key === "ArrowDown";
|
|
3494
|
+
if (event.which === 229 || event.altKey && !isStepKey || event.ctrlKey || event.metaKey || isAllowedNonNumericKey || isAsciiDigit || isArabicNumeral || isFullwidthNumeral || isHanNumeral || isPersianNumeral || isNavigateKey) return;
|
|
3495
|
+
const parsedValue = require_decrement_NumberFieldDecrement.parseNumber(inputValue.value, locale.value, formatOptionsRef.value);
|
|
3496
|
+
const amount = getStepAmount(event) ?? require_decrement_NumberFieldDecrement.DEFAULT_STEP;
|
|
3497
|
+
stopEvent(event);
|
|
3498
|
+
const commitDetails = require_checkbox_index.createGenericEventDetails(require_checkbox_index.REASONS.keyboard, event);
|
|
3499
|
+
if (event.key === "ArrowUp") {
|
|
3500
|
+
incrementValue(amount, {
|
|
3501
|
+
direction: 1,
|
|
3502
|
+
currentValue: parsedValue,
|
|
3503
|
+
event,
|
|
3504
|
+
reason: require_checkbox_index.REASONS.keyboard
|
|
3505
|
+
});
|
|
3506
|
+
onValueCommitted(lastChangedValueRef.value ?? valueRef.value, commitDetails);
|
|
3507
|
+
} else if (event.key === "ArrowDown") {
|
|
3508
|
+
incrementValue(amount, {
|
|
3509
|
+
direction: -1,
|
|
3510
|
+
currentValue: parsedValue,
|
|
3511
|
+
event,
|
|
3512
|
+
reason: require_checkbox_index.REASONS.keyboard
|
|
3513
|
+
});
|
|
3514
|
+
onValueCommitted(lastChangedValueRef.value ?? valueRef.value, commitDetails);
|
|
3515
|
+
} else if (event.key === "Home" && min.value != null) {
|
|
3516
|
+
setValue(min.value, require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.keyboard, event));
|
|
3517
|
+
onValueCommitted(lastChangedValueRef.value ?? valueRef.value, commitDetails);
|
|
3518
|
+
} else if (event.key === "End" && max.value != null) {
|
|
3519
|
+
setValue(max.value, require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.keyboard, event));
|
|
3520
|
+
onValueCommitted(lastChangedValueRef.value ?? valueRef.value, commitDetails);
|
|
3521
|
+
}
|
|
3522
|
+
}
|
|
3523
|
+
function onPaste(event) {
|
|
3524
|
+
if (event.defaultPrevented || readOnly.value || disabled.value) return;
|
|
3525
|
+
let pastedData = "";
|
|
3526
|
+
try {
|
|
3527
|
+
pastedData = event.clipboardData?.getData("text/plain") ?? "";
|
|
3528
|
+
} catch {
|
|
3529
|
+
if (process.env.NODE_ENV !== "production") warn("<NumberFieldInput> could not read clipboard text during paste handling.");
|
|
3530
|
+
return;
|
|
3531
|
+
}
|
|
3532
|
+
event.preventDefault();
|
|
3533
|
+
const parsedValue = require_decrement_NumberFieldDecrement.parseNumber(pastedData, locale.value, formatOptionsRef.value);
|
|
3534
|
+
if (parsedValue !== null) {
|
|
3535
|
+
allowInputSyncRef.value = false;
|
|
3536
|
+
setValue(parsedValue, require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.inputPaste, event));
|
|
3537
|
+
setInputValue(pastedData);
|
|
3538
|
+
}
|
|
3539
|
+
}
|
|
3540
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
3541
|
+
componentProps: props,
|
|
3542
|
+
state,
|
|
3543
|
+
props: (0, vue.computed)(() => require_button_Button.mergeProps(attrsObject, validation.getValidationProps(), {
|
|
3544
|
+
"id": id.value,
|
|
3545
|
+
"required": required.value,
|
|
3546
|
+
"disabled": disabled.value,
|
|
3547
|
+
"readonly": readOnly.value,
|
|
3548
|
+
"inputmode": inputMode.value,
|
|
3549
|
+
"value": inputValue.value,
|
|
3550
|
+
"type": "text",
|
|
3551
|
+
"autocomplete": "off",
|
|
3552
|
+
"autocorrect": "off",
|
|
3553
|
+
"spellcheck": "false",
|
|
3554
|
+
"aria-roledescription": "Number field",
|
|
3555
|
+
"aria-invalid": !disabled.value && invalid.value ? true : void 0,
|
|
3556
|
+
"aria-labelledby": labelId.value,
|
|
3557
|
+
"onFocus": onFocus,
|
|
3558
|
+
"onBlur": onBlur,
|
|
3559
|
+
"onInput": onInput,
|
|
3560
|
+
"onKeydown": onKeydown,
|
|
3561
|
+
"onPaste": onPaste
|
|
3562
|
+
})),
|
|
3563
|
+
stateAttributesMapping: require_decrement_NumberFieldDecrement.stateAttributesMapping,
|
|
3564
|
+
defaultTagName: "input",
|
|
3565
|
+
ref: setInputRef
|
|
3566
|
+
});
|
|
3567
|
+
return (_ctx, _cache) => {
|
|
3568
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
3569
|
+
key: 0,
|
|
3570
|
+
ref: (0, vue.unref)(renderRef),
|
|
3571
|
+
props: (0, vue.unref)(mergedProps),
|
|
3572
|
+
state: (0, vue.unref)(state)
|
|
3573
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
3574
|
+
key: 1,
|
|
3575
|
+
ref: (0, vue.unref)(renderRef)
|
|
3576
|
+
}, (0, vue.unref)(mergedProps)), null, 16));
|
|
3577
|
+
};
|
|
3578
|
+
}
|
|
3579
|
+
});
|
|
3580
|
+
|
|
3581
|
+
//#endregion
|
|
3582
|
+
//#region src/number-field/input/NumberFieldInput.vue
|
|
3583
|
+
var NumberFieldInput_default = NumberFieldInput_vue_vue_type_script_setup_true_lang_default;
|
|
3584
|
+
|
|
3585
|
+
//#endregion
|
|
3586
|
+
//#region src/utils/detectBrowser.ts
|
|
3587
|
+
const ua = typeof navigator !== "undefined" ? navigator.userAgent : "";
|
|
3588
|
+
const platform = typeof navigator !== "undefined" ? navigator.platform : "";
|
|
3589
|
+
const maxTouchPoints = typeof navigator !== "undefined" ? navigator.maxTouchPoints : 0;
|
|
3590
|
+
const isWebKit = typeof CSS !== "undefined" && typeof CSS.supports === "function" ? CSS.supports("-webkit-backdrop-filter:none") && !/chrome|android/i.test(ua) : /\b(?:iphone|ipad|ipod)\b/i.test(ua);
|
|
3591
|
+
const isFirefox = /firefox/i.test(ua);
|
|
3592
|
+
const isIOS = /\b(?:iphone|ipad|ipod)\b/i.test(ua) || platform === "MacIntel" && maxTouchPoints > 1;
|
|
3593
|
+
|
|
3594
|
+
//#endregion
|
|
3595
|
+
//#region src/number-field/root/NumberFieldRoot.vue?vue&type=script&setup=true&lang.ts
|
|
3596
|
+
var NumberFieldRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
3597
|
+
name: "NumberFieldRoot",
|
|
3598
|
+
inheritAttrs: false,
|
|
3599
|
+
__name: "NumberFieldRoot",
|
|
3600
|
+
props: {
|
|
3601
|
+
id: {
|
|
3602
|
+
type: String,
|
|
3603
|
+
required: false
|
|
3604
|
+
},
|
|
3605
|
+
min: {
|
|
3606
|
+
type: Number,
|
|
3607
|
+
required: false
|
|
3608
|
+
},
|
|
3609
|
+
max: {
|
|
3610
|
+
type: Number,
|
|
3611
|
+
required: false
|
|
3612
|
+
},
|
|
3613
|
+
allowOutOfRange: {
|
|
3614
|
+
type: Boolean,
|
|
3615
|
+
required: false,
|
|
3616
|
+
default: false
|
|
3617
|
+
},
|
|
3618
|
+
smallStep: {
|
|
3619
|
+
type: Number,
|
|
3620
|
+
required: false,
|
|
3621
|
+
default: .1
|
|
3622
|
+
},
|
|
3623
|
+
step: {
|
|
3624
|
+
type: [Number, String],
|
|
3625
|
+
required: false,
|
|
3626
|
+
default: 1
|
|
3627
|
+
},
|
|
3628
|
+
largeStep: {
|
|
3629
|
+
type: Number,
|
|
3630
|
+
required: false,
|
|
3631
|
+
default: 10
|
|
3632
|
+
},
|
|
3633
|
+
required: {
|
|
3634
|
+
type: Boolean,
|
|
3635
|
+
required: false,
|
|
3636
|
+
default: false
|
|
3637
|
+
},
|
|
3638
|
+
disabled: {
|
|
3639
|
+
type: Boolean,
|
|
3640
|
+
required: false,
|
|
3641
|
+
default: false
|
|
3642
|
+
},
|
|
3643
|
+
readOnly: {
|
|
3644
|
+
type: Boolean,
|
|
3645
|
+
required: false,
|
|
3646
|
+
default: false
|
|
3647
|
+
},
|
|
3648
|
+
name: {
|
|
3649
|
+
type: String,
|
|
3650
|
+
required: false
|
|
3651
|
+
},
|
|
3652
|
+
form: {
|
|
3653
|
+
type: String,
|
|
3654
|
+
required: false
|
|
3655
|
+
},
|
|
3656
|
+
value: {
|
|
3657
|
+
type: [Number, null],
|
|
3658
|
+
required: false
|
|
3659
|
+
},
|
|
3660
|
+
defaultValue: {
|
|
3661
|
+
type: Number,
|
|
3662
|
+
required: false
|
|
3663
|
+
},
|
|
3664
|
+
allowWheelScrub: {
|
|
3665
|
+
type: Boolean,
|
|
3666
|
+
required: false,
|
|
3667
|
+
default: false
|
|
3668
|
+
},
|
|
3669
|
+
snapOnStep: {
|
|
3670
|
+
type: Boolean,
|
|
3671
|
+
required: false,
|
|
3672
|
+
default: false
|
|
3673
|
+
},
|
|
3674
|
+
format: {
|
|
3675
|
+
type: null,
|
|
3676
|
+
required: false
|
|
3677
|
+
},
|
|
3678
|
+
locale: {
|
|
3679
|
+
type: null,
|
|
3680
|
+
required: false
|
|
3681
|
+
},
|
|
3682
|
+
as: {
|
|
3683
|
+
type: null,
|
|
3684
|
+
required: false,
|
|
3685
|
+
default: "div"
|
|
3686
|
+
},
|
|
3687
|
+
class: {
|
|
3688
|
+
type: Function,
|
|
3689
|
+
required: false,
|
|
3690
|
+
skipCheck: true
|
|
3691
|
+
},
|
|
3692
|
+
style: {
|
|
3693
|
+
type: [
|
|
3694
|
+
Boolean,
|
|
3695
|
+
null,
|
|
3696
|
+
String,
|
|
3697
|
+
Object,
|
|
3698
|
+
Array,
|
|
3699
|
+
Function
|
|
3700
|
+
],
|
|
3701
|
+
required: false,
|
|
3702
|
+
skipCheck: true
|
|
3703
|
+
}
|
|
3704
|
+
},
|
|
3705
|
+
emits: ["valueChange", "valueCommitted"],
|
|
3706
|
+
setup(__props, { emit: __emit }) {
|
|
3707
|
+
const props = __props;
|
|
3708
|
+
const emit = __emit;
|
|
3709
|
+
const attrsObject = (0, vue.useAttrs)();
|
|
3710
|
+
const { setDirty, validityData, disabled: fieldDisabled, setFilled, invalid, name: fieldName, state: fieldState, validation } = require_checkbox_group_CheckboxGroup.useFieldRootContext();
|
|
3711
|
+
const { clearErrors } = require_checkbox_group_CheckboxGroup.useFormContext();
|
|
3712
|
+
const disabled = (0, vue.computed)(() => fieldDisabled.value || props.disabled);
|
|
3713
|
+
const readOnly = (0, vue.computed)(() => props.readOnly);
|
|
3714
|
+
const required = (0, vue.computed)(() => props.required);
|
|
3715
|
+
const nameProp = (0, vue.computed)(() => props.name);
|
|
3716
|
+
const name = (0, vue.computed)(() => fieldName.value ?? props.name);
|
|
3717
|
+
const step = (0, vue.computed)(() => props.step === "any" ? 1 : props.step);
|
|
3718
|
+
const smallStep = (0, vue.computed)(() => props.smallStep);
|
|
3719
|
+
const largeStep = (0, vue.computed)(() => props.largeStep);
|
|
3720
|
+
const locale = (0, vue.computed)(() => props.locale);
|
|
3721
|
+
const format = (0, vue.computed)(() => props.format);
|
|
3722
|
+
const min = (0, vue.computed)(() => props.min);
|
|
3723
|
+
const max = (0, vue.computed)(() => props.max);
|
|
3724
|
+
const minWithDefault = (0, vue.computed)(() => props.min ?? Number.MIN_SAFE_INTEGER);
|
|
3725
|
+
const maxWithDefault = (0, vue.computed)(() => props.max ?? Number.MAX_SAFE_INTEGER);
|
|
3726
|
+
const minWithZeroDefault = (0, vue.computed)(() => props.min ?? 0);
|
|
3727
|
+
const formatStyle = (0, vue.computed)(() => props.format?.style);
|
|
3728
|
+
const isScrubbingRef = (0, vue.ref)(false);
|
|
3729
|
+
function setIsScrubbing(value) {
|
|
3730
|
+
isScrubbingRef.value = value;
|
|
3731
|
+
}
|
|
3732
|
+
const inputRef = (0, vue.ref)(null);
|
|
3733
|
+
const validationInputRef = (0, vue.ref)(null);
|
|
3734
|
+
const id = require_control_FieldControl.useLabelableId({ id: (0, vue.computed)(() => props.id) });
|
|
3735
|
+
const { value: valueUnwrapped, setValue: setValueUnwrapped } = require_checkbox_group_CheckboxGroup.useControllableState({
|
|
3736
|
+
controlled: () => props.value,
|
|
3737
|
+
default: () => props.defaultValue ?? null,
|
|
3738
|
+
name: "NumberField",
|
|
3739
|
+
state: "value"
|
|
3740
|
+
});
|
|
3741
|
+
const value = (0, vue.computed)(() => valueUnwrapped.value ?? null);
|
|
3742
|
+
const valueRef = (0, vue.ref)(value.value);
|
|
3743
|
+
(0, vue.watch)(value, (next) => {
|
|
3744
|
+
valueRef.value = next;
|
|
3745
|
+
}, { flush: "post" });
|
|
3746
|
+
const formatOptionsRef = format;
|
|
3747
|
+
const hasPendingCommitRef = (0, vue.ref)(false);
|
|
3748
|
+
const allowInputSyncRef = (0, vue.ref)(true);
|
|
3749
|
+
const lastChangedValueRef = (0, vue.ref)(null);
|
|
3750
|
+
function onValueCommitted(nextValue, eventDetails) {
|
|
3751
|
+
hasPendingCommitRef.value = false;
|
|
3752
|
+
emit("valueCommitted", nextValue, eventDetails);
|
|
3753
|
+
}
|
|
3754
|
+
function getControlledInputValue(nextValue) {
|
|
3755
|
+
return hasNumberFormatRoundingOptions(format.value) ? require_decrement_NumberFieldDecrement.formatNumber(nextValue, locale.value, format.value) : require_decrement_NumberFieldDecrement.formatNumberMaxPrecision(nextValue, locale.value, format.value);
|
|
3756
|
+
}
|
|
3757
|
+
const inputValue = (0, vue.ref)(props.value !== void 0 ? getControlledInputValue(value.value) : require_decrement_NumberFieldDecrement.formatNumber(value.value, locale.value, format.value));
|
|
3758
|
+
function setInputValue(next) {
|
|
3759
|
+
inputValue.value = next;
|
|
3760
|
+
}
|
|
3761
|
+
const inputMode = (0, vue.ref)("numeric");
|
|
3762
|
+
(0, vue.watchEffect)(() => {
|
|
3763
|
+
setFilled(value.value !== null);
|
|
3764
|
+
});
|
|
3765
|
+
(0, vue.watchEffect)(() => {
|
|
3766
|
+
validation.setInputRef(validationInputRef.value);
|
|
3767
|
+
});
|
|
3768
|
+
require_checkbox_group_CheckboxGroup.useField({
|
|
3769
|
+
enabled: (0, vue.computed)(() => !disabled.value),
|
|
3770
|
+
id,
|
|
3771
|
+
name,
|
|
3772
|
+
commit: (v) => validation.commit(v),
|
|
3773
|
+
value,
|
|
3774
|
+
getValue: () => value.value,
|
|
3775
|
+
controlRef: inputRef
|
|
3776
|
+
});
|
|
3777
|
+
function getAllowedNonNumericKeys() {
|
|
3778
|
+
const { decimal, group, currency, literal } = require_decrement_NumberFieldDecrement.getNumberLocaleDetails(locale.value, format.value);
|
|
3779
|
+
const keys = /* @__PURE__ */ new Set();
|
|
3780
|
+
require_decrement_NumberFieldDecrement.BASE_NON_NUMERIC_SYMBOLS.forEach((symbol) => keys.add(symbol));
|
|
3781
|
+
if (decimal) keys.add(decimal);
|
|
3782
|
+
if (group) {
|
|
3783
|
+
keys.add(group);
|
|
3784
|
+
if (require_decrement_NumberFieldDecrement.SPACE_SEPARATOR_RE.test(group)) keys.add(" ");
|
|
3785
|
+
}
|
|
3786
|
+
const allowPercentSymbols = formatStyle.value === "percent" || formatStyle.value === "unit" && format.value?.unit === "percent";
|
|
3787
|
+
const allowPermilleSymbols = formatStyle.value === "percent" || formatStyle.value === "unit" && format.value?.unit === "permille";
|
|
3788
|
+
if (allowPercentSymbols) require_decrement_NumberFieldDecrement.PERCENTAGES.forEach((key) => keys.add(key));
|
|
3789
|
+
if (allowPermilleSymbols) require_decrement_NumberFieldDecrement.PERMILLE.forEach((key) => keys.add(key));
|
|
3790
|
+
if (formatStyle.value === "currency" && currency) keys.add(currency);
|
|
3791
|
+
if (literal) {
|
|
3792
|
+
Array.from(literal).forEach((char) => keys.add(char));
|
|
3793
|
+
if (require_decrement_NumberFieldDecrement.SPACE_SEPARATOR_RE.test(literal)) keys.add(" ");
|
|
3794
|
+
}
|
|
3795
|
+
require_decrement_NumberFieldDecrement.PLUS_SIGNS_WITH_ASCII.forEach((key) => keys.add(key));
|
|
3796
|
+
if (minWithDefault.value < 0) require_decrement_NumberFieldDecrement.MINUS_SIGNS_WITH_ASCII.forEach((key) => keys.add(key));
|
|
3797
|
+
return keys;
|
|
3798
|
+
}
|
|
3799
|
+
function getStepAmount(event) {
|
|
3800
|
+
if (event?.altKey) return smallStep.value;
|
|
3801
|
+
if (event?.shiftKey) return largeStep.value;
|
|
3802
|
+
return step.value;
|
|
3803
|
+
}
|
|
3804
|
+
function setValue(unvalidatedValue, details) {
|
|
3805
|
+
const eventWithOptionalKeyState = details.event;
|
|
3806
|
+
const dir = details.direction;
|
|
3807
|
+
const reason = details.reason;
|
|
3808
|
+
const shouldClampValue = !props.allowOutOfRange || !(reason === require_checkbox_index.REASONS.inputChange || reason === require_checkbox_index.REASONS.inputBlur || reason === require_checkbox_index.REASONS.inputPaste || reason === require_checkbox_index.REASONS.inputClear || reason === require_checkbox_index.REASONS.none);
|
|
3809
|
+
const validatedValue = toValidatedNumber(unvalidatedValue, {
|
|
3810
|
+
step: dir ? getStepAmount(eventWithOptionalKeyState) * dir : void 0,
|
|
3811
|
+
format: formatOptionsRef.value,
|
|
3812
|
+
minWithDefault: minWithDefault.value,
|
|
3813
|
+
maxWithDefault: maxWithDefault.value,
|
|
3814
|
+
minWithZeroDefault: minWithZeroDefault.value,
|
|
3815
|
+
snapOnStep: props.snapOnStep,
|
|
3816
|
+
small: eventWithOptionalKeyState?.altKey ?? false,
|
|
3817
|
+
clamp: shouldClampValue
|
|
3818
|
+
});
|
|
3819
|
+
const isInputReason = details.reason === require_checkbox_index.REASONS.inputChange || details.reason === require_checkbox_index.REASONS.inputClear || details.reason === require_checkbox_index.REASONS.inputBlur || details.reason === require_checkbox_index.REASONS.inputPaste || details.reason === require_checkbox_index.REASONS.none;
|
|
3820
|
+
const shouldFireChange = validatedValue !== value.value || isInputReason && (unvalidatedValue !== value.value || allowInputSyncRef.value === false);
|
|
3821
|
+
if (shouldFireChange) {
|
|
3822
|
+
emit("valueChange", validatedValue, details);
|
|
3823
|
+
if (details.isCanceled) return shouldFireChange;
|
|
3824
|
+
setValueUnwrapped(validatedValue);
|
|
3825
|
+
setDirty(validatedValue !== validityData.value.initialValue);
|
|
3826
|
+
hasPendingCommitRef.value = true;
|
|
3827
|
+
}
|
|
3828
|
+
lastChangedValueRef.value = validatedValue;
|
|
3829
|
+
if (allowInputSyncRef.value) setInputValue(props.value !== void 0 ? getControlledInputValue(value.value) : require_decrement_NumberFieldDecrement.formatNumber(validatedValue, locale.value, format.value));
|
|
3830
|
+
return shouldFireChange;
|
|
3831
|
+
}
|
|
3832
|
+
function incrementValue(amount, { direction, currentValue, event, reason }) {
|
|
3833
|
+
const prevValue = currentValue == null ? valueRef.value : currentValue;
|
|
3834
|
+
return setValue(typeof prevValue === "number" ? prevValue + amount * direction : Math.max(0, props.min ?? 0), require_checkbox_index.createChangeEventDetails(reason, event, void 0, { direction }));
|
|
3835
|
+
}
|
|
3836
|
+
(0, vue.watch)([
|
|
3837
|
+
value,
|
|
3838
|
+
locale,
|
|
3839
|
+
format
|
|
3840
|
+
], () => {
|
|
3841
|
+
if (!allowInputSyncRef.value) return;
|
|
3842
|
+
const nextInputValue = props.value !== void 0 ? getControlledInputValue(value.value) : require_decrement_NumberFieldDecrement.formatNumber(value.value, locale.value, format.value);
|
|
3843
|
+
if (nextInputValue !== inputValue.value) setInputValue(nextInputValue);
|
|
3844
|
+
}, { flush: "post" });
|
|
3845
|
+
(0, vue.watchEffect)(() => {
|
|
3846
|
+
if (!isIOS) return;
|
|
3847
|
+
let computedInputMode = "text";
|
|
3848
|
+
if (minWithDefault.value >= 0) computedInputMode = "decimal";
|
|
3849
|
+
inputMode.value = computedInputMode;
|
|
3850
|
+
});
|
|
3851
|
+
(0, vue.watchEffect)((onCleanup) => {
|
|
3852
|
+
const element = inputRef.value;
|
|
3853
|
+
if (disabled.value || readOnly.value || !props.allowWheelScrub || !element) return;
|
|
3854
|
+
function handleWheel(event) {
|
|
3855
|
+
if (event.ctrlKey || require_control_SliderControl.activeElement(require_control_SliderControl.ownerDocument(inputRef.value)) !== inputRef.value) return;
|
|
3856
|
+
event.preventDefault();
|
|
3857
|
+
allowInputSyncRef.value = true;
|
|
3858
|
+
incrementValue(getStepAmount(event) ?? require_decrement_NumberFieldDecrement.DEFAULT_STEP, {
|
|
3859
|
+
direction: event.deltaY > 0 ? -1 : 1,
|
|
3860
|
+
event,
|
|
3861
|
+
reason: "wheel"
|
|
3862
|
+
});
|
|
3863
|
+
}
|
|
3864
|
+
element.addEventListener("wheel", handleWheel, { passive: false });
|
|
3865
|
+
onCleanup(() => {
|
|
3866
|
+
element.removeEventListener("wheel", handleWheel);
|
|
3867
|
+
});
|
|
3868
|
+
});
|
|
3869
|
+
const state = (0, vue.computed)(() => ({
|
|
3870
|
+
...fieldState.value,
|
|
3871
|
+
disabled: disabled.value,
|
|
3872
|
+
readOnly: readOnly.value,
|
|
3873
|
+
required: required.value,
|
|
3874
|
+
value: value.value,
|
|
3875
|
+
inputValue: inputValue.value,
|
|
3876
|
+
scrubbing: isScrubbingRef.value
|
|
3877
|
+
}));
|
|
3878
|
+
(0, vue.provide)(require_decrement_NumberFieldDecrement.numberFieldRootContextKey, {
|
|
3879
|
+
inputRef,
|
|
3880
|
+
inputValue,
|
|
3881
|
+
value,
|
|
3882
|
+
minWithDefault,
|
|
3883
|
+
maxWithDefault,
|
|
3884
|
+
disabled,
|
|
3885
|
+
readOnly,
|
|
3886
|
+
id,
|
|
3887
|
+
setValue,
|
|
3888
|
+
incrementValue,
|
|
3889
|
+
getStepAmount,
|
|
3890
|
+
allowInputSyncRef,
|
|
3891
|
+
formatOptionsRef,
|
|
3892
|
+
valueRef,
|
|
3893
|
+
lastChangedValueRef,
|
|
3894
|
+
hasPendingCommitRef,
|
|
3895
|
+
name,
|
|
3896
|
+
nameProp,
|
|
3897
|
+
required,
|
|
3898
|
+
invalid,
|
|
3899
|
+
inputMode,
|
|
3900
|
+
getAllowedNonNumericKeys,
|
|
3901
|
+
min,
|
|
3902
|
+
max,
|
|
3903
|
+
setInputValue,
|
|
3904
|
+
locale,
|
|
3905
|
+
isScrubbing: isScrubbingRef,
|
|
3906
|
+
setIsScrubbing,
|
|
3907
|
+
state,
|
|
3908
|
+
onValueCommitted
|
|
3909
|
+
});
|
|
3910
|
+
const { tag: rootTag, mergedProps: rootMergedProps, renderless: rootRenderless, ref: rootRenderRef } = require_button_Button.useRenderElement({
|
|
3911
|
+
componentProps: props,
|
|
3912
|
+
state,
|
|
3913
|
+
props: attrsObject,
|
|
3914
|
+
stateAttributesMapping: require_decrement_NumberFieldDecrement.stateAttributesMapping,
|
|
3915
|
+
defaultTagName: "div",
|
|
3916
|
+
ref: (0, vue.ref)(null)
|
|
3917
|
+
});
|
|
3918
|
+
const hiddenInputProps = (0, vue.computed)(() => ({
|
|
3919
|
+
...validation.getValidationProps(),
|
|
3920
|
+
"type": "number",
|
|
3921
|
+
"form": props.form,
|
|
3922
|
+
"name": name.value,
|
|
3923
|
+
"value": value.value ?? "",
|
|
3924
|
+
"min": props.min,
|
|
3925
|
+
"max": props.max,
|
|
3926
|
+
"step": props.step,
|
|
3927
|
+
"disabled": disabled.value,
|
|
3928
|
+
"required": required.value,
|
|
3929
|
+
"aria-hidden": true,
|
|
3930
|
+
"tabindex": -1,
|
|
3931
|
+
"style": name.value ? require_checkbox_index.visuallyHiddenInput : require_checkbox_index.visuallyHidden
|
|
3932
|
+
}));
|
|
3933
|
+
function handleHiddenFocus() {
|
|
3934
|
+
inputRef.value?.focus();
|
|
3935
|
+
}
|
|
3936
|
+
function handleHiddenInput(event) {
|
|
3937
|
+
const target = event.currentTarget;
|
|
3938
|
+
if (event.defaultPrevented || disabled.value || readOnly.value) return;
|
|
3939
|
+
const nextValue = target.valueAsNumber;
|
|
3940
|
+
const parsedValue = Number.isNaN(nextValue) ? null : nextValue;
|
|
3941
|
+
const details = require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.none, event);
|
|
3942
|
+
setDirty(parsedValue !== validityData.value.initialValue);
|
|
3943
|
+
setValue(parsedValue, details);
|
|
3944
|
+
clearErrors(name.value);
|
|
3945
|
+
validation.commit(parsedValue, true);
|
|
3946
|
+
}
|
|
3947
|
+
return (_ctx, _cache) => {
|
|
3948
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, null, [!(0, vue.unref)(rootRenderless) ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(rootTag)), (0, vue.mergeProps)({
|
|
3949
|
+
key: 0,
|
|
3950
|
+
ref: (0, vue.unref)(rootRenderRef)
|
|
3951
|
+
}, (0, vue.unref)(rootMergedProps)), {
|
|
3952
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: state.value })]),
|
|
3953
|
+
_: 3
|
|
3954
|
+
}, 16)) : (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
3955
|
+
key: 1,
|
|
3956
|
+
ref: (0, vue.unref)(rootRenderRef),
|
|
3957
|
+
props: (0, vue.unref)(rootMergedProps),
|
|
3958
|
+
state: state.value
|
|
3959
|
+
}), (0, vue.createElementVNode)("input", (0, vue.mergeProps)({
|
|
3960
|
+
ref_key: "validationInputRef",
|
|
3961
|
+
ref: validationInputRef
|
|
3962
|
+
}, hiddenInputProps.value, {
|
|
3963
|
+
suppresshydrationwarning: "",
|
|
3964
|
+
onInput: handleHiddenInput,
|
|
3965
|
+
onFocus: handleHiddenFocus
|
|
3966
|
+
}), null, 16)], 64);
|
|
3967
|
+
};
|
|
3968
|
+
}
|
|
3969
|
+
});
|
|
3970
|
+
|
|
3971
|
+
//#endregion
|
|
3972
|
+
//#region src/number-field/root/NumberFieldRoot.vue
|
|
3973
|
+
var NumberFieldRoot_default = NumberFieldRoot_vue_vue_type_script_setup_true_lang_default;
|
|
3974
|
+
|
|
3975
|
+
//#endregion
|
|
3976
|
+
//#region src/number-field/scrub-area/NumberFieldScrubAreaContext.ts
|
|
3977
|
+
const numberFieldScrubAreaContextKey = Symbol("NumberFieldScrubAreaContext");
|
|
3978
|
+
function useNumberFieldScrubAreaContext() {
|
|
3979
|
+
const context = (0, vue.inject)(numberFieldScrubAreaContextKey, void 0);
|
|
3980
|
+
if (context === void 0) throw new Error("Base UI Vue: NumberFieldScrubAreaContext is missing. NumberFieldScrubArea parts must be placed within <NumberFieldScrubArea>.");
|
|
3981
|
+
return context;
|
|
3982
|
+
}
|
|
3983
|
+
|
|
3984
|
+
//#endregion
|
|
3985
|
+
//#region src/number-field/scrub-area-cursor/NumberFieldScrubAreaCursor.vue?vue&type=script&setup=true&lang.ts
|
|
3986
|
+
var NumberFieldScrubAreaCursor_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
3987
|
+
name: "NumberFieldScrubAreaCursor",
|
|
3988
|
+
inheritAttrs: false,
|
|
3989
|
+
__name: "NumberFieldScrubAreaCursor",
|
|
3990
|
+
props: {
|
|
3991
|
+
as: {
|
|
3992
|
+
type: null,
|
|
3993
|
+
required: false
|
|
3994
|
+
},
|
|
3995
|
+
class: {
|
|
3996
|
+
type: Function,
|
|
3997
|
+
required: false,
|
|
3998
|
+
skipCheck: true
|
|
3999
|
+
},
|
|
4000
|
+
style: {
|
|
4001
|
+
type: [
|
|
4002
|
+
Boolean,
|
|
4003
|
+
null,
|
|
4004
|
+
String,
|
|
4005
|
+
Object,
|
|
4006
|
+
Array,
|
|
4007
|
+
Function
|
|
4008
|
+
],
|
|
4009
|
+
required: false,
|
|
4010
|
+
skipCheck: true
|
|
4011
|
+
}
|
|
4012
|
+
},
|
|
4013
|
+
setup(__props) {
|
|
4014
|
+
const props = __props;
|
|
4015
|
+
const attrsObject = (0, vue.useAttrs)();
|
|
4016
|
+
const { state } = require_decrement_NumberFieldDecrement.useNumberFieldRootContext();
|
|
4017
|
+
const { isScrubbing, isTouchInput, isPointerLockDenied, scrubAreaCursorRef } = useNumberFieldScrubAreaContext();
|
|
4018
|
+
const shouldRender = (0, vue.computed)(() => isScrubbing.value && !isWebKit && !isTouchInput.value && !isPointerLockDenied.value);
|
|
4019
|
+
function setCursorRef(el) {
|
|
4020
|
+
scrubAreaCursorRef.value = el;
|
|
4021
|
+
}
|
|
4022
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
4023
|
+
componentProps: props,
|
|
4024
|
+
state,
|
|
4025
|
+
props: (0, vue.computed)(() => require_button_Button.mergeProps({
|
|
4026
|
+
role: "presentation",
|
|
4027
|
+
style: {
|
|
4028
|
+
position: "fixed",
|
|
4029
|
+
top: 0,
|
|
4030
|
+
left: 0,
|
|
4031
|
+
pointerEvents: "none"
|
|
4032
|
+
}
|
|
4033
|
+
}, attrsObject)),
|
|
4034
|
+
stateAttributesMapping: require_decrement_NumberFieldDecrement.stateAttributesMapping,
|
|
4035
|
+
defaultTagName: "span",
|
|
4036
|
+
ref: setCursorRef
|
|
4037
|
+
});
|
|
4038
|
+
return (_ctx, _cache) => {
|
|
4039
|
+
return shouldRender.value ? ((0, vue.openBlock)(), (0, vue.createBlock)(vue.Teleport, {
|
|
4040
|
+
key: 0,
|
|
4041
|
+
to: "body"
|
|
4042
|
+
}, [(0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
4043
|
+
key: 0,
|
|
4044
|
+
ref: (0, vue.unref)(renderRef),
|
|
4045
|
+
props: (0, vue.unref)(mergedProps),
|
|
4046
|
+
state: (0, vue.unref)(state)
|
|
4047
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
4048
|
+
key: 1,
|
|
4049
|
+
ref: (0, vue.unref)(renderRef)
|
|
4050
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
4051
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: (0, vue.unref)(state) })]),
|
|
4052
|
+
_: 3
|
|
4053
|
+
}, 16))])) : (0, vue.createCommentVNode)("v-if", true);
|
|
4054
|
+
};
|
|
4055
|
+
}
|
|
4056
|
+
});
|
|
4057
|
+
|
|
4058
|
+
//#endregion
|
|
4059
|
+
//#region src/number-field/scrub-area-cursor/NumberFieldScrubAreaCursor.vue
|
|
4060
|
+
var NumberFieldScrubAreaCursor_default = NumberFieldScrubAreaCursor_vue_vue_type_script_setup_true_lang_default;
|
|
4061
|
+
|
|
4062
|
+
//#endregion
|
|
4063
|
+
//#region src/number-field/utils/getViewportRect.ts
|
|
4064
|
+
function getViewportRect(teleportDistance, scrubAreaEl) {
|
|
4065
|
+
const win = (0, _floating_ui_utils_dom.getWindow)(scrubAreaEl);
|
|
4066
|
+
const rect = scrubAreaEl.getBoundingClientRect();
|
|
4067
|
+
if (rect && teleportDistance != null) return {
|
|
4068
|
+
x: rect.left - teleportDistance / 2,
|
|
4069
|
+
y: rect.top - teleportDistance / 2,
|
|
4070
|
+
width: rect.right + teleportDistance / 2,
|
|
4071
|
+
height: rect.bottom + teleportDistance / 2
|
|
4072
|
+
};
|
|
4073
|
+
const vV = win.visualViewport;
|
|
4074
|
+
if (vV) return {
|
|
4075
|
+
x: vV.offsetLeft,
|
|
4076
|
+
y: vV.offsetTop,
|
|
4077
|
+
width: vV.offsetLeft + vV.width,
|
|
4078
|
+
height: vV.offsetTop + vV.height
|
|
4079
|
+
};
|
|
4080
|
+
return {
|
|
4081
|
+
x: 0,
|
|
4082
|
+
y: 0,
|
|
4083
|
+
width: win.document.documentElement.clientWidth,
|
|
4084
|
+
height: win.document.documentElement.clientHeight
|
|
4085
|
+
};
|
|
4086
|
+
}
|
|
4087
|
+
|
|
4088
|
+
//#endregion
|
|
4089
|
+
//#region src/number-field/utils/subscribeToVisualViewportResize.ts
|
|
4090
|
+
function subscribeToVisualViewportResize(element, visualScaleRef) {
|
|
4091
|
+
const vV = (0, _floating_ui_utils_dom.getWindow)(element).visualViewport;
|
|
4092
|
+
if (!vV) return () => {};
|
|
4093
|
+
function handleVisualResize() {
|
|
4094
|
+
if (vV) visualScaleRef.value = vV.scale;
|
|
4095
|
+
}
|
|
4096
|
+
handleVisualResize();
|
|
4097
|
+
vV.addEventListener("resize", handleVisualResize);
|
|
4098
|
+
return () => {
|
|
4099
|
+
vV.removeEventListener("resize", handleVisualResize);
|
|
4100
|
+
};
|
|
4101
|
+
}
|
|
4102
|
+
|
|
4103
|
+
//#endregion
|
|
4104
|
+
//#region src/number-field/scrub-area/NumberFieldScrubArea.vue?vue&type=script&setup=true&lang.ts
|
|
4105
|
+
var NumberFieldScrubArea_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
4106
|
+
name: "NumberFieldScrubArea",
|
|
4107
|
+
inheritAttrs: false,
|
|
4108
|
+
__name: "NumberFieldScrubArea",
|
|
4109
|
+
props: {
|
|
4110
|
+
direction: {
|
|
4111
|
+
type: String,
|
|
4112
|
+
required: false,
|
|
4113
|
+
default: "horizontal"
|
|
4114
|
+
},
|
|
4115
|
+
pixelSensitivity: {
|
|
4116
|
+
type: Number,
|
|
4117
|
+
required: false,
|
|
4118
|
+
default: 2
|
|
4119
|
+
},
|
|
4120
|
+
teleportDistance: {
|
|
4121
|
+
type: Number,
|
|
4122
|
+
required: false
|
|
4123
|
+
},
|
|
4124
|
+
as: {
|
|
4125
|
+
type: null,
|
|
4126
|
+
required: false,
|
|
4127
|
+
default: "span"
|
|
4128
|
+
},
|
|
4129
|
+
class: {
|
|
4130
|
+
type: Function,
|
|
4131
|
+
required: false,
|
|
4132
|
+
skipCheck: true
|
|
4133
|
+
},
|
|
4134
|
+
style: {
|
|
4135
|
+
type: [
|
|
4136
|
+
Boolean,
|
|
4137
|
+
null,
|
|
4138
|
+
String,
|
|
4139
|
+
Object,
|
|
4140
|
+
Array,
|
|
4141
|
+
Function
|
|
4142
|
+
],
|
|
4143
|
+
required: false,
|
|
4144
|
+
skipCheck: true
|
|
4145
|
+
}
|
|
4146
|
+
},
|
|
4147
|
+
setup(__props) {
|
|
4148
|
+
const props = __props;
|
|
4149
|
+
const attrsObject = (0, vue.useAttrs)();
|
|
4150
|
+
const { state, setIsScrubbing: setRootScrubbing, disabled, readOnly, inputRef, incrementValue, allowInputSyncRef, getStepAmount, onValueCommitted, lastChangedValueRef, valueRef } = require_decrement_NumberFieldDecrement.useNumberFieldRootContext();
|
|
4151
|
+
const direction = (0, vue.computed)(() => props.direction);
|
|
4152
|
+
const pixelSensitivity = (0, vue.computed)(() => props.pixelSensitivity);
|
|
4153
|
+
const teleportDistance = (0, vue.computed)(() => props.teleportDistance);
|
|
4154
|
+
const scrubAreaRef = (0, vue.ref)(null);
|
|
4155
|
+
const scrubAreaCursorRef = (0, vue.ref)(null);
|
|
4156
|
+
let isScrubbingInternal = false;
|
|
4157
|
+
let didMove = false;
|
|
4158
|
+
let pointerDownTarget = null;
|
|
4159
|
+
let virtualCursorCoords = {
|
|
4160
|
+
x: 0,
|
|
4161
|
+
y: 0
|
|
4162
|
+
};
|
|
4163
|
+
const visualScaleRef = (0, vue.ref)(1);
|
|
4164
|
+
const exitPointerLockTimeout = require_decrement_NumberFieldDecrement.useTimeout();
|
|
4165
|
+
const isTouchInput = (0, vue.ref)(false);
|
|
4166
|
+
const isPointerLockDenied = (0, vue.ref)(false);
|
|
4167
|
+
const isScrubbing = (0, vue.ref)(false);
|
|
4168
|
+
(0, vue.watch)(isScrubbing, (scrubbing, _prev, onCleanup) => {
|
|
4169
|
+
if (!scrubbing || !scrubAreaCursorRef.value) return;
|
|
4170
|
+
onCleanup(subscribeToVisualViewportResize(scrubAreaCursorRef.value, visualScaleRef));
|
|
4171
|
+
}, { flush: "post" });
|
|
4172
|
+
function updateCursorTransform(x, y) {
|
|
4173
|
+
if (scrubAreaCursorRef.value) scrubAreaCursorRef.value.style.transform = `translate3d(${x}px,${y}px,0) scale(${1 / visualScaleRef.value})`;
|
|
4174
|
+
}
|
|
4175
|
+
function onScrub({ movementX, movementY }) {
|
|
4176
|
+
const virtualCursor = scrubAreaCursorRef.value;
|
|
4177
|
+
const scrubAreaEl = scrubAreaRef.value;
|
|
4178
|
+
if (!virtualCursor || !scrubAreaEl) return;
|
|
4179
|
+
const rect = getViewportRect(teleportDistance.value, scrubAreaEl);
|
|
4180
|
+
const coords = virtualCursorCoords;
|
|
4181
|
+
const newCoords = {
|
|
4182
|
+
x: Math.round(coords.x + movementX),
|
|
4183
|
+
y: Math.round(coords.y + movementY)
|
|
4184
|
+
};
|
|
4185
|
+
const cursorWidth = virtualCursor.offsetWidth;
|
|
4186
|
+
const cursorHeight = virtualCursor.offsetHeight;
|
|
4187
|
+
if (newCoords.x + cursorWidth / 2 < rect.x) newCoords.x = rect.width - cursorWidth / 2;
|
|
4188
|
+
else if (newCoords.x + cursorWidth / 2 > rect.width) newCoords.x = rect.x - cursorWidth / 2;
|
|
4189
|
+
if (newCoords.y + cursorHeight / 2 < rect.y) newCoords.y = rect.height - cursorHeight / 2;
|
|
4190
|
+
else if (newCoords.y + cursorHeight / 2 > rect.height) newCoords.y = rect.y - cursorHeight / 2;
|
|
4191
|
+
virtualCursorCoords = newCoords;
|
|
4192
|
+
updateCursorTransform(newCoords.x, newCoords.y);
|
|
4193
|
+
}
|
|
4194
|
+
function onScrubbingChange(scrubbingValue, { clientX, clientY }) {
|
|
4195
|
+
isScrubbing.value = scrubbingValue;
|
|
4196
|
+
setRootScrubbing(scrubbingValue);
|
|
4197
|
+
const virtualCursor = scrubAreaCursorRef.value;
|
|
4198
|
+
if (!virtualCursor || !scrubbingValue) return;
|
|
4199
|
+
const initialCoords = {
|
|
4200
|
+
x: clientX - virtualCursor.offsetWidth / 2,
|
|
4201
|
+
y: clientY - virtualCursor.offsetHeight / 2
|
|
4202
|
+
};
|
|
4203
|
+
virtualCursorCoords = initialCoords;
|
|
4204
|
+
updateCursorTransform(initialCoords.x, initialCoords.y);
|
|
4205
|
+
}
|
|
4206
|
+
(0, vue.watch)([
|
|
4207
|
+
isScrubbing,
|
|
4208
|
+
disabled,
|
|
4209
|
+
readOnly
|
|
4210
|
+
], (_value, _prev, onCleanup) => {
|
|
4211
|
+
if (!inputRef.value || disabled.value || readOnly.value || !isScrubbing.value) return;
|
|
4212
|
+
let cumulativeDelta = 0;
|
|
4213
|
+
function handleScrubPointerUp(event) {
|
|
4214
|
+
function handler() {
|
|
4215
|
+
try {
|
|
4216
|
+
require_control_SliderControl.ownerDocument(scrubAreaRef.value)?.exitPointerLock();
|
|
4217
|
+
} catch {} finally {
|
|
4218
|
+
isScrubbingInternal = false;
|
|
4219
|
+
onScrubbingChange(false, event);
|
|
4220
|
+
onValueCommitted(lastChangedValueRef.value ?? valueRef.value, require_checkbox_index.createGenericEventDetails(require_checkbox_index.REASONS.scrub, event));
|
|
4221
|
+
const target = pointerDownTarget;
|
|
4222
|
+
const input = inputRef.value;
|
|
4223
|
+
if (!didMove && target != null && input) target.dispatchEvent(new ((0, _floating_ui_utils_dom.getWindow)(input)).MouseEvent("click", {
|
|
4224
|
+
bubbles: true,
|
|
4225
|
+
cancelable: true
|
|
4226
|
+
}));
|
|
4227
|
+
didMove = false;
|
|
4228
|
+
pointerDownTarget = null;
|
|
4229
|
+
}
|
|
4230
|
+
}
|
|
4231
|
+
if (isFirefox) exitPointerLockTimeout.start(20, handler);
|
|
4232
|
+
else handler();
|
|
4233
|
+
}
|
|
4234
|
+
function handleScrubPointerMove(event) {
|
|
4235
|
+
if (!isScrubbingInternal) return;
|
|
4236
|
+
event.preventDefault();
|
|
4237
|
+
onScrub(event);
|
|
4238
|
+
const { movementX, movementY } = event;
|
|
4239
|
+
cumulativeDelta += direction.value === "vertical" ? movementY : movementX;
|
|
4240
|
+
if (Math.abs(cumulativeDelta) >= pixelSensitivity.value) {
|
|
4241
|
+
cumulativeDelta = 0;
|
|
4242
|
+
didMove = true;
|
|
4243
|
+
const rawAmount = (direction.value === "vertical" ? -movementY : movementX) * (getStepAmount(event) ?? require_decrement_NumberFieldDecrement.DEFAULT_STEP);
|
|
4244
|
+
if (rawAmount !== 0) {
|
|
4245
|
+
allowInputSyncRef.value = true;
|
|
4246
|
+
incrementValue(Math.abs(rawAmount), {
|
|
4247
|
+
direction: rawAmount >= 0 ? 1 : -1,
|
|
4248
|
+
event,
|
|
4249
|
+
reason: require_checkbox_index.REASONS.scrub
|
|
4250
|
+
});
|
|
4251
|
+
}
|
|
4252
|
+
}
|
|
4253
|
+
}
|
|
4254
|
+
const win = (0, _floating_ui_utils_dom.getWindow)(inputRef.value);
|
|
4255
|
+
win.addEventListener("pointerup", handleScrubPointerUp, true);
|
|
4256
|
+
win.addEventListener("pointermove", handleScrubPointerMove, true);
|
|
4257
|
+
onCleanup(() => {
|
|
4258
|
+
exitPointerLockTimeout.clear();
|
|
4259
|
+
win.removeEventListener("pointerup", handleScrubPointerUp, true);
|
|
4260
|
+
win.removeEventListener("pointermove", handleScrubPointerMove, true);
|
|
4261
|
+
});
|
|
4262
|
+
}, { flush: "post" });
|
|
4263
|
+
(0, vue.onMounted)(() => {
|
|
4264
|
+
const element = scrubAreaRef.value;
|
|
4265
|
+
if (!element || disabled.value || readOnly.value) return;
|
|
4266
|
+
function handleTouchStart(event) {
|
|
4267
|
+
if (event.touches.length === 1) event.preventDefault();
|
|
4268
|
+
}
|
|
4269
|
+
element.addEventListener("touchstart", handleTouchStart, { passive: false });
|
|
4270
|
+
});
|
|
4271
|
+
async function onPointerdown(event) {
|
|
4272
|
+
const isMainButton = !event.button || event.button === 0;
|
|
4273
|
+
if (event.defaultPrevented || readOnly.value || !isMainButton || disabled.value) return;
|
|
4274
|
+
const isTouch = event.pointerType === "touch";
|
|
4275
|
+
isTouchInput.value = isTouch;
|
|
4276
|
+
if (event.pointerType === "mouse") {
|
|
4277
|
+
event.preventDefault();
|
|
4278
|
+
inputRef.value?.focus();
|
|
4279
|
+
}
|
|
4280
|
+
isScrubbingInternal = true;
|
|
4281
|
+
didMove = false;
|
|
4282
|
+
pointerDownTarget = require_control_SliderControl.getTarget(event);
|
|
4283
|
+
onScrubbingChange(true, event);
|
|
4284
|
+
if (!isTouch && !isWebKit) try {
|
|
4285
|
+
await require_control_SliderControl.ownerDocument(scrubAreaRef.value)?.body.requestPointerLock();
|
|
4286
|
+
isPointerLockDenied.value = false;
|
|
4287
|
+
} catch {
|
|
4288
|
+
isPointerLockDenied.value = true;
|
|
4289
|
+
} finally {
|
|
4290
|
+
if (isScrubbingInternal) onScrubbingChange(true, event);
|
|
4291
|
+
}
|
|
4292
|
+
}
|
|
4293
|
+
const defaultProps = (0, vue.computed)(() => ({
|
|
4294
|
+
role: "presentation",
|
|
4295
|
+
style: {
|
|
4296
|
+
touchAction: "none",
|
|
4297
|
+
WebkitUserSelect: "none",
|
|
4298
|
+
userSelect: "none"
|
|
4299
|
+
},
|
|
4300
|
+
onPointerdown
|
|
4301
|
+
}));
|
|
4302
|
+
const scrubAreaProps = (0, vue.computed)(() => require_button_Button.mergeProps(defaultProps.value, attrsObject));
|
|
4303
|
+
(0, vue.provide)(numberFieldScrubAreaContextKey, {
|
|
4304
|
+
isScrubbing,
|
|
4305
|
+
isTouchInput,
|
|
4306
|
+
isPointerLockDenied,
|
|
4307
|
+
scrubAreaCursorRef,
|
|
4308
|
+
scrubAreaRef,
|
|
4309
|
+
direction,
|
|
4310
|
+
pixelSensitivity,
|
|
4311
|
+
teleportDistance
|
|
4312
|
+
});
|
|
4313
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
4314
|
+
componentProps: props,
|
|
4315
|
+
state,
|
|
4316
|
+
props: scrubAreaProps,
|
|
4317
|
+
stateAttributesMapping: require_decrement_NumberFieldDecrement.stateAttributesMapping,
|
|
4318
|
+
defaultTagName: "span",
|
|
4319
|
+
ref: scrubAreaRef
|
|
4320
|
+
});
|
|
4321
|
+
return (_ctx, _cache) => {
|
|
4322
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
4323
|
+
key: 0,
|
|
4324
|
+
ref: (0, vue.unref)(renderRef),
|
|
4325
|
+
props: (0, vue.unref)(mergedProps),
|
|
4326
|
+
state: (0, vue.unref)(state)
|
|
4327
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
4328
|
+
key: 1,
|
|
4329
|
+
ref: (0, vue.unref)(renderRef)
|
|
4330
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
4331
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: (0, vue.unref)(state) })]),
|
|
4332
|
+
_: 3
|
|
4333
|
+
}, 16));
|
|
4334
|
+
};
|
|
4335
|
+
}
|
|
4336
|
+
});
|
|
4337
|
+
|
|
4338
|
+
//#endregion
|
|
4339
|
+
//#region src/number-field/scrub-area/NumberFieldScrubArea.vue
|
|
4340
|
+
var NumberFieldScrubArea_default = NumberFieldScrubArea_vue_vue_type_script_setup_true_lang_default;
|
|
4341
|
+
|
|
4342
|
+
//#endregion
|
|
4343
|
+
//#region src/otp-field/root/OtpFieldRootContext.ts
|
|
4344
|
+
const otpFieldRootContextKey = Symbol("OtpFieldRootContext");
|
|
4345
|
+
function useOtpFieldRootContext() {
|
|
4346
|
+
const context = (0, vue.inject)(otpFieldRootContextKey, void 0);
|
|
4347
|
+
if (context === void 0) throw new Error("Base UI Vue: OtpFieldRootContext is missing. OtpField parts must be placed within <OtpFieldRoot>.");
|
|
4348
|
+
return context;
|
|
4349
|
+
}
|
|
4350
|
+
function getOtpFieldInputState(state, value, index) {
|
|
4351
|
+
return {
|
|
4352
|
+
...state,
|
|
4353
|
+
value,
|
|
4354
|
+
index,
|
|
4355
|
+
filled: value !== ""
|
|
4356
|
+
};
|
|
4357
|
+
}
|
|
4358
|
+
|
|
4359
|
+
//#endregion
|
|
4360
|
+
//#region src/otp-field/utils/otp.ts
|
|
4361
|
+
const OTP_VALIDATION_CONFIG = {
|
|
4362
|
+
numeric: {
|
|
4363
|
+
slotPattern: "\\d{1}",
|
|
4364
|
+
getRootPattern: (length) => `\\d{${length}}`,
|
|
4365
|
+
regexp: /\D/g,
|
|
4366
|
+
inputMode: "numeric"
|
|
4367
|
+
},
|
|
4368
|
+
alpha: {
|
|
4369
|
+
slotPattern: "[a-z]{1}",
|
|
4370
|
+
getRootPattern: (length) => `[a-z]{${length}}`,
|
|
4371
|
+
regexp: /[^a-z]/gi,
|
|
4372
|
+
inputMode: "text"
|
|
4373
|
+
},
|
|
4374
|
+
alphanumeric: {
|
|
4375
|
+
slotPattern: "[a-z0-9]{1}",
|
|
4376
|
+
getRootPattern: (length) => `[a-z0-9]{${length}}`,
|
|
4377
|
+
regexp: /[^a-z0-9]/gi,
|
|
4378
|
+
inputMode: "text"
|
|
4379
|
+
}
|
|
4380
|
+
};
|
|
4381
|
+
function getOTPValidationConfig(validationType) {
|
|
4382
|
+
if (validationType === "none") return null;
|
|
4383
|
+
return OTP_VALIDATION_CONFIG[validationType];
|
|
4384
|
+
}
|
|
4385
|
+
function stripOTPWhitespace(value) {
|
|
4386
|
+
return (value ?? "").replace(/\s/g, "");
|
|
4387
|
+
}
|
|
4388
|
+
function applyOTPValidation(value, validation) {
|
|
4389
|
+
return validation ? value.replace(validation.regexp, "") : value;
|
|
4390
|
+
}
|
|
4391
|
+
/**
|
|
4392
|
+
* Normalizes user-entered OTP text by stripping whitespace, applying validation and custom
|
|
4393
|
+
* normalization, and clamping the final value to the configured slot count.
|
|
4394
|
+
*/
|
|
4395
|
+
function normalizeOTPValueWithDetails(value, length, validationType, normalizeValue) {
|
|
4396
|
+
const strippedValue = stripOTPWhitespace(value);
|
|
4397
|
+
const validation = getOTPValidationConfig(validationType);
|
|
4398
|
+
let normalizedValue = applyOTPValidation(strippedValue, validation);
|
|
4399
|
+
let didRejectCharacters = strippedValue.length > normalizedValue.length;
|
|
4400
|
+
if (normalizeValue) {
|
|
4401
|
+
const customNormalizedValue = normalizeValue(normalizedValue);
|
|
4402
|
+
didRejectCharacters ||= normalizedValue.length > customNormalizedValue.length;
|
|
4403
|
+
normalizedValue = applyOTPValidation(customNormalizedValue, validation);
|
|
4404
|
+
didRejectCharacters ||= customNormalizedValue.length > normalizedValue.length;
|
|
4405
|
+
}
|
|
4406
|
+
const maxLength = length < 0 ? 0 : length;
|
|
4407
|
+
const normalizedCharacters = Array.from(normalizedValue);
|
|
4408
|
+
return [normalizedCharacters.slice(0, maxLength).join(""), didRejectCharacters || normalizedCharacters.length > maxLength];
|
|
4409
|
+
}
|
|
4410
|
+
function normalizeOTPValue(value, length, validationType, normalizeValue) {
|
|
4411
|
+
return normalizeOTPValueWithDetails(value, length, validationType, normalizeValue)[0];
|
|
4412
|
+
}
|
|
4413
|
+
function getOTPCharacters(value) {
|
|
4414
|
+
return Array.from(value ?? "");
|
|
4415
|
+
}
|
|
4416
|
+
function getOTPValueLength(value) {
|
|
4417
|
+
return getOTPCharacters(value).length;
|
|
4418
|
+
}
|
|
4419
|
+
function getOTPCharacter(value, index) {
|
|
4420
|
+
return getOTPCharacters(value)[index] ?? "";
|
|
4421
|
+
}
|
|
4422
|
+
/**
|
|
4423
|
+
* Replaces characters starting at the provided slot index, then re-normalizes the final OTP value
|
|
4424
|
+
* so paste and multi-character edits stay contiguous and length-bounded.
|
|
4425
|
+
*/
|
|
4426
|
+
function replaceOTPValue(currentValue, index, nextValue, length, validationType, normalizeValue) {
|
|
4427
|
+
const normalizedValue = normalizeOTPValue(nextValue, length, validationType, normalizeValue);
|
|
4428
|
+
const characters = getOTPCharacters(currentValue);
|
|
4429
|
+
const replacementLength = getOTPValueLength(normalizedValue);
|
|
4430
|
+
return normalizeOTPValue(`${characters.slice(0, index).join("")}${normalizedValue}${characters.slice(index + replacementLength).join("")}`, length, validationType, normalizeValue);
|
|
4431
|
+
}
|
|
4432
|
+
function removeOTPCharacter(currentValue, index) {
|
|
4433
|
+
const characters = getOTPCharacters(currentValue);
|
|
4434
|
+
if (index < 0 || index >= characters.length) return currentValue;
|
|
4435
|
+
characters.splice(index, 1);
|
|
4436
|
+
return characters.join("");
|
|
4437
|
+
}
|
|
4438
|
+
|
|
4439
|
+
//#endregion
|
|
4440
|
+
//#region src/otp-field/utils/stateAttributesMapping.ts
|
|
4441
|
+
const rootStateAttributesMapping = {
|
|
4442
|
+
value: () => null,
|
|
4443
|
+
length: () => null,
|
|
4444
|
+
...require_checkbox_group_CheckboxGroup.fieldValidityMapping
|
|
4445
|
+
};
|
|
4446
|
+
const inputStateAttributesMapping = {
|
|
4447
|
+
value: () => null,
|
|
4448
|
+
index: () => null,
|
|
4449
|
+
...require_checkbox_group_CheckboxGroup.fieldValidityMapping
|
|
4450
|
+
};
|
|
4451
|
+
|
|
4452
|
+
//#endregion
|
|
4453
|
+
//#region src/otp-field/input/OtpFieldInput.vue?vue&type=script&setup=true&lang.ts
|
|
4454
|
+
var OtpFieldInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
4455
|
+
name: "OtpFieldInput",
|
|
4456
|
+
inheritAttrs: false,
|
|
4457
|
+
__name: "OtpFieldInput",
|
|
4458
|
+
props: {
|
|
4459
|
+
as: {
|
|
4460
|
+
type: null,
|
|
4461
|
+
required: false
|
|
4462
|
+
},
|
|
4463
|
+
class: {
|
|
4464
|
+
type: Function,
|
|
4465
|
+
required: false,
|
|
4466
|
+
skipCheck: true
|
|
4467
|
+
},
|
|
4468
|
+
style: {
|
|
4469
|
+
type: [
|
|
4470
|
+
Boolean,
|
|
4471
|
+
null,
|
|
4472
|
+
String,
|
|
4473
|
+
Object,
|
|
4474
|
+
Array,
|
|
4475
|
+
Function
|
|
4476
|
+
],
|
|
4477
|
+
required: false,
|
|
4478
|
+
skipCheck: true
|
|
4479
|
+
}
|
|
4480
|
+
},
|
|
4481
|
+
setup(__props) {
|
|
4482
|
+
const props = __props;
|
|
4483
|
+
const attrs = (0, vue.useAttrs)();
|
|
4484
|
+
const attrsObject = attrs;
|
|
4485
|
+
const { activeIndex, autoComplete, disabled, form, focusInput, queueFocusInput, getInputId, handleInputBlur, handleInputFocus, inputMode, inputAriaLabelledBy, invalid, length, mask, pattern, reportValueInvalid, readOnly, required, normalizeValue, setValue, state, validationType, value } = useOtpFieldRootContext();
|
|
4486
|
+
const { ref: listItemRef, index } = require_button_ToolbarButton.useCompositeListItem({ indexGuessBehavior: () => require_button_ToolbarButton.IndexGuessBehavior.GuessFromOrder });
|
|
4487
|
+
const inputRef = (0, vue.ref)(null);
|
|
4488
|
+
const direction = require_control_SliderControl.useDirection();
|
|
4489
|
+
const slotValue = (0, vue.computed)(() => getOTPCharacter(value.value, index.value));
|
|
4490
|
+
const inputState = (0, vue.computed)(() => getOtpFieldInputState(state.value, slotValue.value, index.value));
|
|
4491
|
+
const externalAriaLabel = (0, vue.computed)(() => attrs["aria-label"]);
|
|
4492
|
+
const externalAriaLabelledBy = (0, vue.computed)(() => attrs["aria-labelledby"]);
|
|
4493
|
+
const inheritedLabel = (0, vue.computed)(() => externalAriaLabelledBy.value ?? inputAriaLabelledBy.value);
|
|
4494
|
+
const ariaLabel = (0, vue.computed)(() => index.value === 0 ? void 0 : externalAriaLabel.value);
|
|
4495
|
+
function setInputRef(el) {
|
|
4496
|
+
listItemRef(el);
|
|
4497
|
+
inputRef.value = el;
|
|
4498
|
+
}
|
|
4499
|
+
function onMousedown(event) {
|
|
4500
|
+
if (event.defaultPrevented || disabled.value) return;
|
|
4501
|
+
event.preventDefault();
|
|
4502
|
+
focusInput(index.value);
|
|
4503
|
+
}
|
|
4504
|
+
function onFocus(event) {
|
|
4505
|
+
if (event.defaultPrevented || disabled.value) return;
|
|
4506
|
+
handleInputFocus(index.value, event);
|
|
4507
|
+
}
|
|
4508
|
+
function onBlur(event) {
|
|
4509
|
+
if (event.defaultPrevented) return;
|
|
4510
|
+
handleInputBlur(event);
|
|
4511
|
+
}
|
|
4512
|
+
function onInput(event) {
|
|
4513
|
+
const target = event.target;
|
|
4514
|
+
if (event.defaultPrevented || disabled.value || readOnly.value) return;
|
|
4515
|
+
const rawValue = target.value;
|
|
4516
|
+
const [nextDigits, didRejectCharacters] = normalizeOTPValueWithDetails(rawValue, length.value, validationType.value, normalizeValue.value);
|
|
4517
|
+
if (didRejectCharacters) reportValueInvalid(rawValue, require_checkbox_index.createGenericEventDetails(require_checkbox_index.REASONS.inputChange, event));
|
|
4518
|
+
if (nextDigits === "") {
|
|
4519
|
+
if (rawValue === "") setValue(removeOTPCharacter(value.value, index.value), require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.inputClear, event));
|
|
4520
|
+
target.value = slotValue.value;
|
|
4521
|
+
if (slotValue.value !== "") target.select();
|
|
4522
|
+
return;
|
|
4523
|
+
}
|
|
4524
|
+
const committedValue = setValue(replaceOTPValue(value.value, index.value, nextDigits, length.value, validationType.value, normalizeValue.value), require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.inputChange, event));
|
|
4525
|
+
if (committedValue != null) queueFocusInput(Math.min(index.value + getOTPValueLength(nextDigits), length.value - 1), committedValue);
|
|
4526
|
+
}
|
|
4527
|
+
function onKeydown(event) {
|
|
4528
|
+
if (event.defaultPrevented || disabled.value) return;
|
|
4529
|
+
const firstIndex = 0;
|
|
4530
|
+
const lastIndex = Math.max(length.value - 1, firstIndex);
|
|
4531
|
+
const endTargetIndex = Math.min(getOTPValueLength(value.value), lastIndex);
|
|
4532
|
+
const hasBoundaryModifier = (event.ctrlKey || event.metaKey) && !event.altKey;
|
|
4533
|
+
const isRtl = direction.value === "rtl";
|
|
4534
|
+
const previousKey = isRtl ? "ArrowRight" : "ArrowLeft";
|
|
4535
|
+
const nextKey = isRtl ? "ArrowLeft" : "ArrowRight";
|
|
4536
|
+
if (event.key === previousKey) {
|
|
4537
|
+
stopEvent(event);
|
|
4538
|
+
focusInput(hasBoundaryModifier ? firstIndex : Math.max(firstIndex, index.value - 1));
|
|
4539
|
+
return;
|
|
4540
|
+
}
|
|
4541
|
+
if (event.key === nextKey) {
|
|
4542
|
+
stopEvent(event);
|
|
4543
|
+
focusInput(hasBoundaryModifier ? endTargetIndex : Math.min(lastIndex, index.value + 1));
|
|
4544
|
+
return;
|
|
4545
|
+
}
|
|
4546
|
+
if (event.key === "Home" || event.key === "ArrowUp") {
|
|
4547
|
+
stopEvent(event);
|
|
4548
|
+
focusInput(firstIndex);
|
|
4549
|
+
return;
|
|
4550
|
+
}
|
|
4551
|
+
if (event.key === "End" || event.key === "ArrowDown") {
|
|
4552
|
+
stopEvent(event);
|
|
4553
|
+
focusInput(endTargetIndex);
|
|
4554
|
+
return;
|
|
4555
|
+
}
|
|
4556
|
+
if (readOnly.value) return;
|
|
4557
|
+
function setKeyboardValue(nextValue, targetIndex) {
|
|
4558
|
+
const committedValue = setValue(nextValue, require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.keyboard, event));
|
|
4559
|
+
if (committedValue != null) queueFocusInput(targetIndex, committedValue);
|
|
4560
|
+
}
|
|
4561
|
+
if (event.key === "Backspace" && hasBoundaryModifier) {
|
|
4562
|
+
stopEvent(event);
|
|
4563
|
+
setKeyboardValue("", firstIndex);
|
|
4564
|
+
return;
|
|
4565
|
+
}
|
|
4566
|
+
if (event.key === "Delete") {
|
|
4567
|
+
stopEvent(event);
|
|
4568
|
+
setKeyboardValue(removeOTPCharacter(value.value, index.value), index.value);
|
|
4569
|
+
return;
|
|
4570
|
+
}
|
|
4571
|
+
const target = event.currentTarget;
|
|
4572
|
+
const inputValue = target.value;
|
|
4573
|
+
const fullSelection = target.selectionStart === 0 && target.selectionEnd === inputValue.length;
|
|
4574
|
+
if (getOTPValueLength(event.key) === 1 && fullSelection && slotValue.value === event.key) {
|
|
4575
|
+
stopEvent(event);
|
|
4576
|
+
if (index.value < length.value - 1) focusInput(index.value + 1);
|
|
4577
|
+
return;
|
|
4578
|
+
}
|
|
4579
|
+
if (event.key === "Backspace") {
|
|
4580
|
+
stopEvent(event);
|
|
4581
|
+
const targetIndex = Math.max(firstIndex, index.value - 1);
|
|
4582
|
+
const deleteIndex = slotValue.value === "" ? targetIndex : index.value;
|
|
4583
|
+
setKeyboardValue(removeOTPCharacter(value.value, deleteIndex), targetIndex);
|
|
4584
|
+
}
|
|
4585
|
+
}
|
|
4586
|
+
function onPaste(event) {
|
|
4587
|
+
if (event.defaultPrevented || disabled.value || readOnly.value) return;
|
|
4588
|
+
let rawValue = "";
|
|
4589
|
+
try {
|
|
4590
|
+
rawValue = event.clipboardData?.getData("text/plain") ?? "";
|
|
4591
|
+
} catch {
|
|
4592
|
+
return;
|
|
4593
|
+
}
|
|
4594
|
+
event.preventDefault();
|
|
4595
|
+
const [nextDigits, didRejectCharacters] = normalizeOTPValueWithDetails(rawValue, length.value, validationType.value, normalizeValue.value);
|
|
4596
|
+
if (didRejectCharacters) reportValueInvalid(rawValue, require_checkbox_index.createGenericEventDetails(require_checkbox_index.REASONS.inputPaste, event));
|
|
4597
|
+
if (nextDigits === "") return;
|
|
4598
|
+
const committedValue = setValue(replaceOTPValue(value.value, index.value, nextDigits, length.value, validationType.value, normalizeValue.value), require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.inputPaste, event));
|
|
4599
|
+
if (committedValue != null) queueFocusInput(Math.min(index.value + getOTPValueLength(nextDigits), length.value - 1), committedValue);
|
|
4600
|
+
}
|
|
4601
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
4602
|
+
componentProps: props,
|
|
4603
|
+
state: inputState,
|
|
4604
|
+
props: (0, vue.computed)(() => require_button_Button.mergeProps(attrsObject, {
|
|
4605
|
+
"id": getInputId(index.value),
|
|
4606
|
+
"value": slotValue.value,
|
|
4607
|
+
"type": attrsObject.type ?? (mask.value ? "password" : "text"),
|
|
4608
|
+
"inputmode": inputMode.value,
|
|
4609
|
+
"autocomplete": index.value === 0 ? autoComplete.value : "off",
|
|
4610
|
+
"autocorrect": "off",
|
|
4611
|
+
"spellcheck": "false",
|
|
4612
|
+
"enterkeyhint": index.value === length.value - 1 ? "done" : "next",
|
|
4613
|
+
"maxlength": index.value === 0 ? length.value : void 0,
|
|
4614
|
+
"tabindex": activeIndex.value === index.value ? 0 : -1,
|
|
4615
|
+
"disabled": disabled.value,
|
|
4616
|
+
"form": form.value,
|
|
4617
|
+
"pattern": pattern.value,
|
|
4618
|
+
"readonly": readOnly.value,
|
|
4619
|
+
"required": required.value,
|
|
4620
|
+
"aria-labelledby": ariaLabel.value == null ? inheritedLabel.value : void 0,
|
|
4621
|
+
"aria-invalid": !disabled.value && invalid.value ? true : void 0,
|
|
4622
|
+
"aria-label": ariaLabel.value,
|
|
4623
|
+
"onMousedown": onMousedown,
|
|
4624
|
+
"onFocus": onFocus,
|
|
4625
|
+
"onBlur": onBlur,
|
|
4626
|
+
"onInput": onInput,
|
|
4627
|
+
"onKeydown": onKeydown,
|
|
4628
|
+
"onPaste": onPaste
|
|
4629
|
+
})),
|
|
4630
|
+
stateAttributesMapping: inputStateAttributesMapping,
|
|
4631
|
+
defaultTagName: "input",
|
|
4632
|
+
ref: setInputRef
|
|
4633
|
+
});
|
|
4634
|
+
return (_ctx, _cache) => {
|
|
4635
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
4636
|
+
key: 0,
|
|
4637
|
+
ref: (0, vue.unref)(renderRef),
|
|
4638
|
+
props: (0, vue.unref)(mergedProps),
|
|
4639
|
+
state: inputState.value
|
|
4640
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
4641
|
+
key: 1,
|
|
4642
|
+
ref: (0, vue.unref)(renderRef)
|
|
4643
|
+
}, (0, vue.unref)(mergedProps)), null, 16));
|
|
4644
|
+
};
|
|
4645
|
+
}
|
|
4646
|
+
});
|
|
4647
|
+
|
|
4648
|
+
//#endregion
|
|
4649
|
+
//#region src/otp-field/input/OtpFieldInput.vue
|
|
4650
|
+
var OtpFieldInput_default = OtpFieldInput_vue_vue_type_script_setup_true_lang_default;
|
|
4651
|
+
|
|
4652
|
+
//#endregion
|
|
4653
|
+
//#region src/otp-field/root/OtpFieldRoot.vue?vue&type=script&setup=true&lang.ts
|
|
4654
|
+
var OtpFieldRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
4655
|
+
name: "OtpFieldRoot",
|
|
4656
|
+
inheritAttrs: false,
|
|
4657
|
+
__name: "OtpFieldRoot",
|
|
4658
|
+
props: {
|
|
4659
|
+
id: {
|
|
4660
|
+
type: String,
|
|
4661
|
+
required: false
|
|
4662
|
+
},
|
|
4663
|
+
autoComplete: {
|
|
4664
|
+
type: String,
|
|
4665
|
+
required: false,
|
|
4666
|
+
default: "one-time-code"
|
|
4667
|
+
},
|
|
4668
|
+
form: {
|
|
4669
|
+
type: String,
|
|
4670
|
+
required: false
|
|
4671
|
+
},
|
|
4672
|
+
length: {
|
|
4673
|
+
type: Number,
|
|
4674
|
+
required: true
|
|
4675
|
+
},
|
|
4676
|
+
autoSubmit: {
|
|
4677
|
+
type: Boolean,
|
|
4678
|
+
required: false,
|
|
4679
|
+
default: false
|
|
4680
|
+
},
|
|
4681
|
+
mask: {
|
|
4682
|
+
type: Boolean,
|
|
4683
|
+
required: false,
|
|
4684
|
+
default: false
|
|
4685
|
+
},
|
|
4686
|
+
inputMode: {
|
|
4687
|
+
type: String,
|
|
4688
|
+
required: false
|
|
4689
|
+
},
|
|
4690
|
+
validationType: {
|
|
4691
|
+
type: String,
|
|
4692
|
+
required: false,
|
|
4693
|
+
default: "numeric"
|
|
4694
|
+
},
|
|
4695
|
+
normalizeValue: {
|
|
4696
|
+
type: Function,
|
|
4697
|
+
required: false
|
|
4698
|
+
},
|
|
4699
|
+
required: {
|
|
4700
|
+
type: Boolean,
|
|
4701
|
+
required: false,
|
|
4702
|
+
default: false
|
|
4703
|
+
},
|
|
4704
|
+
disabled: {
|
|
4705
|
+
type: Boolean,
|
|
4706
|
+
required: false,
|
|
4707
|
+
default: false
|
|
4708
|
+
},
|
|
4709
|
+
readOnly: {
|
|
4710
|
+
type: Boolean,
|
|
4711
|
+
required: false,
|
|
4712
|
+
default: false
|
|
4713
|
+
},
|
|
4714
|
+
name: {
|
|
4715
|
+
type: String,
|
|
4716
|
+
required: false
|
|
4717
|
+
},
|
|
4718
|
+
value: {
|
|
4719
|
+
type: String,
|
|
4720
|
+
required: false
|
|
4721
|
+
},
|
|
4722
|
+
defaultValue: {
|
|
4723
|
+
type: String,
|
|
4724
|
+
required: false
|
|
4725
|
+
},
|
|
4726
|
+
as: {
|
|
4727
|
+
type: null,
|
|
4728
|
+
required: false,
|
|
4729
|
+
default: "div"
|
|
4730
|
+
},
|
|
4731
|
+
class: {
|
|
4732
|
+
type: Function,
|
|
4733
|
+
required: false,
|
|
4734
|
+
skipCheck: true
|
|
4735
|
+
},
|
|
4736
|
+
style: {
|
|
4737
|
+
type: [
|
|
4738
|
+
Boolean,
|
|
4739
|
+
null,
|
|
4740
|
+
String,
|
|
4741
|
+
Object,
|
|
4742
|
+
Array,
|
|
4743
|
+
Function
|
|
4744
|
+
],
|
|
4745
|
+
required: false,
|
|
4746
|
+
skipCheck: true
|
|
4747
|
+
}
|
|
4748
|
+
},
|
|
4749
|
+
emits: [
|
|
4750
|
+
"valueChange",
|
|
4751
|
+
"valueInvalid",
|
|
4752
|
+
"valueComplete"
|
|
4753
|
+
],
|
|
4754
|
+
setup(__props, { emit: __emit }) {
|
|
4755
|
+
const props = __props;
|
|
4756
|
+
const emit = __emit;
|
|
4757
|
+
const attrs = (0, vue.useAttrs)();
|
|
4758
|
+
const attrsObject = attrs;
|
|
4759
|
+
const { setDirty, validityData, disabled: fieldDisabled, setFilled, invalid, name: fieldName, state: fieldState, validation, validationMode, setFocused, setTouched } = require_checkbox_group_CheckboxGroup.useFieldRootContext();
|
|
4760
|
+
const { clearErrors } = require_checkbox_group_CheckboxGroup.useFormContext();
|
|
4761
|
+
const { getDescriptionProps, labelId } = require_checkbox_group_CheckboxGroup.useLabelableContext();
|
|
4762
|
+
const length = (0, vue.computed)(() => props.length);
|
|
4763
|
+
const validationType = (0, vue.computed)(() => props.validationType);
|
|
4764
|
+
const normalizeValueProp = (0, vue.computed)(() => props.normalizeValue);
|
|
4765
|
+
const disabled = (0, vue.computed)(() => fieldDisabled.value || props.disabled);
|
|
4766
|
+
const readOnly = (0, vue.computed)(() => props.readOnly);
|
|
4767
|
+
const required = (0, vue.computed)(() => props.required);
|
|
4768
|
+
const mask = (0, vue.computed)(() => props.mask);
|
|
4769
|
+
const autoComplete = (0, vue.computed)(() => props.autoComplete);
|
|
4770
|
+
const formProp = (0, vue.computed)(() => props.form);
|
|
4771
|
+
const name = (0, vue.computed)(() => fieldName.value ?? props.name);
|
|
4772
|
+
const { value: valueUnwrapped, setValue: setValueUnwrapped } = require_checkbox_group_CheckboxGroup.useControllableState({
|
|
4773
|
+
controlled: () => props.value,
|
|
4774
|
+
default: () => props.defaultValue ?? "",
|
|
4775
|
+
name: "OtpField",
|
|
4776
|
+
state: "value"
|
|
4777
|
+
});
|
|
4778
|
+
const value = (0, vue.computed)(() => normalizeOTPValue(valueUnwrapped.value, length.value, validationType.value, normalizeValueProp.value));
|
|
4779
|
+
const valueLength = (0, vue.computed)(() => getOTPValueLength(value.value));
|
|
4780
|
+
const filled = (0, vue.computed)(() => value.value !== "");
|
|
4781
|
+
const rootRef = (0, vue.ref)(null);
|
|
4782
|
+
const inputRefsHolder = { elementsRef: (0, vue.ref)([]) };
|
|
4783
|
+
const inputRefs = inputRefsHolder.elementsRef;
|
|
4784
|
+
const validationInputRef = (0, vue.ref)(null);
|
|
4785
|
+
const firstInputRef = { get value() {
|
|
4786
|
+
return inputRefs.value[0] ?? null;
|
|
4787
|
+
} };
|
|
4788
|
+
let pendingFocus = null;
|
|
4789
|
+
let pendingCompleteValue = null;
|
|
4790
|
+
const inputCount = (0, vue.ref)(0);
|
|
4791
|
+
const focusedIndex = (0, vue.ref)(Math.min(valueLength.value, length.value - 1));
|
|
4792
|
+
const focused = (0, vue.ref)(false);
|
|
4793
|
+
const id = require_control_FieldControl.useLabelableId({ id: (0, vue.computed)(() => props.id) });
|
|
4794
|
+
const ariaLabelledByAttr = (0, vue.computed)(() => attrs["aria-labelledby"]);
|
|
4795
|
+
const ariaLabelledBy = require_checkbox_index.useAriaLabelledBy({
|
|
4796
|
+
ariaLabelledBy: ariaLabelledByAttr,
|
|
4797
|
+
labelId,
|
|
4798
|
+
labelSourceRef: firstInputRef,
|
|
4799
|
+
enableFallback: true,
|
|
4800
|
+
labelSourceId: () => id.value ?? void 0
|
|
4801
|
+
});
|
|
4802
|
+
const inputAriaLabelledBy = (0, vue.computed)(() => ariaLabelledByAttr.value == null ? ariaLabelledBy.value : void 0);
|
|
4803
|
+
const ariaDescribedBy = (0, vue.computed)(() => mergeAriaIds(attrs["aria-describedby"], getDescriptionProps()["aria-describedby"]));
|
|
4804
|
+
const validationConfig = (0, vue.computed)(() => getOTPValidationConfig(validationType.value));
|
|
4805
|
+
const pattern = (0, vue.computed)(() => validationConfig.value?.slotPattern);
|
|
4806
|
+
const hiddenInputPattern = (0, vue.computed)(() => validationConfig.value?.getRootPattern(length.value));
|
|
4807
|
+
const inputMode = (0, vue.computed)(() => props.inputMode ?? validationConfig.value?.inputMode);
|
|
4808
|
+
const hasValidLength = (0, vue.computed)(() => Number.isInteger(length.value) && length.value > 0);
|
|
4809
|
+
const activeIndex = (0, vue.computed)(() => focused.value ? Math.min(focusedIndex.value, Math.max(length.value - 1, 0)) : Math.min(valueLength.value, length.value - 1));
|
|
4810
|
+
(0, vue.watchEffect)(() => {
|
|
4811
|
+
setFilled(filled.value);
|
|
4812
|
+
});
|
|
4813
|
+
(0, vue.watchEffect)(() => {
|
|
4814
|
+
validation.setInputRef(validationInputRef.value);
|
|
4815
|
+
});
|
|
4816
|
+
require_checkbox_group_CheckboxGroup.useField({
|
|
4817
|
+
enabled: (0, vue.computed)(() => !disabled.value),
|
|
4818
|
+
id,
|
|
4819
|
+
name,
|
|
4820
|
+
commit: (v) => validation.commit(v),
|
|
4821
|
+
value,
|
|
4822
|
+
getValue: () => value.value,
|
|
4823
|
+
controlRef: firstInputRef
|
|
4824
|
+
});
|
|
4825
|
+
function focusInput(index) {
|
|
4826
|
+
const targetIndex = Math.min(Math.max(index, 0), Math.max(inputRefs.value.length - 1, 0));
|
|
4827
|
+
const target = inputRefs.value[targetIndex];
|
|
4828
|
+
target?.focus();
|
|
4829
|
+
target?.select();
|
|
4830
|
+
}
|
|
4831
|
+
function queueFocusInput(index, nextValue) {
|
|
4832
|
+
pendingFocus = {
|
|
4833
|
+
index,
|
|
4834
|
+
value: nextValue
|
|
4835
|
+
};
|
|
4836
|
+
}
|
|
4837
|
+
function requestSubmit() {
|
|
4838
|
+
let formElement = validationInputRef.value?.form ?? inputRefs.value[0]?.form ?? null;
|
|
4839
|
+
if (formProp.value) {
|
|
4840
|
+
const associatedElement = require_control_SliderControl.ownerDocument(rootRef.value)?.getElementById(formProp.value);
|
|
4841
|
+
if (associatedElement?.tagName === "FORM") formElement = associatedElement;
|
|
4842
|
+
}
|
|
4843
|
+
if (formElement && typeof formElement.requestSubmit === "function") formElement.requestSubmit();
|
|
4844
|
+
}
|
|
4845
|
+
function completeValue(completedValue, eventDetails) {
|
|
4846
|
+
emit("valueComplete", completedValue, eventDetails);
|
|
4847
|
+
if (props.autoSubmit) requestSubmit();
|
|
4848
|
+
}
|
|
4849
|
+
function getCompleteEventDetails(details) {
|
|
4850
|
+
if (details.reason === require_checkbox_index.REASONS.inputChange || details.reason === require_checkbox_index.REASONS.inputPaste) return require_checkbox_index.createGenericEventDetails(details.reason, details.event);
|
|
4851
|
+
return null;
|
|
4852
|
+
}
|
|
4853
|
+
function setValue(nextValue, details) {
|
|
4854
|
+
const currentValue = value.value;
|
|
4855
|
+
const normalizedValue = normalizeOTPValue(nextValue, length.value, validationType.value, normalizeValueProp.value);
|
|
4856
|
+
const normalizedValueLength = getOTPValueLength(normalizedValue);
|
|
4857
|
+
const completeEventDetails = normalizedValueLength === length.value && (getOTPValueLength(currentValue) !== length.value || details.reason === require_checkbox_index.REASONS.inputPaste) ? getCompleteEventDetails(details) : null;
|
|
4858
|
+
if (normalizedValue === currentValue) {
|
|
4859
|
+
if (completeEventDetails != null) completeValue(normalizedValue, completeEventDetails);
|
|
4860
|
+
return null;
|
|
4861
|
+
}
|
|
4862
|
+
emit("valueChange", normalizedValue, details);
|
|
4863
|
+
if (details.isCanceled) return null;
|
|
4864
|
+
setValueUnwrapped(normalizedValue);
|
|
4865
|
+
if (completeEventDetails != null) pendingCompleteValue = {
|
|
4866
|
+
value: normalizedValue,
|
|
4867
|
+
eventDetails: completeEventDetails
|
|
4868
|
+
};
|
|
4869
|
+
else if (normalizedValueLength !== length.value) pendingCompleteValue = null;
|
|
4870
|
+
return normalizedValue;
|
|
4871
|
+
}
|
|
4872
|
+
function reportValueInvalid(invalidValue, details) {
|
|
4873
|
+
emit("valueInvalid", invalidValue, details);
|
|
4874
|
+
}
|
|
4875
|
+
function handleInputFocus(index, event) {
|
|
4876
|
+
if (index > valueLength.value) {
|
|
4877
|
+
focusInput(Math.min(valueLength.value, length.value - 1));
|
|
4878
|
+
return;
|
|
4879
|
+
}
|
|
4880
|
+
focusedIndex.value = index;
|
|
4881
|
+
focused.value = true;
|
|
4882
|
+
setFocused(true);
|
|
4883
|
+
event.currentTarget.select();
|
|
4884
|
+
}
|
|
4885
|
+
function handleInputBlur(event) {
|
|
4886
|
+
if (require_control_SliderControl.contains(rootRef.value, event.relatedTarget)) return;
|
|
4887
|
+
setTouched(true);
|
|
4888
|
+
focused.value = false;
|
|
4889
|
+
setFocused(false);
|
|
4890
|
+
if (validationMode.value === "onBlur") validation.commit(value.value);
|
|
4891
|
+
}
|
|
4892
|
+
function getInputId(index) {
|
|
4893
|
+
if (id.value == null) return;
|
|
4894
|
+
return index === 0 ? id.value : `${id.value}-${index + 1}`;
|
|
4895
|
+
}
|
|
4896
|
+
useValueChanged(value, () => {
|
|
4897
|
+
clearErrors(name.value);
|
|
4898
|
+
setDirty(value.value !== validityData.value.initialValue);
|
|
4899
|
+
validation.commit(value.value, true);
|
|
4900
|
+
if (pendingCompleteValue != null) {
|
|
4901
|
+
const pending = pendingCompleteValue;
|
|
4902
|
+
pendingCompleteValue = null;
|
|
4903
|
+
if (pending.value === value.value) completeValue(value.value, pending.eventDetails);
|
|
4904
|
+
}
|
|
4905
|
+
if (pendingFocus != null) {
|
|
4906
|
+
const pending = pendingFocus;
|
|
4907
|
+
pendingFocus = null;
|
|
4908
|
+
if (pending.value === value.value) focusInput(pending.index);
|
|
4909
|
+
}
|
|
4910
|
+
});
|
|
4911
|
+
const state = (0, vue.computed)(() => ({
|
|
4912
|
+
...fieldState.value,
|
|
4913
|
+
complete: valueLength.value === length.value,
|
|
4914
|
+
disabled: disabled.value,
|
|
4915
|
+
filled: filled.value,
|
|
4916
|
+
focused: focused.value,
|
|
4917
|
+
length: length.value,
|
|
4918
|
+
readOnly: readOnly.value,
|
|
4919
|
+
required: required.value,
|
|
4920
|
+
value: value.value
|
|
4921
|
+
}));
|
|
4922
|
+
(0, vue.provide)(otpFieldRootContextKey, {
|
|
4923
|
+
activeIndex,
|
|
4924
|
+
autoComplete,
|
|
4925
|
+
disabled,
|
|
4926
|
+
form: formProp,
|
|
4927
|
+
focusInput,
|
|
4928
|
+
queueFocusInput,
|
|
4929
|
+
getInputId,
|
|
4930
|
+
handleInputBlur,
|
|
4931
|
+
handleInputFocus,
|
|
4932
|
+
inputMode,
|
|
4933
|
+
inputAriaLabelledBy,
|
|
4934
|
+
invalid,
|
|
4935
|
+
length,
|
|
4936
|
+
mask,
|
|
4937
|
+
pattern,
|
|
4938
|
+
reportValueInvalid,
|
|
4939
|
+
readOnly,
|
|
4940
|
+
required,
|
|
4941
|
+
normalizeValue: normalizeValueProp,
|
|
4942
|
+
setValue,
|
|
4943
|
+
state,
|
|
4944
|
+
validationType,
|
|
4945
|
+
value
|
|
4946
|
+
});
|
|
4947
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
4948
|
+
componentProps: props,
|
|
4949
|
+
state,
|
|
4950
|
+
props: (0, vue.computed)(() => require_button_Button.mergeProps(attrsObject, {
|
|
4951
|
+
"role": "group",
|
|
4952
|
+
"aria-describedby": ariaDescribedBy.value,
|
|
4953
|
+
"aria-labelledby": ariaLabelledBy.value
|
|
4954
|
+
})),
|
|
4955
|
+
stateAttributesMapping: rootStateAttributesMapping,
|
|
4956
|
+
defaultTagName: "div",
|
|
4957
|
+
ref: rootRef
|
|
4958
|
+
});
|
|
4959
|
+
const hiddenInputProps = (0, vue.computed)(() => ({
|
|
4960
|
+
...validation.getValidationProps(),
|
|
4961
|
+
"type": "text",
|
|
4962
|
+
"id": id.value && name.value == null ? `${id.value}-hidden-input` : void 0,
|
|
4963
|
+
"form": formProp.value,
|
|
4964
|
+
"name": name.value,
|
|
4965
|
+
"value": value.value,
|
|
4966
|
+
"autocomplete": autoComplete.value,
|
|
4967
|
+
"inputmode": inputMode.value,
|
|
4968
|
+
"minlength": length.value,
|
|
4969
|
+
"maxlength": length.value,
|
|
4970
|
+
"pattern": hiddenInputPattern.value,
|
|
4971
|
+
"disabled": disabled.value,
|
|
4972
|
+
"readonly": readOnly.value,
|
|
4973
|
+
"required": required.value,
|
|
4974
|
+
"aria-hidden": true,
|
|
4975
|
+
"tabindex": -1,
|
|
4976
|
+
"style": name.value ? require_checkbox_index.visuallyHiddenInput : require_checkbox_index.visuallyHidden
|
|
4977
|
+
}));
|
|
4978
|
+
function handleHiddenFocus() {
|
|
4979
|
+
focusInput(0);
|
|
4980
|
+
}
|
|
4981
|
+
function handleHiddenInput(event) {
|
|
4982
|
+
const target = event.target;
|
|
4983
|
+
if (event.defaultPrevented || disabled.value || readOnly.value) return;
|
|
4984
|
+
const rawValue = target.value;
|
|
4985
|
+
const [normalizedValue, didRejectCharacters] = normalizeOTPValueWithDetails(rawValue, length.value, validationType.value, normalizeValueProp.value);
|
|
4986
|
+
if (didRejectCharacters) reportValueInvalid(rawValue, require_checkbox_index.createGenericEventDetails(require_checkbox_index.REASONS.inputChange, event));
|
|
4987
|
+
const committedValue = setValue(normalizedValue, require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.inputChange, event));
|
|
4988
|
+
if (committedValue != null && committedValue !== "") queueFocusInput(getOTPValueLength(committedValue) - 1, committedValue);
|
|
4989
|
+
}
|
|
4990
|
+
function mergeAriaIds(...values) {
|
|
4991
|
+
const ids = values.flatMap((v) => v?.split(/\s+/).filter(Boolean) ?? []);
|
|
4992
|
+
return ids.length > 0 ? Array.from(new Set(ids)).join(" ") : void 0;
|
|
4993
|
+
}
|
|
4994
|
+
if (process.env.NODE_ENV !== "production") (0, vue.watchEffect)(() => {
|
|
4995
|
+
const len = length.value;
|
|
4996
|
+
if (!Number.isInteger(len) || len <= 0) {
|
|
4997
|
+
warn(`<OtpFieldRoot> \`length\` must be a positive integer. Received \`length={${String(len)}}\`.`);
|
|
4998
|
+
return;
|
|
4999
|
+
}
|
|
5000
|
+
if (inputCount.value !== 0 && inputCount.value !== len) warn(`<OtpFieldRoot> \`length\` must match the number of rendered <OtpFieldInput /> parts. Received \`length={${len}}\` but rendered ${inputCount.value} input${inputCount.value === 1 ? "" : "s"}.`);
|
|
5001
|
+
});
|
|
5002
|
+
function handleMapChange(map) {
|
|
5003
|
+
inputCount.value = map.size;
|
|
5004
|
+
}
|
|
5005
|
+
return (_ctx, _cache) => {
|
|
5006
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(CompositeList_default, {
|
|
5007
|
+
"elements-ref": inputRefsHolder.elementsRef,
|
|
5008
|
+
"on-map-change": handleMapChange
|
|
5009
|
+
}, {
|
|
5010
|
+
default: (0, vue.withCtx)(() => [(0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
5011
|
+
key: 0,
|
|
5012
|
+
ref: (0, vue.unref)(renderRef),
|
|
5013
|
+
props: (0, vue.unref)(mergedProps),
|
|
5014
|
+
state: state.value
|
|
5015
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
5016
|
+
key: 1,
|
|
5017
|
+
ref: (0, vue.unref)(renderRef)
|
|
5018
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
5019
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: state.value })]),
|
|
5020
|
+
_: 3
|
|
5021
|
+
}, 16)), hasValidLength.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("input", (0, vue.mergeProps)({
|
|
5022
|
+
key: 2,
|
|
5023
|
+
ref_key: "validationInputRef",
|
|
5024
|
+
ref: validationInputRef
|
|
5025
|
+
}, hiddenInputProps.value, {
|
|
5026
|
+
onInput: handleHiddenInput,
|
|
5027
|
+
onFocus: handleHiddenFocus
|
|
5028
|
+
}), null, 16)) : (0, vue.createCommentVNode)("v-if", true)]),
|
|
5029
|
+
_: 3
|
|
5030
|
+
}, 8, ["elements-ref"]);
|
|
5031
|
+
};
|
|
5032
|
+
}
|
|
5033
|
+
});
|
|
5034
|
+
|
|
5035
|
+
//#endregion
|
|
5036
|
+
//#region src/otp-field/root/OtpFieldRoot.vue
|
|
5037
|
+
var OtpFieldRoot_default = OtpFieldRoot_vue_vue_type_script_setup_true_lang_default;
|
|
5038
|
+
|
|
5039
|
+
//#endregion
|
|
5040
|
+
//#region src/progress/root/ProgressRootContext.ts
|
|
5041
|
+
const progressRootContextKey = Symbol("ProgressRootContext");
|
|
5042
|
+
function useProgressRootContext(optional = false) {
|
|
5043
|
+
const context = (0, vue.inject)(progressRootContextKey, void 0);
|
|
5044
|
+
if (!context && !optional) throw new Error("Base UI Vue: ProgressRootContext is missing. Progress parts must be placed within <ProgressRoot>.");
|
|
5045
|
+
return context;
|
|
5046
|
+
}
|
|
5047
|
+
|
|
5048
|
+
//#endregion
|
|
5049
|
+
//#region src/progress/root/ProgressRootDataAttributes.ts
|
|
5050
|
+
let ProgressRootDataAttributes = /* @__PURE__ */ function(ProgressRootDataAttributes) {
|
|
5051
|
+
/**
|
|
5052
|
+
* Present when the progress has completed.
|
|
5053
|
+
*/
|
|
5054
|
+
ProgressRootDataAttributes["complete"] = "data-complete";
|
|
5055
|
+
/**
|
|
5056
|
+
* Present when the progress is in indeterminate state.
|
|
5057
|
+
*/
|
|
5058
|
+
ProgressRootDataAttributes["indeterminate"] = "data-indeterminate";
|
|
5059
|
+
/**
|
|
5060
|
+
* Present while the progress is progressing.
|
|
5061
|
+
*/
|
|
5062
|
+
ProgressRootDataAttributes["progressing"] = "data-progressing";
|
|
5063
|
+
return ProgressRootDataAttributes;
|
|
5064
|
+
}({});
|
|
5065
|
+
|
|
5066
|
+
//#endregion
|
|
5067
|
+
//#region src/progress/root/stateAttributesMapping.ts
|
|
5068
|
+
const progressStateAttributesMapping = { status(value) {
|
|
5069
|
+
if (value === "progressing") return { [ProgressRootDataAttributes.progressing]: "" };
|
|
5070
|
+
if (value === "complete") return { [ProgressRootDataAttributes.complete]: "" };
|
|
5071
|
+
if (value === "indeterminate") return { [ProgressRootDataAttributes.indeterminate]: "" };
|
|
5072
|
+
return null;
|
|
5073
|
+
} };
|
|
5074
|
+
|
|
5075
|
+
//#endregion
|
|
5076
|
+
//#region src/progress/indicator/ProgressIndicator.vue?vue&type=script&setup=true&lang.ts
|
|
5077
|
+
/**
|
|
5078
|
+
* Visualizes the completion status of the task.
|
|
5079
|
+
* Renders a `<div>` element.
|
|
5080
|
+
*
|
|
5081
|
+
* Documentation: [Base UI Vue Progress](https://baseui-vue.com/docs/components/progress)
|
|
5082
|
+
*/
|
|
5083
|
+
var ProgressIndicator_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
5084
|
+
name: "ProgressIndicator",
|
|
5085
|
+
inheritAttrs: false,
|
|
5086
|
+
__name: "ProgressIndicator",
|
|
5087
|
+
props: {
|
|
5088
|
+
as: {
|
|
5089
|
+
type: null,
|
|
5090
|
+
required: false,
|
|
5091
|
+
default: "div"
|
|
5092
|
+
},
|
|
5093
|
+
class: {
|
|
5094
|
+
type: Function,
|
|
5095
|
+
required: false,
|
|
5096
|
+
skipCheck: true
|
|
5097
|
+
},
|
|
5098
|
+
style: {
|
|
5099
|
+
type: [
|
|
5100
|
+
Boolean,
|
|
5101
|
+
null,
|
|
5102
|
+
String,
|
|
5103
|
+
Object,
|
|
5104
|
+
Array,
|
|
5105
|
+
Function
|
|
5106
|
+
],
|
|
5107
|
+
required: false,
|
|
5108
|
+
skipCheck: true
|
|
5109
|
+
}
|
|
5110
|
+
},
|
|
5111
|
+
setup(__props) {
|
|
5112
|
+
const props = __props;
|
|
5113
|
+
const attrs = (0, vue.useAttrs)();
|
|
5114
|
+
const { value, min, max, state } = useProgressRootContext();
|
|
5115
|
+
const percentage = (0, vue.computed)(() => {
|
|
5116
|
+
const v = value.value;
|
|
5117
|
+
if (v == null || !Number.isFinite(v)) return null;
|
|
5118
|
+
return valueToPercent(v, min.value, max.value);
|
|
5119
|
+
});
|
|
5120
|
+
const indicatorStyles = (0, vue.computed)(() => {
|
|
5121
|
+
if (percentage.value == null) return {};
|
|
5122
|
+
return {
|
|
5123
|
+
insetInlineStart: 0,
|
|
5124
|
+
height: "inherit",
|
|
5125
|
+
width: `${percentage.value}%`
|
|
5126
|
+
};
|
|
5127
|
+
});
|
|
5128
|
+
const { tag, mergedProps, renderless } = require_button_Button.useRenderElement({
|
|
5129
|
+
componentProps: props,
|
|
5130
|
+
state,
|
|
5131
|
+
props: (0, vue.computed)(() => require_button_Button.mergeProps({ style: indicatorStyles.value }, attrs)),
|
|
5132
|
+
defaultTagName: "div",
|
|
5133
|
+
stateAttributesMapping: progressStateAttributesMapping
|
|
5134
|
+
});
|
|
5135
|
+
return (_ctx, _cache) => {
|
|
5136
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
5137
|
+
key: 0,
|
|
5138
|
+
props: (0, vue.unref)(mergedProps),
|
|
5139
|
+
state: (0, vue.unref)(state)
|
|
5140
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 1 }, (0, vue.unref)(mergedProps))), {
|
|
5141
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: (0, vue.unref)(state) })]),
|
|
5142
|
+
_: 3
|
|
5143
|
+
}, 16));
|
|
5144
|
+
};
|
|
5145
|
+
}
|
|
5146
|
+
});
|
|
5147
|
+
|
|
5148
|
+
//#endregion
|
|
5149
|
+
//#region src/progress/indicator/ProgressIndicator.vue
|
|
5150
|
+
var ProgressIndicator_default = ProgressIndicator_vue_vue_type_script_setup_true_lang_default;
|
|
5151
|
+
|
|
5152
|
+
//#endregion
|
|
5153
|
+
//#region src/progress/label/ProgressLabel.vue?vue&type=script&setup=true&lang.ts
|
|
5154
|
+
/**
|
|
5155
|
+
* An accessible label for the progress bar.
|
|
5156
|
+
* Renders a `<span>` element.
|
|
5157
|
+
*
|
|
5158
|
+
* Documentation: [Base UI Vue Progress](https://baseui-vue.com/docs/components/progress)
|
|
5159
|
+
*/
|
|
5160
|
+
var ProgressLabel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
5161
|
+
name: "ProgressLabel",
|
|
5162
|
+
inheritAttrs: false,
|
|
5163
|
+
__name: "ProgressLabel",
|
|
5164
|
+
props: {
|
|
5165
|
+
id: {
|
|
5166
|
+
type: String,
|
|
5167
|
+
required: false
|
|
5168
|
+
},
|
|
5169
|
+
as: {
|
|
5170
|
+
type: null,
|
|
5171
|
+
required: false,
|
|
5172
|
+
default: "span"
|
|
5173
|
+
},
|
|
5174
|
+
class: {
|
|
5175
|
+
type: Function,
|
|
5176
|
+
required: false,
|
|
5177
|
+
skipCheck: true
|
|
5178
|
+
},
|
|
5179
|
+
style: {
|
|
5180
|
+
type: [
|
|
5181
|
+
Boolean,
|
|
5182
|
+
null,
|
|
5183
|
+
String,
|
|
5184
|
+
Object,
|
|
5185
|
+
Array,
|
|
5186
|
+
Function
|
|
5187
|
+
],
|
|
5188
|
+
required: false,
|
|
5189
|
+
skipCheck: true
|
|
5190
|
+
}
|
|
5191
|
+
},
|
|
5192
|
+
setup(__props) {
|
|
5193
|
+
const props = __props;
|
|
5194
|
+
const attrs = (0, vue.useAttrs)();
|
|
5195
|
+
const { setLabelId, state } = useProgressRootContext();
|
|
5196
|
+
const id = useRegisteredLabelId(() => props.id, setLabelId);
|
|
5197
|
+
const { tag, mergedProps, renderless } = require_button_Button.useRenderElement({
|
|
5198
|
+
componentProps: props,
|
|
5199
|
+
state,
|
|
5200
|
+
props: (0, vue.computed)(() => ({
|
|
5201
|
+
...attrs,
|
|
5202
|
+
id: id.value,
|
|
5203
|
+
role: "presentation"
|
|
5204
|
+
})),
|
|
5205
|
+
defaultTagName: "span",
|
|
5206
|
+
stateAttributesMapping: progressStateAttributesMapping
|
|
5207
|
+
});
|
|
5208
|
+
return (_ctx, _cache) => {
|
|
5209
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
5210
|
+
key: 0,
|
|
5211
|
+
props: (0, vue.unref)(mergedProps),
|
|
5212
|
+
state: (0, vue.unref)(state)
|
|
5213
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 1 }, (0, vue.unref)(mergedProps))), {
|
|
5214
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: (0, vue.unref)(state) })]),
|
|
5215
|
+
_: 3
|
|
5216
|
+
}, 16));
|
|
5217
|
+
};
|
|
5218
|
+
}
|
|
5219
|
+
});
|
|
5220
|
+
|
|
5221
|
+
//#endregion
|
|
5222
|
+
//#region src/progress/label/ProgressLabel.vue
|
|
5223
|
+
var ProgressLabel_default = ProgressLabel_vue_vue_type_script_setup_true_lang_default;
|
|
5224
|
+
|
|
5225
|
+
//#endregion
|
|
5226
|
+
//#region src/progress/root/ProgressRoot.vue?vue&type=script&setup=true&lang.ts
|
|
5227
|
+
/**
|
|
5228
|
+
* Groups all parts of the progress bar and provides the task completion
|
|
5229
|
+
* status to screen readers.
|
|
5230
|
+
* Renders a `<div>` element.
|
|
5231
|
+
*
|
|
5232
|
+
* Documentation: [Base UI Vue Progress](https://baseui-vue.com/docs/components/progress)
|
|
5233
|
+
*/
|
|
5234
|
+
var ProgressRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
5235
|
+
name: "ProgressRoot",
|
|
5236
|
+
inheritAttrs: false,
|
|
5237
|
+
__name: "ProgressRoot",
|
|
5238
|
+
props: {
|
|
5239
|
+
ariaValuetext: {
|
|
5240
|
+
type: String,
|
|
5241
|
+
required: false
|
|
5242
|
+
},
|
|
5243
|
+
format: {
|
|
5244
|
+
type: null,
|
|
5245
|
+
required: false
|
|
5246
|
+
},
|
|
5247
|
+
getAriaValueText: {
|
|
5248
|
+
type: Function,
|
|
5249
|
+
required: false
|
|
5250
|
+
},
|
|
5251
|
+
locale: {
|
|
5252
|
+
type: null,
|
|
5253
|
+
required: false
|
|
5254
|
+
},
|
|
5255
|
+
max: {
|
|
5256
|
+
type: Number,
|
|
5257
|
+
required: false,
|
|
5258
|
+
default: 100
|
|
5259
|
+
},
|
|
5260
|
+
min: {
|
|
5261
|
+
type: Number,
|
|
5262
|
+
required: false,
|
|
5263
|
+
default: 0
|
|
5264
|
+
},
|
|
5265
|
+
value: {
|
|
5266
|
+
type: [Number, null],
|
|
5267
|
+
required: true
|
|
5268
|
+
},
|
|
5269
|
+
as: {
|
|
5270
|
+
type: null,
|
|
5271
|
+
required: false,
|
|
5272
|
+
default: "div"
|
|
5273
|
+
},
|
|
5274
|
+
class: {
|
|
5275
|
+
type: Function,
|
|
5276
|
+
required: false,
|
|
5277
|
+
skipCheck: true
|
|
5278
|
+
},
|
|
5279
|
+
style: {
|
|
5280
|
+
type: [
|
|
5281
|
+
Boolean,
|
|
5282
|
+
null,
|
|
5283
|
+
String,
|
|
5284
|
+
Object,
|
|
5285
|
+
Array,
|
|
5286
|
+
Function
|
|
5287
|
+
],
|
|
5288
|
+
required: false,
|
|
5289
|
+
skipCheck: true
|
|
5290
|
+
}
|
|
5291
|
+
},
|
|
5292
|
+
setup(__props) {
|
|
5293
|
+
const props = __props;
|
|
5294
|
+
function getDefaultAriaValueText(formattedValue, value) {
|
|
5295
|
+
if (value == null) return "indeterminate progress";
|
|
5296
|
+
return formattedValue || `${value}%`;
|
|
5297
|
+
}
|
|
5298
|
+
const attrs = (0, vue.useAttrs)();
|
|
5299
|
+
const labelId = (0, vue.ref)(void 0);
|
|
5300
|
+
const status = (0, vue.computed)(() => {
|
|
5301
|
+
if (props.value == null || !Number.isFinite(props.value)) return "indeterminate";
|
|
5302
|
+
return props.value === props.max ? "complete" : "progressing";
|
|
5303
|
+
});
|
|
5304
|
+
const formattedValue = (0, vue.computed)(() => require_decrement_NumberFieldDecrement.formatNumberValue(props.value, props.locale, props.format));
|
|
5305
|
+
const ariaValueText = (0, vue.computed)(() => {
|
|
5306
|
+
if (props.ariaValuetext !== void 0) return props.ariaValuetext;
|
|
5307
|
+
const formatted = props.value == null ? null : formattedValue.value;
|
|
5308
|
+
if (props.getAriaValueText) return props.getAriaValueText(formatted, props.value);
|
|
5309
|
+
return getDefaultAriaValueText(formatted, props.value);
|
|
5310
|
+
});
|
|
5311
|
+
const state = (0, vue.computed)(() => ({ status: status.value }));
|
|
5312
|
+
(0, vue.provide)(progressRootContextKey, {
|
|
5313
|
+
formattedValue,
|
|
5314
|
+
max: (0, vue.computed)(() => props.max),
|
|
5315
|
+
min: (0, vue.computed)(() => props.min),
|
|
5316
|
+
value: (0, vue.computed)(() => props.value),
|
|
5317
|
+
status,
|
|
5318
|
+
state,
|
|
5319
|
+
setLabelId(id) {
|
|
5320
|
+
labelId.value = id;
|
|
5321
|
+
}
|
|
5322
|
+
});
|
|
5323
|
+
const { tag, mergedProps, renderless } = require_button_Button.useRenderElement({
|
|
5324
|
+
componentProps: props,
|
|
5325
|
+
state,
|
|
5326
|
+
props: (0, vue.computed)(() => ({
|
|
5327
|
+
"role": "progressbar",
|
|
5328
|
+
"aria-labelledby": labelId.value,
|
|
5329
|
+
"aria-valuemax": props.max,
|
|
5330
|
+
"aria-valuemin": props.min,
|
|
5331
|
+
"aria-valuenow": props.value ?? void 0,
|
|
5332
|
+
"aria-valuetext": ariaValueText.value,
|
|
5333
|
+
...attrs
|
|
5334
|
+
})),
|
|
5335
|
+
defaultTagName: "div",
|
|
5336
|
+
stateAttributesMapping: progressStateAttributesMapping
|
|
5337
|
+
});
|
|
5338
|
+
const visuallyHiddenStyle = require_checkbox_index.visuallyHidden;
|
|
5339
|
+
return (_ctx, _cache) => {
|
|
5340
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
5341
|
+
key: 0,
|
|
5342
|
+
props: (0, vue.unref)(mergedProps),
|
|
5343
|
+
state: state.value
|
|
5344
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 1 }, (0, vue.unref)(mergedProps))), {
|
|
5345
|
+
default: (0, vue.withCtx)(() => [
|
|
5346
|
+
(0, vue.renderSlot)(_ctx.$slots, "default", { state: state.value }),
|
|
5347
|
+
(0, vue.createCommentVNode)(" Force NVDA to read the label https://github.com/mui/base-ui/issues/4184 "),
|
|
5348
|
+
(0, vue.createElementVNode)("span", {
|
|
5349
|
+
role: "presentation",
|
|
5350
|
+
style: (0, vue.normalizeStyle)((0, vue.unref)(visuallyHiddenStyle))
|
|
5351
|
+
}, "x", 4)
|
|
5352
|
+
]),
|
|
5353
|
+
_: 3
|
|
5354
|
+
}, 16));
|
|
5355
|
+
};
|
|
5356
|
+
}
|
|
5357
|
+
});
|
|
5358
|
+
|
|
5359
|
+
//#endregion
|
|
5360
|
+
//#region src/progress/root/ProgressRoot.vue
|
|
5361
|
+
var ProgressRoot_default = ProgressRoot_vue_vue_type_script_setup_true_lang_default;
|
|
5362
|
+
|
|
5363
|
+
//#endregion
|
|
5364
|
+
//#region src/progress/track/ProgressTrack.vue?vue&type=script&setup=true&lang.ts
|
|
5365
|
+
/**
|
|
5366
|
+
* Contains the progress bar indicator.
|
|
5367
|
+
* Renders a `<div>` element.
|
|
5368
|
+
*
|
|
5369
|
+
* Documentation: [Base UI Vue Progress](https://baseui-vue.com/docs/components/progress)
|
|
5370
|
+
*/
|
|
5371
|
+
var ProgressTrack_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
5372
|
+
name: "ProgressTrack",
|
|
5373
|
+
inheritAttrs: false,
|
|
5374
|
+
__name: "ProgressTrack",
|
|
5375
|
+
props: {
|
|
5376
|
+
as: {
|
|
5377
|
+
type: null,
|
|
5378
|
+
required: false,
|
|
5379
|
+
default: "div"
|
|
5380
|
+
},
|
|
5381
|
+
class: {
|
|
5382
|
+
type: Function,
|
|
5383
|
+
required: false,
|
|
5384
|
+
skipCheck: true
|
|
5385
|
+
},
|
|
5386
|
+
style: {
|
|
5387
|
+
type: [
|
|
5388
|
+
Boolean,
|
|
5389
|
+
null,
|
|
5390
|
+
String,
|
|
5391
|
+
Object,
|
|
5392
|
+
Array,
|
|
5393
|
+
Function
|
|
5394
|
+
],
|
|
5395
|
+
required: false,
|
|
5396
|
+
skipCheck: true
|
|
5397
|
+
}
|
|
5398
|
+
},
|
|
5399
|
+
setup(__props) {
|
|
5400
|
+
const props = __props;
|
|
5401
|
+
const attrs = (0, vue.useAttrs)();
|
|
5402
|
+
const { state } = useProgressRootContext();
|
|
5403
|
+
const { tag, mergedProps, renderless } = require_button_Button.useRenderElement({
|
|
5404
|
+
componentProps: props,
|
|
5405
|
+
state,
|
|
5406
|
+
props: attrs,
|
|
5407
|
+
defaultTagName: "div",
|
|
5408
|
+
stateAttributesMapping: progressStateAttributesMapping
|
|
5409
|
+
});
|
|
5410
|
+
return (_ctx, _cache) => {
|
|
5411
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
5412
|
+
key: 0,
|
|
5413
|
+
props: (0, vue.unref)(mergedProps),
|
|
5414
|
+
state: (0, vue.unref)(state)
|
|
5415
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 1 }, (0, vue.unref)(mergedProps))), {
|
|
5416
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: (0, vue.unref)(state) })]),
|
|
5417
|
+
_: 3
|
|
5418
|
+
}, 16));
|
|
5419
|
+
};
|
|
5420
|
+
}
|
|
5421
|
+
});
|
|
5422
|
+
|
|
5423
|
+
//#endregion
|
|
5424
|
+
//#region src/progress/track/ProgressTrack.vue
|
|
5425
|
+
var ProgressTrack_default = ProgressTrack_vue_vue_type_script_setup_true_lang_default;
|
|
5426
|
+
|
|
5427
|
+
//#endregion
|
|
5428
|
+
//#region src/progress/value/ProgressValue.vue?vue&type=script&setup=true&lang.ts
|
|
5429
|
+
/**
|
|
5430
|
+
* A text label displaying the current value.
|
|
5431
|
+
* Renders a `<span>` element.
|
|
5432
|
+
*
|
|
5433
|
+
* Documentation: [Base UI Vue Progress](https://baseui-vue.com/docs/components/progress)
|
|
5434
|
+
*/
|
|
5435
|
+
var ProgressValue_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
5436
|
+
name: "ProgressValue",
|
|
5437
|
+
inheritAttrs: false,
|
|
5438
|
+
__name: "ProgressValue",
|
|
5439
|
+
props: {
|
|
5440
|
+
as: {
|
|
5441
|
+
type: null,
|
|
5442
|
+
required: false,
|
|
5443
|
+
default: "span"
|
|
5444
|
+
},
|
|
5445
|
+
class: {
|
|
5446
|
+
type: Function,
|
|
5447
|
+
required: false,
|
|
5448
|
+
skipCheck: true
|
|
5449
|
+
},
|
|
5450
|
+
style: {
|
|
5451
|
+
type: [
|
|
5452
|
+
Boolean,
|
|
5453
|
+
null,
|
|
5454
|
+
String,
|
|
5455
|
+
Object,
|
|
5456
|
+
Array,
|
|
5457
|
+
Function
|
|
5458
|
+
],
|
|
5459
|
+
required: false,
|
|
5460
|
+
skipCheck: true
|
|
5461
|
+
}
|
|
5462
|
+
},
|
|
5463
|
+
setup(__props) {
|
|
5464
|
+
const props = __props;
|
|
5465
|
+
const attrs = (0, vue.useAttrs)();
|
|
5466
|
+
const { value, formattedValue, state } = useProgressRootContext();
|
|
5467
|
+
const slotFormattedValue = (0, vue.computed)(() => value.value == null ? "indeterminate" : formattedValue.value);
|
|
5468
|
+
const defaultDisplay = (0, vue.computed)(() => value.value == null ? "" : formattedValue.value);
|
|
5469
|
+
const { tag, mergedProps, renderless } = require_button_Button.useRenderElement({
|
|
5470
|
+
componentProps: props,
|
|
5471
|
+
state,
|
|
5472
|
+
props: (0, vue.computed)(() => ({
|
|
5473
|
+
"aria-hidden": true,
|
|
5474
|
+
...attrs
|
|
5475
|
+
})),
|
|
5476
|
+
defaultTagName: "span",
|
|
5477
|
+
stateAttributesMapping: progressStateAttributesMapping
|
|
5478
|
+
});
|
|
5479
|
+
return (_ctx, _cache) => {
|
|
5480
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
5481
|
+
key: 0,
|
|
5482
|
+
props: (0, vue.unref)(mergedProps),
|
|
5483
|
+
state: (0, vue.unref)(state),
|
|
5484
|
+
formattedValue: slotFormattedValue.value,
|
|
5485
|
+
value: (0, vue.unref)(value)
|
|
5486
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 1 }, (0, vue.unref)(mergedProps))), {
|
|
5487
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
5488
|
+
formattedValue: slotFormattedValue.value,
|
|
5489
|
+
value: (0, vue.unref)(value)
|
|
5490
|
+
}, () => [(0, vue.createTextVNode)((0, vue.toDisplayString)(defaultDisplay.value), 1)])]),
|
|
5491
|
+
_: 3
|
|
5492
|
+
}, 16));
|
|
5493
|
+
};
|
|
5494
|
+
}
|
|
5495
|
+
});
|
|
5496
|
+
|
|
5497
|
+
//#endregion
|
|
5498
|
+
//#region src/progress/value/ProgressValue.vue
|
|
5499
|
+
var ProgressValue_default = ProgressValue_vue_vue_type_script_setup_true_lang_default;
|
|
5500
|
+
|
|
5501
|
+
//#endregion
|
|
5502
|
+
//#region src/utils/styles.ts
|
|
5503
|
+
const DISABLE_SCROLLBAR_CLASS_NAME = "base-ui-disable-scrollbar";
|
|
5504
|
+
const STYLE_ELEMENT_ID = `style-${DISABLE_SCROLLBAR_CLASS_NAME}`;
|
|
5505
|
+
const styleDisableScrollbar = {
|
|
5506
|
+
className: DISABLE_SCROLLBAR_CLASS_NAME,
|
|
5507
|
+
inject(nonce, disableStyleElements) {
|
|
5508
|
+
if (disableStyleElements) return;
|
|
5509
|
+
if (typeof document === "undefined") return;
|
|
5510
|
+
if (document.getElementById(STYLE_ELEMENT_ID)) return;
|
|
5511
|
+
const style = document.createElement("style");
|
|
5512
|
+
style.id = STYLE_ELEMENT_ID;
|
|
5513
|
+
if (nonce) style.nonce = nonce;
|
|
5514
|
+
style.textContent = `.${DISABLE_SCROLLBAR_CLASS_NAME}{scrollbar-width:none}.${DISABLE_SCROLLBAR_CLASS_NAME}::-webkit-scrollbar{display:none}`;
|
|
5515
|
+
document.head.appendChild(style);
|
|
5516
|
+
}
|
|
5517
|
+
};
|
|
5518
|
+
|
|
5519
|
+
//#endregion
|
|
5520
|
+
//#region src/scroll-area/constants.ts
|
|
5521
|
+
const SCROLL_TIMEOUT = 500;
|
|
5522
|
+
const MIN_THUMB_SIZE = 16;
|
|
5523
|
+
|
|
5524
|
+
//#endregion
|
|
5525
|
+
//#region src/scroll-area/scrollbar/ScrollAreaScrollbarDataAttributes.ts
|
|
5526
|
+
let ScrollAreaScrollbarDataAttributes = /* @__PURE__ */ function(ScrollAreaScrollbarDataAttributes) {
|
|
5527
|
+
ScrollAreaScrollbarDataAttributes["orientation"] = "data-orientation";
|
|
5528
|
+
ScrollAreaScrollbarDataAttributes["hovering"] = "data-hovering";
|
|
5529
|
+
ScrollAreaScrollbarDataAttributes["scrolling"] = "data-scrolling";
|
|
5530
|
+
ScrollAreaScrollbarDataAttributes["hasOverflowX"] = "data-has-overflow-x";
|
|
5531
|
+
ScrollAreaScrollbarDataAttributes["hasOverflowY"] = "data-has-overflow-y";
|
|
5532
|
+
ScrollAreaScrollbarDataAttributes["overflowXStart"] = "data-overflow-x-start";
|
|
5533
|
+
ScrollAreaScrollbarDataAttributes["overflowXEnd"] = "data-overflow-x-end";
|
|
5534
|
+
ScrollAreaScrollbarDataAttributes["overflowYStart"] = "data-overflow-y-start";
|
|
5535
|
+
ScrollAreaScrollbarDataAttributes["overflowYEnd"] = "data-overflow-y-end";
|
|
5536
|
+
return ScrollAreaScrollbarDataAttributes;
|
|
5537
|
+
}({});
|
|
5538
|
+
|
|
5539
|
+
//#endregion
|
|
5540
|
+
//#region src/scroll-area/utils/getOffset.ts
|
|
5541
|
+
function getOffset(element, prop, axis) {
|
|
5542
|
+
if (!element) return 0;
|
|
5543
|
+
const styles = getComputedStyle(element);
|
|
5544
|
+
const propAxis = axis === "x" ? "Inline" : "Block";
|
|
5545
|
+
const start = getStyleNumber(styles, `${prop}${propAxis}Start`);
|
|
5546
|
+
const end = getStyleNumber(styles, `${prop}${propAxis}End`);
|
|
5547
|
+
if (axis === "x" && prop === "margin" && styles.direction === "rtl" && isSafari()) return start * 2;
|
|
5548
|
+
return start + end;
|
|
5549
|
+
}
|
|
5550
|
+
function getStyleNumber(styles, prop) {
|
|
5551
|
+
return Number.parseFloat(styles[prop]) || 0;
|
|
5552
|
+
}
|
|
5553
|
+
function isSafari() {
|
|
5554
|
+
if (typeof navigator === "undefined") return false;
|
|
5555
|
+
return /AppleWebKit/.test(navigator.userAgent) && !/Chrome|Chromium|Edg\//.test(navigator.userAgent);
|
|
5556
|
+
}
|
|
5557
|
+
|
|
5558
|
+
//#endregion
|
|
5559
|
+
//#region src/scroll-area/root/ScrollAreaRootCssVars.ts
|
|
5560
|
+
let ScrollAreaRootCssVars = /* @__PURE__ */ function(ScrollAreaRootCssVars) {
|
|
5561
|
+
ScrollAreaRootCssVars["scrollAreaCornerHeight"] = "--scroll-area-corner-height";
|
|
5562
|
+
ScrollAreaRootCssVars["scrollAreaCornerWidth"] = "--scroll-area-corner-width";
|
|
5563
|
+
return ScrollAreaRootCssVars;
|
|
5564
|
+
}({});
|
|
5565
|
+
|
|
5566
|
+
//#endregion
|
|
5567
|
+
//#region src/scroll-area/root/ScrollAreaRoot.vue?vue&type=script&setup=true&lang.ts
|
|
5568
|
+
var ScrollAreaRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
5569
|
+
name: "ScrollAreaRoot",
|
|
5570
|
+
inheritAttrs: false,
|
|
5571
|
+
__name: "ScrollAreaRoot",
|
|
5572
|
+
props: {
|
|
5573
|
+
overflowEdgeThreshold: {
|
|
5574
|
+
type: [Number, Object],
|
|
5575
|
+
required: false
|
|
5576
|
+
},
|
|
5577
|
+
as: {
|
|
5578
|
+
type: null,
|
|
5579
|
+
required: false,
|
|
5580
|
+
default: "div"
|
|
5581
|
+
},
|
|
5582
|
+
class: {
|
|
5583
|
+
type: Function,
|
|
5584
|
+
required: false,
|
|
5585
|
+
skipCheck: true
|
|
5586
|
+
},
|
|
5587
|
+
style: {
|
|
5588
|
+
type: [
|
|
5589
|
+
Boolean,
|
|
5590
|
+
null,
|
|
5591
|
+
String,
|
|
5592
|
+
Object,
|
|
5593
|
+
Array,
|
|
5594
|
+
Function
|
|
5595
|
+
],
|
|
5596
|
+
required: false,
|
|
5597
|
+
skipCheck: true
|
|
5598
|
+
}
|
|
5599
|
+
},
|
|
5600
|
+
setup(__props) {
|
|
5601
|
+
const props = __props;
|
|
5602
|
+
const DEFAULT_SIZE = {
|
|
5603
|
+
width: 0,
|
|
5604
|
+
height: 0
|
|
5605
|
+
};
|
|
5606
|
+
const DEFAULT_OVERFLOW_EDGES = {
|
|
5607
|
+
xStart: false,
|
|
5608
|
+
xEnd: false,
|
|
5609
|
+
yStart: false,
|
|
5610
|
+
yEnd: false
|
|
5611
|
+
};
|
|
5612
|
+
const DEFAULT_HIDDEN_STATE = {
|
|
5613
|
+
x: true,
|
|
5614
|
+
y: true,
|
|
5615
|
+
corner: true
|
|
5616
|
+
};
|
|
5617
|
+
const DEFAULT_COORDS = {
|
|
5618
|
+
x: 0,
|
|
5619
|
+
y: 0
|
|
5620
|
+
};
|
|
5621
|
+
const attrs = (0, vue.useAttrs)();
|
|
5622
|
+
const overflowEdgeThreshold = (0, vue.computed)(() => normalizeOverflowEdgeThreshold(props.overflowEdgeThreshold));
|
|
5623
|
+
const rootId = require_checkbox_group_CheckboxGroup.useBaseUiId();
|
|
5624
|
+
const { nonce, disableStyleElements } = require_csp_provider_CSPContext.useCSPContext();
|
|
5625
|
+
const hovering = (0, vue.ref)(false);
|
|
5626
|
+
const scrollingX = (0, vue.ref)(false);
|
|
5627
|
+
const scrollingY = (0, vue.ref)(false);
|
|
5628
|
+
const touchModality = (0, vue.ref)(false);
|
|
5629
|
+
const hasMeasuredScrollbar = (0, vue.ref)(false);
|
|
5630
|
+
const cornerSize = (0, vue.ref)({ ...DEFAULT_SIZE });
|
|
5631
|
+
const thumbSize = (0, vue.ref)({ ...DEFAULT_SIZE });
|
|
5632
|
+
const overflowEdges = (0, vue.ref)({ ...DEFAULT_OVERFLOW_EDGES });
|
|
5633
|
+
const hiddenState = (0, vue.ref)({ ...DEFAULT_HIDDEN_STATE });
|
|
5634
|
+
const rootRef = (0, vue.shallowRef)(null);
|
|
5635
|
+
const viewportRef = (0, vue.shallowRef)(null);
|
|
5636
|
+
const scrollbarYRef = (0, vue.shallowRef)(null);
|
|
5637
|
+
const scrollbarXRef = (0, vue.shallowRef)(null);
|
|
5638
|
+
const thumbYRef = (0, vue.shallowRef)(null);
|
|
5639
|
+
const thumbXRef = (0, vue.shallowRef)(null);
|
|
5640
|
+
const cornerRef = (0, vue.shallowRef)(null);
|
|
5641
|
+
let scrollYTimeoutId;
|
|
5642
|
+
let scrollXTimeoutId;
|
|
5643
|
+
const thumbDragging = { current: false };
|
|
5644
|
+
const startY = { current: 0 };
|
|
5645
|
+
const startX = { current: 0 };
|
|
5646
|
+
const startScrollTop = { current: 0 };
|
|
5647
|
+
const startScrollLeft = { current: 0 };
|
|
5648
|
+
const currentOrientation = { current: "vertical" };
|
|
5649
|
+
const scrollPosition = { current: { ...DEFAULT_COORDS } };
|
|
5650
|
+
function handleScroll(pos) {
|
|
5651
|
+
const offsetX = pos.x - scrollPosition.current.x;
|
|
5652
|
+
const offsetY = pos.y - scrollPosition.current.y;
|
|
5653
|
+
scrollPosition.current = pos;
|
|
5654
|
+
if (offsetY !== 0) {
|
|
5655
|
+
scrollingY.value = true;
|
|
5656
|
+
clearTimeout(scrollYTimeoutId);
|
|
5657
|
+
scrollYTimeoutId = setTimeout(() => {
|
|
5658
|
+
scrollingY.value = false;
|
|
5659
|
+
}, SCROLL_TIMEOUT);
|
|
5660
|
+
}
|
|
5661
|
+
if (offsetX !== 0) {
|
|
5662
|
+
scrollingX.value = true;
|
|
5663
|
+
clearTimeout(scrollXTimeoutId);
|
|
5664
|
+
scrollXTimeoutId = setTimeout(() => {
|
|
5665
|
+
scrollingX.value = false;
|
|
5666
|
+
}, SCROLL_TIMEOUT);
|
|
5667
|
+
}
|
|
5668
|
+
}
|
|
5669
|
+
function handlePointerDown(event) {
|
|
5670
|
+
if (event.button !== 0) return;
|
|
5671
|
+
thumbDragging.current = true;
|
|
5672
|
+
startY.current = event.clientY;
|
|
5673
|
+
startX.current = event.clientX;
|
|
5674
|
+
currentOrientation.current = event.currentTarget.getAttribute(ScrollAreaScrollbarDataAttributes.orientation);
|
|
5675
|
+
if (viewportRef.value) {
|
|
5676
|
+
startScrollTop.current = viewportRef.value.scrollTop;
|
|
5677
|
+
startScrollLeft.current = viewportRef.value.scrollLeft;
|
|
5678
|
+
}
|
|
5679
|
+
if (thumbYRef.value && currentOrientation.current === "vertical") thumbYRef.value.setPointerCapture(event.pointerId);
|
|
5680
|
+
if (thumbXRef.value && currentOrientation.current === "horizontal") thumbXRef.value.setPointerCapture(event.pointerId);
|
|
5681
|
+
}
|
|
5682
|
+
function handlePointerMove(event) {
|
|
5683
|
+
if (!thumbDragging.current) return;
|
|
5684
|
+
const deltaY = event.clientY - startY.current;
|
|
5685
|
+
const deltaX = event.clientX - startX.current;
|
|
5686
|
+
if (viewportRef.value) {
|
|
5687
|
+
const scrollableContentHeight = viewportRef.value.scrollHeight;
|
|
5688
|
+
const viewportHeight = viewportRef.value.clientHeight;
|
|
5689
|
+
const scrollableContentWidth = viewportRef.value.scrollWidth;
|
|
5690
|
+
const viewportWidth = viewportRef.value.clientWidth;
|
|
5691
|
+
if (thumbYRef.value && scrollbarYRef.value && currentOrientation.current === "vertical") {
|
|
5692
|
+
const scrollbarYOffset = getOffset(scrollbarYRef.value, "padding", "y");
|
|
5693
|
+
const thumbYOffset = getOffset(thumbYRef.value, "margin", "y");
|
|
5694
|
+
const thumbHeight = thumbYRef.value.offsetHeight;
|
|
5695
|
+
const scrollRatioY = deltaY / (scrollbarYRef.value.offsetHeight - thumbHeight - scrollbarYOffset - thumbYOffset);
|
|
5696
|
+
viewportRef.value.scrollTop = startScrollTop.current + scrollRatioY * (scrollableContentHeight - viewportHeight);
|
|
5697
|
+
event.preventDefault();
|
|
5698
|
+
scrollingY.value = true;
|
|
5699
|
+
clearTimeout(scrollYTimeoutId);
|
|
5700
|
+
scrollYTimeoutId = setTimeout(() => {
|
|
5701
|
+
scrollingY.value = false;
|
|
5702
|
+
}, SCROLL_TIMEOUT);
|
|
5703
|
+
}
|
|
5704
|
+
if (thumbXRef.value && scrollbarXRef.value && currentOrientation.current === "horizontal") {
|
|
5705
|
+
const scrollbarXOffset = getOffset(scrollbarXRef.value, "padding", "x");
|
|
5706
|
+
const thumbXOffset = getOffset(thumbXRef.value, "margin", "x");
|
|
5707
|
+
const thumbWidth = thumbXRef.value.offsetWidth;
|
|
5708
|
+
const scrollRatioX = deltaX / (scrollbarXRef.value.offsetWidth - thumbWidth - scrollbarXOffset - thumbXOffset);
|
|
5709
|
+
viewportRef.value.scrollLeft = startScrollLeft.current + scrollRatioX * (scrollableContentWidth - viewportWidth);
|
|
5710
|
+
event.preventDefault();
|
|
5711
|
+
scrollingX.value = true;
|
|
5712
|
+
clearTimeout(scrollXTimeoutId);
|
|
5713
|
+
scrollXTimeoutId = setTimeout(() => {
|
|
5714
|
+
scrollingX.value = false;
|
|
5715
|
+
}, SCROLL_TIMEOUT);
|
|
5716
|
+
}
|
|
5717
|
+
}
|
|
5718
|
+
}
|
|
5719
|
+
function handlePointerUp(event) {
|
|
5720
|
+
thumbDragging.current = false;
|
|
5721
|
+
if (thumbYRef.value && currentOrientation.current === "vertical") thumbYRef.value.releasePointerCapture(event.pointerId);
|
|
5722
|
+
if (thumbXRef.value && currentOrientation.current === "horizontal") thumbXRef.value.releasePointerCapture(event.pointerId);
|
|
5723
|
+
}
|
|
5724
|
+
function handleTouchModalityChange(event) {
|
|
5725
|
+
touchModality.value = event.pointerType === "touch";
|
|
5726
|
+
}
|
|
5727
|
+
function handlePointerEnterOrMove(event) {
|
|
5728
|
+
handleTouchModalityChange(event);
|
|
5729
|
+
if (event.pointerType !== "touch") hovering.value = require_control_SliderControl.contains(rootRef.value, event.target);
|
|
5730
|
+
}
|
|
5731
|
+
const state = (0, vue.computed)(() => ({
|
|
5732
|
+
scrolling: scrollingX.value || scrollingY.value,
|
|
5733
|
+
hasOverflowX: !hiddenState.value.x,
|
|
5734
|
+
hasOverflowY: !hiddenState.value.y,
|
|
5735
|
+
overflowXStart: overflowEdges.value.xStart,
|
|
5736
|
+
overflowXEnd: overflowEdges.value.xEnd,
|
|
5737
|
+
overflowYStart: overflowEdges.value.yStart,
|
|
5738
|
+
overflowYEnd: overflowEdges.value.yEnd,
|
|
5739
|
+
cornerHidden: hiddenState.value.corner
|
|
5740
|
+
}));
|
|
5741
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
5742
|
+
componentProps: props,
|
|
5743
|
+
state,
|
|
5744
|
+
props: (0, vue.computed)(() => require_button_Button.mergeProps(attrs, {
|
|
5745
|
+
role: "presentation",
|
|
5746
|
+
onPointerenter: handlePointerEnterOrMove,
|
|
5747
|
+
onPointermove: handlePointerEnterOrMove,
|
|
5748
|
+
onPointerdown: handleTouchModalityChange,
|
|
5749
|
+
onPointerleave: () => {
|
|
5750
|
+
hovering.value = false;
|
|
5751
|
+
},
|
|
5752
|
+
style: {
|
|
5753
|
+
position: "relative",
|
|
5754
|
+
[ScrollAreaRootCssVars.scrollAreaCornerHeight]: `${cornerSize.value.height}px`,
|
|
5755
|
+
[ScrollAreaRootCssVars.scrollAreaCornerWidth]: `${cornerSize.value.width}px`
|
|
5756
|
+
}
|
|
5757
|
+
})),
|
|
5758
|
+
stateAttributesMapping: require_content_ScrollAreaContent.scrollAreaStateAttributesMapping,
|
|
5759
|
+
defaultTagName: "div",
|
|
5760
|
+
ref: rootRef
|
|
5761
|
+
});
|
|
5762
|
+
(0, vue.onMounted)(() => {
|
|
5763
|
+
styleDisableScrollbar.inject(nonce.value, disableStyleElements.value);
|
|
5764
|
+
});
|
|
5765
|
+
(0, vue.provide)(require_content_ScrollAreaContent.scrollAreaRootContextKey, {
|
|
5766
|
+
cornerSize,
|
|
5767
|
+
setCornerSize: (size) => {
|
|
5768
|
+
cornerSize.value = size;
|
|
5769
|
+
},
|
|
5770
|
+
thumbSize,
|
|
5771
|
+
setThumbSize: (size) => {
|
|
5772
|
+
thumbSize.value = size;
|
|
5773
|
+
},
|
|
5774
|
+
hasMeasuredScrollbar,
|
|
5775
|
+
setHasMeasuredScrollbar: (value) => {
|
|
5776
|
+
hasMeasuredScrollbar.value = value;
|
|
5777
|
+
},
|
|
5778
|
+
touchModality,
|
|
5779
|
+
hovering,
|
|
5780
|
+
setHovering: (value) => {
|
|
5781
|
+
hovering.value = value;
|
|
5782
|
+
},
|
|
5783
|
+
scrollingX,
|
|
5784
|
+
setScrollingX: (value) => {
|
|
5785
|
+
scrollingX.value = value;
|
|
5786
|
+
},
|
|
5787
|
+
scrollingY,
|
|
5788
|
+
setScrollingY: (value) => {
|
|
5789
|
+
scrollingY.value = value;
|
|
5790
|
+
},
|
|
5791
|
+
viewportRef,
|
|
5792
|
+
rootRef,
|
|
5793
|
+
scrollbarYRef,
|
|
5794
|
+
scrollbarXRef,
|
|
5795
|
+
thumbYRef,
|
|
5796
|
+
thumbXRef,
|
|
5797
|
+
cornerRef,
|
|
5798
|
+
handlePointerDown,
|
|
5799
|
+
handlePointerMove,
|
|
5800
|
+
handlePointerUp,
|
|
5801
|
+
handleScroll,
|
|
5802
|
+
rootId,
|
|
5803
|
+
hiddenState,
|
|
5804
|
+
setHiddenState: (s) => {
|
|
5805
|
+
hiddenState.value = s;
|
|
5806
|
+
},
|
|
5807
|
+
overflowEdges,
|
|
5808
|
+
setOverflowEdges: (e) => {
|
|
5809
|
+
overflowEdges.value = e;
|
|
5810
|
+
},
|
|
5811
|
+
viewportState: state,
|
|
5812
|
+
overflowEdgeThreshold
|
|
5813
|
+
});
|
|
5814
|
+
function normalizeOverflowEdgeThreshold(threshold) {
|
|
5815
|
+
if (typeof threshold === "number") {
|
|
5816
|
+
const value = Math.max(0, threshold);
|
|
5817
|
+
return {
|
|
5818
|
+
xStart: value,
|
|
5819
|
+
xEnd: value,
|
|
5820
|
+
yStart: value,
|
|
5821
|
+
yEnd: value
|
|
5822
|
+
};
|
|
5823
|
+
}
|
|
5824
|
+
return {
|
|
5825
|
+
xStart: Math.max(0, threshold?.xStart || 0),
|
|
5826
|
+
xEnd: Math.max(0, threshold?.xEnd || 0),
|
|
5827
|
+
yStart: Math.max(0, threshold?.yStart || 0),
|
|
5828
|
+
yEnd: Math.max(0, threshold?.yEnd || 0)
|
|
5829
|
+
};
|
|
5830
|
+
}
|
|
5831
|
+
return (_ctx, _cache) => {
|
|
5832
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
5833
|
+
key: 0,
|
|
5834
|
+
ref: (0, vue.unref)(renderRef),
|
|
5835
|
+
props: (0, vue.unref)(mergedProps),
|
|
5836
|
+
state: state.value
|
|
5837
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
5838
|
+
key: 1,
|
|
5839
|
+
ref: (0, vue.unref)(renderRef)
|
|
5840
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
5841
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
5842
|
+
_: 3
|
|
5843
|
+
}, 16));
|
|
5844
|
+
};
|
|
5845
|
+
}
|
|
5846
|
+
});
|
|
5847
|
+
|
|
5848
|
+
//#endregion
|
|
5849
|
+
//#region src/scroll-area/root/ScrollAreaRoot.vue
|
|
5850
|
+
var ScrollAreaRoot_default = ScrollAreaRoot_vue_vue_type_script_setup_true_lang_default;
|
|
5851
|
+
|
|
5852
|
+
//#endregion
|
|
5853
|
+
//#region src/scroll-area/scrollbar/ScrollAreaScrollbarContext.ts
|
|
5854
|
+
const scrollAreaScrollbarContextKey = Symbol("ScrollAreaScrollbarContext");
|
|
5855
|
+
function useScrollAreaScrollbarContext() {
|
|
5856
|
+
const context = (0, vue.inject)(scrollAreaScrollbarContextKey);
|
|
5857
|
+
if (context === void 0) throw new Error("Base UI: ScrollAreaScrollbarContext is missing. ScrollArea.Thumb must be placed within <ScrollAreaScrollbar>.");
|
|
5858
|
+
return context;
|
|
5859
|
+
}
|
|
5860
|
+
|
|
5861
|
+
//#endregion
|
|
5862
|
+
//#region src/scroll-area/scrollbar/ScrollAreaScrollbarCssVars.ts
|
|
5863
|
+
let ScrollAreaScrollbarCssVars = /* @__PURE__ */ function(ScrollAreaScrollbarCssVars) {
|
|
5864
|
+
ScrollAreaScrollbarCssVars["scrollAreaThumbHeight"] = "--scroll-area-thumb-height";
|
|
5865
|
+
ScrollAreaScrollbarCssVars["scrollAreaThumbWidth"] = "--scroll-area-thumb-width";
|
|
5866
|
+
return ScrollAreaScrollbarCssVars;
|
|
5867
|
+
}({});
|
|
5868
|
+
|
|
5869
|
+
//#endregion
|
|
5870
|
+
//#region src/scroll-area/scrollbar/ScrollAreaScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
5871
|
+
var ScrollAreaScrollbar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
5872
|
+
name: "ScrollAreaScrollbar",
|
|
5873
|
+
inheritAttrs: false,
|
|
5874
|
+
__name: "ScrollAreaScrollbar",
|
|
5875
|
+
props: {
|
|
5876
|
+
orientation: {
|
|
5877
|
+
type: String,
|
|
5878
|
+
required: false,
|
|
5879
|
+
default: "vertical"
|
|
5880
|
+
},
|
|
5881
|
+
keepMounted: {
|
|
5882
|
+
type: Boolean,
|
|
5883
|
+
required: false,
|
|
5884
|
+
default: false
|
|
5885
|
+
},
|
|
5886
|
+
as: {
|
|
5887
|
+
type: null,
|
|
5888
|
+
required: false,
|
|
5889
|
+
default: "div"
|
|
5890
|
+
},
|
|
5891
|
+
class: {
|
|
5892
|
+
type: Function,
|
|
5893
|
+
required: false,
|
|
5894
|
+
skipCheck: true
|
|
5895
|
+
},
|
|
5896
|
+
style: {
|
|
5897
|
+
type: [
|
|
5898
|
+
Boolean,
|
|
5899
|
+
null,
|
|
5900
|
+
String,
|
|
5901
|
+
Object,
|
|
5902
|
+
Array,
|
|
5903
|
+
Function
|
|
5904
|
+
],
|
|
5905
|
+
required: false,
|
|
5906
|
+
skipCheck: true
|
|
5907
|
+
}
|
|
5908
|
+
},
|
|
5909
|
+
setup(__props) {
|
|
5910
|
+
const props = __props;
|
|
5911
|
+
const attrs = (0, vue.useAttrs)();
|
|
5912
|
+
const { hovering, scrollingX, scrollingY, hiddenState, overflowEdges, scrollbarYRef, scrollbarXRef, viewportRef, thumbYRef, thumbXRef, handlePointerDown, handlePointerUp, rootId, thumbSize, hasMeasuredScrollbar } = require_content_ScrollAreaContent.useScrollAreaRootContext();
|
|
5913
|
+
const direction = require_control_SliderControl.useDirection();
|
|
5914
|
+
let wheelCleanup;
|
|
5915
|
+
const scrollbarElementRef = (0, vue.shallowRef)(null);
|
|
5916
|
+
(0, vue.watch)([scrollbarElementRef, () => props.orientation], ([element, orientation], [previousElement, previousOrientation]) => {
|
|
5917
|
+
if (previousElement) {
|
|
5918
|
+
const previousRef = previousOrientation === "vertical" ? scrollbarYRef : scrollbarXRef;
|
|
5919
|
+
if (previousRef.value === previousElement) previousRef.value = null;
|
|
5920
|
+
}
|
|
5921
|
+
if (!element) return;
|
|
5922
|
+
const nextRef = orientation === "vertical" ? scrollbarYRef : scrollbarXRef;
|
|
5923
|
+
nextRef.value = element;
|
|
5924
|
+
});
|
|
5925
|
+
(0, vue.watch)([
|
|
5926
|
+
scrollbarElementRef,
|
|
5927
|
+
viewportRef,
|
|
5928
|
+
() => props.orientation
|
|
5929
|
+
], () => {
|
|
5930
|
+
wheelCleanup?.();
|
|
5931
|
+
wheelCleanup = setupWheelHandler();
|
|
5932
|
+
}, { flush: "post" });
|
|
5933
|
+
(0, vue.onBeforeUnmount)(() => {
|
|
5934
|
+
wheelCleanup?.();
|
|
5935
|
+
});
|
|
5936
|
+
function setupWheelHandler() {
|
|
5937
|
+
const viewportEl = viewportRef.value;
|
|
5938
|
+
const scrollbarEl = scrollbarElementRef.value;
|
|
5939
|
+
if (!scrollbarEl) return void 0;
|
|
5940
|
+
function handleWheel(event) {
|
|
5941
|
+
if (!viewportEl || !scrollbarEl || event.ctrlKey) return;
|
|
5942
|
+
if (props.orientation === "vertical") {
|
|
5943
|
+
if (viewportEl.scrollTop === 0 && event.deltaY < 0) return;
|
|
5944
|
+
if (viewportEl.scrollTop === viewportEl.scrollHeight - viewportEl.clientHeight && event.deltaY > 0) return;
|
|
5945
|
+
event.preventDefault();
|
|
5946
|
+
viewportEl.scrollTop += event.deltaY;
|
|
5947
|
+
} else {
|
|
5948
|
+
if (viewportEl.scrollLeft === 0 && event.deltaX < 0) return;
|
|
5949
|
+
if (viewportEl.scrollLeft === viewportEl.scrollWidth - viewportEl.clientWidth && event.deltaX > 0) return;
|
|
5950
|
+
event.preventDefault();
|
|
5951
|
+
viewportEl.scrollLeft += event.deltaX;
|
|
5952
|
+
}
|
|
5953
|
+
}
|
|
5954
|
+
scrollbarEl.addEventListener("wheel", handleWheel, { passive: false });
|
|
5955
|
+
return () => scrollbarEl.removeEventListener("wheel", handleWheel);
|
|
5956
|
+
}
|
|
5957
|
+
function setScrollbarElement(element) {
|
|
5958
|
+
scrollbarElementRef.value = element;
|
|
5959
|
+
}
|
|
5960
|
+
const state = (0, vue.computed)(() => ({
|
|
5961
|
+
hovering: hovering.value,
|
|
5962
|
+
scrolling: props.orientation === "horizontal" ? scrollingX.value : scrollingY.value,
|
|
5963
|
+
orientation: props.orientation,
|
|
5964
|
+
hasOverflowX: !hiddenState.value.x,
|
|
5965
|
+
hasOverflowY: !hiddenState.value.y,
|
|
5966
|
+
overflowXStart: overflowEdges.value.xStart,
|
|
5967
|
+
overflowXEnd: overflowEdges.value.xEnd,
|
|
5968
|
+
overflowYStart: overflowEdges.value.yStart,
|
|
5969
|
+
overflowYEnd: overflowEdges.value.yEnd,
|
|
5970
|
+
cornerHidden: hiddenState.value.corner
|
|
5971
|
+
}));
|
|
5972
|
+
const hideTrackUntilMeasured = (0, vue.computed)(() => !hasMeasuredScrollbar.value && !props.keepMounted);
|
|
5973
|
+
function onPointerDown(event) {
|
|
5974
|
+
if (event.button !== 0) return;
|
|
5975
|
+
const target = require_control_SliderControl.getTarget(event);
|
|
5976
|
+
const thumb = props.orientation === "vertical" ? thumbYRef.value : thumbXRef.value;
|
|
5977
|
+
if (thumb && require_control_SliderControl.contains(thumb, target)) return;
|
|
5978
|
+
if (!viewportRef.value) return;
|
|
5979
|
+
if (thumbYRef.value && scrollbarYRef.value && props.orientation === "vertical") {
|
|
5980
|
+
const thumbYOffset = getOffset(thumbYRef.value, "margin", "y");
|
|
5981
|
+
const scrollbarYOffset = getOffset(scrollbarYRef.value, "padding", "y");
|
|
5982
|
+
const thumbHeight = thumbYRef.value.offsetHeight;
|
|
5983
|
+
const trackRectY = scrollbarYRef.value.getBoundingClientRect();
|
|
5984
|
+
const clickY = event.clientY - trackRectY.top - thumbHeight / 2 - scrollbarYOffset + thumbYOffset / 2;
|
|
5985
|
+
const scrollableContentHeight = viewportRef.value.scrollHeight;
|
|
5986
|
+
const viewportHeight = viewportRef.value.clientHeight;
|
|
5987
|
+
const scrollRatioY = clickY / (scrollbarYRef.value.offsetHeight - thumbHeight - scrollbarYOffset - thumbYOffset);
|
|
5988
|
+
viewportRef.value.scrollTop = scrollRatioY * (scrollableContentHeight - viewportHeight);
|
|
5989
|
+
}
|
|
5990
|
+
if (thumbXRef.value && scrollbarXRef.value && props.orientation === "horizontal") {
|
|
5991
|
+
const thumbXOffset = getOffset(thumbXRef.value, "margin", "x");
|
|
5992
|
+
const scrollbarXOffset = getOffset(scrollbarXRef.value, "padding", "x");
|
|
5993
|
+
const thumbWidth = thumbXRef.value.offsetWidth;
|
|
5994
|
+
const trackRectX = scrollbarXRef.value.getBoundingClientRect();
|
|
5995
|
+
const clickX = event.clientX - trackRectX.left - thumbWidth / 2 - scrollbarXOffset + thumbXOffset / 2;
|
|
5996
|
+
const scrollableContentWidth = viewportRef.value.scrollWidth;
|
|
5997
|
+
const viewportWidth = viewportRef.value.clientWidth;
|
|
5998
|
+
const scrollRatioX = clickX / (scrollbarXRef.value.offsetWidth - thumbWidth - scrollbarXOffset - thumbXOffset);
|
|
5999
|
+
let newScrollLeft;
|
|
6000
|
+
if (direction.value === "rtl") {
|
|
6001
|
+
newScrollLeft = (1 - scrollRatioX) * (scrollableContentWidth - viewportWidth);
|
|
6002
|
+
if (viewportRef.value.scrollLeft <= 0) newScrollLeft = -newScrollLeft;
|
|
6003
|
+
} else newScrollLeft = scrollRatioX * (scrollableContentWidth - viewportWidth);
|
|
6004
|
+
viewportRef.value.scrollLeft = newScrollLeft;
|
|
6005
|
+
}
|
|
6006
|
+
handlePointerDown(event);
|
|
6007
|
+
}
|
|
6008
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
6009
|
+
componentProps: props,
|
|
6010
|
+
state,
|
|
6011
|
+
props: (0, vue.computed)(() => require_button_Button.mergeProps(attrs, {
|
|
6012
|
+
...rootId ? { "data-id": `${rootId}-scrollbar` } : {},
|
|
6013
|
+
onPointerdown: onPointerDown,
|
|
6014
|
+
onPointerup: handlePointerUp,
|
|
6015
|
+
style: {
|
|
6016
|
+
position: "absolute",
|
|
6017
|
+
touchAction: "none",
|
|
6018
|
+
WebkitUserSelect: "none",
|
|
6019
|
+
userSelect: "none",
|
|
6020
|
+
visibility: hideTrackUntilMeasured.value ? "hidden" : void 0,
|
|
6021
|
+
...props.orientation === "vertical" && {
|
|
6022
|
+
top: 0,
|
|
6023
|
+
bottom: `var(${ScrollAreaRootCssVars.scrollAreaCornerHeight})`,
|
|
6024
|
+
insetInlineEnd: 0,
|
|
6025
|
+
[ScrollAreaScrollbarCssVars.scrollAreaThumbHeight]: `${thumbSize.value.height}px`
|
|
6026
|
+
},
|
|
6027
|
+
...props.orientation === "horizontal" && {
|
|
6028
|
+
insetInlineStart: 0,
|
|
6029
|
+
insetInlineEnd: `var(${ScrollAreaRootCssVars.scrollAreaCornerWidth})`,
|
|
6030
|
+
bottom: 0,
|
|
6031
|
+
[ScrollAreaScrollbarCssVars.scrollAreaThumbWidth]: `${thumbSize.value.width}px`
|
|
6032
|
+
}
|
|
6033
|
+
}
|
|
6034
|
+
})),
|
|
6035
|
+
stateAttributesMapping: require_content_ScrollAreaContent.scrollAreaStateAttributesMapping,
|
|
6036
|
+
defaultTagName: "div",
|
|
6037
|
+
ref: setScrollbarElement
|
|
6038
|
+
});
|
|
6039
|
+
const isHidden = (0, vue.computed)(() => props.orientation === "vertical" ? hiddenState.value.y : hiddenState.value.x);
|
|
6040
|
+
const shouldRender = (0, vue.computed)(() => props.keepMounted || !isHidden.value);
|
|
6041
|
+
(0, vue.provide)(scrollAreaScrollbarContextKey, { orientation: (0, vue.computed)(() => props.orientation) });
|
|
6042
|
+
return (_ctx, _cache) => {
|
|
6043
|
+
return shouldRender.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [(0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
6044
|
+
key: 0,
|
|
6045
|
+
ref: (0, vue.unref)(renderRef),
|
|
6046
|
+
props: (0, vue.unref)(mergedProps),
|
|
6047
|
+
state: state.value
|
|
6048
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
6049
|
+
key: 1,
|
|
6050
|
+
ref: (0, vue.unref)(renderRef)
|
|
6051
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
6052
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
6053
|
+
_: 3
|
|
6054
|
+
}, 16))], 64)) : (0, vue.createCommentVNode)("v-if", true);
|
|
6055
|
+
};
|
|
6056
|
+
}
|
|
6057
|
+
});
|
|
6058
|
+
|
|
6059
|
+
//#endregion
|
|
6060
|
+
//#region src/scroll-area/scrollbar/ScrollAreaScrollbar.vue
|
|
6061
|
+
var ScrollAreaScrollbar_default = ScrollAreaScrollbar_vue_vue_type_script_setup_true_lang_default;
|
|
6062
|
+
|
|
6063
|
+
//#endregion
|
|
6064
|
+
//#region src/scroll-area/thumb/ScrollAreaThumb.vue?vue&type=script&setup=true&lang.ts
|
|
6065
|
+
var ScrollAreaThumb_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
6066
|
+
name: "ScrollAreaThumb",
|
|
6067
|
+
inheritAttrs: false,
|
|
6068
|
+
__name: "ScrollAreaThumb",
|
|
6069
|
+
props: {
|
|
6070
|
+
as: {
|
|
6071
|
+
type: null,
|
|
6072
|
+
required: false,
|
|
6073
|
+
default: "div"
|
|
6074
|
+
},
|
|
6075
|
+
class: {
|
|
6076
|
+
type: Function,
|
|
6077
|
+
required: false,
|
|
6078
|
+
skipCheck: true
|
|
6079
|
+
},
|
|
6080
|
+
style: {
|
|
6081
|
+
type: [
|
|
6082
|
+
Boolean,
|
|
6083
|
+
null,
|
|
6084
|
+
String,
|
|
6085
|
+
Object,
|
|
6086
|
+
Array,
|
|
6087
|
+
Function
|
|
6088
|
+
],
|
|
6089
|
+
required: false,
|
|
6090
|
+
skipCheck: true
|
|
6091
|
+
}
|
|
6092
|
+
},
|
|
6093
|
+
setup(__props) {
|
|
6094
|
+
const props = __props;
|
|
6095
|
+
const attrs = (0, vue.useAttrs)();
|
|
6096
|
+
const { thumbYRef, thumbXRef, handlePointerDown, handlePointerMove, handlePointerUp, setScrollingX, setScrollingY, hasMeasuredScrollbar } = require_content_ScrollAreaContent.useScrollAreaRootContext();
|
|
6097
|
+
const { orientation } = useScrollAreaScrollbarContext();
|
|
6098
|
+
const thumbElementRef = (0, vue.shallowRef)(null);
|
|
6099
|
+
(0, vue.watch)([thumbElementRef, orientation], ([element, currentOrientation], [previousElement, previousOrientation]) => {
|
|
6100
|
+
if (previousElement) {
|
|
6101
|
+
const previousRef = previousOrientation === "vertical" ? thumbYRef : thumbXRef;
|
|
6102
|
+
if (previousRef.value === previousElement) previousRef.value = null;
|
|
6103
|
+
}
|
|
6104
|
+
if (!element) return;
|
|
6105
|
+
const nextRef = currentOrientation === "vertical" ? thumbYRef : thumbXRef;
|
|
6106
|
+
nextRef.value = element;
|
|
6107
|
+
});
|
|
6108
|
+
const state = (0, vue.computed)(() => ({ orientation: orientation.value }));
|
|
6109
|
+
function onPointerUp(event) {
|
|
6110
|
+
if (orientation.value === "vertical") setScrollingY(false);
|
|
6111
|
+
if (orientation.value === "horizontal") setScrollingX(false);
|
|
6112
|
+
handlePointerUp(event);
|
|
6113
|
+
}
|
|
6114
|
+
function setThumbElement(element) {
|
|
6115
|
+
thumbElementRef.value = element;
|
|
6116
|
+
}
|
|
6117
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
6118
|
+
componentProps: props,
|
|
6119
|
+
state,
|
|
6120
|
+
props: (0, vue.computed)(() => require_button_Button.mergeProps(attrs, {
|
|
6121
|
+
onPointerdown: handlePointerDown,
|
|
6122
|
+
onPointermove: handlePointerMove,
|
|
6123
|
+
onPointerup: onPointerUp,
|
|
6124
|
+
style: {
|
|
6125
|
+
visibility: hasMeasuredScrollbar.value ? void 0 : "hidden",
|
|
6126
|
+
...orientation.value === "vertical" && { height: `var(${ScrollAreaScrollbarCssVars.scrollAreaThumbHeight})` },
|
|
6127
|
+
...orientation.value === "horizontal" && { width: `var(${ScrollAreaScrollbarCssVars.scrollAreaThumbWidth})` }
|
|
6128
|
+
}
|
|
6129
|
+
})),
|
|
6130
|
+
defaultTagName: "div",
|
|
6131
|
+
ref: setThumbElement
|
|
6132
|
+
});
|
|
6133
|
+
return (_ctx, _cache) => {
|
|
6134
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
6135
|
+
key: 0,
|
|
6136
|
+
ref: (0, vue.unref)(renderRef),
|
|
6137
|
+
props: (0, vue.unref)(mergedProps),
|
|
6138
|
+
state: state.value
|
|
6139
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
6140
|
+
key: 1,
|
|
6141
|
+
ref: (0, vue.unref)(renderRef)
|
|
6142
|
+
}, (0, vue.unref)(mergedProps)), null, 16));
|
|
6143
|
+
};
|
|
6144
|
+
}
|
|
6145
|
+
});
|
|
6146
|
+
|
|
6147
|
+
//#endregion
|
|
6148
|
+
//#region src/scroll-area/thumb/ScrollAreaThumb.vue
|
|
6149
|
+
var ScrollAreaThumb_default = ScrollAreaThumb_vue_vue_type_script_setup_true_lang_default;
|
|
2615
6150
|
|
|
2616
6151
|
//#endregion
|
|
2617
|
-
//#region src/
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
6152
|
+
//#region src/scroll-area/thumb/ScrollAreaThumbDataAttributes.ts
|
|
6153
|
+
let ScrollAreaThumbDataAttributes = /* @__PURE__ */ function(ScrollAreaThumbDataAttributes) {
|
|
6154
|
+
ScrollAreaThumbDataAttributes["orientation"] = "data-orientation";
|
|
6155
|
+
return ScrollAreaThumbDataAttributes;
|
|
6156
|
+
}({});
|
|
6157
|
+
|
|
6158
|
+
//#endregion
|
|
6159
|
+
//#region src/utils/scrollEdges.ts
|
|
6160
|
+
const SCROLL_EDGE_TOLERANCE_PX = 1;
|
|
6161
|
+
function normalizeScrollOffset(value, max) {
|
|
6162
|
+
if (max <= 0) return 0;
|
|
6163
|
+
const clamped = require_control_SliderControl.clamp(value, 0, max);
|
|
6164
|
+
const startDistance = clamped;
|
|
6165
|
+
const endDistance = max - clamped;
|
|
6166
|
+
const withinStartTolerance = startDistance <= SCROLL_EDGE_TOLERANCE_PX;
|
|
6167
|
+
const withinEndTolerance = endDistance <= SCROLL_EDGE_TOLERANCE_PX;
|
|
6168
|
+
if (withinStartTolerance && withinEndTolerance) return startDistance <= endDistance ? 0 : max;
|
|
6169
|
+
if (withinStartTolerance) return 0;
|
|
6170
|
+
if (withinEndTolerance) return max;
|
|
6171
|
+
return clamped;
|
|
6172
|
+
}
|
|
6173
|
+
|
|
6174
|
+
//#endregion
|
|
6175
|
+
//#region src/scroll-area/viewport/ScrollAreaViewportCssVars.ts
|
|
6176
|
+
let ScrollAreaViewportCssVars = /* @__PURE__ */ function(ScrollAreaViewportCssVars) {
|
|
6177
|
+
ScrollAreaViewportCssVars["scrollAreaOverflowXStart"] = "--scroll-area-overflow-x-start";
|
|
6178
|
+
ScrollAreaViewportCssVars["scrollAreaOverflowXEnd"] = "--scroll-area-overflow-x-end";
|
|
6179
|
+
ScrollAreaViewportCssVars["scrollAreaOverflowYStart"] = "--scroll-area-overflow-y-start";
|
|
6180
|
+
ScrollAreaViewportCssVars["scrollAreaOverflowYEnd"] = "--scroll-area-overflow-y-end";
|
|
6181
|
+
return ScrollAreaViewportCssVars;
|
|
6182
|
+
}({});
|
|
6183
|
+
|
|
6184
|
+
//#endregion
|
|
6185
|
+
//#region src/scroll-area/viewport/ScrollAreaViewport.vue?vue&type=script&setup=true&lang.ts
|
|
6186
|
+
var ScrollAreaViewport_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
6187
|
+
name: "ScrollAreaViewport",
|
|
2626
6188
|
inheritAttrs: false,
|
|
2627
|
-
__name: "
|
|
6189
|
+
__name: "ScrollAreaViewport",
|
|
2628
6190
|
props: {
|
|
2629
|
-
disabled: {
|
|
2630
|
-
type: Boolean,
|
|
2631
|
-
required: false,
|
|
2632
|
-
default: false
|
|
2633
|
-
},
|
|
2634
6191
|
as: {
|
|
2635
6192
|
type: null,
|
|
2636
6193
|
required: false,
|
|
2637
|
-
default: "
|
|
6194
|
+
default: "div"
|
|
2638
6195
|
},
|
|
2639
6196
|
class: {
|
|
2640
6197
|
type: Function,
|
|
@@ -2657,33 +6214,247 @@ var FieldsetRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (
|
|
|
2657
6214
|
setup(__props) {
|
|
2658
6215
|
const props = __props;
|
|
2659
6216
|
const attrs = (0, vue.useAttrs)();
|
|
2660
|
-
const
|
|
2661
|
-
|
|
2662
|
-
|
|
6217
|
+
const { viewportRef, scrollbarYRef, scrollbarXRef, thumbYRef, thumbXRef, cornerRef, cornerSize, setCornerSize, setThumbSize, rootId, setHiddenState, hiddenState, setHasMeasuredScrollbar, handleScroll, setHovering, setOverflowEdges, overflowEdges, overflowEdgeThreshold, scrollingX, scrollingY } = require_content_ScrollAreaContent.useScrollAreaRootContext();
|
|
6218
|
+
const direction = require_control_SliderControl.useDirection();
|
|
6219
|
+
let programmaticScroll = true;
|
|
6220
|
+
const lastMeasuredViewportMetrics = [
|
|
6221
|
+
NaN,
|
|
6222
|
+
NaN,
|
|
6223
|
+
NaN,
|
|
6224
|
+
NaN
|
|
6225
|
+
];
|
|
6226
|
+
let scrollEndTimeoutId;
|
|
6227
|
+
let waitForAnimationsTimeoutId;
|
|
6228
|
+
let resizeObserver;
|
|
6229
|
+
let scrollAreaOverflowVarsRegistered = false;
|
|
6230
|
+
function removeCSSVariableInheritance() {
|
|
6231
|
+
if (scrollAreaOverflowVarsRegistered) return;
|
|
6232
|
+
if (typeof navigator !== "undefined" && /AppleWebKit/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent)) return;
|
|
6233
|
+
if (typeof CSS !== "undefined" && "registerProperty" in CSS) {
|
|
6234
|
+
const vars = [
|
|
6235
|
+
ScrollAreaViewportCssVars.scrollAreaOverflowXStart,
|
|
6236
|
+
ScrollAreaViewportCssVars.scrollAreaOverflowXEnd,
|
|
6237
|
+
ScrollAreaViewportCssVars.scrollAreaOverflowYStart,
|
|
6238
|
+
ScrollAreaViewportCssVars.scrollAreaOverflowYEnd
|
|
6239
|
+
];
|
|
6240
|
+
for (const name of vars) try {
|
|
6241
|
+
CSS.registerProperty({
|
|
6242
|
+
name,
|
|
6243
|
+
syntax: "<length>",
|
|
6244
|
+
inherits: false,
|
|
6245
|
+
initialValue: "0px"
|
|
6246
|
+
});
|
|
6247
|
+
} catch {}
|
|
6248
|
+
}
|
|
6249
|
+
scrollAreaOverflowVarsRegistered = true;
|
|
2663
6250
|
}
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
6251
|
+
function computeThumbPosition() {
|
|
6252
|
+
const viewportEl = viewportRef.value;
|
|
6253
|
+
const scrollbarYEl = scrollbarYRef.value;
|
|
6254
|
+
const scrollbarXEl = scrollbarXRef.value;
|
|
6255
|
+
const thumbYEl = thumbYRef.value;
|
|
6256
|
+
const thumbXEl = thumbXRef.value;
|
|
6257
|
+
const cornerEl = cornerRef.value;
|
|
6258
|
+
if (!viewportEl) return;
|
|
6259
|
+
const scrollableContentHeight = viewportEl.scrollHeight;
|
|
6260
|
+
const scrollableContentWidth = viewportEl.scrollWidth;
|
|
6261
|
+
const viewportHeight = viewportEl.clientHeight;
|
|
6262
|
+
const viewportWidth = viewportEl.clientWidth;
|
|
6263
|
+
const scrollTop = viewportEl.scrollTop;
|
|
6264
|
+
const scrollLeft = viewportEl.scrollLeft;
|
|
6265
|
+
const isFirstMeasurement = Number.isNaN(lastMeasuredViewportMetrics[0]);
|
|
6266
|
+
lastMeasuredViewportMetrics[0] = viewportHeight;
|
|
6267
|
+
lastMeasuredViewportMetrics[1] = scrollableContentHeight;
|
|
6268
|
+
lastMeasuredViewportMetrics[2] = viewportWidth;
|
|
6269
|
+
lastMeasuredViewportMetrics[3] = scrollableContentWidth;
|
|
6270
|
+
if (isFirstMeasurement) setHasMeasuredScrollbar(true);
|
|
6271
|
+
if (scrollableContentHeight === 0 || scrollableContentWidth === 0) return;
|
|
6272
|
+
const nextHiddenState = getHiddenState(viewportEl);
|
|
6273
|
+
const scrollbarYHidden = nextHiddenState.y;
|
|
6274
|
+
const scrollbarXHidden = nextHiddenState.x;
|
|
6275
|
+
const ratioX = viewportWidth / scrollableContentWidth;
|
|
6276
|
+
const ratioY = viewportHeight / scrollableContentHeight;
|
|
6277
|
+
const maxScrollLeft = Math.max(0, scrollableContentWidth - viewportWidth);
|
|
6278
|
+
const maxScrollTop = Math.max(0, scrollableContentHeight - viewportHeight);
|
|
6279
|
+
let scrollLeftFromStart = 0;
|
|
6280
|
+
let scrollLeftFromEnd = 0;
|
|
6281
|
+
if (!scrollbarXHidden) {
|
|
6282
|
+
let rawScrollLeftFromStart = 0;
|
|
6283
|
+
if (direction.value === "rtl") rawScrollLeftFromStart = scrollLeft < 0 ? -scrollLeft : maxScrollLeft - scrollLeft;
|
|
6284
|
+
else rawScrollLeftFromStart = scrollLeft;
|
|
6285
|
+
rawScrollLeftFromStart = require_control_SliderControl.clamp(rawScrollLeftFromStart, 0, maxScrollLeft);
|
|
6286
|
+
scrollLeftFromStart = normalizeScrollOffset(rawScrollLeftFromStart, maxScrollLeft);
|
|
6287
|
+
scrollLeftFromEnd = maxScrollLeft - scrollLeftFromStart;
|
|
6288
|
+
}
|
|
6289
|
+
const rawScrollTopFromStart = !scrollbarYHidden ? require_control_SliderControl.clamp(scrollTop, 0, maxScrollTop) : 0;
|
|
6290
|
+
const scrollTopFromStart = !scrollbarYHidden ? normalizeScrollOffset(rawScrollTopFromStart, maxScrollTop) : 0;
|
|
6291
|
+
const scrollTopFromEnd = !scrollbarYHidden ? maxScrollTop - scrollTopFromStart : 0;
|
|
6292
|
+
const nextWidth = scrollbarXHidden ? 0 : viewportWidth;
|
|
6293
|
+
const nextHeight = scrollbarYHidden ? 0 : viewportHeight;
|
|
6294
|
+
let nextCornerWidth = 0;
|
|
6295
|
+
let nextCornerHeight = 0;
|
|
6296
|
+
if (!scrollbarXHidden && !scrollbarYHidden) {
|
|
6297
|
+
nextCornerWidth = scrollbarYEl?.offsetWidth || 0;
|
|
6298
|
+
nextCornerHeight = scrollbarXEl?.offsetHeight || 0;
|
|
6299
|
+
}
|
|
6300
|
+
const cornerNotYetSized = cornerSize.value.width === 0 && cornerSize.value.height === 0;
|
|
6301
|
+
const cornerWidthOffset = cornerNotYetSized ? nextCornerWidth : 0;
|
|
6302
|
+
const cornerHeightOffset = cornerNotYetSized ? nextCornerHeight : 0;
|
|
6303
|
+
const scrollbarXOffset = getOffset(scrollbarXEl, "padding", "x");
|
|
6304
|
+
const scrollbarYOffset = getOffset(scrollbarYEl, "padding", "y");
|
|
6305
|
+
const thumbXOffset = getOffset(thumbXEl, "margin", "x");
|
|
6306
|
+
const thumbYOffset = getOffset(thumbYEl, "margin", "y");
|
|
6307
|
+
const idealNextWidth = nextWidth - scrollbarXOffset - thumbXOffset;
|
|
6308
|
+
const idealNextHeight = nextHeight - scrollbarYOffset - thumbYOffset;
|
|
6309
|
+
const maxNextWidth = scrollbarXEl ? Math.min(scrollbarXEl.offsetWidth - cornerWidthOffset, idealNextWidth) : idealNextWidth;
|
|
6310
|
+
const maxNextHeight = scrollbarYEl ? Math.min(scrollbarYEl.offsetHeight - cornerHeightOffset, idealNextHeight) : idealNextHeight;
|
|
6311
|
+
const clampedNextWidth = Math.max(MIN_THUMB_SIZE, maxNextWidth * ratioX);
|
|
6312
|
+
const clampedNextHeight = Math.max(MIN_THUMB_SIZE, maxNextHeight * ratioY);
|
|
6313
|
+
setThumbSize({
|
|
6314
|
+
width: clampedNextWidth,
|
|
6315
|
+
height: clampedNextHeight
|
|
6316
|
+
});
|
|
6317
|
+
if (scrollbarYEl && thumbYEl) {
|
|
6318
|
+
const maxThumbOffsetY = scrollbarYEl.offsetHeight - clampedNextHeight - scrollbarYOffset - thumbYOffset;
|
|
6319
|
+
const scrollRangeY = scrollableContentHeight - viewportHeight;
|
|
6320
|
+
const scrollRatioY = scrollRangeY === 0 ? 0 : scrollTop / scrollRangeY;
|
|
6321
|
+
const thumbOffsetY = Math.min(maxThumbOffsetY, Math.max(0, scrollRatioY * maxThumbOffsetY));
|
|
6322
|
+
thumbYEl.style.transform = `translate3d(0,${thumbOffsetY}px,0)`;
|
|
6323
|
+
}
|
|
6324
|
+
if (scrollbarXEl && thumbXEl) {
|
|
6325
|
+
const maxThumbOffsetX = scrollbarXEl.offsetWidth - clampedNextWidth - scrollbarXOffset - thumbXOffset;
|
|
6326
|
+
const scrollRangeX = scrollableContentWidth - viewportWidth;
|
|
6327
|
+
const scrollRatioX = scrollRangeX === 0 ? 0 : scrollLeftFromStart / scrollRangeX;
|
|
6328
|
+
const thumbOffsetX = direction.value === "rtl" ? -require_control_SliderControl.clamp(scrollRatioX * maxThumbOffsetX, 0, maxThumbOffsetX) : require_control_SliderControl.clamp(scrollRatioX * maxThumbOffsetX, 0, maxThumbOffsetX);
|
|
6329
|
+
thumbXEl.style.transform = `translate3d(${thumbOffsetX}px,0,0)`;
|
|
6330
|
+
}
|
|
6331
|
+
const overflowMetricsPx = [
|
|
6332
|
+
[ScrollAreaViewportCssVars.scrollAreaOverflowXStart, scrollLeftFromStart],
|
|
6333
|
+
[ScrollAreaViewportCssVars.scrollAreaOverflowXEnd, scrollLeftFromEnd],
|
|
6334
|
+
[ScrollAreaViewportCssVars.scrollAreaOverflowYStart, scrollTopFromStart],
|
|
6335
|
+
[ScrollAreaViewportCssVars.scrollAreaOverflowYEnd, scrollTopFromEnd]
|
|
6336
|
+
];
|
|
6337
|
+
for (const [cssVar, value] of overflowMetricsPx) viewportEl.style.setProperty(cssVar, `${value}px`);
|
|
6338
|
+
if (cornerEl) if (scrollbarXHidden || scrollbarYHidden) setCornerSize({
|
|
6339
|
+
width: 0,
|
|
6340
|
+
height: 0
|
|
6341
|
+
});
|
|
6342
|
+
else setCornerSize({
|
|
6343
|
+
width: nextCornerWidth,
|
|
6344
|
+
height: nextCornerHeight
|
|
6345
|
+
});
|
|
6346
|
+
setHiddenState(mergeHiddenState(hiddenState.value, nextHiddenState));
|
|
6347
|
+
const threshold = overflowEdgeThreshold.value;
|
|
6348
|
+
const nextOverflowEdges = {
|
|
6349
|
+
xStart: !scrollbarXHidden && scrollLeftFromStart > threshold.xStart,
|
|
6350
|
+
xEnd: !scrollbarXHidden && scrollLeftFromEnd > threshold.xEnd,
|
|
6351
|
+
yStart: !scrollbarYHidden && scrollTopFromStart > threshold.yStart,
|
|
6352
|
+
yEnd: !scrollbarYHidden && scrollTopFromEnd > threshold.yEnd
|
|
6353
|
+
};
|
|
6354
|
+
const prev = overflowEdges.value;
|
|
6355
|
+
if (prev.xStart !== nextOverflowEdges.xStart || prev.xEnd !== nextOverflowEdges.xEnd || prev.yStart !== nextOverflowEdges.yStart || prev.yEnd !== nextOverflowEdges.yEnd) setOverflowEdges(nextOverflowEdges);
|
|
6356
|
+
}
|
|
6357
|
+
function handleUserInteraction() {
|
|
6358
|
+
programmaticScroll = false;
|
|
6359
|
+
}
|
|
6360
|
+
function onScroll() {
|
|
6361
|
+
if (!viewportRef.value) return;
|
|
6362
|
+
computeThumbPosition();
|
|
6363
|
+
if (!programmaticScroll) handleScroll({
|
|
6364
|
+
x: viewportRef.value.scrollLeft,
|
|
6365
|
+
y: viewportRef.value.scrollTop
|
|
6366
|
+
});
|
|
6367
|
+
clearTimeout(scrollEndTimeoutId);
|
|
6368
|
+
scrollEndTimeoutId = setTimeout(() => {
|
|
6369
|
+
programmaticScroll = true;
|
|
6370
|
+
}, 100);
|
|
6371
|
+
}
|
|
6372
|
+
const viewportState = (0, vue.computed)(() => ({
|
|
6373
|
+
scrolling: scrollingX.value || scrollingY.value,
|
|
6374
|
+
hasOverflowX: !hiddenState.value.x,
|
|
6375
|
+
hasOverflowY: !hiddenState.value.y,
|
|
6376
|
+
overflowXStart: overflowEdges.value.xStart,
|
|
6377
|
+
overflowXEnd: overflowEdges.value.xEnd,
|
|
6378
|
+
overflowYStart: overflowEdges.value.yStart,
|
|
6379
|
+
overflowYEnd: overflowEdges.value.yEnd,
|
|
6380
|
+
cornerHidden: hiddenState.value.corner
|
|
6381
|
+
}));
|
|
6382
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
2672
6383
|
componentProps: props,
|
|
2673
|
-
state,
|
|
2674
|
-
props: (0, vue.computed)(() => ({
|
|
2675
|
-
|
|
2676
|
-
"
|
|
6384
|
+
state: viewportState,
|
|
6385
|
+
props: (0, vue.computed)(() => require_button_Button.mergeProps(attrs, {
|
|
6386
|
+
role: "presentation",
|
|
6387
|
+
...rootId ? { "data-id": `${rootId}-viewport` } : {},
|
|
6388
|
+
tabindex: hiddenState.value.x && hiddenState.value.y ? -1 : 0,
|
|
6389
|
+
class: styleDisableScrollbar.className,
|
|
6390
|
+
style: { overflow: "scroll" },
|
|
6391
|
+
onScroll,
|
|
6392
|
+
onWheel: handleUserInteraction,
|
|
6393
|
+
onTouchmove: handleUserInteraction,
|
|
6394
|
+
onPointermove: handleUserInteraction,
|
|
6395
|
+
onPointerenter: handleUserInteraction,
|
|
6396
|
+
onKeydown: handleUserInteraction
|
|
2677
6397
|
})),
|
|
2678
|
-
|
|
6398
|
+
stateAttributesMapping: require_content_ScrollAreaContent.scrollAreaStateAttributesMapping,
|
|
6399
|
+
defaultTagName: "div",
|
|
6400
|
+
ref: viewportRef
|
|
2679
6401
|
});
|
|
6402
|
+
(0, vue.onMounted)(() => {
|
|
6403
|
+
removeCSSVariableInheritance();
|
|
6404
|
+
if (viewportRef.value?.matches(":hover")) setHovering(true);
|
|
6405
|
+
queueMicrotask(computeThumbPosition);
|
|
6406
|
+
const viewport = viewportRef.value;
|
|
6407
|
+
if (typeof ResizeObserver !== "undefined" && viewport) {
|
|
6408
|
+
let hasInitialized = false;
|
|
6409
|
+
resizeObserver = new ResizeObserver(() => {
|
|
6410
|
+
if (!hasInitialized) {
|
|
6411
|
+
hasInitialized = true;
|
|
6412
|
+
if (lastMeasuredViewportMetrics[0] === viewport.clientHeight && lastMeasuredViewportMetrics[1] === viewport.scrollHeight && lastMeasuredViewportMetrics[2] === viewport.clientWidth && lastMeasuredViewportMetrics[3] === viewport.scrollWidth) return;
|
|
6413
|
+
}
|
|
6414
|
+
computeThumbPosition();
|
|
6415
|
+
});
|
|
6416
|
+
resizeObserver.observe(viewport);
|
|
6417
|
+
waitForAnimationsTimeoutId = setTimeout(() => {
|
|
6418
|
+
const animations = viewport.getAnimations({ subtree: true });
|
|
6419
|
+
if (animations.length === 0) return;
|
|
6420
|
+
Promise.allSettled(animations.map((a) => a.finished)).then(computeThumbPosition);
|
|
6421
|
+
}, 0);
|
|
6422
|
+
}
|
|
6423
|
+
});
|
|
6424
|
+
(0, vue.watch)([hiddenState, direction], () => {
|
|
6425
|
+
queueMicrotask(computeThumbPosition);
|
|
6426
|
+
});
|
|
6427
|
+
(0, vue.watch)(overflowEdgeThreshold, computeThumbPosition);
|
|
6428
|
+
(0, vue.onBeforeUnmount)(() => {
|
|
6429
|
+
resizeObserver?.disconnect();
|
|
6430
|
+
clearTimeout(scrollEndTimeoutId);
|
|
6431
|
+
clearTimeout(waitForAnimationsTimeoutId);
|
|
6432
|
+
});
|
|
6433
|
+
(0, vue.provide)(require_content_ScrollAreaContent.scrollAreaViewportContextKey, { computeThumbPosition });
|
|
6434
|
+
function getHiddenState(viewport) {
|
|
6435
|
+
const y = viewport.clientHeight >= viewport.scrollHeight;
|
|
6436
|
+
const x = viewport.clientWidth >= viewport.scrollWidth;
|
|
6437
|
+
return {
|
|
6438
|
+
y,
|
|
6439
|
+
x,
|
|
6440
|
+
corner: y || x
|
|
6441
|
+
};
|
|
6442
|
+
}
|
|
6443
|
+
function mergeHiddenState(prevState, nextState) {
|
|
6444
|
+
if (prevState.y === nextState.y && prevState.x === nextState.x && prevState.corner === nextState.corner) return prevState;
|
|
6445
|
+
return nextState;
|
|
6446
|
+
}
|
|
2680
6447
|
return (_ctx, _cache) => {
|
|
2681
6448
|
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
2682
6449
|
key: 0,
|
|
6450
|
+
ref: (0, vue.unref)(renderRef),
|
|
2683
6451
|
props: (0, vue.unref)(mergedProps),
|
|
2684
|
-
state:
|
|
2685
|
-
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.
|
|
2686
|
-
|
|
6452
|
+
state: viewportState.value
|
|
6453
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
6454
|
+
key: 1,
|
|
6455
|
+
ref: (0, vue.unref)(renderRef)
|
|
6456
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
6457
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
2687
6458
|
_: 3
|
|
2688
6459
|
}, 16));
|
|
2689
6460
|
};
|
|
@@ -2691,8 +6462,21 @@ var FieldsetRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (
|
|
|
2691
6462
|
});
|
|
2692
6463
|
|
|
2693
6464
|
//#endregion
|
|
2694
|
-
//#region src/
|
|
2695
|
-
var
|
|
6465
|
+
//#region src/scroll-area/viewport/ScrollAreaViewport.vue
|
|
6466
|
+
var ScrollAreaViewport_default = ScrollAreaViewport_vue_vue_type_script_setup_true_lang_default;
|
|
6467
|
+
|
|
6468
|
+
//#endregion
|
|
6469
|
+
//#region src/scroll-area/viewport/ScrollAreaViewportDataAttributes.ts
|
|
6470
|
+
let ScrollAreaViewportDataAttributes = /* @__PURE__ */ function(ScrollAreaViewportDataAttributes) {
|
|
6471
|
+
ScrollAreaViewportDataAttributes["scrolling"] = "data-scrolling";
|
|
6472
|
+
ScrollAreaViewportDataAttributes["hasOverflowX"] = "data-has-overflow-x";
|
|
6473
|
+
ScrollAreaViewportDataAttributes["hasOverflowY"] = "data-has-overflow-y";
|
|
6474
|
+
ScrollAreaViewportDataAttributes["overflowXStart"] = "data-overflow-x-start";
|
|
6475
|
+
ScrollAreaViewportDataAttributes["overflowXEnd"] = "data-overflow-x-end";
|
|
6476
|
+
ScrollAreaViewportDataAttributes["overflowYStart"] = "data-overflow-y-start";
|
|
6477
|
+
ScrollAreaViewportDataAttributes["overflowYEnd"] = "data-overflow-y-end";
|
|
6478
|
+
return ScrollAreaViewportDataAttributes;
|
|
6479
|
+
}({});
|
|
2696
6480
|
|
|
2697
6481
|
//#endregion
|
|
2698
6482
|
//#region src/separator/Separator.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -2781,13 +6565,6 @@ let SeparatorDataAttributes = /* @__PURE__ */ function(SeparatorDataAttributes)
|
|
|
2781
6565
|
return SeparatorDataAttributes;
|
|
2782
6566
|
}({});
|
|
2783
6567
|
|
|
2784
|
-
//#endregion
|
|
2785
|
-
//#region src/utils/valueToPercent.ts
|
|
2786
|
-
function valueToPercent(value, min, max) {
|
|
2787
|
-
if (max === min) return 0;
|
|
2788
|
-
return (value - min) * 100 / (max - min);
|
|
2789
|
-
}
|
|
2790
|
-
|
|
2791
6568
|
//#endregion
|
|
2792
6569
|
//#region src/slider/indicator/SliderIndicator.vue?vue&type=script&setup=true&lang.ts
|
|
2793
6570
|
/**
|
|
@@ -3438,12 +7215,6 @@ let SliderRootDataAttributes = /* @__PURE__ */ function(SliderRootDataAttributes
|
|
|
3438
7215
|
return SliderRootDataAttributes;
|
|
3439
7216
|
}({});
|
|
3440
7217
|
|
|
3441
|
-
//#endregion
|
|
3442
|
-
//#region src/utils/formatNumber.ts
|
|
3443
|
-
function formatNumber(value, locale, options) {
|
|
3444
|
-
return new Intl.NumberFormat(locale, options).format(value);
|
|
3445
|
-
}
|
|
3446
|
-
|
|
3447
7218
|
//#endregion
|
|
3448
7219
|
//#region src/slider/thumb/prehydrationScript.min.ts
|
|
3449
7220
|
const script = "(function prehydration() {\n const firstThumb = document.currentScript?.parentElement\n if (!firstThumb) {\n return\n }\n\n const control = firstThumb.closest('[data-base-ui-slider-control]')\n if (!control) {\n return\n }\n\n const indicator = control.querySelector('[data-base-ui-slider-indicator]')\n const controlRect = control.getBoundingClientRect()\n const vertical = control.getAttribute('data-orientation') === 'vertical'\n const side = vertical ? 'height' : 'width'\n const inputElems = control.querySelectorAll('input[type=\"range\"]')\n const range = inputElems.length > 1\n const lastIndex = inputElems.length - 1\n\n let startPosition = null\n let relativeSize = null\n\n for (let i = 0; i < inputElems.length; i += 1) {\n const input = inputElems[i]\n\n const value = Number.parseFloat(input.getAttribute('value') ?? '')\n\n if (Number.isNaN(value)) {\n return\n }\n\n const thumb = input.parentElement\n if (!thumb) {\n return\n }\n\n const max = Number.parseFloat(input.getAttribute('max') ?? '100')\n const min = Number.parseFloat(input.getAttribute('min') ?? '0')\n\n const thumbRect = thumb?.getBoundingClientRect()\n\n const controlSize = controlRect[side] - thumbRect[side]\n const thumbValuePercent = max === min ? 0 : ((value - min) * 100) / (max - min)\n const thumbOffsetFromControlEdge\n = thumbRect[side] / 2 + (controlSize * thumbValuePercent) / 100\n const percent = (thumbOffsetFromControlEdge / controlRect[side]) * 100\n\n if (Number.isFinite(percent)) {\n thumb.style.setProperty(`--position`, `${percent}%`)\n thumb.style.removeProperty('visibility')\n\n if (indicator) {\n if (i === 0) {\n startPosition = percent\n indicator.style.setProperty('--start-position', `${percent}%`)\n if (!range) {\n indicator.style.removeProperty('visibility')\n }\n }\n else if (i === lastIndex) {\n relativeSize = percent - (startPosition ?? 0)\n indicator.style.setProperty('--end-position', `${percent}%`)\n indicator.style.setProperty('--relative-size', `${relativeSize}%`)\n indicator.style.removeProperty('visibility')\n }\n }\n }\n }\n})()";
|
|
@@ -3573,10 +7344,10 @@ var SliderThumb_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0
|
|
|
3573
7344
|
function getDefaultAriaValueText(values, index, format, locale) {
|
|
3574
7345
|
if (index < 0) return;
|
|
3575
7346
|
if (values.length === 2) {
|
|
3576
|
-
if (index === 0) return `${formatNumber(values[index], locale, format)} start range`;
|
|
3577
|
-
return `${formatNumber(values[index], locale, format)} end range`;
|
|
7347
|
+
if (index === 0) return `${require_decrement_NumberFieldDecrement.formatNumber(values[index], locale, format)} start range`;
|
|
7348
|
+
return `${require_decrement_NumberFieldDecrement.formatNumber(values[index], locale, format)} end range`;
|
|
3578
7349
|
}
|
|
3579
|
-
return format ? formatNumber(values[index], locale, format) : void 0;
|
|
7350
|
+
return format ? require_decrement_NumberFieldDecrement.formatNumber(values[index], locale, format) : void 0;
|
|
3580
7351
|
}
|
|
3581
7352
|
function getNewValue(thumbValue, step, direction, min, max) {
|
|
3582
7353
|
return direction === 1 ? Math.min(thumbValue + step, max) : Math.max(thumbValue - step, min);
|
|
@@ -3779,7 +7550,7 @@ var SliderThumb_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0
|
|
|
3779
7550
|
"aria-describedby": props.ariaDescribedby ?? inputValidationProps.value["aria-describedby"],
|
|
3780
7551
|
"aria-orientation": rootContext.orientation.value,
|
|
3781
7552
|
"aria-valuenow": thumbValue.value,
|
|
3782
|
-
"aria-valuetext": typeof props.getAriaValueText === "function" ? props.getAriaValueText(formatNumber(thumbValue.value, rootContext.locale.value, rootContext.formatOptionsRef.value), thumbValue.value, index.value) : getDefaultAriaValueText(rootContext.values.value, index.value, rootContext.formatOptionsRef.value, rootContext.locale.value),
|
|
7553
|
+
"aria-valuetext": typeof props.getAriaValueText === "function" ? props.getAriaValueText(require_decrement_NumberFieldDecrement.formatNumber(thumbValue.value, rootContext.locale.value, rootContext.formatOptionsRef.value), thumbValue.value, index.value) : getDefaultAriaValueText(rootContext.values.value, index.value, rootContext.formatOptionsRef.value, rootContext.locale.value),
|
|
3783
7554
|
"disabled": disabled.value,
|
|
3784
7555
|
"form": rootContext.form.value,
|
|
3785
7556
|
"id": inputId.value,
|
|
@@ -3992,7 +7763,7 @@ var SliderValue_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0
|
|
|
3992
7763
|
for (const thumbMetadata of rootContext.thumbMap.value.values()) if (thumbMetadata?.inputId) htmlFor += `${thumbMetadata.inputId} `;
|
|
3993
7764
|
return htmlFor.trim() === "" ? void 0 : htmlFor.trim();
|
|
3994
7765
|
});
|
|
3995
|
-
const formattedValues = (0, vue.computed)(() => rootContext.values.value.map((value) => formatNumber(value, rootContext.locale.value, rootContext.formatOptionsRef.value)));
|
|
7766
|
+
const formattedValues = (0, vue.computed)(() => rootContext.values.value.map((value) => require_decrement_NumberFieldDecrement.formatNumber(value, rootContext.locale.value, rootContext.formatOptionsRef.value)));
|
|
3996
7767
|
const defaultDisplayValue = (0, vue.computed)(() => rootContext.values.value.map((value, index) => formattedValues.value[index] || String(value)).join(" – "));
|
|
3997
7768
|
const valueProps = (0, vue.computed)(() => require_button_Button.mergeProps(attrs, {
|
|
3998
7769
|
"aria-live": props.ariaLive,
|
|
@@ -5793,6 +9564,180 @@ Object.defineProperty(exports, 'FieldsetRoot_default', {
|
|
|
5793
9564
|
return FieldsetRoot_default;
|
|
5794
9565
|
}
|
|
5795
9566
|
});
|
|
9567
|
+
Object.defineProperty(exports, 'InputDataAttributes', {
|
|
9568
|
+
enumerable: true,
|
|
9569
|
+
get: function () {
|
|
9570
|
+
return InputDataAttributes;
|
|
9571
|
+
}
|
|
9572
|
+
});
|
|
9573
|
+
Object.defineProperty(exports, 'Input_default', {
|
|
9574
|
+
enumerable: true,
|
|
9575
|
+
get: function () {
|
|
9576
|
+
return Input_default;
|
|
9577
|
+
}
|
|
9578
|
+
});
|
|
9579
|
+
Object.defineProperty(exports, 'MeterIndicator_default', {
|
|
9580
|
+
enumerable: true,
|
|
9581
|
+
get: function () {
|
|
9582
|
+
return MeterIndicator_default;
|
|
9583
|
+
}
|
|
9584
|
+
});
|
|
9585
|
+
Object.defineProperty(exports, 'MeterLabel_default', {
|
|
9586
|
+
enumerable: true,
|
|
9587
|
+
get: function () {
|
|
9588
|
+
return MeterLabel_default;
|
|
9589
|
+
}
|
|
9590
|
+
});
|
|
9591
|
+
Object.defineProperty(exports, 'MeterRoot_default', {
|
|
9592
|
+
enumerable: true,
|
|
9593
|
+
get: function () {
|
|
9594
|
+
return MeterRoot_default;
|
|
9595
|
+
}
|
|
9596
|
+
});
|
|
9597
|
+
Object.defineProperty(exports, 'MeterTrack_default', {
|
|
9598
|
+
enumerable: true,
|
|
9599
|
+
get: function () {
|
|
9600
|
+
return MeterTrack_default;
|
|
9601
|
+
}
|
|
9602
|
+
});
|
|
9603
|
+
Object.defineProperty(exports, 'MeterValue_default', {
|
|
9604
|
+
enumerable: true,
|
|
9605
|
+
get: function () {
|
|
9606
|
+
return MeterValue_default;
|
|
9607
|
+
}
|
|
9608
|
+
});
|
|
9609
|
+
Object.defineProperty(exports, 'NumberFieldInput_default', {
|
|
9610
|
+
enumerable: true,
|
|
9611
|
+
get: function () {
|
|
9612
|
+
return NumberFieldInput_default;
|
|
9613
|
+
}
|
|
9614
|
+
});
|
|
9615
|
+
Object.defineProperty(exports, 'NumberFieldRoot_default', {
|
|
9616
|
+
enumerable: true,
|
|
9617
|
+
get: function () {
|
|
9618
|
+
return NumberFieldRoot_default;
|
|
9619
|
+
}
|
|
9620
|
+
});
|
|
9621
|
+
Object.defineProperty(exports, 'NumberFieldScrubAreaCursor_default', {
|
|
9622
|
+
enumerable: true,
|
|
9623
|
+
get: function () {
|
|
9624
|
+
return NumberFieldScrubAreaCursor_default;
|
|
9625
|
+
}
|
|
9626
|
+
});
|
|
9627
|
+
Object.defineProperty(exports, 'NumberFieldScrubArea_default', {
|
|
9628
|
+
enumerable: true,
|
|
9629
|
+
get: function () {
|
|
9630
|
+
return NumberFieldScrubArea_default;
|
|
9631
|
+
}
|
|
9632
|
+
});
|
|
9633
|
+
Object.defineProperty(exports, 'OtpFieldInput_default', {
|
|
9634
|
+
enumerable: true,
|
|
9635
|
+
get: function () {
|
|
9636
|
+
return OtpFieldInput_default;
|
|
9637
|
+
}
|
|
9638
|
+
});
|
|
9639
|
+
Object.defineProperty(exports, 'OtpFieldRoot_default', {
|
|
9640
|
+
enumerable: true,
|
|
9641
|
+
get: function () {
|
|
9642
|
+
return OtpFieldRoot_default;
|
|
9643
|
+
}
|
|
9644
|
+
});
|
|
9645
|
+
Object.defineProperty(exports, 'ProgressIndicator_default', {
|
|
9646
|
+
enumerable: true,
|
|
9647
|
+
get: function () {
|
|
9648
|
+
return ProgressIndicator_default;
|
|
9649
|
+
}
|
|
9650
|
+
});
|
|
9651
|
+
Object.defineProperty(exports, 'ProgressLabel_default', {
|
|
9652
|
+
enumerable: true,
|
|
9653
|
+
get: function () {
|
|
9654
|
+
return ProgressLabel_default;
|
|
9655
|
+
}
|
|
9656
|
+
});
|
|
9657
|
+
Object.defineProperty(exports, 'ProgressRootDataAttributes', {
|
|
9658
|
+
enumerable: true,
|
|
9659
|
+
get: function () {
|
|
9660
|
+
return ProgressRootDataAttributes;
|
|
9661
|
+
}
|
|
9662
|
+
});
|
|
9663
|
+
Object.defineProperty(exports, 'ProgressRoot_default', {
|
|
9664
|
+
enumerable: true,
|
|
9665
|
+
get: function () {
|
|
9666
|
+
return ProgressRoot_default;
|
|
9667
|
+
}
|
|
9668
|
+
});
|
|
9669
|
+
Object.defineProperty(exports, 'ProgressTrack_default', {
|
|
9670
|
+
enumerable: true,
|
|
9671
|
+
get: function () {
|
|
9672
|
+
return ProgressTrack_default;
|
|
9673
|
+
}
|
|
9674
|
+
});
|
|
9675
|
+
Object.defineProperty(exports, 'ProgressValue_default', {
|
|
9676
|
+
enumerable: true,
|
|
9677
|
+
get: function () {
|
|
9678
|
+
return ProgressValue_default;
|
|
9679
|
+
}
|
|
9680
|
+
});
|
|
9681
|
+
Object.defineProperty(exports, 'ScrollAreaRootCssVars', {
|
|
9682
|
+
enumerable: true,
|
|
9683
|
+
get: function () {
|
|
9684
|
+
return ScrollAreaRootCssVars;
|
|
9685
|
+
}
|
|
9686
|
+
});
|
|
9687
|
+
Object.defineProperty(exports, 'ScrollAreaRoot_default', {
|
|
9688
|
+
enumerable: true,
|
|
9689
|
+
get: function () {
|
|
9690
|
+
return ScrollAreaRoot_default;
|
|
9691
|
+
}
|
|
9692
|
+
});
|
|
9693
|
+
Object.defineProperty(exports, 'ScrollAreaScrollbarCssVars', {
|
|
9694
|
+
enumerable: true,
|
|
9695
|
+
get: function () {
|
|
9696
|
+
return ScrollAreaScrollbarCssVars;
|
|
9697
|
+
}
|
|
9698
|
+
});
|
|
9699
|
+
Object.defineProperty(exports, 'ScrollAreaScrollbarDataAttributes', {
|
|
9700
|
+
enumerable: true,
|
|
9701
|
+
get: function () {
|
|
9702
|
+
return ScrollAreaScrollbarDataAttributes;
|
|
9703
|
+
}
|
|
9704
|
+
});
|
|
9705
|
+
Object.defineProperty(exports, 'ScrollAreaScrollbar_default', {
|
|
9706
|
+
enumerable: true,
|
|
9707
|
+
get: function () {
|
|
9708
|
+
return ScrollAreaScrollbar_default;
|
|
9709
|
+
}
|
|
9710
|
+
});
|
|
9711
|
+
Object.defineProperty(exports, 'ScrollAreaThumbDataAttributes', {
|
|
9712
|
+
enumerable: true,
|
|
9713
|
+
get: function () {
|
|
9714
|
+
return ScrollAreaThumbDataAttributes;
|
|
9715
|
+
}
|
|
9716
|
+
});
|
|
9717
|
+
Object.defineProperty(exports, 'ScrollAreaThumb_default', {
|
|
9718
|
+
enumerable: true,
|
|
9719
|
+
get: function () {
|
|
9720
|
+
return ScrollAreaThumb_default;
|
|
9721
|
+
}
|
|
9722
|
+
});
|
|
9723
|
+
Object.defineProperty(exports, 'ScrollAreaViewportCssVars', {
|
|
9724
|
+
enumerable: true,
|
|
9725
|
+
get: function () {
|
|
9726
|
+
return ScrollAreaViewportCssVars;
|
|
9727
|
+
}
|
|
9728
|
+
});
|
|
9729
|
+
Object.defineProperty(exports, 'ScrollAreaViewportDataAttributes', {
|
|
9730
|
+
enumerable: true,
|
|
9731
|
+
get: function () {
|
|
9732
|
+
return ScrollAreaViewportDataAttributes;
|
|
9733
|
+
}
|
|
9734
|
+
});
|
|
9735
|
+
Object.defineProperty(exports, 'ScrollAreaViewport_default', {
|
|
9736
|
+
enumerable: true,
|
|
9737
|
+
get: function () {
|
|
9738
|
+
return ScrollAreaViewport_default;
|
|
9739
|
+
}
|
|
9740
|
+
});
|
|
5796
9741
|
Object.defineProperty(exports, 'SeparatorDataAttributes', {
|
|
5797
9742
|
enumerable: true,
|
|
5798
9743
|
get: function () {
|
|
@@ -5985,12 +9930,48 @@ Object.defineProperty(exports, 'fieldsetRootContextKey', {
|
|
|
5985
9930
|
return fieldsetRootContextKey;
|
|
5986
9931
|
}
|
|
5987
9932
|
});
|
|
9933
|
+
Object.defineProperty(exports, 'getOtpFieldInputState', {
|
|
9934
|
+
enumerable: true,
|
|
9935
|
+
get: function () {
|
|
9936
|
+
return getOtpFieldInputState;
|
|
9937
|
+
}
|
|
9938
|
+
});
|
|
9939
|
+
Object.defineProperty(exports, 'meterRootContextKey', {
|
|
9940
|
+
enumerable: true,
|
|
9941
|
+
get: function () {
|
|
9942
|
+
return meterRootContextKey;
|
|
9943
|
+
}
|
|
9944
|
+
});
|
|
5988
9945
|
Object.defineProperty(exports, 'name', {
|
|
5989
9946
|
enumerable: true,
|
|
5990
9947
|
get: function () {
|
|
5991
9948
|
return name;
|
|
5992
9949
|
}
|
|
5993
9950
|
});
|
|
9951
|
+
Object.defineProperty(exports, 'numberFieldScrubAreaContextKey', {
|
|
9952
|
+
enumerable: true,
|
|
9953
|
+
get: function () {
|
|
9954
|
+
return numberFieldScrubAreaContextKey;
|
|
9955
|
+
}
|
|
9956
|
+
});
|
|
9957
|
+
Object.defineProperty(exports, 'otpFieldRootContextKey', {
|
|
9958
|
+
enumerable: true,
|
|
9959
|
+
get: function () {
|
|
9960
|
+
return otpFieldRootContextKey;
|
|
9961
|
+
}
|
|
9962
|
+
});
|
|
9963
|
+
Object.defineProperty(exports, 'progressRootContextKey', {
|
|
9964
|
+
enumerable: true,
|
|
9965
|
+
get: function () {
|
|
9966
|
+
return progressRootContextKey;
|
|
9967
|
+
}
|
|
9968
|
+
});
|
|
9969
|
+
Object.defineProperty(exports, 'progressStateAttributesMapping', {
|
|
9970
|
+
enumerable: true,
|
|
9971
|
+
get: function () {
|
|
9972
|
+
return progressStateAttributesMapping;
|
|
9973
|
+
}
|
|
9974
|
+
});
|
|
5994
9975
|
Object.defineProperty(exports, 'switchRootContextKey', {
|
|
5995
9976
|
enumerable: true,
|
|
5996
9977
|
get: function () {
|
|
@@ -6021,6 +10002,30 @@ Object.defineProperty(exports, 'useFieldsetRootContext', {
|
|
|
6021
10002
|
return useFieldsetRootContext;
|
|
6022
10003
|
}
|
|
6023
10004
|
});
|
|
10005
|
+
Object.defineProperty(exports, 'useMeterRootContext', {
|
|
10006
|
+
enumerable: true,
|
|
10007
|
+
get: function () {
|
|
10008
|
+
return useMeterRootContext;
|
|
10009
|
+
}
|
|
10010
|
+
});
|
|
10011
|
+
Object.defineProperty(exports, 'useNumberFieldScrubAreaContext', {
|
|
10012
|
+
enumerable: true,
|
|
10013
|
+
get: function () {
|
|
10014
|
+
return useNumberFieldScrubAreaContext;
|
|
10015
|
+
}
|
|
10016
|
+
});
|
|
10017
|
+
Object.defineProperty(exports, 'useOtpFieldRootContext', {
|
|
10018
|
+
enumerable: true,
|
|
10019
|
+
get: function () {
|
|
10020
|
+
return useOtpFieldRootContext;
|
|
10021
|
+
}
|
|
10022
|
+
});
|
|
10023
|
+
Object.defineProperty(exports, 'useProgressRootContext', {
|
|
10024
|
+
enumerable: true,
|
|
10025
|
+
get: function () {
|
|
10026
|
+
return useProgressRootContext;
|
|
10027
|
+
}
|
|
10028
|
+
});
|
|
6024
10029
|
Object.defineProperty(exports, 'useRender', {
|
|
6025
10030
|
enumerable: true,
|
|
6026
10031
|
get: function () {
|