@plasmicpkgs/react-aria 0.0.94 → 0.0.96

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.
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState, useMemo, useCallback, forwardRef, useImperativeHandle, Component } from 'react';
2
2
  import { mergeProps, useFocusable } from 'react-aria';
3
- import { Button, Checkbox, Text, Label, CheckboxGroup, Input, ListBoxItem, ListBox, Section, Header, PopoverContext, Popover, Dialog, ComboBox, ComboBoxStateContext, Heading, ModalOverlay, Modal, DialogTrigger, TooltipContext, OverlayArrow, Radio, RadioGroup, Select, SelectStateContext, SelectValue, SliderOutput, SliderThumb, Slider, SliderTrack, Switch, TextArea, TextField, TooltipTrigger, Tooltip } from 'react-aria-components';
3
+ 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
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';
@@ -2172,15 +2172,13 @@ function BasePopover(props) {
2172
2172
  canMatchTriggerWidth: hasTrigger
2173
2173
  });
2174
2174
  }, [hasTrigger, setControlContextData]);
2175
- const dialogInCanvas = /* @__PURE__ */ React.createElement("div", null, children);
2176
- const dialog = /* @__PURE__ */ React.createElement(Dialog, null, children);
2177
2175
  return /* @__PURE__ */ React.createElement(React.Fragment, null, isStandalone && /* @__PURE__ */ React.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React.createElement(
2178
2176
  Popover,
2179
2177
  __spreadValues$g({
2180
2178
  style: __spreadValues$g(__spreadValues$g({}, matchTriggerWidthProp ? { width: `var(--trigger-width)` } : {}), COMMON_STYLES)
2181
2179
  }, mergedProps),
2182
2180
  ({ placement }) => withObservedValues$a(
2183
- canvasContext || isStandalone ? dialogInCanvas : dialog,
2181
+ children,
2184
2182
  {
2185
2183
  placementTop: placement === "top",
2186
2184
  placementBottom: placement === "bottom",
@@ -2486,6 +2484,36 @@ function registerComboBox(loader) {
2486
2484
  });
2487
2485
  }
2488
2486
 
2487
+ function BaseDialog({ children, className }) {
2488
+ const canvasContext = usePlasmicCanvasContext();
2489
+ if (canvasContext) {
2490
+ return /* @__PURE__ */ React.createElement("div", { className, style: COMMON_STYLES }, children);
2491
+ } else {
2492
+ return /* @__PURE__ */ React.createElement(Dialog, { className, style: COMMON_STYLES }, children);
2493
+ }
2494
+ }
2495
+ const DIALOG_COMPONENT_NAME = makeComponentName("dialog");
2496
+ function registerDialog(loader, overrides) {
2497
+ registerComponentHelper(
2498
+ loader,
2499
+ BaseDialog,
2500
+ {
2501
+ name: DIALOG_COMPONENT_NAME,
2502
+ displayName: "Aria Dialog",
2503
+ importPath: "@plasmicpkgs/react-aria/skinny/registerDialog",
2504
+ importName: "BaseDialog",
2505
+ props: {
2506
+ children: {
2507
+ type: "slot",
2508
+ mergeWithParent: true
2509
+ }
2510
+ },
2511
+ trapsFocus: true
2512
+ },
2513
+ overrides
2514
+ );
2515
+ }
2516
+
2489
2517
  var __defProp$e = Object.defineProperty;
2490
2518
  var __defProps$c = Object.defineProperties;
2491
2519
  var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
@@ -2637,18 +2665,47 @@ const BaseModal = forwardRef(
2637
2665
  (_a2 = mergedProps.onOpenChange) == null ? void 0 : _a2.call(mergedProps, true);
2638
2666
  }
2639
2667
  }));
2640
- const dialogInCanvas = /* @__PURE__ */ React.createElement("div", { style: COMMON_STYLES, className }, children);
2641
- const dialog = /* @__PURE__ */ React.createElement(Dialog, { style: COMMON_STYLES, className }, children);
2642
2668
  return /* @__PURE__ */ React.createElement(
2643
2669
  ModalOverlay,
2644
2670
  __spreadProps$b(__spreadValues$d({}, mergedProps), {
2645
2671
  className: `${resetClassName} ${modalOverlayClass}`
2646
2672
  }),
2647
- /* @__PURE__ */ React.createElement(Modal, null, canvasCtx ? dialogInCanvas : dialog)
2673
+ /* @__PURE__ */ React.createElement(Modal, { className }, children)
2648
2674
  );
2649
2675
  }
2650
2676
  );
2651
2677
  const MODAL_COMPONENT_NAME = makeComponentName("modal");
2678
+ const MODAL_DEFAULT_SLOT_CONTENT = {
2679
+ type: "vbox",
2680
+ styles: {
2681
+ width: "stretch",
2682
+ padding: 0,
2683
+ gap: "10px",
2684
+ justifyContent: "flex-start",
2685
+ alignItems: "flex-start"
2686
+ },
2687
+ children: [
2688
+ {
2689
+ type: "component",
2690
+ name: HEADING_COMPONENT_NAME
2691
+ },
2692
+ {
2693
+ type: "text",
2694
+ value: "This is a Modal!"
2695
+ },
2696
+ {
2697
+ type: "text",
2698
+ value: "You can put anything you can imagine here!",
2699
+ styles: {
2700
+ fontWeight: 500
2701
+ }
2702
+ },
2703
+ {
2704
+ type: "text",
2705
+ value: "Use it in a `Aria Dialog Trigger` component to trigger it on a button click!"
2706
+ }
2707
+ ]
2708
+ };
2652
2709
  function registerModal(loader, overrides) {
2653
2710
  registerComponentHelper(
2654
2711
  loader,
@@ -2687,37 +2744,7 @@ function registerModal(loader, overrides) {
2687
2744
  children: {
2688
2745
  type: "slot",
2689
2746
  mergeWithParent: true,
2690
- defaultValue: {
2691
- type: "vbox",
2692
- styles: {
2693
- width: "stretch",
2694
- padding: 0,
2695
- gap: "10px",
2696
- justifyContent: "flex-start",
2697
- alignItems: "flex-start"
2698
- },
2699
- children: [
2700
- {
2701
- type: "component",
2702
- name: HEADING_COMPONENT_NAME
2703
- },
2704
- {
2705
- type: "text",
2706
- value: "This is a Modal!"
2707
- },
2708
- {
2709
- type: "text",
2710
- value: "You can put anything you can imagine here!",
2711
- styles: {
2712
- fontWeight: 500
2713
- }
2714
- },
2715
- {
2716
- type: "text",
2717
- value: "Use it in a `Aria Dialog Trigger` component to trigger it on a button click!"
2718
- }
2719
- ]
2720
- }
2747
+ defaultValue: MODAL_DEFAULT_SLOT_CONTENT
2721
2748
  },
2722
2749
  modalOverlayClass: {
2723
2750
  type: "class",
@@ -2813,7 +2840,6 @@ function registerDialogTrigger(loader, overrides) {
2813
2840
  importPath: "@plasmicpkgs/react-aria/skinny/registerDialogTrigger",
2814
2841
  importName: "BaseDialogTrigger",
2815
2842
  styleSections: false,
2816
- isAttachment: true,
2817
2843
  props: {
2818
2844
  trigger: {
2819
2845
  type: "slot",
@@ -2832,10 +2858,21 @@ function registerDialogTrigger(loader, overrides) {
2832
2858
  dialog: {
2833
2859
  type: "slot",
2834
2860
  mergeWithParent: true,
2835
- defaultValue: {
2836
- type: "component",
2837
- name: MODAL_COMPONENT_NAME
2838
- }
2861
+ defaultValue: [
2862
+ {
2863
+ type: "component",
2864
+ name: MODAL_COMPONENT_NAME,
2865
+ props: {
2866
+ children: {
2867
+ type: "component",
2868
+ name: DIALOG_COMPONENT_NAME,
2869
+ props: {
2870
+ children: MODAL_DEFAULT_SLOT_CONTENT
2871
+ }
2872
+ }
2873
+ }
2874
+ }
2875
+ ]
2839
2876
  },
2840
2877
  isOpen: {
2841
2878
  type: "boolean",
@@ -4925,6 +4962,7 @@ function registerAll(loader) {
4925
4962
  registerText(loader);
4926
4963
  registerHeading(loader);
4927
4964
  registerDescription(loader);
4965
+ registerDialog(loader);
4928
4966
  registerOverlayArrow(loader);
4929
4967
  registerSelect(loader);
4930
4968
  registerComboBox(loader);