@helsenorge/datepicker 13.7.0 → 13.9.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.
package/lib/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
## [13.9.0](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv13.8.0&targetVersion=GTv13.9.0) (2026-03-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **illustration:** nye illustrasjoner stork og thinking ([26d4edc](https://github.com/helsenorge/designsystem/commit/26d4edce1606559c4017b74097513b090dd3cb0e)), closes [#372380](https://github.com/helsenorge/designsystem/issues/372380)
|
|
7
|
+
* **servicemessage:** ny prop messageRole ([ee8ac9f](https://github.com/helsenorge/designsystem/commit/ee8ac9f084ec3e51904b0a58ff9bb0ccd5f45542)), closes [#372043](https://github.com/helsenorge/designsystem/issues/372043)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* generer ider til svger istedenfor hardkodede ([ea0cccf](https://github.com/helsenorge/designsystem/commit/ea0cccf37a31a817940b36f78b73af7303accb1b)), closes [#372412](https://github.com/helsenorge/designsystem/issues/372412)
|
|
13
|
+
* **button:** ikke vis hoverfarge på små skjermer for disabled buttons ([9a6a451](https://github.com/helsenorge/designsystem/commit/9a6a451fefaaf181858a282ca467bfdf176ec6f7)), closes [#372696](https://github.com/helsenorge/designsystem/issues/372696)
|
|
14
|
+
* **datepicker:** legg på outline ved hover på kalenderknapp ([b0c1a4e](https://github.com/helsenorge/designsystem/commit/b0c1a4e0025c1d7dfa69ab7cf08f00cb790cb0a0)), closes [#345238](https://github.com/helsenorge/designsystem/issues/345238)
|
|
15
|
+
* **datepicker:** småfikser rundt validering ([cd06bee](https://github.com/helsenorge/designsystem/commit/cd06beed0212d3d82fb67165722f5f740367255b)), closes [#372577](https://github.com/helsenorge/designsystem/issues/372577) [#373156](https://github.com/helsenorge/designsystem/issues/373156)
|
|
16
|
+
* **drawer:** flytt lukkekryss tilbake til flexbox ([f0f3c6f](https://github.com/helsenorge/designsystem/commit/f0f3c6f0c2f8d5c6b615c1ac7dbf6aab997b2e73)), closes [#373141](https://github.com/helsenorge/designsystem/issues/373141)
|
|
17
|
+
* **helptriggerinline:** tekst er nå left aligned ([ea0deeb](https://github.com/helsenorge/designsystem/commit/ea0deebe9a2ee373766a5ac6e4500fc581b0ee97)), closes [#372216](https://github.com/helsenorge/designsystem/issues/372216)
|
|
18
|
+
* **unsafe_datepicker:** bruk resources i labels fra react-day-picker ([0958b64](https://github.com/helsenorge/designsystem/commit/0958b64f730776a515917e5dcd44392e5d19ab50)), closes [#345238](https://github.com/helsenorge/designsystem/issues/345238) [#372577](https://github.com/helsenorge/designsystem/issues/372577)
|
|
19
|
+
|
|
20
|
+
## [13.8.0](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv13.7.0&targetVersion=GTv13.8.0) (2026-02-24)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* **expanderhierarchy:** expander har fått ref prop ([74783f1](https://github.com/helsenorge/designsystem/commit/74783f17d93334b39d7c07f7b17ed8bb2b38340c)), closes [#371787](https://github.com/helsenorge/designsystem/issues/371787)
|
|
26
|
+
* **label:** flytt afterLabelChildren til topp og knyttet til hovedlabel ([c7db421](https://github.com/helsenorge/designsystem/commit/c7db421b5196399c8d976567071e97056e92d286)), closes [#366134](https://github.com/helsenorge/designsystem/issues/366134)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* **helptriggericon:** bruk riktig svg for str xl på desktop og mobil ([d51ce49](https://github.com/helsenorge/designsystem/commit/d51ce49ae6e6b159bcb34e3f864e72fd5c027ded)), closes [#371659](https://github.com/helsenorge/designsystem/issues/371659)
|
|
32
|
+
|
|
1
33
|
## [13.7.0](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv13.6.0&targetVersion=GTv13.7.0) (2026-02-16)
|
|
2
34
|
|
|
3
35
|
|
|
@@ -145,6 +145,14 @@ var BaseDayPicker = (props) => {
|
|
|
145
145
|
...getResources(language),
|
|
146
146
|
...resources
|
|
147
147
|
};
|
|
148
|
+
const mergedLabels = {
|
|
149
|
+
labelNext: () => mergedResources.nextMonth,
|
|
150
|
+
labelPrevious: () => mergedResources.previousMonth,
|
|
151
|
+
labelDayButton: () => mergedResources.dayButtonBase,
|
|
152
|
+
labelMonthDropdown: () => mergedResources.monthDropdown,
|
|
153
|
+
labelYearDropdown: () => mergedResources.yearDropdown,
|
|
154
|
+
...labelsForCalendar
|
|
155
|
+
};
|
|
148
156
|
const customLocale = {
|
|
149
157
|
...localeForCalendar,
|
|
150
158
|
localize: {
|
|
@@ -197,7 +205,7 @@ var BaseDayPicker = (props) => {
|
|
|
197
205
|
classNames: datePickerClassNames,
|
|
198
206
|
locale: customLocale,
|
|
199
207
|
modifiers: modifiersExtended,
|
|
200
|
-
labels:
|
|
208
|
+
labels: mergedLabels,
|
|
201
209
|
footer: showGoToTodayButton ? /* @__PURE__ */ jsxs("div", {
|
|
202
210
|
className: classNames(customstyles["datepicker-footer"], customstyles["datepicker-footer--with-today-button"]),
|
|
203
211
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
@@ -280,7 +288,7 @@ var TimeInputInternal = ({ value, onChange, onBlur, id, setErrorText, resources,
|
|
|
280
288
|
if (mm !== newMm) setMm(newMm);
|
|
281
289
|
}
|
|
282
290
|
}, [value]);
|
|
283
|
-
const combinedValue = hh
|
|
291
|
+
const combinedValue = hh || mm ? `${hh}:${mm}` : "";
|
|
284
292
|
useEffect(() => {
|
|
285
293
|
if (onChange) onChange(combinedValue);
|
|
286
294
|
}, [combinedValue]);
|
|
@@ -3183,103 +3191,113 @@ var DateInputInternal = ({ value, onChange, onBlur, inputId, legendId, setErrorT
|
|
|
3183
3191
|
];
|
|
3184
3192
|
const clearButtonRef = useRef(null);
|
|
3185
3193
|
const [isClearButtonFocused, setIsClearButtonFocused] = useState(false);
|
|
3186
|
-
|
|
3187
|
-
if (!value || value === "") return;
|
|
3188
|
-
const match = value.match(/^(\d{2})\.(\d{2})\.(\d{4})$/);
|
|
3189
|
-
if (match) {
|
|
3190
|
-
const [_, newDd, newMm, newYyyy] = match;
|
|
3191
|
-
if (dd !== newDd) setDd(newDd);
|
|
3192
|
-
if (mm !== newMm) setMm(newMm);
|
|
3193
|
-
if (yyyy !== newYyyy) setYyyy(newYyyy);
|
|
3194
|
-
}
|
|
3195
|
-
}, [value]);
|
|
3196
|
-
const combinedValue = dd && mm && yyyy ? `${dd}.${mm}.${yyyy}` : "";
|
|
3194
|
+
const combinedValue = `${dd}.${mm}.${yyyy}`;
|
|
3197
3195
|
useEffect(() => {
|
|
3198
3196
|
if (onChange) onChange(combinedValue);
|
|
3199
3197
|
}, [combinedValue]);
|
|
3200
|
-
const
|
|
3201
|
-
if (
|
|
3202
|
-
|
|
3198
|
+
const validateSegment = ({ segment, length, minValue, maxValue, errorTextSetter, errorMessage }) => {
|
|
3199
|
+
if (segment === "") {
|
|
3200
|
+
errorTextSetter("");
|
|
3203
3201
|
return true;
|
|
3204
3202
|
}
|
|
3205
|
-
if (
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3203
|
+
if ((/* @__PURE__ */ new RegExp(`^\\d{0,${length}}$`)).test(segment)) {
|
|
3204
|
+
if (length === 2 && segment === "00") {
|
|
3205
|
+
errorTextSetter(errorMessage);
|
|
3206
|
+
return false;
|
|
3207
|
+
}
|
|
3208
|
+
const parsedSegment = parseInt(segment, 10);
|
|
3209
|
+
if (parsedSegment < minValue || parsedSegment > maxValue) {
|
|
3210
|
+
errorTextSetter(errorMessage);
|
|
3209
3211
|
return false;
|
|
3210
3212
|
} else {
|
|
3211
|
-
|
|
3213
|
+
errorTextSetter("");
|
|
3212
3214
|
return true;
|
|
3213
3215
|
}
|
|
3214
3216
|
} else {
|
|
3215
|
-
|
|
3217
|
+
errorTextSetter(errorMessage);
|
|
3216
3218
|
return false;
|
|
3217
3219
|
}
|
|
3218
3220
|
};
|
|
3219
3221
|
const handleDdChange = (e) => {
|
|
3220
3222
|
const newDd = e.target.value;
|
|
3221
3223
|
setDd(newDd);
|
|
3222
|
-
if (
|
|
3224
|
+
if (validateSegment({
|
|
3225
|
+
segment: newDd,
|
|
3226
|
+
length: 2,
|
|
3227
|
+
minValue: 0,
|
|
3228
|
+
maxValue: 31,
|
|
3229
|
+
errorTextSetter: setErrorTextDd,
|
|
3230
|
+
errorMessage: resources?.validateDefaultMessageDay || "Dag må være et tall mellom 01 og 31"
|
|
3231
|
+
})) {
|
|
3223
3232
|
if (newDd.length === 2) mmRef.current?.focus();
|
|
3224
3233
|
}
|
|
3225
3234
|
};
|
|
3226
|
-
const validateMm = (newMm) => {
|
|
3227
|
-
if (newMm === "") {
|
|
3228
|
-
setErrorTextMm("");
|
|
3229
|
-
return true;
|
|
3230
|
-
}
|
|
3231
|
-
if (/^\d{0,2}$/.test(newMm)) {
|
|
3232
|
-
const dayNum = parseInt(newMm, 10);
|
|
3233
|
-
if (dayNum < 0 || dayNum > 12) {
|
|
3234
|
-
setErrorTextMm(resources?.validateDefaultMessageMonth || "Måned må være et tall mellom 01 og 12");
|
|
3235
|
-
return false;
|
|
3236
|
-
} else {
|
|
3237
|
-
setErrorTextMm("");
|
|
3238
|
-
return true;
|
|
3239
|
-
}
|
|
3240
|
-
} else {
|
|
3241
|
-
setErrorTextMm(resources?.validateDefaultMessageMonth || "Måned må være et tall mellom 01 og 12");
|
|
3242
|
-
return false;
|
|
3243
|
-
}
|
|
3244
|
-
};
|
|
3245
3235
|
const handleMmChange = (e) => {
|
|
3246
3236
|
const newMm = e.target.value;
|
|
3247
3237
|
setMm(newMm);
|
|
3248
|
-
if (
|
|
3238
|
+
if (validateSegment({
|
|
3239
|
+
segment: newMm,
|
|
3240
|
+
length: 2,
|
|
3241
|
+
minValue: 0,
|
|
3242
|
+
maxValue: 12,
|
|
3243
|
+
errorTextSetter: setErrorTextMm,
|
|
3244
|
+
errorMessage: resources?.validateDefaultMessageMonth || "Måned må være et tall mellom 01 og 12"
|
|
3245
|
+
})) {
|
|
3249
3246
|
if (newMm.length === 2) yyyyRef.current?.focus();
|
|
3250
3247
|
}
|
|
3251
3248
|
};
|
|
3252
|
-
const validateYyyy = (newYyyy, strict) => {
|
|
3253
|
-
if (newYyyy === "") {
|
|
3254
|
-
setErrorTextYyyy("");
|
|
3255
|
-
return true;
|
|
3256
|
-
}
|
|
3257
|
-
if (/^\d{0,4}$/.test(newYyyy)) {
|
|
3258
|
-
const dayNum = parseInt(newYyyy, 10);
|
|
3259
|
-
let minValue = 0;
|
|
3260
|
-
if (strict) minValue = 1e3;
|
|
3261
|
-
if (dayNum < minValue || dayNum > 9999) {
|
|
3262
|
-
setErrorTextYyyy(resources?.validateDefaultMessageYear || "År må være et tall med 4 siffer");
|
|
3263
|
-
return false;
|
|
3264
|
-
} else {
|
|
3265
|
-
setErrorTextYyyy("");
|
|
3266
|
-
return true;
|
|
3267
|
-
}
|
|
3268
|
-
} else {
|
|
3269
|
-
setErrorTextYyyy(resources?.validateDefaultMessageYear || "År må være et tall med 4 siffer");
|
|
3270
|
-
return false;
|
|
3271
|
-
}
|
|
3272
|
-
};
|
|
3273
3249
|
const handleYyyyChange = (e) => {
|
|
3274
3250
|
const newYyyy = e.target.value;
|
|
3275
3251
|
setYyyy(newYyyy);
|
|
3276
|
-
|
|
3252
|
+
validateSegment({
|
|
3253
|
+
segment: newYyyy,
|
|
3254
|
+
length: 4,
|
|
3255
|
+
minValue: 0,
|
|
3256
|
+
maxValue: 9999,
|
|
3257
|
+
errorTextSetter: setErrorTextYyyy,
|
|
3258
|
+
errorMessage: resources?.validateDefaultMessageYear || "År må være et tall med 4 siffer"
|
|
3259
|
+
});
|
|
3260
|
+
};
|
|
3261
|
+
const validateAllSegments = (latestDd, latestMm, latestYyyy) => {
|
|
3262
|
+
validateSegment({
|
|
3263
|
+
segment: latestDd ?? dd,
|
|
3264
|
+
length: 2,
|
|
3265
|
+
minValue: 0,
|
|
3266
|
+
maxValue: 31,
|
|
3267
|
+
errorTextSetter: setErrorTextDd,
|
|
3268
|
+
errorMessage: resources?.validateDefaultMessageDay || "Dag må være et tall mellom 01 og 31"
|
|
3269
|
+
});
|
|
3270
|
+
validateSegment({
|
|
3271
|
+
segment: latestMm ?? mm,
|
|
3272
|
+
length: 2,
|
|
3273
|
+
minValue: 0,
|
|
3274
|
+
maxValue: 12,
|
|
3275
|
+
errorTextSetter: setErrorTextMm,
|
|
3276
|
+
errorMessage: resources?.validateDefaultMessageMonth || "Måned må være et tall mellom 01 og 12"
|
|
3277
|
+
});
|
|
3278
|
+
validateSegment({
|
|
3279
|
+
segment: latestYyyy ?? yyyy,
|
|
3280
|
+
length: 4,
|
|
3281
|
+
minValue: 0,
|
|
3282
|
+
maxValue: 9999,
|
|
3283
|
+
errorTextSetter: setErrorTextYyyy,
|
|
3284
|
+
errorMessage: resources?.validateDefaultMessageYear || "År må være et tall med 4 siffer"
|
|
3285
|
+
});
|
|
3277
3286
|
};
|
|
3278
3287
|
const handleBlurOnSegment = () => {
|
|
3279
|
-
|
|
3280
|
-
validateMm(mm);
|
|
3281
|
-
validateYyyy(yyyy, true);
|
|
3288
|
+
validateAllSegments();
|
|
3282
3289
|
};
|
|
3290
|
+
useEffect(() => {
|
|
3291
|
+
if (!value || value === "") return;
|
|
3292
|
+
const match = value.match(/^(\d{2})\.(\d{2})\.(\d{4})$/);
|
|
3293
|
+
if (match) {
|
|
3294
|
+
const [_, newDd, newMm, newYyyy] = match;
|
|
3295
|
+
if (dd !== newDd) setDd(newDd);
|
|
3296
|
+
if (mm !== newMm) setMm(newMm);
|
|
3297
|
+
if (yyyy !== newYyyy) setYyyy(newYyyy);
|
|
3298
|
+
validateAllSegments(newDd, newMm, newYyyy);
|
|
3299
|
+
}
|
|
3300
|
+
}, [value]);
|
|
3283
3301
|
useEffect(() => {
|
|
3284
3302
|
const combinedErrors = [
|
|
3285
3303
|
errorTextDd,
|