@helsenorge/datepicker 13.0.0-workspaces-beta.6 → 13.0.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,55 @@
|
|
|
1
|
+
## [13.0.0](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv12.12.3&targetVersion=GTv13.0.0) (2025-11-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **anchorlink:** ny prop aschild med støtte for aschild patternet ([b6988a4](https://github.com/helsenorge/designsystem/commit/b6988a4664a2abd8639ad241b54e415e321499f0)), closes [#340712](https://github.com/helsenorge/designsystem/issues/340712)
|
|
7
|
+
* **formfieldtag:** tilgjengeliggjør nordsamisk ([8bee112](https://github.com/helsenorge/designsystem/commit/8bee112fa3148b3a44c8d8c68f1b011b69774e7d)), closes [#364928](https://github.com/helsenorge/designsystem/issues/364928)
|
|
8
|
+
|
|
9
|
+
## 13.0.0-beta.8 (2025-11-24)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* deep export av component ts filer skal inkluderes i publisert pakke ([f9ca449](https://github.com/helsenorge/designsystem/commit/f9ca449205f392c497ab2a66008a9dae07a093d2)), closes [#365382](https://github.com/helsenorge/designsystem/issues/365382)
|
|
15
|
+
|
|
16
|
+
## 13.0.0-beta.7 (2025-11-19)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* **formfieldtag:** legg til engelsk og nynorsk ([c4a2365](https://github.com/helsenorge/designsystem/commit/c4a23657dae5c8e8770f6f5f89510110d1b26e79)), closes [#363896](https://github.com/helsenorge/designsystem/issues/363896)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* cms bygg feiler pga manglende fonts på rot ([37de8b7](https://github.com/helsenorge/designsystem/commit/37de8b7daf74be319da3612bed6dea9c0a65cc35)), closes [#365035](https://github.com/helsenorge/designsystem/issues/365035)
|
|
27
|
+
|
|
28
|
+
## 13.0.0-beta.6 (2025-11-18)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* en rekke typescript feil i komponenter som logges under bygg ([9f5e4cd](https://github.com/helsenorge/designsystem/commit/9f5e4cdcf4c00dc4076d6c03d7e6f2eeafc5964f)), closes [#364139](https://github.com/helsenorge/designsystem/issues/364139)
|
|
34
|
+
* toast får riktig import path på breakpoints ([cde3703](https://github.com/helsenorge/designsystem/commit/cde37035258c5ad3d8c5c1f03405e39ba65879b4)), closes [#364797](https://github.com/helsenorge/designsystem/issues/364797)
|
|
35
|
+
* **elementheader:** fix rar høyde på ikon i noen scenarioer ([5bfbcf8](https://github.com/helsenorge/designsystem/commit/5bfbcf80c6faaeef37ffc7f2ff135dae7aee0ad2)), closes [#362359](https://github.com/helsenorge/designsystem/issues/362359)
|
|
36
|
+
|
|
37
|
+
## 13.0.0-beta.5 (2025-11-13)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Features
|
|
41
|
+
|
|
42
|
+
* designsystemet bruker npm workspaces ([3aa656e](https://github.com/helsenorge/designsystem/commit/3aa656e59f93c8bd2953270b4319a1f4d4a8444d))
|
|
43
|
+
|
|
44
|
+
## 13.0.0-workspaces-beta.7 (2025-11-12)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Features
|
|
48
|
+
|
|
49
|
+
* **radiobutton:** flytter reset mixin ut i scss mappen til radio-reset ([e4c6ade](https://github.com/helsenorge/designsystem/commit/e4c6ade4c91be42b3f12624b27223aad16ffb22a)), closes [#362474](https://github.com/helsenorge/designsystem/issues/362474)
|
|
50
|
+
|
|
51
|
+
## 13.0.0-workspaces-beta.6 (2025-11-12)
|
|
52
|
+
|
|
1
53
|
## 13.0.0-workspaces-beta.5 (2025-11-12)
|
|
2
54
|
|
|
3
55
|
## 13.0.0-workspaces-beta.4 (2025-11-11)
|
|
@@ -27,12 +27,13 @@ import { LanguageLocales as LanguageLocales$1 } from "@helsenorge/designsystem-r
|
|
|
27
27
|
import ErrorWrapper from "@helsenorge/designsystem-react/components/ErrorWrapper";
|
|
28
28
|
import { isComponent } from "@helsenorge/designsystem-react/utils/component";
|
|
29
29
|
var __defProp = Object.defineProperty;
|
|
30
|
-
var __export = (all) => {
|
|
30
|
+
var __export = (all, symbols) => {
|
|
31
31
|
let target = {};
|
|
32
32
|
for (var name in all) __defProp(target, name, {
|
|
33
33
|
get: all[name],
|
|
34
34
|
enumerable: true
|
|
35
35
|
});
|
|
36
|
+
if (symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
36
37
|
return target;
|
|
37
38
|
};
|
|
38
39
|
function tzName(timeZone, date, format$1 = "long") {
|
|
@@ -430,6 +431,9 @@ var CalendarDay = class {
|
|
|
430
431
|
this.displayMonth = displayMonth;
|
|
431
432
|
this.outside = Boolean(displayMonth && !dateLib.isSameMonth(date, displayMonth));
|
|
432
433
|
this.dateLib = dateLib;
|
|
434
|
+
this.isoDate = dateLib.format(date, "yyyy-MM-dd");
|
|
435
|
+
this.displayMonthId = dateLib.format(displayMonth, "yyyy-MM");
|
|
436
|
+
this.dateMonthId = dateLib.format(date, "yyyy-MM");
|
|
433
437
|
}
|
|
434
438
|
isEqualTo(day) {
|
|
435
439
|
return this.dateLib.isSameDay(day.date, this.date) && this.dateLib.isSameMonth(day.displayMonth, this.displayMonth);
|
|
@@ -745,7 +749,7 @@ function dateMatchModifiers(date, matchers, dateLib = defaultDateLib) {
|
|
|
745
749
|
});
|
|
746
750
|
}
|
|
747
751
|
function createGetModifiers(days, props, navStart, navEnd, dateLib) {
|
|
748
|
-
const { disabled, hidden, modifiers, showOutsideDays, broadcastCalendar, today } = props;
|
|
752
|
+
const { disabled, hidden, modifiers, showOutsideDays, broadcastCalendar, today = dateLib.today() } = props;
|
|
749
753
|
const { isSameDay: isSameDay$1, isSameMonth: isSameMonth$1, startOfMonth: startOfMonth$1, isBefore: isBefore$1, endOfMonth: endOfMonth$1, isAfter: isAfter$1 } = dateLib;
|
|
750
754
|
const computedNavStart = navStart && startOfMonth$1(navStart);
|
|
751
755
|
const computedNavEnd = navEnd && endOfMonth$1(navEnd);
|
|
@@ -764,7 +768,7 @@ function createGetModifiers(days, props, navStart, navEnd, dateLib) {
|
|
|
764
768
|
const isAfterNavEnd = Boolean(computedNavEnd && isAfter$1(date, computedNavEnd));
|
|
765
769
|
const isDisabled = Boolean(disabled && dateMatchModifiers(date, disabled, dateLib));
|
|
766
770
|
const isHidden = Boolean(hidden && dateMatchModifiers(date, hidden, dateLib)) || isBeforeNavStart || isAfterNavEnd || !broadcastCalendar && !showOutsideDays && isOutside || broadcastCalendar && showOutsideDays === false && isOutside;
|
|
767
|
-
const isToday = isSameDay$1(date, today
|
|
771
|
+
const isToday = isSameDay$1(date, today);
|
|
768
772
|
if (isOutside) internalModifiersMap.outside.push(day);
|
|
769
773
|
if (isDisabled) internalModifiersMap.disabled.push(day);
|
|
770
774
|
if (isHidden) internalModifiersMap.hidden.push(day);
|
|
@@ -896,9 +900,9 @@ function getStyleForModifiers(dayModifiers, styles$1 = {}, modifiersStyles = {})
|
|
|
896
900
|
});
|
|
897
901
|
return style;
|
|
898
902
|
}
|
|
899
|
-
function getWeekdays(dateLib, ISOWeek, broadcastCalendar) {
|
|
900
|
-
const
|
|
901
|
-
const start = broadcastCalendar ? dateLib.startOfBroadcastWeek(
|
|
903
|
+
function getWeekdays(dateLib, ISOWeek, broadcastCalendar, today) {
|
|
904
|
+
const referenceToday = today ?? dateLib.today();
|
|
905
|
+
const start = broadcastCalendar ? dateLib.startOfBroadcastWeek(referenceToday, dateLib) : ISOWeek ? dateLib.startOfISOWeek(referenceToday) : dateLib.startOfWeek(referenceToday);
|
|
902
906
|
const days = [];
|
|
903
907
|
for (let i = 0; i < 7; i++) {
|
|
904
908
|
const day = dateLib.addDays(start, i);
|
|
@@ -1197,12 +1201,39 @@ function useCalendar(props, dateLib) {
|
|
|
1197
1201
|
useEffect(() => {
|
|
1198
1202
|
setFirstMonth(getInitialMonth(props, navStart, navEnd, dateLib));
|
|
1199
1203
|
}, [props.timeZone]);
|
|
1200
|
-
const
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1204
|
+
const { months, weeks, days, previousMonth: previousMonth$2, nextMonth: nextMonth$2 } = useMemo(() => {
|
|
1205
|
+
const displayMonths = getDisplayMonths(firstMonth, navEnd, { numberOfMonths: props.numberOfMonths }, dateLib);
|
|
1206
|
+
const months$1 = getMonths(displayMonths, getDates(displayMonths, props.endMonth ? endOfMonth$1(props.endMonth) : void 0, {
|
|
1207
|
+
ISOWeek: props.ISOWeek,
|
|
1208
|
+
fixedWeeks: props.fixedWeeks,
|
|
1209
|
+
broadcastCalendar: props.broadcastCalendar
|
|
1210
|
+
}, dateLib), {
|
|
1211
|
+
broadcastCalendar: props.broadcastCalendar,
|
|
1212
|
+
fixedWeeks: props.fixedWeeks,
|
|
1213
|
+
ISOWeek: props.ISOWeek,
|
|
1214
|
+
reverseMonths: props.reverseMonths
|
|
1215
|
+
}, dateLib);
|
|
1216
|
+
return {
|
|
1217
|
+
months: months$1,
|
|
1218
|
+
weeks: getWeeks(months$1),
|
|
1219
|
+
days: getDays(months$1),
|
|
1220
|
+
previousMonth: getPreviousMonth(firstMonth, navStart, props, dateLib),
|
|
1221
|
+
nextMonth: getNextMonth(firstMonth, navEnd, props, dateLib)
|
|
1222
|
+
};
|
|
1223
|
+
}, [
|
|
1224
|
+
dateLib,
|
|
1225
|
+
firstMonth.getTime(),
|
|
1226
|
+
navEnd?.getTime(),
|
|
1227
|
+
navStart?.getTime(),
|
|
1228
|
+
props.disableNavigation,
|
|
1229
|
+
props.broadcastCalendar,
|
|
1230
|
+
props.endMonth?.getTime(),
|
|
1231
|
+
props.fixedWeeks,
|
|
1232
|
+
props.ISOWeek,
|
|
1233
|
+
props.numberOfMonths,
|
|
1234
|
+
props.pagedNavigation,
|
|
1235
|
+
props.reverseMonths
|
|
1236
|
+
]);
|
|
1206
1237
|
const { disableNavigation, onMonthChange } = props;
|
|
1207
1238
|
const isDayInCalendar = (day) => weeks.some((week) => week.days.some((d) => d.isEqualTo(day)));
|
|
1208
1239
|
const goToMonth = (date) => {
|
|
@@ -1517,21 +1548,60 @@ function useSelection(props, dateLib) {
|
|
|
1517
1548
|
default: return;
|
|
1518
1549
|
}
|
|
1519
1550
|
}
|
|
1551
|
+
function toTimeZone(date, timeZone) {
|
|
1552
|
+
if (date instanceof TZDate && date.timeZone === timeZone) return date;
|
|
1553
|
+
return new TZDate(date, timeZone);
|
|
1554
|
+
}
|
|
1555
|
+
function convertMatcher(matcher, timeZone) {
|
|
1556
|
+
if (typeof matcher === "boolean" || typeof matcher === "function") return matcher;
|
|
1557
|
+
if (matcher instanceof Date) return toTimeZone(matcher, timeZone);
|
|
1558
|
+
if (Array.isArray(matcher)) return matcher.map((value) => value instanceof Date ? toTimeZone(value, timeZone) : value);
|
|
1559
|
+
if (isDateRange(matcher)) return {
|
|
1560
|
+
...matcher,
|
|
1561
|
+
from: matcher.from ? toTimeZone(matcher.from, timeZone) : matcher.from,
|
|
1562
|
+
to: matcher.to ? toTimeZone(matcher.to, timeZone) : matcher.to
|
|
1563
|
+
};
|
|
1564
|
+
if (isDateInterval(matcher)) return {
|
|
1565
|
+
before: toTimeZone(matcher.before, timeZone),
|
|
1566
|
+
after: toTimeZone(matcher.after, timeZone)
|
|
1567
|
+
};
|
|
1568
|
+
if (isDateAfterType(matcher)) return { after: toTimeZone(matcher.after, timeZone) };
|
|
1569
|
+
if (isDateBeforeType(matcher)) return { before: toTimeZone(matcher.before, timeZone) };
|
|
1570
|
+
return matcher;
|
|
1571
|
+
}
|
|
1572
|
+
function convertMatchersToTimeZone(matchers, timeZone) {
|
|
1573
|
+
if (!matchers) return matchers;
|
|
1574
|
+
if (Array.isArray(matchers)) return matchers.map((matcher) => convertMatcher(matcher, timeZone));
|
|
1575
|
+
return convertMatcher(matchers, timeZone);
|
|
1576
|
+
}
|
|
1520
1577
|
function DayPicker(initialProps) {
|
|
1521
1578
|
let props = initialProps;
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
if (props.
|
|
1529
|
-
if (props.
|
|
1530
|
-
|
|
1579
|
+
const timeZone = props.timeZone;
|
|
1580
|
+
if (timeZone) {
|
|
1581
|
+
props = {
|
|
1582
|
+
...initialProps,
|
|
1583
|
+
timeZone
|
|
1584
|
+
};
|
|
1585
|
+
if (props.today) props.today = toTimeZone(props.today, timeZone);
|
|
1586
|
+
if (props.month) props.month = toTimeZone(props.month, timeZone);
|
|
1587
|
+
if (props.defaultMonth) props.defaultMonth = toTimeZone(props.defaultMonth, timeZone);
|
|
1588
|
+
if (props.startMonth) props.startMonth = toTimeZone(props.startMonth, timeZone);
|
|
1589
|
+
if (props.endMonth) props.endMonth = toTimeZone(props.endMonth, timeZone);
|
|
1590
|
+
if (props.mode === "single" && props.selected) props.selected = toTimeZone(props.selected, timeZone);
|
|
1591
|
+
else if (props.mode === "multiple" && props.selected) props.selected = props.selected?.map((date) => toTimeZone(date, timeZone));
|
|
1531
1592
|
else if (props.mode === "range" && props.selected) props.selected = {
|
|
1532
|
-
from: props.selected.from ?
|
|
1533
|
-
to: props.selected.to ?
|
|
1593
|
+
from: props.selected.from ? toTimeZone(props.selected.from, timeZone) : props.selected.from,
|
|
1594
|
+
to: props.selected.to ? toTimeZone(props.selected.to, timeZone) : props.selected.to
|
|
1534
1595
|
};
|
|
1596
|
+
if (props.disabled !== void 0) props.disabled = convertMatchersToTimeZone(props.disabled, timeZone);
|
|
1597
|
+
if (props.hidden !== void 0) props.hidden = convertMatchersToTimeZone(props.hidden, timeZone);
|
|
1598
|
+
if (props.modifiers) {
|
|
1599
|
+
const nextModifiers = {};
|
|
1600
|
+
Object.keys(props.modifiers).forEach((key) => {
|
|
1601
|
+
nextModifiers[key] = convertMatchersToTimeZone(props.modifiers?.[key], timeZone);
|
|
1602
|
+
});
|
|
1603
|
+
props.modifiers = nextModifiers;
|
|
1604
|
+
}
|
|
1535
1605
|
}
|
|
1536
1606
|
const { components, formatters, labels, dateLib, locale, classNames: classNames$1 } = useMemo(() => {
|
|
1537
1607
|
const locale$1 = {
|
|
@@ -1575,6 +1645,10 @@ function DayPicker(initialProps) {
|
|
|
1575
1645
|
props.labels,
|
|
1576
1646
|
props.classNames
|
|
1577
1647
|
]);
|
|
1648
|
+
if (!props.today) props = {
|
|
1649
|
+
...props,
|
|
1650
|
+
today: dateLib.today()
|
|
1651
|
+
};
|
|
1578
1652
|
const { captionLayout, mode, navLayout, numberOfMonths = 1, onDayBlur, onDayClick, onDayFocus, onDayKeyDown, onDayMouseEnter, onDayMouseLeave, onNextClick, onPrevClick, showWeekNumber, styles: styles$1 } = props;
|
|
1579
1653
|
const { formatCaption: formatCaption$1, formatDay: formatDay$1, formatMonthDropdown: formatMonthDropdown$1, formatWeekNumber: formatWeekNumber$1, formatWeekNumberHeader: formatWeekNumberHeader$1, formatWeekdayName: formatWeekdayName$1, formatYearDropdown: formatYearDropdown$1 } = formatters;
|
|
1580
1654
|
const calendar = useCalendar(props, dateLib);
|
|
@@ -1583,7 +1657,12 @@ function DayPicker(initialProps) {
|
|
|
1583
1657
|
const { isSelected, select, selected: selectedValue } = useSelection(props, dateLib) ?? {};
|
|
1584
1658
|
const { blur, focused, isFocusTarget, moveFocus, setFocused } = useFocus(props, calendar, getModifiers, isSelected ?? (() => false), dateLib);
|
|
1585
1659
|
const { labelDayButton: labelDayButton$1, labelGridcell: labelGridcell$1, labelGrid: labelGrid$1, labelMonthDropdown: labelMonthDropdown$1, labelNav: labelNav$1, labelPrevious: labelPrevious$1, labelNext: labelNext$1, labelWeekday: labelWeekday$1, labelWeekNumber: labelWeekNumber$1, labelWeekNumberHeader: labelWeekNumberHeader$1, labelYearDropdown: labelYearDropdown$1 } = labels;
|
|
1586
|
-
const weekdays = useMemo(() => getWeekdays(dateLib, props.ISOWeek
|
|
1660
|
+
const weekdays = useMemo(() => getWeekdays(dateLib, props.ISOWeek, props.broadcastCalendar, props.today), [
|
|
1661
|
+
dateLib,
|
|
1662
|
+
props.ISOWeek,
|
|
1663
|
+
props.broadcastCalendar,
|
|
1664
|
+
props.today
|
|
1665
|
+
]);
|
|
1587
1666
|
const isInteractive = mode !== void 0 || onDayClick !== void 0;
|
|
1588
1667
|
const handlePreviousClick = useCallback(() => {
|
|
1589
1668
|
if (!previousMonth$2) return;
|
|
@@ -1868,7 +1947,7 @@ function DayPicker(initialProps) {
|
|
|
1868
1947
|
const className$1 = getClassNamesForModifiers(modifiers, classNames$1, props.modifiersClassNames);
|
|
1869
1948
|
const ariaLabel = !isInteractive && !modifiers.hidden ? labelGridcell$1(date, modifiers, dateLib.options, dateLib) : void 0;
|
|
1870
1949
|
return React.createElement(components.Day, {
|
|
1871
|
-
key: `${
|
|
1950
|
+
key: `${day.isoDate}_${day.displayMonthId}`,
|
|
1872
1951
|
day,
|
|
1873
1952
|
modifiers,
|
|
1874
1953
|
className: className$1.join(" "),
|
|
@@ -1876,8 +1955,8 @@ function DayPicker(initialProps) {
|
|
|
1876
1955
|
role: "gridcell",
|
|
1877
1956
|
"aria-selected": modifiers.selected || void 0,
|
|
1878
1957
|
"aria-label": ariaLabel,
|
|
1879
|
-
"data-day":
|
|
1880
|
-
"data-month": day.outside ?
|
|
1958
|
+
"data-day": day.isoDate,
|
|
1959
|
+
"data-month": day.outside ? day.dateMonthId : void 0,
|
|
1881
1960
|
"data-selected": modifiers.selected || void 0,
|
|
1882
1961
|
"data-disabled": modifiers.disabled || void 0,
|
|
1883
1962
|
"data-hidden": modifiers.hidden || void 0,
|
|
@@ -1890,7 +1969,8 @@ function DayPicker(initialProps) {
|
|
|
1890
1969
|
type: "button",
|
|
1891
1970
|
day,
|
|
1892
1971
|
modifiers,
|
|
1893
|
-
disabled: modifiers.disabled || void 0,
|
|
1972
|
+
disabled: !modifiers.focused && modifiers.disabled || void 0,
|
|
1973
|
+
"aria-disabled": modifiers.focused && modifiers.disabled || void 0,
|
|
1894
1974
|
tabIndex: isFocusTarget(day) ? 0 : -1,
|
|
1895
1975
|
"aria-label": labelDayButton$1(date, modifiers, dateLib.options, dateLib),
|
|
1896
1976
|
onClick: handleDayClick(day, modifiers),
|
|
@@ -2132,7 +2212,9 @@ var HN_Designsystem_DatePicker_nb_NO_default = {
|
|
|
2132
2212
|
nextMonth: "Neste måned",
|
|
2133
2213
|
previousMonth: "Forrige måned",
|
|
2134
2214
|
monthDropdown: "Velg måned",
|
|
2135
|
-
yearDropdown: "Velg år"
|
|
2215
|
+
yearDropdown: "Velg år",
|
|
2216
|
+
goToToday: "Gå til i dag",
|
|
2217
|
+
loadingText: "Henter info. Vennligst vent."
|
|
2136
2218
|
};
|
|
2137
2219
|
const getResources = (language) => {
|
|
2138
2220
|
switch (language) {
|