@impulse-ui-native/form-field 7.0.1 → 8.1.0

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.
@@ -41,7 +41,7 @@ const FormField = memo(function FormField2({
41
41
  /* @__PURE__ */ jsx(Control.Label, { disabled, children: required ? `${label} *` : label }),
42
42
  description ? /* @__PURE__ */ jsx(Typography.Caption, { style: styles.description, children: description }) : null,
43
43
  children(renderProps),
44
- /* @__PURE__ */ jsx(Control.Error, {})
44
+ error ? /* @__PURE__ */ jsx(Control.Error, { children: error }) : null
45
45
  ] })
46
46
  }
47
47
  );
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/form-field.tsx"],"sourcesContent":["import { memo, useId, useMemo } from \"react\";\n\nimport { Control, Typography } from \"@impulse-ui-native/primitives\";\nimport { useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type {\n FormFieldControlProps,\n FormFieldProps,\n FormFieldRenderProps,\n} from \"../types\";\nimport { formFieldStyles } from \"./form-field.styles\";\n\nexport const FormField = memo(function FormField({\n children,\n description,\n disabled = false,\n error,\n label,\n nativeID,\n required = false,\n style,\n ...props\n}: FormFieldProps) {\n const generatedId = useId();\n\n const fieldId = nativeID ?? `form-field-${generatedId}`;\n const controlId = `${fieldId}-control`;\n const invalid = Boolean(error);\n\n const styles = useThemedStyles(formFieldStyles, { disabled }, [disabled]);\n\n const controlProps = useMemo<FormFieldControlProps>(\n () => ({\n disabled,\n nativeID: controlId,\n }),\n [controlId, disabled],\n );\n const renderProps = useMemo<FormFieldRenderProps>(\n () => ({ controlProps, invalid, required }),\n [controlProps, invalid, required],\n );\n\n return (\n <Control.Provider\n disabled={disabled}\n error={error}\n size=\"medium\"\n variant=\"outlined\"\n >\n <Control.Root {...props} nativeID={fieldId} style={style}>\n <Control.Label disabled={disabled}>\n {required ? `${label} *` : label}\n </Control.Label>\n {description ? (\n <Typography.Caption style={styles.description}>\n {description}\n </Typography.Caption>\n ) : null}\n {children(renderProps)}\n <Control.Error />\n </Control.Root>\n </Control.Provider>\n );\n});\n"],"mappings":"AAkDM,SACE,KADF;AAlDN,SAAS,MAAM,OAAO,eAAe;AAErC,SAAS,SAAS,kBAAkB;AACpC,SAAS,uBAAuB;AAOhC,SAAS,uBAAuB;AAEzB,MAAM,YAAY,KAAK,SAASA,WAAU;AAAA,EAC/C;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA,GAAG;AACL,GAAmB;AACjB,QAAM,cAAc,MAAM;AAE1B,QAAM,UAAU,YAAY,cAAc,WAAW;AACrD,QAAM,YAAY,GAAG,OAAO;AAC5B,QAAM,UAAU,QAAQ,KAAK;AAE7B,QAAM,SAAS,gBAAgB,iBAAiB,EAAE,SAAS,GAAG,CAAC,QAAQ,CAAC;AAExE,QAAM,eAAe;AAAA,IACnB,OAAO;AAAA,MACL;AAAA,MACA,UAAU;AAAA,IACZ;AAAA,IACA,CAAC,WAAW,QAAQ;AAAA,EACtB;AACA,QAAM,cAAc;AAAA,IAClB,OAAO,EAAE,cAAc,SAAS,SAAS;AAAA,IACzC,CAAC,cAAc,SAAS,QAAQ;AAAA,EAClC;AAEA,SACE;AAAA,IAAC,QAAQ;AAAA,IAAR;AAAA,MACC;AAAA,MACA;AAAA,MACA,MAAK;AAAA,MACL,SAAQ;AAAA,MAER,+BAAC,QAAQ,MAAR,EAAc,GAAG,OAAO,UAAU,SAAS,OAC1C;AAAA,4BAAC,QAAQ,OAAR,EAAc,UACZ,qBAAW,GAAG,KAAK,OAAO,OAC7B;AAAA,QACC,cACC,oBAAC,WAAW,SAAX,EAAmB,OAAO,OAAO,aAC/B,uBACH,IACE;AAAA,QACH,SAAS,WAAW;AAAA,QACrB,oBAAC,QAAQ,OAAR,EAAc;AAAA,SACjB;AAAA;AAAA,EACF;AAEJ,CAAC;","names":["FormField"]}
1
+ {"version":3,"sources":["../../src/components/form-field.tsx"],"sourcesContent":["import { memo, useId, useMemo } from \"react\";\n\nimport { Control, Typography } from \"@impulse-ui-native/primitives\";\nimport { useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type {\n FormFieldControlProps,\n FormFieldProps,\n FormFieldRenderProps,\n} from \"../types\";\nimport { formFieldStyles } from \"./form-field.styles\";\n\nexport const FormField = memo(function FormField({\n children,\n description,\n disabled = false,\n error,\n label,\n nativeID,\n required = false,\n style,\n ...props\n}: FormFieldProps) {\n const generatedId = useId();\n\n const fieldId = nativeID ?? `form-field-${generatedId}`;\n const controlId = `${fieldId}-control`;\n const invalid = Boolean(error);\n\n const styles = useThemedStyles(formFieldStyles, { disabled }, [disabled]);\n\n const controlProps = useMemo<FormFieldControlProps>(\n () => ({\n disabled,\n nativeID: controlId,\n }),\n [controlId, disabled],\n );\n const renderProps = useMemo<FormFieldRenderProps>(\n () => ({ controlProps, invalid, required }),\n [controlProps, invalid, required],\n );\n\n return (\n <Control.Provider\n disabled={disabled}\n error={error}\n size=\"medium\"\n variant=\"outlined\"\n >\n <Control.Root {...props} nativeID={fieldId} style={style}>\n <Control.Label disabled={disabled}>\n {required ? `${label} *` : label}\n </Control.Label>\n {description ? (\n <Typography.Caption style={styles.description}>\n {description}\n </Typography.Caption>\n ) : null}\n {children(renderProps)}\n {error ? <Control.Error>{error}</Control.Error> : null}\n </Control.Root>\n </Control.Provider>\n );\n});\n"],"mappings":"AAkDM,SACE,KADF;AAlDN,SAAS,MAAM,OAAO,eAAe;AAErC,SAAS,SAAS,kBAAkB;AACpC,SAAS,uBAAuB;AAOhC,SAAS,uBAAuB;AAEzB,MAAM,YAAY,KAAK,SAASA,WAAU;AAAA,EAC/C;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA,GAAG;AACL,GAAmB;AACjB,QAAM,cAAc,MAAM;AAE1B,QAAM,UAAU,YAAY,cAAc,WAAW;AACrD,QAAM,YAAY,GAAG,OAAO;AAC5B,QAAM,UAAU,QAAQ,KAAK;AAE7B,QAAM,SAAS,gBAAgB,iBAAiB,EAAE,SAAS,GAAG,CAAC,QAAQ,CAAC;AAExE,QAAM,eAAe;AAAA,IACnB,OAAO;AAAA,MACL;AAAA,MACA,UAAU;AAAA,IACZ;AAAA,IACA,CAAC,WAAW,QAAQ;AAAA,EACtB;AACA,QAAM,cAAc;AAAA,IAClB,OAAO,EAAE,cAAc,SAAS,SAAS;AAAA,IACzC,CAAC,cAAc,SAAS,QAAQ;AAAA,EAClC;AAEA,SACE;AAAA,IAAC,QAAQ;AAAA,IAAR;AAAA,MACC;AAAA,MACA;AAAA,MACA,MAAK;AAAA,MACL,SAAQ;AAAA,MAER,+BAAC,QAAQ,MAAR,EAAc,GAAG,OAAO,UAAU,SAAS,OAC1C;AAAA,4BAAC,QAAQ,OAAR,EAAc,UACZ,qBAAW,GAAG,KAAK,OAAO,OAC7B;AAAA,QACC,cACC,oBAAC,WAAW,SAAX,EAAmB,OAAO,OAAO,aAC/B,uBACH,IACE;AAAA,QACH,SAAS,WAAW;AAAA,QACpB,QAAQ,oBAAC,QAAQ,OAAR,EAAe,iBAAM,IAAmB;AAAA,SACpD;AAAA;AAAA,EACF;AAEJ,CAAC;","names":["FormField"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impulse-ui-native/form-field",
3
- "version": "7.0.1",
3
+ "version": "8.1.0",
4
4
  "description": "Form-field composition for Impulse UI Native controls.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -28,8 +28,8 @@
28
28
  ],
29
29
  "sideEffects": false,
30
30
  "dependencies": {
31
- "@impulse-ui-native/primitives": "7.0.1",
32
- "@impulse-ui-native/theme": "7.0.1"
31
+ "@impulse-ui-native/primitives": "8.1.0",
32
+ "@impulse-ui-native/theme": "8.1.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/react": "~19.2.14",