@gnist/design-system 7.10.0 → 7.10.2
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/CHANGELOG.md +13 -0
- package/dist/components/actions/buttons/IconButton.cjs +2 -2
- package/dist/components/actions/buttons/IconButton.d.ts.map +1 -1
- package/dist/components/actions/buttons/IconButton.js +2 -2
- package/dist/components/inputs/pickers/calendar.cjs +69 -83
- package/dist/components/inputs/pickers/calendar.d.ts +3 -1
- package/dist/components/inputs/pickers/calendar.d.ts.map +1 -1
- package/dist/components/inputs/pickers/calendar.js +69 -83
- package/dist/translations/en.cjs +1 -0
- package/dist/translations/en.d.ts.map +1 -1
- package/dist/translations/en.js +1 -0
- package/dist/translations/no.cjs +1 -0
- package/dist/translations/no.d.ts +1 -0
- package/dist/translations/no.d.ts.map +1 -1
- package/dist/translations/no.js +1 -0
- package/package.json +18 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [7.10.2](https://github.com/mollerdigital/design-system/compare/%40gnist%2Fdesign-system%407.10.1...%40gnist%2Fdesign-system%407.10.2) (2026-11-24)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* preserve the accessible label on icon-only buttons ([35eda01](https://github.com/mollerdigital/design-system/commit/35eda01407b17c2b6d27ac8a4cb5f7d57ebbeb31))
|
|
11
|
+
|
|
12
|
+
## [7.10.1](https://github.com/mollerdigital/design-system/compare/%40gnist%2Fdesign-system%407.10.0...%40gnist%2Fdesign-system%407.10.1) (2026-11-20)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **calendar:** mention LocalizationProvider in docs for changing texts ([6e6d896](https://github.com/mollerdigital/design-system/commit/6e6d8960e3b97b0c92eb0f8f6e5359ff2596c9c6))
|
|
17
|
+
* **calender:** improve loading accessibility ([26dca4b](https://github.com/mollerdigital/design-system/commit/26dca4bf15ac30a67546f8af3ac22c56a3dd6921))
|
|
18
|
+
|
|
6
19
|
## [7.10.0](https://github.com/mollerdigital/design-system/compare/%40gnist%2Fdesign-system%407.9.1...%40gnist%2Fdesign-system%407.10.0) (2026-11-20)
|
|
7
20
|
|
|
8
21
|
### Features
|
|
@@ -17,7 +17,7 @@ Note: Unlike most button components, `disabled`, `loading` and `density` props d
|
|
|
17
17
|
|
|
18
18
|
Documentation: [IconButton](https://gnist.moller.no/developers/components/latest/?path=/docs/components-actions-buttons-iconbutton--docs)
|
|
19
19
|
*/
|
|
20
|
-
function IconButton({ $as, as, className, showLabel, label, icon, variantOverride, ...props }) {
|
|
20
|
+
function IconButton({ $as, as, className, showLabel = "none", label, icon, variantOverride, ...props }) {
|
|
21
21
|
return (0, react.createElement)($as ?? as ?? "button", {
|
|
22
22
|
...props,
|
|
23
23
|
className: (0, classnames.default)(className, require_styles_css.buttonRecipe({
|
|
@@ -36,7 +36,7 @@ function IconButton({ $as, as, className, showLabel, label, icon, variantOverrid
|
|
|
36
36
|
}),
|
|
37
37
|
(0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
38
38
|
icon,
|
|
39
|
-
title: showLabel ? void 0
|
|
39
|
+
title: showLabel === "none" ? label : void 0,
|
|
40
40
|
variantOverride
|
|
41
41
|
}),
|
|
42
42
|
showLabel === "right" && (0, react_jsx_runtime.jsx)(require_index$1.BodyText, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../../src/components/actions/buttons/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,wDAAoE;AAG3F,OAAO,EAAE,WAAW,EAAE,YAAY,EAAiB,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,YAAY,EAAQ,MAAM,0CAA0C,CAAC;AAI9E,KAAK,eAAe,CAAC,SAAS,SAAS,WAAW,IAC9C,gBAAgB,CAAC,SAAS,CAAC,GAAG;IAC1B;;OAEG;IACH,IAAI,EAAE,YAAY,CAAC;IACnB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IACtC,mHAAmH;IACnH,eAAe,CAAC,EAAE,YAAY,CAAC;IAC/B,GAAG,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;CAC/B,CAAC;AAEN;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,SAAS,SAAS,WAAW,GAAG,QAAQ,EAAE,EACjE,GAAG,EACH,EAAE,EACF,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../../src/components/actions/buttons/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,wDAAoE;AAG3F,OAAO,EAAE,WAAW,EAAE,YAAY,EAAiB,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,YAAY,EAAQ,MAAM,0CAA0C,CAAC;AAI9E,KAAK,eAAe,CAAC,SAAS,SAAS,WAAW,IAC9C,gBAAgB,CAAC,SAAS,CAAC,GAAG;IAC1B;;OAEG;IACH,IAAI,EAAE,YAAY,CAAC;IACnB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IACtC,mHAAmH;IACnH,eAAe,CAAC,EAAE,YAAY,CAAC;IAC/B,GAAG,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;CAC/B,CAAC;AAEN;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,SAAS,SAAS,WAAW,GAAG,QAAQ,EAAE,EACjE,GAAG,EACH,EAAE,EACF,SAAS,EACT,SAAkB,EAClB,KAAK,EACL,IAAI,EACJ,eAAe,EACf,GAAG,KAAK,EACX,EAAE,eAAe,CAAC,SAAS,CAAC,0FA+B5B"}
|
|
@@ -15,7 +15,7 @@ Note: Unlike most button components, `disabled`, `loading` and `density` props d
|
|
|
15
15
|
|
|
16
16
|
Documentation: [IconButton](https://gnist.moller.no/developers/components/latest/?path=/docs/components-actions-buttons-iconbutton--docs)
|
|
17
17
|
*/
|
|
18
|
-
function IconButton({ $as, as, className, showLabel, label, icon, variantOverride, ...props }) {
|
|
18
|
+
function IconButton({ $as, as, className, showLabel = "none", label, icon, variantOverride, ...props }) {
|
|
19
19
|
return createElement($as ?? as ?? "button", {
|
|
20
20
|
...props,
|
|
21
21
|
className: classNames(className, buttonRecipe({
|
|
@@ -34,7 +34,7 @@ function IconButton({ $as, as, className, showLabel, label, icon, variantOverrid
|
|
|
34
34
|
}),
|
|
35
35
|
jsx(Icon, {
|
|
36
36
|
icon,
|
|
37
|
-
title: showLabel ? void 0
|
|
37
|
+
title: showLabel === "none" ? label : void 0,
|
|
38
38
|
variantOverride
|
|
39
39
|
}),
|
|
40
40
|
showLabel === "right" && jsx(BodyText, {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
const require_visuallyHidden_css = require("../../../utilities/accessibility/visuallyHidden.css.cjs");
|
|
3
|
+
require("../../../building-blocks/index.cjs");
|
|
2
4
|
const require_IconButton = require("../../actions/buttons/IconButton.cjs");
|
|
3
5
|
const require_RectangularSkeleton = require("../../../building-blocks/skeletons/RectangularSkeleton.cjs");
|
|
4
|
-
require("../../../building-blocks/index.cjs");
|
|
5
6
|
const require_index$1 = require("../../../translations/index.cjs");
|
|
6
7
|
const require_date = require("../../../utilities/time/date.cjs");
|
|
8
|
+
require("../../../utilities/accessibility/index.cjs");
|
|
7
9
|
require("../../actions/index.cjs");
|
|
8
10
|
const require_Calendar_css = require("./Calendar.css.cjs");
|
|
9
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -29,7 +31,6 @@ var Week = ({ weekDays, current, setCurrent, selected, setSelected, focused, set
|
|
|
29
31
|
};
|
|
30
32
|
if (isLoading) return (0, react_jsx_runtime.jsx)("div", {
|
|
31
33
|
className: require_Calendar_css.rowStyle,
|
|
32
|
-
role: "row",
|
|
33
34
|
style: { ...(0, _vanilla_extract_dynamic.assignInlineVars)({ [require_Calendar_css.firstDay]: weekDayNumberStartingMonday(weekDays[0]).toString() }) },
|
|
34
35
|
children: weekDays.map((d) => (0, react_jsx_runtime.jsx)(require_RectangularSkeleton.RectangularSkeleton, { className: require_Calendar_css.cellSkeletonStyle }, d.getTime()))
|
|
35
36
|
});
|
|
@@ -142,7 +143,7 @@ var DateGrid = ({ current, setCurrent, selected, setSelected, focused, setFocus,
|
|
|
142
143
|
display: "grid",
|
|
143
144
|
gap: _gnist_themes_tokens_css_js.tokens.spacing.base
|
|
144
145
|
},
|
|
145
|
-
role: "rowgroup",
|
|
146
|
+
role: isLoading ? void 0 : "rowgroup",
|
|
146
147
|
children: weeks.map((week) => (0, react_jsx_runtime.jsx)(Week, {
|
|
147
148
|
weekDays: week,
|
|
148
149
|
setCurrent,
|
|
@@ -167,6 +168,8 @@ function clampDate(date, minDate, maxDate) {
|
|
|
167
168
|
/**
|
|
168
169
|
* When a user does not know what date they will select, it can be useful to offer a browsing experience using a calendar component. This allows users to see dates organized into weeks and months, or with additional context such as which dates are unavailable for selection.
|
|
169
170
|
*
|
|
171
|
+
* Calendar text defaults to Norwegian; use `LocalizationProvider` to change the language.
|
|
172
|
+
*
|
|
170
173
|
* Documentation: [Calendar](https://gnist.moller.no/developers/components/latest/?path=/docs/components-inputs-pickers-calendar--docs)
|
|
171
174
|
*/
|
|
172
175
|
function Calendar({ selected, setSelected, isDateUnavailable, minDate: origMinDate, maxDate: origMaxDate, onNavigate, isLoading, ref }) {
|
|
@@ -201,87 +204,70 @@ function Calendar({ selected, setSelected, isDateUnavailable, minDate: origMinDa
|
|
|
201
204
|
role: "group",
|
|
202
205
|
"aria-label": text.calendar,
|
|
203
206
|
ref,
|
|
204
|
-
children: [
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
207
|
+
children: [
|
|
208
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
209
|
+
className: require_Calendar_css.selectMonthRow,
|
|
210
|
+
children: [(0, react_jsx_runtime.jsxs)("span", {
|
|
211
|
+
"aria-live": "polite",
|
|
212
|
+
children: [
|
|
213
|
+
getMonthName(current.getMonth() + 1),
|
|
214
|
+
" ",
|
|
215
|
+
current.getFullYear(),
|
|
216
|
+
" "
|
|
217
|
+
]
|
|
218
|
+
}), (0, react_jsx_runtime.jsxs)("div", {
|
|
219
|
+
className: require_Calendar_css.buttonRow,
|
|
220
|
+
children: [(0, react_jsx_runtime.jsx)(require_IconButton.IconButton, {
|
|
221
|
+
className: require_Calendar_css.arrowButton,
|
|
222
|
+
icon: "arrow_backward",
|
|
223
|
+
onClick: () => {
|
|
224
|
+
handleChangeMonth(-1);
|
|
225
|
+
},
|
|
226
|
+
label: text.showPreviousMonth,
|
|
227
|
+
disabled: minDate && require_date.maxDayOfMonth(require_date.nextMonth(current, -1)) < minDate
|
|
228
|
+
}), (0, react_jsx_runtime.jsx)(require_IconButton.IconButton, {
|
|
229
|
+
className: require_Calendar_css.arrowButton,
|
|
230
|
+
icon: "arrow_forward",
|
|
231
|
+
onClick: () => {
|
|
232
|
+
handleChangeMonth(1);
|
|
233
|
+
},
|
|
234
|
+
label: text.showNextMonth,
|
|
235
|
+
disabled: maxDate && require_date.nextMonth(current, 1) > maxDate
|
|
236
|
+
})]
|
|
237
|
+
})]
|
|
238
|
+
}),
|
|
239
|
+
(0, react_jsx_runtime.jsx)("div", {
|
|
240
|
+
role: "status",
|
|
241
|
+
className: require_visuallyHidden_css.visuallyHidden,
|
|
242
|
+
children: isLoading ? text.loadingDates : null
|
|
243
|
+
}),
|
|
244
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
245
|
+
className: require_Calendar_css.gridStyle,
|
|
246
|
+
role: isLoading ? void 0 : "grid",
|
|
247
|
+
"aria-hidden": isLoading || void 0,
|
|
248
|
+
children: [(0, react_jsx_runtime.jsx)("div", {
|
|
249
|
+
className: require_Calendar_css.rowStyle,
|
|
250
|
+
role: isLoading ? void 0 : "row",
|
|
251
|
+
style: { height: "unset" },
|
|
252
|
+
children: Object.entries(days).map(([day, label]) => (0, react_jsx_runtime.jsx)(HeaderCell, {
|
|
253
|
+
role: isLoading ? void 0 : "columnheader",
|
|
254
|
+
children: label
|
|
255
|
+
}, day))
|
|
256
|
+
}), (0, react_jsx_runtime.jsx)(DateGrid, {
|
|
257
|
+
current,
|
|
258
|
+
setCurrent,
|
|
259
|
+
selected,
|
|
260
|
+
setSelected,
|
|
261
|
+
focused,
|
|
262
|
+
setFocus,
|
|
263
|
+
focusRef,
|
|
264
|
+
isDateUnavailable,
|
|
265
|
+
minDate,
|
|
266
|
+
maxDate,
|
|
267
|
+
isLoading: !!isLoading
|
|
232
268
|
})]
|
|
233
|
-
})
|
|
234
|
-
|
|
235
|
-
className: require_Calendar_css.gridStyle,
|
|
236
|
-
role: "grid",
|
|
237
|
-
children: [(0, react_jsx_runtime.jsxs)("div", {
|
|
238
|
-
className: require_Calendar_css.rowStyle,
|
|
239
|
-
role: "row",
|
|
240
|
-
style: { height: "unset" },
|
|
241
|
-
children: [
|
|
242
|
-
(0, react_jsx_runtime.jsx)(HeaderCell, {
|
|
243
|
-
role: "columnheader",
|
|
244
|
-
children: days.mon
|
|
245
|
-
}),
|
|
246
|
-
(0, react_jsx_runtime.jsx)(HeaderCell, {
|
|
247
|
-
role: "columnheader",
|
|
248
|
-
children: days.tue
|
|
249
|
-
}),
|
|
250
|
-
(0, react_jsx_runtime.jsx)(HeaderCell, {
|
|
251
|
-
role: "columnheader",
|
|
252
|
-
children: days.wed
|
|
253
|
-
}),
|
|
254
|
-
(0, react_jsx_runtime.jsx)(HeaderCell, {
|
|
255
|
-
role: "columnheader",
|
|
256
|
-
children: days.thu
|
|
257
|
-
}),
|
|
258
|
-
(0, react_jsx_runtime.jsx)(HeaderCell, {
|
|
259
|
-
role: "columnheader",
|
|
260
|
-
children: days.fri
|
|
261
|
-
}),
|
|
262
|
-
(0, react_jsx_runtime.jsx)(HeaderCell, {
|
|
263
|
-
role: "columnheader",
|
|
264
|
-
children: days.sat
|
|
265
|
-
}),
|
|
266
|
-
(0, react_jsx_runtime.jsx)(HeaderCell, {
|
|
267
|
-
role: "columnheader",
|
|
268
|
-
children: days.sun
|
|
269
|
-
})
|
|
270
|
-
]
|
|
271
|
-
}), (0, react_jsx_runtime.jsx)(DateGrid, {
|
|
272
|
-
current,
|
|
273
|
-
setCurrent,
|
|
274
|
-
selected,
|
|
275
|
-
setSelected,
|
|
276
|
-
focused,
|
|
277
|
-
setFocus,
|
|
278
|
-
focusRef,
|
|
279
|
-
isDateUnavailable,
|
|
280
|
-
minDate,
|
|
281
|
-
maxDate,
|
|
282
|
-
isLoading: !!isLoading
|
|
283
|
-
})]
|
|
284
|
-
})]
|
|
269
|
+
})
|
|
270
|
+
]
|
|
285
271
|
});
|
|
286
272
|
}
|
|
287
273
|
exports.Calendar = Calendar;
|
|
@@ -12,13 +12,15 @@ export interface CalendarProps {
|
|
|
12
12
|
maxDate?: Date;
|
|
13
13
|
/** A callback that is called when the user navigates in the calendar */
|
|
14
14
|
onNavigate?: (date: Date) => void;
|
|
15
|
-
/**
|
|
15
|
+
/** Replaces the date grid with a decorative skeleton and provides a localized loading status for assistive technology. */
|
|
16
16
|
isLoading?: boolean;
|
|
17
17
|
ref?: Ref<HTMLDivElement>;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* When a user does not know what date they will select, it can be useful to offer a browsing experience using a calendar component. This allows users to see dates organized into weeks and months, or with additional context such as which dates are unavailable for selection.
|
|
21
21
|
*
|
|
22
|
+
* Calendar text defaults to Norwegian; use `LocalizationProvider` to change the language.
|
|
23
|
+
*
|
|
22
24
|
* Documentation: [Calendar](https://gnist.moller.no/developers/components/latest/?path=/docs/components-inputs-pickers-calendar--docs)
|
|
23
25
|
*/
|
|
24
26
|
export declare function Calendar({ selected, setSelected, isDateUnavailable, minDate: origMinDate, maxDate: origMaxDate, onNavigate, isLoading, ref, }: CalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/pickers/calendar.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,GAAG,EAA+B,MAAM,OAAO,CAAC;AA4RzD,MAAM,WAAW,aAAa;IAC1B,mBAAmB;IACnB,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAC;IAC3B,kCAAkC;IAClC,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;IAC9C,0DAA0D;IAC1D,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IAC5C,6BAA6B;IAC7B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,4BAA4B;IAC5B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,wEAAwE;IACxE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAClC,
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/pickers/calendar.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,GAAG,EAA+B,MAAM,OAAO,CAAC;AA4RzD,MAAM,WAAW,aAAa;IAC1B,mBAAmB;IACnB,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAC;IAC3B,kCAAkC;IAClC,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;IAC9C,0DAA0D;IAC1D,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IAC5C,6BAA6B;IAC7B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,4BAA4B;IAC5B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,wEAAwE;IACxE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAClC,0HAA0H;IAC1H,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC7B;AAED;;;;;;GAMG;AAEH,wBAAgB,QAAQ,CAAC,EACrB,QAAQ,EACR,WAAW,EACX,iBAAiB,EACjB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,EACpB,UAAU,EACV,SAAS,EACT,GAAG,GACN,EAAE,aAAa,2CAqHf"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { visuallyHidden } from "../../../utilities/accessibility/visuallyHidden.css.js";
|
|
3
|
+
import "../../../building-blocks/index.js";
|
|
2
4
|
import { IconButton } from "../../actions/buttons/IconButton.js";
|
|
3
5
|
import { RectangularSkeleton } from "../../../building-blocks/skeletons/RectangularSkeleton.js";
|
|
4
|
-
import "../../../building-blocks/index.js";
|
|
5
6
|
import { useTranslation } from "../../../translations/index.js";
|
|
6
7
|
import { addDays, getStartOfDay, isNorwegianHoliday, isSameDate, maxDayOfMonth, minDayOfMonth, nextMonth, today } from "../../../utilities/time/date.js";
|
|
8
|
+
import "../../../utilities/accessibility/index.js";
|
|
7
9
|
import "../../actions/index.js";
|
|
8
10
|
import { arrowButton, buttonRow, cellRecipe, cellSkeletonStyle, containerStyle, firstDay, gridStyle, headerCell, rowStyle, selectMonthRow } from "./Calendar.css.js";
|
|
9
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -29,7 +31,6 @@ var Week = ({ weekDays, current, setCurrent, selected, setSelected, focused, set
|
|
|
29
31
|
};
|
|
30
32
|
if (isLoading) return jsx("div", {
|
|
31
33
|
className: rowStyle,
|
|
32
|
-
role: "row",
|
|
33
34
|
style: { ...assignInlineVars({ [firstDay]: weekDayNumberStartingMonday(weekDays[0]).toString() }) },
|
|
34
35
|
children: weekDays.map((d) => jsx(RectangularSkeleton, { className: cellSkeletonStyle }, d.getTime()))
|
|
35
36
|
});
|
|
@@ -142,7 +143,7 @@ var DateGrid = ({ current, setCurrent, selected, setSelected, focused, setFocus,
|
|
|
142
143
|
display: "grid",
|
|
143
144
|
gap: tokens.spacing.base
|
|
144
145
|
},
|
|
145
|
-
role: "rowgroup",
|
|
146
|
+
role: isLoading ? void 0 : "rowgroup",
|
|
146
147
|
children: weeks.map((week) => jsx(Week, {
|
|
147
148
|
weekDays: week,
|
|
148
149
|
setCurrent,
|
|
@@ -167,6 +168,8 @@ function clampDate(date, minDate, maxDate) {
|
|
|
167
168
|
/**
|
|
168
169
|
* When a user does not know what date they will select, it can be useful to offer a browsing experience using a calendar component. This allows users to see dates organized into weeks and months, or with additional context such as which dates are unavailable for selection.
|
|
169
170
|
*
|
|
171
|
+
* Calendar text defaults to Norwegian; use `LocalizationProvider` to change the language.
|
|
172
|
+
*
|
|
170
173
|
* Documentation: [Calendar](https://gnist.moller.no/developers/components/latest/?path=/docs/components-inputs-pickers-calendar--docs)
|
|
171
174
|
*/
|
|
172
175
|
function Calendar({ selected, setSelected, isDateUnavailable, minDate: origMinDate, maxDate: origMaxDate, onNavigate, isLoading, ref }) {
|
|
@@ -201,87 +204,70 @@ function Calendar({ selected, setSelected, isDateUnavailable, minDate: origMinDa
|
|
|
201
204
|
role: "group",
|
|
202
205
|
"aria-label": text.calendar,
|
|
203
206
|
ref,
|
|
204
|
-
children: [
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
207
|
+
children: [
|
|
208
|
+
jsxs("div", {
|
|
209
|
+
className: selectMonthRow,
|
|
210
|
+
children: [jsxs("span", {
|
|
211
|
+
"aria-live": "polite",
|
|
212
|
+
children: [
|
|
213
|
+
getMonthName(current.getMonth() + 1),
|
|
214
|
+
" ",
|
|
215
|
+
current.getFullYear(),
|
|
216
|
+
" "
|
|
217
|
+
]
|
|
218
|
+
}), jsxs("div", {
|
|
219
|
+
className: buttonRow,
|
|
220
|
+
children: [jsx(IconButton, {
|
|
221
|
+
className: arrowButton,
|
|
222
|
+
icon: "arrow_backward",
|
|
223
|
+
onClick: () => {
|
|
224
|
+
handleChangeMonth(-1);
|
|
225
|
+
},
|
|
226
|
+
label: text.showPreviousMonth,
|
|
227
|
+
disabled: minDate && maxDayOfMonth(nextMonth(current, -1)) < minDate
|
|
228
|
+
}), jsx(IconButton, {
|
|
229
|
+
className: arrowButton,
|
|
230
|
+
icon: "arrow_forward",
|
|
231
|
+
onClick: () => {
|
|
232
|
+
handleChangeMonth(1);
|
|
233
|
+
},
|
|
234
|
+
label: text.showNextMonth,
|
|
235
|
+
disabled: maxDate && nextMonth(current, 1) > maxDate
|
|
236
|
+
})]
|
|
237
|
+
})]
|
|
238
|
+
}),
|
|
239
|
+
jsx("div", {
|
|
240
|
+
role: "status",
|
|
241
|
+
className: visuallyHidden,
|
|
242
|
+
children: isLoading ? text.loadingDates : null
|
|
243
|
+
}),
|
|
244
|
+
jsxs("div", {
|
|
245
|
+
className: gridStyle,
|
|
246
|
+
role: isLoading ? void 0 : "grid",
|
|
247
|
+
"aria-hidden": isLoading || void 0,
|
|
248
|
+
children: [jsx("div", {
|
|
249
|
+
className: rowStyle,
|
|
250
|
+
role: isLoading ? void 0 : "row",
|
|
251
|
+
style: { height: "unset" },
|
|
252
|
+
children: Object.entries(days).map(([day, label]) => jsx(HeaderCell, {
|
|
253
|
+
role: isLoading ? void 0 : "columnheader",
|
|
254
|
+
children: label
|
|
255
|
+
}, day))
|
|
256
|
+
}), jsx(DateGrid, {
|
|
257
|
+
current,
|
|
258
|
+
setCurrent,
|
|
259
|
+
selected,
|
|
260
|
+
setSelected,
|
|
261
|
+
focused,
|
|
262
|
+
setFocus,
|
|
263
|
+
focusRef,
|
|
264
|
+
isDateUnavailable,
|
|
265
|
+
minDate,
|
|
266
|
+
maxDate,
|
|
267
|
+
isLoading: !!isLoading
|
|
232
268
|
})]
|
|
233
|
-
})
|
|
234
|
-
|
|
235
|
-
className: gridStyle,
|
|
236
|
-
role: "grid",
|
|
237
|
-
children: [jsxs("div", {
|
|
238
|
-
className: rowStyle,
|
|
239
|
-
role: "row",
|
|
240
|
-
style: { height: "unset" },
|
|
241
|
-
children: [
|
|
242
|
-
jsx(HeaderCell, {
|
|
243
|
-
role: "columnheader",
|
|
244
|
-
children: days.mon
|
|
245
|
-
}),
|
|
246
|
-
jsx(HeaderCell, {
|
|
247
|
-
role: "columnheader",
|
|
248
|
-
children: days.tue
|
|
249
|
-
}),
|
|
250
|
-
jsx(HeaderCell, {
|
|
251
|
-
role: "columnheader",
|
|
252
|
-
children: days.wed
|
|
253
|
-
}),
|
|
254
|
-
jsx(HeaderCell, {
|
|
255
|
-
role: "columnheader",
|
|
256
|
-
children: days.thu
|
|
257
|
-
}),
|
|
258
|
-
jsx(HeaderCell, {
|
|
259
|
-
role: "columnheader",
|
|
260
|
-
children: days.fri
|
|
261
|
-
}),
|
|
262
|
-
jsx(HeaderCell, {
|
|
263
|
-
role: "columnheader",
|
|
264
|
-
children: days.sat
|
|
265
|
-
}),
|
|
266
|
-
jsx(HeaderCell, {
|
|
267
|
-
role: "columnheader",
|
|
268
|
-
children: days.sun
|
|
269
|
-
})
|
|
270
|
-
]
|
|
271
|
-
}), jsx(DateGrid, {
|
|
272
|
-
current,
|
|
273
|
-
setCurrent,
|
|
274
|
-
selected,
|
|
275
|
-
setSelected,
|
|
276
|
-
focused,
|
|
277
|
-
setFocus,
|
|
278
|
-
focusRef,
|
|
279
|
-
isDateUnavailable,
|
|
280
|
-
minDate,
|
|
281
|
-
maxDate,
|
|
282
|
-
isLoading: !!isLoading
|
|
283
|
-
})]
|
|
284
|
-
})]
|
|
269
|
+
})
|
|
270
|
+
]
|
|
285
271
|
});
|
|
286
272
|
}
|
|
287
273
|
export { Calendar };
|
package/dist/translations/en.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/translations/en.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,eAAO,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/translations/en.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,eAAO,MAAM,EAAE,EAAE,WA+EhB,CAAC"}
|
package/dist/translations/en.js
CHANGED
package/dist/translations/no.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no.d.ts","sourceRoot":"","sources":["../../src/translations/no.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"no.d.ts","sourceRoot":"","sources":["../../src/translations/no.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCA+DqB,MAAM,iBAAiB,MAAM;0CAEvB,MAAM,iBAAiB,MAAM;;;;;;;;;;;CActE,CAAC"}
|
package/dist/translations/no.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gnist/design-system",
|
|
3
|
-
"version": "7.10.
|
|
3
|
+
"version": "7.10.2",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -39,19 +39,24 @@
|
|
|
39
39
|
"clean": "shx rm -rf dist",
|
|
40
40
|
"build": "vite build",
|
|
41
41
|
"serve": "vite preview",
|
|
42
|
-
"typecheck": "tsc -b",
|
|
43
|
-
"lint": "pnpm run detect-cycles && pnpm run
|
|
44
|
-
"
|
|
42
|
+
"typecheck": "tsc -b && pnpm run figma:typecheck",
|
|
43
|
+
"lint": "pnpm run detect-cycles && pnpm run oxlint && pnpm run figma:parse",
|
|
44
|
+
"oxlint": "oxlint --type-aware --disable-nested-config --max-warnings 0",
|
|
45
45
|
"detect-cycles": "pnpm madge --extensions ts,tsx ./src --circular",
|
|
46
46
|
"prettier:base": "prettier \"src/**/*.{ts,tsx,json,scss}\"",
|
|
47
47
|
"prettier": "pnpm run prettier:base --check",
|
|
48
|
-
"build-storybook": "cd docs && pnpm run build"
|
|
48
|
+
"build-storybook": "cd docs && pnpm run build",
|
|
49
|
+
"figma:typecheck": "tsc -p tsconfig.figma.json",
|
|
50
|
+
"figma:parse": "figma connect parse --exit-on-unreadable-files > /dev/null",
|
|
51
|
+
"figma:preview": "figma connect preview",
|
|
52
|
+
"figma:publish": "dotenv -e .env.local -- figma connect publish --exit-on-unreadable-files",
|
|
53
|
+
"figma:unpublish": "dotenv -e .env.local -- figma connect unpublish"
|
|
49
54
|
},
|
|
50
55
|
"dependencies": {
|
|
51
56
|
"@base-ui/react": "1.0.0",
|
|
52
57
|
"@formkit/auto-animate": "^0.8.4",
|
|
53
|
-
"@gnist/component-utils": "3.0.
|
|
54
|
-
"@gnist/themes": "^4.5.
|
|
58
|
+
"@gnist/component-utils": "3.0.20",
|
|
59
|
+
"@gnist/themes": "^4.5.2",
|
|
55
60
|
"@material-symbols/svg-400": "^0.42.3",
|
|
56
61
|
"@vanilla-extract/css": "1.20.1",
|
|
57
62
|
"@vanilla-extract/css-utils": "^0.1.6",
|
|
@@ -69,7 +74,8 @@
|
|
|
69
74
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
70
75
|
},
|
|
71
76
|
"devDependencies": {
|
|
72
|
-
"@
|
|
77
|
+
"@figma/code-connect": "^2.1.0",
|
|
78
|
+
"@gnist/oxlint-config": "",
|
|
73
79
|
"@gnist/ts-config": "",
|
|
74
80
|
"@rollup/plugin-typescript": "^12.3.1",
|
|
75
81
|
"@tsconfig/node24": "^24.0.5",
|
|
@@ -78,9 +84,11 @@
|
|
|
78
84
|
"@types/react-dom": "19.2.3",
|
|
79
85
|
"@types/semver": "^7.8.0",
|
|
80
86
|
"@vitejs/plugin-react-swc": "4.3.3",
|
|
81
|
-
"
|
|
87
|
+
"dotenv-cli": "^11.1.0",
|
|
82
88
|
"globby": "^14.1.0",
|
|
83
89
|
"madge": "^8.0.0",
|
|
90
|
+
"oxlint": "^1.94.0",
|
|
91
|
+
"oxlint-tsgolint": "^7.0.2007",
|
|
84
92
|
"prettier": "3.9.10",
|
|
85
93
|
"react": "19.2.3",
|
|
86
94
|
"react-dom": "19.2.3",
|
|
@@ -103,5 +111,5 @@
|
|
|
103
111
|
"optional": true
|
|
104
112
|
}
|
|
105
113
|
},
|
|
106
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "2a9e64884f6dd563d65f44c99bff5cf61df5ec23"
|
|
107
115
|
}
|