@plasmicpkgs/react-aria 0.0.97 → 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.
Files changed (80) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/react-aria.esm.js +110 -28
  3. package/dist/react-aria.esm.js.map +1 -1
  4. package/dist/react-aria.js +109 -27
  5. package/dist/react-aria.js.map +1 -1
  6. package/dist/registerButton.d.ts +10 -3
  7. package/dist/registerOverlayArrow.d.ts +1 -0
  8. package/package.json +2 -2
  9. package/skinny/{common-bf3c2660.cjs.js → common-b3b54c72.cjs.js} +20 -5
  10. package/skinny/common-b3b54c72.cjs.js.map +1 -0
  11. package/skinny/{common-2dfadd70.esm.js → common-ceebbaea.esm.js} +20 -5
  12. package/skinny/common-ceebbaea.esm.js.map +1 -0
  13. package/skinny/registerButton.cjs.js +90 -23
  14. package/skinny/registerButton.cjs.js.map +1 -1
  15. package/skinny/registerButton.d.ts +10 -3
  16. package/skinny/registerButton.esm.js +91 -24
  17. package/skinny/registerButton.esm.js.map +1 -1
  18. package/skinny/registerCheckbox.cjs.js +1 -1
  19. package/skinny/registerCheckbox.esm.js +1 -1
  20. package/skinny/registerCheckboxGroup.cjs.js +1 -1
  21. package/skinny/registerCheckboxGroup.esm.js +1 -1
  22. package/skinny/registerComboBox.cjs.js +3 -3
  23. package/skinny/registerComboBox.esm.js +3 -3
  24. package/skinny/registerDescription.cjs.js +1 -1
  25. package/skinny/registerDescription.esm.js +1 -1
  26. package/skinny/registerDialog.cjs.js +1 -1
  27. package/skinny/registerDialog.esm.js +1 -1
  28. package/skinny/registerDialogTrigger.cjs.js +1 -1
  29. package/skinny/registerDialogTrigger.esm.js +1 -1
  30. package/skinny/registerHeading.cjs.js +1 -1
  31. package/skinny/registerHeading.esm.js +1 -1
  32. package/skinny/registerInput.cjs.js +1 -1
  33. package/skinny/registerInput.esm.js +1 -1
  34. package/skinny/registerLabel.cjs.js +1 -1
  35. package/skinny/registerLabel.esm.js +1 -1
  36. package/skinny/{registerListBox-5d2e3f2e.esm.js → registerListBox-40846430.esm.js} +2 -2
  37. package/skinny/{registerListBox-5d2e3f2e.esm.js.map → registerListBox-40846430.esm.js.map} +1 -1
  38. package/skinny/{registerListBox-9ba3ccfe.cjs.js → registerListBox-a99736df.cjs.js} +2 -2
  39. package/skinny/{registerListBox-9ba3ccfe.cjs.js.map → registerListBox-a99736df.cjs.js.map} +1 -1
  40. package/skinny/registerListBox.cjs.js +2 -2
  41. package/skinny/registerListBox.esm.js +2 -2
  42. package/skinny/registerListBoxItem.cjs.js +1 -1
  43. package/skinny/registerListBoxItem.esm.js +1 -1
  44. package/skinny/registerModal.cjs.js +1 -1
  45. package/skinny/registerModal.esm.js +1 -1
  46. package/skinny/registerOverlayArrow.cjs.js +2 -2
  47. package/skinny/registerOverlayArrow.cjs.js.map +1 -1
  48. package/skinny/registerOverlayArrow.d.ts +1 -0
  49. package/skinny/registerOverlayArrow.esm.js +2 -2
  50. package/skinny/registerOverlayArrow.esm.js.map +1 -1
  51. package/skinny/registerPopover.cjs.js +1 -1
  52. package/skinny/registerPopover.esm.js +1 -1
  53. package/skinny/registerRadio.cjs.js +1 -1
  54. package/skinny/registerRadio.esm.js +1 -1
  55. package/skinny/registerRadioGroup.cjs.js +1 -1
  56. package/skinny/registerRadioGroup.esm.js +1 -1
  57. package/skinny/registerSection.cjs.js +2 -2
  58. package/skinny/registerSection.esm.js +2 -2
  59. package/skinny/registerSelect.cjs.js +3 -3
  60. package/skinny/registerSelect.esm.js +3 -3
  61. package/skinny/registerSlider.cjs.js +1 -1
  62. package/skinny/registerSlider.esm.js +1 -1
  63. package/skinny/registerSliderOutput.cjs.js +1 -1
  64. package/skinny/registerSliderOutput.esm.js +1 -1
  65. package/skinny/registerSliderThumb.cjs.js +1 -1
  66. package/skinny/registerSliderThumb.esm.js +1 -1
  67. package/skinny/registerSliderTrack.cjs.js +1 -1
  68. package/skinny/registerSliderTrack.esm.js +1 -1
  69. package/skinny/registerSwitch.cjs.js +1 -1
  70. package/skinny/registerSwitch.esm.js +1 -1
  71. package/skinny/registerText.cjs.js +1 -1
  72. package/skinny/registerText.esm.js +1 -1
  73. package/skinny/registerTextArea.cjs.js +1 -1
  74. package/skinny/registerTextArea.esm.js +1 -1
  75. package/skinny/registerTextField.cjs.js +1 -1
  76. package/skinny/registerTextField.esm.js +1 -1
  77. package/skinny/registerTooltip.cjs.js +1 -1
  78. package/skinny/registerTooltip.esm.js +1 -1
  79. package/skinny/common-2dfadd70.esm.js.map +0 -1
  80. package/skinny/common-bf3c2660.cjs.js.map +0 -1
@@ -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';
@@ -446,13 +446,28 @@ function createPlacementProp(componentName, overrides) {
446
446
  type: "choice",
447
447
  description: `Default placement of the ${componentName} relative to the trigger, if there is enough space`,
448
448
  options: [
449
- // Not allowing other placement options here because of https://github.com/adobe/react-spectrum/issues/6825
450
- "top",
451
449
  "bottom",
450
+ "bottom left",
451
+ "bottom right",
452
+ "bottom start",
453
+ "bottom end",
454
+ "top",
455
+ "top left",
456
+ "top right",
457
+ "top start",
458
+ "top end",
459
+ "left",
460
+ "left top",
461
+ "left bottom",
452
462
  "start",
463
+ "start top",
464
+ "start bottom",
465
+ "right",
466
+ "right top",
467
+ "right bottom",
453
468
  "end",
454
- "left",
455
- "right"
469
+ "end top",
470
+ "end bottom"
456
471
  ]
457
472
  }, overrides != null ? overrides : {});
458
473
  }
@@ -637,24 +652,73 @@ const BUTTON_VARIANTS = [
637
652
  ];
638
653
  const { variants: variants$h, withObservedValues: withObservedValues$e } = pickAriaComponentVariants(BUTTON_VARIANTS);
639
654
  const BaseButton = React.forwardRef(function BaseButtonInner(props, ref) {
640
- const _a = props, { submitsForm, resetsForm, children, plasmicUpdateVariant } = _a, rest = __objRest$m(_a, ["submitsForm", "resetsForm", "children", "plasmicUpdateVariant"]);
641
- const type = submitsForm ? "submit" : resetsForm ? "reset" : "button";
642
- const mergedProps = mergeProps(rest, {
643
- type,
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,
644
698
  ref
645
699
  });
646
- return /* @__PURE__ */ React.createElement(Button, __spreadProps$m(__spreadValues$q({}, mergedProps), { style: COMMON_STYLES }), ({ isHovered, isPressed, isFocused, isFocusVisible, isDisabled }) => withObservedValues$e(
647
- children,
648
- {
649
- hovered: isHovered,
650
- pressed: isPressed,
651
- focused: isFocused,
652
- focusVisible: isFocusVisible,
653
- disabled: isDisabled
654
- },
655
- plasmicUpdateVariant
656
- ));
657
- });
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
+ }
658
722
  const BUTTON_COMPONENT_NAME = makeComponentName("button");
659
723
  function registerButton(loader, overrides) {
660
724
  registerComponentHelper(
@@ -667,11 +731,18 @@ function registerButton(loader, overrides) {
667
731
  importName: "BaseButton",
668
732
  variants: variants$h,
669
733
  defaultStyles: {
670
- borderWidth: "1px",
671
- borderStyle: "solid",
734
+ // Ensure consistent design across rendered elements (button, anchor tag).
735
+ backgroundColor: "#EFEFEF",
672
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",
673
744
  padding: "2px 10px",
674
- cursor: "pointer"
745
+ textDecorationLine: "none"
675
746
  },
676
747
  props: __spreadProps$m(__spreadValues$q({}, getCommonProps("button", [
677
748
  "autoFocus",
@@ -686,11 +757,22 @@ function registerButton(loader, overrides) {
686
757
  value: "Button"
687
758
  }
688
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
+ },
689
771
  submitsForm: {
690
772
  type: "boolean",
691
773
  displayName: "Submits form?",
692
774
  defaultValueHint: false,
693
- hidden: (props) => Boolean(props.resetsForm),
775
+ hidden: (props) => Boolean(props.resetsForm) || Boolean(props.href),
694
776
  description: "Whether clicking this button should submit the enclosing form.",
695
777
  advanced: true
696
778
  },
@@ -698,7 +780,7 @@ function registerButton(loader, overrides) {
698
780
  type: "boolean",
699
781
  displayName: "Resets form?",
700
782
  defaultValueHint: false,
701
- hidden: (props) => Boolean(props.submitsForm),
783
+ hidden: (props) => Boolean(props.submitsForm) || Boolean(props.href),
702
784
  description: "Whether clicking this button should reset the enclosing form.",
703
785
  advanced: true
704
786
  },
@@ -2939,7 +3021,7 @@ function BaseOverlayArrow({
2939
3021
  className
2940
3022
  },
2941
3023
  ({ placement }) => withObservedValues$9(
2942
- /* @__PURE__ */ React.createElement(React.Fragment, null, children),
3024
+ children,
2943
3025
  {
2944
3026
  placementTop: placement === "top",
2945
3027
  placementLeft: placement === "left",