@plasmicpkgs/react-aria 0.0.82 → 0.0.83

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 (48) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/react-aria.esm.js +38 -36
  3. package/dist/react-aria.esm.js.map +1 -1
  4. package/dist/react-aria.js +38 -36
  5. package/dist/react-aria.js.map +1 -1
  6. package/package.json +2 -2
  7. package/skinny/{common-4b974d89.cjs.js → common-1e5dba7d.cjs.js} +2 -2
  8. package/skinny/common-1e5dba7d.cjs.js.map +1 -0
  9. package/skinny/{common-1a6affb0.esm.js → common-a8f4a4b1.esm.js} +2 -2
  10. package/skinny/common-a8f4a4b1.esm.js.map +1 -0
  11. package/skinny/registerButton.cjs.js +21 -29
  12. package/skinny/registerButton.cjs.js.map +1 -1
  13. package/skinny/registerButton.esm.js +21 -29
  14. package/skinny/registerButton.esm.js.map +1 -1
  15. package/skinny/registerCheckbox.cjs.js +1 -1
  16. package/skinny/registerCheckbox.esm.js +1 -1
  17. package/skinny/registerCheckboxGroup.cjs.js +1 -1
  18. package/skinny/registerCheckboxGroup.esm.js +1 -1
  19. package/skinny/registerComboBox.cjs.js +2 -2
  20. package/skinny/registerComboBox.esm.js +2 -2
  21. package/skinny/registerDialogTrigger.cjs.js +1 -1
  22. package/skinny/registerDialogTrigger.esm.js +1 -1
  23. package/skinny/registerInput.cjs.js +1 -1
  24. package/skinny/registerInput.esm.js +1 -1
  25. package/skinny/registerModal.cjs.js +7 -7
  26. package/skinny/registerModal.cjs.js.map +1 -1
  27. package/skinny/registerModal.esm.js +8 -8
  28. package/skinny/registerModal.esm.js.map +1 -1
  29. package/skinny/registerRadio.cjs.js +1 -1
  30. package/skinny/registerRadio.esm.js +1 -1
  31. package/skinny/registerRadioGroup.cjs.js +1 -1
  32. package/skinny/registerRadioGroup.esm.js +1 -1
  33. package/skinny/registerSelect.cjs.js +13 -3
  34. package/skinny/registerSelect.cjs.js.map +1 -1
  35. package/skinny/registerSelect.esm.js +13 -3
  36. package/skinny/registerSelect.esm.js.map +1 -1
  37. package/skinny/registerSlider.cjs.js +1 -1
  38. package/skinny/registerSlider.esm.js +1 -1
  39. package/skinny/registerSliderThumb.cjs.js +1 -1
  40. package/skinny/registerSliderThumb.esm.js +1 -1
  41. package/skinny/registerSwitch.cjs.js +1 -1
  42. package/skinny/registerSwitch.esm.js +1 -1
  43. package/skinny/registerTextArea.cjs.js +1 -1
  44. package/skinny/registerTextArea.esm.js +1 -1
  45. package/skinny/registerTextField.cjs.js +1 -1
  46. package/skinny/registerTextField.esm.js +1 -1
  47. package/skinny/common-1a6affb0.esm.js.map +0 -1
  48. package/skinny/common-4b974d89.cjs.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import { usePlasmicCanvasContext, usePlasmicCanvasComponentInfo } from '@plasmicapp/host';
2
1
  import React, { useEffect, useState, useMemo, forwardRef, useImperativeHandle, Component } from 'react';
3
2
  import { mergeProps, useFocusable } from 'react-aria';
4
3
  import { Button, Checkbox, Text, Label, CheckboxGroup, Input, ListBoxItem, ListBox, Section, Header, PopoverContext, Popover, ComboBox, ComboBoxStateContext, Heading, ModalOverlay, Modal, Dialog, DialogTrigger, 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';
@@ -171,7 +171,7 @@ function createAriaLabelProp(componentName) {
171
171
  return {
172
172
  type: "string",
173
173
  displayName: "ARIA label",
174
- description: `Label for this ${componentName}, if no visible label is used, to identify the element to assistive technology`,
174
+ description: `Assistive technology uses this if there is no visible label for this ${componentName}`,
175
175
  advanced: true,
176
176
  hidden: hasParent
177
177
  };
@@ -555,33 +555,25 @@ const BUTTON_VARIANTS = [
555
555
  "disabled"
556
556
  ];
557
557
  const { variants: variants$f, withObservedValues: withObservedValues$d } = pickAriaComponentVariants(BUTTON_VARIANTS);
558
- const BaseButton = React.forwardRef(
559
- (props, ref) => {
560
- var _b;
561
- const _a = props, { submitsForm, resetsForm, children, plasmicUpdateVariant } = _a, rest = __objRest$m(_a, ["submitsForm", "resetsForm", "children", "plasmicUpdateVariant"]);
562
- const canvasContext = (_b = usePlasmicCanvasContext) == null ? void 0 : _b();
563
- const isEditMode = canvasContext && canvasContext.interactive === false;
564
- const type = submitsForm ? "submit" : resetsForm ? "reset" : "button";
565
- const mergedProps = mergeProps(rest, {
566
- type,
567
- ref,
568
- // The rich text editor can cancel effect of clicks/hover, but not of key strokes.
569
- // When pressing space key, the button's "pressed" state is triggered, and the rich text editor loses focus as a result.
570
- preventFocusOnPress: isEditMode
571
- });
572
- return /* @__PURE__ */ React.createElement(Button, __spreadValues$p({}, mergedProps), ({ isHovered, isPressed, isFocused, isFocusVisible, isDisabled }) => withObservedValues$d(
573
- children,
574
- {
575
- hovered: isHovered,
576
- pressed: isPressed,
577
- focused: isFocused,
578
- focusVisible: isFocusVisible,
579
- disabled: isDisabled
580
- },
581
- plasmicUpdateVariant
582
- ));
583
- }
584
- );
558
+ const BaseButton = React.forwardRef(function BaseButtonInner(props, ref) {
559
+ const _a = props, { submitsForm, resetsForm, children, plasmicUpdateVariant } = _a, rest = __objRest$m(_a, ["submitsForm", "resetsForm", "children", "plasmicUpdateVariant"]);
560
+ const type = submitsForm ? "submit" : resetsForm ? "reset" : "button";
561
+ const mergedProps = mergeProps(rest, {
562
+ type,
563
+ ref
564
+ });
565
+ return /* @__PURE__ */ React.createElement(Button, __spreadValues$p({}, mergedProps), ({ isHovered, isPressed, isFocused, isFocusVisible, isDisabled }) => withObservedValues$d(
566
+ children,
567
+ {
568
+ hovered: isHovered,
569
+ pressed: isPressed,
570
+ focused: isFocused,
571
+ focusVisible: isFocusVisible,
572
+ disabled: isDisabled
573
+ },
574
+ plasmicUpdateVariant
575
+ ));
576
+ });
585
577
  const BUTTON_COMPONENT_NAME = makeComponentName("button");
586
578
  function registerButton(loader, overrides) {
587
579
  registerComponentHelper(
@@ -2459,7 +2451,7 @@ const INLINE_STYLES = {
2459
2451
  outline: "none"
2460
2452
  };
2461
2453
  const BaseModal = forwardRef(
2462
- function _BaseModal(props, ref) {
2454
+ function BaseModalInner(props, ref) {
2463
2455
  var _b, _c, _d;
2464
2456
  const _a = props, {
2465
2457
  children,
@@ -2478,6 +2470,8 @@ const BaseModal = forwardRef(
2478
2470
  "setControlContextData",
2479
2471
  "isDismissable"
2480
2472
  ]);
2473
+ const canvasCtx = usePlasmicCanvasContext();
2474
+ const isEditMode = canvasCtx && canvasCtx.interactive === false;
2481
2475
  const isSelected = (_d = (_c = (_b = usePlasmicCanvasComponentInfo) == null ? void 0 : _b(props)) == null ? void 0 : _c.isSelected) != null ? _d : false;
2482
2476
  const contextProps = React.useContext(PlasmicDialogTriggerContext);
2483
2477
  const isStandalone = !contextProps;
@@ -2488,10 +2482,9 @@ const BaseModal = forwardRef(
2488
2482
  1. Clicking anywhere inside the modal dismisses it
2489
2483
  2. If the modal is auto-opened due to selection in outline tab, the modal stays open despite issue #1, but the text elements inside the modal are no longer selectable, and therefore the text or headings inside the modal are not editable.
2490
2484
 
2491
- To fix the above issue, we set an interim isDismissable state to false while the modal is auto-open (`isSelected` is true).
2492
- Also note that `isSelected` can only be true in canvas (non-interactive mode), so we can safely (temporarily) set `isDismissable` to false in this case, because it only matters in interactive mode.
2485
+ To fix the above issue, we set an interim isDismissable state to false in edit mode, because it only matters in interactive mode.
2493
2486
  */
2494
- isDismissable: isSelected ? false : isDismissable
2487
+ isDismissable: isEditMode ? false : isDismissable
2495
2488
  });
2496
2489
  setControlContextData == null ? void 0 : setControlContextData({
2497
2490
  parent: isStandalone ? void 0 : {}
@@ -2506,7 +2499,6 @@ const BaseModal = forwardRef(
2506
2499
  (_a2 = mergedProps.onOpenChange) == null ? void 0 : _a2.call(mergedProps, true);
2507
2500
  }
2508
2501
  }));
2509
- const isCanvas = usePlasmicCanvasContext();
2510
2502
  const bodyInCanvas = /* @__PURE__ */ React.createElement("div", { style: INLINE_STYLES }, children);
2511
2503
  const bodyInPreview = /* @__PURE__ */ React.createElement(Dialog, { style: INLINE_STYLES }, children);
2512
2504
  return /* @__PURE__ */ React.createElement(
@@ -2514,7 +2506,7 @@ const BaseModal = forwardRef(
2514
2506
  __spreadProps$8(__spreadValues$c({}, mergedProps), {
2515
2507
  className: `${resetClassName} ${modalOverlayClass}`
2516
2508
  }),
2517
- /* @__PURE__ */ React.createElement(Modal, { className }, isCanvas ? bodyInCanvas : bodyInPreview)
2509
+ /* @__PURE__ */ React.createElement(Modal, { className }, canvasCtx ? bodyInCanvas : bodyInPreview)
2518
2510
  );
2519
2511
  }
2520
2512
  );
@@ -3057,7 +3049,17 @@ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
3057
3049
  function SelectAutoOpen(props) {
3058
3050
  var _a;
3059
3051
  const { open, close } = (_a = React.useContext(SelectStateContext)) != null ? _a : {};
3060
- useAutoOpen({ props, open, close });
3052
+ useAutoOpen({
3053
+ props,
3054
+ open: () => {
3055
+ open == null ? void 0 : open();
3056
+ setTimeout(() => {
3057
+ var _a2, _b;
3058
+ (_b = (_a2 = window.parent.document.activeElement) == null ? void 0 : _a2.blur) == null ? void 0 : _b.call(_a2);
3059
+ });
3060
+ },
3061
+ close
3062
+ });
3061
3063
  return null;
3062
3064
  }
3063
3065
  const BaseSelectValue = (props) => {