@plasmicpkgs/react-aria 0.0.27 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/contexts.d.ts +2 -7
  3. package/dist/option-utils.d.ts +4 -13
  4. package/dist/react-aria.esm.js +346 -379
  5. package/dist/react-aria.esm.js.map +1 -1
  6. package/dist/react-aria.js +345 -378
  7. package/dist/react-aria.js.map +1 -1
  8. package/dist/registerDialogTrigger.d.ts +10 -0
  9. package/dist/registerListBox.d.ts +7 -5
  10. package/dist/registerListBoxItem.d.ts +2 -4
  11. package/dist/registerPopover.d.ts +4 -2
  12. package/dist/registerSection.d.ts +1 -3
  13. package/dist/registerSelect.d.ts +1 -1
  14. package/package.json +3 -3
  15. package/skinny/contexts.d.ts +2 -7
  16. package/skinny/{interaction-variant-utils-80bf1cfd.cjs.js → interaction-variant-utils-0f05190f.cjs.js} +16 -2
  17. package/skinny/interaction-variant-utils-0f05190f.cjs.js.map +1 -0
  18. package/skinny/{interaction-variant-utils-608d984b.esm.js → interaction-variant-utils-909267e5.esm.js} +16 -2
  19. package/skinny/interaction-variant-utils-909267e5.esm.js.map +1 -0
  20. package/skinny/{option-utils-765a1782.esm.js → option-utils-4f037568.esm.js} +22 -22
  21. package/skinny/option-utils-4f037568.esm.js.map +1 -0
  22. package/skinny/{option-utils-0db61f6d.cjs.js → option-utils-5e4e85bd.cjs.js} +22 -22
  23. package/skinny/option-utils-5e4e85bd.cjs.js.map +1 -0
  24. package/skinny/option-utils.d.ts +4 -13
  25. package/skinny/registerButton.cjs.js +5 -1
  26. package/skinny/registerButton.cjs.js.map +1 -1
  27. package/skinny/registerButton.esm.js +5 -1
  28. package/skinny/registerButton.esm.js.map +1 -1
  29. package/skinny/registerCheckbox.cjs.js +1 -1
  30. package/skinny/registerCheckbox.esm.js +1 -1
  31. package/skinny/registerCheckboxGroup.cjs.js +1 -1
  32. package/skinny/registerCheckboxGroup.esm.js +1 -1
  33. package/skinny/registerComboBox.cjs.js +10 -18
  34. package/skinny/registerComboBox.cjs.js.map +1 -1
  35. package/skinny/registerComboBox.esm.js +10 -18
  36. package/skinny/registerComboBox.esm.js.map +1 -1
  37. package/skinny/registerDialogTrigger.cjs.js +88 -0
  38. package/skinny/registerDialogTrigger.cjs.js.map +1 -0
  39. package/skinny/registerDialogTrigger.d.ts +10 -0
  40. package/skinny/registerDialogTrigger.esm.js +81 -0
  41. package/skinny/registerDialogTrigger.esm.js.map +1 -0
  42. package/skinny/registerInput.cjs.js +1 -1
  43. package/skinny/registerInput.esm.js +1 -1
  44. package/skinny/registerListBox.cjs.js +29 -73
  45. package/skinny/registerListBox.cjs.js.map +1 -1
  46. package/skinny/registerListBox.d.ts +7 -5
  47. package/skinny/registerListBox.esm.js +29 -73
  48. package/skinny/registerListBox.esm.js.map +1 -1
  49. package/skinny/registerListBoxItem.cjs.js +3 -19
  50. package/skinny/registerListBoxItem.cjs.js.map +1 -1
  51. package/skinny/registerListBoxItem.d.ts +2 -4
  52. package/skinny/registerListBoxItem.esm.js +3 -19
  53. package/skinny/registerListBoxItem.esm.js.map +1 -1
  54. package/skinny/registerPopover.cjs.js +7 -32
  55. package/skinny/registerPopover.cjs.js.map +1 -1
  56. package/skinny/registerPopover.d.ts +4 -2
  57. package/skinny/registerPopover.esm.js +7 -32
  58. package/skinny/registerPopover.esm.js.map +1 -1
  59. package/skinny/registerRadio.cjs.js +1 -1
  60. package/skinny/registerRadio.esm.js +1 -1
  61. package/skinny/registerRadioGroup.cjs.js +1 -1
  62. package/skinny/registerRadioGroup.esm.js +1 -1
  63. package/skinny/registerSection.cjs.js +4 -33
  64. package/skinny/registerSection.cjs.js.map +1 -1
  65. package/skinny/registerSection.d.ts +1 -3
  66. package/skinny/registerSection.esm.js +4 -33
  67. package/skinny/registerSection.esm.js.map +1 -1
  68. package/skinny/registerSelect.cjs.js +4 -15
  69. package/skinny/registerSelect.cjs.js.map +1 -1
  70. package/skinny/registerSelect.d.ts +1 -1
  71. package/skinny/registerSelect.esm.js +4 -15
  72. package/skinny/registerSelect.esm.js.map +1 -1
  73. package/skinny/registerSwitch.cjs.js +1 -1
  74. package/skinny/registerSwitch.esm.js +1 -1
  75. package/skinny/registerTextArea.cjs.js +1 -1
  76. package/skinny/registerTextArea.esm.js +1 -1
  77. package/skinny/registerTextField.cjs.js +1 -1
  78. package/skinny/registerTextField.esm.js +1 -1
  79. package/skinny/registerTooltip.cjs.js +13 -6
  80. package/skinny/registerTooltip.cjs.js.map +1 -1
  81. package/skinny/registerTooltip.esm.js +13 -6
  82. package/skinny/registerTooltip.esm.js.map +1 -1
  83. package/skinny/interaction-variant-utils-608d984b.esm.js.map +0 -1
  84. package/skinny/interaction-variant-utils-80bf1cfd.cjs.js.map +0 -1
  85. package/skinny/option-utils-0db61f6d.cjs.js.map +0 -1
  86. package/skinny/option-utils-765a1782.esm.js.map +0 -1
@@ -4,6 +4,7 @@ var utils = require('@react-aria/utils');
4
4
  var React = require('react');
5
5
  var reactAriaComponents = require('react-aria-components');
6
6
  var contexts = require('./contexts-3e42cdf9.cjs.js');
7
+ var optionUtils = require('./option-utils-5e4e85bd.cjs.js');
7
8
  var registerListBoxItem = require('./registerListBoxItem.cjs.js');
8
9
  var utils$1 = require('./utils-18b2465b.cjs.js');
9
10
  require('@plasmicapp/host/registerComponent');
@@ -43,71 +44,36 @@ var __objRest = (source, exclude) => {
43
44
  }
44
45
  return target;
45
46
  };
46
- const STANDALONE_PROPS = {
47
- getItemType: (item) => item.type,
48
- items: [
49
- { type: "item", value: "op1", label: "Option 1" },
50
- { type: "item", value: "op2", label: "Option 2" },
51
- { type: "item", value: "op3", label: "Option 3" },
52
- {
53
- type: "section",
54
- label: "Section 1",
55
- items: [
56
- { type: "item", value: "s1op1", label: "Section 1 Option 1" },
57
- { type: "item", value: "s1op2", label: "Section 1 Option 2" },
58
- { type: "item", value: "s1op3", label: "Section 1 Option 3" }
59
- ]
60
- },
61
- {
62
- type: "section",
63
- label: "Section 2",
64
- items: [
65
- { type: "item", value: "s2op1", label: "Section 2 Option 1" },
66
- { type: "item", value: "s2op2", label: "Section 2 Option 2" },
67
- { type: "item", value: "s2op3", label: "Section 2 Option 3" }
68
- ]
69
- }
70
- ],
71
- makeItemProps: (item) => ({
72
- key: item.value,
73
- textValue: item.label,
74
- children: item.label
75
- }),
76
- makeSectionProps: (section) => ({
77
- section,
78
- key: section.label
79
- })
80
- };
81
47
  function BaseListBox(props) {
48
+ var _c;
82
49
  const contextProps = React__default.default.useContext(contexts.PlasmicListBoxContext);
83
50
  const isStandalone = !contextProps;
84
- const _a = utils.mergeProps(contextProps, props, isStandalone ? STANDALONE_PROPS : {}), {
85
- makeItemProps,
86
- makeSectionProps,
87
- renderItem,
88
- renderSection,
89
- getItemType
90
- } = _a, rest = __objRest(_a, [
91
- "makeItemProps",
92
- "makeSectionProps",
93
- "renderItem",
94
- "renderSection",
95
- "getItemType"
96
- ]);
97
- return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.ListBox, __spreadValues({}, utils.mergeProps(contextProps, rest)), (item) => {
98
- if ((getItemType == null ? void 0 : getItemType(item)) === "section") {
99
- const sectionProps = makeSectionProps == null ? void 0 : makeSectionProps(item);
100
- return /* @__PURE__ */ React__default.default.createElement(
51
+ const _a = props, rest = __objRest(_a, ["options"]);
52
+ const { options } = optionUtils.useStrictOptions(props);
53
+ const _b = utils.mergeProps(
54
+ contextProps,
55
+ rest,
56
+ isStandalone ? { items: options } : {}
57
+ ), { renderItem, renderSection } = _b, mergedProps = __objRest(_b, ["renderItem", "renderSection"]);
58
+ (_c = props.setControlContextData) == null ? void 0 : _c.call(props, {
59
+ isStandalone
60
+ });
61
+ return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.ListBox, __spreadValues({}, mergedProps), (item) => {
62
+ var _a2;
63
+ if (item.type === "option-group") {
64
+ return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement(
101
65
  contexts.PlasmicSectionContext.Provider,
102
66
  {
103
- key: sectionProps == null ? void 0 : sectionProps.key,
104
- value: __spreadProps(__spreadValues({}, sectionProps), { makeItemProps, renderItem })
67
+ value: {
68
+ renderItem,
69
+ key: (_a2 = item.key) != null ? _a2 : item.label,
70
+ section: item
71
+ }
105
72
  },
106
73
  renderSection == null ? void 0 : renderSection(item)
107
- );
74
+ ));
108
75
  } else {
109
- const itemProps = makeItemProps == null ? void 0 : makeItemProps(item);
110
- return /* @__PURE__ */ React__default.default.createElement(contexts.PlasmicItemContext.Provider, { key: itemProps == null ? void 0 : itemProps.key, value: itemProps }, renderItem == null ? void 0 : renderItem(item));
76
+ return /* @__PURE__ */ React__default.default.createElement(contexts.PlasmicItemContext.Provider, { value: item }, renderItem == null ? void 0 : renderItem(item));
111
77
  }
112
78
  });
113
79
  }
@@ -121,29 +87,19 @@ function registerListBox(loader, overrides) {
121
87
  importPath: "@plasmicpkgs/react-aria/skinny/registerListBox",
122
88
  importName: "BaseListBox",
123
89
  props: {
90
+ options: __spreadProps(__spreadValues({}, optionUtils.makeOptionsPropType()), {
91
+ displayName: "Items",
92
+ hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
93
+ }),
124
94
  renderItem: {
125
95
  type: "slot",
126
96
  displayName: "Render Item",
127
- renderPropParams: ["item"]
97
+ renderPropParams: ["itemProps"]
128
98
  },
129
99
  renderSection: {
130
100
  type: "slot",
131
101
  displayName: "Render Section",
132
- renderPropParams: ["section"]
133
- },
134
- className: {
135
- type: "class",
136
- displayName: "Additional states",
137
- selectors: [
138
- {
139
- selector: ":self[data-focused]",
140
- label: "Focused"
141
- },
142
- {
143
- selector: ":self[data-focus-visible]",
144
- label: "Focused by keyboard"
145
- }
146
- ]
102
+ renderPropParams: ["sectionProps"]
147
103
  }
148
104
  }
149
105
  },
@@ -1 +1 @@
1
- {"version":3,"file":"registerListBox.cjs.js","sources":["../src/registerListBox.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { ListBox } from \"react-aria-components\";\nimport {\n PlasmicItemContext,\n PlasmicListBoxContext,\n PlasmicSectionContext,\n} from \"./contexts\";\nimport {\n registerListBoxItem,\n type BaseListBoxItem,\n} from \"./registerListBoxItem\";\nimport type { BaseSection } from \"./registerSection\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseListBoxProps extends React.ComponentProps<typeof ListBox> {\n makeItemProps?: (\n item: any\n ) => Partial<React.ComponentProps<typeof BaseListBoxItem>>;\n makeSectionProps?: (\n section: any\n ) => Partial<React.ComponentProps<typeof BaseSection>>;\n renderItem?: (item: any) => React.ReactNode;\n renderSection?: (section: any) => React.ReactNode;\n getItemType?: (thing: any) => \"item\" | \"section\";\n}\n\nconst STANDALONE_PROPS: Partial<BaseListBoxProps> = {\n getItemType: (item: any) => item.type,\n items: [\n { type: \"item\", value: \"op1\", label: \"Option 1\" },\n { type: \"item\", value: \"op2\", label: \"Option 2\" },\n { type: \"item\", value: \"op3\", label: \"Option 3\" },\n {\n type: \"section\",\n label: \"Section 1\",\n items: [\n { type: \"item\", value: \"s1op1\", label: \"Section 1 Option 1\" },\n { type: \"item\", value: \"s1op2\", label: \"Section 1 Option 2\" },\n { type: \"item\", value: \"s1op3\", label: \"Section 1 Option 3\" },\n ],\n },\n {\n type: \"section\",\n label: \"Section 2\",\n items: [\n { type: \"item\", value: \"s2op1\", label: \"Section 2 Option 1\" },\n { type: \"item\", value: \"s2op2\", label: \"Section 2 Option 2\" },\n { type: \"item\", value: \"s2op3\", label: \"Section 2 Option 3\" },\n ],\n },\n ],\n makeItemProps: (item: any) => ({\n key: item.value,\n textValue: item.label,\n children: item.label,\n }),\n makeSectionProps: (section: any) => ({\n section: section,\n key: section.label,\n }),\n};\n\nexport function BaseListBox(props: BaseListBoxProps) {\n const contextProps = React.useContext(PlasmicListBoxContext);\n const isStandalone: boolean = !contextProps;\n const {\n makeItemProps,\n makeSectionProps,\n renderItem,\n renderSection,\n getItemType,\n ...rest\n } = mergeProps(contextProps, props, isStandalone ? STANDALONE_PROPS : {});\n return (\n <ListBox {...mergeProps(contextProps, rest)}>\n {(item) => {\n if (getItemType?.(item) === \"section\") {\n const sectionProps = makeSectionProps?.(item);\n return (\n <PlasmicSectionContext.Provider\n key={sectionProps?.key}\n value={{ ...sectionProps, makeItemProps, renderItem }}\n >\n {renderSection?.(item)}\n </PlasmicSectionContext.Provider>\n );\n } else {\n const itemProps = makeItemProps?.(item);\n return (\n <PlasmicItemContext.Provider key={itemProps?.key} value={itemProps}>\n {renderItem?.(item)}\n </PlasmicItemContext.Provider>\n );\n }\n }}\n </ListBox>\n );\n}\n\nexport function registerListBox(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBox>\n) {\n registerComponentHelper(\n loader,\n BaseListBox,\n {\n name: makeComponentName(\"listbox\"),\n displayName: \"Aria ListBox\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBox\",\n importName: \"BaseListBox\",\n props: {\n renderItem: {\n type: \"slot\",\n displayName: \"Render Item\",\n renderPropParams: [\"item\"],\n },\n renderSection: {\n type: \"slot\",\n displayName: \"Render Section\",\n renderPropParams: [\"section\"],\n },\n className: {\n type: \"class\",\n displayName: \"Additional states\",\n selectors: [\n {\n selector: \":self[data-focused]\",\n label: \"Focused\",\n },\n {\n selector: \":self[data-focus-visible]\",\n label: \"Focused by keyboard\",\n },\n ],\n },\n },\n },\n overrides\n );\n\n registerListBoxItem(loader, {\n parentComponentName: makeComponentName(\"listbox\"),\n });\n}\n"],"names":["React","PlasmicListBoxContext","ListBox","mergeProps","PlasmicSectionContext","PlasmicItemContext","registerComponentHelper","makeComponentName","registerListBoxItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,gBAA8C,GAAA;AAAA,EAClD,WAAA,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A,aACT;AAAA,YACA;AAAA,cACE,QAAU,EAAA,2BAAA;AAAA,cACV,KAAO,EAAA,qBAAA;AAAA,aACT;AAAA,WACF;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AAEA,EAAAC,uCAAA,CAAoB,MAAQ,EAAA;AAAA,IAC1B,mBAAA,EAAqBD,0BAAkB,SAAS,CAAA;AAAA,GACjD,CAAA,CAAA;AACH;;;;;"}
1
+ {"version":3,"file":"registerListBox.cjs.js","sources":["../src/registerListBox.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { ListBox } from \"react-aria-components\";\nimport {\n PlasmicItemContext,\n PlasmicListBoxContext,\n PlasmicSectionContext,\n} from \"./contexts\";\nimport {\n HasOptions,\n makeOptionsPropType,\n StrictOptionType,\n useStrictOptions,\n} from \"./option-utils\";\nimport { registerListBoxItem } from \"./registerListBoxItem\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\ninterface BaseListBoxControlContextData {\n isStandalone: boolean;\n}\n\nexport interface BaseListBoxProps\n extends React.ComponentProps<typeof ListBox>,\n HasOptions<any> {\n renderItem?: (item: any) => React.ReactNode;\n renderSection?: (section: any) => React.ReactNode;\n getItemType?: (thing: any) => \"item\" | \"section\";\n setControlContextData?: (ctxData: BaseListBoxControlContextData) => void;\n}\n\nexport function BaseListBox(props: BaseListBoxProps) {\n const contextProps = React.useContext(PlasmicListBoxContext);\n const isStandalone: boolean = !contextProps;\n const { options: _rawOptions, ...rest } = props;\n const { options } = useStrictOptions(props);\n const { renderItem, renderSection, ...mergedProps } = mergeProps(\n contextProps,\n rest,\n isStandalone ? { items: options } : {}\n );\n\n // Tell the prop control about whether the listbox is standalone or not, so it can hide/show the items prop\n props.setControlContextData?.({\n isStandalone,\n });\n\n return (\n <ListBox {...mergedProps}>\n {(item: StrictOptionType) => {\n if (item.type === \"option-group\") {\n return (\n <>\n <PlasmicSectionContext.Provider\n value={{\n renderItem,\n key: item.key ?? item.label,\n section: item,\n }}\n >\n {renderSection?.(item)}\n </PlasmicSectionContext.Provider>\n </>\n );\n } else {\n return (\n <PlasmicItemContext.Provider value={item}>\n {renderItem?.(item)}\n </PlasmicItemContext.Provider>\n );\n }\n }}\n </ListBox>\n );\n}\n\nexport function registerListBox(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBox>\n) {\n registerComponentHelper(\n loader,\n BaseListBox,\n {\n name: makeComponentName(\"listbox\"),\n displayName: \"Aria ListBox\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBox\",\n importName: \"BaseListBox\",\n props: {\n options: {\n ...makeOptionsPropType(),\n displayName: \"Items\",\n hidden: (\n _ps: BaseListBoxProps,\n ctx: BaseListBoxControlContextData | null\n ) => !ctx?.isStandalone,\n },\n renderItem: {\n type: \"slot\",\n displayName: \"Render Item\",\n renderPropParams: [\"itemProps\"],\n },\n renderSection: {\n type: \"slot\",\n displayName: \"Render Section\",\n renderPropParams: [\"sectionProps\"],\n },\n },\n },\n overrides\n );\n\n registerListBoxItem(loader, {\n parentComponentName: makeComponentName(\"listbox\"),\n });\n}\n"],"names":["React","PlasmicListBoxContext","useStrictOptions","mergeProps","ListBox","_a","PlasmicSectionContext","PlasmicItemContext","registerComponentHelper","makeComponentName","makeOptionsPropType","registerListBoxItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCO,SAAS,YAAY,KAAyB,EAAA;AAnCrD,EAAA,IAAA,EAAA,CAAA;AAoCE,EAAM,MAAA,YAAA,GAAeA,sBAAM,CAAA,UAAA,CAAWC,8BAAqB,CAAA,CAAA;AAC3D,EAAA,MAAM,eAAwB,CAAC,YAAA,CAAA;AAC/B,EAAA,MAA0C,YAAT,IAAA,GAAA,SAAA,CAAS,IAAT,CAAzB,SAAA,CAAA,EAAA;AACR,EAAA,MAAM,EA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C,yCAAa,IAChB,CAAA,CAAA,CAAA;AAAA,KAEJ;AAAA,GAEJ,CAAA,CAAA;AAEJ,CAAA;AAEgB,SAAA,eAAA,CACd,QACA,SACA,EAAA;AACA,EAAAC,+BAAA;AAAA,IACE,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,KAAO,EAAA;AAAA,QACL,OAAA,EAAS,aACJ,CAAA,cAAA,CAAA,EAAA,EAAAC,+BAAA,EADI,CAAA,EAAA;AAAA,UAEP,WAAa,EAAA,OAAA;AAAA,UACb,MAAQ,EAAA,CACN,GACA,EAAA,GAAA,KACG,EAAC,GAAK,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,GAAA,CAAA,YAAA,CAAA;AAAA,SACb,CAAA;AAAA,QACA,UAAY,EAAA;AAAA,UACV,IAAM,EAAA,MAAA;AAAA,UACN,WAAa,EAAA,aAAA;AAAA,UACb,gBAAA,EAAkB,CAAC,WAAW,CAAA;AAAA,SAChC;AAAA,QACA,aAAe,EAAA;AAAA,UACb,IAAM,EAAA,MAAA;AAAA,UACN,WAAa,EAAA,gBAAA;AAAA,UACb,gBAAA,EAAkB,CAAC,cAAc,CAAA;AAAA,SACnC;AAAA,OACF;AAAA,KACF;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AAEA,EAAAC,uCAAA,CAAoB,MAAQ,EAAA;AAAA,IAC1B,mBAAA,EAAqBF,0BAAkB,SAAS,CAAA;AAAA,GACjD,CAAA,CAAA;AACH;;;;;"}
@@ -1,14 +1,16 @@
1
1
  import React from "react";
2
2
  import { ListBox } from "react-aria-components";
3
- import { type BaseListBoxItem } from "./registerListBoxItem";
4
- import type { BaseSection } from "./registerSection";
3
+ import { HasOptions } from "./option-utils";
5
4
  import { CodeComponentMetaOverrides, Registerable } from "./utils";
6
- export interface BaseListBoxProps extends React.ComponentProps<typeof ListBox> {
7
- makeItemProps?: (item: any) => Partial<React.ComponentProps<typeof BaseListBoxItem>>;
8
- makeSectionProps?: (section: any) => Partial<React.ComponentProps<typeof BaseSection>>;
5
+ interface BaseListBoxControlContextData {
6
+ isStandalone: boolean;
7
+ }
8
+ export interface BaseListBoxProps extends React.ComponentProps<typeof ListBox>, HasOptions<any> {
9
9
  renderItem?: (item: any) => React.ReactNode;
10
10
  renderSection?: (section: any) => React.ReactNode;
11
11
  getItemType?: (thing: any) => "item" | "section";
12
+ setControlContextData?: (ctxData: BaseListBoxControlContextData) => void;
12
13
  }
13
14
  export declare function BaseListBox(props: BaseListBoxProps): React.JSX.Element;
14
15
  export declare function registerListBox(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BaseListBox>): void;
16
+ export {};
@@ -2,6 +2,7 @@ import { mergeProps } from '@react-aria/utils';
2
2
  import React from 'react';
3
3
  import { ListBox } from 'react-aria-components';
4
4
  import { P as PlasmicListBoxContext, b as PlasmicSectionContext, c as PlasmicItemContext } from './contexts-49f6c298.esm.js';
5
+ import { u as useStrictOptions, m as makeOptionsPropType } from './option-utils-4f037568.esm.js';
5
6
  import { registerListBoxItem } from './registerListBoxItem.esm.js';
6
7
  import { r as registerComponentHelper, m as makeComponentName } from './utils-cf2632c9.esm.js';
7
8
  import '@plasmicapp/host/registerComponent';
@@ -37,71 +38,36 @@ var __objRest = (source, exclude) => {
37
38
  }
38
39
  return target;
39
40
  };
40
- const STANDALONE_PROPS = {
41
- getItemType: (item) => item.type,
42
- items: [
43
- { type: "item", value: "op1", label: "Option 1" },
44
- { type: "item", value: "op2", label: "Option 2" },
45
- { type: "item", value: "op3", label: "Option 3" },
46
- {
47
- type: "section",
48
- label: "Section 1",
49
- items: [
50
- { type: "item", value: "s1op1", label: "Section 1 Option 1" },
51
- { type: "item", value: "s1op2", label: "Section 1 Option 2" },
52
- { type: "item", value: "s1op3", label: "Section 1 Option 3" }
53
- ]
54
- },
55
- {
56
- type: "section",
57
- label: "Section 2",
58
- items: [
59
- { type: "item", value: "s2op1", label: "Section 2 Option 1" },
60
- { type: "item", value: "s2op2", label: "Section 2 Option 2" },
61
- { type: "item", value: "s2op3", label: "Section 2 Option 3" }
62
- ]
63
- }
64
- ],
65
- makeItemProps: (item) => ({
66
- key: item.value,
67
- textValue: item.label,
68
- children: item.label
69
- }),
70
- makeSectionProps: (section) => ({
71
- section,
72
- key: section.label
73
- })
74
- };
75
41
  function BaseListBox(props) {
42
+ var _c;
76
43
  const contextProps = React.useContext(PlasmicListBoxContext);
77
44
  const isStandalone = !contextProps;
78
- const _a = mergeProps(contextProps, props, isStandalone ? STANDALONE_PROPS : {}), {
79
- makeItemProps,
80
- makeSectionProps,
81
- renderItem,
82
- renderSection,
83
- getItemType
84
- } = _a, rest = __objRest(_a, [
85
- "makeItemProps",
86
- "makeSectionProps",
87
- "renderItem",
88
- "renderSection",
89
- "getItemType"
90
- ]);
91
- return /* @__PURE__ */ React.createElement(ListBox, __spreadValues({}, mergeProps(contextProps, rest)), (item) => {
92
- if ((getItemType == null ? void 0 : getItemType(item)) === "section") {
93
- const sectionProps = makeSectionProps == null ? void 0 : makeSectionProps(item);
94
- return /* @__PURE__ */ React.createElement(
45
+ const _a = props, rest = __objRest(_a, ["options"]);
46
+ const { options } = useStrictOptions(props);
47
+ const _b = mergeProps(
48
+ contextProps,
49
+ rest,
50
+ isStandalone ? { items: options } : {}
51
+ ), { renderItem, renderSection } = _b, mergedProps = __objRest(_b, ["renderItem", "renderSection"]);
52
+ (_c = props.setControlContextData) == null ? void 0 : _c.call(props, {
53
+ isStandalone
54
+ });
55
+ return /* @__PURE__ */ React.createElement(ListBox, __spreadValues({}, mergedProps), (item) => {
56
+ var _a2;
57
+ if (item.type === "option-group") {
58
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
95
59
  PlasmicSectionContext.Provider,
96
60
  {
97
- key: sectionProps == null ? void 0 : sectionProps.key,
98
- value: __spreadProps(__spreadValues({}, sectionProps), { makeItemProps, renderItem })
61
+ value: {
62
+ renderItem,
63
+ key: (_a2 = item.key) != null ? _a2 : item.label,
64
+ section: item
65
+ }
99
66
  },
100
67
  renderSection == null ? void 0 : renderSection(item)
101
- );
68
+ ));
102
69
  } else {
103
- const itemProps = makeItemProps == null ? void 0 : makeItemProps(item);
104
- return /* @__PURE__ */ React.createElement(PlasmicItemContext.Provider, { key: itemProps == null ? void 0 : itemProps.key, value: itemProps }, renderItem == null ? void 0 : renderItem(item));
70
+ return /* @__PURE__ */ React.createElement(PlasmicItemContext.Provider, { value: item }, renderItem == null ? void 0 : renderItem(item));
105
71
  }
106
72
  });
107
73
  }
@@ -115,29 +81,19 @@ function registerListBox(loader, overrides) {
115
81
  importPath: "@plasmicpkgs/react-aria/skinny/registerListBox",
116
82
  importName: "BaseListBox",
117
83
  props: {
84
+ options: __spreadProps(__spreadValues({}, makeOptionsPropType()), {
85
+ displayName: "Items",
86
+ hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
87
+ }),
118
88
  renderItem: {
119
89
  type: "slot",
120
90
  displayName: "Render Item",
121
- renderPropParams: ["item"]
91
+ renderPropParams: ["itemProps"]
122
92
  },
123
93
  renderSection: {
124
94
  type: "slot",
125
95
  displayName: "Render Section",
126
- renderPropParams: ["section"]
127
- },
128
- className: {
129
- type: "class",
130
- displayName: "Additional states",
131
- selectors: [
132
- {
133
- selector: ":self[data-focused]",
134
- label: "Focused"
135
- },
136
- {
137
- selector: ":self[data-focus-visible]",
138
- label: "Focused by keyboard"
139
- }
140
- ]
96
+ renderPropParams: ["sectionProps"]
141
97
  }
142
98
  }
143
99
  },
@@ -1 +1 @@
1
- {"version":3,"file":"registerListBox.esm.js","sources":["../src/registerListBox.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { ListBox } from \"react-aria-components\";\nimport {\n PlasmicItemContext,\n PlasmicListBoxContext,\n PlasmicSectionContext,\n} from \"./contexts\";\nimport {\n registerListBoxItem,\n type BaseListBoxItem,\n} from \"./registerListBoxItem\";\nimport type { BaseSection } from \"./registerSection\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseListBoxProps extends React.ComponentProps<typeof ListBox> {\n makeItemProps?: (\n item: any\n ) => Partial<React.ComponentProps<typeof BaseListBoxItem>>;\n makeSectionProps?: (\n section: any\n ) => Partial<React.ComponentProps<typeof BaseSection>>;\n renderItem?: (item: any) => React.ReactNode;\n renderSection?: (section: any) => React.ReactNode;\n getItemType?: (thing: any) => \"item\" | \"section\";\n}\n\nconst STANDALONE_PROPS: Partial<BaseListBoxProps> = {\n getItemType: (item: any) => item.type,\n items: [\n { type: \"item\", value: \"op1\", label: \"Option 1\" },\n { type: \"item\", value: \"op2\", label: \"Option 2\" },\n { type: \"item\", value: \"op3\", label: \"Option 3\" },\n {\n type: \"section\",\n label: \"Section 1\",\n items: [\n { type: \"item\", value: \"s1op1\", label: \"Section 1 Option 1\" },\n { type: \"item\", value: \"s1op2\", label: \"Section 1 Option 2\" },\n { type: \"item\", value: \"s1op3\", label: \"Section 1 Option 3\" },\n ],\n },\n {\n type: \"section\",\n label: \"Section 2\",\n items: [\n { type: \"item\", value: \"s2op1\", label: \"Section 2 Option 1\" },\n { type: \"item\", value: \"s2op2\", label: \"Section 2 Option 2\" },\n { type: \"item\", value: \"s2op3\", label: \"Section 2 Option 3\" },\n ],\n },\n ],\n makeItemProps: (item: any) => ({\n key: item.value,\n textValue: item.label,\n children: item.label,\n }),\n makeSectionProps: (section: any) => ({\n section: section,\n key: section.label,\n }),\n};\n\nexport function BaseListBox(props: BaseListBoxProps) {\n const contextProps = React.useContext(PlasmicListBoxContext);\n const isStandalone: boolean = !contextProps;\n const {\n makeItemProps,\n makeSectionProps,\n renderItem,\n renderSection,\n getItemType,\n ...rest\n } = mergeProps(contextProps, props, isStandalone ? STANDALONE_PROPS : {});\n return (\n <ListBox {...mergeProps(contextProps, rest)}>\n {(item) => {\n if (getItemType?.(item) === \"section\") {\n const sectionProps = makeSectionProps?.(item);\n return (\n <PlasmicSectionContext.Provider\n key={sectionProps?.key}\n value={{ ...sectionProps, makeItemProps, renderItem }}\n >\n {renderSection?.(item)}\n </PlasmicSectionContext.Provider>\n );\n } else {\n const itemProps = makeItemProps?.(item);\n return (\n <PlasmicItemContext.Provider key={itemProps?.key} value={itemProps}>\n {renderItem?.(item)}\n </PlasmicItemContext.Provider>\n );\n }\n }}\n </ListBox>\n );\n}\n\nexport function registerListBox(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBox>\n) {\n registerComponentHelper(\n loader,\n BaseListBox,\n {\n name: makeComponentName(\"listbox\"),\n displayName: \"Aria ListBox\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBox\",\n importName: \"BaseListBox\",\n props: {\n renderItem: {\n type: \"slot\",\n displayName: \"Render Item\",\n renderPropParams: [\"item\"],\n },\n renderSection: {\n type: \"slot\",\n displayName: \"Render Section\",\n renderPropParams: [\"section\"],\n },\n className: {\n type: \"class\",\n displayName: \"Additional states\",\n selectors: [\n {\n selector: \":self[data-focused]\",\n label: \"Focused\",\n },\n {\n selector: \":self[data-focus-visible]\",\n label: \"Focused by keyboard\",\n },\n ],\n },\n },\n },\n overrides\n );\n\n registerListBoxItem(loader, {\n parentComponentName: makeComponentName(\"listbox\"),\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,gBAA8C,GAAA;AAAA,EAClD,WAAA,EAAa,CAAC,IAAA,KAAc,IAAK,CAAA,IAAA;AAAA,EACjC,KAAO,EAAA;AAAA,IACL,EAAE,IAAM,EAAA,MAAA,EAAQ,KAAO,EAAA,KAAA,EAAO,OAAO,UAAW,EAAA;AAAA,IAChD,EAAE,IAAM,EAAA,MAAA,EAAQ,K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IAC1B,mBAAA,EAAqB,kBAAkB,SAAS,CAAA;AAAA,GACjD,CAAA,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"registerListBox.esm.js","sources":["../src/registerListBox.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { ListBox } from \"react-aria-components\";\nimport {\n PlasmicItemContext,\n PlasmicListBoxContext,\n PlasmicSectionContext,\n} from \"./contexts\";\nimport {\n HasOptions,\n makeOptionsPropType,\n StrictOptionType,\n useStrictOptions,\n} from \"./option-utils\";\nimport { registerListBoxItem } from \"./registerListBoxItem\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\ninterface BaseListBoxControlContextData {\n isStandalone: boolean;\n}\n\nexport interface BaseListBoxProps\n extends React.ComponentProps<typeof ListBox>,\n HasOptions<any> {\n renderItem?: (item: any) => React.ReactNode;\n renderSection?: (section: any) => React.ReactNode;\n getItemType?: (thing: any) => \"item\" | \"section\";\n setControlContextData?: (ctxData: BaseListBoxControlContextData) => void;\n}\n\nexport function BaseListBox(props: BaseListBoxProps) {\n const contextProps = React.useContext(PlasmicListBoxContext);\n const isStandalone: boolean = !contextProps;\n const { options: _rawOptions, ...rest } = props;\n const { options } = useStrictOptions(props);\n const { renderItem, renderSection, ...mergedProps } = mergeProps(\n contextProps,\n rest,\n isStandalone ? { items: options } : {}\n );\n\n // Tell the prop control about whether the listbox is standalone or not, so it can hide/show the items prop\n props.setControlContextData?.({\n isStandalone,\n });\n\n return (\n <ListBox {...mergedProps}>\n {(item: StrictOptionType) => {\n if (item.type === \"option-group\") {\n return (\n <>\n <PlasmicSectionContext.Provider\n value={{\n renderItem,\n key: item.key ?? item.label,\n section: item,\n }}\n >\n {renderSection?.(item)}\n </PlasmicSectionContext.Provider>\n </>\n );\n } else {\n return (\n <PlasmicItemContext.Provider value={item}>\n {renderItem?.(item)}\n </PlasmicItemContext.Provider>\n );\n }\n }}\n </ListBox>\n );\n}\n\nexport function registerListBox(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBox>\n) {\n registerComponentHelper(\n loader,\n BaseListBox,\n {\n name: makeComponentName(\"listbox\"),\n displayName: \"Aria ListBox\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBox\",\n importName: \"BaseListBox\",\n props: {\n options: {\n ...makeOptionsPropType(),\n displayName: \"Items\",\n hidden: (\n _ps: BaseListBoxProps,\n ctx: BaseListBoxControlContextData | null\n ) => !ctx?.isStandalone,\n },\n renderItem: {\n type: \"slot\",\n displayName: \"Render Item\",\n renderPropParams: [\"itemProps\"],\n },\n renderSection: {\n type: \"slot\",\n displayName: \"Render Section\",\n renderPropParams: [\"sectionProps\"],\n },\n },\n },\n overrides\n );\n\n registerListBoxItem(loader, {\n parentComponentName: makeComponentName(\"listbox\"),\n });\n}\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCO,SAAS,YAAY,KAAyB,EAAA;AAnCrD,EAAA,IAAA,EAAA,CAAA;AAoCE,EAAM,MAAA,YAAA,GAAe,KAAM,CAAA,UAAA,CAAW,qBAAqB,CAAA,CAAA;AAC3D,EAAA,MAAM,eAAwB,CAAC,YAAA,CAAA;AAC/B,EAAA,MAA0C,YAAT,IAAA,GAAA,SAAA,CAAS,IAAT,CAAzB,SAAA,CAAA,EAAA;AACR,EAAA,MAAM,EAAE,OAAA,EAAY,GAAA,gBAAA,CAAiB,KAAK,CAAA,CAAA;AAC1C,EAAsD,MAAA,EAAA,GAAA,UAAA;AAAA,IACpD,YAAA;AAAA,IACA,IAAA;AAAA,IACA,YAAe,GAAA,EAAE,KAAO,EAAA,OAAA,KAAY,EAAC;AAAA,GACvC,EAJQ,cAAY,aAxCtB,EAAA,GAwCwD,IAAhB,WAAgB,GAAA,SAAA,CAAA,EAAA,EAAhB,CAA9B,YAAY,EAAA,eAAA,CAAA,CAAA,CAAA;AAOpB,EAA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QACL,OAAA,EAAS,aACJ,CAAA,cAAA,CAAA,EAAA,EAAA,mBAAA,EADI,CAAA,EAAA;AAAA,UAEP,WAAa,EAAA,OAAA;AAAA,UACb,MAAQ,EAAA,CACN,GACA,EAAA,GAAA,KACG,EAAC,GAAK,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,GAAA,CAAA,YAAA,CAAA;AAAA,SACb,CAAA;AAAA,QACA,UAAY,EAAA;AAAA,UACV,IAAM,EAAA,MAAA;AAAA,UACN,WAAa,EAAA,aAAA;AAAA,UACb,gBAAA,EAAkB,CAAC,WAAW,CAAA;AAAA,SAChC;AAAA,QACA,aAAe,EAAA;AAAA,UACb,IAAM,EAAA,MAAA;AAAA,UACN,WAAa,EAAA,gBAAA;AAAA,UACb,gBAAA,EAAkB,CAAC,cAAc,CAAA;AAAA,SACnC;AAAA,OACF;AAAA,KACF;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AAEA,EAAA,mBAAA,CAAoB,MAAQ,EAAA;AAAA,IAC1B,mBAAA,EAAqB,kBAAkB,SAAS,CAAA;AAAA,GACjD,CAAA,CAAA;AACH;;;;"}
@@ -28,10 +28,9 @@ var __spreadValues = (a, b) => {
28
28
  return a;
29
29
  };
30
30
  function BaseListBoxItem(props) {
31
- var _a;
32
31
  const contextProps = React__default.default.useContext(contexts.PlasmicItemContext);
33
32
  const mergedProps = utils.mergeProps(contextProps, props);
34
- return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.ListBoxItem, __spreadValues({ id: (_a = mergedProps.key) != null ? _a : void 0 }, mergedProps));
33
+ return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.ListBoxItem, __spreadValues({}, mergedProps), mergedProps.children);
35
34
  }
36
35
  function registerListBoxItem(loader, overrides) {
37
36
  utils$1.registerComponentHelper(
@@ -43,23 +42,8 @@ function registerListBoxItem(loader, overrides) {
43
42
  importPath: "@plasmicpkgs/react-aria/skinny/registerListBoxItem",
44
43
  importName: "BaseListBoxItem",
45
44
  props: {
46
- className: {
47
- type: "class",
48
- displayName: "Additional states",
49
- selectors: [
50
- {
51
- selector: ":self[data-selected]",
52
- label: "Selected"
53
- },
54
- {
55
- selector: ":self[data-focused], :self[data-hovered]",
56
- label: "Focused"
57
- },
58
- {
59
- selector: ":self[data-disabled]",
60
- label: "Disabled"
61
- }
62
- ]
45
+ children: {
46
+ type: "slot"
63
47
  }
64
48
  }
65
49
  },
@@ -1 +1 @@
1
- {"version":3,"file":"registerListBoxItem.cjs.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Key, ListBoxItem } from \"react-aria-components\";\nimport { PlasmicItemContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport function BaseListBoxItem(\n props: React.ComponentProps<typeof ListBoxItem> & {\n key?: Key;\n }\n) {\n const contextProps = React.useContext(PlasmicItemContext);\n const mergedProps = mergeProps(contextProps, props);\n return <ListBoxItem id={mergedProps.key ?? undefined} {...mergedProps} />;\n}\n\nexport function registerListBoxItem(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBoxItem>\n) {\n registerComponentHelper(\n loader,\n BaseListBoxItem,\n {\n name: makeComponentName(\"item\"),\n displayName: \"Aria ListBoxItem\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBoxItem\",\n importName: \"BaseListBoxItem\",\n props: {\n className: {\n type: \"class\",\n displayName: \"Additional states\",\n selectors: [\n {\n selector: \":self[data-selected]\",\n label: \"Selected\",\n },\n {\n selector: \":self[data-focused], :self[data-hovered]\",\n label: \"Focused\",\n },\n {\n selector: \":self[data-disabled]\",\n label: \"Disabled\",\n },\n ],\n },\n },\n },\n overrides\n );\n}\n"],"names":["React","PlasmicItemContext","mergeProps","ListBoxItem","registerComponentHelper","makeComponentName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,SAAS,gBACd,KAGA,EAAA;AAfF,EAAA,IAAA,EAAA,CAAA;AAgBE,EAAM,MAAA,YAAA,GAAeA,sBAAM,CAAA,UAAA,CAAWC,2BAAkB,CAAA,CAAA;AACxD,EAAM,MAAA,WAAA,GAAcC,gBAAW,CAAA,YAAA,EAAc,KAAK,CAAA,CAAA;AAClD,EAAA,4DAAQC,+BAAY,EAAA,cAAA,CAAA,EAAA,EAAA,EAAA,CAAI,iBAAY,GAAZ,KAAA,IAAA,GAAA,EAAA,GAAmB,UAAe,WAAa,CAAA,CAAA,CAAA;AACzE,CAAA;AAEgB,SAAA,mBAAA,CACd,QACA,SACA,EAAA;AACA,EAAAC,+BAAA;AAAA,IACE,MAAA;AAAA,IACA,eAAA;AAAA,IACA;AAAA,MACE,IAAA,EAAMC,0BAAkB,MAAM,CAAA;AAAA,MAC9B,WAAa,EAAA,kBAAA;AAAA,MACb,UAAY,EAAA,oDAAA;AAAA,MACZ,UAAY,EAAA,iBAAA;AAAA,MACZ,KAAO,EAAA;AAAA,QACL,SAAW,EAAA;AAAA,UACT,IAAM,EAAA,OAAA;AAAA,UACN,WAAa,EAAA,mBAAA;AAAA,UACb,SAAW,EAAA;AAAA,YACT;AAAA,cACE,QAAU,EAAA,sBAAA;AAAA,cACV,KAAO,EAAA,UAAA;AAAA,aACT;AAAA,YACA;AAAA,cACE,QAAU,EAAA,0CAAA;AAAA,cACV,KAAO,EAAA,SAAA;AAAA,aACT;AAAA,YACA;AAAA,cACE,QAAU,EAAA,sBAAA;AAAA,cACV,KAAO,EAAA,UAAA;AAAA,aACT;AAAA,WACF;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;"}
1
+ {"version":3,"file":"registerListBoxItem.cjs.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { ListBoxItem } from \"react-aria-components\";\nimport { PlasmicItemContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport function BaseListBoxItem(\n props: React.ComponentProps<typeof ListBoxItem>\n) {\n const contextProps = React.useContext(PlasmicItemContext);\n const mergedProps = mergeProps(contextProps, props);\n return (\n <ListBoxItem {...mergedProps}>\n {mergedProps.children as React.ReactNode}\n </ListBoxItem>\n );\n}\n\nexport function registerListBoxItem(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBoxItem>\n) {\n registerComponentHelper(\n loader,\n BaseListBoxItem,\n {\n name: makeComponentName(\"item\"),\n displayName: \"Aria ListBoxItem\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBoxItem\",\n importName: \"BaseListBoxItem\",\n props: {\n children: {\n type: \"slot\",\n },\n },\n },\n overrides\n );\n}\n"],"names":["React","PlasmicItemContext","mergeProps","ListBoxItem","registerComponentHelper","makeComponentName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,SAAS,gBACd,KACA,EAAA;AACA,EAAM,MAAA,YAAA,GAAeA,sBAAM,CAAA,UAAA,CAAWC,2BAAkB,CAAA,CAAA;AACxD,EAAM,MAAA,WAAA,GAAcC,gBAAW,CAAA,YAAA,EAAc,KAAK,CAAA,CAAA;AAClD,EAAA,uBACGF,sBAAA,CAAA,aAAA,CAAAG,+BAAA,EAAA,cAAA,CAAA,EAAA,EAAgB,WACd,CAAA,EAAA,WAAA,CAAY,QACf,CAAA,CAAA;AAEJ,CAAA;AAEgB,SAAA,mBAAA,CACd,QACA,SACA,EAAA;AACA,EAAAC,+BAAA;AAAA,IACE,MAAA;AAAA,IACA,eAAA;AAAA,IACA;AAAA,MACE,IAAA,EAAMC,0BAAkB,MAAM,CAAA;AAAA,MAC9B,WAAa,EAAA,kBAAA;AAAA,MACb,UAAY,EAAA,oDAAA;AAAA,MACZ,UAAY,EAAA,iBAAA;AAAA,MACZ,KAAO,EAAA;AAAA,QACL,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,MAAA;AAAA,SACR;AAAA,OACF;AAAA,KACF;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;"}
@@ -1,7 +1,5 @@
1
1
  import React from "react";
2
- import { Key, ListBoxItem } from "react-aria-components";
2
+ import { ListBoxItem } from "react-aria-components";
3
3
  import { CodeComponentMetaOverrides, Registerable } from "./utils";
4
- export declare function BaseListBoxItem(props: React.ComponentProps<typeof ListBoxItem> & {
5
- key?: Key;
6
- }): React.JSX.Element;
4
+ export declare function BaseListBoxItem(props: React.ComponentProps<typeof ListBoxItem>): React.JSX.Element;
7
5
  export declare function registerListBoxItem(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BaseListBoxItem>): void;
@@ -22,10 +22,9 @@ var __spreadValues = (a, b) => {
22
22
  return a;
23
23
  };
24
24
  function BaseListBoxItem(props) {
25
- var _a;
26
25
  const contextProps = React.useContext(PlasmicItemContext);
27
26
  const mergedProps = mergeProps(contextProps, props);
28
- return /* @__PURE__ */ React.createElement(ListBoxItem, __spreadValues({ id: (_a = mergedProps.key) != null ? _a : void 0 }, mergedProps));
27
+ return /* @__PURE__ */ React.createElement(ListBoxItem, __spreadValues({}, mergedProps), mergedProps.children);
29
28
  }
30
29
  function registerListBoxItem(loader, overrides) {
31
30
  registerComponentHelper(
@@ -37,23 +36,8 @@ function registerListBoxItem(loader, overrides) {
37
36
  importPath: "@plasmicpkgs/react-aria/skinny/registerListBoxItem",
38
37
  importName: "BaseListBoxItem",
39
38
  props: {
40
- className: {
41
- type: "class",
42
- displayName: "Additional states",
43
- selectors: [
44
- {
45
- selector: ":self[data-selected]",
46
- label: "Selected"
47
- },
48
- {
49
- selector: ":self[data-focused], :self[data-hovered]",
50
- label: "Focused"
51
- },
52
- {
53
- selector: ":self[data-disabled]",
54
- label: "Disabled"
55
- }
56
- ]
39
+ children: {
40
+ type: "slot"
57
41
  }
58
42
  }
59
43
  },
@@ -1 +1 @@
1
- {"version":3,"file":"registerListBoxItem.esm.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Key, ListBoxItem } from \"react-aria-components\";\nimport { PlasmicItemContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport function BaseListBoxItem(\n props: React.ComponentProps<typeof ListBoxItem> & {\n key?: Key;\n }\n) {\n const contextProps = React.useContext(PlasmicItemContext);\n const mergedProps = mergeProps(contextProps, props);\n return <ListBoxItem id={mergedProps.key ?? undefined} {...mergedProps} />;\n}\n\nexport function registerListBoxItem(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBoxItem>\n) {\n registerComponentHelper(\n loader,\n BaseListBoxItem,\n {\n name: makeComponentName(\"item\"),\n displayName: \"Aria ListBoxItem\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBoxItem\",\n importName: \"BaseListBoxItem\",\n props: {\n className: {\n type: \"class\",\n displayName: \"Additional states\",\n selectors: [\n {\n selector: \":self[data-selected]\",\n label: \"Selected\",\n },\n {\n selector: \":self[data-focused], :self[data-hovered]\",\n label: \"Focused\",\n },\n {\n selector: \":self[data-disabled]\",\n label: \"Disabled\",\n },\n ],\n },\n },\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAWO,SAAS,gBACd,KAGA,EAAA;AAfF,EAAA,IAAA,EAAA,CAAA;AAgBE,EAAM,MAAA,YAAA,GAAe,KAAM,CAAA,UAAA,CAAW,kBAAkB,CAAA,CAAA;AACxD,EAAM,MAAA,WAAA,GAAc,UAAW,CAAA,YAAA,EAAc,KAAK,CAAA,CAAA;AAClD,EAAA,2CAAQ,WAAY,EAAA,cAAA,CAAA,EAAA,EAAA,EAAA,CAAI,iBAAY,GAAZ,KAAA,IAAA,GAAA,EAAA,GAAmB,UAAe,WAAa,CAAA,CAAA,CAAA;AACzE,CAAA;AAEgB,SAAA,mBAAA,CACd,QACA,SACA,EAAA;AACA,EAAA,uBAAA;AAAA,IACE,MAAA;AAAA,IACA,eAAA;AAAA,IACA;AAAA,MACE,IAAA,EAAM,kBAAkB,MAAM,CAAA;AAAA,MAC9B,WAAa,EAAA,kBAAA;AAAA,MACb,UAAY,EAAA,oDAAA;AAAA,MACZ,UAAY,EAAA,iBAAA;AAAA,MACZ,KAAO,EAAA;AAAA,QACL,SAAW,EAAA;AAAA,UACT,IAAM,EAAA,OAAA;AAAA,UACN,WAAa,EAAA,mBAAA;AAAA,UACb,SAAW,EAAA;AAAA,YACT;AAAA,cACE,QAAU,EAAA,sBAAA;AAAA,cACV,KAAO,EAAA,UAAA;AAAA,aACT;AAAA,YACA;AAAA,cACE,QAAU,EAAA,0CAAA;AAAA,cACV,KAAO,EAAA,SAAA;AAAA,aACT;AAAA,YACA;AAAA,cACE,QAAU,EAAA,sBAAA;AAAA,cACV,KAAO,EAAA,UAAA;AAAA,aACT;AAAA,WACF;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"registerListBoxItem.esm.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { ListBoxItem } from \"react-aria-components\";\nimport { PlasmicItemContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport function BaseListBoxItem(\n props: React.ComponentProps<typeof ListBoxItem>\n) {\n const contextProps = React.useContext(PlasmicItemContext);\n const mergedProps = mergeProps(contextProps, props);\n return (\n <ListBoxItem {...mergedProps}>\n {mergedProps.children as React.ReactNode}\n </ListBoxItem>\n );\n}\n\nexport function registerListBoxItem(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBoxItem>\n) {\n registerComponentHelper(\n loader,\n BaseListBoxItem,\n {\n name: makeComponentName(\"item\"),\n displayName: \"Aria ListBoxItem\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBoxItem\",\n importName: \"BaseListBoxItem\",\n props: {\n children: {\n type: \"slot\",\n },\n },\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAWO,SAAS,gBACd,KACA,EAAA;AACA,EAAM,MAAA,YAAA,GAAe,KAAM,CAAA,UAAA,CAAW,kBAAkB,CAAA,CAAA;AACxD,EAAM,MAAA,WAAA,GAAc,UAAW,CAAA,YAAA,EAAc,KAAK,CAAA,CAAA;AAClD,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,cAAA,CAAA,EAAA,EAAgB,WACd,CAAA,EAAA,WAAA,CAAY,QACf,CAAA,CAAA;AAEJ,CAAA;AAEgB,SAAA,mBAAA,CACd,QACA,SACA,EAAA;AACA,EAAA,uBAAA;AAAA,IACE,MAAA;AAAA,IACA,eAAA;AAAA,IACA;AAAA,MACE,IAAA,EAAM,kBAAkB,MAAM,CAAA;AAAA,MAC9B,WAAa,EAAA,kBAAA;AAAA,MACb,UAAY,EAAA,oDAAA;AAAA,MACZ,UAAY,EAAA,iBAAA;AAAA,MACZ,KAAO,EAAA;AAAA,QACL,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,MAAA;AAAA,SACR;AAAA,OACF;AAAA,KACF;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var host = require('@plasmicapp/host');
4
3
  var utils = require('@react-aria/utils');
5
4
  var React = require('react');
6
5
  var reactAriaComponents = require('react-aria-components');
@@ -13,8 +12,6 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
12
  var React__default = /*#__PURE__*/_interopDefault(React);
14
13
 
15
14
  var __defProp = Object.defineProperty;
16
- var __defProps = Object.defineProperties;
17
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
18
15
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
19
16
  var __hasOwnProp = Object.prototype.hasOwnProperty;
20
17
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -30,7 +27,6 @@ var __spreadValues = (a, b) => {
30
27
  }
31
28
  return a;
32
29
  };
33
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
34
30
  var __objRest = (source, exclude) => {
35
31
  var target = {};
36
32
  for (var prop in source)
@@ -47,23 +43,16 @@ function BasePopover(props) {
47
43
  const _a = props, { resetClassName } = _a, restProps = __objRest(_a, ["resetClassName"]);
48
44
  const isStandalone = !React__default.default.useContext(reactAriaComponents.PopoverContext);
49
45
  const contextProps = React__default.default.useContext(contexts.PlasmicPopoverContext);
50
- const canvas = host.usePlasmicCanvasContext();
51
46
  const mergedProps = utils.mergeProps(contextProps, restProps, {
52
47
  className: `${resetClassName}`
53
48
  });
54
- if (isStandalone) {
55
- const triggerRef = React__default.default.useRef(null);
56
- return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React__default.default.createElement(
57
- reactAriaComponents.Popover,
58
- __spreadProps(__spreadValues({}, mergedProps), {
59
- triggerRef,
60
- isNonModal: true,
61
- isOpen: true
62
- })
63
- ));
64
- } else {
65
- return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Popover, __spreadProps(__spreadValues({}, mergedProps), { isNonModal: !!canvas }));
66
- }
49
+ const triggerRef = React__default.default.useRef(null);
50
+ const standaloneProps = isStandalone ? {
51
+ triggerRef,
52
+ isNonModal: true,
53
+ isOpen: true
54
+ } : {};
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)));
67
56
  }
68
57
  function registerPopover(loader, overrides) {
69
58
  utils$1.registerComponentHelper(
@@ -99,20 +88,6 @@ function registerPopover(loader, overrides) {
99
88
  resetClassName: {
100
89
  type: "themeResetClass"
101
90
  }
102
- // className: {
103
- // type: "class",
104
- // displayName: "Additional states",
105
- // selectors: [
106
- // {
107
- // selector: ":self[data-entering]",
108
- // label: "Entering",
109
- // },
110
- // {
111
- // selector: ":self[data-exiting]",
112
- // label: "Exiting",
113
- // },
114
- // ],
115
- // },
116
91
  },
117
92
  styleSections: true
118
93
  },
@@ -1 +1 @@
1
- {"version":3,"file":"registerPopover.cjs.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { 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 Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport function BasePopover(props: {\n className?: string;\n resetClassName?: string;\n}) {\n const { resetClassName, ...restProps } = props;\n const isStandalone = !React.useContext(PopoverContext);\n const contextProps = React.useContext(PlasmicPopoverContext);\n const canvas = usePlasmicCanvasContext();\n const mergedProps = mergeProps(contextProps, restProps, {\n className: `${resetClassName}`,\n });\n\n if (isStandalone) {\n const triggerRef = React.useRef<any>(null);\n return (\n <>\n <div ref={triggerRef} />\n <Popover\n {...mergedProps}\n triggerRef={triggerRef}\n isNonModal={true}\n isOpen={true}\n />\n </>\n );\n } else {\n return <Popover {...mergedProps} isNonModal={!!canvas} />;\n }\n}\n\nexport function registerPopover(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BasePopover>\n) {\n registerComponentHelper(\n loader,\n BasePopover,\n {\n name: \"plasmic-react-aria-popover\",\n displayName: \"Aria Popover\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerPopover\",\n importName: \"BasePopover\",\n props: {\n children: {\n type: \"slot\",\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 // className: {\n // type: \"class\",\n // displayName: \"Additional states\",\n // selectors: [\n // {\n // selector: \":self[data-entering]\",\n // label: \"Entering\",\n // },\n // {\n // selector: \":self[data-exiting]\",\n // label: \"Exiting\",\n // },\n // ],\n // },\n },\n styleSections: true,\n },\n overrides\n );\n}\n"],"names":["React","PopoverContext","PlasmicPopoverContext","usePlasmicCanvasContext","mergeProps","Popover","registerComponentHelper"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,SAAS,YAAY,KAGzB,EAAA;AACD,EAAA,MAAyC,YAAjC,EAfV,cAAA,EAAA,GAe2C,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,EAAA,MAAM,SAASC,4BAAwB,EAAA,CAAA;AACvC,EAAM,MAAA,WAAA,GAAcC,gBAAW,CAAA,YAAA,EAAc,SAAW,EAAA;AAAA,IACtD,WAAW,CAAG,EAAA,cAAA,CAAA,CAAA;AAAA,GACf,CAAA,CAAA;AAED,EAAA,IAAI,YAAc,EAAA;AAChB,IAAM,MAAA,UAAA,GAAaJ,sBAAM,CAAA,MAAA,CAAY,IAAI,CAAA,CAAA;AACzC,IAAA,uBAEIA,sBAAA,CAAA,aAAA,CAAAA,sBAAA,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AAA;AAAA,UACd,IAAM,EAAA,iBAAA;AAAA,SACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAeF;AAAA,MACA,aAAe,EAAA,IAAA;AAAA,KACjB;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;"}
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: \"plasmic-react-aria-popover\",\n displayName: \"Aria Popover\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerPopover\",\n importName: \"BasePopover\",\n props: {\n children: {\n type: \"slot\",\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","registerComponentHelper"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeO,SAAS,YAAY,KAAyB,EAAA;AACnD,EAAA,MAAyC,YAAjC,EAhBV,cAAA,EAAA,GAgB2C,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,EAAA,GAAA,EAAK,UAAY,EAAA,CAAA,kBACtCA,sBAAA,CAAA,aAAA,CAAAI,2BAAA,EAAA,cAAA,CAAA,cAAA,CAAA,EAAA,EAAY,WAAiB,CAAA,EAAA,eAAA,CAAiB,CACjD,CAAA,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