@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.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var host = require('@plasmicapp/host');
|
|
3
4
|
var React = require('react');
|
|
4
5
|
var reactAria = require('react-aria');
|
|
5
6
|
var reactAriaComponents = require('react-aria-components');
|
|
6
|
-
var host = require('@plasmicapp/host');
|
|
7
7
|
var registerComponent = require('@plasmicapp/host/registerComponent');
|
|
8
8
|
var utils = require('@react-aria/utils');
|
|
9
9
|
var flattenChildren = require('react-keyed-flatten-children');
|
|
@@ -660,24 +660,73 @@ const BUTTON_VARIANTS = [
|
|
|
660
660
|
];
|
|
661
661
|
const { variants: variants$h, withObservedValues: withObservedValues$e } = pickAriaComponentVariants(BUTTON_VARIANTS);
|
|
662
662
|
const BaseButton = React__default.default.forwardRef(function BaseButtonInner(props, ref) {
|
|
663
|
-
const
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
663
|
+
const { href } = props;
|
|
664
|
+
if (href) {
|
|
665
|
+
return /* @__PURE__ */ React__default.default.createElement(
|
|
666
|
+
LinkButton,
|
|
667
|
+
{
|
|
668
|
+
props,
|
|
669
|
+
ref
|
|
670
|
+
}
|
|
671
|
+
);
|
|
672
|
+
} else {
|
|
673
|
+
const _a = props, { submitsForm, resetsForm, children, plasmicUpdateVariant } = _a, rest = __objRest$m(_a, ["submitsForm", "resetsForm", "children", "plasmicUpdateVariant"]);
|
|
674
|
+
const type = submitsForm ? "submit" : resetsForm ? "reset" : "button";
|
|
675
|
+
const buttonProps = reactAria.mergeProps(rest, {
|
|
676
|
+
type,
|
|
677
|
+
style: COMMON_STYLES,
|
|
678
|
+
ref
|
|
679
|
+
});
|
|
680
|
+
return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Button, __spreadValues$q({}, buttonProps), ({ isHovered, isPressed, isFocused, isFocusVisible, isDisabled }) => withObservedValues$e(
|
|
681
|
+
children,
|
|
682
|
+
{
|
|
683
|
+
hovered: isHovered,
|
|
684
|
+
pressed: isPressed,
|
|
685
|
+
focused: isFocused,
|
|
686
|
+
focusVisible: isFocusVisible,
|
|
687
|
+
disabled: isDisabled
|
|
688
|
+
},
|
|
689
|
+
plasmicUpdateVariant
|
|
690
|
+
));
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
function LinkButton({
|
|
694
|
+
props,
|
|
695
|
+
ref
|
|
696
|
+
}) {
|
|
697
|
+
const _a = props, { href, children, plasmicUpdateVariant } = _a, rest = __objRest$m(_a, ["href", "children", "plasmicUpdateVariant"]);
|
|
698
|
+
const PlasmicLink = host.usePlasmicLink();
|
|
699
|
+
const { linkProps, isPressed } = reactAria.useLink(props, ref);
|
|
700
|
+
const { hoverProps, isHovered } = reactAria.useHover(props);
|
|
701
|
+
const { focusProps, isFocused, isFocusVisible } = reactAria.useFocusRing();
|
|
702
|
+
const combinedLinkProps = reactAria.mergeProps(linkProps, hoverProps, focusProps, {
|
|
703
|
+
href,
|
|
704
|
+
className: props.className,
|
|
705
|
+
style: COMMON_STYLES,
|
|
667
706
|
ref
|
|
668
707
|
});
|
|
669
|
-
return /* @__PURE__ */ React__default.default.createElement(
|
|
670
|
-
|
|
671
|
-
{
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
disabled: isDisabled
|
|
677
|
-
},
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
708
|
+
return /* @__PURE__ */ React__default.default.createElement(
|
|
709
|
+
PlasmicLink,
|
|
710
|
+
__spreadProps$m(__spreadValues$q({}, combinedLinkProps), {
|
|
711
|
+
"data-focused": isFocused || void 0,
|
|
712
|
+
"data-hovered": isHovered || void 0,
|
|
713
|
+
"data-pressed": isPressed || void 0,
|
|
714
|
+
"data-focus-visible": isFocusVisible || void 0,
|
|
715
|
+
"data-disabled": props.isDisabled || void 0
|
|
716
|
+
}),
|
|
717
|
+
withObservedValues$e(
|
|
718
|
+
children,
|
|
719
|
+
{
|
|
720
|
+
hovered: isHovered,
|
|
721
|
+
pressed: isPressed,
|
|
722
|
+
focused: isFocused,
|
|
723
|
+
focusVisible: isFocusVisible,
|
|
724
|
+
disabled: !!rest.isDisabled
|
|
725
|
+
},
|
|
726
|
+
plasmicUpdateVariant
|
|
727
|
+
)
|
|
728
|
+
);
|
|
729
|
+
}
|
|
681
730
|
const BUTTON_COMPONENT_NAME = makeComponentName("button");
|
|
682
731
|
function registerButton(loader, overrides) {
|
|
683
732
|
registerComponentHelper(
|
|
@@ -690,11 +739,18 @@ function registerButton(loader, overrides) {
|
|
|
690
739
|
importName: "BaseButton",
|
|
691
740
|
variants: variants$h,
|
|
692
741
|
defaultStyles: {
|
|
693
|
-
|
|
694
|
-
|
|
742
|
+
// Ensure consistent design across rendered elements (button, anchor tag).
|
|
743
|
+
backgroundColor: "#EFEFEF",
|
|
695
744
|
borderColor: "black",
|
|
745
|
+
borderStyle: "solid",
|
|
746
|
+
borderWidth: "1px",
|
|
747
|
+
color: "#000000",
|
|
748
|
+
cursor: "pointer",
|
|
749
|
+
fontFamily: "Arial",
|
|
750
|
+
fontSize: "1rem",
|
|
751
|
+
lineHeight: "1.2",
|
|
696
752
|
padding: "2px 10px",
|
|
697
|
-
|
|
753
|
+
textDecorationLine: "none"
|
|
698
754
|
},
|
|
699
755
|
props: __spreadProps$m(__spreadValues$q({}, getCommonProps("button", [
|
|
700
756
|
"autoFocus",
|
|
@@ -709,11 +765,22 @@ function registerButton(loader, overrides) {
|
|
|
709
765
|
value: "Button"
|
|
710
766
|
}
|
|
711
767
|
},
|
|
768
|
+
href: {
|
|
769
|
+
type: "href",
|
|
770
|
+
description: "The URL this button navigates to. If present, this button is an <a> element."
|
|
771
|
+
},
|
|
772
|
+
target: {
|
|
773
|
+
type: "choice",
|
|
774
|
+
options: ["_blank", "_self", "_parent", "_top"],
|
|
775
|
+
description: "Same as target attribute of <a> element. Only applies when the href prop is present.",
|
|
776
|
+
hidden: (props) => !props.href,
|
|
777
|
+
defaultValueHint: "_self"
|
|
778
|
+
},
|
|
712
779
|
submitsForm: {
|
|
713
780
|
type: "boolean",
|
|
714
781
|
displayName: "Submits form?",
|
|
715
782
|
defaultValueHint: false,
|
|
716
|
-
hidden: (props) => Boolean(props.resetsForm),
|
|
783
|
+
hidden: (props) => Boolean(props.resetsForm) || Boolean(props.href),
|
|
717
784
|
description: "Whether clicking this button should submit the enclosing form.",
|
|
718
785
|
advanced: true
|
|
719
786
|
},
|
|
@@ -721,7 +788,7 @@ function registerButton(loader, overrides) {
|
|
|
721
788
|
type: "boolean",
|
|
722
789
|
displayName: "Resets form?",
|
|
723
790
|
defaultValueHint: false,
|
|
724
|
-
hidden: (props) => Boolean(props.submitsForm),
|
|
791
|
+
hidden: (props) => Boolean(props.submitsForm) || Boolean(props.href),
|
|
725
792
|
description: "Whether clicking this button should reset the enclosing form.",
|
|
726
793
|
advanced: true
|
|
727
794
|
},
|