@plasmicpkgs/react-aria 0.0.75 → 0.0.77

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 (74) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/contexts.d.ts +1 -1
  3. package/dist/react-aria.esm.js +52 -27
  4. package/dist/react-aria.esm.js.map +1 -1
  5. package/dist/react-aria.js +52 -27
  6. package/dist/react-aria.js.map +1 -1
  7. package/dist/registerPopover.d.ts +6 -2
  8. package/package.json +2 -2
  9. package/skinny/{contexts-081d65a0.esm.js → contexts-5cb81c2f.esm.js} +3 -3
  10. package/skinny/contexts-5cb81c2f.esm.js.map +1 -0
  11. package/skinny/{contexts-baa37b74.cjs.js → contexts-6d0cb2b1.cjs.js} +3 -3
  12. package/skinny/contexts-6d0cb2b1.cjs.js.map +1 -0
  13. package/skinny/contexts.d.ts +1 -1
  14. package/skinny/registerCheckbox.cjs.js +1 -1
  15. package/skinny/registerCheckbox.esm.js +1 -1
  16. package/skinny/registerCheckboxGroup.cjs.js +1 -1
  17. package/skinny/registerCheckboxGroup.esm.js +1 -1
  18. package/skinny/registerComboBox.cjs.js +6 -5
  19. package/skinny/registerComboBox.cjs.js.map +1 -1
  20. package/skinny/registerComboBox.esm.js +6 -5
  21. package/skinny/registerComboBox.esm.js.map +1 -1
  22. package/skinny/registerDialogTrigger.cjs.js +1 -1
  23. package/skinny/registerDialogTrigger.esm.js +1 -1
  24. package/skinny/registerInput.cjs.js +1 -1
  25. package/skinny/registerInput.esm.js +1 -1
  26. package/skinny/{registerListBox-64bcf3d2.esm.js → registerListBox-25d602fa.esm.js} +3 -5
  27. package/skinny/registerListBox-25d602fa.esm.js.map +1 -0
  28. package/skinny/{registerListBox-c2c63064.cjs.js → registerListBox-f4f6beb5.cjs.js} +8 -10
  29. package/skinny/registerListBox-f4f6beb5.cjs.js.map +1 -0
  30. package/skinny/registerListBox.cjs.js +2 -3
  31. package/skinny/registerListBox.cjs.js.map +1 -1
  32. package/skinny/registerListBox.esm.js +2 -3
  33. package/skinny/registerListBox.esm.js.map +1 -1
  34. package/skinny/registerListBoxItem.cjs.js +1 -1
  35. package/skinny/registerListBoxItem.esm.js +1 -1
  36. package/skinny/registerModal.cjs.js +1 -1
  37. package/skinny/registerModal.esm.js +1 -1
  38. package/skinny/registerPopover.cjs.js +40 -14
  39. package/skinny/registerPopover.cjs.js.map +1 -1
  40. package/skinny/registerPopover.d.ts +6 -2
  41. package/skinny/registerPopover.esm.js +41 -15
  42. package/skinny/registerPopover.esm.js.map +1 -1
  43. package/skinny/registerRadio.cjs.js +1 -1
  44. package/skinny/registerRadio.esm.js +1 -1
  45. package/skinny/registerRadioGroup.cjs.js +1 -1
  46. package/skinny/registerRadioGroup.esm.js +1 -1
  47. package/skinny/registerSection.cjs.js +2 -3
  48. package/skinny/registerSection.cjs.js.map +1 -1
  49. package/skinny/registerSection.esm.js +2 -3
  50. package/skinny/registerSection.esm.js.map +1 -1
  51. package/skinny/registerSelect.cjs.js +6 -5
  52. package/skinny/registerSelect.cjs.js.map +1 -1
  53. package/skinny/registerSelect.esm.js +6 -5
  54. package/skinny/registerSelect.esm.js.map +1 -1
  55. package/skinny/registerSlider.cjs.js +1 -2
  56. package/skinny/registerSlider.cjs.js.map +1 -1
  57. package/skinny/registerSlider.esm.js +1 -2
  58. package/skinny/registerSlider.esm.js.map +1 -1
  59. package/skinny/registerSliderThumb.cjs.js +1 -5
  60. package/skinny/registerSliderThumb.cjs.js.map +1 -1
  61. package/skinny/registerSliderThumb.esm.js +1 -5
  62. package/skinny/registerSliderThumb.esm.js.map +1 -1
  63. package/skinny/registerSliderTrack.cjs.js +5 -6
  64. package/skinny/registerSliderTrack.cjs.js.map +1 -1
  65. package/skinny/registerSliderTrack.esm.js +5 -6
  66. package/skinny/registerSliderTrack.esm.js.map +1 -1
  67. package/skinny/registerTextArea.cjs.js +1 -1
  68. package/skinny/registerTextArea.esm.js +1 -1
  69. package/skinny/registerTextField.cjs.js +1 -1
  70. package/skinny/registerTextField.esm.js +1 -1
  71. package/skinny/contexts-081d65a0.esm.js.map +0 -1
  72. package/skinny/contexts-baa37b74.cjs.js.map +0 -1
  73. package/skinny/registerListBox-64bcf3d2.esm.js.map +0 -1
  74. package/skinny/registerListBox-c2c63064.cjs.js.map +0 -1
@@ -8,7 +8,7 @@ export declare const PlasmicDialogTriggerContext: React.Context<import("./regist
8
8
  export type PlasmicSliderContextType<T extends number | number[]> = React.ComponentProps<typeof BaseSlider<T>> | undefined;
9
9
  export declare const PlasmicSliderContext: React.Context<PlasmicSliderContextType<number | number[]>>;
10
10
  export declare const PlasmicLabelContext: React.Context<import("react-aria-components").LabelProps | undefined>;
11
- export declare const PlasmicPopoverContext: React.Context<import("./registerPopover").BasePopoverProps | undefined>;
11
+ export declare const PlasmicPopoverTriggerContext: React.Context<boolean | undefined>;
12
12
  export declare const PlasmicListBoxContext: React.Context<{
13
13
  idManager: ListBoxItemIdManager;
14
14
  } | undefined>;
@@ -640,7 +640,7 @@ const PlasmicRadioGroupContext = React.createContext(void 0);
640
640
  const PlasmicDialogTriggerContext = React.createContext(void 0);
641
641
  const PlasmicSliderContext = React.createContext(void 0);
642
642
  React.createContext(void 0);
643
- const PlasmicPopoverContext = React.createContext(void 0);
643
+ const PlasmicPopoverTriggerContext = React.createContext(void 0);
644
644
  const PlasmicListBoxContext = React.createContext(void 0);
645
645
  React.createContext(void 0);
646
646
  const PlasmicInputContext = React.createContext(void 0);
@@ -1772,8 +1772,7 @@ function BaseSection(props) {
1772
1772
  const _a = props, { header, items } = _a, rest = __objRest$g(_a, ["header", "items"]);
1773
1773
  const contextProps = React.useContext(PlasmicListBoxContext);
1774
1774
  const isStandalone = !contextProps;
1775
- const mergedProps = mergeProps$1(contextProps, rest);
1776
- const section = /* @__PURE__ */ React.createElement(Section, __spreadValues$h({}, mergedProps), /* @__PURE__ */ React.createElement(Header, null, header), items);
1775
+ const section = /* @__PURE__ */ React.createElement(Section, __spreadValues$h({}, rest), /* @__PURE__ */ React.createElement(Header, null, header), items);
1777
1776
  if (isStandalone) {
1778
1777
  return (
1779
1778
  // BaseListbox should give section a listbox context (that it can't be used without)
@@ -2116,14 +2115,24 @@ const POPOVER_VARIANTS = [
2116
2115
  ];
2117
2116
  const { variants: variants$a, withObservedValues: withObservedValues$9 } = pickAriaComponentVariants(POPOVER_VARIANTS);
2118
2117
  function BasePopover(props) {
2119
- const _a = props, { resetClassName, plasmicUpdateVariant } = _a, restProps = __objRest$e(_a, ["resetClassName", "plasmicUpdateVariant"]);
2118
+ const _a = props, {
2119
+ resetClassName,
2120
+ plasmicUpdateVariant,
2121
+ setControlContextData,
2122
+ matchTriggerWidth
2123
+ } = _a, restProps = __objRest$e(_a, [
2124
+ "resetClassName",
2125
+ "plasmicUpdateVariant",
2126
+ "setControlContextData",
2127
+ "matchTriggerWidth"
2128
+ ]);
2120
2129
  const isStandalone = !React.useContext(PopoverContext);
2121
- const context = React.useContext(PlasmicPopoverContext);
2130
+ const hasTrigger = !!React.useContext(PlasmicPopoverTriggerContext);
2122
2131
  const triggerRef = React.useRef(null);
2123
2132
  const canvasContext = usePlasmicCanvasContext();
2133
+ const matchTriggerWidthProp = hasTrigger && matchTriggerWidth;
2124
2134
  const _b = mergeProps$1(
2125
2135
  {
2126
- isOpen: context == null ? void 0 : context.isOpen,
2127
2136
  // isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies.
2128
2137
  // Setting isNonModal to true in edit mode (canvas) means that the popover will not prevent the user from interacting with the canvas while the popover is open.
2129
2138
  isNonModal: canvasContext && !canvasContext.interactive
@@ -2139,16 +2148,27 @@ function BasePopover(props) {
2139
2148
  isOpen: true
2140
2149
  } : null
2141
2150
  ), { children } = _b, mergedProps = __objRest$e(_b, ["children"]);
2142
- return /* @__PURE__ */ React.createElement(React.Fragment, null, isStandalone && /* @__PURE__ */ React.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React.createElement(Popover, __spreadValues$f({}, mergedProps), ({ placement }) => withObservedValues$9(
2143
- children,
2144
- {
2145
- placementTop: placement === "top",
2146
- placementBottom: placement === "bottom",
2147
- placementLeft: placement === "left",
2148
- placementRight: placement === "right"
2149
- },
2150
- plasmicUpdateVariant
2151
- )));
2151
+ useEffect(() => {
2152
+ setControlContextData == null ? void 0 : setControlContextData({
2153
+ canMatchTriggerWidth: hasTrigger
2154
+ });
2155
+ }, [hasTrigger, setControlContextData]);
2156
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, isStandalone && /* @__PURE__ */ React.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React.createElement(
2157
+ Popover,
2158
+ __spreadValues$f({
2159
+ style: matchTriggerWidthProp ? { width: `var(--trigger-width)` } : void 0
2160
+ }, mergedProps),
2161
+ ({ placement }) => withObservedValues$9(
2162
+ children,
2163
+ {
2164
+ placementTop: placement === "top",
2165
+ placementBottom: placement === "bottom",
2166
+ placementLeft: placement === "left",
2167
+ placementRight: placement === "right"
2168
+ },
2169
+ plasmicUpdateVariant
2170
+ )
2171
+ ));
2152
2172
  }
2153
2173
  const POPOVER_COMPONENT_NAME = makeComponentName("popover");
2154
2174
  const POPOVER_ARROW_IMG = {
@@ -2239,6 +2259,11 @@ function registerPopover(loader, overrides) {
2239
2259
  },
2240
2260
  resetClassName: {
2241
2261
  type: "themeResetClass"
2262
+ },
2263
+ matchTriggerWidth: {
2264
+ type: "boolean",
2265
+ defaultValue: true,
2266
+ hidden: (_props, ctx) => !(ctx == null ? void 0 : ctx.canMatchTriggerWidth)
2242
2267
  }
2243
2268
  },
2244
2269
  // No isOpen state for popover, because we assume that its open state is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc.
@@ -2324,7 +2349,7 @@ function BaseComboBox(props) {
2324
2349
  isDisabled,
2325
2350
  className
2326
2351
  }, rest),
2327
- /* @__PURE__ */ React.createElement(PlasmicPopoverContext.Provider, { value: {} }, /* @__PURE__ */ React.createElement(
2352
+ /* @__PURE__ */ React.createElement(PlasmicPopoverTriggerContext.Provider, { value: true }, /* @__PURE__ */ React.createElement(
2328
2353
  PlasmicListBoxContext.Provider,
2329
2354
  {
2330
2355
  value: {
@@ -2434,7 +2459,8 @@ function registerComboBox(loader) {
2434
2459
  styles: {
2435
2460
  backgroundColor: "white",
2436
2461
  padding: "10px",
2437
- overflow: "scroll"
2462
+ overflow: "scroll",
2463
+ width: "unset"
2438
2464
  },
2439
2465
  props: {
2440
2466
  offset: 0,
@@ -3234,7 +3260,7 @@ function BaseSelect(props) {
3234
3260
  "aria-label": ariaLabel
3235
3261
  }, extractPlasmicDataProps(props)),
3236
3262
  /* @__PURE__ */ React.createElement(SelectAutoOpen, __spreadValues$8({}, props)),
3237
- /* @__PURE__ */ React.createElement(PlasmicPopoverContext.Provider, { value: {} }, /* @__PURE__ */ React.createElement(
3263
+ /* @__PURE__ */ React.createElement(PlasmicPopoverTriggerContext.Provider, { value: true }, /* @__PURE__ */ React.createElement(
3238
3264
  PlasmicListBoxContext.Provider,
3239
3265
  {
3240
3266
  value: {
@@ -3376,7 +3402,8 @@ function registerSelect(loader) {
3376
3402
  styles: {
3377
3403
  backgroundColor: "white",
3378
3404
  padding: "10px",
3379
- overflow: "scroll"
3405
+ overflow: "scroll",
3406
+ width: "unset"
3380
3407
  },
3381
3408
  props: {
3382
3409
  children: [
@@ -3549,9 +3576,7 @@ function BaseSliderThumb(_a) {
3549
3576
  "advanced",
3550
3577
  "plasmicUpdateVariant"
3551
3578
  ]);
3552
- const context = React.useContext(PlasmicSliderContext);
3553
- const mergedProps = mergeProps(context, rest);
3554
- const thumb = /* @__PURE__ */ React.createElement(SliderThumb, __spreadValues$6({}, mergedProps), ({ isDragging, isHovered, isFocused, isFocusVisible, isDisabled }) => withObservedValues$5(
3579
+ const thumb = /* @__PURE__ */ React.createElement(SliderThumb, __spreadValues$6({}, rest), ({ isDragging, isHovered, isFocused, isFocusVisible, isDisabled }) => withObservedValues$5(
3555
3580
  /* @__PURE__ */ React.createElement(React.Fragment, null, advanced ? children : void 0),
3556
3581
  {
3557
3582
  dragging: isDragging,
@@ -3665,15 +3690,15 @@ function isMultiValueGuard(value) {
3665
3690
  function BaseSliderTrack(props) {
3666
3691
  const context = React.useContext(PlasmicSliderContext);
3667
3692
  const isStandalone = !context;
3668
- const mergedProps = mergeProps(context, props);
3669
- const _a = mergedProps, { children, progressBar, plasmicUpdateVariant } = _a, rest = __objRest$5(_a, ["children", "progressBar", "plasmicUpdateVariant"]);
3670
- const isMultiValue = isMultiValueGuard(mergedProps.value);
3693
+ const _a = props, { children, progressBar, plasmicUpdateVariant } = _a, rest = __objRest$5(_a, ["children", "progressBar", "plasmicUpdateVariant"]);
3694
+ const thumbsLength = context && isMultiValueGuard(context.value) ? context.value.length : 1;
3695
+ const isMultiValue = thumbsLength > 1;
3671
3696
  const { minIndex, maxIndex } = useMemo(() => {
3672
3697
  if (!context || !Array.isArray(context.value) || context.value.length <= 1) {
3673
3698
  return { minIndex: 0, maxIndex: 0 };
3674
3699
  }
3675
3700
  return findMinMaxIndices(context.value);
3676
- }, [context == null ? void 0 : context.value]);
3701
+ }, [thumbsLength]);
3677
3702
  const thumbs = useMemo(() => {
3678
3703
  const thumbNodes = flattenChildren(children);
3679
3704
  if (!thumbNodes || thumbNodes.length === 0 || !isDefined(context == null ? void 0 : context.value)) {