@plasmicpkgs/react-aria 0.0.67 → 0.0.69
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/react-aria.esm.js +73 -43
- package/dist/react-aria.esm.js.map +1 -1
- package/dist/react-aria.js +73 -43
- package/dist/react-aria.js.map +1 -1
- package/dist/registerListBox.d.ts +1 -1
- package/dist/registerPopover.d.ts +5 -1
- package/dist/registerSection.d.ts +0 -2
- package/package.json +2 -2
- package/skinny/registerButton.cjs.js +1 -1
- package/skinny/registerButton.esm.js +1 -1
- package/skinny/registerCheckbox.cjs.js +1 -1
- package/skinny/registerCheckbox.esm.js +1 -1
- package/skinny/registerCheckboxGroup.cjs.js +1 -1
- package/skinny/registerCheckboxGroup.esm.js +1 -1
- package/skinny/registerComboBox.cjs.js +8 -8
- package/skinny/registerComboBox.cjs.js.map +1 -1
- package/skinny/registerComboBox.esm.js +8 -8
- package/skinny/registerComboBox.esm.js.map +1 -1
- package/skinny/registerDialogTrigger.cjs.js +1 -1
- package/skinny/registerDialogTrigger.esm.js +1 -1
- package/skinny/registerInput.cjs.js +1 -1
- package/skinny/registerInput.esm.js +1 -1
- package/skinny/{registerListBox-62e01fbb.cjs.js → registerListBox-44b5ecda.cjs.js} +7 -7
- package/skinny/registerListBox-44b5ecda.cjs.js.map +1 -0
- package/skinny/{registerListBox-5425b5fe.esm.js → registerListBox-5d740ec8.esm.js} +7 -7
- package/skinny/registerListBox-5d740ec8.esm.js.map +1 -0
- package/skinny/registerListBox.cjs.js +2 -2
- package/skinny/registerListBox.d.ts +1 -1
- package/skinny/registerListBox.esm.js +2 -2
- package/skinny/registerListBoxItem.cjs.js +2 -2
- package/skinny/registerListBoxItem.cjs.js.map +1 -1
- package/skinny/registerListBoxItem.esm.js +2 -2
- package/skinny/registerListBoxItem.esm.js.map +1 -1
- package/skinny/registerPopover.cjs.js +36 -11
- package/skinny/registerPopover.cjs.js.map +1 -1
- package/skinny/registerPopover.d.ts +5 -1
- package/skinny/registerPopover.esm.js +36 -11
- package/skinny/registerPopover.esm.js.map +1 -1
- package/skinny/registerRadio.cjs.js +1 -1
- package/skinny/registerRadio.esm.js +1 -1
- package/skinny/registerRadioGroup.cjs.js +1 -1
- package/skinny/registerRadioGroup.esm.js +1 -1
- package/skinny/registerSection.cjs.js.map +1 -1
- package/skinny/registerSection.d.ts +0 -2
- package/skinny/registerSection.esm.js.map +1 -1
- package/skinny/registerSelect.cjs.js +7 -7
- package/skinny/registerSelect.cjs.js.map +1 -1
- package/skinny/registerSelect.esm.js +7 -7
- package/skinny/registerSelect.esm.js.map +1 -1
- package/skinny/registerSlider.cjs.js +1 -1
- package/skinny/registerSlider.esm.js +1 -1
- package/skinny/registerSliderOutput.cjs.js +1 -1
- package/skinny/registerSliderOutput.esm.js +1 -1
- package/skinny/registerSliderThumb.cjs.js +1 -1
- package/skinny/registerSliderThumb.esm.js +1 -1
- package/skinny/registerSliderTrack.cjs.js +1 -1
- package/skinny/registerSliderTrack.esm.js +1 -1
- package/skinny/registerSwitch.cjs.js +1 -1
- package/skinny/registerSwitch.esm.js +1 -1
- package/skinny/registerTextArea.cjs.js +1 -1
- package/skinny/registerTextArea.esm.js +1 -1
- package/skinny/registerTextField.cjs.js +1 -1
- package/skinny/registerTextField.esm.js +1 -1
- package/skinny/registerTooltip.cjs.js +1 -1
- package/skinny/registerTooltip.cjs.js.map +1 -1
- package/skinny/registerTooltip.esm.js +1 -1
- package/skinny/registerTooltip.esm.js.map +1 -1
- package/skinny/{variant-utils-5f90385f.esm.js → variant-utils-7c2ea202.esm.js} +7 -1
- package/skinny/variant-utils-7c2ea202.esm.js.map +1 -0
- package/skinny/{variant-utils-6c6ef452.cjs.js → variant-utils-8cb38f8f.cjs.js} +7 -1
- package/skinny/variant-utils-8cb38f8f.cjs.js.map +1 -0
- package/skinny/registerListBox-5425b5fe.esm.js.map +0 -1
- package/skinny/registerListBox-62e01fbb.cjs.js.map +0 -1
- package/skinny/variant-utils-5f90385f.esm.js.map +0 -1
- package/skinny/variant-utils-6c6ef452.cjs.js.map +0 -1
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
require('react');
|
|
4
4
|
require('react-aria-components');
|
|
5
5
|
require('./contexts-baa37b74.cjs.js');
|
|
6
|
-
var registerListBox = require('./registerListBox-
|
|
6
|
+
var registerListBox = require('./registerListBox-44b5ecda.cjs.js');
|
|
7
7
|
require('./registerListBoxItem.cjs.js');
|
|
8
8
|
require('./registerSection.cjs.js');
|
|
9
9
|
require('./utils-8dbb4d1f.cjs.js');
|
|
10
10
|
require('./registerDescription.cjs.js');
|
|
11
11
|
require('./registerText.cjs.js');
|
|
12
12
|
require('@plasmicapp/host/registerComponent');
|
|
13
|
-
require('./variant-utils-
|
|
13
|
+
require('./variant-utils-8cb38f8f.cjs.js');
|
|
14
14
|
require('@react-aria/utils');
|
|
15
15
|
|
|
16
16
|
|
|
@@ -12,7 +12,7 @@ export interface BaseListBoxProps extends Omit<React.ComponentProps<typeof ListB
|
|
|
12
12
|
}
|
|
13
13
|
export declare const listboxHelpers: {
|
|
14
14
|
states: {
|
|
15
|
-
|
|
15
|
+
selectedValue: {
|
|
16
16
|
onChangeArgsToValue: (value: Set<Key> | string[] | string) => Key;
|
|
17
17
|
};
|
|
18
18
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import 'react';
|
|
2
2
|
import 'react-aria-components';
|
|
3
3
|
import './contexts-081d65a0.esm.js';
|
|
4
|
-
export { B as BaseListBox, a as LIST_BOX_COMPONENT_NAME, l as listboxHelpers, r as registerListBox } from './registerListBox-
|
|
4
|
+
export { B as BaseListBox, a as LIST_BOX_COMPONENT_NAME, l as listboxHelpers, r as registerListBox } from './registerListBox-5d740ec8.esm.js';
|
|
5
5
|
import './registerListBoxItem.esm.js';
|
|
6
6
|
import './registerSection.esm.js';
|
|
7
7
|
import './utils-c7662a47.esm.js';
|
|
8
8
|
import './registerDescription.esm.js';
|
|
9
9
|
import './registerText.esm.js';
|
|
10
10
|
import '@plasmicapp/host/registerComponent';
|
|
11
|
-
import './variant-utils-
|
|
11
|
+
import './variant-utils-7c2ea202.esm.js';
|
|
12
12
|
import '@react-aria/utils';
|
|
13
13
|
//# sourceMappingURL=registerListBox.esm.js.map
|
|
@@ -6,7 +6,7 @@ var contexts = require('./contexts-baa37b74.cjs.js');
|
|
|
6
6
|
var registerDescription = require('./registerDescription.cjs.js');
|
|
7
7
|
var registerText = require('./registerText.cjs.js');
|
|
8
8
|
var utils = require('./utils-8dbb4d1f.cjs.js');
|
|
9
|
-
var variantUtils = require('./variant-utils-
|
|
9
|
+
var variantUtils = require('./variant-utils-8cb38f8f.cjs.js');
|
|
10
10
|
require('@plasmicapp/host/registerComponent');
|
|
11
11
|
|
|
12
12
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -159,7 +159,7 @@ function registerListBoxItem(loader, overrides) {
|
|
|
159
159
|
props: {
|
|
160
160
|
id: {
|
|
161
161
|
type: "string",
|
|
162
|
-
description: "A unique
|
|
162
|
+
description: "A unique value for tracking the selected item in state",
|
|
163
163
|
required: true,
|
|
164
164
|
displayName: "Value",
|
|
165
165
|
validator: (_value, _props, ctx) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerListBoxItem.cjs.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { PlasmicElement } from \"@plasmicapp/host\";\nimport React, { useEffect, useState } from \"react\";\nimport { ListBox, ListBoxItem } from \"react-aria-components\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport { DESCRIPTION_COMPONENT_NAME } from \"./registerDescription\";\nimport { TEXT_COMPONENT_NAME } from \"./registerText\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst LIST_BOX_ITEM_VARIANTS = [\n \"hovered\" as const,\n \"pressed\" as const,\n \"focused\" as const,\n \"focusVisible\" as const,\n \"selected\" as const,\n \"disabled\" as const,\n];\n\nconst { variants, withObservedValues } = pickAriaComponentVariants(\n LIST_BOX_ITEM_VARIANTS\n);\n\nexport interface BaseListBoxControlContextData {\n idError?: string;\n}\n\nexport interface BaseListBoxItemProps\n extends React.ComponentProps<typeof ListBoxItem>,\n HasControlContextData<BaseListBoxControlContextData>,\n WithVariants<typeof LIST_BOX_ITEM_VARIANTS> {\n id?: string;\n children?: React.ReactNode;\n}\n\nexport function BaseListBoxItem(props: BaseListBoxItemProps) {\n const { children, setControlContextData, plasmicUpdateVariant, id, ...rest } =\n props;\n const listboxContext = React.useContext(PlasmicListBoxContext);\n const isStandalone = !listboxContext;\n /**\n * Ids of each listboxitem inside a listbox have to be unique. Otherwise, the items won't show up in the listbox.\n * This is particularly important to ensure, because the most common use case would be to apply Repeat Element to the listbox item.\n * The ids of each repeated item will initially be the same (until the user changes the id prop of the listboxitem).\n *\n * The registerId, therefore, is the unique id of the listboxitem.\n * It is the id registered with the listbox context, so that it can auto-generate a unique id if it identifies a duplicate.\n */\n const [registeredId, setRegisteredId] = useState<string | undefined>();\n\n useEffect(() => {\n if (!listboxContext) {\n return;\n }\n\n const localId = listboxContext.idManager.register(id);\n setRegisteredId(localId);\n\n return () => {\n listboxContext.idManager.unregister(localId);\n setRegisteredId(undefined);\n };\n }, [id]);\n\n setControlContextData?.({\n idError: (() => {\n if (id === undefined) {\n return \"ID must be defined\";\n }\n if (typeof id !== \"string\") {\n return \"ID must be a string\";\n }\n if (!id.trim()) {\n return \"ID must be defined\";\n }\n if (!isStandalone && id != registeredId) {\n return \"ID must be unique\";\n }\n return undefined;\n })(),\n });\n\n const listboxItem = (\n <ListBoxItem key={registeredId} id={registeredId} {...rest}>\n {({\n isHovered,\n isPressed,\n isFocused,\n isFocusVisible,\n isSelected,\n isDisabled,\n }) =>\n withObservedValues(\n children,\n {\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n selected: isSelected,\n disabled: isDisabled,\n },\n plasmicUpdateVariant\n )\n }\n </ListBoxItem>\n );\n\n if (isStandalone) {\n // selection mode needs to be single/multiple to be able to trigger hover state on it.\n return <ListBox selectionMode=\"single\">{listboxItem}</ListBox>;\n }\n\n return listboxItem;\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 variants,\n props: {\n id: {\n type: \"string\",\n description: \"A unique
|
|
1
|
+
{"version":3,"file":"registerListBoxItem.cjs.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { PlasmicElement } from \"@plasmicapp/host\";\nimport React, { useEffect, useState } from \"react\";\nimport { ListBox, ListBoxItem } from \"react-aria-components\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport { DESCRIPTION_COMPONENT_NAME } from \"./registerDescription\";\nimport { TEXT_COMPONENT_NAME } from \"./registerText\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst LIST_BOX_ITEM_VARIANTS = [\n \"hovered\" as const,\n \"pressed\" as const,\n \"focused\" as const,\n \"focusVisible\" as const,\n \"selected\" as const,\n \"disabled\" as const,\n];\n\nconst { variants, withObservedValues } = pickAriaComponentVariants(\n LIST_BOX_ITEM_VARIANTS\n);\n\nexport interface BaseListBoxControlContextData {\n idError?: string;\n}\n\nexport interface BaseListBoxItemProps\n extends React.ComponentProps<typeof ListBoxItem>,\n HasControlContextData<BaseListBoxControlContextData>,\n WithVariants<typeof LIST_BOX_ITEM_VARIANTS> {\n id?: string;\n children?: React.ReactNode;\n}\n\nexport function BaseListBoxItem(props: BaseListBoxItemProps) {\n const { children, setControlContextData, plasmicUpdateVariant, id, ...rest } =\n props;\n const listboxContext = React.useContext(PlasmicListBoxContext);\n const isStandalone = !listboxContext;\n /**\n * Ids of each listboxitem inside a listbox have to be unique. Otherwise, the items won't show up in the listbox.\n * This is particularly important to ensure, because the most common use case would be to apply Repeat Element to the listbox item.\n * The ids of each repeated item will initially be the same (until the user changes the id prop of the listboxitem).\n *\n * The registerId, therefore, is the unique id of the listboxitem.\n * It is the id registered with the listbox context, so that it can auto-generate a unique id if it identifies a duplicate.\n */\n const [registeredId, setRegisteredId] = useState<string | undefined>();\n\n useEffect(() => {\n if (!listboxContext) {\n return;\n }\n\n const localId = listboxContext.idManager.register(id);\n setRegisteredId(localId);\n\n return () => {\n listboxContext.idManager.unregister(localId);\n setRegisteredId(undefined);\n };\n }, [id]);\n\n setControlContextData?.({\n idError: (() => {\n if (id === undefined) {\n return \"ID must be defined\";\n }\n if (typeof id !== \"string\") {\n return \"ID must be a string\";\n }\n if (!id.trim()) {\n return \"ID must be defined\";\n }\n if (!isStandalone && id != registeredId) {\n return \"ID must be unique\";\n }\n return undefined;\n })(),\n });\n\n const listboxItem = (\n <ListBoxItem key={registeredId} id={registeredId} {...rest}>\n {({\n isHovered,\n isPressed,\n isFocused,\n isFocusVisible,\n isSelected,\n isDisabled,\n }) =>\n withObservedValues(\n children,\n {\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n selected: isSelected,\n disabled: isDisabled,\n },\n plasmicUpdateVariant\n )\n }\n </ListBoxItem>\n );\n\n if (isStandalone) {\n // selection mode needs to be single/multiple to be able to trigger hover state on it.\n return <ListBox selectionMode=\"single\">{listboxItem}</ListBox>;\n }\n\n return listboxItem;\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 variants,\n props: {\n id: {\n type: \"string\",\n description: \"A unique value for tracking the selected item in state\",\n required: true,\n displayName: \"Value\",\n validator: (_value, _props, ctx) => {\n if (ctx?.idError) {\n return ctx.idError;\n }\n return true;\n },\n },\n textValue: {\n type: \"string\",\n displayName: \"Label\",\n description:\n \"A user-friendly text representation of the item's contents, used for features like typeahead.\",\n },\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: makeDefaultListBoxItemChildren(\"Item\"),\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["pickAriaComponentVariants","React","PlasmicListBoxContext","useState","useEffect","ListBoxItem","ListBox","TEXT_COMPONENT_NAME","DESCRIPTION_COMPONENT_NAME","registerComponentHelper","makeComponentName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,MAAM,sBAAyB,GAAA;AAAA,EAC7B,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AACF,CAAA,CAAA;AAEA,MAAM,EAAE,QAAU,EAAA,kBAAA,EAAuB,GAAAA,sCAAA;AAAA,EACvC,sBAAA;AACF,CAAA,CAAA;AAcO,SAAS,gBAAgB,KAA6B,EAAA;AAC3D,EAAA,MACE,EADM,GAAA,KAAA,EAAA,EAAA,QAAA,EAAU,qBAAuB,EAAA,oBAAA,EAAsB,EAzCjE,EAAA,GA0CI,EADoE,EAAA,IAAA,GAAA,SAAA,CACpE,EADoE,EAAA,CAA9D,UAAU,EAAA,uBAAA,EAAuB,sBAAsB,EAAA,IAAA,CAAA,CAAA,CAAA;AAE/D,EAAM,MAAA,cAAA,GAAiBC,sBAAM,CAAA,UAAA,CAAWC,8BAAqB,CAAA,CAAA;AAC7D,EAAA,MAAM,eAAe,CAAC,cAAA,CAAA;AAStB,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAIC,cAA6B,EAAA,CAAA;AAErE,EAAAC,eAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,cAAgB,EAAA;AACnB,MAAA,OAAA;AAAA,KACF;AAEA,IAAA,MAAM,OAAU,GAAA,cAAA,CAAe,SAAU,CAAA,QAAA,CAAS,EAAE,CAAA,CAAA;AACpD,IAAA,eAAA,CAAgB,OAAO,CAAA,CAAA;AAEvB,IAAA,OAAO,MAAM;AACX,MAAe,cAAA,CAAA,SAAA,CAAU,WAAW,OAAO,CAAA,CAAA;AAC3C,MAAA,eAAA,CAAgB,KAAS,CAAA,CAA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MACA,KAAO,EAAA;AAAA,QACL,EAAI,EAAA;AAAA,UACF,IAAM,EAAA,QAAA;AAAA,UACN,WAAa,EAAA,wDAAA;AAAA,UACb,QAAU,EAAA,IAAA;AAAA,UACV,WAAa,EAAA,OAAA;AAAA,UACb,SAAW,EAAA,CAAC,MAAQ,EAAA,MAAA,EAAQ,GAAQ,KAAA;AAClC,YAAA,IAAI,2BAAK,OAAS,EAAA;AAChB,cAAA,OAAO,GAAI,CAAA,OAAA,CAAA;AAAA,aACb;AACA,YAAO,OAAA,IAAA,CAAA;AAAA,WACT;AAAA,SACF;AAAA,QACA,SAAW,EAAA;AAAA,UACT,IAAM,EAAA,QAAA;AAAA,UACN,WAAa,EAAA,OAAA;AAAA,UACb,WACE,EAAA,+FAAA;AAAA,SACJ;AAAA,QACA,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,MAAA;AAAA,UACN,eAAiB,EAAA,IAAA;AAAA,UACjB,YAAA,EAAc,+BAA+B,MAAM,CAAA;AAAA,SACrD;AAAA,OACF;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;;"}
|
|
@@ -4,7 +4,7 @@ import { b as PlasmicListBoxContext } from './contexts-081d65a0.esm.js';
|
|
|
4
4
|
import { DESCRIPTION_COMPONENT_NAME } from './registerDescription.esm.js';
|
|
5
5
|
import { TEXT_COMPONENT_NAME } from './registerText.esm.js';
|
|
6
6
|
import { r as registerComponentHelper, a as makeComponentName } from './utils-c7662a47.esm.js';
|
|
7
|
-
import { p as pickAriaComponentVariants } from './variant-utils-
|
|
7
|
+
import { p as pickAriaComponentVariants } from './variant-utils-7c2ea202.esm.js';
|
|
8
8
|
import '@plasmicapp/host/registerComponent';
|
|
9
9
|
|
|
10
10
|
var __defProp = Object.defineProperty;
|
|
@@ -153,7 +153,7 @@ function registerListBoxItem(loader, overrides) {
|
|
|
153
153
|
props: {
|
|
154
154
|
id: {
|
|
155
155
|
type: "string",
|
|
156
|
-
description: "A unique
|
|
156
|
+
description: "A unique value for tracking the selected item in state",
|
|
157
157
|
required: true,
|
|
158
158
|
displayName: "Value",
|
|
159
159
|
validator: (_value, _props, ctx) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerListBoxItem.esm.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { PlasmicElement } from \"@plasmicapp/host\";\nimport React, { useEffect, useState } from \"react\";\nimport { ListBox, ListBoxItem } from \"react-aria-components\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport { DESCRIPTION_COMPONENT_NAME } from \"./registerDescription\";\nimport { TEXT_COMPONENT_NAME } from \"./registerText\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst LIST_BOX_ITEM_VARIANTS = [\n \"hovered\" as const,\n \"pressed\" as const,\n \"focused\" as const,\n \"focusVisible\" as const,\n \"selected\" as const,\n \"disabled\" as const,\n];\n\nconst { variants, withObservedValues } = pickAriaComponentVariants(\n LIST_BOX_ITEM_VARIANTS\n);\n\nexport interface BaseListBoxControlContextData {\n idError?: string;\n}\n\nexport interface BaseListBoxItemProps\n extends React.ComponentProps<typeof ListBoxItem>,\n HasControlContextData<BaseListBoxControlContextData>,\n WithVariants<typeof LIST_BOX_ITEM_VARIANTS> {\n id?: string;\n children?: React.ReactNode;\n}\n\nexport function BaseListBoxItem(props: BaseListBoxItemProps) {\n const { children, setControlContextData, plasmicUpdateVariant, id, ...rest } =\n props;\n const listboxContext = React.useContext(PlasmicListBoxContext);\n const isStandalone = !listboxContext;\n /**\n * Ids of each listboxitem inside a listbox have to be unique. Otherwise, the items won't show up in the listbox.\n * This is particularly important to ensure, because the most common use case would be to apply Repeat Element to the listbox item.\n * The ids of each repeated item will initially be the same (until the user changes the id prop of the listboxitem).\n *\n * The registerId, therefore, is the unique id of the listboxitem.\n * It is the id registered with the listbox context, so that it can auto-generate a unique id if it identifies a duplicate.\n */\n const [registeredId, setRegisteredId] = useState<string | undefined>();\n\n useEffect(() => {\n if (!listboxContext) {\n return;\n }\n\n const localId = listboxContext.idManager.register(id);\n setRegisteredId(localId);\n\n return () => {\n listboxContext.idManager.unregister(localId);\n setRegisteredId(undefined);\n };\n }, [id]);\n\n setControlContextData?.({\n idError: (() => {\n if (id === undefined) {\n return \"ID must be defined\";\n }\n if (typeof id !== \"string\") {\n return \"ID must be a string\";\n }\n if (!id.trim()) {\n return \"ID must be defined\";\n }\n if (!isStandalone && id != registeredId) {\n return \"ID must be unique\";\n }\n return undefined;\n })(),\n });\n\n const listboxItem = (\n <ListBoxItem key={registeredId} id={registeredId} {...rest}>\n {({\n isHovered,\n isPressed,\n isFocused,\n isFocusVisible,\n isSelected,\n isDisabled,\n }) =>\n withObservedValues(\n children,\n {\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n selected: isSelected,\n disabled: isDisabled,\n },\n plasmicUpdateVariant\n )\n }\n </ListBoxItem>\n );\n\n if (isStandalone) {\n // selection mode needs to be single/multiple to be able to trigger hover state on it.\n return <ListBox selectionMode=\"single\">{listboxItem}</ListBox>;\n }\n\n return listboxItem;\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 variants,\n props: {\n id: {\n type: \"string\",\n description: \"A unique
|
|
1
|
+
{"version":3,"file":"registerListBoxItem.esm.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { PlasmicElement } from \"@plasmicapp/host\";\nimport React, { useEffect, useState } from \"react\";\nimport { ListBox, ListBoxItem } from \"react-aria-components\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport { DESCRIPTION_COMPONENT_NAME } from \"./registerDescription\";\nimport { TEXT_COMPONENT_NAME } from \"./registerText\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst LIST_BOX_ITEM_VARIANTS = [\n \"hovered\" as const,\n \"pressed\" as const,\n \"focused\" as const,\n \"focusVisible\" as const,\n \"selected\" as const,\n \"disabled\" as const,\n];\n\nconst { variants, withObservedValues } = pickAriaComponentVariants(\n LIST_BOX_ITEM_VARIANTS\n);\n\nexport interface BaseListBoxControlContextData {\n idError?: string;\n}\n\nexport interface BaseListBoxItemProps\n extends React.ComponentProps<typeof ListBoxItem>,\n HasControlContextData<BaseListBoxControlContextData>,\n WithVariants<typeof LIST_BOX_ITEM_VARIANTS> {\n id?: string;\n children?: React.ReactNode;\n}\n\nexport function BaseListBoxItem(props: BaseListBoxItemProps) {\n const { children, setControlContextData, plasmicUpdateVariant, id, ...rest } =\n props;\n const listboxContext = React.useContext(PlasmicListBoxContext);\n const isStandalone = !listboxContext;\n /**\n * Ids of each listboxitem inside a listbox have to be unique. Otherwise, the items won't show up in the listbox.\n * This is particularly important to ensure, because the most common use case would be to apply Repeat Element to the listbox item.\n * The ids of each repeated item will initially be the same (until the user changes the id prop of the listboxitem).\n *\n * The registerId, therefore, is the unique id of the listboxitem.\n * It is the id registered with the listbox context, so that it can auto-generate a unique id if it identifies a duplicate.\n */\n const [registeredId, setRegisteredId] = useState<string | undefined>();\n\n useEffect(() => {\n if (!listboxContext) {\n return;\n }\n\n const localId = listboxContext.idManager.register(id);\n setRegisteredId(localId);\n\n return () => {\n listboxContext.idManager.unregister(localId);\n setRegisteredId(undefined);\n };\n }, [id]);\n\n setControlContextData?.({\n idError: (() => {\n if (id === undefined) {\n return \"ID must be defined\";\n }\n if (typeof id !== \"string\") {\n return \"ID must be a string\";\n }\n if (!id.trim()) {\n return \"ID must be defined\";\n }\n if (!isStandalone && id != registeredId) {\n return \"ID must be unique\";\n }\n return undefined;\n })(),\n });\n\n const listboxItem = (\n <ListBoxItem key={registeredId} id={registeredId} {...rest}>\n {({\n isHovered,\n isPressed,\n isFocused,\n isFocusVisible,\n isSelected,\n isDisabled,\n }) =>\n withObservedValues(\n children,\n {\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n selected: isSelected,\n disabled: isDisabled,\n },\n plasmicUpdateVariant\n )\n }\n </ListBoxItem>\n );\n\n if (isStandalone) {\n // selection mode needs to be single/multiple to be able to trigger hover state on it.\n return <ListBox selectionMode=\"single\">{listboxItem}</ListBox>;\n }\n\n return listboxItem;\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 variants,\n props: {\n id: {\n type: \"string\",\n description: \"A unique value for tracking the selected item in state\",\n required: true,\n displayName: \"Value\",\n validator: (_value, _props, ctx) => {\n if (ctx?.idError) {\n return ctx.idError;\n }\n return true;\n },\n },\n textValue: {\n type: \"string\",\n displayName: \"Label\",\n description:\n \"A user-friendly text representation of the item's contents, used for features like typeahead.\",\n },\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: makeDefaultListBoxItemChildren(\"Item\"),\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,MAAM,sBAAyB,GAAA;AAAA,EAC7B,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AACF,CAAA,CAAA;AAEA,MAAM,EAAE,QAAU,EAAA,kBAAA,EAAuB,GAAA,yBAAA;AAAA,EACvC,sBAAA;AACF,CAAA,CAAA;AAcO,SAAS,gBAAgB,KAA6B,EAAA;AAC3D,EAAA,MACE,EADM,GAAA,KAAA,EAAA,EAAA,QAAA,EAAU,qBAAuB,EAAA,oBAAA,EAAsB,EAzCjE,EAAA,GA0CI,EADoE,EAAA,IAAA,GAAA,SAAA,CACpE,EADoE,EAAA,CAA9D,UAAU,EAAA,uBAAA,EAAuB,sBAAsB,EAAA,IAAA,CAAA,CAAA,CAAA;AAE/D,EAAM,MAAA,cAAA,GAAiB,KAAM,CAAA,UAAA,CAAW,qBAAqB,CAAA,CAAA;AAC7D,EAAA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components');
|
|
7
7
|
var contexts = require('./contexts-baa37b74.cjs.js');
|
|
8
8
|
var utils$1 = require('./utils-8dbb4d1f.cjs.js');
|
|
9
|
+
var variantUtils = require('./variant-utils-8cb38f8f.cjs.js');
|
|
9
10
|
require('@plasmicapp/host/registerComponent');
|
|
10
11
|
|
|
11
12
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -40,14 +41,29 @@ var __objRest = (source, exclude) => {
|
|
|
40
41
|
}
|
|
41
42
|
return target;
|
|
42
43
|
};
|
|
44
|
+
const POPOVER_VARIANTS = [
|
|
45
|
+
"placementTop",
|
|
46
|
+
"placementBottom",
|
|
47
|
+
"placementLeft",
|
|
48
|
+
"placementRight"
|
|
49
|
+
];
|
|
50
|
+
const { variants, withObservedValues } = variantUtils.pickAriaComponentVariants(POPOVER_VARIANTS);
|
|
43
51
|
function BasePopover(props) {
|
|
44
|
-
var
|
|
45
|
-
const _a = props, {
|
|
52
|
+
var _c;
|
|
53
|
+
const _a = props, {
|
|
54
|
+
resetClassName,
|
|
55
|
+
setControlContextData,
|
|
56
|
+
plasmicUpdateVariant
|
|
57
|
+
} = _a, restProps = __objRest(_a, [
|
|
58
|
+
"resetClassName",
|
|
59
|
+
"setControlContextData",
|
|
60
|
+
"plasmicUpdateVariant"
|
|
61
|
+
]);
|
|
46
62
|
const isStandalone = !React__default.default.useContext(reactAriaComponents.PopoverContext);
|
|
47
63
|
const context = React__default.default.useContext(contexts.PlasmicPopoverContext);
|
|
48
64
|
const triggerRef = React__default.default.useRef(null);
|
|
49
65
|
const isEditMode = !!host.usePlasmicCanvasContext();
|
|
50
|
-
const
|
|
66
|
+
const _b = utils.mergeProps(
|
|
51
67
|
{
|
|
52
68
|
isOpen: context == null ? void 0 : context.isOpen,
|
|
53
69
|
shouldFlip: context == null ? void 0 : context.defaultShouldFlip
|
|
@@ -70,11 +86,20 @@ function BasePopover(props) {
|
|
|
70
86
|
* */
|
|
71
87
|
isOpen: true
|
|
72
88
|
} : null
|
|
73
|
-
);
|
|
89
|
+
), { children } = _b, mergedProps = __objRest(_b, ["children"]);
|
|
74
90
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
75
|
-
defaultShouldFlip: (
|
|
91
|
+
defaultShouldFlip: (_c = context == null ? void 0 : context.defaultShouldFlip) != null ? _c : true
|
|
76
92
|
});
|
|
77
|
-
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({}, mergedProps))
|
|
93
|
+
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({}, mergedProps), ({ placement }) => withObservedValues(
|
|
94
|
+
children,
|
|
95
|
+
{
|
|
96
|
+
placementTop: placement === "top",
|
|
97
|
+
placementBottom: placement === "bottom",
|
|
98
|
+
placementLeft: placement === "left",
|
|
99
|
+
placementRight: placement === "right"
|
|
100
|
+
},
|
|
101
|
+
plasmicUpdateVariant
|
|
102
|
+
)));
|
|
78
103
|
}
|
|
79
104
|
const POPOVER_COMPONENT_NAME = utils$1.makeComponentName("popover");
|
|
80
105
|
const POPOVER_ARROW_IMG = {
|
|
@@ -98,6 +123,7 @@ function registerPopover(loader, overrides) {
|
|
|
98
123
|
displayName: "Aria Popover",
|
|
99
124
|
importPath: "@plasmicpkgs/react-aria/skinny/registerPopover",
|
|
100
125
|
importName: "BasePopover",
|
|
126
|
+
variants,
|
|
101
127
|
defaultStyles: {
|
|
102
128
|
borderWidth: "1px",
|
|
103
129
|
borderStyle: "solid",
|
|
@@ -155,12 +181,11 @@ function registerPopover(loader, overrides) {
|
|
|
155
181
|
description: "Default placement of the popover relative to the trigger, if there is enough space",
|
|
156
182
|
defaultValueHint: "bottom",
|
|
157
183
|
options: [
|
|
158
|
-
|
|
159
|
-
"bottom left",
|
|
160
|
-
"bottom right",
|
|
184
|
+
// Not allowing other placement options here because of https://github.com/adobe/react-spectrum/issues/6825
|
|
161
185
|
"top",
|
|
162
|
-
"
|
|
163
|
-
"
|
|
186
|
+
"bottom",
|
|
187
|
+
"left",
|
|
188
|
+
"right"
|
|
164
189
|
]
|
|
165
190
|
},
|
|
166
191
|
resetClassName: {
|
|
@@ -1 +1 @@
|
|
|
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 } from \"react-aria-components\";\nimport { PlasmicPopoverContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface PopoverControlContextData {\n defaultShouldFlip?: boolean;\n}\n\nexport interface BasePopoverProps\n extends React.ComponentProps<typeof Popover>,\n HasControlContextData<PopoverControlContextData> {\n className?: string;\n resetClassName?: string;\n defaultShouldFlip?: boolean;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const { resetClassName, setControlContextData, ...restProps } = props;\n // Popover can be inside DialogTrigger, Select, Combobox, etc. So we can't just use a particular context like DialogTrigger (like we do in Modal) to decide if it is standalone\n const isStandalone = !React.useContext(PopoverContext);\n const context = React.useContext(PlasmicPopoverContext);\n const triggerRef = React.useRef<any>(null);\n const isEditMode = !!usePlasmicCanvasContext();\n\n const mergedProps = mergeProps(\n {\n isOpen: context?.isOpen,\n shouldFlip: context?.defaultShouldFlip,\n },\n /**\n * isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies. *\n *\n * Setting isNonModal to true in edit mode (canvas) means that the popover will not prevent the user from interacting with the canvas while the popover is open.\n */\n isEditMode ? { isNonModal: true } : null,\n restProps,\n { className: `${resetClassName}` },\n // Override some props if the popover is standalone\n isStandalone\n ? {\n triggerRef,\n isNonModal: true,\n /**\n * Always true, because we assume that popover is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc, and its only really standalone in component view\n * In component view, we never want to start with an empty artboard, so isOpen has to be true\n * */\n\n isOpen: true,\n }\n : null\n );\n\n setControlContextData?.({\n defaultShouldFlip: context?.defaultShouldFlip ?? true,\n });\n\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover {...mergedProps} />\n </>\n );\n}\n\nexport const POPOVER_COMPONENT_NAME = makeComponentName(\"popover\");\nexport const POPOVER_ARROW_IMG: PlasmicElement = {\n type: \"img\",\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 mergeWithParent: true,\n defaultValue: [\n POPOVER_ARROW_IMG,\n {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: 0,\n rowGap: \"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: 8,\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: (_props, ctx) => ctx?.defaultShouldFlip,\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 // No isOpen state for popover, because we assume that its open state is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc.\n styleSections: true,\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["React","PopoverContext","PlasmicPopoverContext","usePlasmicCanvasContext","mergeProps","Popover","makeComponentName","registerComponentHelper"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,SAAS,YAAY,KAAyB,EAAA;AAzBrD,EAAA,IAAA,EAAA,CAAA;AA0BE,EAAgE,MAAA,EAAA,GAAA,KAAA,EAAxD,kBAAgB,qBA1B1B,EAAA,GA0BkE,IAAd,SAAc,GAAA,SAAA,CAAA,EAAA,EAAd,CAA1C,gBAAgB,EAAA,uBAAA,CAAA,CAAA,CAAA;AAExB,EAAA,MAAM,YAAe,GAAA,CAACA,sBAAM,CAAA,UAAA,CAAWC,kCAAc,CAAA,CAAA;AACrD,EAAM,MAAA,OAAA,GAAUD,sBAAM,CAAA,UAAA,CAAWE,8BAAqB,CAAA,CAAA;AACtD,EAAM,MAAA,UAAA,GAAaF,sBAAM,CAAA,MAAA,CAAY,IAAI,CAAA,CAAA;AACzC,EAAM,MAAA,UAAA,GAAa,CAAC,CAACG,4BAAwB,EAAA,CAAA;AAE7C,EAAA,MAAM,WAAc,GAAAC,gBAAA;AAAA,IAClB;AAAA,MACE,QAAQ,OAAS,IAAA,I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AA,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,UAAY,EAAA;AAAA,UACV,IAAM,EAAA,SAAA;AAAA,UACN,WACE,EAAA,oJAAA;AAAA,UACF,gBAAkB,EAAA,CAAC,MAAQ,EAAA,GAAA,KAAQ,GAAK,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,GAAA,CAAA,iBAAA;AAAA,SAC1C;AAAA,QACA,SAAW,EAAA;AAAA,UACT,IAAM,EAAA,QAAA;AAAA,UACN,WACE,EAAA,oFAAA;AAAA,UACF,gBAAkB,EAAA,QAAA;AAAA,UAClB,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;AAAA,MAEA,aAAe,EAAA,IAAA;AAAA,MACf,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;;;"}
|
|
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 } from \"react-aria-components\";\nimport { PlasmicPopoverContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nexport interface PopoverControlContextData {\n defaultShouldFlip?: boolean;\n}\n\n/*\n NOTE: Placement should be managed as variants, not just props.\n When `shouldFlip` is true, the placement prop may not represent the final position\n (e.g., if placement is set to \"bottom\" but lacks space, the popover may flip to \"top\").\n However, data-selectors will consistently indicate the actual placement of the popover.\n */\nconst POPOVER_VARIANTS = [\n \"placementTop\" as const,\n \"placementBottom\" as const,\n \"placementLeft\" as const,\n \"placementRight\" as const,\n];\n\nconst { variants, withObservedValues } =\n pickAriaComponentVariants(POPOVER_VARIANTS);\n\nexport interface BasePopoverProps\n extends React.ComponentProps<typeof Popover>,\n WithVariants<typeof POPOVER_VARIANTS>,\n HasControlContextData<PopoverControlContextData> {\n className?: string;\n resetClassName?: string;\n defaultShouldFlip?: boolean;\n children?: React.ReactNode;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const {\n resetClassName,\n setControlContextData,\n plasmicUpdateVariant,\n ...restProps\n } = props;\n // Popover can be inside DialogTrigger, Select, Combobox, etc. So we can't just use a particular context like DialogTrigger (like we do in Modal) to decide if it is standalone\n const isStandalone = !React.useContext(PopoverContext);\n const context = React.useContext(PlasmicPopoverContext);\n const triggerRef = React.useRef<any>(null);\n const isEditMode = !!usePlasmicCanvasContext();\n\n const { children, ...mergedProps } = mergeProps(\n {\n isOpen: context?.isOpen,\n shouldFlip: context?.defaultShouldFlip,\n },\n /**\n * isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies. *\n *\n * Setting isNonModal to true in edit mode (canvas) means that the popover will not prevent the user from interacting with the canvas while the popover is open.\n */\n isEditMode ? { isNonModal: true } : null,\n restProps,\n { className: `${resetClassName}` },\n // Override some props if the popover is standalone\n isStandalone\n ? {\n triggerRef,\n isNonModal: true,\n /**\n * Always true, because we assume that popover is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc, and its only really standalone in component view\n * In component view, we never want to start with an empty artboard, so isOpen has to be true\n * */\n\n isOpen: true,\n }\n : null\n );\n\n setControlContextData?.({\n defaultShouldFlip: context?.defaultShouldFlip ?? true,\n });\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover {...mergedProps}>\n {({ placement }) =>\n withObservedValues(\n children,\n {\n placementTop: placement === \"top\",\n placementBottom: placement === \"bottom\",\n placementLeft: placement === \"left\",\n placementRight: placement === \"right\",\n },\n plasmicUpdateVariant\n )\n }\n </Popover>\n </>\n );\n}\n\nexport const POPOVER_COMPONENT_NAME = makeComponentName(\"popover\");\nexport const POPOVER_ARROW_IMG: PlasmicElement = {\n type: \"img\",\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 variants,\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 mergeWithParent: true,\n defaultValue: [\n POPOVER_ARROW_IMG,\n {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: 0,\n rowGap: \"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: 8,\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: (_props, ctx) => ctx?.defaultShouldFlip,\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 // Not allowing other placement options here because of https://github.com/adobe/react-spectrum/issues/6825\n \"top\",\n \"bottom\",\n \"left\",\n \"right\",\n ],\n },\n resetClassName: {\n type: \"themeResetClass\",\n },\n },\n // No isOpen state for popover, because we assume that its open state is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc.\n styleSections: true,\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["pickAriaComponentVariants","React","PopoverContext","PlasmicPopoverContext","usePlasmicCanvasContext","mergeProps","Popover","makeComponentName","registerComponentHelper"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,gBAAmB,GAAA;AAAA,EACvB,cAAA;AAAA,EACA,iBAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AACF,CAAA,CAAA;AAEA,MAAM,EAAE,QAAA,EAAU,kBAAmB,EAAA,GACnCA,uCAA0B,gBAAgB,CAAA,CAAA;AAYrC,SAAS,YAAY,KAAyB,EAAA;AA5CrD,EAAA,IAAA,EAAA,CAAA;AA6CE,EAAA,MAKI,EAJF,GAAA,KAAA,EAAA;AAAA,IAAA,cAAA;AAAA,IACA,qBAAA;AAAA,IACA,oBAAA;AAAA,GAhDJ,GAkDM,EADC,EAAA,SAAA,GAAA,SAAA,CACD,EADC,EAAA;AAAA,IAHH,gBAAA;AAAA,IACA,uBAAA;AAAA,IACA,sBAAA;AAAA,GAAA,CAAA,CAAA;AAIF,EAAA,MAAM,YAAe,GAAA,CAACC,sBAAM,CAAA,UAAA,CAAWC,kCAAc,CAAA,CAAA;AACrD,EAAM,MAAA,OAAA,GAAUD,sBAAM,CAAA,UAAA,CAAWE,8BAAqB,CAAA,CAAA;AACtD,EAAM,MAAA,U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d,IAAM,EAAA,iBAAA;AAAA,SACR;AAAA,OACF;AAAA;AAAA,MAEA,aAAe,EAAA,IAAA;AAAA,MACf,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;;;"}
|
|
@@ -2,15 +2,19 @@ import { PlasmicElement } from "@plasmicapp/host";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Popover } from "react-aria-components";
|
|
4
4
|
import { CodeComponentMetaOverrides, HasControlContextData, Registerable } from "./utils";
|
|
5
|
+
import { WithVariants } from "./variant-utils";
|
|
5
6
|
export interface PopoverControlContextData {
|
|
6
7
|
defaultShouldFlip?: boolean;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
declare const POPOVER_VARIANTS: ("placementLeft" | "placementRight" | "placementTop" | "placementBottom")[];
|
|
10
|
+
export interface BasePopoverProps extends React.ComponentProps<typeof Popover>, WithVariants<typeof POPOVER_VARIANTS>, HasControlContextData<PopoverControlContextData> {
|
|
9
11
|
className?: string;
|
|
10
12
|
resetClassName?: string;
|
|
11
13
|
defaultShouldFlip?: boolean;
|
|
14
|
+
children?: React.ReactNode;
|
|
12
15
|
}
|
|
13
16
|
export declare function BasePopover(props: BasePopoverProps): React.JSX.Element;
|
|
14
17
|
export declare const POPOVER_COMPONENT_NAME: string;
|
|
15
18
|
export declare const POPOVER_ARROW_IMG: PlasmicElement;
|
|
16
19
|
export declare function registerPopover(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BasePopover>): void;
|
|
20
|
+
export {};
|
|
@@ -4,6 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import { PopoverContext, Popover } from 'react-aria-components';
|
|
5
5
|
import { a as PlasmicPopoverContext } from './contexts-081d65a0.esm.js';
|
|
6
6
|
import { a as makeComponentName, r as registerComponentHelper } from './utils-c7662a47.esm.js';
|
|
7
|
+
import { p as pickAriaComponentVariants } from './variant-utils-7c2ea202.esm.js';
|
|
7
8
|
import '@plasmicapp/host/registerComponent';
|
|
8
9
|
|
|
9
10
|
var __defProp = Object.defineProperty;
|
|
@@ -34,14 +35,29 @@ var __objRest = (source, exclude) => {
|
|
|
34
35
|
}
|
|
35
36
|
return target;
|
|
36
37
|
};
|
|
38
|
+
const POPOVER_VARIANTS = [
|
|
39
|
+
"placementTop",
|
|
40
|
+
"placementBottom",
|
|
41
|
+
"placementLeft",
|
|
42
|
+
"placementRight"
|
|
43
|
+
];
|
|
44
|
+
const { variants, withObservedValues } = pickAriaComponentVariants(POPOVER_VARIANTS);
|
|
37
45
|
function BasePopover(props) {
|
|
38
|
-
var
|
|
39
|
-
const _a = props, {
|
|
46
|
+
var _c;
|
|
47
|
+
const _a = props, {
|
|
48
|
+
resetClassName,
|
|
49
|
+
setControlContextData,
|
|
50
|
+
plasmicUpdateVariant
|
|
51
|
+
} = _a, restProps = __objRest(_a, [
|
|
52
|
+
"resetClassName",
|
|
53
|
+
"setControlContextData",
|
|
54
|
+
"plasmicUpdateVariant"
|
|
55
|
+
]);
|
|
40
56
|
const isStandalone = !React.useContext(PopoverContext);
|
|
41
57
|
const context = React.useContext(PlasmicPopoverContext);
|
|
42
58
|
const triggerRef = React.useRef(null);
|
|
43
59
|
const isEditMode = !!usePlasmicCanvasContext();
|
|
44
|
-
const
|
|
60
|
+
const _b = mergeProps(
|
|
45
61
|
{
|
|
46
62
|
isOpen: context == null ? void 0 : context.isOpen,
|
|
47
63
|
shouldFlip: context == null ? void 0 : context.defaultShouldFlip
|
|
@@ -64,11 +80,20 @@ function BasePopover(props) {
|
|
|
64
80
|
* */
|
|
65
81
|
isOpen: true
|
|
66
82
|
} : null
|
|
67
|
-
);
|
|
83
|
+
), { children } = _b, mergedProps = __objRest(_b, ["children"]);
|
|
68
84
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
69
|
-
defaultShouldFlip: (
|
|
85
|
+
defaultShouldFlip: (_c = context == null ? void 0 : context.defaultShouldFlip) != null ? _c : true
|
|
70
86
|
});
|
|
71
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, isStandalone && /* @__PURE__ */ React.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React.createElement(Popover, __spreadValues({}, mergedProps))
|
|
87
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, isStandalone && /* @__PURE__ */ React.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React.createElement(Popover, __spreadValues({}, mergedProps), ({ placement }) => withObservedValues(
|
|
88
|
+
children,
|
|
89
|
+
{
|
|
90
|
+
placementTop: placement === "top",
|
|
91
|
+
placementBottom: placement === "bottom",
|
|
92
|
+
placementLeft: placement === "left",
|
|
93
|
+
placementRight: placement === "right"
|
|
94
|
+
},
|
|
95
|
+
plasmicUpdateVariant
|
|
96
|
+
)));
|
|
72
97
|
}
|
|
73
98
|
const POPOVER_COMPONENT_NAME = makeComponentName("popover");
|
|
74
99
|
const POPOVER_ARROW_IMG = {
|
|
@@ -92,6 +117,7 @@ function registerPopover(loader, overrides) {
|
|
|
92
117
|
displayName: "Aria Popover",
|
|
93
118
|
importPath: "@plasmicpkgs/react-aria/skinny/registerPopover",
|
|
94
119
|
importName: "BasePopover",
|
|
120
|
+
variants,
|
|
95
121
|
defaultStyles: {
|
|
96
122
|
borderWidth: "1px",
|
|
97
123
|
borderStyle: "solid",
|
|
@@ -149,12 +175,11 @@ function registerPopover(loader, overrides) {
|
|
|
149
175
|
description: "Default placement of the popover relative to the trigger, if there is enough space",
|
|
150
176
|
defaultValueHint: "bottom",
|
|
151
177
|
options: [
|
|
152
|
-
|
|
153
|
-
"bottom left",
|
|
154
|
-
"bottom right",
|
|
178
|
+
// Not allowing other placement options here because of https://github.com/adobe/react-spectrum/issues/6825
|
|
155
179
|
"top",
|
|
156
|
-
"
|
|
157
|
-
"
|
|
180
|
+
"bottom",
|
|
181
|
+
"left",
|
|
182
|
+
"right"
|
|
158
183
|
]
|
|
159
184
|
},
|
|
160
185
|
resetClassName: {
|
|
@@ -1 +1 @@
|
|
|
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 } from \"react-aria-components\";\nimport { PlasmicPopoverContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface PopoverControlContextData {\n defaultShouldFlip?: boolean;\n}\n\nexport interface BasePopoverProps\n extends React.ComponentProps<typeof Popover>,\n HasControlContextData<PopoverControlContextData> {\n className?: string;\n resetClassName?: string;\n defaultShouldFlip?: boolean;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const { resetClassName, setControlContextData, ...restProps } = props;\n // Popover can be inside DialogTrigger, Select, Combobox, etc. So we can't just use a particular context like DialogTrigger (like we do in Modal) to decide if it is standalone\n const isStandalone = !React.useContext(PopoverContext);\n const context = React.useContext(PlasmicPopoverContext);\n const triggerRef = React.useRef<any>(null);\n const isEditMode = !!usePlasmicCanvasContext();\n\n const mergedProps = mergeProps(\n {\n isOpen: context?.isOpen,\n shouldFlip: context?.defaultShouldFlip,\n },\n /**\n * isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies. *\n *\n * Setting isNonModal to true in edit mode (canvas) means that the popover will not prevent the user from interacting with the canvas while the popover is open.\n */\n isEditMode ? { isNonModal: true } : null,\n restProps,\n { className: `${resetClassName}` },\n // Override some props if the popover is standalone\n isStandalone\n ? {\n triggerRef,\n isNonModal: true,\n /**\n * Always true, because we assume that popover is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc, and its only really standalone in component view\n * In component view, we never want to start with an empty artboard, so isOpen has to be true\n * */\n\n isOpen: true,\n }\n : null\n );\n\n setControlContextData?.({\n defaultShouldFlip: context?.defaultShouldFlip ?? true,\n });\n\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover {...mergedProps} />\n </>\n );\n}\n\nexport const POPOVER_COMPONENT_NAME = makeComponentName(\"popover\");\nexport const POPOVER_ARROW_IMG: PlasmicElement = {\n type: \"img\",\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 mergeWithParent: true,\n defaultValue: [\n POPOVER_ARROW_IMG,\n {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: 0,\n rowGap: \"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: 8,\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: (_props, ctx) => ctx?.defaultShouldFlip,\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 // No isOpen state for popover, because we assume that its open state is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc.\n styleSections: true,\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,SAAS,YAAY,KAAyB,EAAA;AAzBrD,EAAA,IAAA,EAAA,CAAA;AA0BE,EAAgE,MAAA,EAAA,GAAA,KAAA,EAAxD,kBAAgB,qBA1B1B,EAAA,GA0BkE,IAAd,SAAc,GAAA,SAAA,CAAA,EAAA,EAAd,CAA1C,gBAAgB,EAAA,uBAAA,CAAA,CAAA,CAAA;AAExB,EAAA,MAAM,YAAe,GAAA,CAAC,KAAM,CAAA,UAAA,CAAW,cAAc,CAAA,CAAA;AACrD,EAAM,MAAA,OAAA,GAAU,KAAM,CAAA,UAAA,CAAW,qBAAqB,CAAA,CAAA;AACtD,EAAM,MAAA,UAAA,GAAa,KAAM,CAAA,MAAA,CAAY,IAAI,CAAA,CAAA;AACzC,EAAM,MAAA,UAAA,GAAa,CAAC,CAAC,uBAAwB,EAAA,CAAA;AAE7C,EAAA,MAAM,WAAc,GAAA,UAAA;AAAA,IAClB;AAAA,MACE,QAAQ,OAAS,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,OAAA,CAAA,MAAA;AAAA,MACjB,YAAY,OAAS,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,OAAA,CAAA,iBAAA;AAAA,KACvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,UAAa,GAAA,EAAE,UAAY,EAAA,IAAA,EAAS,GAAA,IAAA;AAAA,IACpC,SAAA;AAAA,IACA,EAAE,SAAW,EAAA,CAAA,EAAG,cAAiB,CAAA,CAAA,EAAA;AAAA;AAAA,IAEjC,YACI,GAAA;AAAA,MACE,UAAA;AAAA,MACA,UAAY,EAAA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,EAAA;AAAA,UACT,IAAM,EAAA,QAAA;AAAA,UACN,WACE,EAAA,oFAAA;AAAA,UACF,gBAAkB,EAAA,QAAA;AAAA,UAClB,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;AAAA,MAEA,aAAe,EAAA,IAAA;AAAA,MACf,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
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 } from \"react-aria-components\";\nimport { PlasmicPopoverContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nexport interface PopoverControlContextData {\n defaultShouldFlip?: boolean;\n}\n\n/*\n NOTE: Placement should be managed as variants, not just props.\n When `shouldFlip` is true, the placement prop may not represent the final position\n (e.g., if placement is set to \"bottom\" but lacks space, the popover may flip to \"top\").\n However, data-selectors will consistently indicate the actual placement of the popover.\n */\nconst POPOVER_VARIANTS = [\n \"placementTop\" as const,\n \"placementBottom\" as const,\n \"placementLeft\" as const,\n \"placementRight\" as const,\n];\n\nconst { variants, withObservedValues } =\n pickAriaComponentVariants(POPOVER_VARIANTS);\n\nexport interface BasePopoverProps\n extends React.ComponentProps<typeof Popover>,\n WithVariants<typeof POPOVER_VARIANTS>,\n HasControlContextData<PopoverControlContextData> {\n className?: string;\n resetClassName?: string;\n defaultShouldFlip?: boolean;\n children?: React.ReactNode;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const {\n resetClassName,\n setControlContextData,\n plasmicUpdateVariant,\n ...restProps\n } = props;\n // Popover can be inside DialogTrigger, Select, Combobox, etc. So we can't just use a particular context like DialogTrigger (like we do in Modal) to decide if it is standalone\n const isStandalone = !React.useContext(PopoverContext);\n const context = React.useContext(PlasmicPopoverContext);\n const triggerRef = React.useRef<any>(null);\n const isEditMode = !!usePlasmicCanvasContext();\n\n const { children, ...mergedProps } = mergeProps(\n {\n isOpen: context?.isOpen,\n shouldFlip: context?.defaultShouldFlip,\n },\n /**\n * isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies. *\n *\n * Setting isNonModal to true in edit mode (canvas) means that the popover will not prevent the user from interacting with the canvas while the popover is open.\n */\n isEditMode ? { isNonModal: true } : null,\n restProps,\n { className: `${resetClassName}` },\n // Override some props if the popover is standalone\n isStandalone\n ? {\n triggerRef,\n isNonModal: true,\n /**\n * Always true, because we assume that popover is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc, and its only really standalone in component view\n * In component view, we never want to start with an empty artboard, so isOpen has to be true\n * */\n\n isOpen: true,\n }\n : null\n );\n\n setControlContextData?.({\n defaultShouldFlip: context?.defaultShouldFlip ?? true,\n });\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover {...mergedProps}>\n {({ placement }) =>\n withObservedValues(\n children,\n {\n placementTop: placement === \"top\",\n placementBottom: placement === \"bottom\",\n placementLeft: placement === \"left\",\n placementRight: placement === \"right\",\n },\n plasmicUpdateVariant\n )\n }\n </Popover>\n </>\n );\n}\n\nexport const POPOVER_COMPONENT_NAME = makeComponentName(\"popover\");\nexport const POPOVER_ARROW_IMG: PlasmicElement = {\n type: \"img\",\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 variants,\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 mergeWithParent: true,\n defaultValue: [\n POPOVER_ARROW_IMG,\n {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: 0,\n rowGap: \"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: 8,\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: (_props, ctx) => ctx?.defaultShouldFlip,\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 // Not allowing other placement options here because of https://github.com/adobe/react-spectrum/issues/6825\n \"top\",\n \"bottom\",\n \"left\",\n \"right\",\n ],\n },\n resetClassName: {\n type: \"themeResetClass\",\n },\n },\n // No isOpen state for popover, because we assume that its open state is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc.\n styleSections: true,\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":[],"m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E,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,UAAY,EAAA;AAAA,UACV,IAAM,EAAA,SAAA;AAAA,UACN,WACE,EAAA,oJAAA;AAAA,UACF,gBAAkB,EAAA,CAAC,MAAQ,EAAA,GAAA,KAAQ,GAAK,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,GAAA,CAAA,iBAAA;AAAA,SAC1C;AAAA,QACA,SAAW,EAAA;AAAA,UACT,IAAM,EAAA,QAAA;AAAA,UACN,WACE,EAAA,oFAAA;AAAA,UACF,gBAAkB,EAAA,QAAA;AAAA,UAClB,OAAS,EAAA;AAAA;AAAA,YAEP,KAAA;AAAA,YACA,QAAA;AAAA,YACA,MAAA;AAAA,YACA,OAAA;AAAA,WACF;AAAA,SACF;AAAA,QACA,cAAgB,EAAA;AAAA,UACd,IAAM,EAAA,iBAAA;AAAA,SACR;AAAA,OACF;AAAA;AAAA,MAEA,aAAe,EAAA,IAAA;AAAA,MACf,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -6,7 +6,7 @@ var common = require('./common-2e984ab4.cjs.js');
|
|
|
6
6
|
var contexts = require('./contexts-baa37b74.cjs.js');
|
|
7
7
|
var registerLabel = require('./registerLabel.cjs.js');
|
|
8
8
|
var utils = require('./utils-8dbb4d1f.cjs.js');
|
|
9
|
-
var variantUtils = require('./variant-utils-
|
|
9
|
+
var variantUtils = require('./variant-utils-8cb38f8f.cjs.js');
|
|
10
10
|
require('@plasmicapp/host/registerComponent');
|
|
11
11
|
|
|
12
12
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -4,7 +4,7 @@ import { g as getCommonProps } from './common-0c4336fe.esm.js';
|
|
|
4
4
|
import { e as PlasmicRadioGroupContext } from './contexts-081d65a0.esm.js';
|
|
5
5
|
import { LABEL_COMPONENT_NAME } from './registerLabel.esm.js';
|
|
6
6
|
import { r as registerComponentHelper, a as makeComponentName } from './utils-c7662a47.esm.js';
|
|
7
|
-
import { p as pickAriaComponentVariants } from './variant-utils-
|
|
7
|
+
import { p as pickAriaComponentVariants } from './variant-utils-7c2ea202.esm.js';
|
|
8
8
|
import '@plasmicapp/host/registerComponent';
|
|
9
9
|
|
|
10
10
|
var __defProp = Object.defineProperty;
|
|
@@ -9,7 +9,7 @@ var registerFieldError = require('./registerFieldError.cjs.js');
|
|
|
9
9
|
var registerLabel = require('./registerLabel.cjs.js');
|
|
10
10
|
var registerRadio = require('./registerRadio.cjs.js');
|
|
11
11
|
var utils = require('./utils-8dbb4d1f.cjs.js');
|
|
12
|
-
var variantUtils = require('./variant-utils-
|
|
12
|
+
var variantUtils = require('./variant-utils-8cb38f8f.cjs.js');
|
|
13
13
|
require('./registerText.cjs.js');
|
|
14
14
|
require('@plasmicapp/host/registerComponent');
|
|
15
15
|
|
|
@@ -7,7 +7,7 @@ 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
9
|
import { m as makeChildComponentName, r as registerComponentHelper, a as makeComponentName } from './utils-c7662a47.esm.js';
|
|
10
|
-
import { p as pickAriaComponentVariants } from './variant-utils-
|
|
10
|
+
import { p as pickAriaComponentVariants } from './variant-utils-7c2ea202.esm.js';
|
|
11
11
|
import './registerText.esm.js';
|
|
12
12
|
import '@plasmicapp/host/registerComponent';
|
|
13
13
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerSection.cjs.js","sources":["../src/registerSection.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Header,
|
|
1
|
+
{"version":3,"file":"registerSection.cjs.js","sources":["../src/registerSection.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Header, Section } from \"react-aria-components\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n Styleable,\n} from \"./utils\";\n\nexport interface BaseSectionProps extends Styleable {\n items: React.ReactNode;\n header: React.ReactNode;\n}\n\nexport function BaseSection(props: BaseSectionProps) {\n const { header, items, ...rest } = props;\n const contextProps = React.useContext(PlasmicListBoxContext);\n const mergedProps = mergeProps(contextProps, rest);\n\n return (\n <Section {...mergedProps}>\n <Header>{header}</Header>\n {items}\n </Section>\n );\n}\n\nexport function registerSection(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseSection>\n) {\n return registerComponentHelper(\n loader,\n BaseSection,\n {\n name: makeComponentName(\"section\"),\n displayName: \"Aria Section\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerSection\",\n importName: \"BaseSection\",\n defaultStyles: {\n width: \"stretch\",\n padding: \"10px\",\n },\n props: {\n header: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n {\n type: \"text\",\n value: \"Section Header.\",\n },\n ],\n },\n items: {\n type: \"slot\",\n mergeWithParent: true,\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["React","PlasmicListBoxContext","mergeProps","Section","Header","registerComponentHelper","makeComponentName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,SAAS,YAAY,KAAyB,EAAA;AACnD,EAAmC,MAAA,EAAA,GAAA,KAAA,EAA3B,UAAQ,KAlBlB,EAAA,GAkBqC,IAAT,IAAS,GAAA,SAAA,CAAA,EAAA,EAAT,CAAlB,QAAQ,EAAA,OAAA,CAAA,CAAA,CAAA;AAChB,EAAM,MAAA,YAAA,GAAeA,sBAAM,CAAA,UAAA,CAAWC,8BAAqB,CAAA,CAAA;AAC3D,EAAM,MAAA,WAAA,GAAcC,gBAAW,CAAA,YAAA,EAAc,IAAI,CAAA,CAAA;AAEjD,EAAA,4DACGC,2BAAY,EAAA,cAAA,CAAA,EAAA,EAAA,WAAA,CAAA,uDACVC,0BAAQ,EAAA,IAAA,EAAA,MAAO,GACf,KACH,CAAA,CAAA;AAEJ,CAAA;AAEgB,SAAA,eAAA,CACd,QACA,SACA,EAAA;AACA,EAAO,OAAAC,+BAAA;AAAA,IACL,MAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,MACE,IAAA,EAAMC,0BAAkB,SAAS,CAAA;AAAA,MACjC,WAAa,EAAA,cAAA;AAAA,MACb,UAAY,EAAA,gDAAA;AAAA,MACZ,UAAY,EAAA,aAAA;AAAA,MACZ,aAAe,EAAA;AAAA,QACb,KAAO,EAAA,SAAA;AAAA,QACP,OAAS,EAAA,MAAA;AAAA,OACX;AAAA,MACA,KAAO,EAAA;AAAA,QACL,MAAQ,EAAA;AAAA,UACN,IAAM,EAAA,MAAA;AAAA,UACN,eAAiB,EAAA,IAAA;AAAA,UACjB,YAAc,EAAA;AAAA,YACZ;AAAA,cACE,IAAM,EAAA,MAAA;AAAA,cACN,KAAO,EAAA,iBAAA;AAAA,aACT;AAAA,WACF;AAAA,SACF;AAAA,QACA,KAAO,EAAA;AAAA,UACL,IAAM,EAAA,MAAA;AAAA,UACN,eAAiB,EAAA,IAAA;AAAA,SACnB;AAAA,OACF;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Key } from "react-aria-components";
|
|
3
2
|
import { CodeComponentMetaOverrides, Registerable, Styleable } from "./utils";
|
|
4
3
|
export interface BaseSectionProps extends Styleable {
|
|
5
4
|
items: React.ReactNode;
|
|
6
5
|
header: React.ReactNode;
|
|
7
|
-
key?: Key;
|
|
8
6
|
}
|
|
9
7
|
export declare function BaseSection(props: BaseSectionProps): React.JSX.Element;
|
|
10
8
|
export declare function registerSection(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BaseSection>): import("@plasmicapp/host").CodeComponentMeta<BaseSectionProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerSection.esm.js","sources":["../src/registerSection.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Header,
|
|
1
|
+
{"version":3,"file":"registerSection.esm.js","sources":["../src/registerSection.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Header, Section } from \"react-aria-components\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n Styleable,\n} from \"./utils\";\n\nexport interface BaseSectionProps extends Styleable {\n items: React.ReactNode;\n header: React.ReactNode;\n}\n\nexport function BaseSection(props: BaseSectionProps) {\n const { header, items, ...rest } = props;\n const contextProps = React.useContext(PlasmicListBoxContext);\n const mergedProps = mergeProps(contextProps, rest);\n\n return (\n <Section {...mergedProps}>\n <Header>{header}</Header>\n {items}\n </Section>\n );\n}\n\nexport function registerSection(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseSection>\n) {\n return registerComponentHelper(\n loader,\n BaseSection,\n {\n name: makeComponentName(\"section\"),\n displayName: \"Aria Section\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerSection\",\n importName: \"BaseSection\",\n defaultStyles: {\n width: \"stretch\",\n padding: \"10px\",\n },\n props: {\n header: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n {\n type: \"text\",\n value: \"Section Header.\",\n },\n ],\n },\n items: {\n type: \"slot\",\n mergeWithParent: true,\n },\n },\n trapsFocus: true,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