@hitachivantara/uikit-react-core 3.63.0 → 3.64.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 +21 -0
- package/dist/SimpleGrid/SimpleGrid.d.ts +17 -0
- package/dist/SimpleGrid/SimpleGrid.js +73 -0
- package/dist/SimpleGrid/SimpleGrid.js.map +1 -0
- package/dist/SimpleGrid/index.d.ts +2 -0
- package/dist/SimpleGrid/index.js +16 -0
- package/dist/SimpleGrid/index.js.map +1 -0
- package/dist/SimpleGrid/styles.js +99 -0
- package/dist/SimpleGrid/styles.js.map +1 -0
- package/dist/TimePicker/PeriodPicker/PeriodPicker.js +112 -0
- package/dist/TimePicker/PeriodPicker/PeriodPicker.js.map +1 -0
- package/dist/TimePicker/PeriodPicker/index.js +21 -0
- package/dist/TimePicker/PeriodPicker/index.js.map +1 -0
- package/dist/TimePicker/PeriodPicker/styles.js +32 -0
- package/dist/TimePicker/PeriodPicker/styles.js.map +1 -0
- package/dist/TimePicker/TimePicker.d.ts +140 -0
- package/dist/TimePicker/TimePicker.js +748 -0
- package/dist/TimePicker/TimePicker.js.map +1 -0
- package/dist/TimePicker/UnitTimePicker/UnitTimePicker.js +243 -0
- package/dist/TimePicker/UnitTimePicker/UnitTimePicker.js.map +1 -0
- package/dist/TimePicker/UnitTimePicker/index.js +21 -0
- package/dist/TimePicker/UnitTimePicker/index.js.map +1 -0
- package/dist/TimePicker/UnitTimePicker/styles.js +75 -0
- package/dist/TimePicker/UnitTimePicker/styles.js.map +1 -0
- package/dist/TimePicker/enums.js +43 -0
- package/dist/TimePicker/enums.js.map +1 -0
- package/dist/TimePicker/index.d.ts +2 -0
- package/dist/TimePicker/index.js +16 -0
- package/dist/TimePicker/index.js.map +1 -0
- package/dist/TimePicker/styles.js +134 -0
- package/dist/TimePicker/styles.js.map +1 -0
- package/dist/TimePicker/timePickerConverter.js +90 -0
- package/dist/TimePicker/timePickerConverter.js.map +1 -0
- package/dist/TimePicker/timePickerFormatter.js +81 -0
- package/dist/TimePicker/timePickerFormatter.js.map +1 -0
- package/dist/TimePicker/timePickerUtils.js +39 -0
- package/dist/TimePicker/timePickerUtils.js.map +1 -0
- package/dist/legacy/SimpleGrid/SimpleGrid.d.ts +17 -0
- package/dist/legacy/SimpleGrid/SimpleGrid.js +59 -0
- package/dist/legacy/SimpleGrid/SimpleGrid.js.map +1 -0
- package/dist/legacy/SimpleGrid/index.d.ts +2 -0
- package/dist/legacy/SimpleGrid/index.js +2 -0
- package/dist/legacy/SimpleGrid/index.js.map +1 -0
- package/dist/legacy/SimpleGrid/styles.js +81 -0
- package/dist/legacy/SimpleGrid/styles.js.map +1 -0
- package/dist/legacy/TimePicker/PeriodPicker/PeriodPicker.js +78 -0
- package/dist/legacy/TimePicker/PeriodPicker/PeriodPicker.js.map +1 -0
- package/dist/legacy/TimePicker/PeriodPicker/index.js +7 -0
- package/dist/legacy/TimePicker/PeriodPicker/index.js.map +1 -0
- package/dist/legacy/TimePicker/PeriodPicker/styles.js +24 -0
- package/dist/legacy/TimePicker/PeriodPicker/styles.js.map +1 -0
- package/dist/legacy/TimePicker/TimePicker.d.ts +140 -0
- package/dist/legacy/TimePicker/TimePicker.js +696 -0
- package/dist/legacy/TimePicker/TimePicker.js.map +1 -0
- package/dist/legacy/TimePicker/UnitTimePicker/UnitTimePicker.js +206 -0
- package/dist/legacy/TimePicker/UnitTimePicker/UnitTimePicker.js.map +1 -0
- package/dist/legacy/TimePicker/UnitTimePicker/index.js +7 -0
- package/dist/legacy/TimePicker/UnitTimePicker/index.js.map +1 -0
- package/dist/legacy/TimePicker/UnitTimePicker/styles.js +58 -0
- package/dist/legacy/TimePicker/UnitTimePicker/styles.js.map +1 -0
- package/dist/legacy/TimePicker/enums.js +33 -0
- package/dist/legacy/TimePicker/enums.js.map +1 -0
- package/dist/legacy/TimePicker/index.d.ts +2 -0
- package/dist/legacy/TimePicker/index.js +2 -0
- package/dist/legacy/TimePicker/index.js.map +1 -0
- package/dist/legacy/TimePicker/styles.js +117 -0
- package/dist/legacy/TimePicker/styles.js.map +1 -0
- package/dist/legacy/TimePicker/timePickerConverter.js +71 -0
- package/dist/legacy/TimePicker/timePickerConverter.js.map +1 -0
- package/dist/legacy/TimePicker/timePickerFormatter.js +66 -0
- package/dist/legacy/TimePicker/timePickerFormatter.js.map +1 -0
- package/dist/legacy/TimePicker/timePickerUtils.js +29 -0
- package/dist/legacy/TimePicker/timePickerUtils.js.map +1 -0
- package/dist/modern/SimpleGrid/SimpleGrid.d.ts +17 -0
- package/dist/modern/SimpleGrid/SimpleGrid.js +60 -0
- package/dist/modern/SimpleGrid/SimpleGrid.js.map +1 -0
- package/dist/modern/SimpleGrid/index.d.ts +2 -0
- package/dist/modern/SimpleGrid/index.js +2 -0
- package/dist/modern/SimpleGrid/index.js.map +1 -0
- package/dist/modern/SimpleGrid/styles.js +68 -0
- package/dist/modern/SimpleGrid/styles.js.map +1 -0
- package/dist/modern/TimePicker/PeriodPicker/PeriodPicker.js +75 -0
- package/dist/modern/TimePicker/PeriodPicker/PeriodPicker.js.map +1 -0
- package/dist/modern/TimePicker/PeriodPicker/index.js +7 -0
- package/dist/modern/TimePicker/PeriodPicker/index.js.map +1 -0
- package/dist/modern/TimePicker/PeriodPicker/styles.js +22 -0
- package/dist/modern/TimePicker/PeriodPicker/styles.js.map +1 -0
- package/dist/modern/TimePicker/TimePicker.d.ts +140 -0
- package/dist/modern/TimePicker/TimePicker.js +659 -0
- package/dist/modern/TimePicker/TimePicker.js.map +1 -0
- package/dist/modern/TimePicker/UnitTimePicker/UnitTimePicker.js +191 -0
- package/dist/modern/TimePicker/UnitTimePicker/UnitTimePicker.js.map +1 -0
- package/dist/modern/TimePicker/UnitTimePicker/index.js +7 -0
- package/dist/modern/TimePicker/UnitTimePicker/index.js.map +1 -0
- package/dist/modern/TimePicker/UnitTimePicker/styles.js +49 -0
- package/dist/modern/TimePicker/UnitTimePicker/styles.js.map +1 -0
- package/dist/modern/TimePicker/enums.js +32 -0
- package/dist/modern/TimePicker/enums.js.map +1 -0
- package/dist/modern/TimePicker/index.d.ts +2 -0
- package/dist/modern/TimePicker/index.js +2 -0
- package/dist/modern/TimePicker/index.js.map +1 -0
- package/dist/modern/TimePicker/styles.js +108 -0
- package/dist/modern/TimePicker/styles.js.map +1 -0
- package/dist/modern/TimePicker/timePickerConverter.js +66 -0
- package/dist/modern/TimePicker/timePickerConverter.js.map +1 -0
- package/dist/modern/TimePicker/timePickerFormatter.js +65 -0
- package/dist/modern/TimePicker/timePickerFormatter.js.map +1 -0
- package/dist/modern/TimePicker/timePickerUtils.js +27 -0
- package/dist/modern/TimePicker/timePickerUtils.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.keys.js");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.symbol.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.array.filter.js");
|
|
8
|
+
|
|
9
|
+
require("core-js/modules/es.object.to-string.js");
|
|
10
|
+
|
|
11
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
12
|
+
|
|
13
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
14
|
+
|
|
15
|
+
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
16
|
+
|
|
17
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
18
|
+
|
|
19
|
+
Object.defineProperty(exports, "__esModule", {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
exports.default = void 0;
|
|
23
|
+
|
|
24
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
+
|
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
+
|
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29
|
+
|
|
30
|
+
var icon = {
|
|
31
|
+
position: "absolute",
|
|
32
|
+
right: 0,
|
|
33
|
+
bottom: 0,
|
|
34
|
+
width: "30px",
|
|
35
|
+
height: "30px"
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
var styles = function styles(theme) {
|
|
39
|
+
return {
|
|
40
|
+
input: _objectSpread(_objectSpread({
|
|
41
|
+
border: "none",
|
|
42
|
+
height: "30px",
|
|
43
|
+
width: "100%",
|
|
44
|
+
background: "white",
|
|
45
|
+
fontFamily: theme.hv.typography.fontFamily
|
|
46
|
+
}, theme.hv.typography.normalText), {}, {
|
|
47
|
+
"&:focus": {
|
|
48
|
+
outline: "none"
|
|
49
|
+
},
|
|
50
|
+
"&::placeholder": _objectSpread({}, theme.hv.typography.placeholderText)
|
|
51
|
+
}),
|
|
52
|
+
inputPopperOpenedBelow: {
|
|
53
|
+
boxShadow: "0 10px 12px #fff"
|
|
54
|
+
},
|
|
55
|
+
inputPopperOpenedAbove: {
|
|
56
|
+
boxShadow: "0 -10px 12px #fff"
|
|
57
|
+
},
|
|
58
|
+
inputPopperClosed: {
|
|
59
|
+
border: "1px solid ".concat(theme.hv.palette.atmosphere.atmo6)
|
|
60
|
+
},
|
|
61
|
+
inputContainer: {
|
|
62
|
+
position: "relative",
|
|
63
|
+
background: theme.hv.palette.atmosphere.atmo1,
|
|
64
|
+
height: "32px",
|
|
65
|
+
paddingLeft: "".concat(theme.hv.spacing.xs, "px"),
|
|
66
|
+
paddingRight: "".concat(theme.hv.spacing.md, "px")
|
|
67
|
+
},
|
|
68
|
+
labelContainer: {
|
|
69
|
+
display: "flex",
|
|
70
|
+
alignItems: "flex-start"
|
|
71
|
+
},
|
|
72
|
+
icon: _objectSpread(_objectSpread({}, icon), {}, {
|
|
73
|
+
cursor: "pointer"
|
|
74
|
+
}),
|
|
75
|
+
timePickerContainer: {
|
|
76
|
+
position: "relative",
|
|
77
|
+
minWidth: "175px"
|
|
78
|
+
},
|
|
79
|
+
label: {
|
|
80
|
+
marginBottom: 6,
|
|
81
|
+
display: "block"
|
|
82
|
+
},
|
|
83
|
+
timePopperContainer: {
|
|
84
|
+
backgroundColor: "".concat(theme.hv.palette.atmosphere.atmo1),
|
|
85
|
+
zIndex: "10",
|
|
86
|
+
display: "flex",
|
|
87
|
+
flexDirection: "row",
|
|
88
|
+
justifyContent: "center",
|
|
89
|
+
alignItems: "center",
|
|
90
|
+
padding: "".concat(theme.hv.spacing.sm, "px"),
|
|
91
|
+
userSelect: "none",
|
|
92
|
+
minWidth: "175px"
|
|
93
|
+
},
|
|
94
|
+
separator: _objectSpread(_objectSpread({}, theme.hv.typography.sTitle), {}, {
|
|
95
|
+
width: 8,
|
|
96
|
+
position: "relative",
|
|
97
|
+
top: -8,
|
|
98
|
+
paddingLeft: 2
|
|
99
|
+
}),
|
|
100
|
+
formElementRoot: {
|
|
101
|
+
position: "relative"
|
|
102
|
+
},
|
|
103
|
+
iconBaseRoot: {
|
|
104
|
+
position: "absolute",
|
|
105
|
+
top: "-1px",
|
|
106
|
+
right: "-1px"
|
|
107
|
+
},
|
|
108
|
+
dropdownInputRootFocused: {
|
|
109
|
+
boxShadow: "none"
|
|
110
|
+
},
|
|
111
|
+
dropdownPlaceholder: {
|
|
112
|
+
color: theme.hv.palette.accent.acce1
|
|
113
|
+
},
|
|
114
|
+
dropdownPlaceholderDisabled: {
|
|
115
|
+
color: theme.hv.palette.atmosphere.atmo5
|
|
116
|
+
},
|
|
117
|
+
dropdownHeaderInvalid: {
|
|
118
|
+
border: "1px solid ".concat(theme.hv.palette.semantic.sema4),
|
|
119
|
+
"&:hover": {
|
|
120
|
+
border: "1px solid ".concat(theme.hv.palette.semantic.sema4)
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
dropdownHeaderOpen: {
|
|
124
|
+
border: "1px solid ".concat(theme.hv.palette.atmosphere.atmo1),
|
|
125
|
+
"&:hover": {
|
|
126
|
+
border: "1px solid ".concat(theme.hv.palette.atmosphere.atmo1)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
var _default = styles;
|
|
133
|
+
exports.default = _default;
|
|
134
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/TimePicker/styles.js"],"names":["icon","position","right","bottom","width","height","styles","theme","input","border","background","fontFamily","hv","typography","normalText","outline","placeholderText","inputPopperOpenedBelow","boxShadow","inputPopperOpenedAbove","inputPopperClosed","palette","atmosphere","atmo6","inputContainer","atmo1","paddingLeft","spacing","xs","paddingRight","md","labelContainer","display","alignItems","cursor","timePickerContainer","minWidth","label","marginBottom","timePopperContainer","backgroundColor","zIndex","flexDirection","justifyContent","padding","sm","userSelect","separator","sTitle","top","formElementRoot","iconBaseRoot","dropdownInputRootFocused","dropdownPlaceholder","color","accent","acce1","dropdownPlaceholderDisabled","atmo5","dropdownHeaderInvalid","semantic","sema4","dropdownHeaderOpen"],"mappings":"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","sourcesContent":["const icon = {\n position: \"absolute\",\n right: 0,\n bottom: 0,\n width: \"30px\",\n height: \"30px\",\n};\n\nconst styles = (theme) => ({\n input: {\n border: \"none\",\n height: \"30px\",\n width: \"100%\",\n background: \"white\",\n fontFamily: theme.hv.typography.fontFamily,\n ...theme.hv.typography.normalText,\n \"&:focus\": {\n outline: \"none\",\n },\n \"&::placeholder\": {\n ...theme.hv.typography.placeholderText,\n },\n },\n inputPopperOpenedBelow: {\n boxShadow: \"0 10px 12px #fff\",\n },\n inputPopperOpenedAbove: {\n boxShadow: \"0 -10px 12px #fff\",\n },\n inputPopperClosed: {\n border: `1px solid ${theme.hv.palette.atmosphere.atmo6}`,\n },\n inputContainer: {\n position: \"relative\",\n background: theme.hv.palette.atmosphere.atmo1,\n height: \"32px\",\n paddingLeft: `${theme.hv.spacing.xs}px`,\n paddingRight: `${theme.hv.spacing.md}px`,\n },\n labelContainer: {\n display: \"flex\",\n alignItems: \"flex-start\",\n },\n icon: {\n ...icon,\n cursor: \"pointer\",\n },\n timePickerContainer: {\n position: \"relative\",\n minWidth: \"175px\",\n },\n label: {\n marginBottom: 6,\n display: \"block\",\n },\n timePopperContainer: {\n backgroundColor: `${theme.hv.palette.atmosphere.atmo1}`,\n zIndex: \"10\",\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"center\",\n alignItems: \"center\",\n padding: `${theme.hv.spacing.sm}px`,\n userSelect: \"none\",\n minWidth: \"175px\",\n },\n separator: {\n ...theme.hv.typography.sTitle,\n width: 8,\n position: \"relative\",\n top: -8,\n paddingLeft: 2,\n },\n\n formElementRoot: {\n position: \"relative\",\n },\n\n iconBaseRoot: {\n position: \"absolute\",\n top: \"-1px\",\n right: \"-1px\",\n },\n\n dropdownInputRootFocused: {\n boxShadow: \"none\",\n },\n dropdownPlaceholder: {\n color: theme.hv.palette.accent.acce1,\n },\n dropdownPlaceholderDisabled: {\n color: theme.hv.palette.atmosphere.atmo5,\n },\n dropdownHeaderInvalid: {\n border: `1px solid ${theme.hv.palette.semantic.sema4}`,\n \"&:hover\": {\n border: `1px solid ${theme.hv.palette.semantic.sema4}`,\n },\n },\n\n dropdownHeaderOpen: {\n border: `1px solid ${theme.hv.palette.atmosphere.atmo1}`,\n \"&:hover\": {\n border: `1px solid ${theme.hv.palette.atmosphere.atmo1}`,\n },\n },\n});\n\nexport default styles;\n"],"file":"styles.js"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.keys.js");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.symbol.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.array.filter.js");
|
|
8
|
+
|
|
9
|
+
require("core-js/modules/es.object.to-string.js");
|
|
10
|
+
|
|
11
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
12
|
+
|
|
13
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
14
|
+
|
|
15
|
+
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
16
|
+
|
|
17
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
18
|
+
|
|
19
|
+
Object.defineProperty(exports, "__esModule", {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
exports.getTimeWithFormat24 = exports.getHoursForTimeFormat = void 0;
|
|
23
|
+
|
|
24
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
+
|
|
26
|
+
var _timePickerUtils = require("./timePickerUtils");
|
|
27
|
+
|
|
28
|
+
var _enums = require("./enums");
|
|
29
|
+
|
|
30
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
31
|
+
|
|
32
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Gets hours for the passed time format.
|
|
36
|
+
* e.g. 20hours in 12h format is set to 8
|
|
37
|
+
* @param {Number} hours - current hours
|
|
38
|
+
* @param {String} timeFormat - AM/PM
|
|
39
|
+
*
|
|
40
|
+
* @returns {Number} - hours in the correct format
|
|
41
|
+
*/
|
|
42
|
+
var getHoursForTimeFormat = function getHoursForTimeFormat(hours, timeFormat) {
|
|
43
|
+
if (timeFormat === _enums.TimeFormat.H12) {
|
|
44
|
+
if (hours == null || hours === 0) {
|
|
45
|
+
return _enums.TimePickerUnits.HOUR_12.max;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if ((0, _timePickerUtils.isUnitTimeInValidRange)(hours, _enums.TimePickerUnits.HOUR_12.type)) {
|
|
49
|
+
return hours;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if ((0, _timePickerUtils.isUnitTimeInValidRange)(hours, _enums.TimePickerUnits.HOUR_24.type)) {
|
|
53
|
+
return hours - _enums.TimePickerUnits.HOUR_12.max;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return hours;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Gets the time in 24h format
|
|
61
|
+
* e.g. 08:00:00:PM in 12h format is set to 20:00:00
|
|
62
|
+
* @param {Object} time - object with hours, minutes, seconds and period
|
|
63
|
+
* @param {String} timeFormat - AM/PM
|
|
64
|
+
*
|
|
65
|
+
* @returns {Object} - time object (hours, minutes, seconds and period) with the hours set
|
|
66
|
+
* into the correct format
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
exports.getHoursForTimeFormat = getHoursForTimeFormat;
|
|
71
|
+
|
|
72
|
+
var getTimeWithFormat24 = function getTimeWithFormat24(time, timeFormat) {
|
|
73
|
+
var hours = time.hours,
|
|
74
|
+
period = time.period;
|
|
75
|
+
|
|
76
|
+
var timeIn24Format = _objectSpread({}, time);
|
|
77
|
+
|
|
78
|
+
if (timeFormat === _enums.TimeFormat.H12) {
|
|
79
|
+
if (period === _enums.PeriodPickerOptions.AM && hours === _enums.TimePickerUnits.HOUR_12.max) {
|
|
80
|
+
timeIn24Format.hours = _enums.TimePickerUnits.HOUR_24.min;
|
|
81
|
+
} else if (period === _enums.PeriodPickerOptions.PM && hours < _enums.TimePickerUnits.HOUR_12.max) {
|
|
82
|
+
timeIn24Format.hours = hours + _enums.TimePickerUnits.HOUR_12.max;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return timeIn24Format;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
exports.getTimeWithFormat24 = getTimeWithFormat24;
|
|
90
|
+
//# sourceMappingURL=timePickerConverter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/TimePicker/timePickerConverter.js"],"names":["getHoursForTimeFormat","hours","timeFormat","TimeFormat","H12","TimePickerUnits","HOUR_12","max","type","HOUR_24","getTimeWithFormat24","time","period","timeIn24Format","PeriodPickerOptions","AM","min","PM"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAwB,CAACC,KAAD,EAAQC,UAAR,EAAuB;AACnD,MAAIA,UAAU,KAAKC,kBAAWC,GAA9B,EAAmC;AACjC,QAAIH,KAAK,IAAI,IAAT,IAAiBA,KAAK,KAAK,CAA/B,EAAkC;AAChC,aAAOI,uBAAgBC,OAAhB,CAAwBC,GAA/B;AACD;;AACD,QAAI,6CAAuBN,KAAvB,EAA8BI,uBAAgBC,OAAhB,CAAwBE,IAAtD,CAAJ,EAAiE;AAC/D,aAAOP,KAAP;AACD;;AACD,QAAI,6CAAuBA,KAAvB,EAA8BI,uBAAgBI,OAAhB,CAAwBD,IAAtD,CAAJ,EAAiE;AAC/D,aAAOP,KAAK,GAAGI,uBAAgBC,OAAhB,CAAwBC,GAAvC;AACD;AACF;;AACD,SAAON,KAAP;AACD,CAbD;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACA,IAAMS,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACC,IAAD,EAAOT,UAAP,EAAsB;AAChD,MAAQD,KAAR,GAA0BU,IAA1B,CAAQV,KAAR;AAAA,MAAeW,MAAf,GAA0BD,IAA1B,CAAeC,MAAf;;AACA,MAAMC,cAAc,qBAAQF,IAAR,CAApB;;AACA,MAAIT,UAAU,KAAKC,kBAAWC,GAA9B,EAAmC;AACjC,QAAIQ,MAAM,KAAKE,2BAAoBC,EAA/B,IAAqCd,KAAK,KAAKI,uBAAgBC,OAAhB,CAAwBC,GAA3E,EAAgF;AAC9EM,MAAAA,cAAc,CAACZ,KAAf,GAAuBI,uBAAgBI,OAAhB,CAAwBO,GAA/C;AACD,KAFD,MAEO,IAAIJ,MAAM,KAAKE,2BAAoBG,EAA/B,IAAqChB,KAAK,GAAGI,uBAAgBC,OAAhB,CAAwBC,GAAzE,EAA8E;AACnFM,MAAAA,cAAc,CAACZ,KAAf,GAAuBA,KAAK,GAAGI,uBAAgBC,OAAhB,CAAwBC,GAAvD;AACD;AACF;;AACD,SAAOM,cAAP;AACD,CAXD","sourcesContent":["import { isUnitTimeInValidRange } from \"./timePickerUtils\";\nimport { TimeFormat, PeriodPickerOptions, TimePickerUnits } from \"./enums\";\n\n/**\n * Gets hours for the passed time format.\n * e.g. 20hours in 12h format is set to 8\n * @param {Number} hours - current hours\n * @param {String} timeFormat - AM/PM\n *\n * @returns {Number} - hours in the correct format\n */\nconst getHoursForTimeFormat = (hours, timeFormat) => {\n if (timeFormat === TimeFormat.H12) {\n if (hours == null || hours === 0) {\n return TimePickerUnits.HOUR_12.max;\n }\n if (isUnitTimeInValidRange(hours, TimePickerUnits.HOUR_12.type)) {\n return hours;\n }\n if (isUnitTimeInValidRange(hours, TimePickerUnits.HOUR_24.type)) {\n return hours - TimePickerUnits.HOUR_12.max;\n }\n }\n return hours;\n};\n\n/**\n * Gets the time in 24h format\n * e.g. 08:00:00:PM in 12h format is set to 20:00:00\n * @param {Object} time - object with hours, minutes, seconds and period\n * @param {String} timeFormat - AM/PM\n *\n * @returns {Object} - time object (hours, minutes, seconds and period) with the hours set\n * into the correct format\n */\nconst getTimeWithFormat24 = (time, timeFormat) => {\n const { hours, period } = time;\n const timeIn24Format = { ...time };\n if (timeFormat === TimeFormat.H12) {\n if (period === PeriodPickerOptions.AM && hours === TimePickerUnits.HOUR_12.max) {\n timeIn24Format.hours = TimePickerUnits.HOUR_24.min;\n } else if (period === PeriodPickerOptions.PM && hours < TimePickerUnits.HOUR_12.max) {\n timeIn24Format.hours = hours + TimePickerUnits.HOUR_12.max;\n }\n }\n return timeIn24Format;\n};\n\nexport { getHoursForTimeFormat, getTimeWithFormat24 };\n"],"file":"timePickerConverter.js"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.padTime = exports.getTimeFormatForLocale = exports.getFormattedTime = void 0;
|
|
7
|
+
|
|
8
|
+
require("core-js/modules/es.object.to-string.js");
|
|
9
|
+
|
|
10
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
11
|
+
|
|
12
|
+
require("core-js/modules/es.array.concat.js");
|
|
13
|
+
|
|
14
|
+
var _enums = require("./enums");
|
|
15
|
+
|
|
16
|
+
var _timePickerConverter = require("./timePickerConverter");
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Pads the unit time values so that they always have two digits
|
|
20
|
+
* @param {Number} value - unit time value
|
|
21
|
+
* @returns The unit time value with two digits
|
|
22
|
+
*/
|
|
23
|
+
var padTime = function padTime(value) {
|
|
24
|
+
if (value == null || value === "" || value < 0) {
|
|
25
|
+
return value === null || value === void 0 ? void 0 : value.toString();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (value < 10 && value.toString().length === 1) {
|
|
29
|
+
return "0".concat(value.toString());
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return value.toString();
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Gets the time format for a given locale
|
|
36
|
+
* @param {String} locale - locale
|
|
37
|
+
* @returns {TimeFormat} the time format for the given locale (12 or 24)
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
exports.padTime = padTime;
|
|
42
|
+
|
|
43
|
+
var getTimeFormatForLocale = function getTimeFormatForLocale(locale) {
|
|
44
|
+
var options = {
|
|
45
|
+
hour: "numeric"
|
|
46
|
+
};
|
|
47
|
+
var dateTimeFormat = new Intl.DateTimeFormat(locale, options);
|
|
48
|
+
var isInHour12Format = dateTimeFormat.resolvedOptions().hour12;
|
|
49
|
+
return isInHour12Format ? _enums.TimeFormat.H12 : _enums.TimeFormat.H24;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Formats the time to be rendered
|
|
53
|
+
* @param {Object} time - time object to be rendered
|
|
54
|
+
* @param {Number} time.hours - hours
|
|
55
|
+
* @param {Number} time.minutes - minutes
|
|
56
|
+
* @param {Number} time.seconds - seconds
|
|
57
|
+
* @param {String} time.period - period (am/pm). It is undefined when the time is to be shown in 24h format
|
|
58
|
+
*
|
|
59
|
+
* @returns {String} formatted time
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
exports.getTimeFormatForLocale = getTimeFormatForLocale;
|
|
64
|
+
|
|
65
|
+
var getFormattedTime = function getFormattedTime(time, timeFormat) {
|
|
66
|
+
var hours = time.hours,
|
|
67
|
+
minutes = time.minutes,
|
|
68
|
+
seconds = time.seconds,
|
|
69
|
+
period = time.period;
|
|
70
|
+
var isInHour12Format = timeFormat === _enums.TimeFormat.H12 || timeFormat == null && period != null;
|
|
71
|
+
|
|
72
|
+
if (isInHour12Format) {
|
|
73
|
+
var p = period !== null && period !== void 0 ? period : hours > 12 ? _enums.PeriodPickerOptions.PM : _enums.PeriodPickerOptions.AM;
|
|
74
|
+
return "".concat(padTime((0, _timePickerConverter.getHoursForTimeFormat)(hours, _enums.TimeFormat.H12)), ":").concat(padTime(minutes), ":").concat(padTime(seconds), " ").concat(p);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return "".concat(padTime(hours), ":").concat(padTime(minutes), ":").concat(padTime(seconds));
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
exports.getFormattedTime = getFormattedTime;
|
|
81
|
+
//# sourceMappingURL=timePickerFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/TimePicker/timePickerFormatter.js"],"names":["padTime","value","toString","length","getTimeFormatForLocale","locale","options","hour","dateTimeFormat","Intl","DateTimeFormat","isInHour12Format","resolvedOptions","hour12","TimeFormat","H12","H24","getFormattedTime","time","timeFormat","hours","minutes","seconds","period","p","PeriodPickerOptions","PM","AM"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAMA,OAAO,GAAG,SAAVA,OAAU,CAACC,KAAD,EAAW;AACzB,MAAIA,KAAK,IAAI,IAAT,IAAiBA,KAAK,KAAK,EAA3B,IAAiCA,KAAK,GAAG,CAA7C,EAAgD;AAC9C,WAAOA,KAAP,aAAOA,KAAP,uBAAOA,KAAK,CAAEC,QAAP,EAAP;AACD;;AACD,MAAID,KAAK,GAAG,EAAR,IAAcA,KAAK,CAACC,QAAN,GAAiBC,MAAjB,KAA4B,CAA9C,EAAiD;AAC/C,sBAAWF,KAAK,CAACC,QAAN,EAAX;AACD;;AACD,SAAOD,KAAK,CAACC,QAAN,EAAP;AACD,CARD;AAUA;AACA;AACA;AACA;AACA;;;;;AACA,IAAME,sBAAsB,GAAG,SAAzBA,sBAAyB,CAACC,MAAD,EAAY;AACzC,MAAMC,OAAO,GAAG;AACdC,IAAAA,IAAI,EAAE;AADQ,GAAhB;AAGA,MAAMC,cAAc,GAAG,IAAIC,IAAI,CAACC,cAAT,CAAwBL,MAAxB,EAAgCC,OAAhC,CAAvB;AACA,MAAMK,gBAAgB,GAAGH,cAAc,CAACI,eAAf,GAAiCC,MAA1D;AACA,SAAOF,gBAAgB,GAAGG,kBAAWC,GAAd,GAAoBD,kBAAWE,GAAtD;AACD,CAPD;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,IAAD,EAAOC,UAAP,EAAsB;AAC7C,MAAQC,KAAR,GAA4CF,IAA5C,CAAQE,KAAR;AAAA,MAAeC,OAAf,GAA4CH,IAA5C,CAAeG,OAAf;AAAA,MAAwBC,OAAxB,GAA4CJ,IAA5C,CAAwBI,OAAxB;AAAA,MAAiCC,MAAjC,GAA4CL,IAA5C,CAAiCK,MAAjC;AAEA,MAAMZ,gBAAgB,GAAGQ,UAAU,KAAKL,kBAAWC,GAA1B,IAAkCI,UAAU,IAAI,IAAd,IAAsBI,MAAM,IAAI,IAA3F;;AAEA,MAAIZ,gBAAJ,EAAsB;AACpB,QAAMa,CAAC,GAAGD,MAAH,aAAGA,MAAH,cAAGA,MAAH,GAAcH,KAAK,GAAG,EAAR,GAAaK,2BAAoBC,EAAjC,GAAsCD,2BAAoBE,EAA/E;AACA,qBAAU3B,OAAO,CAAC,gDAAsBoB,KAAtB,EAA6BN,kBAAWC,GAAxC,CAAD,CAAjB,cAAmEf,OAAO,CAACqB,OAAD,CAA1E,cAAuFrB,OAAO,CAC5FsB,OAD4F,CAA9F,cAEKE,CAFL;AAGD;;AAED,mBAAUxB,OAAO,CAACoB,KAAD,CAAjB,cAA4BpB,OAAO,CAACqB,OAAD,CAAnC,cAAgDrB,OAAO,CAACsB,OAAD,CAAvD;AACD,CAbD","sourcesContent":["import { TimeFormat, PeriodPickerOptions } from \"./enums\";\nimport { getHoursForTimeFormat } from \"./timePickerConverter\";\n\n/**\n * Pads the unit time values so that they always have two digits\n * @param {Number} value - unit time value\n * @returns The unit time value with two digits\n */\nconst padTime = (value) => {\n if (value == null || value === \"\" || value < 0) {\n return value?.toString();\n }\n if (value < 10 && value.toString().length === 1) {\n return `0${value.toString()}`;\n }\n return value.toString();\n};\n\n/**\n * Gets the time format for a given locale\n * @param {String} locale - locale\n * @returns {TimeFormat} the time format for the given locale (12 or 24)\n */\nconst getTimeFormatForLocale = (locale) => {\n const options = {\n hour: \"numeric\",\n };\n const dateTimeFormat = new Intl.DateTimeFormat(locale, options);\n const isInHour12Format = dateTimeFormat.resolvedOptions().hour12;\n return isInHour12Format ? TimeFormat.H12 : TimeFormat.H24;\n};\n\n/**\n * Formats the time to be rendered\n * @param {Object} time - time object to be rendered\n * @param {Number} time.hours - hours\n * @param {Number} time.minutes - minutes\n * @param {Number} time.seconds - seconds\n * @param {String} time.period - period (am/pm). It is undefined when the time is to be shown in 24h format\n *\n * @returns {String} formatted time\n */\nconst getFormattedTime = (time, timeFormat) => {\n const { hours, minutes, seconds, period } = time;\n\n const isInHour12Format = timeFormat === TimeFormat.H12 || (timeFormat == null && period != null);\n\n if (isInHour12Format) {\n const p = period ?? (hours > 12 ? PeriodPickerOptions.PM : PeriodPickerOptions.AM);\n return `${padTime(getHoursForTimeFormat(hours, TimeFormat.H12))}:${padTime(minutes)}:${padTime(\n seconds\n )} ${p}`;\n }\n\n return `${padTime(hours)}:${padTime(minutes)}:${padTime(seconds)}`;\n};\n\nexport { padTime, getFormattedTime, getTimeFormatForLocale };\n"],"file":"timePickerFormatter.js"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isUnitTimeInValidRange = exports.getPeriodForDate = void 0;
|
|
7
|
+
|
|
8
|
+
require("core-js/modules/es.array.concat.js");
|
|
9
|
+
|
|
10
|
+
var _enums = require("./enums");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Gets the period(am/pm) for a given time
|
|
14
|
+
* @param {Date} date - Date to get the period from. The default date is the current one.
|
|
15
|
+
* @returns {String} - AM or PM
|
|
16
|
+
*/
|
|
17
|
+
var getPeriodForDate = function getPeriodForDate() {
|
|
18
|
+
var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
|
|
19
|
+
var hours = date.getHours();
|
|
20
|
+
return hours < 12 ? _enums.PeriodPickerOptions.AM : _enums.PeriodPickerOptions.PM;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Checks if the unit time value is inside the acceptable range
|
|
24
|
+
*
|
|
25
|
+
* @param {Number} value - unit time value
|
|
26
|
+
* @param {String} type - unit time type. One of the TimePickerUnits types.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
exports.getPeriodForDate = getPeriodForDate;
|
|
31
|
+
|
|
32
|
+
var isUnitTimeInValidRange = function isUnitTimeInValidRange(value, type) {
|
|
33
|
+
var timeUnit = _enums.TimePickerUnits[type];
|
|
34
|
+
console.log("type = ".concat(type, ", timeUnit: ").concat(timeUnit));
|
|
35
|
+
return value !== "" && value >= timeUnit.min && value <= timeUnit.max;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
exports.isUnitTimeInValidRange = isUnitTimeInValidRange;
|
|
39
|
+
//# sourceMappingURL=timePickerUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/TimePicker/timePickerUtils.js"],"names":["getPeriodForDate","date","Date","hours","getHours","PeriodPickerOptions","AM","PM","isUnitTimeInValidRange","value","type","timeUnit","TimePickerUnits","console","log","min","max"],"mappings":";;;;;;;;;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAmB,GAAuB;AAAA,MAAtBC,IAAsB,uEAAf,IAAIC,IAAJ,EAAe;AAC9C,MAAMC,KAAK,GAAGF,IAAI,CAACG,QAAL,EAAd;AACA,SAAOD,KAAK,GAAG,EAAR,GAAaE,2BAAoBC,EAAjC,GAAsCD,2BAAoBE,EAAjE;AACD,CAHD;AAKA;AACA;AACA;AACA;AACA;AACA;;;;;AACA,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAyB,CAACC,KAAD,EAAQC,IAAR,EAAiB;AAC9C,MAAMC,QAAQ,GAAGC,uBAAgBF,IAAhB,CAAjB;AACAG,EAAAA,OAAO,CAACC,GAAR,kBAAsBJ,IAAtB,yBAAyCC,QAAzC;AACA,SAAOF,KAAK,KAAK,EAAV,IAAgBA,KAAK,IAAIE,QAAQ,CAACI,GAAlC,IAAyCN,KAAK,IAAIE,QAAQ,CAACK,GAAlE;AACD,CAJD","sourcesContent":["import { PeriodPickerOptions, TimePickerUnits } from \"./enums\";\n\n/**\n * Gets the period(am/pm) for a given time\n * @param {Date} date - Date to get the period from. The default date is the current one.\n * @returns {String} - AM or PM\n */\nconst getPeriodForDate = (date = new Date()) => {\n const hours = date.getHours();\n return hours < 12 ? PeriodPickerOptions.AM : PeriodPickerOptions.PM;\n};\n\n/**\n * Checks if the unit time value is inside the acceptable range\n *\n * @param {Number} value - unit time value\n * @param {String} type - unit time type. One of the TimePickerUnits types.\n */\nconst isUnitTimeInValidRange = (value, type) => {\n const timeUnit = TimePickerUnits[type];\n console.log(`type = ${type}, timeUnit: ${timeUnit}`);\n return value !== \"\" && value >= timeUnit.min && value <= timeUnit.max;\n};\n\nexport { getPeriodForDate, isUnitTimeInValidRange };\n"],"file":"timePickerUtils.js"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FunctionComponent } from "react";
|
|
2
|
+
|
|
3
|
+
export type Spacing = "xs" | "sm" | "md" | "lg";
|
|
4
|
+
export type Breakpoints = {
|
|
5
|
+
cols?: number;
|
|
6
|
+
maxWidth?: number;
|
|
7
|
+
minWidth?: number;
|
|
8
|
+
spacing?: Spacing;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export interface SimpleGridProps extends FunctionComponent {
|
|
12
|
+
spacing?: Spacing;
|
|
13
|
+
cols?: number;
|
|
14
|
+
breakpoints?: Breakpoints;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default function HvSimpleGrid(props: SimpleGridProps): JSX.Element | null;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["children", "breakpoints", "spacing", "cols"];
|
|
4
|
+
import React from "react";
|
|
5
|
+
import PropTypes from "prop-types";
|
|
6
|
+
import useStyles from "./styles";
|
|
7
|
+
|
|
8
|
+
var SimpleGrid = function SimpleGrid(_ref) {
|
|
9
|
+
var children = _ref.children,
|
|
10
|
+
breakpoints = _ref.breakpoints,
|
|
11
|
+
_ref$spacing = _ref.spacing,
|
|
12
|
+
spacing = _ref$spacing === void 0 ? "sm" : _ref$spacing,
|
|
13
|
+
cols = _ref.cols,
|
|
14
|
+
others = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
+
|
|
16
|
+
var classes = useStyles({
|
|
17
|
+
breakpoints: breakpoints,
|
|
18
|
+
cols: cols,
|
|
19
|
+
spacing: spacing
|
|
20
|
+
})();
|
|
21
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
22
|
+
className: classes.container
|
|
23
|
+
}, others), children);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
process.env.NODE_ENV !== "production" ? SimpleGrid.propTypes = {
|
|
27
|
+
/**
|
|
28
|
+
* -
|
|
29
|
+
*/
|
|
30
|
+
children: PropTypes.node,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Spacing with pre-defined values according the values defined in the theme
|
|
34
|
+
*/
|
|
35
|
+
spacing: PropTypes.oneOf(["sm", "md", "lg", "xl"]),
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Provide an array to define responsive behavior:
|
|
39
|
+
*
|
|
40
|
+
* maxWidth or minWidth: max-width or min-width at which media query will work
|
|
41
|
+
*
|
|
42
|
+
* cols: number of columns per row at given max-width
|
|
43
|
+
*
|
|
44
|
+
* spacing: optional spacing at given max-width, if not provided spacing from component prop will be used instead
|
|
45
|
+
*/
|
|
46
|
+
breakpoints: PropTypes.arrayOf(PropTypes.shape({
|
|
47
|
+
maxWidth: PropTypes.number,
|
|
48
|
+
minWidth: PropTypes.number,
|
|
49
|
+
cols: PropTypes.number,
|
|
50
|
+
spacing: PropTypes.oneOf(["sm", "md", "lg", "xl"])
|
|
51
|
+
})),
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Number of how many columns the content will be displayed
|
|
55
|
+
*/
|
|
56
|
+
cols: PropTypes.number
|
|
57
|
+
} : void 0;
|
|
58
|
+
export default SimpleGrid;
|
|
59
|
+
//# sourceMappingURL=SimpleGrid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/SimpleGrid/SimpleGrid.js"],"names":["React","PropTypes","useStyles","SimpleGrid","children","breakpoints","spacing","cols","others","classes","container","propTypes","node","oneOf","arrayOf","shape","maxWidth","number","minWidth"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,SAAP,MAAsB,UAAtB;;AAEA,IAAMC,UAAU,GAAG,SAAbA,UAAa,OAAgE;AAAA,MAA7DC,QAA6D,QAA7DA,QAA6D;AAAA,MAAnDC,WAAmD,QAAnDA,WAAmD;AAAA,0BAAtCC,OAAsC;AAAA,MAAtCA,OAAsC,6BAA5B,IAA4B;AAAA,MAAtBC,IAAsB,QAAtBA,IAAsB;AAAA,MAAbC,MAAa;;AACjF,MAAMC,OAAO,GAAGP,SAAS,CAAC;AAAEG,IAAAA,WAAW,EAAXA,WAAF;AAAeE,IAAAA,IAAI,EAAJA,IAAf;AAAqBD,IAAAA,OAAO,EAAPA;AAArB,GAAD,CAAT,EAAhB;AACA,sBACE;AAAK,IAAA,SAAS,EAAEG,OAAO,CAACC;AAAxB,KAAuCF,MAAvC,GACGJ,QADH,CADF;AAKD,CAPD;;AASA,wCAAAD,UAAU,CAACQ,SAAX,GAAuB;AACrB;AACF;AACA;AACEP,EAAAA,QAAQ,EAAEH,SAAS,CAACW,IAJC;;AAKrB;AACF;AACA;AACEN,EAAAA,OAAO,EAAEL,SAAS,CAACY,KAAV,CAAgB,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,CAAhB,CARY;;AASrB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACER,EAAAA,WAAW,EAAEJ,SAAS,CAACa,OAAV,CACXb,SAAS,CAACc,KAAV,CAAgB;AACdC,IAAAA,QAAQ,EAAEf,SAAS,CAACgB,MADN;AAEdC,IAAAA,QAAQ,EAAEjB,SAAS,CAACgB,MAFN;AAGdV,IAAAA,IAAI,EAAEN,SAAS,CAACgB,MAHF;AAIdX,IAAAA,OAAO,EAAEL,SAAS,CAACY,KAAV,CAAgB,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,CAAhB;AAJK,GAAhB,CADW,CAlBQ;;AA0BrB;AACF;AACA;AACEN,EAAAA,IAAI,EAAEN,SAAS,CAACgB;AA7BK,CAAvB;AAgCA,eAAed,UAAf","sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport useStyles from \"./styles\";\n\nconst SimpleGrid = ({ children, breakpoints, spacing = \"sm\", cols, ...others }) => {\n const classes = useStyles({ breakpoints, cols, spacing })();\n return (\n <div className={classes.container} {...others}>\n {children}\n </div>\n );\n};\n\nSimpleGrid.propTypes = {\n /**\n * -\n */\n children: PropTypes.node,\n /**\n * Spacing with pre-defined values according the values defined in the theme\n */\n spacing: PropTypes.oneOf([\"sm\", \"md\", \"lg\", \"xl\"]),\n /**\n * Provide an array to define responsive behavior:\n *\n * maxWidth or minWidth: max-width or min-width at which media query will work\n *\n * cols: number of columns per row at given max-width\n *\n * spacing: optional spacing at given max-width, if not provided spacing from component prop will be used instead\n */\n breakpoints: PropTypes.arrayOf(\n PropTypes.shape({\n maxWidth: PropTypes.number,\n minWidth: PropTypes.number,\n cols: PropTypes.number,\n spacing: PropTypes.oneOf([\"sm\", \"md\", \"lg\", \"xl\"]),\n })\n ),\n /**\n * Number of how many columns the content will be displayed\n */\n cols: PropTypes.number,\n};\n\nexport default SimpleGrid;\n"],"file":"SimpleGrid.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/SimpleGrid/index.js"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,cAAxB","sourcesContent":["export { default } from \"./SimpleGrid\";\n"],"file":"index.js"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
+
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
+
|
|
8
|
+
import "core-js/modules/es.array.sort.js";
|
|
9
|
+
import "core-js/modules/es.object.to-string.js";
|
|
10
|
+
import "core-js/modules/es.array.concat.js";
|
|
11
|
+
import "core-js/modules/es.object.keys.js";
|
|
12
|
+
import "core-js/modules/es.symbol.js";
|
|
13
|
+
import "core-js/modules/es.array.filter.js";
|
|
14
|
+
import "core-js/modules/es.object.get-own-property-descriptor.js";
|
|
15
|
+
import "core-js/modules/web.dom-collections.for-each.js";
|
|
16
|
+
import "core-js/modules/es.object.get-own-property-descriptors.js";
|
|
17
|
+
import { makeStyles } from "@material-ui/core";
|
|
18
|
+
|
|
19
|
+
function size(props) {
|
|
20
|
+
if (typeof props.size === "number") {
|
|
21
|
+
return props.size;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return props.sizes[props.size] || props.size || props.sizes.md;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function getSortedBreakpoints(theme, breakpoints) {
|
|
28
|
+
if (breakpoints.length === 0) {
|
|
29
|
+
return breakpoints;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var property = "maxWidth" in breakpoints[0] ? "maxWidth" : "minWidth";
|
|
33
|
+
|
|
34
|
+
var sorted = _toConsumableArray(breakpoints).sort(function (a, b) {
|
|
35
|
+
return size({
|
|
36
|
+
size: b[property],
|
|
37
|
+
sizes: theme.breakpoints
|
|
38
|
+
}) - size({
|
|
39
|
+
size: a[property],
|
|
40
|
+
sizes: theme.breakpoints
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
return property === "minWidth" ? sorted.reverse() : sorted;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
var styles = function styles(props) {
|
|
48
|
+
return makeStyles(function (theme) {
|
|
49
|
+
var breakpoints = props.breakpoints,
|
|
50
|
+
spacing = props.spacing,
|
|
51
|
+
cols = props.cols;
|
|
52
|
+
var gridBreakpoints = null;
|
|
53
|
+
|
|
54
|
+
if (breakpoints) {
|
|
55
|
+
gridBreakpoints = getSortedBreakpoints(theme, breakpoints).reduce(function (acc, breakpoint) {
|
|
56
|
+
var property = "maxWidth" in breakpoint ? "max-width" : "min-width";
|
|
57
|
+
var breakpointSize = size({
|
|
58
|
+
size: property === "max-width" ? breakpoint.maxWidth : breakpoint.minWidth,
|
|
59
|
+
sizes: theme.breakpoints
|
|
60
|
+
});
|
|
61
|
+
acc["@media (".concat(property, ": ").concat(breakpointSize + (property === "max-width" ? 0 : 1), "px)")] = {
|
|
62
|
+
gridTemplateColumns: "repeat(".concat(breakpoint.cols, ", minmax(0, 1fr))"),
|
|
63
|
+
gap: theme.hv.spacing[spacing]
|
|
64
|
+
};
|
|
65
|
+
return acc;
|
|
66
|
+
}, {});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
container: _objectSpread({
|
|
71
|
+
boxSizing: "border-box",
|
|
72
|
+
display: "grid",
|
|
73
|
+
gridTemplateColumns: "repeat(".concat(cols, ", minmax(0, 1fr))"),
|
|
74
|
+
gap: theme.hv.spacing[spacing]
|
|
75
|
+
}, gridBreakpoints)
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export default styles;
|
|
81
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/SimpleGrid/styles.js"],"names":["makeStyles","size","props","sizes","md","getSortedBreakpoints","theme","breakpoints","length","property","sorted","sort","a","b","reverse","styles","spacing","cols","gridBreakpoints","reduce","acc","breakpoint","breakpointSize","maxWidth","minWidth","gridTemplateColumns","gap","hv","container","boxSizing","display"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAASA,UAAT,QAA2B,mBAA3B;;AAEA,SAASC,IAAT,CAAcC,KAAd,EAAqB;AACnB,MAAI,OAAOA,KAAK,CAACD,IAAb,KAAsB,QAA1B,EAAoC;AAClC,WAAOC,KAAK,CAACD,IAAb;AACD;;AAED,SAAOC,KAAK,CAACC,KAAN,CAAYD,KAAK,CAACD,IAAlB,KAA2BC,KAAK,CAACD,IAAjC,IAAyCC,KAAK,CAACC,KAAN,CAAYC,EAA5D;AACD;;AAED,SAASC,oBAAT,CAA8BC,KAA9B,EAAqCC,WAArC,EAAkD;AAChD,MAAIA,WAAW,CAACC,MAAZ,KAAuB,CAA3B,EAA8B;AAC5B,WAAOD,WAAP;AACD;;AAED,MAAME,QAAQ,GAAG,cAAcF,WAAW,CAAC,CAAD,CAAzB,GAA+B,UAA/B,GAA4C,UAA7D;;AACA,MAAMG,MAAM,GAAG,mBAAIH,WAAJ,EAAiBI,IAAjB,CACb,UAACC,CAAD,EAAIC,CAAJ;AAAA,WACEZ,IAAI,CAAC;AAAEA,MAAAA,IAAI,EAAEY,CAAC,CAACJ,QAAD,CAAT;AAAqBN,MAAAA,KAAK,EAAEG,KAAK,CAACC;AAAlC,KAAD,CAAJ,GACAN,IAAI,CAAC;AAAEA,MAAAA,IAAI,EAAEW,CAAC,CAACH,QAAD,CAAT;AAAqBN,MAAAA,KAAK,EAAEG,KAAK,CAACC;AAAlC,KAAD,CAFN;AAAA,GADa,CAAf;;AAMA,SAAOE,QAAQ,KAAK,UAAb,GAA0BC,MAAM,CAACI,OAAP,EAA1B,GAA6CJ,MAApD;AACD;;AAED,IAAMK,MAAM,GAAG,SAATA,MAAS,CAACb,KAAD;AAAA,SACbF,UAAU,CAAC,UAACM,KAAD,EAAW;AACpB,QAAQC,WAAR,GAAuCL,KAAvC,CAAQK,WAAR;AAAA,QAAqBS,OAArB,GAAuCd,KAAvC,CAAqBc,OAArB;AAAA,QAA8BC,IAA9B,GAAuCf,KAAvC,CAA8Be,IAA9B;AACA,QAAIC,eAAe,GAAG,IAAtB;;AACA,QAAIX,WAAJ,EAAiB;AACfW,MAAAA,eAAe,GAAGb,oBAAoB,CAACC,KAAD,EAAQC,WAAR,CAApB,CAAyCY,MAAzC,CAAgD,UAACC,GAAD,EAAMC,UAAN,EAAqB;AACrF,YAAMZ,QAAQ,GAAG,cAAcY,UAAd,GAA2B,WAA3B,GAAyC,WAA1D;AACA,YAAMC,cAAc,GAAGrB,IAAI,CAAC;AAC1BA,UAAAA,IAAI,EAAEQ,QAAQ,KAAK,WAAb,GAA2BY,UAAU,CAACE,QAAtC,GAAiDF,UAAU,CAACG,QADxC;AAE1BrB,UAAAA,KAAK,EAAEG,KAAK,CAACC;AAFa,SAAD,CAA3B;AAKAa,QAAAA,GAAG,mBAAYX,QAAZ,eAAyBa,cAAc,IAAIb,QAAQ,KAAK,WAAb,GAA2B,CAA3B,GAA+B,CAAnC,CAAvC,SAAH,GAAwF;AACtFgB,UAAAA,mBAAmB,mBAAYJ,UAAU,CAACJ,IAAvB,sBADmE;AAEtFS,UAAAA,GAAG,EAAEpB,KAAK,CAACqB,EAAN,CAASX,OAAT,CAAiBA,OAAjB;AAFiF,SAAxF;AAKA,eAAOI,GAAP;AACD,OAbiB,EAaf,EAbe,CAAlB;AAcD;;AAED,WAAO;AACLQ,MAAAA,SAAS;AACPC,QAAAA,SAAS,EAAE,YADJ;AAEPC,QAAAA,OAAO,EAAE,MAFF;AAGPL,QAAAA,mBAAmB,mBAAYR,IAAZ,sBAHZ;AAIPS,QAAAA,GAAG,EAAEpB,KAAK,CAACqB,EAAN,CAASX,OAAT,CAAiBA,OAAjB;AAJE,SAKJE,eALI;AADJ,KAAP;AASD,GA7BS,CADG;AAAA,CAAf;;AAgCA,eAAeH,MAAf","sourcesContent":["import { makeStyles } from \"@material-ui/core\";\n\nfunction size(props) {\n if (typeof props.size === \"number\") {\n return props.size;\n }\n\n return props.sizes[props.size] || props.size || props.sizes.md;\n}\n\nfunction getSortedBreakpoints(theme, breakpoints) {\n if (breakpoints.length === 0) {\n return breakpoints;\n }\n\n const property = \"maxWidth\" in breakpoints[0] ? \"maxWidth\" : \"minWidth\";\n const sorted = [...breakpoints].sort(\n (a, b) =>\n size({ size: b[property], sizes: theme.breakpoints }) -\n size({ size: a[property], sizes: theme.breakpoints })\n );\n\n return property === \"minWidth\" ? sorted.reverse() : sorted;\n}\n\nconst styles = (props) =>\n makeStyles((theme) => {\n const { breakpoints, spacing, cols } = props;\n let gridBreakpoints = null;\n if (breakpoints) {\n gridBreakpoints = getSortedBreakpoints(theme, breakpoints).reduce((acc, breakpoint) => {\n const property = \"maxWidth\" in breakpoint ? \"max-width\" : \"min-width\";\n const breakpointSize = size({\n size: property === \"max-width\" ? breakpoint.maxWidth : breakpoint.minWidth,\n sizes: theme.breakpoints,\n });\n\n acc[`@media (${property}: ${breakpointSize + (property === \"max-width\" ? 0 : 1)}px)`] = {\n gridTemplateColumns: `repeat(${breakpoint.cols}, minmax(0, 1fr))`,\n gap: theme.hv.spacing[spacing],\n };\n\n return acc;\n }, {});\n }\n\n return {\n container: {\n boxSizing: \"border-box\",\n display: \"grid\",\n gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))`,\n gap: theme.hv.spacing[spacing],\n ...gridBreakpoints,\n },\n };\n });\n\nexport default styles;\n"],"file":"styles.js"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import { DropUpXS as UpIcon, DropDownXS as DownIcon } from "@hitachivantara/uikit-react-icons";
|
|
6
|
+
import { HvToggleButton } from "../..";
|
|
7
|
+
import { PeriodPickerOptions } from "../enums";
|
|
8
|
+
|
|
9
|
+
var PeriodPicker = function PeriodPicker(props) {
|
|
10
|
+
var classes = props.classes,
|
|
11
|
+
period = props.period,
|
|
12
|
+
onChangePeriod = props.onChangePeriod;
|
|
13
|
+
|
|
14
|
+
var _useState = useState(period !== null && period !== void 0 ? period : PeriodPickerOptions.AM),
|
|
15
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
+
currentPeriod = _useState2[0],
|
|
17
|
+
setCurrentPeriod = _useState2[1];
|
|
18
|
+
/**
|
|
19
|
+
* Gets the new value for the period
|
|
20
|
+
* @returns the new value for the period
|
|
21
|
+
* @memberof UnitTimePicker
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var selectDifferentPeriod = function selectDifferentPeriod() {
|
|
26
|
+
return currentPeriod === PeriodPickerOptions.AM ? PeriodPickerOptions.PM : PeriodPickerOptions.AM;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Handles the period change
|
|
30
|
+
* @memberof PeriodPicker
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
var handleChangePeriod = function handleChangePeriod() {
|
|
35
|
+
var newPeriod = selectDifferentPeriod();
|
|
36
|
+
setCurrentPeriod(newPeriod);
|
|
37
|
+
onChangePeriod(newPeriod);
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Renders the PeriodPicker
|
|
41
|
+
* @memberof UnitTimePicker
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: classes.periodContainer
|
|
47
|
+
}, /*#__PURE__*/React.createElement(UpIcon, {
|
|
48
|
+
className: classes.icon,
|
|
49
|
+
onClick: handleChangePeriod
|
|
50
|
+
}), /*#__PURE__*/React.createElement(HvToggleButton, {
|
|
51
|
+
className: classes.periodToggle,
|
|
52
|
+
selected: currentPeriod === PeriodPickerOptions.PM,
|
|
53
|
+
onClick: handleChangePeriod
|
|
54
|
+
}, currentPeriod), /*#__PURE__*/React.createElement(DownIcon, {
|
|
55
|
+
className: clsx(classes.icon, classes.subtractIcon),
|
|
56
|
+
onClick: handleChangePeriod
|
|
57
|
+
}));
|
|
58
|
+
}; // }
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
process.env.NODE_ENV !== "production" ? PeriodPicker.propTypes = {
|
|
62
|
+
/**
|
|
63
|
+
* A Jss Object used to override or extend the styles applied to the input/popper
|
|
64
|
+
*/
|
|
65
|
+
classes: PropTypes.instanceOf(Object).isRequired,
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Callback function called when the period value changes
|
|
69
|
+
*/
|
|
70
|
+
onChangePeriod: PropTypes.func.isRequired,
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Default period value
|
|
74
|
+
*/
|
|
75
|
+
period: PropTypes.oneOf([PeriodPickerOptions.AM, PeriodPickerOptions.PM])
|
|
76
|
+
} : void 0;
|
|
77
|
+
export default PeriodPicker;
|
|
78
|
+
//# sourceMappingURL=PeriodPicker.js.map
|