@bytebrand/fe-ui-core-autobahn 1.0.150 → 1.0.152

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.
@@ -8,6 +8,7 @@ import * as React from 'react';
8
8
  import classnames from 'classnames';
9
9
 
10
10
  import Icon from '../../ui/Icon';
11
+ import MfieldCheckIcon from '../../ui/MfieldCheckIcon';
11
12
 
12
13
  export interface MdFieldProps {
13
14
  className?: string;
@@ -32,12 +33,15 @@ export interface MdFieldProps {
32
33
  * when empty and unfocused, then floats up to the normal small-label spot on focus
33
34
  * or once a value is typed. Defaults to false — the static above-field label. */
34
35
  floatingLabel?: boolean;
36
+ /** opt-in: show a green check + green border when the field is filled and valid (checkout).
37
+ * Same contract/markup as FormField's own showValid (.mfield--valid/.mfield-ok, md3.css). */
38
+ showValid?: boolean;
35
39
  onChange: (value: string, name?: string, event?: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
36
40
  }
37
41
 
38
42
  const MdField: React.FunctionComponent<MdFieldProps> = ({
39
43
  className, error, sx, required, disabled, multiline, autoComplete,
40
- value, type, name, rows, label, placeholder, floatingLabel, maxLength, onChange
44
+ value, type, name, rows, label, placeholder, floatingLabel, maxLength, showValid, onChange
41
45
  }) => {
42
46
  const [reveal, setReveal] = React.useState(false);
43
47
  const [focused, setFocused] = React.useState(false);
@@ -54,6 +58,7 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
54
58
  // a value is typed, the real <label> appears in its normal static spot above the
55
59
  // field and the native placeholder goes quiet — the two never show at the same time.
56
60
  const hasValue = value != null && value !== '';
61
+ const isValid = !!showValid && !disabled && !isPassword && !hasError && hasValue;
57
62
  const resting = !!floatingLabel && !focused && !hasValue;
58
63
  const effectivePlaceholder = floatingLabel ? (resting ? (label || placeholder || '') : '') : (placeholder || '');
59
64
  // The real <label> is skipped entirely while resting (see above), leaving the input with
@@ -71,7 +76,9 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
71
76
 
72
77
  return (
73
78
  <div className={classnames('mfield-group', className)} style={sx as React.CSSProperties}>
74
- {label && !resting ? (
79
+ {/* Non-floating fields (FormField's own call sites don't set floatingLabel) keep the
80
+ plain label-above-the-box row — unchanged, still a .mfield-group flex child. */}
81
+ {label && !resting && !floatingLabel ? (
75
82
  <label className='md-label-sm mfield-label' htmlFor={generatedId}>
76
83
  {label}{required ? ' *' : ''}
77
84
  </label>
@@ -87,8 +94,18 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
87
94
  + (hasError ? ' mfield--error' : '')
88
95
  + (disabled ? ' mfield--disabled' : '')
89
96
  + (floatingLabel ? ' mfield--floating' : '')
97
+ + (isValid ? ' mfield--valid' : '')
90
98
  }
91
99
  >
100
+ {/* floatingLabel + floated (focused or has a value): the Material "notched outline"
101
+ treatment — label sits ON the border line, not stacked above it in its own row.
102
+ Lives INSIDE .mfield (not .mfield-group) so it can position against .mfield's own
103
+ edge (.mfield is position:relative already, md3.css) via .mfield-label--notch. */}
104
+ {label && !resting && floatingLabel ? (
105
+ <label className='md-label-sm mfield-label mfield-label--notch' htmlFor={generatedId}>
106
+ {label}{required ? ' *' : ''}
107
+ </label>
108
+ ) : null}
92
109
  {multiline ? (
93
110
  <textarea
94
111
  id={generatedId}
@@ -137,6 +154,7 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
137
154
  <Icon name={reveal ? 'eye-off' : 'eye'} size={18} />
138
155
  </button>
139
156
  ) : null}
157
+ {isValid ? <span className="mfield-ok"><MfieldCheckIcon /></span> : null}
140
158
  </div>
141
159
  {hasError ? (
142
160
  // role="alert" announces this to screen readers the moment it enters the DOM (e.g.
@@ -67,6 +67,7 @@
67
67
  "finance": {
68
68
  "termSelection": "Laufzeit",
69
69
  "termSelectionMonths": "Laufzeit (Monate)",
70
+ "change": "Ändern",
70
71
  "headerTitle": "Dein Angebot",
71
72
  "adjustRate": "Rate anpassen",
72
73
  "secureOffer": "Angebot anfragen",
@@ -700,7 +701,7 @@
700
701
  },
701
702
  "modal": {
702
703
  "leasingDetails": "Leasingdetails",
703
- "financingDetails": "Finanzierungs-Details",
704
+ "financingDetails": "Details",
704
705
  "close": "Schließen",
705
706
  "vehiclePrice": "Fahrzeugpreis ggf. inkl. MwSt.",
706
707
  "leasingAmount": "Leasingbetrag",
@@ -67,6 +67,7 @@
67
67
  "finance": {
68
68
  "termSelection": "Term",
69
69
  "termSelectionMonths": "Term (months)",
70
+ "change": "Change",
70
71
  "headerTitle": "Your offer",
71
72
  "adjustRate": "Adjust rate",
72
73
  "secureOffer": "Request offer",
package/package.json CHANGED
@@ -1,30 +1,30 @@
1
- {
2
- "name": "@bytebrand/fe-ui-core-autobahn",
3
- "version": "1.0.150",
4
- "description": "auto.de md3 (Autobahn) design system — UI primitives, cards, chrome, VDP modules, theme CSS and locales. Ships raw TypeScript source (like fe-ui-core before it); each consumer's bundler compiles it.",
5
- "main": "index.ts",
6
- "license": "UNLICENSED",
7
- "peerDependencies": {
8
- "react": "^18.0.0",
9
- "react-dom": "^18.0.0"
10
- },
11
- "dependencies": {
12
- "@bytebrand/car-schema-selectors": "^2.0.7",
13
- "@bytebrand/fe-financing": "^5.14.20",
14
- "classnames": "2.2.6",
15
- "clsx": "^2.1.1",
16
- "d3-format": "1.4.5",
17
- "js-cookie": "^2.2.0",
18
- "lodash": "^4.17.21",
19
- "lucide-react": "^0.288.0",
20
- "mobx-react": "^7.6.0",
21
- "moment": "^2.29.1",
22
- "qs": "^6.6.0",
23
- "react-device-detect": "^2.1.2",
24
- "react-grid-system": "^5.0.2",
25
- "react-lazyload": "^3.2.0",
26
- "react-scroll": "^1.9.3",
27
- "react-slick": "^0.29.0",
28
- "slick-carousel": "1.8.1"
29
- }
30
- }
1
+ {
2
+ "name": "@bytebrand/fe-ui-core-autobahn",
3
+ "version": "1.0.152",
4
+ "description": "auto.de md3 (Autobahn) design system — UI primitives, cards, chrome, VDP modules, theme CSS and locales. Ships raw TypeScript source (like fe-ui-core before it); each consumer's bundler compiles it.",
5
+ "main": "index.ts",
6
+ "license": "UNLICENSED",
7
+ "peerDependencies": {
8
+ "react": "^18.0.0",
9
+ "react-dom": "^18.0.0"
10
+ },
11
+ "dependencies": {
12
+ "@bytebrand/car-schema-selectors": "^2.0.7",
13
+ "@bytebrand/fe-financing": "^5.14.20",
14
+ "classnames": "2.2.6",
15
+ "clsx": "^2.1.1",
16
+ "d3-format": "1.4.5",
17
+ "js-cookie": "^2.2.0",
18
+ "lodash": "^4.17.21",
19
+ "lucide-react": "^0.288.0",
20
+ "mobx-react": "^7.6.0",
21
+ "moment": "^2.29.1",
22
+ "qs": "^6.6.0",
23
+ "react-device-detect": "^2.1.2",
24
+ "react-grid-system": "^5.0.2",
25
+ "react-lazyload": "^3.2.0",
26
+ "react-scroll": "^1.9.3",
27
+ "react-slick": "^0.29.0",
28
+ "slick-carousel": "1.8.1"
29
+ }
30
+ }