@plasmicpkgs/react-aria 0.0.42 → 0.0.44

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 (146) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/common.d.ts +8 -1
  3. package/dist/contexts.d.ts +3 -2
  4. package/dist/react-aria.esm.js +863 -670
  5. package/dist/react-aria.esm.js.map +1 -1
  6. package/dist/react-aria.js +861 -668
  7. package/dist/react-aria.js.map +1 -1
  8. package/dist/registerButton.d.ts +1 -1
  9. package/dist/registerCheckbox.d.ts +3 -4
  10. package/dist/registerCheckboxGroup.d.ts +2 -2
  11. package/dist/registerInput.d.ts +12 -5
  12. package/dist/registerListBox.d.ts +2 -3
  13. package/dist/registerModal.d.ts +2 -3
  14. package/dist/registerPopover.d.ts +4 -6
  15. package/dist/registerRadio.d.ts +3 -5
  16. package/dist/registerRadioGroup.d.ts +1 -1
  17. package/dist/registerSlider.d.ts +3 -20
  18. package/dist/registerSliderOutput.d.ts +1 -1
  19. package/dist/registerSliderThumb.d.ts +3 -3
  20. package/dist/registerSliderTrack.d.ts +3 -1
  21. package/dist/registerSwitch.d.ts +1 -1
  22. package/dist/registerTextArea.d.ts +11 -5
  23. package/dist/registerTextField.d.ts +3 -3
  24. package/dist/utils.d.ts +7 -1
  25. package/package.json +2 -2
  26. package/skinny/common-96be13c3.esm.js +341 -0
  27. package/skinny/common-96be13c3.esm.js.map +1 -0
  28. package/skinny/common-f51484c1.cjs.js +345 -0
  29. package/skinny/common-f51484c1.cjs.js.map +1 -0
  30. package/skinny/common.d.ts +8 -1
  31. package/skinny/{contexts-7236059e.cjs.js → contexts-3a98471a.cjs.js} +1 -3
  32. package/skinny/contexts-3a98471a.cjs.js.map +1 -0
  33. package/skinny/{contexts-21e0d928.esm.js → contexts-87c261f6.esm.js} +2 -3
  34. package/skinny/contexts-87c261f6.esm.js.map +1 -0
  35. package/skinny/contexts.d.ts +3 -2
  36. package/skinny/registerButton.cjs.js +2 -2
  37. package/skinny/registerButton.cjs.js.map +1 -1
  38. package/skinny/registerButton.d.ts +1 -1
  39. package/skinny/registerButton.esm.js +2 -2
  40. package/skinny/registerButton.esm.js.map +1 -1
  41. package/skinny/registerCheckbox.cjs.js +13 -18
  42. package/skinny/registerCheckbox.cjs.js.map +1 -1
  43. package/skinny/registerCheckbox.d.ts +3 -4
  44. package/skinny/registerCheckbox.esm.js +13 -18
  45. package/skinny/registerCheckbox.esm.js.map +1 -1
  46. package/skinny/registerCheckboxGroup.cjs.js +5 -5
  47. package/skinny/registerCheckboxGroup.cjs.js.map +1 -1
  48. package/skinny/registerCheckboxGroup.d.ts +2 -2
  49. package/skinny/registerCheckboxGroup.esm.js +5 -5
  50. package/skinny/registerCheckboxGroup.esm.js.map +1 -1
  51. package/skinny/registerComboBox.cjs.js +3 -3
  52. package/skinny/registerComboBox.esm.js +3 -3
  53. package/skinny/registerDialogTrigger.cjs.js +2 -2
  54. package/skinny/registerDialogTrigger.esm.js +2 -2
  55. package/skinny/registerHeader.cjs.js +1 -1
  56. package/skinny/registerHeader.esm.js +1 -1
  57. package/skinny/registerInput.cjs.js +76 -16
  58. package/skinny/registerInput.cjs.js.map +1 -1
  59. package/skinny/registerInput.d.ts +12 -5
  60. package/skinny/registerInput.esm.js +76 -17
  61. package/skinny/registerInput.esm.js.map +1 -1
  62. package/skinny/{registerListBox-f060da58.cjs.js → registerListBox-44316bb6.cjs.js} +7 -7
  63. package/skinny/registerListBox-44316bb6.cjs.js.map +1 -0
  64. package/skinny/{registerListBox-38a08460.esm.js → registerListBox-ccd14a2e.esm.js} +7 -7
  65. package/skinny/registerListBox-ccd14a2e.esm.js.map +1 -0
  66. package/skinny/registerListBox.cjs.js +3 -2
  67. package/skinny/registerListBox.cjs.js.map +1 -1
  68. package/skinny/registerListBox.d.ts +2 -3
  69. package/skinny/registerListBox.esm.js +3 -2
  70. package/skinny/registerListBox.esm.js.map +1 -1
  71. package/skinny/registerListBoxItem.cjs.js +1 -1
  72. package/skinny/registerListBoxItem.esm.js +1 -1
  73. package/skinny/registerModal.cjs.js +5 -4
  74. package/skinny/registerModal.cjs.js.map +1 -1
  75. package/skinny/registerModal.d.ts +2 -3
  76. package/skinny/registerModal.esm.js +5 -4
  77. package/skinny/registerModal.esm.js.map +1 -1
  78. package/skinny/registerPopover.cjs.js +23 -24
  79. package/skinny/registerPopover.cjs.js.map +1 -1
  80. package/skinny/registerPopover.d.ts +4 -6
  81. package/skinny/registerPopover.esm.js +24 -25
  82. package/skinny/registerPopover.esm.js.map +1 -1
  83. package/skinny/registerRadio.cjs.js +14 -26
  84. package/skinny/registerRadio.cjs.js.map +1 -1
  85. package/skinny/registerRadio.d.ts +3 -5
  86. package/skinny/registerRadio.esm.js +14 -26
  87. package/skinny/registerRadio.esm.js.map +1 -1
  88. package/skinny/registerRadioGroup.cjs.js +4 -4
  89. package/skinny/registerRadioGroup.cjs.js.map +1 -1
  90. package/skinny/registerRadioGroup.d.ts +1 -1
  91. package/skinny/registerRadioGroup.esm.js +4 -4
  92. package/skinny/registerRadioGroup.esm.js.map +1 -1
  93. package/skinny/registerSection.cjs.js +1 -1
  94. package/skinny/registerSection.esm.js +1 -1
  95. package/skinny/registerSelect.cjs.js +3 -3
  96. package/skinny/registerSelect.esm.js +3 -3
  97. package/skinny/registerSlider.cjs.js +305 -15
  98. package/skinny/registerSlider.cjs.js.map +1 -1
  99. package/skinny/registerSlider.d.ts +3 -20
  100. package/skinny/registerSlider.esm.js +303 -11
  101. package/skinny/registerSlider.esm.js.map +1 -1
  102. package/skinny/registerSliderOutput.cjs.js +1 -1
  103. package/skinny/registerSliderOutput.cjs.js.map +1 -1
  104. package/skinny/registerSliderOutput.d.ts +1 -1
  105. package/skinny/registerSliderOutput.esm.js +1 -1
  106. package/skinny/registerSliderOutput.esm.js.map +1 -1
  107. package/skinny/registerSliderThumb.cjs.js +4 -4
  108. package/skinny/registerSliderThumb.cjs.js.map +1 -1
  109. package/skinny/registerSliderThumb.d.ts +3 -3
  110. package/skinny/registerSliderThumb.esm.js +4 -4
  111. package/skinny/registerSliderThumb.esm.js.map +1 -1
  112. package/skinny/registerSliderTrack.cjs.js +188 -16
  113. package/skinny/registerSliderTrack.cjs.js.map +1 -1
  114. package/skinny/registerSliderTrack.d.ts +3 -1
  115. package/skinny/registerSliderTrack.esm.js +184 -13
  116. package/skinny/registerSliderTrack.esm.js.map +1 -1
  117. package/skinny/registerSwitch.cjs.js +10 -4
  118. package/skinny/registerSwitch.cjs.js.map +1 -1
  119. package/skinny/registerSwitch.d.ts +1 -1
  120. package/skinny/registerSwitch.esm.js +10 -4
  121. package/skinny/registerSwitch.esm.js.map +1 -1
  122. package/skinny/registerTextArea.cjs.js +56 -35
  123. package/skinny/registerTextArea.cjs.js.map +1 -1
  124. package/skinny/registerTextArea.d.ts +11 -5
  125. package/skinny/registerTextArea.esm.js +56 -36
  126. package/skinny/registerTextArea.esm.js.map +1 -1
  127. package/skinny/registerTextField.cjs.js +34 -215
  128. package/skinny/registerTextField.cjs.js.map +1 -1
  129. package/skinny/registerTextField.d.ts +3 -3
  130. package/skinny/registerTextField.esm.js +34 -215
  131. package/skinny/registerTextField.esm.js.map +1 -1
  132. package/skinny/utils-a1785802.esm.js.map +1 -1
  133. package/skinny/utils-d3708034.cjs.js.map +1 -1
  134. package/skinny/utils.d.ts +7 -1
  135. package/skinny/common-52c26d37.esm.js +0 -52
  136. package/skinny/common-52c26d37.esm.js.map +0 -1
  137. package/skinny/common-e74a9214.cjs.js +0 -54
  138. package/skinny/common-e74a9214.cjs.js.map +0 -1
  139. package/skinny/contexts-21e0d928.esm.js.map +0 -1
  140. package/skinny/contexts-7236059e.cjs.js.map +0 -1
  141. package/skinny/registerListBox-38a08460.esm.js.map +0 -1
  142. package/skinny/registerListBox-f060da58.cjs.js.map +0 -1
  143. package/skinny/registerSlider-58ef7e20.cjs.js +0 -473
  144. package/skinny/registerSlider-58ef7e20.cjs.js.map +0 -1
  145. package/skinny/registerSlider-d74e2330.esm.js +0 -460
  146. package/skinny/registerSlider-d74e2330.esm.js.map +0 -1
@@ -16,51 +16,400 @@ var React__default = /*#__PURE__*/_interopDefault(React);
16
16
  var registerComponent__default = /*#__PURE__*/_interopDefault(registerComponent);
17
17
  var flattenChildren__default = /*#__PURE__*/_interopDefault(flattenChildren);
18
18
 
19
- function getCommonInputProps(fieldName, fields) {
20
- const commonInputProps = {
21
- name: {
19
+ var __defProp$r = Object.defineProperty;
20
+ var __defProps$e = Object.defineProperties;
21
+ var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
22
+ var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
23
+ var __hasOwnProp$r = Object.prototype.hasOwnProperty;
24
+ var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
25
+ var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
26
+ var __spreadValues$r = (a, b) => {
27
+ for (var prop in b || (b = {}))
28
+ if (__hasOwnProp$r.call(b, prop))
29
+ __defNormalProp$r(a, prop, b[prop]);
30
+ if (__getOwnPropSymbols$r)
31
+ for (var prop of __getOwnPropSymbols$r(b)) {
32
+ if (__propIsEnum$r.call(b, prop))
33
+ __defNormalProp$r(a, prop, b[prop]);
34
+ }
35
+ return a;
36
+ };
37
+ var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
38
+ function registerComponentHelper(loader, component, meta, overrides) {
39
+ if (overrides) {
40
+ meta = __spreadProps$e(__spreadValues$r(__spreadValues$r({}, meta), overrides), {
41
+ props: __spreadValues$r(__spreadValues$r({}, meta.props), overrides.props)
42
+ });
43
+ if (overrides.parentComponentName) {
44
+ meta.name = makeChildComponentName(
45
+ overrides.parentComponentName,
46
+ meta.name
47
+ );
48
+ }
49
+ }
50
+ if (loader) {
51
+ loader.registerComponent(component, meta);
52
+ } else {
53
+ registerComponent__default.default(component, meta);
54
+ }
55
+ return meta;
56
+ }
57
+ function makeComponentName(name) {
58
+ return `plasmic-react-aria-${name}`;
59
+ }
60
+ function makeChildComponentName(fullParentName, fullChildName) {
61
+ if (!fullParentName) {
62
+ return fullChildName;
63
+ }
64
+ return `${fullParentName}-${fullChildName.replace(
65
+ "plasmic-react-aria-",
66
+ ""
67
+ )}`;
68
+ }
69
+ function extractPlasmicDataProps(props) {
70
+ return Object.fromEntries(
71
+ Object.entries(props).filter(([key]) => key.startsWith("data-plasmic-"))
72
+ );
73
+ }
74
+ function withoutNils(array) {
75
+ return array.filter((x) => x != null);
76
+ }
77
+ function isDefined(thing) {
78
+ return thing !== void 0 && thing !== null;
79
+ }
80
+
81
+ function hasParent(_props, ctx) {
82
+ return isDefined(ctx == null ? void 0 : ctx.parent) === true;
83
+ }
84
+ function isParentReadOnly(_props, ctx) {
85
+ var _a;
86
+ return ((_a = ctx == null ? void 0 : ctx.parent) == null ? void 0 : _a.isReadOnly) === true;
87
+ }
88
+ function isParentDisabled(_props, ctx) {
89
+ var _a;
90
+ return ((_a = ctx == null ? void 0 : ctx.parent) == null ? void 0 : _a.isDisabled) === true;
91
+ }
92
+ function resolveAutoComplete(autoCompleteProp) {
93
+ if (typeof autoCompleteProp === "string") {
94
+ return autoCompleteProp;
95
+ }
96
+ if (!autoCompleteProp || !Array.isArray(autoCompleteProp) || autoCompleteProp.includes("off")) {
97
+ return void 0;
98
+ }
99
+ if (autoCompleteProp.includes("off")) {
100
+ return "off";
101
+ }
102
+ if (autoCompleteProp.includes("on") && autoCompleteProp.length === 1) {
103
+ return "on";
104
+ }
105
+ return autoCompleteProp.filter((x) => x !== "on").join(" ");
106
+ }
107
+ function createNameProp() {
108
+ return {
109
+ type: "string",
110
+ description: "Name for this field if it is part of a form",
111
+ hidden: hasParent,
112
+ advanced: true
113
+ };
114
+ }
115
+ function createDisabledProp(componentName) {
116
+ return {
117
+ displayName: "Disabled",
118
+ type: "boolean",
119
+ description: `Whether the ${componentName} is read-only and unfocusable`,
120
+ defaultValueHint: false,
121
+ hidden: isParentDisabled
122
+ };
123
+ }
124
+ function createReadOnlyProp(componentName) {
125
+ return {
126
+ displayName: "Read only",
127
+ type: "boolean",
128
+ description: `Whether the value of this ${componentName} can be changed by the user. Unlike disabled, read-only does not prevent the user from interacting with the component (such as focus).`,
129
+ defaultValueHint: false,
130
+ advanced: true,
131
+ hidden: isParentReadOnly
132
+ };
133
+ }
134
+ function createRequiredProp(componentName) {
135
+ return {
136
+ displayName: "Required",
137
+ type: "boolean",
138
+ description: `Whether user input is required on the ${componentName} before form submission.`,
139
+ defaultValueHint: false,
140
+ advanced: true,
141
+ hidden: hasParent
142
+ };
143
+ }
144
+ function createAutoFocusProp(componentName) {
145
+ return {
146
+ type: "boolean",
147
+ description: `Whether the ${componentName} should be focused when rendered`,
148
+ defaultValueHint: false,
149
+ advanced: true,
150
+ hidden: hasParent
151
+ };
152
+ }
153
+ function createAriaLabelProp(componentName) {
154
+ return {
155
+ type: "string",
156
+ displayName: "Aria Label",
157
+ description: `Label for this ${componentName}, if no visible label is used, to identify the element to assistive technology`,
158
+ advanced: true,
159
+ hidden: hasParent
160
+ };
161
+ }
162
+ function createChildrenProp() {
163
+ return {
164
+ type: "slot",
165
+ mergeWithParent: true
166
+ };
167
+ }
168
+ function getCommonProps(componentName, propNames) {
169
+ const commonProps = {
170
+ name: createNameProp(),
171
+ disabled: createDisabledProp(componentName),
172
+ isDisabled: createDisabledProp(componentName),
173
+ readOnly: createReadOnlyProp(componentName),
174
+ isReadOnly: createReadOnlyProp(componentName),
175
+ autoFocus: createAutoFocusProp(componentName),
176
+ "aria-label": createAriaLabelProp(componentName),
177
+ required: createRequiredProp(componentName),
178
+ isRequired: createRequiredProp(componentName),
179
+ children: createChildrenProp(),
180
+ // NOTE: The following props are only applicable to inputs, textareas, and text fields
181
+ value: {
22
182
  type: "string",
23
- description: "Name for this field if it is part of a form"
183
+ editOnly: true,
184
+ displayName: "Default Value",
185
+ uncontrolledProp: "defaultValue",
186
+ description: `The default value of the ${componentName}`,
187
+ hidden: hasParent
24
188
  },
25
- isDisabled: {
26
- displayName: "Disabled",
27
- type: "boolean",
28
- description: `Whether the ${fieldName} is read-only and unfocusable`,
29
- defaultValueHint: false
189
+ maxLength: {
190
+ type: "number",
191
+ description: "The maximum number of characters supported by the input",
192
+ advanced: true,
193
+ hidden: hasParent
30
194
  },
31
- isReadOnly: {
32
- displayName: "Read only",
33
- type: "boolean",
34
- description: `Whether the value of this ${fieldName} can be changed by the user`,
35
- defaultValueHint: false
195
+ minLength: {
196
+ type: "number",
197
+ description: "The minimum number of characters supported by the input",
198
+ advanced: true,
199
+ hidden: hasParent
36
200
  },
37
- autoFocus: {
38
- type: "boolean",
39
- description: `Whether the ${fieldName} should be focused when rendered`,
40
- defaultValueHint: false,
41
- advanced: true
42
- },
43
- "aria-label": {
201
+ pattern: {
44
202
  type: "string",
45
- displayName: "Aria Label",
46
- description: `Label for this ${fieldName}, if no visible label is used, to identify the element to assistive technology`,
47
- advanced: true
203
+ description: "Regex pattern that the value of the input must match to be valid",
204
+ helpText: "For more information about writing Regular Expressions (regex), check out https://regexr.com/",
205
+ validator: (value) => {
206
+ try {
207
+ new RegExp(value);
208
+ return true;
209
+ } catch (error) {
210
+ return "Invalid Regex";
211
+ }
212
+ },
213
+ advanced: true,
214
+ hidden: hasParent
215
+ },
216
+ type: {
217
+ type: "choice",
218
+ defaultValueHint: "text",
219
+ options: ["text", "search", "url", "tel", "email", "password"],
220
+ description: "The type of data that an input field is expected to handle. It influences the input's behavior, validation, and the kind of interface provided to the user.",
221
+ advanced: true,
222
+ hidden: hasParent
223
+ },
224
+ inputMode: {
225
+ type: "choice",
226
+ description: "hint to browsers as to the type of virtual keyboard configuration to use when editing this element or its contents.",
227
+ options: [
228
+ "none",
229
+ "text",
230
+ "tel",
231
+ "url",
232
+ "email",
233
+ "numeric",
234
+ "decimal",
235
+ "search"
236
+ ],
237
+ hidden: hasParent
238
+ },
239
+ autoComplete: {
240
+ type: "choice",
241
+ advanced: true,
242
+ multiSelect: true,
243
+ hidden: hasParent,
244
+ description: "Guidance as to the type of data expected in the field",
245
+ helpText: "For explanations on what each of the values mean, check https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values",
246
+ options: [
247
+ "on",
248
+ "off",
249
+ "name",
250
+ "honorific-prefix",
251
+ "given-name",
252
+ "additional-name",
253
+ "family-name",
254
+ "honorific-suffix",
255
+ "nickname",
256
+ "email",
257
+ "username",
258
+ "new-password",
259
+ "current-password",
260
+ "one-time-code",
261
+ "organization-title",
262
+ "organization",
263
+ "street-address",
264
+ "shipping",
265
+ "billing",
266
+ "address-line1",
267
+ "address-line2",
268
+ "address-line3",
269
+ "address-level4",
270
+ "address-level3",
271
+ "address-level2",
272
+ "address-level1",
273
+ "country",
274
+ "country-name",
275
+ "postal-code",
276
+ "cc-name",
277
+ "cc-given-name",
278
+ "cc-additional-name",
279
+ "cc-family-name",
280
+ "cc-number",
281
+ "cc-exp",
282
+ "cc-exp-month",
283
+ "cc-exp-year",
284
+ "cc-csc",
285
+ "cc-type",
286
+ "transaction-currency",
287
+ "transaction-amount",
288
+ "language",
289
+ "bday",
290
+ "bday-day",
291
+ "bday-month",
292
+ "bday-year",
293
+ "sex",
294
+ "tel",
295
+ "tel-country-code",
296
+ "tel-national",
297
+ "tel-area-code",
298
+ "tel-local",
299
+ "tel-local-suffix",
300
+ "tel-local-prefix",
301
+ "tel-extension",
302
+ "impp",
303
+ "url",
304
+ "photo",
305
+ "webauthn"
306
+ ]
307
+ },
308
+ validationBehavior: {
309
+ type: "choice",
310
+ options: ["native", "aria"],
311
+ description: "Whether to use native HTML form validation to prevent form submission when the value is missing or invalid, or mark the field as required or invalid via ARIA.",
312
+ defaultValueHint: "native",
313
+ advanced: true,
314
+ hidden: hasParent
315
+ },
316
+ onChange: {
317
+ type: "eventHandler",
318
+ argTypes: [{ name: "value", type: "string" }],
319
+ hidden: hasParent
320
+ },
321
+ onFocus: {
322
+ type: "eventHandler",
323
+ argTypes: [{ name: "focusEvent", type: "object" }],
324
+ advanced: true,
325
+ hidden: hasParent
326
+ },
327
+ onBlur: {
328
+ type: "eventHandler",
329
+ argTypes: [{ name: "focusEvent", type: "object" }],
330
+ advanced: true,
331
+ hidden: hasParent
332
+ },
333
+ onFocusChange: {
334
+ type: "eventHandler",
335
+ argTypes: [{ name: "isFocused", type: "boolean" }],
336
+ advanced: true,
337
+ hidden: hasParent
338
+ },
339
+ onKeyDown: {
340
+ type: "eventHandler",
341
+ argTypes: [{ name: "keyboardEvent", type: "object" }],
342
+ advanced: true,
343
+ hidden: hasParent
344
+ },
345
+ onKeyUp: {
346
+ type: "eventHandler",
347
+ argTypes: [{ name: "keyboardEvent", type: "object" }],
348
+ advanced: true,
349
+ hidden: hasParent
350
+ },
351
+ onCopy: {
352
+ type: "eventHandler",
353
+ argTypes: [{ name: "clipbordEvent", type: "object" }],
354
+ advanced: true,
355
+ hidden: hasParent
48
356
  },
49
- isRequired: {
50
- displayName: "Required",
51
- type: "boolean",
52
- description: `Whether user input is required on the ${fieldName} before form submission.`,
53
- defaultValueHint: false
357
+ onCut: {
358
+ type: "eventHandler",
359
+ argTypes: [{ name: "clipbordEvent", type: "object" }],
360
+ advanced: true,
361
+ hidden: hasParent
54
362
  },
55
- children: {
56
- type: "slot",
57
- mergeWithParent: true
363
+ onPaste: {
364
+ type: "eventHandler",
365
+ argTypes: [{ name: "clipbordEvent", type: "object" }],
366
+ advanced: true,
367
+ hidden: hasParent
368
+ },
369
+ onCompositionStart: {
370
+ type: "eventHandler",
371
+ argTypes: [{ name: "compositionEvent", type: "object" }],
372
+ advanced: true,
373
+ hidden: hasParent
374
+ },
375
+ onCompositionEnd: {
376
+ type: "eventHandler",
377
+ argTypes: [{ name: "compositionEvent", type: "object" }],
378
+ advanced: true,
379
+ hidden: hasParent
380
+ },
381
+ onCompositionUpdate: {
382
+ type: "eventHandler",
383
+ argTypes: [{ name: "compositionEvent", type: "object" }],
384
+ advanced: true,
385
+ hidden: hasParent
386
+ },
387
+ onSelect: {
388
+ type: "eventHandler",
389
+ argTypes: [{ name: "selectionEvent", type: "object" }],
390
+ advanced: true,
391
+ hidden: hasParent
392
+ },
393
+ onBeforeInput: {
394
+ type: "eventHandler",
395
+ argTypes: [{ name: "inputEvent", type: "object" }],
396
+ advanced: true,
397
+ hidden: hasParent
398
+ },
399
+ onInput: {
400
+ type: "eventHandler",
401
+ argTypes: [{ name: "inputEvent", type: "object" }],
402
+ advanced: true,
403
+ hidden: hasParent
404
+ },
405
+ placeholder: {
406
+ type: "string"
58
407
  }
59
408
  };
60
409
  const filteredProps = {};
61
- fields.forEach((field) => {
62
- if (commonInputProps.hasOwnProperty(field)) {
63
- filteredProps[field] = commonInputProps[field];
410
+ propNames.forEach((propName) => {
411
+ if (Object.prototype.hasOwnProperty.call(commonProps, propName)) {
412
+ filteredProps[propName] = commonProps[propName];
64
413
  }
65
414
  });
66
415
  return filteredProps;
@@ -135,68 +484,6 @@ function pickAriaComponentVariants(keys) {
135
484
  };
136
485
  }
137
486
 
138
- var __defProp$r = Object.defineProperty;
139
- var __defProps$e = Object.defineProperties;
140
- var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
141
- var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
142
- var __hasOwnProp$r = Object.prototype.hasOwnProperty;
143
- var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
144
- var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
145
- var __spreadValues$r = (a, b) => {
146
- for (var prop in b || (b = {}))
147
- if (__hasOwnProp$r.call(b, prop))
148
- __defNormalProp$r(a, prop, b[prop]);
149
- if (__getOwnPropSymbols$r)
150
- for (var prop of __getOwnPropSymbols$r(b)) {
151
- if (__propIsEnum$r.call(b, prop))
152
- __defNormalProp$r(a, prop, b[prop]);
153
- }
154
- return a;
155
- };
156
- var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
157
- function registerComponentHelper(loader, component, meta, overrides) {
158
- if (overrides) {
159
- meta = __spreadProps$e(__spreadValues$r(__spreadValues$r({}, meta), overrides), {
160
- props: __spreadValues$r(__spreadValues$r({}, meta.props), overrides.props)
161
- });
162
- if (overrides.parentComponentName) {
163
- meta.name = makeChildComponentName(
164
- overrides.parentComponentName,
165
- meta.name
166
- );
167
- }
168
- }
169
- if (loader) {
170
- loader.registerComponent(component, meta);
171
- } else {
172
- registerComponent__default.default(component, meta);
173
- }
174
- return meta;
175
- }
176
- function makeComponentName(name) {
177
- return `plasmic-react-aria-${name}`;
178
- }
179
- function makeChildComponentName(fullParentName, fullChildName) {
180
- if (!fullParentName) {
181
- return fullChildName;
182
- }
183
- return `${fullParentName}-${fullChildName.replace(
184
- "plasmic-react-aria-",
185
- ""
186
- )}`;
187
- }
188
- function extractPlasmicDataProps(props) {
189
- return Object.fromEntries(
190
- Object.entries(props).filter(([key]) => key.startsWith("data-plasmic-"))
191
- );
192
- }
193
- function withoutNils(array) {
194
- return array.filter((x) => x != null);
195
- }
196
- function isDefined(thing) {
197
- return thing !== void 0 && thing !== null;
198
- }
199
-
200
487
  var __defProp$q = Object.defineProperty;
201
488
  var __defProps$d = Object.defineProperties;
202
489
  var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
@@ -281,7 +568,7 @@ function registerButton(loader, overrides) {
281
568
  padding: "2px 10px",
282
569
  cursor: "pointer"
283
570
  },
284
- props: __spreadProps$d(__spreadValues$q({}, getCommonInputProps("button", [
571
+ props: __spreadProps$d(__spreadValues$q({}, getCommonProps("button", [
285
572
  "isDisabled",
286
573
  "aria-label"
287
574
  ])), {
@@ -327,37 +614,11 @@ const PlasmicDialogTriggerContext = React__default.default.createContext(void 0)
327
614
  const PlasmicSliderContext = React__default.default.createContext(void 0);
328
615
  React__default.default.createContext(void 0);
329
616
  const PlasmicListBoxContext = React__default.default.createContext(void 0);
330
- const PlasmicPopoverContext = React__default.default.createContext(void 0);
331
617
  const PlasmicItemContext = React__default.default.createContext(void 0);
332
618
  const PlasmicSectionContext = React__default.default.createContext(void 0);
333
619
  const PlasmicHeaderContext = React__default.default.createContext(void 0);
334
620
  const PlasmicInputContext = React__default.default.createContext(void 0);
335
621
 
336
- const BaseLabel = reactAriaComponents.Label;
337
- const LABEL_COMPONENT_NAME = makeComponentName("label");
338
- function registerLabel(loader, overrides) {
339
- registerComponentHelper(
340
- loader,
341
- BaseLabel,
342
- {
343
- name: LABEL_COMPONENT_NAME,
344
- displayName: "Aria Label",
345
- importPath: "@plasmicpkgs/react-aria/skinny/registerLabel",
346
- importName: "BaseLabel",
347
- defaultStyles: {
348
- cursor: "pointer"
349
- },
350
- props: {
351
- children: {
352
- type: "slot"
353
- }
354
- },
355
- trapsFocus: true
356
- },
357
- overrides
358
- );
359
- }
360
-
361
622
  var __defProp$p = Object.defineProperty;
362
623
  var __defProps$c = Object.defineProperties;
363
624
  var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
@@ -397,7 +658,8 @@ const CHECKBOX_INTERACTION_VARIANTS = [
397
658
  "indeterminate",
398
659
  "disabled",
399
660
  "selected",
400
- "readonly"
661
+ "readonly",
662
+ "selected"
401
663
  ];
402
664
  const { interactionVariants: interactionVariants$b, withObservedValues: withObservedValues$9 } = pickAriaComponentVariants(
403
665
  CHECKBOX_INTERACTION_VARIANTS
@@ -405,9 +667,8 @@ const { interactionVariants: interactionVariants$b, withObservedValues: withObse
405
667
  function BaseCheckbox(props) {
406
668
  const _a = props, { children, updateInteractionVariant, setControlContextData } = _a, rest = __objRest$j(_a, ["children", "updateInteractionVariant", "setControlContextData"]);
407
669
  const contextProps = React__default.default.useContext(PlasmicCheckboxGroupContext);
408
- const isStandalone = !contextProps;
409
670
  setControlContextData == null ? void 0 : setControlContextData({
410
- isStandalone
671
+ parent: contextProps
411
672
  });
412
673
  return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Checkbox, __spreadValues$p({}, rest), ({
413
674
  isHovered,
@@ -466,14 +727,8 @@ const makeDefaultCheckboxChildren = ({
466
727
  }
467
728
  },
468
729
  {
469
- type: "component",
470
- name: LABEL_COMPONENT_NAME,
471
- props: {
472
- children: {
473
- type: "text",
474
- value: label
475
- }
476
- }
730
+ type: "text",
731
+ value: label
477
732
  }
478
733
  ]
479
734
  },
@@ -495,7 +750,7 @@ function registerCheckbox(loader, overrides) {
495
750
  importPath: "@plasmicpkgs/react-aria/skinny/registerCheckbox",
496
751
  importName: "BaseCheckbox",
497
752
  interactionVariants: interactionVariants$b,
498
- props: __spreadProps$c(__spreadValues$p({}, getCommonInputProps("checkbox", [
753
+ props: __spreadProps$c(__spreadValues$p({}, getCommonProps("checkbox", [
499
754
  "name",
500
755
  "isDisabled",
501
756
  "isReadOnly",
@@ -513,13 +768,15 @@ function registerCheckbox(loader, overrides) {
513
768
  },
514
769
  value: {
515
770
  type: "string",
516
- description: "The value of the input element, used when submitting an HTML form."
771
+ description: 'The value of the checkbox in "selected" state, used when submitting an HTML form.',
772
+ defaultValueHint: "on"
517
773
  },
518
774
  isSelected: {
519
775
  type: "boolean",
776
+ displayName: "Default Selected",
520
777
  editOnly: true,
521
778
  uncontrolledProp: "defaultSelected",
522
- description: "Whether the checkbox is toggled on",
779
+ description: "Whether the checkbox should be selected by default",
523
780
  defaultValueHint: false,
524
781
  defaultValue: false
525
782
  },
@@ -552,7 +809,7 @@ function registerCheckbox(loader, overrides) {
552
809
  valueProp: "isSelected",
553
810
  onChangeProp: "onChange",
554
811
  variableType: "boolean",
555
- hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
812
+ hidden: hasParent
556
813
  }
557
814
  },
558
815
  trapsFocus: true
@@ -818,6 +1075,31 @@ function registerFieldError(loader, overrides) {
818
1075
  );
819
1076
  }
820
1077
 
1078
+ const BaseLabel = reactAriaComponents.Label;
1079
+ const LABEL_COMPONENT_NAME = makeComponentName("label");
1080
+ function registerLabel(loader, overrides) {
1081
+ registerComponentHelper(
1082
+ loader,
1083
+ BaseLabel,
1084
+ {
1085
+ name: LABEL_COMPONENT_NAME,
1086
+ displayName: "Aria Label",
1087
+ importPath: "@plasmicpkgs/react-aria/skinny/registerLabel",
1088
+ importName: "BaseLabel",
1089
+ defaultStyles: {
1090
+ cursor: "pointer"
1091
+ },
1092
+ props: {
1093
+ children: {
1094
+ type: "slot"
1095
+ }
1096
+ },
1097
+ trapsFocus: true
1098
+ },
1099
+ overrides
1100
+ );
1101
+ }
1102
+
821
1103
  var __defProp$l = Object.defineProperty;
822
1104
  var __defProps$a = Object.defineProperties;
823
1105
  var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
@@ -857,8 +1139,8 @@ const { interactionVariants: interactionVariants$a, withObservedValues: withObse
857
1139
  CHECKBOX_GROUP_INTERACTION_VARIANTS
858
1140
  );
859
1141
  function BaseCheckboxGroup(props) {
860
- const _a = props, { children, updateInteractionVariant } = _a; __objRest$g(_a, ["children", "updateInteractionVariant"]);
861
- return /* @__PURE__ */ React__default.default.createElement(PlasmicCheckboxGroupContext.Provider, { value: props }, /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.CheckboxGroup, __spreadValues$l({}, props), ({ isDisabled, isReadOnly }) => withObservedValues$8(
1142
+ const _a = props, { children, updateInteractionVariant } = _a, rest = __objRest$g(_a, ["children", "updateInteractionVariant"]);
1143
+ return /* @__PURE__ */ React__default.default.createElement(PlasmicCheckboxGroupContext.Provider, { value: rest }, /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.CheckboxGroup, __spreadValues$l({}, rest), ({ isDisabled, isReadOnly }) => withObservedValues$8(
862
1144
  children,
863
1145
  {
864
1146
  disabled: isDisabled,
@@ -887,7 +1169,7 @@ function registerCheckboxGroup(loader, overrides) {
887
1169
  importPath: "@plasmicpkgs/react-aria/skinny/registerCheckboxGroup",
888
1170
  importName: "BaseCheckboxGroup",
889
1171
  interactionVariants: interactionVariants$a,
890
- props: __spreadProps$a(__spreadValues$l({}, getCommonInputProps("checkbox group", [
1172
+ props: __spreadProps$a(__spreadValues$l({}, getCommonProps("checkbox group", [
891
1173
  "name",
892
1174
  "isDisabled",
893
1175
  "isReadOnly",
@@ -1203,23 +1485,49 @@ const INPUT_INTERACTION_VARIANTS = [
1203
1485
  const { interactionVariants: interactionVariants$9 } = pickAriaComponentVariants(
1204
1486
  INPUT_INTERACTION_VARIANTS
1205
1487
  );
1488
+ const inputHelpers$1 = {
1489
+ states: {
1490
+ value: {
1491
+ onChangeArgsToValue: (e) => {
1492
+ return e.target.value;
1493
+ }
1494
+ }
1495
+ }
1496
+ };
1206
1497
  function BaseInput(props) {
1207
1498
  var _b;
1208
- const context = React__default.default.useContext(PlasmicTextFieldContext);
1209
- const isStandalone = !context;
1210
- const _a = props, { updateInteractionVariant, setControlContextData, disabled } = _a, rest = __objRest$f(_a, ["updateInteractionVariant", "setControlContextData", "disabled"]);
1499
+ const _a = props, {
1500
+ updateInteractionVariant,
1501
+ setControlContextData,
1502
+ disabled,
1503
+ autoComplete
1504
+ } = _a, rest = __objRest$f(_a, [
1505
+ "updateInteractionVariant",
1506
+ "setControlContextData",
1507
+ "disabled",
1508
+ "autoComplete"
1509
+ ]);
1510
+ const textFieldContext = React__default.default.useContext(PlasmicTextFieldContext);
1511
+ setControlContextData == null ? void 0 : setControlContextData({
1512
+ parent: textFieldContext
1513
+ });
1211
1514
  const mergedProps = reactAria.mergeProps(rest, {
1212
- disabled: (_b = context == null ? void 0 : context.isDisabled) != null ? _b : disabled
1515
+ /**
1516
+ * While react-aria internally does the merging of the disabled prop,
1517
+ * we need to explicity do it here, because react-aria does it behind the scenes,
1518
+ * whereas we need the calculated value of the disabled prop to be able to update the "disabled" interaction variant.
1519
+ * */
1520
+ disabled: (_b = textFieldContext == null ? void 0 : textFieldContext.isDisabled) != null ? _b : disabled
1213
1521
  });
1214
1522
  React.useEffect(() => {
1215
1523
  updateInteractionVariant == null ? void 0 : updateInteractionVariant({
1216
1524
  disabled: mergedProps.disabled
1217
1525
  });
1218
1526
  }, [mergedProps.disabled, updateInteractionVariant]);
1219
- setControlContextData == null ? void 0 : setControlContextData({ isStandalone });
1220
1527
  return /* @__PURE__ */ React__default.default.createElement(
1221
1528
  reactAriaComponents.Input,
1222
1529
  __spreadValues$k({
1530
+ autoComplete: resolveAutoComplete(autoComplete),
1223
1531
  onHoverChange: (isHovered) => {
1224
1532
  updateInteractionVariant == null ? void 0 : updateInteractionVariant({
1225
1533
  hovered: isHovered
@@ -1256,16 +1564,48 @@ function registerInput(loader, overrides) {
1256
1564
  borderColor: "black",
1257
1565
  padding: "2px 10px"
1258
1566
  },
1259
- props: {
1260
- placeholder: {
1261
- type: "string"
1262
- },
1263
- disabled: {
1264
- type: "boolean",
1265
- description: "Whether the input is disabled",
1266
- defaultValueHint: false,
1267
- hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
1268
- }
1567
+ props: __spreadValues$k({}, getCommonProps("Input", [
1568
+ "name",
1569
+ "disabled",
1570
+ "readOnly",
1571
+ "autoFocus",
1572
+ "aria-label",
1573
+ "required",
1574
+ "placeholder",
1575
+ "value",
1576
+ "maxLength",
1577
+ "minLength",
1578
+ "pattern",
1579
+ "type",
1580
+ "inputMode",
1581
+ "autoComplete",
1582
+ "onChange",
1583
+ "onFocus",
1584
+ "onBlur",
1585
+ "onKeyDown",
1586
+ "onKeyUp",
1587
+ "onCopy",
1588
+ "onCut",
1589
+ "onPaste",
1590
+ "onCompositionStart",
1591
+ "onCompositionEnd",
1592
+ "onCompositionUpdate",
1593
+ "onSelect",
1594
+ "onBeforeInput",
1595
+ "onInput"
1596
+ ])),
1597
+ states: {
1598
+ value: __spreadValues$k({
1599
+ type: "writable",
1600
+ valueProp: "value",
1601
+ onChangeProp: "onChange",
1602
+ variableType: "text"
1603
+ }, inputHelpers$1.states.value)
1604
+ },
1605
+ componentHelpers: {
1606
+ helpers: inputHelpers$1,
1607
+ importName: "inputHelpers",
1608
+ importPath: "@plasmicpkgs/react-aria/skinny/registerInput"
1269
1609
  },
1270
1610
  trapsFocus: true
1271
1611
  },
@@ -1502,18 +1842,17 @@ var __objRest$e = (source, exclude) => {
1502
1842
  return target;
1503
1843
  };
1504
1844
  function BaseListBox(props) {
1505
- var _c;
1506
1845
  const contextProps = React__default.default.useContext(PlasmicListBoxContext);
1507
1846
  const isStandalone = !contextProps;
1508
- const _a = props, rest = __objRest$e(_a, ["options"]);
1847
+ const _a = props, { options: _rawOptions, setControlContextData } = _a, rest = __objRest$e(_a, ["options", "setControlContextData"]);
1509
1848
  const { options } = useStrictOptions(props);
1510
1849
  const _b = utils.mergeProps(
1511
1850
  contextProps,
1512
1851
  rest,
1513
1852
  isStandalone ? { items: options } : {}
1514
1853
  ), { renderItem, renderSection } = _b, mergedProps = __objRest$e(_b, ["renderItem", "renderSection"]);
1515
- (_c = props.setControlContextData) == null ? void 0 : _c.call(props, {
1516
- isStandalone
1854
+ setControlContextData == null ? void 0 : setControlContextData({
1855
+ parent: isStandalone ? void 0 : {}
1517
1856
  });
1518
1857
  return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.ListBox, __spreadValues$g({}, mergedProps), (item) => {
1519
1858
  var _a2;
@@ -1559,7 +1898,7 @@ function registerListBox(loader, overrides) {
1559
1898
  props: {
1560
1899
  options: __spreadProps$8(__spreadValues$g({}, makeOptionsPropType()), {
1561
1900
  displayName: "Items",
1562
- hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
1901
+ hidden: hasParent
1563
1902
  }),
1564
1903
  renderItem: {
1565
1904
  type: "slot",
@@ -1622,37 +1961,34 @@ var __objRest$d = (source, exclude) => {
1622
1961
  }
1623
1962
  return target;
1624
1963
  };
1625
- const SHOULD_FLIP_INSIDE_SELECT = false;
1626
1964
  function BasePopover(props) {
1627
1965
  const _a = props, { resetClassName, setControlContextData } = _a, restProps = __objRest$d(_a, ["resetClassName", "setControlContextData"]);
1628
1966
  const isStandalone = !React__default.default.useContext(reactAriaComponents.PopoverContext);
1629
- const contextProps = React__default.default.useContext(PlasmicPopoverContext);
1630
1967
  const isInsideSelect = !!React__default.default.useContext(reactAriaComponents.SelectContext);
1968
+ const triggerRef = React__default.default.useRef(null);
1969
+ const isEditMode = !!host.usePlasmicCanvasContext();
1970
+ const defaultShouldFlip = isInsideSelect ? false : true;
1631
1971
  const mergedProps = utils.mergeProps(
1632
- contextProps,
1972
+ { shouldFlip: defaultShouldFlip },
1973
+ /**
1974
+ * isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies. *
1975
+ *
1976
+ * Setting isNonModal to true in edit mode (canvas) means that the popover will not prevent the user from interacting with the canvas while the popover is open.
1977
+ */
1978
+ isEditMode ? { isNonModal: true } : null,
1633
1979
  restProps,
1634
- {
1635
- className: `${resetClassName}`
1636
- },
1637
- isInsideSelect && !isDefined(restProps.shouldFlip) ? { shouldFlip: SHOULD_FLIP_INSIDE_SELECT } : void 0
1980
+ { className: `${resetClassName}` },
1981
+ // Override some props if the popover is standalone
1982
+ isStandalone ? {
1983
+ triggerRef,
1984
+ isNonModal: true,
1985
+ isOpen: true
1986
+ } : null
1638
1987
  );
1639
- const isEditMode = !!host.usePlasmicCanvasContext();
1640
- const triggerRef = React__default.default.useRef(null);
1641
- const standaloneProps = isStandalone ? {
1642
- triggerRef,
1643
- isNonModal: true,
1644
- isOpen: true
1645
- } : {};
1646
1988
  setControlContextData == null ? void 0 : setControlContextData({
1647
- isStandalone,
1648
- isInsideSelect
1989
+ defaultShouldFlip
1649
1990
  });
1650
- 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(
1651
- reactAriaComponents.Popover,
1652
- __spreadValues$f(__spreadValues$f({
1653
- isNonModal: isEditMode ? true : void 0
1654
- }, mergedProps), standaloneProps)
1655
- ));
1991
+ 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$f({}, mergedProps)));
1656
1992
  }
1657
1993
  const POPOVER_COMPONENT_NAME = makeComponentName("popover");
1658
1994
  const POPOVER_ARROW_IMG = {
@@ -1726,7 +2062,10 @@ function registerPopover(loader, overrides) {
1726
2062
  shouldFlip: {
1727
2063
  type: "boolean",
1728
2064
  description: "Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.",
1729
- defaultValueHint: (_ps, ctx) => (ctx == null ? void 0 : ctx.isInsideSelect) ? SHOULD_FLIP_INSIDE_SELECT : true
2065
+ defaultValueHint: (_ps, ctx) => {
2066
+ var _a;
2067
+ return (_a = ctx == null ? void 0 : ctx.defaultShouldFlip) != null ? _a : true;
2068
+ }
1730
2069
  },
1731
2070
  placement: {
1732
2071
  type: "choice",
@@ -2169,7 +2508,7 @@ const BaseModal = React.forwardRef(
2169
2508
  isOpen: isStandalone ? isOpen : contextProps.isOpen
2170
2509
  });
2171
2510
  setControlContextData == null ? void 0 : setControlContextData({
2172
- isStandalone
2511
+ parent: isStandalone ? void 0 : {}
2173
2512
  });
2174
2513
  React.useImperativeHandle(ref, () => ({
2175
2514
  close: () => {
@@ -2279,7 +2618,7 @@ function registerModal(loader, overrides) {
2279
2618
  uncontrolledProp: "defaultOpen",
2280
2619
  defaultValueHint: false,
2281
2620
  defaultValue: true,
2282
- hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
2621
+ hidden: hasParent
2283
2622
  },
2284
2623
  isDismissable: {
2285
2624
  type: "boolean",
@@ -2300,7 +2639,7 @@ function registerModal(loader, overrides) {
2300
2639
  valueProp: "isOpen",
2301
2640
  onChangeProp: "onOpenChange",
2302
2641
  variableType: "boolean",
2303
- hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
2642
+ hidden: hasParent
2304
2643
  }
2305
2644
  },
2306
2645
  trapsFocus: true
@@ -2517,14 +2856,19 @@ const RADIO_INTERACTION_VARIANTS = [
2517
2856
  "focused",
2518
2857
  "focusVisible",
2519
2858
  "disabled",
2520
- "readonly"
2859
+ "readonly",
2860
+ "selected"
2521
2861
  ];
2522
2862
  const { interactionVariants: interactionVariants$8, withObservedValues: withObservedValues$7 } = pickAriaComponentVariants(
2523
2863
  RADIO_INTERACTION_VARIANTS
2524
2864
  );
2525
2865
  function BaseRadio(props) {
2526
- const _a = props, { children, updateInteractionVariant, setControlContextData } = _a, rest = __objRest$9(_a, ["children", "updateInteractionVariant", "setControlContextData"]);
2866
+ const _a = props, { children, setControlContextData, updateInteractionVariant } = _a, rest = __objRest$9(_a, ["children", "setControlContextData", "updateInteractionVariant"]);
2527
2867
  const contextProps = React__default.default.useContext(PlasmicRadioGroupContext);
2868
+ const isStandalone = !contextProps;
2869
+ setControlContextData == null ? void 0 : setControlContextData({
2870
+ parent: contextProps
2871
+ });
2528
2872
  const radio = /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Radio, __spreadValues$a({}, rest), ({
2529
2873
  isHovered,
2530
2874
  isPressed,
@@ -2546,11 +2890,10 @@ function BaseRadio(props) {
2546
2890
  },
2547
2891
  updateInteractionVariant
2548
2892
  ));
2549
- const isStandalone = !contextProps;
2550
- setControlContextData == null ? void 0 : setControlContextData({
2551
- isStandalone
2552
- });
2553
- return /* @__PURE__ */ React__default.default.createElement(ErrorBoundary, { fallback: /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.RadioGroup, null, radio) }, radio);
2893
+ if (isStandalone) {
2894
+ return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.RadioGroup, null, radio);
2895
+ }
2896
+ return radio;
2554
2897
  }
2555
2898
  const makeDefaultRadioChildren = (label) => ({
2556
2899
  type: "hbox",
@@ -2594,7 +2937,7 @@ function registerRadio(loader, overrides) {
2594
2937
  importPath: "@plasmicpkgs/react-aria/skinny/registerRadio",
2595
2938
  importName: "BaseRadio",
2596
2939
  interactionVariants: interactionVariants$8,
2597
- props: __spreadProps$5(__spreadValues$a({}, getCommonInputProps("radio", [
2940
+ props: __spreadProps$5(__spreadValues$a({}, getCommonProps("radio", [
2598
2941
  "isDisabled",
2599
2942
  "autoFocus",
2600
2943
  "aria-label"
@@ -2607,23 +2950,8 @@ function registerRadio(loader, overrides) {
2607
2950
  value: {
2608
2951
  type: "string",
2609
2952
  description: "The value of the input element, used when submitting an HTML form."
2610
- },
2611
- // Keeping for backwards compatibility reasons
2612
- onSelectionChange: {
2613
- type: "eventHandler",
2614
- argTypes: [{ name: "isSelected", type: "boolean" }],
2615
- hidden: () => true
2616
2953
  }
2617
2954
  }),
2618
- states: {
2619
- // Keeping for backwards compatibility reasons
2620
- isSelected: {
2621
- type: "readonly",
2622
- onChangeProp: "onSelectionChange",
2623
- variableType: "boolean",
2624
- hidden: () => true
2625
- }
2626
- },
2627
2955
  trapsFocus: true
2628
2956
  },
2629
2957
  overrides
@@ -2697,7 +3025,7 @@ function registerRadioGroup(loader, overrides) {
2697
3025
  importPath: "@plasmicpkgs/react-aria/skinny/registerRadioGroup",
2698
3026
  importName: "BaseRadioGroup",
2699
3027
  interactionVariants: interactionVariants$7,
2700
- props: __spreadProps$4(__spreadValues$9({}, getCommonInputProps("radio group", [
3028
+ props: __spreadProps$4(__spreadValues$9({}, getCommonProps("radio group", [
2701
3029
  "name",
2702
3030
  "isDisabled",
2703
3031
  "isReadOnly",
@@ -2768,6 +3096,7 @@ function registerRadioGroup(loader, overrides) {
2768
3096
  value: {
2769
3097
  type: "string",
2770
3098
  editOnly: true,
3099
+ displayName: "Default Value",
2771
3100
  uncontrolledProp: "defaultValue",
2772
3101
  description: "The current value"
2773
3102
  },
@@ -3118,7 +3447,7 @@ function BaseSliderOutput(props) {
3118
3447
  }
3119
3448
  const SLIDER_OUTPUT_COMPONENT_NAME = makeComponentName("sliderOutput");
3120
3449
  function registerSliderOutput(loader, overrides) {
3121
- registerComponentHelper(
3450
+ return registerComponentHelper(
3122
3451
  loader,
3123
3452
  BaseSliderOutput,
3124
3453
  {
@@ -3210,7 +3539,7 @@ function BaseSliderThumb(_a) {
3210
3539
  }
3211
3540
  const SLIDER_THUMB_COMPONENT_NAME = makeComponentName("sliderThumb");
3212
3541
  function registerSliderThumb(loader, overrides) {
3213
- registerComponentHelper(
3542
+ return registerComponentHelper(
3214
3543
  loader,
3215
3544
  BaseSliderThumb,
3216
3545
  {
@@ -3228,7 +3557,7 @@ function registerSliderThumb(loader, overrides) {
3228
3557
  cursor: "pointer"
3229
3558
  },
3230
3559
  interactionVariants: interactionVariants$5,
3231
- props: __spreadProps$3(__spreadValues$6({}, getCommonInputProps("slider thumb", [
3560
+ props: __spreadProps$3(__spreadValues$6({}, getCommonProps("slider thumb", [
3232
3561
  "name",
3233
3562
  "isDisabled",
3234
3563
  "autoFocus"
@@ -3282,52 +3611,59 @@ const { interactionVariants: interactionVariants$4, withObservedValues: withObse
3282
3611
  SLIDER_TRACK_INTERACTION_VARIANTS
3283
3612
  );
3284
3613
  function findMinMaxIndices(values) {
3285
- if (typeof values === "number" || (values == null ? void 0 : values.length) === 0 || !Array.isArray(values)) {
3286
- return { minIndex: 0, maxIndex: 0 };
3287
- }
3288
3614
  let minIndex = 0;
3289
3615
  let maxIndex = 0;
3290
- for (let i = 1; i < values.length; i++) {
3291
- if (values[i] < values[minIndex]) {
3292
- minIndex = i;
3293
- }
3294
- if (values[i] > values[maxIndex]) {
3295
- maxIndex = i;
3616
+ if (Array.isArray(values)) {
3617
+ for (let i = 1; i < values.length; i++) {
3618
+ if (values[i] < values[minIndex]) {
3619
+ minIndex = i;
3620
+ }
3621
+ if (values[i] > values[maxIndex]) {
3622
+ maxIndex = i;
3623
+ }
3296
3624
  }
3297
3625
  }
3298
3626
  return { minIndex, maxIndex };
3299
3627
  }
3628
+ function isMultiValueGuard(value) {
3629
+ return Array.isArray(value) && value.length > 1;
3630
+ }
3300
3631
  function BaseSliderTrack(props) {
3301
3632
  const context = React__default.default.useContext(PlasmicSliderContext);
3633
+ const isStandalone = !context;
3302
3634
  const mergedProps = reactAria.mergeProps(context, props);
3303
- const _a = mergedProps, {
3304
- children,
3305
- progressBar,
3306
- updateInteractionVariant,
3307
- isMultiValue
3308
- } = _a, rest = __objRest$5(_a, [
3309
- "children",
3310
- "progressBar",
3311
- "updateInteractionVariant",
3312
- "isMultiValue"
3313
- ]);
3314
- const { minIndex, maxIndex } = React.useMemo(
3315
- () => findMinMaxIndices(mergedProps.value),
3316
- [mergedProps.value]
3317
- );
3318
- const thumbs = React.useMemo(() => {
3319
- const rawThumbs = flattenChildren__default.default(children);
3320
- const values = Array.isArray(mergedProps == null ? void 0 : mergedProps.value) ? mergedProps.value : [mergedProps.value].filter((v) => v !== void 0);
3321
- const difference = values.length - rawThumbs.length;
3322
- if (!difference) {
3323
- return rawThumbs;
3635
+ const _a = mergedProps, { children, progressBar, updateInteractionVariant } = _a, rest = __objRest$5(_a, ["children", "progressBar", "updateInteractionVariant"]);
3636
+ const isMultiValue = isMultiValueGuard(mergedProps.value);
3637
+ const { minIndex, maxIndex } = React.useMemo(() => {
3638
+ if (!context || !Array.isArray(context.value) || context.value.length <= 1) {
3639
+ return { minIndex: 0, maxIndex: 0 };
3324
3640
  }
3325
- if (difference < 0) {
3326
- return rawThumbs.slice(0, values.length);
3641
+ return findMinMaxIndices(context.value);
3642
+ }, [context == null ? void 0 : context.value]);
3643
+ const thumbs = React.useMemo(() => {
3644
+ const thumbNodes = flattenChildren__default.default(children);
3645
+ if (!thumbNodes || thumbNodes.length === 0 || !isDefined(context == null ? void 0 : context.value)) {
3646
+ return [];
3327
3647
  }
3328
- const lastThumb = rawThumbs[rawThumbs.length - 1];
3329
- return rawThumbs.concat(new Array(difference).fill(lastThumb));
3330
- }, [children, mergedProps.value]);
3648
+ const values = isDefined(context) ? Array.isArray(context.value) ? context.value : [context.value] : [];
3649
+ const lastThumb = thumbNodes[thumbNodes.length - 1];
3650
+ return values.map((v, i) => {
3651
+ const currentThumb = thumbNodes[i];
3652
+ if (i >= thumbNodes.length) {
3653
+ if (React__default.default.isValidElement(lastThumb)) {
3654
+ return React__default.default.cloneElement(lastThumb, {
3655
+ index: i
3656
+ });
3657
+ }
3658
+ }
3659
+ if (!React__default.default.isValidElement(currentThumb)) {
3660
+ return null;
3661
+ }
3662
+ return React__default.default.cloneElement(currentThumb, {
3663
+ index: i
3664
+ });
3665
+ });
3666
+ }, [children, context == null ? void 0 : context.value]);
3331
3667
  const track = /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.SliderTrack, __spreadValues$5({ style: { position: "relative" } }, rest), ({ state, isHovered }) => /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, withObservedValues$3(
3332
3668
  /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement(
3333
3669
  "div",
@@ -3341,28 +3677,20 @@ function BaseSliderTrack(props) {
3341
3677
  }
3342
3678
  },
3343
3679
  progressBar
3344
- ), thumbs.map(
3345
- (thumb, i) => React__default.default.isValidElement(thumb) && React__default.default.cloneElement(thumb, {
3346
- // sets the index of the thumb, so that each thumb reflects the correct value
3347
- index: i
3348
- })
3349
- )),
3680
+ ), thumbs),
3350
3681
  {
3351
3682
  hovered: isHovered
3352
3683
  },
3353
3684
  updateInteractionVariant
3354
3685
  )));
3355
- return /* @__PURE__ */ React__default.default.createElement(
3356
- ErrorBoundary,
3357
- {
3358
- fallback: /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Slider, { style: { height: "100%", width: "100%" } }, track)
3359
- },
3360
- track
3361
- );
3686
+ if (isStandalone) {
3687
+ return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Slider, { style: { height: "100%", width: "100%" } }, track);
3688
+ }
3689
+ return track;
3362
3690
  }
3363
3691
  const SLIDER_TRACK_COMPONENT_NAME = makeComponentName("sliderTrack");
3364
- function registerSliderTrack(loader, overrides) {
3365
- registerComponentHelper(
3692
+ function registerSliderTrack(sliderThumbMeta, loader, overrides) {
3693
+ return registerComponentHelper(
3366
3694
  loader,
3367
3695
  BaseSliderTrack,
3368
3696
  {
@@ -3381,14 +3709,13 @@ function registerSliderTrack(loader, overrides) {
3381
3709
  props: {
3382
3710
  children: {
3383
3711
  type: "slot",
3384
- description: "The thumbs of the slider",
3712
+ displayName: "Thumbs",
3713
+ description: "The thumbs of the slider. For range slider, you can add more than one thumb.",
3714
+ allowedComponents: [sliderThumbMeta.name],
3385
3715
  defaultValue: [
3386
3716
  {
3387
3717
  type: "component",
3388
- name: makeChildComponentName(
3389
- SLIDER_COMPONENT_NAME,
3390
- SLIDER_THUMB_COMPONENT_NAME
3391
- )
3718
+ name: sliderThumbMeta.name
3392
3719
  }
3393
3720
  ]
3394
3721
  },
@@ -3458,106 +3785,101 @@ var __objRest$4 = (source, exclude) => {
3458
3785
  return target;
3459
3786
  };
3460
3787
  const SLIDER_COMPONENT_NAME = makeComponentName("slider");
3788
+ const RANGE_SLIDER_COMPONENT_NAME = makeComponentName("range-slider");
3461
3789
  const SLIDER_INTERACTION_VARIANTS = ["disabled"];
3462
3790
  const { interactionVariants: interactionVariants$3, withObservedValues: withObservedValues$2 } = pickAriaComponentVariants(
3463
3791
  SLIDER_INTERACTION_VARIANTS
3464
3792
  );
3465
- const sliderHelpers = {
3466
- states: {
3467
- range: {
3468
- onChangeArgsToValue: (value, isMultiValue) => {
3469
- if (isMultiValue) {
3470
- return Array.isArray(value) ? value : [value, value + 10];
3471
- }
3472
- return void 0;
3473
- }
3474
- },
3475
- value: {
3476
- onChangeArgsToValue: (value, isMultiValue) => {
3477
- if (isMultiValue) {
3478
- return void 0;
3479
- }
3480
- return Array.isArray(value) ? value[0] : value;
3481
- }
3482
- }
3483
- }
3484
- };
3485
3793
  function BaseSlider(props) {
3486
- const _a = props, {
3487
- range,
3488
- value,
3489
- defaultRange,
3490
- children,
3491
- updateInteractionVariant,
3492
- defaultValue,
3493
- onChange
3494
- } = _a, rest = __objRest$4(_a, [
3495
- "range",
3496
- "value",
3497
- "defaultRange",
3498
- "children",
3499
- "updateInteractionVariant",
3500
- "defaultValue",
3501
- "onChange"
3502
- ]);
3503
- const isFirstRender = React.useRef(true);
3504
- React.useEffect(() => {
3505
- var _a2, _b, _c;
3506
- if (isFirstRender.current) {
3507
- isFirstRender.current = false;
3508
- return;
3509
- }
3510
- if (props.isMultiValue) {
3511
- const minValue = (_a2 = props.minValue) != null ? _a2 : 0;
3512
- (_b = props.onChange) == null ? void 0 : _b.call(
3513
- props,
3514
- Array.isArray(range) && range.length > 1 ? range : [minValue, minValue + 10],
3515
- true
3516
- );
3517
- return;
3518
- }
3519
- (_c = props.onChange) == null ? void 0 : _c.call(props, Array.isArray(value) ? 0 : value != null ? value : 0, false);
3520
- }, [props.isMultiValue]);
3521
- const mergedProps = reactAria.mergeProps(rest, {
3522
- value: props.isMultiValue ? range : value,
3523
- defaultValue: props.isMultiValue ? defaultRange : defaultValue
3524
- });
3525
- return /* @__PURE__ */ React__default.default.createElement(PlasmicSliderContext.Provider, { value: mergedProps }, /* @__PURE__ */ React__default.default.createElement(
3526
- reactAriaComponents.Slider,
3527
- __spreadValues$4({
3528
- key: props.isMultiValue ? "multi" : "single",
3529
- onChange: (newValue) => {
3530
- onChange == null ? void 0 : onChange(newValue, props.isMultiValue);
3531
- }
3532
- }, mergedProps),
3533
- ({ isDisabled }) => withObservedValues$2(
3794
+ const _a = props, { children, updateInteractionVariant } = _a, rest = __objRest$4(_a, ["children", "updateInteractionVariant"]);
3795
+ return /* @__PURE__ */ React__default.default.createElement(
3796
+ PlasmicSliderContext.Provider,
3797
+ {
3798
+ value: __spreadProps$2(__spreadValues$4({}, rest), {
3799
+ // Here's why the type casting is needed here: https://github.com/Microsoft/TypeScript/issues/3410
3800
+ onChange: rest.onChange,
3801
+ onChangeEnd: rest.onChangeEnd
3802
+ })
3803
+ },
3804
+ /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Slider, __spreadValues$4({}, rest), ({ isDisabled }) => withObservedValues$2(
3534
3805
  children,
3535
3806
  {
3536
3807
  disabled: isDisabled
3537
3808
  },
3538
3809
  updateInteractionVariant
3539
- )
3540
- ));
3810
+ ))
3811
+ );
3812
+ }
3813
+ function getCommonSliderProps() {
3814
+ return {
3815
+ orientation: {
3816
+ type: "choice",
3817
+ options: ["horizontal", "vertical"],
3818
+ defaultValueHint: "horizontal",
3819
+ defaultValue: "horizontal"
3820
+ },
3821
+ minValue: {
3822
+ type: "number",
3823
+ description: "The minimum value of the slider",
3824
+ defaultValueHint: 0
3825
+ },
3826
+ maxValue: {
3827
+ type: "number",
3828
+ description: "The maximum value of the slider",
3829
+ defaultValueHint: 100
3830
+ },
3831
+ step: {
3832
+ type: "number",
3833
+ description: "The step value of the slider",
3834
+ defaultValueHint: 1
3835
+ }
3836
+ };
3541
3837
  }
3542
3838
  function registerSlider(loader, overrides) {
3839
+ const sliderOutputMeta = registerSliderOutput(loader, {
3840
+ parentComponentName: SLIDER_COMPONENT_NAME
3841
+ });
3842
+ const sliderThumbMeta = registerSliderThumb(loader, {
3843
+ parentComponentName: SLIDER_COMPONENT_NAME
3844
+ });
3845
+ const sliderTrackMeta = registerSliderTrack(sliderThumbMeta, loader, {
3846
+ parentComponentName: SLIDER_COMPONENT_NAME
3847
+ });
3543
3848
  registerComponentHelper(
3544
3849
  loader,
3545
3850
  BaseSlider,
3546
3851
  {
3547
- name: SLIDER_COMPONENT_NAME,
3548
- displayName: "Aria Slider",
3852
+ name: RANGE_SLIDER_COMPONENT_NAME,
3853
+ displayName: "Aria Range Slider",
3549
3854
  importPath: "@plasmicpkgs/react-aria/skinny/registerSlider",
3550
3855
  importName: "BaseSlider",
3551
3856
  interactionVariants: interactionVariants$3,
3552
3857
  defaultStyles: {
3553
3858
  width: "300px"
3554
3859
  },
3555
- props: __spreadProps$2(__spreadValues$4({}, getCommonInputProps("slider", [
3860
+ props: __spreadProps$2(__spreadValues$4(__spreadValues$4({}, getCommonProps("slider", [
3556
3861
  "isDisabled",
3557
- "name",
3558
- "autoFocus",
3559
3862
  "aria-label"
3560
- ])), {
3863
+ ])), getCommonSliderProps()), {
3864
+ value: {
3865
+ type: "array",
3866
+ editOnly: true,
3867
+ displayName: "Initial value",
3868
+ uncontrolledProp: "defaultValue",
3869
+ description: "The intial value of the slider",
3870
+ defaultValue: [20, 50],
3871
+ validator: (value) => {
3872
+ if (!Array.isArray(value)) {
3873
+ return "Input must be an array.";
3874
+ }
3875
+ for (let i = 1; i < value.length; i++) {
3876
+ if (value[i] < value[i - 1]) {
3877
+ return "Array elements are not in ascending order.";
3878
+ }
3879
+ }
3880
+ return true;
3881
+ }
3882
+ },
3561
3883
  children: {
3562
3884
  type: "slot",
3563
3885
  defaultValue: [
@@ -3581,10 +3903,7 @@ function registerSlider(loader, overrides) {
3581
3903
  },
3582
3904
  {
3583
3905
  type: "component",
3584
- name: makeChildComponentName(
3585
- SLIDER_COMPONENT_NAME,
3586
- SLIDER_OUTPUT_COMPONENT_NAME
3587
- ),
3906
+ name: sliderOutputMeta.name,
3588
3907
  props: {
3589
3908
  children: {
3590
3909
  type: "text",
@@ -3596,49 +3915,102 @@ function registerSlider(loader, overrides) {
3596
3915
  },
3597
3916
  {
3598
3917
  type: "component",
3599
- name: makeChildComponentName(
3600
- SLIDER_COMPONENT_NAME,
3601
- SLIDER_TRACK_COMPONENT_NAME
3602
- )
3918
+ name: sliderTrackMeta.name,
3919
+ props: {
3920
+ children: [
3921
+ {
3922
+ type: "component",
3923
+ name: sliderThumbMeta.name
3924
+ },
3925
+ {
3926
+ type: "component",
3927
+ name: sliderThumbMeta.name,
3928
+ styles: {
3929
+ backgroundColor: "blue"
3930
+ }
3931
+ }
3932
+ ]
3933
+ }
3603
3934
  }
3604
3935
  ]
3605
3936
  },
3606
- orientation: {
3607
- type: "choice",
3608
- options: ["horizontal", "vertical"],
3609
- defaultValueHint: "horizontal",
3610
- defaultValue: "horizontal"
3611
- },
3612
- minValue: {
3613
- type: "number",
3614
- description: "The minimum value of the slider",
3615
- defaultValueHint: 0
3616
- },
3617
- maxValue: {
3618
- type: "number",
3619
- description: "The maximum value of the slider",
3620
- defaultValueHint: 100
3621
- },
3622
- step: {
3623
- type: "number",
3624
- description: "The step value of the slider",
3625
- defaultValueHint: 1
3626
- },
3627
- isMultiValue: {
3628
- type: "boolean",
3629
- displayName: "Multi-valued",
3630
- description: "Whether the slider supports range (multiple thumbs)",
3631
- defaultValue: false,
3632
- defaultValueHint: false
3937
+ onChange: {
3938
+ type: "eventHandler",
3939
+ argTypes: [{ name: "value", type: "object" }]
3633
3940
  },
3634
- range: {
3635
- type: "array",
3636
- editOnly: true,
3637
- uncontrolledProp: "defaultRange",
3638
- description: "The default range of the slider",
3639
- defaultValueHint: [10, 20],
3640
- defaultValue: [10, 20],
3641
- hidden: (ps) => !ps.isMultiValue
3941
+ onChangeEnd: {
3942
+ type: "eventHandler",
3943
+ argTypes: [{ name: "value", type: "object" }]
3944
+ }
3945
+ }),
3946
+ states: {
3947
+ value: {
3948
+ type: "writable",
3949
+ valueProp: "value",
3950
+ onChangeProp: "onChange",
3951
+ variableType: "array"
3952
+ }
3953
+ },
3954
+ trapsFocus: true
3955
+ },
3956
+ {
3957
+ parentComponentName: SLIDER_COMPONENT_NAME
3958
+ }
3959
+ );
3960
+ registerComponentHelper(
3961
+ loader,
3962
+ BaseSlider,
3963
+ {
3964
+ name: SLIDER_COMPONENT_NAME,
3965
+ displayName: "Aria Slider",
3966
+ importPath: "@plasmicpkgs/react-aria/skinny/registerSlider",
3967
+ importName: "BaseSlider",
3968
+ interactionVariants: interactionVariants$3,
3969
+ defaultStyles: {
3970
+ width: "300px"
3971
+ },
3972
+ props: __spreadProps$2(__spreadValues$4(__spreadValues$4({}, getCommonProps("slider", [
3973
+ "isDisabled",
3974
+ "aria-label"
3975
+ ])), getCommonSliderProps()), {
3976
+ children: {
3977
+ type: "slot",
3978
+ defaultValue: [
3979
+ {
3980
+ type: "hbox",
3981
+ styles: {
3982
+ width: "stretch",
3983
+ justifyContent: "space-between",
3984
+ padding: "8px 0px"
3985
+ },
3986
+ children: [
3987
+ {
3988
+ type: "component",
3989
+ name: LABEL_COMPONENT_NAME,
3990
+ props: {
3991
+ children: {
3992
+ type: "text",
3993
+ value: "Label"
3994
+ }
3995
+ }
3996
+ },
3997
+ {
3998
+ type: "component",
3999
+ name: sliderOutputMeta.name,
4000
+ props: {
4001
+ children: {
4002
+ type: "text",
4003
+ value: "Output"
4004
+ }
4005
+ }
4006
+ }
4007
+ ]
4008
+ },
4009
+ {
4010
+ type: "component",
4011
+ name: sliderTrackMeta.name
4012
+ }
4013
+ ]
3642
4014
  },
3643
4015
  value: {
3644
4016
  type: "number",
@@ -3646,52 +4018,29 @@ function registerSlider(loader, overrides) {
3646
4018
  uncontrolledProp: "defaultValue",
3647
4019
  description: "The default value of the slider",
3648
4020
  defaultValueHint: 0,
3649
- defaultValue: 0,
3650
- hidden: (ps) => Boolean(ps.isMultiValue)
4021
+ defaultValue: 0
3651
4022
  },
3652
4023
  onChange: {
3653
4024
  type: "eventHandler",
3654
- argTypes: [{ name: "value", type: "object" }]
4025
+ argTypes: [{ name: "value", type: "number" }]
3655
4026
  },
3656
4027
  onChangeEnd: {
3657
4028
  type: "eventHandler",
3658
- argTypes: [{ name: "value", type: "object" }]
4029
+ argTypes: [{ name: "value", type: "number" }]
3659
4030
  }
3660
4031
  }),
3661
4032
  states: {
3662
- range: __spreadValues$4({
3663
- type: "writable",
3664
- valueProp: "range",
3665
- onChangeProp: "onChange",
3666
- variableType: "array",
3667
- hidden: (ps) => !ps.isMultiValue
3668
- }, sliderHelpers.states.range),
3669
- value: __spreadValues$4({
4033
+ value: {
3670
4034
  type: "writable",
3671
4035
  valueProp: "value",
3672
4036
  onChangeProp: "onChange",
3673
- variableType: "number",
3674
- hidden: (ps) => Boolean(ps.isMultiValue)
3675
- }, sliderHelpers.states.value)
3676
- },
3677
- componentHelpers: {
3678
- helpers: sliderHelpers,
3679
- importName: "sliderHelpers",
3680
- importPath: "@plasmicpkgs/react-aria/skinny/registerSlider"
4037
+ variableType: "number"
4038
+ }
3681
4039
  },
3682
4040
  trapsFocus: true
3683
4041
  },
3684
4042
  overrides
3685
4043
  );
3686
- registerSliderOutput(loader, {
3687
- parentComponentName: SLIDER_COMPONENT_NAME
3688
- });
3689
- registerSliderThumb(loader, {
3690
- parentComponentName: SLIDER_COMPONENT_NAME
3691
- });
3692
- registerSliderTrack(loader, {
3693
- parentComponentName: SLIDER_COMPONENT_NAME
3694
- });
3695
4044
  }
3696
4045
 
3697
4046
  var __defProp$3 = Object.defineProperty;
@@ -3778,7 +4127,7 @@ function registerSwitch(loader, overrides) {
3778
4127
  justifyContent: "flex-start",
3779
4128
  padding: 0
3780
4129
  },
3781
- props: __spreadProps$1(__spreadValues$3({}, getCommonInputProps("switch", [
4130
+ props: __spreadProps$1(__spreadValues$3({}, getCommonProps("switch", [
3782
4131
  "name",
3783
4132
  "isDisabled",
3784
4133
  "isReadOnly",
@@ -3857,10 +4206,16 @@ function registerSwitch(loader, overrides) {
3857
4206
  ]
3858
4207
  },
3859
4208
  value: {
4209
+ type: "string",
4210
+ description: 'The value of the switch in "selected" state, used when submitting an HTML form.',
4211
+ defaultValueHint: "on"
4212
+ },
4213
+ isSelected: {
3860
4214
  type: "boolean",
3861
4215
  editOnly: true,
4216
+ displayName: "Default Selected",
3862
4217
  uncontrolledProp: "defaultSelected",
3863
- description: "Whether the switch is toggled on",
4218
+ description: "Whether the switch should be selected by default",
3864
4219
  defaultValueHint: false
3865
4220
  },
3866
4221
  onChange: {
@@ -3871,7 +4226,7 @@ function registerSwitch(loader, overrides) {
3871
4226
  states: {
3872
4227
  isSelected: {
3873
4228
  type: "writable",
3874
- valueProp: "value",
4229
+ valueProp: "isSelected",
3875
4230
  onChangeProp: "onChange",
3876
4231
  variableType: "boolean"
3877
4232
  }
@@ -3918,20 +4273,30 @@ const TEXTAREA_INTERACTION_VARIANTS = [
3918
4273
  const { interactionVariants: interactionVariants$1 } = pickAriaComponentVariants(
3919
4274
  TEXTAREA_INTERACTION_VARIANTS
3920
4275
  );
4276
+ const inputHelpers = {
4277
+ states: {
4278
+ value: {
4279
+ onChangeArgsToValue: (e) => {
4280
+ return e.target.value;
4281
+ }
4282
+ }
4283
+ }
4284
+ };
3921
4285
  function BaseTextArea(props) {
3922
4286
  var _b;
3923
4287
  const _a = props, { disabled, updateInteractionVariant, setControlContextData } = _a, rest = __objRest$2(_a, ["disabled", "updateInteractionVariant", "setControlContextData"]);
3924
- const context = React__default.default.useContext(PlasmicTextFieldContext);
3925
- const isStandalone = !context;
4288
+ const textFieldContext = React__default.default.useContext(PlasmicTextFieldContext);
3926
4289
  const mergedProps = reactAria.mergeProps(rest, {
3927
- disabled: (_b = context == null ? void 0 : context.isDisabled) != null ? _b : disabled
4290
+ disabled: (_b = textFieldContext == null ? void 0 : textFieldContext.isDisabled) != null ? _b : disabled
3928
4291
  });
3929
4292
  React.useEffect(() => {
3930
4293
  updateInteractionVariant == null ? void 0 : updateInteractionVariant({
3931
4294
  disabled: mergedProps.disabled
3932
4295
  });
3933
4296
  }, [mergedProps.disabled, updateInteractionVariant]);
3934
- setControlContextData == null ? void 0 : setControlContextData({ isStandalone });
4297
+ setControlContextData == null ? void 0 : setControlContextData({
4298
+ parent: textFieldContext
4299
+ });
3935
4300
  return /* @__PURE__ */ React__default.default.createElement(
3936
4301
  reactAriaComponents.TextArea,
3937
4302
  __spreadValues$2({
@@ -3963,36 +4328,45 @@ function registerTextArea(loader, overrides) {
3963
4328
  importPath: "@plasmicpkgs/react-aria/skinny/registerTextArea",
3964
4329
  importName: "BaseTextArea",
3965
4330
  interactionVariants: interactionVariants$1,
3966
- props: {
3967
- placeholder: {
3968
- type: "string"
3969
- },
3970
- disabled: {
3971
- type: "boolean",
3972
- description: "Whether the input is disabled",
3973
- defaultValueHint: false,
3974
- hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
3975
- },
3976
- onKeyDown: {
3977
- type: "eventHandler",
3978
- argTypes: [{ name: "keyboardEvent", type: "object" }]
3979
- },
3980
- onKeyUp: {
3981
- type: "eventHandler",
3982
- argTypes: [{ name: "keyboardEvent", type: "object" }]
3983
- },
3984
- onCopy: {
3985
- type: "eventHandler",
3986
- argTypes: [{ name: "clipbordEvent", type: "object" }]
3987
- },
3988
- onCut: {
3989
- type: "eventHandler",
3990
- argTypes: [{ name: "clipbordEvent", type: "object" }]
3991
- },
3992
- onPaste: {
3993
- type: "eventHandler",
3994
- argTypes: [{ name: "clipbordEvent", type: "object" }]
3995
- }
4331
+ props: __spreadValues$2({}, getCommonProps("Text Area", [
4332
+ "name",
4333
+ "disabled",
4334
+ "readOnly",
4335
+ "autoFocus",
4336
+ "aria-label",
4337
+ "required",
4338
+ "placeholder",
4339
+ "value",
4340
+ "maxLength",
4341
+ "minLength",
4342
+ "inputMode",
4343
+ "onChange",
4344
+ "onFocus",
4345
+ "onBlur",
4346
+ "onKeyDown",
4347
+ "onKeyUp",
4348
+ "onCopy",
4349
+ "onCut",
4350
+ "onPaste",
4351
+ "onCompositionStart",
4352
+ "onCompositionEnd",
4353
+ "onCompositionUpdate",
4354
+ "onSelect",
4355
+ "onBeforeInput",
4356
+ "onInput"
4357
+ ])),
4358
+ states: {
4359
+ value: __spreadValues$2({
4360
+ type: "writable",
4361
+ valueProp: "value",
4362
+ onChangeProp: "onChange",
4363
+ variableType: "text"
4364
+ }, inputHelpers.states.value)
4365
+ },
4366
+ componentHelpers: {
4367
+ helpers: inputHelpers,
4368
+ importName: "inputHelpers",
4369
+ importPath: "@plasmicpkgs/react-aria/skinny/registerTextArea"
3996
4370
  },
3997
4371
  trapsFocus: true
3998
4372
  },
@@ -4039,31 +4413,15 @@ const { interactionVariants, withObservedValues } = pickAriaComponentVariants(
4039
4413
  TEXT_FIELD_INTERACTION_VARIANTS
4040
4414
  );
4041
4415
  function BaseTextField(props) {
4042
- const _a = props, {
4043
- enableAutoComplete,
4044
- autoComplete,
4416
+ const _a = props, { children, updateInteractionVariant, autoComplete } = _a, rest = __objRest$1(_a, ["children", "updateInteractionVariant", "autoComplete"]);
4417
+ return /* @__PURE__ */ React__default.default.createElement(PlasmicTextFieldContext.Provider, { value: props }, /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.TextField, __spreadValues$1({ autoComplete: resolveAutoComplete(autoComplete) }, rest), ({ isDisabled, isReadOnly }) => withObservedValues(
4045
4418
  children,
4419
+ {
4420
+ disabled: isDisabled,
4421
+ readonly: isReadOnly
4422
+ },
4046
4423
  updateInteractionVariant
4047
- } = _a, rest = __objRest$1(_a, [
4048
- "enableAutoComplete",
4049
- "autoComplete",
4050
- "children",
4051
- "updateInteractionVariant"
4052
- ]);
4053
- return /* @__PURE__ */ React__default.default.createElement(PlasmicTextFieldContext.Provider, { value: props }, /* @__PURE__ */ React__default.default.createElement(
4054
- reactAriaComponents.TextField,
4055
- __spreadValues$1({
4056
- autoComplete: enableAutoComplete ? autoComplete : void 0
4057
- }, rest),
4058
- ({ isDisabled, isReadOnly }) => withObservedValues(
4059
- children,
4060
- {
4061
- disabled: isDisabled,
4062
- readonly: isReadOnly
4063
- },
4064
- updateInteractionVariant
4065
- )
4066
- ));
4424
+ )));
4067
4425
  }
4068
4426
  const TEXT_FIELD_COMPONENT_NAME = makeComponentName("textField");
4069
4427
  function registerTextField(loader, overrides) {
@@ -4077,13 +4435,36 @@ function registerTextField(loader, overrides) {
4077
4435
  importName: "BaseTextField",
4078
4436
  interactionVariants,
4079
4437
  // TODO: Support for validate prop
4080
- props: __spreadProps(__spreadValues$1({}, getCommonInputProps("input", [
4438
+ props: __spreadProps(__spreadValues$1({}, getCommonProps("Text Field", [
4081
4439
  "name",
4082
4440
  "isDisabled",
4083
4441
  "isReadOnly",
4084
4442
  "autoFocus",
4085
4443
  "aria-label",
4086
- "isRequired"
4444
+ "isRequired",
4445
+ "value",
4446
+ "maxLength",
4447
+ "minLength",
4448
+ "pattern",
4449
+ "type",
4450
+ "inputMode",
4451
+ "validationBehavior",
4452
+ "autoComplete",
4453
+ "onChange",
4454
+ "onFocus",
4455
+ "onBlur",
4456
+ "onFocusChange",
4457
+ "onKeyDown",
4458
+ "onKeyUp",
4459
+ "onCopy",
4460
+ "onCut",
4461
+ "onPaste",
4462
+ "onCompositionStart",
4463
+ "onCompositionEnd",
4464
+ "onCompositionUpdate",
4465
+ "onSelect",
4466
+ "onBeforeInput",
4467
+ "onInput"
4087
4468
  ])), {
4088
4469
  children: {
4089
4470
  type: "slot",
@@ -4127,12 +4508,6 @@ function registerTextField(loader, overrides) {
4127
4508
  ]
4128
4509
  }
4129
4510
  },
4130
- value: {
4131
- type: "string",
4132
- editOnly: true,
4133
- uncontrolledProp: "defaultValue",
4134
- description: "The current value"
4135
- },
4136
4511
  isInvalid: {
4137
4512
  // TODO: Not sure if needed
4138
4513
  displayName: "Invalid",
@@ -4144,190 +4519,8 @@ function registerTextField(loader, overrides) {
4144
4519
  // TODO: Not sure if needed
4145
4520
  type: "array",
4146
4521
  description: "Errors for custom validation"
4147
- },
4148
- // validate: {
4149
- // type: "function" as const,
4150
- // argNames: ["value"],
4151
- // argValues: (_ps: any, ctx: any) => [ctx.data[0]],
4152
- // },
4153
- enableAutoComplete: {
4154
- type: "boolean",
4155
- description: "Whether the browser is allowed to automatically complete the input",
4156
- defaultValueHint: false
4157
- },
4158
- autoComplete: {
4159
- type: "choice",
4160
- hidden: ({ enableAutoComplete }) => !enableAutoComplete,
4161
- description: "Guidance as to the type of data expected in the field",
4162
- helpText: "For explanations on what each of the values mean, check https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values",
4163
- options: [
4164
- "name",
4165
- "honorific-prefix",
4166
- "given-name",
4167
- "additional-name",
4168
- "family-name",
4169
- "honorific-suffix",
4170
- "nickname",
4171
- "email",
4172
- "username",
4173
- "new-password",
4174
- "current-password",
4175
- "one-time-code",
4176
- "organization-title",
4177
- "organization",
4178
- "street-address",
4179
- "shipping",
4180
- "billing",
4181
- "address-line1",
4182
- "address-line2",
4183
- "address-line3",
4184
- "address-level4",
4185
- "address-level3",
4186
- "address-level2",
4187
- "address-level1",
4188
- "country",
4189
- "country-name",
4190
- "postal-code",
4191
- "cc-name",
4192
- "cc-given-name",
4193
- "cc-additional-name",
4194
- "cc-family-name",
4195
- "cc-number",
4196
- "cc-exp",
4197
- "cc-exp-month",
4198
- "cc-exp-year",
4199
- "cc-csc",
4200
- "cc-type",
4201
- "transaction-currency",
4202
- "transaction-amount",
4203
- "language",
4204
- "bday",
4205
- "bday-day",
4206
- "bday-month",
4207
- "bday-year",
4208
- "sex",
4209
- "tel",
4210
- "tel-country-code",
4211
- "tel-national",
4212
- "tel-area-code",
4213
- "tel-local",
4214
- "tel-local-suffix",
4215
- "tel-local-prefix",
4216
- "tel-extension",
4217
- "impp",
4218
- "url",
4219
- "photo",
4220
- "webauthn"
4221
- ]
4222
- },
4223
- maxLength: {
4224
- type: "number",
4225
- description: "The maximum number of characters supported by the input"
4226
- },
4227
- minLength: {
4228
- type: "number",
4229
- description: "The minimum number of characters supported by the input"
4230
- },
4231
- pattern: {
4232
- type: "string",
4233
- description: "Regex pattern that the value of the input must match to be valid",
4234
- helpText: "For more information about writing Regular Expressions (regex), check out https://regexr.com/",
4235
- validator: (value) => {
4236
- try {
4237
- new RegExp(value);
4238
- return true;
4239
- } catch (error) {
4240
- return "Invalid Regex";
4241
- }
4242
- }
4243
- },
4244
- type: {
4245
- type: "choice",
4246
- defaultValueHint: "text",
4247
- options: ["text", "search", "url", "tel", "email", "password"]
4248
- },
4249
- inputMode: {
4250
- type: "choice",
4251
- description: "hint to browsers as to the type of virtual keyboard configuration to use when editing this element or its contents.",
4252
- options: [
4253
- "none",
4254
- "text",
4255
- "tel",
4256
- "url",
4257
- "email",
4258
- "numeric",
4259
- "decimal",
4260
- "search"
4261
- ]
4262
- },
4263
- validationBehavior: {
4264
- type: "choice",
4265
- options: ["native", "aria"],
4266
- description: "Whether to use native HTML form validation to prevent form submission when the value is missing or invalid, or mark the field as required or invalid via ARIA.",
4267
- defaultValueHint: "native"
4268
- },
4269
- onChange: {
4270
- type: "eventHandler",
4271
- argTypes: [{ name: "value", type: "string" }]
4272
- },
4273
- onFocus: {
4274
- type: "eventHandler",
4275
- argTypes: [{ name: "focusEvent", type: "object" }]
4276
- },
4277
- onBlur: {
4278
- type: "eventHandler",
4279
- argTypes: [{ name: "focusEvent", type: "object" }]
4280
- },
4281
- onFocusChange: {
4282
- type: "eventHandler",
4283
- argTypes: [{ name: "isFocused", type: "boolean" }]
4284
- },
4285
- onKeyDown: {
4286
- type: "eventHandler",
4287
- argTypes: [{ name: "keyboardEvent", type: "object" }]
4288
- },
4289
- onKeyUp: {
4290
- type: "eventHandler",
4291
- argTypes: [{ name: "keyboardEvent", type: "object" }]
4292
- },
4293
- onCopy: {
4294
- type: "eventHandler",
4295
- argTypes: [{ name: "clipbordEvent", type: "object" }]
4296
- },
4297
- onCut: {
4298
- type: "eventHandler",
4299
- argTypes: [{ name: "clipbordEvent", type: "object" }]
4300
- },
4301
- onPaste: {
4302
- type: "eventHandler",
4303
- argTypes: [{ name: "clipbordEvent", type: "object" }]
4304
- },
4305
- onCompositionStart: {
4306
- type: "eventHandler",
4307
- argTypes: [{ name: "compositionEvent", type: "object" }]
4308
- },
4309
- onCompositionEnd: {
4310
- type: "eventHandler",
4311
- argTypes: [{ name: "compositionEvent", type: "object" }]
4312
- },
4313
- onCompositionUpdate: {
4314
- type: "eventHandler",
4315
- argTypes: [{ name: "compositionEvent", type: "object" }]
4316
- },
4317
- onSelect: {
4318
- type: "eventHandler",
4319
- argTypes: [{ name: "selectionEvent", type: "object" }]
4320
- },
4321
- onBeforeInput: {
4322
- type: "eventHandler",
4323
- argTypes: [{ name: "inputEvent", type: "object" }]
4324
- },
4325
- onInput: {
4326
- type: "eventHandler",
4327
- argTypes: [{ name: "inputEvent", type: "object" }]
4328
4522
  }
4329
4523
  }),
4330
- // NOTE: React-Aria does not support render props for <Input> and <Textarea>, so focusVisible and inputHovered states are not implemented
4331
4524
  states: {
4332
4525
  value: {
4333
4526
  type: "writable",