@plasmicpkgs/react-aria 0.0.43 → 0.0.44
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/.tsbuildinfo +1 -1
- package/dist/contexts.d.ts +3 -1
- package/dist/react-aria.esm.js +226 -206
- package/dist/react-aria.esm.js.map +1 -1
- package/dist/react-aria.js +225 -205
- package/dist/react-aria.js.map +1 -1
- package/dist/registerSlider.d.ts +3 -20
- package/dist/registerSliderOutput.d.ts +1 -1
- package/dist/registerSliderThumb.d.ts +2 -2
- package/dist/registerSliderTrack.d.ts +3 -1
- package/package.json +2 -2
- package/skinny/contexts-3a98471a.cjs.js.map +1 -1
- package/skinny/contexts-87c261f6.esm.js.map +1 -1
- package/skinny/contexts.d.ts +3 -1
- package/skinny/registerSlider.cjs.js +305 -15
- package/skinny/registerSlider.cjs.js.map +1 -1
- package/skinny/registerSlider.d.ts +3 -20
- package/skinny/registerSlider.esm.js +303 -11
- package/skinny/registerSlider.esm.js.map +1 -1
- package/skinny/registerSliderOutput.cjs.js +1 -1
- package/skinny/registerSliderOutput.cjs.js.map +1 -1
- package/skinny/registerSliderOutput.d.ts +1 -1
- package/skinny/registerSliderOutput.esm.js +1 -1
- package/skinny/registerSliderOutput.esm.js.map +1 -1
- package/skinny/registerSliderThumb.cjs.js +1 -1
- package/skinny/registerSliderThumb.cjs.js.map +1 -1
- package/skinny/registerSliderThumb.d.ts +2 -2
- package/skinny/registerSliderThumb.esm.js +1 -1
- package/skinny/registerSliderThumb.esm.js.map +1 -1
- package/skinny/registerSliderTrack.cjs.js +188 -16
- package/skinny/registerSliderTrack.cjs.js.map +1 -1
- package/skinny/registerSliderTrack.d.ts +3 -1
- package/skinny/registerSliderTrack.esm.js +184 -13
- package/skinny/registerSliderTrack.esm.js.map +1 -1
- package/skinny/registerSlider-cd08b960.cjs.js +0 -473
- package/skinny/registerSlider-cd08b960.cjs.js.map +0 -1
- package/skinny/registerSlider-df0fdf82.esm.js +0 -460
- package/skinny/registerSlider-df0fdf82.esm.js.map +0 -1
package/dist/contexts.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { StrictItemType } from "./option-utils";
|
|
3
3
|
import type { BaseListBoxProps } from "./registerListBox";
|
|
4
|
+
import { BaseSlider } from "./registerSlider";
|
|
4
5
|
export declare const PlasmicTextFieldContext: React.Context<import("./registerTextField").BaseTextFieldProps | undefined>;
|
|
5
6
|
export declare const PlasmicCheckboxGroupContext: React.Context<import("./registerCheckboxGroup").BaseCheckboxGroupProps | undefined>;
|
|
6
7
|
export declare const PlasmicRadioGroupContext: React.Context<import("./registerRadioGroup").BaseRadioGroupProps | undefined>;
|
|
7
8
|
export declare const PlasmicDialogTriggerContext: React.Context<import("./registerDialogTrigger").BaseDialogTriggerProps | undefined>;
|
|
8
|
-
export
|
|
9
|
+
export type PlasmicSliderContextType<T extends number | number[]> = React.ComponentProps<typeof BaseSlider<T>> | undefined;
|
|
10
|
+
export declare const PlasmicSliderContext: React.Context<PlasmicSliderContextType<number | number[]>>;
|
|
9
11
|
export declare const PlasmicLabelContext: React.Context<(import("react-aria-components").LabelProps & React.RefAttributes<HTMLLabelElement>) | undefined>;
|
|
10
12
|
export declare const PlasmicListBoxContext: React.Context<BaseListBoxProps | undefined>;
|
|
11
13
|
export declare const PlasmicItemContext: React.Context<StrictItemType | undefined>;
|
package/dist/react-aria.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, Component, forwardRef, useImperativeHandle, useMemo
|
|
1
|
+
import React, { useEffect, Component, forwardRef, useImperativeHandle, useMemo } from 'react';
|
|
2
2
|
import { Button, Checkbox, Text, FieldError, Label, CheckboxGroup, Input, ListBoxItem, ListBox, Header, Section, Collection, PopoverContext, SelectContext, Popover, ComboBox, ComboBoxStateContext, Heading, ModalOverlay, Modal, Dialog, DialogTrigger, Form, Radio, RadioGroup, Select, SelectValue, SliderOutput, SliderThumb, Slider, SliderTrack, Switch, TextArea, TextField } from 'react-aria-components';
|
|
3
3
|
import registerComponent from '@plasmicapp/host/registerComponent';
|
|
4
4
|
import { useFilter } from '@react-aria/i18n';
|
|
@@ -3439,7 +3439,7 @@ function BaseSliderOutput(props) {
|
|
|
3439
3439
|
}
|
|
3440
3440
|
const SLIDER_OUTPUT_COMPONENT_NAME = makeComponentName("sliderOutput");
|
|
3441
3441
|
function registerSliderOutput(loader, overrides) {
|
|
3442
|
-
registerComponentHelper(
|
|
3442
|
+
return registerComponentHelper(
|
|
3443
3443
|
loader,
|
|
3444
3444
|
BaseSliderOutput,
|
|
3445
3445
|
{
|
|
@@ -3531,7 +3531,7 @@ function BaseSliderThumb(_a) {
|
|
|
3531
3531
|
}
|
|
3532
3532
|
const SLIDER_THUMB_COMPONENT_NAME = makeComponentName("sliderThumb");
|
|
3533
3533
|
function registerSliderThumb(loader, overrides) {
|
|
3534
|
-
registerComponentHelper(
|
|
3534
|
+
return registerComponentHelper(
|
|
3535
3535
|
loader,
|
|
3536
3536
|
BaseSliderThumb,
|
|
3537
3537
|
{
|
|
@@ -3603,52 +3603,59 @@ const { interactionVariants: interactionVariants$4, withObservedValues: withObse
|
|
|
3603
3603
|
SLIDER_TRACK_INTERACTION_VARIANTS
|
|
3604
3604
|
);
|
|
3605
3605
|
function findMinMaxIndices(values) {
|
|
3606
|
-
if (typeof values === "number" || (values == null ? void 0 : values.length) === 0 || !Array.isArray(values)) {
|
|
3607
|
-
return { minIndex: 0, maxIndex: 0 };
|
|
3608
|
-
}
|
|
3609
3606
|
let minIndex = 0;
|
|
3610
3607
|
let maxIndex = 0;
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
minIndex
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
maxIndex
|
|
3608
|
+
if (Array.isArray(values)) {
|
|
3609
|
+
for (let i = 1; i < values.length; i++) {
|
|
3610
|
+
if (values[i] < values[minIndex]) {
|
|
3611
|
+
minIndex = i;
|
|
3612
|
+
}
|
|
3613
|
+
if (values[i] > values[maxIndex]) {
|
|
3614
|
+
maxIndex = i;
|
|
3615
|
+
}
|
|
3617
3616
|
}
|
|
3618
3617
|
}
|
|
3619
3618
|
return { minIndex, maxIndex };
|
|
3620
3619
|
}
|
|
3620
|
+
function isMultiValueGuard(value) {
|
|
3621
|
+
return Array.isArray(value) && value.length > 1;
|
|
3622
|
+
}
|
|
3621
3623
|
function BaseSliderTrack(props) {
|
|
3622
3624
|
const context = React.useContext(PlasmicSliderContext);
|
|
3625
|
+
const isStandalone = !context;
|
|
3623
3626
|
const mergedProps = mergeProps(context, props);
|
|
3624
|
-
const _a = mergedProps, {
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
} = _a, rest = __objRest$5(_a, [
|
|
3630
|
-
"children",
|
|
3631
|
-
"progressBar",
|
|
3632
|
-
"updateInteractionVariant",
|
|
3633
|
-
"isMultiValue"
|
|
3634
|
-
]);
|
|
3635
|
-
const { minIndex, maxIndex } = useMemo(
|
|
3636
|
-
() => findMinMaxIndices(mergedProps.value),
|
|
3637
|
-
[mergedProps.value]
|
|
3638
|
-
);
|
|
3639
|
-
const thumbs = useMemo(() => {
|
|
3640
|
-
const rawThumbs = flattenChildren(children);
|
|
3641
|
-
const values = Array.isArray(mergedProps == null ? void 0 : mergedProps.value) ? mergedProps.value : [mergedProps.value].filter((v) => v !== void 0);
|
|
3642
|
-
const difference = values.length - rawThumbs.length;
|
|
3643
|
-
if (!difference) {
|
|
3644
|
-
return rawThumbs;
|
|
3627
|
+
const _a = mergedProps, { children, progressBar, updateInteractionVariant } = _a, rest = __objRest$5(_a, ["children", "progressBar", "updateInteractionVariant"]);
|
|
3628
|
+
const isMultiValue = isMultiValueGuard(mergedProps.value);
|
|
3629
|
+
const { minIndex, maxIndex } = useMemo(() => {
|
|
3630
|
+
if (!context || !Array.isArray(context.value) || context.value.length <= 1) {
|
|
3631
|
+
return { minIndex: 0, maxIndex: 0 };
|
|
3645
3632
|
}
|
|
3646
|
-
|
|
3647
|
-
|
|
3633
|
+
return findMinMaxIndices(context.value);
|
|
3634
|
+
}, [context == null ? void 0 : context.value]);
|
|
3635
|
+
const thumbs = useMemo(() => {
|
|
3636
|
+
const thumbNodes = flattenChildren(children);
|
|
3637
|
+
if (!thumbNodes || thumbNodes.length === 0 || !isDefined(context == null ? void 0 : context.value)) {
|
|
3638
|
+
return [];
|
|
3648
3639
|
}
|
|
3649
|
-
const
|
|
3650
|
-
|
|
3651
|
-
|
|
3640
|
+
const values = isDefined(context) ? Array.isArray(context.value) ? context.value : [context.value] : [];
|
|
3641
|
+
const lastThumb = thumbNodes[thumbNodes.length - 1];
|
|
3642
|
+
return values.map((v, i) => {
|
|
3643
|
+
const currentThumb = thumbNodes[i];
|
|
3644
|
+
if (i >= thumbNodes.length) {
|
|
3645
|
+
if (React.isValidElement(lastThumb)) {
|
|
3646
|
+
return React.cloneElement(lastThumb, {
|
|
3647
|
+
index: i
|
|
3648
|
+
});
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3651
|
+
if (!React.isValidElement(currentThumb)) {
|
|
3652
|
+
return null;
|
|
3653
|
+
}
|
|
3654
|
+
return React.cloneElement(currentThumb, {
|
|
3655
|
+
index: i
|
|
3656
|
+
});
|
|
3657
|
+
});
|
|
3658
|
+
}, [children, context == null ? void 0 : context.value]);
|
|
3652
3659
|
const track = /* @__PURE__ */ React.createElement(SliderTrack, __spreadValues$5({ style: { position: "relative" } }, rest), ({ state, isHovered }) => /* @__PURE__ */ React.createElement(React.Fragment, null, withObservedValues$3(
|
|
3653
3660
|
/* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
3654
3661
|
"div",
|
|
@@ -3662,28 +3669,20 @@ function BaseSliderTrack(props) {
|
|
|
3662
3669
|
}
|
|
3663
3670
|
},
|
|
3664
3671
|
progressBar
|
|
3665
|
-
), thumbs
|
|
3666
|
-
(thumb, i) => React.isValidElement(thumb) && React.cloneElement(thumb, {
|
|
3667
|
-
// sets the index of the thumb, so that each thumb reflects the correct value
|
|
3668
|
-
index: i
|
|
3669
|
-
})
|
|
3670
|
-
)),
|
|
3672
|
+
), thumbs),
|
|
3671
3673
|
{
|
|
3672
3674
|
hovered: isHovered
|
|
3673
3675
|
},
|
|
3674
3676
|
updateInteractionVariant
|
|
3675
3677
|
)));
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
},
|
|
3681
|
-
track
|
|
3682
|
-
);
|
|
3678
|
+
if (isStandalone) {
|
|
3679
|
+
return /* @__PURE__ */ React.createElement(Slider, { style: { height: "100%", width: "100%" } }, track);
|
|
3680
|
+
}
|
|
3681
|
+
return track;
|
|
3683
3682
|
}
|
|
3684
3683
|
const SLIDER_TRACK_COMPONENT_NAME = makeComponentName("sliderTrack");
|
|
3685
|
-
function registerSliderTrack(loader, overrides) {
|
|
3686
|
-
registerComponentHelper(
|
|
3684
|
+
function registerSliderTrack(sliderThumbMeta, loader, overrides) {
|
|
3685
|
+
return registerComponentHelper(
|
|
3687
3686
|
loader,
|
|
3688
3687
|
BaseSliderTrack,
|
|
3689
3688
|
{
|
|
@@ -3702,14 +3701,13 @@ function registerSliderTrack(loader, overrides) {
|
|
|
3702
3701
|
props: {
|
|
3703
3702
|
children: {
|
|
3704
3703
|
type: "slot",
|
|
3705
|
-
|
|
3704
|
+
displayName: "Thumbs",
|
|
3705
|
+
description: "The thumbs of the slider. For range slider, you can add more than one thumb.",
|
|
3706
|
+
allowedComponents: [sliderThumbMeta.name],
|
|
3706
3707
|
defaultValue: [
|
|
3707
3708
|
{
|
|
3708
3709
|
type: "component",
|
|
3709
|
-
name:
|
|
3710
|
-
SLIDER_COMPONENT_NAME,
|
|
3711
|
-
SLIDER_THUMB_COMPONENT_NAME
|
|
3712
|
-
)
|
|
3710
|
+
name: sliderThumbMeta.name
|
|
3713
3711
|
}
|
|
3714
3712
|
]
|
|
3715
3713
|
},
|
|
@@ -3779,106 +3777,101 @@ var __objRest$4 = (source, exclude) => {
|
|
|
3779
3777
|
return target;
|
|
3780
3778
|
};
|
|
3781
3779
|
const SLIDER_COMPONENT_NAME = makeComponentName("slider");
|
|
3780
|
+
const RANGE_SLIDER_COMPONENT_NAME = makeComponentName("range-slider");
|
|
3782
3781
|
const SLIDER_INTERACTION_VARIANTS = ["disabled"];
|
|
3783
3782
|
const { interactionVariants: interactionVariants$3, withObservedValues: withObservedValues$2 } = pickAriaComponentVariants(
|
|
3784
3783
|
SLIDER_INTERACTION_VARIANTS
|
|
3785
3784
|
);
|
|
3786
|
-
const sliderHelpers = {
|
|
3787
|
-
states: {
|
|
3788
|
-
range: {
|
|
3789
|
-
onChangeArgsToValue: (value, isMultiValue) => {
|
|
3790
|
-
if (isMultiValue) {
|
|
3791
|
-
return Array.isArray(value) ? value : [value, value + 10];
|
|
3792
|
-
}
|
|
3793
|
-
return void 0;
|
|
3794
|
-
}
|
|
3795
|
-
},
|
|
3796
|
-
value: {
|
|
3797
|
-
onChangeArgsToValue: (value, isMultiValue) => {
|
|
3798
|
-
if (isMultiValue) {
|
|
3799
|
-
return void 0;
|
|
3800
|
-
}
|
|
3801
|
-
return Array.isArray(value) ? value[0] : value;
|
|
3802
|
-
}
|
|
3803
|
-
}
|
|
3804
|
-
}
|
|
3805
|
-
};
|
|
3806
3785
|
function BaseSlider(props) {
|
|
3807
|
-
const _a = props, {
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
"defaultRange",
|
|
3819
|
-
"children",
|
|
3820
|
-
"updateInteractionVariant",
|
|
3821
|
-
"defaultValue",
|
|
3822
|
-
"onChange"
|
|
3823
|
-
]);
|
|
3824
|
-
const isFirstRender = useRef(true);
|
|
3825
|
-
useEffect(() => {
|
|
3826
|
-
var _a2, _b, _c;
|
|
3827
|
-
if (isFirstRender.current) {
|
|
3828
|
-
isFirstRender.current = false;
|
|
3829
|
-
return;
|
|
3830
|
-
}
|
|
3831
|
-
if (props.isMultiValue) {
|
|
3832
|
-
const minValue = (_a2 = props.minValue) != null ? _a2 : 0;
|
|
3833
|
-
(_b = props.onChange) == null ? void 0 : _b.call(
|
|
3834
|
-
props,
|
|
3835
|
-
Array.isArray(range) && range.length > 1 ? range : [minValue, minValue + 10],
|
|
3836
|
-
true
|
|
3837
|
-
);
|
|
3838
|
-
return;
|
|
3839
|
-
}
|
|
3840
|
-
(_c = props.onChange) == null ? void 0 : _c.call(props, Array.isArray(value) ? 0 : value != null ? value : 0, false);
|
|
3841
|
-
}, [props.isMultiValue]);
|
|
3842
|
-
const mergedProps = mergeProps(rest, {
|
|
3843
|
-
value: props.isMultiValue ? range : value,
|
|
3844
|
-
defaultValue: props.isMultiValue ? defaultRange : defaultValue
|
|
3845
|
-
});
|
|
3846
|
-
return /* @__PURE__ */ React.createElement(PlasmicSliderContext.Provider, { value: mergedProps }, /* @__PURE__ */ React.createElement(
|
|
3847
|
-
Slider,
|
|
3848
|
-
__spreadValues$4({
|
|
3849
|
-
key: props.isMultiValue ? "multi" : "single",
|
|
3850
|
-
onChange: (newValue) => {
|
|
3851
|
-
onChange == null ? void 0 : onChange(newValue, props.isMultiValue);
|
|
3852
|
-
}
|
|
3853
|
-
}, mergedProps),
|
|
3854
|
-
({ isDisabled }) => withObservedValues$2(
|
|
3786
|
+
const _a = props, { children, updateInteractionVariant } = _a, rest = __objRest$4(_a, ["children", "updateInteractionVariant"]);
|
|
3787
|
+
return /* @__PURE__ */ React.createElement(
|
|
3788
|
+
PlasmicSliderContext.Provider,
|
|
3789
|
+
{
|
|
3790
|
+
value: __spreadProps$2(__spreadValues$4({}, rest), {
|
|
3791
|
+
// Here's why the type casting is needed here: https://github.com/Microsoft/TypeScript/issues/3410
|
|
3792
|
+
onChange: rest.onChange,
|
|
3793
|
+
onChangeEnd: rest.onChangeEnd
|
|
3794
|
+
})
|
|
3795
|
+
},
|
|
3796
|
+
/* @__PURE__ */ React.createElement(Slider, __spreadValues$4({}, rest), ({ isDisabled }) => withObservedValues$2(
|
|
3855
3797
|
children,
|
|
3856
3798
|
{
|
|
3857
3799
|
disabled: isDisabled
|
|
3858
3800
|
},
|
|
3859
3801
|
updateInteractionVariant
|
|
3860
|
-
)
|
|
3861
|
-
)
|
|
3802
|
+
))
|
|
3803
|
+
);
|
|
3804
|
+
}
|
|
3805
|
+
function getCommonSliderProps() {
|
|
3806
|
+
return {
|
|
3807
|
+
orientation: {
|
|
3808
|
+
type: "choice",
|
|
3809
|
+
options: ["horizontal", "vertical"],
|
|
3810
|
+
defaultValueHint: "horizontal",
|
|
3811
|
+
defaultValue: "horizontal"
|
|
3812
|
+
},
|
|
3813
|
+
minValue: {
|
|
3814
|
+
type: "number",
|
|
3815
|
+
description: "The minimum value of the slider",
|
|
3816
|
+
defaultValueHint: 0
|
|
3817
|
+
},
|
|
3818
|
+
maxValue: {
|
|
3819
|
+
type: "number",
|
|
3820
|
+
description: "The maximum value of the slider",
|
|
3821
|
+
defaultValueHint: 100
|
|
3822
|
+
},
|
|
3823
|
+
step: {
|
|
3824
|
+
type: "number",
|
|
3825
|
+
description: "The step value of the slider",
|
|
3826
|
+
defaultValueHint: 1
|
|
3827
|
+
}
|
|
3828
|
+
};
|
|
3862
3829
|
}
|
|
3863
3830
|
function registerSlider(loader, overrides) {
|
|
3831
|
+
const sliderOutputMeta = registerSliderOutput(loader, {
|
|
3832
|
+
parentComponentName: SLIDER_COMPONENT_NAME
|
|
3833
|
+
});
|
|
3834
|
+
const sliderThumbMeta = registerSliderThumb(loader, {
|
|
3835
|
+
parentComponentName: SLIDER_COMPONENT_NAME
|
|
3836
|
+
});
|
|
3837
|
+
const sliderTrackMeta = registerSliderTrack(sliderThumbMeta, loader, {
|
|
3838
|
+
parentComponentName: SLIDER_COMPONENT_NAME
|
|
3839
|
+
});
|
|
3864
3840
|
registerComponentHelper(
|
|
3865
3841
|
loader,
|
|
3866
3842
|
BaseSlider,
|
|
3867
3843
|
{
|
|
3868
|
-
name:
|
|
3869
|
-
displayName: "Aria Slider",
|
|
3844
|
+
name: RANGE_SLIDER_COMPONENT_NAME,
|
|
3845
|
+
displayName: "Aria Range Slider",
|
|
3870
3846
|
importPath: "@plasmicpkgs/react-aria/skinny/registerSlider",
|
|
3871
3847
|
importName: "BaseSlider",
|
|
3872
3848
|
interactionVariants: interactionVariants$3,
|
|
3873
3849
|
defaultStyles: {
|
|
3874
3850
|
width: "300px"
|
|
3875
3851
|
},
|
|
3876
|
-
props: __spreadProps$2(__spreadValues$4({}, getCommonProps("slider", [
|
|
3852
|
+
props: __spreadProps$2(__spreadValues$4(__spreadValues$4({}, getCommonProps("slider", [
|
|
3877
3853
|
"isDisabled",
|
|
3878
|
-
"name",
|
|
3879
|
-
"autoFocus",
|
|
3880
3854
|
"aria-label"
|
|
3881
|
-
])), {
|
|
3855
|
+
])), getCommonSliderProps()), {
|
|
3856
|
+
value: {
|
|
3857
|
+
type: "array",
|
|
3858
|
+
editOnly: true,
|
|
3859
|
+
displayName: "Initial value",
|
|
3860
|
+
uncontrolledProp: "defaultValue",
|
|
3861
|
+
description: "The intial value of the slider",
|
|
3862
|
+
defaultValue: [20, 50],
|
|
3863
|
+
validator: (value) => {
|
|
3864
|
+
if (!Array.isArray(value)) {
|
|
3865
|
+
return "Input must be an array.";
|
|
3866
|
+
}
|
|
3867
|
+
for (let i = 1; i < value.length; i++) {
|
|
3868
|
+
if (value[i] < value[i - 1]) {
|
|
3869
|
+
return "Array elements are not in ascending order.";
|
|
3870
|
+
}
|
|
3871
|
+
}
|
|
3872
|
+
return true;
|
|
3873
|
+
}
|
|
3874
|
+
},
|
|
3882
3875
|
children: {
|
|
3883
3876
|
type: "slot",
|
|
3884
3877
|
defaultValue: [
|
|
@@ -3902,10 +3895,7 @@ function registerSlider(loader, overrides) {
|
|
|
3902
3895
|
},
|
|
3903
3896
|
{
|
|
3904
3897
|
type: "component",
|
|
3905
|
-
name:
|
|
3906
|
-
SLIDER_COMPONENT_NAME,
|
|
3907
|
-
SLIDER_OUTPUT_COMPONENT_NAME
|
|
3908
|
-
),
|
|
3898
|
+
name: sliderOutputMeta.name,
|
|
3909
3899
|
props: {
|
|
3910
3900
|
children: {
|
|
3911
3901
|
type: "text",
|
|
@@ -3917,49 +3907,102 @@ function registerSlider(loader, overrides) {
|
|
|
3917
3907
|
},
|
|
3918
3908
|
{
|
|
3919
3909
|
type: "component",
|
|
3920
|
-
name:
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3910
|
+
name: sliderTrackMeta.name,
|
|
3911
|
+
props: {
|
|
3912
|
+
children: [
|
|
3913
|
+
{
|
|
3914
|
+
type: "component",
|
|
3915
|
+
name: sliderThumbMeta.name
|
|
3916
|
+
},
|
|
3917
|
+
{
|
|
3918
|
+
type: "component",
|
|
3919
|
+
name: sliderThumbMeta.name,
|
|
3920
|
+
styles: {
|
|
3921
|
+
backgroundColor: "blue"
|
|
3922
|
+
}
|
|
3923
|
+
}
|
|
3924
|
+
]
|
|
3925
|
+
}
|
|
3924
3926
|
}
|
|
3925
3927
|
]
|
|
3926
3928
|
},
|
|
3927
|
-
|
|
3928
|
-
type: "
|
|
3929
|
-
|
|
3930
|
-
defaultValueHint: "horizontal",
|
|
3931
|
-
defaultValue: "horizontal"
|
|
3932
|
-
},
|
|
3933
|
-
minValue: {
|
|
3934
|
-
type: "number",
|
|
3935
|
-
description: "The minimum value of the slider",
|
|
3936
|
-
defaultValueHint: 0
|
|
3937
|
-
},
|
|
3938
|
-
maxValue: {
|
|
3939
|
-
type: "number",
|
|
3940
|
-
description: "The maximum value of the slider",
|
|
3941
|
-
defaultValueHint: 100
|
|
3942
|
-
},
|
|
3943
|
-
step: {
|
|
3944
|
-
type: "number",
|
|
3945
|
-
description: "The step value of the slider",
|
|
3946
|
-
defaultValueHint: 1
|
|
3947
|
-
},
|
|
3948
|
-
isMultiValue: {
|
|
3949
|
-
type: "boolean",
|
|
3950
|
-
displayName: "Multi-valued",
|
|
3951
|
-
description: "Whether the slider supports range (multiple thumbs)",
|
|
3952
|
-
defaultValue: false,
|
|
3953
|
-
defaultValueHint: false
|
|
3929
|
+
onChange: {
|
|
3930
|
+
type: "eventHandler",
|
|
3931
|
+
argTypes: [{ name: "value", type: "object" }]
|
|
3954
3932
|
},
|
|
3955
|
-
|
|
3956
|
-
type: "
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3933
|
+
onChangeEnd: {
|
|
3934
|
+
type: "eventHandler",
|
|
3935
|
+
argTypes: [{ name: "value", type: "object" }]
|
|
3936
|
+
}
|
|
3937
|
+
}),
|
|
3938
|
+
states: {
|
|
3939
|
+
value: {
|
|
3940
|
+
type: "writable",
|
|
3941
|
+
valueProp: "value",
|
|
3942
|
+
onChangeProp: "onChange",
|
|
3943
|
+
variableType: "array"
|
|
3944
|
+
}
|
|
3945
|
+
},
|
|
3946
|
+
trapsFocus: true
|
|
3947
|
+
},
|
|
3948
|
+
{
|
|
3949
|
+
parentComponentName: SLIDER_COMPONENT_NAME
|
|
3950
|
+
}
|
|
3951
|
+
);
|
|
3952
|
+
registerComponentHelper(
|
|
3953
|
+
loader,
|
|
3954
|
+
BaseSlider,
|
|
3955
|
+
{
|
|
3956
|
+
name: SLIDER_COMPONENT_NAME,
|
|
3957
|
+
displayName: "Aria Slider",
|
|
3958
|
+
importPath: "@plasmicpkgs/react-aria/skinny/registerSlider",
|
|
3959
|
+
importName: "BaseSlider",
|
|
3960
|
+
interactionVariants: interactionVariants$3,
|
|
3961
|
+
defaultStyles: {
|
|
3962
|
+
width: "300px"
|
|
3963
|
+
},
|
|
3964
|
+
props: __spreadProps$2(__spreadValues$4(__spreadValues$4({}, getCommonProps("slider", [
|
|
3965
|
+
"isDisabled",
|
|
3966
|
+
"aria-label"
|
|
3967
|
+
])), getCommonSliderProps()), {
|
|
3968
|
+
children: {
|
|
3969
|
+
type: "slot",
|
|
3970
|
+
defaultValue: [
|
|
3971
|
+
{
|
|
3972
|
+
type: "hbox",
|
|
3973
|
+
styles: {
|
|
3974
|
+
width: "stretch",
|
|
3975
|
+
justifyContent: "space-between",
|
|
3976
|
+
padding: "8px 0px"
|
|
3977
|
+
},
|
|
3978
|
+
children: [
|
|
3979
|
+
{
|
|
3980
|
+
type: "component",
|
|
3981
|
+
name: LABEL_COMPONENT_NAME,
|
|
3982
|
+
props: {
|
|
3983
|
+
children: {
|
|
3984
|
+
type: "text",
|
|
3985
|
+
value: "Label"
|
|
3986
|
+
}
|
|
3987
|
+
}
|
|
3988
|
+
},
|
|
3989
|
+
{
|
|
3990
|
+
type: "component",
|
|
3991
|
+
name: sliderOutputMeta.name,
|
|
3992
|
+
props: {
|
|
3993
|
+
children: {
|
|
3994
|
+
type: "text",
|
|
3995
|
+
value: "Output"
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3998
|
+
}
|
|
3999
|
+
]
|
|
4000
|
+
},
|
|
4001
|
+
{
|
|
4002
|
+
type: "component",
|
|
4003
|
+
name: sliderTrackMeta.name
|
|
4004
|
+
}
|
|
4005
|
+
]
|
|
3963
4006
|
},
|
|
3964
4007
|
value: {
|
|
3965
4008
|
type: "number",
|
|
@@ -3967,52 +4010,29 @@ function registerSlider(loader, overrides) {
|
|
|
3967
4010
|
uncontrolledProp: "defaultValue",
|
|
3968
4011
|
description: "The default value of the slider",
|
|
3969
4012
|
defaultValueHint: 0,
|
|
3970
|
-
defaultValue: 0
|
|
3971
|
-
hidden: (ps) => Boolean(ps.isMultiValue)
|
|
4013
|
+
defaultValue: 0
|
|
3972
4014
|
},
|
|
3973
4015
|
onChange: {
|
|
3974
4016
|
type: "eventHandler",
|
|
3975
|
-
argTypes: [{ name: "value", type: "
|
|
4017
|
+
argTypes: [{ name: "value", type: "number" }]
|
|
3976
4018
|
},
|
|
3977
4019
|
onChangeEnd: {
|
|
3978
4020
|
type: "eventHandler",
|
|
3979
|
-
argTypes: [{ name: "value", type: "
|
|
4021
|
+
argTypes: [{ name: "value", type: "number" }]
|
|
3980
4022
|
}
|
|
3981
4023
|
}),
|
|
3982
4024
|
states: {
|
|
3983
|
-
|
|
3984
|
-
type: "writable",
|
|
3985
|
-
valueProp: "range",
|
|
3986
|
-
onChangeProp: "onChange",
|
|
3987
|
-
variableType: "array",
|
|
3988
|
-
hidden: (ps) => !ps.isMultiValue
|
|
3989
|
-
}, sliderHelpers.states.range),
|
|
3990
|
-
value: __spreadValues$4({
|
|
4025
|
+
value: {
|
|
3991
4026
|
type: "writable",
|
|
3992
4027
|
valueProp: "value",
|
|
3993
4028
|
onChangeProp: "onChange",
|
|
3994
|
-
variableType: "number"
|
|
3995
|
-
|
|
3996
|
-
}, sliderHelpers.states.value)
|
|
3997
|
-
},
|
|
3998
|
-
componentHelpers: {
|
|
3999
|
-
helpers: sliderHelpers,
|
|
4000
|
-
importName: "sliderHelpers",
|
|
4001
|
-
importPath: "@plasmicpkgs/react-aria/skinny/registerSlider"
|
|
4029
|
+
variableType: "number"
|
|
4030
|
+
}
|
|
4002
4031
|
},
|
|
4003
4032
|
trapsFocus: true
|
|
4004
4033
|
},
|
|
4005
4034
|
overrides
|
|
4006
4035
|
);
|
|
4007
|
-
registerSliderOutput(loader, {
|
|
4008
|
-
parentComponentName: SLIDER_COMPONENT_NAME
|
|
4009
|
-
});
|
|
4010
|
-
registerSliderThumb(loader, {
|
|
4011
|
-
parentComponentName: SLIDER_COMPONENT_NAME
|
|
4012
|
-
});
|
|
4013
|
-
registerSliderTrack(loader, {
|
|
4014
|
-
parentComponentName: SLIDER_COMPONENT_NAME
|
|
4015
|
-
});
|
|
4016
4036
|
}
|
|
4017
4037
|
|
|
4018
4038
|
var __defProp$3 = Object.defineProperty;
|