@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
@@ -1,5 +1,5 @@
1
- import React, { useEffect, Component, forwardRef, useImperativeHandle, useMemo, useRef } from 'react';
2
- import { Button, Label, Checkbox, Text, FieldError, CheckboxGroup, Input, ListBoxItem, ListBox, Header, Section, Collection, PopoverContext, SelectContext, Popover, ComboBox, ComboBoxStateContext, Heading, ModalOverlay, Modal, Dialog, DialogTrigger, Form, Radio, RadioGroup, Select, SelectValue, SliderOutput, SliderThumb, Slider, SliderTrack, Switch, TextArea, TextField } from 'react-aria-components';
1
+ import React, { useEffect, Component, forwardRef, useImperativeHandle, useMemo } from 'react';
2
+ import { Button, Checkbox, Text, FieldError, Label, CheckboxGroup, Input, ListBoxItem, ListBox, Header, Section, Collection, PopoverContext, SelectContext, Popover, ComboBox, ComboBoxStateContext, Heading, ModalOverlay, Modal, Dialog, DialogTrigger, Form, Radio, RadioGroup, Select, SelectValue, SliderOutput, SliderThumb, Slider, SliderTrack, Switch, TextArea, TextField } from 'react-aria-components';
3
3
  import registerComponent from '@plasmicapp/host/registerComponent';
4
4
  import { useFilter } from '@react-aria/i18n';
5
5
  import { mergeProps, useTooltipTrigger } from 'react-aria';
@@ -8,51 +8,400 @@ import { usePlasmicCanvasContext } from '@plasmicapp/host';
8
8
  import flattenChildren from 'react-keyed-flatten-children';
9
9
  import { useTooltipTriggerState } from 'react-stately';
10
10
 
11
- function getCommonInputProps(fieldName, fields) {
12
- const commonInputProps = {
13
- name: {
11
+ var __defProp$r = Object.defineProperty;
12
+ var __defProps$e = Object.defineProperties;
13
+ var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
14
+ var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
15
+ var __hasOwnProp$r = Object.prototype.hasOwnProperty;
16
+ var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
17
+ var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18
+ var __spreadValues$r = (a, b) => {
19
+ for (var prop in b || (b = {}))
20
+ if (__hasOwnProp$r.call(b, prop))
21
+ __defNormalProp$r(a, prop, b[prop]);
22
+ if (__getOwnPropSymbols$r)
23
+ for (var prop of __getOwnPropSymbols$r(b)) {
24
+ if (__propIsEnum$r.call(b, prop))
25
+ __defNormalProp$r(a, prop, b[prop]);
26
+ }
27
+ return a;
28
+ };
29
+ var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
30
+ function registerComponentHelper(loader, component, meta, overrides) {
31
+ if (overrides) {
32
+ meta = __spreadProps$e(__spreadValues$r(__spreadValues$r({}, meta), overrides), {
33
+ props: __spreadValues$r(__spreadValues$r({}, meta.props), overrides.props)
34
+ });
35
+ if (overrides.parentComponentName) {
36
+ meta.name = makeChildComponentName(
37
+ overrides.parentComponentName,
38
+ meta.name
39
+ );
40
+ }
41
+ }
42
+ if (loader) {
43
+ loader.registerComponent(component, meta);
44
+ } else {
45
+ registerComponent(component, meta);
46
+ }
47
+ return meta;
48
+ }
49
+ function makeComponentName(name) {
50
+ return `plasmic-react-aria-${name}`;
51
+ }
52
+ function makeChildComponentName(fullParentName, fullChildName) {
53
+ if (!fullParentName) {
54
+ return fullChildName;
55
+ }
56
+ return `${fullParentName}-${fullChildName.replace(
57
+ "plasmic-react-aria-",
58
+ ""
59
+ )}`;
60
+ }
61
+ function extractPlasmicDataProps(props) {
62
+ return Object.fromEntries(
63
+ Object.entries(props).filter(([key]) => key.startsWith("data-plasmic-"))
64
+ );
65
+ }
66
+ function withoutNils(array) {
67
+ return array.filter((x) => x != null);
68
+ }
69
+ function isDefined(thing) {
70
+ return thing !== void 0 && thing !== null;
71
+ }
72
+
73
+ function hasParent(_props, ctx) {
74
+ return isDefined(ctx == null ? void 0 : ctx.parent) === true;
75
+ }
76
+ function isParentReadOnly(_props, ctx) {
77
+ var _a;
78
+ return ((_a = ctx == null ? void 0 : ctx.parent) == null ? void 0 : _a.isReadOnly) === true;
79
+ }
80
+ function isParentDisabled(_props, ctx) {
81
+ var _a;
82
+ return ((_a = ctx == null ? void 0 : ctx.parent) == null ? void 0 : _a.isDisabled) === true;
83
+ }
84
+ function resolveAutoComplete(autoCompleteProp) {
85
+ if (typeof autoCompleteProp === "string") {
86
+ return autoCompleteProp;
87
+ }
88
+ if (!autoCompleteProp || !Array.isArray(autoCompleteProp) || autoCompleteProp.includes("off")) {
89
+ return void 0;
90
+ }
91
+ if (autoCompleteProp.includes("off")) {
92
+ return "off";
93
+ }
94
+ if (autoCompleteProp.includes("on") && autoCompleteProp.length === 1) {
95
+ return "on";
96
+ }
97
+ return autoCompleteProp.filter((x) => x !== "on").join(" ");
98
+ }
99
+ function createNameProp() {
100
+ return {
101
+ type: "string",
102
+ description: "Name for this field if it is part of a form",
103
+ hidden: hasParent,
104
+ advanced: true
105
+ };
106
+ }
107
+ function createDisabledProp(componentName) {
108
+ return {
109
+ displayName: "Disabled",
110
+ type: "boolean",
111
+ description: `Whether the ${componentName} is read-only and unfocusable`,
112
+ defaultValueHint: false,
113
+ hidden: isParentDisabled
114
+ };
115
+ }
116
+ function createReadOnlyProp(componentName) {
117
+ return {
118
+ displayName: "Read only",
119
+ type: "boolean",
120
+ 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).`,
121
+ defaultValueHint: false,
122
+ advanced: true,
123
+ hidden: isParentReadOnly
124
+ };
125
+ }
126
+ function createRequiredProp(componentName) {
127
+ return {
128
+ displayName: "Required",
129
+ type: "boolean",
130
+ description: `Whether user input is required on the ${componentName} before form submission.`,
131
+ defaultValueHint: false,
132
+ advanced: true,
133
+ hidden: hasParent
134
+ };
135
+ }
136
+ function createAutoFocusProp(componentName) {
137
+ return {
138
+ type: "boolean",
139
+ description: `Whether the ${componentName} should be focused when rendered`,
140
+ defaultValueHint: false,
141
+ advanced: true,
142
+ hidden: hasParent
143
+ };
144
+ }
145
+ function createAriaLabelProp(componentName) {
146
+ return {
147
+ type: "string",
148
+ displayName: "Aria Label",
149
+ description: `Label for this ${componentName}, if no visible label is used, to identify the element to assistive technology`,
150
+ advanced: true,
151
+ hidden: hasParent
152
+ };
153
+ }
154
+ function createChildrenProp() {
155
+ return {
156
+ type: "slot",
157
+ mergeWithParent: true
158
+ };
159
+ }
160
+ function getCommonProps(componentName, propNames) {
161
+ const commonProps = {
162
+ name: createNameProp(),
163
+ disabled: createDisabledProp(componentName),
164
+ isDisabled: createDisabledProp(componentName),
165
+ readOnly: createReadOnlyProp(componentName),
166
+ isReadOnly: createReadOnlyProp(componentName),
167
+ autoFocus: createAutoFocusProp(componentName),
168
+ "aria-label": createAriaLabelProp(componentName),
169
+ required: createRequiredProp(componentName),
170
+ isRequired: createRequiredProp(componentName),
171
+ children: createChildrenProp(),
172
+ // NOTE: The following props are only applicable to inputs, textareas, and text fields
173
+ value: {
14
174
  type: "string",
15
- description: "Name for this field if it is part of a form"
175
+ editOnly: true,
176
+ displayName: "Default Value",
177
+ uncontrolledProp: "defaultValue",
178
+ description: `The default value of the ${componentName}`,
179
+ hidden: hasParent
16
180
  },
17
- isDisabled: {
18
- displayName: "Disabled",
19
- type: "boolean",
20
- description: `Whether the ${fieldName} is read-only and unfocusable`,
21
- defaultValueHint: false
181
+ maxLength: {
182
+ type: "number",
183
+ description: "The maximum number of characters supported by the input",
184
+ advanced: true,
185
+ hidden: hasParent
22
186
  },
23
- isReadOnly: {
24
- displayName: "Read only",
25
- type: "boolean",
26
- description: `Whether the value of this ${fieldName} can be changed by the user`,
27
- defaultValueHint: false
187
+ minLength: {
188
+ type: "number",
189
+ description: "The minimum number of characters supported by the input",
190
+ advanced: true,
191
+ hidden: hasParent
28
192
  },
29
- autoFocus: {
30
- type: "boolean",
31
- description: `Whether the ${fieldName} should be focused when rendered`,
32
- defaultValueHint: false,
33
- advanced: true
34
- },
35
- "aria-label": {
193
+ pattern: {
36
194
  type: "string",
37
- displayName: "Aria Label",
38
- description: `Label for this ${fieldName}, if no visible label is used, to identify the element to assistive technology`,
39
- advanced: true
195
+ description: "Regex pattern that the value of the input must match to be valid",
196
+ helpText: "For more information about writing Regular Expressions (regex), check out https://regexr.com/",
197
+ validator: (value) => {
198
+ try {
199
+ new RegExp(value);
200
+ return true;
201
+ } catch (error) {
202
+ return "Invalid Regex";
203
+ }
204
+ },
205
+ advanced: true,
206
+ hidden: hasParent
207
+ },
208
+ type: {
209
+ type: "choice",
210
+ defaultValueHint: "text",
211
+ options: ["text", "search", "url", "tel", "email", "password"],
212
+ 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.",
213
+ advanced: true,
214
+ hidden: hasParent
215
+ },
216
+ inputMode: {
217
+ type: "choice",
218
+ description: "hint to browsers as to the type of virtual keyboard configuration to use when editing this element or its contents.",
219
+ options: [
220
+ "none",
221
+ "text",
222
+ "tel",
223
+ "url",
224
+ "email",
225
+ "numeric",
226
+ "decimal",
227
+ "search"
228
+ ],
229
+ hidden: hasParent
230
+ },
231
+ autoComplete: {
232
+ type: "choice",
233
+ advanced: true,
234
+ multiSelect: true,
235
+ hidden: hasParent,
236
+ description: "Guidance as to the type of data expected in the field",
237
+ helpText: "For explanations on what each of the values mean, check https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values",
238
+ options: [
239
+ "on",
240
+ "off",
241
+ "name",
242
+ "honorific-prefix",
243
+ "given-name",
244
+ "additional-name",
245
+ "family-name",
246
+ "honorific-suffix",
247
+ "nickname",
248
+ "email",
249
+ "username",
250
+ "new-password",
251
+ "current-password",
252
+ "one-time-code",
253
+ "organization-title",
254
+ "organization",
255
+ "street-address",
256
+ "shipping",
257
+ "billing",
258
+ "address-line1",
259
+ "address-line2",
260
+ "address-line3",
261
+ "address-level4",
262
+ "address-level3",
263
+ "address-level2",
264
+ "address-level1",
265
+ "country",
266
+ "country-name",
267
+ "postal-code",
268
+ "cc-name",
269
+ "cc-given-name",
270
+ "cc-additional-name",
271
+ "cc-family-name",
272
+ "cc-number",
273
+ "cc-exp",
274
+ "cc-exp-month",
275
+ "cc-exp-year",
276
+ "cc-csc",
277
+ "cc-type",
278
+ "transaction-currency",
279
+ "transaction-amount",
280
+ "language",
281
+ "bday",
282
+ "bday-day",
283
+ "bday-month",
284
+ "bday-year",
285
+ "sex",
286
+ "tel",
287
+ "tel-country-code",
288
+ "tel-national",
289
+ "tel-area-code",
290
+ "tel-local",
291
+ "tel-local-suffix",
292
+ "tel-local-prefix",
293
+ "tel-extension",
294
+ "impp",
295
+ "url",
296
+ "photo",
297
+ "webauthn"
298
+ ]
299
+ },
300
+ validationBehavior: {
301
+ type: "choice",
302
+ options: ["native", "aria"],
303
+ 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.",
304
+ defaultValueHint: "native",
305
+ advanced: true,
306
+ hidden: hasParent
307
+ },
308
+ onChange: {
309
+ type: "eventHandler",
310
+ argTypes: [{ name: "value", type: "string" }],
311
+ hidden: hasParent
312
+ },
313
+ onFocus: {
314
+ type: "eventHandler",
315
+ argTypes: [{ name: "focusEvent", type: "object" }],
316
+ advanced: true,
317
+ hidden: hasParent
318
+ },
319
+ onBlur: {
320
+ type: "eventHandler",
321
+ argTypes: [{ name: "focusEvent", type: "object" }],
322
+ advanced: true,
323
+ hidden: hasParent
324
+ },
325
+ onFocusChange: {
326
+ type: "eventHandler",
327
+ argTypes: [{ name: "isFocused", type: "boolean" }],
328
+ advanced: true,
329
+ hidden: hasParent
330
+ },
331
+ onKeyDown: {
332
+ type: "eventHandler",
333
+ argTypes: [{ name: "keyboardEvent", type: "object" }],
334
+ advanced: true,
335
+ hidden: hasParent
336
+ },
337
+ onKeyUp: {
338
+ type: "eventHandler",
339
+ argTypes: [{ name: "keyboardEvent", type: "object" }],
340
+ advanced: true,
341
+ hidden: hasParent
342
+ },
343
+ onCopy: {
344
+ type: "eventHandler",
345
+ argTypes: [{ name: "clipbordEvent", type: "object" }],
346
+ advanced: true,
347
+ hidden: hasParent
40
348
  },
41
- isRequired: {
42
- displayName: "Required",
43
- type: "boolean",
44
- description: `Whether user input is required on the ${fieldName} before form submission.`,
45
- defaultValueHint: false
349
+ onCut: {
350
+ type: "eventHandler",
351
+ argTypes: [{ name: "clipbordEvent", type: "object" }],
352
+ advanced: true,
353
+ hidden: hasParent
46
354
  },
47
- children: {
48
- type: "slot",
49
- mergeWithParent: true
355
+ onPaste: {
356
+ type: "eventHandler",
357
+ argTypes: [{ name: "clipbordEvent", type: "object" }],
358
+ advanced: true,
359
+ hidden: hasParent
360
+ },
361
+ onCompositionStart: {
362
+ type: "eventHandler",
363
+ argTypes: [{ name: "compositionEvent", type: "object" }],
364
+ advanced: true,
365
+ hidden: hasParent
366
+ },
367
+ onCompositionEnd: {
368
+ type: "eventHandler",
369
+ argTypes: [{ name: "compositionEvent", type: "object" }],
370
+ advanced: true,
371
+ hidden: hasParent
372
+ },
373
+ onCompositionUpdate: {
374
+ type: "eventHandler",
375
+ argTypes: [{ name: "compositionEvent", type: "object" }],
376
+ advanced: true,
377
+ hidden: hasParent
378
+ },
379
+ onSelect: {
380
+ type: "eventHandler",
381
+ argTypes: [{ name: "selectionEvent", type: "object" }],
382
+ advanced: true,
383
+ hidden: hasParent
384
+ },
385
+ onBeforeInput: {
386
+ type: "eventHandler",
387
+ argTypes: [{ name: "inputEvent", type: "object" }],
388
+ advanced: true,
389
+ hidden: hasParent
390
+ },
391
+ onInput: {
392
+ type: "eventHandler",
393
+ argTypes: [{ name: "inputEvent", type: "object" }],
394
+ advanced: true,
395
+ hidden: hasParent
396
+ },
397
+ placeholder: {
398
+ type: "string"
50
399
  }
51
400
  };
52
401
  const filteredProps = {};
53
- fields.forEach((field) => {
54
- if (commonInputProps.hasOwnProperty(field)) {
55
- filteredProps[field] = commonInputProps[field];
402
+ propNames.forEach((propName) => {
403
+ if (Object.prototype.hasOwnProperty.call(commonProps, propName)) {
404
+ filteredProps[propName] = commonProps[propName];
56
405
  }
57
406
  });
58
407
  return filteredProps;
@@ -127,68 +476,6 @@ function pickAriaComponentVariants(keys) {
127
476
  };
128
477
  }
129
478
 
130
- var __defProp$r = Object.defineProperty;
131
- var __defProps$e = Object.defineProperties;
132
- var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
133
- var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
134
- var __hasOwnProp$r = Object.prototype.hasOwnProperty;
135
- var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
136
- var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
137
- var __spreadValues$r = (a, b) => {
138
- for (var prop in b || (b = {}))
139
- if (__hasOwnProp$r.call(b, prop))
140
- __defNormalProp$r(a, prop, b[prop]);
141
- if (__getOwnPropSymbols$r)
142
- for (var prop of __getOwnPropSymbols$r(b)) {
143
- if (__propIsEnum$r.call(b, prop))
144
- __defNormalProp$r(a, prop, b[prop]);
145
- }
146
- return a;
147
- };
148
- var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
149
- function registerComponentHelper(loader, component, meta, overrides) {
150
- if (overrides) {
151
- meta = __spreadProps$e(__spreadValues$r(__spreadValues$r({}, meta), overrides), {
152
- props: __spreadValues$r(__spreadValues$r({}, meta.props), overrides.props)
153
- });
154
- if (overrides.parentComponentName) {
155
- meta.name = makeChildComponentName(
156
- overrides.parentComponentName,
157
- meta.name
158
- );
159
- }
160
- }
161
- if (loader) {
162
- loader.registerComponent(component, meta);
163
- } else {
164
- registerComponent(component, meta);
165
- }
166
- return meta;
167
- }
168
- function makeComponentName(name) {
169
- return `plasmic-react-aria-${name}`;
170
- }
171
- function makeChildComponentName(fullParentName, fullChildName) {
172
- if (!fullParentName) {
173
- return fullChildName;
174
- }
175
- return `${fullParentName}-${fullChildName.replace(
176
- "plasmic-react-aria-",
177
- ""
178
- )}`;
179
- }
180
- function extractPlasmicDataProps(props) {
181
- return Object.fromEntries(
182
- Object.entries(props).filter(([key]) => key.startsWith("data-plasmic-"))
183
- );
184
- }
185
- function withoutNils(array) {
186
- return array.filter((x) => x != null);
187
- }
188
- function isDefined(thing) {
189
- return thing !== void 0 && thing !== null;
190
- }
191
-
192
479
  var __defProp$q = Object.defineProperty;
193
480
  var __defProps$d = Object.defineProperties;
194
481
  var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
@@ -273,7 +560,7 @@ function registerButton(loader, overrides) {
273
560
  padding: "2px 10px",
274
561
  cursor: "pointer"
275
562
  },
276
- props: __spreadProps$d(__spreadValues$q({}, getCommonInputProps("button", [
563
+ props: __spreadProps$d(__spreadValues$q({}, getCommonProps("button", [
277
564
  "isDisabled",
278
565
  "aria-label"
279
566
  ])), {
@@ -319,37 +606,11 @@ const PlasmicDialogTriggerContext = React.createContext(void 0);
319
606
  const PlasmicSliderContext = React.createContext(void 0);
320
607
  React.createContext(void 0);
321
608
  const PlasmicListBoxContext = React.createContext(void 0);
322
- const PlasmicPopoverContext = React.createContext(void 0);
323
609
  const PlasmicItemContext = React.createContext(void 0);
324
610
  const PlasmicSectionContext = React.createContext(void 0);
325
611
  const PlasmicHeaderContext = React.createContext(void 0);
326
612
  const PlasmicInputContext = React.createContext(void 0);
327
613
 
328
- const BaseLabel = Label;
329
- const LABEL_COMPONENT_NAME = makeComponentName("label");
330
- function registerLabel(loader, overrides) {
331
- registerComponentHelper(
332
- loader,
333
- BaseLabel,
334
- {
335
- name: LABEL_COMPONENT_NAME,
336
- displayName: "Aria Label",
337
- importPath: "@plasmicpkgs/react-aria/skinny/registerLabel",
338
- importName: "BaseLabel",
339
- defaultStyles: {
340
- cursor: "pointer"
341
- },
342
- props: {
343
- children: {
344
- type: "slot"
345
- }
346
- },
347
- trapsFocus: true
348
- },
349
- overrides
350
- );
351
- }
352
-
353
614
  var __defProp$p = Object.defineProperty;
354
615
  var __defProps$c = Object.defineProperties;
355
616
  var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
@@ -389,7 +650,8 @@ const CHECKBOX_INTERACTION_VARIANTS = [
389
650
  "indeterminate",
390
651
  "disabled",
391
652
  "selected",
392
- "readonly"
653
+ "readonly",
654
+ "selected"
393
655
  ];
394
656
  const { interactionVariants: interactionVariants$b, withObservedValues: withObservedValues$9 } = pickAriaComponentVariants(
395
657
  CHECKBOX_INTERACTION_VARIANTS
@@ -397,9 +659,8 @@ const { interactionVariants: interactionVariants$b, withObservedValues: withObse
397
659
  function BaseCheckbox(props) {
398
660
  const _a = props, { children, updateInteractionVariant, setControlContextData } = _a, rest = __objRest$j(_a, ["children", "updateInteractionVariant", "setControlContextData"]);
399
661
  const contextProps = React.useContext(PlasmicCheckboxGroupContext);
400
- const isStandalone = !contextProps;
401
662
  setControlContextData == null ? void 0 : setControlContextData({
402
- isStandalone
663
+ parent: contextProps
403
664
  });
404
665
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Checkbox, __spreadValues$p({}, rest), ({
405
666
  isHovered,
@@ -458,14 +719,8 @@ const makeDefaultCheckboxChildren = ({
458
719
  }
459
720
  },
460
721
  {
461
- type: "component",
462
- name: LABEL_COMPONENT_NAME,
463
- props: {
464
- children: {
465
- type: "text",
466
- value: label
467
- }
468
- }
722
+ type: "text",
723
+ value: label
469
724
  }
470
725
  ]
471
726
  },
@@ -487,7 +742,7 @@ function registerCheckbox(loader, overrides) {
487
742
  importPath: "@plasmicpkgs/react-aria/skinny/registerCheckbox",
488
743
  importName: "BaseCheckbox",
489
744
  interactionVariants: interactionVariants$b,
490
- props: __spreadProps$c(__spreadValues$p({}, getCommonInputProps("checkbox", [
745
+ props: __spreadProps$c(__spreadValues$p({}, getCommonProps("checkbox", [
491
746
  "name",
492
747
  "isDisabled",
493
748
  "isReadOnly",
@@ -505,13 +760,15 @@ function registerCheckbox(loader, overrides) {
505
760
  },
506
761
  value: {
507
762
  type: "string",
508
- description: "The value of the input element, used when submitting an HTML form."
763
+ description: 'The value of the checkbox in "selected" state, used when submitting an HTML form.',
764
+ defaultValueHint: "on"
509
765
  },
510
766
  isSelected: {
511
767
  type: "boolean",
768
+ displayName: "Default Selected",
512
769
  editOnly: true,
513
770
  uncontrolledProp: "defaultSelected",
514
- description: "Whether the checkbox is toggled on",
771
+ description: "Whether the checkbox should be selected by default",
515
772
  defaultValueHint: false,
516
773
  defaultValue: false
517
774
  },
@@ -544,7 +801,7 @@ function registerCheckbox(loader, overrides) {
544
801
  valueProp: "isSelected",
545
802
  onChangeProp: "onChange",
546
803
  variableType: "boolean",
547
- hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
804
+ hidden: hasParent
548
805
  }
549
806
  },
550
807
  trapsFocus: true
@@ -810,6 +1067,31 @@ function registerFieldError(loader, overrides) {
810
1067
  );
811
1068
  }
812
1069
 
1070
+ const BaseLabel = Label;
1071
+ const LABEL_COMPONENT_NAME = makeComponentName("label");
1072
+ function registerLabel(loader, overrides) {
1073
+ registerComponentHelper(
1074
+ loader,
1075
+ BaseLabel,
1076
+ {
1077
+ name: LABEL_COMPONENT_NAME,
1078
+ displayName: "Aria Label",
1079
+ importPath: "@plasmicpkgs/react-aria/skinny/registerLabel",
1080
+ importName: "BaseLabel",
1081
+ defaultStyles: {
1082
+ cursor: "pointer"
1083
+ },
1084
+ props: {
1085
+ children: {
1086
+ type: "slot"
1087
+ }
1088
+ },
1089
+ trapsFocus: true
1090
+ },
1091
+ overrides
1092
+ );
1093
+ }
1094
+
813
1095
  var __defProp$l = Object.defineProperty;
814
1096
  var __defProps$a = Object.defineProperties;
815
1097
  var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
@@ -849,8 +1131,8 @@ const { interactionVariants: interactionVariants$a, withObservedValues: withObse
849
1131
  CHECKBOX_GROUP_INTERACTION_VARIANTS
850
1132
  );
851
1133
  function BaseCheckboxGroup(props) {
852
- const _a = props, { children, updateInteractionVariant } = _a; __objRest$g(_a, ["children", "updateInteractionVariant"]);
853
- return /* @__PURE__ */ React.createElement(PlasmicCheckboxGroupContext.Provider, { value: props }, /* @__PURE__ */ React.createElement(CheckboxGroup, __spreadValues$l({}, props), ({ isDisabled, isReadOnly }) => withObservedValues$8(
1134
+ const _a = props, { children, updateInteractionVariant } = _a, rest = __objRest$g(_a, ["children", "updateInteractionVariant"]);
1135
+ return /* @__PURE__ */ React.createElement(PlasmicCheckboxGroupContext.Provider, { value: rest }, /* @__PURE__ */ React.createElement(CheckboxGroup, __spreadValues$l({}, rest), ({ isDisabled, isReadOnly }) => withObservedValues$8(
854
1136
  children,
855
1137
  {
856
1138
  disabled: isDisabled,
@@ -879,7 +1161,7 @@ function registerCheckboxGroup(loader, overrides) {
879
1161
  importPath: "@plasmicpkgs/react-aria/skinny/registerCheckboxGroup",
880
1162
  importName: "BaseCheckboxGroup",
881
1163
  interactionVariants: interactionVariants$a,
882
- props: __spreadProps$a(__spreadValues$l({}, getCommonInputProps("checkbox group", [
1164
+ props: __spreadProps$a(__spreadValues$l({}, getCommonProps("checkbox group", [
883
1165
  "name",
884
1166
  "isDisabled",
885
1167
  "isReadOnly",
@@ -1195,23 +1477,49 @@ const INPUT_INTERACTION_VARIANTS = [
1195
1477
  const { interactionVariants: interactionVariants$9 } = pickAriaComponentVariants(
1196
1478
  INPUT_INTERACTION_VARIANTS
1197
1479
  );
1480
+ const inputHelpers$1 = {
1481
+ states: {
1482
+ value: {
1483
+ onChangeArgsToValue: (e) => {
1484
+ return e.target.value;
1485
+ }
1486
+ }
1487
+ }
1488
+ };
1198
1489
  function BaseInput(props) {
1199
1490
  var _b;
1200
- const context = React.useContext(PlasmicTextFieldContext);
1201
- const isStandalone = !context;
1202
- const _a = props, { updateInteractionVariant, setControlContextData, disabled } = _a, rest = __objRest$f(_a, ["updateInteractionVariant", "setControlContextData", "disabled"]);
1491
+ const _a = props, {
1492
+ updateInteractionVariant,
1493
+ setControlContextData,
1494
+ disabled,
1495
+ autoComplete
1496
+ } = _a, rest = __objRest$f(_a, [
1497
+ "updateInteractionVariant",
1498
+ "setControlContextData",
1499
+ "disabled",
1500
+ "autoComplete"
1501
+ ]);
1502
+ const textFieldContext = React.useContext(PlasmicTextFieldContext);
1503
+ setControlContextData == null ? void 0 : setControlContextData({
1504
+ parent: textFieldContext
1505
+ });
1203
1506
  const mergedProps = mergeProps(rest, {
1204
- disabled: (_b = context == null ? void 0 : context.isDisabled) != null ? _b : disabled
1507
+ /**
1508
+ * While react-aria internally does the merging of the disabled prop,
1509
+ * we need to explicity do it here, because react-aria does it behind the scenes,
1510
+ * whereas we need the calculated value of the disabled prop to be able to update the "disabled" interaction variant.
1511
+ * */
1512
+ disabled: (_b = textFieldContext == null ? void 0 : textFieldContext.isDisabled) != null ? _b : disabled
1205
1513
  });
1206
1514
  useEffect(() => {
1207
1515
  updateInteractionVariant == null ? void 0 : updateInteractionVariant({
1208
1516
  disabled: mergedProps.disabled
1209
1517
  });
1210
1518
  }, [mergedProps.disabled, updateInteractionVariant]);
1211
- setControlContextData == null ? void 0 : setControlContextData({ isStandalone });
1212
1519
  return /* @__PURE__ */ React.createElement(
1213
1520
  Input,
1214
1521
  __spreadValues$k({
1522
+ autoComplete: resolveAutoComplete(autoComplete),
1215
1523
  onHoverChange: (isHovered) => {
1216
1524
  updateInteractionVariant == null ? void 0 : updateInteractionVariant({
1217
1525
  hovered: isHovered
@@ -1248,16 +1556,48 @@ function registerInput(loader, overrides) {
1248
1556
  borderColor: "black",
1249
1557
  padding: "2px 10px"
1250
1558
  },
1251
- props: {
1252
- placeholder: {
1253
- type: "string"
1254
- },
1255
- disabled: {
1256
- type: "boolean",
1257
- description: "Whether the input is disabled",
1258
- defaultValueHint: false,
1259
- hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
1260
- }
1559
+ props: __spreadValues$k({}, getCommonProps("Input", [
1560
+ "name",
1561
+ "disabled",
1562
+ "readOnly",
1563
+ "autoFocus",
1564
+ "aria-label",
1565
+ "required",
1566
+ "placeholder",
1567
+ "value",
1568
+ "maxLength",
1569
+ "minLength",
1570
+ "pattern",
1571
+ "type",
1572
+ "inputMode",
1573
+ "autoComplete",
1574
+ "onChange",
1575
+ "onFocus",
1576
+ "onBlur",
1577
+ "onKeyDown",
1578
+ "onKeyUp",
1579
+ "onCopy",
1580
+ "onCut",
1581
+ "onPaste",
1582
+ "onCompositionStart",
1583
+ "onCompositionEnd",
1584
+ "onCompositionUpdate",
1585
+ "onSelect",
1586
+ "onBeforeInput",
1587
+ "onInput"
1588
+ ])),
1589
+ states: {
1590
+ value: __spreadValues$k({
1591
+ type: "writable",
1592
+ valueProp: "value",
1593
+ onChangeProp: "onChange",
1594
+ variableType: "text"
1595
+ }, inputHelpers$1.states.value)
1596
+ },
1597
+ componentHelpers: {
1598
+ helpers: inputHelpers$1,
1599
+ importName: "inputHelpers",
1600
+ importPath: "@plasmicpkgs/react-aria/skinny/registerInput"
1261
1601
  },
1262
1602
  trapsFocus: true
1263
1603
  },
@@ -1494,18 +1834,17 @@ var __objRest$e = (source, exclude) => {
1494
1834
  return target;
1495
1835
  };
1496
1836
  function BaseListBox(props) {
1497
- var _c;
1498
1837
  const contextProps = React.useContext(PlasmicListBoxContext);
1499
1838
  const isStandalone = !contextProps;
1500
- const _a = props, rest = __objRest$e(_a, ["options"]);
1839
+ const _a = props, { options: _rawOptions, setControlContextData } = _a, rest = __objRest$e(_a, ["options", "setControlContextData"]);
1501
1840
  const { options } = useStrictOptions(props);
1502
1841
  const _b = mergeProps$1(
1503
1842
  contextProps,
1504
1843
  rest,
1505
1844
  isStandalone ? { items: options } : {}
1506
1845
  ), { renderItem, renderSection } = _b, mergedProps = __objRest$e(_b, ["renderItem", "renderSection"]);
1507
- (_c = props.setControlContextData) == null ? void 0 : _c.call(props, {
1508
- isStandalone
1846
+ setControlContextData == null ? void 0 : setControlContextData({
1847
+ parent: isStandalone ? void 0 : {}
1509
1848
  });
1510
1849
  return /* @__PURE__ */ React.createElement(ListBox, __spreadValues$g({}, mergedProps), (item) => {
1511
1850
  var _a2;
@@ -1551,7 +1890,7 @@ function registerListBox(loader, overrides) {
1551
1890
  props: {
1552
1891
  options: __spreadProps$8(__spreadValues$g({}, makeOptionsPropType()), {
1553
1892
  displayName: "Items",
1554
- hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
1893
+ hidden: hasParent
1555
1894
  }),
1556
1895
  renderItem: {
1557
1896
  type: "slot",
@@ -1614,37 +1953,34 @@ var __objRest$d = (source, exclude) => {
1614
1953
  }
1615
1954
  return target;
1616
1955
  };
1617
- const SHOULD_FLIP_INSIDE_SELECT = false;
1618
1956
  function BasePopover(props) {
1619
1957
  const _a = props, { resetClassName, setControlContextData } = _a, restProps = __objRest$d(_a, ["resetClassName", "setControlContextData"]);
1620
1958
  const isStandalone = !React.useContext(PopoverContext);
1621
- const contextProps = React.useContext(PlasmicPopoverContext);
1622
1959
  const isInsideSelect = !!React.useContext(SelectContext);
1960
+ const triggerRef = React.useRef(null);
1961
+ const isEditMode = !!usePlasmicCanvasContext();
1962
+ const defaultShouldFlip = isInsideSelect ? false : true;
1623
1963
  const mergedProps = mergeProps$1(
1624
- contextProps,
1964
+ { shouldFlip: defaultShouldFlip },
1965
+ /**
1966
+ * isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies. *
1967
+ *
1968
+ * 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.
1969
+ */
1970
+ isEditMode ? { isNonModal: true } : null,
1625
1971
  restProps,
1626
- {
1627
- className: `${resetClassName}`
1628
- },
1629
- isInsideSelect && !isDefined(restProps.shouldFlip) ? { shouldFlip: SHOULD_FLIP_INSIDE_SELECT } : void 0
1972
+ { className: `${resetClassName}` },
1973
+ // Override some props if the popover is standalone
1974
+ isStandalone ? {
1975
+ triggerRef,
1976
+ isNonModal: true,
1977
+ isOpen: true
1978
+ } : null
1630
1979
  );
1631
- const isEditMode = !!usePlasmicCanvasContext();
1632
- const triggerRef = React.useRef(null);
1633
- const standaloneProps = isStandalone ? {
1634
- triggerRef,
1635
- isNonModal: true,
1636
- isOpen: true
1637
- } : {};
1638
1980
  setControlContextData == null ? void 0 : setControlContextData({
1639
- isStandalone,
1640
- isInsideSelect
1981
+ defaultShouldFlip
1641
1982
  });
1642
- return /* @__PURE__ */ React.createElement(React.Fragment, null, isStandalone && /* @__PURE__ */ React.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React.createElement(
1643
- Popover,
1644
- __spreadValues$f(__spreadValues$f({
1645
- isNonModal: isEditMode ? true : void 0
1646
- }, mergedProps), standaloneProps)
1647
- ));
1983
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, isStandalone && /* @__PURE__ */ React.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React.createElement(Popover, __spreadValues$f({}, mergedProps)));
1648
1984
  }
1649
1985
  const POPOVER_COMPONENT_NAME = makeComponentName("popover");
1650
1986
  const POPOVER_ARROW_IMG = {
@@ -1718,7 +2054,10 @@ function registerPopover(loader, overrides) {
1718
2054
  shouldFlip: {
1719
2055
  type: "boolean",
1720
2056
  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.",
1721
- defaultValueHint: (_ps, ctx) => (ctx == null ? void 0 : ctx.isInsideSelect) ? SHOULD_FLIP_INSIDE_SELECT : true
2057
+ defaultValueHint: (_ps, ctx) => {
2058
+ var _a;
2059
+ return (_a = ctx == null ? void 0 : ctx.defaultShouldFlip) != null ? _a : true;
2060
+ }
1722
2061
  },
1723
2062
  placement: {
1724
2063
  type: "choice",
@@ -2161,7 +2500,7 @@ const BaseModal = forwardRef(
2161
2500
  isOpen: isStandalone ? isOpen : contextProps.isOpen
2162
2501
  });
2163
2502
  setControlContextData == null ? void 0 : setControlContextData({
2164
- isStandalone
2503
+ parent: isStandalone ? void 0 : {}
2165
2504
  });
2166
2505
  useImperativeHandle(ref, () => ({
2167
2506
  close: () => {
@@ -2271,7 +2610,7 @@ function registerModal(loader, overrides) {
2271
2610
  uncontrolledProp: "defaultOpen",
2272
2611
  defaultValueHint: false,
2273
2612
  defaultValue: true,
2274
- hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
2613
+ hidden: hasParent
2275
2614
  },
2276
2615
  isDismissable: {
2277
2616
  type: "boolean",
@@ -2292,7 +2631,7 @@ function registerModal(loader, overrides) {
2292
2631
  valueProp: "isOpen",
2293
2632
  onChangeProp: "onOpenChange",
2294
2633
  variableType: "boolean",
2295
- hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
2634
+ hidden: hasParent
2296
2635
  }
2297
2636
  },
2298
2637
  trapsFocus: true
@@ -2509,14 +2848,19 @@ const RADIO_INTERACTION_VARIANTS = [
2509
2848
  "focused",
2510
2849
  "focusVisible",
2511
2850
  "disabled",
2512
- "readonly"
2851
+ "readonly",
2852
+ "selected"
2513
2853
  ];
2514
2854
  const { interactionVariants: interactionVariants$8, withObservedValues: withObservedValues$7 } = pickAriaComponentVariants(
2515
2855
  RADIO_INTERACTION_VARIANTS
2516
2856
  );
2517
2857
  function BaseRadio(props) {
2518
- const _a = props, { children, updateInteractionVariant, setControlContextData } = _a, rest = __objRest$9(_a, ["children", "updateInteractionVariant", "setControlContextData"]);
2858
+ const _a = props, { children, setControlContextData, updateInteractionVariant } = _a, rest = __objRest$9(_a, ["children", "setControlContextData", "updateInteractionVariant"]);
2519
2859
  const contextProps = React.useContext(PlasmicRadioGroupContext);
2860
+ const isStandalone = !contextProps;
2861
+ setControlContextData == null ? void 0 : setControlContextData({
2862
+ parent: contextProps
2863
+ });
2520
2864
  const radio = /* @__PURE__ */ React.createElement(Radio, __spreadValues$a({}, rest), ({
2521
2865
  isHovered,
2522
2866
  isPressed,
@@ -2538,11 +2882,10 @@ function BaseRadio(props) {
2538
2882
  },
2539
2883
  updateInteractionVariant
2540
2884
  ));
2541
- const isStandalone = !contextProps;
2542
- setControlContextData == null ? void 0 : setControlContextData({
2543
- isStandalone
2544
- });
2545
- return /* @__PURE__ */ React.createElement(ErrorBoundary, { fallback: /* @__PURE__ */ React.createElement(RadioGroup, null, radio) }, radio);
2885
+ if (isStandalone) {
2886
+ return /* @__PURE__ */ React.createElement(RadioGroup, null, radio);
2887
+ }
2888
+ return radio;
2546
2889
  }
2547
2890
  const makeDefaultRadioChildren = (label) => ({
2548
2891
  type: "hbox",
@@ -2586,7 +2929,7 @@ function registerRadio(loader, overrides) {
2586
2929
  importPath: "@plasmicpkgs/react-aria/skinny/registerRadio",
2587
2930
  importName: "BaseRadio",
2588
2931
  interactionVariants: interactionVariants$8,
2589
- props: __spreadProps$5(__spreadValues$a({}, getCommonInputProps("radio", [
2932
+ props: __spreadProps$5(__spreadValues$a({}, getCommonProps("radio", [
2590
2933
  "isDisabled",
2591
2934
  "autoFocus",
2592
2935
  "aria-label"
@@ -2599,23 +2942,8 @@ function registerRadio(loader, overrides) {
2599
2942
  value: {
2600
2943
  type: "string",
2601
2944
  description: "The value of the input element, used when submitting an HTML form."
2602
- },
2603
- // Keeping for backwards compatibility reasons
2604
- onSelectionChange: {
2605
- type: "eventHandler",
2606
- argTypes: [{ name: "isSelected", type: "boolean" }],
2607
- hidden: () => true
2608
2945
  }
2609
2946
  }),
2610
- states: {
2611
- // Keeping for backwards compatibility reasons
2612
- isSelected: {
2613
- type: "readonly",
2614
- onChangeProp: "onSelectionChange",
2615
- variableType: "boolean",
2616
- hidden: () => true
2617
- }
2618
- },
2619
2947
  trapsFocus: true
2620
2948
  },
2621
2949
  overrides
@@ -2689,7 +3017,7 @@ function registerRadioGroup(loader, overrides) {
2689
3017
  importPath: "@plasmicpkgs/react-aria/skinny/registerRadioGroup",
2690
3018
  importName: "BaseRadioGroup",
2691
3019
  interactionVariants: interactionVariants$7,
2692
- props: __spreadProps$4(__spreadValues$9({}, getCommonInputProps("radio group", [
3020
+ props: __spreadProps$4(__spreadValues$9({}, getCommonProps("radio group", [
2693
3021
  "name",
2694
3022
  "isDisabled",
2695
3023
  "isReadOnly",
@@ -2760,6 +3088,7 @@ function registerRadioGroup(loader, overrides) {
2760
3088
  value: {
2761
3089
  type: "string",
2762
3090
  editOnly: true,
3091
+ displayName: "Default Value",
2763
3092
  uncontrolledProp: "defaultValue",
2764
3093
  description: "The current value"
2765
3094
  },
@@ -3110,7 +3439,7 @@ function BaseSliderOutput(props) {
3110
3439
  }
3111
3440
  const SLIDER_OUTPUT_COMPONENT_NAME = makeComponentName("sliderOutput");
3112
3441
  function registerSliderOutput(loader, overrides) {
3113
- registerComponentHelper(
3442
+ return registerComponentHelper(
3114
3443
  loader,
3115
3444
  BaseSliderOutput,
3116
3445
  {
@@ -3202,7 +3531,7 @@ function BaseSliderThumb(_a) {
3202
3531
  }
3203
3532
  const SLIDER_THUMB_COMPONENT_NAME = makeComponentName("sliderThumb");
3204
3533
  function registerSliderThumb(loader, overrides) {
3205
- registerComponentHelper(
3534
+ return registerComponentHelper(
3206
3535
  loader,
3207
3536
  BaseSliderThumb,
3208
3537
  {
@@ -3220,7 +3549,7 @@ function registerSliderThumb(loader, overrides) {
3220
3549
  cursor: "pointer"
3221
3550
  },
3222
3551
  interactionVariants: interactionVariants$5,
3223
- props: __spreadProps$3(__spreadValues$6({}, getCommonInputProps("slider thumb", [
3552
+ props: __spreadProps$3(__spreadValues$6({}, getCommonProps("slider thumb", [
3224
3553
  "name",
3225
3554
  "isDisabled",
3226
3555
  "autoFocus"
@@ -3274,52 +3603,59 @@ const { interactionVariants: interactionVariants$4, withObservedValues: withObse
3274
3603
  SLIDER_TRACK_INTERACTION_VARIANTS
3275
3604
  );
3276
3605
  function findMinMaxIndices(values) {
3277
- if (typeof values === "number" || (values == null ? void 0 : values.length) === 0 || !Array.isArray(values)) {
3278
- return { minIndex: 0, maxIndex: 0 };
3279
- }
3280
3606
  let minIndex = 0;
3281
3607
  let maxIndex = 0;
3282
- for (let i = 1; i < values.length; i++) {
3283
- if (values[i] < values[minIndex]) {
3284
- minIndex = i;
3285
- }
3286
- if (values[i] > values[maxIndex]) {
3287
- maxIndex = i;
3608
+ if (Array.isArray(values)) {
3609
+ for (let i = 1; i < values.length; i++) {
3610
+ if (values[i] < values[minIndex]) {
3611
+ minIndex = i;
3612
+ }
3613
+ if (values[i] > values[maxIndex]) {
3614
+ maxIndex = i;
3615
+ }
3288
3616
  }
3289
3617
  }
3290
3618
  return { minIndex, maxIndex };
3291
3619
  }
3620
+ function isMultiValueGuard(value) {
3621
+ return Array.isArray(value) && value.length > 1;
3622
+ }
3292
3623
  function BaseSliderTrack(props) {
3293
3624
  const context = React.useContext(PlasmicSliderContext);
3625
+ const isStandalone = !context;
3294
3626
  const mergedProps = mergeProps(context, props);
3295
- const _a = mergedProps, {
3296
- children,
3297
- progressBar,
3298
- updateInteractionVariant,
3299
- isMultiValue
3300
- } = _a, rest = __objRest$5(_a, [
3301
- "children",
3302
- "progressBar",
3303
- "updateInteractionVariant",
3304
- "isMultiValue"
3305
- ]);
3306
- const { minIndex, maxIndex } = useMemo(
3307
- () => findMinMaxIndices(mergedProps.value),
3308
- [mergedProps.value]
3309
- );
3310
- const thumbs = useMemo(() => {
3311
- const rawThumbs = flattenChildren(children);
3312
- const values = Array.isArray(mergedProps == null ? void 0 : mergedProps.value) ? mergedProps.value : [mergedProps.value].filter((v) => v !== void 0);
3313
- const difference = values.length - rawThumbs.length;
3314
- if (!difference) {
3315
- return rawThumbs;
3627
+ const _a = mergedProps, { children, progressBar, updateInteractionVariant } = _a, rest = __objRest$5(_a, ["children", "progressBar", "updateInteractionVariant"]);
3628
+ const isMultiValue = isMultiValueGuard(mergedProps.value);
3629
+ const { minIndex, maxIndex } = useMemo(() => {
3630
+ if (!context || !Array.isArray(context.value) || context.value.length <= 1) {
3631
+ return { minIndex: 0, maxIndex: 0 };
3316
3632
  }
3317
- if (difference < 0) {
3318
- return rawThumbs.slice(0, values.length);
3633
+ return findMinMaxIndices(context.value);
3634
+ }, [context == null ? void 0 : context.value]);
3635
+ const thumbs = useMemo(() => {
3636
+ const thumbNodes = flattenChildren(children);
3637
+ if (!thumbNodes || thumbNodes.length === 0 || !isDefined(context == null ? void 0 : context.value)) {
3638
+ return [];
3319
3639
  }
3320
- const lastThumb = rawThumbs[rawThumbs.length - 1];
3321
- return rawThumbs.concat(new Array(difference).fill(lastThumb));
3322
- }, [children, mergedProps.value]);
3640
+ const values = isDefined(context) ? Array.isArray(context.value) ? context.value : [context.value] : [];
3641
+ const lastThumb = thumbNodes[thumbNodes.length - 1];
3642
+ return values.map((v, i) => {
3643
+ const currentThumb = thumbNodes[i];
3644
+ if (i >= thumbNodes.length) {
3645
+ if (React.isValidElement(lastThumb)) {
3646
+ return React.cloneElement(lastThumb, {
3647
+ index: i
3648
+ });
3649
+ }
3650
+ }
3651
+ if (!React.isValidElement(currentThumb)) {
3652
+ return null;
3653
+ }
3654
+ return React.cloneElement(currentThumb, {
3655
+ index: i
3656
+ });
3657
+ });
3658
+ }, [children, context == null ? void 0 : context.value]);
3323
3659
  const track = /* @__PURE__ */ React.createElement(SliderTrack, __spreadValues$5({ style: { position: "relative" } }, rest), ({ state, isHovered }) => /* @__PURE__ */ React.createElement(React.Fragment, null, withObservedValues$3(
3324
3660
  /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
3325
3661
  "div",
@@ -3333,28 +3669,20 @@ function BaseSliderTrack(props) {
3333
3669
  }
3334
3670
  },
3335
3671
  progressBar
3336
- ), thumbs.map(
3337
- (thumb, i) => React.isValidElement(thumb) && React.cloneElement(thumb, {
3338
- // sets the index of the thumb, so that each thumb reflects the correct value
3339
- index: i
3340
- })
3341
- )),
3672
+ ), thumbs),
3342
3673
  {
3343
3674
  hovered: isHovered
3344
3675
  },
3345
3676
  updateInteractionVariant
3346
3677
  )));
3347
- return /* @__PURE__ */ React.createElement(
3348
- ErrorBoundary,
3349
- {
3350
- fallback: /* @__PURE__ */ React.createElement(Slider, { style: { height: "100%", width: "100%" } }, track)
3351
- },
3352
- track
3353
- );
3678
+ if (isStandalone) {
3679
+ return /* @__PURE__ */ React.createElement(Slider, { style: { height: "100%", width: "100%" } }, track);
3680
+ }
3681
+ return track;
3354
3682
  }
3355
3683
  const SLIDER_TRACK_COMPONENT_NAME = makeComponentName("sliderTrack");
3356
- function registerSliderTrack(loader, overrides) {
3357
- registerComponentHelper(
3684
+ function registerSliderTrack(sliderThumbMeta, loader, overrides) {
3685
+ return registerComponentHelper(
3358
3686
  loader,
3359
3687
  BaseSliderTrack,
3360
3688
  {
@@ -3373,14 +3701,13 @@ function registerSliderTrack(loader, overrides) {
3373
3701
  props: {
3374
3702
  children: {
3375
3703
  type: "slot",
3376
- description: "The thumbs of the slider",
3704
+ displayName: "Thumbs",
3705
+ description: "The thumbs of the slider. For range slider, you can add more than one thumb.",
3706
+ allowedComponents: [sliderThumbMeta.name],
3377
3707
  defaultValue: [
3378
3708
  {
3379
3709
  type: "component",
3380
- name: makeChildComponentName(
3381
- SLIDER_COMPONENT_NAME,
3382
- SLIDER_THUMB_COMPONENT_NAME
3383
- )
3710
+ name: sliderThumbMeta.name
3384
3711
  }
3385
3712
  ]
3386
3713
  },
@@ -3450,106 +3777,101 @@ var __objRest$4 = (source, exclude) => {
3450
3777
  return target;
3451
3778
  };
3452
3779
  const SLIDER_COMPONENT_NAME = makeComponentName("slider");
3780
+ const RANGE_SLIDER_COMPONENT_NAME = makeComponentName("range-slider");
3453
3781
  const SLIDER_INTERACTION_VARIANTS = ["disabled"];
3454
3782
  const { interactionVariants: interactionVariants$3, withObservedValues: withObservedValues$2 } = pickAriaComponentVariants(
3455
3783
  SLIDER_INTERACTION_VARIANTS
3456
3784
  );
3457
- const sliderHelpers = {
3458
- states: {
3459
- range: {
3460
- onChangeArgsToValue: (value, isMultiValue) => {
3461
- if (isMultiValue) {
3462
- return Array.isArray(value) ? value : [value, value + 10];
3463
- }
3464
- return void 0;
3465
- }
3466
- },
3467
- value: {
3468
- onChangeArgsToValue: (value, isMultiValue) => {
3469
- if (isMultiValue) {
3470
- return void 0;
3471
- }
3472
- return Array.isArray(value) ? value[0] : value;
3473
- }
3474
- }
3475
- }
3476
- };
3477
3785
  function BaseSlider(props) {
3478
- const _a = props, {
3479
- range,
3480
- value,
3481
- defaultRange,
3482
- children,
3483
- updateInteractionVariant,
3484
- defaultValue,
3485
- onChange
3486
- } = _a, rest = __objRest$4(_a, [
3487
- "range",
3488
- "value",
3489
- "defaultRange",
3490
- "children",
3491
- "updateInteractionVariant",
3492
- "defaultValue",
3493
- "onChange"
3494
- ]);
3495
- const isFirstRender = useRef(true);
3496
- useEffect(() => {
3497
- var _a2, _b, _c;
3498
- if (isFirstRender.current) {
3499
- isFirstRender.current = false;
3500
- return;
3501
- }
3502
- if (props.isMultiValue) {
3503
- const minValue = (_a2 = props.minValue) != null ? _a2 : 0;
3504
- (_b = props.onChange) == null ? void 0 : _b.call(
3505
- props,
3506
- Array.isArray(range) && range.length > 1 ? range : [minValue, minValue + 10],
3507
- true
3508
- );
3509
- return;
3510
- }
3511
- (_c = props.onChange) == null ? void 0 : _c.call(props, Array.isArray(value) ? 0 : value != null ? value : 0, false);
3512
- }, [props.isMultiValue]);
3513
- const mergedProps = mergeProps(rest, {
3514
- value: props.isMultiValue ? range : value,
3515
- defaultValue: props.isMultiValue ? defaultRange : defaultValue
3516
- });
3517
- return /* @__PURE__ */ React.createElement(PlasmicSliderContext.Provider, { value: mergedProps }, /* @__PURE__ */ React.createElement(
3518
- Slider,
3519
- __spreadValues$4({
3520
- key: props.isMultiValue ? "multi" : "single",
3521
- onChange: (newValue) => {
3522
- onChange == null ? void 0 : onChange(newValue, props.isMultiValue);
3523
- }
3524
- }, mergedProps),
3525
- ({ isDisabled }) => withObservedValues$2(
3786
+ const _a = props, { children, updateInteractionVariant } = _a, rest = __objRest$4(_a, ["children", "updateInteractionVariant"]);
3787
+ return /* @__PURE__ */ React.createElement(
3788
+ PlasmicSliderContext.Provider,
3789
+ {
3790
+ value: __spreadProps$2(__spreadValues$4({}, rest), {
3791
+ // Here's why the type casting is needed here: https://github.com/Microsoft/TypeScript/issues/3410
3792
+ onChange: rest.onChange,
3793
+ onChangeEnd: rest.onChangeEnd
3794
+ })
3795
+ },
3796
+ /* @__PURE__ */ React.createElement(Slider, __spreadValues$4({}, rest), ({ isDisabled }) => withObservedValues$2(
3526
3797
  children,
3527
3798
  {
3528
3799
  disabled: isDisabled
3529
3800
  },
3530
3801
  updateInteractionVariant
3531
- )
3532
- ));
3802
+ ))
3803
+ );
3804
+ }
3805
+ function getCommonSliderProps() {
3806
+ return {
3807
+ orientation: {
3808
+ type: "choice",
3809
+ options: ["horizontal", "vertical"],
3810
+ defaultValueHint: "horizontal",
3811
+ defaultValue: "horizontal"
3812
+ },
3813
+ minValue: {
3814
+ type: "number",
3815
+ description: "The minimum value of the slider",
3816
+ defaultValueHint: 0
3817
+ },
3818
+ maxValue: {
3819
+ type: "number",
3820
+ description: "The maximum value of the slider",
3821
+ defaultValueHint: 100
3822
+ },
3823
+ step: {
3824
+ type: "number",
3825
+ description: "The step value of the slider",
3826
+ defaultValueHint: 1
3827
+ }
3828
+ };
3533
3829
  }
3534
3830
  function registerSlider(loader, overrides) {
3831
+ const sliderOutputMeta = registerSliderOutput(loader, {
3832
+ parentComponentName: SLIDER_COMPONENT_NAME
3833
+ });
3834
+ const sliderThumbMeta = registerSliderThumb(loader, {
3835
+ parentComponentName: SLIDER_COMPONENT_NAME
3836
+ });
3837
+ const sliderTrackMeta = registerSliderTrack(sliderThumbMeta, loader, {
3838
+ parentComponentName: SLIDER_COMPONENT_NAME
3839
+ });
3535
3840
  registerComponentHelper(
3536
3841
  loader,
3537
3842
  BaseSlider,
3538
3843
  {
3539
- name: SLIDER_COMPONENT_NAME,
3540
- displayName: "Aria Slider",
3844
+ name: RANGE_SLIDER_COMPONENT_NAME,
3845
+ displayName: "Aria Range Slider",
3541
3846
  importPath: "@plasmicpkgs/react-aria/skinny/registerSlider",
3542
3847
  importName: "BaseSlider",
3543
3848
  interactionVariants: interactionVariants$3,
3544
3849
  defaultStyles: {
3545
3850
  width: "300px"
3546
3851
  },
3547
- props: __spreadProps$2(__spreadValues$4({}, getCommonInputProps("slider", [
3852
+ props: __spreadProps$2(__spreadValues$4(__spreadValues$4({}, getCommonProps("slider", [
3548
3853
  "isDisabled",
3549
- "name",
3550
- "autoFocus",
3551
3854
  "aria-label"
3552
- ])), {
3855
+ ])), getCommonSliderProps()), {
3856
+ value: {
3857
+ type: "array",
3858
+ editOnly: true,
3859
+ displayName: "Initial value",
3860
+ uncontrolledProp: "defaultValue",
3861
+ description: "The intial value of the slider",
3862
+ defaultValue: [20, 50],
3863
+ validator: (value) => {
3864
+ if (!Array.isArray(value)) {
3865
+ return "Input must be an array.";
3866
+ }
3867
+ for (let i = 1; i < value.length; i++) {
3868
+ if (value[i] < value[i - 1]) {
3869
+ return "Array elements are not in ascending order.";
3870
+ }
3871
+ }
3872
+ return true;
3873
+ }
3874
+ },
3553
3875
  children: {
3554
3876
  type: "slot",
3555
3877
  defaultValue: [
@@ -3573,10 +3895,7 @@ function registerSlider(loader, overrides) {
3573
3895
  },
3574
3896
  {
3575
3897
  type: "component",
3576
- name: makeChildComponentName(
3577
- SLIDER_COMPONENT_NAME,
3578
- SLIDER_OUTPUT_COMPONENT_NAME
3579
- ),
3898
+ name: sliderOutputMeta.name,
3580
3899
  props: {
3581
3900
  children: {
3582
3901
  type: "text",
@@ -3588,49 +3907,102 @@ function registerSlider(loader, overrides) {
3588
3907
  },
3589
3908
  {
3590
3909
  type: "component",
3591
- name: makeChildComponentName(
3592
- SLIDER_COMPONENT_NAME,
3593
- SLIDER_TRACK_COMPONENT_NAME
3594
- )
3910
+ name: sliderTrackMeta.name,
3911
+ props: {
3912
+ children: [
3913
+ {
3914
+ type: "component",
3915
+ name: sliderThumbMeta.name
3916
+ },
3917
+ {
3918
+ type: "component",
3919
+ name: sliderThumbMeta.name,
3920
+ styles: {
3921
+ backgroundColor: "blue"
3922
+ }
3923
+ }
3924
+ ]
3925
+ }
3595
3926
  }
3596
3927
  ]
3597
3928
  },
3598
- orientation: {
3599
- type: "choice",
3600
- options: ["horizontal", "vertical"],
3601
- defaultValueHint: "horizontal",
3602
- defaultValue: "horizontal"
3603
- },
3604
- minValue: {
3605
- type: "number",
3606
- description: "The minimum value of the slider",
3607
- defaultValueHint: 0
3608
- },
3609
- maxValue: {
3610
- type: "number",
3611
- description: "The maximum value of the slider",
3612
- defaultValueHint: 100
3613
- },
3614
- step: {
3615
- type: "number",
3616
- description: "The step value of the slider",
3617
- defaultValueHint: 1
3618
- },
3619
- isMultiValue: {
3620
- type: "boolean",
3621
- displayName: "Multi-valued",
3622
- description: "Whether the slider supports range (multiple thumbs)",
3623
- defaultValue: false,
3624
- defaultValueHint: false
3929
+ onChange: {
3930
+ type: "eventHandler",
3931
+ argTypes: [{ name: "value", type: "object" }]
3625
3932
  },
3626
- range: {
3627
- type: "array",
3628
- editOnly: true,
3629
- uncontrolledProp: "defaultRange",
3630
- description: "The default range of the slider",
3631
- defaultValueHint: [10, 20],
3632
- defaultValue: [10, 20],
3633
- hidden: (ps) => !ps.isMultiValue
3933
+ onChangeEnd: {
3934
+ type: "eventHandler",
3935
+ argTypes: [{ name: "value", type: "object" }]
3936
+ }
3937
+ }),
3938
+ states: {
3939
+ value: {
3940
+ type: "writable",
3941
+ valueProp: "value",
3942
+ onChangeProp: "onChange",
3943
+ variableType: "array"
3944
+ }
3945
+ },
3946
+ trapsFocus: true
3947
+ },
3948
+ {
3949
+ parentComponentName: SLIDER_COMPONENT_NAME
3950
+ }
3951
+ );
3952
+ registerComponentHelper(
3953
+ loader,
3954
+ BaseSlider,
3955
+ {
3956
+ name: SLIDER_COMPONENT_NAME,
3957
+ displayName: "Aria Slider",
3958
+ importPath: "@plasmicpkgs/react-aria/skinny/registerSlider",
3959
+ importName: "BaseSlider",
3960
+ interactionVariants: interactionVariants$3,
3961
+ defaultStyles: {
3962
+ width: "300px"
3963
+ },
3964
+ props: __spreadProps$2(__spreadValues$4(__spreadValues$4({}, getCommonProps("slider", [
3965
+ "isDisabled",
3966
+ "aria-label"
3967
+ ])), getCommonSliderProps()), {
3968
+ children: {
3969
+ type: "slot",
3970
+ defaultValue: [
3971
+ {
3972
+ type: "hbox",
3973
+ styles: {
3974
+ width: "stretch",
3975
+ justifyContent: "space-between",
3976
+ padding: "8px 0px"
3977
+ },
3978
+ children: [
3979
+ {
3980
+ type: "component",
3981
+ name: LABEL_COMPONENT_NAME,
3982
+ props: {
3983
+ children: {
3984
+ type: "text",
3985
+ value: "Label"
3986
+ }
3987
+ }
3988
+ },
3989
+ {
3990
+ type: "component",
3991
+ name: sliderOutputMeta.name,
3992
+ props: {
3993
+ children: {
3994
+ type: "text",
3995
+ value: "Output"
3996
+ }
3997
+ }
3998
+ }
3999
+ ]
4000
+ },
4001
+ {
4002
+ type: "component",
4003
+ name: sliderTrackMeta.name
4004
+ }
4005
+ ]
3634
4006
  },
3635
4007
  value: {
3636
4008
  type: "number",
@@ -3638,52 +4010,29 @@ function registerSlider(loader, overrides) {
3638
4010
  uncontrolledProp: "defaultValue",
3639
4011
  description: "The default value of the slider",
3640
4012
  defaultValueHint: 0,
3641
- defaultValue: 0,
3642
- hidden: (ps) => Boolean(ps.isMultiValue)
4013
+ defaultValue: 0
3643
4014
  },
3644
4015
  onChange: {
3645
4016
  type: "eventHandler",
3646
- argTypes: [{ name: "value", type: "object" }]
4017
+ argTypes: [{ name: "value", type: "number" }]
3647
4018
  },
3648
4019
  onChangeEnd: {
3649
4020
  type: "eventHandler",
3650
- argTypes: [{ name: "value", type: "object" }]
4021
+ argTypes: [{ name: "value", type: "number" }]
3651
4022
  }
3652
4023
  }),
3653
4024
  states: {
3654
- range: __spreadValues$4({
3655
- type: "writable",
3656
- valueProp: "range",
3657
- onChangeProp: "onChange",
3658
- variableType: "array",
3659
- hidden: (ps) => !ps.isMultiValue
3660
- }, sliderHelpers.states.range),
3661
- value: __spreadValues$4({
4025
+ value: {
3662
4026
  type: "writable",
3663
4027
  valueProp: "value",
3664
4028
  onChangeProp: "onChange",
3665
- variableType: "number",
3666
- hidden: (ps) => Boolean(ps.isMultiValue)
3667
- }, sliderHelpers.states.value)
3668
- },
3669
- componentHelpers: {
3670
- helpers: sliderHelpers,
3671
- importName: "sliderHelpers",
3672
- importPath: "@plasmicpkgs/react-aria/skinny/registerSlider"
4029
+ variableType: "number"
4030
+ }
3673
4031
  },
3674
4032
  trapsFocus: true
3675
4033
  },
3676
4034
  overrides
3677
4035
  );
3678
- registerSliderOutput(loader, {
3679
- parentComponentName: SLIDER_COMPONENT_NAME
3680
- });
3681
- registerSliderThumb(loader, {
3682
- parentComponentName: SLIDER_COMPONENT_NAME
3683
- });
3684
- registerSliderTrack(loader, {
3685
- parentComponentName: SLIDER_COMPONENT_NAME
3686
- });
3687
4036
  }
3688
4037
 
3689
4038
  var __defProp$3 = Object.defineProperty;
@@ -3770,7 +4119,7 @@ function registerSwitch(loader, overrides) {
3770
4119
  justifyContent: "flex-start",
3771
4120
  padding: 0
3772
4121
  },
3773
- props: __spreadProps$1(__spreadValues$3({}, getCommonInputProps("switch", [
4122
+ props: __spreadProps$1(__spreadValues$3({}, getCommonProps("switch", [
3774
4123
  "name",
3775
4124
  "isDisabled",
3776
4125
  "isReadOnly",
@@ -3849,10 +4198,16 @@ function registerSwitch(loader, overrides) {
3849
4198
  ]
3850
4199
  },
3851
4200
  value: {
4201
+ type: "string",
4202
+ description: 'The value of the switch in "selected" state, used when submitting an HTML form.',
4203
+ defaultValueHint: "on"
4204
+ },
4205
+ isSelected: {
3852
4206
  type: "boolean",
3853
4207
  editOnly: true,
4208
+ displayName: "Default Selected",
3854
4209
  uncontrolledProp: "defaultSelected",
3855
- description: "Whether the switch is toggled on",
4210
+ description: "Whether the switch should be selected by default",
3856
4211
  defaultValueHint: false
3857
4212
  },
3858
4213
  onChange: {
@@ -3863,7 +4218,7 @@ function registerSwitch(loader, overrides) {
3863
4218
  states: {
3864
4219
  isSelected: {
3865
4220
  type: "writable",
3866
- valueProp: "value",
4221
+ valueProp: "isSelected",
3867
4222
  onChangeProp: "onChange",
3868
4223
  variableType: "boolean"
3869
4224
  }
@@ -3910,20 +4265,30 @@ const TEXTAREA_INTERACTION_VARIANTS = [
3910
4265
  const { interactionVariants: interactionVariants$1 } = pickAriaComponentVariants(
3911
4266
  TEXTAREA_INTERACTION_VARIANTS
3912
4267
  );
4268
+ const inputHelpers = {
4269
+ states: {
4270
+ value: {
4271
+ onChangeArgsToValue: (e) => {
4272
+ return e.target.value;
4273
+ }
4274
+ }
4275
+ }
4276
+ };
3913
4277
  function BaseTextArea(props) {
3914
4278
  var _b;
3915
4279
  const _a = props, { disabled, updateInteractionVariant, setControlContextData } = _a, rest = __objRest$2(_a, ["disabled", "updateInteractionVariant", "setControlContextData"]);
3916
- const context = React.useContext(PlasmicTextFieldContext);
3917
- const isStandalone = !context;
4280
+ const textFieldContext = React.useContext(PlasmicTextFieldContext);
3918
4281
  const mergedProps = mergeProps(rest, {
3919
- disabled: (_b = context == null ? void 0 : context.isDisabled) != null ? _b : disabled
4282
+ disabled: (_b = textFieldContext == null ? void 0 : textFieldContext.isDisabled) != null ? _b : disabled
3920
4283
  });
3921
4284
  useEffect(() => {
3922
4285
  updateInteractionVariant == null ? void 0 : updateInteractionVariant({
3923
4286
  disabled: mergedProps.disabled
3924
4287
  });
3925
4288
  }, [mergedProps.disabled, updateInteractionVariant]);
3926
- setControlContextData == null ? void 0 : setControlContextData({ isStandalone });
4289
+ setControlContextData == null ? void 0 : setControlContextData({
4290
+ parent: textFieldContext
4291
+ });
3927
4292
  return /* @__PURE__ */ React.createElement(
3928
4293
  TextArea,
3929
4294
  __spreadValues$2({
@@ -3955,36 +4320,45 @@ function registerTextArea(loader, overrides) {
3955
4320
  importPath: "@plasmicpkgs/react-aria/skinny/registerTextArea",
3956
4321
  importName: "BaseTextArea",
3957
4322
  interactionVariants: interactionVariants$1,
3958
- props: {
3959
- placeholder: {
3960
- type: "string"
3961
- },
3962
- disabled: {
3963
- type: "boolean",
3964
- description: "Whether the input is disabled",
3965
- defaultValueHint: false,
3966
- hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
3967
- },
3968
- onKeyDown: {
3969
- type: "eventHandler",
3970
- argTypes: [{ name: "keyboardEvent", type: "object" }]
3971
- },
3972
- onKeyUp: {
3973
- type: "eventHandler",
3974
- argTypes: [{ name: "keyboardEvent", type: "object" }]
3975
- },
3976
- onCopy: {
3977
- type: "eventHandler",
3978
- argTypes: [{ name: "clipbordEvent", type: "object" }]
3979
- },
3980
- onCut: {
3981
- type: "eventHandler",
3982
- argTypes: [{ name: "clipbordEvent", type: "object" }]
3983
- },
3984
- onPaste: {
3985
- type: "eventHandler",
3986
- argTypes: [{ name: "clipbordEvent", type: "object" }]
3987
- }
4323
+ props: __spreadValues$2({}, getCommonProps("Text Area", [
4324
+ "name",
4325
+ "disabled",
4326
+ "readOnly",
4327
+ "autoFocus",
4328
+ "aria-label",
4329
+ "required",
4330
+ "placeholder",
4331
+ "value",
4332
+ "maxLength",
4333
+ "minLength",
4334
+ "inputMode",
4335
+ "onChange",
4336
+ "onFocus",
4337
+ "onBlur",
4338
+ "onKeyDown",
4339
+ "onKeyUp",
4340
+ "onCopy",
4341
+ "onCut",
4342
+ "onPaste",
4343
+ "onCompositionStart",
4344
+ "onCompositionEnd",
4345
+ "onCompositionUpdate",
4346
+ "onSelect",
4347
+ "onBeforeInput",
4348
+ "onInput"
4349
+ ])),
4350
+ states: {
4351
+ value: __spreadValues$2({
4352
+ type: "writable",
4353
+ valueProp: "value",
4354
+ onChangeProp: "onChange",
4355
+ variableType: "text"
4356
+ }, inputHelpers.states.value)
4357
+ },
4358
+ componentHelpers: {
4359
+ helpers: inputHelpers,
4360
+ importName: "inputHelpers",
4361
+ importPath: "@plasmicpkgs/react-aria/skinny/registerTextArea"
3988
4362
  },
3989
4363
  trapsFocus: true
3990
4364
  },
@@ -4031,31 +4405,15 @@ const { interactionVariants, withObservedValues } = pickAriaComponentVariants(
4031
4405
  TEXT_FIELD_INTERACTION_VARIANTS
4032
4406
  );
4033
4407
  function BaseTextField(props) {
4034
- const _a = props, {
4035
- enableAutoComplete,
4036
- autoComplete,
4408
+ const _a = props, { children, updateInteractionVariant, autoComplete } = _a, rest = __objRest$1(_a, ["children", "updateInteractionVariant", "autoComplete"]);
4409
+ return /* @__PURE__ */ React.createElement(PlasmicTextFieldContext.Provider, { value: props }, /* @__PURE__ */ React.createElement(TextField, __spreadValues$1({ autoComplete: resolveAutoComplete(autoComplete) }, rest), ({ isDisabled, isReadOnly }) => withObservedValues(
4037
4410
  children,
4411
+ {
4412
+ disabled: isDisabled,
4413
+ readonly: isReadOnly
4414
+ },
4038
4415
  updateInteractionVariant
4039
- } = _a, rest = __objRest$1(_a, [
4040
- "enableAutoComplete",
4041
- "autoComplete",
4042
- "children",
4043
- "updateInteractionVariant"
4044
- ]);
4045
- return /* @__PURE__ */ React.createElement(PlasmicTextFieldContext.Provider, { value: props }, /* @__PURE__ */ React.createElement(
4046
- TextField,
4047
- __spreadValues$1({
4048
- autoComplete: enableAutoComplete ? autoComplete : void 0
4049
- }, rest),
4050
- ({ isDisabled, isReadOnly }) => withObservedValues(
4051
- children,
4052
- {
4053
- disabled: isDisabled,
4054
- readonly: isReadOnly
4055
- },
4056
- updateInteractionVariant
4057
- )
4058
- ));
4416
+ )));
4059
4417
  }
4060
4418
  const TEXT_FIELD_COMPONENT_NAME = makeComponentName("textField");
4061
4419
  function registerTextField(loader, overrides) {
@@ -4069,13 +4427,36 @@ function registerTextField(loader, overrides) {
4069
4427
  importName: "BaseTextField",
4070
4428
  interactionVariants,
4071
4429
  // TODO: Support for validate prop
4072
- props: __spreadProps(__spreadValues$1({}, getCommonInputProps("input", [
4430
+ props: __spreadProps(__spreadValues$1({}, getCommonProps("Text Field", [
4073
4431
  "name",
4074
4432
  "isDisabled",
4075
4433
  "isReadOnly",
4076
4434
  "autoFocus",
4077
4435
  "aria-label",
4078
- "isRequired"
4436
+ "isRequired",
4437
+ "value",
4438
+ "maxLength",
4439
+ "minLength",
4440
+ "pattern",
4441
+ "type",
4442
+ "inputMode",
4443
+ "validationBehavior",
4444
+ "autoComplete",
4445
+ "onChange",
4446
+ "onFocus",
4447
+ "onBlur",
4448
+ "onFocusChange",
4449
+ "onKeyDown",
4450
+ "onKeyUp",
4451
+ "onCopy",
4452
+ "onCut",
4453
+ "onPaste",
4454
+ "onCompositionStart",
4455
+ "onCompositionEnd",
4456
+ "onCompositionUpdate",
4457
+ "onSelect",
4458
+ "onBeforeInput",
4459
+ "onInput"
4079
4460
  ])), {
4080
4461
  children: {
4081
4462
  type: "slot",
@@ -4119,12 +4500,6 @@ function registerTextField(loader, overrides) {
4119
4500
  ]
4120
4501
  }
4121
4502
  },
4122
- value: {
4123
- type: "string",
4124
- editOnly: true,
4125
- uncontrolledProp: "defaultValue",
4126
- description: "The current value"
4127
- },
4128
4503
  isInvalid: {
4129
4504
  // TODO: Not sure if needed
4130
4505
  displayName: "Invalid",
@@ -4136,190 +4511,8 @@ function registerTextField(loader, overrides) {
4136
4511
  // TODO: Not sure if needed
4137
4512
  type: "array",
4138
4513
  description: "Errors for custom validation"
4139
- },
4140
- // validate: {
4141
- // type: "function" as const,
4142
- // argNames: ["value"],
4143
- // argValues: (_ps: any, ctx: any) => [ctx.data[0]],
4144
- // },
4145
- enableAutoComplete: {
4146
- type: "boolean",
4147
- description: "Whether the browser is allowed to automatically complete the input",
4148
- defaultValueHint: false
4149
- },
4150
- autoComplete: {
4151
- type: "choice",
4152
- hidden: ({ enableAutoComplete }) => !enableAutoComplete,
4153
- description: "Guidance as to the type of data expected in the field",
4154
- helpText: "For explanations on what each of the values mean, check https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values",
4155
- options: [
4156
- "name",
4157
- "honorific-prefix",
4158
- "given-name",
4159
- "additional-name",
4160
- "family-name",
4161
- "honorific-suffix",
4162
- "nickname",
4163
- "email",
4164
- "username",
4165
- "new-password",
4166
- "current-password",
4167
- "one-time-code",
4168
- "organization-title",
4169
- "organization",
4170
- "street-address",
4171
- "shipping",
4172
- "billing",
4173
- "address-line1",
4174
- "address-line2",
4175
- "address-line3",
4176
- "address-level4",
4177
- "address-level3",
4178
- "address-level2",
4179
- "address-level1",
4180
- "country",
4181
- "country-name",
4182
- "postal-code",
4183
- "cc-name",
4184
- "cc-given-name",
4185
- "cc-additional-name",
4186
- "cc-family-name",
4187
- "cc-number",
4188
- "cc-exp",
4189
- "cc-exp-month",
4190
- "cc-exp-year",
4191
- "cc-csc",
4192
- "cc-type",
4193
- "transaction-currency",
4194
- "transaction-amount",
4195
- "language",
4196
- "bday",
4197
- "bday-day",
4198
- "bday-month",
4199
- "bday-year",
4200
- "sex",
4201
- "tel",
4202
- "tel-country-code",
4203
- "tel-national",
4204
- "tel-area-code",
4205
- "tel-local",
4206
- "tel-local-suffix",
4207
- "tel-local-prefix",
4208
- "tel-extension",
4209
- "impp",
4210
- "url",
4211
- "photo",
4212
- "webauthn"
4213
- ]
4214
- },
4215
- maxLength: {
4216
- type: "number",
4217
- description: "The maximum number of characters supported by the input"
4218
- },
4219
- minLength: {
4220
- type: "number",
4221
- description: "The minimum number of characters supported by the input"
4222
- },
4223
- pattern: {
4224
- type: "string",
4225
- description: "Regex pattern that the value of the input must match to be valid",
4226
- helpText: "For more information about writing Regular Expressions (regex), check out https://regexr.com/",
4227
- validator: (value) => {
4228
- try {
4229
- new RegExp(value);
4230
- return true;
4231
- } catch (error) {
4232
- return "Invalid Regex";
4233
- }
4234
- }
4235
- },
4236
- type: {
4237
- type: "choice",
4238
- defaultValueHint: "text",
4239
- options: ["text", "search", "url", "tel", "email", "password"]
4240
- },
4241
- inputMode: {
4242
- type: "choice",
4243
- description: "hint to browsers as to the type of virtual keyboard configuration to use when editing this element or its contents.",
4244
- options: [
4245
- "none",
4246
- "text",
4247
- "tel",
4248
- "url",
4249
- "email",
4250
- "numeric",
4251
- "decimal",
4252
- "search"
4253
- ]
4254
- },
4255
- validationBehavior: {
4256
- type: "choice",
4257
- options: ["native", "aria"],
4258
- 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.",
4259
- defaultValueHint: "native"
4260
- },
4261
- onChange: {
4262
- type: "eventHandler",
4263
- argTypes: [{ name: "value", type: "string" }]
4264
- },
4265
- onFocus: {
4266
- type: "eventHandler",
4267
- argTypes: [{ name: "focusEvent", type: "object" }]
4268
- },
4269
- onBlur: {
4270
- type: "eventHandler",
4271
- argTypes: [{ name: "focusEvent", type: "object" }]
4272
- },
4273
- onFocusChange: {
4274
- type: "eventHandler",
4275
- argTypes: [{ name: "isFocused", type: "boolean" }]
4276
- },
4277
- onKeyDown: {
4278
- type: "eventHandler",
4279
- argTypes: [{ name: "keyboardEvent", type: "object" }]
4280
- },
4281
- onKeyUp: {
4282
- type: "eventHandler",
4283
- argTypes: [{ name: "keyboardEvent", type: "object" }]
4284
- },
4285
- onCopy: {
4286
- type: "eventHandler",
4287
- argTypes: [{ name: "clipbordEvent", type: "object" }]
4288
- },
4289
- onCut: {
4290
- type: "eventHandler",
4291
- argTypes: [{ name: "clipbordEvent", type: "object" }]
4292
- },
4293
- onPaste: {
4294
- type: "eventHandler",
4295
- argTypes: [{ name: "clipbordEvent", type: "object" }]
4296
- },
4297
- onCompositionStart: {
4298
- type: "eventHandler",
4299
- argTypes: [{ name: "compositionEvent", type: "object" }]
4300
- },
4301
- onCompositionEnd: {
4302
- type: "eventHandler",
4303
- argTypes: [{ name: "compositionEvent", type: "object" }]
4304
- },
4305
- onCompositionUpdate: {
4306
- type: "eventHandler",
4307
- argTypes: [{ name: "compositionEvent", type: "object" }]
4308
- },
4309
- onSelect: {
4310
- type: "eventHandler",
4311
- argTypes: [{ name: "selectionEvent", type: "object" }]
4312
- },
4313
- onBeforeInput: {
4314
- type: "eventHandler",
4315
- argTypes: [{ name: "inputEvent", type: "object" }]
4316
- },
4317
- onInput: {
4318
- type: "eventHandler",
4319
- argTypes: [{ name: "inputEvent", type: "object" }]
4320
4514
  }
4321
4515
  }),
4322
- // NOTE: React-Aria does not support render props for <Input> and <Textarea>, so focusVisible and inputHovered states are not implemented
4323
4516
  states: {
4324
4517
  value: {
4325
4518
  type: "writable",