@commercetools/nimbus 0.0.0-canary-20251114201426 → 0.0.0-canary-20251118141326

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 (35) hide show
  1. package/dist/chunks/money-input-field-B78Mykv-.es.js +51 -0
  2. package/dist/chunks/money-input-field-B78Mykv-.es.js.map +1 -0
  3. package/dist/chunks/money-input-field-WfLgZ6jg.cjs.js +2 -0
  4. package/dist/chunks/money-input-field-WfLgZ6jg.cjs.js.map +1 -0
  5. package/dist/chunks/text-input-field-DBtMQ9o_.es.js +58 -0
  6. package/dist/chunks/text-input-field-DBtMQ9o_.es.js.map +1 -0
  7. package/dist/chunks/text-input-field-DmQLdVNA.cjs.js +2 -0
  8. package/dist/chunks/text-input-field-DmQLdVNA.cjs.js.map +1 -0
  9. package/dist/components/fields.cjs +1 -1
  10. package/dist/components/fields.es.js +6 -4
  11. package/dist/components/fields.es.js.map +1 -1
  12. package/dist/components/money-input-field.cjs +2 -0
  13. package/dist/components/money-input-field.cjs.map +1 -0
  14. package/dist/components/money-input-field.es.js +5 -0
  15. package/dist/components/money-input-field.es.js.map +1 -0
  16. package/dist/components/patterns.cjs +1 -1
  17. package/dist/components/patterns.es.js +6 -4
  18. package/dist/components/patterns.es.js.map +1 -1
  19. package/dist/components/text-input-field.cjs +1 -1
  20. package/dist/components/text-input-field.es.js +1 -1
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.es.js +209 -207
  24. package/dist/index.es.js.map +1 -1
  25. package/dist/patterns/fields/index.d.ts +1 -0
  26. package/dist/patterns/fields/money-input-field/index.d.ts +2 -0
  27. package/dist/patterns/fields/money-input-field/money-input-field.d.ts +32 -0
  28. package/dist/patterns/fields/money-input-field/money-input-field.types.d.ts +56 -0
  29. package/dist/patterns/fields/text-input-field/text-input-field.d.ts +1 -1
  30. package/dist/patterns/fields/text-input-field/text-input-field.types.d.ts +5 -0
  31. package/package.json +5 -5
  32. package/dist/chunks/text-input-field-BGnzwfip.cjs.js +0 -2
  33. package/dist/chunks/text-input-field-BGnzwfip.cjs.js.map +0 -1
  34. package/dist/chunks/text-input-field-dIMJFukb.es.js +0 -55
  35. package/dist/chunks/text-input-field-dIMJFukb.es.js.map +0 -1
@@ -1,2 +1,3 @@
1
1
  export * from './date-range-picker-field';
2
+ export * from './money-input-field';
2
3
  export * from './text-input-field';
@@ -0,0 +1,2 @@
1
+ export { MoneyInputField } from './money-input-field';
2
+ export type { MoneyInputFieldProps } from './money-input-field.types';
@@ -0,0 +1,32 @@
1
+ import { MoneyInputFieldProps } from './money-input-field.types';
2
+ /**
3
+ * # MoneyInputField
4
+ *
5
+ * A pre-composed form field component that combines MoneyInput with FormField features
6
+ * like labels, descriptions, error handling, and validation feedback.
7
+ *
8
+ * This component provides a simple, flat API for monetary input use cases, combining
9
+ * a currency selector and amount input into a single field.
10
+ *
11
+ * Contains two focusable inputs: currency selector and amount input.
12
+ *
13
+ * @supportsStyleProps
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * <MoneyInputField
18
+ * label="Product Price"
19
+ * description="Enter the product price with currency"
20
+ * currencies={["USD", "EUR", "GBP", "JPY"]}
21
+ * value={{ amount: "99.99", currencyCode: "USD" }}
22
+ * onValueChange={setValue}
23
+ * errors={{ missing: true }}
24
+ * touched={touched}
25
+ * isRequired
26
+ * />
27
+ * ```
28
+ */
29
+ export declare const MoneyInputField: {
30
+ ({ id, label, description, info, errors, renderError, touched, isRequired, isDisabled, isReadOnly, isInvalid, size, ...moneyInputProps }: MoneyInputFieldProps): import("react/jsx-runtime").JSX.Element;
31
+ displayName: string;
32
+ };
@@ -0,0 +1,56 @@
1
+ import { ReactNode } from 'react';
2
+ import { MoneyInputProps } from '../../../components/money-input/money-input.types';
3
+ import { FieldErrorsData } from '../../../components';
4
+ import { FormFieldProps } from '../../../components/form-field';
5
+ /**
6
+ * Props for the MoneyInputField component.
7
+ *
8
+ * Combines MoneyInput functionality with form field features like labels,
9
+ * descriptions, error handling, and validation feedback.
10
+ *
11
+ * Contains two focusable inputs: currency selector and amount input.
12
+ * Style props (margin, padding, width, etc.) are applied to the root container.
13
+ * Functional props (aria-*, data-*, id, isRequired, etc.) are applied to the form field wrapper.
14
+ */
15
+ export type MoneyInputFieldProps = Omit<MoneyInputProps, "isInvalid" | "id" | "onChange"> & Pick<FormFieldProps, "isRequired" | "isInvalid" | "isDisabled" | "isReadOnly" | "id"> & {
16
+ /**
17
+ * Used as HTML name of the input component.
18
+ * Creates ${name}.amount and ${name}.currencyCode for the two inputs.
19
+ */
20
+ name?: string;
21
+ /**
22
+ * Label text for the input field (required for accessibility)
23
+ */
24
+ label: string | ReactNode;
25
+ /**
26
+ * Description text that appears below the input
27
+ */
28
+ description?: string | ReactNode;
29
+ /**
30
+ * Info content that appears in a popover when the info button is clicked.
31
+ * Info button will only be visible when this prop is passed.
32
+ */
33
+ info?: ReactNode;
34
+ /**
35
+ * List of possible currencies (required for field pattern).
36
+ * Creates a currency dropdown for selection.
37
+ */
38
+ currencies: string[];
39
+ /**
40
+ * Error object - only truthy values will be rendered
41
+ */
42
+ errors?: FieldErrorsData;
43
+ /**
44
+ * Custom error renderer function
45
+ */
46
+ renderError?: (errorKey: string) => ReactNode;
47
+ /**
48
+ * Indicates whether the field was touched. Errors will only be shown when the field was touched.
49
+ */
50
+ touched?: boolean;
51
+ /**
52
+ * Size of the money input
53
+ * @default "md"
54
+ */
55
+ size?: "sm" | "md";
56
+ };
@@ -23,6 +23,6 @@ import { TextInputFieldProps } from './text-input-field.types';
23
23
  * ```
24
24
  */
25
25
  export declare const TextInputField: {
26
- ({ id, label, description, info, errors, onChange, renderError, touched, isRequired, isDisabled, isReadOnly, isInvalid, value, placeholder, type, ...rest }: TextInputFieldProps): import("react/jsx-runtime").JSX.Element;
26
+ ({ id, label, description, info, errors, onChange, renderError, touched, isRequired, isDisabled, isReadOnly, isInvalid, size, value, placeholder, type, ...rest }: TextInputFieldProps): import("react/jsx-runtime").JSX.Element;
27
27
  displayName: string;
28
28
  };
@@ -41,4 +41,9 @@ export type TextInputFieldProps = Omit<TextInputProps, "type"> & Pick<FormFieldP
41
41
  */
42
42
  errors?: FieldErrorsData;
43
43
  renderError?: (errorKey: string) => ReactNode;
44
+ /**
45
+ * Size of the text input
46
+ * @default "md"
47
+ */
48
+ size?: "sm" | "md";
44
49
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools/nimbus",
3
- "version": "0.0.0-canary-20251114201426",
3
+ "version": "0.0.0-canary-20251118141326",
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.es.js",
6
6
  "type": "module",
@@ -102,8 +102,8 @@
102
102
  "vite-plugin-dts": "^4.5.4",
103
103
  "vite-tsconfig-paths": "^5.1.4",
104
104
  "vitest": "^3.2.4",
105
- "@commercetools/nimbus-icons": "^0.0.0-canary-20251114201426",
106
- "@commercetools/nimbus-tokens": "^0.0.0-canary-20251114201426"
105
+ "@commercetools/nimbus-icons": "^0.0.0-canary-20251118141326",
106
+ "@commercetools/nimbus-tokens": "^0.0.0-canary-20251118141326"
107
107
  },
108
108
  "peerDependencies": {
109
109
  "@chakra-ui/react": "^3.27.1",
@@ -113,8 +113,8 @@
113
113
  "slate-history": "^0.113.1",
114
114
  "slate-hyperscript": "^0.77.0",
115
115
  "slate-react": "^0.75.0",
116
- "@commercetools/nimbus-icons": "^0.0.0-canary-20251114201426",
117
- "@commercetools/nimbus-tokens": "^0.0.0-canary-20251114201426"
116
+ "@commercetools/nimbus-icons": "^0.0.0-canary-20251118141326",
117
+ "@commercetools/nimbus-tokens": "^0.0.0-canary-20251118141326"
118
118
  },
119
119
  "scripts": {
120
120
  "build": "pnpm run build-theme-typings && pnpm run build:lib",
@@ -1,2 +0,0 @@
1
- "use strict";const e=require("react/jsx-runtime"),q=require("./text-input-C8lFGlq1.cjs.js"),r=require("./form-field-DV0-9fu9.cjs.js"),E=require("./field-errors-D2re_C_c.cjs.js"),n=({id:o,label:d,description:l,info:i,errors:s,onChange:F,renderError:x,touched:c=!1,isRequired:u=!1,isDisabled:a=!1,isReadOnly:j=!1,isInvalid:m=!1,value:I,placeholder:f,type:h="text",...p})=>{const t=c&&s&&Object.values(s).some(Boolean);return e.jsxs(r.FormField.Root,{id:o,isRequired:u,isDisabled:a,isReadOnly:j,isInvalid:t||m,children:[e.jsx(r.FormField.Label,{children:d}),e.jsx(r.FormField.Input,{children:e.jsx(q.TextInput,{...p,type:h,placeholder:f,onChange:F,value:I})}),l&&e.jsx(r.FormField.Description,{children:l}),t&&e.jsx(r.FormField.Error,{children:e.jsx(E.FieldErrors,{errors:s,renderError:x})}),i&&e.jsx(r.FormField.InfoBox,{children:i})]})};n.displayName="TextInputField";exports.TextInputField=n;
2
- //# sourceMappingURL=text-input-field-BGnzwfip.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"text-input-field-BGnzwfip.cjs.js","sources":["../../src/patterns/fields/text-input-field/text-input-field.tsx"],"sourcesContent":["import { TextInput } from \"@/components/text-input/text-input\";\nimport type { TextInputFieldProps } from \"./text-input-field.types\";\nimport { FormField, FieldErrors } from \"@/components\";\n\n/**\n * # TextInputField\n *\n * A pre-composed form field component that combines TextInput with FormField features\n * like labels, descriptions, error handling, and validation feedback.\n *\n * This component provides a simple, flat API for common text input use cases and serves\n * as a drop-in replacement for UI-Kit's TextField, maintaining compatibility with the\n * same error format and localized error messages.\n *\n * @example\n * ```tsx\n * <TextInputField\n * label=\"Project name\"\n * description=\"Enter a descriptive name for your project\"\n * placeholder=\"My Awesome Project\"\n * value={value}\n * onChange={setValue}\n * errors={{ missing: true }}\n * isRequired\n * />\n * ```\n */\n\nexport const TextInputField = ({\n id,\n label,\n description,\n info,\n errors,\n onChange,\n renderError,\n touched = false,\n isRequired = false,\n isDisabled = false,\n isReadOnly = false,\n isInvalid = false,\n value,\n placeholder,\n type = \"text\",\n ...rest\n}: TextInputFieldProps) => {\n // Determine if we should show errors\n const hasErrors = touched && errors && Object.values(errors).some(Boolean);\n\n return (\n <FormField.Root\n id={id}\n isRequired={isRequired}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isInvalid={hasErrors || isInvalid}\n >\n <FormField.Label>{label}</FormField.Label>\n <FormField.Input>\n <TextInput\n {...rest}\n type={type}\n placeholder={placeholder}\n onChange={onChange}\n value={value}\n />\n </FormField.Input>\n {description && (\n <FormField.Description>{description}</FormField.Description>\n )}\n {hasErrors && (\n <FormField.Error>\n <FieldErrors errors={errors} renderError={renderError} />\n </FormField.Error>\n )}\n {info && <FormField.InfoBox>{info}</FormField.InfoBox>}\n </FormField.Root>\n );\n};\n\nTextInputField.displayName = \"TextInputField\";\n"],"names":["TextInputField","id","label","description","info","errors","onChange","renderError","touched","isRequired","isDisabled","isReadOnly","isInvalid","value","placeholder","type","rest","hasErrors","jsxs","FormField","jsx","TextInput","FieldErrors"],"mappings":"kLA4BaA,EAAiB,CAAC,CAC7B,GAAAC,EACA,MAAAC,EACA,YAAAC,EACA,KAAAC,EACA,OAAAC,EACA,SAAAC,EACA,YAAAC,EACA,QAAAC,EAAU,GACV,WAAAC,EAAa,GACb,WAAAC,EAAa,GACb,WAAAC,EAAa,GACb,UAAAC,EAAY,GACZ,MAAAC,EACA,YAAAC,EACA,KAAAC,EAAO,OACP,GAAGC,CACL,IAA2B,CAEzB,MAAMC,EAAYT,GAAWH,GAAU,OAAO,OAAOA,CAAM,EAAE,KAAK,OAAO,EAEzE,OACEa,EAAAA,KAACC,EAAAA,UAAU,KAAV,CACC,GAAAlB,EACA,WAAAQ,EACA,WAAAC,EACA,WAAAC,EACA,UAAWM,GAAaL,EAExB,SAAA,CAAAQ,EAAAA,IAACD,EAAAA,UAAU,MAAV,CAAiB,SAAAjB,CAAA,CAAM,EACxBkB,EAAAA,IAACD,EAAAA,UAAU,MAAV,CACC,SAAAC,EAAAA,IAACC,EAAAA,UAAA,CACE,GAAGL,EACJ,KAAAD,EACA,YAAAD,EACA,SAAAR,EACA,MAAAO,CAAA,CAAA,EAEJ,EACCV,GACCiB,EAAAA,IAACD,EAAAA,UAAU,YAAV,CAAuB,SAAAhB,EAAY,EAErCc,SACEE,YAAU,MAAV,CACC,SAAAC,MAACE,EAAAA,YAAA,CAAY,OAAAjB,EAAgB,YAAAE,CAAA,CAA0B,CAAA,CACzD,EAEDH,GAAQgB,EAAAA,IAACD,EAAAA,UAAU,QAAV,CAAmB,SAAAf,CAAA,CAAK,CAAA,CAAA,CAAA,CAGxC,EAEAJ,EAAe,YAAc"}
@@ -1,55 +0,0 @@
1
- import { jsxs as T, jsx as e } from "react/jsx-runtime";
2
- import { T as j } from "./text-input-DvvPItr3.es.js";
3
- import { F as r } from "./form-field-D-on43gD.es.js";
4
- import { F as E } from "./field-errors-ClQprmQz.es.js";
5
- const b = ({
6
- id: a,
7
- label: i,
8
- description: o,
9
- info: s,
10
- errors: l,
11
- onChange: n,
12
- renderError: d,
13
- touched: m = !1,
14
- isRequired: p = !1,
15
- isDisabled: c = !1,
16
- isReadOnly: f = !1,
17
- isInvalid: x = !1,
18
- value: h,
19
- placeholder: F,
20
- type: u = "text",
21
- ...I
22
- }) => {
23
- const t = m && l && Object.values(l).some(Boolean);
24
- return /* @__PURE__ */ T(
25
- r.Root,
26
- {
27
- id: a,
28
- isRequired: p,
29
- isDisabled: c,
30
- isReadOnly: f,
31
- isInvalid: t || x,
32
- children: [
33
- /* @__PURE__ */ e(r.Label, { children: i }),
34
- /* @__PURE__ */ e(r.Input, { children: /* @__PURE__ */ e(
35
- j,
36
- {
37
- ...I,
38
- type: u,
39
- placeholder: F,
40
- onChange: n,
41
- value: h
42
- }
43
- ) }),
44
- o && /* @__PURE__ */ e(r.Description, { children: o }),
45
- t && /* @__PURE__ */ e(r.Error, { children: /* @__PURE__ */ e(E, { errors: l, renderError: d }) }),
46
- s && /* @__PURE__ */ e(r.InfoBox, { children: s })
47
- ]
48
- }
49
- );
50
- };
51
- b.displayName = "TextInputField";
52
- export {
53
- b as T
54
- };
55
- //# sourceMappingURL=text-input-field-dIMJFukb.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"text-input-field-dIMJFukb.es.js","sources":["../../src/patterns/fields/text-input-field/text-input-field.tsx"],"sourcesContent":["import { TextInput } from \"@/components/text-input/text-input\";\nimport type { TextInputFieldProps } from \"./text-input-field.types\";\nimport { FormField, FieldErrors } from \"@/components\";\n\n/**\n * # TextInputField\n *\n * A pre-composed form field component that combines TextInput with FormField features\n * like labels, descriptions, error handling, and validation feedback.\n *\n * This component provides a simple, flat API for common text input use cases and serves\n * as a drop-in replacement for UI-Kit's TextField, maintaining compatibility with the\n * same error format and localized error messages.\n *\n * @example\n * ```tsx\n * <TextInputField\n * label=\"Project name\"\n * description=\"Enter a descriptive name for your project\"\n * placeholder=\"My Awesome Project\"\n * value={value}\n * onChange={setValue}\n * errors={{ missing: true }}\n * isRequired\n * />\n * ```\n */\n\nexport const TextInputField = ({\n id,\n label,\n description,\n info,\n errors,\n onChange,\n renderError,\n touched = false,\n isRequired = false,\n isDisabled = false,\n isReadOnly = false,\n isInvalid = false,\n value,\n placeholder,\n type = \"text\",\n ...rest\n}: TextInputFieldProps) => {\n // Determine if we should show errors\n const hasErrors = touched && errors && Object.values(errors).some(Boolean);\n\n return (\n <FormField.Root\n id={id}\n isRequired={isRequired}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isInvalid={hasErrors || isInvalid}\n >\n <FormField.Label>{label}</FormField.Label>\n <FormField.Input>\n <TextInput\n {...rest}\n type={type}\n placeholder={placeholder}\n onChange={onChange}\n value={value}\n />\n </FormField.Input>\n {description && (\n <FormField.Description>{description}</FormField.Description>\n )}\n {hasErrors && (\n <FormField.Error>\n <FieldErrors errors={errors} renderError={renderError} />\n </FormField.Error>\n )}\n {info && <FormField.InfoBox>{info}</FormField.InfoBox>}\n </FormField.Root>\n );\n};\n\nTextInputField.displayName = \"TextInputField\";\n"],"names":["TextInputField","id","label","description","info","errors","onChange","renderError","touched","isRequired","isDisabled","isReadOnly","isInvalid","value","placeholder","type","rest","hasErrors","jsxs","FormField","jsx","TextInput","FieldErrors"],"mappings":";;;;AA4BO,MAAMA,IAAiB,CAAC;AAAA,EAC7B,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,YAAAC,IAAa;AAAA,EACb,YAAAC,IAAa;AAAA,EACb,YAAAC,IAAa;AAAA,EACb,WAAAC,IAAY;AAAA,EACZ,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,GAAGC;AACL,MAA2B;AAEzB,QAAMC,IAAYT,KAAWH,KAAU,OAAO,OAAOA,CAAM,EAAE,KAAK,OAAO;AAEzE,SACE,gBAAAa;AAAA,IAACC,EAAU;AAAA,IAAV;AAAA,MACC,IAAAlB;AAAA,MACA,YAAAQ;AAAA,MACA,YAAAC;AAAA,MACA,YAAAC;AAAA,MACA,WAAWM,KAAaL;AAAA,MAExB,UAAA;AAAA,QAAA,gBAAAQ,EAACD,EAAU,OAAV,EAAiB,UAAAjB,EAAA,CAAM;AAAA,QACxB,gBAAAkB,EAACD,EAAU,OAAV,EACC,UAAA,gBAAAC;AAAA,UAACC;AAAA,UAAA;AAAA,YACE,GAAGL;AAAA,YACJ,MAAAD;AAAA,YACA,aAAAD;AAAA,YACA,UAAAR;AAAA,YACA,OAAAO;AAAA,UAAA;AAAA,QAAA,GAEJ;AAAA,QACCV,KACC,gBAAAiB,EAACD,EAAU,aAAV,EAAuB,UAAAhB,GAAY;AAAA,QAErCc,uBACEE,EAAU,OAAV,EACC,UAAA,gBAAAC,EAACE,GAAA,EAAY,QAAAjB,GAAgB,aAAAE,EAAA,CAA0B,EAAA,CACzD;AAAA,QAEDH,KAAQ,gBAAAgB,EAACD,EAAU,SAAV,EAAmB,UAAAf,EAAA,CAAK;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGxC;AAEAJ,EAAe,cAAc;"}