@plasmicpkgs/react-aria 0.0.29 → 0.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/contexts.d.ts +3 -0
  3. package/dist/react-aria.esm.js +1712 -878
  4. package/dist/react-aria.esm.js.map +1 -1
  5. package/dist/react-aria.js +1711 -877
  6. package/dist/react-aria.js.map +1 -1
  7. package/dist/registerButton.d.ts +1 -0
  8. package/dist/registerCheckbox.d.ts +8 -2
  9. package/dist/registerCheckboxGroup.d.ts +2 -2
  10. package/dist/registerDescription.d.ts +2 -1
  11. package/dist/registerDialogTrigger.d.ts +1 -2
  12. package/dist/registerHeader.d.ts +1 -1
  13. package/dist/registerInput.d.ts +1 -0
  14. package/dist/registerListBox.d.ts +3 -6
  15. package/dist/registerListBoxItem.d.ts +3 -1
  16. package/dist/registerModal.d.ts +3 -1
  17. package/dist/registerPopover.d.ts +3 -0
  18. package/dist/registerRadio.d.ts +5 -2
  19. package/dist/registerRadioGroup.d.ts +3 -3
  20. package/dist/registerSection.d.ts +1 -1
  21. package/dist/registerSelect.d.ts +5 -2
  22. package/dist/registerText.d.ts +2 -1
  23. package/dist/registerTextField.d.ts +1 -0
  24. package/dist/utils.d.ts +9 -2
  25. package/package.json +2 -2
  26. package/skinny/contexts-9475faad.esm.js +16 -0
  27. package/skinny/contexts-9475faad.esm.js.map +1 -0
  28. package/skinny/{contexts-dd0ce341.cjs.js → contexts-b21f6b12.cjs.js} +7 -1
  29. package/skinny/contexts-b21f6b12.cjs.js.map +1 -0
  30. package/skinny/contexts.d.ts +3 -0
  31. package/skinny/registerButton.cjs.js +19 -4
  32. package/skinny/registerButton.cjs.js.map +1 -1
  33. package/skinny/registerButton.d.ts +1 -0
  34. package/skinny/registerButton.esm.js +19 -5
  35. package/skinny/registerButton.esm.js.map +1 -1
  36. package/skinny/registerCheckbox.cjs.js +75 -6
  37. package/skinny/registerCheckbox.cjs.js.map +1 -1
  38. package/skinny/registerCheckbox.d.ts +8 -2
  39. package/skinny/registerCheckbox.esm.js +75 -7
  40. package/skinny/registerCheckbox.esm.js.map +1 -1
  41. package/skinny/registerCheckboxGroup.cjs.js +89 -13
  42. package/skinny/registerCheckboxGroup.cjs.js.map +1 -1
  43. package/skinny/registerCheckboxGroup.d.ts +2 -2
  44. package/skinny/registerCheckboxGroup.esm.js +88 -16
  45. package/skinny/registerCheckboxGroup.esm.js.map +1 -1
  46. package/skinny/registerComboBox.cjs.js +113 -8
  47. package/skinny/registerComboBox.cjs.js.map +1 -1
  48. package/skinny/registerComboBox.esm.js +109 -4
  49. package/skinny/registerComboBox.esm.js.map +1 -1
  50. package/skinny/registerDescription.cjs.js +10 -3
  51. package/skinny/registerDescription.cjs.js.map +1 -1
  52. package/skinny/registerDescription.d.ts +2 -1
  53. package/skinny/registerDescription.esm.js +10 -4
  54. package/skinny/registerDescription.esm.js.map +1 -1
  55. package/skinny/registerDialogTrigger.cjs.js +25 -4
  56. package/skinny/registerDialogTrigger.cjs.js.map +1 -1
  57. package/skinny/registerDialogTrigger.d.ts +1 -2
  58. package/skinny/registerDialogTrigger.esm.js +25 -4
  59. package/skinny/registerDialogTrigger.esm.js.map +1 -1
  60. package/skinny/registerFieldError.cjs.js +21 -11
  61. package/skinny/registerFieldError.cjs.js.map +1 -1
  62. package/skinny/registerFieldError.esm.js +21 -11
  63. package/skinny/registerFieldError.esm.js.map +1 -1
  64. package/skinny/registerForm.cjs.js +1 -1
  65. package/skinny/registerForm.esm.js +1 -1
  66. package/skinny/registerHeader.cjs.js +7 -3
  67. package/skinny/registerHeader.cjs.js.map +1 -1
  68. package/skinny/registerHeader.d.ts +1 -1
  69. package/skinny/registerHeader.esm.js +7 -3
  70. package/skinny/registerHeader.esm.js.map +1 -1
  71. package/skinny/registerInput.cjs.js +11 -2
  72. package/skinny/registerInput.cjs.js.map +1 -1
  73. package/skinny/registerInput.d.ts +1 -0
  74. package/skinny/registerInput.esm.js +11 -3
  75. package/skinny/registerInput.esm.js.map +1 -1
  76. package/skinny/registerLabel.cjs.js +1 -1
  77. package/skinny/registerLabel.esm.js +1 -1
  78. package/skinny/registerListBox-1effa43d.esm.js +299 -0
  79. package/skinny/registerListBox-1effa43d.esm.js.map +1 -0
  80. package/skinny/registerListBox-837b90d8.cjs.js +311 -0
  81. package/skinny/registerListBox-837b90d8.cjs.js.map +1 -0
  82. package/skinny/registerListBox.cjs.js +14 -108
  83. package/skinny/registerListBox.cjs.js.map +1 -1
  84. package/skinny/registerListBox.d.ts +3 -6
  85. package/skinny/registerListBox.esm.js +11 -106
  86. package/skinny/registerListBox.esm.js.map +1 -1
  87. package/skinny/registerListBoxItem.cjs.js +49 -5
  88. package/skinny/registerListBoxItem.cjs.js.map +1 -1
  89. package/skinny/registerListBoxItem.d.ts +3 -1
  90. package/skinny/registerListBoxItem.esm.js +49 -6
  91. package/skinny/registerListBoxItem.esm.js.map +1 -1
  92. package/skinny/registerModal.cjs.js +78 -9
  93. package/skinny/registerModal.cjs.js.map +1 -1
  94. package/skinny/registerModal.d.ts +3 -1
  95. package/skinny/registerModal.esm.js +78 -10
  96. package/skinny/registerModal.esm.js.map +1 -1
  97. package/skinny/registerPopover.cjs.js +56 -4
  98. package/skinny/registerPopover.cjs.js.map +1 -1
  99. package/skinny/registerPopover.d.ts +3 -0
  100. package/skinny/registerPopover.esm.js +55 -5
  101. package/skinny/registerPopover.esm.js.map +1 -1
  102. package/skinny/registerRadio.cjs.js +51 -6
  103. package/skinny/registerRadio.cjs.js.map +1 -1
  104. package/skinny/registerRadio.d.ts +5 -2
  105. package/skinny/registerRadio.esm.js +51 -7
  106. package/skinny/registerRadio.esm.js.map +1 -1
  107. package/skinny/registerRadioGroup.cjs.js +80 -16
  108. package/skinny/registerRadioGroup.cjs.js.map +1 -1
  109. package/skinny/registerRadioGroup.d.ts +3 -3
  110. package/skinny/registerRadioGroup.esm.js +79 -19
  111. package/skinny/registerRadioGroup.esm.js.map +1 -1
  112. package/skinny/registerSection.cjs.js +36 -12
  113. package/skinny/registerSection.cjs.js.map +1 -1
  114. package/skinny/registerSection.d.ts +1 -1
  115. package/skinny/registerSection.esm.js +36 -12
  116. package/skinny/registerSection.esm.js.map +1 -1
  117. package/skinny/registerSelect.cjs.js +133 -30
  118. package/skinny/registerSelect.cjs.js.map +1 -1
  119. package/skinny/registerSelect.d.ts +5 -2
  120. package/skinny/registerSelect.esm.js +130 -25
  121. package/skinny/registerSelect.esm.js.map +1 -1
  122. package/skinny/{registerSlider-efdba013.esm.js → registerSlider-39783c91.esm.js} +3 -3
  123. package/skinny/{registerSlider-efdba013.esm.js.map → registerSlider-39783c91.esm.js.map} +1 -1
  124. package/skinny/{registerSlider-73e80194.cjs.js → registerSlider-ac9f3b1e.cjs.js} +3 -3
  125. package/skinny/{registerSlider-73e80194.cjs.js.map → registerSlider-ac9f3b1e.cjs.js.map} +1 -1
  126. package/skinny/registerSlider.cjs.js +3 -3
  127. package/skinny/registerSlider.esm.js +3 -3
  128. package/skinny/registerSliderOutput.cjs.js +1 -1
  129. package/skinny/registerSliderOutput.esm.js +1 -1
  130. package/skinny/registerSliderThumb.cjs.js +2 -2
  131. package/skinny/registerSliderThumb.esm.js +2 -2
  132. package/skinny/registerSliderTrack.cjs.js +3 -3
  133. package/skinny/registerSliderTrack.esm.js +3 -3
  134. package/skinny/registerSwitch.cjs.js +83 -3
  135. package/skinny/registerSwitch.cjs.js.map +1 -1
  136. package/skinny/registerSwitch.esm.js +83 -3
  137. package/skinny/registerSwitch.esm.js.map +1 -1
  138. package/skinny/registerText.cjs.js +11 -4
  139. package/skinny/registerText.cjs.js.map +1 -1
  140. package/skinny/registerText.d.ts +2 -1
  141. package/skinny/registerText.esm.js +11 -5
  142. package/skinny/registerText.esm.js.map +1 -1
  143. package/skinny/registerTextArea.cjs.js +1 -1
  144. package/skinny/registerTextArea.esm.js +1 -1
  145. package/skinny/registerTextField.cjs.js +47 -6
  146. package/skinny/registerTextField.cjs.js.map +1 -1
  147. package/skinny/registerTextField.d.ts +1 -0
  148. package/skinny/registerTextField.esm.js +50 -10
  149. package/skinny/registerTextField.esm.js.map +1 -1
  150. package/skinny/registerTooltip.cjs.js +1 -1
  151. package/skinny/registerTooltip.esm.js +1 -1
  152. package/skinny/{utils-cf2632c9.esm.js → utils-5051df41.esm.js} +3 -2
  153. package/skinny/utils-5051df41.esm.js.map +1 -0
  154. package/skinny/{utils-18b2465b.cjs.js → utils-745db876.cjs.js} +2 -1
  155. package/skinny/utils-745db876.cjs.js.map +1 -0
  156. package/skinny/utils.d.ts +9 -2
  157. package/skinny/contexts-8a2a183b.esm.js +0 -13
  158. package/skinny/contexts-8a2a183b.esm.js.map +0 -1
  159. package/skinny/contexts-dd0ce341.cjs.js.map +0 -1
  160. package/skinny/option-utils-4f037568.esm.js +0 -153
  161. package/skinny/option-utils-4f037568.esm.js.map +0 -1
  162. package/skinny/option-utils-5e4e85bd.cjs.js +0 -162
  163. package/skinny/option-utils-5e4e85bd.cjs.js.map +0 -1
  164. package/skinny/utils-18b2465b.cjs.js.map +0 -1
  165. package/skinny/utils-cf2632c9.esm.js.map +0 -1
@@ -0,0 +1,311 @@
1
+ 'use strict';
2
+
3
+ var utils = require('@react-aria/utils');
4
+ var React = require('react');
5
+ var reactAriaComponents = require('react-aria-components');
6
+ var contexts = require('./contexts-b21f6b12.cjs.js');
7
+ var registerListBoxItem = require('./registerListBoxItem.cjs.js');
8
+ var registerSection = require('./registerSection.cjs.js');
9
+ var utils$1 = require('./utils-745db876.cjs.js');
10
+
11
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
+
13
+ var React__default = /*#__PURE__*/_interopDefault(React);
14
+
15
+ function useStrictOptions(props) {
16
+ const { options, optionInfo } = props;
17
+ return React__default.default.useMemo(() => {
18
+ return deriveStrictOptions({ options, optionInfo });
19
+ }, [options, optionInfo]);
20
+ }
21
+ function deriveStrictOptions(props) {
22
+ var _a;
23
+ const { options, optionInfo } = props;
24
+ let sectionCount = 0;
25
+ const makeStrict = (op) => {
26
+ var _a2, _b, _c, _d, _e, _f;
27
+ if (!op) {
28
+ return void 0;
29
+ } else if (typeof op === "string" || typeof op === "number") {
30
+ const item = {
31
+ id: op
32
+ };
33
+ return item;
34
+ } else if (optionInfo) {
35
+ const info = optionInfo(op);
36
+ if (info.type === "option-group") {
37
+ const section = {
38
+ type: "option-group",
39
+ items: (_c = (_b = (_a2 = info.items) == null ? void 0 : _a2.map) == null ? void 0 : _b.call(_a2, (item) => makeStrict(item))) == null ? void 0 : _c.filter((x) => !!x),
40
+ label: info.label,
41
+ key: `option-group-${sectionCount}`
42
+ };
43
+ sectionCount += 1;
44
+ return section;
45
+ } else {
46
+ let item = info;
47
+ if (!("id" in item)) {
48
+ item = {
49
+ type: "option",
50
+ id: JSON.stringify(item)
51
+ };
52
+ }
53
+ return item;
54
+ }
55
+ } else if (typeof op === "object") {
56
+ if ("items" in op) {
57
+ const section = {
58
+ type: "option-group",
59
+ items: (_f = (_e = (_d = op.items) == null ? void 0 : _d.map) == null ? void 0 : _e.call(_d, (item) => makeStrict(item))) == null ? void 0 : _f.filter((x) => !!x),
60
+ label: op.label,
61
+ key: `option-group-${sectionCount}`
62
+ };
63
+ sectionCount += 1;
64
+ return section;
65
+ } else {
66
+ let item = op;
67
+ if (!("id" in item)) {
68
+ item = {
69
+ type: "option",
70
+ id: JSON.stringify(item)
71
+ };
72
+ }
73
+ return item;
74
+ }
75
+ } else {
76
+ return void 0;
77
+ }
78
+ };
79
+ const strictOptions = (_a = options == null ? void 0 : options.map(makeStrict)) == null ? void 0 : _a.filter((x) => !!x);
80
+ const optionText = (op) => {
81
+ var _a2;
82
+ return (_a2 = op.label) != null ? _a2 : op.id;
83
+ };
84
+ return { options: strictOptions, optionText };
85
+ }
86
+ function flattenOptions(options) {
87
+ if (!options) {
88
+ return [];
89
+ } else {
90
+ return options.flatMap(
91
+ (op) => {
92
+ var _a;
93
+ return op.type === "option-group" ? (_a = op.items) != null ? _a : [] : op;
94
+ }
95
+ );
96
+ }
97
+ }
98
+ function makeOptionsPropType() {
99
+ const type = {
100
+ type: "array",
101
+ itemType: {
102
+ type: "object",
103
+ nameFunc: (item) => item.label || item.id,
104
+ fields: {
105
+ type: {
106
+ type: "choice",
107
+ options: [
108
+ { value: "option", label: "Option" },
109
+ { value: "option-group", label: "Option Group" }
110
+ ],
111
+ defaultValue: "option"
112
+ },
113
+ id: {
114
+ type: "string",
115
+ hidden: (_ps, _ctx, { item }) => item.type !== "option"
116
+ },
117
+ label: "string",
118
+ items: {
119
+ type: "array",
120
+ displayName: "Options",
121
+ hidden: (_ps, _ctx, { item }) => {
122
+ return item.type !== "option-group";
123
+ },
124
+ itemType: {
125
+ type: "object",
126
+ nameFunc: (item) => item.label || item.id,
127
+ fields: {
128
+ id: "string",
129
+ label: "string"
130
+ }
131
+ }
132
+ }
133
+ }
134
+ },
135
+ defaultValue: [
136
+ {
137
+ id: "option1",
138
+ label: "Option 1",
139
+ type: "option"
140
+ },
141
+ {
142
+ id: "option2",
143
+ label: "Option 2",
144
+ type: "option"
145
+ },
146
+ {
147
+ label: "Section 1",
148
+ type: "option-group",
149
+ items: [
150
+ {
151
+ id: "section-1-1",
152
+ label: "Section item 1",
153
+ type: "option"
154
+ },
155
+ {
156
+ id: "section-1-2",
157
+ label: "Section item 2",
158
+ type: "option"
159
+ }
160
+ ]
161
+ }
162
+ ]
163
+ };
164
+ return type;
165
+ }
166
+ function makeValuePropType() {
167
+ const type = {
168
+ type: "choice",
169
+ options: (ps) => {
170
+ const { options, optionText } = deriveStrictOptions(ps);
171
+ return flattenOptions(options).map((op) => ({
172
+ value: op.id,
173
+ label: optionText(op)
174
+ }));
175
+ }
176
+ };
177
+ return type;
178
+ }
179
+
180
+ var __defProp = Object.defineProperty;
181
+ var __defProps = Object.defineProperties;
182
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
183
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
184
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
185
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
186
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
187
+ var __spreadValues = (a, b) => {
188
+ for (var prop in b || (b = {}))
189
+ if (__hasOwnProp.call(b, prop))
190
+ __defNormalProp(a, prop, b[prop]);
191
+ if (__getOwnPropSymbols)
192
+ for (var prop of __getOwnPropSymbols(b)) {
193
+ if (__propIsEnum.call(b, prop))
194
+ __defNormalProp(a, prop, b[prop]);
195
+ }
196
+ return a;
197
+ };
198
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
199
+ var __objRest = (source, exclude) => {
200
+ var target = {};
201
+ for (var prop in source)
202
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
203
+ target[prop] = source[prop];
204
+ if (source != null && __getOwnPropSymbols)
205
+ for (var prop of __getOwnPropSymbols(source)) {
206
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
207
+ target[prop] = source[prop];
208
+ }
209
+ return target;
210
+ };
211
+ function BaseListBox(props) {
212
+ var _c;
213
+ const contextProps = React__default.default.useContext(contexts.PlasmicListBoxContext);
214
+ const isStandalone = !contextProps;
215
+ const _a = props, rest = __objRest(_a, ["options"]);
216
+ const { options } = useStrictOptions(props);
217
+ const _b = utils.mergeProps(
218
+ contextProps,
219
+ rest,
220
+ isStandalone ? { items: options } : {}
221
+ ), { renderItem, renderSection } = _b, mergedProps = __objRest(_b, ["renderItem", "renderSection"]);
222
+ (_c = props.setControlContextData) == null ? void 0 : _c.call(props, {
223
+ isStandalone
224
+ });
225
+ return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.ListBox, __spreadValues({}, mergedProps), (item) => {
226
+ var _a2;
227
+ if (item.type === "option-group") {
228
+ return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement(
229
+ contexts.PlasmicSectionContext.Provider,
230
+ {
231
+ value: {
232
+ renderItem,
233
+ key: (_a2 = item.key) != null ? _a2 : item.label,
234
+ section: item
235
+ }
236
+ },
237
+ renderSection == null ? void 0 : renderSection(item)
238
+ ));
239
+ } else {
240
+ return /* @__PURE__ */ React__default.default.createElement(contexts.PlasmicItemContext.Provider, { value: item }, renderItem == null ? void 0 : renderItem(item));
241
+ }
242
+ });
243
+ }
244
+ const LIST_BOX_COMPONENT_NAME = utils$1.makeComponentName("listbox");
245
+ function registerListBox(loader, overrides) {
246
+ const listBoxItemMeta = registerListBoxItem.registerListBoxItem(loader, {
247
+ parentComponentName: LIST_BOX_COMPONENT_NAME
248
+ });
249
+ const sectionMeta = registerSection.registerSection(loader, {
250
+ parentComponentName: LIST_BOX_COMPONENT_NAME
251
+ });
252
+ utils$1.registerComponentHelper(
253
+ loader,
254
+ BaseListBox,
255
+ {
256
+ name: LIST_BOX_COMPONENT_NAME,
257
+ displayName: "Aria ListBox",
258
+ importPath: "@plasmicpkgs/react-aria/skinny/registerListBox",
259
+ importName: "BaseListBox",
260
+ defaultStyles: {
261
+ width: "250px",
262
+ borderWidth: "1px",
263
+ borderStyle: "solid",
264
+ borderColor: "black"
265
+ },
266
+ props: {
267
+ options: __spreadProps(__spreadValues({}, makeOptionsPropType()), {
268
+ displayName: "Items",
269
+ hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
270
+ }),
271
+ renderItem: {
272
+ type: "slot",
273
+ displayName: "Render Item",
274
+ renderPropParams: ["itemProps"],
275
+ defaultValue: {
276
+ type: "component",
277
+ name: listBoxItemMeta.name,
278
+ props: {
279
+ children: registerListBoxItem.makeDefaultListBoxItemChildren(
280
+ "Item (itemProps.label)",
281
+ "Connect with `itemProps` in the data picker to display list box items"
282
+ )
283
+ }
284
+ }
285
+ },
286
+ renderSection: {
287
+ type: "slot",
288
+ displayName: "Render Section",
289
+ renderPropParams: ["sectionProps"],
290
+ defaultValue: {
291
+ type: "component",
292
+ name: sectionMeta.name,
293
+ styles: {
294
+ backgroundColor: "#F4FAFF"
295
+ }
296
+ }
297
+ }
298
+ }
299
+ },
300
+ overrides
301
+ );
302
+ }
303
+
304
+ exports.BaseListBox = BaseListBox;
305
+ exports.LIST_BOX_COMPONENT_NAME = LIST_BOX_COMPONENT_NAME;
306
+ exports.flattenOptions = flattenOptions;
307
+ exports.makeOptionsPropType = makeOptionsPropType;
308
+ exports.makeValuePropType = makeValuePropType;
309
+ exports.registerListBox = registerListBox;
310
+ exports.useStrictOptions = useStrictOptions;
311
+ //# sourceMappingURL=registerListBox-837b90d8.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerListBox-837b90d8.cjs.js","sources":["../src/option-utils.ts","../src/registerListBox.tsx"],"sourcesContent":["import type { ArrayType, ChoiceType } from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\n\nexport interface ObjectSectionType<T extends object> {\n label?: string;\n items?: ObjectItemType<T>[];\n}\ninterface FlexSectionType<T extends object> {\n label?: string;\n items?: FlexItemType<T>[];\n}\n\nexport type ObjectItemType<T extends object> = StrictOptionType | T;\ntype FlexItemType<T extends object> = ObjectItemType<T> | string;\n\nexport type FlexOptionType<T extends object> =\n | FlexItemType<T>\n | FlexSectionType<T>;\n\nexport type ObjectOptionType<T extends object> =\n | ObjectSectionType<T>\n | ObjectItemType<T>;\n\nexport interface HasOptions<T extends object> {\n options?: FlexOptionType<T>[];\n optionInfo?: (option: FlexOptionType<T>) => StrictOptionType;\n}\n\nexport interface StrictItemType {\n type?: \"option\";\n id: string;\n label?: string;\n isDisabled?: boolean;\n}\n\nexport interface StrictSectionType {\n type: \"option-group\";\n label?: string;\n items?: StrictItemType[];\n key: string;\n}\n\nexport type StrictOptionType = StrictItemType | StrictSectionType;\n\nexport function useStrictOptions<T extends object>(props: HasOptions<T>) {\n const { options, optionInfo } = props;\n return React.useMemo(() => {\n return deriveStrictOptions({ options, optionInfo });\n }, [options, optionInfo]);\n}\n\nexport function deriveStrictOptions<T extends object>(props: HasOptions<T>) {\n const { options, optionInfo } = props;\n let sectionCount = 0;\n\n const makeStrict = (op: FlexOptionType<T>): StrictOptionType | undefined => {\n if (!op) {\n return undefined;\n } else if (typeof op === \"string\" || typeof op === \"number\") {\n const item = {\n id: op,\n };\n return item;\n } else if (optionInfo) {\n const info = optionInfo(op);\n if (info.type === \"option-group\") {\n const section: StrictSectionType = {\n type: \"option-group\",\n items: info.items\n ?.map?.((item) => makeStrict(item) as StrictItemType)\n ?.filter((x) => !!x),\n label: info.label,\n key: `option-group-${sectionCount}`,\n };\n sectionCount += 1;\n return section;\n } else {\n let item = info;\n if (!(\"id\" in item)) {\n item = {\n type: \"option\",\n id: JSON.stringify(item),\n };\n }\n return item;\n }\n } else if (typeof op === \"object\") {\n if (\"items\" in op) {\n const section: StrictSectionType = {\n type: \"option-group\",\n items: op.items\n ?.map?.((item) => makeStrict(item) as StrictItemType)\n ?.filter((x) => !!x),\n label: op.label,\n key: `option-group-${sectionCount}`,\n };\n sectionCount += 1;\n return section;\n } else {\n let item = op;\n if (!(\"id\" in item)) {\n item = {\n type: \"option\",\n id: JSON.stringify(item),\n };\n }\n return item;\n }\n } else {\n return undefined;\n }\n };\n\n const strictOptions = options\n ?.map(makeStrict)\n ?.filter((x): x is StrictOptionType => !!x);\n\n const optionText = (op: StrictItemType) => {\n return op.label ?? op.id;\n };\n\n return { options: strictOptions, optionText };\n}\n\nexport function flattenOptions(\n options: (StrictItemType | StrictSectionType)[] | undefined\n): StrictItemType[] {\n if (!options) {\n return [];\n } else {\n return options.flatMap((op) =>\n op.type === \"option-group\" ? op.items ?? [] : op\n );\n }\n}\n\nexport function makeOptionsPropType() {\n const type: ArrayType<HasOptions<any>> = {\n type: \"array\",\n itemType: {\n type: \"object\",\n nameFunc: (item: any) => item.label || item.id,\n fields: {\n type: {\n type: \"choice\",\n options: [\n { value: \"option\", label: \"Option\" },\n { value: \"option-group\", label: \"Option Group\" },\n ],\n defaultValue: \"option\",\n },\n id: {\n type: \"string\",\n hidden: (_ps: any, _ctx: any, { item }: any) =>\n item.type !== \"option\",\n },\n label: \"string\",\n items: {\n type: \"array\",\n displayName: \"Options\",\n hidden: (_ps: any, _ctx: any, { item }: any) => {\n return item.type !== \"option-group\";\n },\n itemType: {\n type: \"object\",\n nameFunc: (item: any) => item.label || item.id,\n fields: {\n id: \"string\",\n label: \"string\",\n },\n },\n },\n },\n },\n defaultValue: [\n {\n id: \"option1\",\n label: \"Option 1\",\n type: \"option\",\n },\n {\n id: \"option2\",\n label: \"Option 2\",\n type: \"option\",\n },\n {\n label: \"Section 1\",\n type: \"option-group\",\n items: [\n {\n id: \"section-1-1\",\n label: \"Section item 1\",\n type: \"option\",\n },\n {\n id: \"section-1-2\",\n label: \"Section item 2\",\n type: \"option\",\n },\n ],\n },\n ],\n };\n return type;\n}\n\nexport function makeValuePropType() {\n const type: ChoiceType<HasOptions<any>> = {\n type: \"choice\",\n options: (ps: HasOptions<any>) => {\n const { options, optionText } = deriveStrictOptions(ps);\n return flattenOptions(options).map((op) => ({\n value: op.id,\n label: optionText(op),\n }));\n },\n };\n return type;\n}\n","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 {\n makeDefaultListBoxItemChildren,\n registerListBoxItem,\n} from \"./registerListBoxItem\";\nimport { registerSection } from \"./registerSection\";\nimport {\n BaseControlContextData,\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\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: BaseControlContextData) => 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 const LIST_BOX_COMPONENT_NAME = makeComponentName(\"listbox\");\n\nexport function registerListBox(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBox>\n) {\n const listBoxItemMeta = registerListBoxItem(loader, {\n parentComponentName: LIST_BOX_COMPONENT_NAME,\n });\n const sectionMeta = registerSection(loader, {\n parentComponentName: LIST_BOX_COMPONENT_NAME,\n });\n\n registerComponentHelper(\n loader,\n BaseListBox,\n {\n name: LIST_BOX_COMPONENT_NAME,\n displayName: \"Aria ListBox\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBox\",\n importName: \"BaseListBox\",\n defaultStyles: {\n width: \"250px\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n },\n props: {\n options: {\n ...makeOptionsPropType(),\n displayName: \"Items\",\n hidden: (_ps: BaseListBoxProps, ctx: BaseControlContextData | null) =>\n !ctx?.isStandalone,\n },\n renderItem: {\n type: \"slot\",\n displayName: \"Render Item\",\n renderPropParams: [\"itemProps\"],\n defaultValue: {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n children: makeDefaultListBoxItemChildren(\n \"Item (itemProps.label)\",\n \"Connect with `itemProps` in the data picker to display list box items\"\n ),\n },\n },\n },\n renderSection: {\n type: \"slot\",\n displayName: \"Render Section\",\n renderPropParams: [\"sectionProps\"],\n defaultValue: {\n type: \"component\",\n name: sectionMeta.name,\n styles: {\n backgroundColor: \"#F4FAFF\",\n },\n },\n },\n },\n },\n overrides\n );\n}\n"],"names":["React","_a","PlasmicListBoxContext","mergeProps","ListBox","PlasmicSectionContext","PlasmicItemContext","makeComponentName","registerListBoxItem","registerSection","registerComponentHelper","makeDefaultListBoxItemChildren"],"mappings":";;;;;;;;;;;;;;AA4CO,SAAS,iBAAmC,KAAsB,EAAA;AACvE,EAAM,MAAA,EAAE,OAAS,EAAA,UAAA,EAAe,GAAA,KAAA,CAAA;AAChC,EAAO,OAAAA,sBAAA,CAAM,QAAQ,MAAM;AACzB,IAAA,OAAO,mBAAoB,CAAA,EAAE,OAAS,EAAA,UAAA,EAAY,CAAA,CAAA;AAAA,GACjD,EAAA,CAAC,OAAS,EAAA,UAAU,CAAC,CAAA,CAAA;AAC1B,CAAA;AAEO,SAAS,oBAAsC,KAAsB,EAAA;AAnD5E,EAAA,IAAA,EAAA,CAAA;AAoDE,EAAM,MAAA,EAAE,OAAS,EAAA,UAAA,EAAe,GAAA,KAAA,CAAA;AAChC,EAAA,IAAI,YAAe,GAAA,CAAA,CAAA;AAEnB,EAAM,MAAA,UAAA,GAAa,CAAC,EAAwD,KAAA;AAvD9E,IAAA,IAAAC,GAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAwDI,IAAA,IAAI,CAAC,EAAI,EAAA;AACP,MAAO,OAAA,KAAA,CAAA,CAAA;AAAA,eACE,OAAO,EAAA,KAAO,QAAY,IAAA,OAAO,OAAO,QAAU,EAAA;AAC3D,MAAA,MAAM,IAAO,G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ACb,WAAa,EAAA,OAAA;AAAA,QACb,WAAa,EAAA,OAAA;AAAA,OACf;AAAA,MACA,KAAO,EAAA;AAAA,QACL,OAAA,EAAS,aACJ,CAAA,cAAA,CAAA,EAAA,EAAA,mBAAA,EADI,CAAA,EAAA;AAAA,UAEP,WAAa,EAAA,OAAA;AAAA,UACb,MAAQ,EAAA,CAAC,GAAuB,EAAA,GAAA,KAC9B,EAAC,GAAK,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,GAAA,CAAA,YAAA,CAAA;AAAA,SACV,CAAA;AAAA,QACA,UAAY,EAAA;AAAA,UACV,IAAM,EAAA,MAAA;AAAA,UACN,WAAa,EAAA,aAAA;AAAA,UACb,gBAAA,EAAkB,CAAC,WAAW,CAAA;AAAA,UAC9B,YAAc,EAAA;AAAA,YACZ,IAAM,EAAA,WAAA;AAAA,YACN,MAAM,eAAgB,CAAA,IAAA;AAAA,YACtB,KAAO,EAAA;AAAA,cACL,QAAU,EAAAC,kDAAA;AAAA,gBACR,wBAAA;AAAA,gBACA,uEAAA;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,QACA,aAAe,EAAA;AAAA,UACb,IAAM,EAAA,MAAA;AAAA,UACN,WAAa,EAAA,gBAAA;AAAA,UACb,gBAAA,EAAkB,CAAC,cAAc,CAAA;AAAA,UACjC,YAAc,EAAA;AAAA,YACZ,IAAM,EAAA,WAAA;AAAA,YACN,MAAM,WAAY,CAAA,IAAA;AAAA,YAClB,MAAQ,EAAA;AAAA,cACN,eAAiB,EAAA,SAAA;AAAA,aACnB;AAAA,WACF;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;;;;;;"}
@@ -1,115 +1,21 @@
1
1
  'use strict';
2
2
 
3
- var utils = require('@react-aria/utils');
4
- var React = require('react');
5
- var reactAriaComponents = require('react-aria-components');
6
- var contexts = require('./contexts-dd0ce341.cjs.js');
7
- var optionUtils = require('./option-utils-5e4e85bd.cjs.js');
8
- var registerListBoxItem = require('./registerListBoxItem.cjs.js');
9
- var utils$1 = require('./utils-18b2465b.cjs.js');
3
+ require('@react-aria/utils');
4
+ require('react');
5
+ require('react-aria-components');
6
+ require('./contexts-b21f6b12.cjs.js');
7
+ var registerListBox = require('./registerListBox-837b90d8.cjs.js');
8
+ require('./registerListBoxItem.cjs.js');
9
+ require('./registerSection.cjs.js');
10
+ require('./utils-745db876.cjs.js');
11
+ require('./registerDescription.cjs.js');
12
+ require('./registerText.cjs.js');
10
13
  require('@plasmicapp/host/registerComponent');
14
+ require('./registerHeader.cjs.js');
11
15
 
12
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
16
 
14
- var React__default = /*#__PURE__*/_interopDefault(React);
15
17
 
16
- var __defProp = Object.defineProperty;
17
- var __defProps = Object.defineProperties;
18
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
19
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
20
- var __hasOwnProp = Object.prototype.hasOwnProperty;
21
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
22
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
23
- var __spreadValues = (a, b) => {
24
- for (var prop in b || (b = {}))
25
- if (__hasOwnProp.call(b, prop))
26
- __defNormalProp(a, prop, b[prop]);
27
- if (__getOwnPropSymbols)
28
- for (var prop of __getOwnPropSymbols(b)) {
29
- if (__propIsEnum.call(b, prop))
30
- __defNormalProp(a, prop, b[prop]);
31
- }
32
- return a;
33
- };
34
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
35
- var __objRest = (source, exclude) => {
36
- var target = {};
37
- for (var prop in source)
38
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
39
- target[prop] = source[prop];
40
- if (source != null && __getOwnPropSymbols)
41
- for (var prop of __getOwnPropSymbols(source)) {
42
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
43
- target[prop] = source[prop];
44
- }
45
- return target;
46
- };
47
- function BaseListBox(props) {
48
- var _c;
49
- const contextProps = React__default.default.useContext(contexts.PlasmicListBoxContext);
50
- const isStandalone = !contextProps;
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(
65
- contexts.PlasmicSectionContext.Provider,
66
- {
67
- value: {
68
- renderItem,
69
- key: (_a2 = item.key) != null ? _a2 : item.label,
70
- section: item
71
- }
72
- },
73
- renderSection == null ? void 0 : renderSection(item)
74
- ));
75
- } else {
76
- return /* @__PURE__ */ React__default.default.createElement(contexts.PlasmicItemContext.Provider, { value: item }, renderItem == null ? void 0 : renderItem(item));
77
- }
78
- });
79
- }
80
- function registerListBox(loader, overrides) {
81
- utils$1.registerComponentHelper(
82
- loader,
83
- BaseListBox,
84
- {
85
- name: utils$1.makeComponentName("listbox"),
86
- displayName: "Aria ListBox",
87
- importPath: "@plasmicpkgs/react-aria/skinny/registerListBox",
88
- importName: "BaseListBox",
89
- props: {
90
- options: __spreadProps(__spreadValues({}, optionUtils.makeOptionsPropType()), {
91
- displayName: "Items",
92
- hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
93
- }),
94
- renderItem: {
95
- type: "slot",
96
- displayName: "Render Item",
97
- renderPropParams: ["itemProps"]
98
- },
99
- renderSection: {
100
- type: "slot",
101
- displayName: "Render Section",
102
- renderPropParams: ["sectionProps"]
103
- }
104
- }
105
- },
106
- overrides
107
- );
108
- registerListBoxItem.registerListBoxItem(loader, {
109
- parentComponentName: utils$1.makeComponentName("listbox")
110
- });
111
- }
112
-
113
- exports.BaseListBox = BaseListBox;
114
- exports.registerListBox = registerListBox;
18
+ exports.BaseListBox = registerListBox.BaseListBox;
19
+ exports.LIST_BOX_COMPONENT_NAME = registerListBox.LIST_BOX_COMPONENT_NAME;
20
+ exports.registerListBox = registerListBox.registerListBox;
115
21
  //# sourceMappingURL=registerListBox.cjs.js.map
@@ -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 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,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,13 @@
1
1
  import React from "react";
2
2
  import { ListBox } from "react-aria-components";
3
3
  import { HasOptions } from "./option-utils";
4
- import { CodeComponentMetaOverrides, Registerable } from "./utils";
5
- interface BaseListBoxControlContextData {
6
- isStandalone: boolean;
7
- }
4
+ import { BaseControlContextData, CodeComponentMetaOverrides, Registerable } from "./utils";
8
5
  export interface BaseListBoxProps extends React.ComponentProps<typeof ListBox>, HasOptions<any> {
9
6
  renderItem?: (item: any) => React.ReactNode;
10
7
  renderSection?: (section: any) => React.ReactNode;
11
8
  getItemType?: (thing: any) => "item" | "section";
12
- setControlContextData?: (ctxData: BaseListBoxControlContextData) => void;
9
+ setControlContextData?: (ctxData: BaseControlContextData) => void;
13
10
  }
14
11
  export declare function BaseListBox(props: BaseListBoxProps): React.JSX.Element;
12
+ export declare const LIST_BOX_COMPONENT_NAME: string;
15
13
  export declare function registerListBox(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BaseListBox>): void;
16
- export {};
@@ -1,108 +1,13 @@
1
- import { mergeProps } from '@react-aria/utils';
2
- import React from 'react';
3
- import { ListBox } from 'react-aria-components';
4
- import { P as PlasmicListBoxContext, b as PlasmicSectionContext, c as PlasmicItemContext } from './contexts-8a2a183b.esm.js';
5
- import { u as useStrictOptions, m as makeOptionsPropType } from './option-utils-4f037568.esm.js';
6
- import { registerListBoxItem } from './registerListBoxItem.esm.js';
7
- import { r as registerComponentHelper, m as makeComponentName } from './utils-cf2632c9.esm.js';
1
+ import '@react-aria/utils';
2
+ import 'react';
3
+ import 'react-aria-components';
4
+ import './contexts-9475faad.esm.js';
5
+ export { B as BaseListBox, L as LIST_BOX_COMPONENT_NAME, r as registerListBox } from './registerListBox-1effa43d.esm.js';
6
+ import './registerListBoxItem.esm.js';
7
+ import './registerSection.esm.js';
8
+ import './utils-5051df41.esm.js';
9
+ import './registerDescription.esm.js';
10
+ import './registerText.esm.js';
8
11
  import '@plasmicapp/host/registerComponent';
9
-
10
- var __defProp = Object.defineProperty;
11
- var __defProps = Object.defineProperties;
12
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
13
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
14
- var __hasOwnProp = Object.prototype.hasOwnProperty;
15
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
16
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17
- var __spreadValues = (a, b) => {
18
- for (var prop in b || (b = {}))
19
- if (__hasOwnProp.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- if (__getOwnPropSymbols)
22
- for (var prop of __getOwnPropSymbols(b)) {
23
- if (__propIsEnum.call(b, prop))
24
- __defNormalProp(a, prop, b[prop]);
25
- }
26
- return a;
27
- };
28
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
29
- var __objRest = (source, exclude) => {
30
- var target = {};
31
- for (var prop in source)
32
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
33
- target[prop] = source[prop];
34
- if (source != null && __getOwnPropSymbols)
35
- for (var prop of __getOwnPropSymbols(source)) {
36
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
37
- target[prop] = source[prop];
38
- }
39
- return target;
40
- };
41
- function BaseListBox(props) {
42
- var _c;
43
- const contextProps = React.useContext(PlasmicListBoxContext);
44
- const isStandalone = !contextProps;
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(
59
- PlasmicSectionContext.Provider,
60
- {
61
- value: {
62
- renderItem,
63
- key: (_a2 = item.key) != null ? _a2 : item.label,
64
- section: item
65
- }
66
- },
67
- renderSection == null ? void 0 : renderSection(item)
68
- ));
69
- } else {
70
- return /* @__PURE__ */ React.createElement(PlasmicItemContext.Provider, { value: item }, renderItem == null ? void 0 : renderItem(item));
71
- }
72
- });
73
- }
74
- function registerListBox(loader, overrides) {
75
- registerComponentHelper(
76
- loader,
77
- BaseListBox,
78
- {
79
- name: makeComponentName("listbox"),
80
- displayName: "Aria ListBox",
81
- importPath: "@plasmicpkgs/react-aria/skinny/registerListBox",
82
- importName: "BaseListBox",
83
- props: {
84
- options: __spreadProps(__spreadValues({}, makeOptionsPropType()), {
85
- displayName: "Items",
86
- hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
87
- }),
88
- renderItem: {
89
- type: "slot",
90
- displayName: "Render Item",
91
- renderPropParams: ["itemProps"]
92
- },
93
- renderSection: {
94
- type: "slot",
95
- displayName: "Render Section",
96
- renderPropParams: ["sectionProps"]
97
- }
98
- }
99
- },
100
- overrides
101
- );
102
- registerListBoxItem(loader, {
103
- parentComponentName: makeComponentName("listbox")
104
- });
105
- }
106
-
107
- export { BaseListBox, registerListBox };
12
+ import './registerHeader.esm.js';
108
13
  //# sourceMappingURL=registerListBox.esm.js.map
@@ -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 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: [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