@plasmicpkgs/react-aria 0.0.11 → 0.0.12

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 (44) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/contexts.d.ts +1 -1
  3. package/dist/react-aria.esm.js +136 -59
  4. package/dist/react-aria.esm.js.map +1 -1
  5. package/dist/react-aria.js +135 -58
  6. package/dist/react-aria.js.map +1 -1
  7. package/dist/registerForm.d.ts +9 -0
  8. package/dist/registerLabel.d.ts +2 -2
  9. package/package.json +4 -4
  10. package/skinny/{contexts-c0294d96.cjs.js → contexts-3e42cdf9.cjs.js} +2 -3
  11. package/skinny/{contexts-c0294d96.cjs.js.map → contexts-3e42cdf9.cjs.js.map} +1 -1
  12. package/skinny/{contexts-fd3e1077.esm.js → contexts-49f6c298.esm.js} +3 -3
  13. package/skinny/{contexts-fd3e1077.esm.js.map → contexts-49f6c298.esm.js.map} +1 -1
  14. package/skinny/contexts.d.ts +1 -1
  15. package/skinny/registerComboBox.cjs.js +1 -1
  16. package/skinny/registerComboBox.esm.js +1 -1
  17. package/skinny/registerFieldError.cjs.js +163 -0
  18. package/skinny/registerFieldError.cjs.js.map +1 -0
  19. package/skinny/registerFieldError.esm.js +156 -0
  20. package/skinny/registerFieldError.esm.js.map +1 -0
  21. package/skinny/registerForm.cjs.js +96 -0
  22. package/skinny/registerForm.cjs.js.map +1 -0
  23. package/skinny/registerForm.d.ts +9 -0
  24. package/skinny/registerForm.esm.js +89 -0
  25. package/skinny/registerForm.esm.js.map +1 -0
  26. package/skinny/registerHeader.cjs.js +1 -1
  27. package/skinny/registerHeader.esm.js +1 -1
  28. package/skinny/registerInput.cjs.js +1 -1
  29. package/skinny/registerInput.esm.js +1 -1
  30. package/skinny/registerLabel.cjs.js +5 -13
  31. package/skinny/registerLabel.cjs.js.map +1 -1
  32. package/skinny/registerLabel.d.ts +2 -2
  33. package/skinny/registerLabel.esm.js +4 -12
  34. package/skinny/registerLabel.esm.js.map +1 -1
  35. package/skinny/registerListBox.cjs.js +1 -1
  36. package/skinny/registerListBox.esm.js +1 -1
  37. package/skinny/registerListBoxItem.cjs.js +1 -1
  38. package/skinny/registerListBoxItem.esm.js +1 -1
  39. package/skinny/registerPopover.cjs.js +1 -1
  40. package/skinny/registerPopover.esm.js +1 -1
  41. package/skinny/registerSection.cjs.js +1 -1
  42. package/skinny/registerSection.esm.js +1 -1
  43. package/skinny/registerSelect.cjs.js +1 -1
  44. package/skinny/registerSelect.esm.js +1 -1
@@ -0,0 +1,163 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var reactAriaComponents = require('react-aria-components');
5
+ var utils = require('./utils-1190a0a9.cjs.js');
6
+ require('@plasmicapp/host/registerComponent');
7
+
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ var React__default = /*#__PURE__*/_interopDefault(React);
11
+
12
+ var __defProp = Object.defineProperty;
13
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
14
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
15
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
16
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17
+ var __spreadValues = (a, b) => {
18
+ for (var prop in b || (b = {}))
19
+ if (__hasOwnProp.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ if (__getOwnPropSymbols)
22
+ for (var prop of __getOwnPropSymbols(b)) {
23
+ if (__propIsEnum.call(b, prop))
24
+ __defNormalProp(a, prop, b[prop]);
25
+ }
26
+ return a;
27
+ };
28
+ var __objRest = (source, exclude) => {
29
+ var target = {};
30
+ for (var prop in source)
31
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
32
+ target[prop] = source[prop];
33
+ if (source != null && __getOwnPropSymbols)
34
+ for (var prop of __getOwnPropSymbols(source)) {
35
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
36
+ target[prop] = source[prop];
37
+ }
38
+ return target;
39
+ };
40
+ function BaseFieldError(_a) {
41
+ var _b = _a, {
42
+ badInput,
43
+ customError,
44
+ patternMismatch,
45
+ rangeOverflow,
46
+ rangeUnderflow,
47
+ stepMismatch,
48
+ tooLong,
49
+ tooShort,
50
+ typeMismatch,
51
+ valueMissing
52
+ } = _b, rest = __objRest(_b, [
53
+ "badInput",
54
+ "customError",
55
+ "patternMismatch",
56
+ "rangeOverflow",
57
+ "rangeUnderflow",
58
+ "stepMismatch",
59
+ "tooLong",
60
+ "tooShort",
61
+ "typeMismatch",
62
+ "valueMissing"
63
+ ]);
64
+ return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.FieldError, __spreadValues({}, rest), ({ validationDetails, validationErrors }) => {
65
+ if (validationDetails.badInput && badInput)
66
+ return badInput;
67
+ if (validationDetails.customError && customError)
68
+ return customError;
69
+ if (validationDetails.patternMismatch && patternMismatch)
70
+ return patternMismatch;
71
+ if (validationDetails.rangeOverflow && rangeOverflow)
72
+ return rangeOverflow;
73
+ if (validationDetails.rangeUnderflow && rangeUnderflow)
74
+ return rangeUnderflow;
75
+ if (validationDetails.stepMismatch && stepMismatch)
76
+ return stepMismatch;
77
+ if (validationDetails.tooLong && tooLong)
78
+ return tooLong;
79
+ if (validationDetails.tooShort && tooShort)
80
+ return tooShort;
81
+ if (validationDetails.typeMismatch && typeMismatch)
82
+ return typeMismatch;
83
+ if (validationDetails.valueMissing && valueMissing)
84
+ return valueMissing;
85
+ return validationErrors;
86
+ });
87
+ }
88
+ function PropsDescription() {
89
+ return /* @__PURE__ */ React__default.default.createElement("div", { style: { marginBottom: 20 } }, /* @__PURE__ */ React__default.default.createElement("p", null, "You can customize the error messages for built-in validations by utilizing the props below."), /* @__PURE__ */ React__default.default.createElement("p", null, "For further information on the specific conditions triggering each error, please refer to the", " ", /* @__PURE__ */ React__default.default.createElement(
90
+ "a",
91
+ {
92
+ target: "_blank",
93
+ href: "https://developer.mozilla.org/en-US/docs/Web/API/ValidityState#instance_properties"
94
+ },
95
+ "MDN Docs"
96
+ ), "."));
97
+ }
98
+ function registerFieldError(loader, overrides) {
99
+ utils.registerComponentHelper(
100
+ loader,
101
+ BaseFieldError,
102
+ {
103
+ name: utils.makeComponentName("fielderror"),
104
+ displayName: "BaseFieldError",
105
+ importPath: "@plasmicpkgs/react-aria/registerFieldError",
106
+ importName: "BaseFieldError",
107
+ actions: [
108
+ {
109
+ type: "custom-action",
110
+ control: PropsDescription
111
+ }
112
+ ],
113
+ props: {
114
+ badInput: {
115
+ type: "string",
116
+ description: "Error message if the user has provided input that the browser is unable to convert"
117
+ },
118
+ customError: {
119
+ type: "string",
120
+ description: "Error message for custom validations"
121
+ },
122
+ patternMismatch: {
123
+ type: "string",
124
+ description: "Error message if the value does not match the specified pattern"
125
+ },
126
+ rangeOverflow: {
127
+ type: "string",
128
+ description: "Error message if the value is greater than the maximum specified"
129
+ },
130
+ rangeUnderflow: {
131
+ type: "string",
132
+ description: "Error message if the value is less than the minimum specified"
133
+ },
134
+ stepMismatch: {
135
+ type: "string",
136
+ description: "Error message if the value is not evenly divisible by the step value"
137
+ },
138
+ tooLong: {
139
+ type: "string",
140
+ description: "Error message if the value exceeds the specified maximum number of characters"
141
+ },
142
+ tooShort: {
143
+ type: "string",
144
+ description: "Error message if the value fails to meet the specified minimum number of characters"
145
+ },
146
+ typeMismatch: {
147
+ type: "string",
148
+ description: "Error message if the value is not in the required syntax (when type is email or url)"
149
+ },
150
+ valueMissing: {
151
+ type: "string",
152
+ description: "Error message if a required field has no value"
153
+ }
154
+ },
155
+ trapsFocus: true
156
+ },
157
+ overrides
158
+ );
159
+ }
160
+
161
+ exports.BaseFieldError = BaseFieldError;
162
+ exports.registerFieldError = registerFieldError;
163
+ //# sourceMappingURL=registerFieldError.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerFieldError.cjs.js","sources":["../src/registerFieldError.tsx"],"sourcesContent":["import React from \"react\";\nimport type { FieldErrorProps } from \"react-aria-components\";\nimport { FieldError } from \"react-aria-components\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\ninterface BaseFieldErrorProps extends FieldErrorProps {\n useBuiltInValidation: boolean;\n badInput?: string;\n customError?: string;\n patternMismatch?: string;\n rangeOverflow?: string;\n rangeUnderflow?: string;\n stepMismatch?: string;\n tooLong?: string;\n tooShort?: string;\n typeMismatch?: string;\n valueMissing?: string;\n}\n\nexport function BaseFieldError({\n badInput,\n customError,\n patternMismatch,\n rangeOverflow,\n rangeUnderflow,\n stepMismatch,\n tooLong,\n tooShort,\n typeMismatch,\n valueMissing,\n ...rest\n}: BaseFieldErrorProps) {\n return (\n <FieldError {...rest}>\n {({ validationDetails, validationErrors }) => {\n if (validationDetails.badInput && badInput) return badInput;\n if (validationDetails.customError && customError) return customError;\n if (validationDetails.patternMismatch && patternMismatch)\n return patternMismatch;\n if (validationDetails.rangeOverflow && rangeOverflow)\n return rangeOverflow;\n if (validationDetails.rangeUnderflow && rangeUnderflow)\n return rangeUnderflow;\n if (validationDetails.stepMismatch && stepMismatch) return stepMismatch;\n if (validationDetails.tooLong && tooLong) return tooLong;\n if (validationDetails.tooShort && tooShort) return tooShort;\n if (validationDetails.typeMismatch && typeMismatch) return typeMismatch;\n if (validationDetails.valueMissing && valueMissing) return valueMissing;\n return validationErrors;\n }}\n </FieldError>\n );\n}\n\nfunction PropsDescription() {\n return (\n <div style={{ marginBottom: 20 }}>\n <p>\n You can customize the error messages for built-in validations by\n utilizing the props below.\n </p>\n <p>\n For further information on the specific conditions triggering each\n error, please refer to the{\" \"}\n <a\n target=\"_blank\"\n href=\"https://developer.mozilla.org/en-US/docs/Web/API/ValidityState#instance_properties\"\n >\n MDN Docs\n </a>\n .\n </p>\n </div>\n );\n}\n\nexport function registerFieldError(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseFieldError>\n) {\n registerComponentHelper(\n loader,\n BaseFieldError,\n {\n name: makeComponentName(\"fielderror\"),\n displayName: \"BaseFieldError\",\n importPath: \"@plasmicpkgs/react-aria/registerFieldError\",\n importName: \"BaseFieldError\",\n actions: [\n {\n type: \"custom-action\",\n control: PropsDescription,\n },\n ],\n props: {\n badInput: {\n type: \"string\",\n description:\n \"Error message if the user has provided input that the browser is unable to convert\",\n },\n customError: {\n type: \"string\",\n description: \"Error message for custom validations\",\n },\n patternMismatch: {\n type: \"string\",\n description:\n \"Error message if the value does not match the specified pattern\",\n },\n rangeOverflow: {\n type: \"string\",\n description:\n \"Error message if the value is greater than the maximum specified\",\n },\n rangeUnderflow: {\n type: \"string\",\n description:\n \"Error message if the value is less than the minimum specified\",\n },\n stepMismatch: {\n type: \"string\",\n description:\n \"Error message if the value is not evenly divisible by the step value\",\n },\n tooLong: {\n type: \"string\",\n description:\n \"Error message if the value exceeds the specified maximum number of characters\",\n },\n tooShort: {\n type: \"string\",\n description:\n \"Error message if the value fails to meet the specified minimum number of characters\",\n },\n typeMismatch: {\n type: \"string\",\n description:\n \"Error message if the value is not in the required syntax (when type is email or url)\",\n },\n valueMissing: {\n type: \"string\",\n description: \"Error message if a required field has no value\",\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["FieldError","React","registerComponentHelper","makeComponentName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,SAAS,eAAe,EAYP,EAAA;AAZO,EAC7B,IAAA,EAAA,GAAA,EAAA,EAAA;AAAA,IAAA,QAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,aAAA;AAAA,IACA,cAAA;AAAA,IACA,YAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,YAAA;AAAA,GAlCF,GAwB+B,EAW1B,EAAA,IAAA,GAAA,SAAA,CAX0B,EAW1B,EAAA;AAAA,IAVH,UAAA;AAAA,I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IAAM,EAAA,QAAA;AAAA,UACN,WACE,EAAA,sEAAA;AAAA,SACJ;AAAA,QACA,OAAS,EAAA;AAAA,UACP,IAAM,EAAA,QAAA;AAAA,UACN,WACE,EAAA,+EAAA;AAAA,SACJ;AAAA,QACA,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,QAAA;AAAA,UACN,WACE,EAAA,sFAAA;AAAA,SACJ;AAAA,QACA,YAAc,EAAA;AAAA,UACZ,IAAM,EAAA,QAAA;AAAA,UACN,WACE,EAAA,sFAAA;AAAA,SACJ;AAAA,QACA,YAAc,EAAA;AAAA,UACZ,IAAM,EAAA,QAAA;AAAA,UACN,WAAa,EAAA,gDAAA;AAAA,SACf;AAAA,OACF;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;"}
@@ -0,0 +1,156 @@
1
+ import React from 'react';
2
+ import { FieldError } from 'react-aria-components';
3
+ import { r as registerComponentHelper, m as makeComponentName } from './utils-28f98072.esm.js';
4
+ import '@plasmicapp/host/registerComponent';
5
+
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __objRest = (source, exclude) => {
23
+ var target = {};
24
+ for (var prop in source)
25
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
26
+ target[prop] = source[prop];
27
+ if (source != null && __getOwnPropSymbols)
28
+ for (var prop of __getOwnPropSymbols(source)) {
29
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
30
+ target[prop] = source[prop];
31
+ }
32
+ return target;
33
+ };
34
+ function BaseFieldError(_a) {
35
+ var _b = _a, {
36
+ badInput,
37
+ customError,
38
+ patternMismatch,
39
+ rangeOverflow,
40
+ rangeUnderflow,
41
+ stepMismatch,
42
+ tooLong,
43
+ tooShort,
44
+ typeMismatch,
45
+ valueMissing
46
+ } = _b, rest = __objRest(_b, [
47
+ "badInput",
48
+ "customError",
49
+ "patternMismatch",
50
+ "rangeOverflow",
51
+ "rangeUnderflow",
52
+ "stepMismatch",
53
+ "tooLong",
54
+ "tooShort",
55
+ "typeMismatch",
56
+ "valueMissing"
57
+ ]);
58
+ return /* @__PURE__ */ React.createElement(FieldError, __spreadValues({}, rest), ({ validationDetails, validationErrors }) => {
59
+ if (validationDetails.badInput && badInput)
60
+ return badInput;
61
+ if (validationDetails.customError && customError)
62
+ return customError;
63
+ if (validationDetails.patternMismatch && patternMismatch)
64
+ return patternMismatch;
65
+ if (validationDetails.rangeOverflow && rangeOverflow)
66
+ return rangeOverflow;
67
+ if (validationDetails.rangeUnderflow && rangeUnderflow)
68
+ return rangeUnderflow;
69
+ if (validationDetails.stepMismatch && stepMismatch)
70
+ return stepMismatch;
71
+ if (validationDetails.tooLong && tooLong)
72
+ return tooLong;
73
+ if (validationDetails.tooShort && tooShort)
74
+ return tooShort;
75
+ if (validationDetails.typeMismatch && typeMismatch)
76
+ return typeMismatch;
77
+ if (validationDetails.valueMissing && valueMissing)
78
+ return valueMissing;
79
+ return validationErrors;
80
+ });
81
+ }
82
+ function PropsDescription() {
83
+ return /* @__PURE__ */ React.createElement("div", { style: { marginBottom: 20 } }, /* @__PURE__ */ React.createElement("p", null, "You can customize the error messages for built-in validations by utilizing the props below."), /* @__PURE__ */ React.createElement("p", null, "For further information on the specific conditions triggering each error, please refer to the", " ", /* @__PURE__ */ React.createElement(
84
+ "a",
85
+ {
86
+ target: "_blank",
87
+ href: "https://developer.mozilla.org/en-US/docs/Web/API/ValidityState#instance_properties"
88
+ },
89
+ "MDN Docs"
90
+ ), "."));
91
+ }
92
+ function registerFieldError(loader, overrides) {
93
+ registerComponentHelper(
94
+ loader,
95
+ BaseFieldError,
96
+ {
97
+ name: makeComponentName("fielderror"),
98
+ displayName: "BaseFieldError",
99
+ importPath: "@plasmicpkgs/react-aria/registerFieldError",
100
+ importName: "BaseFieldError",
101
+ actions: [
102
+ {
103
+ type: "custom-action",
104
+ control: PropsDescription
105
+ }
106
+ ],
107
+ props: {
108
+ badInput: {
109
+ type: "string",
110
+ description: "Error message if the user has provided input that the browser is unable to convert"
111
+ },
112
+ customError: {
113
+ type: "string",
114
+ description: "Error message for custom validations"
115
+ },
116
+ patternMismatch: {
117
+ type: "string",
118
+ description: "Error message if the value does not match the specified pattern"
119
+ },
120
+ rangeOverflow: {
121
+ type: "string",
122
+ description: "Error message if the value is greater than the maximum specified"
123
+ },
124
+ rangeUnderflow: {
125
+ type: "string",
126
+ description: "Error message if the value is less than the minimum specified"
127
+ },
128
+ stepMismatch: {
129
+ type: "string",
130
+ description: "Error message if the value is not evenly divisible by the step value"
131
+ },
132
+ tooLong: {
133
+ type: "string",
134
+ description: "Error message if the value exceeds the specified maximum number of characters"
135
+ },
136
+ tooShort: {
137
+ type: "string",
138
+ description: "Error message if the value fails to meet the specified minimum number of characters"
139
+ },
140
+ typeMismatch: {
141
+ type: "string",
142
+ description: "Error message if the value is not in the required syntax (when type is email or url)"
143
+ },
144
+ valueMissing: {
145
+ type: "string",
146
+ description: "Error message if a required field has no value"
147
+ }
148
+ },
149
+ trapsFocus: true
150
+ },
151
+ overrides
152
+ );
153
+ }
154
+
155
+ export { BaseFieldError, registerFieldError };
156
+ //# sourceMappingURL=registerFieldError.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerFieldError.esm.js","sources":["../src/registerFieldError.tsx"],"sourcesContent":["import React from \"react\";\nimport type { FieldErrorProps } from \"react-aria-components\";\nimport { FieldError } from \"react-aria-components\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\ninterface BaseFieldErrorProps extends FieldErrorProps {\n useBuiltInValidation: boolean;\n badInput?: string;\n customError?: string;\n patternMismatch?: string;\n rangeOverflow?: string;\n rangeUnderflow?: string;\n stepMismatch?: string;\n tooLong?: string;\n tooShort?: string;\n typeMismatch?: string;\n valueMissing?: string;\n}\n\nexport function BaseFieldError({\n badInput,\n customError,\n patternMismatch,\n rangeOverflow,\n rangeUnderflow,\n stepMismatch,\n tooLong,\n tooShort,\n typeMismatch,\n valueMissing,\n ...rest\n}: BaseFieldErrorProps) {\n return (\n <FieldError {...rest}>\n {({ validationDetails, validationErrors }) => {\n if (validationDetails.badInput && badInput) return badInput;\n if (validationDetails.customError && customError) return customError;\n if (validationDetails.patternMismatch && patternMismatch)\n return patternMismatch;\n if (validationDetails.rangeOverflow && rangeOverflow)\n return rangeOverflow;\n if (validationDetails.rangeUnderflow && rangeUnderflow)\n return rangeUnderflow;\n if (validationDetails.stepMismatch && stepMismatch) return stepMismatch;\n if (validationDetails.tooLong && tooLong) return tooLong;\n if (validationDetails.tooShort && tooShort) return tooShort;\n if (validationDetails.typeMismatch && typeMismatch) return typeMismatch;\n if (validationDetails.valueMissing && valueMissing) return valueMissing;\n return validationErrors;\n }}\n </FieldError>\n );\n}\n\nfunction PropsDescription() {\n return (\n <div style={{ marginBottom: 20 }}>\n <p>\n You can customize the error messages for built-in validations by\n utilizing the props below.\n </p>\n <p>\n For further information on the specific conditions triggering each\n error, please refer to the{\" \"}\n <a\n target=\"_blank\"\n href=\"https://developer.mozilla.org/en-US/docs/Web/API/ValidityState#instance_properties\"\n >\n MDN Docs\n </a>\n .\n </p>\n </div>\n );\n}\n\nexport function registerFieldError(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseFieldError>\n) {\n registerComponentHelper(\n loader,\n BaseFieldError,\n {\n name: makeComponentName(\"fielderror\"),\n displayName: \"BaseFieldError\",\n importPath: \"@plasmicpkgs/react-aria/registerFieldError\",\n importName: \"BaseFieldError\",\n actions: [\n {\n type: \"custom-action\",\n control: PropsDescription,\n },\n ],\n props: {\n badInput: {\n type: \"string\",\n description:\n \"Error message if the user has provided input that the browser is unable to convert\",\n },\n customError: {\n type: \"string\",\n description: \"Error message for custom validations\",\n },\n patternMismatch: {\n type: \"string\",\n description:\n \"Error message if the value does not match the specified pattern\",\n },\n rangeOverflow: {\n type: \"string\",\n description:\n \"Error message if the value is greater than the maximum specified\",\n },\n rangeUnderflow: {\n type: \"string\",\n description:\n \"Error message if the value is less than the minimum specified\",\n },\n stepMismatch: {\n type: \"string\",\n description:\n \"Error message if the value is not evenly divisible by the step value\",\n },\n tooLong: {\n type: \"string\",\n description:\n \"Error message if the value exceeds the specified maximum number of characters\",\n },\n tooShort: {\n type: \"string\",\n description:\n \"Error message if the value fails to meet the specified minimum number of characters\",\n },\n typeMismatch: {\n type: \"string\",\n description:\n \"Error message if the value is not in the required syntax (when type is email or url)\",\n },\n valueMissing: {\n type: \"string\",\n description: \"Error message if a required field has no value\",\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,SAAS,eAAe,EAYP,EAAA;AAZO,EAC7B,IAAA,EAAA,GAAA,EAAA,EAAA;AAAA,IAAA,QAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,aAAA;AAAA,IACA,cAAA;AAAA,IACA,YAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,YAAA;AAAA,GAlCF,GAwB+B,EAW1B,EAAA,IAAA,GAAA,SAAA,CAX0B,EAW1B,EAAA;AAAA,IAVH,UAAA;AAAA,IACA,aAAA;AAA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,WACE,EAAA,sEAAA;AAAA,SACJ;AAAA,QACA,OAAS,EAAA;AAAA,UACP,IAAM,EAAA,QAAA;AAAA,UACN,WACE,EAAA,+EAAA;AAAA,SACJ;AAAA,QACA,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,QAAA;AAAA,UACN,WACE,EAAA,sFAAA;AAAA,SACJ;AAAA,QACA,YAAc,EAAA;AAAA,UACZ,IAAM,EAAA,QAAA;AAAA,UACN,WACE,EAAA,sFAAA;AAAA,SACJ;AAAA,QACA,YAAc,EAAA;AAAA,UACZ,IAAM,EAAA,QAAA;AAAA,UACN,WAAa,EAAA,gDAAA;AAAA,SACf;AAAA,OACF;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
@@ -0,0 +1,96 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var reactAriaComponents = require('react-aria-components');
5
+ var utils = require('./utils-1190a0a9.cjs.js');
6
+ require('@plasmicapp/host/registerComponent');
7
+
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ var React__default = /*#__PURE__*/_interopDefault(React);
11
+
12
+ var __defProp = Object.defineProperty;
13
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
14
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
15
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
16
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17
+ var __spreadValues = (a, b) => {
18
+ for (var prop in b || (b = {}))
19
+ if (__hasOwnProp.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ if (__getOwnPropSymbols)
22
+ for (var prop of __getOwnPropSymbols(b)) {
23
+ if (__propIsEnum.call(b, prop))
24
+ __defNormalProp(a, prop, b[prop]);
25
+ }
26
+ return a;
27
+ };
28
+ var __objRest = (source, exclude) => {
29
+ var target = {};
30
+ for (var prop in source)
31
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
32
+ target[prop] = source[prop];
33
+ if (source != null && __getOwnPropSymbols)
34
+ for (var prop of __getOwnPropSymbols(source)) {
35
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
36
+ target[prop] = source[prop];
37
+ }
38
+ return target;
39
+ };
40
+ function BaseForm(props) {
41
+ const _a = props, { onSubmit, children } = _a, rest = __objRest(_a, ["onSubmit", "children"]);
42
+ return /* @__PURE__ */ React__default.default.createElement(
43
+ reactAriaComponents.Form,
44
+ __spreadValues({
45
+ onSubmit: (e) => {
46
+ e.preventDefault();
47
+ const formData = new FormData(e.currentTarget);
48
+ const formValues = {};
49
+ formData.forEach((value, key) => {
50
+ const field = e.currentTarget.elements.namedItem(key);
51
+ if (field instanceof RadioNodeList && Array.from(field.values()).every(
52
+ (f) => f.type === "checkbox"
53
+ )) {
54
+ formValues[key] = formData.getAll(key);
55
+ } else {
56
+ field.type;
57
+ formValues[key] = formData.get(key);
58
+ }
59
+ });
60
+ onSubmit == null ? void 0 : onSubmit(formValues);
61
+ }
62
+ }, rest),
63
+ children
64
+ );
65
+ }
66
+ function registerForm(loader, overrides) {
67
+ utils.registerComponentHelper(
68
+ loader,
69
+ BaseForm,
70
+ {
71
+ name: utils.makeComponentName("form"),
72
+ displayName: "BaseForm",
73
+ importPath: "@plasmicpkgs/react-aria/registerForm",
74
+ importName: "BaseForm",
75
+ props: {
76
+ children: {
77
+ type: "slot"
78
+ },
79
+ onSubmit: {
80
+ type: "eventHandler",
81
+ argTypes: [{ name: "data", type: "object" }]
82
+ },
83
+ onReset: {
84
+ type: "eventHandler",
85
+ argTypes: []
86
+ }
87
+ },
88
+ trapsFocus: true
89
+ },
90
+ overrides
91
+ );
92
+ }
93
+
94
+ exports.BaseForm = BaseForm;
95
+ exports.registerForm = registerForm;
96
+ //# sourceMappingURL=registerForm.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerForm.cjs.js","sources":["../src/registerForm.tsx"],"sourcesContent":["import React from \"react\";\nimport type { FormProps } from \"react-aria-components\";\nimport { Form } from \"react-aria-components\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\ninterface BaseFormProps extends Omit<FormProps, \"onSubmit\"> {\n onSubmit: (\n data: Record<string, FormDataEntryValue | FormDataEntryValue[] | null>\n ) => void;\n}\n\nexport function BaseForm(props: BaseFormProps) {\n const { onSubmit, children, ...rest } = props;\n return (\n <Form\n onSubmit={(e) => {\n e.preventDefault();\n const formData = new FormData(e.currentTarget);\n const formValues: {\n [key: string]: FormDataEntryValue | FormDataEntryValue[] | null;\n } = {};\n formData.forEach((value, key) => {\n const field = e.currentTarget.elements.namedItem(key);\n if (\n field instanceof RadioNodeList &&\n (Array.from(field.values()) as HTMLInputElement[]).every(\n (f) => f.type === \"checkbox\"\n )\n ) {\n formValues[key] = formData.getAll(key);\n } else {\n (field as HTMLInputElement).type;\n formValues[key] = formData.get(key);\n }\n });\n onSubmit?.(formValues);\n }}\n {...rest}\n >\n {children}\n </Form>\n );\n}\n\nexport function registerForm(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseForm>\n) {\n registerComponentHelper(\n loader,\n BaseForm,\n {\n name: makeComponentName(\"form\"),\n displayName: \"BaseForm\",\n importPath: \"@plasmicpkgs/react-aria/registerForm\",\n importName: \"BaseForm\",\n props: {\n children: {\n type: \"slot\",\n },\n onSubmit: {\n type: \"eventHandler\",\n argTypes: [{ name: \"data\", type: \"object\" }],\n } as any,\n onReset: {\n type: \"eventHandler\",\n argTypes: [],\n } as any,\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["React","Form","registerComponentHelper","makeComponentName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,SAAS,SAAS,KAAsB,EAAA;AAC7C,EAAwC,MAAA,EAAA,GAAA,KA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AAA,IACE,MAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,MACE,IAAA,EAAMC,wBAAkB,MAAM,CAAA;AAAA,MAC9B,WAAa,EAAA,UAAA;AAAA,MACb,UAAY,EAAA,sCAAA;AAAA,MACZ,UAAY,EAAA,UAAA;AAAA,MACZ,KAAO,EAAA;AAAA,QACL,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,MAAA;AAAA,SACR;AAAA,QACA,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,cAAA;AAAA,UACN,UAAU,CAAC,EAAE,MAAM,MAAQ,EAAA,IAAA,EAAM,UAAU,CAAA;AAAA,SAC7C;AAAA,QACA,OAAS,EAAA;AAAA,UACP,IAAM,EAAA,cAAA;AAAA,UACN,UAAU,EAAC;AAAA,SACb;AAAA,OACF;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;"}
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import type { FormProps } from "react-aria-components";
3
+ import { CodeComponentMetaOverrides, Registerable } from "./utils";
4
+ interface BaseFormProps extends Omit<FormProps, "onSubmit"> {
5
+ onSubmit: (data: Record<string, FormDataEntryValue | FormDataEntryValue[] | null>) => void;
6
+ }
7
+ export declare function BaseForm(props: BaseFormProps): React.JSX.Element;
8
+ export declare function registerForm(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BaseForm>): void;
9
+ export {};
@@ -0,0 +1,89 @@
1
+ import React from 'react';
2
+ import { Form } from 'react-aria-components';
3
+ import { r as registerComponentHelper, m as makeComponentName } from './utils-28f98072.esm.js';
4
+ import '@plasmicapp/host/registerComponent';
5
+
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __objRest = (source, exclude) => {
23
+ var target = {};
24
+ for (var prop in source)
25
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
26
+ target[prop] = source[prop];
27
+ if (source != null && __getOwnPropSymbols)
28
+ for (var prop of __getOwnPropSymbols(source)) {
29
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
30
+ target[prop] = source[prop];
31
+ }
32
+ return target;
33
+ };
34
+ function BaseForm(props) {
35
+ const _a = props, { onSubmit, children } = _a, rest = __objRest(_a, ["onSubmit", "children"]);
36
+ return /* @__PURE__ */ React.createElement(
37
+ Form,
38
+ __spreadValues({
39
+ onSubmit: (e) => {
40
+ e.preventDefault();
41
+ const formData = new FormData(e.currentTarget);
42
+ const formValues = {};
43
+ formData.forEach((value, key) => {
44
+ const field = e.currentTarget.elements.namedItem(key);
45
+ if (field instanceof RadioNodeList && Array.from(field.values()).every(
46
+ (f) => f.type === "checkbox"
47
+ )) {
48
+ formValues[key] = formData.getAll(key);
49
+ } else {
50
+ field.type;
51
+ formValues[key] = formData.get(key);
52
+ }
53
+ });
54
+ onSubmit == null ? void 0 : onSubmit(formValues);
55
+ }
56
+ }, rest),
57
+ children
58
+ );
59
+ }
60
+ function registerForm(loader, overrides) {
61
+ registerComponentHelper(
62
+ loader,
63
+ BaseForm,
64
+ {
65
+ name: makeComponentName("form"),
66
+ displayName: "BaseForm",
67
+ importPath: "@plasmicpkgs/react-aria/registerForm",
68
+ importName: "BaseForm",
69
+ props: {
70
+ children: {
71
+ type: "slot"
72
+ },
73
+ onSubmit: {
74
+ type: "eventHandler",
75
+ argTypes: [{ name: "data", type: "object" }]
76
+ },
77
+ onReset: {
78
+ type: "eventHandler",
79
+ argTypes: []
80
+ }
81
+ },
82
+ trapsFocus: true
83
+ },
84
+ overrides
85
+ );
86
+ }
87
+
88
+ export { BaseForm, registerForm };
89
+ //# sourceMappingURL=registerForm.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerForm.esm.js","sources":["../src/registerForm.tsx"],"sourcesContent":["import React from \"react\";\nimport type { FormProps } from \"react-aria-components\";\nimport { Form } from \"react-aria-components\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\ninterface BaseFormProps extends Omit<FormProps, \"onSubmit\"> {\n onSubmit: (\n data: Record<string, FormDataEntryValue | FormDataEntryValue[] | null>\n ) => void;\n}\n\nexport function BaseForm(props: BaseFormProps) {\n const { onSubmit, children, ...rest } = props;\n return (\n <Form\n onSubmit={(e) => {\n e.preventDefault();\n const formData = new FormData(e.currentTarget);\n const formValues: {\n [key: string]: FormDataEntryValue | FormDataEntryValue[] | null;\n } = {};\n formData.forEach((value, key) => {\n const field = e.currentTarget.elements.namedItem(key);\n if (\n field instanceof RadioNodeList &&\n (Array.from(field.values()) as HTMLInputElement[]).every(\n (f) => f.type === \"checkbox\"\n )\n ) {\n formValues[key] = formData.getAll(key);\n } else {\n (field as HTMLInputElement).type;\n formValues[key] = formData.get(key);\n }\n });\n onSubmit?.(formValues);\n }}\n {...rest}\n >\n {children}\n </Form>\n );\n}\n\nexport function registerForm(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseForm>\n) {\n registerComponentHelper(\n loader,\n BaseForm,\n {\n name: makeComponentName(\"form\"),\n displayName: \"BaseForm\",\n importPath: \"@plasmicpkgs/react-aria/registerForm\",\n importName: \"BaseForm\",\n props: {\n children: {\n type: \"slot\",\n },\n onSubmit: {\n type: \"eventHandler\",\n argTypes: [{ name: \"data\", type: \"object\" }],\n } as any,\n onReset: {\n type: \"eventHandler\",\n argTypes: [],\n } as any,\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,SAAS,SAAS,KAAsB,EAAA;AAC7C,EAAwC,MAAA,EAAA,GAAA,KAAA,EAAhC,YAAU,QAjBpB,EAAA,GAiB0C,IAAT,IAAS,GAAA,SAAA,CAAA,EAAA,EAAT,CAAvB,UAAU,EAAA,UAAA,CAAA,CAAA,CAAA;AAClB,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA,cAAA,CAAA;AAAA,MACC,QAAA,EAAU,CAAC,CAAM,KAAA;AACf,QAAA,CAAA,CAAE,cAAe,EAAA,CAAA;AACjB,QAAA,MAAM,QAAW,GAAA,IAAI,QAAS,CAAA,CAAA,CAAE,aAAa,CAAA,CAAA;AAC7C,QAAA,MAAM,aAEF,EAAC,CAAA;AACL,QAAS,QAAA,CAAA,OAAA,CAAQ,CAAC,KAAA,EAAO,GAAQ,KAAA;AAC/B,UAAA,MAAM,KAAQ,GAAA,CAAA,CAAE,aAAc,CAAA,QAAA,CAAS,UAAU,GAAG,CAAA,CAAA;AACpD,UAAA,IACE,iBAAiB,aAChB,IAAA,KAAA,CAAM,KAAK,KAAM,CAAA,MAAA,EAAQ,CAAyB,CAAA,KAAA;AAAA,YACjD,CAAC,CAAM,KAAA,CAAA,CAAE,IAAS,KAAA,UAAA;AAAA,WAEpB,EAAA;AACA,YAAA,UAAA,CAAW,GAAG,CAAA,GAAI,QAAS,CAAA,MAAA,CAAO,GAAG,CAAA,CAAA;AAAA,WAChC,MAAA;AACL,YAAC,KAA2B,CAAA,IAAA,CAAA;AAC5B,YAAA,UAAA,CAAW,GAAG,CAAA,GAAI,QAAS,CAAA,GAAA,CAAI,GAAG,CAAA,CAAA;AAAA,WACpC;AAAA,SACD,CAAA,CAAA;AACD,QAAW,QAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,QAAA,CAAA,UAAA,CAAA,CAAA;AAAA,OACb;AAAA,KACI,EAAA,IAAA,CAAA;AAAA,IAEH,QAAA;AAAA,GACH,CAAA;AAEJ,CAAA;AAEgB,SAAA,YAAA,CACd,QACA,SACA,EAAA;AACA,EAAA,uBAAA;AAAA,IACE,MAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,MACE,IAAA,EAAM,kBAAkB,MAAM,CAAA;AAAA,MAC9B,WAAa,EAAA,UAAA;AAAA,MACb,UAAY,EAAA,sCAAA;AAAA,MACZ,UAAY,EAAA,UAAA;AAAA,MACZ,KAAO,EAAA;AAAA,QACL,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,MAAA;AAAA,SACR;AAAA,QACA,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,cAAA;AAAA,UACN,UAAU,CAAC,EAAE,MAAM,MAAQ,EAAA,IAAA,EAAM,UAAU,CAAA;AAAA,SAC7C;AAAA,QACA,OAAS,EAAA;AAAA,UACP,IAAM,EAAA,cAAA;AAAA,UACN,UAAU,EAAC;AAAA,SACb;AAAA,OACF;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
@@ -3,7 +3,7 @@
3
3
  var utils = require('@react-aria/utils');
4
4
  var React = require('react');
5
5
  var reactAriaComponents = require('react-aria-components');
6
- var contexts = require('./contexts-c0294d96.cjs.js');
6
+ var contexts = require('./contexts-3e42cdf9.cjs.js');
7
7
  var utils$1 = require('./utils-1190a0a9.cjs.js');
8
8
  require('@plasmicapp/host/registerComponent');
9
9
 
@@ -1,7 +1,7 @@
1
1
  import { mergeProps } from '@react-aria/utils';
2
2
  import React from 'react';
3
3
  import { Header } from 'react-aria-components';
4
- import { f as PlasmicHeaderContext } from './contexts-fd3e1077.esm.js';
4
+ import { e as PlasmicHeaderContext } from './contexts-49f6c298.esm.js';
5
5
  import { r as registerComponentHelper, m as makeComponentName } from './utils-28f98072.esm.js';
6
6
  import '@plasmicapp/host/registerComponent';
7
7
 
@@ -3,7 +3,7 @@
3
3
  var utils = require('@react-aria/utils');
4
4
  var React = require('react');
5
5
  var reactAriaComponents = require('react-aria-components');
6
- var contexts = require('./contexts-c0294d96.cjs.js');
6
+ var contexts = require('./contexts-3e42cdf9.cjs.js');
7
7
  var utils$1 = require('./utils-1190a0a9.cjs.js');
8
8
  require('@plasmicapp/host/registerComponent');
9
9
 
@@ -1,7 +1,7 @@
1
1
  import { mergeProps } from '@react-aria/utils';
2
2
  import React from 'react';
3
3
  import { Input } from 'react-aria-components';
4
- import { a as PlasmicInputContext } from './contexts-fd3e1077.esm.js';
4
+ import { a as PlasmicInputContext } from './contexts-49f6c298.esm.js';
5
5
  import { r as registerComponentHelper, m as makeComponentName } from './utils-28f98072.esm.js';
6
6
  import '@plasmicapp/host/registerComponent';
7
7
 
@@ -1,10 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var utils = require('@react-aria/utils');
4
3
  var React = require('react');
5
4
  var reactAriaComponents = require('react-aria-components');
6
- var contexts = require('./contexts-c0294d96.cjs.js');
7
- var utils$1 = require('./utils-1190a0a9.cjs.js');
5
+ var utils = require('./utils-1190a0a9.cjs.js');
8
6
  require('@plasmicapp/host/registerComponent');
9
7
 
10
8
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -28,26 +26,20 @@ var __spreadValues = (a, b) => {
28
26
  return a;
29
27
  };
30
28
  function BaseLabel(props) {
31
- const contextProps = React__default.default.useContext(contexts.PlasmicLabelContext);
32
- return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Label, __spreadValues({}, utils.mergeProps(contextProps, props)));
29
+ return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Label, __spreadValues({}, props));
33
30
  }
34
31
  function registerLabel(loader, overrides) {
35
- utils$1.registerComponentHelper(
32
+ utils.registerComponentHelper(
36
33
  loader,
37
34
  BaseLabel,
38
35
  {
39
- name: "plasmic-react-aria-label",
36
+ name: utils.makeComponentName("label"),
40
37
  displayName: "BaseLabel",
41
38
  importPath: "@plasmicpkgs/react-aria/registerLabel",
42
39
  importName: "BaseLabel",
43
40
  props: {
44
41
  children: {
45
- type: "slot",
46
- defaultValue: {
47
- type: "text",
48
- value: "Label"
49
- },
50
- mergeWithParent: true
42
+ type: "slot"
51
43
  }
52
44
  },
53
45
  trapsFocus: true