@plasmicpkgs/react-aria 0.0.10 → 0.0.11

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.
@@ -1,29 +1,79 @@
1
1
  import React, { useEffect } from 'react';
2
- import { Button, ComboBox, ComboBoxStateContext, Input, Label, ListBoxItem, ListBox, PopoverContext, Popover, Header, Section, Collection, SelectValue, Select } from 'react-aria-components';
2
+ import { Button, ComboBox, ComboBoxStateContext, Input, Label, ListBoxItem, ListBox, PopoverContext, Popover, Header, Section, Collection, SelectValue, Select, Switch } 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
7
 
8
- var __defProp$a = Object.defineProperty;
9
- var __defProps$3 = Object.defineProperties;
10
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
11
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
12
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
13
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
14
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15
- var __spreadValues$a = (a, b) => {
8
+ function getCommonInputProps(fieldName, fields) {
9
+ const commonInputProps = {
10
+ name: {
11
+ type: "string",
12
+ description: "Name for this field if it is part of a form"
13
+ },
14
+ isDisabled: {
15
+ displayName: "Disabled",
16
+ type: "boolean",
17
+ description: `Whether the ${fieldName} is read-only and unfocusable`,
18
+ defaultValueHint: false
19
+ },
20
+ isReadOnly: {
21
+ displayName: "Read only",
22
+ type: "boolean",
23
+ description: `Whether the value of this ${fieldName} can be changed by the user`,
24
+ defaultValueHint: false
25
+ },
26
+ autoFocus: {
27
+ type: "boolean",
28
+ description: `Whether the ${fieldName} should be focused when rendered`,
29
+ defaultValueHint: false,
30
+ advanced: true
31
+ },
32
+ "aria-label": {
33
+ type: "string",
34
+ displayName: "Aria Label",
35
+ description: `Label for this ${fieldName}, if no visible label is used, to identify the element to assistive technology`,
36
+ advanced: true
37
+ },
38
+ isRequired: {
39
+ displayName: "Required",
40
+ type: "boolean",
41
+ description: `Whether user input is required on the ${fieldName} before form submission.`,
42
+ defaultValueHint: false
43
+ },
44
+ children: {
45
+ type: "slot",
46
+ mergeWithParent: true
47
+ }
48
+ };
49
+ const filteredProps = {};
50
+ fields.forEach((field) => {
51
+ if (commonInputProps.hasOwnProperty(field)) {
52
+ filteredProps[field] = commonInputProps[field];
53
+ }
54
+ });
55
+ return filteredProps;
56
+ }
57
+
58
+ var __defProp$b = Object.defineProperty;
59
+ var __defProps$5 = Object.defineProperties;
60
+ var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
61
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
62
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
63
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
64
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
65
+ var __spreadValues$b = (a, b) => {
16
66
  for (var prop in b || (b = {}))
17
- if (__hasOwnProp$a.call(b, prop))
18
- __defNormalProp$a(a, prop, b[prop]);
19
- if (__getOwnPropSymbols$a)
20
- for (var prop of __getOwnPropSymbols$a(b)) {
21
- if (__propIsEnum$a.call(b, prop))
22
- __defNormalProp$a(a, prop, b[prop]);
67
+ if (__hasOwnProp$b.call(b, prop))
68
+ __defNormalProp$b(a, prop, b[prop]);
69
+ if (__getOwnPropSymbols$b)
70
+ for (var prop of __getOwnPropSymbols$b(b)) {
71
+ if (__propIsEnum$b.call(b, prop))
72
+ __defNormalProp$b(a, prop, b[prop]);
23
73
  }
24
74
  return a;
25
75
  };
26
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
76
+ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
27
77
  function ValueObserver({ value, onChange }) {
28
78
  useEffect(() => {
29
79
  onChange(value);
@@ -32,8 +82,8 @@ function ValueObserver({ value, onChange }) {
32
82
  }
33
83
  function registerComponentHelper(loader, component, meta, overrides) {
34
84
  if (overrides) {
35
- meta = __spreadProps$3(__spreadValues$a(__spreadValues$a({}, meta), overrides), {
36
- props: __spreadValues$a(__spreadValues$a({}, meta.props), overrides.props)
85
+ meta = __spreadProps$5(__spreadValues$b(__spreadValues$b({}, meta), overrides), {
86
+ props: __spreadValues$b(__spreadValues$b({}, meta.props), overrides.props)
37
87
  });
38
88
  if (overrides.parentComponentName) {
39
89
  meta.name = makeChildComponentName(
@@ -71,37 +121,41 @@ function withoutNils(array) {
71
121
  return array.filter((x) => x != null);
72
122
  }
73
123
 
74
- var __defProp$9 = Object.defineProperty;
75
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
76
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
77
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
78
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
79
- var __spreadValues$9 = (a, b) => {
124
+ var __defProp$a = Object.defineProperty;
125
+ var __defProps$4 = Object.defineProperties;
126
+ var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
127
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
128
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
129
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
130
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
131
+ var __spreadValues$a = (a, b) => {
80
132
  for (var prop in b || (b = {}))
81
- if (__hasOwnProp$9.call(b, prop))
82
- __defNormalProp$9(a, prop, b[prop]);
83
- if (__getOwnPropSymbols$9)
84
- for (var prop of __getOwnPropSymbols$9(b)) {
85
- if (__propIsEnum$9.call(b, prop))
86
- __defNormalProp$9(a, prop, b[prop]);
133
+ if (__hasOwnProp$a.call(b, prop))
134
+ __defNormalProp$a(a, prop, b[prop]);
135
+ if (__getOwnPropSymbols$a)
136
+ for (var prop of __getOwnPropSymbols$a(b)) {
137
+ if (__propIsEnum$a.call(b, prop))
138
+ __defNormalProp$a(a, prop, b[prop]);
87
139
  }
88
140
  return a;
89
141
  };
142
+ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
90
143
  var __objRest$3 = (source, exclude) => {
91
144
  var target = {};
92
145
  for (var prop in source)
93
- if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
146
+ if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
94
147
  target[prop] = source[prop];
95
- if (source != null && __getOwnPropSymbols$9)
96
- for (var prop of __getOwnPropSymbols$9(source)) {
97
- if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
148
+ if (source != null && __getOwnPropSymbols$a)
149
+ for (var prop of __getOwnPropSymbols$a(source)) {
150
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
98
151
  target[prop] = source[prop];
99
152
  }
100
153
  return target;
101
154
  };
102
155
  function BaseButton(props) {
103
- const _a = props, { submitsForm, onFocusVisibleChange, children } = _a, rest = __objRest$3(_a, ["submitsForm", "onFocusVisibleChange", "children"]);
104
- return /* @__PURE__ */ React.createElement(Button, __spreadValues$9({ type: submitsForm ? "submit" : "button" }, rest), ({ isFocusVisible }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
156
+ const _a = props, { submitsForm, onFocusVisibleChange, resetsForm, children } = _a, rest = __objRest$3(_a, ["submitsForm", "onFocusVisibleChange", "resetsForm", "children"]);
157
+ const type = submitsForm ? "submit" : resetsForm ? "reset" : "button";
158
+ return /* @__PURE__ */ React.createElement(Button, __spreadValues$a({ type }, rest), ({ isFocusVisible }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
105
159
  ValueObserver,
106
160
  {
107
161
  value: isFocusVisible,
@@ -118,28 +172,25 @@ function registerButton(loader, overrides) {
118
172
  displayName: "BaseButton",
119
173
  importPath: "@plasmicpkgs/react-aria/registerButton",
120
174
  importName: "BaseButton",
121
- props: {
122
- children: {
123
- type: "slot",
124
- mergeWithParent: true
125
- },
126
- isDisabled: {
127
- displayName: "Disabled",
128
- type: "boolean",
129
- description: "Whether the button is disabled",
130
- defaultValueHint: false
131
- },
175
+ props: __spreadProps$4(__spreadValues$a({}, getCommonInputProps("button", [
176
+ "isDisabled",
177
+ "aria-label",
178
+ "children"
179
+ ])), {
132
180
  submitsForm: {
133
181
  type: "boolean",
134
182
  displayName: "Submits form?",
135
183
  defaultValueHint: false,
184
+ hidden: (ps) => Boolean(ps.resetsForm),
136
185
  description: "Whether clicking this button should submit the enclosing form.",
137
186
  advanced: true
138
187
  },
139
- "aria-label": {
140
- type: "string",
141
- displayName: "Aria Label",
142
- description: "Label for this button, if no visible label is used (e.g. an icon only button)",
188
+ resetsForm: {
189
+ type: "boolean",
190
+ displayName: "Resets form?",
191
+ defaultValueHint: false,
192
+ hidden: (ps) => Boolean(ps.submitsForm),
193
+ description: "Whether clicking this button should reset the enclosing form.",
143
194
  advanced: true
144
195
  },
145
196
  onPress: {
@@ -162,7 +213,7 @@ function registerButton(loader, overrides) {
162
213
  type: "eventHandler",
163
214
  argTypes: [{ name: "isFocusVisible", type: "boolean" }]
164
215
  }
165
- },
216
+ }),
166
217
  states: {
167
218
  isHovered: {
168
219
  type: "readonly",
@@ -348,25 +399,25 @@ function makeValuePropType() {
348
399
  return type;
349
400
  }
350
401
 
351
- var __defProp$8 = Object.defineProperty;
352
- var __defProps$2 = Object.defineProperties;
353
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
354
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
355
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
356
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
357
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
358
- var __spreadValues$8 = (a, b) => {
402
+ var __defProp$9 = Object.defineProperty;
403
+ var __defProps$3 = Object.defineProperties;
404
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
405
+ var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
406
+ var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
407
+ var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
408
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
409
+ var __spreadValues$9 = (a, b) => {
359
410
  for (var prop in b || (b = {}))
360
- if (__hasOwnProp$8.call(b, prop))
361
- __defNormalProp$8(a, prop, b[prop]);
362
- if (__getOwnPropSymbols$8)
363
- for (var prop of __getOwnPropSymbols$8(b)) {
364
- if (__propIsEnum$8.call(b, prop))
365
- __defNormalProp$8(a, prop, b[prop]);
411
+ if (__hasOwnProp$9.call(b, prop))
412
+ __defNormalProp$9(a, prop, b[prop]);
413
+ if (__getOwnPropSymbols$9)
414
+ for (var prop of __getOwnPropSymbols$9(b)) {
415
+ if (__propIsEnum$9.call(b, prop))
416
+ __defNormalProp$9(a, prop, b[prop]);
366
417
  }
367
418
  return a;
368
419
  };
369
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
420
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
370
421
  function BaseComboBox(props) {
371
422
  const {
372
423
  value,
@@ -399,7 +450,7 @@ function BaseComboBox(props) {
399
450
  return withoutNils(
400
451
  options2.map((op) => {
401
452
  if (op.type === "section") {
402
- return __spreadProps$2(__spreadValues$8({}, op), {
453
+ return __spreadProps$3(__spreadValues$9({}, op), {
403
454
  items: op.items ? filterOptions(op.items) : void 0
404
455
  });
405
456
  } else {
@@ -483,7 +534,7 @@ function BaseComboBox(props) {
483
534
  ]);
484
535
  return /* @__PURE__ */ React.createElement(
485
536
  ComboBox,
486
- __spreadValues$8({
537
+ __spreadValues$9({
487
538
  selectedKey: value,
488
539
  onSelectionChange,
489
540
  isDisabled,
@@ -622,25 +673,25 @@ function registerComboBox(loader) {
622
673
  });
623
674
  }
624
675
 
625
- var __defProp$7 = Object.defineProperty;
626
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
627
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
628
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
629
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
630
- var __spreadValues$7 = (a, b) => {
676
+ var __defProp$8 = Object.defineProperty;
677
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
678
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
679
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
680
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
681
+ var __spreadValues$8 = (a, b) => {
631
682
  for (var prop in b || (b = {}))
632
- if (__hasOwnProp$7.call(b, prop))
633
- __defNormalProp$7(a, prop, b[prop]);
634
- if (__getOwnPropSymbols$7)
635
- for (var prop of __getOwnPropSymbols$7(b)) {
636
- if (__propIsEnum$7.call(b, prop))
637
- __defNormalProp$7(a, prop, b[prop]);
683
+ if (__hasOwnProp$8.call(b, prop))
684
+ __defNormalProp$8(a, prop, b[prop]);
685
+ if (__getOwnPropSymbols$8)
686
+ for (var prop of __getOwnPropSymbols$8(b)) {
687
+ if (__propIsEnum$8.call(b, prop))
688
+ __defNormalProp$8(a, prop, b[prop]);
638
689
  }
639
690
  return a;
640
691
  };
641
692
  function BaseInput(props) {
642
693
  const contextProps = React.useContext(PlasmicInputContext);
643
- return /* @__PURE__ */ React.createElement(Input, __spreadValues$7({}, mergeProps(contextProps, props)));
694
+ return /* @__PURE__ */ React.createElement(Input, __spreadValues$8({}, mergeProps(contextProps, props)));
644
695
  }
645
696
  function registerInput(loader, overrides) {
646
697
  registerComponentHelper(
@@ -684,25 +735,25 @@ function registerInput(loader, overrides) {
684
735
  );
685
736
  }
686
737
 
687
- var __defProp$6 = Object.defineProperty;
688
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
689
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
690
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
691
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
692
- var __spreadValues$6 = (a, b) => {
738
+ var __defProp$7 = Object.defineProperty;
739
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
740
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
741
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
742
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
743
+ var __spreadValues$7 = (a, b) => {
693
744
  for (var prop in b || (b = {}))
694
- if (__hasOwnProp$6.call(b, prop))
695
- __defNormalProp$6(a, prop, b[prop]);
696
- if (__getOwnPropSymbols$6)
697
- for (var prop of __getOwnPropSymbols$6(b)) {
698
- if (__propIsEnum$6.call(b, prop))
699
- __defNormalProp$6(a, prop, b[prop]);
745
+ if (__hasOwnProp$7.call(b, prop))
746
+ __defNormalProp$7(a, prop, b[prop]);
747
+ if (__getOwnPropSymbols$7)
748
+ for (var prop of __getOwnPropSymbols$7(b)) {
749
+ if (__propIsEnum$7.call(b, prop))
750
+ __defNormalProp$7(a, prop, b[prop]);
700
751
  }
701
752
  return a;
702
753
  };
703
754
  function BaseLabel(props) {
704
755
  const contextProps = React.useContext(PlasmicLabelContext);
705
- return /* @__PURE__ */ React.createElement(Label, __spreadValues$6({}, mergeProps(contextProps, props)));
756
+ return /* @__PURE__ */ React.createElement(Label, __spreadValues$7({}, mergeProps(contextProps, props)));
706
757
  }
707
758
  function registerLabel(loader, overrides) {
708
759
  registerComponentHelper(
@@ -729,19 +780,19 @@ function registerLabel(loader, overrides) {
729
780
  );
730
781
  }
731
782
 
732
- var __defProp$5 = Object.defineProperty;
733
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
734
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
735
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
736
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
737
- var __spreadValues$5 = (a, b) => {
783
+ var __defProp$6 = Object.defineProperty;
784
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
785
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
786
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
787
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
788
+ var __spreadValues$6 = (a, b) => {
738
789
  for (var prop in b || (b = {}))
739
- if (__hasOwnProp$5.call(b, prop))
740
- __defNormalProp$5(a, prop, b[prop]);
741
- if (__getOwnPropSymbols$5)
742
- for (var prop of __getOwnPropSymbols$5(b)) {
743
- if (__propIsEnum$5.call(b, prop))
744
- __defNormalProp$5(a, prop, b[prop]);
790
+ if (__hasOwnProp$6.call(b, prop))
791
+ __defNormalProp$6(a, prop, b[prop]);
792
+ if (__getOwnPropSymbols$6)
793
+ for (var prop of __getOwnPropSymbols$6(b)) {
794
+ if (__propIsEnum$6.call(b, prop))
795
+ __defNormalProp$6(a, prop, b[prop]);
745
796
  }
746
797
  return a;
747
798
  };
@@ -749,7 +800,7 @@ function BaseListBoxItem(props) {
749
800
  var _a;
750
801
  const contextProps = React.useContext(PlasmicItemContext);
751
802
  const mergedProps = mergeProps(contextProps, props);
752
- return /* @__PURE__ */ React.createElement(ListBoxItem, __spreadValues$5({ id: (_a = mergedProps.key) != null ? _a : void 0 }, mergedProps));
803
+ return /* @__PURE__ */ React.createElement(ListBoxItem, __spreadValues$6({ id: (_a = mergedProps.key) != null ? _a : void 0 }, mergedProps));
753
804
  }
754
805
  function registerListBoxItem(loader, overrides) {
755
806
  registerComponentHelper(
@@ -785,33 +836,33 @@ function registerListBoxItem(loader, overrides) {
785
836
  );
786
837
  }
787
838
 
788
- var __defProp$4 = Object.defineProperty;
789
- var __defProps$1 = Object.defineProperties;
790
- var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
791
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
792
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
793
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
794
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
795
- var __spreadValues$4 = (a, b) => {
839
+ var __defProp$5 = Object.defineProperty;
840
+ var __defProps$2 = Object.defineProperties;
841
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
842
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
843
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
844
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
845
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
846
+ var __spreadValues$5 = (a, b) => {
796
847
  for (var prop in b || (b = {}))
797
- if (__hasOwnProp$4.call(b, prop))
798
- __defNormalProp$4(a, prop, b[prop]);
799
- if (__getOwnPropSymbols$4)
800
- for (var prop of __getOwnPropSymbols$4(b)) {
801
- if (__propIsEnum$4.call(b, prop))
802
- __defNormalProp$4(a, prop, b[prop]);
848
+ if (__hasOwnProp$5.call(b, prop))
849
+ __defNormalProp$5(a, prop, b[prop]);
850
+ if (__getOwnPropSymbols$5)
851
+ for (var prop of __getOwnPropSymbols$5(b)) {
852
+ if (__propIsEnum$5.call(b, prop))
853
+ __defNormalProp$5(a, prop, b[prop]);
803
854
  }
804
855
  return a;
805
856
  };
806
- var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
857
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
807
858
  var __objRest$2 = (source, exclude) => {
808
859
  var target = {};
809
860
  for (var prop in source)
810
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
861
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
811
862
  target[prop] = source[prop];
812
- if (source != null && __getOwnPropSymbols$4)
813
- for (var prop of __getOwnPropSymbols$4(source)) {
814
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
863
+ if (source != null && __getOwnPropSymbols$5)
864
+ for (var prop of __getOwnPropSymbols$5(source)) {
865
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
815
866
  target[prop] = source[prop];
816
867
  }
817
868
  return target;
@@ -867,14 +918,14 @@ function BaseListBox(props) {
867
918
  "renderSection",
868
919
  "getItemType"
869
920
  ]);
870
- return /* @__PURE__ */ React.createElement(ListBox, __spreadValues$4({}, mergeProps(contextProps, rest)), (item) => {
921
+ return /* @__PURE__ */ React.createElement(ListBox, __spreadValues$5({}, mergeProps(contextProps, rest)), (item) => {
871
922
  if ((getItemType == null ? void 0 : getItemType(item)) === "section") {
872
923
  const sectionProps = makeSectionProps == null ? void 0 : makeSectionProps(item);
873
924
  return /* @__PURE__ */ React.createElement(
874
925
  PlasmicSectionContext.Provider,
875
926
  {
876
927
  key: sectionProps == null ? void 0 : sectionProps.key,
877
- value: __spreadProps$1(__spreadValues$4({}, sectionProps), { makeItemProps, renderItem })
928
+ value: __spreadProps$2(__spreadValues$5({}, sectionProps), { makeItemProps, renderItem })
878
929
  },
879
930
  renderSection == null ? void 0 : renderSection(item)
880
931
  );
@@ -927,33 +978,33 @@ function registerListBox(loader, overrides) {
927
978
  });
928
979
  }
929
980
 
930
- var __defProp$3 = Object.defineProperty;
931
- var __defProps = Object.defineProperties;
932
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
933
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
934
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
935
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
936
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
937
- var __spreadValues$3 = (a, b) => {
981
+ var __defProp$4 = Object.defineProperty;
982
+ var __defProps$1 = Object.defineProperties;
983
+ var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
984
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
985
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
986
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
987
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
988
+ var __spreadValues$4 = (a, b) => {
938
989
  for (var prop in b || (b = {}))
939
- if (__hasOwnProp$3.call(b, prop))
940
- __defNormalProp$3(a, prop, b[prop]);
941
- if (__getOwnPropSymbols$3)
942
- for (var prop of __getOwnPropSymbols$3(b)) {
943
- if (__propIsEnum$3.call(b, prop))
944
- __defNormalProp$3(a, prop, b[prop]);
990
+ if (__hasOwnProp$4.call(b, prop))
991
+ __defNormalProp$4(a, prop, b[prop]);
992
+ if (__getOwnPropSymbols$4)
993
+ for (var prop of __getOwnPropSymbols$4(b)) {
994
+ if (__propIsEnum$4.call(b, prop))
995
+ __defNormalProp$4(a, prop, b[prop]);
945
996
  }
946
997
  return a;
947
998
  };
948
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
999
+ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
949
1000
  var __objRest$1 = (source, exclude) => {
950
1001
  var target = {};
951
1002
  for (var prop in source)
952
- if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
1003
+ if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
953
1004
  target[prop] = source[prop];
954
- if (source != null && __getOwnPropSymbols$3)
955
- for (var prop of __getOwnPropSymbols$3(source)) {
956
- if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
1005
+ if (source != null && __getOwnPropSymbols$4)
1006
+ for (var prop of __getOwnPropSymbols$4(source)) {
1007
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
957
1008
  target[prop] = source[prop];
958
1009
  }
959
1010
  return target;
@@ -970,14 +1021,14 @@ function BasePopover(props) {
970
1021
  const triggerRef = React.useRef(null);
971
1022
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React.createElement(
972
1023
  Popover,
973
- __spreadProps(__spreadValues$3({}, mergedProps), {
1024
+ __spreadProps$1(__spreadValues$4({}, mergedProps), {
974
1025
  triggerRef,
975
1026
  isNonModal: true,
976
1027
  isOpen: true
977
1028
  })
978
1029
  ));
979
1030
  } else {
980
- return /* @__PURE__ */ React.createElement(Popover, __spreadProps(__spreadValues$3({}, mergedProps), { isNonModal: !!canvas }));
1031
+ return /* @__PURE__ */ React.createElement(Popover, __spreadProps$1(__spreadValues$4({}, mergedProps), { isNonModal: !!canvas }));
981
1032
  }
982
1033
  }
983
1034
  function registerPopover(loader, overrides) {
@@ -1035,25 +1086,25 @@ function registerPopover(loader, overrides) {
1035
1086
  );
1036
1087
  }
1037
1088
 
1038
- var __defProp$2 = Object.defineProperty;
1039
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
1040
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
1041
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
1042
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1043
- var __spreadValues$2 = (a, b) => {
1089
+ var __defProp$3 = Object.defineProperty;
1090
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
1091
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
1092
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
1093
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1094
+ var __spreadValues$3 = (a, b) => {
1044
1095
  for (var prop in b || (b = {}))
1045
- if (__hasOwnProp$2.call(b, prop))
1046
- __defNormalProp$2(a, prop, b[prop]);
1047
- if (__getOwnPropSymbols$2)
1048
- for (var prop of __getOwnPropSymbols$2(b)) {
1049
- if (__propIsEnum$2.call(b, prop))
1050
- __defNormalProp$2(a, prop, b[prop]);
1096
+ if (__hasOwnProp$3.call(b, prop))
1097
+ __defNormalProp$3(a, prop, b[prop]);
1098
+ if (__getOwnPropSymbols$3)
1099
+ for (var prop of __getOwnPropSymbols$3(b)) {
1100
+ if (__propIsEnum$3.call(b, prop))
1101
+ __defNormalProp$3(a, prop, b[prop]);
1051
1102
  }
1052
1103
  return a;
1053
1104
  };
1054
1105
  function BaseHeader(props) {
1055
1106
  const contextProps = React.useContext(PlasmicHeaderContext);
1056
- return /* @__PURE__ */ React.createElement(Header, __spreadValues$2({}, mergeProps(contextProps, props)));
1107
+ return /* @__PURE__ */ React.createElement(Header, __spreadValues$3({}, mergeProps(contextProps, props)));
1057
1108
  }
1058
1109
  function registerHeader(loader, overrides) {
1059
1110
  registerComponentHelper(
@@ -1070,30 +1121,30 @@ function registerHeader(loader, overrides) {
1070
1121
  );
1071
1122
  }
1072
1123
 
1073
- var __defProp$1 = Object.defineProperty;
1074
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
1075
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
1076
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
1077
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1078
- var __spreadValues$1 = (a, b) => {
1124
+ var __defProp$2 = Object.defineProperty;
1125
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
1126
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
1127
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
1128
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1129
+ var __spreadValues$2 = (a, b) => {
1079
1130
  for (var prop in b || (b = {}))
1080
- if (__hasOwnProp$1.call(b, prop))
1081
- __defNormalProp$1(a, prop, b[prop]);
1082
- if (__getOwnPropSymbols$1)
1083
- for (var prop of __getOwnPropSymbols$1(b)) {
1084
- if (__propIsEnum$1.call(b, prop))
1085
- __defNormalProp$1(a, prop, b[prop]);
1131
+ if (__hasOwnProp$2.call(b, prop))
1132
+ __defNormalProp$2(a, prop, b[prop]);
1133
+ if (__getOwnPropSymbols$2)
1134
+ for (var prop of __getOwnPropSymbols$2(b)) {
1135
+ if (__propIsEnum$2.call(b, prop))
1136
+ __defNormalProp$2(a, prop, b[prop]);
1086
1137
  }
1087
1138
  return a;
1088
1139
  };
1089
1140
  var __objRest = (source, exclude) => {
1090
1141
  var target = {};
1091
1142
  for (var prop in source)
1092
- if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
1143
+ if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
1093
1144
  target[prop] = source[prop];
1094
- if (source != null && __getOwnPropSymbols$1)
1095
- for (var prop of __getOwnPropSymbols$1(source)) {
1096
- if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
1145
+ if (source != null && __getOwnPropSymbols$2)
1146
+ for (var prop of __getOwnPropSymbols$2(source)) {
1147
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
1097
1148
  target[prop] = source[prop];
1098
1149
  }
1099
1150
  return target;
@@ -1102,7 +1153,7 @@ function BaseSection(props) {
1102
1153
  const contextProps = React.useContext(PlasmicSectionContext);
1103
1154
  const mergedProps = mergeProps(contextProps, props);
1104
1155
  const _a = mergedProps, { section, renderHeader, key, makeItemProps, renderItem } = _a, rest = __objRest(_a, ["section", "renderHeader", "key", "makeItemProps", "renderItem"]);
1105
- return /* @__PURE__ */ React.createElement(Section, __spreadValues$1({ id: key != null ? key : void 0 }, rest), /* @__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) => {
1156
+ return /* @__PURE__ */ React.createElement(Section, __spreadValues$2({ id: key != null ? key : void 0 }, rest), /* @__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) => {
1106
1157
  const itemProps = makeItemProps == null ? void 0 : makeItemProps(item);
1107
1158
  return /* @__PURE__ */ React.createElement(PlasmicItemContext.Provider, { key: itemProps == null ? void 0 : itemProps.key, value: itemProps }, renderItem == null ? void 0 : renderItem(item));
1108
1159
  }));
@@ -1135,19 +1186,19 @@ function registerSection(loader, overrides) {
1135
1186
  });
1136
1187
  }
1137
1188
 
1138
- var __defProp = Object.defineProperty;
1139
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
1140
- var __hasOwnProp = Object.prototype.hasOwnProperty;
1141
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
1142
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1143
- var __spreadValues = (a, b) => {
1189
+ var __defProp$1 = Object.defineProperty;
1190
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
1191
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
1192
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
1193
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1194
+ var __spreadValues$1 = (a, b) => {
1144
1195
  for (var prop in b || (b = {}))
1145
- if (__hasOwnProp.call(b, prop))
1146
- __defNormalProp(a, prop, b[prop]);
1147
- if (__getOwnPropSymbols)
1148
- for (var prop of __getOwnPropSymbols(b)) {
1149
- if (__propIsEnum.call(b, prop))
1150
- __defNormalProp(a, prop, b[prop]);
1196
+ if (__hasOwnProp$1.call(b, prop))
1197
+ __defNormalProp$1(a, prop, b[prop]);
1198
+ if (__getOwnPropSymbols$1)
1199
+ for (var prop of __getOwnPropSymbols$1(b)) {
1200
+ if (__propIsEnum$1.call(b, prop))
1201
+ __defNormalProp$1(a, prop, b[prop]);
1151
1202
  }
1152
1203
  return a;
1153
1204
  };
@@ -1172,7 +1223,7 @@ function BaseSelect(props) {
1172
1223
  const disabledKeys = flattenOptions(options).filter((op) => op.isDisabled).map((op) => op.value);
1173
1224
  return /* @__PURE__ */ React.createElement(
1174
1225
  Select,
1175
- __spreadValues(__spreadValues({
1226
+ __spreadValues$1(__spreadValues$1({
1176
1227
  placeholder,
1177
1228
  selectedKey: value,
1178
1229
  onSelectionChange: onChange,
@@ -1323,6 +1374,78 @@ function registerSelect(loader) {
1323
1374
  });
1324
1375
  }
1325
1376
 
1377
+ var __defProp = Object.defineProperty;
1378
+ var __defProps = Object.defineProperties;
1379
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
1380
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
1381
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
1382
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
1383
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1384
+ var __spreadValues = (a, b) => {
1385
+ for (var prop in b || (b = {}))
1386
+ if (__hasOwnProp.call(b, prop))
1387
+ __defNormalProp(a, prop, b[prop]);
1388
+ if (__getOwnPropSymbols)
1389
+ for (var prop of __getOwnPropSymbols(b)) {
1390
+ if (__propIsEnum.call(b, prop))
1391
+ __defNormalProp(a, prop, b[prop]);
1392
+ }
1393
+ return a;
1394
+ };
1395
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1396
+ const BaseSwitch = Switch;
1397
+ function registerSwitch(loader, overrides) {
1398
+ registerComponentHelper(
1399
+ loader,
1400
+ BaseSwitch,
1401
+ {
1402
+ name: makeComponentName("switch"),
1403
+ displayName: "BaseSwitch",
1404
+ importPath: "@plasmicpkgs/react-aria/registerSwitch",
1405
+ importName: "BaseSwitch",
1406
+ props: __spreadProps(__spreadValues({}, getCommonInputProps("switch", [
1407
+ "name",
1408
+ "isDisabled",
1409
+ "isReadOnly",
1410
+ "autoFocus",
1411
+ "aria-label",
1412
+ "children"
1413
+ ])), {
1414
+ value: {
1415
+ type: "boolean",
1416
+ editOnly: true,
1417
+ uncontrolledProp: "defaultSelected",
1418
+ description: "Whether the switch is toggled on",
1419
+ defaultValueHint: false
1420
+ },
1421
+ onChange: {
1422
+ type: "eventHandler",
1423
+ argTypes: [{ name: "isSelected", type: "boolean" }]
1424
+ },
1425
+ onHoverChange: {
1426
+ type: "eventHandler",
1427
+ argTypes: [{ name: "isHovered", type: "boolean" }]
1428
+ }
1429
+ }),
1430
+ states: {
1431
+ isSelected: {
1432
+ type: "writable",
1433
+ valueProp: "value",
1434
+ onChangeProp: "onChange",
1435
+ variableType: "boolean"
1436
+ },
1437
+ isHovered: {
1438
+ type: "readonly",
1439
+ onChangeProp: "onHoverChange",
1440
+ variableType: "boolean"
1441
+ }
1442
+ },
1443
+ trapsFocus: true
1444
+ },
1445
+ overrides
1446
+ );
1447
+ }
1448
+
1326
1449
  function registerAll(loader) {
1327
1450
  registerSelect(loader);
1328
1451
  registerComboBox(loader);
@@ -1332,6 +1455,7 @@ function registerAll(loader) {
1332
1455
  registerPopover(loader);
1333
1456
  registerInput(loader);
1334
1457
  registerSection(loader);
1458
+ registerSwitch(loader);
1335
1459
  }
1336
1460
 
1337
1461
  export { registerAll };