@plasmicpkgs/react-aria 0.0.28 → 0.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/contexts.d.ts +4 -0
  3. package/dist/interaction-variant-utils.d.ts +4 -0
  4. package/dist/react-aria.esm.js +2494 -1120
  5. package/dist/react-aria.esm.js.map +1 -1
  6. package/dist/react-aria.js +2491 -1117
  7. package/dist/react-aria.js.map +1 -1
  8. package/dist/registerButton.d.ts +1 -0
  9. package/dist/registerCheckbox.d.ts +8 -2
  10. package/dist/registerCheckboxGroup.d.ts +2 -2
  11. package/dist/registerDescription.d.ts +2 -1
  12. package/dist/registerDialogTrigger.d.ts +1 -2
  13. package/dist/registerHeader.d.ts +1 -1
  14. package/dist/registerInput.d.ts +1 -0
  15. package/dist/registerLabel.d.ts +1 -0
  16. package/dist/registerListBox.d.ts +3 -6
  17. package/dist/registerListBoxItem.d.ts +3 -1
  18. package/dist/registerModal.d.ts +3 -1
  19. package/dist/registerPopover.d.ts +3 -0
  20. package/dist/registerRadio.d.ts +5 -2
  21. package/dist/registerRadioGroup.d.ts +3 -3
  22. package/dist/registerSection.d.ts +1 -1
  23. package/dist/registerSelect.d.ts +5 -2
  24. package/dist/registerSlider.d.ts +14 -0
  25. package/dist/registerSliderOutput.d.ts +5 -0
  26. package/dist/registerSliderThumb.d.ts +13 -0
  27. package/dist/registerSliderTrack.d.ts +14 -0
  28. package/dist/registerText.d.ts +2 -1
  29. package/dist/registerTextField.d.ts +1 -0
  30. package/dist/utils.d.ts +9 -2
  31. package/package.json +2 -2
  32. package/skinny/ErrorBoundary-c6b111d3.esm.js +20 -0
  33. package/skinny/ErrorBoundary-c6b111d3.esm.js.map +1 -0
  34. package/skinny/ErrorBoundary-e9b86248.cjs.js +22 -0
  35. package/skinny/ErrorBoundary-e9b86248.cjs.js.map +1 -0
  36. package/skinny/contexts-9475faad.esm.js +16 -0
  37. package/skinny/contexts-9475faad.esm.js.map +1 -0
  38. package/skinny/{contexts-3e42cdf9.cjs.js → contexts-b21f6b12.cjs.js} +9 -1
  39. package/skinny/contexts-b21f6b12.cjs.js.map +1 -0
  40. package/skinny/contexts.d.ts +4 -0
  41. package/skinny/{interaction-variant-utils-0f05190f.cjs.js → interaction-variant-utils-244b74fb.cjs.js} +5 -1
  42. package/skinny/interaction-variant-utils-244b74fb.cjs.js.map +1 -0
  43. package/skinny/{interaction-variant-utils-909267e5.esm.js → interaction-variant-utils-c44a9d56.esm.js} +5 -1
  44. package/skinny/interaction-variant-utils-c44a9d56.esm.js.map +1 -0
  45. package/skinny/interaction-variant-utils.d.ts +4 -0
  46. package/skinny/registerButton.cjs.js +20 -5
  47. package/skinny/registerButton.cjs.js.map +1 -1
  48. package/skinny/registerButton.d.ts +1 -0
  49. package/skinny/registerButton.esm.js +20 -6
  50. package/skinny/registerButton.esm.js.map +1 -1
  51. package/skinny/registerCheckbox.cjs.js +76 -7
  52. package/skinny/registerCheckbox.cjs.js.map +1 -1
  53. package/skinny/registerCheckbox.d.ts +8 -2
  54. package/skinny/registerCheckbox.esm.js +76 -8
  55. package/skinny/registerCheckbox.esm.js.map +1 -1
  56. package/skinny/registerCheckboxGroup.cjs.js +90 -14
  57. package/skinny/registerCheckboxGroup.cjs.js.map +1 -1
  58. package/skinny/registerCheckboxGroup.d.ts +2 -2
  59. package/skinny/registerCheckboxGroup.esm.js +89 -17
  60. package/skinny/registerCheckboxGroup.esm.js.map +1 -1
  61. package/skinny/registerComboBox.cjs.js +113 -8
  62. package/skinny/registerComboBox.cjs.js.map +1 -1
  63. package/skinny/registerComboBox.esm.js +109 -4
  64. package/skinny/registerComboBox.esm.js.map +1 -1
  65. package/skinny/registerDescription.cjs.js +10 -3
  66. package/skinny/registerDescription.cjs.js.map +1 -1
  67. package/skinny/registerDescription.d.ts +2 -1
  68. package/skinny/registerDescription.esm.js +10 -4
  69. package/skinny/registerDescription.esm.js.map +1 -1
  70. package/skinny/registerDialogTrigger.cjs.js +25 -4
  71. package/skinny/registerDialogTrigger.cjs.js.map +1 -1
  72. package/skinny/registerDialogTrigger.d.ts +1 -2
  73. package/skinny/registerDialogTrigger.esm.js +25 -4
  74. package/skinny/registerDialogTrigger.esm.js.map +1 -1
  75. package/skinny/registerFieldError.cjs.js +21 -11
  76. package/skinny/registerFieldError.cjs.js.map +1 -1
  77. package/skinny/registerFieldError.esm.js +21 -11
  78. package/skinny/registerFieldError.esm.js.map +1 -1
  79. package/skinny/registerForm.cjs.js +1 -1
  80. package/skinny/registerForm.esm.js +1 -1
  81. package/skinny/registerHeader.cjs.js +7 -3
  82. package/skinny/registerHeader.cjs.js.map +1 -1
  83. package/skinny/registerHeader.d.ts +1 -1
  84. package/skinny/registerHeader.esm.js +7 -3
  85. package/skinny/registerHeader.esm.js.map +1 -1
  86. package/skinny/registerInput.cjs.js +12 -3
  87. package/skinny/registerInput.cjs.js.map +1 -1
  88. package/skinny/registerInput.d.ts +1 -0
  89. package/skinny/registerInput.esm.js +12 -4
  90. package/skinny/registerInput.esm.js.map +1 -1
  91. package/skinny/registerLabel.cjs.js +7 -2
  92. package/skinny/registerLabel.cjs.js.map +1 -1
  93. package/skinny/registerLabel.d.ts +1 -0
  94. package/skinny/registerLabel.esm.js +7 -3
  95. package/skinny/registerLabel.esm.js.map +1 -1
  96. package/skinny/registerListBox-1effa43d.esm.js +299 -0
  97. package/skinny/registerListBox-1effa43d.esm.js.map +1 -0
  98. package/skinny/registerListBox-837b90d8.cjs.js +311 -0
  99. package/skinny/registerListBox-837b90d8.cjs.js.map +1 -0
  100. package/skinny/registerListBox.cjs.js +14 -108
  101. package/skinny/registerListBox.cjs.js.map +1 -1
  102. package/skinny/registerListBox.d.ts +3 -6
  103. package/skinny/registerListBox.esm.js +11 -106
  104. package/skinny/registerListBox.esm.js.map +1 -1
  105. package/skinny/registerListBoxItem.cjs.js +49 -5
  106. package/skinny/registerListBoxItem.cjs.js.map +1 -1
  107. package/skinny/registerListBoxItem.d.ts +3 -1
  108. package/skinny/registerListBoxItem.esm.js +49 -6
  109. package/skinny/registerListBoxItem.esm.js.map +1 -1
  110. package/skinny/registerModal.cjs.js +78 -9
  111. package/skinny/registerModal.cjs.js.map +1 -1
  112. package/skinny/registerModal.d.ts +3 -1
  113. package/skinny/registerModal.esm.js +78 -10
  114. package/skinny/registerModal.esm.js.map +1 -1
  115. package/skinny/registerPopover.cjs.js +56 -4
  116. package/skinny/registerPopover.cjs.js.map +1 -1
  117. package/skinny/registerPopover.d.ts +3 -0
  118. package/skinny/registerPopover.esm.js +55 -5
  119. package/skinny/registerPopover.esm.js.map +1 -1
  120. package/skinny/registerRadio.cjs.js +54 -24
  121. package/skinny/registerRadio.cjs.js.map +1 -1
  122. package/skinny/registerRadio.d.ts +5 -2
  123. package/skinny/registerRadio.esm.js +54 -25
  124. package/skinny/registerRadio.esm.js.map +1 -1
  125. package/skinny/registerRadioGroup.cjs.js +82 -17
  126. package/skinny/registerRadioGroup.cjs.js.map +1 -1
  127. package/skinny/registerRadioGroup.d.ts +3 -3
  128. package/skinny/registerRadioGroup.esm.js +81 -20
  129. package/skinny/registerRadioGroup.esm.js.map +1 -1
  130. package/skinny/registerSection.cjs.js +36 -12
  131. package/skinny/registerSection.cjs.js.map +1 -1
  132. package/skinny/registerSection.d.ts +1 -1
  133. package/skinny/registerSection.esm.js +36 -12
  134. package/skinny/registerSection.esm.js.map +1 -1
  135. package/skinny/registerSelect.cjs.js +133 -30
  136. package/skinny/registerSelect.cjs.js.map +1 -1
  137. package/skinny/registerSelect.d.ts +5 -2
  138. package/skinny/registerSelect.esm.js +130 -25
  139. package/skinny/registerSelect.esm.js.map +1 -1
  140. package/skinny/registerSlider-39783c91.esm.js +425 -0
  141. package/skinny/registerSlider-39783c91.esm.js.map +1 -0
  142. package/skinny/registerSlider-ac9f3b1e.cjs.js +437 -0
  143. package/skinny/registerSlider-ac9f3b1e.cjs.js.map +1 -0
  144. package/skinny/registerSlider.cjs.js +23 -0
  145. package/skinny/registerSlider.cjs.js.map +1 -0
  146. package/skinny/registerSlider.d.ts +14 -0
  147. package/skinny/registerSlider.esm.js +15 -0
  148. package/skinny/registerSlider.esm.js.map +1 -0
  149. package/skinny/registerSliderOutput.cjs.js +30 -0
  150. package/skinny/registerSliderOutput.cjs.js.map +1 -0
  151. package/skinny/registerSliderOutput.d.ts +5 -0
  152. package/skinny/registerSliderOutput.esm.js +26 -0
  153. package/skinny/registerSliderOutput.esm.js.map +1 -0
  154. package/skinny/registerSliderThumb.cjs.js +119 -0
  155. package/skinny/registerSliderThumb.cjs.js.map +1 -0
  156. package/skinny/registerSliderThumb.d.ts +13 -0
  157. package/skinny/registerSliderThumb.esm.js +111 -0
  158. package/skinny/registerSliderThumb.esm.js.map +1 -0
  159. package/skinny/registerSliderTrack.cjs.js +23 -0
  160. package/skinny/registerSliderTrack.cjs.js.map +1 -0
  161. package/skinny/registerSliderTrack.d.ts +14 -0
  162. package/skinny/registerSliderTrack.esm.js +15 -0
  163. package/skinny/registerSliderTrack.esm.js.map +1 -0
  164. package/skinny/registerSwitch.cjs.js +84 -4
  165. package/skinny/registerSwitch.cjs.js.map +1 -1
  166. package/skinny/registerSwitch.esm.js +84 -4
  167. package/skinny/registerSwitch.esm.js.map +1 -1
  168. package/skinny/registerText.cjs.js +11 -4
  169. package/skinny/registerText.cjs.js.map +1 -1
  170. package/skinny/registerText.d.ts +2 -1
  171. package/skinny/registerText.esm.js +11 -5
  172. package/skinny/registerText.esm.js.map +1 -1
  173. package/skinny/registerTextArea.cjs.js +2 -2
  174. package/skinny/registerTextArea.esm.js +2 -2
  175. package/skinny/registerTextField.cjs.js +48 -7
  176. package/skinny/registerTextField.cjs.js.map +1 -1
  177. package/skinny/registerTextField.d.ts +1 -0
  178. package/skinny/registerTextField.esm.js +51 -11
  179. package/skinny/registerTextField.esm.js.map +1 -1
  180. package/skinny/registerTooltip.cjs.js +1 -1
  181. package/skinny/registerTooltip.esm.js +1 -1
  182. package/skinny/{utils-cf2632c9.esm.js → utils-5051df41.esm.js} +3 -2
  183. package/skinny/utils-5051df41.esm.js.map +1 -0
  184. package/skinny/{utils-18b2465b.cjs.js → utils-745db876.cjs.js} +2 -1
  185. package/skinny/utils-745db876.cjs.js.map +1 -0
  186. package/skinny/utils.d.ts +9 -2
  187. package/skinny/contexts-3e42cdf9.cjs.js.map +0 -1
  188. package/skinny/contexts-49f6c298.esm.js +0 -12
  189. package/skinny/contexts-49f6c298.esm.js.map +0 -1
  190. package/skinny/interaction-variant-utils-0f05190f.cjs.js.map +0 -1
  191. package/skinny/interaction-variant-utils-909267e5.esm.js.map +0 -1
  192. package/skinny/option-utils-4f037568.esm.js +0 -153
  193. package/skinny/option-utils-4f037568.esm.js.map +0 -1
  194. package/skinny/option-utils-5e4e85bd.cjs.js +0 -162
  195. package/skinny/option-utils-5e4e85bd.cjs.js.map +0 -1
  196. package/skinny/utils-18b2465b.cjs.js.map +0 -1
  197. package/skinny/utils-cf2632c9.esm.js.map +0 -1
@@ -1,10 +1,10 @@
1
- import React, { forwardRef, useImperativeHandle, Component } from 'react';
2
- import { Button, Checkbox, Text, FieldError, Label, CheckboxGroup, ComboBox, ComboBoxStateContext, DialogTrigger, Form, Input, ListBoxItem, ListBox, Heading, ModalOverlay, Modal, Dialog, PopoverContext, Popover, Radio, RadioGroup, Header, Section, Collection, SelectValue, Select, Switch, TextArea, TextField } from 'react-aria-components';
1
+ import React, { forwardRef, useImperativeHandle, Component, useMemo, useRef, useEffect } from 'react';
2
+ import { Button, Label, Checkbox, Text, FieldError, CheckboxGroup, Input, ListBoxItem, Header, Section, Collection, ListBox, PopoverContext, 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 } from '@react-aria/utils';
6
6
  import { usePlasmicCanvasContext } from '@plasmicapp/host';
7
- import { useTooltipTrigger } from 'react-aria';
7
+ import { mergeProps as mergeProps$1, useTooltipTrigger } from 'react-aria';
8
8
  import flattenChildren from 'react-keyed-flatten-children';
9
9
  import { useTooltipTriggerState } from 'react-stately';
10
10
 
@@ -74,6 +74,10 @@ const ARIA_COMPONENTS_INTERACTION_VARIANTS = {
74
74
  focusVisible: {
75
75
  cssSelector: "[data-focus-visible]",
76
76
  displayName: "Focus Visible"
77
+ },
78
+ dragging: {
79
+ cssSelector: "[data-dragging]",
80
+ displayName: "Dragging"
77
81
  }
78
82
  };
79
83
  function ChangesObserver({
@@ -107,29 +111,29 @@ function pickAriaComponentVariants(keys) {
107
111
  };
108
112
  }
109
113
 
110
- var __defProp$m = Object.defineProperty;
111
- var __defProps$c = Object.defineProperties;
112
- var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
113
- var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
114
- var __hasOwnProp$m = Object.prototype.hasOwnProperty;
115
- var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
116
- var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
117
- var __spreadValues$m = (a, b) => {
114
+ var __defProp$q = Object.defineProperty;
115
+ var __defProps$e = Object.defineProperties;
116
+ var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
117
+ var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
118
+ var __hasOwnProp$q = Object.prototype.hasOwnProperty;
119
+ var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
120
+ var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
121
+ var __spreadValues$q = (a, b) => {
118
122
  for (var prop in b || (b = {}))
119
- if (__hasOwnProp$m.call(b, prop))
120
- __defNormalProp$m(a, prop, b[prop]);
121
- if (__getOwnPropSymbols$m)
122
- for (var prop of __getOwnPropSymbols$m(b)) {
123
- if (__propIsEnum$m.call(b, prop))
124
- __defNormalProp$m(a, prop, b[prop]);
123
+ if (__hasOwnProp$q.call(b, prop))
124
+ __defNormalProp$q(a, prop, b[prop]);
125
+ if (__getOwnPropSymbols$q)
126
+ for (var prop of __getOwnPropSymbols$q(b)) {
127
+ if (__propIsEnum$q.call(b, prop))
128
+ __defNormalProp$q(a, prop, b[prop]);
125
129
  }
126
130
  return a;
127
131
  };
128
- var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
132
+ var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
129
133
  function registerComponentHelper(loader, component, meta, overrides) {
130
134
  if (overrides) {
131
- meta = __spreadProps$c(__spreadValues$m(__spreadValues$m({}, meta), overrides), {
132
- props: __spreadValues$m(__spreadValues$m({}, meta.props), overrides.props)
135
+ meta = __spreadProps$e(__spreadValues$q(__spreadValues$q({}, meta), overrides), {
136
+ props: __spreadValues$q(__spreadValues$q({}, meta.props), overrides.props)
133
137
  });
134
138
  if (overrides.parentComponentName) {
135
139
  meta.name = makeChildComponentName(
@@ -143,6 +147,7 @@ function registerComponentHelper(loader, component, meta, overrides) {
143
147
  } else {
144
148
  registerComponent(component, meta);
145
149
  }
150
+ return meta;
146
151
  }
147
152
  function makeComponentName(name) {
148
153
  return `plasmic-react-aria-${name}`;
@@ -165,33 +170,33 @@ function withoutNils(array) {
165
170
  return array.filter((x) => x != null);
166
171
  }
167
172
 
168
- var __defProp$l = Object.defineProperty;
169
- var __defProps$b = Object.defineProperties;
170
- var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
171
- var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
172
- var __hasOwnProp$l = Object.prototype.hasOwnProperty;
173
- var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
174
- var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
175
- var __spreadValues$l = (a, b) => {
173
+ var __defProp$p = Object.defineProperty;
174
+ var __defProps$d = Object.defineProperties;
175
+ var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
176
+ var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
177
+ var __hasOwnProp$p = Object.prototype.hasOwnProperty;
178
+ var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
179
+ var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
180
+ var __spreadValues$p = (a, b) => {
176
181
  for (var prop in b || (b = {}))
177
- if (__hasOwnProp$l.call(b, prop))
178
- __defNormalProp$l(a, prop, b[prop]);
179
- if (__getOwnPropSymbols$l)
180
- for (var prop of __getOwnPropSymbols$l(b)) {
181
- if (__propIsEnum$l.call(b, prop))
182
- __defNormalProp$l(a, prop, b[prop]);
182
+ if (__hasOwnProp$p.call(b, prop))
183
+ __defNormalProp$p(a, prop, b[prop]);
184
+ if (__getOwnPropSymbols$p)
185
+ for (var prop of __getOwnPropSymbols$p(b)) {
186
+ if (__propIsEnum$p.call(b, prop))
187
+ __defNormalProp$p(a, prop, b[prop]);
183
188
  }
184
189
  return a;
185
190
  };
186
- var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
187
- var __objRest$e = (source, exclude) => {
191
+ var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
192
+ var __objRest$h = (source, exclude) => {
188
193
  var target = {};
189
194
  for (var prop in source)
190
- if (__hasOwnProp$l.call(source, prop) && exclude.indexOf(prop) < 0)
195
+ if (__hasOwnProp$p.call(source, prop) && exclude.indexOf(prop) < 0)
191
196
  target[prop] = source[prop];
192
- if (source != null && __getOwnPropSymbols$l)
193
- for (var prop of __getOwnPropSymbols$l(source)) {
194
- if (exclude.indexOf(prop) < 0 && __propIsEnum$l.call(source, prop))
197
+ if (source != null && __getOwnPropSymbols$p)
198
+ for (var prop of __getOwnPropSymbols$p(source)) {
199
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$p.call(source, prop))
195
200
  target[prop] = source[prop];
196
201
  }
197
202
  return target;
@@ -202,7 +207,7 @@ const BUTTON_INTERACTION_VARIANTS = [
202
207
  "focused",
203
208
  "focusVisible"
204
209
  ];
205
- const { interactionVariants: interactionVariants$5, withObservedValues: withObservedValues$3 } = pickAriaComponentVariants(
210
+ const { interactionVariants: interactionVariants$7, withObservedValues: withObservedValues$5 } = pickAriaComponentVariants(
206
211
  BUTTON_INTERACTION_VARIANTS
207
212
  );
208
213
  function BaseButton(props) {
@@ -211,14 +216,14 @@ function BaseButton(props) {
211
216
  resetsForm,
212
217
  children,
213
218
  updateInteractionVariant
214
- } = _a, rest = __objRest$e(_a, [
219
+ } = _a, rest = __objRest$h(_a, [
215
220
  "submitsForm",
216
221
  "resetsForm",
217
222
  "children",
218
223
  "updateInteractionVariant"
219
224
  ]);
220
225
  const type = submitsForm ? "submit" : resetsForm ? "reset" : "button";
221
- return /* @__PURE__ */ React.createElement(Button, __spreadValues$l({ type }, rest), ({ isHovered, isPressed, isFocused, isFocusVisible }) => withObservedValues$3(
226
+ return /* @__PURE__ */ React.createElement(Button, __spreadValues$p({ type }, rest), ({ isHovered, isPressed, isFocused, isFocusVisible }) => withObservedValues$5(
222
227
  children,
223
228
  {
224
229
  hovered: isHovered,
@@ -229,21 +234,35 @@ function BaseButton(props) {
229
234
  updateInteractionVariant
230
235
  ));
231
236
  }
237
+ const BUTTON_COMPONENT_NAME = makeComponentName("button");
232
238
  function registerButton(loader, overrides) {
233
239
  registerComponentHelper(
234
240
  loader,
235
241
  BaseButton,
236
242
  {
237
- name: makeComponentName("button"),
243
+ name: BUTTON_COMPONENT_NAME,
238
244
  displayName: "Aria Button",
239
245
  importPath: "@plasmicpkgs/react-aria/skinny/registerButton",
240
246
  importName: "BaseButton",
241
- interactionVariants: interactionVariants$5,
242
- props: __spreadProps$b(__spreadValues$l({}, getCommonInputProps("button", [
247
+ interactionVariants: interactionVariants$7,
248
+ defaultStyles: {
249
+ borderWidth: "1px",
250
+ borderStyle: "solid",
251
+ borderColor: "black",
252
+ padding: "2px 10px"
253
+ },
254
+ props: __spreadProps$d(__spreadValues$p({}, getCommonInputProps("button", [
243
255
  "isDisabled",
244
- "aria-label",
245
- "children"
256
+ "aria-label"
246
257
  ])), {
258
+ children: {
259
+ type: "slot",
260
+ mergeWithParent: true,
261
+ defaultValue: {
262
+ type: "text",
263
+ value: "Button"
264
+ }
265
+ },
247
266
  submitsForm: {
248
267
  type: "boolean",
249
268
  displayName: "Submits form?",
@@ -271,33 +290,70 @@ function registerButton(loader, overrides) {
271
290
  );
272
291
  }
273
292
 
274
- var __defProp$k = Object.defineProperty;
275
- var __defProps$a = Object.defineProperties;
276
- var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
277
- var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
278
- var __hasOwnProp$k = Object.prototype.hasOwnProperty;
279
- var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
280
- var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
281
- var __spreadValues$k = (a, b) => {
293
+ const PlasmicCheckboxGroupContext = React.createContext(void 0);
294
+ const PlasmicRadioGroupContext = React.createContext(void 0);
295
+ const PlasmicDialogTriggerContext = React.createContext(void 0);
296
+ const PlasmicSliderContext = React.createContext(void 0);
297
+ React.createContext(void 0);
298
+ const PlasmicListBoxContext = React.createContext(void 0);
299
+ const PlasmicPopoverContext = React.createContext(void 0);
300
+ const PlasmicItemContext = React.createContext(void 0);
301
+ const PlasmicSectionContext = React.createContext(void 0);
302
+ const PlasmicHeaderContext = React.createContext(void 0);
303
+ const PlasmicInputContext = React.createContext(void 0);
304
+
305
+ const BaseLabel = Label;
306
+ const LABEL_COMPONENT_NAME = makeComponentName("label");
307
+ function registerLabel(loader, overrides) {
308
+ registerComponentHelper(
309
+ loader,
310
+ BaseLabel,
311
+ {
312
+ name: LABEL_COMPONENT_NAME,
313
+ displayName: "Aria Label",
314
+ importPath: "@plasmicpkgs/react-aria/skinny/registerLabel",
315
+ importName: "BaseLabel",
316
+ defaultStyles: {
317
+ cursor: "pointer"
318
+ },
319
+ props: {
320
+ children: {
321
+ type: "slot"
322
+ }
323
+ },
324
+ trapsFocus: true
325
+ },
326
+ overrides
327
+ );
328
+ }
329
+
330
+ var __defProp$o = Object.defineProperty;
331
+ var __defProps$c = Object.defineProperties;
332
+ var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
333
+ var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
334
+ var __hasOwnProp$o = Object.prototype.hasOwnProperty;
335
+ var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
336
+ var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
337
+ var __spreadValues$o = (a, b) => {
282
338
  for (var prop in b || (b = {}))
283
- if (__hasOwnProp$k.call(b, prop))
284
- __defNormalProp$k(a, prop, b[prop]);
285
- if (__getOwnPropSymbols$k)
286
- for (var prop of __getOwnPropSymbols$k(b)) {
287
- if (__propIsEnum$k.call(b, prop))
288
- __defNormalProp$k(a, prop, b[prop]);
339
+ if (__hasOwnProp$o.call(b, prop))
340
+ __defNormalProp$o(a, prop, b[prop]);
341
+ if (__getOwnPropSymbols$o)
342
+ for (var prop of __getOwnPropSymbols$o(b)) {
343
+ if (__propIsEnum$o.call(b, prop))
344
+ __defNormalProp$o(a, prop, b[prop]);
289
345
  }
290
346
  return a;
291
347
  };
292
- var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
293
- var __objRest$d = (source, exclude) => {
348
+ var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
349
+ var __objRest$g = (source, exclude) => {
294
350
  var target = {};
295
351
  for (var prop in source)
296
- if (__hasOwnProp$k.call(source, prop) && exclude.indexOf(prop) < 0)
352
+ if (__hasOwnProp$o.call(source, prop) && exclude.indexOf(prop) < 0)
297
353
  target[prop] = source[prop];
298
- if (source != null && __getOwnPropSymbols$k)
299
- for (var prop of __getOwnPropSymbols$k(source)) {
300
- if (exclude.indexOf(prop) < 0 && __propIsEnum$k.call(source, prop))
354
+ if (source != null && __getOwnPropSymbols$o)
355
+ for (var prop of __getOwnPropSymbols$o(source)) {
356
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$o.call(source, prop))
301
357
  target[prop] = source[prop];
302
358
  }
303
359
  return target;
@@ -308,12 +364,17 @@ const CHECKBOX_INTERACTION_VARIANTS = [
308
364
  "focused",
309
365
  "focusVisible"
310
366
  ];
311
- const { interactionVariants: interactionVariants$4, withObservedValues: withObservedValues$2 } = pickAriaComponentVariants(
367
+ const { interactionVariants: interactionVariants$6, withObservedValues: withObservedValues$4 } = pickAriaComponentVariants(
312
368
  CHECKBOX_INTERACTION_VARIANTS
313
369
  );
314
370
  function BaseCheckbox(props) {
315
- const _a = props, { children, updateInteractionVariant } = _a, rest = __objRest$d(_a, ["children", "updateInteractionVariant"]);
316
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Checkbox, __spreadValues$k({}, rest), ({ isHovered, isPressed, isFocused, isFocusVisible }) => withObservedValues$2(
371
+ const _a = props, { children, updateInteractionVariant, setControlContextData } = _a, rest = __objRest$g(_a, ["children", "updateInteractionVariant", "setControlContextData"]);
372
+ const contextProps = React.useContext(PlasmicCheckboxGroupContext);
373
+ const isStandalone = !contextProps;
374
+ setControlContextData == null ? void 0 : setControlContextData({
375
+ isStandalone
376
+ });
377
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Checkbox, __spreadValues$o({}, rest), ({ isHovered, isPressed, isFocused, isFocusVisible }) => withObservedValues$4(
317
378
  children,
318
379
  {
319
380
  hovered: isHovered,
@@ -324,8 +385,60 @@ function BaseCheckbox(props) {
324
385
  updateInteractionVariant
325
386
  )));
326
387
  }
388
+ const makeDefaultCheckboxChildren = ({
389
+ label,
390
+ showDocs
391
+ }) => ({
392
+ type: "vbox",
393
+ styles: {
394
+ display: "flex",
395
+ alignItems: "center",
396
+ gap: "2px",
397
+ padding: 0
398
+ },
399
+ children: [
400
+ {
401
+ type: "hbox",
402
+ styles: {
403
+ display: "flex",
404
+ alignItems: "center",
405
+ gap: "10px",
406
+ padding: 0
407
+ },
408
+ children: [
409
+ {
410
+ type: "box",
411
+ styles: {
412
+ width: "7px",
413
+ height: "7px",
414
+ borderRadius: "3px",
415
+ borderWidth: "1px",
416
+ borderStyle: "solid",
417
+ borderColor: "black"
418
+ }
419
+ },
420
+ {
421
+ type: "component",
422
+ name: LABEL_COMPONENT_NAME,
423
+ props: {
424
+ children: {
425
+ type: "text",
426
+ value: label
427
+ }
428
+ }
429
+ }
430
+ ]
431
+ },
432
+ ...showDocs ? [
433
+ {
434
+ type: "text",
435
+ value: "Add interaction variants to see it in action..."
436
+ }
437
+ ] : []
438
+ ]
439
+ });
327
440
  function registerCheckbox(loader, overrides) {
328
- registerComponentHelper(
441
+ return registerComponentHelper(
329
442
  loader,
330
443
  BaseCheckbox,
331
444
  {
@@ -333,16 +446,23 @@ function registerCheckbox(loader, overrides) {
333
446
  displayName: "Aria Checkbox",
334
447
  importPath: "@plasmicpkgs/react-aria/skinny/registerCheckbox",
335
448
  importName: "BaseCheckbox",
336
- interactionVariants: interactionVariants$4,
337
- props: __spreadProps$a(__spreadValues$k({}, getCommonInputProps("checkbox", [
449
+ interactionVariants: interactionVariants$6,
450
+ props: __spreadProps$c(__spreadValues$o({}, getCommonInputProps("checkbox", [
338
451
  "name",
339
452
  "isDisabled",
340
453
  "isReadOnly",
341
454
  "aria-label",
342
- "children",
343
455
  "isRequired",
344
456
  "autoFocus"
345
457
  ])), {
458
+ children: {
459
+ type: "slot",
460
+ mergeWithParent: true,
461
+ defaultValue: makeDefaultCheckboxChildren({
462
+ label: "Label",
463
+ showDocs: true
464
+ })
465
+ },
346
466
  value: {
347
467
  type: "string",
348
468
  description: "The value of the input element, used when submitting an HTML form."
@@ -352,7 +472,8 @@ function registerCheckbox(loader, overrides) {
352
472
  editOnly: true,
353
473
  uncontrolledProp: "defaultSelected",
354
474
  description: "Whether the checkbox is toggled on",
355
- defaultValueHint: false
475
+ defaultValueHint: false,
476
+ defaultValue: false
356
477
  },
357
478
  isIndeterminate: {
358
479
  displayName: "Indeterminate",
@@ -382,7 +503,8 @@ function registerCheckbox(loader, overrides) {
382
503
  type: "writable",
383
504
  valueProp: "isSelected",
384
505
  onChangeProp: "onChange",
385
- variableType: "boolean"
506
+ variableType: "boolean",
507
+ hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
386
508
  }
387
509
  },
388
510
  trapsFocus: true
@@ -391,50 +513,56 @@ function registerCheckbox(loader, overrides) {
391
513
  );
392
514
  }
393
515
 
394
- var __defProp$j = Object.defineProperty;
395
- var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
396
- var __hasOwnProp$j = Object.prototype.hasOwnProperty;
397
- var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
398
- var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
399
- var __spreadValues$j = (a, b) => {
516
+ var __defProp$n = Object.defineProperty;
517
+ var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
518
+ var __hasOwnProp$n = Object.prototype.hasOwnProperty;
519
+ var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
520
+ var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
521
+ var __spreadValues$n = (a, b) => {
400
522
  for (var prop in b || (b = {}))
401
- if (__hasOwnProp$j.call(b, prop))
402
- __defNormalProp$j(a, prop, b[prop]);
403
- if (__getOwnPropSymbols$j)
404
- for (var prop of __getOwnPropSymbols$j(b)) {
405
- if (__propIsEnum$j.call(b, prop))
406
- __defNormalProp$j(a, prop, b[prop]);
523
+ if (__hasOwnProp$n.call(b, prop))
524
+ __defNormalProp$n(a, prop, b[prop]);
525
+ if (__getOwnPropSymbols$n)
526
+ for (var prop of __getOwnPropSymbols$n(b)) {
527
+ if (__propIsEnum$n.call(b, prop))
528
+ __defNormalProp$n(a, prop, b[prop]);
407
529
  }
408
530
  return a;
409
531
  };
410
- var __objRest$c = (source, exclude) => {
532
+ var __objRest$f = (source, exclude) => {
411
533
  var target = {};
412
534
  for (var prop in source)
413
- if (__hasOwnProp$j.call(source, prop) && exclude.indexOf(prop) < 0)
535
+ if (__hasOwnProp$n.call(source, prop) && exclude.indexOf(prop) < 0)
414
536
  target[prop] = source[prop];
415
- if (source != null && __getOwnPropSymbols$j)
416
- for (var prop of __getOwnPropSymbols$j(source)) {
417
- if (exclude.indexOf(prop) < 0 && __propIsEnum$j.call(source, prop))
537
+ if (source != null && __getOwnPropSymbols$n)
538
+ for (var prop of __getOwnPropSymbols$n(source)) {
539
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$n.call(source, prop))
418
540
  target[prop] = source[prop];
419
541
  }
420
542
  return target;
421
543
  };
422
544
  function BaseText(_a) {
423
- var _b = _a, { children } = _b, rest = __objRest$c(_b, ["children"]);
424
- return /* @__PURE__ */ React.createElement(Text, __spreadValues$j({}, rest), children);
545
+ var _b = _a, { children } = _b, rest = __objRest$f(_b, ["children"]);
546
+ return /* @__PURE__ */ React.createElement(Text, __spreadValues$n({}, rest), children);
425
547
  }
548
+ const TEXT_COMPONENT_NAME = makeComponentName("text");
426
549
  function registerText(loader, overrides) {
427
- registerComponentHelper(
550
+ return registerComponentHelper(
428
551
  loader,
429
552
  BaseText,
430
553
  {
431
- name: makeComponentName("text"),
554
+ name: TEXT_COMPONENT_NAME,
432
555
  displayName: "Aria Text",
433
556
  importPath: "@plasmicpkgs/react-aria/skinny/registerText",
434
557
  importName: "BaseText",
435
558
  props: {
436
559
  children: {
437
- type: "slot"
560
+ type: "slot",
561
+ mergeWithParent: true,
562
+ defaultValue: {
563
+ type: "text",
564
+ value: "Some text..."
565
+ }
438
566
  },
439
567
  slot: {
440
568
  type: "string"
@@ -446,58 +574,64 @@ function registerText(loader, overrides) {
446
574
  );
447
575
  }
448
576
 
449
- var __defProp$i = Object.defineProperty;
450
- var __defProps$9 = Object.defineProperties;
451
- var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
452
- var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
453
- var __hasOwnProp$i = Object.prototype.hasOwnProperty;
454
- var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
455
- var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
456
- var __spreadValues$i = (a, b) => {
577
+ var __defProp$m = Object.defineProperty;
578
+ var __defProps$b = Object.defineProperties;
579
+ var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
580
+ var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
581
+ var __hasOwnProp$m = Object.prototype.hasOwnProperty;
582
+ var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
583
+ var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
584
+ var __spreadValues$m = (a, b) => {
457
585
  for (var prop in b || (b = {}))
458
- if (__hasOwnProp$i.call(b, prop))
459
- __defNormalProp$i(a, prop, b[prop]);
460
- if (__getOwnPropSymbols$i)
461
- for (var prop of __getOwnPropSymbols$i(b)) {
462
- if (__propIsEnum$i.call(b, prop))
463
- __defNormalProp$i(a, prop, b[prop]);
586
+ if (__hasOwnProp$m.call(b, prop))
587
+ __defNormalProp$m(a, prop, b[prop]);
588
+ if (__getOwnPropSymbols$m)
589
+ for (var prop of __getOwnPropSymbols$m(b)) {
590
+ if (__propIsEnum$m.call(b, prop))
591
+ __defNormalProp$m(a, prop, b[prop]);
464
592
  }
465
593
  return a;
466
594
  };
467
- var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
595
+ var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
596
+ const DESCRIPTION_COMPONENT_NAME = makeComponentName("description");
468
597
  function registerDescription(loader, overrides) {
469
- registerText(loader, __spreadProps$9(__spreadValues$i({}, overrides), {
598
+ return registerText(loader, __spreadProps$b(__spreadValues$m({}, overrides), {
599
+ name: DESCRIPTION_COMPONENT_NAME,
470
600
  displayName: "Aria Description",
471
601
  props: {
472
- slot: { type: "string", hidden: () => true, defaultValue: "description" }
602
+ slot: {
603
+ type: "string",
604
+ hidden: () => true,
605
+ defaultValue: "description"
606
+ }
473
607
  }
474
608
  }));
475
609
  }
476
610
 
477
- var __defProp$h = Object.defineProperty;
478
- var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
479
- var __hasOwnProp$h = Object.prototype.hasOwnProperty;
480
- var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
481
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
482
- var __spreadValues$h = (a, b) => {
611
+ var __defProp$l = Object.defineProperty;
612
+ var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
613
+ var __hasOwnProp$l = Object.prototype.hasOwnProperty;
614
+ var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
615
+ var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
616
+ var __spreadValues$l = (a, b) => {
483
617
  for (var prop in b || (b = {}))
484
- if (__hasOwnProp$h.call(b, prop))
485
- __defNormalProp$h(a, prop, b[prop]);
486
- if (__getOwnPropSymbols$h)
487
- for (var prop of __getOwnPropSymbols$h(b)) {
488
- if (__propIsEnum$h.call(b, prop))
489
- __defNormalProp$h(a, prop, b[prop]);
618
+ if (__hasOwnProp$l.call(b, prop))
619
+ __defNormalProp$l(a, prop, b[prop]);
620
+ if (__getOwnPropSymbols$l)
621
+ for (var prop of __getOwnPropSymbols$l(b)) {
622
+ if (__propIsEnum$l.call(b, prop))
623
+ __defNormalProp$l(a, prop, b[prop]);
490
624
  }
491
625
  return a;
492
626
  };
493
- var __objRest$b = (source, exclude) => {
627
+ var __objRest$e = (source, exclude) => {
494
628
  var target = {};
495
629
  for (var prop in source)
496
- if (__hasOwnProp$h.call(source, prop) && exclude.indexOf(prop) < 0)
630
+ if (__hasOwnProp$l.call(source, prop) && exclude.indexOf(prop) < 0)
497
631
  target[prop] = source[prop];
498
- if (source != null && __getOwnPropSymbols$h)
499
- for (var prop of __getOwnPropSymbols$h(source)) {
500
- if (exclude.indexOf(prop) < 0 && __propIsEnum$h.call(source, prop))
632
+ if (source != null && __getOwnPropSymbols$l)
633
+ for (var prop of __getOwnPropSymbols$l(source)) {
634
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$l.call(source, prop))
501
635
  target[prop] = source[prop];
502
636
  }
503
637
  return target;
@@ -514,7 +648,7 @@ function BaseFieldError(_a) {
514
648
  tooShort,
515
649
  typeMismatch,
516
650
  valueMissing
517
- } = _b, rest = __objRest$b(_b, [
651
+ } = _b, rest = __objRest$e(_b, [
518
652
  "badInput",
519
653
  "customError",
520
654
  "patternMismatch",
@@ -526,27 +660,37 @@ function BaseFieldError(_a) {
526
660
  "typeMismatch",
527
661
  "valueMissing"
528
662
  ]);
529
- return /* @__PURE__ */ React.createElement(FieldError, __spreadValues$h({}, rest), ({ validationDetails, validationErrors }) => {
530
- if (validationDetails.badInput && badInput)
663
+ return /* @__PURE__ */ React.createElement(FieldError, __spreadValues$l({}, rest), ({ validationDetails, validationErrors }) => {
664
+ if (validationDetails.badInput && badInput) {
531
665
  return badInput;
532
- if (validationDetails.customError && customError)
666
+ }
667
+ if (validationDetails.customError && customError) {
533
668
  return customError;
534
- if (validationDetails.patternMismatch && patternMismatch)
669
+ }
670
+ if (validationDetails.patternMismatch && patternMismatch) {
535
671
  return patternMismatch;
536
- if (validationDetails.rangeOverflow && rangeOverflow)
672
+ }
673
+ if (validationDetails.rangeOverflow && rangeOverflow) {
537
674
  return rangeOverflow;
538
- if (validationDetails.rangeUnderflow && rangeUnderflow)
675
+ }
676
+ if (validationDetails.rangeUnderflow && rangeUnderflow) {
539
677
  return rangeUnderflow;
540
- if (validationDetails.stepMismatch && stepMismatch)
678
+ }
679
+ if (validationDetails.stepMismatch && stepMismatch) {
541
680
  return stepMismatch;
542
- if (validationDetails.tooLong && tooLong)
681
+ }
682
+ if (validationDetails.tooLong && tooLong) {
543
683
  return tooLong;
544
- if (validationDetails.tooShort && tooShort)
684
+ }
685
+ if (validationDetails.tooShort && tooShort) {
545
686
  return tooShort;
546
- if (validationDetails.typeMismatch && typeMismatch)
687
+ }
688
+ if (validationDetails.typeMismatch && typeMismatch) {
547
689
  return typeMismatch;
548
- if (validationDetails.valueMissing && valueMissing)
690
+ }
691
+ if (validationDetails.valueMissing && valueMissing) {
549
692
  return valueMissing;
693
+ }
550
694
  return validationErrors;
551
695
  });
552
696
  }
@@ -623,58 +767,48 @@ function registerFieldError(loader, overrides) {
623
767
  );
624
768
  }
625
769
 
626
- const BaseLabel = Label;
627
- function registerLabel(loader, overrides) {
770
+ var __defProp$k = Object.defineProperty;
771
+ var __defProps$a = Object.defineProperties;
772
+ var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
773
+ var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
774
+ var __hasOwnProp$k = Object.prototype.hasOwnProperty;
775
+ var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
776
+ var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
777
+ var __spreadValues$k = (a, b) => {
778
+ for (var prop in b || (b = {}))
779
+ if (__hasOwnProp$k.call(b, prop))
780
+ __defNormalProp$k(a, prop, b[prop]);
781
+ if (__getOwnPropSymbols$k)
782
+ for (var prop of __getOwnPropSymbols$k(b)) {
783
+ if (__propIsEnum$k.call(b, prop))
784
+ __defNormalProp$k(a, prop, b[prop]);
785
+ }
786
+ return a;
787
+ };
788
+ var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
789
+ function BaseCheckboxGroup(props) {
790
+ return /* @__PURE__ */ React.createElement(PlasmicCheckboxGroupContext.Provider, { value: props }, /* @__PURE__ */ React.createElement(CheckboxGroup, __spreadValues$k({}, props)));
791
+ }
792
+ const componentName = makeComponentName("checkboxGroup");
793
+ function registerCheckboxGroup(loader, overrides) {
794
+ const thisName = makeChildComponentName(
795
+ overrides == null ? void 0 : overrides.parentComponentName,
796
+ componentName
797
+ );
798
+ registerFieldError(loader, { parentComponentName: thisName });
799
+ const checkboxMeta = registerCheckbox(loader, {
800
+ parentComponentName: thisName
801
+ });
802
+ registerLabel(loader, { parentComponentName: thisName });
628
803
  registerComponentHelper(
629
804
  loader,
630
- BaseLabel,
805
+ BaseCheckboxGroup,
631
806
  {
632
- name: makeComponentName("label"),
633
- displayName: "Aria Label",
634
- importPath: "@plasmicpkgs/react-aria/skinny/registerLabel",
635
- importName: "BaseLabel",
636
- props: {
637
- children: {
638
- type: "slot"
639
- }
640
- },
641
- trapsFocus: true
642
- },
643
- overrides
644
- );
645
- }
646
-
647
- var __defProp$g = Object.defineProperty;
648
- var __defProps$8 = Object.defineProperties;
649
- var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
650
- var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
651
- var __hasOwnProp$g = Object.prototype.hasOwnProperty;
652
- var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
653
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
654
- var __spreadValues$g = (a, b) => {
655
- for (var prop in b || (b = {}))
656
- if (__hasOwnProp$g.call(b, prop))
657
- __defNormalProp$g(a, prop, b[prop]);
658
- if (__getOwnPropSymbols$g)
659
- for (var prop of __getOwnPropSymbols$g(b)) {
660
- if (__propIsEnum$g.call(b, prop))
661
- __defNormalProp$g(a, prop, b[prop]);
662
- }
663
- return a;
664
- };
665
- var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
666
- const BaseCheckboxGroup = CheckboxGroup;
667
- const componentName$2 = makeComponentName("checkboxGroup");
668
- function registerCheckboxGroup(loader, overrides) {
669
- registerComponentHelper(
670
- loader,
671
- BaseCheckboxGroup,
672
- {
673
- name: componentName$2,
807
+ name: componentName,
674
808
  displayName: "Aria Checkbox Group",
675
809
  importPath: "@plasmicpkgs/react-aria/skinny/registerCheckboxGroup",
676
810
  importName: "BaseCheckboxGroup",
677
- props: __spreadProps$8(__spreadValues$g({}, getCommonInputProps("checkbox group", [
811
+ props: __spreadProps$a(__spreadValues$k({}, getCommonInputProps("checkbox group", [
678
812
  "name",
679
813
  "isDisabled",
680
814
  "isReadOnly",
@@ -682,6 +816,76 @@ function registerCheckboxGroup(loader, overrides) {
682
816
  "children",
683
817
  "isRequired"
684
818
  ])), {
819
+ children: {
820
+ type: "slot",
821
+ mergeWithParent: true,
822
+ defaultValue: [
823
+ {
824
+ type: "vbox",
825
+ styles: {
826
+ display: "flex",
827
+ gap: "5px",
828
+ padding: 0,
829
+ alignItems: "flex-start"
830
+ },
831
+ children: [
832
+ {
833
+ type: "component",
834
+ name: LABEL_COMPONENT_NAME,
835
+ props: {
836
+ children: {
837
+ type: "text",
838
+ value: "Checkbox Group"
839
+ }
840
+ }
841
+ },
842
+ {
843
+ type: "component",
844
+ name: checkboxMeta.name,
845
+ props: {
846
+ children: makeDefaultCheckboxChildren({
847
+ label: "Checkbox 1",
848
+ showDocs: false
849
+ }),
850
+ value: "checkbox1"
851
+ }
852
+ },
853
+ {
854
+ type: "component",
855
+ name: checkboxMeta.name,
856
+ props: {
857
+ children: makeDefaultCheckboxChildren({
858
+ label: "Checkbox 2",
859
+ showDocs: false
860
+ }),
861
+ value: "checkbox2"
862
+ }
863
+ },
864
+ {
865
+ type: "component",
866
+ name: checkboxMeta.name,
867
+ props: {
868
+ children: makeDefaultCheckboxChildren({
869
+ label: "Checkbox 3",
870
+ showDocs: false
871
+ }),
872
+ value: "checkbox3"
873
+ }
874
+ },
875
+ {
876
+ type: "component",
877
+ name: DESCRIPTION_COMPONENT_NAME,
878
+ props: {
879
+ children: {
880
+ type: "text",
881
+ value: "Add interaction variants to see it in action..."
882
+ }
883
+ }
884
+ }
885
+ ]
886
+ }
887
+ ]
888
+ },
685
889
  value: {
686
890
  type: "array",
687
891
  editOnly: true,
@@ -717,26 +921,8 @@ function registerCheckboxGroup(loader, overrides) {
717
921
  },
718
922
  overrides
719
923
  );
720
- const thisName = makeChildComponentName(
721
- overrides == null ? void 0 : overrides.parentComponentName,
722
- componentName$2
723
- );
724
- registerFieldError(loader, { parentComponentName: thisName });
725
- registerCheckbox(loader, { parentComponentName: thisName });
726
- registerLabel(loader, { parentComponentName: thisName });
727
- registerDescription(loader, {
728
- parentComponentName: thisName
729
- });
730
924
  }
731
925
 
732
- React.createContext(void 0);
733
- const PlasmicListBoxContext = React.createContext(void 0);
734
- const PlasmicPopoverContext = React.createContext(void 0);
735
- const PlasmicItemContext = React.createContext(void 0);
736
- const PlasmicSectionContext = React.createContext(void 0);
737
- const PlasmicHeaderContext = React.createContext(void 0);
738
- const PlasmicInputContext = React.createContext(void 0);
739
-
740
926
  function useStrictOptions(props) {
741
927
  const { options, optionInfo } = props;
742
928
  return React.useMemo(() => {
@@ -867,6 +1053,22 @@ function makeOptionsPropType() {
867
1053
  id: "option2",
868
1054
  label: "Option 2",
869
1055
  type: "option"
1056
+ },
1057
+ {
1058
+ label: "Section 1",
1059
+ type: "option-group",
1060
+ items: [
1061
+ {
1062
+ id: "section-1-1",
1063
+ label: "Section item 1",
1064
+ type: "option"
1065
+ },
1066
+ {
1067
+ id: "section-1-2",
1068
+ label: "Section item 2",
1069
+ type: "option"
1070
+ }
1071
+ ]
870
1072
  }
871
1073
  ]
872
1074
  };
@@ -886,126 +1088,648 @@ function makeValuePropType() {
886
1088
  return type;
887
1089
  }
888
1090
 
889
- var __defProp$f = Object.defineProperty;
890
- var __defProps$7 = Object.defineProperties;
891
- var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
892
- var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
893
- var __hasOwnProp$f = Object.prototype.hasOwnProperty;
894
- var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
895
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
896
- var __spreadValues$f = (a, b) => {
1091
+ var __defProp$j = Object.defineProperty;
1092
+ var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
1093
+ var __hasOwnProp$j = Object.prototype.hasOwnProperty;
1094
+ var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
1095
+ var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1096
+ var __spreadValues$j = (a, b) => {
897
1097
  for (var prop in b || (b = {}))
898
- if (__hasOwnProp$f.call(b, prop))
899
- __defNormalProp$f(a, prop, b[prop]);
900
- if (__getOwnPropSymbols$f)
901
- for (var prop of __getOwnPropSymbols$f(b)) {
902
- if (__propIsEnum$f.call(b, prop))
903
- __defNormalProp$f(a, prop, b[prop]);
1098
+ if (__hasOwnProp$j.call(b, prop))
1099
+ __defNormalProp$j(a, prop, b[prop]);
1100
+ if (__getOwnPropSymbols$j)
1101
+ for (var prop of __getOwnPropSymbols$j(b)) {
1102
+ if (__propIsEnum$j.call(b, prop))
1103
+ __defNormalProp$j(a, prop, b[prop]);
904
1104
  }
905
1105
  return a;
906
1106
  };
907
- var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
908
- function BaseComboBox(props) {
909
- const {
910
- value,
911
- onChange,
912
- menuTrigger,
913
- filterValue,
914
- onFilterValueChange,
915
- valueType,
916
- allowsCustomValue,
917
- placeholder,
918
- previewOpen,
919
- onOpenChange,
920
- isDisabled,
921
- className,
922
- style,
923
- structure,
924
- name
925
- } = props;
926
- const { options, optionText } = useStrictOptions(props);
927
- const { contains } = useFilter({ sensitivity: "base" });
928
- const [showAllOptions, setShowAllOptions] = React.useState(false);
929
- const filteredOptions = React.useMemo(() => {
930
- if (!filterValue || filterValue.trim().length === 0) {
931
- return options;
932
- }
933
- if (!options) {
934
- return options;
1107
+ var __objRest$d = (source, exclude) => {
1108
+ var target = {};
1109
+ for (var prop in source)
1110
+ if (__hasOwnProp$j.call(source, prop) && exclude.indexOf(prop) < 0)
1111
+ target[prop] = source[prop];
1112
+ if (source != null && __getOwnPropSymbols$j)
1113
+ for (var prop of __getOwnPropSymbols$j(source)) {
1114
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$j.call(source, prop))
1115
+ target[prop] = source[prop];
935
1116
  }
936
- const filterOptions = (opts) => {
937
- return withoutNils(
938
- opts.map((op) => {
939
- if (op.type === "option-group") {
940
- return __spreadProps$7(__spreadValues$f({}, op), {
941
- items: op.items ? filterOptions(op.items) : void 0
942
- });
943
- } else {
944
- if (contains(optionText(op), filterValue)) {
945
- return op;
946
- } else {
947
- return void 0;
948
- }
949
- }
950
- })
951
- );
952
- };
953
- return filterOptions(options);
954
- }, [filterValue, options, contains, optionText]);
955
- const flattenedOptions = React.useMemo(
956
- () => flattenOptions(options),
957
- [options]
958
- );
959
- const disabledKeys = flattenedOptions.filter((op) => op.isDisabled).map((op) => op.id);
960
- const onSelectionChange = React.useCallback(
961
- (key) => {
962
- if (key === null) {
963
- return;
1117
+ return target;
1118
+ };
1119
+ const INPUT_INTERACTION_VARIANTS = ["focused", "hovered"];
1120
+ const { interactionVariants: interactionVariants$5 } = pickAriaComponentVariants(
1121
+ INPUT_INTERACTION_VARIANTS
1122
+ );
1123
+ function BaseInput(props) {
1124
+ const _a = props, { updateInteractionVariant } = _a, rest = __objRest$d(_a, ["updateInteractionVariant"]);
1125
+ return /* @__PURE__ */ React.createElement(
1126
+ Input,
1127
+ __spreadValues$j({
1128
+ onHoverChange: (isHovered) => {
1129
+ updateInteractionVariant == null ? void 0 : updateInteractionVariant({
1130
+ hovered: isHovered
1131
+ });
1132
+ },
1133
+ onFocus: () => {
1134
+ updateInteractionVariant == null ? void 0 : updateInteractionVariant({
1135
+ focused: true
1136
+ });
1137
+ },
1138
+ onBlur: () => {
1139
+ updateInteractionVariant == null ? void 0 : updateInteractionVariant({
1140
+ focused: false
1141
+ });
964
1142
  }
965
- const selectedOption = flattenedOptions == null ? void 0 : flattenedOptions.find((op) => op.id === key);
966
- if (valueType === "text") {
967
- if (selectedOption) {
968
- onChange == null ? void 0 : onChange(optionText(selectedOption));
1143
+ }, rest)
1144
+ );
1145
+ }
1146
+ const INPUT_COMPONENT_NAME = makeComponentName("input");
1147
+ function registerInput(loader, overrides) {
1148
+ registerComponentHelper(
1149
+ loader,
1150
+ BaseInput,
1151
+ {
1152
+ name: INPUT_COMPONENT_NAME,
1153
+ displayName: "Aria Input",
1154
+ importPath: "@plasmicpkgs/react-aria/skinny/registerInput",
1155
+ importName: "BaseInput",
1156
+ interactionVariants: interactionVariants$5,
1157
+ defaultStyles: {
1158
+ width: "300px",
1159
+ borderWidth: "1px",
1160
+ borderStyle: "solid",
1161
+ borderColor: "black",
1162
+ padding: "2px 10px"
1163
+ },
1164
+ props: {
1165
+ placeholder: {
1166
+ type: "string"
969
1167
  }
970
- } else {
971
- onChange == null ? void 0 : onChange(key);
972
- }
973
- if (selectedOption) {
974
- onFilterValueChange == null ? void 0 : onFilterValueChange(optionText(selectedOption));
975
- }
1168
+ },
1169
+ trapsFocus: true
976
1170
  },
977
- [flattenedOptions, valueType, onChange, optionText, onFilterValueChange]
1171
+ overrides
978
1172
  );
979
- const onInputValueChange = React.useCallback(
980
- (newValue) => {
981
- onFilterValueChange == null ? void 0 : onFilterValueChange(newValue);
982
- setShowAllOptions(false);
983
- if (valueType === "text") {
984
- if (allowsCustomValue) {
985
- onChange == null ? void 0 : onChange(newValue);
986
- } else {
987
- const matchingOption = flattenedOptions == null ? void 0 : flattenedOptions.find(
988
- (op) => optionText(op) === newValue
989
- );
990
- if (matchingOption) {
991
- onChange == null ? void 0 : onChange(optionText(matchingOption));
992
- }
1173
+ }
1174
+
1175
+ var __defProp$i = Object.defineProperty;
1176
+ var __defProps$9 = Object.defineProperties;
1177
+ var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
1178
+ var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
1179
+ var __hasOwnProp$i = Object.prototype.hasOwnProperty;
1180
+ var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
1181
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1182
+ var __spreadValues$i = (a, b) => {
1183
+ for (var prop in b || (b = {}))
1184
+ if (__hasOwnProp$i.call(b, prop))
1185
+ __defNormalProp$i(a, prop, b[prop]);
1186
+ if (__getOwnPropSymbols$i)
1187
+ for (var prop of __getOwnPropSymbols$i(b)) {
1188
+ if (__propIsEnum$i.call(b, prop))
1189
+ __defNormalProp$i(a, prop, b[prop]);
1190
+ }
1191
+ return a;
1192
+ };
1193
+ var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
1194
+ function BaseListBoxItem(props) {
1195
+ const contextProps = React.useContext(PlasmicItemContext);
1196
+ const mergedProps = mergeProps(contextProps, props);
1197
+ return /* @__PURE__ */ React.createElement(ListBoxItem, __spreadProps$9(__spreadValues$i({}, mergedProps), { textValue: contextProps.label }), mergedProps.children);
1198
+ }
1199
+ const makeDefaultListBoxItemChildren = (label, description) => ({
1200
+ type: "vbox",
1201
+ styles: {
1202
+ display: "flex",
1203
+ alignItems: "flex-start",
1204
+ gap: "2px"
1205
+ },
1206
+ children: [
1207
+ {
1208
+ type: "component",
1209
+ name: TEXT_COMPONENT_NAME,
1210
+ props: {
1211
+ slot: "label",
1212
+ children: {
1213
+ type: "text",
1214
+ styles: {
1215
+ fontWeight: 500
1216
+ },
1217
+ value: label
993
1218
  }
994
1219
  }
995
1220
  },
996
- [
997
- onFilterValueChange,
998
- onChange,
999
- flattenedOptions,
1000
- optionText,
1001
- valueType,
1002
- allowsCustomValue
1003
- ]
1004
- );
1005
- const onBlur = React.useCallback(() => {
1006
- if (!allowsCustomValue) {
1007
- const selectedOption = flattenedOptions == null ? void 0 : flattenedOptions.find(
1008
- (op) => valueType === "text" ? optionText(op) === value : op.id === value
1221
+ {
1222
+ type: "component",
1223
+ name: DESCRIPTION_COMPONENT_NAME,
1224
+ props: {
1225
+ children: {
1226
+ type: "text",
1227
+ styles: {
1228
+ color: "#838383"
1229
+ },
1230
+ value: description != null ? description : `Some description for ${label}...`
1231
+ }
1232
+ }
1233
+ }
1234
+ ]
1235
+ });
1236
+ function registerListBoxItem(loader, overrides) {
1237
+ return registerComponentHelper(
1238
+ loader,
1239
+ BaseListBoxItem,
1240
+ {
1241
+ name: makeComponentName("item"),
1242
+ displayName: "Aria ListBoxItem",
1243
+ importPath: "@plasmicpkgs/react-aria/skinny/registerListBoxItem",
1244
+ importName: "BaseListBoxItem",
1245
+ props: {
1246
+ children: {
1247
+ type: "slot",
1248
+ defaultValue: makeDefaultListBoxItemChildren("Item")
1249
+ }
1250
+ }
1251
+ },
1252
+ overrides
1253
+ );
1254
+ }
1255
+
1256
+ var __defProp$h = Object.defineProperty;
1257
+ var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
1258
+ var __hasOwnProp$h = Object.prototype.hasOwnProperty;
1259
+ var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
1260
+ var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1261
+ var __spreadValues$h = (a, b) => {
1262
+ for (var prop in b || (b = {}))
1263
+ if (__hasOwnProp$h.call(b, prop))
1264
+ __defNormalProp$h(a, prop, b[prop]);
1265
+ if (__getOwnPropSymbols$h)
1266
+ for (var prop of __getOwnPropSymbols$h(b)) {
1267
+ if (__propIsEnum$h.call(b, prop))
1268
+ __defNormalProp$h(a, prop, b[prop]);
1269
+ }
1270
+ return a;
1271
+ };
1272
+ function BaseHeader(props) {
1273
+ const contextProps = React.useContext(PlasmicHeaderContext);
1274
+ return /* @__PURE__ */ React.createElement(Header, __spreadValues$h({}, mergeProps(contextProps, props)));
1275
+ }
1276
+ function registerHeader(loader, overrides) {
1277
+ return registerComponentHelper(
1278
+ loader,
1279
+ BaseHeader,
1280
+ {
1281
+ name: makeComponentName("header"),
1282
+ displayName: "Aria Header",
1283
+ importPath: "@plasmicpkgs/react-aria/skinny/registerHeader",
1284
+ importName: "BaseHeader",
1285
+ defaultStyles: {
1286
+ fontWeight: "bold",
1287
+ fontSize: "20px"
1288
+ },
1289
+ props: {}
1290
+ },
1291
+ overrides
1292
+ );
1293
+ }
1294
+
1295
+ var __defProp$g = Object.defineProperty;
1296
+ var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
1297
+ var __hasOwnProp$g = Object.prototype.hasOwnProperty;
1298
+ var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
1299
+ var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1300
+ var __spreadValues$g = (a, b) => {
1301
+ for (var prop in b || (b = {}))
1302
+ if (__hasOwnProp$g.call(b, prop))
1303
+ __defNormalProp$g(a, prop, b[prop]);
1304
+ if (__getOwnPropSymbols$g)
1305
+ for (var prop of __getOwnPropSymbols$g(b)) {
1306
+ if (__propIsEnum$g.call(b, prop))
1307
+ __defNormalProp$g(a, prop, b[prop]);
1308
+ }
1309
+ return a;
1310
+ };
1311
+ function BaseSection(props) {
1312
+ const contextProps = React.useContext(PlasmicSectionContext);
1313
+ const mergedProps = mergeProps(contextProps, props);
1314
+ const { section, renderHeader, key, renderItem } = mergedProps;
1315
+ return /* @__PURE__ */ React.createElement(Section, __spreadValues$g({ id: key }, mergedProps), /* @__PURE__ */ React.createElement(PlasmicHeaderContext.Provider, { value: { children: section == null ? void 0 : section.label } }, renderHeader == null ? void 0 : renderHeader(section)), /* @__PURE__ */ React.createElement(Collection, { items: section == null ? void 0 : section.items }, (item) => {
1316
+ return /* @__PURE__ */ React.createElement(PlasmicItemContext.Provider, { value: item }, renderItem == null ? void 0 : renderItem(item));
1317
+ }));
1318
+ }
1319
+ function registerSection(loader, overrides) {
1320
+ const thisName = makeChildComponentName(
1321
+ overrides == null ? void 0 : overrides.parentComponentName,
1322
+ makeComponentName("section")
1323
+ );
1324
+ const headerMeta = registerHeader(loader, {
1325
+ parentComponentName: thisName
1326
+ });
1327
+ return registerComponentHelper(
1328
+ loader,
1329
+ BaseSection,
1330
+ {
1331
+ name: makeComponentName("section"),
1332
+ displayName: "Aria Section",
1333
+ importPath: "@plasmicpkgs/react-aria/skinny/registerSection",
1334
+ importName: "BaseSection",
1335
+ defaultStyles: {
1336
+ width: "stretch",
1337
+ padding: "10px"
1338
+ },
1339
+ props: {
1340
+ renderHeader: {
1341
+ type: "slot",
1342
+ displayName: "Render section header",
1343
+ renderPropParams: ["sectionProps"],
1344
+ defaultValue: {
1345
+ type: "component",
1346
+ name: headerMeta.name
1347
+ }
1348
+ }
1349
+ }
1350
+ },
1351
+ overrides
1352
+ );
1353
+ }
1354
+
1355
+ var __defProp$f = Object.defineProperty;
1356
+ var __defProps$8 = Object.defineProperties;
1357
+ var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
1358
+ var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
1359
+ var __hasOwnProp$f = Object.prototype.hasOwnProperty;
1360
+ var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
1361
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1362
+ var __spreadValues$f = (a, b) => {
1363
+ for (var prop in b || (b = {}))
1364
+ if (__hasOwnProp$f.call(b, prop))
1365
+ __defNormalProp$f(a, prop, b[prop]);
1366
+ if (__getOwnPropSymbols$f)
1367
+ for (var prop of __getOwnPropSymbols$f(b)) {
1368
+ if (__propIsEnum$f.call(b, prop))
1369
+ __defNormalProp$f(a, prop, b[prop]);
1370
+ }
1371
+ return a;
1372
+ };
1373
+ var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
1374
+ var __objRest$c = (source, exclude) => {
1375
+ var target = {};
1376
+ for (var prop in source)
1377
+ if (__hasOwnProp$f.call(source, prop) && exclude.indexOf(prop) < 0)
1378
+ target[prop] = source[prop];
1379
+ if (source != null && __getOwnPropSymbols$f)
1380
+ for (var prop of __getOwnPropSymbols$f(source)) {
1381
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$f.call(source, prop))
1382
+ target[prop] = source[prop];
1383
+ }
1384
+ return target;
1385
+ };
1386
+ function BaseListBox(props) {
1387
+ var _c;
1388
+ const contextProps = React.useContext(PlasmicListBoxContext);
1389
+ const isStandalone = !contextProps;
1390
+ const _a = props, rest = __objRest$c(_a, ["options"]);
1391
+ const { options } = useStrictOptions(props);
1392
+ const _b = mergeProps(
1393
+ contextProps,
1394
+ rest,
1395
+ isStandalone ? { items: options } : {}
1396
+ ), { renderItem, renderSection } = _b, mergedProps = __objRest$c(_b, ["renderItem", "renderSection"]);
1397
+ (_c = props.setControlContextData) == null ? void 0 : _c.call(props, {
1398
+ isStandalone
1399
+ });
1400
+ return /* @__PURE__ */ React.createElement(ListBox, __spreadValues$f({}, mergedProps), (item) => {
1401
+ var _a2;
1402
+ if (item.type === "option-group") {
1403
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
1404
+ PlasmicSectionContext.Provider,
1405
+ {
1406
+ value: {
1407
+ renderItem,
1408
+ key: (_a2 = item.key) != null ? _a2 : item.label,
1409
+ section: item
1410
+ }
1411
+ },
1412
+ renderSection == null ? void 0 : renderSection(item)
1413
+ ));
1414
+ } else {
1415
+ return /* @__PURE__ */ React.createElement(PlasmicItemContext.Provider, { value: item }, renderItem == null ? void 0 : renderItem(item));
1416
+ }
1417
+ });
1418
+ }
1419
+ const LIST_BOX_COMPONENT_NAME = makeComponentName("listbox");
1420
+ function registerListBox(loader, overrides) {
1421
+ const listBoxItemMeta = registerListBoxItem(loader, {
1422
+ parentComponentName: LIST_BOX_COMPONENT_NAME
1423
+ });
1424
+ const sectionMeta = registerSection(loader, {
1425
+ parentComponentName: LIST_BOX_COMPONENT_NAME
1426
+ });
1427
+ registerComponentHelper(
1428
+ loader,
1429
+ BaseListBox,
1430
+ {
1431
+ name: LIST_BOX_COMPONENT_NAME,
1432
+ displayName: "Aria ListBox",
1433
+ importPath: "@plasmicpkgs/react-aria/skinny/registerListBox",
1434
+ importName: "BaseListBox",
1435
+ defaultStyles: {
1436
+ width: "250px",
1437
+ borderWidth: "1px",
1438
+ borderStyle: "solid",
1439
+ borderColor: "black"
1440
+ },
1441
+ props: {
1442
+ options: __spreadProps$8(__spreadValues$f({}, makeOptionsPropType()), {
1443
+ displayName: "Items",
1444
+ hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
1445
+ }),
1446
+ renderItem: {
1447
+ type: "slot",
1448
+ displayName: "Render Item",
1449
+ renderPropParams: ["itemProps"],
1450
+ defaultValue: {
1451
+ type: "component",
1452
+ name: listBoxItemMeta.name,
1453
+ props: {
1454
+ children: makeDefaultListBoxItemChildren(
1455
+ "Item (itemProps.label)",
1456
+ "Connect with `itemProps` in the data picker to display list box items"
1457
+ )
1458
+ }
1459
+ }
1460
+ },
1461
+ renderSection: {
1462
+ type: "slot",
1463
+ displayName: "Render Section",
1464
+ renderPropParams: ["sectionProps"],
1465
+ defaultValue: {
1466
+ type: "component",
1467
+ name: sectionMeta.name,
1468
+ styles: {
1469
+ backgroundColor: "#F4FAFF"
1470
+ }
1471
+ }
1472
+ }
1473
+ }
1474
+ },
1475
+ overrides
1476
+ );
1477
+ }
1478
+
1479
+ var __defProp$e = Object.defineProperty;
1480
+ var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
1481
+ var __hasOwnProp$e = Object.prototype.hasOwnProperty;
1482
+ var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
1483
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1484
+ var __spreadValues$e = (a, b) => {
1485
+ for (var prop in b || (b = {}))
1486
+ if (__hasOwnProp$e.call(b, prop))
1487
+ __defNormalProp$e(a, prop, b[prop]);
1488
+ if (__getOwnPropSymbols$e)
1489
+ for (var prop of __getOwnPropSymbols$e(b)) {
1490
+ if (__propIsEnum$e.call(b, prop))
1491
+ __defNormalProp$e(a, prop, b[prop]);
1492
+ }
1493
+ return a;
1494
+ };
1495
+ var __objRest$b = (source, exclude) => {
1496
+ var target = {};
1497
+ for (var prop in source)
1498
+ if (__hasOwnProp$e.call(source, prop) && exclude.indexOf(prop) < 0)
1499
+ target[prop] = source[prop];
1500
+ if (source != null && __getOwnPropSymbols$e)
1501
+ for (var prop of __getOwnPropSymbols$e(source)) {
1502
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$e.call(source, prop))
1503
+ target[prop] = source[prop];
1504
+ }
1505
+ return target;
1506
+ };
1507
+ function BasePopover(props) {
1508
+ const _a = props, { resetClassName } = _a, restProps = __objRest$b(_a, ["resetClassName"]);
1509
+ const isStandalone = !React.useContext(PopoverContext);
1510
+ const contextProps = React.useContext(PlasmicPopoverContext);
1511
+ const mergedProps = mergeProps(contextProps, restProps, {
1512
+ className: `${resetClassName}`
1513
+ });
1514
+ const triggerRef = React.useRef(null);
1515
+ const standaloneProps = isStandalone ? {
1516
+ triggerRef,
1517
+ isNonModal: true,
1518
+ isOpen: true
1519
+ } : {};
1520
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, isStandalone && /* @__PURE__ */ React.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React.createElement(Popover, __spreadValues$e(__spreadValues$e({}, mergedProps), standaloneProps)));
1521
+ }
1522
+ const POPOVER_COMPONENT_NAME = makeComponentName("popover");
1523
+ const POPOVER_ARROW_IMG = {
1524
+ type: "img",
1525
+ // TODO: Replace with the image of an arrow pointing up, like: https://icon-sets.iconify.design/mdi/triangle/
1526
+ src: "https://static1.plasmic.app/arrow-up.svg",
1527
+ styles: {
1528
+ position: "absolute",
1529
+ top: "-14px",
1530
+ // center the arrow horizontally on the popover
1531
+ left: "50%",
1532
+ transform: "translateX(-50%)",
1533
+ width: "15px"
1534
+ }
1535
+ };
1536
+ function registerPopover(loader, overrides) {
1537
+ registerComponentHelper(
1538
+ loader,
1539
+ BasePopover,
1540
+ {
1541
+ name: POPOVER_COMPONENT_NAME,
1542
+ displayName: "Aria Popover",
1543
+ importPath: "@plasmicpkgs/react-aria/skinny/registerPopover",
1544
+ importName: "BasePopover",
1545
+ defaultStyles: {
1546
+ borderWidth: "1px",
1547
+ borderStyle: "solid",
1548
+ borderColor: "black",
1549
+ padding: "20px",
1550
+ width: "300px",
1551
+ backgroundColor: "#FDE3C3"
1552
+ },
1553
+ props: {
1554
+ children: {
1555
+ type: "slot",
1556
+ defaultValue: [
1557
+ POPOVER_ARROW_IMG,
1558
+ {
1559
+ type: "vbox",
1560
+ styles: {
1561
+ width: "stretch",
1562
+ padding: 0,
1563
+ gap: "10px"
1564
+ },
1565
+ children: [
1566
+ {
1567
+ type: "text",
1568
+ value: "This is a Popover!"
1569
+ },
1570
+ {
1571
+ type: "text",
1572
+ value: "You can put anything you can imagine here!",
1573
+ styles: {
1574
+ fontWeight: 500
1575
+ }
1576
+ },
1577
+ {
1578
+ type: "text",
1579
+ value: "Use it in a `Aria Dialog Trigger` component to trigger it on a button click!"
1580
+ }
1581
+ ]
1582
+ }
1583
+ ]
1584
+ },
1585
+ offset: {
1586
+ type: "number",
1587
+ displayName: "Offset",
1588
+ description: "Additional offset applied vertically between the popover and its trigger",
1589
+ defaultValueHint: 0
1590
+ },
1591
+ placement: {
1592
+ type: "choice",
1593
+ description: "Default placement of the popover relative to the trigger, if there is enough space",
1594
+ options: [
1595
+ "bottom",
1596
+ "bottom left",
1597
+ "bottom right",
1598
+ "top",
1599
+ "top left",
1600
+ "top right"
1601
+ ]
1602
+ },
1603
+ resetClassName: {
1604
+ type: "themeResetClass"
1605
+ }
1606
+ },
1607
+ styleSections: true
1608
+ },
1609
+ overrides
1610
+ );
1611
+ }
1612
+
1613
+ var __defProp$d = Object.defineProperty;
1614
+ var __defProps$7 = Object.defineProperties;
1615
+ var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
1616
+ var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
1617
+ var __hasOwnProp$d = Object.prototype.hasOwnProperty;
1618
+ var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
1619
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1620
+ var __spreadValues$d = (a, b) => {
1621
+ for (var prop in b || (b = {}))
1622
+ if (__hasOwnProp$d.call(b, prop))
1623
+ __defNormalProp$d(a, prop, b[prop]);
1624
+ if (__getOwnPropSymbols$d)
1625
+ for (var prop of __getOwnPropSymbols$d(b)) {
1626
+ if (__propIsEnum$d.call(b, prop))
1627
+ __defNormalProp$d(a, prop, b[prop]);
1628
+ }
1629
+ return a;
1630
+ };
1631
+ var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
1632
+ function BaseComboBox(props) {
1633
+ const {
1634
+ value,
1635
+ onChange,
1636
+ menuTrigger,
1637
+ filterValue,
1638
+ onFilterValueChange,
1639
+ valueType,
1640
+ allowsCustomValue,
1641
+ placeholder,
1642
+ previewOpen,
1643
+ onOpenChange,
1644
+ isDisabled,
1645
+ className,
1646
+ style,
1647
+ structure,
1648
+ name
1649
+ } = props;
1650
+ const { options, optionText } = useStrictOptions(props);
1651
+ const { contains } = useFilter({ sensitivity: "base" });
1652
+ const [showAllOptions, setShowAllOptions] = React.useState(false);
1653
+ const filteredOptions = React.useMemo(() => {
1654
+ if (!filterValue || filterValue.trim().length === 0) {
1655
+ return options;
1656
+ }
1657
+ if (!options) {
1658
+ return options;
1659
+ }
1660
+ const filterOptions = (opts) => {
1661
+ return withoutNils(
1662
+ opts.map((op) => {
1663
+ if (op.type === "option-group") {
1664
+ return __spreadProps$7(__spreadValues$d({}, op), {
1665
+ items: op.items ? filterOptions(op.items) : void 0
1666
+ });
1667
+ } else {
1668
+ if (contains(optionText(op), filterValue)) {
1669
+ return op;
1670
+ } else {
1671
+ return void 0;
1672
+ }
1673
+ }
1674
+ })
1675
+ );
1676
+ };
1677
+ return filterOptions(options);
1678
+ }, [filterValue, options, contains, optionText]);
1679
+ const flattenedOptions = React.useMemo(
1680
+ () => flattenOptions(options),
1681
+ [options]
1682
+ );
1683
+ const disabledKeys = flattenedOptions.filter((op) => op.isDisabled).map((op) => op.id);
1684
+ const onSelectionChange = React.useCallback(
1685
+ (key) => {
1686
+ if (key === null) {
1687
+ return;
1688
+ }
1689
+ const selectedOption = flattenedOptions == null ? void 0 : flattenedOptions.find((op) => op.id === key);
1690
+ if (valueType === "text") {
1691
+ if (selectedOption) {
1692
+ onChange == null ? void 0 : onChange(optionText(selectedOption));
1693
+ }
1694
+ } else {
1695
+ onChange == null ? void 0 : onChange(key);
1696
+ }
1697
+ if (selectedOption) {
1698
+ onFilterValueChange == null ? void 0 : onFilterValueChange(optionText(selectedOption));
1699
+ }
1700
+ },
1701
+ [flattenedOptions, valueType, onChange, optionText, onFilterValueChange]
1702
+ );
1703
+ const onInputValueChange = React.useCallback(
1704
+ (newValue) => {
1705
+ onFilterValueChange == null ? void 0 : onFilterValueChange(newValue);
1706
+ setShowAllOptions(false);
1707
+ if (valueType === "text") {
1708
+ if (allowsCustomValue) {
1709
+ onChange == null ? void 0 : onChange(newValue);
1710
+ } else {
1711
+ const matchingOption = flattenedOptions == null ? void 0 : flattenedOptions.find(
1712
+ (op) => optionText(op) === newValue
1713
+ );
1714
+ if (matchingOption) {
1715
+ onChange == null ? void 0 : onChange(optionText(matchingOption));
1716
+ }
1717
+ }
1718
+ }
1719
+ },
1720
+ [
1721
+ onFilterValueChange,
1722
+ onChange,
1723
+ flattenedOptions,
1724
+ optionText,
1725
+ valueType,
1726
+ allowsCustomValue
1727
+ ]
1728
+ );
1729
+ const onBlur = React.useCallback(() => {
1730
+ if (!allowsCustomValue) {
1731
+ const selectedOption = flattenedOptions == null ? void 0 : flattenedOptions.find(
1732
+ (op) => valueType === "text" ? optionText(op) === value : op.id === value
1009
1733
  );
1010
1734
  if (selectedOption) {
1011
1735
  const selectedOptionText = optionText(selectedOption);
@@ -1025,7 +1749,7 @@ function BaseComboBox(props) {
1025
1749
  ]);
1026
1750
  return /* @__PURE__ */ React.createElement(
1027
1751
  ComboBox,
1028
- __spreadValues$f({
1752
+ __spreadValues$d({
1029
1753
  selectedKey: value,
1030
1754
  onSelectionChange,
1031
1755
  isDisabled,
@@ -1103,215 +1827,154 @@ function registerComboBox(loader) {
1103
1827
  },
1104
1828
  valueType: {
1105
1829
  displayName: "`value` Type",
1106
- type: "choice",
1107
- options: [
1108
- { value: "value", label: "By option value" },
1109
- { value: "text", label: "By option text" }
1110
- ],
1111
- defaultValueHint: "value",
1112
- description: "This controls whether `value` and `onChange` are option values or option text. Choosing `text` allows you to optionally allow a custom value that's not in the provided list of options.",
1113
- advanced: true
1114
- },
1115
- allowsCustomValue: {
1116
- type: "boolean",
1117
- displayName: "Allows custom value?",
1118
- description: "Allows entering a value that is not one of the options",
1119
- hidden: (ps) => ps.valueType !== "text",
1120
- advanced: true
1121
- },
1122
- onOpenChange: {
1123
- type: "eventHandler",
1124
- argTypes: [{ name: "isOpen", type: "boolean" }]
1125
- },
1126
- structure: {
1127
- type: "slot"
1128
- },
1129
- previewOpen: {
1130
- type: "boolean",
1131
- displayName: "Preview opened?",
1132
- description: "Preview opened state while designing in Plasmic editor",
1133
- editOnly: true
1134
- }
1135
- },
1136
- states: {
1137
- value: {
1138
- type: "writable",
1139
- valueProp: "value",
1140
- onChangeProp: "onChange",
1141
- variableType: "text"
1142
- },
1143
- filterValue: {
1144
- type: "writable",
1145
- valueProp: "filterValue",
1146
- onChangeProp: "onFilterValueChange",
1147
- variableType: "text"
1148
- },
1149
- isOpen: {
1150
- type: "readonly",
1151
- onChangeProp: "onOpenChange",
1152
- variableType: "boolean"
1153
- }
1154
- }
1155
- });
1156
- }
1157
-
1158
- var __defProp$e = Object.defineProperty;
1159
- var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
1160
- var __hasOwnProp$e = Object.prototype.hasOwnProperty;
1161
- var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
1162
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1163
- var __spreadValues$e = (a, b) => {
1164
- for (var prop in b || (b = {}))
1165
- if (__hasOwnProp$e.call(b, prop))
1166
- __defNormalProp$e(a, prop, b[prop]);
1167
- if (__getOwnPropSymbols$e)
1168
- for (var prop of __getOwnPropSymbols$e(b)) {
1169
- if (__propIsEnum$e.call(b, prop))
1170
- __defNormalProp$e(a, prop, b[prop]);
1171
- }
1172
- return a;
1173
- };
1174
- var __objRest$a = (source, exclude) => {
1175
- var target = {};
1176
- for (var prop in source)
1177
- if (__hasOwnProp$e.call(source, prop) && exclude.indexOf(prop) < 0)
1178
- target[prop] = source[prop];
1179
- if (source != null && __getOwnPropSymbols$e)
1180
- for (var prop of __getOwnPropSymbols$e(source)) {
1181
- if (exclude.indexOf(prop) < 0 && __propIsEnum$e.call(source, prop))
1182
- target[prop] = source[prop];
1183
- }
1184
- return target;
1185
- };
1186
- function BaseDialogTrigger(props) {
1187
- const _a = props, { trigger, dialog } = _a, rest = __objRest$a(_a, ["trigger", "dialog"]);
1188
- return /* @__PURE__ */ React.createElement(DialogTrigger, __spreadValues$e({}, rest), trigger, dialog);
1189
- }
1190
- function registerDialogTrigger(loader, overrides) {
1191
- registerComponentHelper(
1192
- loader,
1193
- BaseDialogTrigger,
1194
- {
1195
- name: makeComponentName("dialogTrigger"),
1196
- displayName: "Aria Dialog Trigger",
1197
- importPath: "@plasmicpkgs/react-aria/skinny/registerDialogTrigger",
1198
- importName: "BaseDialogTrigger",
1199
- isAttachment: true,
1200
- props: {
1201
- trigger: {
1202
- type: "slot"
1203
- },
1204
- dialog: {
1205
- type: "slot"
1206
- },
1207
- isOpen: {
1208
- type: "boolean",
1209
- defaultValueHint: false,
1210
- editOnly: true,
1211
- uncontrolledProp: "defaultOpen"
1212
- },
1213
- onOpenChange: {
1214
- type: "eventHandler",
1215
- argTypes: [{ name: "isOpen", type: "boolean" }]
1216
- }
1217
- },
1218
- states: {
1219
- isOpen: {
1220
- type: "writable",
1221
- valueProp: "isOpen",
1222
- onChangeProp: "onOpenChange",
1223
- variableType: "boolean"
1224
- }
1225
- },
1226
- trapsFocus: true
1227
- },
1228
- overrides
1229
- );
1230
- }
1231
-
1232
- var __defProp$d = Object.defineProperty;
1233
- var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
1234
- var __hasOwnProp$d = Object.prototype.hasOwnProperty;
1235
- var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
1236
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1237
- var __spreadValues$d = (a, b) => {
1238
- for (var prop in b || (b = {}))
1239
- if (__hasOwnProp$d.call(b, prop))
1240
- __defNormalProp$d(a, prop, b[prop]);
1241
- if (__getOwnPropSymbols$d)
1242
- for (var prop of __getOwnPropSymbols$d(b)) {
1243
- if (__propIsEnum$d.call(b, prop))
1244
- __defNormalProp$d(a, prop, b[prop]);
1245
- }
1246
- return a;
1247
- };
1248
- var __objRest$9 = (source, exclude) => {
1249
- var target = {};
1250
- for (var prop in source)
1251
- if (__hasOwnProp$d.call(source, prop) && exclude.indexOf(prop) < 0)
1252
- target[prop] = source[prop];
1253
- if (source != null && __getOwnPropSymbols$d)
1254
- for (var prop of __getOwnPropSymbols$d(source)) {
1255
- if (exclude.indexOf(prop) < 0 && __propIsEnum$d.call(source, prop))
1256
- target[prop] = source[prop];
1257
- }
1258
- return target;
1259
- };
1260
- function BaseForm(props) {
1261
- const _a = props, { onSubmit, children } = _a, rest = __objRest$9(_a, ["onSubmit", "children"]);
1262
- return /* @__PURE__ */ React.createElement(
1263
- Form,
1264
- __spreadValues$d({
1265
- onSubmit: (e) => {
1266
- e.preventDefault();
1267
- const formData = new FormData(e.currentTarget);
1268
- const formValues = {};
1269
- formData.forEach((value, key) => {
1270
- const field = e.currentTarget.elements.namedItem(key);
1271
- if (field instanceof RadioNodeList && Array.from(field.values()).every(
1272
- (f) => f.type === "checkbox"
1273
- )) {
1274
- formValues[key] = formData.getAll(key);
1275
- } else {
1276
- field.type;
1277
- formValues[key] = formData.get(key);
1830
+ type: "choice",
1831
+ options: [
1832
+ { value: "value", label: "By option value" },
1833
+ { value: "text", label: "By option text" }
1834
+ ],
1835
+ defaultValueHint: "value",
1836
+ description: "This controls whether `value` and `onChange` are option values or option text. Choosing `text` allows you to optionally allow a custom value that's not in the provided list of options.",
1837
+ advanced: true
1838
+ },
1839
+ allowsCustomValue: {
1840
+ type: "boolean",
1841
+ displayName: "Allows custom value?",
1842
+ description: "Allows entering a value that is not one of the options",
1843
+ hidden: (ps) => ps.valueType !== "text",
1844
+ advanced: true
1845
+ },
1846
+ onOpenChange: {
1847
+ type: "eventHandler",
1848
+ argTypes: [{ name: "isOpen", type: "boolean" }]
1849
+ },
1850
+ structure: {
1851
+ type: "slot",
1852
+ defaultValue: [
1853
+ {
1854
+ type: "vbox",
1855
+ styles: {
1856
+ justifyContent: "flex-start",
1857
+ alignItems: "flex-start",
1858
+ width: "300px",
1859
+ padding: 0
1860
+ },
1861
+ children: [
1862
+ {
1863
+ type: "component",
1864
+ name: LABEL_COMPONENT_NAME,
1865
+ props: {
1866
+ children: {
1867
+ type: "text",
1868
+ value: "Label"
1869
+ }
1870
+ }
1871
+ },
1872
+ {
1873
+ type: "hbox",
1874
+ styles: {
1875
+ width: "stretch",
1876
+ borderWidth: "1px",
1877
+ borderStyle: "solid",
1878
+ borderColor: "black",
1879
+ padding: 0,
1880
+ position: "relative"
1881
+ },
1882
+ children: [
1883
+ {
1884
+ type: "component",
1885
+ name: INPUT_COMPONENT_NAME,
1886
+ styles: {
1887
+ borderWidth: 0,
1888
+ width: "100%",
1889
+ padding: "2px 30px 2px 10px"
1890
+ }
1891
+ },
1892
+ {
1893
+ type: "component",
1894
+ name: BUTTON_COMPONENT_NAME,
1895
+ styles: {
1896
+ borderWidth: 0,
1897
+ display: "flex",
1898
+ alignItems: "center",
1899
+ justifyContent: "center",
1900
+ position: "absolute",
1901
+ right: "10px",
1902
+ top: 0,
1903
+ padding: 0,
1904
+ height: "100%"
1905
+ },
1906
+ props: {
1907
+ children: {
1908
+ type: "img",
1909
+ src: "https://static1.plasmic.app/arrow-up.svg",
1910
+ styles: {
1911
+ height: "20px",
1912
+ width: "20px",
1913
+ transform: "rotate(180deg)"
1914
+ }
1915
+ }
1916
+ }
1917
+ }
1918
+ ]
1919
+ },
1920
+ {
1921
+ type: "component",
1922
+ name: POPOVER_COMPONENT_NAME,
1923
+ styles: {
1924
+ backgroundColor: "white",
1925
+ width: "300px",
1926
+ padding: "10px",
1927
+ overflow: "scroll"
1928
+ },
1929
+ props: {
1930
+ children: [
1931
+ {
1932
+ type: "component",
1933
+ name: LIST_BOX_COMPONENT_NAME,
1934
+ styles: {
1935
+ borderWidth: 0,
1936
+ width: "stretch"
1937
+ }
1938
+ }
1939
+ ]
1940
+ }
1941
+ }
1942
+ ]
1278
1943
  }
1279
- });
1280
- onSubmit == null ? void 0 : onSubmit(formValues);
1281
- }
1282
- }, rest),
1283
- children
1284
- );
1285
- }
1286
- function registerForm(loader, overrides) {
1287
- registerComponentHelper(
1288
- loader,
1289
- BaseForm,
1290
- {
1291
- name: makeComponentName("form"),
1292
- displayName: "Aria Form",
1293
- importPath: "@plasmicpkgs/react-aria/skinny/registerForm",
1294
- importName: "BaseForm",
1295
- props: {
1296
- children: {
1297
- type: "slot"
1298
- },
1299
- onSubmit: {
1300
- type: "eventHandler",
1301
- argTypes: [{ name: "data", type: "object" }]
1302
- },
1303
- onReset: {
1304
- type: "eventHandler",
1305
- argTypes: []
1306
- }
1944
+ ]
1307
1945
  },
1308
- trapsFocus: true
1946
+ previewOpen: {
1947
+ type: "boolean",
1948
+ displayName: "Preview opened?",
1949
+ description: "Preview opened state while designing in Plasmic editor",
1950
+ editOnly: true
1951
+ }
1309
1952
  },
1310
- overrides
1311
- );
1953
+ states: {
1954
+ value: {
1955
+ type: "writable",
1956
+ valueProp: "value",
1957
+ onChangeProp: "onChange",
1958
+ variableType: "text"
1959
+ },
1960
+ filterValue: {
1961
+ type: "writable",
1962
+ valueProp: "filterValue",
1963
+ onChangeProp: "onFilterValueChange",
1964
+ variableType: "text"
1965
+ },
1966
+ isOpen: {
1967
+ type: "readonly",
1968
+ onChangeProp: "onOpenChange",
1969
+ variableType: "boolean"
1970
+ }
1971
+ }
1972
+ });
1312
1973
  }
1313
1974
 
1314
1975
  var __defProp$c = Object.defineProperty;
1976
+ var __defProps$6 = Object.defineProperties;
1977
+ var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
1315
1978
  var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
1316
1979
  var __hasOwnProp$c = Object.prototype.hasOwnProperty;
1317
1980
  var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
@@ -1327,7 +1990,8 @@ var __spreadValues$c = (a, b) => {
1327
1990
  }
1328
1991
  return a;
1329
1992
  };
1330
- var __objRest$8 = (source, exclude) => {
1993
+ var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
1994
+ var __objRest$a = (source, exclude) => {
1331
1995
  var target = {};
1332
1996
  for (var prop in source)
1333
1997
  if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
@@ -1339,46 +2003,163 @@ var __objRest$8 = (source, exclude) => {
1339
2003
  }
1340
2004
  return target;
1341
2005
  };
1342
- const INPUT_INTERACTION_VARIANTS = ["focused", "hovered"];
1343
- const { interactionVariants: interactionVariants$3 } = pickAriaComponentVariants(
1344
- INPUT_INTERACTION_VARIANTS
1345
- );
1346
- function BaseInput(props) {
1347
- const _a = props, { updateInteractionVariant } = _a, rest = __objRest$8(_a, ["updateInteractionVariant"]);
1348
- return /* @__PURE__ */ React.createElement(
1349
- Input,
1350
- __spreadValues$c({
1351
- onHoverChange: (isHovered) => {
1352
- updateInteractionVariant == null ? void 0 : updateInteractionVariant({
1353
- hovered: isHovered
1354
- });
1355
- },
1356
- onFocus: () => {
1357
- updateInteractionVariant == null ? void 0 : updateInteractionVariant({
1358
- focused: true
1359
- });
2006
+ const BaseModal = forwardRef(
2007
+ function _BaseModal(props, ref) {
2008
+ const _a = props, {
2009
+ children,
2010
+ heading,
2011
+ modalOverlayClass,
2012
+ onOpenChange,
2013
+ className,
2014
+ isOpen,
2015
+ setControlContextData
2016
+ } = _a, rest = __objRest$a(_a, [
2017
+ "children",
2018
+ "heading",
2019
+ "modalOverlayClass",
2020
+ "onOpenChange",
2021
+ "className",
2022
+ "isOpen",
2023
+ "setControlContextData"
2024
+ ]);
2025
+ const contextProps = React.useContext(PlasmicDialogTriggerContext);
2026
+ const isStandalone = !contextProps;
2027
+ const mergedProps = mergeProps$1(contextProps, rest, {
2028
+ isOpen: isStandalone ? isOpen : contextProps.isOpen
2029
+ });
2030
+ setControlContextData == null ? void 0 : setControlContextData({
2031
+ isStandalone
2032
+ });
2033
+ useImperativeHandle(ref, () => ({
2034
+ close: () => {
2035
+ onOpenChange(false);
1360
2036
  },
1361
- onBlur: () => {
1362
- updateInteractionVariant == null ? void 0 : updateInteractionVariant({
1363
- focused: false
1364
- });
2037
+ open: () => {
2038
+ onOpenChange(true);
1365
2039
  }
1366
- }, rest)
1367
- );
1368
- }
1369
- function registerInput(loader, overrides) {
2040
+ }));
2041
+ const isCanvas = usePlasmicCanvasContext();
2042
+ const body = /* @__PURE__ */ React.createElement(React.Fragment, null, heading && /* @__PURE__ */ React.createElement(Heading, { slot: "title" }, heading), children);
2043
+ return /* @__PURE__ */ React.createElement(
2044
+ ModalOverlay,
2045
+ __spreadProps$6(__spreadValues$c({}, mergedProps), {
2046
+ className: modalOverlayClass,
2047
+ onOpenChange
2048
+ }),
2049
+ /* @__PURE__ */ React.createElement(Modal, { className }, isCanvas ? body : /* @__PURE__ */ React.createElement(Dialog, null, body))
2050
+ );
2051
+ }
2052
+ );
2053
+ const MODAL_COMPONENT_NAME = makeComponentName("modal");
2054
+ function registerModal(loader, overrides) {
1370
2055
  registerComponentHelper(
1371
2056
  loader,
1372
- BaseInput,
2057
+ BaseModal,
1373
2058
  {
1374
- name: makeComponentName("input"),
1375
- displayName: "Aria Input",
1376
- importPath: "@plasmicpkgs/react-aria/skinny/registerInput",
1377
- importName: "BaseInput",
1378
- interactionVariants: interactionVariants$3,
2059
+ name: MODAL_COMPONENT_NAME,
2060
+ displayName: "Aria Modal",
2061
+ importPath: "@plasmicpkgs/react-aria/skinny/registerModal",
2062
+ importName: "BaseModal",
2063
+ styleSections: true,
2064
+ defaultStyles: {
2065
+ // centering the modal on the page by default
2066
+ position: "fixed",
2067
+ top: "10%",
2068
+ left: "50%",
2069
+ width: "50%",
2070
+ transform: "translateX(-50%)",
2071
+ borderWidth: "1px",
2072
+ borderStyle: "solid",
2073
+ borderColor: "black",
2074
+ padding: "20px",
2075
+ maxWidth: "300px",
2076
+ backgroundColor: "#FDE3C3"
2077
+ },
2078
+ refActions: {
2079
+ open: {
2080
+ description: "Open the modal",
2081
+ argTypes: []
2082
+ },
2083
+ close: {
2084
+ description: "Close the modal",
2085
+ argTypes: []
2086
+ }
2087
+ },
1379
2088
  props: {
1380
- placeholder: {
1381
- type: "string"
2089
+ heading: {
2090
+ type: "slot",
2091
+ defaultValue: {
2092
+ type: "text",
2093
+ value: "Modal Heading",
2094
+ styles: {
2095
+ fontSize: "20px",
2096
+ fontWeight: "bold",
2097
+ marginBottom: "10px"
2098
+ }
2099
+ }
2100
+ },
2101
+ children: {
2102
+ type: "slot",
2103
+ defaultValue: {
2104
+ type: "vbox",
2105
+ styles: {
2106
+ width: "stretch",
2107
+ padding: 0,
2108
+ gap: "10px",
2109
+ justifyContent: "flex-start",
2110
+ alignItems: "flex-start"
2111
+ },
2112
+ children: [
2113
+ {
2114
+ type: "text",
2115
+ value: "This is a Modal!"
2116
+ },
2117
+ {
2118
+ type: "text",
2119
+ value: "You can put anything you can imagine here!",
2120
+ styles: {
2121
+ fontWeight: 500
2122
+ }
2123
+ },
2124
+ {
2125
+ type: "text",
2126
+ value: "Use it in a `Aria Dialog Trigger` component to trigger it on a button click!"
2127
+ }
2128
+ ]
2129
+ }
2130
+ },
2131
+ modalOverlayClass: {
2132
+ type: "class",
2133
+ displayName: "Modal Overlay"
2134
+ },
2135
+ isOpen: {
2136
+ type: "boolean",
2137
+ editOnly: true,
2138
+ uncontrolledProp: "defaultOpen",
2139
+ defaultValueHint: false,
2140
+ defaultValue: true,
2141
+ hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
2142
+ },
2143
+ isDismissable: {
2144
+ type: "boolean",
2145
+ description: "Whether to close the modal when the user interacts outside it."
2146
+ },
2147
+ isKeyboardDismissDisabled: {
2148
+ type: "boolean",
2149
+ description: "Whether pressing the escape key to close the modal should be disabled."
2150
+ },
2151
+ onOpenChange: {
2152
+ type: "eventHandler",
2153
+ argTypes: [{ name: "isOpen", type: "boolean" }]
2154
+ }
2155
+ },
2156
+ states: {
2157
+ isOpen: {
2158
+ type: "writable",
2159
+ valueProp: "isOpen",
2160
+ onChangeProp: "onOpenChange",
2161
+ variableType: "boolean",
2162
+ hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
1382
2163
  }
1383
2164
  },
1384
2165
  trapsFocus: true
@@ -1403,33 +2184,79 @@ var __spreadValues$b = (a, b) => {
1403
2184
  }
1404
2185
  return a;
1405
2186
  };
1406
- function BaseListBoxItem(props) {
1407
- const contextProps = React.useContext(PlasmicItemContext);
1408
- const mergedProps = mergeProps(contextProps, props);
1409
- return /* @__PURE__ */ React.createElement(ListBoxItem, __spreadValues$b({}, mergedProps), mergedProps.children);
2187
+ var __objRest$9 = (source, exclude) => {
2188
+ var target = {};
2189
+ for (var prop in source)
2190
+ if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
2191
+ target[prop] = source[prop];
2192
+ if (source != null && __getOwnPropSymbols$b)
2193
+ for (var prop of __getOwnPropSymbols$b(source)) {
2194
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
2195
+ target[prop] = source[prop];
2196
+ }
2197
+ return target;
2198
+ };
2199
+ function BaseDialogTrigger(props) {
2200
+ const _a = props, { trigger, dialog } = _a, rest = __objRest$9(_a, ["trigger", "dialog"]);
2201
+ return /* @__PURE__ */ React.createElement(PlasmicDialogTriggerContext.Provider, { value: props }, /* @__PURE__ */ React.createElement(DialogTrigger, __spreadValues$b({}, rest), trigger, dialog));
1410
2202
  }
1411
- function registerListBoxItem(loader, overrides) {
2203
+ function registerDialogTrigger(loader, overrides) {
1412
2204
  registerComponentHelper(
1413
2205
  loader,
1414
- BaseListBoxItem,
2206
+ BaseDialogTrigger,
1415
2207
  {
1416
- name: makeComponentName("item"),
1417
- displayName: "Aria ListBoxItem",
1418
- importPath: "@plasmicpkgs/react-aria/skinny/registerListBoxItem",
1419
- importName: "BaseListBoxItem",
2208
+ name: makeComponentName("dialogTrigger"),
2209
+ displayName: "Aria Dialog Trigger",
2210
+ importPath: "@plasmicpkgs/react-aria/skinny/registerDialogTrigger",
2211
+ importName: "BaseDialogTrigger",
2212
+ isAttachment: true,
1420
2213
  props: {
1421
- children: {
1422
- type: "slot"
2214
+ trigger: {
2215
+ type: "slot",
2216
+ defaultValue: {
2217
+ type: "component",
2218
+ name: BUTTON_COMPONENT_NAME,
2219
+ props: {
2220
+ children: {
2221
+ type: "text",
2222
+ value: "Open Dialog"
2223
+ }
2224
+ }
2225
+ }
2226
+ },
2227
+ dialog: {
2228
+ type: "slot",
2229
+ defaultValue: {
2230
+ type: "component",
2231
+ name: MODAL_COMPONENT_NAME
2232
+ }
2233
+ },
2234
+ isOpen: {
2235
+ type: "boolean",
2236
+ defaultValueHint: false,
2237
+ editOnly: true,
2238
+ uncontrolledProp: "defaultOpen"
2239
+ },
2240
+ onOpenChange: {
2241
+ type: "eventHandler",
2242
+ argTypes: [{ name: "isOpen", type: "boolean" }]
2243
+ }
2244
+ },
2245
+ states: {
2246
+ isOpen: {
2247
+ type: "writable",
2248
+ valueProp: "isOpen",
2249
+ onChangeProp: "onOpenChange",
2250
+ variableType: "boolean"
1423
2251
  }
1424
- }
2252
+ },
2253
+ trapsFocus: true
1425
2254
  },
1426
2255
  overrides
1427
2256
  );
1428
2257
  }
1429
2258
 
1430
2259
  var __defProp$a = Object.defineProperty;
1431
- var __defProps$6 = Object.defineProperties;
1432
- var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
1433
2260
  var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
1434
2261
  var __hasOwnProp$a = Object.prototype.hasOwnProperty;
1435
2262
  var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
@@ -1445,8 +2272,7 @@ var __spreadValues$a = (a, b) => {
1445
2272
  }
1446
2273
  return a;
1447
2274
  };
1448
- var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
1449
- var __objRest$7 = (source, exclude) => {
2275
+ var __objRest$8 = (source, exclude) => {
1450
2276
  var target = {};
1451
2277
  for (var prop in source)
1452
2278
  if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
@@ -1458,70 +2284,74 @@ var __objRest$7 = (source, exclude) => {
1458
2284
  }
1459
2285
  return target;
1460
2286
  };
1461
- function BaseListBox(props) {
1462
- var _c;
1463
- const contextProps = React.useContext(PlasmicListBoxContext);
1464
- const isStandalone = !contextProps;
1465
- const _a = props, rest = __objRest$7(_a, ["options"]);
1466
- const { options } = useStrictOptions(props);
1467
- const _b = mergeProps(
1468
- contextProps,
1469
- rest,
1470
- isStandalone ? { items: options } : {}
1471
- ), { renderItem, renderSection } = _b, mergedProps = __objRest$7(_b, ["renderItem", "renderSection"]);
1472
- (_c = props.setControlContextData) == null ? void 0 : _c.call(props, {
1473
- isStandalone
1474
- });
1475
- return /* @__PURE__ */ React.createElement(ListBox, __spreadValues$a({}, mergedProps), (item) => {
1476
- var _a2;
1477
- if (item.type === "option-group") {
1478
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
1479
- PlasmicSectionContext.Provider,
1480
- {
1481
- value: {
1482
- renderItem,
1483
- key: (_a2 = item.key) != null ? _a2 : item.label,
1484
- section: item
2287
+ function BaseForm(props) {
2288
+ const _a = props, { onSubmit, children } = _a, rest = __objRest$8(_a, ["onSubmit", "children"]);
2289
+ return /* @__PURE__ */ React.createElement(
2290
+ Form,
2291
+ __spreadValues$a({
2292
+ onSubmit: (e) => {
2293
+ e.preventDefault();
2294
+ const formData = new FormData(e.currentTarget);
2295
+ const formValues = {};
2296
+ formData.forEach((value, key) => {
2297
+ const field = e.currentTarget.elements.namedItem(key);
2298
+ if (field instanceof RadioNodeList && Array.from(field.values()).every(
2299
+ (f) => f.type === "checkbox"
2300
+ )) {
2301
+ formValues[key] = formData.getAll(key);
2302
+ } else {
2303
+ field.type;
2304
+ formValues[key] = formData.get(key);
1485
2305
  }
1486
- },
1487
- renderSection == null ? void 0 : renderSection(item)
1488
- ));
1489
- } else {
1490
- return /* @__PURE__ */ React.createElement(PlasmicItemContext.Provider, { value: item }, renderItem == null ? void 0 : renderItem(item));
1491
- }
1492
- });
2306
+ });
2307
+ onSubmit == null ? void 0 : onSubmit(formValues);
2308
+ }
2309
+ }, rest),
2310
+ children
2311
+ );
1493
2312
  }
1494
- function registerListBox(loader, overrides) {
2313
+ function registerForm(loader, overrides) {
1495
2314
  registerComponentHelper(
1496
2315
  loader,
1497
- BaseListBox,
2316
+ BaseForm,
1498
2317
  {
1499
- name: makeComponentName("listbox"),
1500
- displayName: "Aria ListBox",
1501
- importPath: "@plasmicpkgs/react-aria/skinny/registerListBox",
1502
- importName: "BaseListBox",
2318
+ name: makeComponentName("form"),
2319
+ displayName: "Aria Form",
2320
+ importPath: "@plasmicpkgs/react-aria/skinny/registerForm",
2321
+ importName: "BaseForm",
1503
2322
  props: {
1504
- options: __spreadProps$6(__spreadValues$a({}, makeOptionsPropType()), {
1505
- displayName: "Items",
1506
- hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
1507
- }),
1508
- renderItem: {
1509
- type: "slot",
1510
- displayName: "Render Item",
1511
- renderPropParams: ["itemProps"]
2323
+ children: {
2324
+ type: "slot"
1512
2325
  },
1513
- renderSection: {
1514
- type: "slot",
1515
- displayName: "Render Section",
1516
- renderPropParams: ["sectionProps"]
2326
+ onSubmit: {
2327
+ type: "eventHandler",
2328
+ argTypes: [{ name: "data", type: "object" }]
2329
+ },
2330
+ onReset: {
2331
+ type: "eventHandler",
2332
+ argTypes: []
1517
2333
  }
1518
- }
2334
+ },
2335
+ trapsFocus: true
1519
2336
  },
1520
2337
  overrides
1521
2338
  );
1522
- registerListBoxItem(loader, {
1523
- parentComponentName: makeComponentName("listbox")
1524
- });
2339
+ }
2340
+
2341
+ class ErrorBoundary extends Component {
2342
+ constructor(props) {
2343
+ super(props);
2344
+ this.state = { hasError: false };
2345
+ }
2346
+ static getDerivedStateFromError(_) {
2347
+ return { hasError: true };
2348
+ }
2349
+ render() {
2350
+ if (this.state.hasError) {
2351
+ return this.props.fallback;
2352
+ }
2353
+ return this.props.children;
2354
+ }
1525
2355
  }
1526
2356
 
1527
2357
  var __defProp$9 = Object.defineProperty;
@@ -1543,7 +2373,7 @@ var __spreadValues$9 = (a, b) => {
1543
2373
  return a;
1544
2374
  };
1545
2375
  var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
1546
- var __objRest$6 = (source, exclude) => {
2376
+ var __objRest$7 = (source, exclude) => {
1547
2377
  var target = {};
1548
2378
  for (var prop in source)
1549
2379
  if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
@@ -1555,97 +2385,245 @@ var __objRest$6 = (source, exclude) => {
1555
2385
  }
1556
2386
  return target;
1557
2387
  };
1558
- const BaseModal = forwardRef(
1559
- function _BaseModal(props, ref) {
1560
- const _a = props, {
1561
- children,
1562
- heading,
1563
- modalOverlayClass,
1564
- onOpenChange,
1565
- className
1566
- } = _a, rest = __objRest$6(_a, [
1567
- "children",
1568
- "heading",
1569
- "modalOverlayClass",
1570
- "onOpenChange",
1571
- "className"
1572
- ]);
1573
- useImperativeHandle(ref, () => ({
1574
- close: () => {
1575
- onOpenChange(false);
1576
- },
1577
- open: () => {
1578
- onOpenChange(true);
1579
- }
1580
- }));
1581
- const isCanvas = usePlasmicCanvasContext();
1582
- const body = /* @__PURE__ */ React.createElement(React.Fragment, null, heading && /* @__PURE__ */ React.createElement(Heading, { slot: "title" }, heading), children);
1583
- return /* @__PURE__ */ React.createElement(
1584
- ModalOverlay,
1585
- __spreadProps$5(__spreadValues$9({}, rest), {
1586
- className: modalOverlayClass,
1587
- onOpenChange
1588
- }),
1589
- /* @__PURE__ */ React.createElement(Modal, { className }, isCanvas ? body : /* @__PURE__ */ React.createElement(Dialog, null, body))
1590
- );
1591
- }
2388
+ const RADIO_INTERACTION_VARIANTS = [
2389
+ "hovered",
2390
+ "pressed",
2391
+ "focused",
2392
+ "focusVisible"
2393
+ ];
2394
+ const { interactionVariants: interactionVariants$4, withObservedValues: withObservedValues$3 } = pickAriaComponentVariants(
2395
+ RADIO_INTERACTION_VARIANTS
1592
2396
  );
1593
- function registerModal(loader, overrides) {
1594
- registerComponentHelper(
2397
+ function BaseRadio(props) {
2398
+ const _a = props, { children, updateInteractionVariant, setControlContextData } = _a, rest = __objRest$7(_a, ["children", "updateInteractionVariant", "setControlContextData"]);
2399
+ const contextProps = React.useContext(PlasmicRadioGroupContext);
2400
+ const radio = /* @__PURE__ */ React.createElement(Radio, __spreadValues$9({}, rest), ({ isHovered, isPressed, isFocused, isFocusVisible }) => withObservedValues$3(
2401
+ children,
2402
+ {
2403
+ hovered: isHovered,
2404
+ pressed: isPressed,
2405
+ focused: isFocused,
2406
+ focusVisible: isFocusVisible
2407
+ },
2408
+ updateInteractionVariant
2409
+ ));
2410
+ const isStandalone = !contextProps;
2411
+ setControlContextData == null ? void 0 : setControlContextData({
2412
+ isStandalone
2413
+ });
2414
+ return /* @__PURE__ */ React.createElement(ErrorBoundary, { fallback: /* @__PURE__ */ React.createElement(RadioGroup, null, radio) }, radio);
2415
+ }
2416
+ const makeDefaultRadioChildren = (label) => ({
2417
+ type: "hbox",
2418
+ styles: {
2419
+ display: "flex",
2420
+ alignItems: "center",
2421
+ gap: "10px",
2422
+ padding: 0
2423
+ },
2424
+ children: [
2425
+ {
2426
+ type: "box",
2427
+ styles: {
2428
+ width: "7px",
2429
+ height: "7px",
2430
+ borderRadius: "100%",
2431
+ borderWidth: "1px",
2432
+ borderStyle: "solid",
2433
+ borderColor: "black"
2434
+ }
2435
+ },
2436
+ {
2437
+ type: "component",
2438
+ name: LABEL_COMPONENT_NAME,
2439
+ props: {
2440
+ children: {
2441
+ type: "text",
2442
+ value: label
2443
+ }
2444
+ }
2445
+ }
2446
+ ]
2447
+ });
2448
+ function registerRadio(loader, overrides) {
2449
+ return registerComponentHelper(
1595
2450
  loader,
1596
- BaseModal,
2451
+ BaseRadio,
1597
2452
  {
1598
- name: makeComponentName("modal"),
1599
- displayName: "Aria Modal",
1600
- importPath: "@plasmicpkgs/react-aria/skinny/registerModal",
1601
- importName: "BaseModal",
1602
- styleSections: true,
1603
- refActions: {
1604
- open: {
1605
- description: "Open the modal",
1606
- argTypes: []
2453
+ name: makeComponentName("radio"),
2454
+ displayName: "Aria Radio",
2455
+ importPath: "@plasmicpkgs/react-aria/skinny/registerRadio",
2456
+ importName: "BaseRadio",
2457
+ interactionVariants: interactionVariants$4,
2458
+ props: __spreadProps$5(__spreadValues$9({}, getCommonInputProps("radio", [
2459
+ "isDisabled",
2460
+ "autoFocus",
2461
+ "aria-label"
2462
+ ])), {
2463
+ children: {
2464
+ type: "slot",
2465
+ mergeWithParent: true,
2466
+ defaultValue: makeDefaultRadioChildren("Radio")
1607
2467
  },
1608
- close: {
1609
- description: "Close the modal",
1610
- argTypes: []
2468
+ value: {
2469
+ type: "string",
2470
+ description: "The value of the input element, used when submitting an HTML form."
2471
+ },
2472
+ onSelectionChange: {
2473
+ type: "eventHandler",
2474
+ argTypes: [{ name: "isSelected", type: "boolean" }]
2475
+ }
2476
+ }),
2477
+ states: {
2478
+ isSelected: {
2479
+ type: "readonly",
2480
+ onChangeProp: "onSelectionChange",
2481
+ variableType: "boolean",
2482
+ hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
1611
2483
  }
1612
2484
  },
1613
- props: {
1614
- heading: {
1615
- type: "slot"
1616
- },
2485
+ trapsFocus: true
2486
+ },
2487
+ overrides
2488
+ );
2489
+ }
2490
+
2491
+ var __defProp$8 = Object.defineProperty;
2492
+ var __defProps$4 = Object.defineProperties;
2493
+ var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
2494
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
2495
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
2496
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
2497
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2498
+ var __spreadValues$8 = (a, b) => {
2499
+ for (var prop in b || (b = {}))
2500
+ if (__hasOwnProp$8.call(b, prop))
2501
+ __defNormalProp$8(a, prop, b[prop]);
2502
+ if (__getOwnPropSymbols$8)
2503
+ for (var prop of __getOwnPropSymbols$8(b)) {
2504
+ if (__propIsEnum$8.call(b, prop))
2505
+ __defNormalProp$8(a, prop, b[prop]);
2506
+ }
2507
+ return a;
2508
+ };
2509
+ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
2510
+ function BaseRadioGroup(props) {
2511
+ return /* @__PURE__ */ React.createElement(PlasmicRadioGroupContext.Provider, { value: props }, /* @__PURE__ */ React.createElement(RadioGroup, __spreadValues$8({}, props)));
2512
+ }
2513
+ const RADIO_GROUP_COMPONENT_NAME = makeComponentName("radioGroup");
2514
+ function registerRadioGroup(loader, overrides) {
2515
+ const thisName = makeChildComponentName(
2516
+ overrides == null ? void 0 : overrides.parentComponentName,
2517
+ RADIO_GROUP_COMPONENT_NAME
2518
+ );
2519
+ registerFieldError(loader, { parentComponentName: thisName });
2520
+ const radioMeta = registerRadio(loader, { parentComponentName: thisName });
2521
+ registerLabel(loader, { parentComponentName: thisName });
2522
+ registerComponentHelper(
2523
+ loader,
2524
+ BaseRadioGroup,
2525
+ {
2526
+ name: RADIO_GROUP_COMPONENT_NAME,
2527
+ displayName: "Aria RadioGroup",
2528
+ importPath: "@plasmicpkgs/react-aria/skinny/registerRadioGroup",
2529
+ importName: "BaseRadioGroup",
2530
+ props: __spreadProps$4(__spreadValues$8({}, getCommonInputProps("radio group", [
2531
+ "name",
2532
+ "isDisabled",
2533
+ "isReadOnly",
2534
+ "aria-label",
2535
+ "isRequired"
2536
+ ])), {
1617
2537
  children: {
1618
- type: "slot"
1619
- },
1620
- modalOverlayClass: {
1621
- type: "class",
1622
- displayName: "Modal Overlay"
2538
+ type: "slot",
2539
+ mergeWithParent: true,
2540
+ defaultValue: [
2541
+ {
2542
+ type: "vbox",
2543
+ styles: {
2544
+ display: "flex",
2545
+ gap: "5px",
2546
+ padding: 0,
2547
+ alignItems: "flex-start"
2548
+ },
2549
+ children: [
2550
+ {
2551
+ type: "component",
2552
+ name: LABEL_COMPONENT_NAME,
2553
+ props: {
2554
+ children: {
2555
+ type: "text",
2556
+ value: "Radio Group"
2557
+ }
2558
+ }
2559
+ },
2560
+ {
2561
+ type: "component",
2562
+ name: radioMeta.name,
2563
+ props: {
2564
+ children: makeDefaultRadioChildren("Radio 1"),
2565
+ value: "radio1"
2566
+ }
2567
+ },
2568
+ {
2569
+ type: "component",
2570
+ name: radioMeta.name,
2571
+ props: {
2572
+ children: makeDefaultRadioChildren("Radio 2"),
2573
+ value: "radio2"
2574
+ }
2575
+ },
2576
+ {
2577
+ type: "component",
2578
+ name: radioMeta.name,
2579
+ props: {
2580
+ children: makeDefaultRadioChildren("Radio 3"),
2581
+ value: "radio3"
2582
+ }
2583
+ },
2584
+ {
2585
+ type: "component",
2586
+ name: DESCRIPTION_COMPONENT_NAME,
2587
+ props: {
2588
+ children: {
2589
+ type: "text",
2590
+ value: "Add interaction variants to see it in action..."
2591
+ }
2592
+ }
2593
+ }
2594
+ ]
2595
+ }
2596
+ ]
1623
2597
  },
1624
- isOpen: {
1625
- type: "boolean",
2598
+ value: {
2599
+ type: "string",
1626
2600
  editOnly: true,
1627
- uncontrolledProp: "defaultOpen",
1628
- defaultValueHint: false
2601
+ uncontrolledProp: "defaultValue",
2602
+ description: "The current value"
1629
2603
  },
1630
- isDismissable: {
2604
+ isInvalid: {
2605
+ displayName: "Invalid",
1631
2606
  type: "boolean",
1632
- description: "Whether to close the modal when the user interacts outside it."
2607
+ description: "Whether the input value is invalid",
2608
+ defaultValueHint: false
1633
2609
  },
1634
- isKeyboardDismissDisabled: {
1635
- type: "boolean",
1636
- description: "Whether pressing the escape key to close the modal should be disabled."
2610
+ validationBehavior: {
2611
+ type: "choice",
2612
+ options: ["native", "aria"],
2613
+ 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.",
2614
+ defaultValueHint: "native"
1637
2615
  },
1638
- onOpenChange: {
2616
+ onChange: {
1639
2617
  type: "eventHandler",
1640
- argTypes: [{ name: "isOpen", type: "boolean" }]
2618
+ argTypes: [{ name: "value", type: "string" }]
1641
2619
  }
1642
- },
2620
+ }),
1643
2621
  states: {
1644
- isOpen: {
2622
+ value: {
1645
2623
  type: "writable",
1646
- valueProp: "isOpen",
1647
- onChangeProp: "onOpenChange",
1648
- variableType: "boolean"
2624
+ valueProp: "value",
2625
+ onChangeProp: "onChange",
2626
+ variableType: "array"
1649
2627
  }
1650
2628
  },
1651
2629
  trapsFocus: true
@@ -1654,281 +2632,396 @@ function registerModal(loader, overrides) {
1654
2632
  );
1655
2633
  }
1656
2634
 
1657
- var __defProp$8 = Object.defineProperty;
1658
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
1659
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
1660
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
1661
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1662
- var __spreadValues$8 = (a, b) => {
2635
+ var __defProp$7 = Object.defineProperty;
2636
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
2637
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
2638
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
2639
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2640
+ var __spreadValues$7 = (a, b) => {
1663
2641
  for (var prop in b || (b = {}))
1664
- if (__hasOwnProp$8.call(b, prop))
1665
- __defNormalProp$8(a, prop, b[prop]);
1666
- if (__getOwnPropSymbols$8)
1667
- for (var prop of __getOwnPropSymbols$8(b)) {
1668
- if (__propIsEnum$8.call(b, prop))
1669
- __defNormalProp$8(a, prop, b[prop]);
2642
+ if (__hasOwnProp$7.call(b, prop))
2643
+ __defNormalProp$7(a, prop, b[prop]);
2644
+ if (__getOwnPropSymbols$7)
2645
+ for (var prop of __getOwnPropSymbols$7(b)) {
2646
+ if (__propIsEnum$7.call(b, prop))
2647
+ __defNormalProp$7(a, prop, b[prop]);
1670
2648
  }
1671
2649
  return a;
1672
2650
  };
1673
- var __objRest$5 = (source, exclude) => {
1674
- var target = {};
1675
- for (var prop in source)
1676
- if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
1677
- target[prop] = source[prop];
1678
- if (source != null && __getOwnPropSymbols$8)
1679
- for (var prop of __getOwnPropSymbols$8(source)) {
1680
- if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
1681
- target[prop] = source[prop];
1682
- }
1683
- return target;
2651
+ const BaseSelectValue = (props) => {
2652
+ const { children, customize } = props;
2653
+ return /* @__PURE__ */ React.createElement(SelectValue, null, ({ isPlaceholder, selectedText }) => /* @__PURE__ */ React.createElement(React.Fragment, null, isPlaceholder ? /* @__PURE__ */ React.createElement("span", null, "Select an item") : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", null, customize ? children : selectedText))));
1684
2654
  };
1685
- function BasePopover(props) {
1686
- const _a = props, { resetClassName } = _a, restProps = __objRest$5(_a, ["resetClassName"]);
1687
- const isStandalone = !React.useContext(PopoverContext);
1688
- const contextProps = React.useContext(PlasmicPopoverContext);
1689
- const mergedProps = mergeProps(contextProps, restProps, {
1690
- className: `${resetClassName}`
2655
+ const SELECT_NAME = makeComponentName("select");
2656
+ function BaseSelect(props) {
2657
+ const {
2658
+ value,
2659
+ onChange,
2660
+ placeholder,
2661
+ previewOpen,
2662
+ onOpenChange,
2663
+ isDisabled,
2664
+ className,
2665
+ style,
2666
+ structure,
2667
+ name,
2668
+ "aria-label": ariaLabel
2669
+ } = props;
2670
+ const { options } = useStrictOptions(props);
2671
+ const canvas = usePlasmicCanvasContext();
2672
+ const disabledKeys = flattenOptions(options).filter((op) => op.isDisabled).map((op) => op.id);
2673
+ return /* @__PURE__ */ React.createElement(
2674
+ Select,
2675
+ __spreadValues$7(__spreadValues$7({
2676
+ placeholder,
2677
+ selectedKey: value,
2678
+ onSelectionChange: onChange,
2679
+ onOpenChange,
2680
+ isDisabled,
2681
+ className,
2682
+ style,
2683
+ name,
2684
+ "aria-label": ariaLabel
2685
+ }, previewOpen && canvas ? { isOpen: previewOpen } : void 0), extractPlasmicDataProps(props)),
2686
+ /* @__PURE__ */ React.createElement(
2687
+ PlasmicListBoxContext.Provider,
2688
+ {
2689
+ value: {
2690
+ items: options,
2691
+ disabledKeys
2692
+ }
2693
+ },
2694
+ structure
2695
+ )
2696
+ );
2697
+ }
2698
+ function registerSelect(loader) {
2699
+ const selectValueMeta = registerComponentHelper(loader, BaseSelectValue, {
2700
+ name: makeComponentName("select-value"),
2701
+ displayName: "Aria Selected Value",
2702
+ importPath: "@plasmicpkgs/react-aria/registerSelect",
2703
+ importName: "SelectValue",
2704
+ parentComponentName: SELECT_NAME,
2705
+ props: {
2706
+ customize: {
2707
+ type: "boolean",
2708
+ advanced: true,
2709
+ description: "Whether to customize the selected value display"
2710
+ },
2711
+ children: {
2712
+ type: "slot",
2713
+ defaultValue: [
2714
+ {
2715
+ type: "text",
2716
+ value: "Selected value..."
2717
+ }
2718
+ ]
2719
+ },
2720
+ className: {
2721
+ type: "class",
2722
+ selectors: [
2723
+ {
2724
+ selector: ":self[data-placeholder]",
2725
+ label: "Placeholder"
2726
+ }
2727
+ ]
2728
+ }
2729
+ }
2730
+ });
2731
+ registerComponentHelper(loader, BaseSelect, {
2732
+ name: SELECT_NAME,
2733
+ displayName: "Aria Select",
2734
+ importPath: "@plasmicpkgs/react-aria/skinny/registerSelect",
2735
+ importName: "BaseSelect",
2736
+ props: {
2737
+ options: makeOptionsPropType(),
2738
+ placeholder: {
2739
+ type: "string"
2740
+ },
2741
+ isDisabled: {
2742
+ type: "boolean"
2743
+ },
2744
+ value: makeValuePropType(),
2745
+ onChange: {
2746
+ type: "eventHandler",
2747
+ argTypes: [{ name: "value", type: "string" }]
2748
+ },
2749
+ previewOpen: {
2750
+ type: "boolean",
2751
+ displayName: "Preview opened?",
2752
+ description: "Preview opened state while designing in Plasmic editor",
2753
+ editOnly: true
2754
+ },
2755
+ onOpenChange: {
2756
+ type: "eventHandler",
2757
+ argTypes: [{ name: "isOpen", type: "boolean" }]
2758
+ },
2759
+ // optionValue: {
2760
+ // type: "string",
2761
+ // displayName: "Field key for an option's value",
2762
+ // hidden: (ps) =>
2763
+ // !ps.options ||
2764
+ // !ps.options[0] ||
2765
+ // typeof ps.options[0] === "string" ||
2766
+ // "value" in ps.options[0],
2767
+ // exprHint:
2768
+ // "Return a function that takes in an option object, and returns the key to use",
2769
+ // },
2770
+ // optionText: {
2771
+ // type: "string",
2772
+ // displayName: "Field key for an option's text value",
2773
+ // hidden: (ps) =>
2774
+ // !ps.options ||
2775
+ // !ps.options[0] ||
2776
+ // typeof ps.options[0] === "string" ||
2777
+ // "value" in ps.options[0],
2778
+ // exprHint:
2779
+ // "Return a function that takes in an option object, and returns the text value to use",
2780
+ // },
2781
+ // optionDisabled: {
2782
+ // type: "string",
2783
+ // displayName: "Field key for whether an option is disabled",
2784
+ // hidden: (ps) =>
2785
+ // !ps.options ||
2786
+ // !ps.options[0] ||
2787
+ // typeof ps.options[0] === "string" ||
2788
+ // "value" in ps.options[0],
2789
+ // exprHint:
2790
+ // "Return a function that takes in an option object, and returns true if option should be disabled",
2791
+ // },
2792
+ structure: {
2793
+ type: "slot",
2794
+ defaultValue: [
2795
+ {
2796
+ type: "vbox",
2797
+ styles: {
2798
+ justifyContent: "flex-start",
2799
+ alignItems: "flex-start",
2800
+ width: "300px",
2801
+ padding: 0
2802
+ },
2803
+ children: [
2804
+ {
2805
+ type: "component",
2806
+ name: LABEL_COMPONENT_NAME,
2807
+ props: {
2808
+ children: {
2809
+ type: "text",
2810
+ value: "Label"
2811
+ }
2812
+ }
2813
+ },
2814
+ {
2815
+ type: "component",
2816
+ name: BUTTON_COMPONENT_NAME,
2817
+ styles: {
2818
+ width: "100%"
2819
+ },
2820
+ props: {
2821
+ children: {
2822
+ type: "hbox",
2823
+ styles: {
2824
+ width: "stretch",
2825
+ justifyContent: "space-between",
2826
+ alignItems: "center",
2827
+ padding: "2px 5px"
2828
+ },
2829
+ children: [
2830
+ {
2831
+ type: "component",
2832
+ name: selectValueMeta.name
2833
+ },
2834
+ {
2835
+ type: "img",
2836
+ src: "https://static1.plasmic.app/arrow-up.svg",
2837
+ styles: {
2838
+ height: "20px",
2839
+ width: "20px",
2840
+ transform: "rotate(180deg)"
2841
+ }
2842
+ }
2843
+ ]
2844
+ }
2845
+ }
2846
+ },
2847
+ {
2848
+ type: "component",
2849
+ name: POPOVER_COMPONENT_NAME,
2850
+ styles: {
2851
+ backgroundColor: "white",
2852
+ padding: "10px",
2853
+ overflow: "scroll"
2854
+ },
2855
+ props: {
2856
+ children: [
2857
+ {
2858
+ type: "component",
2859
+ name: LIST_BOX_COMPONENT_NAME,
2860
+ styles: {
2861
+ borderWidth: 0,
2862
+ width: "stretch"
2863
+ }
2864
+ }
2865
+ ]
2866
+ }
2867
+ }
2868
+ ]
2869
+ }
2870
+ ]
2871
+ },
2872
+ // renderOption: {
2873
+ // type: "slot",
2874
+ // displayName: "Custom render option",
2875
+ // renderPropParams: ["item"],
2876
+ // hidePlaceholder: true
2877
+ // },
2878
+ name: {
2879
+ type: "string",
2880
+ displayName: "Form field key",
2881
+ description: "Name of the input, when submitting in an HTML form",
2882
+ advanced: true
2883
+ },
2884
+ "aria-label": {
2885
+ type: "string",
2886
+ displayName: "Aria Label",
2887
+ description: "Label for this input, if no visible label is used",
2888
+ advanced: true
2889
+ }
2890
+ },
2891
+ states: {
2892
+ value: {
2893
+ type: "writable",
2894
+ valueProp: "value",
2895
+ onChangeProp: "onChange",
2896
+ variableType: "text"
2897
+ },
2898
+ isOpen: {
2899
+ type: "readonly",
2900
+ onChangeProp: "onOpenChange",
2901
+ variableType: "boolean"
2902
+ }
2903
+ }
1691
2904
  });
1692
- const triggerRef = React.useRef(null);
1693
- const standaloneProps = isStandalone ? {
1694
- triggerRef,
1695
- isNonModal: true,
1696
- isOpen: true
1697
- } : {};
1698
- return /* @__PURE__ */ React.createElement(React.Fragment, null, isStandalone && /* @__PURE__ */ React.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React.createElement(Popover, __spreadValues$8(__spreadValues$8({}, mergedProps), standaloneProps)));
1699
2905
  }
1700
- function registerPopover(loader, overrides) {
2906
+
2907
+ const BaseSliderOutput = SliderOutput;
2908
+ const SLIDER_OUTPUT_COMPONENT_NAME = makeComponentName("sliderOutput");
2909
+ function registerSliderOutput(loader, overrides) {
1701
2910
  registerComponentHelper(
1702
2911
  loader,
1703
- BasePopover,
2912
+ BaseSliderOutput,
1704
2913
  {
1705
- name: "plasmic-react-aria-popover",
1706
- displayName: "Aria Popover",
1707
- importPath: "@plasmicpkgs/react-aria/skinny/registerPopover",
1708
- importName: "BasePopover",
2914
+ name: SLIDER_OUTPUT_COMPONENT_NAME,
2915
+ displayName: "Aria Slider Output",
2916
+ importPath: "@plasmicpkgs/react-aria/skinny/registerSliderOutput",
2917
+ importName: "BaseSliderOutput",
1709
2918
  props: {
1710
- children: {
1711
- type: "slot"
1712
- },
1713
- offset: {
1714
- type: "number",
1715
- displayName: "Offset",
1716
- description: "Additional offset applied vertically between the popover and its trigger",
1717
- defaultValueHint: 0
1718
- },
1719
- placement: {
1720
- type: "choice",
1721
- description: "Default placement of the popover relative to the trigger, if there is enough space",
1722
- options: [
1723
- "bottom",
1724
- "bottom left",
1725
- "bottom right",
1726
- "top",
1727
- "top left",
1728
- "top right"
1729
- ]
1730
- },
1731
- resetClassName: {
1732
- type: "themeResetClass"
1733
- }
2919
+ children: { type: "slot" }
1734
2920
  },
1735
- styleSections: true
2921
+ trapsFocus: true
1736
2922
  },
1737
2923
  overrides
1738
2924
  );
1739
2925
  }
1740
2926
 
1741
- class ErrorBoundary extends Component {
1742
- constructor(props) {
1743
- super(props);
1744
- this.state = { hasError: false };
1745
- }
1746
- static getDerivedStateFromError(_) {
1747
- return { hasError: true };
1748
- }
1749
- render() {
1750
- if (this.state.hasError) {
1751
- return this.props.fallback;
1752
- }
1753
- return this.props.children;
1754
- }
1755
- }
1756
-
1757
- var __defProp$7 = Object.defineProperty;
1758
- var __defProps$4 = Object.defineProperties;
1759
- var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
1760
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
1761
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
1762
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
1763
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1764
- var __spreadValues$7 = (a, b) => {
2927
+ var __defProp$6 = Object.defineProperty;
2928
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
2929
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
2930
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
2931
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2932
+ var __spreadValues$6 = (a, b) => {
1765
2933
  for (var prop in b || (b = {}))
1766
- if (__hasOwnProp$7.call(b, prop))
1767
- __defNormalProp$7(a, prop, b[prop]);
1768
- if (__getOwnPropSymbols$7)
1769
- for (var prop of __getOwnPropSymbols$7(b)) {
1770
- if (__propIsEnum$7.call(b, prop))
1771
- __defNormalProp$7(a, prop, b[prop]);
2934
+ if (__hasOwnProp$6.call(b, prop))
2935
+ __defNormalProp$6(a, prop, b[prop]);
2936
+ if (__getOwnPropSymbols$6)
2937
+ for (var prop of __getOwnPropSymbols$6(b)) {
2938
+ if (__propIsEnum$6.call(b, prop))
2939
+ __defNormalProp$6(a, prop, b[prop]);
1772
2940
  }
1773
2941
  return a;
1774
2942
  };
1775
- var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
1776
- var __objRest$4 = (source, exclude) => {
2943
+ var __objRest$6 = (source, exclude) => {
1777
2944
  var target = {};
1778
2945
  for (var prop in source)
1779
- if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
2946
+ if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
1780
2947
  target[prop] = source[prop];
1781
- if (source != null && __getOwnPropSymbols$7)
1782
- for (var prop of __getOwnPropSymbols$7(source)) {
1783
- if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
2948
+ if (source != null && __getOwnPropSymbols$6)
2949
+ for (var prop of __getOwnPropSymbols$6(source)) {
2950
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
1784
2951
  target[prop] = source[prop];
1785
2952
  }
1786
2953
  return target;
1787
2954
  };
1788
- const RADIO_INTERACTION_VARIANTS = [
2955
+ const SLIDER_THUMB_INTERACTION_VARIANTS = [
2956
+ "dragging",
1789
2957
  "hovered",
1790
- "pressed",
1791
2958
  "focused",
1792
2959
  "focusVisible"
1793
2960
  ];
1794
- const { interactionVariants: interactionVariants$2, withObservedValues: withObservedValues$1 } = pickAriaComponentVariants(
1795
- RADIO_INTERACTION_VARIANTS
2961
+ const { interactionVariants: interactionVariants$3, withObservedValues: withObservedValues$2 } = pickAriaComponentVariants(
2962
+ SLIDER_THUMB_INTERACTION_VARIANTS
1796
2963
  );
1797
- function BaseRadio(props) {
1798
- const _a = props, { children, updateInteractionVariant } = _a, rest = __objRest$4(_a, ["children", "updateInteractionVariant"]);
1799
- const radio = /* @__PURE__ */ React.createElement(Radio, __spreadValues$7({}, rest), ({ isHovered, isPressed, isFocused, isFocusVisible }) => withObservedValues$1(
2964
+ function BaseSliderThumb(_a) {
2965
+ var _b = _a, {
1800
2966
  children,
2967
+ advanced,
2968
+ updateInteractionVariant
2969
+ } = _b, rest = __objRest$6(_b, [
2970
+ "children",
2971
+ "advanced",
2972
+ "updateInteractionVariant"
2973
+ ]);
2974
+ const context = React.useContext(PlasmicSliderContext);
2975
+ const mergedProps = mergeProps$1(context, rest);
2976
+ const thumb = /* @__PURE__ */ React.createElement(SliderThumb, __spreadValues$6({}, mergedProps), ({ isDragging, isHovered, isFocused, isFocusVisible }) => withObservedValues$2(
2977
+ /* @__PURE__ */ React.createElement(React.Fragment, null, advanced ? children : void 0),
1801
2978
  {
2979
+ dragging: isDragging,
1802
2980
  hovered: isHovered,
1803
- pressed: isPressed,
1804
2981
  focused: isFocused,
1805
2982
  focusVisible: isFocusVisible
1806
2983
  },
1807
2984
  updateInteractionVariant
1808
2985
  ));
1809
- return /* @__PURE__ */ React.createElement(ErrorBoundary, { fallback: /* @__PURE__ */ React.createElement(RadioGroup, null, radio) }, radio);
1810
- }
1811
- function registerRadio(loader, overrides) {
1812
- registerComponentHelper(
1813
- loader,
1814
- BaseRadio,
2986
+ return /* @__PURE__ */ React.createElement(
2987
+ ErrorBoundary,
1815
2988
  {
1816
- name: makeComponentName("radio"),
1817
- displayName: "Aria Radio",
1818
- importPath: "@plasmicpkgs/react-aria/skinny/registerRadio",
1819
- importName: "BaseRadio",
1820
- interactionVariants: interactionVariants$2,
1821
- props: __spreadProps$4(__spreadValues$7({}, getCommonInputProps("radio", [
1822
- "isDisabled",
1823
- "autoFocus",
1824
- "aria-label",
1825
- "children"
1826
- ])), {
1827
- value: {
1828
- type: "string",
1829
- description: "The value of the input element, used when submitting an HTML form."
1830
- },
1831
- onSelectionChange: {
1832
- type: "eventHandler",
1833
- argTypes: [{ name: "isSelected", type: "boolean" }]
1834
- }
1835
- }),
1836
- states: {
1837
- isSelected: {
1838
- type: "readonly",
1839
- onChangeProp: "onSelectionChange",
1840
- variableType: "boolean"
1841
- }
1842
- },
1843
- trapsFocus: true
2989
+ fallback: /* @__PURE__ */ React.createElement(Slider, { style: { height: "100%", width: "100%" } }, /* @__PURE__ */ React.createElement(SliderTrack, null, thumb))
1844
2990
  },
1845
- overrides
2991
+ thumb
1846
2992
  );
1847
2993
  }
1848
-
1849
- var __defProp$6 = Object.defineProperty;
1850
- var __defProps$3 = Object.defineProperties;
1851
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
1852
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
1853
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
1854
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
1855
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1856
- var __spreadValues$6 = (a, b) => {
1857
- for (var prop in b || (b = {}))
1858
- if (__hasOwnProp$6.call(b, prop))
1859
- __defNormalProp$6(a, prop, b[prop]);
1860
- if (__getOwnPropSymbols$6)
1861
- for (var prop of __getOwnPropSymbols$6(b)) {
1862
- if (__propIsEnum$6.call(b, prop))
1863
- __defNormalProp$6(a, prop, b[prop]);
1864
- }
1865
- return a;
1866
- };
1867
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
1868
- const BaseRadioGroup = RadioGroup;
1869
- const componentName$1 = makeComponentName("radioGroup");
1870
- function registerRadioGroup(loader, overrides) {
2994
+ const SLIDER_THUMB_COMPONENT_NAME = makeComponentName("sliderThumb");
2995
+ function registerSliderThumb(loader, overrides) {
1871
2996
  registerComponentHelper(
1872
2997
  loader,
1873
- BaseRadioGroup,
2998
+ BaseSliderThumb,
1874
2999
  {
1875
- name: componentName$1,
1876
- displayName: "Aria RadioGroup",
1877
- importPath: "@plasmicpkgs/react-aria/skinny/registerRadioGroup",
1878
- importName: "BaseRadioGroup",
1879
- props: __spreadProps$3(__spreadValues$6({}, getCommonInputProps("radio group", [
1880
- "name",
1881
- "isDisabled",
1882
- "isReadOnly",
1883
- "aria-label",
1884
- "children",
1885
- "isRequired"
1886
- ])), {
1887
- value: {
1888
- type: "string",
1889
- editOnly: true,
1890
- uncontrolledProp: "defaultValue",
1891
- description: "The current value"
1892
- },
1893
- isInvalid: {
1894
- displayName: "Invalid",
1895
- type: "boolean",
1896
- description: "Whether the input value is invalid",
1897
- defaultValueHint: false
1898
- },
1899
- validationBehavior: {
1900
- type: "choice",
1901
- options: ["native", "aria"],
1902
- 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.",
1903
- defaultValueHint: "native"
1904
- },
1905
- onChange: {
1906
- type: "eventHandler",
1907
- argTypes: [{ name: "value", type: "string" }]
1908
- }
1909
- }),
1910
- states: {
1911
- value: {
1912
- type: "writable",
1913
- valueProp: "value",
1914
- onChangeProp: "onChange",
1915
- variableType: "array"
3000
+ name: SLIDER_THUMB_COMPONENT_NAME,
3001
+ displayName: "Aria Slider Thumb",
3002
+ importPath: "@plasmicpkgs/react-aria/skinny/registerSliderThumb",
3003
+ importName: "BaseSliderThumb",
3004
+ defaultStyles: {
3005
+ position: "absolute",
3006
+ top: "5px",
3007
+ width: "20px",
3008
+ height: "20px",
3009
+ backgroundColor: "#C80101",
3010
+ borderRadius: "100%",
3011
+ cursor: "pointer"
3012
+ },
3013
+ interactionVariants: interactionVariants$3,
3014
+ props: {
3015
+ advanced: "boolean",
3016
+ children: {
3017
+ type: "slot",
3018
+ hidden: (ps) => !ps.advanced
1916
3019
  }
1917
3020
  },
1918
3021
  trapsFocus: true
1919
3022
  },
1920
3023
  overrides
1921
3024
  );
1922
- const thisName = makeChildComponentName(
1923
- overrides == null ? void 0 : overrides.parentComponentName,
1924
- componentName$1
1925
- );
1926
- registerFieldError(loader, { parentComponentName: thisName });
1927
- registerRadio(loader, { parentComponentName: thisName });
1928
- registerLabel(loader, { parentComponentName: thisName });
1929
- registerDescription(loader, {
1930
- parentComponentName: thisName
1931
- });
1932
3025
  }
1933
3026
 
1934
3027
  var __defProp$5 = Object.defineProperty;
@@ -1947,62 +3040,163 @@ var __spreadValues$5 = (a, b) => {
1947
3040
  }
1948
3041
  return a;
1949
3042
  };
1950
- function BaseHeader(props) {
1951
- const contextProps = React.useContext(PlasmicHeaderContext);
1952
- return /* @__PURE__ */ React.createElement(Header, __spreadValues$5({}, mergeProps(contextProps, props)));
3043
+ var __objRest$5 = (source, exclude) => {
3044
+ var target = {};
3045
+ for (var prop in source)
3046
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
3047
+ target[prop] = source[prop];
3048
+ if (source != null && __getOwnPropSymbols$5)
3049
+ for (var prop of __getOwnPropSymbols$5(source)) {
3050
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
3051
+ target[prop] = source[prop];
3052
+ }
3053
+ return target;
3054
+ };
3055
+ const SLIDER_TRACK_INTERACTION_VARIANTS = ["hovered"];
3056
+ const { interactionVariants: interactionVariants$2, withObservedValues: withObservedValues$1 } = pickAriaComponentVariants(
3057
+ SLIDER_TRACK_INTERACTION_VARIANTS
3058
+ );
3059
+ function findMinMaxIndices(values) {
3060
+ if (typeof values === "number" || (values == null ? void 0 : values.length) === 0 || !Array.isArray(values)) {
3061
+ return { minIndex: 0, maxIndex: 0 };
3062
+ }
3063
+ let minIndex = 0;
3064
+ let maxIndex = 0;
3065
+ for (let i = 1; i < values.length; i++) {
3066
+ if (values[i] < values[minIndex]) {
3067
+ minIndex = i;
3068
+ }
3069
+ if (values[i] > values[maxIndex]) {
3070
+ maxIndex = i;
3071
+ }
3072
+ }
3073
+ return { minIndex, maxIndex };
1953
3074
  }
1954
- function registerHeader(loader, overrides) {
1955
- registerComponentHelper(
1956
- loader,
1957
- BaseHeader,
3075
+ function BaseSliderTrack(props) {
3076
+ const context = React.useContext(PlasmicSliderContext);
3077
+ const mergedProps = mergeProps$1(context, props);
3078
+ const _a = mergedProps, {
3079
+ children,
3080
+ progressBar,
3081
+ updateInteractionVariant,
3082
+ isMultiValue
3083
+ } = _a, rest = __objRest$5(_a, [
3084
+ "children",
3085
+ "progressBar",
3086
+ "updateInteractionVariant",
3087
+ "isMultiValue"
3088
+ ]);
3089
+ const { minIndex, maxIndex } = useMemo(
3090
+ () => findMinMaxIndices(mergedProps.value),
3091
+ [mergedProps.value]
3092
+ );
3093
+ const thumbs = useMemo(() => {
3094
+ const rawThumbs = flattenChildren(children);
3095
+ if (mergedProps.value === void 0) {
3096
+ return [];
3097
+ }
3098
+ if (!Array.isArray(mergedProps == null ? void 0 : mergedProps.value)) {
3099
+ return rawThumbs;
3100
+ }
3101
+ const difference = mergedProps.value.length - rawThumbs.length;
3102
+ if (!difference) {
3103
+ return rawThumbs;
3104
+ }
3105
+ if (difference < 0) {
3106
+ return rawThumbs.slice(0, mergedProps.value.length);
3107
+ }
3108
+ const lastThumb = rawThumbs[rawThumbs.length - 1];
3109
+ return rawThumbs.concat(new Array(difference).fill(lastThumb));
3110
+ }, [children, mergedProps.value]);
3111
+ const track = /* @__PURE__ */ React.createElement(SliderTrack, __spreadValues$5({ style: { position: "relative" } }, rest), ({ state, isHovered }) => /* @__PURE__ */ React.createElement(React.Fragment, null, withObservedValues$1(
3112
+ /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
3113
+ "div",
3114
+ {
3115
+ style: {
3116
+ width: `${(!isMultiValue ? state.getThumbPercent(minIndex) : state.getThumbPercent(maxIndex) - state.getThumbPercent(minIndex)) * 100}%`,
3117
+ height: "100%",
3118
+ position: "absolute",
3119
+ top: 0,
3120
+ left: !isMultiValue ? 0 : state.getThumbPercent(minIndex) * 100 + "%"
3121
+ }
3122
+ },
3123
+ progressBar
3124
+ ), thumbs.map(
3125
+ (thumb, i) => React.isValidElement(thumb) && React.cloneElement(thumb, {
3126
+ // sets the index of the thumb, so that each thumb reflects the correct value
3127
+ index: i
3128
+ })
3129
+ )),
1958
3130
  {
1959
- name: makeComponentName("header"),
1960
- displayName: "Aria Header",
1961
- importPath: "@plasmicpkgs/react-aria/skinny/registerHeader",
1962
- importName: "BaseHeader",
1963
- props: {}
3131
+ hovered: isHovered
1964
3132
  },
1965
- overrides
3133
+ updateInteractionVariant
3134
+ )));
3135
+ return /* @__PURE__ */ React.createElement(
3136
+ ErrorBoundary,
3137
+ {
3138
+ fallback: /* @__PURE__ */ React.createElement(Slider, { style: { height: "100%", width: "100%" } }, track)
3139
+ },
3140
+ track
1966
3141
  );
1967
3142
  }
1968
-
1969
- function BaseSection(props) {
1970
- const contextProps = React.useContext(PlasmicSectionContext);
1971
- const mergedProps = mergeProps(contextProps, props);
1972
- const { section, renderHeader, key, renderItem } = mergedProps;
1973
- return /* @__PURE__ */ React.createElement(Section, { id: key }, /* @__PURE__ */ React.createElement(PlasmicHeaderContext.Provider, { value: { children: section == null ? void 0 : section.label } }, renderHeader == null ? void 0 : renderHeader(section)), /* @__PURE__ */ React.createElement(Collection, { items: section == null ? void 0 : section.items }, (item) => {
1974
- return /* @__PURE__ */ React.createElement(PlasmicItemContext.Provider, { value: item }, renderItem == null ? void 0 : renderItem(item));
1975
- }));
1976
- }
1977
- function registerSection(loader, overrides) {
3143
+ const SLIDER_TRACK_COMPONENT_NAME = makeComponentName("sliderTrack");
3144
+ function registerSliderTrack(loader, overrides) {
1978
3145
  registerComponentHelper(
1979
3146
  loader,
1980
- BaseSection,
3147
+ BaseSliderTrack,
1981
3148
  {
1982
- name: makeComponentName("section"),
1983
- displayName: "Aria Section",
1984
- importPath: "@plasmicpkgs/react-aria/skinny/registerSection",
1985
- importName: "BaseSection",
3149
+ name: SLIDER_TRACK_COMPONENT_NAME,
3150
+ displayName: "Aria Slider Track",
3151
+ importPath: "@plasmicpkgs/react-aria/skinny/registerSliderTrack",
3152
+ importName: "BaseSliderTrack",
3153
+ defaultStyles: {
3154
+ width: "stretch",
3155
+ backgroundColor: "#aaa",
3156
+ position: "relative",
3157
+ height: "10px",
3158
+ padding: 0
3159
+ },
3160
+ interactionVariants: interactionVariants$2,
1986
3161
  props: {
1987
- renderHeader: {
3162
+ children: {
1988
3163
  type: "slot",
1989
- displayName: "Render section header",
1990
- renderPropParams: ["sectionProps"]
3164
+ description: "The thumbs of the slider",
3165
+ defaultValue: [
3166
+ {
3167
+ type: "component",
3168
+ name: makeChildComponentName(
3169
+ SLIDER_COMPONENT_NAME,
3170
+ SLIDER_THUMB_COMPONENT_NAME
3171
+ )
3172
+ }
3173
+ ]
3174
+ },
3175
+ progressBar: {
3176
+ type: "slot",
3177
+ displayName: "Progress Bar",
3178
+ defaultValue: [
3179
+ {
3180
+ type: "box",
3181
+ styles: {
3182
+ height: "100%",
3183
+ width: "100%",
3184
+ backgroundColor: "#ffa6a6",
3185
+ padding: 0
3186
+ }
3187
+ }
3188
+ ]
1991
3189
  }
1992
- }
3190
+ },
3191
+ trapsFocus: true
1993
3192
  },
1994
3193
  overrides
1995
3194
  );
1996
- const thisName = makeChildComponentName(
1997
- overrides == null ? void 0 : overrides.parentComponentName,
1998
- makeComponentName("section")
1999
- );
2000
- registerHeader(loader, {
2001
- parentComponentName: thisName
2002
- });
2003
3195
  }
2004
3196
 
2005
3197
  var __defProp$4 = Object.defineProperty;
3198
+ var __defProps$3 = Object.defineProperties;
3199
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
2006
3200
  var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
2007
3201
  var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
2008
3202
  var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
@@ -2018,164 +3212,225 @@ var __spreadValues$4 = (a, b) => {
2018
3212
  }
2019
3213
  return a;
2020
3214
  };
2021
- const SELECT_NAME = makeComponentName("select");
2022
- function BaseSelect(props) {
2023
- const {
2024
- value,
2025
- onChange,
2026
- placeholder,
2027
- previewOpen,
2028
- onOpenChange,
2029
- isDisabled,
2030
- className,
2031
- style,
2032
- structure,
2033
- name,
2034
- "aria-label": ariaLabel
2035
- } = props;
2036
- const { options } = useStrictOptions(props);
2037
- const canvas = usePlasmicCanvasContext();
2038
- const disabledKeys = flattenOptions(options).filter((op) => op.isDisabled).map((op) => op.id);
2039
- return /* @__PURE__ */ React.createElement(
2040
- Select,
2041
- __spreadValues$4(__spreadValues$4({
2042
- placeholder,
2043
- selectedKey: value,
2044
- onSelectionChange: onChange,
2045
- onOpenChange,
2046
- isDisabled,
2047
- className,
2048
- style,
2049
- name,
2050
- "aria-label": ariaLabel
2051
- }, previewOpen && canvas ? { isOpen: previewOpen } : void 0), extractPlasmicDataProps(props)),
2052
- /* @__PURE__ */ React.createElement(
2053
- PlasmicListBoxContext.Provider,
2054
- {
2055
- value: {
2056
- items: options,
2057
- disabledKeys
3215
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
3216
+ var __objRest$4 = (source, exclude) => {
3217
+ var target = {};
3218
+ for (var prop in source)
3219
+ if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
3220
+ target[prop] = source[prop];
3221
+ if (source != null && __getOwnPropSymbols$4)
3222
+ for (var prop of __getOwnPropSymbols$4(source)) {
3223
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
3224
+ target[prop] = source[prop];
3225
+ }
3226
+ return target;
3227
+ };
3228
+ const SLIDER_COMPONENT_NAME = makeComponentName("slider");
3229
+ const sliderHelpers = {
3230
+ states: {
3231
+ range: {
3232
+ onChangeArgsToValue: (value, isMultiValue) => {
3233
+ if (isMultiValue) {
3234
+ return Array.isArray(value) ? value : [value, value + 10];
2058
3235
  }
2059
- },
2060
- structure
2061
- )
2062
- );
2063
- }
2064
- function registerSelect(loader) {
2065
- registerComponentHelper(loader, BaseSelect, {
2066
- name: SELECT_NAME,
2067
- displayName: "Aria Select",
2068
- importPath: "@plasmicpkgs/react-aria/skinny/registerSelect",
2069
- importName: "BaseSelect",
2070
- props: {
2071
- options: makeOptionsPropType(),
2072
- placeholder: {
2073
- type: "string"
2074
- },
2075
- isDisabled: {
2076
- type: "boolean"
2077
- },
2078
- value: makeValuePropType(),
2079
- onChange: {
2080
- type: "eventHandler",
2081
- argTypes: [{ name: "value", type: "string" }]
2082
- },
2083
- previewOpen: {
2084
- type: "boolean",
2085
- displayName: "Preview opened?",
2086
- description: "Preview opened state while designing in Plasmic editor",
2087
- editOnly: true
2088
- },
2089
- onOpenChange: {
2090
- type: "eventHandler",
2091
- argTypes: [{ name: "isOpen", type: "boolean" }]
2092
- },
2093
- // optionValue: {
2094
- // type: "string",
2095
- // displayName: "Field key for an option's value",
2096
- // hidden: (ps) =>
2097
- // !ps.options ||
2098
- // !ps.options[0] ||
2099
- // typeof ps.options[0] === "string" ||
2100
- // "value" in ps.options[0],
2101
- // exprHint:
2102
- // "Return a function that takes in an option object, and returns the key to use",
2103
- // },
2104
- // optionText: {
2105
- // type: "string",
2106
- // displayName: "Field key for an option's text value",
2107
- // hidden: (ps) =>
2108
- // !ps.options ||
2109
- // !ps.options[0] ||
2110
- // typeof ps.options[0] === "string" ||
2111
- // "value" in ps.options[0],
2112
- // exprHint:
2113
- // "Return a function that takes in an option object, and returns the text value to use",
2114
- // },
2115
- // optionDisabled: {
2116
- // type: "string",
2117
- // displayName: "Field key for whether an option is disabled",
2118
- // hidden: (ps) =>
2119
- // !ps.options ||
2120
- // !ps.options[0] ||
2121
- // typeof ps.options[0] === "string" ||
2122
- // "value" in ps.options[0],
2123
- // exprHint:
2124
- // "Return a function that takes in an option object, and returns true if option should be disabled",
2125
- // },
2126
- structure: {
2127
- type: "slot"
2128
- },
2129
- // renderOption: {
2130
- // type: "slot",
2131
- // displayName: "Custom render option",
2132
- // renderPropParams: ["item"],
2133
- // hidePlaceholder: true
2134
- // },
2135
- name: {
2136
- type: "string",
2137
- displayName: "Form field key",
2138
- description: "Name of the input, when submitting in an HTML form",
2139
- advanced: true
2140
- },
2141
- "aria-label": {
2142
- type: "string",
2143
- displayName: "Aria Label",
2144
- description: "Label for this input, if no visible label is used",
2145
- advanced: true
3236
+ return void 0;
2146
3237
  }
2147
3238
  },
2148
- states: {
2149
- value: {
2150
- type: "writable",
2151
- valueProp: "value",
2152
- onChangeProp: "onChange",
2153
- variableType: "text"
2154
- },
2155
- isOpen: {
2156
- type: "readonly",
2157
- onChangeProp: "onOpenChange",
2158
- variableType: "boolean"
3239
+ value: {
3240
+ onChangeArgsToValue: (value, isMultiValue) => {
3241
+ if (isMultiValue) {
3242
+ return void 0;
3243
+ }
3244
+ return Array.isArray(value) ? value[0] : value;
2159
3245
  }
2160
3246
  }
3247
+ }
3248
+ };
3249
+ function BaseSlider(props) {
3250
+ const _a = props, { range, value, defaultRange, defaultValue, onChange } = _a, rest = __objRest$4(_a, ["range", "value", "defaultRange", "defaultValue", "onChange"]);
3251
+ const isFirstRender = useRef(true);
3252
+ useEffect(() => {
3253
+ var _a2, _b, _c;
3254
+ if (isFirstRender.current) {
3255
+ isFirstRender.current = false;
3256
+ return;
3257
+ }
3258
+ if (props.isMultiValue) {
3259
+ const minValue = (_a2 = props.minValue) != null ? _a2 : 0;
3260
+ (_b = props.onChange) == null ? void 0 : _b.call(
3261
+ props,
3262
+ Array.isArray(range) && range.length > 1 ? range : [minValue, minValue + 10],
3263
+ true
3264
+ );
3265
+ return;
3266
+ }
3267
+ (_c = props.onChange) == null ? void 0 : _c.call(props, Array.isArray(value) ? 0 : value != null ? value : 0, false);
3268
+ }, [props.isMultiValue]);
3269
+ const mergedProps = mergeProps$1(rest, {
3270
+ value: props.isMultiValue ? range : value,
3271
+ defaultValue: props.isMultiValue ? defaultRange : defaultValue
2161
3272
  });
2162
- registerComponentHelper(loader, SelectValue, {
2163
- name: makeComponentName("select-value"),
2164
- displayName: "Aria Selected Value",
2165
- importPath: "@plasmicpkgs/react-aria/registerSelect",
2166
- importName: "SelectValue",
2167
- parentComponentName: SELECT_NAME,
2168
- props: {
2169
- className: {
2170
- type: "class",
2171
- selectors: [
2172
- {
2173
- selector: ":self[data-placeholder]",
2174
- label: "Placeholder"
2175
- }
2176
- ]
3273
+ return /* @__PURE__ */ React.createElement(PlasmicSliderContext.Provider, { value: mergedProps }, /* @__PURE__ */ React.createElement(
3274
+ Slider,
3275
+ __spreadValues$4({
3276
+ key: props.isMultiValue ? "multi" : "single",
3277
+ onChange: (newValue) => {
3278
+ onChange == null ? void 0 : onChange(newValue, props.isMultiValue);
2177
3279
  }
2178
- }
3280
+ }, mergedProps)
3281
+ ));
3282
+ }
3283
+ function registerSlider(loader, overrides) {
3284
+ registerComponentHelper(
3285
+ loader,
3286
+ BaseSlider,
3287
+ {
3288
+ name: SLIDER_COMPONENT_NAME,
3289
+ displayName: "Aria Slider",
3290
+ importPath: "@plasmicpkgs/react-aria/skinny/registerSlider",
3291
+ importName: "BaseSlider",
3292
+ defaultStyles: {
3293
+ width: "300px"
3294
+ },
3295
+ props: __spreadProps$3(__spreadValues$4({}, getCommonInputProps("slider", [
3296
+ "isDisabled",
3297
+ "name",
3298
+ "autoFocus",
3299
+ "aria-label"
3300
+ ])), {
3301
+ children: {
3302
+ type: "slot",
3303
+ defaultValue: [
3304
+ {
3305
+ type: "hbox",
3306
+ styles: {
3307
+ width: "stretch",
3308
+ justifyContent: "space-between",
3309
+ padding: "8px 0px"
3310
+ },
3311
+ children: [
3312
+ {
3313
+ type: "component",
3314
+ name: LABEL_COMPONENT_NAME,
3315
+ props: {
3316
+ children: {
3317
+ type: "text",
3318
+ value: "Label"
3319
+ }
3320
+ }
3321
+ },
3322
+ {
3323
+ type: "component",
3324
+ name: makeChildComponentName(
3325
+ SLIDER_COMPONENT_NAME,
3326
+ SLIDER_OUTPUT_COMPONENT_NAME
3327
+ ),
3328
+ props: {
3329
+ children: {
3330
+ type: "text",
3331
+ value: "Output"
3332
+ }
3333
+ }
3334
+ }
3335
+ ]
3336
+ },
3337
+ {
3338
+ type: "component",
3339
+ name: makeChildComponentName(
3340
+ SLIDER_COMPONENT_NAME,
3341
+ SLIDER_TRACK_COMPONENT_NAME
3342
+ )
3343
+ }
3344
+ ]
3345
+ },
3346
+ orientation: {
3347
+ type: "choice",
3348
+ options: ["horizontal", "vertical"],
3349
+ defaultValueHint: "horizontal",
3350
+ defaultValue: "horizontal"
3351
+ },
3352
+ minValue: {
3353
+ type: "number",
3354
+ description: "The minimum value of the slider",
3355
+ defaultValueHint: 0
3356
+ },
3357
+ maxValue: {
3358
+ type: "number",
3359
+ description: "The maximum value of the slider",
3360
+ defaultValueHint: 100
3361
+ },
3362
+ step: {
3363
+ type: "number",
3364
+ description: "The step value of the slider",
3365
+ defaultValueHint: 1
3366
+ },
3367
+ isMultiValue: {
3368
+ type: "boolean",
3369
+ displayName: "Multi-valued",
3370
+ description: "Whether the slider supports range (multiple thumbs)",
3371
+ defaultValue: false,
3372
+ defaultValueHint: false
3373
+ },
3374
+ range: {
3375
+ type: "array",
3376
+ editOnly: true,
3377
+ uncontrolledProp: "defaultRange",
3378
+ description: "The default range of the slider",
3379
+ defaultValueHint: [10, 20],
3380
+ defaultValue: [10, 20],
3381
+ hidden: (ps) => !ps.isMultiValue
3382
+ },
3383
+ value: {
3384
+ type: "number",
3385
+ editOnly: true,
3386
+ uncontrolledProp: "defaultValue",
3387
+ description: "The default value of the slider",
3388
+ defaultValueHint: 0,
3389
+ defaultValue: 0,
3390
+ hidden: (ps) => Boolean(ps.isMultiValue)
3391
+ },
3392
+ onChange: {
3393
+ type: "eventHandler",
3394
+ argTypes: [{ name: "value", type: "object" }]
3395
+ },
3396
+ onChangeEnd: {
3397
+ type: "eventHandler",
3398
+ argTypes: [{ name: "value", type: "object" }]
3399
+ }
3400
+ }),
3401
+ states: {
3402
+ range: __spreadValues$4({
3403
+ type: "writable",
3404
+ valueProp: "range",
3405
+ onChangeProp: "onChange",
3406
+ variableType: "array",
3407
+ hidden: (ps) => !ps.isMultiValue
3408
+ }, sliderHelpers.states.range),
3409
+ value: __spreadValues$4({
3410
+ type: "writable",
3411
+ valueProp: "value",
3412
+ onChangeProp: "onChange",
3413
+ variableType: "number",
3414
+ hidden: (ps) => Boolean(ps.isMultiValue)
3415
+ }, sliderHelpers.states.value)
3416
+ },
3417
+ componentHelpers: {
3418
+ helpers: sliderHelpers,
3419
+ importName: "sliderHelpers",
3420
+ importPath: "@plasmicpkgs/react-aria/skinny/registerSlider"
3421
+ },
3422
+ trapsFocus: true
3423
+ },
3424
+ overrides
3425
+ );
3426
+ registerSliderOutput(loader, {
3427
+ parentComponentName: SLIDER_COMPONENT_NAME
3428
+ });
3429
+ registerSliderThumb(loader, {
3430
+ parentComponentName: SLIDER_COMPONENT_NAME
3431
+ });
3432
+ registerSliderTrack(loader, {
3433
+ parentComponentName: SLIDER_COMPONENT_NAME
2179
3434
  });
2180
3435
  }
2181
3436
 
@@ -2242,14 +3497,91 @@ function registerSwitch(loader, overrides) {
2242
3497
  importPath: "@plasmicpkgs/react-aria/skinny/registerSwitch",
2243
3498
  importName: "BaseSwitch",
2244
3499
  interactionVariants: interactionVariants$1,
3500
+ defaultStyles: {
3501
+ display: "flex",
3502
+ flexDirection: "column",
3503
+ alignItems: "center",
3504
+ justifyContent: "flex-start",
3505
+ padding: 0
3506
+ },
2245
3507
  props: __spreadProps$2(__spreadValues$3({}, getCommonInputProps("switch", [
2246
3508
  "name",
2247
3509
  "isDisabled",
2248
3510
  "isReadOnly",
2249
3511
  "autoFocus",
2250
- "aria-label",
2251
- "children"
3512
+ "aria-label"
2252
3513
  ])), {
3514
+ children: {
3515
+ type: "slot",
3516
+ mergeWithParent: true,
3517
+ defaultValue: [
3518
+ {
3519
+ type: "hbox",
3520
+ styles: {
3521
+ display: "flex",
3522
+ alignItems: "center",
3523
+ justifyContent: "center",
3524
+ gap: "10px",
3525
+ padding: 0
3526
+ },
3527
+ children: [
3528
+ {
3529
+ // the track
3530
+ type: "hbox",
3531
+ styles: {
3532
+ width: "30px",
3533
+ height: "16px",
3534
+ padding: 0,
3535
+ backgroundColor: "#D5D5D5",
3536
+ cursor: "pointer",
3537
+ borderRadius: "999px"
3538
+ },
3539
+ children: {
3540
+ // the thumb
3541
+ type: "hbox",
3542
+ styles: {
3543
+ width: "12px",
3544
+ height: "12px",
3545
+ position: "absolute",
3546
+ top: "2px",
3547
+ left: "2px",
3548
+ borderRadius: "100%",
3549
+ backgroundColor: "#fff",
3550
+ padding: 0,
3551
+ transitionProperty: "all",
3552
+ transitionDuration: "0.5s",
3553
+ transitionTimingFunction: "ease-in-out"
3554
+ }
3555
+ }
3556
+ },
3557
+ {
3558
+ // the label
3559
+ type: "component",
3560
+ name: LABEL_COMPONENT_NAME,
3561
+ props: {
3562
+ children: {
3563
+ type: "text",
3564
+ value: "Label"
3565
+ }
3566
+ }
3567
+ }
3568
+ ]
3569
+ },
3570
+ {
3571
+ type: "component",
3572
+ name: DESCRIPTION_COMPONENT_NAME,
3573
+ styles: {
3574
+ fontSize: "12px"
3575
+ },
3576
+ props: {
3577
+ children: {
3578
+ type: "text",
3579
+ value: "Add interaction variants to see it in action..."
3580
+ }
3581
+ }
3582
+ }
3583
+ ]
3584
+ },
2253
3585
  value: {
2254
3586
  type: "boolean",
2255
3587
  editOnly: true,
@@ -2414,13 +3746,13 @@ function BaseTextField(props) {
2414
3746
  children
2415
3747
  );
2416
3748
  }
2417
- const componentName = makeComponentName("textField");
3749
+ const TEXT_FIELD_COMPONENT_NAME = makeComponentName("textField");
2418
3750
  function registerTextField(loader, overrides) {
2419
3751
  registerComponentHelper(
2420
3752
  loader,
2421
3753
  BaseTextField,
2422
3754
  {
2423
- name: componentName,
3755
+ name: TEXT_FIELD_COMPONENT_NAME,
2424
3756
  displayName: "Aria TextField",
2425
3757
  importPath: "@plasmicpkgs/react-aria/skinny/registerTextField",
2426
3758
  importName: "BaseTextField",
@@ -2431,9 +3763,50 @@ function registerTextField(loader, overrides) {
2431
3763
  "isReadOnly",
2432
3764
  "autoFocus",
2433
3765
  "aria-label",
2434
- "children",
2435
3766
  "isRequired"
2436
3767
  ])), {
3768
+ children: {
3769
+ type: "slot",
3770
+ mergeWithParent: true,
3771
+ defaultValue: {
3772
+ type: "vbox",
3773
+ styles: {
3774
+ justifyContent: "flex-start",
3775
+ alignItems: "flex-start",
3776
+ width: "300px",
3777
+ gap: "5px"
3778
+ },
3779
+ children: [
3780
+ {
3781
+ type: "component",
3782
+ name: LABEL_COMPONENT_NAME,
3783
+ props: {
3784
+ children: {
3785
+ type: "text",
3786
+ value: "Label"
3787
+ }
3788
+ }
3789
+ },
3790
+ {
3791
+ type: "component",
3792
+ name: INPUT_COMPONENT_NAME,
3793
+ styles: {
3794
+ width: "100%"
3795
+ }
3796
+ },
3797
+ {
3798
+ type: "component",
3799
+ name: DESCRIPTION_COMPONENT_NAME,
3800
+ props: {
3801
+ children: {
3802
+ type: "text",
3803
+ value: "Type something..."
3804
+ }
3805
+ }
3806
+ }
3807
+ ]
3808
+ }
3809
+ },
2437
3810
  value: {
2438
3811
  type: "string",
2439
3812
  editOnly: true,
@@ -2649,12 +4022,11 @@ function registerTextField(loader, overrides) {
2649
4022
  );
2650
4023
  const thisName = makeChildComponentName(
2651
4024
  overrides == null ? void 0 : overrides.parentComponentName,
2652
- componentName
4025
+ TEXT_FIELD_COMPONENT_NAME
2653
4026
  );
2654
4027
  registerFieldError(loader, { parentComponentName: thisName });
2655
4028
  registerInput(loader, { parentComponentName: thisName });
2656
4029
  registerLabel(loader, { parentComponentName: thisName });
2657
- registerDescription(loader, { parentComponentName: thisName });
2658
4030
  registerTextArea(loader, { parentComponentName: thisName });
2659
4031
  }
2660
4032
 
@@ -2788,6 +4160,8 @@ function registerTooltip(loader, overrides) {
2788
4160
  }
2789
4161
 
2790
4162
  function registerAll(loader) {
4163
+ registerText(loader);
4164
+ registerDescription(loader);
2791
4165
  registerSelect(loader);
2792
4166
  registerComboBox(loader);
2793
4167
  registerButton(loader);
@@ -2795,7 +4169,6 @@ function registerAll(loader) {
2795
4169
  registerListBox(loader);
2796
4170
  registerPopover(loader);
2797
4171
  registerInput(loader);
2798
- registerSection(loader);
2799
4172
  registerSwitch(loader);
2800
4173
  registerForm(loader);
2801
4174
  registerCheckbox(loader);
@@ -2805,6 +4178,7 @@ function registerAll(loader) {
2805
4178
  registerModal(loader);
2806
4179
  registerTooltip(loader);
2807
4180
  registerDialogTrigger(loader);
4181
+ registerSlider(loader);
2808
4182
  }
2809
4183
 
2810
4184
  export { registerAll };