@plasmicpkgs/react-aria 0.0.28 → 0.0.30
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 +4 -0
- package/dist/interaction-variant-utils.d.ts +4 -0
- package/dist/react-aria.esm.js +2494 -1120
- package/dist/react-aria.esm.js.map +1 -1
- package/dist/react-aria.js +2491 -1117
- package/dist/react-aria.js.map +1 -1
- package/dist/registerButton.d.ts +1 -0
- package/dist/registerCheckbox.d.ts +8 -2
- package/dist/registerCheckboxGroup.d.ts +2 -2
- package/dist/registerDescription.d.ts +2 -1
- package/dist/registerDialogTrigger.d.ts +1 -2
- package/dist/registerHeader.d.ts +1 -1
- package/dist/registerInput.d.ts +1 -0
- package/dist/registerLabel.d.ts +1 -0
- package/dist/registerListBox.d.ts +3 -6
- package/dist/registerListBoxItem.d.ts +3 -1
- package/dist/registerModal.d.ts +3 -1
- package/dist/registerPopover.d.ts +3 -0
- package/dist/registerRadio.d.ts +5 -2
- package/dist/registerRadioGroup.d.ts +3 -3
- package/dist/registerSection.d.ts +1 -1
- package/dist/registerSelect.d.ts +5 -2
- package/dist/registerSlider.d.ts +14 -0
- package/dist/registerSliderOutput.d.ts +5 -0
- package/dist/registerSliderThumb.d.ts +13 -0
- package/dist/registerSliderTrack.d.ts +14 -0
- package/dist/registerText.d.ts +2 -1
- package/dist/registerTextField.d.ts +1 -0
- package/dist/utils.d.ts +9 -2
- package/package.json +2 -2
- package/skinny/ErrorBoundary-c6b111d3.esm.js +20 -0
- package/skinny/ErrorBoundary-c6b111d3.esm.js.map +1 -0
- package/skinny/ErrorBoundary-e9b86248.cjs.js +22 -0
- package/skinny/ErrorBoundary-e9b86248.cjs.js.map +1 -0
- package/skinny/contexts-9475faad.esm.js +16 -0
- package/skinny/contexts-9475faad.esm.js.map +1 -0
- package/skinny/{contexts-3e42cdf9.cjs.js → contexts-b21f6b12.cjs.js} +9 -1
- package/skinny/contexts-b21f6b12.cjs.js.map +1 -0
- package/skinny/contexts.d.ts +4 -0
- package/skinny/{interaction-variant-utils-0f05190f.cjs.js → interaction-variant-utils-244b74fb.cjs.js} +5 -1
- package/skinny/interaction-variant-utils-244b74fb.cjs.js.map +1 -0
- package/skinny/{interaction-variant-utils-909267e5.esm.js → interaction-variant-utils-c44a9d56.esm.js} +5 -1
- package/skinny/interaction-variant-utils-c44a9d56.esm.js.map +1 -0
- package/skinny/interaction-variant-utils.d.ts +4 -0
- package/skinny/registerButton.cjs.js +20 -5
- package/skinny/registerButton.cjs.js.map +1 -1
- package/skinny/registerButton.d.ts +1 -0
- package/skinny/registerButton.esm.js +20 -6
- package/skinny/registerButton.esm.js.map +1 -1
- package/skinny/registerCheckbox.cjs.js +76 -7
- package/skinny/registerCheckbox.cjs.js.map +1 -1
- package/skinny/registerCheckbox.d.ts +8 -2
- package/skinny/registerCheckbox.esm.js +76 -8
- package/skinny/registerCheckbox.esm.js.map +1 -1
- package/skinny/registerCheckboxGroup.cjs.js +90 -14
- package/skinny/registerCheckboxGroup.cjs.js.map +1 -1
- package/skinny/registerCheckboxGroup.d.ts +2 -2
- package/skinny/registerCheckboxGroup.esm.js +89 -17
- package/skinny/registerCheckboxGroup.esm.js.map +1 -1
- package/skinny/registerComboBox.cjs.js +113 -8
- package/skinny/registerComboBox.cjs.js.map +1 -1
- package/skinny/registerComboBox.esm.js +109 -4
- package/skinny/registerComboBox.esm.js.map +1 -1
- package/skinny/registerDescription.cjs.js +10 -3
- package/skinny/registerDescription.cjs.js.map +1 -1
- package/skinny/registerDescription.d.ts +2 -1
- package/skinny/registerDescription.esm.js +10 -4
- package/skinny/registerDescription.esm.js.map +1 -1
- package/skinny/registerDialogTrigger.cjs.js +25 -4
- package/skinny/registerDialogTrigger.cjs.js.map +1 -1
- package/skinny/registerDialogTrigger.d.ts +1 -2
- package/skinny/registerDialogTrigger.esm.js +25 -4
- package/skinny/registerDialogTrigger.esm.js.map +1 -1
- package/skinny/registerFieldError.cjs.js +21 -11
- package/skinny/registerFieldError.cjs.js.map +1 -1
- package/skinny/registerFieldError.esm.js +21 -11
- package/skinny/registerFieldError.esm.js.map +1 -1
- package/skinny/registerForm.cjs.js +1 -1
- package/skinny/registerForm.esm.js +1 -1
- package/skinny/registerHeader.cjs.js +7 -3
- package/skinny/registerHeader.cjs.js.map +1 -1
- package/skinny/registerHeader.d.ts +1 -1
- package/skinny/registerHeader.esm.js +7 -3
- package/skinny/registerHeader.esm.js.map +1 -1
- package/skinny/registerInput.cjs.js +12 -3
- package/skinny/registerInput.cjs.js.map +1 -1
- package/skinny/registerInput.d.ts +1 -0
- package/skinny/registerInput.esm.js +12 -4
- package/skinny/registerInput.esm.js.map +1 -1
- package/skinny/registerLabel.cjs.js +7 -2
- package/skinny/registerLabel.cjs.js.map +1 -1
- package/skinny/registerLabel.d.ts +1 -0
- package/skinny/registerLabel.esm.js +7 -3
- package/skinny/registerLabel.esm.js.map +1 -1
- package/skinny/registerListBox-1effa43d.esm.js +299 -0
- package/skinny/registerListBox-1effa43d.esm.js.map +1 -0
- package/skinny/registerListBox-837b90d8.cjs.js +311 -0
- package/skinny/registerListBox-837b90d8.cjs.js.map +1 -0
- package/skinny/registerListBox.cjs.js +14 -108
- package/skinny/registerListBox.cjs.js.map +1 -1
- package/skinny/registerListBox.d.ts +3 -6
- package/skinny/registerListBox.esm.js +11 -106
- package/skinny/registerListBox.esm.js.map +1 -1
- package/skinny/registerListBoxItem.cjs.js +49 -5
- package/skinny/registerListBoxItem.cjs.js.map +1 -1
- package/skinny/registerListBoxItem.d.ts +3 -1
- package/skinny/registerListBoxItem.esm.js +49 -6
- package/skinny/registerListBoxItem.esm.js.map +1 -1
- package/skinny/registerModal.cjs.js +78 -9
- package/skinny/registerModal.cjs.js.map +1 -1
- package/skinny/registerModal.d.ts +3 -1
- package/skinny/registerModal.esm.js +78 -10
- package/skinny/registerModal.esm.js.map +1 -1
- package/skinny/registerPopover.cjs.js +56 -4
- package/skinny/registerPopover.cjs.js.map +1 -1
- package/skinny/registerPopover.d.ts +3 -0
- package/skinny/registerPopover.esm.js +55 -5
- package/skinny/registerPopover.esm.js.map +1 -1
- package/skinny/registerRadio.cjs.js +54 -24
- package/skinny/registerRadio.cjs.js.map +1 -1
- package/skinny/registerRadio.d.ts +5 -2
- package/skinny/registerRadio.esm.js +54 -25
- package/skinny/registerRadio.esm.js.map +1 -1
- package/skinny/registerRadioGroup.cjs.js +82 -17
- package/skinny/registerRadioGroup.cjs.js.map +1 -1
- package/skinny/registerRadioGroup.d.ts +3 -3
- package/skinny/registerRadioGroup.esm.js +81 -20
- package/skinny/registerRadioGroup.esm.js.map +1 -1
- package/skinny/registerSection.cjs.js +36 -12
- package/skinny/registerSection.cjs.js.map +1 -1
- package/skinny/registerSection.d.ts +1 -1
- package/skinny/registerSection.esm.js +36 -12
- package/skinny/registerSection.esm.js.map +1 -1
- package/skinny/registerSelect.cjs.js +133 -30
- package/skinny/registerSelect.cjs.js.map +1 -1
- package/skinny/registerSelect.d.ts +5 -2
- package/skinny/registerSelect.esm.js +130 -25
- package/skinny/registerSelect.esm.js.map +1 -1
- package/skinny/registerSlider-39783c91.esm.js +425 -0
- package/skinny/registerSlider-39783c91.esm.js.map +1 -0
- package/skinny/registerSlider-ac9f3b1e.cjs.js +437 -0
- package/skinny/registerSlider-ac9f3b1e.cjs.js.map +1 -0
- package/skinny/registerSlider.cjs.js +23 -0
- package/skinny/registerSlider.cjs.js.map +1 -0
- package/skinny/registerSlider.d.ts +14 -0
- package/skinny/registerSlider.esm.js +15 -0
- package/skinny/registerSlider.esm.js.map +1 -0
- package/skinny/registerSliderOutput.cjs.js +30 -0
- package/skinny/registerSliderOutput.cjs.js.map +1 -0
- package/skinny/registerSliderOutput.d.ts +5 -0
- package/skinny/registerSliderOutput.esm.js +26 -0
- package/skinny/registerSliderOutput.esm.js.map +1 -0
- package/skinny/registerSliderThumb.cjs.js +119 -0
- package/skinny/registerSliderThumb.cjs.js.map +1 -0
- package/skinny/registerSliderThumb.d.ts +13 -0
- package/skinny/registerSliderThumb.esm.js +111 -0
- package/skinny/registerSliderThumb.esm.js.map +1 -0
- package/skinny/registerSliderTrack.cjs.js +23 -0
- package/skinny/registerSliderTrack.cjs.js.map +1 -0
- package/skinny/registerSliderTrack.d.ts +14 -0
- package/skinny/registerSliderTrack.esm.js +15 -0
- package/skinny/registerSliderTrack.esm.js.map +1 -0
- package/skinny/registerSwitch.cjs.js +84 -4
- package/skinny/registerSwitch.cjs.js.map +1 -1
- package/skinny/registerSwitch.esm.js +84 -4
- package/skinny/registerSwitch.esm.js.map +1 -1
- package/skinny/registerText.cjs.js +11 -4
- package/skinny/registerText.cjs.js.map +1 -1
- package/skinny/registerText.d.ts +2 -1
- package/skinny/registerText.esm.js +11 -5
- 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 +48 -7
- package/skinny/registerTextField.cjs.js.map +1 -1
- package/skinny/registerTextField.d.ts +1 -0
- package/skinny/registerTextField.esm.js +51 -11
- package/skinny/registerTextField.esm.js.map +1 -1
- package/skinny/registerTooltip.cjs.js +1 -1
- package/skinny/registerTooltip.esm.js +1 -1
- package/skinny/{utils-cf2632c9.esm.js → utils-5051df41.esm.js} +3 -2
- package/skinny/utils-5051df41.esm.js.map +1 -0
- package/skinny/{utils-18b2465b.cjs.js → utils-745db876.cjs.js} +2 -1
- package/skinny/utils-745db876.cjs.js.map +1 -0
- package/skinny/utils.d.ts +9 -2
- package/skinny/contexts-3e42cdf9.cjs.js.map +0 -1
- package/skinny/contexts-49f6c298.esm.js +0 -12
- package/skinny/contexts-49f6c298.esm.js.map +0 -1
- package/skinny/interaction-variant-utils-0f05190f.cjs.js.map +0 -1
- package/skinny/interaction-variant-utils-909267e5.esm.js.map +0 -1
- package/skinny/option-utils-4f037568.esm.js +0 -153
- package/skinny/option-utils-4f037568.esm.js.map +0 -1
- package/skinny/option-utils-5e4e85bd.cjs.js +0 -162
- package/skinny/option-utils-5e4e85bd.cjs.js.map +0 -1
- package/skinny/utils-18b2465b.cjs.js.map +0 -1
- package/skinny/utils-cf2632c9.esm.js.map +0 -1
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
var utils = require('@react-aria/utils');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var reactAriaComponents = require('react-aria-components');
|
|
6
|
-
var contexts = require('./contexts-
|
|
7
|
-
var utils$1 = require('./utils-
|
|
6
|
+
var contexts = require('./contexts-b21f6b12.cjs.js');
|
|
7
|
+
var utils$1 = require('./utils-745db876.cjs.js');
|
|
8
8
|
require('@plasmicapp/host/registerComponent');
|
|
9
9
|
|
|
10
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -54,18 +54,68 @@ function BasePopover(props) {
|
|
|
54
54
|
} : {};
|
|
55
55
|
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(reactAriaComponents.Popover, __spreadValues(__spreadValues({}, mergedProps), standaloneProps)));
|
|
56
56
|
}
|
|
57
|
+
const POPOVER_COMPONENT_NAME = utils$1.makeComponentName("popover");
|
|
58
|
+
const POPOVER_ARROW_IMG = {
|
|
59
|
+
type: "img",
|
|
60
|
+
// TODO: Replace with the image of an arrow pointing up, like: https://icon-sets.iconify.design/mdi/triangle/
|
|
61
|
+
src: "https://static1.plasmic.app/arrow-up.svg",
|
|
62
|
+
styles: {
|
|
63
|
+
position: "absolute",
|
|
64
|
+
top: "-14px",
|
|
65
|
+
// center the arrow horizontally on the popover
|
|
66
|
+
left: "50%",
|
|
67
|
+
transform: "translateX(-50%)",
|
|
68
|
+
width: "15px"
|
|
69
|
+
}
|
|
70
|
+
};
|
|
57
71
|
function registerPopover(loader, overrides) {
|
|
58
72
|
utils$1.registerComponentHelper(
|
|
59
73
|
loader,
|
|
60
74
|
BasePopover,
|
|
61
75
|
{
|
|
62
|
-
name:
|
|
76
|
+
name: POPOVER_COMPONENT_NAME,
|
|
63
77
|
displayName: "Aria Popover",
|
|
64
78
|
importPath: "@plasmicpkgs/react-aria/skinny/registerPopover",
|
|
65
79
|
importName: "BasePopover",
|
|
80
|
+
defaultStyles: {
|
|
81
|
+
borderWidth: "1px",
|
|
82
|
+
borderStyle: "solid",
|
|
83
|
+
borderColor: "black",
|
|
84
|
+
padding: "20px",
|
|
85
|
+
width: "300px",
|
|
86
|
+
backgroundColor: "#FDE3C3"
|
|
87
|
+
},
|
|
66
88
|
props: {
|
|
67
89
|
children: {
|
|
68
|
-
type: "slot"
|
|
90
|
+
type: "slot",
|
|
91
|
+
defaultValue: [
|
|
92
|
+
POPOVER_ARROW_IMG,
|
|
93
|
+
{
|
|
94
|
+
type: "vbox",
|
|
95
|
+
styles: {
|
|
96
|
+
width: "stretch",
|
|
97
|
+
padding: 0,
|
|
98
|
+
gap: "10px"
|
|
99
|
+
},
|
|
100
|
+
children: [
|
|
101
|
+
{
|
|
102
|
+
type: "text",
|
|
103
|
+
value: "This is a Popover!"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
type: "text",
|
|
107
|
+
value: "You can put anything you can imagine here!",
|
|
108
|
+
styles: {
|
|
109
|
+
fontWeight: 500
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
type: "text",
|
|
114
|
+
value: "Use it in a `Aria Dialog Trigger` component to trigger it on a button click!"
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
]
|
|
69
119
|
},
|
|
70
120
|
offset: {
|
|
71
121
|
type: "number",
|
|
@@ -96,5 +146,7 @@ function registerPopover(loader, overrides) {
|
|
|
96
146
|
}
|
|
97
147
|
|
|
98
148
|
exports.BasePopover = BasePopover;
|
|
149
|
+
exports.POPOVER_ARROW_IMG = POPOVER_ARROW_IMG;
|
|
150
|
+
exports.POPOVER_COMPONENT_NAME = POPOVER_COMPONENT_NAME;
|
|
99
151
|
exports.registerPopover = registerPopover;
|
|
100
152
|
//# sourceMappingURL=registerPopover.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerPopover.cjs.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { 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 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, restProps, {\n className: `${resetClassName}`,\n });\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 return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover {...mergedProps} {...standaloneProps} />\n </>\n );\n}\n\nexport function registerPopover(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BasePopover>\n) {\n registerComponentHelper(\n loader,\n BasePopover,\n {\n name:
|
|
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, restProps, {\n className: `${resetClassName}`,\n });\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 return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover {...mergedProps} {...standaloneProps} />\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 placement: {\n type: \"choice\",\n description:\n \"Default placement of the popover relative to the trigger, if there is enough space\",\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","mergeProps","Popover","makeComponentName","registerComponentHelper"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,SAAS,YAAY,KAAyB,EAAA;AACnD,EAAA,MAAyC,YAAjC,EAlBV,cAAA,EAAA,GAkB2C,EAAd,EAAA,SAAA,GAAA,SAAA,CAAc,IAAd,CAAnB,gBAAA,CAAA,CAAA,CAAA;AACR,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,EAAM,MAAA,WAAA,GAAcC,gBAAW,CAAA,YAAA,EAAc,SAAW,EAAA;AAAA,IACtD,WAAW,CAAG,EAAA,cAAA,CAAA,CAAA;AAAA,GACf,CAAA,CAAA;AAED,EAAM,MAAA,UAAA,GAAaH,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,EACE,uBAAAA,sBAAA,CAAA,aAAA,CAAAA,sBAAA,CAAA,QAAA,EAAA,IAAA,EACG,YAAgB,oBAAAA,sBAAA,CAAA,aAAA,CAAC,KAAI,EAAA,E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AA,eACP;AAAA,cACA,QAAU,EAAA;AAAA,gBACR;AAAA,kBACE,IAAM,EAAA,MAAA;AAAA,kBACN,KAAO,EAAA,oBAAA;AAAA,iBACT;AAAA,gBACA;AAAA,kBACE,IAAM,EAAA,MAAA;AAAA,kBACN,KAAO,EAAA,4CAAA;AAAA,kBACP,MAAQ,EAAA;AAAA,oBACN,UAAY,EAAA,GAAA;AAAA,mBACd;AAAA,iBACF;AAAA,gBACA;AAAA,kBACE,IAAM,EAAA,MAAA;AAAA,kBACN,KACE,EAAA,8EAAA;AAAA,iBACJ;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,QACA,MAAQ,EAAA;AAAA,UACN,IAAM,EAAA,QAAA;AAAA,UACN,WAAa,EAAA,QAAA;AAAA,UACb,WACE,EAAA,0EAAA;AAAA,UACF,gBAAkB,EAAA,CAAA;AAAA,SACpB;AAAA,QACA,SAAW,EAAA;AAAA,UACT,IAAM,EAAA,QAAA;AAAA,UACN,WACE,EAAA,oFAAA;AAAA,UACF,OAAS,EAAA;AAAA,YACP,QAAA;AAAA,YACA,aAAA;AAAA,YACA,cAAA;AAAA,YACA,KAAA;AAAA,YACA,UAAA;AAAA,YACA,WAAA;AAAA,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,3 +1,4 @@
|
|
|
1
|
+
import { PlasmicElement } from "@plasmicapp/host";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { Popover } from "react-aria-components";
|
|
3
4
|
import { CodeComponentMetaOverrides, Registerable } from "./utils";
|
|
@@ -6,4 +7,6 @@ export interface BasePopoverProps extends React.ComponentProps<typeof Popover> {
|
|
|
6
7
|
resetClassName?: string;
|
|
7
8
|
}
|
|
8
9
|
export declare function BasePopover(props: BasePopoverProps): React.JSX.Element;
|
|
10
|
+
export declare const POPOVER_COMPONENT_NAME: string;
|
|
11
|
+
export declare const POPOVER_ARROW_IMG: PlasmicElement;
|
|
9
12
|
export declare function registerPopover(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BasePopover>): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { mergeProps } from '@react-aria/utils';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { PopoverContext, Popover } from 'react-aria-components';
|
|
4
|
-
import {
|
|
5
|
-
import { r as registerComponentHelper } from './utils-
|
|
4
|
+
import { g as PlasmicPopoverContext } from './contexts-9475faad.esm.js';
|
|
5
|
+
import { a as makeComponentName, r as registerComponentHelper } from './utils-5051df41.esm.js';
|
|
6
6
|
import '@plasmicapp/host/registerComponent';
|
|
7
7
|
|
|
8
8
|
var __defProp = Object.defineProperty;
|
|
@@ -48,18 +48,68 @@ function BasePopover(props) {
|
|
|
48
48
|
} : {};
|
|
49
49
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, isStandalone && /* @__PURE__ */ React.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React.createElement(Popover, __spreadValues(__spreadValues({}, mergedProps), standaloneProps)));
|
|
50
50
|
}
|
|
51
|
+
const POPOVER_COMPONENT_NAME = makeComponentName("popover");
|
|
52
|
+
const POPOVER_ARROW_IMG = {
|
|
53
|
+
type: "img",
|
|
54
|
+
// TODO: Replace with the image of an arrow pointing up, like: https://icon-sets.iconify.design/mdi/triangle/
|
|
55
|
+
src: "https://static1.plasmic.app/arrow-up.svg",
|
|
56
|
+
styles: {
|
|
57
|
+
position: "absolute",
|
|
58
|
+
top: "-14px",
|
|
59
|
+
// center the arrow horizontally on the popover
|
|
60
|
+
left: "50%",
|
|
61
|
+
transform: "translateX(-50%)",
|
|
62
|
+
width: "15px"
|
|
63
|
+
}
|
|
64
|
+
};
|
|
51
65
|
function registerPopover(loader, overrides) {
|
|
52
66
|
registerComponentHelper(
|
|
53
67
|
loader,
|
|
54
68
|
BasePopover,
|
|
55
69
|
{
|
|
56
|
-
name:
|
|
70
|
+
name: POPOVER_COMPONENT_NAME,
|
|
57
71
|
displayName: "Aria Popover",
|
|
58
72
|
importPath: "@plasmicpkgs/react-aria/skinny/registerPopover",
|
|
59
73
|
importName: "BasePopover",
|
|
74
|
+
defaultStyles: {
|
|
75
|
+
borderWidth: "1px",
|
|
76
|
+
borderStyle: "solid",
|
|
77
|
+
borderColor: "black",
|
|
78
|
+
padding: "20px",
|
|
79
|
+
width: "300px",
|
|
80
|
+
backgroundColor: "#FDE3C3"
|
|
81
|
+
},
|
|
60
82
|
props: {
|
|
61
83
|
children: {
|
|
62
|
-
type: "slot"
|
|
84
|
+
type: "slot",
|
|
85
|
+
defaultValue: [
|
|
86
|
+
POPOVER_ARROW_IMG,
|
|
87
|
+
{
|
|
88
|
+
type: "vbox",
|
|
89
|
+
styles: {
|
|
90
|
+
width: "stretch",
|
|
91
|
+
padding: 0,
|
|
92
|
+
gap: "10px"
|
|
93
|
+
},
|
|
94
|
+
children: [
|
|
95
|
+
{
|
|
96
|
+
type: "text",
|
|
97
|
+
value: "This is a Popover!"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
type: "text",
|
|
101
|
+
value: "You can put anything you can imagine here!",
|
|
102
|
+
styles: {
|
|
103
|
+
fontWeight: 500
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
type: "text",
|
|
108
|
+
value: "Use it in a `Aria Dialog Trigger` component to trigger it on a button click!"
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
]
|
|
63
113
|
},
|
|
64
114
|
offset: {
|
|
65
115
|
type: "number",
|
|
@@ -89,5 +139,5 @@ function registerPopover(loader, overrides) {
|
|
|
89
139
|
);
|
|
90
140
|
}
|
|
91
141
|
|
|
92
|
-
export { BasePopover, registerPopover };
|
|
142
|
+
export { BasePopover, POPOVER_ARROW_IMG, POPOVER_COMPONENT_NAME, registerPopover };
|
|
93
143
|
//# sourceMappingURL=registerPopover.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerPopover.esm.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { 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 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, restProps, {\n className: `${resetClassName}`,\n });\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 return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover {...mergedProps} {...standaloneProps} />\n </>\n );\n}\n\nexport function registerPopover(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BasePopover>\n) {\n registerComponentHelper(\n loader,\n BasePopover,\n {\n name:
|
|
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, restProps, {\n className: `${resetClassName}`,\n });\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 return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover {...mergedProps} {...standaloneProps} />\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 placement: {\n type: \"choice\",\n description:\n \"Default placement of the popover relative to the trigger, if there is enough space\",\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":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,SAAS,YAAY,KAAyB,EAAA;AACnD,EAAA,MAAyC,YAAjC,EAlBV,cAAA,EAAA,GAkB2C,EAAd,EAAA,SAAA,GAAA,SAAA,CAAc,IAAd,CAAnB,gBAAA,CAAA,CAAA,CAAA;AACR,EAAA,MAAM,YAAe,GAAA,CAAC,KAAM,CAAA,UAAA,CAAW,cAAc,CAAA,CAAA;AACrD,EAAM,MAAA,YAAA,GAAe,KAAM,CAAA,UAAA,CAAW,qBAAqB,CAAA,CAAA;AAC3D,EAAM,MAAA,WAAA,GAAc,UAAW,CAAA,YAAA,EAAc,SAAW,EAAA;AAAA,IACtD,WAAW,CAAG,EAAA,cAAA,CAAA,CAAA;AAAA,GACf,CAAA,CAAA;AAED,EAAM,MAAA,UAAA,GAAa,KAAM,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,EACE,uBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EACG,YAAgB,oBAAA,KAAA,CAAA,aAAA,CAAC,KAAI,EAAA,EAAA,GAAA,EAAK,UAAY,EAAA,CAAA,kBACtC,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,cAAA,CAAA,cAAA,CAAA,EAAA,EAAY,WAAiB,CAAA,EAAA,eAA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M,EAAA,MAAA;AAAA,kBACN,KAAO,EAAA,4CAAA;AAAA,kBACP,MAAQ,EAAA;AAAA,oBACN,UAAY,EAAA,GAAA;AAAA,mBACd;AAAA,iBACF;AAAA,gBACA;AAAA,kBACE,IAAM,EAAA,MAAA;AAAA,kBACN,KACE,EAAA,8EAAA;AAAA,iBACJ;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,QACA,MAAQ,EAAA;AAAA,UACN,IAAM,EAAA,QAAA;AAAA,UACN,WAAa,EAAA,QAAA;AAAA,UACb,WACE,EAAA,0EAAA;AAAA,UACF,gBAAkB,EAAA,CAAA;AAAA,SACpB;AAAA,QACA,SAAW,EAAA;AAAA,UACT,IAAM,EAAA,QAAA;AAAA,UACN,WACE,EAAA,oFAAA;AAAA,UACF,OAAS,EAAA;AAAA,YACP,QAAA;AAAA,YACA,aAAA;AAAA,YACA,cAAA;AAAA,YACA,KAAA;AAAA,YACA,UAAA;AAAA,YACA,WAAA;AAAA,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;;;;"}
|
|
@@ -2,31 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var reactAriaComponents = require('react-aria-components');
|
|
5
|
+
var ErrorBoundary = require('./ErrorBoundary-e9b86248.cjs.js');
|
|
5
6
|
var common = require('./common-e74a9214.cjs.js');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
7
|
+
var contexts = require('./contexts-b21f6b12.cjs.js');
|
|
8
|
+
var interactionVariantUtils = require('./interaction-variant-utils-244b74fb.cjs.js');
|
|
9
|
+
var registerLabel = require('./registerLabel.cjs.js');
|
|
10
|
+
var utils = require('./utils-745db876.cjs.js');
|
|
8
11
|
require('@plasmicapp/host/registerComponent');
|
|
9
12
|
|
|
10
13
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
14
|
|
|
12
15
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
13
16
|
|
|
14
|
-
class ErrorBoundary extends React.Component {
|
|
15
|
-
constructor(props) {
|
|
16
|
-
super(props);
|
|
17
|
-
this.state = { hasError: false };
|
|
18
|
-
}
|
|
19
|
-
static getDerivedStateFromError(_) {
|
|
20
|
-
return { hasError: true };
|
|
21
|
-
}
|
|
22
|
-
render() {
|
|
23
|
-
if (this.state.hasError) {
|
|
24
|
-
return this.props.fallback;
|
|
25
|
-
}
|
|
26
|
-
return this.props.children;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
17
|
var __defProp = Object.defineProperty;
|
|
31
18
|
var __defProps = Object.defineProperties;
|
|
32
19
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -68,7 +55,8 @@ const { interactionVariants, withObservedValues } = interactionVariantUtils.pick
|
|
|
68
55
|
RADIO_INTERACTION_VARIANTS
|
|
69
56
|
);
|
|
70
57
|
function BaseRadio(props) {
|
|
71
|
-
const _a = props, { children, updateInteractionVariant } = _a, rest = __objRest(_a, ["children", "updateInteractionVariant"]);
|
|
58
|
+
const _a = props, { children, updateInteractionVariant, setControlContextData } = _a, rest = __objRest(_a, ["children", "updateInteractionVariant", "setControlContextData"]);
|
|
59
|
+
const contextProps = React__default.default.useContext(contexts.PlasmicRadioGroupContext);
|
|
72
60
|
const radio = /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Radio, __spreadValues({}, rest), ({ isHovered, isPressed, isFocused, isFocusVisible }) => withObservedValues(
|
|
73
61
|
children,
|
|
74
62
|
{
|
|
@@ -79,10 +67,46 @@ function BaseRadio(props) {
|
|
|
79
67
|
},
|
|
80
68
|
updateInteractionVariant
|
|
81
69
|
));
|
|
82
|
-
|
|
70
|
+
const isStandalone = !contextProps;
|
|
71
|
+
setControlContextData == null ? void 0 : setControlContextData({
|
|
72
|
+
isStandalone
|
|
73
|
+
});
|
|
74
|
+
return /* @__PURE__ */ React__default.default.createElement(ErrorBoundary.ErrorBoundary, { fallback: /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.RadioGroup, null, radio) }, radio);
|
|
83
75
|
}
|
|
76
|
+
const makeDefaultRadioChildren = (label) => ({
|
|
77
|
+
type: "hbox",
|
|
78
|
+
styles: {
|
|
79
|
+
display: "flex",
|
|
80
|
+
alignItems: "center",
|
|
81
|
+
gap: "10px",
|
|
82
|
+
padding: 0
|
|
83
|
+
},
|
|
84
|
+
children: [
|
|
85
|
+
{
|
|
86
|
+
type: "box",
|
|
87
|
+
styles: {
|
|
88
|
+
width: "7px",
|
|
89
|
+
height: "7px",
|
|
90
|
+
borderRadius: "100%",
|
|
91
|
+
borderWidth: "1px",
|
|
92
|
+
borderStyle: "solid",
|
|
93
|
+
borderColor: "black"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
type: "component",
|
|
98
|
+
name: registerLabel.LABEL_COMPONENT_NAME,
|
|
99
|
+
props: {
|
|
100
|
+
children: {
|
|
101
|
+
type: "text",
|
|
102
|
+
value: label
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
});
|
|
84
108
|
function registerRadio(loader, overrides) {
|
|
85
|
-
utils.registerComponentHelper(
|
|
109
|
+
return utils.registerComponentHelper(
|
|
86
110
|
loader,
|
|
87
111
|
BaseRadio,
|
|
88
112
|
{
|
|
@@ -94,9 +118,13 @@ function registerRadio(loader, overrides) {
|
|
|
94
118
|
props: __spreadProps(__spreadValues({}, common.getCommonInputProps("radio", [
|
|
95
119
|
"isDisabled",
|
|
96
120
|
"autoFocus",
|
|
97
|
-
"aria-label"
|
|
98
|
-
"children"
|
|
121
|
+
"aria-label"
|
|
99
122
|
])), {
|
|
123
|
+
children: {
|
|
124
|
+
type: "slot",
|
|
125
|
+
mergeWithParent: true,
|
|
126
|
+
defaultValue: makeDefaultRadioChildren("Radio")
|
|
127
|
+
},
|
|
100
128
|
value: {
|
|
101
129
|
type: "string",
|
|
102
130
|
description: "The value of the input element, used when submitting an HTML form."
|
|
@@ -110,7 +138,8 @@ function registerRadio(loader, overrides) {
|
|
|
110
138
|
isSelected: {
|
|
111
139
|
type: "readonly",
|
|
112
140
|
onChangeProp: "onSelectionChange",
|
|
113
|
-
variableType: "boolean"
|
|
141
|
+
variableType: "boolean",
|
|
142
|
+
hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
|
|
114
143
|
}
|
|
115
144
|
},
|
|
116
145
|
trapsFocus: true
|
|
@@ -120,5 +149,6 @@ function registerRadio(loader, overrides) {
|
|
|
120
149
|
}
|
|
121
150
|
|
|
122
151
|
exports.BaseRadio = BaseRadio;
|
|
152
|
+
exports.makeDefaultRadioChildren = makeDefaultRadioChildren;
|
|
123
153
|
exports.registerRadio = registerRadio;
|
|
124
154
|
//# sourceMappingURL=registerRadio.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerRadio.cjs.js","sources":["../src/
|
|
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 { PlasmicRadioGroupContext } from \"./contexts\";\nimport {\n UpdateInteractionVariant,\n pickAriaComponentVariants,\n} from \"./interaction-variant-utils\";\nimport { LABEL_COMPONENT_NAME } from \"./registerLabel\";\nimport {\n BaseControlContextData,\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];\n\nexport interface BaseRadioProps extends RadioProps {\n children: React.ReactNode;\n isSelected: boolean;\n setControlContextData?: (ctxData: BaseControlContextData) => void;\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, setControlContextData, ...rest } =\n props;\n const contextProps = React.useContext(PlasmicRadioGroupContext);\n\n const radio = (\n <Radio {...rest}>\n {({ isHovered, isPressed, isFocused, isFocusVisible }) =>\n withObservedValues(\n children,\n {\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n },\n updateInteractionVariant\n )\n }\n </Radio>\n );\n\n const isStandalone = !contextProps;\n\n setControlContextData?.({\n isStandalone,\n });\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 onSelectionChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isSelected\", type: \"boolean\" }],\n },\n },\n states: {\n isSelected: {\n type: \"readonly\",\n onChangeProp: \"onSelectionChange\",\n variableType: \"boolean\",\n hidden: (_ps: BaseRadioProps, ctx: BaseControlContextData | null) =>\n !ctx?.isStandalone,\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["pickAriaComponentVariants","React","PlasmicRadioGroupContext","Radio","ErrorBoundary","RadioGroup","LABEL_COMPONENT_NAME","registerComponentHelper","makeComponentName","getCommonInputProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,0BAA6B,GAAA;AAAA,EACjC,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AACF,CAAA,CAAA;AAaA,MAAM,EAAE,mBAAqB,EAAA,kBAAA,EAAuB,GAAAA,iDAAA;AAAA,EAClD,0BAAA;AACF,CAAA,CAAA;AAEO,SAAS,UAAU,KAAuB,EAAA;AAC/C,EACE,MAAA,EAAA,GAAA,KAAA,EADM,EAAU,QAAA,EAAA,wBAAA,EAA0B,qBA3C9C,EAAA,GA4CI,IADoE,IACpE,GAAA,SAAA,CAAA,EAAA,EADoE,CAA9D,UAAA,EAAU,0BAA0B,EAAA,uBAAA,CAAA,CAAA,CAAA;AAE5C,EAAM,MAAA,YAAA,GAAeC,sBAAM,CAAA,UAAA,CAAWC,iCAAwB,CAAA,CAAA;AAE9D,EAAM,MAAA,KAAA,mBACHD,sBAAA,CAAA,aAAA,CAAAE,yBAAA,EAAA,c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AA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;;"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import { PlasmicElement } from "@plasmicapp/host";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import type { RadioProps } from "react-aria-components";
|
|
3
4
|
import { UpdateInteractionVariant } from "./interaction-variant-utils";
|
|
4
|
-
import { CodeComponentMetaOverrides, Registerable } from "./utils";
|
|
5
|
+
import { BaseControlContextData, CodeComponentMetaOverrides, Registerable } from "./utils";
|
|
5
6
|
declare const RADIO_INTERACTION_VARIANTS: ("hovered" | "pressed" | "focused" | "focusVisible")[];
|
|
6
7
|
export interface BaseRadioProps extends RadioProps {
|
|
7
8
|
children: React.ReactNode;
|
|
8
9
|
isSelected: boolean;
|
|
10
|
+
setControlContextData?: (ctxData: BaseControlContextData) => void;
|
|
9
11
|
updateInteractionVariant?: UpdateInteractionVariant<typeof RADIO_INTERACTION_VARIANTS>;
|
|
10
12
|
}
|
|
11
13
|
export declare function BaseRadio(props: BaseRadioProps): React.JSX.Element;
|
|
12
|
-
export declare
|
|
14
|
+
export declare const makeDefaultRadioChildren: (label: string) => PlasmicElement;
|
|
15
|
+
export declare function registerRadio(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BaseRadio>): import("@plasmicapp/host").CodeComponentMeta<BaseRadioProps>;
|
|
13
16
|
export {};
|
|
@@ -1,26 +1,13 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { Radio, RadioGroup } from 'react-aria-components';
|
|
3
|
+
import { E as ErrorBoundary } from './ErrorBoundary-c6b111d3.esm.js';
|
|
3
4
|
import { g as getCommonInputProps } from './common-52c26d37.esm.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
5
|
+
import { d as PlasmicRadioGroupContext } from './contexts-9475faad.esm.js';
|
|
6
|
+
import { p as pickAriaComponentVariants } from './interaction-variant-utils-c44a9d56.esm.js';
|
|
7
|
+
import { LABEL_COMPONENT_NAME } from './registerLabel.esm.js';
|
|
8
|
+
import { r as registerComponentHelper, a as makeComponentName } from './utils-5051df41.esm.js';
|
|
6
9
|
import '@plasmicapp/host/registerComponent';
|
|
7
10
|
|
|
8
|
-
class ErrorBoundary extends Component {
|
|
9
|
-
constructor(props) {
|
|
10
|
-
super(props);
|
|
11
|
-
this.state = { hasError: false };
|
|
12
|
-
}
|
|
13
|
-
static getDerivedStateFromError(_) {
|
|
14
|
-
return { hasError: true };
|
|
15
|
-
}
|
|
16
|
-
render() {
|
|
17
|
-
if (this.state.hasError) {
|
|
18
|
-
return this.props.fallback;
|
|
19
|
-
}
|
|
20
|
-
return this.props.children;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
11
|
var __defProp = Object.defineProperty;
|
|
25
12
|
var __defProps = Object.defineProperties;
|
|
26
13
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -62,7 +49,8 @@ const { interactionVariants, withObservedValues } = pickAriaComponentVariants(
|
|
|
62
49
|
RADIO_INTERACTION_VARIANTS
|
|
63
50
|
);
|
|
64
51
|
function BaseRadio(props) {
|
|
65
|
-
const _a = props, { children, updateInteractionVariant } = _a, rest = __objRest(_a, ["children", "updateInteractionVariant"]);
|
|
52
|
+
const _a = props, { children, updateInteractionVariant, setControlContextData } = _a, rest = __objRest(_a, ["children", "updateInteractionVariant", "setControlContextData"]);
|
|
53
|
+
const contextProps = React.useContext(PlasmicRadioGroupContext);
|
|
66
54
|
const radio = /* @__PURE__ */ React.createElement(Radio, __spreadValues({}, rest), ({ isHovered, isPressed, isFocused, isFocusVisible }) => withObservedValues(
|
|
67
55
|
children,
|
|
68
56
|
{
|
|
@@ -73,10 +61,46 @@ function BaseRadio(props) {
|
|
|
73
61
|
},
|
|
74
62
|
updateInteractionVariant
|
|
75
63
|
));
|
|
64
|
+
const isStandalone = !contextProps;
|
|
65
|
+
setControlContextData == null ? void 0 : setControlContextData({
|
|
66
|
+
isStandalone
|
|
67
|
+
});
|
|
76
68
|
return /* @__PURE__ */ React.createElement(ErrorBoundary, { fallback: /* @__PURE__ */ React.createElement(RadioGroup, null, radio) }, radio);
|
|
77
69
|
}
|
|
70
|
+
const makeDefaultRadioChildren = (label) => ({
|
|
71
|
+
type: "hbox",
|
|
72
|
+
styles: {
|
|
73
|
+
display: "flex",
|
|
74
|
+
alignItems: "center",
|
|
75
|
+
gap: "10px",
|
|
76
|
+
padding: 0
|
|
77
|
+
},
|
|
78
|
+
children: [
|
|
79
|
+
{
|
|
80
|
+
type: "box",
|
|
81
|
+
styles: {
|
|
82
|
+
width: "7px",
|
|
83
|
+
height: "7px",
|
|
84
|
+
borderRadius: "100%",
|
|
85
|
+
borderWidth: "1px",
|
|
86
|
+
borderStyle: "solid",
|
|
87
|
+
borderColor: "black"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
type: "component",
|
|
92
|
+
name: LABEL_COMPONENT_NAME,
|
|
93
|
+
props: {
|
|
94
|
+
children: {
|
|
95
|
+
type: "text",
|
|
96
|
+
value: label
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
});
|
|
78
102
|
function registerRadio(loader, overrides) {
|
|
79
|
-
registerComponentHelper(
|
|
103
|
+
return registerComponentHelper(
|
|
80
104
|
loader,
|
|
81
105
|
BaseRadio,
|
|
82
106
|
{
|
|
@@ -88,9 +112,13 @@ function registerRadio(loader, overrides) {
|
|
|
88
112
|
props: __spreadProps(__spreadValues({}, getCommonInputProps("radio", [
|
|
89
113
|
"isDisabled",
|
|
90
114
|
"autoFocus",
|
|
91
|
-
"aria-label"
|
|
92
|
-
"children"
|
|
115
|
+
"aria-label"
|
|
93
116
|
])), {
|
|
117
|
+
children: {
|
|
118
|
+
type: "slot",
|
|
119
|
+
mergeWithParent: true,
|
|
120
|
+
defaultValue: makeDefaultRadioChildren("Radio")
|
|
121
|
+
},
|
|
94
122
|
value: {
|
|
95
123
|
type: "string",
|
|
96
124
|
description: "The value of the input element, used when submitting an HTML form."
|
|
@@ -104,7 +132,8 @@ function registerRadio(loader, overrides) {
|
|
|
104
132
|
isSelected: {
|
|
105
133
|
type: "readonly",
|
|
106
134
|
onChangeProp: "onSelectionChange",
|
|
107
|
-
variableType: "boolean"
|
|
135
|
+
variableType: "boolean",
|
|
136
|
+
hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
|
|
108
137
|
}
|
|
109
138
|
},
|
|
110
139
|
trapsFocus: true
|
|
@@ -113,5 +142,5 @@ function registerRadio(loader, overrides) {
|
|
|
113
142
|
);
|
|
114
143
|
}
|
|
115
144
|
|
|
116
|
-
export { BaseRadio, registerRadio };
|
|
145
|
+
export { BaseRadio, makeDefaultRadioChildren, registerRadio };
|
|
117
146
|
//# sourceMappingURL=registerRadio.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerRadio.esm.js","sources":["../src/
|
|
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 { PlasmicRadioGroupContext } from \"./contexts\";\nimport {\n UpdateInteractionVariant,\n pickAriaComponentVariants,\n} from \"./interaction-variant-utils\";\nimport { LABEL_COMPONENT_NAME } from \"./registerLabel\";\nimport {\n BaseControlContextData,\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];\n\nexport interface BaseRadioProps extends RadioProps {\n children: React.ReactNode;\n isSelected: boolean;\n setControlContextData?: (ctxData: BaseControlContextData) => void;\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, setControlContextData, ...rest } =\n props;\n const contextProps = React.useContext(PlasmicRadioGroupContext);\n\n const radio = (\n <Radio {...rest}>\n {({ isHovered, isPressed, isFocused, isFocusVisible }) =>\n withObservedValues(\n children,\n {\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n },\n updateInteractionVariant\n )\n }\n </Radio>\n );\n\n const isStandalone = !contextProps;\n\n setControlContextData?.({\n isStandalone,\n });\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 onSelectionChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isSelected\", type: \"boolean\" }],\n },\n },\n states: {\n isSelected: {\n type: \"readonly\",\n onChangeProp: \"onSelectionChange\",\n variableType: \"boolean\",\n hidden: (_ps: BaseRadioProps, ctx: BaseControlContextData | null) =>\n !ctx?.isStandalone,\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,0BAA6B,GAAA;AAAA,EACjC,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AACF,CAAA,CAAA;AAaA,MAAM,EAAE,mBAAqB,EAAA,kBAAA,EAAuB,GAAA,yBAAA;AAAA,EAClD,0BAAA;AACF,CAAA,CAAA;AAEO,SAAS,UAAU,KAAuB,EAAA;AAC/C,EACE,MAAA,EAAA,GAAA,KAAA,EADM,EAAU,QAAA,EAAA,wBAAA,EAA0B,qBA3C9C,EAAA,GA4CI,IADoE,IACpE,GAAA,SAAA,CAAA,EAAA,EADoE,CAA9D,UAAA,EAAU,0BAA0B,EAAA,uBAAA,CAAA,CAAA,CAAA;AAE5C,EAAM,MAAA,YAAA,GAAe,KAAM,CAAA,UAAA,CAAW,wBAAwB,CAAA,CAAA;AAE9D,EAAM,MAAA,KAAA,mBACH,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,cAAA,CAAA,EAAA,EAAU,IACR,CAAA,EAAA,CAAC,EAAE,SAAW,EAAA,SAAA,EAAW,SAAW,EAAA,cAAA,EACnC,KAAA,kBAAA;AAAA,IACE,QAAA;AAAA,IACA;AAAA,MACE,OAAS,EAAA,SAAA;AAAA,MACT,OAAS,EAAA,SAAA;AAAA,MACT,OAAS,EAAA,S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