@utrecht/component-library-react 1.0.0-alpha.147 → 1.0.0-alpha.148

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.
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { ButtonProps } from '../Button';
3
+ export interface CalendarButtonProps extends ButtonProps {
4
+ }
5
+ export declare const CalendarButton: React.FC<CalendarButtonProps>;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export interface CalendarIconProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
3
+ children?: React.ReactNode;
4
+ }
5
+ export declare const CalendarIcon: React.FC<CalendarIconProps>;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export interface CalendarNavigationProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
3
+ children?: React.ReactNode;
4
+ }
5
+ export declare const CalendarNavigation: React.FC<CalendarNavigationProps>;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { CalendarButtonProps } from './CalendarButton';
3
+ interface CalendarNavigationButtonsProps extends CalendarButtonProps {
4
+ onPreviousClick?: React.MouseEventHandler<HTMLButtonElement>;
5
+ onNextClick?: React.MouseEventHandler<HTMLButtonElement>;
6
+ previousIcon?: any;
7
+ nextIcon?: any;
8
+ previousTitle?: string;
9
+ nextTitle?: string;
10
+ children?: React.ReactNode;
11
+ }
12
+ export declare const CalendarNavigationButtons: React.FC<CalendarNavigationButtonsProps>;
13
+ export {};
@@ -0,0 +1,6 @@
1
+ import { FC } from 'react';
2
+ interface CalendarNavigationLabelProps {
3
+ label?: string;
4
+ }
5
+ export declare const CalendarNavigationLabel: FC<CalendarNavigationLabelProps>;
6
+ export {};
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export interface CalendarTableDaysContainerProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement> {
3
+ children?: React.ReactNode;
4
+ }
5
+ export declare const CalendarTableDaysContainer: React.FC<CalendarTableDaysContainerProps>;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export interface CalendarTableDaysItemProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement> {
3
+ children?: React.ReactNode;
4
+ }
5
+ export declare const CalendarTableDaysItem: React.FC<CalendarTableDaysItemProps>;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { CalendarButtonProps } from './CalendarButton';
3
+ export interface CalendarTableDaysItemDayProps extends CalendarButtonProps {
4
+ day: string;
5
+ dayOutOfTheMonth?: boolean;
6
+ isToday: boolean;
7
+ emphasis?: boolean;
8
+ selected?: boolean;
9
+ disabled?: boolean;
10
+ }
11
+ export declare const CalendarTableDaysItemDay: React.FC<CalendarTableDaysItemDayProps>;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare const CalendarTableWeeksContainer: React.FC<{
3
+ children?: React.ReactNode;
4
+ }>;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export interface CalendarTableWeeksItemProps extends React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement> {
3
+ children?: React.ReactNode;
4
+ }
5
+ export declare const CalendarTableWeeksItem: React.FC<CalendarTableWeeksItemProps>;
@@ -0,0 +1,7 @@
1
+ import { SVGProps } from 'react';
2
+ interface SVGRProps {
3
+ title?: string;
4
+ titleId?: string;
5
+ }
6
+ export declare const IconArrowLeft: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { SVGProps } from 'react';
2
+ interface SVGRProps {
3
+ title?: string;
4
+ titleId?: string;
5
+ }
6
+ export declare const IconArrowLeftDouble: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { SVGProps } from 'react';
2
+ interface SVGRProps {
3
+ title?: string;
4
+ titleId?: string;
5
+ }
6
+ export declare const IconArrowRight: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { SVGProps } from 'react';
2
+ interface SVGRProps {
3
+ title?: string;
4
+ titleId?: string;
5
+ }
6
+ export declare const IconArrowRightDouble: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => JSX.Element;
7
+ export {};
@@ -0,0 +1,41 @@
1
+ import { Locale } from 'date-fns';
2
+ import { FC } from 'react';
3
+ declare type Events = {
4
+ date: string;
5
+ emphasis?: boolean;
6
+ selected?: boolean;
7
+ disabled?: boolean;
8
+ };
9
+ interface CalendarProps {
10
+ /**
11
+ * `onCalendarClick` It's a callback function that returns the selected date, triggered when you click on the day
12
+ *
13
+ * */
14
+ onCalendarClick: (date: string) => void;
15
+ /**
16
+ * `events` An array of event objects that contain some properties that allow you to change the calendar day style base on your value
17
+ * `{date?: Date; emphasis?: boolean; selected?: boolean; disabled?: boolean;}`
18
+ *
19
+ * */
20
+ events?: Events[];
21
+ /**
22
+ * `currentDate` The default value is `new Date()`, but you can provide a different date
23
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
24
+ * */
25
+ currentDate?: Date;
26
+ /**
27
+ * `locale` to change the calendar language by using 'date-fns/locale'
28
+ * `import { nl, enUS } from 'date-fns/locale';`
29
+ * */
30
+ locale?: Locale;
31
+ previousYearButtonTitle?: string;
32
+ nextYearButtonTitle?: string;
33
+ previousMonthButtonTitle?: string;
34
+ nextMonthButtonTitle?: string;
35
+ }
36
+ /**
37
+ * Calendar Component
38
+ * powered by date-fns, so that make it easy to use the `date-fns` date functions & locale
39
+ * */
40
+ export declare const Calendar: FC<CalendarProps>;
41
+ export {};
package/dist/index.cjs.js CHANGED
@@ -6,10 +6,15 @@ var tslib = require('tslib');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var clsx = require('clsx');
8
8
  var react = require('react');
9
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
10
+ var dateFns = require('date-fns');
11
+ var locale = require('date-fns/locale');
12
+ var lodash = require('lodash');
9
13
 
10
14
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
15
 
12
16
  var clsx__default = /*#__PURE__*/_interopDefaultLegacy(clsx);
17
+ var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
13
18
 
14
19
  var Article = /*#__PURE__*/react.forwardRef(function (_a, ref) {
15
20
  var children = _a.children,
@@ -146,6 +151,424 @@ var ButtonLink = /*#__PURE__*/react.forwardRef(function (_a, ref) {
146
151
  });
147
152
  ButtonLink.displayName = 'ButtonLink';
148
153
 
154
+ var CalendarNavigation = function CalendarNavigation(_a) {
155
+ var children = _a.children,
156
+ props = tslib.__rest(_a, ["children"]);
157
+
158
+ return jsxRuntime.jsx("div", Object.assign({
159
+ className: "utrecht-calendar__navigation"
160
+ }, props, {
161
+ children: children
162
+ }));
163
+ };
164
+
165
+ var CalendarButton = function CalendarButton(_a) {
166
+ var children = _a.children,
167
+ className = _a.className,
168
+ props = tslib.__rest(_a, ["children", "className"]);
169
+
170
+ return jsxRuntime.jsx(Button, Object.assign({
171
+ appearance: "subtle-button"
172
+ }, props, {
173
+ className: clsx.clsx('utrecht-calendar__button', className)
174
+ }, {
175
+ children: children
176
+ }));
177
+ };
178
+
179
+ var CalendarIcon = function CalendarIcon(_a) {
180
+ var children = _a.children,
181
+ props = tslib.__rest(_a, ["children"]);
182
+
183
+ return jsxRuntime.jsx("div", Object.assign({
184
+ className: clsx.clsx('utrecht-calendar__icon')
185
+ }, props, {
186
+ children: children
187
+ }));
188
+ };
189
+
190
+ var CalendarNavigationButtons = function CalendarNavigationButtons(_a) {
191
+ var onPreviousClick = _a.onPreviousClick,
192
+ onNextClick = _a.onNextClick,
193
+ previousIcon = _a.previousIcon,
194
+ nextIcon = _a.nextIcon,
195
+ children = _a.children,
196
+ props = tslib.__rest(_a, ["onPreviousClick", "onNextClick", "previousIcon", "nextIcon", "children"]);
197
+
198
+ return jsxRuntime.jsxs("div", Object.assign({
199
+ className: "utrecht-calendar__navigation-buttons"
200
+ }, {
201
+ children: [jsxRuntime.jsx(CalendarButton, Object.assign({
202
+ onClick: onPreviousClick
203
+ }, props, {
204
+ children: jsxRuntime.jsx(CalendarIcon, {
205
+ children: previousIcon
206
+ })
207
+ })), children, jsxRuntime.jsx(CalendarButton, Object.assign({
208
+ onClick: onNextClick
209
+ }, props, {
210
+ children: jsxRuntime.jsx(CalendarIcon, {
211
+ children: nextIcon
212
+ })
213
+ }))]
214
+ }));
215
+ };
216
+
217
+ var Heading2 = /*#__PURE__*/react.forwardRef(function (_a, ref) {
218
+ var children = _a.children,
219
+ className = _a.className,
220
+ restProps = tslib.__rest(_a, ["children", "className"]);
221
+
222
+ return jsxRuntime.jsx("h2", Object.assign({}, restProps, {
223
+ ref: ref,
224
+ className: clsx__default["default"]('utrecht-heading-2', className)
225
+ }, {
226
+ children: children
227
+ }));
228
+ });
229
+ Heading2.displayName = 'Heading2';
230
+
231
+ var CalendarNavigationLabel = function CalendarNavigationLabel(_ref) {
232
+ var label = _ref.label;
233
+ return jsxRuntime.jsx(Heading2, Object.assign({
234
+ className: "utrecht-calendar__navigation-label"
235
+ }, {
236
+ children: label
237
+ }));
238
+ };
239
+
240
+ var CalendarTableDaysContainer = function CalendarTableDaysContainer(_a) {
241
+ var children = _a.children,
242
+ props = tslib.__rest(_a, ["children"]);
243
+
244
+ return jsxRuntime.jsx("tbody", Object.assign({}, props, {
245
+ className: "utrecht-calendar__table-days-container"
246
+ }, {
247
+ children: children
248
+ }));
249
+ };
250
+
251
+ var CalendarTableDaysItem = function CalendarTableDaysItem(_a) {
252
+ var children = _a.children,
253
+ props = tslib.__rest(_a, ["children"]);
254
+
255
+ return jsxRuntime.jsx("tr", Object.assign({}, props, {
256
+ children: children
257
+ }));
258
+ };
259
+
260
+ var CalendarTableDaysItemDay = function CalendarTableDaysItemDay(_a) {
261
+ var day = _a.day,
262
+ dayOutOfTheMonth = _a.dayOutOfTheMonth,
263
+ isToday = _a.isToday,
264
+ emphasis = _a.emphasis,
265
+ selected = _a.selected,
266
+ disabled = _a.disabled,
267
+ props = tslib.__rest(_a, ["day", "dayOutOfTheMonth", "isToday", "emphasis", "selected", "disabled"]);
268
+
269
+ return jsxRuntime.jsx("td", {
270
+ children: jsxRuntime.jsx(CalendarButton, Object.assign({
271
+ className: clsx__default["default"]('utrecht-calendar__table-days-item-day', {
272
+ 'utrecht-calendar__table-days-item-day--out-of-the-month': dayOutOfTheMonth
273
+ }, {
274
+ 'utrecht-calendar__table-days-item-day--is-today': isToday
275
+ }, {
276
+ 'utrecht-calendar__table-days-item-day--emphasis': emphasis
277
+ }, {
278
+ 'utrecht-calendar__table-days-item-day--selected': selected
279
+ }),
280
+ disabled: disabled
281
+ }, props, {
282
+ children: day
283
+ }))
284
+ });
285
+ };
286
+
287
+ var CalendarTableWeeksContainer = function CalendarTableWeeksContainer(_ref) {
288
+ var children = _ref.children;
289
+ return jsxRuntime.jsx("thead", Object.assign({
290
+ className: "utrecht-calendar__table-weeks-container"
291
+ }, {
292
+ children: jsxRuntime.jsx("tr", Object.assign({
293
+ className: "utrecht-calendar__table-weeks-container-content"
294
+ }, {
295
+ children: children
296
+ }))
297
+ }));
298
+ };
299
+
300
+ var CalendarTableWeeksItem = function CalendarTableWeeksItem(_a) {
301
+ var children = _a.children,
302
+ props = tslib.__rest(_a, ["children"]);
303
+
304
+ return jsxRuntime.jsx("th", Object.assign({}, props, {
305
+ className: "utrecht-calendar__table-weeks-item"
306
+ }, {
307
+ children: children
308
+ }));
309
+ };
310
+
311
+ var IconArrowLeft = function IconArrowLeft(_a) {
312
+ var title = _a.title,
313
+ titleId = _a.titleId,
314
+ props = tslib.__rest(_a, ["title", "titleId"]);
315
+
316
+ return jsxRuntime.jsxs("svg", Object.assign({
317
+ width: "100%",
318
+ height: "100%",
319
+ fill: "none",
320
+ xmlns: "http://www.w3.org/2000/svg",
321
+ "aria-labelledby": titleId
322
+ }, props, {
323
+ children: [title ? jsxRuntime.jsx("title", Object.assign({
324
+ id: titleId
325
+ }, {
326
+ children: title
327
+ })) : null, jsxRuntime.jsx("path", {
328
+ d: "M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41Z",
329
+ fill: "currentColor"
330
+ })]
331
+ }));
332
+ };
333
+
334
+ var IconArrowLeftDouble = function IconArrowLeftDouble(_a) {
335
+ var title = _a.title,
336
+ titleId = _a.titleId,
337
+ props = tslib.__rest(_a, ["title", "titleId"]);
338
+
339
+ return jsxRuntime.jsxs("svg", Object.assign({
340
+ width: "100%",
341
+ height: "100%",
342
+ fill: "none",
343
+ xmlns: "http://www.w3.org/2000/svg",
344
+ "aria-labelledby": titleId
345
+ }, props, {
346
+ children: [title ? jsxRuntime.jsx("title", Object.assign({
347
+ id: titleId
348
+ }, {
349
+ children: title
350
+ })) : null, jsxRuntime.jsx("path", {
351
+ d: "M17.59 18 19 16.59 14.42 12 19 7.41 17.59 6l-6 6 6 6Z",
352
+ fill: "currentColor"
353
+ }), jsxRuntime.jsx("path", {
354
+ d: "m11 18 1.41-1.41L7.83 12l4.58-4.59L11 6l-6 6 6 6Z",
355
+ fill: "currentColor"
356
+ })]
357
+ }));
358
+ };
359
+
360
+ var IconArrowRight = function IconArrowRight(_a) {
361
+ var title = _a.title,
362
+ titleId = _a.titleId,
363
+ props = tslib.__rest(_a, ["title", "titleId"]);
364
+
365
+ return jsxRuntime.jsxs("svg", Object.assign({
366
+ width: "100%",
367
+ height: "100%",
368
+ fill: "none",
369
+ xmlns: "http://www.w3.org/2000/svg",
370
+ "aria-labelledby": titleId
371
+ }, props, {
372
+ children: [title ? jsxRuntime.jsx("title", Object.assign({
373
+ id: titleId
374
+ }, {
375
+ children: title
376
+ })) : null, jsxRuntime.jsx("path", {
377
+ d: "M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41Z",
378
+ fill: "currentColor"
379
+ })]
380
+ }));
381
+ };
382
+
383
+ var IconArrowRightDouble = function IconArrowRightDouble(_a) {
384
+ var title = _a.title,
385
+ titleId = _a.titleId,
386
+ props = tslib.__rest(_a, ["title", "titleId"]);
387
+
388
+ return jsxRuntime.jsxs("svg", Object.assign({
389
+ fill: "none",
390
+ width: "100%",
391
+ height: "100%",
392
+ xmlns: "http://www.w3.org/2000/svg",
393
+ "aria-labelledby": titleId
394
+ }, props, {
395
+ children: [title ? jsxRuntime.jsx("title", Object.assign({
396
+ id: titleId
397
+ }, {
398
+ children: title
399
+ })) : null, jsxRuntime.jsx("path", {
400
+ d: "M6.41 6 5 7.41 9.58 12 5 16.59 6.41 18l6-6-6-6Z",
401
+ fill: "currentColor"
402
+ }), jsxRuntime.jsx("path", {
403
+ d: "m13 6-1.41 1.41L16.17 12l-4.58 4.59L13 18l6-6-6-6Z",
404
+ fill: "currentColor"
405
+ })]
406
+ }));
407
+ };
408
+
409
+ function createCalendar(today) {
410
+ var start = dateFns.startOfWeek(dateFns.startOfMonth(today), {
411
+ weekStartsOn: 1
412
+ /* Monday */
413
+
414
+ });
415
+ var end = dateFns.endOfWeek(dateFns.addWeeks(start, 5), {
416
+ weekStartsOn: 1
417
+ /* Monday */
418
+
419
+ });
420
+ return dateFns.eachDayOfInterval({
421
+ start: start,
422
+ end: end
423
+ });
424
+ }
425
+ /**
426
+ * Calendar Component
427
+ * powered by date-fns, so that make it easy to use the `date-fns` date functions & locale
428
+ * */
429
+
430
+
431
+ var Calendar = function Calendar(_ref) {
432
+ var onCalendarClick = _ref.onCalendarClick,
433
+ events = _ref.events,
434
+ currentDate = _ref.currentDate,
435
+ _ref$locale = _ref.locale,
436
+ locale$1 = _ref$locale === void 0 ? locale.enUS : _ref$locale,
437
+ _ref$previousYearButt = _ref.previousYearButtonTitle,
438
+ previousYearButtonTitle = _ref$previousYearButt === void 0 ? 'Previous year' : _ref$previousYearButt,
439
+ _ref$nextYearButtonTi = _ref.nextYearButtonTitle,
440
+ nextYearButtonTitle = _ref$nextYearButtonTi === void 0 ? 'Next year' : _ref$nextYearButtonTi,
441
+ _ref$previousMonthBut = _ref.previousMonthButtonTitle,
442
+ previousMonthButtonTitle = _ref$previousMonthBut === void 0 ? 'Previous month' : _ref$previousMonthBut,
443
+ _ref$nextMonthButtonT = _ref.nextMonthButtonTitle,
444
+ nextMonthButtonTitle = _ref$nextMonthButtonT === void 0 ? 'Next month' : _ref$nextMonthButtonT;
445
+
446
+ var _useState = react.useState(currentDate || new Date()),
447
+ _useState2 = _slicedToArray__default["default"](_useState, 2),
448
+ date = _useState2[0],
449
+ setDate = _useState2[1];
450
+
451
+ var calendar = createCalendar(date);
452
+ var start = dateFns.startOfWeek(date, {
453
+ weekStartsOn: 1
454
+ });
455
+ var end = dateFns.endOfWeek(date, {
456
+ weekStartsOn: 1
457
+ });
458
+ var currentWeek = dateFns.eachDayOfInterval({
459
+ start: start,
460
+ end: end
461
+ }).map(function (day) {
462
+ return day;
463
+ });
464
+ var chunksWeeks = lodash.chunk(calendar, calendar.length / 6);
465
+ var weeks = chunksWeeks.map(function (week) {
466
+ return week.map(function (date) {
467
+ var currentEvent = events && events.length > 0 && events.find(function (e) {
468
+ return dateFns.isSameDay(dateFns.endOfDay(dateFns.parseISO(e.date)), date);
469
+ });
470
+
471
+ if (currentEvent) {
472
+ return {
473
+ date: date,
474
+ emphasis: currentEvent.emphasis,
475
+ selected: currentEvent.selected,
476
+ disabled: currentEvent.disabled
477
+ };
478
+ } else {
479
+ return {
480
+ date: date,
481
+ emphasis: false,
482
+ selected: false,
483
+ disabled: false
484
+ };
485
+ }
486
+ });
487
+ });
488
+ return jsxRuntime.jsxs("div", Object.assign({
489
+ className: "utrecht-calendar"
490
+ }, {
491
+ children: [jsxRuntime.jsx(CalendarNavigation, {
492
+ children: jsxRuntime.jsx(CalendarNavigationButtons, Object.assign({
493
+ previousIcon: jsxRuntime.jsx(IconArrowLeftDouble, {
494
+ title: previousYearButtonTitle
495
+ }),
496
+ nextIcon: jsxRuntime.jsx(IconArrowRightDouble, {
497
+ title: nextYearButtonTitle
498
+ }),
499
+ onPreviousClick: function onPreviousClick() {
500
+ return setDate(dateFns.setYear(date, dateFns.getYear(date) - 1));
501
+ },
502
+ onNextClick: function onNextClick() {
503
+ return setDate(dateFns.addYears(date, 1));
504
+ }
505
+ }, {
506
+ children: jsxRuntime.jsx(CalendarNavigationButtons, Object.assign({
507
+ previousIcon: jsxRuntime.jsx(IconArrowLeft, {
508
+ title: previousMonthButtonTitle
509
+ }),
510
+ nextIcon: jsxRuntime.jsx(IconArrowRight, {
511
+ title: nextMonthButtonTitle
512
+ }),
513
+ onPreviousClick: function onPreviousClick() {
514
+ return setDate(dateFns.setMonth(date, date.getMonth() - 1));
515
+ },
516
+ onNextClick: function onNextClick() {
517
+ return setDate(dateFns.addMonths(date, 1));
518
+ }
519
+ }, {
520
+ children: jsxRuntime.jsx(CalendarNavigationLabel, {
521
+ label: dateFns.format(date, 'LLLL Y', {
522
+ locale: locale$1
523
+ })
524
+ })
525
+ }))
526
+ }))
527
+ }), jsxRuntime.jsxs("table", Object.assign({
528
+ className: "utrecht-calendar__table",
529
+ role: "grid"
530
+ }, {
531
+ children: [jsxRuntime.jsx(CalendarTableWeeksContainer, {
532
+ children: currentWeek && currentWeek.length > 0 && currentWeek.map(function (day, index) {
533
+ return jsxRuntime.jsx(CalendarTableWeeksItem, Object.assign({
534
+ scope: "col",
535
+ abbr: dateFns.format(day, 'EEEE', {
536
+ locale: locale$1
537
+ })
538
+ }, {
539
+ children: dateFns.format(day, 'EEEEEE', {
540
+ locale: locale$1
541
+ })
542
+ }), index);
543
+ })
544
+ }), jsxRuntime.jsx(CalendarTableDaysContainer, {
545
+ children: weeks && weeks.length > 0 && weeks.map(function (week, index) {
546
+ return jsxRuntime.jsx(CalendarTableDaysItem, {
547
+ children: week.map(function (day, index) {
548
+ return jsxRuntime.jsx(CalendarTableDaysItemDay, {
549
+ isToday: dateFns.isSameDay(date, day.date),
550
+ dayOutOfTheMonth: !dateFns.isSameMonth(day.date, date),
551
+ onClick: function onClick(event) {
552
+ var selectedDay = dateFns.setDate(date, lodash.toNumber(event.target.textContent));
553
+ setDate(selectedDay);
554
+ onCalendarClick(dateFns.formatISO(selectedDay));
555
+ },
556
+ "aria-label": dateFns.format(day.date, 'eeee dd LLLL Y', {
557
+ locale: locale$1
558
+ }),
559
+ day: day.date.getDate().toString(),
560
+ emphasis: day.emphasis,
561
+ selected: day.selected,
562
+ disabled: day.disabled
563
+ }, index);
564
+ })
565
+ }, index);
566
+ })
567
+ })]
568
+ }))]
569
+ }));
570
+ };
571
+
149
572
  var Checkbox = /*#__PURE__*/react.forwardRef(function (_a, ref) {
150
573
  var disabled = _a.disabled,
151
574
  invalid = _a.invalid,
@@ -375,20 +798,6 @@ var Heading1 = /*#__PURE__*/react.forwardRef(function (_a, ref) {
375
798
  });
376
799
  Heading1.displayName = 'Heading1';
377
800
 
378
- var Heading2 = /*#__PURE__*/react.forwardRef(function (_a, ref) {
379
- var children = _a.children,
380
- className = _a.className,
381
- restProps = tslib.__rest(_a, ["children", "className"]);
382
-
383
- return jsxRuntime.jsx("h2", Object.assign({}, restProps, {
384
- ref: ref,
385
- className: clsx__default["default"]('utrecht-heading-2', className)
386
- }, {
387
- children: children
388
- }));
389
- });
390
- Heading2.displayName = 'Heading2';
391
-
392
801
  var Heading3 = /*#__PURE__*/react.forwardRef(function (_a, ref) {
393
802
  var children = _a.children,
394
803
  className = _a.className,
@@ -991,6 +1400,7 @@ exports.Backdrop = Backdrop;
991
1400
  exports.Button = Button;
992
1401
  exports.ButtonGroup = ButtonGroup;
993
1402
  exports.ButtonLink = ButtonLink;
1403
+ exports.Calendar = Calendar;
994
1404
  exports.Checkbox = Checkbox;
995
1405
  exports.CustomRadioButton = CustomRadioButton;
996
1406
  exports.DataList = DataList;
@@ -1 +1 @@
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export { Backdrop } from './Backdrop';
7
7
  export { Button, PrimaryActionButton, SecondaryActionButton, SubtleButton } from './Button';
8
8
  export { ButtonGroup } from './ButtonGroup';
9
9
  export { ButtonLink } from './ButtonLink';
10
+ export * from './Calendar';
10
11
  export { Checkbox } from './Checkbox';
11
12
  export { CustomRadioButton } from './CustomRadioButton';
12
13
  export { Document } from './Document';
package/dist/index.esm.js CHANGED
@@ -1,7 +1,11 @@
1
1
  import { __rest } from 'tslib';
2
- import { jsx } from 'react/jsx-runtime';
3
- import clsx from 'clsx';
4
- import { forwardRef } from 'react';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import clsx, { clsx as clsx$1 } from 'clsx';
4
+ import { forwardRef, useState } from 'react';
5
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
6
+ import { eachDayOfInterval, startOfWeek, endOfWeek, isSameDay, endOfDay, parseISO, setYear, getYear, addYears, setMonth, addMonths, format, isSameMonth, setDate, formatISO, startOfMonth, addWeeks } from 'date-fns';
7
+ import { enUS } from 'date-fns/locale';
8
+ import { chunk, toNumber } from 'lodash';
5
9
 
6
10
  var Article = /*#__PURE__*/forwardRef(function (_a, ref) {
7
11
  var children = _a.children,
@@ -138,6 +142,424 @@ var ButtonLink = /*#__PURE__*/forwardRef(function (_a, ref) {
138
142
  });
139
143
  ButtonLink.displayName = 'ButtonLink';
140
144
 
145
+ var CalendarNavigation = function CalendarNavigation(_a) {
146
+ var children = _a.children,
147
+ props = __rest(_a, ["children"]);
148
+
149
+ return jsx("div", Object.assign({
150
+ className: "utrecht-calendar__navigation"
151
+ }, props, {
152
+ children: children
153
+ }));
154
+ };
155
+
156
+ var CalendarButton = function CalendarButton(_a) {
157
+ var children = _a.children,
158
+ className = _a.className,
159
+ props = __rest(_a, ["children", "className"]);
160
+
161
+ return jsx(Button, Object.assign({
162
+ appearance: "subtle-button"
163
+ }, props, {
164
+ className: clsx$1('utrecht-calendar__button', className)
165
+ }, {
166
+ children: children
167
+ }));
168
+ };
169
+
170
+ var CalendarIcon = function CalendarIcon(_a) {
171
+ var children = _a.children,
172
+ props = __rest(_a, ["children"]);
173
+
174
+ return jsx("div", Object.assign({
175
+ className: clsx$1('utrecht-calendar__icon')
176
+ }, props, {
177
+ children: children
178
+ }));
179
+ };
180
+
181
+ var CalendarNavigationButtons = function CalendarNavigationButtons(_a) {
182
+ var onPreviousClick = _a.onPreviousClick,
183
+ onNextClick = _a.onNextClick,
184
+ previousIcon = _a.previousIcon,
185
+ nextIcon = _a.nextIcon,
186
+ children = _a.children,
187
+ props = __rest(_a, ["onPreviousClick", "onNextClick", "previousIcon", "nextIcon", "children"]);
188
+
189
+ return jsxs("div", Object.assign({
190
+ className: "utrecht-calendar__navigation-buttons"
191
+ }, {
192
+ children: [jsx(CalendarButton, Object.assign({
193
+ onClick: onPreviousClick
194
+ }, props, {
195
+ children: jsx(CalendarIcon, {
196
+ children: previousIcon
197
+ })
198
+ })), children, jsx(CalendarButton, Object.assign({
199
+ onClick: onNextClick
200
+ }, props, {
201
+ children: jsx(CalendarIcon, {
202
+ children: nextIcon
203
+ })
204
+ }))]
205
+ }));
206
+ };
207
+
208
+ var Heading2 = /*#__PURE__*/forwardRef(function (_a, ref) {
209
+ var children = _a.children,
210
+ className = _a.className,
211
+ restProps = __rest(_a, ["children", "className"]);
212
+
213
+ return jsx("h2", Object.assign({}, restProps, {
214
+ ref: ref,
215
+ className: clsx('utrecht-heading-2', className)
216
+ }, {
217
+ children: children
218
+ }));
219
+ });
220
+ Heading2.displayName = 'Heading2';
221
+
222
+ var CalendarNavigationLabel = function CalendarNavigationLabel(_ref) {
223
+ var label = _ref.label;
224
+ return jsx(Heading2, Object.assign({
225
+ className: "utrecht-calendar__navigation-label"
226
+ }, {
227
+ children: label
228
+ }));
229
+ };
230
+
231
+ var CalendarTableDaysContainer = function CalendarTableDaysContainer(_a) {
232
+ var children = _a.children,
233
+ props = __rest(_a, ["children"]);
234
+
235
+ return jsx("tbody", Object.assign({}, props, {
236
+ className: "utrecht-calendar__table-days-container"
237
+ }, {
238
+ children: children
239
+ }));
240
+ };
241
+
242
+ var CalendarTableDaysItem = function CalendarTableDaysItem(_a) {
243
+ var children = _a.children,
244
+ props = __rest(_a, ["children"]);
245
+
246
+ return jsx("tr", Object.assign({}, props, {
247
+ children: children
248
+ }));
249
+ };
250
+
251
+ var CalendarTableDaysItemDay = function CalendarTableDaysItemDay(_a) {
252
+ var day = _a.day,
253
+ dayOutOfTheMonth = _a.dayOutOfTheMonth,
254
+ isToday = _a.isToday,
255
+ emphasis = _a.emphasis,
256
+ selected = _a.selected,
257
+ disabled = _a.disabled,
258
+ props = __rest(_a, ["day", "dayOutOfTheMonth", "isToday", "emphasis", "selected", "disabled"]);
259
+
260
+ return jsx("td", {
261
+ children: jsx(CalendarButton, Object.assign({
262
+ className: clsx('utrecht-calendar__table-days-item-day', {
263
+ 'utrecht-calendar__table-days-item-day--out-of-the-month': dayOutOfTheMonth
264
+ }, {
265
+ 'utrecht-calendar__table-days-item-day--is-today': isToday
266
+ }, {
267
+ 'utrecht-calendar__table-days-item-day--emphasis': emphasis
268
+ }, {
269
+ 'utrecht-calendar__table-days-item-day--selected': selected
270
+ }),
271
+ disabled: disabled
272
+ }, props, {
273
+ children: day
274
+ }))
275
+ });
276
+ };
277
+
278
+ var CalendarTableWeeksContainer = function CalendarTableWeeksContainer(_ref) {
279
+ var children = _ref.children;
280
+ return jsx("thead", Object.assign({
281
+ className: "utrecht-calendar__table-weeks-container"
282
+ }, {
283
+ children: jsx("tr", Object.assign({
284
+ className: "utrecht-calendar__table-weeks-container-content"
285
+ }, {
286
+ children: children
287
+ }))
288
+ }));
289
+ };
290
+
291
+ var CalendarTableWeeksItem = function CalendarTableWeeksItem(_a) {
292
+ var children = _a.children,
293
+ props = __rest(_a, ["children"]);
294
+
295
+ return jsx("th", Object.assign({}, props, {
296
+ className: "utrecht-calendar__table-weeks-item"
297
+ }, {
298
+ children: children
299
+ }));
300
+ };
301
+
302
+ var IconArrowLeft = function IconArrowLeft(_a) {
303
+ var title = _a.title,
304
+ titleId = _a.titleId,
305
+ props = __rest(_a, ["title", "titleId"]);
306
+
307
+ return jsxs("svg", Object.assign({
308
+ width: "100%",
309
+ height: "100%",
310
+ fill: "none",
311
+ xmlns: "http://www.w3.org/2000/svg",
312
+ "aria-labelledby": titleId
313
+ }, props, {
314
+ children: [title ? jsx("title", Object.assign({
315
+ id: titleId
316
+ }, {
317
+ children: title
318
+ })) : null, jsx("path", {
319
+ d: "M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41Z",
320
+ fill: "currentColor"
321
+ })]
322
+ }));
323
+ };
324
+
325
+ var IconArrowLeftDouble = function IconArrowLeftDouble(_a) {
326
+ var title = _a.title,
327
+ titleId = _a.titleId,
328
+ props = __rest(_a, ["title", "titleId"]);
329
+
330
+ return jsxs("svg", Object.assign({
331
+ width: "100%",
332
+ height: "100%",
333
+ fill: "none",
334
+ xmlns: "http://www.w3.org/2000/svg",
335
+ "aria-labelledby": titleId
336
+ }, props, {
337
+ children: [title ? jsx("title", Object.assign({
338
+ id: titleId
339
+ }, {
340
+ children: title
341
+ })) : null, jsx("path", {
342
+ d: "M17.59 18 19 16.59 14.42 12 19 7.41 17.59 6l-6 6 6 6Z",
343
+ fill: "currentColor"
344
+ }), jsx("path", {
345
+ d: "m11 18 1.41-1.41L7.83 12l4.58-4.59L11 6l-6 6 6 6Z",
346
+ fill: "currentColor"
347
+ })]
348
+ }));
349
+ };
350
+
351
+ var IconArrowRight = function IconArrowRight(_a) {
352
+ var title = _a.title,
353
+ titleId = _a.titleId,
354
+ props = __rest(_a, ["title", "titleId"]);
355
+
356
+ return jsxs("svg", Object.assign({
357
+ width: "100%",
358
+ height: "100%",
359
+ fill: "none",
360
+ xmlns: "http://www.w3.org/2000/svg",
361
+ "aria-labelledby": titleId
362
+ }, props, {
363
+ children: [title ? jsx("title", Object.assign({
364
+ id: titleId
365
+ }, {
366
+ children: title
367
+ })) : null, jsx("path", {
368
+ d: "M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41Z",
369
+ fill: "currentColor"
370
+ })]
371
+ }));
372
+ };
373
+
374
+ var IconArrowRightDouble = function IconArrowRightDouble(_a) {
375
+ var title = _a.title,
376
+ titleId = _a.titleId,
377
+ props = __rest(_a, ["title", "titleId"]);
378
+
379
+ return jsxs("svg", Object.assign({
380
+ fill: "none",
381
+ width: "100%",
382
+ height: "100%",
383
+ xmlns: "http://www.w3.org/2000/svg",
384
+ "aria-labelledby": titleId
385
+ }, props, {
386
+ children: [title ? jsx("title", Object.assign({
387
+ id: titleId
388
+ }, {
389
+ children: title
390
+ })) : null, jsx("path", {
391
+ d: "M6.41 6 5 7.41 9.58 12 5 16.59 6.41 18l6-6-6-6Z",
392
+ fill: "currentColor"
393
+ }), jsx("path", {
394
+ d: "m13 6-1.41 1.41L16.17 12l-4.58 4.59L13 18l6-6-6-6Z",
395
+ fill: "currentColor"
396
+ })]
397
+ }));
398
+ };
399
+
400
+ function createCalendar(today) {
401
+ var start = startOfWeek(startOfMonth(today), {
402
+ weekStartsOn: 1
403
+ /* Monday */
404
+
405
+ });
406
+ var end = endOfWeek(addWeeks(start, 5), {
407
+ weekStartsOn: 1
408
+ /* Monday */
409
+
410
+ });
411
+ return eachDayOfInterval({
412
+ start: start,
413
+ end: end
414
+ });
415
+ }
416
+ /**
417
+ * Calendar Component
418
+ * powered by date-fns, so that make it easy to use the `date-fns` date functions & locale
419
+ * */
420
+
421
+
422
+ var Calendar = function Calendar(_ref) {
423
+ var onCalendarClick = _ref.onCalendarClick,
424
+ events = _ref.events,
425
+ currentDate = _ref.currentDate,
426
+ _ref$locale = _ref.locale,
427
+ locale = _ref$locale === void 0 ? enUS : _ref$locale,
428
+ _ref$previousYearButt = _ref.previousYearButtonTitle,
429
+ previousYearButtonTitle = _ref$previousYearButt === void 0 ? 'Previous year' : _ref$previousYearButt,
430
+ _ref$nextYearButtonTi = _ref.nextYearButtonTitle,
431
+ nextYearButtonTitle = _ref$nextYearButtonTi === void 0 ? 'Next year' : _ref$nextYearButtonTi,
432
+ _ref$previousMonthBut = _ref.previousMonthButtonTitle,
433
+ previousMonthButtonTitle = _ref$previousMonthBut === void 0 ? 'Previous month' : _ref$previousMonthBut,
434
+ _ref$nextMonthButtonT = _ref.nextMonthButtonTitle,
435
+ nextMonthButtonTitle = _ref$nextMonthButtonT === void 0 ? 'Next month' : _ref$nextMonthButtonT;
436
+
437
+ var _useState = useState(currentDate || new Date()),
438
+ _useState2 = _slicedToArray(_useState, 2),
439
+ date = _useState2[0],
440
+ setDate$1 = _useState2[1];
441
+
442
+ var calendar = createCalendar(date);
443
+ var start = startOfWeek(date, {
444
+ weekStartsOn: 1
445
+ });
446
+ var end = endOfWeek(date, {
447
+ weekStartsOn: 1
448
+ });
449
+ var currentWeek = eachDayOfInterval({
450
+ start: start,
451
+ end: end
452
+ }).map(function (day) {
453
+ return day;
454
+ });
455
+ var chunksWeeks = chunk(calendar, calendar.length / 6);
456
+ var weeks = chunksWeeks.map(function (week) {
457
+ return week.map(function (date) {
458
+ var currentEvent = events && events.length > 0 && events.find(function (e) {
459
+ return isSameDay(endOfDay(parseISO(e.date)), date);
460
+ });
461
+
462
+ if (currentEvent) {
463
+ return {
464
+ date: date,
465
+ emphasis: currentEvent.emphasis,
466
+ selected: currentEvent.selected,
467
+ disabled: currentEvent.disabled
468
+ };
469
+ } else {
470
+ return {
471
+ date: date,
472
+ emphasis: false,
473
+ selected: false,
474
+ disabled: false
475
+ };
476
+ }
477
+ });
478
+ });
479
+ return jsxs("div", Object.assign({
480
+ className: "utrecht-calendar"
481
+ }, {
482
+ children: [jsx(CalendarNavigation, {
483
+ children: jsx(CalendarNavigationButtons, Object.assign({
484
+ previousIcon: jsx(IconArrowLeftDouble, {
485
+ title: previousYearButtonTitle
486
+ }),
487
+ nextIcon: jsx(IconArrowRightDouble, {
488
+ title: nextYearButtonTitle
489
+ }),
490
+ onPreviousClick: function onPreviousClick() {
491
+ return setDate$1(setYear(date, getYear(date) - 1));
492
+ },
493
+ onNextClick: function onNextClick() {
494
+ return setDate$1(addYears(date, 1));
495
+ }
496
+ }, {
497
+ children: jsx(CalendarNavigationButtons, Object.assign({
498
+ previousIcon: jsx(IconArrowLeft, {
499
+ title: previousMonthButtonTitle
500
+ }),
501
+ nextIcon: jsx(IconArrowRight, {
502
+ title: nextMonthButtonTitle
503
+ }),
504
+ onPreviousClick: function onPreviousClick() {
505
+ return setDate$1(setMonth(date, date.getMonth() - 1));
506
+ },
507
+ onNextClick: function onNextClick() {
508
+ return setDate$1(addMonths(date, 1));
509
+ }
510
+ }, {
511
+ children: jsx(CalendarNavigationLabel, {
512
+ label: format(date, 'LLLL Y', {
513
+ locale: locale
514
+ })
515
+ })
516
+ }))
517
+ }))
518
+ }), jsxs("table", Object.assign({
519
+ className: "utrecht-calendar__table",
520
+ role: "grid"
521
+ }, {
522
+ children: [jsx(CalendarTableWeeksContainer, {
523
+ children: currentWeek && currentWeek.length > 0 && currentWeek.map(function (day, index) {
524
+ return jsx(CalendarTableWeeksItem, Object.assign({
525
+ scope: "col",
526
+ abbr: format(day, 'EEEE', {
527
+ locale: locale
528
+ })
529
+ }, {
530
+ children: format(day, 'EEEEEE', {
531
+ locale: locale
532
+ })
533
+ }), index);
534
+ })
535
+ }), jsx(CalendarTableDaysContainer, {
536
+ children: weeks && weeks.length > 0 && weeks.map(function (week, index) {
537
+ return jsx(CalendarTableDaysItem, {
538
+ children: week.map(function (day, index) {
539
+ return jsx(CalendarTableDaysItemDay, {
540
+ isToday: isSameDay(date, day.date),
541
+ dayOutOfTheMonth: !isSameMonth(day.date, date),
542
+ onClick: function onClick(event) {
543
+ var selectedDay = setDate(date, toNumber(event.target.textContent));
544
+ setDate$1(selectedDay);
545
+ onCalendarClick(formatISO(selectedDay));
546
+ },
547
+ "aria-label": format(day.date, 'eeee dd LLLL Y', {
548
+ locale: locale
549
+ }),
550
+ day: day.date.getDate().toString(),
551
+ emphasis: day.emphasis,
552
+ selected: day.selected,
553
+ disabled: day.disabled
554
+ }, index);
555
+ })
556
+ }, index);
557
+ })
558
+ })]
559
+ }))]
560
+ }));
561
+ };
562
+
141
563
  var Checkbox = /*#__PURE__*/forwardRef(function (_a, ref) {
142
564
  var disabled = _a.disabled,
143
565
  invalid = _a.invalid,
@@ -367,20 +789,6 @@ var Heading1 = /*#__PURE__*/forwardRef(function (_a, ref) {
367
789
  });
368
790
  Heading1.displayName = 'Heading1';
369
791
 
370
- var Heading2 = /*#__PURE__*/forwardRef(function (_a, ref) {
371
- var children = _a.children,
372
- className = _a.className,
373
- restProps = __rest(_a, ["children", "className"]);
374
-
375
- return jsx("h2", Object.assign({}, restProps, {
376
- ref: ref,
377
- className: clsx('utrecht-heading-2', className)
378
- }, {
379
- children: children
380
- }));
381
- });
382
- Heading2.displayName = 'Heading2';
383
-
384
792
  var Heading3 = /*#__PURE__*/forwardRef(function (_a, ref) {
385
793
  var children = _a.children,
386
794
  className = _a.className,
@@ -978,5 +1386,5 @@ var UnorderedListItem = /*#__PURE__*/forwardRef(function (_a, ref) {
978
1386
  });
979
1387
  UnorderedListItem.displayName = 'UnorderedListItem';
980
1388
 
981
- export { Article, Backdrop, Button, ButtonGroup, ButtonLink, Checkbox, CustomRadioButton, DataList, DataListActions, DataListItem, DataListKey, DataListValue, Document, Fieldset, FieldsetLegend, FormField, FormFieldDescription, FormLabel, HTMLContent, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, HeadingGroup, Image, Link, LinkButton, LinkSocial, ListSocial, ListSocialItem, NumberValue, OrderedList, OrderedListItem, Page, PageContent, PageFooter, PageHeader, Paragraph, PreHeading, PrimaryActionButton, RadioButton, SecondaryActionButton, Select, SelectOption, Separator, SkipLink, SubtleButton, Surface, Table, TableBody, TableCaption, TableCell, TableFooter, TableHeader, TableHeaderCell, TableRow, Textarea, Textbox, URLValue, UnorderedList, UnorderedListItem };
1389
+ export { Article, Backdrop, Button, ButtonGroup, ButtonLink, Calendar, Checkbox, CustomRadioButton, DataList, DataListActions, DataListItem, DataListKey, DataListValue, Document, Fieldset, FieldsetLegend, FormField, FormFieldDescription, FormLabel, HTMLContent, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, HeadingGroup, Image, Link, LinkButton, LinkSocial, ListSocial, ListSocialItem, NumberValue, OrderedList, OrderedListItem, Page, PageContent, PageFooter, PageHeader, Paragraph, PreHeading, PrimaryActionButton, RadioButton, SecondaryActionButton, Select, SelectOption, Separator, SkipLink, SubtleButton, Surface, Table, TableBody, TableCaption, TableCell, TableFooter, TableHeader, TableHeaderCell, TableRow, Textarea, Textbox, URLValue, UnorderedList, UnorderedListItem };
982
1390
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.0-alpha.147",
2
+ "version": "1.0.0-alpha.148",
3
3
  "author": "Community for NL Design System",
4
4
  "description": "React component library bundle for the Municipality of Utrecht based on the NL Design System architecture",
5
5
  "license": "EUPL-1.2",
@@ -31,7 +31,8 @@
31
31
  "dist/"
32
32
  ],
33
33
  "dependencies": {
34
- "clsx": "1.2.1"
34
+ "clsx": "1.2.1",
35
+ "date-fns": "2.29.3"
35
36
  },
36
37
  "devDependencies": {
37
38
  "@babel/core": "7.18.10",
@@ -45,11 +46,14 @@
45
46
  "@testing-library/jest-dom": "5.16.4",
46
47
  "@testing-library/react": "13.3.0",
47
48
  "@testing-library/user-event": "14.4.0",
49
+ "@types/date-fns": "2.6.0",
48
50
  "@types/jest": "28.1.8",
51
+ "@types/lodash": "4.14.185",
49
52
  "@types/react": "18.0.17",
50
53
  "@types/testing-library__jest-dom": "5.14.5",
51
54
  "jest": "28.1.3",
52
55
  "jest-environment-jsdom": "28.1.3",
56
+ "lodash": "4.17.21",
53
57
  "next": "12.2.3",
54
58
  "npm-run-all": "4.1.5",
55
59
  "react": "18.2.0",
@@ -69,5 +73,5 @@
69
73
  "react": "16 - 18",
70
74
  "react-dom": "16 - 18"
71
75
  },
72
- "gitHead": "a2b840c2321dc6490d093d2467ddbe5223bc25a5"
76
+ "gitHead": "c4f0516083780e2ac6158a49f4303d6645f03153"
73
77
  }