@plasmicpkgs/react-aria 0.0.35 → 0.0.37
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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/contexts.d.ts +2 -1
- package/dist/interaction-variant-utils.d.ts +4 -0
- package/dist/react-aria.esm.js +69 -49
- package/dist/react-aria.esm.js.map +1 -1
- package/dist/react-aria.js +67 -47
- package/dist/react-aria.js.map +1 -1
- package/dist/registerPopover.d.ts +6 -1
- package/dist/registerRadio.d.ts +2 -4
- package/dist/utils.d.ts +1 -0
- package/package.json +2 -2
- package/skinny/contexts-9475faad.esm.js.map +1 -1
- package/skinny/contexts-b21f6b12.cjs.js.map +1 -1
- package/skinny/contexts.d.ts +2 -1
- package/skinny/{interaction-variant-utils-c44a9d56.esm.js → interaction-variant-utils-0e04f834.esm.js} +5 -1
- package/skinny/interaction-variant-utils-0e04f834.esm.js.map +1 -0
- package/skinny/{interaction-variant-utils-244b74fb.cjs.js → interaction-variant-utils-d45aa2a2.cjs.js} +5 -1
- package/skinny/interaction-variant-utils-d45aa2a2.cjs.js.map +1 -0
- package/skinny/interaction-variant-utils.d.ts +4 -0
- package/skinny/registerButton.cjs.js +4 -3
- package/skinny/registerButton.cjs.js.map +1 -1
- package/skinny/registerButton.esm.js +4 -3
- package/skinny/registerButton.esm.js.map +1 -1
- package/skinny/registerCheckbox.cjs.js +2 -2
- package/skinny/registerCheckbox.esm.js +2 -2
- package/skinny/registerCheckboxGroup.cjs.js +2 -2
- package/skinny/registerCheckboxGroup.esm.js +2 -2
- package/skinny/registerComboBox.cjs.js +5 -3
- package/skinny/registerComboBox.cjs.js.map +1 -1
- package/skinny/registerComboBox.esm.js +5 -3
- package/skinny/registerComboBox.esm.js.map +1 -1
- package/skinny/registerDescription.cjs.js +1 -1
- package/skinny/registerDescription.esm.js +1 -1
- package/skinny/registerDialogTrigger.cjs.js +2 -2
- package/skinny/registerDialogTrigger.esm.js +2 -2
- package/skinny/registerFieldError.cjs.js +1 -1
- package/skinny/registerFieldError.esm.js +1 -1
- package/skinny/registerForm.cjs.js +1 -1
- package/skinny/registerForm.esm.js +1 -1
- package/skinny/registerHeader.cjs.js +1 -1
- package/skinny/registerHeader.esm.js +1 -1
- package/skinny/registerInput.cjs.js +2 -2
- package/skinny/registerInput.esm.js +2 -2
- package/skinny/registerLabel.cjs.js +1 -1
- package/skinny/registerLabel.esm.js +1 -1
- package/skinny/{registerListBox-1effa43d.esm.js → registerListBox-cbc7beea.esm.js} +2 -2
- package/skinny/{registerListBox-1effa43d.esm.js.map → registerListBox-cbc7beea.esm.js.map} +1 -1
- package/skinny/{registerListBox-837b90d8.cjs.js → registerListBox-e98e849f.cjs.js} +2 -2
- package/skinny/{registerListBox-837b90d8.cjs.js.map → registerListBox-e98e849f.cjs.js.map} +1 -1
- package/skinny/registerListBox.cjs.js +3 -2
- package/skinny/registerListBox.cjs.js.map +1 -1
- package/skinny/registerListBox.esm.js +3 -2
- package/skinny/registerListBox.esm.js.map +1 -1
- package/skinny/registerListBoxItem.cjs.js +4 -2
- package/skinny/registerListBoxItem.cjs.js.map +1 -1
- package/skinny/registerListBoxItem.esm.js +5 -3
- package/skinny/registerListBoxItem.esm.js.map +1 -1
- package/skinny/registerModal.cjs.js +1 -1
- package/skinny/registerModal.esm.js +1 -1
- package/skinny/registerPopover.cjs.js +30 -6
- package/skinny/registerPopover.cjs.js.map +1 -1
- package/skinny/registerPopover.d.ts +6 -1
- package/skinny/registerPopover.esm.js +31 -7
- package/skinny/registerPopover.esm.js.map +1 -1
- package/skinny/registerRadio.cjs.js +8 -24
- package/skinny/registerRadio.cjs.js.map +1 -1
- package/skinny/registerRadio.d.ts +2 -4
- package/skinny/registerRadio.esm.js +8 -24
- package/skinny/registerRadio.esm.js.map +1 -1
- package/skinny/registerRadioGroup.cjs.js +2 -2
- package/skinny/registerRadioGroup.esm.js +2 -2
- package/skinny/registerSection.cjs.js +1 -1
- package/skinny/registerSection.esm.js +1 -1
- package/skinny/registerSelect.cjs.js +6 -5
- package/skinny/registerSelect.cjs.js.map +1 -1
- package/skinny/registerSelect.esm.js +6 -5
- package/skinny/registerSelect.esm.js.map +1 -1
- package/skinny/{registerSlider-b37e26ac.esm.js → registerSlider-3d1d372e.esm.js} +3 -3
- package/skinny/{registerSlider-b37e26ac.esm.js.map → registerSlider-3d1d372e.esm.js.map} +1 -1
- package/skinny/{registerSlider-abe2fcd9.cjs.js → registerSlider-7d3a0b39.cjs.js} +3 -3
- package/skinny/{registerSlider-abe2fcd9.cjs.js.map → registerSlider-7d3a0b39.cjs.js.map} +1 -1
- package/skinny/registerSlider.cjs.js +3 -3
- package/skinny/registerSlider.esm.js +3 -3
- package/skinny/registerSliderOutput.cjs.js +1 -1
- package/skinny/registerSliderOutput.esm.js +1 -1
- package/skinny/registerSliderThumb.cjs.js +2 -2
- package/skinny/registerSliderThumb.esm.js +2 -2
- package/skinny/registerSliderTrack.cjs.js +3 -3
- package/skinny/registerSliderTrack.esm.js +3 -3
- package/skinny/registerSwitch.cjs.js +2 -2
- package/skinny/registerSwitch.esm.js +2 -2
- package/skinny/registerText.cjs.js +5 -2
- package/skinny/registerText.cjs.js.map +1 -1
- package/skinny/registerText.esm.js +5 -2
- package/skinny/registerText.esm.js.map +1 -1
- package/skinny/registerTextArea.cjs.js +2 -2
- package/skinny/registerTextArea.esm.js +2 -2
- package/skinny/registerTextField.cjs.js +2 -2
- package/skinny/registerTextField.esm.js +2 -2
- package/skinny/registerTooltip.cjs.js +1 -1
- package/skinny/registerTooltip.esm.js +1 -1
- package/skinny/{utils-5051df41.esm.js → utils-a1785802.esm.js} +5 -2
- package/skinny/{utils-5051df41.esm.js.map → utils-a1785802.esm.js.map} +1 -1
- package/skinny/{utils-745db876.cjs.js → utils-d3708034.cjs.js} +5 -1
- package/skinny/{utils-745db876.cjs.js.map → utils-d3708034.cjs.js.map} +1 -1
- package/skinny/utils.d.ts +1 -0
- package/skinny/interaction-variant-utils-244b74fb.cjs.js.map +0 -1
- package/skinny/interaction-variant-utils-c44a9d56.esm.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerListBoxItem.esm.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { PlasmicElement } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { ListBoxItem } from \"react-aria-components\";\nimport { PlasmicItemContext } from \"./contexts\";\nimport { DESCRIPTION_COMPONENT_NAME } from \"./registerDescription\";\nimport { TEXT_COMPONENT_NAME } from \"./registerText\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport function BaseListBoxItem(\n props: React.ComponentProps<typeof ListBoxItem>\n) {\n const contextProps = React.useContext(PlasmicItemContext);\n const mergedProps = mergeProps(contextProps, props);\n\n
|
|
1
|
+
{"version":3,"file":"registerListBoxItem.esm.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { PlasmicElement } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { ListBox, ListBoxItem } from \"react-aria-components\";\nimport { PlasmicItemContext } from \"./contexts\";\nimport ErrorBoundary from \"./ErrorBoundary\";\nimport { DESCRIPTION_COMPONENT_NAME } from \"./registerDescription\";\nimport { TEXT_COMPONENT_NAME } from \"./registerText\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport function BaseListBoxItem(\n props: React.ComponentProps<typeof ListBoxItem>\n) {\n const contextProps = React.useContext(PlasmicItemContext);\n const mergedProps = mergeProps(contextProps, props);\n\n const listboxItem = (\n <ListBoxItem {...mergedProps} textValue={contextProps?.label}>\n {mergedProps.children as React.ReactNode}\n </ListBoxItem>\n );\n return (\n <ErrorBoundary fallback={<ListBox>{listboxItem}</ListBox>}>\n {listboxItem}\n </ErrorBoundary>\n );\n}\n\nexport const makeDefaultListBoxItemChildren = (\n label: string,\n description?: string\n): PlasmicElement => ({\n type: \"vbox\",\n styles: {\n display: \"flex\",\n alignItems: \"flex-start\",\n gap: \"2px\",\n },\n children: [\n {\n type: \"component\",\n name: TEXT_COMPONENT_NAME,\n props: {\n slot: \"label\",\n children: {\n type: \"text\",\n styles: {\n fontWeight: 500,\n },\n value: label,\n },\n },\n },\n {\n type: \"component\",\n name: DESCRIPTION_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n styles: {\n color: \"#838383\",\n },\n value: description ?? `Some description for ${label}...`,\n },\n },\n },\n ],\n});\n\nexport function registerListBoxItem(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBoxItem>\n) {\n return registerComponentHelper(\n loader,\n BaseListBoxItem,\n {\n name: makeComponentName(\"item\"),\n displayName: \"Aria ListBoxItem\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBoxItem\",\n importName: \"BaseListBoxItem\",\n props: {\n children: {\n type: \"slot\",\n defaultValue: makeDefaultListBoxItemChildren(\"Item\"),\n },\n },\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeO,SAAS,gBACd,KACA,EAAA;AACA,EAAM,MAAA,YAAA,GAAe,KAAM,CAAA,UAAA,CAAW,kBAAkB,CAAA,CAAA;AACxD,EAAM,MAAA,WAAA,GAAc,UAAW,CAAA,YAAA,EAAc,KAAK,CAAA,CAAA;AAElD,EAAM,MAAA,WAAA,uCACH,WAAgB,EAAA,aAAA,CAAA,cAAA,CAAA,EAAA,EAAA,WAAA,CAAA,EAAhB,EAA6B,SAAW,EAAA,YAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,YAAA,CAAc,KACpD,EAAA,CAAA,EAAA,WAAA,CAAY,QACf,CAAA,CAAA;AAEF,EAAA,2CACG,aAAc,EAAA,EAAA,QAAA,sCAAW,OAAS,EAAA,IAAA,EAAA,WAAY,KAC5C,WACH,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,YAAA,EAAc,+BAA+B,MAAM,CAAA;AAAA,SACrD;AAAA,OACF;AAAA,KACF;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -5,7 +5,7 @@ var React = require('react');
|
|
|
5
5
|
var reactAria = require('react-aria');
|
|
6
6
|
var reactAriaComponents = require('react-aria-components');
|
|
7
7
|
var contexts = require('./contexts-b21f6b12.cjs.js');
|
|
8
|
-
var utils = require('./utils-
|
|
8
|
+
var utils = require('./utils-d3708034.cjs.js');
|
|
9
9
|
require('@plasmicapp/host/registerComponent');
|
|
10
10
|
|
|
11
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -3,7 +3,7 @@ import React, { forwardRef, useImperativeHandle } from 'react';
|
|
|
3
3
|
import { mergeProps } from 'react-aria';
|
|
4
4
|
import { Heading, ModalOverlay, Modal, Dialog } from 'react-aria-components';
|
|
5
5
|
import { c as PlasmicDialogTriggerContext } from './contexts-9475faad.esm.js';
|
|
6
|
-
import { a as makeComponentName, r as registerComponentHelper } from './utils-
|
|
6
|
+
import { a as makeComponentName, r as registerComponentHelper } from './utils-a1785802.esm.js';
|
|
7
7
|
import '@plasmicapp/host/registerComponent';
|
|
8
8
|
|
|
9
9
|
var __defProp = Object.defineProperty;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var host = require('@plasmicapp/host');
|
|
3
4
|
var utils = require('@react-aria/utils');
|
|
4
5
|
var React = require('react');
|
|
5
6
|
var reactAriaComponents = require('react-aria-components');
|
|
6
7
|
var contexts = require('./contexts-b21f6b12.cjs.js');
|
|
7
|
-
var utils$1 = require('./utils-
|
|
8
|
+
var utils$1 = require('./utils-d3708034.cjs.js');
|
|
8
9
|
require('@plasmicapp/host/registerComponent');
|
|
9
10
|
|
|
10
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -39,20 +40,37 @@ var __objRest = (source, exclude) => {
|
|
|
39
40
|
}
|
|
40
41
|
return target;
|
|
41
42
|
};
|
|
43
|
+
const SHOULD_FLIP_INSIDE_SELECT = false;
|
|
42
44
|
function BasePopover(props) {
|
|
43
|
-
const _a = props, { resetClassName } = _a, restProps = __objRest(_a, ["resetClassName"]);
|
|
45
|
+
const _a = props, { resetClassName, setControlContextData } = _a, restProps = __objRest(_a, ["resetClassName", "setControlContextData"]);
|
|
44
46
|
const isStandalone = !React__default.default.useContext(reactAriaComponents.PopoverContext);
|
|
45
47
|
const contextProps = React__default.default.useContext(contexts.PlasmicPopoverContext);
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
const isInsideSelect = !!React__default.default.useContext(reactAriaComponents.SelectContext);
|
|
49
|
+
const mergedProps = utils.mergeProps(
|
|
50
|
+
contextProps,
|
|
51
|
+
restProps,
|
|
52
|
+
{
|
|
53
|
+
className: `${resetClassName}`
|
|
54
|
+
},
|
|
55
|
+
isInsideSelect && !utils$1.isDefined(restProps.shouldFlip) ? { shouldFlip: SHOULD_FLIP_INSIDE_SELECT } : void 0
|
|
56
|
+
);
|
|
57
|
+
const isEditMode = !!host.usePlasmicCanvasContext();
|
|
49
58
|
const triggerRef = React__default.default.useRef(null);
|
|
50
59
|
const standaloneProps = isStandalone ? {
|
|
51
60
|
triggerRef,
|
|
52
61
|
isNonModal: true,
|
|
53
62
|
isOpen: true
|
|
54
63
|
} : {};
|
|
55
|
-
|
|
64
|
+
setControlContextData == null ? void 0 : setControlContextData({
|
|
65
|
+
isStandalone,
|
|
66
|
+
isInsideSelect
|
|
67
|
+
});
|
|
68
|
+
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(
|
|
69
|
+
reactAriaComponents.Popover,
|
|
70
|
+
__spreadValues(__spreadValues({
|
|
71
|
+
isNonModal: isEditMode ? true : void 0
|
|
72
|
+
}, mergedProps), standaloneProps)
|
|
73
|
+
));
|
|
56
74
|
}
|
|
57
75
|
const POPOVER_COMPONENT_NAME = utils$1.makeComponentName("popover");
|
|
58
76
|
const POPOVER_ARROW_IMG = {
|
|
@@ -123,9 +141,15 @@ function registerPopover(loader, overrides) {
|
|
|
123
141
|
description: "Additional offset applied vertically between the popover and its trigger",
|
|
124
142
|
defaultValueHint: 0
|
|
125
143
|
},
|
|
144
|
+
shouldFlip: {
|
|
145
|
+
type: "boolean",
|
|
146
|
+
description: "Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.",
|
|
147
|
+
defaultValueHint: (_ps, ctx) => (ctx == null ? void 0 : ctx.isInsideSelect) ? SHOULD_FLIP_INSIDE_SELECT : true
|
|
148
|
+
},
|
|
126
149
|
placement: {
|
|
127
150
|
type: "choice",
|
|
128
151
|
description: "Default placement of the popover relative to the trigger, if there is enough space",
|
|
152
|
+
defaultValueHint: "bottom",
|
|
129
153
|
options: [
|
|
130
154
|
"bottom",
|
|
131
155
|
"bottom left",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerPopover.cjs.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { PlasmicElement } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Popover, PopoverContext } from \"react-aria-components\";\nimport { PlasmicPopoverContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BasePopoverProps extends React.ComponentProps<typeof Popover> {\n className?: string;\n resetClassName?: string;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const { resetClassName, ...restProps } = props;\n const isStandalone = !React.useContext(PopoverContext);\n const contextProps = React.useContext(PlasmicPopoverContext);\n const mergedProps = mergeProps(contextProps
|
|
1
|
+
{"version":3,"file":"registerPopover.cjs.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { PlasmicElement, usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Popover, PopoverContext, SelectContext } from \"react-aria-components\";\nimport { PlasmicPopoverContext } from \"./contexts\";\nimport {\n BaseControlContextData,\n CodeComponentMetaOverrides,\n Registerable,\n isDefined,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\n\ninterface PopoverControlContextData extends BaseControlContextData {\n isInsideSelect: boolean;\n}\n\nexport interface BasePopoverProps extends React.ComponentProps<typeof Popover> {\n className?: string;\n resetClassName?: string;\n setControlContextData?: (ctxData: PopoverControlContextData) => void;\n}\n\nconst SHOULD_FLIP_INSIDE_SELECT = false;\n\nexport function BasePopover(props: BasePopoverProps) {\n const { resetClassName, setControlContextData, ...restProps } = props;\n const isStandalone = !React.useContext(PopoverContext);\n const contextProps = React.useContext(PlasmicPopoverContext);\n const isInsideSelect = !!React.useContext(SelectContext);\n\n const mergedProps = mergeProps(\n contextProps,\n restProps,\n {\n className: `${resetClassName}`,\n },\n isInsideSelect &&\n !isDefined<BasePopoverProps[\"shouldFlip\"]>(restProps.shouldFlip)\n ? { shouldFlip: SHOULD_FLIP_INSIDE_SELECT }\n : undefined\n );\n\n const isEditMode = !!usePlasmicCanvasContext();\n\n const triggerRef = React.useRef<any>(null);\n\n const standaloneProps = isStandalone\n ? {\n triggerRef,\n isNonModal: true,\n isOpen: true,\n }\n : {};\n\n setControlContextData?.({\n isStandalone,\n isInsideSelect,\n });\n\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover\n isNonModal={isEditMode ? true : undefined}\n {...mergedProps}\n {...standaloneProps}\n />\n </>\n );\n}\n\nexport const POPOVER_COMPONENT_NAME = makeComponentName(\"popover\");\nexport const POPOVER_ARROW_IMG: PlasmicElement = {\n type: \"img\",\n // TODO: Replace with the image of an arrow pointing up, like: https://icon-sets.iconify.design/mdi/triangle/\n src: \"https://static1.plasmic.app/arrow-up.svg\",\n styles: {\n position: \"absolute\",\n top: \"-14px\",\n // center the arrow horizontally on the popover\n left: \"50%\",\n transform: \"translateX(-50%)\",\n width: \"15px\",\n },\n};\n\nexport function registerPopover(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BasePopover>\n) {\n registerComponentHelper(\n loader,\n BasePopover,\n {\n name: POPOVER_COMPONENT_NAME,\n displayName: \"Aria Popover\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerPopover\",\n importName: \"BasePopover\",\n defaultStyles: {\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n padding: \"20px\",\n width: \"300px\",\n backgroundColor: \"#FDE3C3\",\n },\n props: {\n children: {\n type: \"slot\",\n defaultValue: [\n POPOVER_ARROW_IMG,\n {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: 0,\n gap: \"10px\",\n },\n children: [\n {\n type: \"text\",\n value: \"This is a Popover!\",\n },\n {\n type: \"text\",\n value: \"You can put anything you can imagine here!\",\n styles: {\n fontWeight: 500,\n },\n },\n {\n type: \"text\",\n value:\n \"Use it in a `Aria Dialog Trigger` component to trigger it on a button click!\",\n },\n ],\n },\n ],\n },\n offset: {\n type: \"number\",\n displayName: \"Offset\",\n description:\n \"Additional offset applied vertically between the popover and its trigger\",\n defaultValueHint: 0,\n },\n shouldFlip: {\n type: \"boolean\",\n description:\n \"Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.\",\n defaultValueHint: (\n _ps: BasePopoverProps,\n ctx: PopoverControlContextData | null\n ) => (ctx?.isInsideSelect ? SHOULD_FLIP_INSIDE_SELECT : true),\n },\n placement: {\n type: \"choice\",\n description:\n \"Default placement of the popover relative to the trigger, if there is enough space\",\n defaultValueHint: \"bottom\",\n options: [\n \"bottom\",\n \"bottom left\",\n \"bottom right\",\n \"top\",\n \"top left\",\n \"top right\",\n ],\n },\n resetClassName: {\n type: \"themeResetClass\",\n },\n },\n styleSections: true,\n },\n overrides\n );\n}\n"],"names":["React","PopoverContext","PlasmicPopoverContext","SelectContext","mergeProps","isDefined","usePlasmicCanvasContext","Popover","makeComponentName","registerComponentHelper"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,yBAA4B,GAAA,KAAA,CAAA;AAE3B,SAAS,YAAY,KAAyB,EAAA;AACnD,EAAgE,MAAA,EAAA,GAAA,KAAA,EAAxD,kBAAgB,qBA3B1B,EAAA,GA2BkE,IAAd,SAAc,GAAA,SAAA,CAAA,EAAA,EAAd,CAA1C,gBAAgB,EAAA,uBAAA,CAAA,CAAA,CAAA;AACxB,EAAA,MAAM,YAAe,GAAA,CAACA,sBAAM,CAAA,UAAA,CAAWC,kCAAc,CAAA,CAAA;AACrD,EAAM,MAAA,YAAA,GAAeD,sBAAM,CAAA,UAAA,CAAWE,8BAAqB,CAAA,CAAA;AAC3D,EAAA,MAAM,cAAiB,GAAA,CAAC,CAACF,sBAAA,CAAM,WAAWG,iCAAa,CAAA,CAAA;AAEvD,EAAA,MAAM,WAAc,GAAAC,gBAAA;AAAA,IAClB,YAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,MACE,WAAW,CAAG,EAAA,cAAA,CAAA,CAAA;AAAA,KAChB;AAAA,IACA,cAAA,IACE,CAACC,iBAA0C,CAAA,SAAA,CAAU,UAAU,CAC7D,GAAA,EAAE,UAAY,EAAA,yBAAA,EACd,GAAA,KAAA,CAAA;AAAA,GACN,CAAA;AAEA,EAAM,MAAA,UAAA,GAAa,CAAC,CAACC,4BAAwB,EAAA,CAAA;AAE7C,EAAM,MAAA,UAAA,GAAaN,sBAAM,CAAA,MAAA,CAAY,IAAI,CAAA,CAAA;AAEzC,EAAA,MAAM,kBAAkB,YACpB,GAAA;AAAA,IACE,UAAA;AAAA,IACA,UAAY,EAAA,IAAA;AAAA,IACZ,MAAQ,EAAA,IAAA;AAAA,MAEV,EAAC,CAAA;AAEL,EAAwB,qBAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,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AA,WACF;AAAA,SACF;AAAA,QACA,cAAgB,EAAA;AAAA,UACd,IAAM,EAAA,iBAAA;AAAA,SACR;AAAA,OACF;AAAA,MACA,aAAe,EAAA,IAAA;AAAA,KACjB;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;;;"}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { PlasmicElement } from "@plasmicapp/host";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Popover } from "react-aria-components";
|
|
4
|
-
import { CodeComponentMetaOverrides, Registerable } from "./utils";
|
|
4
|
+
import { BaseControlContextData, CodeComponentMetaOverrides, Registerable } from "./utils";
|
|
5
|
+
interface PopoverControlContextData extends BaseControlContextData {
|
|
6
|
+
isInsideSelect: boolean;
|
|
7
|
+
}
|
|
5
8
|
export interface BasePopoverProps extends React.ComponentProps<typeof Popover> {
|
|
6
9
|
className?: string;
|
|
7
10
|
resetClassName?: string;
|
|
11
|
+
setControlContextData?: (ctxData: PopoverControlContextData) => void;
|
|
8
12
|
}
|
|
9
13
|
export declare function BasePopover(props: BasePopoverProps): React.JSX.Element;
|
|
10
14
|
export declare const POPOVER_COMPONENT_NAME: string;
|
|
11
15
|
export declare const POPOVER_ARROW_IMG: PlasmicElement;
|
|
12
16
|
export declare function registerPopover(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BasePopover>): void;
|
|
17
|
+
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { usePlasmicCanvasContext } from '@plasmicapp/host';
|
|
1
2
|
import { mergeProps } from '@react-aria/utils';
|
|
2
3
|
import React from 'react';
|
|
3
|
-
import { PopoverContext, Popover } from 'react-aria-components';
|
|
4
|
+
import { PopoverContext, SelectContext, Popover } from 'react-aria-components';
|
|
4
5
|
import { g as PlasmicPopoverContext } from './contexts-9475faad.esm.js';
|
|
5
|
-
import { a as makeComponentName, r as registerComponentHelper } from './utils-
|
|
6
|
+
import { i as isDefined, a as makeComponentName, r as registerComponentHelper } from './utils-a1785802.esm.js';
|
|
6
7
|
import '@plasmicapp/host/registerComponent';
|
|
7
8
|
|
|
8
9
|
var __defProp = Object.defineProperty;
|
|
@@ -33,20 +34,37 @@ var __objRest = (source, exclude) => {
|
|
|
33
34
|
}
|
|
34
35
|
return target;
|
|
35
36
|
};
|
|
37
|
+
const SHOULD_FLIP_INSIDE_SELECT = false;
|
|
36
38
|
function BasePopover(props) {
|
|
37
|
-
const _a = props, { resetClassName } = _a, restProps = __objRest(_a, ["resetClassName"]);
|
|
39
|
+
const _a = props, { resetClassName, setControlContextData } = _a, restProps = __objRest(_a, ["resetClassName", "setControlContextData"]);
|
|
38
40
|
const isStandalone = !React.useContext(PopoverContext);
|
|
39
41
|
const contextProps = React.useContext(PlasmicPopoverContext);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
const isInsideSelect = !!React.useContext(SelectContext);
|
|
43
|
+
const mergedProps = mergeProps(
|
|
44
|
+
contextProps,
|
|
45
|
+
restProps,
|
|
46
|
+
{
|
|
47
|
+
className: `${resetClassName}`
|
|
48
|
+
},
|
|
49
|
+
isInsideSelect && !isDefined(restProps.shouldFlip) ? { shouldFlip: SHOULD_FLIP_INSIDE_SELECT } : void 0
|
|
50
|
+
);
|
|
51
|
+
const isEditMode = !!usePlasmicCanvasContext();
|
|
43
52
|
const triggerRef = React.useRef(null);
|
|
44
53
|
const standaloneProps = isStandalone ? {
|
|
45
54
|
triggerRef,
|
|
46
55
|
isNonModal: true,
|
|
47
56
|
isOpen: true
|
|
48
57
|
} : {};
|
|
49
|
-
|
|
58
|
+
setControlContextData == null ? void 0 : setControlContextData({
|
|
59
|
+
isStandalone,
|
|
60
|
+
isInsideSelect
|
|
61
|
+
});
|
|
62
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, isStandalone && /* @__PURE__ */ React.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React.createElement(
|
|
63
|
+
Popover,
|
|
64
|
+
__spreadValues(__spreadValues({
|
|
65
|
+
isNonModal: isEditMode ? true : void 0
|
|
66
|
+
}, mergedProps), standaloneProps)
|
|
67
|
+
));
|
|
50
68
|
}
|
|
51
69
|
const POPOVER_COMPONENT_NAME = makeComponentName("popover");
|
|
52
70
|
const POPOVER_ARROW_IMG = {
|
|
@@ -117,9 +135,15 @@ function registerPopover(loader, overrides) {
|
|
|
117
135
|
description: "Additional offset applied vertically between the popover and its trigger",
|
|
118
136
|
defaultValueHint: 0
|
|
119
137
|
},
|
|
138
|
+
shouldFlip: {
|
|
139
|
+
type: "boolean",
|
|
140
|
+
description: "Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.",
|
|
141
|
+
defaultValueHint: (_ps, ctx) => (ctx == null ? void 0 : ctx.isInsideSelect) ? SHOULD_FLIP_INSIDE_SELECT : true
|
|
142
|
+
},
|
|
120
143
|
placement: {
|
|
121
144
|
type: "choice",
|
|
122
145
|
description: "Default placement of the popover relative to the trigger, if there is enough space",
|
|
146
|
+
defaultValueHint: "bottom",
|
|
123
147
|
options: [
|
|
124
148
|
"bottom",
|
|
125
149
|
"bottom left",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerPopover.esm.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { PlasmicElement } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Popover, PopoverContext } from \"react-aria-components\";\nimport { PlasmicPopoverContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BasePopoverProps extends React.ComponentProps<typeof Popover> {\n className?: string;\n resetClassName?: string;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const { resetClassName, ...restProps } = props;\n const isStandalone = !React.useContext(PopoverContext);\n const contextProps = React.useContext(PlasmicPopoverContext);\n const mergedProps = mergeProps(contextProps
|
|
1
|
+
{"version":3,"file":"registerPopover.esm.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { PlasmicElement, usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Popover, PopoverContext, SelectContext } from \"react-aria-components\";\nimport { PlasmicPopoverContext } from \"./contexts\";\nimport {\n BaseControlContextData,\n CodeComponentMetaOverrides,\n Registerable,\n isDefined,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\n\ninterface PopoverControlContextData extends BaseControlContextData {\n isInsideSelect: boolean;\n}\n\nexport interface BasePopoverProps extends React.ComponentProps<typeof Popover> {\n className?: string;\n resetClassName?: string;\n setControlContextData?: (ctxData: PopoverControlContextData) => void;\n}\n\nconst SHOULD_FLIP_INSIDE_SELECT = false;\n\nexport function BasePopover(props: BasePopoverProps) {\n const { resetClassName, setControlContextData, ...restProps } = props;\n const isStandalone = !React.useContext(PopoverContext);\n const contextProps = React.useContext(PlasmicPopoverContext);\n const isInsideSelect = !!React.useContext(SelectContext);\n\n const mergedProps = mergeProps(\n contextProps,\n restProps,\n {\n className: `${resetClassName}`,\n },\n isInsideSelect &&\n !isDefined<BasePopoverProps[\"shouldFlip\"]>(restProps.shouldFlip)\n ? { shouldFlip: SHOULD_FLIP_INSIDE_SELECT }\n : undefined\n );\n\n const isEditMode = !!usePlasmicCanvasContext();\n\n const triggerRef = React.useRef<any>(null);\n\n const standaloneProps = isStandalone\n ? {\n triggerRef,\n isNonModal: true,\n isOpen: true,\n }\n : {};\n\n setControlContextData?.({\n isStandalone,\n isInsideSelect,\n });\n\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover\n isNonModal={isEditMode ? true : undefined}\n {...mergedProps}\n {...standaloneProps}\n />\n </>\n );\n}\n\nexport const POPOVER_COMPONENT_NAME = makeComponentName(\"popover\");\nexport const POPOVER_ARROW_IMG: PlasmicElement = {\n type: \"img\",\n // TODO: Replace with the image of an arrow pointing up, like: https://icon-sets.iconify.design/mdi/triangle/\n src: \"https://static1.plasmic.app/arrow-up.svg\",\n styles: {\n position: \"absolute\",\n top: \"-14px\",\n // center the arrow horizontally on the popover\n left: \"50%\",\n transform: \"translateX(-50%)\",\n width: \"15px\",\n },\n};\n\nexport function registerPopover(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BasePopover>\n) {\n registerComponentHelper(\n loader,\n BasePopover,\n {\n name: POPOVER_COMPONENT_NAME,\n displayName: \"Aria Popover\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerPopover\",\n importName: \"BasePopover\",\n defaultStyles: {\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n padding: \"20px\",\n width: \"300px\",\n backgroundColor: \"#FDE3C3\",\n },\n props: {\n children: {\n type: \"slot\",\n defaultValue: [\n POPOVER_ARROW_IMG,\n {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: 0,\n gap: \"10px\",\n },\n children: [\n {\n type: \"text\",\n value: \"This is a Popover!\",\n },\n {\n type: \"text\",\n value: \"You can put anything you can imagine here!\",\n styles: {\n fontWeight: 500,\n },\n },\n {\n type: \"text\",\n value:\n \"Use it in a `Aria Dialog Trigger` component to trigger it on a button click!\",\n },\n ],\n },\n ],\n },\n offset: {\n type: \"number\",\n displayName: \"Offset\",\n description:\n \"Additional offset applied vertically between the popover and its trigger\",\n defaultValueHint: 0,\n },\n shouldFlip: {\n type: \"boolean\",\n description:\n \"Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.\",\n defaultValueHint: (\n _ps: BasePopoverProps,\n ctx: PopoverControlContextData | null\n ) => (ctx?.isInsideSelect ? SHOULD_FLIP_INSIDE_SELECT : true),\n },\n placement: {\n type: \"choice\",\n description:\n \"Default placement of the popover relative to the trigger, if there is enough space\",\n defaultValueHint: \"bottom\",\n options: [\n \"bottom\",\n \"bottom left\",\n \"bottom right\",\n \"top\",\n \"top left\",\n \"top right\",\n ],\n },\n resetClassName: {\n type: \"themeResetClass\",\n },\n },\n styleS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AAA,SACR;AAAA,OACF;AAAA,MACA,aAAe,EAAA,IAAA;AAAA,KACjB;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -4,10 +4,9 @@ var React = require('react');
|
|
|
4
4
|
var reactAriaComponents = require('react-aria-components');
|
|
5
5
|
var ErrorBoundary = require('./ErrorBoundary-e9b86248.cjs.js');
|
|
6
6
|
var common = require('./common-e74a9214.cjs.js');
|
|
7
|
-
var
|
|
8
|
-
var interactionVariantUtils = require('./interaction-variant-utils-244b74fb.cjs.js');
|
|
7
|
+
var interactionVariantUtils = require('./interaction-variant-utils-d45aa2a2.cjs.js');
|
|
9
8
|
var registerLabel = require('./registerLabel.cjs.js');
|
|
10
|
-
var utils = require('./utils-
|
|
9
|
+
var utils = require('./utils-d3708034.cjs.js');
|
|
11
10
|
require('@plasmicapp/host/registerComponent');
|
|
12
11
|
|
|
13
12
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -49,28 +48,25 @@ const RADIO_INTERACTION_VARIANTS = [
|
|
|
49
48
|
"hovered",
|
|
50
49
|
"pressed",
|
|
51
50
|
"focused",
|
|
52
|
-
"focusVisible"
|
|
51
|
+
"focusVisible",
|
|
52
|
+
"selected"
|
|
53
53
|
];
|
|
54
54
|
const { interactionVariants, withObservedValues } = interactionVariantUtils.pickAriaComponentVariants(
|
|
55
55
|
RADIO_INTERACTION_VARIANTS
|
|
56
56
|
);
|
|
57
57
|
function BaseRadio(props) {
|
|
58
|
-
const _a = props, { children, updateInteractionVariant
|
|
59
|
-
const
|
|
60
|
-
const radio = /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Radio, __spreadValues({}, rest), ({ isHovered, isPressed, isFocused, isFocusVisible }) => withObservedValues(
|
|
58
|
+
const _a = props, { children, updateInteractionVariant } = _a, rest = __objRest(_a, ["children", "updateInteractionVariant"]);
|
|
59
|
+
const radio = /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Radio, __spreadValues({}, rest), ({ isHovered, isPressed, isFocused, isFocusVisible, isSelected }) => withObservedValues(
|
|
61
60
|
children,
|
|
62
61
|
{
|
|
63
62
|
hovered: isHovered,
|
|
64
63
|
pressed: isPressed,
|
|
65
64
|
focused: isFocused,
|
|
66
|
-
focusVisible: isFocusVisible
|
|
65
|
+
focusVisible: isFocusVisible,
|
|
66
|
+
selected: isSelected
|
|
67
67
|
},
|
|
68
68
|
updateInteractionVariant
|
|
69
69
|
));
|
|
70
|
-
const isStandalone = !contextProps;
|
|
71
|
-
setControlContextData == null ? void 0 : setControlContextData({
|
|
72
|
-
isStandalone
|
|
73
|
-
});
|
|
74
70
|
return /* @__PURE__ */ React__default.default.createElement(ErrorBoundary.ErrorBoundary, { fallback: /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.RadioGroup, null, radio) }, radio);
|
|
75
71
|
}
|
|
76
72
|
const makeDefaultRadioChildren = (label) => ({
|
|
@@ -128,20 +124,8 @@ function registerRadio(loader, overrides) {
|
|
|
128
124
|
value: {
|
|
129
125
|
type: "string",
|
|
130
126
|
description: "The value of the input element, used when submitting an HTML form."
|
|
131
|
-
},
|
|
132
|
-
onSelectionChange: {
|
|
133
|
-
type: "eventHandler",
|
|
134
|
-
argTypes: [{ name: "isSelected", type: "boolean" }]
|
|
135
127
|
}
|
|
136
128
|
}),
|
|
137
|
-
states: {
|
|
138
|
-
isSelected: {
|
|
139
|
-
type: "readonly",
|
|
140
|
-
onChangeProp: "onSelectionChange",
|
|
141
|
-
variableType: "boolean",
|
|
142
|
-
hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
129
|
trapsFocus: true
|
|
146
130
|
},
|
|
147
131
|
overrides
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerRadio.cjs.js","sources":["../src/registerRadio.tsx"],"sourcesContent":["import { PlasmicElement } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport type { RadioProps } from \"react-aria-components\";\nimport { Radio, RadioGroup } from \"react-aria-components\";\nimport ErrorBoundary from \"./ErrorBoundary\";\nimport { getCommonInputProps } from \"./common\";\nimport {
|
|
1
|
+
{"version":3,"file":"registerRadio.cjs.js","sources":["../src/registerRadio.tsx"],"sourcesContent":["import { PlasmicElement } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport type { RadioProps } from \"react-aria-components\";\nimport { Radio, RadioGroup } from \"react-aria-components\";\nimport ErrorBoundary from \"./ErrorBoundary\";\nimport { getCommonInputProps } from \"./common\";\nimport {\n UpdateInteractionVariant,\n pickAriaComponentVariants,\n} from \"./interaction-variant-utils\";\nimport { LABEL_COMPONENT_NAME } from \"./registerLabel\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\n\nconst RADIO_INTERACTION_VARIANTS = [\n \"hovered\" as const,\n \"pressed\" as const,\n \"focused\" as const,\n \"focusVisible\" as const,\n \"selected\" as const,\n];\n\nexport interface BaseRadioProps extends RadioProps {\n children: React.ReactNode;\n // Optional callback to update the interaction variant state\n // as it's only provided if the component is the root of a Studio component\n updateInteractionVariant?: UpdateInteractionVariant<\n typeof RADIO_INTERACTION_VARIANTS\n >;\n}\n\nconst { interactionVariants, withObservedValues } = pickAriaComponentVariants(\n RADIO_INTERACTION_VARIANTS\n);\n\nexport function BaseRadio(props: BaseRadioProps) {\n const { children, updateInteractionVariant, ...rest } = props;\n\n const radio = (\n <Radio {...rest}>\n {({ isHovered, isPressed, isFocused, isFocusVisible, isSelected }) =>\n withObservedValues(\n children,\n {\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n selected: isSelected,\n },\n updateInteractionVariant\n )\n }\n </Radio>\n );\n return (\n <ErrorBoundary fallback={<RadioGroup>{radio}</RadioGroup>}>\n {radio}\n </ErrorBoundary>\n );\n}\n\nexport const makeDefaultRadioChildren = (label: string): PlasmicElement => ({\n type: \"hbox\",\n styles: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"10px\",\n padding: 0,\n },\n children: [\n {\n type: \"box\",\n styles: {\n width: \"7px\",\n height: \"7px\",\n borderRadius: \"100%\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n },\n },\n {\n type: \"component\",\n name: LABEL_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n value: label,\n },\n },\n },\n ],\n});\n\nexport function registerRadio(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseRadio>\n) {\n return registerComponentHelper(\n loader,\n BaseRadio,\n {\n name: makeComponentName(\"radio\"),\n displayName: \"Aria Radio\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerRadio\",\n importName: \"BaseRadio\",\n interactionVariants,\n props: {\n ...getCommonInputProps<BaseRadioProps>(\"radio\", [\n \"isDisabled\",\n \"autoFocus\",\n \"aria-label\",\n ]),\n children: {\n type: \"slot\",\n mergeWithParent: true as any,\n defaultValue: makeDefaultRadioChildren(\"Radio\"),\n },\n value: {\n type: \"string\",\n description:\n \"The value of the input element, used when submitting an HTML form.\",\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["pickAriaComponentVariants","React","Radio","ErrorBoundary","RadioGroup","LABEL_COMPONENT_NAME","registerComponentHelper","makeComponentName","getCommonInputProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,0BAA6B,GAAA;AAAA,EACjC,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AACF,CAAA,CAAA;AAWA,MAAM,EAAE,mBAAqB,EAAA,kBAAA,EAAuB,GAAAA,iDAAA;AAAA,EAClD,0BAAA;AACF,CAAA,CAAA;AAEO,SAAS,UAAU,KAAuB,EAAA;AAC/C,EAAwD,MAAA,EAAA,GAAA,KAAA,EAAhD,YAAU,wBAxCpB,EAAA,GAwC0D,IAAT,I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AA,QACL,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,MAAA;AAAA,UACN,KAAO,EAAA,KAAA;AAAA,SACT;AAAA,OACF;AAAA,KACF;AAAA,GACF;AACF,CAAA,EAAA;AAEgB,SAAA,aAAA,CACd,QACA,SACA,EAAA;AACA,EAAO,OAAAC,6BAAA;AAAA,IACL,MAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,MACE,IAAA,EAAMC,wBAAkB,OAAO,CAAA;AAAA,MAC/B,WAAa,EAAA,YAAA;AAAA,MACb,UAAY,EAAA,8CAAA;AAAA,MACZ,UAAY,EAAA,WAAA;AAAA,MACZ,mBAAA;AAAA,MACA,KAAA,EAAO,aACF,CAAA,cAAA,CAAA,EAAA,EAAAC,0BAAA,CAAoC,OAAS,EAAA;AAAA,QAC9C,YAAA;AAAA,QACA,WAAA;AAAA,QACA,YAAA;AAAA,OACD,CALI,CAAA,EAAA;AAAA,QAML,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,MAAA;AAAA,UACN,eAAiB,EAAA,IAAA;AAAA,UACjB,YAAA,EAAc,yBAAyB,OAAO,CAAA;AAAA,SAChD;AAAA,QACA,KAAO,EAAA;AAAA,UACL,IAAM,EAAA,QAAA;AAAA,UACN,WACE,EAAA,oEAAA;AAAA,SACJ;AAAA,OACF,CAAA;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;;"}
|
|
@@ -2,12 +2,10 @@ import { PlasmicElement } from "@plasmicapp/host";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import type { RadioProps } from "react-aria-components";
|
|
4
4
|
import { UpdateInteractionVariant } from "./interaction-variant-utils";
|
|
5
|
-
import {
|
|
6
|
-
declare const RADIO_INTERACTION_VARIANTS: ("hovered" | "pressed" | "focused" | "focusVisible")[];
|
|
5
|
+
import { CodeComponentMetaOverrides, Registerable } from "./utils";
|
|
6
|
+
declare const RADIO_INTERACTION_VARIANTS: ("hovered" | "pressed" | "focused" | "focusVisible" | "selected")[];
|
|
7
7
|
export interface BaseRadioProps extends RadioProps {
|
|
8
8
|
children: React.ReactNode;
|
|
9
|
-
isSelected: boolean;
|
|
10
|
-
setControlContextData?: (ctxData: BaseControlContextData) => void;
|
|
11
9
|
updateInteractionVariant?: UpdateInteractionVariant<typeof RADIO_INTERACTION_VARIANTS>;
|
|
12
10
|
}
|
|
13
11
|
export declare function BaseRadio(props: BaseRadioProps): React.JSX.Element;
|
|
@@ -2,10 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { Radio, RadioGroup } from 'react-aria-components';
|
|
3
3
|
import { E as ErrorBoundary } from './ErrorBoundary-c6b111d3.esm.js';
|
|
4
4
|
import { g as getCommonInputProps } from './common-52c26d37.esm.js';
|
|
5
|
-
import {
|
|
6
|
-
import { p as pickAriaComponentVariants } from './interaction-variant-utils-c44a9d56.esm.js';
|
|
5
|
+
import { p as pickAriaComponentVariants } from './interaction-variant-utils-0e04f834.esm.js';
|
|
7
6
|
import { LABEL_COMPONENT_NAME } from './registerLabel.esm.js';
|
|
8
|
-
import { r as registerComponentHelper, a as makeComponentName } from './utils-
|
|
7
|
+
import { r as registerComponentHelper, a as makeComponentName } from './utils-a1785802.esm.js';
|
|
9
8
|
import '@plasmicapp/host/registerComponent';
|
|
10
9
|
|
|
11
10
|
var __defProp = Object.defineProperty;
|
|
@@ -43,28 +42,25 @@ const RADIO_INTERACTION_VARIANTS = [
|
|
|
43
42
|
"hovered",
|
|
44
43
|
"pressed",
|
|
45
44
|
"focused",
|
|
46
|
-
"focusVisible"
|
|
45
|
+
"focusVisible",
|
|
46
|
+
"selected"
|
|
47
47
|
];
|
|
48
48
|
const { interactionVariants, withObservedValues } = pickAriaComponentVariants(
|
|
49
49
|
RADIO_INTERACTION_VARIANTS
|
|
50
50
|
);
|
|
51
51
|
function BaseRadio(props) {
|
|
52
|
-
const _a = props, { children, updateInteractionVariant
|
|
53
|
-
const
|
|
54
|
-
const radio = /* @__PURE__ */ React.createElement(Radio, __spreadValues({}, rest), ({ isHovered, isPressed, isFocused, isFocusVisible }) => withObservedValues(
|
|
52
|
+
const _a = props, { children, updateInteractionVariant } = _a, rest = __objRest(_a, ["children", "updateInteractionVariant"]);
|
|
53
|
+
const radio = /* @__PURE__ */ React.createElement(Radio, __spreadValues({}, rest), ({ isHovered, isPressed, isFocused, isFocusVisible, isSelected }) => withObservedValues(
|
|
55
54
|
children,
|
|
56
55
|
{
|
|
57
56
|
hovered: isHovered,
|
|
58
57
|
pressed: isPressed,
|
|
59
58
|
focused: isFocused,
|
|
60
|
-
focusVisible: isFocusVisible
|
|
59
|
+
focusVisible: isFocusVisible,
|
|
60
|
+
selected: isSelected
|
|
61
61
|
},
|
|
62
62
|
updateInteractionVariant
|
|
63
63
|
));
|
|
64
|
-
const isStandalone = !contextProps;
|
|
65
|
-
setControlContextData == null ? void 0 : setControlContextData({
|
|
66
|
-
isStandalone
|
|
67
|
-
});
|
|
68
64
|
return /* @__PURE__ */ React.createElement(ErrorBoundary, { fallback: /* @__PURE__ */ React.createElement(RadioGroup, null, radio) }, radio);
|
|
69
65
|
}
|
|
70
66
|
const makeDefaultRadioChildren = (label) => ({
|
|
@@ -122,20 +118,8 @@ function registerRadio(loader, overrides) {
|
|
|
122
118
|
value: {
|
|
123
119
|
type: "string",
|
|
124
120
|
description: "The value of the input element, used when submitting an HTML form."
|
|
125
|
-
},
|
|
126
|
-
onSelectionChange: {
|
|
127
|
-
type: "eventHandler",
|
|
128
|
-
argTypes: [{ name: "isSelected", type: "boolean" }]
|
|
129
121
|
}
|
|
130
122
|
}),
|
|
131
|
-
states: {
|
|
132
|
-
isSelected: {
|
|
133
|
-
type: "readonly",
|
|
134
|
-
onChangeProp: "onSelectionChange",
|
|
135
|
-
variableType: "boolean",
|
|
136
|
-
hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
123
|
trapsFocus: true
|
|
140
124
|
},
|
|
141
125
|
overrides
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerRadio.esm.js","sources":["../src/registerRadio.tsx"],"sourcesContent":["import { PlasmicElement } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport type { RadioProps } from \"react-aria-components\";\nimport { Radio, RadioGroup } from \"react-aria-components\";\nimport ErrorBoundary from \"./ErrorBoundary\";\nimport { getCommonInputProps } from \"./common\";\nimport {
|
|
1
|
+
{"version":3,"file":"registerRadio.esm.js","sources":["../src/registerRadio.tsx"],"sourcesContent":["import { PlasmicElement } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport type { RadioProps } from \"react-aria-components\";\nimport { Radio, RadioGroup } from \"react-aria-components\";\nimport ErrorBoundary from \"./ErrorBoundary\";\nimport { getCommonInputProps } from \"./common\";\nimport {\n UpdateInteractionVariant,\n pickAriaComponentVariants,\n} from \"./interaction-variant-utils\";\nimport { LABEL_COMPONENT_NAME } from \"./registerLabel\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\n\nconst RADIO_INTERACTION_VARIANTS = [\n \"hovered\" as const,\n \"pressed\" as const,\n \"focused\" as const,\n \"focusVisible\" as const,\n \"selected\" as const,\n];\n\nexport interface BaseRadioProps extends RadioProps {\n children: React.ReactNode;\n // Optional callback to update the interaction variant state\n // as it's only provided if the component is the root of a Studio component\n updateInteractionVariant?: UpdateInteractionVariant<\n typeof RADIO_INTERACTION_VARIANTS\n >;\n}\n\nconst { interactionVariants, withObservedValues } = pickAriaComponentVariants(\n RADIO_INTERACTION_VARIANTS\n);\n\nexport function BaseRadio(props: BaseRadioProps) {\n const { children, updateInteractionVariant, ...rest } = props;\n\n const radio = (\n <Radio {...rest}>\n {({ isHovered, isPressed, isFocused, isFocusVisible, isSelected }) =>\n withObservedValues(\n children,\n {\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n selected: isSelected,\n },\n updateInteractionVariant\n )\n }\n </Radio>\n );\n return (\n <ErrorBoundary fallback={<RadioGroup>{radio}</RadioGroup>}>\n {radio}\n </ErrorBoundary>\n );\n}\n\nexport const makeDefaultRadioChildren = (label: string): PlasmicElement => ({\n type: \"hbox\",\n styles: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"10px\",\n padding: 0,\n },\n children: [\n {\n type: \"box\",\n styles: {\n width: \"7px\",\n height: \"7px\",\n borderRadius: \"100%\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n },\n },\n {\n type: \"component\",\n name: LABEL_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n value: label,\n },\n },\n },\n ],\n});\n\nexport function registerRadio(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseRadio>\n) {\n return registerComponentHelper(\n loader,\n BaseRadio,\n {\n name: makeComponentName(\"radio\"),\n displayName: \"Aria Radio\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerRadio\",\n importName: \"BaseRadio\",\n interactionVariants,\n props: {\n ...getCommonInputProps<BaseRadioProps>(\"radio\", [\n \"isDisabled\",\n \"autoFocus\",\n \"aria-label\",\n ]),\n children: {\n type: \"slot\",\n mergeWithParent: true as any,\n defaultValue: makeDefaultRadioChildren(\"Radio\"),\n },\n value: {\n type: \"string\",\n description:\n \"The value of the input element, used when submitting an HTML form.\",\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,0BAA6B,GAAA;AAAA,EACjC,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AACF,CAAA,CAAA;AAWA,MAAM,EAAE,mBAAqB,EAAA,kBAAA,EAAuB,GAAA,yBAAA;AAAA,EAClD,0BAAA;AACF,CAAA,CAAA;AAEO,SAAS,UAAU,KAAuB,EAAA;AAC/C,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AA,WAAA;AAAA,MACN,IAAM,EAAA,oBAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,MAAA;AAAA,UACN,KAAO,EAAA,KAAA;AAAA,SACT;AAAA,OACF;AAAA,KACF;AAAA,GACF;AACF,CAAA,EAAA;AAEgB,SAAA,aAAA,CACd,QACA,SACA,EAAA;AACA,EAAO,OAAA,uBAAA;AAAA,IACL,MAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,MACE,IAAA,EAAM,kBAAkB,OAAO,CAAA;AAAA,MAC/B,WAAa,EAAA,YAAA;AAAA,MACb,UAAY,EAAA,8CAAA;AAAA,MACZ,UAAY,EAAA,WAAA;AAAA,MACZ,mBAAA;AAAA,MACA,KAAA,EAAO,aACF,CAAA,cAAA,CAAA,EAAA,EAAA,mBAAA,CAAoC,OAAS,EAAA;AAAA,QAC9C,YAAA;AAAA,QACA,WAAA;AAAA,QACA,YAAA;AAAA,OACD,CALI,CAAA,EAAA;AAAA,QAML,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,MAAA;AAAA,UACN,eAAiB,EAAA,IAAA;AAAA,UACjB,YAAA,EAAc,yBAAyB,OAAO,CAAA;AAAA,SAChD;AAAA,QACA,KAAO,EAAA;AAAA,UACL,IAAM,EAAA,QAAA;AAAA,UACN,WACE,EAAA,oEAAA;AAAA,SACJ;AAAA,OACF,CAAA;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -8,10 +8,10 @@ var registerDescription = require('./registerDescription.cjs.js');
|
|
|
8
8
|
var registerFieldError = require('./registerFieldError.cjs.js');
|
|
9
9
|
var registerLabel = require('./registerLabel.cjs.js');
|
|
10
10
|
var registerRadio = require('./registerRadio.cjs.js');
|
|
11
|
-
var utils = require('./utils-
|
|
11
|
+
var utils = require('./utils-d3708034.cjs.js');
|
|
12
12
|
require('./registerText.cjs.js');
|
|
13
13
|
require('./ErrorBoundary-e9b86248.cjs.js');
|
|
14
|
-
require('./interaction-variant-utils-
|
|
14
|
+
require('./interaction-variant-utils-d45aa2a2.cjs.js');
|
|
15
15
|
require('@plasmicapp/host/registerComponent');
|
|
16
16
|
|
|
17
17
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -6,10 +6,10 @@ import { DESCRIPTION_COMPONENT_NAME } from './registerDescription.esm.js';
|
|
|
6
6
|
import { registerFieldError } from './registerFieldError.esm.js';
|
|
7
7
|
import { registerLabel, LABEL_COMPONENT_NAME } from './registerLabel.esm.js';
|
|
8
8
|
import { registerRadio, makeDefaultRadioChildren } from './registerRadio.esm.js';
|
|
9
|
-
import { m as makeChildComponentName, r as registerComponentHelper, a as makeComponentName } from './utils-
|
|
9
|
+
import { m as makeChildComponentName, r as registerComponentHelper, a as makeComponentName } from './utils-a1785802.esm.js';
|
|
10
10
|
import './registerText.esm.js';
|
|
11
11
|
import './ErrorBoundary-c6b111d3.esm.js';
|
|
12
|
-
import './interaction-variant-utils-
|
|
12
|
+
import './interaction-variant-utils-0e04f834.esm.js';
|
|
13
13
|
import '@plasmicapp/host/registerComponent';
|
|
14
14
|
|
|
15
15
|
var __defProp = Object.defineProperty;
|
|
@@ -5,7 +5,7 @@ var React = require('react');
|
|
|
5
5
|
var reactAriaComponents = require('react-aria-components');
|
|
6
6
|
var contexts = require('./contexts-b21f6b12.cjs.js');
|
|
7
7
|
var registerHeader = require('./registerHeader.cjs.js');
|
|
8
|
-
var utils$1 = require('./utils-
|
|
8
|
+
var utils$1 = require('./utils-d3708034.cjs.js');
|
|
9
9
|
require('@plasmicapp/host/registerComponent');
|
|
10
10
|
|
|
11
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { Section, Collection } from 'react-aria-components';
|
|
4
4
|
import { e as PlasmicSectionContext, h as PlasmicHeaderContext, f as PlasmicItemContext } from './contexts-9475faad.esm.js';
|
|
5
5
|
import { registerHeader } from './registerHeader.esm.js';
|
|
6
|
-
import { m as makeChildComponentName, r as registerComponentHelper, a as makeComponentName } from './utils-
|
|
6
|
+
import { m as makeChildComponentName, r as registerComponentHelper, a as makeComponentName } from './utils-a1785802.esm.js';
|
|
7
7
|
import '@plasmicapp/host/registerComponent';
|
|
8
8
|
|
|
9
9
|
var __defProp = Object.defineProperty;
|
|
@@ -4,19 +4,20 @@ var host = require('@plasmicapp/host');
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var reactAriaComponents = require('react-aria-components');
|
|
6
6
|
var contexts = require('./contexts-b21f6b12.cjs.js');
|
|
7
|
-
var registerListBox = require('./registerListBox-
|
|
7
|
+
var registerListBox = require('./registerListBox-e98e849f.cjs.js');
|
|
8
8
|
var registerButton = require('./registerButton.cjs.js');
|
|
9
9
|
var registerLabel = require('./registerLabel.cjs.js');
|
|
10
10
|
var registerPopover = require('./registerPopover.cjs.js');
|
|
11
|
-
var utils = require('./utils-
|
|
11
|
+
var utils = require('./utils-d3708034.cjs.js');
|
|
12
12
|
require('@react-aria/utils');
|
|
13
13
|
require('./registerListBoxItem.cjs.js');
|
|
14
|
+
require('./ErrorBoundary-e9b86248.cjs.js');
|
|
14
15
|
require('./registerDescription.cjs.js');
|
|
15
16
|
require('./registerText.cjs.js');
|
|
16
17
|
require('./registerSection.cjs.js');
|
|
17
18
|
require('./registerHeader.cjs.js');
|
|
18
19
|
require('./common-e74a9214.cjs.js');
|
|
19
|
-
require('./interaction-variant-utils-
|
|
20
|
+
require('./interaction-variant-utils-d45aa2a2.cjs.js');
|
|
20
21
|
require('@plasmicapp/host/registerComponent');
|
|
21
22
|
|
|
22
23
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -59,7 +60,7 @@ function BaseSelect(props) {
|
|
|
59
60
|
"aria-label": ariaLabel
|
|
60
61
|
} = props;
|
|
61
62
|
const { options } = registerListBox.useStrictOptions(props);
|
|
62
|
-
const
|
|
63
|
+
const isEditMode = !!host.usePlasmicCanvasContext();
|
|
63
64
|
const disabledKeys = registerListBox.flattenOptions(options).filter((op) => op.isDisabled).map((op) => op.id);
|
|
64
65
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
65
66
|
reactAriaComponents.Select,
|
|
@@ -73,7 +74,7 @@ function BaseSelect(props) {
|
|
|
73
74
|
style,
|
|
74
75
|
name,
|
|
75
76
|
"aria-label": ariaLabel
|
|
76
|
-
},
|
|
77
|
+
}, isEditMode ? { isOpen: previewOpen } : void 0), utils.extractPlasmicDataProps(props)),
|
|
77
78
|
/* @__PURE__ */ React__default.default.createElement(
|
|
78
79
|
contexts.PlasmicListBoxContext.Provider,
|
|
79
80
|
{
|