@plasmicpkgs/react-aria 0.0.98 → 0.0.99
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/react-aria.esm.js +90 -23
- package/dist/react-aria.esm.js.map +1 -1
- package/dist/react-aria.js +89 -22
- package/dist/react-aria.js.map +1 -1
- package/dist/registerButton.d.ts +10 -3
- package/package.json +2 -2
- package/skinny/registerButton.cjs.js +89 -22
- package/skinny/registerButton.cjs.js.map +1 -1
- package/skinny/registerButton.d.ts +10 -3
- package/skinny/registerButton.esm.js +90 -23
- package/skinny/registerButton.esm.js.map +1 -1
- package/skinny/registerComboBox.cjs.js +1 -1
- package/skinny/registerComboBox.esm.js +1 -1
- package/skinny/registerSelect.cjs.js +1 -1
- package/skinny/registerSelect.esm.js +1 -1
package/dist/react-aria.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { usePlasmicCanvasContext, usePlasmicCanvasComponentInfo, usePlasmicLink } from '@plasmicapp/host';
|
|
1
2
|
import React, { useEffect, useState, useMemo, useCallback, forwardRef, useImperativeHandle, Component } from 'react';
|
|
2
|
-
import { mergeProps, useFocusable } from 'react-aria';
|
|
3
|
+
import { mergeProps, useLink, useHover, useFocusRing, useFocusable } from 'react-aria';
|
|
3
4
|
import { Button, Checkbox, Text, Label, CheckboxGroup, Input, ListBoxItem, ListBox, Section, Header, PopoverContext, Popover, ComboBox, ComboBoxStateContext, Dialog, Heading, ModalOverlay, Modal, DialogTrigger, TooltipContext, OverlayArrow, Radio, RadioGroup, Select, SelectStateContext, SelectValue, SliderOutput, SliderThumb, Slider, SliderTrack, Switch, TextArea, TextField, TooltipTrigger, Tooltip } from 'react-aria-components';
|
|
4
|
-
import { usePlasmicCanvasContext, usePlasmicCanvasComponentInfo } from '@plasmicapp/host';
|
|
5
5
|
import registerComponent from '@plasmicapp/host/registerComponent';
|
|
6
6
|
import { mergeProps as mergeProps$1 } from '@react-aria/utils';
|
|
7
7
|
import flattenChildren from 'react-keyed-flatten-children';
|
|
@@ -652,24 +652,73 @@ const BUTTON_VARIANTS = [
|
|
|
652
652
|
];
|
|
653
653
|
const { variants: variants$h, withObservedValues: withObservedValues$e } = pickAriaComponentVariants(BUTTON_VARIANTS);
|
|
654
654
|
const BaseButton = React.forwardRef(function BaseButtonInner(props, ref) {
|
|
655
|
-
const
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
655
|
+
const { href } = props;
|
|
656
|
+
if (href) {
|
|
657
|
+
return /* @__PURE__ */ React.createElement(
|
|
658
|
+
LinkButton,
|
|
659
|
+
{
|
|
660
|
+
props,
|
|
661
|
+
ref
|
|
662
|
+
}
|
|
663
|
+
);
|
|
664
|
+
} else {
|
|
665
|
+
const _a = props, { submitsForm, resetsForm, children, plasmicUpdateVariant } = _a, rest = __objRest$m(_a, ["submitsForm", "resetsForm", "children", "plasmicUpdateVariant"]);
|
|
666
|
+
const type = submitsForm ? "submit" : resetsForm ? "reset" : "button";
|
|
667
|
+
const buttonProps = mergeProps(rest, {
|
|
668
|
+
type,
|
|
669
|
+
style: COMMON_STYLES,
|
|
670
|
+
ref
|
|
671
|
+
});
|
|
672
|
+
return /* @__PURE__ */ React.createElement(Button, __spreadValues$q({}, buttonProps), ({ isHovered, isPressed, isFocused, isFocusVisible, isDisabled }) => withObservedValues$e(
|
|
673
|
+
children,
|
|
674
|
+
{
|
|
675
|
+
hovered: isHovered,
|
|
676
|
+
pressed: isPressed,
|
|
677
|
+
focused: isFocused,
|
|
678
|
+
focusVisible: isFocusVisible,
|
|
679
|
+
disabled: isDisabled
|
|
680
|
+
},
|
|
681
|
+
plasmicUpdateVariant
|
|
682
|
+
));
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
function LinkButton({
|
|
686
|
+
props,
|
|
687
|
+
ref
|
|
688
|
+
}) {
|
|
689
|
+
const _a = props, { href, children, plasmicUpdateVariant } = _a, rest = __objRest$m(_a, ["href", "children", "plasmicUpdateVariant"]);
|
|
690
|
+
const PlasmicLink = usePlasmicLink();
|
|
691
|
+
const { linkProps, isPressed } = useLink(props, ref);
|
|
692
|
+
const { hoverProps, isHovered } = useHover(props);
|
|
693
|
+
const { focusProps, isFocused, isFocusVisible } = useFocusRing();
|
|
694
|
+
const combinedLinkProps = mergeProps(linkProps, hoverProps, focusProps, {
|
|
695
|
+
href,
|
|
696
|
+
className: props.className,
|
|
697
|
+
style: COMMON_STYLES,
|
|
659
698
|
ref
|
|
660
699
|
});
|
|
661
|
-
return /* @__PURE__ */ React.createElement(
|
|
662
|
-
|
|
663
|
-
{
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
disabled: isDisabled
|
|
669
|
-
},
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
700
|
+
return /* @__PURE__ */ React.createElement(
|
|
701
|
+
PlasmicLink,
|
|
702
|
+
__spreadProps$m(__spreadValues$q({}, combinedLinkProps), {
|
|
703
|
+
"data-focused": isFocused || void 0,
|
|
704
|
+
"data-hovered": isHovered || void 0,
|
|
705
|
+
"data-pressed": isPressed || void 0,
|
|
706
|
+
"data-focus-visible": isFocusVisible || void 0,
|
|
707
|
+
"data-disabled": props.isDisabled || void 0
|
|
708
|
+
}),
|
|
709
|
+
withObservedValues$e(
|
|
710
|
+
children,
|
|
711
|
+
{
|
|
712
|
+
hovered: isHovered,
|
|
713
|
+
pressed: isPressed,
|
|
714
|
+
focused: isFocused,
|
|
715
|
+
focusVisible: isFocusVisible,
|
|
716
|
+
disabled: !!rest.isDisabled
|
|
717
|
+
},
|
|
718
|
+
plasmicUpdateVariant
|
|
719
|
+
)
|
|
720
|
+
);
|
|
721
|
+
}
|
|
673
722
|
const BUTTON_COMPONENT_NAME = makeComponentName("button");
|
|
674
723
|
function registerButton(loader, overrides) {
|
|
675
724
|
registerComponentHelper(
|
|
@@ -682,11 +731,18 @@ function registerButton(loader, overrides) {
|
|
|
682
731
|
importName: "BaseButton",
|
|
683
732
|
variants: variants$h,
|
|
684
733
|
defaultStyles: {
|
|
685
|
-
|
|
686
|
-
|
|
734
|
+
// Ensure consistent design across rendered elements (button, anchor tag).
|
|
735
|
+
backgroundColor: "#EFEFEF",
|
|
687
736
|
borderColor: "black",
|
|
737
|
+
borderStyle: "solid",
|
|
738
|
+
borderWidth: "1px",
|
|
739
|
+
color: "#000000",
|
|
740
|
+
cursor: "pointer",
|
|
741
|
+
fontFamily: "Arial",
|
|
742
|
+
fontSize: "1rem",
|
|
743
|
+
lineHeight: "1.2",
|
|
688
744
|
padding: "2px 10px",
|
|
689
|
-
|
|
745
|
+
textDecorationLine: "none"
|
|
690
746
|
},
|
|
691
747
|
props: __spreadProps$m(__spreadValues$q({}, getCommonProps("button", [
|
|
692
748
|
"autoFocus",
|
|
@@ -701,11 +757,22 @@ function registerButton(loader, overrides) {
|
|
|
701
757
|
value: "Button"
|
|
702
758
|
}
|
|
703
759
|
},
|
|
760
|
+
href: {
|
|
761
|
+
type: "href",
|
|
762
|
+
description: "The URL this button navigates to. If present, this button is an <a> element."
|
|
763
|
+
},
|
|
764
|
+
target: {
|
|
765
|
+
type: "choice",
|
|
766
|
+
options: ["_blank", "_self", "_parent", "_top"],
|
|
767
|
+
description: "Same as target attribute of <a> element. Only applies when the href prop is present.",
|
|
768
|
+
hidden: (props) => !props.href,
|
|
769
|
+
defaultValueHint: "_self"
|
|
770
|
+
},
|
|
704
771
|
submitsForm: {
|
|
705
772
|
type: "boolean",
|
|
706
773
|
displayName: "Submits form?",
|
|
707
774
|
defaultValueHint: false,
|
|
708
|
-
hidden: (props) => Boolean(props.resetsForm),
|
|
775
|
+
hidden: (props) => Boolean(props.resetsForm) || Boolean(props.href),
|
|
709
776
|
description: "Whether clicking this button should submit the enclosing form.",
|
|
710
777
|
advanced: true
|
|
711
778
|
},
|
|
@@ -713,7 +780,7 @@ function registerButton(loader, overrides) {
|
|
|
713
780
|
type: "boolean",
|
|
714
781
|
displayName: "Resets form?",
|
|
715
782
|
defaultValueHint: false,
|
|
716
|
-
hidden: (props) => Boolean(props.submitsForm),
|
|
783
|
+
hidden: (props) => Boolean(props.submitsForm) || Boolean(props.href),
|
|
717
784
|
description: "Whether clicking this button should reset the enclosing form.",
|
|
718
785
|
advanced: true
|
|
719
786
|
},
|