@plasmicpkgs/react-aria 0.0.95 → 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.
@@ -2158,8 +2158,6 @@ function BasePopover(props) {
2158
2158
  const triggerRef = React__default.default.useRef(null);
2159
2159
  const canvasContext = host.usePlasmicCanvasContext();
2160
2160
  const matchTriggerWidthProp = hasTrigger && matchTriggerWidth;
2161
- const dialogTriggerContext = React__default.default.useContext(PlasmicDialogTriggerContext);
2162
- const shouldTrapFocus = !canvasContext && !!dialogTriggerContext;
2163
2161
  const _b = utils.mergeProps(
2164
2162
  {
2165
2163
  // isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies.
@@ -2182,15 +2180,13 @@ function BasePopover(props) {
2182
2180
  canMatchTriggerWidth: hasTrigger
2183
2181
  });
2184
2182
  }, [hasTrigger, setControlContextData]);
2185
- const withoutDialog = /* @__PURE__ */ React__default.default.createElement("div", null, children);
2186
- const dialog = /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Dialog, null, children);
2187
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(
2188
2184
  reactAriaComponents.Popover,
2189
2185
  __spreadValues$g({
2190
2186
  style: __spreadValues$g(__spreadValues$g({}, matchTriggerWidthProp ? { width: `var(--trigger-width)` } : {}), COMMON_STYLES)
2191
2187
  }, mergedProps),
2192
2188
  ({ placement }) => withObservedValues$a(
2193
- shouldTrapFocus ? dialog : withoutDialog,
2189
+ children,
2194
2190
  {
2195
2191
  placementTop: placement === "top",
2196
2192
  placementBottom: placement === "bottom",
@@ -2496,6 +2492,36 @@ function registerComboBox(loader) {
2496
2492
  });
2497
2493
  }
2498
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
+
2499
2525
  var __defProp$e = Object.defineProperty;
2500
2526
  var __defProps$c = Object.defineProperties;
2501
2527
  var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
@@ -2647,18 +2673,47 @@ const BaseModal = React.forwardRef(
2647
2673
  (_a2 = mergedProps.onOpenChange) == null ? void 0 : _a2.call(mergedProps, true);
2648
2674
  }
2649
2675
  }));
2650
- const dialogInCanvas = /* @__PURE__ */ React__default.default.createElement("div", { style: COMMON_STYLES, className }, children);
2651
- const dialog = /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Dialog, { style: COMMON_STYLES, className }, children);
2652
2676
  return /* @__PURE__ */ React__default.default.createElement(
2653
2677
  reactAriaComponents.ModalOverlay,
2654
2678
  __spreadProps$b(__spreadValues$d({}, mergedProps), {
2655
2679
  className: `${resetClassName} ${modalOverlayClass}`
2656
2680
  }),
2657
- /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Modal, null, canvasCtx ? dialogInCanvas : dialog)
2681
+ /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Modal, { className }, children)
2658
2682
  );
2659
2683
  }
2660
2684
  );
2661
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
+ };
2662
2717
  function registerModal(loader, overrides) {
2663
2718
  registerComponentHelper(
2664
2719
  loader,
@@ -2697,37 +2752,7 @@ function registerModal(loader, overrides) {
2697
2752
  children: {
2698
2753
  type: "slot",
2699
2754
  mergeWithParent: true,
2700
- defaultValue: {
2701
- type: "vbox",
2702
- styles: {
2703
- width: "stretch",
2704
- padding: 0,
2705
- gap: "10px",
2706
- justifyContent: "flex-start",
2707
- alignItems: "flex-start"
2708
- },
2709
- children: [
2710
- {
2711
- type: "component",
2712
- name: HEADING_COMPONENT_NAME
2713
- },
2714
- {
2715
- type: "text",
2716
- value: "This is a Modal!"
2717
- },
2718
- {
2719
- type: "text",
2720
- value: "You can put anything you can imagine here!",
2721
- styles: {
2722
- fontWeight: 500
2723
- }
2724
- },
2725
- {
2726
- type: "text",
2727
- value: "Use it in a `Aria Dialog Trigger` component to trigger it on a button click!"
2728
- }
2729
- ]
2730
- }
2755
+ defaultValue: MODAL_DEFAULT_SLOT_CONTENT
2731
2756
  },
2732
2757
  modalOverlayClass: {
2733
2758
  type: "class",
@@ -2823,7 +2848,6 @@ function registerDialogTrigger(loader, overrides) {
2823
2848
  importPath: "@plasmicpkgs/react-aria/skinny/registerDialogTrigger",
2824
2849
  importName: "BaseDialogTrigger",
2825
2850
  styleSections: false,
2826
- isAttachment: true,
2827
2851
  props: {
2828
2852
  trigger: {
2829
2853
  type: "slot",
@@ -2842,10 +2866,21 @@ function registerDialogTrigger(loader, overrides) {
2842
2866
  dialog: {
2843
2867
  type: "slot",
2844
2868
  mergeWithParent: true,
2845
- defaultValue: {
2846
- type: "component",
2847
- name: MODAL_COMPONENT_NAME
2848
- }
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
+ ]
2849
2884
  },
2850
2885
  isOpen: {
2851
2886
  type: "boolean",
@@ -4935,6 +4970,7 @@ function registerAll(loader) {
4935
4970
  registerText(loader);
4936
4971
  registerHeading(loader);
4937
4972
  registerDescription(loader);
4973
+ registerDialog(loader);
4938
4974
  registerOverlayArrow(loader);
4939
4975
  registerSelect(loader);
4940
4976
  registerComboBox(loader);