@amedia/brick-mcp 0.1.5 → 0.1.6
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.
- package/data/components/brick-countdown.md +28 -17
- package/data/components/brick-input.md +117 -74
- package/data/components/brick-pill.md +41 -41
- package/data/components/brick-teaser.md +18 -18
- package/data/components-metadata.json +35 -35
- package/data/tokens.json +27 -3
- package/dist/data/components/brick-countdown.md +28 -17
- package/dist/data/components/brick-input.md +117 -74
- package/dist/data/components/brick-pill.md +41 -41
- package/dist/data/components/brick-teaser.md +18 -18
- package/dist/data/components-metadata.json +35 -35
- package/dist/data/tokens.json +27 -3
- package/package.json +35 -35
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: brick-countdown
|
|
3
|
-
version:
|
|
3
|
+
version: 3.0.0
|
|
4
4
|
selector: brick-countdown-v2
|
|
5
5
|
category: Feedback
|
|
6
6
|
tags: [countdown, timer, animation, teaser, time-based]
|
|
@@ -18,18 +18,18 @@ An animated countdown component that displays time remaining until a specified d
|
|
|
18
18
|
- Animated digit transitions with flip animation
|
|
19
19
|
- Automatic countdown updates every second
|
|
20
20
|
- Supports days, hours, minutes, and seconds display
|
|
21
|
-
- Localization support (Norwegian Bokmål and Nynorsk)
|
|
21
|
+
- Localization support following IETF BCP 47 standard (Norwegian Bokmål and Nynorsk)
|
|
22
22
|
- Automatically hides when countdown reaches zero
|
|
23
23
|
- Server-side rendering support via template function
|
|
24
24
|
- Accessible with screen reader support
|
|
25
25
|
|
|
26
26
|
## Props/Attributes
|
|
27
27
|
|
|
28
|
-
| Attribute | Type | Default
|
|
29
|
-
| ------------- | ------------------ |
|
|
30
|
-
| `data-date` | EpochTimeStamp | -
|
|
31
|
-
| `data-text` | string | -
|
|
32
|
-
| `data-locale` | '
|
|
28
|
+
| Attribute | Type | Default | Required | Description |
|
|
29
|
+
| ------------- | ------------------ | --------- | -------- | -------------------------------------------------- |
|
|
30
|
+
| `data-date` | EpochTimeStamp | - | yes | Unix timestamp in milliseconds for the target date |
|
|
31
|
+
| `data-text` | string | - | no | Optional text to display with the countdown |
|
|
32
|
+
| `data-locale` | 'nb-NO' \| 'nn-NO' | 'nb-NO' | no | Locale for time unit labels (IETF BCP 47 format) |
|
|
33
33
|
|
|
34
34
|
## Examples
|
|
35
35
|
|
|
@@ -54,7 +54,7 @@ An animated countdown component that displays time remaining until a specified d
|
|
|
54
54
|
<brick-countdown-v2
|
|
55
55
|
data-date="1713515269513"
|
|
56
56
|
data-text="Tid igjen"
|
|
57
|
-
data-locale="
|
|
57
|
+
data-locale="nn-NO"
|
|
58
58
|
></brick-countdown-v2>
|
|
59
59
|
```
|
|
60
60
|
|
|
@@ -64,7 +64,7 @@ An animated countdown component that displays time remaining until a specified d
|
|
|
64
64
|
const el = document.createElement('brick-countdown-v2');
|
|
65
65
|
el.dataset.date = '1713515269513';
|
|
66
66
|
el.dataset.text = 'Event starts in';
|
|
67
|
-
el.dataset.locale = '
|
|
67
|
+
el.dataset.locale = 'nb-NO';
|
|
68
68
|
document.body.appendChild(el);
|
|
69
69
|
```
|
|
70
70
|
|
|
@@ -78,7 +78,7 @@ import { renderBrickCountdown } from '@amedia/brick-countdown/template';
|
|
|
78
78
|
const markup = renderBrickCountdown({
|
|
79
79
|
dataDate: 1713515269513,
|
|
80
80
|
dataText: 'Starts in',
|
|
81
|
-
dataLocale: '
|
|
81
|
+
dataLocale: 'nb-NO',
|
|
82
82
|
});
|
|
83
83
|
```
|
|
84
84
|
|
|
@@ -116,19 +116,21 @@ import '@amedia/brick-countdown';
|
|
|
116
116
|
|
|
117
117
|
### Supported Locales
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
The component follows the IETF BCP 47 language tag standard for locale values.
|
|
120
|
+
|
|
121
|
+
**Norwegian Bokmål (nb-NO - default):**
|
|
120
122
|
|
|
121
123
|
- days: "dager"
|
|
122
124
|
- hours: "timer"
|
|
123
|
-
- minutes: "
|
|
124
|
-
- seconds: "
|
|
125
|
+
- minutes: "min"
|
|
126
|
+
- seconds: "sek"
|
|
125
127
|
|
|
126
|
-
**Norwegian Nynorsk (
|
|
128
|
+
**Norwegian Nynorsk (nn-NO):**
|
|
127
129
|
|
|
128
130
|
- days: "dagar"
|
|
129
131
|
- hours: "timar"
|
|
130
|
-
- minutes: "
|
|
131
|
-
- seconds: "
|
|
132
|
+
- minutes: "min"
|
|
133
|
+
- seconds: "sek"
|
|
132
134
|
|
|
133
135
|
## Common Patterns
|
|
134
136
|
|
|
@@ -139,6 +141,7 @@ import '@amedia/brick-countdown';
|
|
|
139
141
|
<brick-countdown-v2
|
|
140
142
|
data-date="1713515269513"
|
|
141
143
|
data-text="Direktesending starter om"
|
|
144
|
+
data-locale="nb-NO"
|
|
142
145
|
></brick-countdown-v2>
|
|
143
146
|
<!-- Other teaser content -->
|
|
144
147
|
</brick-teaser-v9>
|
|
@@ -177,4 +180,12 @@ const countdownEl = createCountdown(eventDate, 'New Year in');
|
|
|
177
180
|
|
|
178
181
|
## Version
|
|
179
182
|
|
|
180
|
-
Current version:
|
|
183
|
+
Current version: 3.0.0 (pending release)
|
|
184
|
+
|
|
185
|
+
## Breaking Changes in v3.0.0
|
|
186
|
+
|
|
187
|
+
**Locale format update**: The `data-locale` attribute now follows the IETF BCP 47 standard:
|
|
188
|
+
- Changed from `nb_NO` to `nb-NO` (Norwegian Bokmål)
|
|
189
|
+
- Changed from `nn_NO` to `nn-NO` (Norwegian Nynorsk)
|
|
190
|
+
|
|
191
|
+
If you are upgrading from v2.x, update any hardcoded locale values to use the hyphenated format.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: brick-input
|
|
3
|
-
version:
|
|
4
|
-
selector: brick-input-
|
|
3
|
+
version: 4.0.0
|
|
4
|
+
selector: brick-input-v4
|
|
5
5
|
category: Forms
|
|
6
6
|
tags: [input, form-control, text-field, validation, form-element, user-input]
|
|
7
7
|
use_cases:
|
|
@@ -15,7 +15,7 @@ use_cases:
|
|
|
15
15
|
surveys,
|
|
16
16
|
data-entry,
|
|
17
17
|
]
|
|
18
|
-
related: [brick-tokens, brick-form]
|
|
18
|
+
related: [brick-tokens, brick-form, brick-textarea]
|
|
19
19
|
---
|
|
20
20
|
|
|
21
21
|
# Brick Input
|
|
@@ -24,7 +24,7 @@ A web component that renders accessible input fields with labels, validation sup
|
|
|
24
24
|
|
|
25
25
|
## Key Capabilities
|
|
26
26
|
|
|
27
|
-
- Supports all standard HTML input types (text, email, password, number, date, checkbox, radio, etc.)
|
|
27
|
+
- Supports all standard HTML input types (text, email, password, number, date, checkbox, radio, file, etc.)
|
|
28
28
|
- Built-in label management with optional visual hiding (screen-reader accessible)
|
|
29
29
|
- Pattern-based validation with error messages and aria-live announcements
|
|
30
30
|
- Help text and optional field indicators
|
|
@@ -35,9 +35,11 @@ A web component that renders accessible input fields with labels, validation sup
|
|
|
35
35
|
|
|
36
36
|
## Props/Attributes
|
|
37
37
|
|
|
38
|
+
All properties use camelCase naming when accessed programmatically (e.g., `dataLabelText`). Attributes use kebab-case (e.g., `data-label-text`).
|
|
39
|
+
|
|
38
40
|
| Attribute | Type | Default | Required | Description |
|
|
39
41
|
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------- | ----------- | ---------------------------------------------------------------------- |
|
|
40
|
-
| `type`
|
|
42
|
+
| `data-type` | `'text' \| 'email' \| 'password' \| 'number' \| 'date' \| 'checkbox' \| 'radio' \| 'tel' \| 'url' \| 'search' \| 'file' \| 'color' \| 'range' \| 'time' \| 'button' \| 'submit' \| 'reset' \| 'hidden' \| 'image'` | `'text'` | yes | Type of input field to render |
|
|
41
43
|
| `data-label-text` | string | - | recommended | Label text for the input field |
|
|
42
44
|
| `data-id` | string | - | no | ID for the input element |
|
|
43
45
|
| `data-name` | string | - | no | Name attribute for form submission |
|
|
@@ -72,20 +74,20 @@ A web component that renders accessible input fields with labels, validation sup
|
|
|
72
74
|
### Basic Text Input
|
|
73
75
|
|
|
74
76
|
```html
|
|
75
|
-
<brick-input-
|
|
77
|
+
<brick-input-v4
|
|
76
78
|
data-type="text"
|
|
77
79
|
data-label-text="First Name"
|
|
78
80
|
data-id="firstname"
|
|
79
81
|
data-name="firstname"
|
|
80
82
|
data-required="true"
|
|
81
83
|
>
|
|
82
|
-
</brick-input-
|
|
84
|
+
</brick-input-v4>
|
|
83
85
|
```
|
|
84
86
|
|
|
85
87
|
### Email Input with Validation
|
|
86
88
|
|
|
87
89
|
```html
|
|
88
|
-
<brick-input-
|
|
90
|
+
<brick-input-v4
|
|
89
91
|
data-type="email"
|
|
90
92
|
data-label-text="Email Address"
|
|
91
93
|
data-id="email"
|
|
@@ -95,13 +97,13 @@ A web component that renders accessible input fields with labels, validation sup
|
|
|
95
97
|
data-errortext="Please enter a valid email address"
|
|
96
98
|
data-helptext="We'll never share your email"
|
|
97
99
|
>
|
|
98
|
-
</brick-input-
|
|
100
|
+
</brick-input-v4>
|
|
99
101
|
```
|
|
100
102
|
|
|
101
103
|
### Password Input
|
|
102
104
|
|
|
103
105
|
```html
|
|
104
|
-
<brick-input-
|
|
106
|
+
<brick-input-v4
|
|
105
107
|
data-type="password"
|
|
106
108
|
data-label-text="Password"
|
|
107
109
|
data-id="password"
|
|
@@ -111,13 +113,13 @@ A web component that renders accessible input fields with labels, validation sup
|
|
|
111
113
|
data-pattern="^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$"
|
|
112
114
|
data-errortext="Password must be at least 8 characters with letters and numbers"
|
|
113
115
|
>
|
|
114
|
-
</brick-input-
|
|
116
|
+
</brick-input-v4>
|
|
115
117
|
```
|
|
116
118
|
|
|
117
119
|
### Number Input with Range
|
|
118
120
|
|
|
119
121
|
```html
|
|
120
|
-
<brick-input-
|
|
122
|
+
<brick-input-v4
|
|
121
123
|
data-type="number"
|
|
122
124
|
data-label-text="Age"
|
|
123
125
|
data-id="age"
|
|
@@ -126,13 +128,13 @@ A web component that renders accessible input fields with labels, validation sup
|
|
|
126
128
|
data-max="120"
|
|
127
129
|
data-required="true"
|
|
128
130
|
>
|
|
129
|
-
</brick-input-
|
|
131
|
+
</brick-input-v4>
|
|
130
132
|
```
|
|
131
133
|
|
|
132
134
|
### Checkbox Input
|
|
133
135
|
|
|
134
136
|
```html
|
|
135
|
-
<brick-input-
|
|
137
|
+
<brick-input-v4
|
|
136
138
|
data-type="checkbox"
|
|
137
139
|
data-label-text="I accept the terms and conditions"
|
|
138
140
|
data-id="terms"
|
|
@@ -140,7 +142,7 @@ A web component that renders accessible input fields with labels, validation sup
|
|
|
140
142
|
data-value="accepted"
|
|
141
143
|
data-required="true"
|
|
142
144
|
>
|
|
143
|
-
</brick-input-
|
|
145
|
+
</brick-input-v4>
|
|
144
146
|
```
|
|
145
147
|
|
|
146
148
|
### Radio Button Group
|
|
@@ -150,7 +152,7 @@ A web component that renders accessible input fields with labels, validation sup
|
|
|
150
152
|
<fieldset>
|
|
151
153
|
<legend>Select an option</legend>
|
|
152
154
|
|
|
153
|
-
<brick-input-
|
|
155
|
+
<brick-input-v4
|
|
154
156
|
data-type="radio"
|
|
155
157
|
data-label-text="Option 1"
|
|
156
158
|
data-id="option1"
|
|
@@ -158,9 +160,9 @@ A web component that renders accessible input fields with labels, validation sup
|
|
|
158
160
|
data-value="1"
|
|
159
161
|
data-required="true"
|
|
160
162
|
>
|
|
161
|
-
</brick-input-
|
|
163
|
+
</brick-input-v4>
|
|
162
164
|
|
|
163
|
-
<brick-input-
|
|
165
|
+
<brick-input-v4
|
|
164
166
|
data-type="radio"
|
|
165
167
|
data-label-text="Option 2"
|
|
166
168
|
data-id="option2"
|
|
@@ -168,14 +170,14 @@ A web component that renders accessible input fields with labels, validation sup
|
|
|
168
170
|
data-value="2"
|
|
169
171
|
data-required="true"
|
|
170
172
|
>
|
|
171
|
-
</brick-input-
|
|
173
|
+
</brick-input-v4>
|
|
172
174
|
</fieldset>
|
|
173
175
|
```
|
|
174
176
|
|
|
175
177
|
### Date Input
|
|
176
178
|
|
|
177
179
|
```html
|
|
178
|
-
<brick-input-
|
|
180
|
+
<brick-input-v4
|
|
179
181
|
data-type="date"
|
|
180
182
|
data-label-text="Date of Birth"
|
|
181
183
|
data-id="dob"
|
|
@@ -184,13 +186,13 @@ A web component that renders accessible input fields with labels, validation sup
|
|
|
184
186
|
data-max="2025-12-31"
|
|
185
187
|
data-required="true"
|
|
186
188
|
>
|
|
187
|
-
</brick-input-
|
|
189
|
+
</brick-input-v4>
|
|
188
190
|
```
|
|
189
191
|
|
|
190
192
|
### Search Input
|
|
191
193
|
|
|
192
194
|
```html
|
|
193
|
-
<brick-input-
|
|
195
|
+
<brick-input-v4
|
|
194
196
|
data-type="search"
|
|
195
197
|
data-label-text="Search"
|
|
196
198
|
data-label-hidden="true"
|
|
@@ -198,13 +200,13 @@ A web component that renders accessible input fields with labels, validation sup
|
|
|
198
200
|
data-name="q"
|
|
199
201
|
data-placeholder="Search articles..."
|
|
200
202
|
>
|
|
201
|
-
</brick-input-
|
|
203
|
+
</brick-input-v4>
|
|
202
204
|
```
|
|
203
205
|
|
|
204
206
|
### File Upload
|
|
205
207
|
|
|
206
208
|
```html
|
|
207
|
-
<brick-input-
|
|
209
|
+
<brick-input-v4
|
|
208
210
|
data-type="file"
|
|
209
211
|
data-label-text="Upload Document"
|
|
210
212
|
data-id="document"
|
|
@@ -212,20 +214,20 @@ A web component that renders accessible input fields with labels, validation sup
|
|
|
212
214
|
data-accept=".pdf,.doc,.docx"
|
|
213
215
|
data-multiple="true"
|
|
214
216
|
>
|
|
215
|
-
</brick-input-
|
|
217
|
+
</brick-input-v4>
|
|
216
218
|
```
|
|
217
219
|
|
|
218
220
|
### Input with Datalist (Autocomplete)
|
|
219
221
|
|
|
220
222
|
```html
|
|
221
|
-
<brick-input-
|
|
223
|
+
<brick-input-v4
|
|
222
224
|
data-type="text"
|
|
223
225
|
data-label-text="Choose a browser"
|
|
224
226
|
data-id="browser"
|
|
225
227
|
data-name="browser"
|
|
226
228
|
data-list="browsers"
|
|
227
229
|
>
|
|
228
|
-
</brick-input-
|
|
230
|
+
</brick-input-v4>
|
|
229
231
|
|
|
230
232
|
<datalist id="browsers">
|
|
231
233
|
<option value="Chrome"></option>
|
|
@@ -238,20 +240,20 @@ A web component that renders accessible input fields with labels, validation sup
|
|
|
238
240
|
### Optional Field
|
|
239
241
|
|
|
240
242
|
```html
|
|
241
|
-
<brick-input-
|
|
243
|
+
<brick-input-v4
|
|
242
244
|
data-type="text"
|
|
243
245
|
data-label-text="Middle Name"
|
|
244
246
|
data-id="middlename"
|
|
245
247
|
data-name="middlename"
|
|
246
248
|
data-optionaltext="(optional)"
|
|
247
249
|
>
|
|
248
|
-
</brick-input-
|
|
250
|
+
</brick-input-v4>
|
|
249
251
|
```
|
|
250
252
|
|
|
251
253
|
### Phone Number with Pattern
|
|
252
254
|
|
|
253
255
|
```html
|
|
254
|
-
<brick-input-
|
|
256
|
+
<brick-input-v4
|
|
255
257
|
data-type="tel"
|
|
256
258
|
data-label-text="Phone Number"
|
|
257
259
|
data-id="phone"
|
|
@@ -261,7 +263,7 @@ A web component that renders accessible input fields with labels, validation sup
|
|
|
261
263
|
data-errortext="Please enter a valid 8-digit phone number"
|
|
262
264
|
data-required="true"
|
|
263
265
|
>
|
|
264
|
-
</brick-input-
|
|
266
|
+
</brick-input-v4>
|
|
265
267
|
```
|
|
266
268
|
|
|
267
269
|
## Framework Integration
|
|
@@ -280,7 +282,7 @@ A web component that renders accessible input fields with labels, validation sup
|
|
|
280
282
|
}
|
|
281
283
|
</script>
|
|
282
284
|
|
|
283
|
-
<brick-input-
|
|
285
|
+
<brick-input-v4
|
|
284
286
|
data-type="email"
|
|
285
287
|
data-label-text="Email"
|
|
286
288
|
data-id="email"
|
|
@@ -301,7 +303,7 @@ function MyForm() {
|
|
|
301
303
|
};
|
|
302
304
|
|
|
303
305
|
return (
|
|
304
|
-
<brick-input-
|
|
306
|
+
<brick-input-v4
|
|
305
307
|
data-type="text"
|
|
306
308
|
data-label-text="Username"
|
|
307
309
|
data-id="username"
|
|
@@ -318,14 +320,13 @@ function MyForm() {
|
|
|
318
320
|
```javascript
|
|
319
321
|
import { BrickInput } from '@amedia/brick-input';
|
|
320
322
|
|
|
321
|
-
const input = new BrickInput(
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
});
|
|
323
|
+
const input = new BrickInput();
|
|
324
|
+
input.dataType = 'email';
|
|
325
|
+
input.dataLabelText = 'Email Address';
|
|
326
|
+
input.dataId = 'email';
|
|
327
|
+
input.dataName = 'email';
|
|
328
|
+
input.dataRequired = true;
|
|
329
|
+
input.dataPlaceholder = 'you@example.com';
|
|
329
330
|
|
|
330
331
|
// Set change handler
|
|
331
332
|
input.onChange = (event) => {
|
|
@@ -342,15 +343,15 @@ document.querySelector('form').appendChild(input);
|
|
|
342
343
|
import { renderBrickInput } from '@amedia/brick-input/template';
|
|
343
344
|
|
|
344
345
|
const inputHTML = renderBrickInput({
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
346
|
+
dataType: 'text',
|
|
347
|
+
dataLabelText: 'First Name',
|
|
348
|
+
dataId: 'firstname',
|
|
349
|
+
dataName: 'firstname',
|
|
350
|
+
dataRequired: true,
|
|
350
351
|
});
|
|
351
352
|
|
|
352
353
|
// Include CSS file in your HTML
|
|
353
|
-
// <link rel="stylesheet" href="https://assets.acdn.no/pkg/@amedia/brick-input/
|
|
354
|
+
// <link rel="stylesheet" href="https://assets.acdn.no/pkg/@amedia/brick-input/v4/css/styles.css">
|
|
354
355
|
```
|
|
355
356
|
|
|
356
357
|
## Accessibility
|
|
@@ -370,13 +371,13 @@ const inputHTML = renderBrickInput({
|
|
|
370
371
|
Validation is triggered on `blur` event for inputs with a `data-pattern` attribute:
|
|
371
372
|
|
|
372
373
|
```html
|
|
373
|
-
<brick-input-
|
|
374
|
+
<brick-input-v4
|
|
374
375
|
data-type="text"
|
|
375
376
|
data-label-text="Username"
|
|
376
377
|
data-pattern="^[a-zA-Z0-9_]{3,16}$"
|
|
377
378
|
data-errortext="Username must be 3-16 characters (letters, numbers, underscore only)"
|
|
378
379
|
>
|
|
379
|
-
</brick-input-
|
|
380
|
+
</brick-input-v4>
|
|
380
381
|
```
|
|
381
382
|
|
|
382
383
|
**Supported types for pattern validation:**
|
|
@@ -400,7 +401,7 @@ Error messages are:
|
|
|
400
401
|
|
|
401
402
|
```html
|
|
402
403
|
<form>
|
|
403
|
-
<brick-input-
|
|
404
|
+
<brick-input-v4
|
|
404
405
|
data-type="email"
|
|
405
406
|
data-label-text="Email"
|
|
406
407
|
data-id="login-email"
|
|
@@ -408,9 +409,9 @@ Error messages are:
|
|
|
408
409
|
data-autocomplete="email"
|
|
409
410
|
data-required="true"
|
|
410
411
|
>
|
|
411
|
-
</brick-input-
|
|
412
|
+
</brick-input-v4>
|
|
412
413
|
|
|
413
|
-
<brick-input-
|
|
414
|
+
<brick-input-v4
|
|
414
415
|
data-type="password"
|
|
415
416
|
data-label-text="Password"
|
|
416
417
|
data-id="login-password"
|
|
@@ -418,7 +419,7 @@ Error messages are:
|
|
|
418
419
|
data-autocomplete="current-password"
|
|
419
420
|
data-required="true"
|
|
420
421
|
>
|
|
421
|
-
</brick-input-
|
|
422
|
+
</brick-input-v4>
|
|
422
423
|
|
|
423
424
|
<button type="submit">Log In</button>
|
|
424
425
|
</form>
|
|
@@ -428,7 +429,7 @@ Error messages are:
|
|
|
428
429
|
|
|
429
430
|
```html
|
|
430
431
|
<form>
|
|
431
|
-
<brick-input-
|
|
432
|
+
<brick-input-v4
|
|
432
433
|
data-type="text"
|
|
433
434
|
data-label-text="Full Name"
|
|
434
435
|
data-id="fullname"
|
|
@@ -436,9 +437,9 @@ Error messages are:
|
|
|
436
437
|
data-autocomplete="name"
|
|
437
438
|
data-required="true"
|
|
438
439
|
>
|
|
439
|
-
</brick-input-
|
|
440
|
+
</brick-input-v4>
|
|
440
441
|
|
|
441
|
-
<brick-input-
|
|
442
|
+
<brick-input-v4
|
|
442
443
|
data-type="email"
|
|
443
444
|
data-label-text="Email"
|
|
444
445
|
data-id="email"
|
|
@@ -446,9 +447,9 @@ Error messages are:
|
|
|
446
447
|
data-autocomplete="email"
|
|
447
448
|
data-required="true"
|
|
448
449
|
>
|
|
449
|
-
</brick-input-
|
|
450
|
+
</brick-input-v4>
|
|
450
451
|
|
|
451
|
-
<brick-input-
|
|
452
|
+
<brick-input-v4
|
|
452
453
|
data-type="password"
|
|
453
454
|
data-label-text="Password"
|
|
454
455
|
data-id="password"
|
|
@@ -457,16 +458,16 @@ Error messages are:
|
|
|
457
458
|
data-minlength="8"
|
|
458
459
|
data-required="true"
|
|
459
460
|
>
|
|
460
|
-
</brick-input-
|
|
461
|
+
</brick-input-v4>
|
|
461
462
|
|
|
462
|
-
<brick-input-
|
|
463
|
+
<brick-input-v4
|
|
463
464
|
data-type="checkbox"
|
|
464
465
|
data-label-text="I agree to the terms and conditions"
|
|
465
466
|
data-id="terms"
|
|
466
467
|
data-name="terms"
|
|
467
468
|
data-required="true"
|
|
468
469
|
>
|
|
469
|
-
</brick-input-
|
|
470
|
+
</brick-input-v4>
|
|
470
471
|
|
|
471
472
|
<button type="submit">Register</button>
|
|
472
473
|
</form>
|
|
@@ -476,7 +477,7 @@ Error messages are:
|
|
|
476
477
|
|
|
477
478
|
```html
|
|
478
479
|
<form role="search">
|
|
479
|
-
<brick-input-
|
|
480
|
+
<brick-input-v4
|
|
480
481
|
data-type="search"
|
|
481
482
|
data-label-text="Search"
|
|
482
483
|
data-label-hidden="true"
|
|
@@ -485,7 +486,7 @@ Error messages are:
|
|
|
485
486
|
data-placeholder="Search articles..."
|
|
486
487
|
data-autocomplete="off"
|
|
487
488
|
>
|
|
488
|
-
</brick-input-
|
|
489
|
+
</brick-input-v4>
|
|
489
490
|
|
|
490
491
|
<button type="submit">Search</button>
|
|
491
492
|
</form>
|
|
@@ -495,32 +496,32 @@ Error messages are:
|
|
|
495
496
|
|
|
496
497
|
```html
|
|
497
498
|
<form>
|
|
498
|
-
<brick-input-
|
|
499
|
+
<brick-input-v4
|
|
499
500
|
data-type="text"
|
|
500
501
|
data-label-text="Name"
|
|
501
502
|
data-id="contact-name"
|
|
502
503
|
data-name="name"
|
|
503
504
|
data-required="true"
|
|
504
505
|
>
|
|
505
|
-
</brick-input-
|
|
506
|
+
</brick-input-v4>
|
|
506
507
|
|
|
507
|
-
<brick-input-
|
|
508
|
+
<brick-input-v4
|
|
508
509
|
data-type="email"
|
|
509
510
|
data-label-text="Email"
|
|
510
511
|
data-id="contact-email"
|
|
511
512
|
data-name="email"
|
|
512
513
|
data-required="true"
|
|
513
514
|
>
|
|
514
|
-
</brick-input-
|
|
515
|
+
</brick-input-v4>
|
|
515
516
|
|
|
516
|
-
<brick-input-
|
|
517
|
+
<brick-input-v4
|
|
517
518
|
data-type="tel"
|
|
518
519
|
data-label-text="Phone"
|
|
519
520
|
data-id="contact-phone"
|
|
520
521
|
data-name="phone"
|
|
521
522
|
data-optionaltext="(optional)"
|
|
522
523
|
>
|
|
523
|
-
</brick-input-
|
|
524
|
+
</brick-input-v4>
|
|
524
525
|
|
|
525
526
|
<button type="submit">Send</button>
|
|
526
527
|
</form>
|
|
@@ -528,7 +529,7 @@ Error messages are:
|
|
|
528
529
|
|
|
529
530
|
## Technical Details
|
|
530
531
|
|
|
531
|
-
- **Custom Element**: `brick-input-
|
|
532
|
+
- **Custom Element**: `brick-input-v4`
|
|
532
533
|
- **Base Class**: BrickElement
|
|
533
534
|
- **Dependencies**:
|
|
534
535
|
- @amedia/brick-tokens (design tokens and utilities)
|
|
@@ -539,7 +540,51 @@ Error messages are:
|
|
|
539
540
|
|
|
540
541
|
## Important Notes
|
|
541
542
|
|
|
542
|
-
|
|
543
|
+
### Breaking Changes in v4.0.0
|
|
544
|
+
|
|
545
|
+
**Property Naming Convention Updated:**
|
|
546
|
+
|
|
547
|
+
- Properties now use camelCase with `data` prefix (e.g., `dataLabelText`, `dataType`, `dataPlaceholder`)
|
|
548
|
+
- Attributes continue to use kebab-case (e.g., `data-label-text`, `data-type`, `data-placeholder`)
|
|
549
|
+
|
|
550
|
+
**Migration Required:**
|
|
551
|
+
|
|
552
|
+
If you're using server-side rendering (`renderBrickInput`), update your code to use camelCase properties with the `data` prefix:
|
|
553
|
+
|
|
554
|
+
```javascript
|
|
555
|
+
// Before (v3.x)
|
|
556
|
+
renderBrickInput({
|
|
557
|
+
type: 'text',
|
|
558
|
+
labelText: 'First Name',
|
|
559
|
+
placeholder: 'Enter your name',
|
|
560
|
+
required: true,
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
// After (v4.0.0)
|
|
564
|
+
renderBrickInput({
|
|
565
|
+
dataType: 'text',
|
|
566
|
+
dataLabelText: 'First Name',
|
|
567
|
+
dataPlaceholder: 'Enter your name',
|
|
568
|
+
dataRequired: true,
|
|
569
|
+
});
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
If you're using the component in HTML with attributes, no changes are required - attributes already use the correct kebab-case format:
|
|
573
|
+
|
|
574
|
+
```html
|
|
575
|
+
<!-- No changes needed for HTML usage -->
|
|
576
|
+
<brick-input-v4
|
|
577
|
+
data-type="text"
|
|
578
|
+
data-label-text="First Name"
|
|
579
|
+
data-placeholder="Enter your name"
|
|
580
|
+
data-required="true"
|
|
581
|
+
>
|
|
582
|
+
</brick-input-v4>
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
### General Notes
|
|
586
|
+
|
|
587
|
+
- The `data-type` attribute is required - defaults to `'text'` if not provided
|
|
543
588
|
- Use `data-label-text` for accessibility - it creates proper label associations
|
|
544
589
|
- Use `data-label-hidden` to visually hide labels while keeping them accessible to screen readers
|
|
545
590
|
- Pattern validation only works with: text, password, search, tel, url, and email types
|
|
@@ -549,9 +594,7 @@ Error messages are:
|
|
|
549
594
|
- Validation triggers on blur (when user leaves the field)
|
|
550
595
|
- The component provides an `onChange` setter/getter for custom change handling
|
|
551
596
|
- Checkbox and radio inputs automatically manage their `checked` attribute on change
|
|
552
|
-
- Version 3.0.0 removed the `getCssText` export - use CSS files instead
|
|
553
|
-
- Version 2.0.0 changed the onChange event to bubble up correctly
|
|
554
597
|
|
|
555
598
|
## Version
|
|
556
599
|
|
|
557
|
-
Current version:
|
|
600
|
+
Current version: 4.0.0
|