@payloadcms/ui 3.0.0-beta.133 → 3.0.0-beta.135

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 (128) hide show
  1. package/dist/assets/payload-favicon-dark.png +0 -0
  2. package/dist/assets/payload-favicon-light.png +0 -0
  3. package/dist/assets/payload-favicon.svg +4 -4
  4. package/dist/assets/payload-logo-dark.svg +1 -23
  5. package/dist/assets/payload-logo-light.svg +1 -23
  6. package/dist/assets/static-og-image.png +0 -0
  7. package/dist/elements/RelationshipTable/index.d.ts +1 -0
  8. package/dist/elements/RelationshipTable/index.d.ts.map +1 -1
  9. package/dist/elements/RelationshipTable/index.js +3 -2
  10. package/dist/elements/RelationshipTable/index.js.map +1 -1
  11. package/dist/elements/RenderServerComponent/index.d.ts +0 -6
  12. package/dist/elements/RenderServerComponent/index.d.ts.map +1 -1
  13. package/dist/elements/RenderServerComponent/index.js +1 -24
  14. package/dist/elements/RenderServerComponent/index.js.map +1 -1
  15. package/dist/elements/WhereBuilder/Condition/DefaultFilter/index.js +1 -1
  16. package/dist/elements/WhereBuilder/Condition/DefaultFilter/index.js.map +1 -1
  17. package/dist/exports/client/index.js +22 -22
  18. package/dist/exports/client/index.js.map +4 -4
  19. package/dist/exports/shared/index.d.ts +1 -0
  20. package/dist/exports/shared/index.d.ts.map +1 -1
  21. package/dist/exports/shared/index.js +2 -2
  22. package/dist/exports/shared/index.js.map +4 -4
  23. package/dist/fields/Checkbox/index.d.ts.map +1 -1
  24. package/dist/fields/Checkbox/index.js +71 -183
  25. package/dist/fields/Checkbox/index.js.map +1 -1
  26. package/dist/fields/Code/index.d.ts.map +1 -1
  27. package/dist/fields/Code/index.js +68 -170
  28. package/dist/fields/Code/index.js.map +1 -1
  29. package/dist/fields/Collapsible/index.d.ts.map +1 -1
  30. package/dist/fields/Collapsible/index.js +100 -207
  31. package/dist/fields/Collapsible/index.js.map +1 -1
  32. package/dist/fields/DateTime/index.d.ts.map +1 -1
  33. package/dist/fields/DateTime/index.js +72 -162
  34. package/dist/fields/DateTime/index.js.map +1 -1
  35. package/dist/fields/Email/index.d.ts.map +1 -1
  36. package/dist/fields/Email/index.js +72 -161
  37. package/dist/fields/Email/index.js.map +1 -1
  38. package/dist/fields/Group/index.d.ts.map +1 -1
  39. package/dist/fields/Group/index.js +64 -152
  40. package/dist/fields/Group/index.js.map +1 -1
  41. package/dist/fields/JSON/index.d.ts.map +1 -1
  42. package/dist/fields/JSON/index.js +7 -10
  43. package/dist/fields/JSON/index.js.map +1 -1
  44. package/dist/fields/Join/index.d.ts.map +1 -1
  45. package/dist/fields/Join/index.js +5 -2
  46. package/dist/fields/Join/index.js.map +1 -1
  47. package/dist/fields/Number/index.d.ts.map +1 -1
  48. package/dist/fields/Number/index.js +143 -275
  49. package/dist/fields/Number/index.js.map +1 -1
  50. package/dist/fields/Password/index.d.ts.map +1 -1
  51. package/dist/fields/Password/index.js +79 -166
  52. package/dist/fields/Password/index.js.map +1 -1
  53. package/dist/fields/Point/index.d.ts.map +1 -1
  54. package/dist/fields/Point/index.js +110 -235
  55. package/dist/fields/Point/index.js.map +1 -1
  56. package/dist/fields/RadioGroup/index.d.ts.map +1 -1
  57. package/dist/fields/RadioGroup/index.js +93 -209
  58. package/dist/fields/RadioGroup/index.js.map +1 -1
  59. package/dist/fields/Relationship/index.d.ts.map +1 -1
  60. package/dist/fields/Relationship/index.js +7 -10
  61. package/dist/fields/Relationship/index.js.map +1 -1
  62. package/dist/fields/Select/Input.d.ts +0 -1
  63. package/dist/fields/Select/Input.d.ts.map +1 -1
  64. package/dist/fields/Select/Input.js +45 -50
  65. package/dist/fields/Select/Input.js.map +1 -1
  66. package/dist/fields/Select/index.d.ts.map +1 -1
  67. package/dist/fields/Select/index.js +7 -7
  68. package/dist/fields/Select/index.js.map +1 -1
  69. package/dist/fields/Text/Input.d.ts.map +1 -1
  70. package/dist/fields/Text/Input.js +31 -36
  71. package/dist/fields/Text/Input.js.map +1 -1
  72. package/dist/fields/Text/index.d.ts +1 -1
  73. package/dist/fields/Text/index.d.ts.map +1 -1
  74. package/dist/fields/Text/index.js +93 -171
  75. package/dist/fields/Text/index.js.map +1 -1
  76. package/dist/fields/Text/types.d.ts +0 -1
  77. package/dist/fields/Text/types.d.ts.map +1 -1
  78. package/dist/fields/Text/types.js.map +1 -1
  79. package/dist/fields/Textarea/Input.d.ts.map +1 -1
  80. package/dist/fields/Textarea/Input.js +26 -31
  81. package/dist/fields/Textarea/Input.js.map +1 -1
  82. package/dist/fields/Textarea/index.d.ts.map +1 -1
  83. package/dist/fields/Textarea/index.js +62 -112
  84. package/dist/fields/Textarea/index.js.map +1 -1
  85. package/dist/fields/Textarea/types.d.ts +0 -1
  86. package/dist/fields/Textarea/types.d.ts.map +1 -1
  87. package/dist/fields/Textarea/types.js.map +1 -1
  88. package/dist/fields/Upload/Input.d.ts +0 -1
  89. package/dist/fields/Upload/Input.d.ts.map +1 -1
  90. package/dist/fields/Upload/Input.js +41 -46
  91. package/dist/fields/Upload/Input.js.map +1 -1
  92. package/dist/fields/Upload/index.d.ts.map +1 -1
  93. package/dist/fields/Upload/index.js +63 -135
  94. package/dist/fields/Upload/index.js.map +1 -1
  95. package/dist/fields/mergeFieldStyles.d.ts +3 -0
  96. package/dist/fields/mergeFieldStyles.d.ts.map +1 -0
  97. package/dist/fields/mergeFieldStyles.js +13 -0
  98. package/dist/fields/mergeFieldStyles.js.map +1 -0
  99. package/dist/forms/Form/index.d.ts.map +1 -1
  100. package/dist/forms/Form/index.js +3 -3
  101. package/dist/forms/Form/index.js.map +1 -1
  102. package/dist/forms/Submit/index.d.ts.map +1 -1
  103. package/dist/forms/Submit/index.js +7 -2
  104. package/dist/forms/Submit/index.js.map +1 -1
  105. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.d.ts.map +1 -1
  106. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js +3 -0
  107. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js.map +1 -1
  108. package/dist/forms/fieldSchemasToFormState/renderField.d.ts.map +1 -1
  109. package/dist/forms/fieldSchemasToFormState/renderField.js +40 -9
  110. package/dist/forms/fieldSchemasToFormState/renderField.js.map +1 -1
  111. package/dist/forms/fieldSchemasToFormState/types.d.ts +4 -1
  112. package/dist/forms/fieldSchemasToFormState/types.d.ts.map +1 -1
  113. package/dist/forms/fieldSchemasToFormState/types.js.map +1 -1
  114. package/dist/graphics/Icon/index.d.ts.map +1 -1
  115. package/dist/graphics/Icon/index.js +2 -2
  116. package/dist/graphics/Icon/index.js.map +1 -1
  117. package/dist/graphics/Logo/index.d.ts.map +1 -1
  118. package/dist/graphics/Logo/index.js +30 -21
  119. package/dist/graphics/Logo/index.js.map +1 -1
  120. package/dist/utilities/buildFormState.d.ts +0 -4
  121. package/dist/utilities/buildFormState.d.ts.map +1 -1
  122. package/dist/utilities/buildFormState.js +1 -15
  123. package/dist/utilities/buildFormState.js.map +1 -1
  124. package/dist/utilities/buildTableState.d.ts +2 -1
  125. package/dist/utilities/buildTableState.d.ts.map +1 -1
  126. package/dist/utilities/buildTableState.js +7 -4
  127. package/dist/utilities/buildTableState.js.map +1 -1
  128. package/package.json +15 -5
@@ -1,9 +1,8 @@
1
1
  'use client';
2
2
 
3
- import { c as _c } from "react/compiler-runtime";
4
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
4
  import { getTranslation } from '@payloadcms/translations';
6
- import React, { useCallback } from 'react';
5
+ import React, { useCallback, useMemo } from 'react';
7
6
  import { DatePickerField } from '../../elements/DatePicker/index.js';
8
7
  import { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js';
9
8
  import { FieldDescription } from '../../fields/FieldDescription/index.js';
@@ -12,182 +11,93 @@ import { FieldLabel } from '../../fields/FieldLabel/index.js';
12
11
  import { useField } from '../../forms/useField/index.js';
13
12
  import { withCondition } from '../../forms/withCondition/index.js';
14
13
  import { useTranslation } from '../../providers/Translation/index.js';
15
- import { fieldBaseClass } from '../shared/index.js';
14
+ import { mergeFieldStyles } from '../mergeFieldStyles.js';
16
15
  import './index.scss';
16
+ import { fieldBaseClass } from '../shared/index.js';
17
17
  const baseClass = 'date-time-field';
18
18
  const DateTimeFieldComponent = props => {
19
- const $ = _c(38);
20
19
  const {
21
- field: t0,
20
+ field,
21
+ field: {
22
+ admin: {
23
+ className,
24
+ date: datePickerProps,
25
+ description,
26
+ placeholder
27
+ } = {},
28
+ label,
29
+ localized,
30
+ required
31
+ },
22
32
  path,
23
33
  readOnly,
24
34
  validate
25
35
  } = props;
26
- const {
27
- admin: t1,
28
- label,
29
- localized,
30
- required
31
- } = t0;
32
- let t2;
33
- if ($[0] !== t1) {
34
- t2 = t1 === undefined ? {} : t1;
35
- $[0] = t1;
36
- $[1] = t2;
37
- } else {
38
- t2 = $[1];
39
- }
40
- const {
41
- className,
42
- date: datePickerProps,
43
- description,
44
- placeholder,
45
- style,
46
- width
47
- } = t2;
48
36
  const {
49
37
  i18n
50
38
  } = useTranslation();
51
- let t3;
52
- if ($[2] !== validate || $[3] !== required) {
53
- t3 = (value, options) => {
54
- if (typeof validate === "function") {
55
- return validate(value, {
56
- ...options,
57
- required
58
- });
59
- }
60
- };
61
- $[2] = validate;
62
- $[3] = required;
63
- $[4] = t3;
64
- } else {
65
- t3 = $[4];
66
- }
67
- const memoizedValidate = t3;
68
- let t4;
69
- if ($[5] !== path || $[6] !== memoizedValidate) {
70
- t4 = {
71
- path,
72
- validate: memoizedValidate
73
- };
74
- $[5] = path;
75
- $[6] = memoizedValidate;
76
- $[7] = t4;
77
- } else {
78
- t4 = $[7];
79
- }
39
+ const memoizedValidate = useCallback((value, options) => {
40
+ if (typeof validate === 'function') {
41
+ return validate(value, {
42
+ ...options,
43
+ required
44
+ });
45
+ }
46
+ }, [validate, required]);
80
47
  const {
81
- customComponents: t5,
48
+ customComponents: {
49
+ AfterInput,
50
+ BeforeInput,
51
+ Description,
52
+ Error,
53
+ Label
54
+ } = {},
82
55
  setValue,
83
56
  showError,
84
57
  value: value_0
85
- } = useField(t4);
86
- let t6;
87
- if ($[8] !== t5) {
88
- t6 = t5 === undefined ? {} : t5;
89
- $[8] = t5;
90
- $[9] = t6;
91
- } else {
92
- t6 = $[9];
93
- }
94
- const {
95
- AfterInput,
96
- BeforeInput,
97
- Description,
98
- Error,
99
- Label
100
- } = t6;
101
- const t7 = showError && `${baseClass}--has-error`;
102
- const t8 = readOnly && "read-only";
103
- let t9;
104
- if ($[10] !== className || $[11] !== t7 || $[12] !== t8) {
105
- t9 = [fieldBaseClass, baseClass, className, t7, t8].filter(Boolean);
106
- $[10] = className;
107
- $[11] = t7;
108
- $[12] = t8;
109
- $[13] = t9;
110
- } else {
111
- t9 = $[13];
112
- }
113
- const t10 = t9.join(" ");
114
- let t11;
115
- if ($[14] !== style || $[15] !== width || $[16] !== label || $[17] !== localized || $[18] !== required || $[19] !== Label || $[20] !== path || $[21] !== showError || $[22] !== Error || $[23] !== readOnly || $[24] !== setValue || $[25] !== placeholder || $[26] !== i18n || $[27] !== datePickerProps || $[28] !== value_0 || $[29] !== BeforeInput || $[30] !== AfterInput || $[31] !== description || $[32] !== Description || $[33] !== t10) {
116
- let t12;
117
- if ($[35] !== readOnly || $[36] !== setValue) {
118
- t12 = incomingDate => {
119
- if (!readOnly) {
120
- setValue(incomingDate?.toISOString() || null);
121
- }
122
- };
123
- $[35] = readOnly;
124
- $[36] = setValue;
125
- $[37] = t12;
126
- } else {
127
- t12 = $[37];
128
- }
129
- t11 = _jsxs("div", {
130
- className: t10,
131
- style: {
132
- ...style,
133
- width
134
- },
135
- children: [_jsx(RenderCustomComponent, {
136
- CustomComponent: Label,
137
- Fallback: _jsx(FieldLabel, {
138
- label,
139
- localized,
140
- required
141
- })
142
- }), _jsxs("div", {
143
- className: `${fieldBaseClass}__wrap`,
144
- id: `field-${path.replace(/\./g, "__")}`,
145
- children: [_jsx(RenderCustomComponent, {
146
- CustomComponent: Error,
147
- Fallback: _jsx(FieldError, {
148
- path,
149
- showError
150
- })
151
- }), BeforeInput, _jsx(DatePickerField, {
152
- ...datePickerProps,
153
- onChange: t12,
154
- placeholder: getTranslation(placeholder, i18n),
155
- readOnly,
156
- value: value_0
157
- }), AfterInput]
158
- }), _jsx(RenderCustomComponent, {
159
- CustomComponent: Description,
160
- Fallback: _jsx(FieldDescription, {
161
- description,
162
- path
58
+ } = useField({
59
+ path,
60
+ validate: memoizedValidate
61
+ });
62
+ const styles = useMemo(() => mergeFieldStyles(field), [field]);
63
+ return /*#__PURE__*/_jsxs("div", {
64
+ className: [fieldBaseClass, baseClass, className, showError && `${baseClass}--has-error`, readOnly && 'read-only'].filter(Boolean).join(' '),
65
+ style: styles,
66
+ children: [/*#__PURE__*/_jsx(RenderCustomComponent, {
67
+ CustomComponent: Label,
68
+ Fallback: /*#__PURE__*/_jsx(FieldLabel, {
69
+ label: label,
70
+ localized: localized,
71
+ required: required
72
+ })
73
+ }), /*#__PURE__*/_jsxs("div", {
74
+ className: `${fieldBaseClass}__wrap`,
75
+ id: `field-${path.replace(/\./g, '__')}`,
76
+ children: [/*#__PURE__*/_jsx(RenderCustomComponent, {
77
+ CustomComponent: Error,
78
+ Fallback: /*#__PURE__*/_jsx(FieldError, {
79
+ path: path,
80
+ showError: showError
163
81
  })
164
- })]
165
- });
166
- $[14] = style;
167
- $[15] = width;
168
- $[16] = label;
169
- $[17] = localized;
170
- $[18] = required;
171
- $[19] = Label;
172
- $[20] = path;
173
- $[21] = showError;
174
- $[22] = Error;
175
- $[23] = readOnly;
176
- $[24] = setValue;
177
- $[25] = placeholder;
178
- $[26] = i18n;
179
- $[27] = datePickerProps;
180
- $[28] = value_0;
181
- $[29] = BeforeInput;
182
- $[30] = AfterInput;
183
- $[31] = description;
184
- $[32] = Description;
185
- $[33] = t10;
186
- $[34] = t11;
187
- } else {
188
- t11 = $[34];
189
- }
190
- return t11;
82
+ }), BeforeInput, /*#__PURE__*/_jsx(DatePickerField, {
83
+ ...datePickerProps,
84
+ onChange: incomingDate => {
85
+ if (!readOnly) {
86
+ setValue(incomingDate?.toISOString() || null);
87
+ }
88
+ },
89
+ placeholder: getTranslation(placeholder, i18n),
90
+ readOnly: readOnly,
91
+ value: value_0
92
+ }), AfterInput]
93
+ }), /*#__PURE__*/_jsx(RenderCustomComponent, {
94
+ CustomComponent: Description,
95
+ Fallback: /*#__PURE__*/_jsx(FieldDescription, {
96
+ description: description,
97
+ path: path
98
+ })
99
+ })]
100
+ });
191
101
  };
192
102
  export const DateTimeField = withCondition(DateTimeFieldComponent);
193
103
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","getTranslation","React","useCallback","DatePickerField","RenderCustomComponent","FieldDescription","FieldError","FieldLabel","useField","withCondition","useTranslation","fieldBaseClass","baseClass","DateTimeFieldComponent","props","$","field","t0","path","readOnly","validate","admin","t1","label","localized","required","t2","undefined","className","date","datePickerProps","description","placeholder","style","width","i18n","t3","value","options","memoizedValidate","t4","customComponents","t5","setValue","showError","value_0","t6","AfterInput","BeforeInput","Description","Error","Label","t7","t8","t9","filter","Boolean","t10","join","t11","t12","incomingDate","toISOString","_jsxs","children","_jsx","CustomComponent","Fallback","id","replace","onChange","DateTimeField"],"sources":["../../../src/fields/DateTime/index.tsx"],"sourcesContent":["'use client'\nimport type { DateFieldClientComponent, DateFieldValidation } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback } from 'react'\n\nimport { DatePickerField } from '../../elements/DatePicker/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { FieldError } from '../../fields/FieldError/index.js'\nimport { FieldLabel } from '../../fields/FieldLabel/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nconst baseClass = 'date-time-field'\n\nconst DateTimeFieldComponent: DateFieldClientComponent = (props) => {\n const {\n field: {\n name,\n admin: { className, date: datePickerProps, description, placeholder, style, width } = {},\n label,\n localized,\n required,\n },\n path,\n readOnly,\n validate,\n } = props\n\n const { i18n } = useTranslation()\n\n const memoizedValidate: DateFieldValidation = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n setValue,\n showError,\n value,\n } = useField<Date>({\n path,\n validate: memoizedValidate,\n })\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && `${baseClass}--has-error`,\n readOnly && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <RenderCustomComponent\n CustomComponent={Label}\n Fallback={<FieldLabel label={label} localized={localized} required={required} />}\n />\n <div className={`${fieldBaseClass}__wrap`} id={`field-${path.replace(/\\./g, '__')}`}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {BeforeInput}\n <DatePickerField\n {...datePickerProps}\n onChange={(incomingDate) => {\n if (!readOnly) {\n setValue(incomingDate?.toISOString() || null)\n }\n }}\n placeholder={getTranslation(placeholder, i18n)}\n readOnly={readOnly}\n value={value}\n />\n {AfterInput}\n </div>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n )\n}\n\nexport const DateTimeField = withCondition(DateTimeFieldComponent)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,WAAW,QAAQ;AAEnC,SAASC,eAAe,QAAQ;AAChC,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,UAAU,QAAQ;AAC3B,SAASC,UAAU,QAAQ;AAC3B,SAASC,QAAQ,QAAQ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AAA3D,UAAA;YAAAY,IAAA;YAAA0B;UAAA,C;YAEXI,WAAA,EACDiB,IAAA,CAAA9D,eAAA;UAAA,GACM2B,eAAe;UAAAwC,QAAA,EACTV,GAIV;UAAA5B,WAAA,EACahC,cAAA,CAAegC,WAAA,EAAaG,IAAA;UAAAhB,QAAA;UAAAkB,KAAA,EAElCA;QAAA,C,GAERU,UAAA;MAAA,C,GAEHkB,IAAA,CAAA7D,qBAAA;QAAA8D,eAAA,EACmBjB,WAAA;QAAAkB,QAAA,EACPF,IAAA,CAAA5D,gBAAA;UAAA0B,WAAA;UAAAb;QAAA,C;;;;;;;;;;;;;;;;;;;;;;;;;;;SAxCdyC,G;CA4CJ;AAEA,OAAO,MAAMY,aAAA,GAAgB9D,aAAA,CAAcI,sBAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["getTranslation","React","useCallback","useMemo","DatePickerField","RenderCustomComponent","FieldDescription","FieldError","FieldLabel","useField","withCondition","useTranslation","mergeFieldStyles","fieldBaseClass","baseClass","DateTimeFieldComponent","props","field","admin","className","date","datePickerProps","description","placeholder","label","localized","required","path","readOnly","validate","i18n","memoizedValidate","value","options","customComponents","AfterInput","BeforeInput","Description","Error","Label","setValue","showError","styles","_jsxs","filter","Boolean","join","style","_jsx","CustomComponent","Fallback","id","replace","onChange","incomingDate","toISOString","DateTimeField"],"sources":["../../../src/fields/DateTime/index.tsx"],"sourcesContent":["'use client'\nimport type { DateFieldClientComponent, DateFieldValidation } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback, useMemo } from 'react'\n\nimport { DatePickerField } from '../../elements/DatePicker/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { FieldError } from '../../fields/FieldError/index.js'\nimport { FieldLabel } from '../../fields/FieldLabel/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { mergeFieldStyles } from '../mergeFieldStyles.js'\nimport './index.scss'\nimport { fieldBaseClass } from '../shared/index.js'\n\nconst baseClass = 'date-time-field'\n\nconst DateTimeFieldComponent: DateFieldClientComponent = (props) => {\n const {\n field,\n field: {\n admin: { className, date: datePickerProps, description, placeholder } = {},\n label,\n localized,\n required,\n },\n path,\n readOnly,\n validate,\n } = props\n\n const { i18n } = useTranslation()\n\n const memoizedValidate: DateFieldValidation = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n setValue,\n showError,\n value,\n } = useField<Date>({\n path,\n validate: memoizedValidate,\n })\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && `${baseClass}--has-error`,\n readOnly && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={styles}\n >\n <RenderCustomComponent\n CustomComponent={Label}\n Fallback={<FieldLabel label={label} localized={localized} required={required} />}\n />\n <div className={`${fieldBaseClass}__wrap`} id={`field-${path.replace(/\\./g, '__')}`}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {BeforeInput}\n <DatePickerField\n {...datePickerProps}\n onChange={(incomingDate) => {\n if (!readOnly) {\n setValue(incomingDate?.toISOString() || null)\n }\n }}\n placeholder={getTranslation(placeholder, i18n)}\n readOnly={readOnly}\n value={value}\n />\n {AfterInput}\n </div>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n )\n}\n\nexport const DateTimeField = withCondition(DateTimeFieldComponent)\n"],"mappings":"AAAA;;;AAGA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,WAAW,EAAEC,OAAO,QAAQ;AAE5C,SAASC,eAAe,QAAQ;AA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,EAGV,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAGhB,OAAO,KAAsB,MAAM,OAAO,CAAA;AAU1C,OAAO,cAAc,CAAA;AAyFrB,eAAO,MAAM,UAAU;;;;;+EAAqC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Email/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAGhB,OAAO,KAA+B,MAAM,OAAO,CAAA;AAUnD,OAAO,cAAc,CAAA;AAuFrB,eAAO,MAAM,UAAU;;;;;+EAAqC,CAAA"}
@@ -1,9 +1,8 @@
1
1
  'use client';
2
2
 
3
- import { c as _c } from "react/compiler-runtime";
4
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
4
  import { getTranslation } from '@payloadcms/translations';
6
- import React, { useCallback } from 'react';
5
+ import React, { useCallback, useMemo } from 'react';
7
6
  import { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js';
8
7
  import { FieldDescription } from '../../fields/FieldDescription/index.js';
9
8
  import { FieldError } from '../../fields/FieldError/index.js';
@@ -11,180 +10,92 @@ import { useField } from '../../forms/useField/index.js';
11
10
  import { withCondition } from '../../forms/withCondition/index.js';
12
11
  import { useTranslation } from '../../providers/Translation/index.js';
13
12
  import { FieldLabel } from '../FieldLabel/index.js';
14
- import { fieldBaseClass } from '../shared/index.js';
13
+ import { mergeFieldStyles } from '../mergeFieldStyles.js';
15
14
  import './index.scss';
15
+ import { fieldBaseClass } from '../shared/index.js';
16
16
  const EmailFieldComponent = props => {
17
- const $ = _c(37);
18
17
  const {
19
- field: t0,
18
+ field,
19
+ field: {
20
+ admin: {
21
+ autoComplete,
22
+ className,
23
+ description,
24
+ placeholder
25
+ } = {},
26
+ label,
27
+ localized,
28
+ required
29
+ } = {},
20
30
  path,
21
31
  readOnly,
22
32
  validate
23
33
  } = props;
24
- let t1;
25
- if ($[0] !== t0) {
26
- t1 = t0 === undefined ? {} : t0;
27
- $[0] = t0;
28
- $[1] = t1;
29
- } else {
30
- t1 = $[1];
31
- }
32
- const {
33
- admin: t2,
34
- label,
35
- localized,
36
- required
37
- } = t1;
38
- let t3;
39
- if ($[2] !== t2) {
40
- t3 = t2 === undefined ? {} : t2;
41
- $[2] = t2;
42
- $[3] = t3;
43
- } else {
44
- t3 = $[3];
45
- }
46
- const {
47
- autoComplete,
48
- className,
49
- description,
50
- placeholder,
51
- style,
52
- width
53
- } = t3;
54
34
  const {
55
35
  i18n
56
36
  } = useTranslation();
57
- let t4;
58
- if ($[4] !== validate || $[5] !== required) {
59
- t4 = (value, options) => {
60
- if (typeof validate === "function") {
61
- return validate(value, {
62
- ...options,
63
- required
64
- });
65
- }
66
- };
67
- $[4] = validate;
68
- $[5] = required;
69
- $[6] = t4;
70
- } else {
71
- t4 = $[6];
72
- }
73
- const memoizedValidate = t4;
74
- let t5;
75
- if ($[7] !== path || $[8] !== memoizedValidate) {
76
- t5 = {
77
- path,
78
- validate: memoizedValidate
79
- };
80
- $[7] = path;
81
- $[8] = memoizedValidate;
82
- $[9] = t5;
83
- } else {
84
- t5 = $[9];
85
- }
37
+ const memoizedValidate = useCallback((value, options) => {
38
+ if (typeof validate === 'function') {
39
+ return validate(value, {
40
+ ...options,
41
+ required
42
+ });
43
+ }
44
+ }, [validate, required]);
86
45
  const {
87
- customComponents: t6,
46
+ customComponents: {
47
+ AfterInput,
48
+ BeforeInput,
49
+ Description,
50
+ Error,
51
+ Label
52
+ } = {},
88
53
  setValue,
89
54
  showError,
90
55
  value: value_0
91
- } = useField(t5);
92
- let t7;
93
- if ($[10] !== t6) {
94
- t7 = t6 === undefined ? {} : t6;
95
- $[10] = t6;
96
- $[11] = t7;
97
- } else {
98
- t7 = $[11];
99
- }
100
- const {
101
- AfterInput,
102
- BeforeInput,
103
- Description,
104
- Error,
105
- Label
106
- } = t7;
107
- const t8 = showError && "error";
108
- const t9 = readOnly && "read-only";
109
- let t10;
110
- if ($[12] !== className || $[13] !== t8 || $[14] !== t9) {
111
- t10 = [fieldBaseClass, "email", className, t8, t9].filter(Boolean);
112
- $[12] = className;
113
- $[13] = t8;
114
- $[14] = t9;
115
- $[15] = t10;
116
- } else {
117
- t10 = $[15];
118
- }
119
- const t11 = t10.join(" ");
120
- let t12;
121
- if ($[16] !== style || $[17] !== width || $[18] !== label || $[19] !== localized || $[20] !== path || $[21] !== required || $[22] !== Label || $[23] !== showError || $[24] !== Error || $[25] !== placeholder || $[26] !== i18n || $[27] !== value_0 || $[28] !== autoComplete || $[29] !== readOnly || $[30] !== setValue || $[31] !== BeforeInput || $[32] !== AfterInput || $[33] !== description || $[34] !== Description || $[35] !== t11) {
122
- t12 = _jsxs("div", {
123
- className: t11,
124
- style: {
125
- ...style,
126
- width
127
- },
128
- children: [_jsx(RenderCustomComponent, {
129
- CustomComponent: Label,
130
- Fallback: _jsx(FieldLabel, {
131
- label,
132
- localized,
133
- path,
134
- required
135
- })
136
- }), _jsxs("div", {
137
- className: `${fieldBaseClass}__wrap`,
138
- children: [_jsx(RenderCustomComponent, {
139
- CustomComponent: Error,
140
- Fallback: _jsx(FieldError, {
141
- path,
142
- showError
143
- })
144
- }), BeforeInput, _jsx("input", {
145
- autoComplete,
146
- disabled: readOnly,
147
- id: `field-${path.replace(/\./g, "__")}`,
148
- name: path,
149
- onChange: setValue,
150
- placeholder: getTranslation(placeholder, i18n),
151
- required,
152
- type: "email",
153
- value: value_0 || ""
154
- }), AfterInput]
155
- }), _jsx(RenderCustomComponent, {
156
- CustomComponent: Description,
157
- Fallback: _jsx(FieldDescription, {
158
- description,
159
- path
56
+ } = useField({
57
+ path,
58
+ validate: memoizedValidate
59
+ });
60
+ const styles = useMemo(() => mergeFieldStyles(field), [field]);
61
+ return /*#__PURE__*/_jsxs("div", {
62
+ className: [fieldBaseClass, 'email', className, showError && 'error', readOnly && 'read-only'].filter(Boolean).join(' '),
63
+ style: styles,
64
+ children: [/*#__PURE__*/_jsx(RenderCustomComponent, {
65
+ CustomComponent: Label,
66
+ Fallback: /*#__PURE__*/_jsx(FieldLabel, {
67
+ label: label,
68
+ localized: localized,
69
+ path: path,
70
+ required: required
71
+ })
72
+ }), /*#__PURE__*/_jsxs("div", {
73
+ className: `${fieldBaseClass}__wrap`,
74
+ children: [/*#__PURE__*/_jsx(RenderCustomComponent, {
75
+ CustomComponent: Error,
76
+ Fallback: /*#__PURE__*/_jsx(FieldError, {
77
+ path: path,
78
+ showError: showError
160
79
  })
161
- })]
162
- });
163
- $[16] = style;
164
- $[17] = width;
165
- $[18] = label;
166
- $[19] = localized;
167
- $[20] = path;
168
- $[21] = required;
169
- $[22] = Label;
170
- $[23] = showError;
171
- $[24] = Error;
172
- $[25] = placeholder;
173
- $[26] = i18n;
174
- $[27] = value_0;
175
- $[28] = autoComplete;
176
- $[29] = readOnly;
177
- $[30] = setValue;
178
- $[31] = BeforeInput;
179
- $[32] = AfterInput;
180
- $[33] = description;
181
- $[34] = Description;
182
- $[35] = t11;
183
- $[36] = t12;
184
- } else {
185
- t12 = $[36];
186
- }
187
- return t12;
80
+ }), BeforeInput, /*#__PURE__*/_jsx("input", {
81
+ autoComplete: autoComplete,
82
+ disabled: readOnly,
83
+ id: `field-${path.replace(/\./g, '__')}`,
84
+ name: path,
85
+ onChange: setValue,
86
+ placeholder: getTranslation(placeholder, i18n),
87
+ required: required,
88
+ type: "email",
89
+ value: value_0 || ''
90
+ }), AfterInput]
91
+ }), /*#__PURE__*/_jsx(RenderCustomComponent, {
92
+ CustomComponent: Description,
93
+ Fallback: /*#__PURE__*/_jsx(FieldDescription, {
94
+ description: description,
95
+ path: path
96
+ })
97
+ })]
98
+ });
188
99
  };
189
100
  export const EmailField = withCondition(EmailFieldComponent);
190
101
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","getTranslation","React","useCallback","RenderCustomComponent","FieldDescription","FieldError","useField","withCondition","useTranslation","FieldLabel","fieldBaseClass","EmailFieldComponent","props","$","field","t0","path","readOnly","validate","t1","undefined","admin","t2","label","localized","required","t3","autoComplete","className","description","placeholder","style","width","i18n","t4","value","options","memoizedValidate","t5","customComponents","t6","setValue","showError","value_0","t7","AfterInput","BeforeInput","Description","Error","Label","t8","t9","t10","filter","Boolean","t11","join","t12","_jsxs","children","_jsx","CustomComponent","Fallback","disabled","id","replace","name","onChange","type","EmailField"],"sources":["../../../src/fields/Email/index.tsx"],"sourcesContent":["'use client'\nimport type {\n EmailFieldClientComponent,\n EmailFieldClientProps,\n EmailFieldValidation,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback } from 'react'\n\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { FieldError } from '../../fields/FieldError/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nconst EmailFieldComponent: EmailFieldClientComponent = (props) => {\n const {\n field: {\n name,\n admin: {\n autoComplete,\n className,\n description,\n placeholder,\n style,\n width,\n } = {} as EmailFieldClientProps['field']['admin'],\n label,\n localized,\n required,\n } = {} as EmailFieldClientProps['field'],\n path,\n readOnly,\n validate,\n } = props\n\n const { i18n } = useTranslation()\n\n const memoizedValidate: EmailFieldValidation = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n setValue,\n showError,\n value,\n } = useField({\n path,\n validate: memoizedValidate,\n })\n\n return (\n <div\n className={[fieldBaseClass, 'email', className, showError && 'error', readOnly && 'read-only']\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <RenderCustomComponent\n CustomComponent={Label}\n Fallback={\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n }\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {BeforeInput}\n {/* disable eslint here because the label is dynamic */}\n {/* eslint-disable-next-line jsx-a11y/control-has-associated-label */}\n <input\n autoComplete={autoComplete}\n disabled={readOnly}\n id={`field-${path.replace(/\\./g, '__')}`}\n name={path}\n onChange={setValue}\n placeholder={getTranslation(placeholder, i18n)}\n required={required}\n type=\"email\"\n value={(value as string) || ''}\n />\n {AfterInput}\n </div>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n )\n}\n\nexport const EmailField = withCondition(EmailFieldComponent)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAOA,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,WAAW,QAAQ;AAEnC,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,UAAU,QAAQ;AAC3B,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,UAAU,QAAQ;AAC3B,SAASC,cAAc,QAAQ;AAC/B,OAAO;AAEP,MAAMC,mBAAA,GAAiDC,KAAA;EAAA,MAAAC,CAAA,GAAAd,EAAA;EACrD;IAAAe,KAAA,EAAAC,EAAA;IAAAC,IAAA;IAAAC,QAAA;IAAAC;EAAA,IAkBIN,KAAA;EAAA,IAAAO,EAAA;EAAA,IAAAN,CAAA,QAAAE,EAAA;IAjBKI,EAAA,GAAAJ,EAaiC,KAAAK,SAAA,QAbjCL,EAaiC;IAAAF,CAAA,MAAAE,EAAA;IAAAF,CAAA,MAAAM,EAAA;EAAA;IAAAA,EAAA,GAAAN,CAAA;EAAA;EAbjC;IAAAQ,KAAA,EAAAC,EAAA;IAAAC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CAAA,SAAAgB,WAAA,IAAAhB,CAAA,SAAAkC,WAAA,IAAAlC,CAAA,SAAA0C,GAAA;IAHVE,GAAA,GAAAC,KAAA,CAAC;MAAA9B,SAAA,EACY2B,GAEH;MAAAxB,KAAA;QAAA,GAEHA,KAAK;QAAAC;MAAA;MAAA2B,QAAA,GAIVC,IAAA,CAAAzD,qBAAA;QAAA0D,eAAA,EACmBZ,KAAA;QAAAa,QAAA,EAEfF,IAAA,CAAAnD,UAAA;UAAAc,KAAA;UAAAC,SAAA;UAAAR,IAAA;UAAAS;QAAA,C;UAGJiC,KAAA,CAAC;QAAA9B,SAAA,EAAe,GAAAlB,cAAA,QAAyB;QAAAiD,QAAA,GACvCC,IAAA,CAAAzD,qBAAA;UAAA0D,eAAA,EACmBb,KAAA;UAAAc,QAAA,EACPF,IAAA,CAAAvD,UAAA;YAAAW,IAAA;YAAA0B;UAAA,C;YAEXI,WAAA,EAGDc,IAAA,CAAC;UAAAjC,YAAA;UAAAoC,QAAA,EAEW9C,QAAA;UAAA+C,EAAA,EACN,SAAShD,IAAA,CAAAiD,OAAA,QAAoB,OAAO;UAAAC,IAAA,EAClClD,IAAA;UAAAmD,QAAA,EACI1B,QAAA;UAAAX,WAAA,EACG9B,cAAA,CAAe8B,WAAA,EAAaG,IAAA;UAAAR,QAAA;UAAA2C,IAAA,EAEpC;UAAAjC,KAAA,EACEA,OAAC,IAAoB;QAAA,C,GAE7BU,UAAA;MAAA,C,GAEHe,IAAA,CAAAzD,qBAAA;QAAA0D,eAAA,EACmBd,WAAA;QAAAe,QAAA,EACPF,IAAA,CAAAxD,gBAAA;UAAAyB,WAAA;UAAAb;QAAA,C;;;;;;;;;;;;;;;;;;;;;;;;;;;SAtCdyC,G;CA0CJ;AAEA,OAAO,MAAMY,UAAA,GAAa9D,aAAA,CAAcI,mBAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["getTranslation","React","useCallback","useMemo","RenderCustomComponent","FieldDescription","FieldError","useField","withCondition","useTranslation","FieldLabel","mergeFieldStyles","fieldBaseClass","EmailFieldComponent","props","field","admin","autoComplete","className","description","placeholder","label","localized","required","path","readOnly","validate","i18n","memoizedValidate","value","options","customComponents","AfterInput","BeforeInput","Description","Error","Label","setValue","showError","styles","_jsxs","filter","Boolean","join","style","_jsx","CustomComponent","Fallback","disabled","id","replace","name","onChange","type","EmailField"],"sources":["../../../src/fields/Email/index.tsx"],"sourcesContent":["'use client'\nimport type {\n EmailFieldClientComponent,\n EmailFieldClientProps,\n EmailFieldValidation,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback, useMemo } from 'react'\n\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { FieldError } from '../../fields/FieldError/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { mergeFieldStyles } from '../mergeFieldStyles.js'\nimport './index.scss'\nimport { fieldBaseClass } from '../shared/index.js'\n\nconst EmailFieldComponent: EmailFieldClientComponent = (props) => {\n const {\n field,\n field: {\n admin: {\n autoComplete,\n className,\n description,\n placeholder,\n } = {} as EmailFieldClientProps['field']['admin'],\n label,\n localized,\n required,\n } = {} as EmailFieldClientProps['field'],\n path,\n readOnly,\n validate,\n } = props\n\n const { i18n } = useTranslation()\n\n const memoizedValidate: EmailFieldValidation = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n setValue,\n showError,\n value,\n } = useField({\n path,\n validate: memoizedValidate,\n })\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <div\n className={[fieldBaseClass, 'email', className, showError && 'error', readOnly && 'read-only']\n .filter(Boolean)\n .join(' ')}\n style={styles}\n >\n <RenderCustomComponent\n CustomComponent={Label}\n Fallback={\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n }\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {BeforeInput}\n {/* disable eslint here because the label is dynamic */}\n {/* eslint-disable-next-line jsx-a11y/control-has-associated-label */}\n <input\n autoComplete={autoComplete}\n disabled={readOnly}\n id={`field-${path.replace(/\\./g, '__')}`}\n name={path}\n onChange={setValue}\n placeholder={getTranslation(placeholder, i18n)}\n required={required}\n type=\"email\"\n value={(value as string) || ''}\n />\n {AfterInput}\n </div>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n )\n}\n\nexport const EmailField = withCondition(EmailFieldComponent)\n"],"mappings":"AAAA;;;AAOA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,WAAW,EAAEC,OAAO,QAAQ;AAE5C,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,UAAU,QAAQ;AAC3B,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,UAAU,QAAQ;AAC3B,SAASC,gBAAgB,QAAQ;AACjC,OAAO;AACP,SAASC,cAAc,QAAQ;AAE/B,MAAMC,mBAAA,GAAkDC,KAAA;EACtD,MAAM;IACJC,KAAK;IACLA,KAAA,EAAO;MACLC,KAAA,EAAO;QACLC,YAAY;QACZC,SAAS;QACTC,WAAW;QACXC;MAAW,CACZ,GAAG,CAAC,CAA4C;MACjDC,KAAK;MACLC,SAAS;MACTC;IAAQ,CACT,GAAG,CAAC,CAAmC;IACxCC,IAAI;IACJC,QAAQ;IACRC;EAAQ,CACT,GAAGZ,KAAA;EAEJ,MAAM;IAAEa;EAAI,CAAE,GAAGlB,cAAA;EAEjB,MAAMmB,g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AA;QACVwB,EAAA,EAAI,SAASzB,IAAA,CAAK0B,OAAO,CAAC,OAAO,OAAO;QACxCC,IAAA,EAAM3B,IAAA;QACN4B,QAAA,EAAUf,QAAA;QACVjB,WAAA,EAAapB,cAAA,CAAeoB,WAAA,EAAaO,IAAA;QACzCJ,QAAA,EAAUA,QAAA;QACV8B,IAAA,EAAK;QACLxB,KAAA,EAAOA,OAAC,IAAoB;UAE7BG,UAAA;qBAEHa,IAAA,CAACzC,qBAAA;MACC0C,eAAA,EAAiBZ,WAAA;MACjBa,QAAA,eAAUF,IAAA,CAACxC,gBAAA;QAAiBc,WAAA,EAAaA,WAAA;QAAaK,IAAA,EAAMA;;;;AAIpE;AAEA,OAAO,MAAM8B,UAAA,GAAa9C,aAAA,CAAcK,mBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Group/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAGxD,OAAO,KAAK,MAAM,OAAO,CAAA;AAezB,OAAO,cAAc,CAAA;AACrB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAIvD,eAAO,MAAM,mBAAmB,EAAE,yBAwFjC,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAA;AAElC,eAAO,MAAM,UAAU;;+EAAqC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Group/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAGxD,OAAO,KAAkB,MAAM,OAAO,CAAA;AAetC,OAAO,cAAc,CAAA;AAErB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAIvD,eAAO,MAAM,mBAAmB,EAAE,yBAmFjC,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAA;AAElC,eAAO,MAAM,UAAU;;+EAAqC,CAAA"}