@commercetools/nimbus 0.0.0-canary-20250922152719 → 0.0.0-canary-20250922155413

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.
@@ -0,0 +1,225 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { defineMessages as b, FormattedMessage as a } from "react-intl";
3
+ import { createSlotRecipeContext as p } from "@chakra-ui/react/styled-system";
4
+ import { defineSlotRecipe as T } from "@chakra-ui/react";
5
+ const M = /* @__PURE__ */ T({
6
+ className: "nimbus-field-errors",
7
+ slots: ["root"],
8
+ base: {
9
+ root: {
10
+ display: "block"
11
+ }
12
+ }
13
+ }), { withProvider: O } = /* @__PURE__ */ p({
14
+ recipe: M
15
+ }), h = /* @__PURE__ */ O("div", "root"), l = /* @__PURE__ */ b({
16
+ // Basic validation
17
+ missingRequiredField: {
18
+ id: "Nimbus.FieldErrors.missingRequiredField",
19
+ description: "Error message for missing required value",
20
+ defaultMessage: "This field is required. Provide a value."
21
+ },
22
+ invalidValue: {
23
+ id: "Nimbus.FieldErrors.invalidValue",
24
+ description: "Error message for invalid value or format",
25
+ defaultMessage: "The provided value is invalid."
26
+ },
27
+ emptyValue: {
28
+ id: "Nimbus.FieldErrors.emptyValue",
29
+ description: "Error message for empty value when content is required",
30
+ defaultMessage: "This field cannot be empty."
31
+ },
32
+ // Length validation
33
+ valueTooShort: {
34
+ id: "Nimbus.FieldErrors.valueTooShort",
35
+ description: "Error message for minimum length validation",
36
+ defaultMessage: "This value is too short."
37
+ },
38
+ valueTooLong: {
39
+ id: "Nimbus.FieldErrors.valueTooLong",
40
+ description: "Error message for maximum length validation",
41
+ defaultMessage: "This value is too long."
42
+ },
43
+ // Format validation
44
+ invalidFormat: {
45
+ id: "Nimbus.FieldErrors.invalidFormat",
46
+ description: "Error message for format validation",
47
+ defaultMessage: "Please enter a valid format."
48
+ },
49
+ duplicateValue: {
50
+ id: "Nimbus.FieldErrors.duplicateValue",
51
+ description: "Error message for duplicate value validation",
52
+ defaultMessage: "This value is already in use. It must be unique."
53
+ },
54
+ // Numeric validation
55
+ invalidNegativeNumber: {
56
+ id: "Nimbus.FieldErrors.invalidNegativeNumber",
57
+ description: "Error message when negative number is used",
58
+ defaultMessage: "Negative number is not supported."
59
+ },
60
+ invalidFractionalNumber: {
61
+ id: "Nimbus.FieldErrors.invalidFractionalNumber",
62
+ description: "Error message when fractional number is used",
63
+ defaultMessage: "A whole number is required."
64
+ },
65
+ valueBelowMinimum: {
66
+ id: "Nimbus.FieldErrors.valueBelowMinimum",
67
+ description: "Error message for values below minimum threshold",
68
+ defaultMessage: "Value must be greater than or equal to the minimum."
69
+ },
70
+ valueAboveMaximum: {
71
+ id: "Nimbus.FieldErrors.valueAboveMaximum",
72
+ description: "Error message for values above maximum threshold",
73
+ defaultMessage: "Value must be less than or equal to the maximum."
74
+ },
75
+ valueOutOfRange: {
76
+ id: "Nimbus.FieldErrors.valueOutOfRange",
77
+ description: "Error message for values outside acceptable range",
78
+ defaultMessage: "Value must be within the acceptable range."
79
+ },
80
+ // Server/async validation
81
+ invalidFromServer: {
82
+ id: "Nimbus.FieldErrors.invalidFromServer",
83
+ description: "Error message for server-side validation errors",
84
+ defaultMessage: "Server validation failed. Please check your input."
85
+ },
86
+ resourceNotFound: {
87
+ id: "Nimbus.FieldErrors.resourceNotFound",
88
+ description: "Error message when a resource is not found",
89
+ defaultMessage: "The requested resource was not found."
90
+ },
91
+ valueBlocked: {
92
+ id: "Nimbus.FieldErrors.valueBlocked",
93
+ description: "Error message for blocked or restricted values",
94
+ defaultMessage: "This value is not allowed."
95
+ }
96
+ }), e = {
97
+ // Basic validation
98
+ MISSING: "missing",
99
+ INVALID: "invalid",
100
+ EMPTY: "empty",
101
+ // Length validation
102
+ MIN_LENGTH: "min",
103
+ MAX_LENGTH: "max",
104
+ // Format validation
105
+ FORMAT: "format",
106
+ DUPLICATE: "duplicate",
107
+ // Numeric validation
108
+ NEGATIVE: "negative",
109
+ FRACTIONS: "fractions",
110
+ BELOW_MIN: "belowMin",
111
+ ABOVE_MAX: "aboveMax",
112
+ OUT_OF_RANGE: "outOfRange",
113
+ // Server/async validation
114
+ INVALID_FROM_SERVER: "invalidFromServer",
115
+ NOT_FOUND: "notFound",
116
+ BLOCKED: "blocked"
117
+ }, I = (t) => typeof t == "object", A = (t, r) => {
118
+ if (!r) return null;
119
+ switch (t) {
120
+ case e.MISSING:
121
+ return r.missing || null;
122
+ case e.INVALID:
123
+ return r.invalid || null;
124
+ case e.EMPTY:
125
+ return r.empty || null;
126
+ case e.MIN_LENGTH:
127
+ return r.min || null;
128
+ case e.MAX_LENGTH:
129
+ return r.max || null;
130
+ case e.FORMAT:
131
+ return r.format || null;
132
+ case e.DUPLICATE:
133
+ return r.duplicate || null;
134
+ case e.NEGATIVE:
135
+ return r.negative || null;
136
+ case e.FRACTIONS:
137
+ return r.fractions || null;
138
+ case e.BELOW_MIN:
139
+ return r.belowMin || null;
140
+ case e.ABOVE_MAX:
141
+ return r.aboveMax || null;
142
+ case e.OUT_OF_RANGE:
143
+ return r.outOfRange || null;
144
+ case e.INVALID_FROM_SERVER:
145
+ return r.invalidFromServer || null;
146
+ case e.NOT_FOUND:
147
+ return r.notFound || null;
148
+ case e.BLOCKED:
149
+ return r.blocked || null;
150
+ default:
151
+ return null;
152
+ }
153
+ }, R = (t) => {
154
+ switch (t) {
155
+ // Basic validation
156
+ case e.MISSING:
157
+ return /* @__PURE__ */ i(a, { ...l.missingRequiredField });
158
+ case e.INVALID:
159
+ return /* @__PURE__ */ i(a, { ...l.invalidValue });
160
+ case e.EMPTY:
161
+ return /* @__PURE__ */ i(a, { ...l.emptyValue });
162
+ // Length validation
163
+ case e.MIN_LENGTH:
164
+ return /* @__PURE__ */ i(a, { ...l.valueTooShort });
165
+ case e.MAX_LENGTH:
166
+ return /* @__PURE__ */ i(a, { ...l.valueTooLong });
167
+ // Format validation
168
+ case e.FORMAT:
169
+ return /* @__PURE__ */ i(a, { ...l.invalidFormat });
170
+ case e.DUPLICATE:
171
+ return /* @__PURE__ */ i(a, { ...l.duplicateValue });
172
+ // Numeric validation
173
+ case e.NEGATIVE:
174
+ return /* @__PURE__ */ i(a, { ...l.invalidNegativeNumber });
175
+ case e.FRACTIONS:
176
+ return /* @__PURE__ */ i(a, { ...l.invalidFractionalNumber });
177
+ case e.BELOW_MIN:
178
+ return /* @__PURE__ */ i(a, { ...l.valueBelowMinimum });
179
+ case e.ABOVE_MAX:
180
+ return /* @__PURE__ */ i(a, { ...l.valueAboveMaximum });
181
+ case e.OUT_OF_RANGE:
182
+ return /* @__PURE__ */ i(a, { ...l.valueOutOfRange });
183
+ // Server/async validation
184
+ case e.INVALID_FROM_SERVER:
185
+ return /* @__PURE__ */ i(a, { ...l.invalidFromServer });
186
+ case e.NOT_FOUND:
187
+ return /* @__PURE__ */ i(a, { ...l.resourceNotFound });
188
+ case e.BLOCKED:
189
+ return /* @__PURE__ */ i(a, { ...l.valueBlocked });
190
+ default:
191
+ return null;
192
+ }
193
+ }, v = ({
194
+ id: t,
195
+ errors: r,
196
+ isVisible: E = !0,
197
+ // Default to true for backwards compatibility, but will be auto-handled in future
198
+ renderError: f,
199
+ renderDefaultError: N,
200
+ customMessages: F,
201
+ ...g
202
+ }) => {
203
+ if (!E || !r || !I(r)) return null;
204
+ const o = Object.entries(r).filter(([, n]) => n);
205
+ return o.length === 0 ? null : /* @__PURE__ */ i(h, { id: t, role: "alert", ...g, children: o.map(([n, u]) => {
206
+ const s = f?.(n, u);
207
+ if (s)
208
+ return /* @__PURE__ */ i("div", { children: s }, n);
209
+ const d = N?.(n, u);
210
+ if (d)
211
+ return /* @__PURE__ */ i("div", { children: d }, n);
212
+ const m = A(n, F);
213
+ if (m)
214
+ return /* @__PURE__ */ i("div", { children: m }, n);
215
+ const c = R(n);
216
+ return c ? /* @__PURE__ */ i("div", { children: c }, n) : null;
217
+ }) });
218
+ };
219
+ v.displayName = "FieldErrors";
220
+ v.errorTypes = e;
221
+ export {
222
+ v as F,
223
+ e as a
224
+ };
225
+ //# sourceMappingURL=field-errors-CcQ1ssQj.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-errors-CcQ1ssQj.es.js","sources":["../../src/components/field-errors/field-errors.recipe.tsx","../../src/components/field-errors/field-errors.slots.tsx","../../src/components/field-errors/field-errors.i18n.ts","../../src/components/field-errors/field-errors.types.ts","../../src/components/field-errors/field-errors.tsx"],"sourcesContent":["import { defineSlotRecipe } from \"@chakra-ui/react\";\n\nexport const fieldErrorsRecipe = defineSlotRecipe({\n className: \"nimbus-field-errors\",\n slots: [\"root\"],\n base: {\n root: {\n display: \"block\",\n },\n },\n});\n","import { createSlotRecipeContext } from \"@chakra-ui/react/styled-system\";\nimport { fieldErrorsRecipe } from \"./field-errors.recipe\";\nimport type { FieldErrorsRootProps } from \"./field-errors.types\";\n\nconst { withProvider } = createSlotRecipeContext({\n recipe: fieldErrorsRecipe,\n});\n\nexport const FieldErrorsRoot = withProvider<\n HTMLDivElement,\n FieldErrorsRootProps\n>(\"div\", \"root\");\n","import { defineMessages } from \"react-intl\";\n\nexport const messages = defineMessages({\n // Basic validation\n missingRequiredField: {\n id: \"Nimbus.FieldErrors.missingRequiredField\",\n description: \"Error message for missing required value\",\n defaultMessage: \"This field is required. Provide a value.\",\n },\n invalidValue: {\n id: \"Nimbus.FieldErrors.invalidValue\",\n description: \"Error message for invalid value or format\",\n defaultMessage: \"The provided value is invalid.\",\n },\n emptyValue: {\n id: \"Nimbus.FieldErrors.emptyValue\",\n description: \"Error message for empty value when content is required\",\n defaultMessage: \"This field cannot be empty.\",\n },\n\n // Length validation\n valueTooShort: {\n id: \"Nimbus.FieldErrors.valueTooShort\",\n description: \"Error message for minimum length validation\",\n defaultMessage: \"This value is too short.\",\n },\n valueTooLong: {\n id: \"Nimbus.FieldErrors.valueTooLong\",\n description: \"Error message for maximum length validation\",\n defaultMessage: \"This value is too long.\",\n },\n\n // Format validation\n invalidFormat: {\n id: \"Nimbus.FieldErrors.invalidFormat\",\n description: \"Error message for format validation\",\n defaultMessage: \"Please enter a valid format.\",\n },\n duplicateValue: {\n id: \"Nimbus.FieldErrors.duplicateValue\",\n description: \"Error message for duplicate value validation\",\n defaultMessage: \"This value is already in use. It must be unique.\",\n },\n\n // Numeric validation\n invalidNegativeNumber: {\n id: \"Nimbus.FieldErrors.invalidNegativeNumber\",\n description: \"Error message when negative number is used\",\n defaultMessage: \"Negative number is not supported.\",\n },\n invalidFractionalNumber: {\n id: \"Nimbus.FieldErrors.invalidFractionalNumber\",\n description: \"Error message when fractional number is used\",\n defaultMessage: \"A whole number is required.\",\n },\n valueBelowMinimum: {\n id: \"Nimbus.FieldErrors.valueBelowMinimum\",\n description: \"Error message for values below minimum threshold\",\n defaultMessage: \"Value must be greater than or equal to the minimum.\",\n },\n valueAboveMaximum: {\n id: \"Nimbus.FieldErrors.valueAboveMaximum\",\n description: \"Error message for values above maximum threshold\",\n defaultMessage: \"Value must be less than or equal to the maximum.\",\n },\n valueOutOfRange: {\n id: \"Nimbus.FieldErrors.valueOutOfRange\",\n description: \"Error message for values outside acceptable range\",\n defaultMessage: \"Value must be within the acceptable range.\",\n },\n\n // Server/async validation\n invalidFromServer: {\n id: \"Nimbus.FieldErrors.invalidFromServer\",\n description: \"Error message for server-side validation errors\",\n defaultMessage: \"Server validation failed. Please check your input.\",\n },\n resourceNotFound: {\n id: \"Nimbus.FieldErrors.resourceNotFound\",\n description: \"Error message when a resource is not found\",\n defaultMessage: \"The requested resource was not found.\",\n },\n valueBlocked: {\n id: \"Nimbus.FieldErrors.valueBlocked\",\n description: \"Error message for blocked or restricted values\",\n defaultMessage: \"This value is not allowed.\",\n },\n});\n","import type { ReactNode } from \"react\";\n\n/**\n * Error object type - compatible with UI-Kit FieldErrors\n * Only entries with truthy values will be rendered as errors\n */\nexport type TFieldErrors = Record<string, boolean>;\n\n/**\n * Function to render custom error messages\n */\nexport type TErrorRenderer = (key: string, error?: boolean) => ReactNode;\n\n/**\n * Props for FieldErrors component\n */\nexport interface FieldErrorsProps {\n /**\n * ID of the error field for accessibility\n */\n id?: string;\n\n /**\n * Error object - only truthy values will be rendered\n * Compatible with UI-Kit FieldErrors format\n */\n errors?: TFieldErrors;\n\n /**\n * Whether error messages should be visible\n * @deprecated This prop will be automatically handled by the component\n */\n isVisible?: boolean;\n\n /**\n * Custom error renderer function\n * Return null to fall back to renderDefaultError or built-in errors\n */\n renderError?: TErrorRenderer;\n\n /**\n * Default error renderer function for errors not handled by renderError\n * Return null to fall back to built-in error handling\n */\n renderDefaultError?: TErrorRenderer;\n\n /**\n * Custom error messages to override built-in ones\n */\n customMessages?: {\n // Basic validation\n missing?: ReactNode;\n invalid?: ReactNode;\n empty?: ReactNode;\n\n // Length validation\n min?: ReactNode;\n max?: ReactNode;\n\n // Format validation\n format?: ReactNode;\n duplicate?: ReactNode;\n\n // Numeric validation\n negative?: ReactNode;\n fractions?: ReactNode;\n belowMin?: ReactNode;\n aboveMax?: ReactNode;\n outOfRange?: ReactNode;\n\n // Server/async validation\n invalidFromServer?: ReactNode;\n notFound?: ReactNode;\n blocked?: ReactNode;\n };\n}\n\n/**\n * Built-in error types that FieldErrors can handle automatically\n */\nexport const FieldErrorTypes = {\n // Basic validation\n MISSING: \"missing\",\n INVALID: \"invalid\",\n EMPTY: \"empty\",\n\n // Length validation\n MIN_LENGTH: \"min\",\n MAX_LENGTH: \"max\",\n\n // Format validation\n FORMAT: \"format\",\n DUPLICATE: \"duplicate\",\n\n // Numeric validation\n NEGATIVE: \"negative\",\n FRACTIONS: \"fractions\",\n BELOW_MIN: \"belowMin\",\n ABOVE_MAX: \"aboveMax\",\n OUT_OF_RANGE: \"outOfRange\",\n\n // Server/async validation\n INVALID_FROM_SERVER: \"invalidFromServer\",\n NOT_FOUND: \"notFound\",\n BLOCKED: \"blocked\",\n} as const;\n\nexport type TFieldErrorTypes =\n (typeof FieldErrorTypes)[keyof typeof FieldErrorTypes];\n\n/**\n * Props for FieldErrors root slot\n */\nexport interface FieldErrorsRootProps {\n id?: string;\n role?: string;\n children?: ReactNode;\n}\n","import { FormattedMessage } from \"react-intl\";\nimport { FieldErrorsRoot } from \"./field-errors.slots\";\nimport { messages } from \"./field-errors.i18n\";\nimport type { FieldErrorsProps } from \"./field-errors.types\";\nimport { FieldErrorTypes } from \"./field-errors.types\";\n\nconst isObject = (obj: unknown): boolean => typeof obj === \"object\";\n\n/**\n * Get custom message for a given error key\n */\nconst getCustomMessage = (\n key: string,\n customMessages?: FieldErrorsProps[\"customMessages\"]\n): React.ReactNode => {\n if (!customMessages) return null;\n\n // Map error keys to custom messages\n switch (key) {\n case FieldErrorTypes.MISSING:\n return customMessages.missing || null;\n case FieldErrorTypes.INVALID:\n return customMessages.invalid || null;\n case FieldErrorTypes.EMPTY:\n return customMessages.empty || null;\n case FieldErrorTypes.MIN_LENGTH:\n return customMessages.min || null;\n case FieldErrorTypes.MAX_LENGTH:\n return customMessages.max || null;\n case FieldErrorTypes.FORMAT:\n return customMessages.format || null;\n case FieldErrorTypes.DUPLICATE:\n return customMessages.duplicate || null;\n case FieldErrorTypes.NEGATIVE:\n return customMessages.negative || null;\n case FieldErrorTypes.FRACTIONS:\n return customMessages.fractions || null;\n case FieldErrorTypes.BELOW_MIN:\n return customMessages.belowMin || null;\n case FieldErrorTypes.ABOVE_MAX:\n return customMessages.aboveMax || null;\n case FieldErrorTypes.OUT_OF_RANGE:\n return customMessages.outOfRange || null;\n case FieldErrorTypes.INVALID_FROM_SERVER:\n return customMessages.invalidFromServer || null;\n case FieldErrorTypes.NOT_FOUND:\n return customMessages.notFound || null;\n case FieldErrorTypes.BLOCKED:\n return customMessages.blocked || null;\n default:\n return null;\n }\n};\n\n/**\n * Get built-in localized message for a given error key\n */\nconst getBuiltInMessage = (key: string): React.ReactNode => {\n switch (key) {\n // Basic validation\n case FieldErrorTypes.MISSING:\n return <FormattedMessage {...messages.missingRequiredField} />;\n case FieldErrorTypes.INVALID:\n return <FormattedMessage {...messages.invalidValue} />;\n case FieldErrorTypes.EMPTY:\n return <FormattedMessage {...messages.emptyValue} />;\n\n // Length validation\n case FieldErrorTypes.MIN_LENGTH:\n return <FormattedMessage {...messages.valueTooShort} />;\n case FieldErrorTypes.MAX_LENGTH:\n return <FormattedMessage {...messages.valueTooLong} />;\n\n // Format validation\n case FieldErrorTypes.FORMAT:\n return <FormattedMessage {...messages.invalidFormat} />;\n case FieldErrorTypes.DUPLICATE:\n return <FormattedMessage {...messages.duplicateValue} />;\n\n // Numeric validation\n case FieldErrorTypes.NEGATIVE:\n return <FormattedMessage {...messages.invalidNegativeNumber} />;\n case FieldErrorTypes.FRACTIONS:\n return <FormattedMessage {...messages.invalidFractionalNumber} />;\n case FieldErrorTypes.BELOW_MIN:\n return <FormattedMessage {...messages.valueBelowMinimum} />;\n case FieldErrorTypes.ABOVE_MAX:\n return <FormattedMessage {...messages.valueAboveMaximum} />;\n case FieldErrorTypes.OUT_OF_RANGE:\n return <FormattedMessage {...messages.valueOutOfRange} />;\n\n // Server/async validation\n case FieldErrorTypes.INVALID_FROM_SERVER:\n return <FormattedMessage {...messages.invalidFromServer} />;\n case FieldErrorTypes.NOT_FOUND:\n return <FormattedMessage {...messages.resourceNotFound} />;\n case FieldErrorTypes.BLOCKED:\n return <FormattedMessage {...messages.valueBlocked} />;\n\n default:\n return null;\n }\n};\n\n/**\n * # FieldErrors\n *\n * Renders error messages based on error object configuration.\n * Provides backwards compatibility with UI-Kit FieldErrors while integrating\n * with Nimbus design system patterns.\n *\n * Supports custom error renderers and localized built-in error messages\n * for common validation scenarios like missing required fields.\n */\nexport const FieldErrors = ({\n id,\n errors,\n isVisible = true, // Default to true for backwards compatibility, but will be auto-handled in future\n renderError,\n renderDefaultError,\n customMessages,\n ...props\n}: FieldErrorsProps) => {\n // Don't render if not visible or no errors\n if (!isVisible) return null;\n if (!errors || !isObject(errors)) return null;\n\n // Filter to only show truthy errors\n const activeErrors = Object.entries(errors).filter(([, error]) => error);\n\n // Don't render if no active errors\n if (activeErrors.length === 0) return null;\n\n return (\n <FieldErrorsRoot id={id} role=\"alert\" {...props}>\n {activeErrors.map(([key, error]) => {\n // Try custom error renderer first\n const customErrorElement = renderError?.(key, error);\n if (customErrorElement) {\n return <div key={key}>{customErrorElement}</div>;\n }\n\n // Try default error renderer second\n const defaultErrorElement = renderDefaultError?.(key, error);\n if (defaultErrorElement) {\n return <div key={key}>{defaultErrorElement}</div>;\n }\n\n // Try custom messages for built-in error types first\n const customMessage = getCustomMessage(key, customMessages);\n if (customMessage) {\n return <div key={key}>{customMessage}</div>;\n }\n\n // Fall back to built-in localized messages\n const builtInMessage = getBuiltInMessage(key);\n if (builtInMessage) {\n return <div key={key}>{builtInMessage}</div>;\n }\n\n // If no renderer handles it, render nothing\n return null;\n })}\n </FieldErrorsRoot>\n );\n};\n\n// Static properties for backwards compatibility with UI-Kit\nFieldErrors.displayName = \"FieldErrors\";\nFieldErrors.errorTypes = FieldErrorTypes;\n"],"names":["fieldErrorsRecipe","defineSlotRecipe","withProvider","createSlotRecipeContext","FieldErrorsRoot","messages","defineMessages","FieldErrorTypes","isObject","obj","getCustomMessage","key","customMessages","getBuiltInMessage","jsx","FormattedMessage","FieldErrors","id","errors","isVisible","renderError","renderDefaultError","props","activeErrors","error","customErrorElement","defaultErrorElement","customMessage","builtInMessage"],"mappings":";;;;AAEO,MAAMA,IAAoB,gBAAAC,EAAiB;AAAA,EAChD,WAAW;AAAA,EACX,OAAO,CAAC,MAAM;AAAA,EACd,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ,CAAC,GCNK,EAAE,cAAAC,EAAA,IAAiB,gBAAAC,EAAwB;AAAA,EAC/C,QAAQH;AACV,CAAC,GAEYI,IAAkB,gBAAAF,EAG7B,OAAO,MAAM,GCTFG,IAAW,gBAAAC,EAAe;AAAA;AAAA,EAErC,sBAAsB;AAAA,IACpB,IAAI;AAAA,IACJ,aAAa;AAAA,IACb,gBAAgB;AAAA,EAAA;AAA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BF,CAAG;AAC5C,WAAIiB,IACK,gBAAAd,EAAC,OAAA,EAAe,UAAAc,EAAA,GAANjB,CAAqB,IAIjC;AAAA,EACT,CAAC,EAAA,CACH;AAEJ;AAGAK,EAAY,cAAc;AAC1BA,EAAY,aAAaT;"}
@@ -0,0 +1,2 @@
1
+ "use strict";const i=require("react/jsx-runtime"),a=require("react-intl"),M=require("@chakra-ui/react/styled-system"),b=require("@chakra-ui/react"),p=b.defineSlotRecipe({className:"nimbus-field-errors",slots:["root"],base:{root:{display:"block"}}}),{withProvider:T}=M.createSlotRecipeContext({recipe:p}),O=T("div","root"),s=a.defineMessages({missingRequiredField:{id:"Nimbus.FieldErrors.missingRequiredField",description:"Error message for missing required value",defaultMessage:"This field is required. Provide a value."},invalidValue:{id:"Nimbus.FieldErrors.invalidValue",description:"Error message for invalid value or format",defaultMessage:"The provided value is invalid."},emptyValue:{id:"Nimbus.FieldErrors.emptyValue",description:"Error message for empty value when content is required",defaultMessage:"This field cannot be empty."},valueTooShort:{id:"Nimbus.FieldErrors.valueTooShort",description:"Error message for minimum length validation",defaultMessage:"This value is too short."},valueTooLong:{id:"Nimbus.FieldErrors.valueTooLong",description:"Error message for maximum length validation",defaultMessage:"This value is too long."},invalidFormat:{id:"Nimbus.FieldErrors.invalidFormat",description:"Error message for format validation",defaultMessage:"Please enter a valid format."},duplicateValue:{id:"Nimbus.FieldErrors.duplicateValue",description:"Error message for duplicate value validation",defaultMessage:"This value is already in use. It must be unique."},invalidNegativeNumber:{id:"Nimbus.FieldErrors.invalidNegativeNumber",description:"Error message when negative number is used",defaultMessage:"Negative number is not supported."},invalidFractionalNumber:{id:"Nimbus.FieldErrors.invalidFractionalNumber",description:"Error message when fractional number is used",defaultMessage:"A whole number is required."},valueBelowMinimum:{id:"Nimbus.FieldErrors.valueBelowMinimum",description:"Error message for values below minimum threshold",defaultMessage:"Value must be greater than or equal to the minimum."},valueAboveMaximum:{id:"Nimbus.FieldErrors.valueAboveMaximum",description:"Error message for values above maximum threshold",defaultMessage:"Value must be less than or equal to the maximum."},valueOutOfRange:{id:"Nimbus.FieldErrors.valueOutOfRange",description:"Error message for values outside acceptable range",defaultMessage:"Value must be within the acceptable range."},invalidFromServer:{id:"Nimbus.FieldErrors.invalidFromServer",description:"Error message for server-side validation errors",defaultMessage:"Server validation failed. Please check your input."},resourceNotFound:{id:"Nimbus.FieldErrors.resourceNotFound",description:"Error message when a resource is not found",defaultMessage:"The requested resource was not found."},valueBlocked:{id:"Nimbus.FieldErrors.valueBlocked",description:"Error message for blocked or restricted values",defaultMessage:"This value is not allowed."}}),e={MISSING:"missing",INVALID:"invalid",EMPTY:"empty",MIN_LENGTH:"min",MAX_LENGTH:"max",FORMAT:"format",DUPLICATE:"duplicate",NEGATIVE:"negative",FRACTIONS:"fractions",BELOW_MIN:"belowMin",ABOVE_MAX:"aboveMax",OUT_OF_RANGE:"outOfRange",INVALID_FROM_SERVER:"invalidFromServer",NOT_FOUND:"notFound",BLOCKED:"blocked"},h=l=>typeof l=="object",I=(l,r)=>{if(!r)return null;switch(l){case e.MISSING:return r.missing||null;case e.INVALID:return r.invalid||null;case e.EMPTY:return r.empty||null;case e.MIN_LENGTH:return r.min||null;case e.MAX_LENGTH:return r.max||null;case e.FORMAT:return r.format||null;case e.DUPLICATE:return r.duplicate||null;case e.NEGATIVE:return r.negative||null;case e.FRACTIONS:return r.fractions||null;case e.BELOW_MIN:return r.belowMin||null;case e.ABOVE_MAX:return r.aboveMax||null;case e.OUT_OF_RANGE:return r.outOfRange||null;case e.INVALID_FROM_SERVER:return r.invalidFromServer||null;case e.NOT_FOUND:return r.notFound||null;case e.BLOCKED:return r.blocked||null;default:return null}},A=l=>{switch(l){case e.MISSING:return i.jsx(a.FormattedMessage,{...s.missingRequiredField});case e.INVALID:return i.jsx(a.FormattedMessage,{...s.invalidValue});case e.EMPTY:return i.jsx(a.FormattedMessage,{...s.emptyValue});case e.MIN_LENGTH:return i.jsx(a.FormattedMessage,{...s.valueTooShort});case e.MAX_LENGTH:return i.jsx(a.FormattedMessage,{...s.valueTooLong});case e.FORMAT:return i.jsx(a.FormattedMessage,{...s.invalidFormat});case e.DUPLICATE:return i.jsx(a.FormattedMessage,{...s.duplicateValue});case e.NEGATIVE:return i.jsx(a.FormattedMessage,{...s.invalidNegativeNumber});case e.FRACTIONS:return i.jsx(a.FormattedMessage,{...s.invalidFractionalNumber});case e.BELOW_MIN:return i.jsx(a.FormattedMessage,{...s.valueBelowMinimum});case e.ABOVE_MAX:return i.jsx(a.FormattedMessage,{...s.valueAboveMaximum});case e.OUT_OF_RANGE:return i.jsx(a.FormattedMessage,{...s.valueOutOfRange});case e.INVALID_FROM_SERVER:return i.jsx(a.FormattedMessage,{...s.invalidFromServer});case e.NOT_FOUND:return i.jsx(a.FormattedMessage,{...s.resourceNotFound});case e.BLOCKED:return i.jsx(a.FormattedMessage,{...s.valueBlocked});default:return null}},o=({id:l,errors:r,isVisible:E=!0,renderError:F,renderDefaultError:g,customMessages:N,...f})=>{if(!E||!r||!h(r))return null;const n=Object.entries(r).filter(([,t])=>t);return n.length===0?null:i.jsx(O,{id:l,role:"alert",...f,children:n.map(([t,u])=>{const d=F?.(t,u);if(d)return i.jsx("div",{children:d},t);const m=g?.(t,u);if(m)return i.jsx("div",{children:m},t);const c=I(t,N);if(c)return i.jsx("div",{children:c},t);const v=A(t);return v?i.jsx("div",{children:v},t):null})})};o.displayName="FieldErrors";o.errorTypes=e;exports.FieldErrorTypes=e;exports.FieldErrors=o;
2
+ //# sourceMappingURL=field-errors-Rzp3VbWz.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-errors-Rzp3VbWz.cjs.js","sources":["../../src/components/field-errors/field-errors.recipe.tsx","../../src/components/field-errors/field-errors.slots.tsx","../../src/components/field-errors/field-errors.i18n.ts","../../src/components/field-errors/field-errors.types.ts","../../src/components/field-errors/field-errors.tsx"],"sourcesContent":["import { defineSlotRecipe } from \"@chakra-ui/react\";\n\nexport const fieldErrorsRecipe = defineSlotRecipe({\n className: \"nimbus-field-errors\",\n slots: [\"root\"],\n base: {\n root: {\n display: \"block\",\n },\n },\n});\n","import { createSlotRecipeContext } from \"@chakra-ui/react/styled-system\";\nimport { fieldErrorsRecipe } from \"./field-errors.recipe\";\nimport type { FieldErrorsRootProps } from \"./field-errors.types\";\n\nconst { withProvider } = createSlotRecipeContext({\n recipe: fieldErrorsRecipe,\n});\n\nexport const FieldErrorsRoot = withProvider<\n HTMLDivElement,\n FieldErrorsRootProps\n>(\"div\", \"root\");\n","import { defineMessages } from \"react-intl\";\n\nexport const messages = defineMessages({\n // Basic validation\n missingRequiredField: {\n id: \"Nimbus.FieldErrors.missingRequiredField\",\n description: \"Error message for missing required value\",\n defaultMessage: \"This field is required. Provide a value.\",\n },\n invalidValue: {\n id: \"Nimbus.FieldErrors.invalidValue\",\n description: \"Error message for invalid value or format\",\n defaultMessage: \"The provided value is invalid.\",\n },\n emptyValue: {\n id: \"Nimbus.FieldErrors.emptyValue\",\n description: \"Error message for empty value when content is required\",\n defaultMessage: \"This field cannot be empty.\",\n },\n\n // Length validation\n valueTooShort: {\n id: \"Nimbus.FieldErrors.valueTooShort\",\n description: \"Error message for minimum length validation\",\n defaultMessage: \"This value is too short.\",\n },\n valueTooLong: {\n id: \"Nimbus.FieldErrors.valueTooLong\",\n description: \"Error message for maximum length validation\",\n defaultMessage: \"This value is too long.\",\n },\n\n // Format validation\n invalidFormat: {\n id: \"Nimbus.FieldErrors.invalidFormat\",\n description: \"Error message for format validation\",\n defaultMessage: \"Please enter a valid format.\",\n },\n duplicateValue: {\n id: \"Nimbus.FieldErrors.duplicateValue\",\n description: \"Error message for duplicate value validation\",\n defaultMessage: \"This value is already in use. It must be unique.\",\n },\n\n // Numeric validation\n invalidNegativeNumber: {\n id: \"Nimbus.FieldErrors.invalidNegativeNumber\",\n description: \"Error message when negative number is used\",\n defaultMessage: \"Negative number is not supported.\",\n },\n invalidFractionalNumber: {\n id: \"Nimbus.FieldErrors.invalidFractionalNumber\",\n description: \"Error message when fractional number is used\",\n defaultMessage: \"A whole number is required.\",\n },\n valueBelowMinimum: {\n id: \"Nimbus.FieldErrors.valueBelowMinimum\",\n description: \"Error message for values below minimum threshold\",\n defaultMessage: \"Value must be greater than or equal to the minimum.\",\n },\n valueAboveMaximum: {\n id: \"Nimbus.FieldErrors.valueAboveMaximum\",\n description: \"Error message for values above maximum threshold\",\n defaultMessage: \"Value must be less than or equal to the maximum.\",\n },\n valueOutOfRange: {\n id: \"Nimbus.FieldErrors.valueOutOfRange\",\n description: \"Error message for values outside acceptable range\",\n defaultMessage: \"Value must be within the acceptable range.\",\n },\n\n // Server/async validation\n invalidFromServer: {\n id: \"Nimbus.FieldErrors.invalidFromServer\",\n description: \"Error message for server-side validation errors\",\n defaultMessage: \"Server validation failed. Please check your input.\",\n },\n resourceNotFound: {\n id: \"Nimbus.FieldErrors.resourceNotFound\",\n description: \"Error message when a resource is not found\",\n defaultMessage: \"The requested resource was not found.\",\n },\n valueBlocked: {\n id: \"Nimbus.FieldErrors.valueBlocked\",\n description: \"Error message for blocked or restricted values\",\n defaultMessage: \"This value is not allowed.\",\n },\n});\n","import type { ReactNode } from \"react\";\n\n/**\n * Error object type - compatible with UI-Kit FieldErrors\n * Only entries with truthy values will be rendered as errors\n */\nexport type TFieldErrors = Record<string, boolean>;\n\n/**\n * Function to render custom error messages\n */\nexport type TErrorRenderer = (key: string, error?: boolean) => ReactNode;\n\n/**\n * Props for FieldErrors component\n */\nexport interface FieldErrorsProps {\n /**\n * ID of the error field for accessibility\n */\n id?: string;\n\n /**\n * Error object - only truthy values will be rendered\n * Compatible with UI-Kit FieldErrors format\n */\n errors?: TFieldErrors;\n\n /**\n * Whether error messages should be visible\n * @deprecated This prop will be automatically handled by the component\n */\n isVisible?: boolean;\n\n /**\n * Custom error renderer function\n * Return null to fall back to renderDefaultError or built-in errors\n */\n renderError?: TErrorRenderer;\n\n /**\n * Default error renderer function for errors not handled by renderError\n * Return null to fall back to built-in error handling\n */\n renderDefaultError?: TErrorRenderer;\n\n /**\n * Custom error messages to override built-in ones\n */\n customMessages?: {\n // Basic validation\n missing?: ReactNode;\n invalid?: ReactNode;\n empty?: ReactNode;\n\n // Length validation\n min?: ReactNode;\n max?: ReactNode;\n\n // Format validation\n format?: ReactNode;\n duplicate?: ReactNode;\n\n // Numeric validation\n negative?: ReactNode;\n fractions?: ReactNode;\n belowMin?: ReactNode;\n aboveMax?: ReactNode;\n outOfRange?: ReactNode;\n\n // Server/async validation\n invalidFromServer?: ReactNode;\n notFound?: ReactNode;\n blocked?: ReactNode;\n };\n}\n\n/**\n * Built-in error types that FieldErrors can handle automatically\n */\nexport const FieldErrorTypes = {\n // Basic validation\n MISSING: \"missing\",\n INVALID: \"invalid\",\n EMPTY: \"empty\",\n\n // Length validation\n MIN_LENGTH: \"min\",\n MAX_LENGTH: \"max\",\n\n // Format validation\n FORMAT: \"format\",\n DUPLICATE: \"duplicate\",\n\n // Numeric validation\n NEGATIVE: \"negative\",\n FRACTIONS: \"fractions\",\n BELOW_MIN: \"belowMin\",\n ABOVE_MAX: \"aboveMax\",\n OUT_OF_RANGE: \"outOfRange\",\n\n // Server/async validation\n INVALID_FROM_SERVER: \"invalidFromServer\",\n NOT_FOUND: \"notFound\",\n BLOCKED: \"blocked\",\n} as const;\n\nexport type TFieldErrorTypes =\n (typeof FieldErrorTypes)[keyof typeof FieldErrorTypes];\n\n/**\n * Props for FieldErrors root slot\n */\nexport interface FieldErrorsRootProps {\n id?: string;\n role?: string;\n children?: ReactNode;\n}\n","import { FormattedMessage } from \"react-intl\";\nimport { FieldErrorsRoot } from \"./field-errors.slots\";\nimport { messages } from \"./field-errors.i18n\";\nimport type { FieldErrorsProps } from \"./field-errors.types\";\nimport { FieldErrorTypes } from \"./field-errors.types\";\n\nconst isObject = (obj: unknown): boolean => typeof obj === \"object\";\n\n/**\n * Get custom message for a given error key\n */\nconst getCustomMessage = (\n key: string,\n customMessages?: FieldErrorsProps[\"customMessages\"]\n): React.ReactNode => {\n if (!customMessages) return null;\n\n // Map error keys to custom messages\n switch (key) {\n case FieldErrorTypes.MISSING:\n return customMessages.missing || null;\n case FieldErrorTypes.INVALID:\n return customMessages.invalid || null;\n case FieldErrorTypes.EMPTY:\n return customMessages.empty || null;\n case FieldErrorTypes.MIN_LENGTH:\n return customMessages.min || null;\n case FieldErrorTypes.MAX_LENGTH:\n return customMessages.max || null;\n case FieldErrorTypes.FORMAT:\n return customMessages.format || null;\n case FieldErrorTypes.DUPLICATE:\n return customMessages.duplicate || null;\n case FieldErrorTypes.NEGATIVE:\n return customMessages.negative || null;\n case FieldErrorTypes.FRACTIONS:\n return customMessages.fractions || null;\n case FieldErrorTypes.BELOW_MIN:\n return customMessages.belowMin || null;\n case FieldErrorTypes.ABOVE_MAX:\n return customMessages.aboveMax || null;\n case FieldErrorTypes.OUT_OF_RANGE:\n return customMessages.outOfRange || null;\n case FieldErrorTypes.INVALID_FROM_SERVER:\n return customMessages.invalidFromServer || null;\n case FieldErrorTypes.NOT_FOUND:\n return customMessages.notFound || null;\n case FieldErrorTypes.BLOCKED:\n return customMessages.blocked || null;\n default:\n return null;\n }\n};\n\n/**\n * Get built-in localized message for a given error key\n */\nconst getBuiltInMessage = (key: string): React.ReactNode => {\n switch (key) {\n // Basic validation\n case FieldErrorTypes.MISSING:\n return <FormattedMessage {...messages.missingRequiredField} />;\n case FieldErrorTypes.INVALID:\n return <FormattedMessage {...messages.invalidValue} />;\n case FieldErrorTypes.EMPTY:\n return <FormattedMessage {...messages.emptyValue} />;\n\n // Length validation\n case FieldErrorTypes.MIN_LENGTH:\n return <FormattedMessage {...messages.valueTooShort} />;\n case FieldErrorTypes.MAX_LENGTH:\n return <FormattedMessage {...messages.valueTooLong} />;\n\n // Format validation\n case FieldErrorTypes.FORMAT:\n return <FormattedMessage {...messages.invalidFormat} />;\n case FieldErrorTypes.DUPLICATE:\n return <FormattedMessage {...messages.duplicateValue} />;\n\n // Numeric validation\n case FieldErrorTypes.NEGATIVE:\n return <FormattedMessage {...messages.invalidNegativeNumber} />;\n case FieldErrorTypes.FRACTIONS:\n return <FormattedMessage {...messages.invalidFractionalNumber} />;\n case FieldErrorTypes.BELOW_MIN:\n return <FormattedMessage {...messages.valueBelowMinimum} />;\n case FieldErrorTypes.ABOVE_MAX:\n return <FormattedMessage {...messages.valueAboveMaximum} />;\n case FieldErrorTypes.OUT_OF_RANGE:\n return <FormattedMessage {...messages.valueOutOfRange} />;\n\n // Server/async validation\n case FieldErrorTypes.INVALID_FROM_SERVER:\n return <FormattedMessage {...messages.invalidFromServer} />;\n case FieldErrorTypes.NOT_FOUND:\n return <FormattedMessage {...messages.resourceNotFound} />;\n case FieldErrorTypes.BLOCKED:\n return <FormattedMessage {...messages.valueBlocked} />;\n\n default:\n return null;\n }\n};\n\n/**\n * # FieldErrors\n *\n * Renders error messages based on error object configuration.\n * Provides backwards compatibility with UI-Kit FieldErrors while integrating\n * with Nimbus design system patterns.\n *\n * Supports custom error renderers and localized built-in error messages\n * for common validation scenarios like missing required fields.\n */\nexport const FieldErrors = ({\n id,\n errors,\n isVisible = true, // Default to true for backwards compatibility, but will be auto-handled in future\n renderError,\n renderDefaultError,\n customMessages,\n ...props\n}: FieldErrorsProps) => {\n // Don't render if not visible or no errors\n if (!isVisible) return null;\n if (!errors || !isObject(errors)) return null;\n\n // Filter to only show truthy errors\n const activeErrors = Object.entries(errors).filter(([, error]) => error);\n\n // Don't render if no active errors\n if (activeErrors.length === 0) return null;\n\n return (\n <FieldErrorsRoot id={id} role=\"alert\" {...props}>\n {activeErrors.map(([key, error]) => {\n // Try custom error renderer first\n const customErrorElement = renderError?.(key, error);\n if (customErrorElement) {\n return <div key={key}>{customErrorElement}</div>;\n }\n\n // Try default error renderer second\n const defaultErrorElement = renderDefaultError?.(key, error);\n if (defaultErrorElement) {\n return <div key={key}>{defaultErrorElement}</div>;\n }\n\n // Try custom messages for built-in error types first\n const customMessage = getCustomMessage(key, customMessages);\n if (customMessage) {\n return <div key={key}>{customMessage}</div>;\n }\n\n // Fall back to built-in localized messages\n const builtInMessage = getBuiltInMessage(key);\n if (builtInMessage) {\n return <div key={key}>{builtInMessage}</div>;\n }\n\n // If no renderer handles it, render nothing\n return null;\n })}\n </FieldErrorsRoot>\n );\n};\n\n// Static properties for backwards compatibility with UI-Kit\nFieldErrors.displayName = \"FieldErrors\";\nFieldErrors.errorTypes = FieldErrorTypes;\n"],"names":["fieldErrorsRecipe","defineSlotRecipe","withProvider","createSlotRecipeContext","FieldErrorsRoot","messages","defineMessages","FieldErrorTypes","isObject","obj","getCustomMessage","key","customMessages","getBuiltInMessage","jsx","FormattedMessage","FieldErrors","id","errors","isVisible","renderError","renderDefaultError","props","activeErrors","error","customErrorElement","defaultErrorElement","customMessage","builtInMessage"],"mappings":"oJAEaA,EAAoBC,EAAAA,iBAAiB,CAChD,UAAW,sBACX,MAAO,CAAC,MAAM,EACd,KAAM,CACJ,KAAM,CACJ,QAAS,OAAA,CACX,CAEJ,CAAC,ECNK,CAAE,aAAAC,CAAA,EAAiBC,0BAAwB,CAC/C,OAAQH,CACV,CAAC,EAEYI,EAAkBF,EAG7B,MAAO,MAAM,ECTFG,EAAWC,EAAAA,eAAe,CAErC,qBAAsB,CACpB,GAAI,0CACJ,YAAa,2CACb,eAAgB,0CAAA,EAElB,aAAc,CACZ,GAAI,kCACJ,YAAa,4CACb,eAAgB,gCAAA,EAElB,WAAY,CACV,GAAI,gCACJ,YAAa,yDACb,eAAgB,6BAAA,EAIlB,cAAe,CACb,GAAI,mCACJ,YAAa,8CACb,eAAgB,0BAAA,EAElB,aAAc,CACZ,GAAI,kCACJ,YAAa,8CACb,eAAgB,yBAAA,EAIlB,cAAe,CACb,GAAI,mCACJ,YAAa,sCACb,eAAgB,8BAAA,EAElB,eAAgB,CACd,GAAI,oCACJ,YAAa,+CACb,eAAgB,kDAAA,EAIlB,sBAAuB,CACrB,GAAI,2CACJ,YAAa,6CACb,eAAgB,mCAAA,EAElB,wBAAyB,CACvB,GAAI,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1D,GAAIe,EACF,OAAOb,EAAAA,IAAC,MAAA,CAAe,SAAAa,CAAA,EAANhB,CAAoB,EAIvC,MAAMiB,EAAiBf,EAAkBF,CAAG,EAC5C,OAAIiB,EACKd,EAAAA,IAAC,MAAA,CAAe,SAAAc,CAAA,EAANjB,CAAqB,EAIjC,IACT,CAAC,CAAA,CACH,CAEJ,EAGAK,EAAY,YAAc,cAC1BA,EAAY,WAAaT"}
@@ -0,0 +1,11 @@
1
+ "use strict";const t=require("react/jsx-runtime"),i=require("react"),x=require("@chakra-ui/react/styled-system"),p=require("./Dialog-K19USc7c.cjs.js"),u=require("./box-CWni3A32.cjs.js"),B=require("./icon-button-0GLW7WtL.cjs.js"),m=require("@commercetools/nimbus-icons"),A=require("./useField-DmqO9k7a.cjs.js"),s=i.createContext({context:{label:null,description:null,error:null,info:null,input:null},setContext:()=>{}}),H=`
2
+ "label"
3
+ "input"
4
+ "description"
5
+ "error"
6
+ `,I=`
7
+ "label input"
8
+ "label description"
9
+ "label error"
10
+ `,L=x.defineSlotRecipe({slots:["root","label","input","description","error","popover"],className:"nimbus-ui-form-field",base:{root:{"--grid-gap":"spacing.100",display:"grid",width:"auto"},label:{gridArea:"label",fontWeight:"500",color:"neutral.11",fontSize:"var(--form-field-font-size)",lineHeight:"var(--form-field-line-height)"},input:{gridArea:"input"},description:{gridArea:"description",color:"neutral.11",fontSize:"var(--form-field-font-size)",lineHeight:"var(--form-field-line-height)"},error:{gridArea:"error",color:"critical.11",fontSize:"var(--form-field-font-size)",lineHeight:"var(--form-field-line-height)",display:"flex",gap:"100"},popover:{"--scrollbar-color":"colors.neutral.8","--scrollbar-bg":"colors.neutral.3",bg:"neutral.1",maxWidth:"xl",borderRadius:"200",boxShadow:"6",border:"solid-25",borderColor:"neutral.8",maxHeight:"40svh",overflow:"auto",scrollbarWidth:"thin",scrollbarColor:"var(--scrollbar-color) var(--scrollbar-bg)",focusRing:"outside"}},variants:{size:{md:{root:{"--form-field-font-size":"fontSizes.350","--form-field-line-height":"lineHeights.500"}},sm:{root:{"--form-field-font-size":"fontSizes.300","--form-field-line-height":"lineHeights.450"}}},direction:{column:{root:{gridTemplateAreas:H},input:{mt:"var(--grid-gap)"},description:{mt:"var(--grid-gap)"},error:{mt:"var(--grid-gap)"}},row:{root:{gridTemplateAreas:I,gridTemplateColumns:"auto 1fr",gridColumnGap:"200"},description:{mt:"var(--grid-gap)"},error:{mt:"var(--grid-gap)"}}}},defaultVariants:{direction:"column",size:"md"}}),{withProvider:R,withContext:c}=x.createSlotRecipeContext({recipe:L}),q=R("div","root"),M=c("div","label"),T=c("div","input"),W=c("div","description"),k=c("div","error"),D=c("div","popover"),b=i.forwardRef(({isInvalid:e,isRequired:l,isDisabled:o,isReadOnly:n,children:S,...j},z)=>{const[r,f]=i.useState({label:null,description:null,error:null,info:null,input:null,isInvalid:e,isRequired:l,isDisabled:o,isReadOnly:n}),d={description:r.description,errorMessage:r.error};r.label?d.label=r.label:(d["aria-label"]="empty-label",d["aria-labelledby"]="empty-label");const{labelProps:E,fieldProps:P,descriptionProps:$,errorMessageProps:w}=A.$2baaea4c71418dea$export$294aa081a6c6f55d(d);i.useEffect(()=>{f(a=>({...a,isInvalid:e,isRequired:l,isDisabled:o,isReadOnly:n}))},[e,l,o,n]);const y={...P,isInvalid:e,isRequired:l,isDisabled:o,isReadOnly:n};return t.jsx(s.Provider,{value:{context:r,setContext:f},children:t.jsxs(q,{ref:z,...j,children:[r.label&&t.jsxs(M,{...r.labelSlotProps,children:[t.jsxs("label",{...E,children:[r.label,l&&t.jsx("sup",{"aria-hidden":"true",children:"*"})]}),r.info&&t.jsxs(p.$de32f1b87079253c$export$2e1e1122cf0cba88,{children:[t.jsx(u.Box,{as:"span",display:"inline-block",position:"relative",width:"1ch",height:"1ch",ml:"200",children:t.jsx(u.Box,{as:"span",display:"inline-flex",position:"absolute",top:"50%",right:"50%",transform:"translate(50%, -50%)",children:t.jsx(B.IconButton,{"aria-label":"__MORE INFO",size:"2xs",tone:"info",variant:"link",children:t.jsx(m.HelpOutline,{})})})}),t.jsx(p.$07b14b47974efb58$export$5b6b19405a83ff9d,{children:t.jsx(D,{asChild:!0,children:t.jsx(p.$de32f1b87079253c$export$3ddf2d174ce01153,{children:t.jsx(u.Box,{p:"300",children:r.info})})})})]})]}),r.input&&t.jsx(T,{...r.inputSlotProps,children:i.Children.map(r.input,a=>i.isValidElement(a)?i.cloneElement(a,y):a)}),r.description&&t.jsx(W,{...$,...r.descriptionSlotProps,children:r.description}),e&&r.error&&t.jsxs(k,{...w,...r.errorSlotProps,children:[t.jsx(u.Box,{as:m.ErrorOutline,display:"inline-flex",boxSize:"400",verticalAlign:"middle"}),r.error]}),S]})})}),g=({children:e,...l})=>{const{setContext:o}=i.useContext(s);return i.useEffect(()=>{o(n=>({...n,label:e,labelSlotProps:l}))},[e,o]),null},F=({children:e,...l})=>{const{setContext:o}=i.useContext(s);return i.useEffect(()=>{o(n=>({...n,input:e,inputSlotProps:l}))},[e,o]),null},h=({children:e,...l})=>{const{setContext:o}=i.useContext(s);return i.useEffect(()=>{o(n=>({...n,description:e,descriptionSlotProps:l}))},[e,o]),null},v=({children:e,...l})=>{const{setContext:o}=i.useContext(s);return i.useEffect(()=>{o(n=>({...n,error:e,errorSlotProps:l}))},[e,o]),null},C=({children:e})=>{const{setContext:l}=i.useContext(s);return i.useEffect(()=>{l(o=>({...o,info:e}))},[e,l]),null},N={Root:b,Label:g,Input:F,Description:h,Error:v,InfoBox:C};exports.FormField=N;exports.FormFieldDescription=h;exports.FormFieldError=v;exports.FormFieldInfoBox=C;exports.FormFieldInput=F;exports.FormFieldLabel=g;exports.FormFieldRoot=b;
11
+ //# sourceMappingURL=form-field-DHvafAwV.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-field-DHvafAwV.cjs.js","sources":["../../src/components/form-field/components/form-field.context.tsx","../../src/components/form-field/form-field.recipe.tsx","../../src/components/form-field/form-field.slots.tsx","../../src/components/form-field/components/form-field.root.tsx","../../src/components/form-field/components/form-field.label.tsx","../../src/components/form-field/components/form-field.input.tsx","../../src/components/form-field/components/form-field.description.tsx","../../src/components/form-field/components/form-field.error.tsx","../../src/components/form-field/components/form-field.info-box.tsx","../../src/components/form-field/form-field.tsx"],"sourcesContent":["import { createContext, type ReactNode } from \"react\";\nimport type {\n FormFieldDescriptionSlotProps,\n FormFieldErrorSlotProps,\n FormFieldInputSlotProps,\n FormFieldLabelSlotProps,\n} from \"../form-field.slots\";\n\nexport type FormFieldContextPayloadType = {\n label: ReactNode;\n labelSlotProps?: FormFieldLabelSlotProps;\n input: ReactNode;\n inputSlotProps?: FormFieldInputSlotProps;\n description: ReactNode;\n descriptionSlotProps?: FormFieldDescriptionSlotProps;\n error: ReactNode;\n errorSlotProps?: FormFieldErrorSlotProps;\n info: ReactNode;\n isInvalid?: boolean;\n isRequired?: boolean;\n isDisabled?: boolean;\n isReadOnly?: boolean;\n};\n\nexport type FormFieldContextType = {\n context: FormFieldContextPayloadType;\n setContext: React.Dispatch<React.SetStateAction<FormFieldContextPayloadType>>;\n};\n\nexport const FormFieldContext = createContext<FormFieldContextType>({\n context: {\n label: null,\n description: null,\n error: null,\n info: null,\n input: null,\n },\n setContext: () => {},\n});\n","import { defineSlotRecipe } from \"@chakra-ui/react/styled-system\";\n\nconst columnLayout = `\n\"label\"\n\"input\"\n\"description\"\n\"error\"\n`;\nconst rowLayout = `\n\"label input\"\n\"label description\"\n\"label error\"\n`;\n\n/**\n * Recipe configuration for the FormField component.\n * Defines the styling variants and base styles using Chakra UI's recipe system.\n */\nexport const formFieldRecipe = defineSlotRecipe({\n slots: [\"root\", \"label\", \"input\", \"description\", \"error\", \"popover\"],\n // Unique class name prefix for the component\n className: \"nimbus-ui-form-field\",\n\n base: {\n root: {\n \"--grid-gap\": \"spacing.100\",\n\n display: \"grid\",\n width: \"auto\",\n },\n label: {\n gridArea: \"label\",\n fontWeight: \"500\",\n color: \"neutral.11\",\n fontSize: \"var(--form-field-font-size)\",\n lineHeight: \"var(--form-field-line-height)\",\n },\n input: {\n gridArea: \"input\",\n },\n description: {\n gridArea: \"description\",\n color: \"neutral.11\",\n fontSize: \"var(--form-field-font-size)\",\n lineHeight: \"var(--form-field-line-height)\",\n },\n error: {\n gridArea: \"error\",\n color: \"critical.11\",\n fontSize: \"var(--form-field-font-size)\",\n lineHeight: \"var(--form-field-line-height)\",\n display: \"flex\",\n gap: \"100\",\n },\n popover: {\n \"--scrollbar-color\": \"colors.neutral.8\",\n \"--scrollbar-bg\": \"colors.neutral.3\",\n bg: \"neutral.1\",\n maxWidth: \"xl\",\n borderRadius: \"200\",\n boxShadow: \"6\",\n border: \"solid-25\",\n borderColor: \"neutral.8\",\n maxHeight: \"40svh\",\n overflow: \"auto\",\n scrollbarWidth: \"thin\",\n scrollbarColor: \"var(--scrollbar-color) var(--scrollbar-bg)\",\n focusRing: \"outside\",\n },\n },\n\n variants: {\n size: {\n md: {\n root: {\n \"--form-field-font-size\": \"fontSizes.350\",\n \"--form-field-line-height\": \"lineHeights.500\",\n },\n },\n sm: {\n root: {\n \"--form-field-font-size\": \"fontSizes.300\",\n \"--form-field-line-height\": \"lineHeights.450\",\n },\n },\n },\n direction: {\n column: {\n root: {\n gridTemplateAreas: columnLayout,\n },\n input: {\n mt: \"var(--grid-gap)\",\n },\n description: {\n mt: \"var(--grid-gap)\",\n },\n error: {\n mt: \"var(--grid-gap)\",\n },\n },\n row: {\n root: {\n gridTemplateAreas: rowLayout,\n gridTemplateColumns: \"auto 1fr\",\n gridColumnGap: \"200\",\n },\n description: {\n mt: \"var(--grid-gap)\",\n },\n error: {\n mt: \"var(--grid-gap)\",\n },\n },\n },\n },\n\n // Default variant values when not explicitly specified\n defaultVariants: {\n direction: \"column\",\n size: \"md\",\n },\n});\n","/* eslint-disable @typescript-eslint/no-empty-object-type */\nimport {\n type HTMLChakraProps,\n type RecipeVariantProps,\n type UnstyledProp,\n createSlotRecipeContext,\n} from \"@chakra-ui/react/styled-system\";\n\nimport { formFieldRecipe } from \"./form-field.recipe\";\n\nconst { withProvider, withContext } = createSlotRecipeContext({\n recipe: formFieldRecipe,\n});\n\n// Root slot\nexport interface FormFieldRootSlotProps\n extends HTMLChakraProps<\n \"div\",\n RecipeVariantProps<typeof formFieldRecipe> & UnstyledProp\n > {}\n\nexport const FormFieldRootSlot = withProvider<\n HTMLDivElement,\n FormFieldRootSlotProps\n>(\"div\", \"root\");\n\n// Label Slot\nexport interface FormFieldLabelSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldLabelSlot = withContext<\n HTMLDivElement,\n FormFieldLabelSlotProps\n>(\"div\", \"label\");\n\n// Input Slot\nexport interface FormFieldInputSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldInputSlot = withContext<\n HTMLDivElement,\n FormFieldInputSlotProps\n>(\"div\", \"input\");\n\n// Description Slot\nexport interface FormFieldDescriptionSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldDescriptionSlot = withContext<\n HTMLDivElement,\n FormFieldDescriptionSlotProps\n>(\"div\", \"description\");\n\n// Error Slot\nexport interface FormFieldErrorSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldErrorSlot = withContext<\n HTMLDivElement,\n FormFieldErrorSlotProps\n>(\"div\", \"error\");\n\n// Error Slot\nexport interface FormFieldPopoverSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldPopoverSlot = withContext<\n HTMLDivElement,\n FormFieldPopoverSlotProps\n>(\"div\", \"popover\");\n","import {\n Children,\n cloneElement,\n forwardRef,\n isValidElement,\n useEffect,\n useState,\n} from \"react\";\nimport type { FormFieldProps } from \"../form-field.types\";\nimport { useField } from \"react-aria\";\nimport {\n FormFieldContext,\n type FormFieldContextPayloadType,\n} from \"./form-field.context\";\nimport {\n FormFieldDescriptionSlot,\n FormFieldErrorSlot,\n FormFieldInputSlot,\n FormFieldLabelSlot,\n FormFieldPopoverSlot,\n FormFieldRootSlot,\n} from \"../form-field.slots\";\nimport { Dialog, DialogTrigger, Popover } from \"react-aria-components\";\nimport { Box, IconButton } from \"@/components\";\nimport { ErrorOutline, HelpOutline } from \"@commercetools/nimbus-icons\";\n\n/**\n * # FormField\n *\n * displays miscellaneous inputs in a FormField context\n *\n * @see {@link https://nimbus-documentation.vercel.app/components/inputs/formfield}\n */\nexport const FormFieldRoot = forwardRef<HTMLDivElement, FormFieldProps>(\n (\n { isInvalid, isRequired, isDisabled, isReadOnly, children, ...props },\n ref\n ) => {\n const [context, setContext] = useState<FormFieldContextPayloadType>({\n label: null,\n description: null,\n error: null,\n info: null,\n input: null,\n isInvalid,\n isRequired,\n isDisabled,\n isReadOnly,\n });\n\n const useFieldArgs: Parameters<typeof useField>[0] = {\n description: context.description,\n errorMessage: context.error,\n };\n\n if (context.label) {\n useFieldArgs.label = context.label;\n } else {\n // Context will always start out null, so we need to stub out some aria attributes\n // FIXME: This is a hack to get the form field to work, but it's not the best solution\n // FIXME: We should find a better way to handle this by redesigning the FormField component's structure\n useFieldArgs[\"aria-label\"] = \"empty-label\";\n useFieldArgs[\"aria-labelledby\"] = \"empty-label\";\n }\n\n const { labelProps, fieldProps, descriptionProps, errorMessageProps } =\n useField(useFieldArgs);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n isInvalid,\n isRequired,\n isDisabled,\n isReadOnly,\n }));\n }, [isInvalid, isRequired, isDisabled, isReadOnly]);\n\n const inputProps = {\n ...fieldProps,\n isInvalid,\n isRequired,\n isDisabled,\n isReadOnly,\n };\n\n return (\n <FormFieldContext.Provider value={{ context, setContext }}>\n <FormFieldRootSlot ref={ref} {...props}>\n {context.label && (\n <FormFieldLabelSlot {...context.labelSlotProps}>\n <label {...labelProps}>\n {context.label}\n {isRequired && <sup aria-hidden=\"true\">*</sup>}\n </label>\n {context.info && (\n <DialogTrigger>\n <Box\n as=\"span\"\n display=\"inline-block\"\n position=\"relative\"\n width=\"1ch\"\n height=\"1ch\"\n ml=\"200\"\n >\n <Box\n as=\"span\"\n display=\"inline-flex\"\n position=\"absolute\"\n top=\"50%\"\n right=\"50%\"\n transform=\"translate(50%, -50%)\"\n >\n <IconButton\n aria-label=\"__MORE INFO\"\n size=\"2xs\"\n tone=\"info\"\n variant=\"link\"\n >\n <HelpOutline />\n </IconButton>\n </Box>\n </Box>\n <Popover>\n <FormFieldPopoverSlot asChild>\n <Dialog>\n <Box p=\"300\">{context.info}</Box>\n </Dialog>\n </FormFieldPopoverSlot>\n </Popover>\n </DialogTrigger>\n )}\n </FormFieldLabelSlot>\n )}\n {context.input && (\n <FormFieldInputSlot {...context.inputSlotProps}>\n {Children.map(context.input, (child) => {\n // Important: Check if the child is a valid React element before cloning.\n if (isValidElement(child)) {\n return cloneElement(child, inputProps);\n }\n // If it's not a valid element (e.g., text node, null, undefined), return it as is.\n return child;\n })}\n </FormFieldInputSlot>\n )}\n {context.description && (\n <FormFieldDescriptionSlot\n {...descriptionProps}\n {...context.descriptionSlotProps}\n >\n {context.description}\n </FormFieldDescriptionSlot>\n )}\n {isInvalid && context.error && (\n <FormFieldErrorSlot\n {...errorMessageProps}\n {...context.errorSlotProps}\n >\n <Box\n as={ErrorOutline}\n display=\"inline-flex\"\n boxSize=\"400\"\n verticalAlign=\"middle\"\n />\n {context.error}\n </FormFieldErrorSlot>\n )}\n {children}\n </FormFieldRootSlot>\n </FormFieldContext.Provider>\n );\n }\n);\n","import { useContext, useEffect } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\nimport type { FormFieldLabelSlotProps } from \"../form-field.slots\";\n\nexport const FormFieldLabel = ({\n children,\n ...labelSlotProps\n}: FormFieldLabelSlotProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n label: children,\n labelSlotProps,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { useContext, useEffect } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\nimport type { FormFieldInputSlotProps } from \"../form-field.slots\";\n\nexport const FormFieldInput = ({\n children,\n ...inputSlotProps\n}: FormFieldInputSlotProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n input: children,\n inputSlotProps,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { useContext, useEffect } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\nimport type { FormFieldDescriptionSlotProps } from \"../form-field.slots\";\n\nexport const FormFieldDescription = ({\n children,\n ...descriptionSlotProps\n}: FormFieldDescriptionSlotProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n description: children,\n descriptionSlotProps,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { useContext, useEffect } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\nimport type { FormFieldErrorSlotProps } from \"../form-field.slots\";\n\nexport const FormFieldError = ({\n children,\n ...errorSlotProps\n}: FormFieldErrorSlotProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n error: children,\n errorSlotProps,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { useContext, useEffect, type ReactNode } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\n\ntype FormFieldInfoBoxProps = {\n /**\n * The content to display in the InfoBox\n */\n children: ReactNode;\n};\n\nexport const FormFieldInfoBox = ({ children }: FormFieldInfoBoxProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n info: children,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { FormFieldRoot } from \"./components/form-field.root\";\nimport { FormFieldLabel } from \"./components/form-field.label\";\nimport { FormFieldInput } from \"./components/form-field.input\";\nimport { FormFieldDescription } from \"./components/form-field.description\";\nimport { FormFieldError } from \"./components/form-field.error\";\nimport { FormFieldInfoBox } from \"./components/form-field.info-box\";\n\nexport const FormField = {\n Root: FormFieldRoot,\n Label: FormFieldLabel,\n Input: FormFieldInput,\n Description: FormFieldDescription,\n Error: FormFieldError,\n InfoBox: FormFieldInfoBox,\n};\n\nexport {\n FormFieldRoot as _FormFieldRoot,\n FormFieldLabel as _FormFieldLabel,\n FormFieldInput as _FormFieldInput,\n FormFieldDescription as _FormFieldDescription,\n FormFieldError as _FormFieldError,\n FormFieldInfoBox as _FormFieldInfoBox,\n};\n"],"names":["FormFieldContext","createContext","columnLayout","rowLayout","formFieldRecipe","defineSlotRecipe","withProvider","withContext","createSlotRecipeContext","FormFieldRootSlot","FormFieldLabelSlot","FormFieldInputSlot","FormFieldDescriptionSlot","FormFieldErrorSlot","FormFieldPopoverSlot","FormFieldRoot","forwardRef","isInvalid","isRequired","isDisabled","isReadOnly","children","props","ref","context","setContext","useState","useFieldArgs","labelProps","fieldProps","descriptionProps","errorMessageProps","useField","useEffect","prevContext","inputProps","jsx","jsxs","DialogTrigger","Box","IconButton","HelpOutline","Popover","Dialog","Children","child","isValidElement","cloneElement","ErrorOutline","FormFieldLabel","labelSlotProps","useContext","FormFieldInput","inputSlotProps","FormFieldDescription","descriptionSlotProps","FormFieldError","errorSlotProps","FormFieldInfoBox","FormField"],"mappings":"sTA6BaA,EAAmBC,EAAAA,cAAoC,CAClE,QAAS,CACP,MAAO,KACP,YAAa,KACb,MAAO,KACP,KAAM,KACN,MAAO,IAAA,EAET,WAAY,IAAM,CAAC,CACrB,CAAC,ECpCKC,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA,EAMfC,EAAY;AAAA;AAAA;AAAA;AAAA,EAULC,EAAkBC,EAAAA,iBAAiB,CAC9C,MAAO,CAAC,OAAQ,QAAS,QAAS,cAAe,QAAS,SAAS,EAEnE,UAAW,uBAEX,KAAM,CACJ,KAAM,CACJ,aAAc,cAEd,QAAS,OACT,MAAO,MAAA,EAET,MAAO,CACL,SAAU,QACV,WAAY,MACZ,MAAO,aACP,SAAU,8BACV,WAAY,+BAAA,EAEd,MAAO,CACL,SAAU,OAAA,EAEZ,YAAa,CAC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AU,CAAC,EAElB,IACT,ECdakC,EAAY,CACvB,KAAM5C,EACN,MAAOkC,EACP,MAAOG,EACP,YAAaE,EACb,MAAOE,EACP,QAASE,CACX"}
@@ -1,6 +1,6 @@
1
- import { jsx as l, jsxs as c } from "react/jsx-runtime";
2
- import { createContext as z, forwardRef as $, useState as P, useEffect as n, Children as w, isValidElement as A, cloneElement as E, useContext as d } from "react";
3
- import { defineSlotRecipe as H, createSlotRecipeContext as y } from "@chakra-ui/react/styled-system";
1
+ import { jsx as l, jsxs as d } from "react/jsx-runtime";
2
+ import { createContext as z, forwardRef as $, useState as P, useEffect as n, Children as w, isValidElement as A, cloneElement as E, useContext as c } from "react";
3
+ import { defineSlotRecipe as y, createSlotRecipeContext as H } from "@chakra-ui/react/styled-system";
4
4
  import { e as B, $ as L, a as I } from "./Dialog-BH-H4BEe.es.js";
5
5
  import { B as m } from "./box-DuBoAZvq.es.js";
6
6
  import { I as M } from "./icon-button-C_i4ydsN.es.js";
@@ -25,7 +25,7 @@ const a = /* @__PURE__ */ z({
25
25
  "label input"
26
26
  "label description"
27
27
  "label error"
28
- `, N = /* @__PURE__ */ H({
28
+ `, N = /* @__PURE__ */ y({
29
29
  slots: ["root", "label", "input", "description", "error", "popover"],
30
30
  // Unique class name prefix for the component
31
31
  className: "nimbus-ui-form-field",
@@ -55,7 +55,9 @@ const a = /* @__PURE__ */ z({
55
55
  gridArea: "error",
56
56
  color: "critical.11",
57
57
  fontSize: "var(--form-field-font-size)",
58
- lineHeight: "var(--form-field-line-height)"
58
+ lineHeight: "var(--form-field-line-height)",
59
+ display: "flex",
60
+ gap: "100"
59
61
  },
60
62
  popover: {
61
63
  "--scrollbar-color": "colors.neutral.8",
@@ -123,7 +125,7 @@ const a = /* @__PURE__ */ z({
123
125
  direction: "column",
124
126
  size: "md"
125
127
  }
126
- }), { withProvider: V, withContext: p } = /* @__PURE__ */ y({
128
+ }), { withProvider: V, withContext: p } = /* @__PURE__ */ H({
127
129
  recipe: N
128
130
  }), _ = /* @__PURE__ */ V("div", "root"), G = /* @__PURE__ */ p("div", "label"), O = /* @__PURE__ */ p("div", "input"), D = /* @__PURE__ */ p("div", "description"), J = /* @__PURE__ */ p("div", "error"), K = /* @__PURE__ */ p("div", "popover"), Q = /* @__PURE__ */ $(
129
131
  ({ isInvalid: r, isRequired: t, isDisabled: e, isReadOnly: i, children: b, ...g }, h) => {
@@ -159,13 +161,13 @@ const a = /* @__PURE__ */ z({
159
161
  isDisabled: e,
160
162
  isReadOnly: i
161
163
  };
162
- return /* @__PURE__ */ l(a.Provider, { value: { context: o, setContext: u }, children: /* @__PURE__ */ c(_, { ref: h, ...g, children: [
163
- o.label && /* @__PURE__ */ c(G, { ...o.labelSlotProps, children: [
164
- /* @__PURE__ */ c("label", { ...x, children: [
164
+ return /* @__PURE__ */ l(a.Provider, { value: { context: o, setContext: u }, children: /* @__PURE__ */ d(_, { ref: h, ...g, children: [
165
+ o.label && /* @__PURE__ */ d(G, { ...o.labelSlotProps, children: [
166
+ /* @__PURE__ */ d("label", { ...x, children: [
165
167
  o.label,
166
168
  t && /* @__PURE__ */ l("sup", { "aria-hidden": "true", children: "*" })
167
169
  ] }),
168
- o.info && /* @__PURE__ */ c(B, { children: [
170
+ o.info && /* @__PURE__ */ d(B, { children: [
169
171
  /* @__PURE__ */ l(
170
172
  m,
171
173
  {
@@ -210,7 +212,7 @@ const a = /* @__PURE__ */ z({
210
212
  children: o.description
211
213
  }
212
214
  ),
213
- r && o.error && /* @__PURE__ */ c(
215
+ r && o.error && /* @__PURE__ */ d(
214
216
  J,
215
217
  {
216
218
  ...S,
@@ -222,8 +224,7 @@ const a = /* @__PURE__ */ z({
222
224
  as: T,
223
225
  display: "inline-flex",
224
226
  boxSize: "400",
225
- verticalAlign: "text-bottom",
226
- mr: "100"
227
+ verticalAlign: "middle"
227
228
  }
228
229
  ),
229
230
  o.error
@@ -237,7 +238,7 @@ const a = /* @__PURE__ */ z({
237
238
  children: r,
238
239
  ...t
239
240
  }) => {
240
- const { setContext: e } = d(a);
241
+ const { setContext: e } = c(a);
241
242
  return n(() => {
242
243
  e((i) => ({
243
244
  ...i,
@@ -249,7 +250,7 @@ const a = /* @__PURE__ */ z({
249
250
  children: r,
250
251
  ...t
251
252
  }) => {
252
- const { setContext: e } = d(a);
253
+ const { setContext: e } = c(a);
253
254
  return n(() => {
254
255
  e((i) => ({
255
256
  ...i,
@@ -261,7 +262,7 @@ const a = /* @__PURE__ */ z({
261
262
  children: r,
262
263
  ...t
263
264
  }) => {
264
- const { setContext: e } = d(a);
265
+ const { setContext: e } = c(a);
265
266
  return n(() => {
266
267
  e((i) => ({
267
268
  ...i,
@@ -273,7 +274,7 @@ const a = /* @__PURE__ */ z({
273
274
  children: r,
274
275
  ...t
275
276
  }) => {
276
- const { setContext: e } = d(a);
277
+ const { setContext: e } = c(a);
277
278
  return n(() => {
278
279
  e((i) => ({
279
280
  ...i,
@@ -282,7 +283,7 @@ const a = /* @__PURE__ */ z({
282
283
  }));
283
284
  }, [r, e]), null;
284
285
  }, q = ({ children: r }) => {
285
- const { setContext: t } = d(a);
286
+ const { setContext: t } = c(a);
286
287
  return n(() => {
287
288
  t((e) => ({
288
289
  ...e,
@@ -306,4 +307,4 @@ export {
306
307
  Z as e,
307
308
  q as f
308
309
  };
309
- //# sourceMappingURL=form-field-DMs36b56.es.js.map
310
+ //# sourceMappingURL=form-field-DIUXRuTp.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-field-DIUXRuTp.es.js","sources":["../../src/components/form-field/components/form-field.context.tsx","../../src/components/form-field/form-field.recipe.tsx","../../src/components/form-field/form-field.slots.tsx","../../src/components/form-field/components/form-field.root.tsx","../../src/components/form-field/components/form-field.label.tsx","../../src/components/form-field/components/form-field.input.tsx","../../src/components/form-field/components/form-field.description.tsx","../../src/components/form-field/components/form-field.error.tsx","../../src/components/form-field/components/form-field.info-box.tsx","../../src/components/form-field/form-field.tsx"],"sourcesContent":["import { createContext, type ReactNode } from \"react\";\nimport type {\n FormFieldDescriptionSlotProps,\n FormFieldErrorSlotProps,\n FormFieldInputSlotProps,\n FormFieldLabelSlotProps,\n} from \"../form-field.slots\";\n\nexport type FormFieldContextPayloadType = {\n label: ReactNode;\n labelSlotProps?: FormFieldLabelSlotProps;\n input: ReactNode;\n inputSlotProps?: FormFieldInputSlotProps;\n description: ReactNode;\n descriptionSlotProps?: FormFieldDescriptionSlotProps;\n error: ReactNode;\n errorSlotProps?: FormFieldErrorSlotProps;\n info: ReactNode;\n isInvalid?: boolean;\n isRequired?: boolean;\n isDisabled?: boolean;\n isReadOnly?: boolean;\n};\n\nexport type FormFieldContextType = {\n context: FormFieldContextPayloadType;\n setContext: React.Dispatch<React.SetStateAction<FormFieldContextPayloadType>>;\n};\n\nexport const FormFieldContext = createContext<FormFieldContextType>({\n context: {\n label: null,\n description: null,\n error: null,\n info: null,\n input: null,\n },\n setContext: () => {},\n});\n","import { defineSlotRecipe } from \"@chakra-ui/react/styled-system\";\n\nconst columnLayout = `\n\"label\"\n\"input\"\n\"description\"\n\"error\"\n`;\nconst rowLayout = `\n\"label input\"\n\"label description\"\n\"label error\"\n`;\n\n/**\n * Recipe configuration for the FormField component.\n * Defines the styling variants and base styles using Chakra UI's recipe system.\n */\nexport const formFieldRecipe = defineSlotRecipe({\n slots: [\"root\", \"label\", \"input\", \"description\", \"error\", \"popover\"],\n // Unique class name prefix for the component\n className: \"nimbus-ui-form-field\",\n\n base: {\n root: {\n \"--grid-gap\": \"spacing.100\",\n\n display: \"grid\",\n width: \"auto\",\n },\n label: {\n gridArea: \"label\",\n fontWeight: \"500\",\n color: \"neutral.11\",\n fontSize: \"var(--form-field-font-size)\",\n lineHeight: \"var(--form-field-line-height)\",\n },\n input: {\n gridArea: \"input\",\n },\n description: {\n gridArea: \"description\",\n color: \"neutral.11\",\n fontSize: \"var(--form-field-font-size)\",\n lineHeight: \"var(--form-field-line-height)\",\n },\n error: {\n gridArea: \"error\",\n color: \"critical.11\",\n fontSize: \"var(--form-field-font-size)\",\n lineHeight: \"var(--form-field-line-height)\",\n display: \"flex\",\n gap: \"100\",\n },\n popover: {\n \"--scrollbar-color\": \"colors.neutral.8\",\n \"--scrollbar-bg\": \"colors.neutral.3\",\n bg: \"neutral.1\",\n maxWidth: \"xl\",\n borderRadius: \"200\",\n boxShadow: \"6\",\n border: \"solid-25\",\n borderColor: \"neutral.8\",\n maxHeight: \"40svh\",\n overflow: \"auto\",\n scrollbarWidth: \"thin\",\n scrollbarColor: \"var(--scrollbar-color) var(--scrollbar-bg)\",\n focusRing: \"outside\",\n },\n },\n\n variants: {\n size: {\n md: {\n root: {\n \"--form-field-font-size\": \"fontSizes.350\",\n \"--form-field-line-height\": \"lineHeights.500\",\n },\n },\n sm: {\n root: {\n \"--form-field-font-size\": \"fontSizes.300\",\n \"--form-field-line-height\": \"lineHeights.450\",\n },\n },\n },\n direction: {\n column: {\n root: {\n gridTemplateAreas: columnLayout,\n },\n input: {\n mt: \"var(--grid-gap)\",\n },\n description: {\n mt: \"var(--grid-gap)\",\n },\n error: {\n mt: \"var(--grid-gap)\",\n },\n },\n row: {\n root: {\n gridTemplateAreas: rowLayout,\n gridTemplateColumns: \"auto 1fr\",\n gridColumnGap: \"200\",\n },\n description: {\n mt: \"var(--grid-gap)\",\n },\n error: {\n mt: \"var(--grid-gap)\",\n },\n },\n },\n },\n\n // Default variant values when not explicitly specified\n defaultVariants: {\n direction: \"column\",\n size: \"md\",\n },\n});\n","/* eslint-disable @typescript-eslint/no-empty-object-type */\nimport {\n type HTMLChakraProps,\n type RecipeVariantProps,\n type UnstyledProp,\n createSlotRecipeContext,\n} from \"@chakra-ui/react/styled-system\";\n\nimport { formFieldRecipe } from \"./form-field.recipe\";\n\nconst { withProvider, withContext } = createSlotRecipeContext({\n recipe: formFieldRecipe,\n});\n\n// Root slot\nexport interface FormFieldRootSlotProps\n extends HTMLChakraProps<\n \"div\",\n RecipeVariantProps<typeof formFieldRecipe> & UnstyledProp\n > {}\n\nexport const FormFieldRootSlot = withProvider<\n HTMLDivElement,\n FormFieldRootSlotProps\n>(\"div\", \"root\");\n\n// Label Slot\nexport interface FormFieldLabelSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldLabelSlot = withContext<\n HTMLDivElement,\n FormFieldLabelSlotProps\n>(\"div\", \"label\");\n\n// Input Slot\nexport interface FormFieldInputSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldInputSlot = withContext<\n HTMLDivElement,\n FormFieldInputSlotProps\n>(\"div\", \"input\");\n\n// Description Slot\nexport interface FormFieldDescriptionSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldDescriptionSlot = withContext<\n HTMLDivElement,\n FormFieldDescriptionSlotProps\n>(\"div\", \"description\");\n\n// Error Slot\nexport interface FormFieldErrorSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldErrorSlot = withContext<\n HTMLDivElement,\n FormFieldErrorSlotProps\n>(\"div\", \"error\");\n\n// Error Slot\nexport interface FormFieldPopoverSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const FormFieldPopoverSlot = withContext<\n HTMLDivElement,\n FormFieldPopoverSlotProps\n>(\"div\", \"popover\");\n","import {\n Children,\n cloneElement,\n forwardRef,\n isValidElement,\n useEffect,\n useState,\n} from \"react\";\nimport type { FormFieldProps } from \"../form-field.types\";\nimport { useField } from \"react-aria\";\nimport {\n FormFieldContext,\n type FormFieldContextPayloadType,\n} from \"./form-field.context\";\nimport {\n FormFieldDescriptionSlot,\n FormFieldErrorSlot,\n FormFieldInputSlot,\n FormFieldLabelSlot,\n FormFieldPopoverSlot,\n FormFieldRootSlot,\n} from \"../form-field.slots\";\nimport { Dialog, DialogTrigger, Popover } from \"react-aria-components\";\nimport { Box, IconButton } from \"@/components\";\nimport { ErrorOutline, HelpOutline } from \"@commercetools/nimbus-icons\";\n\n/**\n * # FormField\n *\n * displays miscellaneous inputs in a FormField context\n *\n * @see {@link https://nimbus-documentation.vercel.app/components/inputs/formfield}\n */\nexport const FormFieldRoot = forwardRef<HTMLDivElement, FormFieldProps>(\n (\n { isInvalid, isRequired, isDisabled, isReadOnly, children, ...props },\n ref\n ) => {\n const [context, setContext] = useState<FormFieldContextPayloadType>({\n label: null,\n description: null,\n error: null,\n info: null,\n input: null,\n isInvalid,\n isRequired,\n isDisabled,\n isReadOnly,\n });\n\n const useFieldArgs: Parameters<typeof useField>[0] = {\n description: context.description,\n errorMessage: context.error,\n };\n\n if (context.label) {\n useFieldArgs.label = context.label;\n } else {\n // Context will always start out null, so we need to stub out some aria attributes\n // FIXME: This is a hack to get the form field to work, but it's not the best solution\n // FIXME: We should find a better way to handle this by redesigning the FormField component's structure\n useFieldArgs[\"aria-label\"] = \"empty-label\";\n useFieldArgs[\"aria-labelledby\"] = \"empty-label\";\n }\n\n const { labelProps, fieldProps, descriptionProps, errorMessageProps } =\n useField(useFieldArgs);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n isInvalid,\n isRequired,\n isDisabled,\n isReadOnly,\n }));\n }, [isInvalid, isRequired, isDisabled, isReadOnly]);\n\n const inputProps = {\n ...fieldProps,\n isInvalid,\n isRequired,\n isDisabled,\n isReadOnly,\n };\n\n return (\n <FormFieldContext.Provider value={{ context, setContext }}>\n <FormFieldRootSlot ref={ref} {...props}>\n {context.label && (\n <FormFieldLabelSlot {...context.labelSlotProps}>\n <label {...labelProps}>\n {context.label}\n {isRequired && <sup aria-hidden=\"true\">*</sup>}\n </label>\n {context.info && (\n <DialogTrigger>\n <Box\n as=\"span\"\n display=\"inline-block\"\n position=\"relative\"\n width=\"1ch\"\n height=\"1ch\"\n ml=\"200\"\n >\n <Box\n as=\"span\"\n display=\"inline-flex\"\n position=\"absolute\"\n top=\"50%\"\n right=\"50%\"\n transform=\"translate(50%, -50%)\"\n >\n <IconButton\n aria-label=\"__MORE INFO\"\n size=\"2xs\"\n tone=\"info\"\n variant=\"link\"\n >\n <HelpOutline />\n </IconButton>\n </Box>\n </Box>\n <Popover>\n <FormFieldPopoverSlot asChild>\n <Dialog>\n <Box p=\"300\">{context.info}</Box>\n </Dialog>\n </FormFieldPopoverSlot>\n </Popover>\n </DialogTrigger>\n )}\n </FormFieldLabelSlot>\n )}\n {context.input && (\n <FormFieldInputSlot {...context.inputSlotProps}>\n {Children.map(context.input, (child) => {\n // Important: Check if the child is a valid React element before cloning.\n if (isValidElement(child)) {\n return cloneElement(child, inputProps);\n }\n // If it's not a valid element (e.g., text node, null, undefined), return it as is.\n return child;\n })}\n </FormFieldInputSlot>\n )}\n {context.description && (\n <FormFieldDescriptionSlot\n {...descriptionProps}\n {...context.descriptionSlotProps}\n >\n {context.description}\n </FormFieldDescriptionSlot>\n )}\n {isInvalid && context.error && (\n <FormFieldErrorSlot\n {...errorMessageProps}\n {...context.errorSlotProps}\n >\n <Box\n as={ErrorOutline}\n display=\"inline-flex\"\n boxSize=\"400\"\n verticalAlign=\"middle\"\n />\n {context.error}\n </FormFieldErrorSlot>\n )}\n {children}\n </FormFieldRootSlot>\n </FormFieldContext.Provider>\n );\n }\n);\n","import { useContext, useEffect } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\nimport type { FormFieldLabelSlotProps } from \"../form-field.slots\";\n\nexport const FormFieldLabel = ({\n children,\n ...labelSlotProps\n}: FormFieldLabelSlotProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n label: children,\n labelSlotProps,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { useContext, useEffect } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\nimport type { FormFieldInputSlotProps } from \"../form-field.slots\";\n\nexport const FormFieldInput = ({\n children,\n ...inputSlotProps\n}: FormFieldInputSlotProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n input: children,\n inputSlotProps,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { useContext, useEffect } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\nimport type { FormFieldDescriptionSlotProps } from \"../form-field.slots\";\n\nexport const FormFieldDescription = ({\n children,\n ...descriptionSlotProps\n}: FormFieldDescriptionSlotProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n description: children,\n descriptionSlotProps,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { useContext, useEffect } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\nimport type { FormFieldErrorSlotProps } from \"../form-field.slots\";\n\nexport const FormFieldError = ({\n children,\n ...errorSlotProps\n}: FormFieldErrorSlotProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n error: children,\n errorSlotProps,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { useContext, useEffect, type ReactNode } from \"react\";\nimport { FormFieldContext } from \"./form-field.context\";\n\ntype FormFieldInfoBoxProps = {\n /**\n * The content to display in the InfoBox\n */\n children: ReactNode;\n};\n\nexport const FormFieldInfoBox = ({ children }: FormFieldInfoBoxProps) => {\n const { setContext } = useContext(FormFieldContext);\n\n useEffect(() => {\n setContext((prevContext) => ({\n ...prevContext,\n info: children,\n }));\n }, [children, setContext]);\n\n return null;\n};\n","import { FormFieldRoot } from \"./components/form-field.root\";\nimport { FormFieldLabel } from \"./components/form-field.label\";\nimport { FormFieldInput } from \"./components/form-field.input\";\nimport { FormFieldDescription } from \"./components/form-field.description\";\nimport { FormFieldError } from \"./components/form-field.error\";\nimport { FormFieldInfoBox } from \"./components/form-field.info-box\";\n\nexport const FormField = {\n Root: FormFieldRoot,\n Label: FormFieldLabel,\n Input: FormFieldInput,\n Description: FormFieldDescription,\n Error: FormFieldError,\n InfoBox: FormFieldInfoBox,\n};\n\nexport {\n FormFieldRoot as _FormFieldRoot,\n FormFieldLabel as _FormFieldLabel,\n FormFieldInput as _FormFieldInput,\n FormFieldDescription as _FormFieldDescription,\n FormFieldError as _FormFieldError,\n FormFieldInfoBox as _FormFieldInfoBox,\n};\n"],"names":["FormFieldContext","createContext","columnLayout","rowLayout","formFieldRecipe","defineSlotRecipe","withProvider","withContext","createSlotRecipeContext","FormFieldRootSlot","FormFieldLabelSlot","FormFieldInputSlot","FormFieldDescriptionSlot","FormFieldErrorSlot","FormFieldPopoverSlot","FormFieldRoot","forwardRef","isInvalid","isRequired","isDisabled","isReadOnly","children","props","ref","context","setContext","useState","useFieldArgs","labelProps","fieldProps","descriptionProps","errorMessageProps","useField","useEffect","prevContext","inputProps","jsx","jsxs","DialogTrigger","Box","IconButton","HelpOutline","Popover","Dialog","Children","child","isValidElement","cloneElement","ErrorOutline","FormFieldLabel","labelSlotProps","useContext","FormFieldInput","inputSlotProps","FormFieldDescription","descriptionSlotProps","FormFieldError","errorSlotProps","FormFieldInfoBox","FormField"],"mappings":";;;;;;;;AA6BO,MAAMA,IAAmB,gBAAAC,EAAoC;AAAA,EAClE,SAAS;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,IACb,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,EAAA;AAAA,EAET,YAAY,MAAM;AAAA,EAAC;AACrB,CAAC,GCpCKC,IAAe;AAAA;AAAA;AAAA;AAAA;AAAA,GAMfC,IAAY;AAAA;AAAA;AAAA;AAAA,GAULC,IAAkB,gBAAAC,EAAiB;AAAA,EAC9C,OAAO,CAAC,QAAQ,SAAS,SAAS,eAAe,SAAS,SAAS;AAAA;AAAA,EAEnE,WAAW;AAAA,EAEX,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ,cAAc;AAAA,MAEd,SAAS;AAAA,MACT,OAAO;AAAA,IAAA;AAAA,IAET,OAAO;AAAA,MACL,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,OAAO;AAAA,MACP,UAAU;AAAA,MACV,YAAY;AAAA,IAAA;AAAA,IAEd,OAAO;AAAA,MACL,UAAU;AAAA,IAAA;AAAA,IAEZ,aAAa;AAAA,MACX,UA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