@plasmicpkgs/react-aria 0.0.43 → 0.0.45
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 +227 -206
- package/dist/react-aria.esm.js.map +1 -1
- package/dist/react-aria.js +226 -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 +189 -16
- package/skinny/registerSliderTrack.cjs.js.map +1 -1
- package/skinny/registerSliderTrack.d.ts +3 -1
- package/skinny/registerSliderTrack.esm.js +185 -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,14 @@ 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],
|
|
3707
|
+
allowRootWrapper: true,
|
|
3706
3708
|
defaultValue: [
|
|
3707
3709
|
{
|
|
3708
3710
|
type: "component",
|
|
3709
|
-
name:
|
|
3710
|
-
SLIDER_COMPONENT_NAME,
|
|
3711
|
-
SLIDER_THUMB_COMPONENT_NAME
|
|
3712
|
-
)
|
|
3711
|
+
name: sliderThumbMeta.name
|
|
3713
3712
|
}
|
|
3714
3713
|
]
|
|
3715
3714
|
},
|
|
@@ -3779,106 +3778,101 @@ var __objRest$4 = (source, exclude) => {
|
|
|
3779
3778
|
return target;
|
|
3780
3779
|
};
|
|
3781
3780
|
const SLIDER_COMPONENT_NAME = makeComponentName("slider");
|
|
3781
|
+
const RANGE_SLIDER_COMPONENT_NAME = makeComponentName("range-slider");
|
|
3782
3782
|
const SLIDER_INTERACTION_VARIANTS = ["disabled"];
|
|
3783
3783
|
const { interactionVariants: interactionVariants$3, withObservedValues: withObservedValues$2 } = pickAriaComponentVariants(
|
|
3784
3784
|
SLIDER_INTERACTION_VARIANTS
|
|
3785
3785
|
);
|
|
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
3786
|
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(
|
|
3787
|
+
const _a = props, { children, updateInteractionVariant } = _a, rest = __objRest$4(_a, ["children", "updateInteractionVariant"]);
|
|
3788
|
+
return /* @__PURE__ */ React.createElement(
|
|
3789
|
+
PlasmicSliderContext.Provider,
|
|
3790
|
+
{
|
|
3791
|
+
value: __spreadProps$2(__spreadValues$4({}, rest), {
|
|
3792
|
+
// Here's why the type casting is needed here: https://github.com/Microsoft/TypeScript/issues/3410
|
|
3793
|
+
onChange: rest.onChange,
|
|
3794
|
+
onChangeEnd: rest.onChangeEnd
|
|
3795
|
+
})
|
|
3796
|
+
},
|
|
3797
|
+
/* @__PURE__ */ React.createElement(Slider, __spreadValues$4({}, rest), ({ isDisabled }) => withObservedValues$2(
|
|
3855
3798
|
children,
|
|
3856
3799
|
{
|
|
3857
3800
|
disabled: isDisabled
|
|
3858
3801
|
},
|
|
3859
3802
|
updateInteractionVariant
|
|
3860
|
-
)
|
|
3861
|
-
)
|
|
3803
|
+
))
|
|
3804
|
+
);
|
|
3805
|
+
}
|
|
3806
|
+
function getCommonSliderProps() {
|
|
3807
|
+
return {
|
|
3808
|
+
orientation: {
|
|
3809
|
+
type: "choice",
|
|
3810
|
+
options: ["horizontal", "vertical"],
|
|
3811
|
+
defaultValueHint: "horizontal",
|
|
3812
|
+
defaultValue: "horizontal"
|
|
3813
|
+
},
|
|
3814
|
+
minValue: {
|
|
3815
|
+
type: "number",
|
|
3816
|
+
description: "The minimum value of the slider",
|
|
3817
|
+
defaultValueHint: 0
|
|
3818
|
+
},
|
|
3819
|
+
maxValue: {
|
|
3820
|
+
type: "number",
|
|
3821
|
+
description: "The maximum value of the slider",
|
|
3822
|
+
defaultValueHint: 100
|
|
3823
|
+
},
|
|
3824
|
+
step: {
|
|
3825
|
+
type: "number",
|
|
3826
|
+
description: "The step value of the slider",
|
|
3827
|
+
defaultValueHint: 1
|
|
3828
|
+
}
|
|
3829
|
+
};
|
|
3862
3830
|
}
|
|
3863
3831
|
function registerSlider(loader, overrides) {
|
|
3832
|
+
const sliderOutputMeta = registerSliderOutput(loader, {
|
|
3833
|
+
parentComponentName: SLIDER_COMPONENT_NAME
|
|
3834
|
+
});
|
|
3835
|
+
const sliderThumbMeta = registerSliderThumb(loader, {
|
|
3836
|
+
parentComponentName: SLIDER_COMPONENT_NAME
|
|
3837
|
+
});
|
|
3838
|
+
const sliderTrackMeta = registerSliderTrack(sliderThumbMeta, loader, {
|
|
3839
|
+
parentComponentName: SLIDER_COMPONENT_NAME
|
|
3840
|
+
});
|
|
3864
3841
|
registerComponentHelper(
|
|
3865
3842
|
loader,
|
|
3866
3843
|
BaseSlider,
|
|
3867
3844
|
{
|
|
3868
|
-
name:
|
|
3869
|
-
displayName: "Aria Slider",
|
|
3845
|
+
name: RANGE_SLIDER_COMPONENT_NAME,
|
|
3846
|
+
displayName: "Aria Range Slider",
|
|
3870
3847
|
importPath: "@plasmicpkgs/react-aria/skinny/registerSlider",
|
|
3871
3848
|
importName: "BaseSlider",
|
|
3872
3849
|
interactionVariants: interactionVariants$3,
|
|
3873
3850
|
defaultStyles: {
|
|
3874
3851
|
width: "300px"
|
|
3875
3852
|
},
|
|
3876
|
-
props: __spreadProps$2(__spreadValues$4({}, getCommonProps("slider", [
|
|
3853
|
+
props: __spreadProps$2(__spreadValues$4(__spreadValues$4({}, getCommonProps("slider", [
|
|
3877
3854
|
"isDisabled",
|
|
3878
|
-
"name",
|
|
3879
|
-
"autoFocus",
|
|
3880
3855
|
"aria-label"
|
|
3881
|
-
])), {
|
|
3856
|
+
])), getCommonSliderProps()), {
|
|
3857
|
+
value: {
|
|
3858
|
+
type: "array",
|
|
3859
|
+
editOnly: true,
|
|
3860
|
+
displayName: "Initial value",
|
|
3861
|
+
uncontrolledProp: "defaultValue",
|
|
3862
|
+
description: "The intial value of the slider",
|
|
3863
|
+
defaultValue: [20, 50],
|
|
3864
|
+
validator: (value) => {
|
|
3865
|
+
if (!Array.isArray(value)) {
|
|
3866
|
+
return "Input must be an array.";
|
|
3867
|
+
}
|
|
3868
|
+
for (let i = 1; i < value.length; i++) {
|
|
3869
|
+
if (value[i] < value[i - 1]) {
|
|
3870
|
+
return "Array elements are not in ascending order.";
|
|
3871
|
+
}
|
|
3872
|
+
}
|
|
3873
|
+
return true;
|
|
3874
|
+
}
|
|
3875
|
+
},
|
|
3882
3876
|
children: {
|
|
3883
3877
|
type: "slot",
|
|
3884
3878
|
defaultValue: [
|
|
@@ -3902,10 +3896,7 @@ function registerSlider(loader, overrides) {
|
|
|
3902
3896
|
},
|
|
3903
3897
|
{
|
|
3904
3898
|
type: "component",
|
|
3905
|
-
name:
|
|
3906
|
-
SLIDER_COMPONENT_NAME,
|
|
3907
|
-
SLIDER_OUTPUT_COMPONENT_NAME
|
|
3908
|
-
),
|
|
3899
|
+
name: sliderOutputMeta.name,
|
|
3909
3900
|
props: {
|
|
3910
3901
|
children: {
|
|
3911
3902
|
type: "text",
|
|
@@ -3917,49 +3908,102 @@ function registerSlider(loader, overrides) {
|
|
|
3917
3908
|
},
|
|
3918
3909
|
{
|
|
3919
3910
|
type: "component",
|
|
3920
|
-
name:
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3911
|
+
name: sliderTrackMeta.name,
|
|
3912
|
+
props: {
|
|
3913
|
+
children: [
|
|
3914
|
+
{
|
|
3915
|
+
type: "component",
|
|
3916
|
+
name: sliderThumbMeta.name
|
|
3917
|
+
},
|
|
3918
|
+
{
|
|
3919
|
+
type: "component",
|
|
3920
|
+
name: sliderThumbMeta.name,
|
|
3921
|
+
styles: {
|
|
3922
|
+
backgroundColor: "blue"
|
|
3923
|
+
}
|
|
3924
|
+
}
|
|
3925
|
+
]
|
|
3926
|
+
}
|
|
3924
3927
|
}
|
|
3925
3928
|
]
|
|
3926
3929
|
},
|
|
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
|
|
3930
|
+
onChange: {
|
|
3931
|
+
type: "eventHandler",
|
|
3932
|
+
argTypes: [{ name: "value", type: "object" }]
|
|
3954
3933
|
},
|
|
3955
|
-
|
|
3956
|
-
type: "
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3934
|
+
onChangeEnd: {
|
|
3935
|
+
type: "eventHandler",
|
|
3936
|
+
argTypes: [{ name: "value", type: "object" }]
|
|
3937
|
+
}
|
|
3938
|
+
}),
|
|
3939
|
+
states: {
|
|
3940
|
+
value: {
|
|
3941
|
+
type: "writable",
|
|
3942
|
+
valueProp: "value",
|
|
3943
|
+
onChangeProp: "onChange",
|
|
3944
|
+
variableType: "array"
|
|
3945
|
+
}
|
|
3946
|
+
},
|
|
3947
|
+
trapsFocus: true
|
|
3948
|
+
},
|
|
3949
|
+
{
|
|
3950
|
+
parentComponentName: SLIDER_COMPONENT_NAME
|
|
3951
|
+
}
|
|
3952
|
+
);
|
|
3953
|
+
registerComponentHelper(
|
|
3954
|
+
loader,
|
|
3955
|
+
BaseSlider,
|
|
3956
|
+
{
|
|
3957
|
+
name: SLIDER_COMPONENT_NAME,
|
|
3958
|
+
displayName: "Aria Slider",
|
|
3959
|
+
importPath: "@plasmicpkgs/react-aria/skinny/registerSlider",
|
|
3960
|
+
importName: "BaseSlider",
|
|
3961
|
+
interactionVariants: interactionVariants$3,
|
|
3962
|
+
defaultStyles: {
|
|
3963
|
+
width: "300px"
|
|
3964
|
+
},
|
|
3965
|
+
props: __spreadProps$2(__spreadValues$4(__spreadValues$4({}, getCommonProps("slider", [
|
|
3966
|
+
"isDisabled",
|
|
3967
|
+
"aria-label"
|
|
3968
|
+
])), getCommonSliderProps()), {
|
|
3969
|
+
children: {
|
|
3970
|
+
type: "slot",
|
|
3971
|
+
defaultValue: [
|
|
3972
|
+
{
|
|
3973
|
+
type: "hbox",
|
|
3974
|
+
styles: {
|
|
3975
|
+
width: "stretch",
|
|
3976
|
+
justifyContent: "space-between",
|
|
3977
|
+
padding: "8px 0px"
|
|
3978
|
+
},
|
|
3979
|
+
children: [
|
|
3980
|
+
{
|
|
3981
|
+
type: "component",
|
|
3982
|
+
name: LABEL_COMPONENT_NAME,
|
|
3983
|
+
props: {
|
|
3984
|
+
children: {
|
|
3985
|
+
type: "text",
|
|
3986
|
+
value: "Label"
|
|
3987
|
+
}
|
|
3988
|
+
}
|
|
3989
|
+
},
|
|
3990
|
+
{
|
|
3991
|
+
type: "component",
|
|
3992
|
+
name: sliderOutputMeta.name,
|
|
3993
|
+
props: {
|
|
3994
|
+
children: {
|
|
3995
|
+
type: "text",
|
|
3996
|
+
value: "Output"
|
|
3997
|
+
}
|
|
3998
|
+
}
|
|
3999
|
+
}
|
|
4000
|
+
]
|
|
4001
|
+
},
|
|
4002
|
+
{
|
|
4003
|
+
type: "component",
|
|
4004
|
+
name: sliderTrackMeta.name
|
|
4005
|
+
}
|
|
4006
|
+
]
|
|
3963
4007
|
},
|
|
3964
4008
|
value: {
|
|
3965
4009
|
type: "number",
|
|
@@ -3967,52 +4011,29 @@ function registerSlider(loader, overrides) {
|
|
|
3967
4011
|
uncontrolledProp: "defaultValue",
|
|
3968
4012
|
description: "The default value of the slider",
|
|
3969
4013
|
defaultValueHint: 0,
|
|
3970
|
-
defaultValue: 0
|
|
3971
|
-
hidden: (ps) => Boolean(ps.isMultiValue)
|
|
4014
|
+
defaultValue: 0
|
|
3972
4015
|
},
|
|
3973
4016
|
onChange: {
|
|
3974
4017
|
type: "eventHandler",
|
|
3975
|
-
argTypes: [{ name: "value", type: "
|
|
4018
|
+
argTypes: [{ name: "value", type: "number" }]
|
|
3976
4019
|
},
|
|
3977
4020
|
onChangeEnd: {
|
|
3978
4021
|
type: "eventHandler",
|
|
3979
|
-
argTypes: [{ name: "value", type: "
|
|
4022
|
+
argTypes: [{ name: "value", type: "number" }]
|
|
3980
4023
|
}
|
|
3981
4024
|
}),
|
|
3982
4025
|
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({
|
|
4026
|
+
value: {
|
|
3991
4027
|
type: "writable",
|
|
3992
4028
|
valueProp: "value",
|
|
3993
4029
|
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"
|
|
4030
|
+
variableType: "number"
|
|
4031
|
+
}
|
|
4002
4032
|
},
|
|
4003
4033
|
trapsFocus: true
|
|
4004
4034
|
},
|
|
4005
4035
|
overrides
|
|
4006
4036
|
);
|
|
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
4037
|
}
|
|
4017
4038
|
|
|
4018
4039
|
var __defProp$3 = Object.defineProperty;
|