@stenajs-webui/calendar 17.5.0 → 17.6.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/CHANGELOG.md +14 -0
- package/dist/index.es.js +15 -22
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +14 -21
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# v17.6.0 (Fri Jul 01 2022)
|
|
2
|
+
|
|
3
|
+
#### 🚀 Enhancement
|
|
4
|
+
|
|
5
|
+
- Use Stena icons instead of Font Awesome icons [#471](https://github.com/StenaIT/stenajs-webui/pull/471) (david.zetterdahl@stenaline.com [@LordDz](https://github.com/LordDz) [@lindskogen](https://github.com/lindskogen))
|
|
6
|
+
|
|
7
|
+
#### Authors: 3
|
|
8
|
+
|
|
9
|
+
- David ([@LordDz](https://github.com/LordDz))
|
|
10
|
+
- David Zetterdahl (david.zetterdahl@stenaline.com)
|
|
11
|
+
- Johan Lindskogen ([@lindskogen](https://github.com/lindskogen))
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
1
15
|
# v17.0.0 (Fri Jun 17 2022)
|
|
2
16
|
|
|
3
17
|
#### 💥 Breaking Change
|
package/dist/index.es.js
CHANGED
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useMemo, useCallback, useState, useEffect, useRef } from 'react';
|
|
3
|
-
import { FlatButton, PrimaryButton, Icon, stenaArrowRight } from '@stenajs-webui/elements';
|
|
3
|
+
import { FlatButton, stenaAngleLeft, stenaAngleRight, PrimaryButton, stenaCalendar, Icon, stenaClock, stenaAngleDown, stenaArrowRight } from '@stenajs-webui/elements';
|
|
4
4
|
import { Box, Text, Clickable, Row, Space, Spacing, Indent, Column, SeparatorLine, parseIntElseUndefined, useBoolean, useDelayedFalse } from '@stenajs-webui/core';
|
|
5
5
|
import { isAfter, eachDayOfInterval, isSameDay, endOfMonth, startOfMonth, min, addDays, max, subDays, format, getISOWeek, getDate, startOfISOWeek, addWeeks, getMonth, getYear, getISODay, addHours, isBefore, parse, addMonths, addYears, subMonths, subYears, isValid } from 'date-fns';
|
|
6
6
|
import { last, chunk, range, debounce } from 'lodash';
|
|
7
7
|
import styled from '@emotion/styled';
|
|
8
|
-
import { faAngleLeft } from '@fortawesome/free-solid-svg-icons/faAngleLeft';
|
|
9
|
-
import { faAngleRight } from '@fortawesome/free-solid-svg-icons/faAngleRight';
|
|
10
8
|
import { faAngleDoubleLeft } from '@fortawesome/free-solid-svg-icons/faAngleDoubleLeft';
|
|
11
9
|
import { faAngleDoubleRight } from '@fortawesome/free-solid-svg-icons/faAngleDoubleRight';
|
|
12
10
|
import { faCaretLeft } from '@fortawesome/free-solid-svg-icons/faCaretLeft';
|
|
13
11
|
import { faCaretRight } from '@fortawesome/free-solid-svg-icons/faCaretRight';
|
|
14
|
-
import { faCalendarAlt } from '@fortawesome/free-regular-svg-icons/faCalendarAlt';
|
|
15
12
|
import { TextInput, TextInputBox } from '@stenajs-webui/forms';
|
|
16
13
|
import { useTippyInstance, Popover } from '@stenajs-webui/tooltip';
|
|
17
|
-
import { faCalendarAlt as faCalendarAlt$1 } from '@fortawesome/free-solid-svg-icons/faCalendarAlt';
|
|
18
14
|
import { cssColor } from '@stenajs-webui/theme';
|
|
19
15
|
import { faLongArrowAltRight } from '@fortawesome/free-solid-svg-icons/faLongArrowAltRight';
|
|
20
|
-
import { faClock } from '@fortawesome/free-solid-svg-icons/faClock';
|
|
21
|
-
import { faClock as faClock$1 } from '@fortawesome/free-regular-svg-icons/faClock';
|
|
22
|
-
import { faAngleDown } from '@fortawesome/free-solid-svg-icons/faAngleDown';
|
|
23
16
|
|
|
24
17
|
/*! *****************************************************************************
|
|
25
18
|
Copyright (c) Microsoft Corporation.
|
|
@@ -610,9 +603,9 @@ var WithMonthSwitcherBelow = function (_a) {
|
|
|
610
603
|
React.createElement(Row, null,
|
|
611
604
|
React.createElement(FlatButton, { onClick: prevYear, leftIcon: faAngleDoubleLeft }),
|
|
612
605
|
React.createElement(Space, null),
|
|
613
|
-
React.createElement(FlatButton, { onClick: prevMonth, leftIcon:
|
|
606
|
+
React.createElement(FlatButton, { onClick: prevMonth, leftIcon: stenaAngleLeft }),
|
|
614
607
|
React.createElement(Indent, { num: 2 }),
|
|
615
|
-
React.createElement(FlatButton, { onClick: nextMonth, leftIcon:
|
|
608
|
+
React.createElement(FlatButton, { onClick: nextMonth, leftIcon: stenaAngleRight }),
|
|
616
609
|
React.createElement(Space, null),
|
|
617
610
|
React.createElement(FlatButton, { onClick: nextYear, leftIcon: faAngleDoubleRight }))),
|
|
618
611
|
React.createElement(Space, null)));
|
|
@@ -667,9 +660,9 @@ var PresetPicker = function (_a) {
|
|
|
667
660
|
var currentPage = (_b = pages[pageIndex]) !== null && _b !== void 0 ? _b : pages[0];
|
|
668
661
|
return (React.createElement(Column, null,
|
|
669
662
|
React.createElement(Row, { justifyContent: "space-between", alignItems: "center", width: "200px" },
|
|
670
|
-
React.createElement(FlatButton, { size: "small", leftIcon:
|
|
663
|
+
React.createElement(FlatButton, { size: "small", leftIcon: stenaAngleLeft, disabled: pageIndex === 0, onClick: function () { return setPageIndex(pageIndex - 1); } }),
|
|
671
664
|
React.createElement(Text, null, currentPage.label),
|
|
672
|
-
React.createElement(FlatButton, { size: "small", leftIcon:
|
|
665
|
+
React.createElement(FlatButton, { size: "small", leftIcon: stenaAngleRight, disabled: pageIndex === pages.length - 1, onClick: function () { return setPageIndex(pageIndex + 1); } })),
|
|
673
666
|
React.createElement(Space, null),
|
|
674
667
|
React.createElement(Column, { alignItems: "center" }, currentPage.presets.map(function (preset) { return (React.createElement(React.Fragment, { key: preset.label },
|
|
675
668
|
React.createElement(PrimaryButton, { label: preset.label, onClick: function () { return onClickPreset(preset); } }),
|
|
@@ -779,8 +772,8 @@ function CalendarWithMonthSwitcher(_a) {
|
|
|
779
772
|
React.createElement(CalendarWithMonthYearPickers, __assign({}, calendarProps, { theme: theme, dateInFocus: dateInFocus, setDateInFocus: setDateInFocus, currentPanel: currentPanel, setCurrentPanel: setCurrentPanel, onSelectPreset: onSelectPreset, headerLeftContent: React.createElement(Row, { alignItems: "center" },
|
|
780
773
|
!hideYearPagination && (React.createElement(FlatButton, { size: "small", onClick: prevYear, leftIcon: faAngleDoubleLeft })),
|
|
781
774
|
React.createElement(Space, null),
|
|
782
|
-
React.createElement(FlatButton, { size: "small", onClick: prevMonth, leftIcon:
|
|
783
|
-
React.createElement(FlatButton, { size: "small", onClick: nextMonth, leftIcon:
|
|
775
|
+
React.createElement(FlatButton, { size: "small", onClick: prevMonth, leftIcon: stenaAngleLeft })), headerRightContent: React.createElement(Row, { alignItems: "center" },
|
|
776
|
+
React.createElement(FlatButton, { size: "small", onClick: nextMonth, leftIcon: stenaAngleRight }),
|
|
784
777
|
React.createElement(Space, null),
|
|
785
778
|
!hideYearPagination && (React.createElement(FlatButton, { size: "small", onClick: nextYear, leftIcon: faAngleDoubleRight }))) }))));
|
|
786
779
|
}
|
|
@@ -1159,7 +1152,7 @@ var DateInput = function (_a) {
|
|
|
1159
1152
|
return (React.createElement(Box, { width: width },
|
|
1160
1153
|
React.createElement(Popover, { arrow: false, lazy: true, visible: showingCalendar, onClickOutside: hideCalendar, placement: defaultPopoverPlacement, zIndex: zIndex, appendTo: portalTarget !== null && portalTarget !== void 0 ? portalTarget : "parent", tippyRef: tippyRef, disabled: disabled, content: React.createElement(SingleDateCalendar, __assign({}, calendarProps, { onChange: onSelectDate, value: value, theme: calendarTheme, onChangePanel: onChangePanel, minDate: minDate, maxDate: maxDate })) },
|
|
1161
1154
|
React.createElement(TextInput, { type: "date", contentRight: React.createElement(Row, { alignItems: "center" },
|
|
1162
|
-
React.createElement(FlatButton, { size: "small", disabled: disabled, leftIcon:
|
|
1155
|
+
React.createElement(FlatButton, { size: "small", disabled: disabled, leftIcon: stenaCalendar, onClick: showCalendar })), onFocus: showCalendar, onClickRight: showCalendar, value: value ? format(value, displayFormat) : "", placeholder: placeholder, size: 9, disabled: disabled, autoFocus: openOnMount, variant: variant, min: minDate, max: maxDate }))));
|
|
1163
1156
|
};
|
|
1164
1157
|
|
|
1165
1158
|
var useDateRangeInput = function (value, onValueChange) {
|
|
@@ -1240,11 +1233,11 @@ var DateRangeInput = function (_a) {
|
|
|
1240
1233
|
}, [value]);
|
|
1241
1234
|
return (React.createElement(Popover, { arrow: false, lazy: true, disabled: disabled, visible: showingCalendar, zIndex: zIndex, placement: defaultPopoverPlacement, appendTo: portalTarget !== null && portalTarget !== void 0 ? portalTarget : "parent", onClickOutside: hideCalendar, content: React.createElement(CalendarWithMonthSwitcher, __assign({}, calendarProps, { dateInFocus: dateInFocus, setDateInFocus: setDateInFocus, statePerMonth: statePerMonth, theme: calendarTheme, onClickDay: onClickDay, currentPanel: currentPanel, setCurrentPanel: setCurrentPanel, minDate: minDate, maxDate: maxDate })) },
|
|
1242
1235
|
React.createElement(Row, { alignItems: "center" },
|
|
1243
|
-
React.createElement(TextInput, { iconLeft:
|
|
1236
|
+
React.createElement(TextInput, { iconLeft: stenaCalendar, onFocus: showCalendarStartDate, value: (value === null || value === void 0 ? void 0 : value.startDate) ? format(value.startDate, displayFormat) : "", placeholder: placeholderStartDate, width: width, disabled: disabled, inputRef: startDateInputRef, size: 9, variant: startDateIsAfterEnd ? "error" : undefined }),
|
|
1244
1237
|
React.createElement(Space, null),
|
|
1245
1238
|
React.createElement(Icon, { icon: faLongArrowAltRight, color: cssColor("--lhds-color-ui-500"), size: 14 }),
|
|
1246
1239
|
React.createElement(Space, null),
|
|
1247
|
-
React.createElement(TextInput, { iconLeft:
|
|
1240
|
+
React.createElement(TextInput, { iconLeft: stenaCalendar, onFocus: showCalendarEndDate, value: (value === null || value === void 0 ? void 0 : value.endDate) ? format(value.endDate, displayFormat) : "", placeholder: placeholderEndDate, width: width, disabled: disabled, inputRef: endDateInputRef, size: 9, variant: startDateIsAfterEnd ? "error" : undefined }))));
|
|
1248
1241
|
};
|
|
1249
1242
|
|
|
1250
1243
|
var DateTextInput = function (_a) {
|
|
@@ -1279,7 +1272,7 @@ var DateTextInput = function (_a) {
|
|
|
1279
1272
|
? parse(value, dateFormat, new Date())
|
|
1280
1273
|
: undefined, minDate: minDate, maxDate: maxDate, theme: calendarTheme })) },
|
|
1281
1274
|
React.createElement(TextInput, __assign({}, props, { variant: invalid ? "error" : variant, disableContentPaddingRight: true, contentRight: !hideCalenderIcon ? (React.createElement(Row, { alignItems: "center", indent: 0.5 },
|
|
1282
|
-
React.createElement(FlatButton, { size: "small", disabled: props.disabled, leftIcon:
|
|
1275
|
+
React.createElement(FlatButton, { size: "small", disabled: props.disabled, leftIcon: stenaCalendar, onClick: toggleCalendar }))) : undefined, onValueChange: onValueChangeHandler, placeholder: placeholder, value: value || "", min: minDate, max: maxDate, size: 10 })))));
|
|
1283
1276
|
};
|
|
1284
1277
|
|
|
1285
1278
|
var formatHours = function (hours) {
|
|
@@ -1413,7 +1406,7 @@ var TimeTextInput = function (_a) {
|
|
|
1413
1406
|
onValueChange(time);
|
|
1414
1407
|
}
|
|
1415
1408
|
}, [onValueChange, setValid]);
|
|
1416
|
-
return (React.createElement(TextInput, __assign({}, props, { type: "time", variant: !valid ? "error" : variant, iconLeft: useIcon ?
|
|
1409
|
+
return (React.createElement(TextInput, __assign({}, props, { type: "time", variant: !valid ? "error" : variant, iconLeft: useIcon ? stenaClock : undefined, value: value, placeholder: showPlaceholder ? timeFormat : undefined, onChange: onChangeHandler, onBlur: onBlur, width: width })));
|
|
1417
1410
|
};
|
|
1418
1411
|
|
|
1419
1412
|
var DualTextInput = function (_a) {
|
|
@@ -1457,12 +1450,12 @@ var DualTextInput = function (_a) {
|
|
|
1457
1450
|
return (React.createElement(Box, null,
|
|
1458
1451
|
React.createElement(TextInputBox, { disableContentPaddingRight: true, disabled: disabled, variant: variant, contentRight: React.createElement(Row, { alignItems: "center" },
|
|
1459
1452
|
React.createElement(Indent, { num: 0.5 },
|
|
1460
|
-
React.createElement(FlatButton, { leftIcon:
|
|
1453
|
+
React.createElement(FlatButton, { leftIcon: stenaCalendar, onClick: onClickCalendar, disabled: disabled, size: "small" })),
|
|
1461
1454
|
showPresets ? (React.createElement(React.Fragment, null,
|
|
1462
1455
|
React.createElement(Row, { height: "22px" },
|
|
1463
1456
|
React.createElement(SeparatorLine, { vertical: true })),
|
|
1464
1457
|
React.createElement(Indent, { num: 0.5 },
|
|
1465
|
-
React.createElement(FlatButton, { leftIcon:
|
|
1458
|
+
React.createElement(FlatButton, { leftIcon: stenaAngleDown, onClick: onClickArrowDown, disabled: disabled, size: "small" })))) : null) },
|
|
1466
1459
|
React.createElement(Box, { width: widthLeft },
|
|
1467
1460
|
React.createElement(TextInput, { onEsc: onEsc, onEnter: onEnter, onClick: onClickLeft, disabled: disabled, hideBorder: true, placeholder: placeholderLeft, value: valueLeft, onValueChange: onValueChangeLeft, onChange: onChangeLeft, onBlur: blurLeftHandler, onFocus: focusLeftHandler, inputRef: inputRefLeft, variant: variantLeft, type: typeLeft, autoFocus: autoFocusLeft, min: minLeft, max: maxLeft })),
|
|
1468
1461
|
React.createElement(Row, { indent: 0.5, alignItems: "center", justifyContent: "center" },
|
|
@@ -1805,7 +1798,7 @@ var DateTimeInput = function (_a) {
|
|
|
1805
1798
|
React.createElement(Space, null),
|
|
1806
1799
|
React.createElement(Row, { justifyContent: "flex-end" },
|
|
1807
1800
|
React.createElement(PrimaryButton, { label: "Done", onClick: hideTimePicker })))) : null)) },
|
|
1808
|
-
React.createElement(DualTextInput, { autoFocusLeft: autoFocus, onEsc: onEsc, onEnter: onEnter, onBlur: onBlur, disabled: disabled, separatorIcon:
|
|
1801
|
+
React.createElement(DualTextInput, { autoFocusLeft: autoFocus, onEsc: onEsc, onEnter: onEnter, onBlur: onBlur, disabled: disabled, separatorIcon: stenaClock, typeLeft: "date", typeRight: "time", placeholderLeft: "yyyy-mm-dd", placeholderRight: "hh:mm", onChangeLeft: inputLeftChangeHandler, onChangeRight: inputRightChangeHandler, onClickArrowDown: onClickArrowButton, onClickCalendar: onClickCalendarButton, onFocusLeft: onFocusLeft, onFocusRight: onFocusRight, onClickLeft: onFocusLeft, onClickRight: onFocusRight, inputRefLeft: dateInputRef, inputRefRight: timeInputRef, valueRight: timeValue !== null && timeValue !== void 0 ? timeValue : "", widthLeft: widthLeft, widthRight: widthRight, minLeft: minDate, maxLeft: maxDate, variant: variant }))));
|
|
1809
1802
|
};
|
|
1810
1803
|
|
|
1811
1804
|
var useDateRangeEffects = function (startDate, endDate, setDateInFocus, startDateInputRef, endDateInputRef) {
|