@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.
@@ -2180,15 +2180,13 @@ function BasePopover(props) {
2180
2180
  canMatchTriggerWidth: hasTrigger
2181
2181
  });
2182
2182
  }, [hasTrigger, setControlContextData]);
2183
- const dialogInCanvas = /* @__PURE__ */ React__default.default.createElement("div", null, children);
2184
- const dialog = /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Dialog, null, children);
2185
2183
  return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, isStandalone && /* @__PURE__ */ React__default.default.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React__default.default.createElement(
2186
2184
  reactAriaComponents.Popover,
2187
2185
  __spreadValues$g({
2188
2186
  style: __spreadValues$g(__spreadValues$g({}, matchTriggerWidthProp ? { width: `var(--trigger-width)` } : {}), COMMON_STYLES)
2189
2187
  }, mergedProps),
2190
2188
  ({ placement }) => withObservedValues$a(
2191
- canvasContext || isStandalone ? dialogInCanvas : dialog,
2189
+ children,
2192
2190
  {
2193
2191
  placementTop: placement === "top",
2194
2192
  placementBottom: placement === "bottom",
@@ -2494,6 +2492,36 @@ function registerComboBox(loader) {
2494
2492
  });
2495
2493
  }
2496
2494
 
2495
+ function BaseDialog({ children, className }) {
2496
+ const canvasContext = host.usePlasmicCanvasContext();
2497
+ if (canvasContext) {
2498
+ return /* @__PURE__ */ React__default.default.createElement("div", { className, style: COMMON_STYLES }, children);
2499
+ } else {
2500
+ return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Dialog, { className, style: COMMON_STYLES }, children);
2501
+ }
2502
+ }
2503
+ const DIALOG_COMPONENT_NAME = makeComponentName("dialog");
2504
+ function registerDialog(loader, overrides) {
2505
+ registerComponentHelper(
2506
+ loader,
2507
+ BaseDialog,
2508
+ {
2509
+ name: DIALOG_COMPONENT_NAME,
2510
+ displayName: "Aria Dialog",
2511
+ importPath: "@plasmicpkgs/react-aria/skinny/registerDialog",
2512
+ importName: "BaseDialog",
2513
+ props: {
2514
+ children: {
2515
+ type: "slot",
2516
+ mergeWithParent: true
2517
+ }
2518
+ },
2519
+ trapsFocus: true
2520
+ },
2521
+ overrides
2522
+ );
2523
+ }
2524
+
2497
2525
  var __defProp$e = Object.defineProperty;
2498
2526
  var __defProps$c = Object.defineProperties;
2499
2527
  var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
@@ -2645,18 +2673,47 @@ const BaseModal = React.forwardRef(
2645
2673
  (_a2 = mergedProps.onOpenChange) == null ? void 0 : _a2.call(mergedProps, true);
2646
2674
  }
2647
2675
  }));
2648
- const dialogInCanvas = /* @__PURE__ */ React__default.default.createElement("div", { style: COMMON_STYLES, className }, children);
2649
- const dialog = /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Dialog, { style: COMMON_STYLES, className }, children);
2650
2676
  return /* @__PURE__ */ React__default.default.createElement(
2651
2677
  reactAriaComponents.ModalOverlay,
2652
2678
  __spreadProps$b(__spreadValues$d({}, mergedProps), {
2653
2679
  className: `${resetClassName} ${modalOverlayClass}`
2654
2680
  }),
2655
- /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Modal, null, canvasCtx ? dialogInCanvas : dialog)
2681
+ /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Modal, { className }, children)
2656
2682
  );
2657
2683
  }
2658
2684
  );
2659
2685
  const MODAL_COMPONENT_NAME = makeComponentName("modal");
2686
+ const MODAL_DEFAULT_SLOT_CONTENT = {
2687
+ type: "vbox",
2688
+ styles: {
2689
+ width: "stretch",
2690
+ padding: 0,
2691
+ gap: "10px",
2692
+ justifyContent: "flex-start",
2693
+ alignItems: "flex-start"
2694
+ },
2695
+ children: [
2696
+ {
2697
+ type: "component",
2698
+ name: HEADING_COMPONENT_NAME
2699
+ },
2700
+ {
2701
+ type: "text",
2702
+ value: "This is a Modal!"
2703
+ },
2704
+ {
2705
+ type: "text",
2706
+ value: "You can put anything you can imagine here!",
2707
+ styles: {
2708
+ fontWeight: 500
2709
+ }
2710
+ },
2711
+ {
2712
+ type: "text",
2713
+ value: "Use it in a `Aria Dialog Trigger` component to trigger it on a button click!"
2714
+ }
2715
+ ]
2716
+ };
2660
2717
  function registerModal(loader, overrides) {
2661
2718
  registerComponentHelper(
2662
2719
  loader,
@@ -2695,37 +2752,7 @@ function registerModal(loader, overrides) {
2695
2752
  children: {
2696
2753
  type: "slot",
2697
2754
  mergeWithParent: true,
2698
- defaultValue: {
2699
- type: "vbox",
2700
- styles: {
2701
- width: "stretch",
2702
- padding: 0,
2703
- gap: "10px",
2704
- justifyContent: "flex-start",
2705
- alignItems: "flex-start"
2706
- },
2707
- children: [
2708
- {
2709
- type: "component",
2710
- name: HEADING_COMPONENT_NAME
2711
- },
2712
- {
2713
- type: "text",
2714
- value: "This is a Modal!"
2715
- },
2716
- {
2717
- type: "text",
2718
- value: "You can put anything you can imagine here!",
2719
- styles: {
2720
- fontWeight: 500
2721
- }
2722
- },
2723
- {
2724
- type: "text",
2725
- value: "Use it in a `Aria Dialog Trigger` component to trigger it on a button click!"
2726
- }
2727
- ]
2728
- }
2755
+ defaultValue: MODAL_DEFAULT_SLOT_CONTENT
2729
2756
  },
2730
2757
  modalOverlayClass: {
2731
2758
  type: "class",
@@ -2821,7 +2848,6 @@ function registerDialogTrigger(loader, overrides) {
2821
2848
  importPath: "@plasmicpkgs/react-aria/skinny/registerDialogTrigger",
2822
2849
  importName: "BaseDialogTrigger",
2823
2850
  styleSections: false,
2824
- isAttachment: true,
2825
2851
  props: {
2826
2852
  trigger: {
2827
2853
  type: "slot",
@@ -2840,10 +2866,21 @@ function registerDialogTrigger(loader, overrides) {
2840
2866
  dialog: {
2841
2867
  type: "slot",
2842
2868
  mergeWithParent: true,
2843
- defaultValue: {
2844
- type: "component",
2845
- name: MODAL_COMPONENT_NAME
2846
- }
2869
+ defaultValue: [
2870
+ {
2871
+ type: "component",
2872
+ name: MODAL_COMPONENT_NAME,
2873
+ props: {
2874
+ children: {
2875
+ type: "component",
2876
+ name: DIALOG_COMPONENT_NAME,
2877
+ props: {
2878
+ children: MODAL_DEFAULT_SLOT_CONTENT
2879
+ }
2880
+ }
2881
+ }
2882
+ }
2883
+ ]
2847
2884
  },
2848
2885
  isOpen: {
2849
2886
  type: "boolean",
@@ -4933,6 +4970,7 @@ function registerAll(loader) {
4933
4970
  registerText(loader);
4934
4971
  registerHeading(loader);
4935
4972
  registerDescription(loader);
4973
+ registerDialog(loader);
4936
4974
  registerOverlayArrow(loader);
4937
4975
  registerSelect(loader);
4938
4976
  registerComboBox(loader);